Public 成员函数 | |
SGMatrix () | |
SGMatrix (bool ref_counting) | |
SGMatrix (T *m, index_t nrows, index_t ncols, bool ref_counting=true) | |
SGMatrix (index_t nrows, index_t ncols, bool ref_counting=true) | |
SGMatrix (const SGMatrix &orig) | |
virtual | ~SGMatrix () |
T * | get_column_vector (index_t col) const |
SGVector< T > | get_row_vector (index_t row) const |
SGVector< T > | get_diagonal_vector () const |
const T & | operator() (index_t i_row, index_t i_col) const |
const T & | operator[] (index_t index) const |
T & | operator() (index_t i_row, index_t i_col) |
T & | operator[] (index_t index) |
SGMatrix< T > | get () |
bool | operator== (SGMatrix< T > &other) |
bool | equals (SGMatrix< T > &other) |
void | set_const (T const_elem) |
void | zero () |
bool | is_symmetric () |
T | max_single () |
SGMatrix< T > | clone () |
void | compute_few_eigenvectors (double *matrix_, double *&eigenvalues, double *&eigenvectors, int n, int il, int iu) |
void | center () |
void | remove_column_mean () |
void | display_matrix (const char *name="matrix") const |
void | load (CFile *loader) |
void | save (CFile *saver) |
template<> | |
void | zero () |
template<> | |
bool | is_symmetric () |
template<> | |
bool | is_symmetric () |
template<> | |
bool | is_symmetric () |
template<> | |
bool | is_symmetric () |
template<> | |
complex128_t | max_single () |
template<> | |
void | display_matrix (const bool *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const char *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const int8_t *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const uint8_t *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const int16_t *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const uint16_t *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const int32_t *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const uint32_t *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const int64_t *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const uint64_t *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const float32_t *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const float64_t *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const floatmax_t *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
void | display_matrix (const complex128_t *matrix, int32_t rows, int32_t cols, const char *name, const char *prefix) |
template<> | |
SGMatrix< char > | create_identity_matrix (index_t size, char scale) |
template<> | |
SGMatrix< int8_t > | create_identity_matrix (index_t size, int8_t scale) |
template<> | |
SGMatrix< uint8_t > | create_identity_matrix (index_t size, uint8_t scale) |
template<> | |
SGMatrix< bool > | create_identity_matrix (index_t size, bool scale) |
template<> | |
SGMatrix< int16_t > | create_identity_matrix (index_t size, int16_t scale) |
template<> | |
SGMatrix< uint16_t > | create_identity_matrix (index_t size, uint16_t scale) |
template<> | |
SGMatrix< int32_t > | create_identity_matrix (index_t size, int32_t scale) |
template<> | |
SGMatrix< uint32_t > | create_identity_matrix (index_t size, uint32_t scale) |
template<> | |
SGMatrix< int64_t > | create_identity_matrix (index_t size, int64_t scale) |
template<> | |
SGMatrix< uint64_t > | create_identity_matrix (index_t size, uint64_t scale) |
template<> | |
SGMatrix< float32_t > | create_identity_matrix (index_t size, float32_t scale) |
template<> | |
SGMatrix< float64_t > | create_identity_matrix (index_t size, float64_t scale) |
template<> | |
SGMatrix< floatmax_t > | create_identity_matrix (index_t size, floatmax_t scale) |
template<> | |
SGMatrix< complex128_t > | create_identity_matrix (index_t size, complex128_t scale) |
template<> | |
void | load (CFile *loader) |
template<> | |
void | save (CFile *saver) |
int32_t | ref_count () |
静态 Public 成员函数 | |
static T * | clone_matrix (const T *matrix, int32_t nrows, int32_t ncols) |
static void | transpose_matrix (T *&matrix, int32_t &num_feat, int32_t &num_vec) |
static void | create_diagonal_matrix (T *matrix, T *v, int32_t size) |
static SGMatrix< T > | create_identity_matrix (index_t size, T scale) |
static SGVector< float64_t > | compute_eigenvectors (SGMatrix< float64_t > matrix) |
static double * | compute_eigenvectors (double *matrix, int n, int m) |
static SGMatrix< float64_t > | matrix_multiply (SGMatrix< float64_t > A, SGMatrix< float64_t > B, bool transpose_A=false, bool transpose_B=false, float64_t scale=1.0) |
static void | inverse (SGMatrix< float64_t > matrix) |
inverses square matrix in-place 更多... | |
static float64_t * | pinv (float64_t *matrix, int32_t rows, int32_t cols, float64_t *target=NULL) |
static float64_t | trace (float64_t *mat, int32_t cols, int32_t rows) |
static T * | get_row_sum (T *matrix, int32_t m, int32_t n) |
static T * | get_column_sum (T *matrix, int32_t m, int32_t n) |
static void | center_matrix (T *matrix, int32_t m, int32_t n) |
static void | display_matrix (const T *matrix, int32_t rows, int32_t cols, const char *name="matrix", const char *prefix="") |
static void | display_matrix (const SGMatrix< T > matrix, const char *name="matrix", const char *prefix="") |
static SGMatrix< T > | get_allocated_matrix (index_t num_rows, index_t num_cols, SGMatrix< T > pre_allocated=SGMatrix< T >()) |
Public 属性 | |
T * | matrix |
index_t | num_rows |
index_t | num_cols |
Protected 成员函数 | |
virtual void | copy_data (const SGReferencedData &orig) |
virtual void | init_data () |
virtual void | free_data () |
void | copy_refcount (const SGReferencedData &orig) |
int32_t | ref () |
int32_t | unref () |
SGMatrix | ( | ) |
default constructor
在文件 SGMatrix.cpp 第 26 行定义.
SGMatrix | ( | bool | ref_counting | ) |
constructor for setting reference counting while not creating the matrix in memory (use this for static SGMatrix instances)
在文件 SGMatrix.cpp 第 32 行定义.
constructor for setting params
在文件 SGMatrix.cpp 第 38 行定义.
constructor to create new matrix in memory
在文件 SGMatrix.cpp 第 43 行定义.
copy constructor
在文件 SGMatrix.cpp 第 50 行定义.
|
virtual |
empty destructor
在文件 SGMatrix.cpp 第 56 行定义.
void center | ( | ) |
Centers the matrix, i.e. removes column/row mean from columns/rows
在文件 SGMatrix.cpp 第 302 行定义.
|
static |
Centers matrix (e.g. kernel matrix in feature space INPLACE
在文件 SGMatrix.cpp 第 308 行定义.
SGMatrix< T > clone | ( | ) |
clone matrix
在文件 SGMatrix.cpp 第 216 行定义.
|
static |
clone matrix
在文件 SGMatrix.cpp 第 223 行定义.
compute eigenvalues and eigenvectors of symmetric matrix using LAPACK
matrix | symmetric matrix to compute eigenproblem. Is overwritten and contains orthonormal eigenvectors afterwards |
在文件 SGMatrix.cpp 第 851 行定义.
|
static |
compute eigenvalues and eigenvectors of symmetric matrix
matrix | overwritten and contains n orthonormal eigenvectors |
n | |
m |
在文件 SGMatrix.cpp 第 868 行定义.
void compute_few_eigenvectors | ( | double * | matrix_, |
double *& | eigenvalues, | ||
double *& | eigenvectors, | ||
int | n, | ||
int | il, | ||
int | iu | ||
) |
compute few eigenpairs of a symmetric matrix using LAPACK DSYEVR method (Relatively Robust Representations). Has at least O(n^3/3) complexity
matrix_ | symmetric matrix |
eigenvalues | contains iu-il+1 eigenvalues in ascending order (to be free'd) |
eigenvectors | contains iu-il+1 orthonormal eigenvectors of given matrix column-wise (to be free'd) |
n | dimension of matrix |
il | low index of requested eigenpairs (1<=il<=n) |
iu | high index of requested eigenpairs (1<=il<=iu<=n) |
在文件 SGMatrix.cpp 第 890 行定义.
|
protectedvirtual |
|
protectedinherited |
copy refcount
在文件 SGReferencedData.cpp 第 55 行定义.
|
static |
create diagonal matrix
在文件 SGMatrix.cpp 第 251 行定义.
returns the identity matrix, scaled by a factor
size | size of square identity matrix |
scale | (optional) scaling factor |
在文件 SGMatrix.cpp 第 616 行定义.
在文件 SGMatrix.cpp 第 623 行定义.
在文件 SGMatrix.cpp 第 636 行定义.
在文件 SGMatrix.cpp 第 649 行定义.
在文件 SGMatrix.cpp 第 662 行定义.
在文件 SGMatrix.cpp 第 675 行定义.
在文件 SGMatrix.cpp 第 688 行定义.
在文件 SGMatrix.cpp 第 701 行定义.
在文件 SGMatrix.cpp 第 714 行定义.
在文件 SGMatrix.cpp 第 727 行定义.
在文件 SGMatrix.cpp 第 740 行定义.
在文件 SGMatrix.cpp 第 753 行定义.
SGMatrix< floatmax_t > create_identity_matrix | ( | index_t | size, |
floatmax_t | scale | ||
) |
在文件 SGMatrix.cpp 第 766 行定义.
SGMatrix< complex128_t > create_identity_matrix | ( | index_t | size, |
complex128_t | scale | ||
) |
在文件 SGMatrix.cpp 第 779 行定义.
void display_matrix | ( | const char * | name = "matrix" | ) | const |
display matrix
在文件 SGMatrix.cpp 第 350 行定义.
|
static |
display matrix (useful for debugging)
|
static |
display matrix
在文件 SGMatrix.cpp 第 356 行定义.
void display_matrix | ( | const bool * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 364 行定义.
void display_matrix | ( | const char * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 382 行定义.
void display_matrix | ( | const int8_t * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 400 行定义.
void display_matrix | ( | const uint8_t * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 418 行定义.
void display_matrix | ( | const int16_t * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 436 行定义.
void display_matrix | ( | const uint16_t * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 454 行定义.
void display_matrix | ( | const int32_t * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 473 行定义.
void display_matrix | ( | const uint32_t * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 491 行定义.
void display_matrix | ( | const int64_t * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 508 行定义.
void display_matrix | ( | const uint64_t * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 526 行定义.
void display_matrix | ( | const float32_t * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 544 行定义.
void display_matrix | ( | const float64_t * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 562 行定义.
void display_matrix | ( | const floatmax_t * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 580 行定义.
void display_matrix | ( | const complex128_t * | matrix, |
int32_t | rows, | ||
int32_t | cols, | ||
const char * | name, | ||
const char * | prefix | ||
) |
在文件 SGMatrix.cpp 第 598 行定义.
bool equals | ( | SGMatrix< T > & | other | ) |
operator overload for element-wise matrix comparison. Note that only numerical data is compared
other | matrix to compare with |
在文件 SGMatrix.cpp 第 74 行定义.
|
protectedvirtual |
SGMatrix<T> get | ( | ) |
|
static |
Simple helper method that returns a matrix with allocated memory for a given size. A pre_allocated one can optionally be specified in order to use that. Basically just for having dimension check encapsulated.
num_rows | rows of returned matrix |
num_cols | columns of returned matrix |
pre_allocated | optional matrix that is returned instead of new matrix. Make sure dimensions match |
在文件 SGMatrix.cpp 第 953 行定义.
|
static |
sums up all columns of a matrix and returns the resulting columnvector
在文件 SGMatrix.cpp 第 289 行定义.
T* get_column_vector | ( | index_t | col | ) | const |
SGVector< T > get_diagonal_vector | ( | ) | const |
get a main diagonal vector. Matrix is not required to be square.
在文件 SGMatrix.cpp 第 1055 行定义.
|
static |
sums up all rows of a matrix and returns the resulting rowvector
在文件 SGMatrix.cpp 第 276 行定义.
|
protectedvirtual |
bool is_symmetric | ( | ) |
在文件 SGMatrix.cpp 第 126 行定义.
bool is_symmetric | ( | ) |
Checks whether the matrix is symmetric or not. The equality check is performed using '==' operators for discrete types (int, char, bool) and using CMath::fequals method for floating types (float, double, long double, std::complex<double>) with default espilon values from std::numeric_limits
在文件 SGMatrix.cpp 第 110 行定义.
bool is_symmetric | ( | ) |
在文件 SGMatrix.cpp 第 143 行定义.
bool is_symmetric | ( | ) |
在文件 SGMatrix.cpp 第 160 行定义.
bool is_symmetric | ( | ) |
在文件 SGMatrix.cpp 第 177 行定义.
void load | ( | CFile * | loader | ) |
void load | ( | CFile * | loader | ) |
在文件 SGMatrix.cpp 第 1023 行定义.
|
static |
Computes scale* A*B, where A and B may be transposed. Asserts for matching inner dimensions.
A | matrix A |
transpose_A | optional whether A should be transposed before |
B | matrix B |
transpose_B | optional whether B should be transposed before |
scale | optional scaling factor for result |
在文件 SGMatrix.cpp 第 903 行定义.
T max_single | ( | ) |
returns the maximum single element of the matrix
在文件 SGMatrix.cpp 第 196 行定义.
complex128_t max_single | ( | ) |
在文件 SGMatrix.cpp 第 209 行定义.
bool operator== | ( | SGMatrix< T > & | other | ) |
check for pointer identity
在文件 SGMatrix.cpp 第 62 行定义.
const T& operator[] | ( | index_t | index | ) | const |
T& operator[] | ( | index_t | index | ) |
|
static |
return the pseudo inverse for matrix when matrix has shape (rows, cols) the pseudo inverse has (cols, rows)
在文件 SGMatrix.cpp 第 802 行定义.
|
protectedinherited |
|
inherited |
void remove_column_mean | ( | ) |
remove column mean
在文件 SGMatrix.cpp 第 333 行定义.
void save | ( | CFile * | saver | ) |
void save | ( | CFile * | saver | ) |
在文件 SGMatrix.cpp 第 1038 行定义.
void set_const | ( | T | const_elem | ) |
set matrix to a constant
在文件 SGMatrix.cpp 第 89 行定义.
compute trace
在文件 SGMatrix.cpp 第 266 行定义.
|
static |
transpose matrix
在文件 SGMatrix.cpp 第 233 行定义.
|
protectedinherited |
decrement reference counter and deallocate object if refcount is zero before or after decrementing it
在文件 SGReferencedData.cpp 第 84 行定义.
void zero | ( | ) |
在文件 SGMatrix.cpp 第 103 行定义.
void zero | ( | ) |
fill matrix with zeros
在文件 SGMatrix.cpp 第 96 行定义.
T* matrix |
matrix
在文件 SGMatrix.h 第 296 行定义.
index_t num_cols |
number of columns of matrix
在文件 SGMatrix.h 第 300 行定义.
index_t num_rows |
number of rows of matrix
在文件 SGMatrix.h 第 298 行定义.