#ifndef RTS_MATRIX_H #define RTS_MATRIX_H //#include "rts/vector.h" #include #include #include #include namespace stim{ template struct matrix { //the matrix will be stored in column-major order (compatible with OpenGL) T M[N*N]; CUDA_CALLABLE matrix() { for(int r=0; r set(T rhs[N*N]) { memcpy(M, rhs, sizeof(T)*N*N); return *this; } CUDA_CALLABLE T& operator()(int row, int col) { return M[col * N + row]; } CUDA_CALLABLE matrix operator=(T rhs) { int Nsq = N*N; for(int i=0; i CUDA_CALLABLE vec operator*(vec rhs) { unsigned int N = rhs.size(); vec result; result.resize(N); for(int r=0; r std::ostream& operator<<(std::ostream& os, stim::matrix M) { os< 3 && __GNUC_MINOR__ > 7 //template using rtsMatrix = rts::matrix; //#endif #endif