mass#
- AnsMath.mass(dtype=<class 'numpy.float64'>, name=None, fname='file.full', asarray=False)#
Load the mass matrix from a FULL file.
- Parameters:
- dtype
numpy.dtype
,optional
NumPy data type to store the matrix as. The options are
np.double
,np.int32
, andnp.int64
. The default isnp.double
. This parameter is only applicable ifasarray=True
.- name
str
,optional
AnsMath matrix name. The default is
None
, in which case a name is automatically generated.- fname
str
,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
.
- dtype
- Returns:
AnsMat
orscipy.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>.