MPQC  3.0.0-alpha
sc::RefSCMatrix Class Reference

The RefSCMatrix class is a smart pointer to an SCMatrix specialization. More...

#include <math/scmat/matrix.h>

Inheritance diagram for sc::RefSCMatrix:
sc::Ref< SCMatrix > sc::RefBase

Public Types

typedef double value_type
 
typedef double element_type
 
- Public Types inherited from sc::Ref< SCMatrix >
typedef SCMatrix element_type
 

Public Member Functions

 RefSCMatrix ()
 Initializes the matrix pointer to 0. More...
 
 RefSCMatrix (const RefSCMatrix &m)
 Make this and m refer to the same SCMatrix.
 
 RefSCMatrix (SCMatrix *m)
 Make this refer to m.
 
RefSCMatrixoperator= (SCMatrix *m)
 Make this refer to m.
 
RefSCMatrixoperator= (const RefSCMatrix &m)
 Make this and m refer to the same matrix.
 
 RefSCMatrix (const RefSCDimension &d1, const RefSCDimension &d2, const Ref< SCMatrixKit > &)
 Create a vector with dimension d1 by d2. More...
 
RefSCVector operator* (const RefSCVector &) const
 Multiply this by a vector and return a vector.
 
RefSCMatrix operator* (const RefSCMatrix &) const
 Multiply this by a matrix and return a matrix.
 
RefSCMatrix operator* (const RefSymmSCMatrix &) const
 
RefSCMatrix operator* (const RefDiagSCMatrix &) const
 
RefSCMatrix operator* (double) const
 Multiply this by a scalar and return the result.
 
RefSCMatrix operator+ (const RefSCMatrix &) const
 Matrix addition.
 
RefSCMatrix operator- (const RefSCMatrix &) const
 Matrix subtraction.
 
RefSCMatrix t () const
 Return the transpose of this.
 
RefSCMatrix i () const
 Return the inverse of this.
 
RefSCMatrix gi (double condition_number_threshold=1e8) const
 Return the generalized inverse of this using SVD decomposition. More...
 
RefSCMatrix clone () const
 These call the SCMatrix members of the same name after checking for references to 0.
 
RefSCMatrix copy () const
 
RefSCMatrix get_subblock (int br, int er, int bc, int ec)
 
void assign_subblock (const RefSCMatrix &, int br, int er, int bc, int ec, int source_br=0, int source_bc=0)
 
void accumulate_subblock (const RefSCMatrix &, int, int, int, int, int source_br=0, int source_bc=0)
 
RefSCVector get_row (int) const
 
RefSCVector get_column (int) const
 
void assign_row (const RefSCVector &, int) const
 
void assign_column (const RefSCVector &, int) const
 
void accumulate_row (const RefSCVector &, int) const
 
void accumulate_column (const RefSCVector &, int) const
 
void accumulate_outer_product (const RefSCVector &, const RefSCVector &) const
 
void accumulate_product (const RefSCMatrix &, const RefSCMatrix &) const
 
void assign (const RefSCMatrix &) const
 
void scale (double) const
 
void randomize () const
 
void assign (double) const
 
void assign (const double *) const
 
void assign (const double **) const
 
void convert (double *) const
 
void convert (double **) const
 
void accumulate (const RefSCMatrix &) const
 
void accumulate (const RefSymmSCMatrix &) const
 
void accumulate (const RefDiagSCMatrix &) const
 
void element_op (const Ref< SCElementOp > &) const
 
void element_op (const Ref< SCElementOp2 > &, const RefSCMatrix &) const
 
void element_op (const Ref< SCElementOp3 > &, const RefSCMatrix &, const RefSCMatrix &) const
 
int nrow () const
 
int ncol () const
 
RefSCDimension rowdim () const
 
RefSCDimension coldim () const
 
Ref< SCMatrixKitkit () const
 
void set_element (int, int, double) const
 
void accumulate_element (int, int, double) const
 
double get_element (int, int) const
 
void print (std::ostream &) const
 
void print (const char *title=0, std::ostream &out=ExEnv::out0(), int=10) const
 
double trace () const
 
void save (StateOut &)
 
void restore (StateIn &)
 Restores the matrix from StateIn object. The matrix must have been initialized already.
 
void svd (const RefSCMatrix &U, const RefDiagSCMatrix &sigma, const RefSCMatrix &V)
 Compute the singular value decomposition, this = U sigma V.t(). More...
 
double solve_lin (const RefSCVector &v) const
 Solves this x = v. More...
 
double determ () const
 Returns the determinant of the referenced matrix.
 
SCMatrixdouble operator() (int i, int j) const
 Assign and examine matrix elements.
 
int nblock () const
 If this matrix is blocked return the number of blocks. More...
 
RefSCMatrix block (int i) const
 If this matrix is blocked return block i. More...
 
- Public Member Functions inherited from sc::Ref< SCMatrix >
 Ref ()
 Create a reference to a null object.
 
 Ref (SCMatrix *a)
 Create a reference to the object a.
 
 Ref (const Ref< SCMatrix > &a)
 Create a reference to the object referred to by a.
 
 Ref (const Ref< A > &a)
 Create a reference to the object referred to by a.
 
 ~Ref ()
 Create a reference to the object a. More...
 
SCMatrixoperator-> () const
 Returns the reference counted object. More...
 
SCMatrixpointer () const
 Returns a pointer the reference counted object.
 
RefCountparentpointer () const
 Implements the parentpointer pure virtual in the base class.
 
 operator SCMatrix * () const
 
SCMatrixoperator* () const
 Returns a C++ reference to the reference counted object. More...
 
bool null () const
 Return true if this is a reference to a null object. More...
 
bool operator! () const
 
int operator== (const Ref< A > &a) const
 Ordering and equivalence operators are determined by the identifier if both pointers are not null. More...
 
int operator>= (const Ref< A > &a) const
 
int operator<= (const Ref< A > &a) const
 
int operator> (const Ref< A > &a) const
 
int operator< (const Ref< A > &a) const
 
int operator!= (const Ref< A > &a) const
 
int compare (const Ref< SCMatrix > &a) const
 Compare two objects returning -1, 0, or 1. More...
 
void clear ()
 Refer to the null object.
 
Ref< SCMatrix > & operator= (const Ref< SCMatrix > &c)
 Assignment to c.
 
Ref< SCMatrix > & operator= (const Ref< A > &c)
 Assignment to c.
 
Ref< SCMatrix > & operator= (SCMatrix *cr)
 Assignment to cr.
 
Ref< SCMatrix > & operator<< (const RefBase &a)
 Assignment to the object that a references using dynamic_cast.
 
Ref< SCMatrix > & operator<< (RefCount *a)
 Assigns to the given base class pointer using dynamic_cast. More...
 
void assign_pointer (SCMatrix *cr)
 Assignment to cr.
 
void check_pointer () const
 Check the validity of the pointer.
 
void ref_info (std::ostream &os) const
 Print information about the reference to os.
 
void warn (const char *s) const
 Print a warning concerning the reference.
 
bool nonnull () const
 Return !null().
 
- Public Member Functions inherited from sc::RefBase
void require_nonnull () const
 Requires that a nonnull reference is held. More...
 

Additional Inherited Members

- Protected Member Functions inherited from sc::RefBase
void warn (const char *msg) const
 Print a warning message.
 
void warn_ref_to_stack () const
 Called when stack data is referenced.
 
void warn_skip_stack_delete () const
 Called when the deletion of stack data is skipped.
 
void warn_bad_ref_count () const
 Called when the reference count is corrupted.
 
void ref_info (RefCount *p, std::ostream &os) const
 Print information about the reference.
 
void ref_info (std::ostream &os) const
 
void check_pointer () const
 
void reference (RefCount *)
 
int dereference (RefCount *)
 

Detailed Description

The RefSCMatrix class is a smart pointer to an SCMatrix specialization.

Constructor & Destructor Documentation

◆ RefSCMatrix() [1/2]

sc::RefSCMatrix::RefSCMatrix ( )

Initializes the matrix pointer to 0.

The reference must be initialized before it is used.

◆ RefSCMatrix() [2/2]

sc::RefSCMatrix::RefSCMatrix ( const RefSCDimension d1,
const RefSCDimension d2,
const Ref< SCMatrixKit > &   
)

Create a vector with dimension d1 by d2.

The data values are undefined.

Member Function Documentation

◆ block()

RefSCMatrix sc::RefSCMatrix::block ( int  i) const

If this matrix is blocked return block i.

Otherwise return this as block 0.

◆ gi()

RefSCMatrix sc::RefSCMatrix::gi ( double  condition_number_threshold = 1e8) const

Return the generalized inverse of this using SVD decomposition.

See also
SCMatrix::gen_invert_this()

◆ nblock()

int sc::RefSCMatrix::nblock ( ) const

If this matrix is blocked return the number of blocks.

Otherwise return 1.

◆ solve_lin()

double sc::RefSCMatrix::solve_lin ( const RefSCVector v) const

Solves this x = v.

Overwrites v with x.

◆ svd()

void sc::RefSCMatrix::svd ( const RefSCMatrix U,
const RefDiagSCMatrix sigma,
const RefSCMatrix V 
)

Compute the singular value decomposition, this = U sigma V.t().

The dimension of sigma is the smallest dimension of this. U, V, and sigma must already have the correct dimensions and are overwritten.


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

Generated at Sun Jan 26 2020 23:24:10 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.