// version 1.0.0 14Feb2018 // header file for MyMatrix class #include "stplugin.h" #define M(i,j) *(mat+(i)*c+j) class MyMatrix { private: ST_int r, c; ST_double *mat ; ST_int TotalSize ; public: ST_retcode rc ; // constructor MyMatrix(ST_int rows, ST_int cols) ; // destructor ~MyMatrix() ; // Return (i,j)th element inline ST_double GetValue(ST_int i, ST_int j) { return( M(i,j) ) ; } // Store val into (i,j)th element inline void StoreValue(ST_int i, ST_int j, ST_double val) { M(i,j) = val ; } // Increment (i,j)th element by val inline void IncrementByValue(ST_int i, ST_int j, ST_double val) { M(i,j) += val ; } // Divide each element by val void DivideByScalar(ST_double val) ; // Copy from class to Stata matrix smname ST_retcode CopyCtoStataMatrix(char *smname) ; // Return rows of matrix inline ST_int Rows() { return r; } // Return cols of matrix inline ST_int Cols() { return c ; } }; #undef M