13 #ifndef __SGMATRIX_H__ 14 #define __SGMATRIX_H__ 22 template <
class,
int,
int,
int,
int,
int>
class Matrix;
24 template <
class,
int,
class>
class Map;
29 template<
class T>
class SGVector;
33 template<
class T>
class SGMatrix :
public SGReferencedData
55 num_rows(nrows), num_cols(ncols) { }
60 #ifndef SWIG // SWIG should skip this part 61 #if defined(HAVE_CXX0X) || defined(HAVE_CXX11) 64 template <
typename ST>
using container_type =
SGMatrix<ST>;
66 #endif // define (HAVE_CXX0X) || defined(HAVE_CXX11) 100 operator EigenMatrixXtMap()
const;
101 #endif // HAVE_EIGEN3 110 #ifndef SWIG // SWIG should skip this part 117 const int64_t c = col;
118 return &matrix[c*num_rows];
140 const int64_t c = i_col;
141 return matrix[c*num_rows + i_row];
149 return matrix[index];
158 const int64_t c = i_col;
159 return matrix[c*num_rows + i_row];
167 return matrix[index];
189 const uint64_t c=num_cols;
205 void set_const(T const_elem);
228 static T* clone_matrix(
const T* matrix, int32_t nrows, int32_t ncols);
231 static void transpose_matrix(
232 T*& matrix, int32_t& num_feat, int32_t& num_vec);
235 static void create_diagonal_matrix(T* matrix, T* v,int32_t size);
263 static double* compute_eigenvectors(
double* matrix,
int n,
int m);
275 void compute_few_eigenvectors(
double* matrix_,
double*& eigenvalues,
double*& eigenvectors,
276 int n,
int il,
int iu);
288 bool transpose_A=
false,
bool transpose_B=
false,
298 float64_t* matrix, int32_t rows, int32_t cols,
305 float64_t* mat, int32_t cols, int32_t rows);
308 static T* get_row_sum(T* matrix, int32_t m, int32_t n);
311 static T* get_column_sum(T* matrix, int32_t m, int32_t n);
317 static void center_matrix(T* matrix, int32_t m, int32_t n);
320 void remove_column_mean();
323 void display_matrix(
const char* name=
"matrix")
const;
326 static void display_matrix(
327 const T* matrix, int32_t rows, int32_t cols,
328 const char* name=
"matrix",
const char* prefix=
"");
331 static void display_matrix(
332 const SGMatrix<T> matrix,
const char* name=
"matrix",
333 const char* prefix=
"");
353 void load(
CFile* loader);
359 void save(
CFile* saver);
360 #endif // #ifndef SWIG // SWIG should skip this part 367 virtual void init_data();
370 virtual void free_data();
381 #endif // __SGMATRIX_H__ T & operator[](index_t index)
SGMatrix(T *m, index_t nrows, index_t ncols, index_t offset)
shogun reference count managed data
A File access base class.
const T & operator[](index_t index) const
const T & operator()(index_t i_row, index_t i_col) const
all of classes and functions are contained in the shogun namespace
void scale(Matrix A, Matrix B, typename Matrix::Scalar alpha)
T & operator()(index_t i_row, index_t i_col)
T * get_column_vector(index_t col) const