FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

/* matrix.cpp file */ #include #include #include #include #include #include #include #include #include #include "matrix.h" #ifdef __NORMAL #else #include "module_external/blas_connector.h" #endif //********************************************************* // The init() function is the main initialization routine. // Sets up sizes and allocates memory for matrix class. // All constructors call init() // ******************************************************** //int matrix::mCount = 0; namespace ModuleBase { void matrixAlloc() { std::cerr create( m_in.nr, m_in.nc, false ); memcpy( c, m_in.c, nr*nc*sizeof(double) ); return *this; } // Peize Lin add 2016-08-05 matrix& matrix::operator=( matrix && m_in ) { nr = m_in.nr; nc = m_in.nc; if(c) delete[] c; c = m_in.c; m_in.nr = m_in.nc = 0; m_in.c = nullptr; return *this; } /* double & matrix::operator()(const int ir,const int ic) { assert(ir>=0); assert(ir=0); assert(ic=0); assert(ir=0); assert(ic zero_out(); } double trace_on(const matrix &A, const matrix &B) { assert(A.nr == B.nc); assert(A.nc == B.nr); double tr = 0.0; for (int i = 0; i < A.nr; ++i) for (int k = 0; k < A.nc; ++k) tr += A(i,k) * B(k, i); return tr; } double mdot(const matrix &A, const matrix &B) { assert (A.nr == B.nr); assert (A.nc == B.nc); const int size = A.nr * A.nc; double sum = 0.0; for (int i = 0; i < size; ++i) sum += A.c[i] * B.c[i]; return sum; } /* // Peize Lin add 2016-09-08 std::ostream & operator

Back | FazBrowse Home | New Git URL