# auxmem - Man Page

## Name

auxmem — Memory Query Routines

— Query memory requirements of the computational routines.

## Synopsis

### Functions

ssize_t **mepack_memory** (const char *func, int M, int N)

Query the size of the workspace for triangular solvers.

ssize_t **mepack_memory_frontend** (const char *func, const char *factA, const char *factB, int M, int N)

Query the size of the workspace for frontend routines.

## Detailed Description

Query memory requirements of the computational routines.

Many of the computational routines require a separate work_space during the computation. Due to the fact that this memory can be reused and memory allocation is normally a costly process, this needs to be done before calling a matrix equation solver. From Fortran this is achieved by calling a subroutine with the INFO parameter set to -1 on entry. From C this can cause integer overflows if MEPACK is compiled using 64 bit integers. For this reason if the work_space should be queried from C codes, the function from this section should be used. They perform the correct typecasts internally. This avoids most of the integer overflows and makes the query more easy.

## Function Documentation

### ssize_t mepack_memory (const char * func, int M, int N)

Query the size of the workspace for triangular solvers.

**Purpose:**

The mepack_memory function queries the size of the required routine. It wraps around the Fortran style workspace query and adds a typecast to avoid integer overflows. This can happen if MEPACK is compiled with the support for 64-bit integers in Fortran. If solver only relies on one dimension argument, e.g. a Lyapunov or a Stein equation is planed to be solved, only the **M** parameter is used. The value of **N** is neglected in this case. The frontend routines, i.e. the ones dealing with the transformation matrices as well, have to use **mepack_memory_frontend** to query their memory requirements.

**See also****mepack_memory_frontend****Remarks**This function should be used from C. If the workspace query is performed from a Fortran code, the workspace is queried by passing INFO == -1 to the corresponding solver.

**Parameters***func*The name of the solver for which the size of the workspace should be queried. The argument is not case sensitive.*M*The number of rows of the solution, the right hand side, and the order of the matrices from the left side. If the equation only depends on one dimension argument, this is given here.*N*The number of columns of the solution, the right hand side, and the order of the matrices from the right side. If the equation only depends on one dimension argument, this parameter is not used.**Returns**The memory requirements of the routine counted in floating point number of the desired precision. That means the return value either needs to be multiplied by sizeof(float) or sizeof(double). A negative return value indicates an error. This error code is explained in the description of the corresponding routine for which the memory query was performed.

Definition at line **69** of file **memory.c**.

### ssize_t mepack_memory_frontend (const char * func, const char * factA, const char * factB, int M, int N)

Query the size of the workspace for frontend routines.

**Purpose:**

The mepack_memory_frontend function queries the size of the required routine. It wraps around the Fortran style workspace query and adds a typecast to avoid integer overflows. This can happen if MEPACK is compiled with the support for 64-bit integers in Fortran. If solver only relies on one dimension argument, e.g. a Lyapunov or a Stein equation is planed to be solved, only the **M** and the **factA** parameters are used. The values of **N** and **factB** are neglected in this case. The triangular solvers, i.e. the ones which only aware of the triangular coefficient matrices, have to use **mepack_memory** to query their memory requirements.

**See also****mepack_memory****Remarks**This function should be used from C. If the workspace query is performed from a Fortran code, the workspace is queried by passing INFO == -1 to the corresponding solver.

**Parameters***func*The name of the solver for which the size of the workspace should be queried. The argument is not case sensitive.*factA*Indicates whether the first matrix pair is already factorized or not. If 'N' is passed the matrix pair is not factorized. If 'F' is passed it is. For Lyapunov and Stein equations only this parameter is used.*factB*Indicates whether the second matrix pair is already factorized or not. If 'N' is passed the matrix pair is not factorized. If 'F' is passed it is. For Lyapunov and Stein equations this parameter is not used.*M*The number of rows of the solution, the right hand side, and the order of the matrices from the left side. If the equation only depends on one dimension argument, this is given here.*N*The number of columns of the solution, the right hand side, and the order of the matrices from the right side. If the equation only depends on one dimension argument, this parameter is not used.**Returns**memory requirements of the routine counted in floating point number of the desired precision. That means the return value either needs to be multiplied by sizeof(float) or sizeof(double). A negative return value indicates an error. This error code is explained in the description of the corresponding routine for which the memory query was performed.

Definition at line **77** of file **memory_frontend.c**.

## Author

Generated automatically by Doxygen for MEPACK from the source code.