---
name: "sc_DiagSCMatrix"
section: "3"
platform: "linux"
package: "libsc-doc"
version: "2.3.1-22"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/sc_DiagSCMatrix"
---

# sc\_DiagSCMatrix(3)

The SymmSCMatrix class is the abstract base class for diagonal double valued matrices.

## NAME

sc::DiagSCMatrix - The **SymmSCMatrix** class is the abstract base class for diagonal double valued matrices.

## SYNOPSIS

`#include <abstract.h>`

Inherits **sc::DescribedClass**.

Inherited by **sc::BlockedDiagSCMatrix**, **sc::DistDiagSCMatrix**, **sc::LocalDiagSCMatrix**, and **sc::ReplDiagSCMatrix**.

### Public Member Functions

**DiagSCMatrix** (const **RefSCDimension** &, **SCMatrixKit** \*)\
 **Ref**\< **SCMatrixKit** \> **kit** () const\
 Return the **SCMatrixKit** used to create this object.  virtual void **save** (**StateOut** &)\
 Save and restore this in an implementation independent way.  virtual void **restore** (**StateIn** &)\
 virtual double **maxabs** () const\
 Return the maximum absolute value element of this vector.  virtual void **randomize** ()\
 Assign each element to a random number between -1 and 1.  void **assign** (double val)\
 Set all elements to val.  void **assign** (const double \*p)\
 Assign element i, i to m\[i\].  void **assign** (**DiagSCMatrix** \*d\_a)\
 Make this have the same elements as m.  virtual void **assign\_val** (double val)\
 Overridden to implement the assign members.  virtual void **assign\_p** (const double \*)\
 virtual void **assign\_d** (**DiagSCMatrix** \*)\
 virtual void **convert** (double \*) const\
 Like the assign member, but this writes values to the argument.  virtual void **convert** (**DiagSCMatrix** \*)\
 Convert an SCDiagSCMatrix of a different specialization to this specialization and possibly accumulate the data.  virtual void **convert\_accumulate** (**DiagSCMatrix** \*)\
 virtual void **scale** (double)\
 Multiply all elements by val.  int **n** () const\
 Return the dimension.  virtual **DiagSCMatrix** \* **copy** ()\
 Return a matrix with the same dimension and same elements.  virtual **DiagSCMatrix** \* **clone** ()\
 Return a matrix with the same dimension but uninitialized memory.  **RefSCDimension** **dim** () const\
 Return the dimension.  virtual double **get\_element** (int) const =0\
 Return or modify an element.  virtual void **set\_element** (int, double)=0\
 virtual void **accumulate\_element** (int, double)=0\
 virtual void **accumulate** (const **DiagSCMatrix** \*m)=0\
 Sum m into this.  virtual double **trace** ()=0\
 Return the trace.  virtual double **determ\_this** ()=0\
 Return the determinant of this. this is overwritten.  virtual double **invert\_this** ()=0\
 Invert this.  virtual void **gen\_invert\_this** ()=0\
 Do a generalized inversion of this.  virtual void **element\_op** (const **Ref**\< **SCElementOp** \> &)=0\
 Perform the element operation op on each element of this.  virtual void **element\_op** (const **Ref**\< **SCElementOp2** \> &, **DiagSCMatrix** \*)=0\
 virtual void **element\_op** (const **Ref**\< **SCElementOp3** \> &, **DiagSCMatrix** \*, **DiagSCMatrix** \*)=0\
 void **print** (std::ostream &o=**ExEnv::out0**()) const\
 Print out the matrix.  void **print** (const char \*title=0, std::ostream &out=**ExEnv::out0**(), int=10) const\
 virtual void **vprint** (const char \*title=0, std::ostream &out=**ExEnv::out0**(), int=10) const\
 **Ref**\< **MessageGrp** \> **messagegrp** () const\
 Returns the message group used by the matrix kit.  virtual **Ref**\< **SCMatrixSubblockIter** \> **local\_blocks** (SCMatrixSubblockIter::Access)=0\
 Returns iterators for the local (rapidly accessible) blocks used in this matrix.  virtual **Ref**\< **SCMatrixSubblockIter** \> **all\_blocks** (SCMatrixSubblockIter::Access)=0\
 Returns iterators for the all blocks used in this matrix.

### Protected Attributes

**RefSCDimension** **d**\
 **Ref**\< **SCMatrixKit** \> **kit\_**\

### Additional Inherited Members

## Detailed Description

The **SymmSCMatrix** class is the abstract base class for diagonal double valued matrices.

## Member Function Documentation

### virtual void sc::DiagSCMatrix::accumulate (const DiagSCMatrix \* m)` [pure virtual]`

Sum m into this.

Implemented in **sc::BlockedDiagSCMatrix**, **sc::DistDiagSCMatrix**, **sc::LocalDiagSCMatrix**, and **sc::ReplDiagSCMatrix**.

### virtual Ref\< SCMatrixSubblockIter \> sc::DiagSCMatrix::all\_blocks (SCMatrixSubblockIter::Access)` [pure virtual]`

Returns iterators for the all blocks used in this matrix.

Implemented in **sc::BlockedDiagSCMatrix**, **sc::DistDiagSCMatrix**, **sc::LocalDiagSCMatrix**, and **sc::ReplDiagSCMatrix**.

### void sc::DiagSCMatrix::assign (DiagSCMatrix \* d\_a)` [inline]`

Make this have the same elements as m. The dimensions must match.

### virtual void sc::DiagSCMatrix::assign\_val (double val)` [virtual]`

Overridden to implement the assign members.

Reimplemented in **sc::ReplDiagSCMatrix**.

Referenced by **assign()**.

### virtual double sc::DiagSCMatrix::determ\_this ()` [pure virtual]`

Return the determinant of this. this is overwritten.

Implemented in **sc::BlockedDiagSCMatrix**, **sc::DistDiagSCMatrix**, **sc::LocalDiagSCMatrix**, and **sc::ReplDiagSCMatrix**.

### virtual void sc::DiagSCMatrix::element\_op (const Ref\< SCElementOp \> &)` [pure virtual]`

Perform the element operation op on each element of this.

Implemented in **sc::BlockedDiagSCMatrix**, **sc::DistDiagSCMatrix**, **sc::LocalDiagSCMatrix**, and **sc::ReplDiagSCMatrix**.

### virtual void sc::DiagSCMatrix::gen\_invert\_this ()` [pure virtual]`

Do a generalized inversion of this.

Implemented in **sc::BlockedDiagSCMatrix**, **sc::DistDiagSCMatrix**, **sc::LocalDiagSCMatrix**, and **sc::ReplDiagSCMatrix**.

### virtual double sc::DiagSCMatrix::get\_element (int) const` [pure virtual]`

Return or modify an element.

Implemented in **sc::BlockedDiagSCMatrix**, **sc::DistDiagSCMatrix**, **sc::LocalDiagSCMatrix**, and **sc::ReplDiagSCMatrix**.

### virtual double sc::DiagSCMatrix::invert\_this ()` [pure virtual]`

Invert this.

Implemented in **sc::BlockedDiagSCMatrix**, **sc::DistDiagSCMatrix**, **sc::LocalDiagSCMatrix**, and **sc::ReplDiagSCMatrix**.

### virtual Ref\< SCMatrixSubblockIter \> sc::DiagSCMatrix::local\_blocks (SCMatrixSubblockIter::Access)` [pure virtual]`

Returns iterators for the local (rapidly accessible) blocks used in this matrix.

Implemented in **sc::BlockedDiagSCMatrix**, **sc::DistDiagSCMatrix**, **sc::LocalDiagSCMatrix**, and **sc::ReplDiagSCMatrix**.

### void sc::DiagSCMatrix::print (std::ostream & o = ExEnv::out0`()`) const` [virtual]`

Print out the matrix.

Reimplemented from **sc::DescribedClass**.

### virtual void sc::DiagSCMatrix::save (StateOut &)` [virtual]`

Save and restore this in an implementation independent way.

Reimplemented in **sc::BlockedDiagSCMatrix**.

### virtual double sc::DiagSCMatrix::trace ()` [pure virtual]`

Return the trace.

Implemented in **sc::BlockedDiagSCMatrix**, **sc::DistDiagSCMatrix**, **sc::LocalDiagSCMatrix**, and **sc::ReplDiagSCMatrix**.

## Author

Generated automatically by Doxygen for MPQC from the source code.
