> ## 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.

# SparseLU Class Reference

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

Base class of LU solvers. It already implements the standard LU decomposition.

## Public Types

| Type | Name |
| - | - |
|  typedef number | [TScalar](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_solver.md#ad33f729eda6e45412aac71cee702012f) data type of matrix elements |
|  typedef Eigen::SparseMatrix\< [TScalar](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_solver.md#ad33f729eda6e45412aac71cee702012f) > | [TSparseMatrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_solver.md#a0ce6eae547dc1456730d2df72d9c29cb) the sparse matrix base type |

## Public Member Functions

| Type | Name |
| - | - |
| virtual bool | [Compute](#a79c58864d591ecafc1ef6fc3c5f2e8fc) ([SparseMatrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_matrix.md)) 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\*](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_solver.md#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](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_solver.md#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](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_solver.md#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](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_solver.md#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. |
| | [SparseLU](#a621b6fc7ec546c4d3c0a8516c5902415) () destructor |
| virtual string | [typeIdent](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_solver.md#a4bab1e661cce06aa1bab0b15bc3f5f9e) () |

## Detailed Description

Base class of LU solvers. It already implements the standard LU decomposition.

## Constructor & Destructor Documentation

### SparseLU()

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

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 from [SparseSolver](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_solver.md#a198e988cd87fa6915dd1aa906d1fb87c).

### 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 from [SparseSolver](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_solver.md#ac6480ddf60c975e344ad332af27eba9b).

### operator\*()

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

`virtual` `inherited`

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
)
```

`inherited`

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
)
```

`inherited`

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 from [SparseSolver](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_sparse_solver.md#a6facb69b91b239c79f8272159402c4f4).

### SolveTransposed()

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

`inherited`

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` `inherited`

**Returns**

the name of the datatype
