CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
Loading...
Searching...
No Matches
cla3p::dns::XxMatrix< T_Scalar > Class Template Reference

The dense matrix class. More...

Inheritance diagram for cla3p::dns::XxMatrix< T_Scalar >:

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 Propertyprop () 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.

Detailed Description

template<typename T_Scalar>
class cla3p::dns::XxMatrix< T_Scalar >

The dense matrix class.

Represents a dense matrix stored in column-major format.

Template Parameters
T_ScalarThe scalar type (e.g., float, double, complex).

Constructor & Destructor Documentation

◆ XxMatrix() [1/5]

template<typename T_Scalar>
cla3p::dns::XxMatrix< T_Scalar >::XxMatrix ( )

Default constructor.

Creates an empty matrix with no allocated memory.

◆ XxMatrix() [2/5]

template<typename T_Scalar>
cla3p::dns::XxMatrix< T_Scalar >::XxMatrix ( int_t nr,
int_t nc,
const Property & pr = Property::General() )
explicit

Dimension constructor.

Creates a matrix of the specified dimensions and allocates memory.

Parameters
[in]nrThe number of rows.
[in]ncThe number of columns.
[in]prThe matrix property (default: General).

◆ XxMatrix() [3/5]

template<typename T_Scalar>
cla3p::dns::XxMatrix< T_Scalar >::XxMatrix ( int_t nr,
int_t nc,
T_Scalar * vals,
int_t ldv,
bool bind,
const Property & pr = Property::General() )
explicit

Auxiliary constructor.

Creates a matrix using existing memory.

Parameters
[in]nrThe number of rows.
[in]ncThe number of columns.
[in]valsPointer to existing memory.
[in]ldvThe leading dimension.
[in]bindIf true, the matrix takes ownership of the memory.
[in]prThe matrix property (default: General).

◆ XxMatrix() [4/5]

template<typename T_Scalar>
cla3p::dns::XxMatrix< T_Scalar >::XxMatrix ( const XxMatrix< T_Scalar > & other)

Copy constructor.

Creates a new matrix by copying another matrix.

Parameters
[in]otherThe matrix to copy.

◆ XxMatrix() [5/5]

template<typename T_Scalar>
cla3p::dns::XxMatrix< T_Scalar >::XxMatrix ( XxMatrix< T_Scalar > && other)

Move constructor.

Creates a new matrix by moving resources from another matrix.

Parameters
[in]otherThe matrix to move from.

◆ ~XxMatrix()

template<typename T_Scalar>
cla3p::dns::XxMatrix< T_Scalar >::~XxMatrix ( )

Destructor.

Destroys the matrix and releases allocated memory.

Member Function Documentation

◆ operator=() [1/3]

template<typename T_Scalar>
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.

Parameters
[in]otherThe matrix to copy.
Returns
Reference to this matrix.

◆ operator=() [2/3]

template<typename T_Scalar>
XxMatrix< T_Scalar > & cla3p::dns::XxMatrix< T_Scalar >::operator= ( XxMatrix< T_Scalar > && other)

Move assignment operator.

Moves resources from another matrix to this matrix.

Parameters
[in]otherThe matrix to move from.
Returns
Reference to this matrix.

◆ operator()() [1/2]

template<typename T_Scalar>
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.

Parameters
[in]iThe row index (0-based).
[in]jThe column index (0-based).
Returns
Reference to the element at position (i,j).

◆ operator()() [2/2]

template<typename T_Scalar>
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.

Parameters
[in]iThe row index (0-based).
[in]jThe column index (0-based).
Returns
Const reference to the element at position (i,j).

◆ operator-()

template<typename T_Scalar>
alias::VirtualScal_dns< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::operator- ( ) const

Unary negation operator.

Returns a negated copy of the matrix.

Returns
A virtual expression containing the negated elements.

◆ operator=() [3/3]

template<typename T_Scalar>
void cla3p::dns::XxMatrix< T_Scalar >::operator= ( T_Scalar val)

Fill operator.

Fills all elements with the specified value.

Parameters
[in]valThe scalar value to fill with.

◆ ld()

template<typename T_Scalar>
int_t cla3p::dns::XxMatrix< T_Scalar >::ld ( ) const

Get the leading dimension.

Returns the leading dimension of the matrix (distance between consecutive columns).

Returns
The leading dimension.

◆ clear()

template<typename T_Scalar>
void cla3p::dns::XxMatrix< T_Scalar >::clear ( )

Clear the matrix.

Releases all memory and resets the matrix to an empty state.

◆ fill()

template<typename T_Scalar>
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.

Parameters
[in]valThe scalar value to fill with.

◆ copy()

template<typename T_Scalar>
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.

Returns
A new matrix containing a copy of this matrix's data.

◆ rcopy() [1/2]

template<typename T_Scalar>
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.

Returns
A matrix that shares memory with this matrix.

◆ rcopy() [2/2]

template<typename T_Scalar>
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.

Returns
A guarded matrix that shares memory with this matrix.

◆ move()

template<typename T_Scalar>
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.

Returns
A new matrix containing this matrix's memory.

◆ diag() [1/2]

template<typename T_Scalar>
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.

Returns
A strided vector view of the diagonal elements.

◆ diag() [2/2]

template<typename T_Scalar>
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.

Returns
A guarded strided vector view of the diagonal elements.

◆ info()

template<typename T_Scalar>
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.

Parameters
[in]headerOptional header string to prepend to the information.
Returns
A string containing matrix information.
Examples
ex02e_dense_matrix_create_random.cpp.

◆ print()

template<typename T_Scalar>
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.

Parameters
[in]precThe output precision (default: 0 for default precision).

◆ toStream()

template<typename T_Scalar>
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.

Parameters
[in,out]osThe output stream to write to.
[in]precThe output precision (default: 0 for default precision).

◆ iscale()

template<typename T_Scalar>
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.

Parameters
[in]valThe scalar value to multiply by.

◆ transpose()

template<typename T_Scalar>
alias::VirtualTrans_dns< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::transpose ( ) const

Transpose the matrix.

Returns a transposed view of the matrix.

Returns
A virtual transpose expression.

◆ ctranspose()

template<typename T_Scalar>
alias::VirtualTrans_dns< T_Scalar > cla3p::dns::XxMatrix< T_Scalar >::ctranspose ( ) const

Conjugate transpose the matrix.

Returns a conjugate transposed view of the matrix.

Returns
A virtual conjugate transpose expression.

◆ conjugate()

template<typename T_Scalar>
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.

Returns
A virtual expression with conjugated elements.

◆ iconjugate()

template<typename T_Scalar>
void cla3p::dns::XxMatrix< T_Scalar >::iconjugate ( )

Conjugate the matrix in-place.

Replaces all elements with their complex conjugates.

◆ normOne()

template<typename T_Scalar>
T_RScalar cla3p::dns::XxMatrix< T_Scalar >::normOne ( ) const

Compute the 1-norm.

Computes the maximum absolute column sum.

Returns
The 1-norm of the matrix.

◆ normInf()

template<typename T_Scalar>
T_RScalar cla3p::dns::XxMatrix< T_Scalar >::normInf ( ) const

Compute the infinity norm.

Computes the maximum absolute row sum.

Returns
The infinity norm of the matrix.

◆ normMax()

template<typename T_Scalar>
T_RScalar cla3p::dns::XxMatrix< T_Scalar >::normMax ( ) const

Compute the maximum norm.

Computes the maximum absolute value of all elements.

Returns
The maximum norm of the matrix.

◆ normFro()

template<typename T_Scalar>
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.

Returns
The Frobenius norm of the matrix.

◆ general()

template<typename T_Scalar>
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.

Returns
A general matrix containing the full data.

◆ igeneral()

template<typename T_Scalar>
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.

◆ permuteLeftRight() [1/2]

template<typename T_Scalar>
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.

Parameters
[in]PThe row permutation matrix.
[in]QThe column permutation matrix.
Returns
A new matrix containing the permuted elements.

◆ permuteLeftRight() [2/2]

template<typename T_Scalar>
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.

Parameters
[in]PThe row permutation matrix.
[in]QThe column permutation matrix.
[out]destThe destination matrix for the permuted elements.

◆ permuteLeft() [1/2]

template<typename T_Scalar>
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.

Parameters
[in]PThe row permutation matrix.
Returns
A new matrix containing the permuted elements.

◆ permuteLeft() [2/2]

template<typename T_Scalar>
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.

Parameters
[in]PThe row permutation matrix.
[out]destThe destination matrix for the permuted elements.

◆ permuteRight() [1/2]

template<typename T_Scalar>
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.

Parameters
[in]QThe column permutation matrix.
Returns
A new matrix containing the permuted elements.

◆ permuteRight() [2/2]

template<typename T_Scalar>
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.

Parameters
[in]QThe column permutation matrix.
[out]destThe destination matrix for the permuted elements.

◆ permuteMirror() [1/2]

template<typename T_Scalar>
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).

Parameters
[in]PThe permutation matrix to apply to both rows and columns.
Returns
A new matrix containing the permuted elements.

◆ permuteMirror() [2/2]

template<typename T_Scalar>
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.

Parameters
[in]PThe permutation matrix to apply to both rows and columns.
[out]destThe destination matrix for the permuted elements.

◆ block()

template<typename T_Scalar>
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.

Parameters
[in]ibgnThe starting row index of the block.
[in]jbgnThe starting column index of the block.
[in]niThe number of rows in the block.
[in]njThe number of columns in the block.
Returns
A new matrix containing the block's data.

◆ rblock() [1/2]

template<typename T_Scalar>
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.

Parameters
[in]ibgnThe starting row index of the block.
[in]jbgnThe starting column index of the block.
[in]niThe number of rows in the block.
[in]njThe number of columns in the block.
Returns
A matrix that shares memory with this matrix.

◆ rblock() [2/2]

template<typename T_Scalar>
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.

Parameters
[in]ibgnThe starting row index of the block.
[in]jbgnThe starting column index of the block.
[in]niThe number of rows in the block.
[in]njThe number of columns in the block.
Returns
A guarded matrix that shares memory with this matrix.

◆ setBlock()

template<typename T_Scalar>
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.

Parameters
[in]ibgnThe starting row index where the block will be written.
[in]jbgnThe starting column index where the block will be written.
[in]srcThe source matrix to copy from.

◆ column()

template<typename T_Scalar>
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.

Parameters
[in]jThe column index.
Returns
A new vector containing the column's data.

◆ rcolumn() [1/2]

template<typename T_Scalar>
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.

Parameters
[in]jThe column index.
Returns
A vector that shares memory with this matrix.

◆ rcolumn() [2/2]

template<typename T_Scalar>
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.

Parameters
[in]jThe column index.
Returns
A guarded vector that shares memory with this matrix.

◆ row()

template<typename T_Scalar>
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.

Parameters
[in]iThe row index.
Returns
A new matrix containing the row's data.

◆ rrow() [1/2]

template<typename T_Scalar>
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.

Parameters
[in]iThe row index.
Returns
A matrix that shares memory with this matrix.

◆ rrow() [2/2]

template<typename T_Scalar>
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.

Parameters
[in]iThe row index.
Returns
A guarded matrix that shares memory with this matrix.

◆ rrowvec()

template<typename T_Scalar>
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.

Parameters
[in]iThe row index.
Returns
A virtual row vector expression.

◆ random()

template<typename T_Scalar>
XxMatrix< T_Scalar > cla3p::dns::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) )
static

Create a random matrix.

Creates a matrix with random values uniformly distributed in the specified range.

Parameters
[in]nrThe number of rows.
[in]ncThe number of columns.
[in]prThe matrix property (default: General).
[in]loThe lower bound of the random values (default: 0).
[in]hiThe upper bound of the random values (default: 1).
Returns
A matrix containing random values.
Examples
ex02e_dense_matrix_create_random.cpp.

◆ view()

template<typename T_Scalar>
Guard< XxMatrix< T_Scalar > > cla3p::dns::XxMatrix< T_Scalar >::view ( int_t nr,
int_t nc,
const T_Scalar * vals,
int_t ldv,
const Property & pr = Property::General() )
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.

Parameters
[in]nrThe number of rows.
[in]ncThe number of columns.
[in]valsPointer to the memory.
[in]ldvThe leading dimension.
[in]prThe matrix property (default: General).
Returns
A guarded matrix that views the specified memory.