norm#

AnsMat.norm(nrmtype='nrm2')#

Return the norm of the AnsMath object.

Parameters:
nrmtypestr, optional

Mathematical norm to use. The default is 'NRM2'. Options are:

  • 'NRM2': L2 (Euclidean or SRSS) norm.

  • 'NRM1': L1 (absolute sum) norm (vectors only).

  • 'NRMINF': Maximum norm.

Returns:
float

Norm of the matrix or the one or more vectors.

Examples

>>> dim = 1000
>>> m2 = mm.rand(dim, dim)
>>> nrm = m2.norm()