chrono::ChMklEngine Class Reference

## Description

Interface class to Intel MKL Pardiso solver.

This class wraps the C interface of the solver in order to fit Chrono data structures. This class can still be called by the end-user in order to solve linear systems. See demo_MKL_MklEngine for the related demo.

#include <ChMklEngine.h>

## Public Types

enum  phase_t {
COMPLETE = 13, ANALYSIS = 11, ANALYSIS_NUMFACTORIZATION = 12, NUMFACTORIZATION = 22,
NUMFACTORIZATION_SOLVE = 23, SOLVE = 33, SOLVE_FORWARD = 331, SOLVE_DIAGONAL = 332,
SOLVE_BACKWARD = 333, RELEASE_FACTORS = 0, RELEASE_ALL = -1
}
Pardiso phases.

## Public Member Functions

ChMklEngine (int pb_size=0, ChSparseMatrix::SymmetryType matrix_type=ChSparseMatrix::GENERAL)

void SetProblemSize (int pb_size)
Set problem dimension.

void SetMatrix (ChSparseMatrix &Z)
Set the problem matrix. More...

void SetMatrix (int pb_size, double *a, int *ia, int *ja)
Set directly the CSR matrix arrays. More...

void SetSolutionVector (ChVectorRef x)
Set the solution vector. More...

void SetSolutionVector (double *x)
As SetSolutionVector(ChVectorRef).

void SetRhsVector (ChVectorRef b)
Set the right-hand side vector. More...

void SetRhsVector (double *b)
As #SetRhsVector(ChMatrix<>&).

void SetProblem (ChSparseMatrix &Z, ChVectorRef b, ChVectorRef x)
Set the matrix, as well as the right-hand side and solution arrays.

int PardisoCall (int phase, int message_level=0)
Solver routine.

void ResetSolver ()
Reinitializes the solver to default values.

void GetResidual (ChVectorRef res) const
Calculate and return the problem residual res=b-Ax. More...

void GetResidual (double *res) const
As GetResidual(ChMatrix<>&).

double GetResidualNorm () const
Calculate and return the L2-norm of the problem residual, ||b-Ax||.

void SetIparmValue (int parm_num, MKL_INT value)
Set the value of the specified entry in the Pardiso parameter list.

MKL_INT GetIparmValue (int parm_num) const
Return the current value of the specified Pardiso parameter.

Get the Pardiso parameter list.

void PrintPardisoParameters () const
Print the current values of the Pardiso solver parameters.

void UsePermutationVector (bool val)
Enable/disable use of permutation vector. More...

void UsePartialSolution (int option=1, int start_row=0, int end_row=0)
Computes only a part of the solution, from start_row to end_row.

void OutputSchurComplement (int option, int start_row, int end_row=0)
The Schur complement is output on the solution vector m_x that has to be resized to m_n x m_n size; The next call to Pardiso must not involve a solution phase. More...

void SetPreconditionedCGS (bool val, int L)
Set the parameter that controls preconditioned CGS.

## Member Function Documentation

 void chrono::ChMklEngine::GetResidual ( ChVectorRef res ) const

Calculate and return the problem residual res=b-Ax.

Note that it is the caller's responsibility to provide an array of appropriate size.

 void chrono::ChMklEngine::OutputSchurComplement ( int option, int start_row, int end_row = 0 )

The Schur complement is output on the solution vector m_x that has to be resized to m_n x m_n size; The next call to Pardiso must not involve a solution phase.

So no phase 33, 331, 332, 333, 23, 13, etc... Any solution phase in fact would output the solution on the solution vector m_x. The element (start_row,start_row) must be the top-left element of the matrix on which the Schur complement will be computed; The element (end_row,end_row) must be the bottom-right element of the matrix on which the Schur complement will be computed;

 void chrono::ChMklEngine::SetMatrix ( ChSparseMatrix & Z )

Set the problem matrix.

This will also update the problem dimension as well as the matrix symmetry type.

 void chrono::ChMklEngine::SetMatrix ( int pb_size, double * a, int * ia, int * ja )

Set directly the CSR matrix arrays.

Note that it is implied that the matrix symmetry type is GENERAL.

 void chrono::ChMklEngine::SetRhsVector ( ChVectorRef b )

Set the right-hand side vector.

Note that it is the caller's responsibility to ensure that the size is appropriate.

 void chrono::ChMklEngine::SetSolutionVector ( ChVectorRef x )

Set the solution vector.

Note that it is the caller's responsibility to provide an array of appropriate size.

 void chrono::ChMklEngine::UsePermutationVector ( bool val )

Enable/disable use of permutation vector.

Indicate to the solver to store the permutation vector and use it in the next calls.