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:
- nrow
int Number of rows.
- ncol
int,optional Number of columns. If a value is specified, a matrix is returned.
- dtype
np.dtype,optional NumPy data type of the object. The options are
np.double,np.int32, andnp.int64. The default isnp.double.- name
str,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.
- nrow
- Returns:
AnsVec,AnsMat,ornumpy.ndarrayAnsMath vector, NumPy array vector, AnsMath matrix, or NumPy array matrix, depending on the value for the
asarrayparameter and if a value for thencolparameter 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)