ConicBundle
Classes | Namespaces | Functions
symmat.hxx File Reference

Header declaring the class CH_Matrix_Classes::Symmatrix for symmetric matrices with Real elements. More...

#include "matrix.hxx"
#include "sparsmat.hxx"

Go to the source code of this file.

Classes

class  CH_Matrix_Classes::Symmatrix
 Matrix class of symmetric 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.
 

Functions

Matrix CH_Matrix_Classes::diag (const Symmatrix &A)
 returns a column vector v consisting of the elements v(i)=(*this)(i,i), 0<=i<row dimension
 
Symmatrix CH_Matrix_Classes::Diag (const Matrix &A)
 returns a symmetric diagonal matrix S of order A.dim() with vec(A) on the diagonal, i.e., S(i,i)=A(i) for all i and S(i,j)=0 for i!=j
 
Symmatrix & CH_Matrix_Classes::rankadd (const Matrix &A, Symmatrix &C, Real alpha=1., Real beta=0., int trans=0)
 returns C=beta*C+alpha* A*A^T, where A may be transposed. If beta==0. then C is initiliazed to the correct size.
 
Symmatrix & CH_Matrix_Classes::scaledrankadd (const Matrix &A, const Matrix &D, Symmatrix &C, Real alpha=1., Real beta=0., int trans=0)
 returns C=beta*C+alpha* A*D*A^T, where D is a vector representing a diagonal matrix and A may be transposed; if beta==0. then C is initialized to the correct size
 
Symmatrix & CH_Matrix_Classes::rank2add (const Matrix &A, const Matrix &B, Symmatrix &C, Real alpha=1., Real beta=0., int trans=0)
 returns C=beta*C+alpha*(A*B^T+B*A^T)/2 [or for transposed (A^T*B+B^T*A)/2]. If beta==0. then C is initiliazed to the correct size.
 
Matrix & CH_Matrix_Classes::genmult (const Symmatrix &A, const Matrix &B, Matrix &C, Real alpha, Real beta, 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 More...
 
Matrix & CH_Matrix_Classes::genmult (const Matrix &A, const Symmatrix &B, Matrix &C, Real alpha, Real beta, int atrans)
 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 Symmatrix &A, const Sparsemat &B, Matrix &C, Real alpha=1., Real beta=0., int btrans=0)
 returns C=beta*C+alpha*A*B, where B may be transposed; if beta==0. then C is initialized to the correct size
 
Matrix & CH_Matrix_Classes::genmult (const Sparsemat &A, const Symmatrix &B, Matrix &C, Real alpha=1., Real beta=0., int atrans=0)
 returns C=beta*C+alpha*A*B, where A may be transposed; if beta==0. then C is initialized to the correct size
 
Symmatrix & CH_Matrix_Classes::rankadd (const Sparsemat &A, Symmatrix &C, Real alpha=1., Real beta=0., int trans=0)
 returns C=beta*C+alpha* A*A^T, where A may be transposed; if beta==0. then C is initialized to the correct size
 
Symmatrix & CH_Matrix_Classes::scaledrankadd (const Sparsemat &A, const Matrix &D, Symmatrix &C, Real alpha=1., Real beta=0., int trans=0)
 returns C=beta*C+alpha* A*D*A^T, where D is a vector representing a diagonal matrix and A may be transposed; if beta==0. then C is initialized to the correct size
 
Symmatrix & CH_Matrix_Classes::rank2add (const Sparsemat &A, const Matrix &B, Symmatrix &C, Real alpha=1., Real beta=0., int trans=0)
 returns C=beta*C+alpha*(A*B^T+B*A^T)/2 [or for transposed (A^T*B+B^T*A)/2]. If beta==0. then C is initiliazed to the correct size.
 
Symmatrix CH_Matrix_Classes::abs (const Symmatrix &A)
 returns a Symmatrix with elements abs(A(i,j))
 
Real CH_Matrix_Classes::trace (const Symmatrix &A)
 returns the sum of the diagonal elements A(i,i) over all i
 
Real CH_Matrix_Classes::ip (const Symmatrix &A, const Symmatrix &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 Matrix &A, const Symmatrix &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 Symmatrix &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
 
Matrix CH_Matrix_Classes::sumrows (const Symmatrix &A)
 returns a row vector holding the sum over all rows, i.e., (1 1 ... 1)*A
 
Matrix CH_Matrix_Classes::sumcols (const Symmatrix &A)
 returns a column vector holding the sum over all columns, i.e., A*(1 1 ... 1)^T
 
Real CH_Matrix_Classes::sum (const Symmatrix &A)
 returns the sum over all elements of A, i.e., (1 1 ... 1)*A*(1 1 ... 1)^T
 
void CH_Matrix_Classes::svec (const Symmatrix &A, Matrix &sv, Real a=1., bool add=false, Integer startindex_vec=-1, Integer startindex_A=0, Integer blockdim=-1)
 the symmetric vec operator stacks the lower triangle of A to a n*(n+1)/2 vector with the same norm2 as A; here it sets svec(A)=[a11,sqrt(2)a12,...,sqrt(2)a1n,a22,...,sqrt(2)a(n-1,n),ann]', multiplies it by a and sets or adds (if add==true) it to v starting from startindex_vec possibly restricted to the subblock of order blockdim (whenever >=0, else blockdim is set to A.rowdim()-startindex_A) starting from startindex_A (must be >=0); if add==false and startindex_vec<0 then vec is also reinitialzed to the appropriate size
 
void CH_Matrix_Classes::sveci (const Matrix &sv, Symmatrix &A, Real a=1., bool add=false, Integer startindex_vec=0, Integer startindex_A=-1, Integer blockdim=-1)
 the inverse operator to svec, extracts from v at startindex_vec (>=0) the symmetric matrix of blockdim adding its mutliple by a into A starting at startindex_A; if add==false and startindex_A<0 A is initialized to the size of blockdim; if the latter is also negative then v.dim()-startindex_vec must match an exact order and matrix A is initialized to this size. In all other cases the size of the symmetric matrix determines the missing parameters and vec.dim-startindex_vec
 
void CH_Matrix_Classes::skron (const Symmatrix &A, const Symmatrix &B, Symmatrix &S, Real alpha=1., bool add=false, Integer startindex_S=-1)
 def symmetric Kronecker product (A skron B)svec(C)=(BCA'+ACB')/2; sets S=alpha*(A skron B) or S*=... (if add==true) possibly shifted to the block starting at startindex_S; if add==false and startindex_S<0, S is initialzed to the correct size
 
void CH_Matrix_Classes::symscale (const Symmatrix &A, const Matrix &B, Symmatrix &S, Real alpha=1., Real beta=0., int btrans=0)
 sets S=beta*S+alpha*B'*A*B for symmatrix A and matrix B
 
Matrix CH_Matrix_Classes::minrows (const Symmatrix &A)
 returns a row vector holding in each column the minimum over all rows in this column
 
Matrix CH_Matrix_Classes::mincols (const Symmatrix &A)
 returns a column vector holding in each row the minimum over all columns in this row
 
Real CH_Matrix_Classes::min (const Symmatrix &A)
 returns the minimum value over all elements of the matrix
 
Matrix CH_Matrix_Classes::maxrows (const Symmatrix &A)
 returns a row vector holding in each column the maximum over all rows in this column
 
Matrix CH_Matrix_Classes::maxcols (const Symmatrix &A)
 returns a column vector holding in each row the maximum over all columns in this row
 
Real CH_Matrix_Classes::max (const Symmatrix &A)
 returns the maximum value over all elements of the matrix
 
std::ostream & CH_Matrix_Classes::operator<< (std::ostream &o, const Symmatrix &A)
 output format (nr and nc are Integer values, all others Real values):
nr nc \n A(1,1) A(1,2) ... A(1,nc) \n A(2,1) ... A(nr,nc) \n
 
std::istream & CH_Matrix_Classes::operator>> (std::istream &i, Symmatrix &A)
 input format (nr and nc are Integer values, all others Real values):
nr nc \n A(1,1) A(1,2) ... A(1,nc) \n A(2,1) ... A(nr,nc) \n
 
void CH_Matrix_Classes::swap (Symmatrix &A, Symmatrix &B)
 swap the content of the two matrices A and B (involves no copying)
 
Symmatrix & CH_Matrix_Classes::xbpeya (Symmatrix &x, const Symmatrix &y, Real alpha=1., Real beta=0.)
 returns x= alpha*y+beta*x; if beta==0. then x is initialized to the correct size
 
Symmatrix & CH_Matrix_Classes::xeyapzb (Symmatrix &x, const Symmatrix &y, const Symmatrix &z, Real alpha=1., Real beta=1.)
 returns x= alpha*y+beta*z; x is initialized to the correct size
 
Matrix CH_Matrix_Classes::operator* (const Symmatrix &A, const Symmatrix &B)
 returns a Matrix that equals A*B
 
Symmatrix CH_Matrix_Classes::operator% (const Symmatrix &A, const Symmatrix &B)
 returns a Matrix that equals AB (where % is overloaded as elementwise multiplication) More...
 
Symmatrix CH_Matrix_Classes::operator+ (const Symmatrix &A, const Symmatrix &B)
 returns a Matrix that equals A+B
 
Symmatrix CH_Matrix_Classes::operator- (const Symmatrix &A, const Symmatrix &B)
 returns a Matrix that equals A-B
 
Matrix CH_Matrix_Classes::operator* (const Symmatrix &A, const Matrix &B)
 returns a Matrix that equals A*B
 
Matrix CH_Matrix_Classes::operator* (const Matrix &A, const Symmatrix &B)
 returns a Matrix that equals A*B
 
Matrix CH_Matrix_Classes::operator+ (const Symmatrix &A, const Matrix &B)
 returns a Matrix that equals A+B
 
Matrix CH_Matrix_Classes::operator+ (const Matrix &A, const Symmatrix &B)
 returns a Matrix that equals A+B
 
Matrix CH_Matrix_Classes::operator- (const Symmatrix &A, const Matrix &B)
 returns a Matrix that equals A-B
 
Matrix CH_Matrix_Classes::operator- (const Matrix &A, const Symmatrix &B)
 returns a Matrix that equals A-B
 
Symmatrix CH_Matrix_Classes::operator* (const Symmatrix &A, Real d)
 returns a Symmatrix that equals A*d
 
Symmatrix CH_Matrix_Classes::operator* (Real d, const Symmatrix &A)
 returns a Symmatrix that equals A*d
 
Symmatrix CH_Matrix_Classes::operator/ (const Symmatrix &A, Real d)
 returns a Symmatrix that equals A/d; ATTENTION: no check against division by zero
 
Symmatrix CH_Matrix_Classes::operator+ (const Symmatrix &A, Real d)
 returns a Symmatrix that equals A+d (d is added to each element) More...
 
Symmatrix CH_Matrix_Classes::operator+ (Real d, const Symmatrix &A)
 returns a Symmatrix that equals A+d (d is added to each element) More...
 
Symmatrix CH_Matrix_Classes::operator- (const Symmatrix &A, Real d)
 returns a Symmatrix that equals A-d (d is subtracted from each element) More...
 
Symmatrix CH_Matrix_Classes::operator- (Real d, const Symmatrix &A)
 returns a Symmatrix that equals d-A (each element subtracted from d) More...
 
Matrix CH_Matrix_Classes::svec (const Symmatrix &A)
 the symmetric vec operator, stacks the lower triangle of A to a n*(n+1)/2 vector with the same norm2 as A; i.e., it returns svec(A)=[a11,sqrt(2)a12,...,sqrt(2)a1n,a22,...,sqrt(2)a(n-1,n),ann]'
 
Symmatrix CH_Matrix_Classes::skron (const Symmatrix &A, const Symmatrix &B, Real alpha=1., bool add=false, Integer startindex_S=-1)
 the symmetric Kronecker product, defined via (A skron B)svec(C)=(BCA'+ACB')/2; sets or adds (if add==true) the symmetric matrix a*(A skron B) into S starting at startindex_S; if add==false and startindex_S<0, S is initialzed to the correct size
 
Real CH_Matrix_Classes::norm2 (const Symmatrix &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
 
Symmatrix CH_Matrix_Classes::transpose (const Symmatrix &A)
 returns a copy of A (drop it or use a constructor instead) More...
 

Detailed Description

Header declaring the class CH_Matrix_Classes::Symmatrix for symmetric matrices with Real elements.

Version
1.0
Date
2005-03-01
Author
Christoph Helmberg