asarray#

AnsVec.asarray(dtype=None) ndarray#

Return the vector as a NumPy array.

Parameters:
dtypenumpy.dtype, optional

NumPy data type to upload the array as. The options are numpy.double, numpy.int32, and numpy.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(10)
>>> v.asarray()
[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
>>> v.asarray(dtype=np.int32)
[1 1 1 1 1 1 1 1 1 1]