Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120765527
matrix.hh
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
Sun, Jul 6, 21:45
Size
582 B
Mime Type
text/x-c++
Expires
Tue, Jul 8, 21:45 (2 d)
Engine
blob
Format
Raw Data
Handle
27221275
Attached To
R11201 phpc-2021
matrix.hh
View Options
#include <string>
#include <vector>
#ifndef __MATRIX_H_
#define __MATRIX_H_
class Matrix {
public:
Matrix(int m = 0, int n = 0) : m_m(m), m_n(n), m_a(m * n) {}
void resize(int m, int n) {
m_m = m;
m_n = n;
m_a.resize(m * n);
}
inline double & operator()(int i, int j) { return m_a[i * m_n + j]; }
inline int m() const { return m_m; }
inline int n() const { return m_n; }
inline double * data() { return m_a.data(); }
void read(const std::string & filename);
private:
int m_m{0};
int m_n{0};
std::vector<double> m_a;
};
#endif // __MATRIX_H_
Event Timeline
Log In to Comment