Class xlifepp::HMatrixNode#

template<typename T, typename I>
class HMatrixNode#

Inheritence diagram for xlifepp::HMatrixNode:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "3" [label="xlifepp::HMatrixNode< complex_t, I >" tooltip="xlifepp::HMatrixNode< complex_t, I >"] "7" [label="xlifepp::HMatrixNode< complex_t, xlifepp::FeDof >" tooltip="xlifepp::HMatrixNode< complex_t, xlifepp::FeDof >"] "2" [label="xlifepp::HMatrixNode< real_t, I >" tooltip="xlifepp::HMatrixNode< real_t, I >"] "6" [label="xlifepp::HMatrixNode< real_t, xlifepp::FeDof >" tooltip="xlifepp::HMatrixNode< real_t, xlifepp::FeDof >"] "5" [label="xlifepp::HMatrixNode< xlifepp::Matrix< complex_t >, I >" tooltip="xlifepp::HMatrixNode< xlifepp::Matrix< complex_t >, I >"] "9" [label="xlifepp::HMatrixNode< xlifepp::Matrix< complex_t >, xlifepp::FeDof >" tooltip="xlifepp::HMatrixNode< xlifepp::Matrix< complex_t >, xlifepp::FeDof >"] "4" [label="xlifepp::HMatrixNode< xlifepp::Matrix< real_t >, I >" tooltip="xlifepp::HMatrixNode< xlifepp::Matrix< real_t >, I >"] "8" [label="xlifepp::HMatrixNode< xlifepp::Matrix< real_t >, xlifepp::FeDof >" tooltip="xlifepp::HMatrixNode< xlifepp::Matrix< real_t >, xlifepp::FeDof >"] "1" [label="xlifepp::HMatrixNode< T, I >" tooltip="xlifepp::HMatrixNode< T, I >" fillcolor="#BFBFBF"] "3" -> "1" [dir=forward tooltip="template-instance"] "7" -> "1" [dir=forward tooltip="template-instance"] "2" -> "1" [dir=forward tooltip="template-instance"] "6" -> "1" [dir=forward tooltip="template-instance"] "5" -> "1" [dir=forward tooltip="template-instance"] "9" -> "1" [dir=forward tooltip="template-instance"] "4" -> "1" [dir=forward tooltip="template-instance"] "8" -> "1" [dir=forward tooltip="template-instance"] }

Collaboration diagram for xlifepp::HMatrixNode:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "2" [label="xlifepp::ClusterNode< I >" tooltip="xlifepp::ClusterNode< I >"] "12" [label="std::list< xlifepp::ClusterNode< I > * >" tooltip="std::list< xlifepp::ClusterNode< I > * >"] "9" [label="std::list< xlifepp::ClusterNode< T > * >" tooltip="std::list< xlifepp::ClusterNode< T > * >"] "10" [label="std::list< T >" tooltip="std::list< T >"] "4" [label="std::vector< T >" tooltip="std::vector< T >"] "3" [label="std::vector< I >" tooltip="std::vector< I >"] "8" [label="std::vector< RealPair >" tooltip="std::vector< RealPair >"] "6" [label="std::vector< number_t >" tooltip="std::vector< number_t >"] "11" [label="std::vector< xlifepp::Element * >" tooltip="std::vector< xlifepp::Element * >"] "7" [label="xlifepp::BoundingBox" tooltip="xlifepp::BoundingBox"] "5" [label="xlifepp::ClusterNode< T >" tooltip="xlifepp::ClusterNode< T >"] "1" [label="xlifepp::HMatrixNode< T, I >" tooltip="xlifepp::HMatrixNode< T, I >" fillcolor="#BFBFBF"] "2" -> "3" [dir=forward tooltip="usage"] "2" -> "5" [dir=forward tooltip="usage"] "2" -> "6" [dir=forward tooltip="usage"] "2" -> "7" [dir=forward tooltip="usage"] "2" -> "12" [dir=forward tooltip="usage"] "2" -> "11" [dir=forward tooltip="usage"] "2" -> "5" [dir=forward tooltip="template-instance"] "12" -> "10" [dir=forward tooltip="template-instance"] "9" -> "10" [dir=forward tooltip="template-instance"] "3" -> "4" [dir=forward tooltip="template-instance"] "8" -> "4" [dir=forward tooltip="template-instance"] "6" -> "4" [dir=forward tooltip="template-instance"] "11" -> "4" [dir=forward tooltip="template-instance"] "7" -> "8" [dir=forward tooltip="usage"] "5" -> "5" [dir=forward tooltip="usage"] "5" -> "6" [dir=forward tooltip="usage"] "5" -> "7" [dir=forward tooltip="usage"] "5" -> "9" [dir=forward tooltip="usage"] "5" -> "11" [dir=forward tooltip="usage"] "1" -> "2" [dir=forward tooltip="usage"] }

describes a node of hierarchical representation of matrix

Public Functions

inline HMatrixNode()#

default constructor

inline HMatrixNode(ApproximateMatrix<T> *am, HMatrixNode<T, I> *pa, number_t d)#

ApproximateMatrix leaf constructor.

HMatrixNode(const HMatrixNode<T, I>&)#

copy constructor (full copy except ClusterNode pointers)

inline HMatrixNode(HMatrixNode<T, I> *pa, HMatrixNode<T, I> *ch, HMatrixNode<T, I> *ne, number_t d, ClusterNode<I> *rcn, ClusterNode<I> *ccn, number_t rs, number_t cs, LargeMatrix<T> *m, ApproximateMatrix<T> *am)#

full constructor

inline HMatrixNode(HMatrixNode<T, I> *pa, number_t d)#

node constructor

inline HMatrixNode(LargeMatrix<T> *m, HMatrixNode<T, I> *pa, number_t d)#

LargeMatrix leaf constructor.

HMatrixNode<T, I> *child(number_t d = 1)#

access to child at depth d

std::vector<HMatrixNode<T, I>*> childsMatrix(number_t&, number_t&) const#

all child pointers as a matrix of HMatrixNode pointers, row access storage

void clear()#

clear all except ClusterNode pointers

void clearMatrices()#

clear (deallocate) only matrices

void copy(const HMatrixNode<T, I>&)#

copy all (full copy), do not clear

inline dimPair dimValues() const#

return dimensions of values, (1,1) when scalar

void divide(number_t rmin, number_t cmin, number_t maxdepth = 0, HMAdmissibilityRule admRule = _boxesRule, bool sym = false)#

split node according to a splitting rule

void getLeaves(std::list<HMatrixNode<T, I>*>&, bool = true) const#

get leaves as a list

void lowerLeftSolve(HMatrixNode<T, I> &B) const#

solve X*L=B, L the lower triangular part of current part

solve X*L = B where L is the lower triangular part of the current node, assuming it is factorized as LU in B: right hand side node out B: solution node same as Lt*X = Bt (upper algorithm)

void lowerSolve(HMatrixNode<T, I> &B) const#

solve L*X=B, L the lower triangular part of current part

solve L*X = B where L is the lower triangular part of the current node, assuming it is factorized as LU in B: right hand side node out B: solution node

void lu()#

LU factorization.

perform LU factorization of the current Hmatrix node as follows if the node is a LargeMatrix leaf perform LU standard LU factorization if the node is an ApproximateMatrix leaf perform LU factorization on the decompressed matrix, leading to a LU LargeMatrix (should not be handled!) | A11 A12 … A1n| if the node is the block HMatrix, say H= | A21 A22 … A2n|, row access HMatrix | … … … …| | An1 An2 … Ann| perform the block LU factorization for k=1,n LU factorization of Akk for i = k+1,n upper solve Lik*Ukk=Aik for j = k+1,n lower solve Lkk*Ukj = Akj for i = k+1,n for j = k+1,n Aij-=Lik*Ukj

when bisection clustering is used, n=2, so the algorithm does k=1 : A11=L11*U11, L21*U11=A21 -> L21, L11*U12=A12 -> U12, A22-=L21*U12 k=2 : A22 = L22*U22

Note

at the end the node contains the virtual LU factorization

void multMatrixAdd(HMatrixNode<T, I>&, HMatrixNode<T, I>&, T c = T(1.))#

perform += c*A*B with a complex algorithm regarding the structure of current HMatrixNode and HMatrixNode A, B current, A and B nodes must be consistent, not checked here! indeed HMatrixNode’s may be a hierarchical node, an ApproximateMatrix (LowRankMatrix) or a dense LargeMatrix

  • current node is a hierarchical matrix . A or B is not a hierarchical matrix, create hierarchical representation of A or B (A.toHierarchical(…)) . A,B nodes are hierarchical matrix -> do a block product going down

  • current node is a LargeMatrix (dense) . if A and B are not hierarchical do the operation L+=c*LA*LB or L+=c*LA*ApB or L+=c*ApA*LB or L+=c*ApA*ApB . if A or B is a hierarchical matrix, move A and B to LargeMatrix and do L+=c*LA*LB

  • current node is an ApproximateMatrix (LowRankMatrix) . if A and B are LargeMatrix, move current to LargeMatrix and do operation, then return to ApproximateMatrix . if A or B is a ApproximateMatrix, compute A*B as an approximate matrix then combine +=c*Ab using ApproximateMatrix summation . if A or B is a Hierarchical matrix, move all matrices to hierarchical representation, then return to ApproximateMatrix

std::vector<T> &multMatrixVector(const std::vector<T>&, std::vector<T>&, SymType symt = _noSymmetry) const#

matrix vector product (recursive)

std::vector<T> &multMatrixVectorNode(const std::vector<T>&, std::vector<T>&, SymType symt = _noSymmetry) const#

matrix vector product for a leaf

number_t nbNonZero() const#

number of T coefficients used to represent the matrix node

real_t norm2() const#

Frobenius norm.

real_t norminfty() const#

infinite norm

number_t numberOfChilds() const#

return the number of childs

inline number_t numberOfCols() const#

return number of columns counted in T

inline number_t numberOfRows() const#

return number of rows counted in T

HMatrixNode<T, I> &operator=(const HMatrixNode<T, I>&)#

assign operator (full copy except ClusterNode pointers)

void print(std::ostream&) const#

print tree from current node

void printNode(std::ostream&, bool = true) const#

print current node contents

void printStructure(std::ostream&, number_t, number_t, bool all = false, bool shift = false) const#

print matrix node structure

void setClusterCol(ClusterNode<I>*)#

update col cluster node pointers (recursive)

void setClusterRow(ClusterNode<I>*)#

update row cluster node pointers (recursive)

void toApproximateMatrix(MatrixApproximationType = _lowRankApproximation, number_t rank = 0, real_t eps = theTolerance)#

move to ApproximateMatrix

void toHierarchical(number_t depth = 1)#

move to hierarchical representation up to the given depth

move to hierarchical representation down to the given depth d go down to depth d, splitting any HMatrixNode that are either a Largematrix or an ApproximateMatrix if current node is a hierarchic matrix nothing is done if current node is a LargeMatrix, then split in LargeMatrix if current node is an ApproximateMatrix, then split in ApproximateMatrix

void toLargeMatrix(StorageType st = _dense, AccessType at = _row)#

move to LargeMatrix using the given storage

move to LargeMatrix representation

void upperLeftSolve(HMatrixNode<T, I> &B) const#

solve X*U=B, U the upper triangular part of current part

solve X*U = B where U is the upper triangular part of the current node, assuming it factorized as LU in B: right hand side node out B: solution node

void upperSolve(HMatrixNode<T, I> &B) const#

solve U*X=B, U the upper triangular part of current part

solve U*X = B where U is the upper triangular part of the current node, assuming it is factorized as LU in B: right hand side node out B: solution node

Public Members

bool admissible_#

block can be approximated

ApproximateMatrix<T> *appmat_#

pointer to an ApproximateMatrix

HMatrixNode<T, I> *child_#

pointer to its first child, if 0 no child

ClusterNode<I> *colNode_#

column cluster node to access to col numbering

number_t colSub_#

sub block numbering (1,1), (1,2), (2,1) or (2,2)

number_t depth_#

depth of node/leaf in tree, root has 0 depth

FactorizationType factorization_#

one of _noFactorization, _lu, _ldlt, _ldlstar

bool isDiag_#

boolean flag telling if matrix node is located on the diagonal

LargeMatrix<T> *mat_#

pointer to a LargeMatrix

HMatrixNode<T, I> *next_#

pointer to its brother, if 0 no brother

HMatrixNode<T, I> *parent_#

pointer to its parent, if 0 root node

ClusterNode<I> *rowNode_#

row cluster node to access to row numbering

Public Static Functions

static inline void initCounter(number_t n = 0)#

init the counter and enable it

static inline void stopCounter()#

disable counter

Public Static Attributes

static number_t counter = 0#

to count the number of call of operations

static bool counterOn = false#

flag to activate the counting of some operations (default: false)