identity() 공개 정적인 메소드

public static identity ( integer $size ) : self
$size integer How many rows and columns the identity matrix should have
리턴 self
예제 #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));
 }