> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SparseSolver Class Reference

Part of [tmath](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__tmath)

The base class for sparse solvers. It provides a unified interface which can be used by generic algorithms.

## Public Types

| Type | Name |
| - | - |
|  typedef number | [TScalar](#ad33f729eda6e45412aac71cee702012f) data type of matrix elements |
|  typedef Eigen::SparseMatrix\< [TScalar](#ad33f729eda6e45412aac71cee702012f) > | [TSparseMatrix](#a0ce6eae547dc1456730d2df72d9c29cb) the sparse matrix base type |

## Public Member Functions

| Type | Name |
| - | - |
| virtual bool | [Compute](#a198e988cd87fa6915dd1aa906d1fb87c) ([SparseMatrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_matrix.md) A) computes the factorization, returns true if succeeded |
| virtual bool | [Compute](#ac6480ddf60c975e344ad332af27eba9b) ([SymSparseMatrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sym_sparse_matrix.md) A) computes the factorization, returns true if succeeded |
| virtual [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) | [operator\*](#ab575d53b6b3741bf8b54ca4dad896322) ([Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) other) returns the matrix product inv(A)\*B |
| | [Solve](#a03c9937003c1c78404c778f1ce257cfd) ([Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) INPUT, [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) \*\*OUTPUT, bool \*\*OUTPUT) Solves the given vector on return; returns true if succeeded. |
| | [Solve](#aed85b6e6bc9e10b49a5eacee4930dc12) ([SparseMatrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_matrix.md) INPUT, [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) \*\*OUTPUT, bool \*\*OUTPUT) Solves the given sparse RHS on return; returns true if succeeded. |
| virtual bool | [SolveInPlace](#a6facb69b91b239c79f8272159402c4f4) ([Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) b) Factorizes this matrix and solves the given vector in place;. |
| | [SolveTransposed](#aeb600a838ac25ea5705191ddcd35d5aa) ([Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) INPUT, [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) \*\*OUTPUT, bool \*\*OUTPUT) Solves the system (transpose(Matrix)\*x=b for x; returns true if succeeded. |
| | [SparseSolver](#af1e7f2e7e3552b4dc667f324d0f21492) () destructor |
| virtual string | [typeIdent](#a4bab1e661cce06aa1bab0b15bc3f5f9e) () |

## Detailed Description

The base class for sparse solvers. It provides a unified interface which can be used by generic algorithms.

## Constructor & Destructor Documentation

### SparseSolver()

```cpp theme={null}
SparseSolver()
```

destructor

default constructor

## Member Function Documentation

### Compute() \[1/2]

```cpp theme={null}
virtual bool Compute(SparseMatrix A)
```

`virtual`

computes the factorization, returns true if succeeded

**Parameters**

| Name | Description |
| - | - |
| A | the matrix to be factorized |

**Returns**

true of successful

Reimplemented in [SparseLU](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_l_u.md#a79c58864d591ecafc1ef6fc3c5f2e8fc), and [MUMPS](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_m_u_m_p_s.md#a79c58864d591ecafc1ef6fc3c5f2e8fc).

### Compute() \[2/2]

```cpp theme={null}
virtual bool Compute(SymSparseMatrix A)
```

`virtual`

computes the factorization, returns true if succeeded

**Parameters**

| Name | Description |
| - | - |
| A | the matrix to be factorized |

**Returns**

true of successful

Reimplemented in [SparseLU](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_l_u.md#ac6480ddf60c975e344ad332af27eba9b), and [MUMPS](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_m_u_m_p_s.md#a5526f969e26fc63c313b4aa589c764d8).

### operator\*()

```cpp theme={null}
virtual Matrix operator*(Matrix other)
```

`virtual`

returns the matrix product inv(A)\*B

**Parameters**

| Name | Description |
| - | - |
| other | the second argument of inv(A)\*B |

**Returns**

the product of the factorized matrix multiplied with *other*

### Solve() \[1/2]

```cpp theme={null}
Solve(
    Matrix INPUT,
    Matrix ** OUTPUT,
    bool ** OUTPUT
)
```

Solves the given vector on return; returns true if succeeded.

**Parameters**

| Name | Description |
| - | - |
| b | the right hand side |
| x | the solution |
| success | the return value of *Solve(b,x)* allow the SWIG syntax (x,bool)=Solve(b) for solving x in Ax=b in script bindings |

### Solve() \[2/2]

```cpp theme={null}
Solve(
    SparseMatrix INPUT,
    Matrix ** OUTPUT,
    bool ** OUTPUT
)
```

Solves the given sparse RHS on return; returns true if succeeded.

**Parameters**

| Name | Description |
| - | - |
| b | the right hand side |
| x | the solution |

**Returns**

true if successfulallows the SWIG syntax (x,bool)=Solve(b) for solving x in Ax=b in script

### SolveInPlace()

```cpp theme={null}
virtual bool SolveInPlace(Matrix b)
```

`virtual`

Factorizes this matrix and solves the given vector in place;.

**Returns**

returns true if succeeded

**Parameters**

| Name | Description |
| - | - |
| b | on input: the right hand side. On output: the solution x |

Reimplemented in [SparseLU](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_l_u.md#a6facb69b91b239c79f8272159402c4f4), and [MUMPS](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_m_u_m_p_s.md#a6facb69b91b239c79f8272159402c4f4).

### SolveTransposed()

```cpp theme={null}
SolveTransposed(
    Matrix INPUT,
    Matrix ** OUTPUT,
    bool ** OUTPUT
)
```

Solves the system (transpose(Matrix)\*x=b for x; returns true if succeeded.

**Parameters**

| Name | Description |
| - | - |
| b | the right hand side |
| x | the solution |

**Returns**

true if successful allows the SWIG syntax (x,bool)=Solve(b) for solving x in Ax=b in script.

### typeIdent()

```cpp theme={null}
virtual string typeIdent()
```

`virtual`

**Returns**

the name of the datatype
