identity() public static method

public static identity ( integer $size ) : self
$size integer How many rows and columns the identity matrix should have
return self
Example #1
0
 public function testIdentity()
 {
     $identity = Matrix::identity(3);
     static::assertEquals(1, $identity->get(0, 0));
     static::assertEquals(0, $identity->get(0, 1));
     static::assertEquals(0, $identity->get(0, 2));
     static::assertEquals(0, $identity->get(1, 0));
     static::assertEquals(1, $identity->get(1, 1));
     static::assertEquals(0, $identity->get(1, 2));
     static::assertEquals(0, $identity->get(2, 0));
     static::assertEquals(0, $identity->get(2, 1));
     static::assertEquals(1, $identity->get(2, 2));
 }