5 #ifndef FML_CPU_UTILS_H 6 #define FML_CPU_UTILS_H 13 #include "../../_internals/linalgutils.hh" 15 #include "../internals/lapack.hh" 17 #include "../cpumat.hh" 22 template <
typename REAL>
28 const int blocksize = 8;
29 const len_t n = x.
nrows();
31 for (len_t j=0; j<n; j+=blocksize)
33 for (len_t i=j; i<n; i+=blocksize)
35 for (len_t col=j; col<j+blocksize && col<n; ++col)
37 for (len_t row=i; row<i+blocksize && row<n; ++row)
39 const bool check = samenum(x[col + n*row], x[row + n*col]);
51 template <
typename REAL>
55 throw std::runtime_error(
"non-square matrix");
57 const int blocksize = 8;
58 const len_t n = x.
nrows();
61 for (len_t j=0; j<n; j+=blocksize)
63 for (len_t i=j+1; i<n; i+=blocksize)
65 for (len_t col=j; col<j+blocksize && col<n; ++col)
67 for (len_t row=i; row<i+blocksize && row<n; ++row)
68 x_d[col + n*row] = x_d[row + n*col];
REAL * data_ptr()
Pointer to the internal array.
Definition: unimat.hh:34
bool is_square() const
Is the matrix square?
Definition: unimat.hh:28
len_t nrows() const
Number of rows.
Definition: unimat.hh:30
Matrix class for data held on a single CPU.
Definition: cpumat.hh:31