NumPhp::is_square

Check that it's a square matrix.

Description

bool NumPhp::is_square( array|NdArray $m )

Parameters

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

Return Values

A boolean. True if given matrix is a square matrix, false otherwise.

Examples

Example #1: Matrices are square?

use SciPhp\NumPhp as np;

// false, it's a 1-dim
np::is_square([123]);

// true, it's a 3x3
np::is_square(
 [[
123],
  [
123],
  [
123]]
);

// false, it's a 4x3
np::is_square(
 [[
123],
  [
123],
  [
123],
  [
123]]
);

See Also