xerus
a general purpose tensor library
xerus::internal::CholmodSparse Class Referencefinal

wrapper class for the cholmod sparse matrix objects More...

#include <cholmod_wrapper.h>

Collaboration diagram for xerus::internal::CholmodSparse:

Public Types

using ptr_type = std::unique_ptr< cholmod_sparse, std::function< void(cholmod_sparse *)> >
 

Public Member Functions

 CholmodSparse (cholmod_sparse *_matrix)
 stores the given cholmod_sparse object in this wrapper. NOTE: the object must have been created by the same thread that uses this constructor! More...
 
 CholmodSparse (const size_t _m, const size_t _n, const size_t _N)
 Creates a cholmod sparse matrix with given dimensions and number of entries. More...
 
 CholmodSparse (const std::map< size_t, double > &_input, const size_t _m, const size_t _n, const bool _transpose)
 Converts the given tensor to the cholmod sparse format using the given matrification. More...
 
CholmodSparse operator* (const CholmodSparse &_rhs) const
 Calculates the Matrix Matrix product with another sparse matrix. More...
 
std::map< size_t, double > to_map (double _alpha=1.0) const
 Transforms a cholmod sparse matrix to sparse Tensor format. More...
 
void transpose ()
 transposes the represented sparse matrix. More...
 

Static Public Member Functions

static std::tuple< std::map< size_t, double >, std::map< size_t, double >, size_t > cq (const std::map< size_t, double > &_A, const bool _transposeA, size_t _m, size_t _n, bool _fullrank)
 calculates the sparse CQ decomposition More...
 
static void matrix_matrix_product (std::map< size_t, double > &_C, const size_t _leftDim, const size_t _rightDim, const double _alpha, const std::map< size_t, double > &_A, const bool _transposeA, const size_t _midDim, const std::map< size_t, double > &_B, const bool _transposeB)
 Calculates the Matrix Matrix product between two sparse matrices. More...
 
static std::tuple< std::map< size_t, double >, std::map< size_t, double >, size_t > qc (const std::map< size_t, double > &_A, const bool _transposeA, size_t _m, size_t _n, bool _fullrank)
 calculates the sparse QR decomposition (or qc if fullrank = false) More...
 
static void solve_dense_rhs (double *_x, size_t _xDim, const std::map< size_t, double > &_A, const bool _transposeA, const double *_b, size_t _bDim)
 solve operator / for dense right hand sites More...
 
static void solve_sparse_rhs (std::map< size_t, double > &_x, size_t _xDim, const std::map< size_t, double > &_A, const bool _transposeA, const std::map< size_t, double > &_b, size_t _bDim)
 solve operator / for sparse right hand sites More...
 

Public Attributes

ptr_type matrix
 

Detailed Description

wrapper class for the cholmod sparse matrix objects

Definition at line 61 of file cholmod_wrapper.h.

Member Typedef Documentation

◆ ptr_type

using xerus::internal::CholmodSparse::ptr_type = std::unique_ptr<cholmod_sparse, std::function<void(cholmod_sparse*)> >

Definition at line 63 of file cholmod_wrapper.h.

Constructor & Destructor Documentation

◆ CholmodSparse() [1/3]

xerus::internal::CholmodSparse::CholmodSparse ( cholmod_sparse *  _matrix)

stores the given cholmod_sparse object in this wrapper. NOTE: the object must have been created by the same thread that uses this constructor!

Definition at line 85 of file cholmod_wrapper.cpp.

◆ CholmodSparse() [2/3]

xerus::internal::CholmodSparse::CholmodSparse ( const size_t  _m,
const size_t  _n,
const size_t  _N 
)

Creates a cholmod sparse matrix with given dimensions and number of entries.

Definition at line 88 of file cholmod_wrapper.cpp.

◆ CholmodSparse() [3/3]

xerus::internal::CholmodSparse::CholmodSparse ( const std::map< size_t, double > &  _input,
const size_t  _m,
const size_t  _n,
const bool  _transpose 
)

Converts the given tensor to the cholmod sparse format using the given matrification.

Note
input is supposed to be a _m by _n matrix _before transposition.

Definition at line 94 of file cholmod_wrapper.cpp.

Member Function Documentation

◆ cq()

std::tuple< std::map< size_t, double >, std::map< size_t, double >, size_t > xerus::internal::CholmodSparse::cq ( const std::map< size_t, double > &  _A,
const bool  _transposeA,
size_t  _m,
size_t  _n,
bool  _fullrank 
)
static

calculates the sparse CQ decomposition

Note
A is assumed to be a m by _n matrix _before transposition. Outputs are given in sparse format but usually not very sparse anymore...
Returns
(c, q, rank), rank = min(m,n) if fullrank was set to true

Definition at line 237 of file cholmod_wrapper.cpp.

◆ matrix_matrix_product()

void xerus::internal::CholmodSparse::matrix_matrix_product ( std::map< size_t, double > &  _C,
const size_t  _leftDim,
const size_t  _rightDim,
const double  _alpha,
const std::map< size_t, double > &  _A,
const bool  _transposeA,
const size_t  _midDim,
const std::map< size_t, double > &  _B,
const bool  _transposeB 
)
static

Calculates the Matrix Matrix product between two sparse matrices.

Definition at line 154 of file cholmod_wrapper.cpp.

◆ operator*()

CholmodSparse xerus::internal::CholmodSparse::operator* ( const CholmodSparse _rhs) const

Calculates the Matrix Matrix product with another sparse matrix.

Definition at line 143 of file cholmod_wrapper.cpp.

◆ qc()

std::tuple< std::map< size_t, double >, std::map< size_t, double >, size_t > xerus::internal::CholmodSparse::qc ( const std::map< size_t, double > &  _A,
const bool  _transposeA,
size_t  _m,
size_t  _n,
bool  _fullrank 
)
static

calculates the sparse QR decomposition (or qc if fullrank = false)

Note
A is assumed to be a m by _n matrix _before transposition. Outputs are given in sparse format but usually not very sparse anymore...
Returns
(q, c, rank), rank = min(m,n) if fullrank was set to true

Definition at line 213 of file cholmod_wrapper.cpp.

◆ solve_dense_rhs()

void xerus::internal::CholmodSparse::solve_dense_rhs ( double *  _x,
size_t  _xDim,
const std::map< size_t, double > &  _A,
const bool  _transposeA,
const double *  _b,
size_t  _bDim 
)
static

solve operator / for dense right hand sites

Definition at line 185 of file cholmod_wrapper.cpp.

◆ solve_sparse_rhs()

void xerus::internal::CholmodSparse::solve_sparse_rhs ( std::map< size_t, double > &  _x,
size_t  _xDim,
const std::map< size_t, double > &  _A,
const bool  _transposeA,
const std::map< size_t, double > &  _b,
size_t  _bDim 
)
static

solve operator / for sparse right hand sites

Definition at line 171 of file cholmod_wrapper.cpp.

◆ to_map()

std::map< size_t, double > xerus::internal::CholmodSparse::to_map ( double  _alpha = 1.0) const

Transforms a cholmod sparse matrix to sparse Tensor format.

Definition at line 128 of file cholmod_wrapper.cpp.

◆ transpose()

void xerus::internal::CholmodSparse::transpose ( )

transposes the represented sparse matrix.

Definition at line 147 of file cholmod_wrapper.cpp.

Member Data Documentation

◆ matrix

ptr_type xerus::internal::CholmodSparse::matrix

Definition at line 64 of file cholmod_wrapper.h.


The documentation for this class was generated from the following files: