Quantum 3xplorer (Q3)
An AI-native quantum simulation engine
Loading...
Searching...
No Matches
q3::DenseMatrix< T > Class Template Reference

#include <dense_matrix.hpp>

Public Member Functions

 DenseMatrix ()=default
 
 DenseMatrix (int rows, int columns, const T &initial_value=T{})
 
 DenseMatrix (int rows, int columns, std::vector< T > column_major_data)
 Adopts a column-major buffer; refuses one whose size is not rows * columns.
 
template<typename Factor >
DenseMatrix & add_scaled (const Factor &factor, const DenseMatrix &other)
 this += factor * other, element by element; the two shapes must agree.
 
DenseMatrix adjoint () const
 The conjugate transpose, columns x rows.
 
int columns () const
 
T * data ()
 The column-major buffer: with rows() it is the (pointer, leading dimension) BLAS takes.
 
const T * data () const
 
bool empty () const
 
Real frobenius_norm_squared () const
 The sum of every element's squared modulus.
 
std::size_t number_of_elements () const
 
bool operator!= (const DenseMatrix &other) const
 
T & operator() (int row, int column)
 
const T & operator() (int row, int column) const
 
bool operator== (const DenseMatrix &other) const
 
const std::vector< T > & raw () const
 Read-only: a caller that could resize the buffer could break rows() x columns().
 
Real real_inner_product (const DenseMatrix &other) const
 
int rows () const
 
template<typename Factor >
DenseMatrix scaled (const Factor &factor) const
 factor * this, element by element.
 
template<typename Factor >
DenseMatrix scaled_columns (const std::vector< Factor > &factors) const
 this * diag(factors): column j scaled by factors[j], which needs one factor per column.
 
template<typename Factor >
DenseMatrix scaled_rows (const std::vector< Factor > &factors) const
 diag(factors) * this: row i scaled by factors[i], which needs one factor per row.
 
DenseMatrix submatrix (const std::vector< int > &row_indices, const std::vector< int > &column_indices) const
 The rows and columns named, in the order named; an index outside the matrix is refused.
 

Static Public Member Functions

static DenseMatrix identity (int dimension)
 

Detailed Description

template<typename T>
class q3::DenseMatrix< T >

Definition at line 42 of file dense_matrix.hpp.

Constructor & Destructor Documentation

◆ DenseMatrix() [1/3]

template<typename T >
q3::DenseMatrix< T >::DenseMatrix ( )
default

◆ DenseMatrix() [2/3]

template<typename T >
q3::DenseMatrix< T >::DenseMatrix ( int  rows,
int  columns,
const T &  initial_value = T{} 
)
inline

Definition at line 46 of file dense_matrix.hpp.

◆ DenseMatrix() [3/3]

template<typename T >
q3::DenseMatrix< T >::DenseMatrix ( int  rows,
int  columns,
std::vector< T >  column_major_data 
)
inline

Adopts a column-major buffer; refuses one whose size is not rows * columns.

Definition at line 54 of file dense_matrix.hpp.

Member Function Documentation

◆ add_scaled()

template<typename T >
template<typename Factor >
DenseMatrix & q3::DenseMatrix< T >::add_scaled ( const Factor &  factor,
const DenseMatrix< T > &  other 
)
inline

this += factor * other, element by element; the two shapes must agree.

Definition at line 137 of file dense_matrix.hpp.

◆ adjoint()

template<typename T >
DenseMatrix q3::DenseMatrix< T >::adjoint ( ) const
inline

The conjugate transpose, columns x rows.

Definition at line 107 of file dense_matrix.hpp.

◆ columns()

◆ data() [1/2]

template<typename T >
T * q3::DenseMatrix< T >::data ( )
inline

The column-major buffer: with rows() it is the (pointer, leading dimension) BLAS takes.

Definition at line 95 of file dense_matrix.hpp.

Referenced by q3::SingularValueDecomposition::compute(), q3::multiply_add(), and q3::HermitianEigensolver::solve().

◆ data() [2/2]

template<typename T >
const T * q3::DenseMatrix< T >::data ( ) const
inline

Definition at line 98 of file dense_matrix.hpp.

◆ empty()

template<typename T >
bool q3::DenseMatrix< T >::empty ( ) const
inline

Definition at line 83 of file dense_matrix.hpp.

Referenced by q3::SubspaceDisentangler::run().

◆ frobenius_norm_squared()

template<typename T >
Real q3::DenseMatrix< T >::frobenius_norm_squared ( ) const
inline

The sum of every element's squared modulus.

Definition at line 118 of file dense_matrix.hpp.

Referenced by q3::SpreadFunctional::evaluate().

◆ identity()

template<typename T >
static DenseMatrix q3::DenseMatrix< T >::identity ( int  dimension)
inlinestatic

Definition at line 66 of file dense_matrix.hpp.

◆ number_of_elements()

template<typename T >
std::size_t q3::DenseMatrix< T >::number_of_elements ( ) const
inline

Definition at line 80 of file dense_matrix.hpp.

◆ operator!=()

template<typename T >
bool q3::DenseMatrix< T >::operator!= ( const DenseMatrix< T > &  other) const
inline

Definition at line 204 of file dense_matrix.hpp.

◆ operator()() [1/2]

template<typename T >
T & q3::DenseMatrix< T >::operator() ( int  row,
int  column 
)
inline

Definition at line 87 of file dense_matrix.hpp.

◆ operator()() [2/2]

template<typename T >
const T & q3::DenseMatrix< T >::operator() ( int  row,
int  column 
) const
inline

Definition at line 90 of file dense_matrix.hpp.

◆ operator==()

template<typename T >
bool q3::DenseMatrix< T >::operator== ( const DenseMatrix< T > &  other) const
inline

Definition at line 201 of file dense_matrix.hpp.

◆ raw()

template<typename T >
const std::vector< T > & q3::DenseMatrix< T >::raw ( ) const
inline

Read-only: a caller that could resize the buffer could break rows() x columns().

Definition at line 102 of file dense_matrix.hpp.

◆ real_inner_product()

template<typename T >
Real q3::DenseMatrix< T >::real_inner_product ( const DenseMatrix< T > &  other) const
inline

Re tr(this^dagger other), the sum of Re(conj(a) b) over matching elements: the inner product under which the matrices of one shape are a real vector space, which is what a gradient and a search direction are compared in.

Definition at line 151 of file dense_matrix.hpp.

◆ rows()

◆ scaled()

template<typename T >
template<typename Factor >
DenseMatrix q3::DenseMatrix< T >::scaled ( const Factor &  factor) const
inline

factor * this, element by element.

Definition at line 127 of file dense_matrix.hpp.

Referenced by q3::exponential_of_anti_hermitian().

◆ scaled_columns()

template<typename T >
template<typename Factor >
DenseMatrix q3::DenseMatrix< T >::scaled_columns ( const std::vector< Factor > &  factors) const
inline

this * diag(factors): column j scaled by factors[j], which needs one factor per column.

Definition at line 190 of file dense_matrix.hpp.

Referenced by q3::exponential_of_anti_hermitian().

◆ scaled_rows()

template<typename T >
template<typename Factor >
DenseMatrix q3::DenseMatrix< T >::scaled_rows ( const std::vector< Factor > &  factors) const
inline

diag(factors) * this: row i scaled by factors[i], which needs one factor per row.

Definition at line 177 of file dense_matrix.hpp.

◆ submatrix()

template<typename T >
DenseMatrix q3::DenseMatrix< T >::submatrix ( const std::vector< int > &  row_indices,
const std::vector< int > &  column_indices 
) const
inline

The rows and columns named, in the order named; an index outside the matrix is refused.

Definition at line 162 of file dense_matrix.hpp.

Referenced by q3::BlochOverlaps::restricted_to().


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