addScalar() public method

public addScalar ( float $value ) : self
$value float
return self
示例#1
0
 public function testAddScalar()
 {
     $matrix = new Matrix([[4, 2, 6], [1, 7, 3], [7, 3, 2]]);
     $added = $matrix->addScalar(4);
     static::assertEquals(8, $added->get(0, 0));
     static::assertEquals(6, $added->get(0, 1));
     static::assertEquals(10, $added->get(0, 2));
     static::assertEquals(5, $added->get(1, 0));
     static::assertEquals(11, $added->get(1, 1));
     static::assertEquals(7, $added->get(1, 2));
     static::assertEquals(11, $added->get(2, 0));
     static::assertEquals(7, $added->get(2, 1));
     static::assertEquals(6, $added->get(2, 2));
 }