mass#

AnsMath.mass(dtype=<class 'numpy.float64'>, name=None, fname='file.full', asarray=False)#

Load the mass matrix from a FULL file.

Parameters:
dtypenumpy.dtype, optional

NumPy data type to store the matrix as. The options are np.double, np.int32, and np.int64. The default is np.double. This parameter is only applicable if asarray=True.

namestr, optional

AnsMath matrix name. The default is None, in which case a name is automatically generated.

fnamestr, optional

Name of the file to read the matrix from. The default is "file.full".

asarraybool, optional

Whether to return a SciPy array rather than an AnsMath matrix. The default is False.

Returns:
AnsMat or scipy.sparse.csr.csr_matrix

AnsMath matrix or SciPy sparse matrix, depending on the value for the asarray parameter.

Examples

>>> import ansys.math.core.math as pymath
>>> mm = pymath.AnsMath()
>>> mass = mm.mass()
>>> mass
AnsMath matrix 60 x 60

Convert to a SciPy array.

>>> mat = mass.asarray()
>>> mat
<60x60 sparse matrix of type '<class 'numpy.float64'>'
    with 1734 stored elements in Compressed Sparse Row (CSR) format>.