ConicBundle
Classes | Namespaces | Macros | Functions
sparsmat.hxx File Reference

Header declaring the class CH_Matrix_Classes::Sparsemat for sparse matrices with Real elements. More...

#include "symmat.hxx"
#include "sparssym.hxx"

Go to the source code of this file.

Classes

class  CH_Matrix_Classes::Sparsemat
 Matrix class of sparse matrices with real values of type Real More...
 

Namespaces

 CH_Matrix_Classes
 Matrix Classes and Linear Algebra. See Matrix Classes (namespace CH_Matrix_Classes) for a quick introduction.
 

Macros

#define SPARSE_ZERO_TOL   1e-60
 if the absolute value of an element is below this value, it is considered zero
 

Functions

void CH_Matrix_Classes::swap (Sparsemat &A, Sparsemat &B)
 swap the content of the two sparse matrices A and B (involves no copying)
 
Sparsemat & CH_Matrix_Classes::xbpeya (Sparsemat &x, const Sparsemat &y, Real alpha=1., Real beta=0., int ytrans=0)
 returns x= alpha*y+beta*x, where y may be transposed (ytrans=1); if beta==0. then x is initialized to the correct size
 
Matrix & CH_Matrix_Classes::genmult (const Sparsemat &A, const Matrix &B, Matrix &C, Real alpha, Real beta, int atrans, int btrans)
 returns C=beta*C+alpha*A*B, where A and B may be transposed; C must not be equal to A and B; if beta==0. then C is initialized to the correct size
 
Matrix & CH_Matrix_Classes::genmult (const Matrix &A, const Sparsemat &B, Matrix &C, Real alpha, Real beta, int atrans, int btrans)
 returns C=beta*C+alpha*A*B, where A and B may be transposed; C must not be equal to A and B; if beta==0. then C is initialized to the correct size
 
Matrix & CH_Matrix_Classes::genmult (const Sparsemat &A, const Sparsemat &B, Matrix &C, Real alpha=1., Real beta=0., int atrans=0, int btrans=0)
 returns C=beta*C+alpha*A*B, where A and B may be transposed; C must not be equal to A and B; if beta==0. then C is initialized to the correct size
 
Sparsemat CH_Matrix_Classes::operator* (const Sparsemat &A, const Sparsemat &B)
 returns a Sparsemat equal to A*B
 
Matrix & CH_Matrix_Classes::genmult (const Sparsesym &A, const Sparsemat &B, Matrix &C, Real alpha=1., Real beta=0., int btrans=0)
 returns C=beta*C+alpha*A*B, where A and B may be transposed; C must not be equal to A and B; if beta==0. then C is initialized to the correct size More...
 
Matrix & CH_Matrix_Classes::genmult (const Sparsemat &A, const Sparsesym &B, Matrix &C, Real alpha=1., Real beta=0., int atrans=0)
 returns C=beta*C+alpha*A*B, where A and B may be transposed; C must not be equal to A and B; if beta==0. then C is initialized to the correct size More...
 
Sparsemat CH_Matrix_Classes::abs (const Sparsemat &A)
 returns a Sparsmat with elements abs((*this)(i,j)) for all i,j
 
Real CH_Matrix_Classes::trace (const Sparsemat &A)
 returns the sum of the diagonal elements A(i,i) over all i
 
Real CH_Matrix_Classes::ip (const Sparsemat &A, const Sparsemat &B)
 returns the usual inner product of A and B, i.e., the sum of A(i,j)*B(i,j) over all i,j
 
Real CH_Matrix_Classes::ip (const Sparsemat &A, const Matrix &B)
 returns the usual inner product of A and B, i.e., the sum of A(i,j)*B(i,j) over all i,j
 
Real CH_Matrix_Classes::colip (const Sparsemat &A, Integer j, const Matrix *scaling=0)
 returns the squared Frobenius norm of col i of A, i.e., the sum of A(i,j)*A(i,j) over all i with possibly (if scaling!=0) each term i multiplied by (*scaling)(i)
 
Real CH_Matrix_Classes::rowip (const Sparsemat &A, Integer i, const Matrix *scaling=0)
 returns the squared Frobenius norm of row i of A, i.e., the sum of A(i,j)*A(i,j) over all j with possibly (if scaling!=0) each term j multiplied by (*scaling)(j)
 
Sparsemat CH_Matrix_Classes::colsip (const Sparsemat &A, const Matrix *colscaling=0)
 returns the row vector of the squared Frobenius norm of all columns j of A, i.e., the sum of A(i,j)*A(i,j) over all i for each j with possibly (if scaling!=0) each term i multiplied by (*scaling)(i) More...
 
Sparsemat CH_Matrix_Classes::rowsip (const Sparsemat &A, const Matrix *rowscaling=0)
 returns the column vector of the squared Frobenius norm of all rows i of A, i.e., the sum of A(i,j)*A(i,j) over all j for each i with possibly (if scaling!=0) each term j multiplied by (*scaling)(j) More...
 
Matrix CH_Matrix_Classes::sumrows (const Sparsemat &A)
 returns a row vector holding the sum over all rows, i.e., (1 1 ... 1)*A
 
Matrix CH_Matrix_Classes::sumcols (const Sparsemat &A)
 returns a column vector holding the sum over all columns, i.e., A*(1 1 ... 1)^T
 
std::ostream & CH_Matrix_Classes::operator<< (std::ostream &o, const Sparsemat &v)
 output format: nr nc nz \n i1 j1 val1\n i2 j2 val2\n ... inz jnz valnz\n
 
std::istream & CH_Matrix_Classes::operator>> (std::istream &i, Sparsemat &v)
 input format: nr nc nz \n i1 j1 val1\n i2 j2 val2\n ... inz jnz valnz\n
 
Sparsemat CH_Matrix_Classes::concat_right (const Sparsemat &A, const Sparsemat &B)
 returns a new sparse matrix [A, B], i.e., it concats matrices A and B rowwise; A or B may be a 0x0 matrix
 
Sparsemat CH_Matrix_Classes::concat_below (const Sparsemat &A, const Sparsemat &B)
 returns a new sparse matrix [A; B], i.e., it concats matrices A and B columnwise; A or B may be a 0x0 matrix
 
Real CH_Matrix_Classes::norm2 (const Sparsemat &A)
 returns the Frobenius norm of A, i.e., the square root of the sum of A(i,j)*A(i,j) over all i,j
 
Sparsemat CH_Matrix_Classes::operator+ (const Sparsemat &A, const Sparsemat &B)
 returns a Sparsemat equal to A+B
 
Sparsemat CH_Matrix_Classes::operator- (const Sparsemat &A, const Sparsemat &B)
 returns a Sparsemat equal to A-B
 
Sparsemat CH_Matrix_Classes::operator* (const Sparsemat &A, Real d)
 returns a Sparsemat equal to A*d
 
Sparsemat CH_Matrix_Classes::operator* (Real d, const Sparsemat &A)
 returns a Sparsemat equal to d*A
 
Sparsemat CH_Matrix_Classes::operator/ (const Sparsemat &A, Real d)
 returns a Sparsemat equal to A/d; ATTENTION: no check against division by zero More...
 
Matrix CH_Matrix_Classes::operator* (const Sparsemat &A, const Matrix &B)
 returns a Matrix equal to A*B
 
Matrix CH_Matrix_Classes::operator* (const Matrix &A, const Sparsemat &B)
 returns a Matrix equal to A*B
 
Matrix CH_Matrix_Classes::operator+ (const Sparsemat &A, const Matrix &B)
 returns a Matrix equal to A+B
 
Matrix CH_Matrix_Classes::operator+ (const Matrix &A, const Sparsemat &B)
 returns a Matrix equal to A+B
 
Matrix CH_Matrix_Classes::operator- (const Sparsemat &A, const Matrix &B)
 returns a Matrix equal to A-B
 
Matrix CH_Matrix_Classes::operator- (const Matrix &A, const Sparsemat &B)
 returns a Matrix equal to A-B
 
Real CH_Matrix_Classes::ip (const Matrix &A, const Sparsemat &B)
 returns the usual inner product of A and B, i.e., the sum of A(i,j)*B(i,j) over all i,j
 
Real CH_Matrix_Classes::sum (const Sparsemat &A)
 returns the sum over all elements of A, i.e., (1 1 ... 1)*A*(1 1 ... 1)^T
 
Sparsemat CH_Matrix_Classes::transpose (const Sparsemat &A)
 returns a Sparsemat that is the transpose of A
 
Equal (Members)
int CH_Matrix_Classes::equal (const Sparsemat &A, const Sparsemat &B, Real eqtol=1e-10)
 returns 1 if both matrices are identical, 0 otherwise
 

Detailed Description

Header declaring the class CH_Matrix_Classes::Sparsemat for sparse matrices with Real elements.

Version
1.0
Date
2005-03-01
Author
Christoph Helmberg