asarray#

AnsMat.asarray(dtype=None) ndarray#

Return the matrix as a NumPy array.

Parameters:
dtypenumpy.dtype, optional

NumPy data type to upload the array as. The options are np.double, np.int32, and np.int64. The default is the current array type.

Returns:
np.ndarray

NumPy array with the defined data type.

Examples

>>> import ansys.math.core.math as pymath
>>> mm = pymath.AnsMath()
>>> v = mm.ones(2,2)
>>> v.asarray()
array([[1., 1.], [1., 1.]])
>>> v.asarray(dtype=np.int32)
array([[1, 1], [1, 1]])