![]() |
planc
Parallel Lowrank Approximation with Non-negativity Constraints
|
#include <ncpfactors.hpp>
Public Member Functions | |
NCPFactors (const UVEC &i_dimensions, const int &i_k, bool trans) | |
constructor that takes the dimensions of every mode, low rank k All the factors will be initialized with random uniform number More... | |
~NCPFactors () | |
int | rank () const |
returns low rank More... | |
UVEC | dimensions () const |
dimensions of every mode More... | |
MAT & | factor (const int i_n) const |
factor matrix of a mode i_n More... | |
int | modes () const |
returns number of modes More... | |
VEC | lambda () const |
returns the lambda vector More... | |
void | set (const int i_n, const MAT &i_factor) |
Set the mode i_n with the given factor matrix. More... | |
void | set_lambda (const VEC &new_lambda) |
sets the lambda vector More... | |
void | gram (MAT *o_UtU) |
Return the hadamard of the factor grams. More... | |
void | gram_leave_out_one (const unsigned int i_n, MAT *o_UtU) |
Returns the hadamard of the factor grams except i_n. More... | |
MAT | krp_leave_out_one (const unsigned int i_n) |
KRP leaving out the mode i_n. More... | |
void | krp_leave_out_one (const unsigned int i_n, MAT *o_krp) |
khatrirao leaving out one. More... | |
void | krp (const UVEC i_modes, MAT *o_krp) |
KRP of the given vector of modes. More... | |
void | rankk_tensor (Tensor &out) |
Construct the rank k tensor out of the factor matrices Determine the KRP of the n-1 modes leaving out 0 and multiply with the mode 0 factor matrix. More... | |
void | printinfo () |
prints just the information about the factors. More... | |
void | print () |
prints the entire NCPFactors including the factor matrices More... | |
void | print (const unsigned int i_n) |
print the ith factor matrix alone More... | |
void | trans (NCPFactors &factor_t) |
Transposes the entire factor matrix. More... | |
void | normalize () |
only during initialization. Reset's all lambda. More... | |
void | normalize (int mode) |
Column normalizes the factor matrix of the given mode and replaces the existing lambda. More... | |
void | normalize_rows (unsigned int mode) |
Row normalizes the factor matrix of the given mode and replaces the existing lambda. More... | |
void | randu (const int i_seed) |
initializes the local tensor with the given seed. More... | |
void | zeros () |
this is for reinitializing zeros across different processors. More... | |
Definition at line 22 of file ncpfactors.hpp.
|
inline |
constructor that takes the dimensions of every mode, low rank k All the factors will be initialized with random uniform number
[in] | vector | of dimension for every mode. |
[in] | low | rank |
[in] | trans. | takes true or false. Transposes every factor. |
Definition at line 41 of file ncpfactors.hpp.
|
inline |
Definition at line 84 of file ncpfactors.hpp.
|
inline |
dimensions of every mode
Definition at line 98 of file ncpfactors.hpp.
|
inline |
factor matrix of a mode i_n
Definition at line 100 of file ncpfactors.hpp.
|
inline |
Return the hadamard of the factor grams.
[out] | UtU | is a kxk matrix |
Definition at line 123 of file ncpfactors.hpp.
|
inline |
Returns the hadamard of the factor grams except i_n.
[in] | i_n | ith mode that will be excluded in the factor grams |
[out] | UtU | is a kxk matrix |
Definition at line 139 of file ncpfactors.hpp.
KRP of the given vector of modes.
It can be any subset of the modes.
[in] | Subset | of modes |
[out] | KRP | of product of dimensions of the given modes by k |
Definition at line 239 of file ncpfactors.hpp.
|
inline |
KRP leaving out the mode i_n.
[in] | mode | i_n |
Definition at line 154 of file ncpfactors.hpp.
|
inline |
khatrirao leaving out one.
we are using the implementation from tensor toolbox. Always krp for mttkrp is computed in reverse. Hence assuming the same. The order of the computation is same a tensor tool box. size of krp must be product of all dimensions leaving out nxk
[in] | i_n | mode that will be excluded |
[out] | m_dimensions[i_n]xk |
Definition at line 171 of file ncpfactors.hpp.
|
inline |
returns the lambda vector
Definition at line 104 of file ncpfactors.hpp.
|
inline |
returns number of modes
Definition at line 102 of file ncpfactors.hpp.
|
inline |
only during initialization. Reset's all lambda.
Definition at line 329 of file ncpfactors.hpp.
|
inline |
Column normalizes the factor matrix of the given mode and replaces the existing lambda.
[in] | mode | of the factor matrix that will be column normalized |
Definition at line 346 of file ncpfactors.hpp.
|
inline |
Row normalizes the factor matrix of the given mode and replaces the existing lambda.
[in] | mode | of the factor matrix that will be row normalized |
Definition at line 358 of file ncpfactors.hpp.
|
inline |
prints the entire NCPFactors including the factor matrices
Definition at line 302 of file ncpfactors.hpp.
|
inline |
print the ith factor matrix alone
[in] | i_n | the mode for which the factor matrix to be printed |
Definition at line 314 of file ncpfactors.hpp.
|
inline |
prints just the information about the factors.
it will NOT print the factor
Definition at line 296 of file ncpfactors.hpp.
|
inline |
initializes the local tensor with the given seed.
this is for reinitializing random numbers across different processors.
[in] | i_seed |
Definition at line 371 of file ncpfactors.hpp.
|
inline |
returns low rank
Definition at line 96 of file ncpfactors.hpp.
|
inline |
Construct the rank k tensor out of the factor matrices Determine the KRP of the n-1 modes leaving out 0 and multiply with the mode 0 factor matrix.
[out] | Rank-k | tensor |
Definition at line 282 of file ncpfactors.hpp.
|
inline |
Set the mode i_n with the given factor matrix.
[in] | i_n | mode for which given factor matrix will be updated |
[in] | i_factor | factor matrix |
Definition at line 112 of file ncpfactors.hpp.
|
inline |
sets the lambda vector
Definition at line 117 of file ncpfactors.hpp.
|
inline |
Transposes the entire factor matrix.
[out] | factor_t | that contains the transpose of every factor matrix. |
Definition at line 323 of file ncpfactors.hpp.
|
inline |
this is for reinitializing zeros across different processors.
Definition at line 382 of file ncpfactors.hpp.