AGX Dynamics  2.35.0.1
agx::MatrixType Class Reference

A class to distinguish between various types of matrices, both in terms of storage properties, i.e., dense or sparse, or lower or upper triangular in the case of symmetric matrices. More...

#include <MatrixTypes.h>

Public Types

enum  Storage { DENSE = 2 , UPPER_TRIANGLE = 4 , LOWER_TRIANGLE = 8 }
 How the matrix is stored. More...
 
enum  Type {
  GENERIC = 0 , SQUARE = 2 , SYMMETRIC = 4 , POSITIVE_DEFINITE = 8 ,
  SADDLE_POINT = 16
}
 The kind of matrix we are dealing with. More...
 

Public Member Functions

 MatrixType ()
 
 MatrixType (int type, int storage)
 
bool isDense () const
 
bool isGeneric () const
 
bool isLowerTriangle () const
 
bool isPositiveDefinite () const
 
bool isSaddlePoint () const
 
bool isSparse () const
 
bool isSquare () const
 
bool isSymmetric () const
 
bool isUpperTriangle () const
 
MatrixType & setDense (bool t=true)
 
MatrixType & setGeneric (bool t=true)
 
MatrixType & setLowerTriangle (bool t=true)
 
MatrixType & setPositiveDefinite (bool t=true)
 
MatrixType & setSaddlePoint (bool t=true)
 
MatrixType & setSparse (bool t=true)
 
MatrixType & setSquare (bool t=true)
 
MatrixType & setSymmetric (bool t=true)
 
MatrixType & setUpperTriangle (bool t=true)
 

Detailed Description

A class to distinguish between various types of matrices, both in terms of storage properties, i.e., dense or sparse, or lower or upper triangular in the case of symmetric matrices.

These storage types should include banded storage in the future.

The matrix type itself refers to mathematical properties, such as whether or not it is square, symmetric, positive definite, or a saddle point matrix.

The set functions here all take a boolean argument which defaults to true, and they return a reference to *this. This means that one can do things like t.setSaddlePoint().t.setPositiveDefinite(false).setDense(false).setUpperTriangle();

The MatrixType class holds little data and that is directly on the stack in any case. Thus, it is possible to create such objects on the fly inside constructors of matrices. For instance, one could do int n = 100; SparseMatrix m(n, MatrixType().setSaddlePoint().t.setPositiveDefinite(false).setDense(false).setUpperTriangle()); to get a square sparse matrix of saddle point type stored as upper triangle only. In this example, the default solver library would be used. The class SolverLibs is defined in another file because it is part of our own specific matrix library class hierarchy.

Definition at line 48 of file MatrixTypes.h.

Member Enumeration Documentation

◆ Storage

How the matrix is stored.

If not dense, then, it is sparse. Dense or sparse, it is possible that only upper or lower triangles are stores, as is the case for symmetric matrices.

Enumerator
DENSE 

The entire matrix is stored, or it is sparse.

UPPER_TRIANGLE 

Only upper triangle is stored, dense or sparse.

LOWER_TRIANGLE 

Only lower triangle is stored, dense or sparse.

Definition at line 56 of file MatrixTypes.h.

◆ Type

The kind of matrix we are dealing with.

Users of these classes are not to worry much about these enums since the inline methods below do the work.

Enumerator
GENERIC 

No special property.

SQUARE 
SYMMETRIC 

Symmetric matrices.

POSITIVE_DEFINITE 

Positive definite matrices.

SADDLE_POINT 

Saddle point matrices, which may be symmetric or not, and positive definite or not.

Definition at line 67 of file MatrixTypes.h.

Constructor & Destructor Documentation

◆ MatrixType() [1/2]

agx::MatrixType::MatrixType ( )
inline

Definition at line 77 of file MatrixTypes.h.

◆ MatrixType() [2/2]

agx::MatrixType::MatrixType ( int  type,
int  storage 
)
inline

Definition at line 80 of file MatrixTypes.h.

Member Function Documentation

◆ isDense()

bool agx::MatrixType::isDense ( ) const
inline

Definition at line 140 of file MatrixTypes.h.

References DENSE.

Referenced by isSparse().

◆ isGeneric()

bool agx::MatrixType::isGeneric ( ) const
inline

Definition at line 136 of file MatrixTypes.h.

References GENERIC.

◆ isLowerTriangle()

bool agx::MatrixType::isLowerTriangle ( ) const
inline

Definition at line 143 of file MatrixTypes.h.

References LOWER_TRIANGLE.

◆ isPositiveDefinite()

bool agx::MatrixType::isPositiveDefinite ( ) const
inline

Definition at line 137 of file MatrixTypes.h.

References POSITIVE_DEFINITE.

◆ isSaddlePoint()

bool agx::MatrixType::isSaddlePoint ( ) const
inline

Definition at line 138 of file MatrixTypes.h.

References SADDLE_POINT.

◆ isSparse()

bool agx::MatrixType::isSparse ( ) const
inline

Definition at line 141 of file MatrixTypes.h.

References isDense().

◆ isSquare()

bool agx::MatrixType::isSquare ( ) const
inline

Definition at line 144 of file MatrixTypes.h.

References SQUARE.

◆ isSymmetric()

bool agx::MatrixType::isSymmetric ( ) const
inline

Definition at line 139 of file MatrixTypes.h.

References SYMMETRIC.

◆ isUpperTriangle()

bool agx::MatrixType::isUpperTriangle ( ) const
inline

Definition at line 142 of file MatrixTypes.h.

References UPPER_TRIANGLE.

◆ setDense()

MatrixType& agx::MatrixType::setDense ( bool  t = true)
inline

Definition at line 114 of file MatrixTypes.h.

References DENSE.

Referenced by setSparse().

◆ setGeneric()

MatrixType& agx::MatrixType::setGeneric ( bool  t = true)
inline

Definition at line 109 of file MatrixTypes.h.

References GENERIC.

Referenced by setPositiveDefinite(), setSaddlePoint(), setSquare(), and setSymmetric().

◆ setLowerTriangle()

MatrixType& agx::MatrixType::setLowerTriangle ( bool  t = true)
inline

Definition at line 130 of file MatrixTypes.h.

References LOWER_TRIANGLE, and setSquare().

Referenced by setUpperTriangle().

◆ setPositiveDefinite()

MatrixType& agx::MatrixType::setPositiveDefinite ( bool  t = true)
inline

Definition at line 103 of file MatrixTypes.h.

References POSITIVE_DEFINITE, setGeneric(), and setSquare().

◆ setSaddlePoint()

MatrixType& agx::MatrixType::setSaddlePoint ( bool  t = true)
inline

Definition at line 97 of file MatrixTypes.h.

References SADDLE_POINT, setGeneric(), and setSquare().

◆ setSparse()

MatrixType& agx::MatrixType::setSparse ( bool  t = true)
inline

Definition at line 120 of file MatrixTypes.h.

References setDense().

◆ setSquare()

MatrixType& agx::MatrixType::setSquare ( bool  t = true)
inline

Definition at line 91 of file MatrixTypes.h.

References setGeneric(), and SQUARE.

Referenced by setLowerTriangle(), setPositiveDefinite(), and setSaddlePoint().

◆ setSymmetric()

MatrixType& agx::MatrixType::setSymmetric ( bool  t = true)
inline

Definition at line 85 of file MatrixTypes.h.

References setGeneric(), and SYMMETRIC.

◆ setUpperTriangle()

MatrixType& agx::MatrixType::setUpperTriangle ( bool  t = true)
inline

Definition at line 124 of file MatrixTypes.h.

References setLowerTriangle(), and UPPER_TRIANGLE.


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