zeros#

AnsMath.zeros(nrow, ncol=None, dtype=<class 'numpy.float64'>, name=None, asarray=False)#

Create a vector or a matrix where all values are zeros.

Parameters:
nrowint

Number of rows.

ncolint, optional

Number of columns. If a value is specified, a matrix is returned.

dtypenp.dtype, optional

NumPy data type of the object. The options are np.double, np.int32, and np.int64. The default is np.double.

namestr, optional

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

asarraybool, optional

Whether to return a NumPy array rather than an AnsMath object. The default is False.

Returns:
AnsVec, AnsMat, or numpy.ndarray

AnsMath vector, NumPy array vector, AnsMath matrix, or NumPy array matrix, depending on the value for the asarray parameter and if a value for the ncol parameter is specified.

Examples

Create a vector where all values are zeros.

>>> import ansys.math.core.math as pymath
>>> mm = pymath.AnsMath()
>>> vec = mm.zeros(10)

Create a matrix where all values are zeros.

>>> mat = mm.zeros(10, 10)