![]() |
CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
|
The dense matrix class. More...

Constructors | |
| XxMatrix () | |
| Default constructor. | |
| XxMatrix (int_t nr, int_t nc, const Property &pr=Property::General()) | |
| Dimension constructor. | |
| XxMatrix (int_t nr, int_t nc, T_Scalar *vals, int_t ldv, bool bind, const Property &pr=Property::General()) | |
| Auxiliary constructor. | |
| XxMatrix (const XxMatrix< T_Scalar > &other) | |
| Copy constructor. | |
| XxMatrix (XxMatrix< T_Scalar > &&other) | |
| Move constructor. | |
| ~XxMatrix () | |
| Destructor. | |
Operators | |
| XxMatrix< T_Scalar > & | operator= (const XxMatrix< T_Scalar > &other) |
| Copy assignment operator. | |
| XxMatrix< T_Scalar > & | operator= (XxMatrix< T_Scalar > &&other) |
| Move assignment operator. | |
| T_Scalar & | operator() (int_t i, int_t j) |
| Element access operator. | |
| const T_Scalar & | operator() (int_t i, int_t j) const |
| Element access operator. | |
| alias::VirtualScal_dns< T_Scalar > | operator- () const |
| Unary negation operator. | |
| void | operator= (T_Scalar val) |
| Fill operator. | |
Arguments | |
| int_t | ld () const |
| Get the leading dimension. | |
Public Member Functions | |
| void | clear () |
| Clear the matrix. | |
| void | fill (T_Scalar val) |
| Fill all elements with a value. | |
| XxMatrix< T_Scalar > | copy () const |
| Create a deep copy of the matrix. | |
| XxMatrix< T_Scalar > | rcopy () |
| Create a reference copy (shallow copy) of the matrix. | |
| Guard< XxMatrix< T_Scalar > > | rcopy () const |
| Create a guarded reference copy (shallow copy) of the matrix. | |
| XxMatrix< T_Scalar > | move () |
| Move the matrix's resources. | |
| alias::VirtualStrided_vec< T_Scalar > | diag () |
| Access the diagonal of the matrix. | |
| alias::GuardedStrided_vec< T_Scalar > | diag () const |
| Access the diagonal of the matrix (const). | |
| std::string | info (const std::string &header="") const |
| Get information about the matrix. | |
| void | print (std::streamsize prec=0) const |
| Print the matrix to standard output. | |
| void | toStream (std::ostream &os, std::streamsize prec=0) const |
| Output the matrix to a stream. | |
| void | iscale (T_Scalar val) |
| Scale the matrix in-place. | |
| alias::VirtualTrans_dns< T_Scalar > | transpose () const |
| Transpose the matrix. | |
| alias::VirtualTrans_dns< T_Scalar > | ctranspose () const |
| Conjugate transpose the matrix. | |
| alias::VirtualConj_dns< T_Scalar > | conjugate () const |
| Compute the complex conjugate. | |
| void | iconjugate () |
| Conjugate the matrix in-place. | |
| T_RScalar | normOne () const |
| Compute the 1-norm. | |
| T_RScalar | normInf () const |
| Compute the infinity norm. | |
| T_RScalar | normMax () const |
| Compute the maximum norm. | |
| T_RScalar | normFro () const |
| Compute the Frobenius norm. | |
| XxMatrix< T_Scalar > | general () const |
| Convert to general matrix. | |
| void | igeneral () |
| Convert to general matrix in-place. | |
| XxMatrix< T_Scalar > | permuteLeftRight (const prm::PxMatrix< int_t > &P, const prm::PxMatrix< int_t > &Q) const |
| Permute rows and columns. | |
| void | permuteLeftRight (const prm::PxMatrix< int_t > &P, const prm::PxMatrix< int_t > &Q, XxMatrix< T_Scalar > &dest) const |
| Permute rows and columns into a destination. | |
| XxMatrix< T_Scalar > | permuteLeft (const prm::PxMatrix< int_t > &P) const |
| Permute rows. | |
| void | permuteLeft (const prm::PxMatrix< int_t > &P, XxMatrix< T_Scalar > &dest) const |
| Permute rows into a destination. | |
| XxMatrix< T_Scalar > | permuteRight (const prm::PxMatrix< int_t > &Q) const |
| Permute columns. | |
| void | permuteRight (const prm::PxMatrix< int_t > &Q, XxMatrix< T_Scalar > &dest) const |
| Permute columns into a destination. | |
| XxMatrix< T_Scalar > | permuteMirror (const prm::PxMatrix< int_t > &P) const |
| Permute rows and columns symmetrically. | |
| void | permuteMirror (const prm::PxMatrix< int_t > &P, XxMatrix< T_Scalar > &dest) const |
| Permute rows and columns symmetrically into a destination. | |
| XxMatrix< T_Scalar > | block (int_t ibgn, int_t jbgn, int_t ni, int_t nj) const |
| Extract a block as a new matrix. | |
| XxMatrix< T_Scalar > | rblock (int_t ibgn, int_t jbgn, int_t ni, int_t nj) |
| Extract a reference block. | |
| Guard< XxMatrix< T_Scalar > > | rblock (int_t ibgn, int_t jbgn, int_t ni, int_t nj) const |
| Extract a guarded reference block. | |
| void | setBlock (int_t ibgn, int_t jbgn, const XxMatrix< T_Scalar > &src) |
| Set a block of elements. | |
| XxVector< T_Scalar > | column (int_t j) const |
| Extract a column as a new vector. | |
| XxVector< T_Scalar > | rcolumn (int_t j) |
| Extract a column as a reference. | |
| Guard< XxVector< T_Scalar > > | rcolumn (int_t j) const |
| Extract a column as a guarded reference. | |
| XxMatrix< T_Scalar > | row (int_t i) const |
| Extract a row as a new matrix. | |
| XxMatrix< T_Scalar > | rrow (int_t i) |
| Extract a row as a reference. | |
| Guard< XxMatrix< T_Scalar > > | rrow (int_t i) const |
| Extract a row as a guarded reference. | |
| VirtualRowvec< T_Scalar > | rrowvec (int_t i) const |
| Extract a row as a virtual row vector. | |
Creators/Generators | |
| static XxMatrix< T_Scalar > | random (int_t nr, int_t nc, const Property &pr=Property::General(), T_RScalar lo=T_RScalar(0), T_RScalar hi=T_RScalar(1)) |
| Create a random matrix. | |
| static Guard< XxMatrix< T_Scalar > > | view (int_t nr, int_t nc, const T_Scalar *vals, int_t ldv, const Property &pr=Property::General()) |
| Create a view of existing memory. | |
Additional Inherited Members | |
| Public Member Functions inherited from cla3p::MatrixMeta< int_t > | |
| const Property & | prop () const |
| Matrix property accessor. | |
| Public Member Functions inherited from cla3p::Meta2D< int_t > | |
| virtual int_t | nrows () const |
| Number of rows. | |
| virtual int_t | ncols () const |
| Number of columns. | |
| bool | empty () const |
| Tests whether the object has zero dimensions. | |
| operator bool () const | |
| Boolean conversion operator. | |
| Public Member Functions inherited from cla3p::dns::XxContainerBase< T_Scalar > | |
| T_Scalar * | values () |
| Access the data buffer. | |
| const T_Scalar * | values () const |
| Access the data buffer. | |
| Public Member Functions inherited from cla3p::Ownership | |
| Ownership () | |
| Default constructor. | |
| Ownership (bool owner) | |
| Ownership constructor. | |
| ~Ownership () | |
| Destructor. | |
| bool | owner () const |
| Tests memory ownership. | |
| void | unbind () |
| Relinquishes memory ownership. | |
The dense matrix class.
Represents a dense matrix stored in column-major format.
| T_Scalar | The scalar type (e.g., float, double, complex). |
| cla3p::dns::XxMatrix< T_Scalar >::XxMatrix | ( | ) |
Default constructor.
Creates an empty matrix with no allocated memory.
|
explicit |
Dimension constructor.
Creates a matrix of the specified dimensions and allocates memory.
| [in] | nr | The number of rows. |
| [in] | nc | The number of columns. |
| [in] | pr | The matrix property (default: General). |
|
explicit |
Auxiliary constructor.
Creates a matrix using existing memory.
| [in] | nr | The number of rows. |
| [in] | nc | The number of columns. |
| [in] | vals | Pointer to existing memory. |
| [in] | ldv | The leading dimension. |
| [in] | bind | If true, the matrix takes ownership of the memory. |
| [in] | pr | The matrix property (default: General). |
| cla3p::dns::XxMatrix< T_Scalar >::XxMatrix | ( | const XxMatrix< T_Scalar > & | other | ) |
Copy constructor.
Creates a new matrix by copying another matrix.
| [in] | other | The matrix to copy. |
| cla3p::dns::XxMatrix< T_Scalar >::XxMatrix | ( | XxMatrix< T_Scalar > && | other | ) |
Move constructor.
Creates a new matrix by moving resources from another matrix.
| [in] | other | The matrix to move from. |
| cla3p::dns::XxMatrix< T_Scalar >::~XxMatrix | ( | ) |
Destructor.
Destroys the matrix and releases allocated memory.
| XxMatrix< T_Scalar > & cla3p::dns::XxMatrix< T_Scalar >::operator= | ( | const XxMatrix< T_Scalar > & | other | ) |
Copy assignment operator.
Copies the contents of another matrix to this matrix.
| [in] | other | The matrix to copy. |
| XxMatrix< T_Scalar > & cla3p::dns::XxMatrix< T_Scalar >::operator= | ( | XxMatrix< T_Scalar > && | other | ) |
Move assignment operator.
Moves resources from another matrix to this matrix.
| [in] | other | The matrix to move from. |
| T_Scalar & cla3p::dns::XxMatrix< T_Scalar >::operator() | ( | int_t | i, |
| int_t | j ) |
Element access operator.
Accesses the element at the specified row and column.
| [in] | i | The row index (0-based). |
| [in] | j | The column index (0-based). |
| const T_Scalar & cla3p::dns::XxMatrix< T_Scalar >::operator() | ( | int_t | i, |
| int_t | j ) const |
Element access operator.
Accesses the element at the specified row and column.
| [in] | i | The row index (0-based). |
| [in] | j | The column index (0-based). |
| alias::VirtualScal_dns< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::operator- | ( | ) | const |
Unary negation operator.
Returns a negated copy of the matrix.
| void cla3p::dns::XxMatrix< T_Scalar >::operator= | ( | T_Scalar | val | ) |
Fill operator.
Fills all elements with the specified value.
| [in] | val | The scalar value to fill with. |
| int_t cla3p::dns::XxMatrix< T_Scalar >::ld | ( | ) | const |
Get the leading dimension.
Returns the leading dimension of the matrix (distance between consecutive columns).
| void cla3p::dns::XxMatrix< T_Scalar >::clear | ( | ) |
Clear the matrix.
Releases all memory and resets the matrix to an empty state.
| void cla3p::dns::XxMatrix< T_Scalar >::fill | ( | T_Scalar | val | ) |
Fill all elements with a value.
Sets all elements in the matrix to the specified scalar value.
| [in] | val | The scalar value to fill with. |
| XxMatrix< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::copy | ( | ) | const |
Create a deep copy of the matrix.
Creates a new matrix with its own memory allocation and copies all elements from this matrix to the new matrix.
| XxMatrix< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::rcopy | ( | ) |
Create a reference copy (shallow copy) of the matrix.
Creates a new matrix object that references the same memory as this matrix. Changes to either matrix will affect both.
| Guard< XxMatrix< T_Scalar > > cla3p::dns::XxMatrix< T_Scalar >::rcopy | ( | ) | const |
Create a guarded reference copy (shallow copy) of the matrix.
Creates a guarded matrix object that references the same memory as this matrix. The guard ensures the reference is read-only.
| XxMatrix< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::move | ( | ) |
Move the matrix's resources.
Transfers ownership of the memory to a new matrix object, leaving this matrix in an empty state.
| alias::VirtualStrided_vec< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::diag | ( | ) |
Access the diagonal of the matrix.
Returns a mutable strided vector view of the matrix's diagonal. The diagonal elements can be modified through this view.
| alias::GuardedStrided_vec< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::diag | ( | ) | const |
Access the diagonal of the matrix (const).
Returns a read-only guarded strided vector view of the matrix's diagonal. The diagonal elements cannot be modified through this view.
| std::string cla3p::dns::XxMatrix< T_Scalar >::info | ( | const std::string & | header = "" | ) | const |
Get information about the matrix.
Returns a string containing information about the matrix's dimensions and properties.
| [in] | header | Optional header string to prepend to the information. |
| void cla3p::dns::XxMatrix< T_Scalar >::print | ( | std::streamsize | prec = 0 | ) | const |
Print the matrix to standard output.
Prints the matrix elements to standard output with specified precision.
| [in] | prec | The output precision (default: 0 for default precision). |
| void cla3p::dns::XxMatrix< T_Scalar >::toStream | ( | std::ostream & | os, |
| std::streamsize | prec = 0 ) const |
Output the matrix to a stream.
Writes the matrix elements to the specified output stream with specified precision.
| [in,out] | os | The output stream to write to. |
| [in] | prec | The output precision (default: 0 for default precision). |
| void cla3p::dns::XxMatrix< T_Scalar >::iscale | ( | T_Scalar | val | ) |
Scale the matrix in-place.
Multiplies all elements of the matrix by a scalar value.
| [in] | val | The scalar value to multiply by. |
| alias::VirtualTrans_dns< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::transpose | ( | ) | const |
Transpose the matrix.
Returns a transposed view of the matrix.
| alias::VirtualTrans_dns< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::ctranspose | ( | ) | const |
Conjugate transpose the matrix.
Returns a conjugate transposed view of the matrix.
| alias::VirtualConj_dns< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::conjugate | ( | ) | const |
Compute the complex conjugate.
Returns a virtual expression containing the complex conjugate of each element.
| void cla3p::dns::XxMatrix< T_Scalar >::iconjugate | ( | ) |
Conjugate the matrix in-place.
Replaces all elements with their complex conjugates.
| T_RScalar cla3p::dns::XxMatrix< T_Scalar >::normOne | ( | ) | const |
Compute the 1-norm.
Computes the maximum absolute column sum.
| T_RScalar cla3p::dns::XxMatrix< T_Scalar >::normInf | ( | ) | const |
Compute the infinity norm.
Computes the maximum absolute row sum.
| T_RScalar cla3p::dns::XxMatrix< T_Scalar >::normMax | ( | ) | const |
Compute the maximum norm.
Computes the maximum absolute value of all elements.
| T_RScalar cla3p::dns::XxMatrix< T_Scalar >::normFro | ( | ) | const |
Compute the Frobenius norm.
Computes the square root of the sum of squared absolute values of all elements.
| XxMatrix< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::general | ( | ) | const |
Convert to general matrix.
Creates a new general matrix by copying all relevant elements from a structured matrix.
| void cla3p::dns::XxMatrix< T_Scalar >::igeneral | ( | ) |
Convert to general matrix in-place.
Converts a structured matrix to general form by filling in all elements.
| XxMatrix< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::permuteLeftRight | ( | const prm::PxMatrix< int_t > & | P, |
| const prm::PxMatrix< int_t > & | Q ) const |
Permute rows and columns.
Applies left and right permutations to the matrix.
| [in] | P | The row permutation matrix. |
| [in] | Q | The column permutation matrix. |
| void cla3p::dns::XxMatrix< T_Scalar >::permuteLeftRight | ( | const prm::PxMatrix< int_t > & | P, |
| const prm::PxMatrix< int_t > & | Q, | ||
| XxMatrix< T_Scalar > & | dest ) const |
Permute rows and columns into a destination.
Applies left and right permutations to the matrix and stores the result in the destination matrix.
| [in] | P | The row permutation matrix. |
| [in] | Q | The column permutation matrix. |
| [out] | dest | The destination matrix for the permuted elements. |
| XxMatrix< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::permuteLeft | ( | const prm::PxMatrix< int_t > & | P | ) | const |
Permute rows.
Applies a left (row) permutation to the matrix.
| [in] | P | The row permutation matrix. |
| void cla3p::dns::XxMatrix< T_Scalar >::permuteLeft | ( | const prm::PxMatrix< int_t > & | P, |
| XxMatrix< T_Scalar > & | dest ) const |
Permute rows into a destination.
Applies a left (row) permutation to the matrix and stores the result in the destination matrix.
| [in] | P | The row permutation matrix. |
| [out] | dest | The destination matrix for the permuted elements. |
| XxMatrix< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::permuteRight | ( | const prm::PxMatrix< int_t > & | Q | ) | const |
Permute columns.
Applies a right (column) permutation to the matrix.
| [in] | Q | The column permutation matrix. |
| void cla3p::dns::XxMatrix< T_Scalar >::permuteRight | ( | const prm::PxMatrix< int_t > & | Q, |
| XxMatrix< T_Scalar > & | dest ) const |
Permute columns into a destination.
Applies a right (column) permutation to the matrix and stores the result in the destination matrix.
| [in] | Q | The column permutation matrix. |
| [out] | dest | The destination matrix for the permuted elements. |
| XxMatrix< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::permuteMirror | ( | const prm::PxMatrix< int_t > & | P | ) | const |
Permute rows and columns symmetrically.
Applies the same permutation to both rows and columns (mirror permutation).
| [in] | P | The permutation matrix to apply to both rows and columns. |
| void cla3p::dns::XxMatrix< T_Scalar >::permuteMirror | ( | const prm::PxMatrix< int_t > & | P, |
| XxMatrix< T_Scalar > & | dest ) const |
Permute rows and columns symmetrically into a destination.
Applies the same permutation to both rows and columns and stores the result in the destination matrix.
| [in] | P | The permutation matrix to apply to both rows and columns. |
| [out] | dest | The destination matrix for the permuted elements. |
| XxMatrix< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::block | ( | int_t | ibgn, |
| int_t | jbgn, | ||
| int_t | ni, | ||
| int_t | nj ) const |
Extract a block as a new matrix.
Creates a new matrix containing a deep copy of a contiguous block of elements.
| [in] | ibgn | The starting row index of the block. |
| [in] | jbgn | The starting column index of the block. |
| [in] | ni | The number of rows in the block. |
| [in] | nj | The number of columns in the block. |
| XxMatrix< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::rblock | ( | int_t | ibgn, |
| int_t | jbgn, | ||
| int_t | ni, | ||
| int_t | nj ) |
Extract a reference block.
Creates a matrix that references a contiguous block of this matrix's memory.
| [in] | ibgn | The starting row index of the block. |
| [in] | jbgn | The starting column index of the block. |
| [in] | ni | The number of rows in the block. |
| [in] | nj | The number of columns in the block. |
| Guard< XxMatrix< T_Scalar > > cla3p::dns::XxMatrix< T_Scalar >::rblock | ( | int_t | ibgn, |
| int_t | jbgn, | ||
| int_t | ni, | ||
| int_t | nj ) const |
Extract a guarded reference block.
Creates a guarded matrix that references a contiguous block of this matrix's memory.
| [in] | ibgn | The starting row index of the block. |
| [in] | jbgn | The starting column index of the block. |
| [in] | ni | The number of rows in the block. |
| [in] | nj | The number of columns in the block. |
| void cla3p::dns::XxMatrix< T_Scalar >::setBlock | ( | int_t | ibgn, |
| int_t | jbgn, | ||
| const XxMatrix< T_Scalar > & | src ) |
Set a block of elements.
Copies elements from the source matrix to a contiguous block of this matrix.
| [in] | ibgn | The starting row index where the block will be written. |
| [in] | jbgn | The starting column index where the block will be written. |
| [in] | src | The source matrix to copy from. |
| XxVector< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::column | ( | int_t | j | ) | const |
Extract a column as a new vector.
Creates a new vector containing a deep copy of a column.
| [in] | j | The column index. |
| XxVector< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::rcolumn | ( | int_t | j | ) |
Extract a column as a reference.
Creates a vector that references a column of this matrix's memory.
| [in] | j | The column index. |
| Guard< XxVector< T_Scalar > > cla3p::dns::XxMatrix< T_Scalar >::rcolumn | ( | int_t | j | ) | const |
Extract a column as a guarded reference.
Creates a guarded vector that references a column of this matrix's memory.
| [in] | j | The column index. |
| XxMatrix< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::row | ( | int_t | i | ) | const |
Extract a row as a new matrix.
Creates a new matrix containing a deep copy of a row.
| [in] | i | The row index. |
| XxMatrix< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::rrow | ( | int_t | i | ) |
Extract a row as a reference.
Creates a matrix that references a row of this matrix's memory.
| [in] | i | The row index. |
| Guard< XxMatrix< T_Scalar > > cla3p::dns::XxMatrix< T_Scalar >::rrow | ( | int_t | i | ) | const |
Extract a row as a guarded reference.
Creates a guarded matrix that references a row of this matrix's memory.
| [in] | i | The row index. |
| VirtualRowvec< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::rrowvec | ( | int_t | i | ) | const |
Extract a row as a virtual row vector.
Creates a virtual row vector expression that references a row of this matrix's memory.
| [in] | i | The row index. |
|
static |
Create a random matrix.
Creates a matrix with random values uniformly distributed in the specified range.
| [in] | nr | The number of rows. |
| [in] | nc | The number of columns. |
| [in] | pr | The matrix property (default: General). |
| [in] | lo | The lower bound of the random values (default: 0). |
| [in] | hi | The upper bound of the random values (default: 1). |
|
static |
Create a view of existing memory.
Creates a guarded matrix that references existing memory without taking ownership. The memory must remain valid for the lifetime of the returned view.
| [in] | nr | The number of rows. |
| [in] | nc | The number of columns. |
| [in] | vals | Pointer to the memory. |
| [in] | ldv | The leading dimension. |
| [in] | pr | The matrix property (default: General). |