CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
Loading...
Searching...
No Matches
cla3p::csc::CxMatrix< T_Int, T_Scalar > Class Template Reference

The sparse complex matrix class (compressed sparse column format). More...

Inheritance diagram for cla3p::csc::CxMatrix< T_Int, T_Scalar >:

Constructors

 CxMatrix ()
 Default constructor.
 CxMatrix (T_Int nr, T_Int nc, T_Int nz, const Property &pr=Property::General())
 Dimension constructor.
 CxMatrix (T_Int nr, T_Int nc, T_Int *cptr, T_Int *ridx, T_Scalar *vals, bool bind, const Property &pr=Property::General())
 Auxiliary constructor.
 CxMatrix (const CxMatrix< T_Int, T_Scalar > &other)=default
 Copy constructor.
 CxMatrix (CxMatrix< T_Int, T_Scalar > &&other)=default
 Move constructor.
 ~CxMatrix ()
 Destructor.

Operators

CxMatrix< T_Int, T_Scalar > & operator= (const CxMatrix< T_Int, T_Scalar > &other)=default
 Copy assignment operator.
CxMatrix< T_Int, T_Scalar > & operator= (CxMatrix< T_Int, T_Scalar > &&other)=default
 Move assignment operator.

Public Member Functions

alias::VirtualStrided_csc< T_Int, T_RScalar > real ()
 Accesses the real part of the complex sparse matrix.
alias::VirtualStrided_csc< T_Int, T_RScalar > imag ()
 Accesses the imaginary part of the complex sparse matrix.
alias::GuardedStrided_csc< T_Int, T_RScalar > real () const
 Accesses the real part of the complex sparse matrix (const).
alias::GuardedStrided_csc< T_Int, T_RScalar > imag () const
 Accesses the imaginary part of the complex sparse matrix (const).

Additional Inherited Members

 XxMatrix ()
 Default constructor.
 XxMatrix (T_Int nr, T_Int nc, T_Int nz, const Property &pr=Property::General())
 Dimension constructor.
 XxMatrix (T_Int nr, T_Int nc, T_Int *cptr, T_Int *ridx, T_Scalar *vals, bool bind, const Property &pr=Property::General())
 Auxiliary constructor.
 XxMatrix (const XxMatrix< T_Int, T_Scalar > &other)
 Copy constructor.
 XxMatrix (XxMatrix< T_Int, T_Scalar > &&other)
 Move constructor.
 ~XxMatrix ()
 Destructor.
XxMatrix< T_Int, T_Scalar > & operator= (const XxMatrix< T_Int, T_Scalar > &other)
 Copy assignment operator.
XxMatrix< T_Int, T_Scalar > & operator= (XxMatrix< T_Int, T_Scalar > &&other)
 Move assignment operator.
alias::VirtualScal_csc< T_Int, T_Scalar > operator- () const
 Unary negation operator.
T_Int * colptr ()
 Access the column pointer array.
const T_Int * colptr () const
 Access the column pointer array.
T_Int * rowidx ()
 Access the row index array.
const T_Int * rowidx () const
 Access the row index array.
T_Int nnz () const
 Get the number of non-zero elements.
void clear ()
 Clear the sparse matrix.
std::string info (const std::string &header="") const
 Get information about the sparse matrix.
XxMatrix< T_Int, T_Scalar > copy () const
 Create a deep copy of the sparse matrix.
XxMatrix< T_Int, T_Scalar > rcopy ()
 Create a reference copy (shallow copy) of the sparse matrix.
Guard< XxMatrix< T_Int, T_Scalar > > rcopy () const
 Create a guarded reference copy (shallow copy) of the sparse matrix.
XxMatrix< T_Int, T_Scalar > move ()
 Move the sparse matrix's resources.
void toStream (std::ostream &os, std::streamsize prec=0) const
 Output the sparse matrix to a stream.
void iscale (T_Scalar val)
 Scale the sparse matrix in-place.
alias::VirtualTrans_csc< T_Int, T_Scalar > transpose () const
 Transpose the sparse matrix.
alias::VirtualTrans_csc< T_Int, T_Scalar > ctranspose () const
 Conjugate transpose the sparse matrix.
alias::VirtualConj_csc< T_Int, T_Scalar > conjugate () const
 Compute the complex conjugate.
void iconjugate ()
 Conjugate the sparse 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_Int, T_Scalar > general () const
 Convert to general sparse matrix.
dns::XxMatrix< T_Scalar > toDns () const
 Convert to dense matrix format.
XxMatrix< T_Int, T_Scalar > permuteLeftRight (const prm::PxMatrix< T_Int > &P, const prm::PxMatrix< T_Int > &Q) const
 Permute rows and columns.
XxMatrix< T_Int, T_Scalar > permuteLeft (const prm::PxMatrix< T_Int > &P) const
 Permute rows.
XxMatrix< T_Int, T_Scalar > permuteRight (const prm::PxMatrix< T_Int > &Q) const
 Permute columns.
XxMatrix< T_Int, T_Scalar > permuteMirror (const prm::PxMatrix< T_Int > &P) const
 Permute rows and columns symmetrically.
XxMatrix< T_Int, T_Scalar > block (T_Int ibgn, T_Int jbgn, T_Int ni, T_Int nj) const
 Extract a block as a new sparse matrix.
Public Member Functions inherited from cla3p::MatrixMeta< T_Int >
const Propertyprop () const
 Matrix property accessor.
Public Member Functions inherited from cla3p::Meta2D< T_Int >
virtual T_Int nrows () const
 Number of rows.
virtual T_Int 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::csx::XxContainerBase< T_Int, 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.
static XxMatrix< T_Int, T_Scalar > random (T_Int nr, T_Int nc, T_Int nz, const Property &pr=Property::General(), T_RScalar lo=T_RScalar(0), T_RScalar hi=T_RScalar(1))
 Create a random sparse matrix.
static Guard< XxMatrix< T_Int, T_Scalar > > view (T_Int nr, T_Int nc, const T_Int *cptr, const T_Int *ridx, const T_Scalar *vals, const Property &pr=Property::General())
 Create a view of existing CSC arrays.

Detailed Description

template<typename T_Int, typename T_Scalar>
class cla3p::csc::CxMatrix< T_Int, T_Scalar >

The sparse complex matrix class (compressed sparse column format).

Represents a sparse complex-valued matrix in compressed sparse column (CSC) format.

Template Parameters
T_IntThe integer type for indices.
T_ScalarThe complex scalar type (e.g., std::complex<float>, std::complex<double>).

Constructor & Destructor Documentation

◆ CxMatrix() [1/5]

template<typename T_Int, typename T_Scalar>
cla3p::csc::CxMatrix< T_Int, T_Scalar >::CxMatrix ( )

Default constructor.

Creates an empty complex sparse matrix with no allocated memory.

◆ CxMatrix() [2/5]

template<typename T_Int, typename T_Scalar>
cla3p::csc::CxMatrix< T_Int, T_Scalar >::CxMatrix ( T_Int nr,
T_Int nc,
T_Int nz,
const Property & pr = Property::General() )
explicit

Dimension constructor.

Creates a complex sparse matrix of the specified dimensions in CSC format and allocates memory.

Parameters
[in]nrThe number of rows.
[in]ncThe number of columns.
[in]nzThe number of non-zero elements.
[in]prThe matrix property (default: General).

◆ CxMatrix() [3/5]

template<typename T_Int, typename T_Scalar>
cla3p::csc::CxMatrix< T_Int, T_Scalar >::CxMatrix ( T_Int nr,
T_Int nc,
T_Int * cptr,
T_Int * ridx,
T_Scalar * vals,
bool bind,
const Property & pr = Property::General() )
explicit

Auxiliary constructor.

Creates a complex sparse matrix using existing CSC format arrays.

Parameters
[in]nrThe number of rows.
[in]ncThe number of columns.
[in]cptrPointer to existing column pointer array.
[in]ridxPointer to existing row index array.
[in]valsPointer to existing values array.
[in]bindIf true, the matrix takes ownership of the memory.
[in]prThe matrix property (default: General).

◆ CxMatrix() [4/5]

template<typename T_Int, typename T_Scalar>
cla3p::csc::CxMatrix< T_Int, T_Scalar >::CxMatrix ( const CxMatrix< T_Int, T_Scalar > & other)
default

Copy constructor.

Creates a new complex sparse matrix by copying another complex sparse matrix.

Parameters
[in]otherThe complex sparse matrix to copy.

◆ CxMatrix() [5/5]

template<typename T_Int, typename T_Scalar>
cla3p::csc::CxMatrix< T_Int, T_Scalar >::CxMatrix ( CxMatrix< T_Int, T_Scalar > && other)
default

Move constructor.

Creates a new complex sparse matrix by moving resources from another complex sparse matrix.

Parameters
[in]otherThe complex sparse matrix to move from.

◆ ~CxMatrix()

template<typename T_Int, typename T_Scalar>
cla3p::csc::CxMatrix< T_Int, T_Scalar >::~CxMatrix ( )

Destructor.

Destroys the complex sparse matrix and releases allocated memory.

Member Function Documentation

◆ operator=() [1/2]

template<typename T_Int, typename T_Scalar>
CxMatrix< T_Int, T_Scalar > & cla3p::csc::CxMatrix< T_Int, T_Scalar >::operator= ( const CxMatrix< T_Int, T_Scalar > & other)
default

Copy assignment operator.

Copies the contents of another complex sparse matrix to this complex sparse matrix.

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

◆ operator=() [2/2]

template<typename T_Int, typename T_Scalar>
CxMatrix< T_Int, T_Scalar > & cla3p::csc::CxMatrix< T_Int, T_Scalar >::operator= ( CxMatrix< T_Int, T_Scalar > && other)
default

Move assignment operator.

Moves resources from another complex sparse matrix to this complex sparse matrix.

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

◆ real() [1/2]

template<typename T_Int, typename T_Scalar>
alias::VirtualStrided_csc< T_Int, T_RScalar > cla3p::csc::CxMatrix< T_Int, T_Scalar >::real ( )

Accesses the real part of the complex sparse matrix.

Returns a strided view of the real components that can be used for both reading and writing.

Returns
A virtual strided view of the real part.

◆ imag() [1/2]

template<typename T_Int, typename T_Scalar>
alias::VirtualStrided_csc< T_Int, T_RScalar > cla3p::csc::CxMatrix< T_Int, T_Scalar >::imag ( )

Accesses the imaginary part of the complex sparse matrix.

Returns a strided view of the imaginary components that can be used for both reading and writing.

Returns
A virtual strided view of the imaginary part.

◆ real() [2/2]

template<typename T_Int, typename T_Scalar>
alias::GuardedStrided_csc< T_Int, T_RScalar > cla3p::csc::CxMatrix< T_Int, T_Scalar >::real ( ) const

Accesses the real part of the complex sparse matrix (const).

Returns a read-only strided view of the real components.

Returns
A guarded strided view of the real part.

◆ imag() [2/2]

template<typename T_Int, typename T_Scalar>
alias::GuardedStrided_csc< T_Int, T_RScalar > cla3p::csc::CxMatrix< T_Int, T_Scalar >::imag ( ) const

Accesses the imaginary part of the complex sparse matrix (const).

Returns a read-only strided view of the imaginary components.

Returns
A guarded strided view of the imaginary part.