LinAlg::norm

Matrix or vector norm.

Description

float|int LinAlg::norm( array|NdArray $m )

Parameters

$m
An array [1, 2, 3] or a NdArray.

Return Values

A float or an integer. Norm of the matrix or vector.

Examples

Example #1: Calculating norm of a matrix

use SciPhp\NumPhp as np;

$m 
    [[
12],
     [
02]];

echo 
np::linalg()->norm($m);

The above example will output:

3

See Also