ansys.mapdl.core.Mapdl.smat#

Mapdl.smat(matrix='', type_='', method='', val1='', val2='', val3='', val4='', val5='', **kwargs)#

Creates a sparse matrix.

Mechanical APDL Command: *SMAT

Parameters:
matrixstr

Name used to identify the matrix. Must be specified.

type_str

Matrix type:

  • D - Double precision real values (default).

  • Z - Complex double precision values.

methodstr

Method used to create the matrix:

  • ALLOC - Allocate a new matrix.

  • COPY - Copy an existing matrix.

  • IMPORT - Import the matrix from a file.

val1str

Name of the matrix to copy (can be either a dense or a sparse matrix).

val2str

Method used for copying the matrix:

  • DIAG - Copy only the diagonal of the matrix. Val3 and Val4 are ignored.

  • TRANS - Transpose the original matrix. Val3 and Val4 are ignored.

  • EXTRACT - Extract a submatrix based on row and column numbers specified by Val3 and Val4.

val3str

Name of integer vector ( vec ) containing row numbers. If no vector is specified, defaults to all rows.

val4str

Name of integer vector ( vec ) containing column numbers. If no vector is specified, defaults to all columns.

val5str

Additional input. The meaning of Val1 through Val5 will vary depending on the specified Method. See details below.

Notes

Warning

This function contains specificities regarding the argument definitions. Please refer to the command documentation for further explanations.

Argument Descriptions

  • matrix : str - Name used to identify the matrix. Must be specified.

  • type_ : str - Matrix type:

    • D - Double precision real values (default).

    • Z - Complex double precision values.

  • method : str - Method used to create the matrix:

    • ALLOC - Allocate a new matrix.

    • COPY - Copy an existing matrix.

    • IMPORT - Import the matrix from a file.

  • val1, val2, val3, val4, val5 : str - Additional input. The meaning of Val1 through Val5 will vary depending on the specified Method. See details below.

The following Valx fields are used with Method = ALLOC.

  • val1 : str - Method used to create the matrix:

    • DIAG - Allocate a diagonal square matrix. Val2 is used; Val3, Val4, and Val5 are ignored.

      • Val2 - Matrix size.

    • CSR - Create a square sparse matrix based on Compressed Sparse Row (CSR) format description vectors. This format requires 3 input vectors specified as Val2, Val3 and Val4.

      • Val2, Val3, Val4 - Names of required row_ptr, col_ind and val vectors. These vectors must be created using the vec command.

        row_ptr is a long integer vector (use of L instead of I as the scalar type in the vec call); col_ind is an integer vector. Val can be a real of complex values vector, according to the matrix type.

      • Val5 - Specifies whether the matrix is symmetric (TRUE) or unsymmetric (FALSE). Default = TRUE.

The following Valx fields are used with Method = COPY.

  • val1 : str - Name of the matrix to copy (can be either a dense or a sparse matrix).

  • val2 : str - Method used for copying the matrix:

    • DIAG - Copy only the diagonal of the matrix. Val3 and Val4 are ignored.

    • TRANS - Transpose the original matrix. Val3 and Val4 are ignored.

    • EXTRACT - Extract a submatrix based on row and column numbers specified by Val3 and Val4.

  • val3 : str - Name of integer vector ( vec ) containing row numbers. If no vector is specified, defaults to all rows.

  • val4 : str - Name of integer vector ( vec ) containing column numbers. If no vector is specified, defaults to all columns.

The following table describes the Valx fields used with Method = IMPORT.

This command contains some tables and extra information which can be inspected in the original documentation pointed above.

Use the dmat command to create a dense matrix.

For more information on the CSR format, see Creating a Sparse Matrix Using the CSR Format

For more information on the NOD2SOLV and USR2SOLV mapping vectors, see.

For more information about .FULL file contents, see the hbmat in the Command Reference.