Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F64092460
matrix.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, May 24, 13:12
Size
414 B
Mime Type
text/x-c
Expires
Sun, May 26, 13:12 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17854610
Attached To
R12662 PHPC-graded_hw_1
matrix.cc
View Options
#include "matrix.hh"
#include "matrix_coo.hh"
#include <iostream>
#include <string>
#include <cassert>
void Matrix::read(const std::string & fn) {
MatrixCOO mat;
mat.read(fn);
resize(mat.m(), mat.n());
for (int z = 0; z < mat.nz(); ++z) {
auto i = mat.irn[z];
auto j = mat.jcn[z];
auto a = mat.a[z];
m_a[i * m_n + j] = a;
if (mat.is_sym()) {
m_a[j * m_n + i] = a;
}
}
}
Event Timeline
Log In to Comment