subtractScalar() public method

public subtractScalar ( float $value ) : self
$value float
return self
コード例 #1
0
 public function testSubtractScalar()
 {
     $matrix = new Matrix([[4, 2, 6], [1, 7, 3], [7, 3, 2]]);
     $subtracted = $matrix->subtractScalar(4);
     static::assertEquals(0, $subtracted->get(0, 0));
     static::assertEquals(-2, $subtracted->get(0, 1));
     static::assertEquals(2, $subtracted->get(0, 2));
     static::assertEquals(-3, $subtracted->get(1, 0));
     static::assertEquals(3, $subtracted->get(1, 1));
     static::assertEquals(-1, $subtracted->get(1, 2));
     static::assertEquals(3, $subtracted->get(2, 0));
     static::assertEquals(-1, $subtracted->get(2, 1));
     static::assertEquals(-2, $subtracted->get(2, 2));
 }