matrix#
- AnsMath.matrix(matrix, name=None, triu=False)#
 Send a SciPy matrix or NumPy array to MAPDL.
- Parameters:
 - matrix
np.ndarray SciPy matrix or NumPy array to send as a matrix to MAPDL.
- name
str,optional AnsMath matrix name. The default is
None, in which case a name is automatically generated.- triubool, 
optional Whether the matrix is the upper triangular. The default is
False, which means that the matrix is unsymmetric.
- matrix
 - Returns:
 AnsMatMath matrix.
Examples
Generate a random sparse matrix.
>>> from scipy import sparse >>> sz = 5000 >>> mat = sparse.random(sz, sz, density=0.05, format='csr') >>> ans_mat = mm.matrix(mat, name) >>> ans_mat AnsMath matrix 5000 x 5000
Transfer the matrix back to Python.
>>> ans_mat.asarray() <500x5000 sparse matrix of type '<class 'numpy.float64'>' with 1250000 stored elements in Compressed Sparse Row (CSR) format>