7 #ifndef TAPKEE_MATRIX_OPS_H_ 8 #define TAPKEE_MATRIX_OPS_H_ 14 #ifdef TAPKEE_WITH_VIENNACL 15 #define VIENNACL_HAVE_EIGEN 16 #include <viennacl/matrix.hpp> 17 #include <viennacl/vector.hpp> 18 #include <viennacl/linalg/prod.hpp> 23 namespace tapkee_internal
42 return solver.solve(operatee);
67 return solver.solve(operatee);
94 return _matrix.selfadjointView<Eigen::Upper>()*rhs;
122 return _matrix.selfadjointView<Eigen::Upper>()*(_matrix.selfadjointView<Eigen::Upper>()*rhs);
150 return _matrix*(_matrix.transpose()*rhs);
159 #ifdef TAPKEE_WITH_VIENNACL 160 struct GPUDenseImplicitSquareMatrixOperation
162 GPUDenseImplicitSquareMatrixOperation(
const DenseMatrix& matrix)
164 mat = viennacl::matrix<ScalarType>(matrix.cols(),matrix.rows());
165 vec = viennacl::vector<ScalarType>(matrix.cols());
166 res = viennacl::vector<ScalarType>(matrix.cols());
167 viennacl::copy(matrix,mat);
176 viennacl::copy(rhs,vec);
177 res = viennacl::linalg::prod(mat, vec);
179 res = viennacl::linalg::prod(mat, vec);
181 viennacl::copy(res,result);
184 viennacl::matrix<ScalarType> mat;
185 viennacl::vector<ScalarType> vec;
186 viennacl::vector<ScalarType> res;
190 const char* GPUDenseImplicitSquareMatrixOperation::ARPACK_CODE =
"LA";
191 const bool GPUDenseImplicitSquareMatrixOperation::largest =
true;
193 struct GPUDenseMatrixOperation
197 mat = viennacl::matrix<ScalarType>(matrix.cols(),matrix.rows());
198 vec = viennacl::vector<ScalarType>(matrix.cols());
199 res = viennacl::vector<ScalarType>(matrix.cols());
200 viennacl::copy(matrix,mat);
209 viennacl::copy(rhs,vec);
210 res = viennacl::linalg::prod(mat, vec);
212 viennacl::copy(res,result);
215 viennacl::matrix<ScalarType> mat;
216 viennacl::vector<ScalarType> vec;
217 viennacl::vector<ScalarType> res;
221 const char* GPUDenseMatrixOperation::ARPACK_CODE =
"LA";
222 const bool GPUDenseMatrixOperation::largest =
true;
DenseMatrixOperation(const DenseMatrix &matrix)
DenseInverseMatrixOperation(const DenseMatrix &matrix)
Matrix-matrix operation used to compute smallest eigenvalues and associated eigenvectors of a dense m...
SparseInverseMatrixOperation(const SparseWeightMatrix &matrix)
Eigen::Matrix< tapkee::ScalarType, Eigen::Dynamic, Eigen::Dynamic > DenseMatrix
dense matrix type (non-overridable)
DenseMatrix operator()(const DenseMatrix &operatee)
static const char * ARPACK_CODE
static const char * ARPACK_CODE
Matrix-matrix operation used to compute largest eigenvalues and associated eigenvectors of X*X^T like...
const DenseMatrix & _matrix
const DenseMatrix & _matrix
static const bool largest
Eigen::SparseMatrix< tapkee::ScalarType > SparseWeightMatrix
sparse weight matrix type (non-overridable)
DenseMatrix operator()(const DenseMatrix &operatee)
Eigen::Matrix< tapkee::ScalarType, Eigen::Dynamic, 1 > DenseVector
dense vector type (non-overridable)
static const char * ARPACK_CODE
Matrix-matrix operation used to compute smallest eigenvalues and associated eigenvectors of a sparse ...
const DenseMatrix & _matrix
Eigen::SimplicialLDLT< tapkee::SparseWeightMatrix > SparseSolver
DenseMatrix operator()(const DenseMatrix &rhs)
Computes matrix product of the matrix and provided right-hand side matrix twice.
static const bool largest
DenseImplicitSquareSymmetricMatrixOperation(const DenseMatrix &matrix)
DenseMatrix operator()(const DenseMatrix &rhs)
Computes matrix product of the matrix and provided right-hand side matrix.
static const bool largest
Matrix-matrix operation used to compute largest eigenvalues and associated eigenvectors of X*X^T like...
static const bool largest
Matrix-matrix operation used to compute largest eigenvalues and associated eigenvectors. Essentially computes matrix product with provided right-hand side part.
static const bool largest
Eigen::LDLT< tapkee::DenseMatrix > DenseSolver
dense solver (non-overridable)
DenseImplicitSquareMatrixOperation(const DenseMatrix &matrix)
static const char * ARPACK_CODE
DenseMatrix operator()(const DenseMatrix &rhs)
Computes matrix product of the matrix and provided right-hand side matrix twice.
static const char * ARPACK_CODE