Skip to content

Version 1.1.0

Latest
Compare
Choose a tag to compare
@nubs nubs released this 05 May 11:24
· 72 commits to master since this release

Minor Changes

Two new methods were added: isSameDimension and isSameVectorSpace.

Test for Same Dimension

A new method, isSameDimension was added that checks two vectors to see if they have the same dimension.

$a = new \Nubs\Vectorix\Vector([1, 2]);                                                                                                             
$b = new \Nubs\Vectorix\Vector([5, 1]);                                                                                                             
$c = new \Nubs\Vectorix\Vector([5, 8, 2]);                                                                                                          

var_dump($a->isSameDimension($b));                                                                                                                  
// bool(true)                                                                                                                                       

var_dump($a->isSameDimension($c));                                                                                                                  
// bool(false)                                                                                                                                      

Test for Same Vector Space

A new method, isSameVectorSpace was added that checks two vectors to see if they have the same vector space. The vector space is defined here to mean that the vectors have the same dimension and their components have the same keys.

$a = new \Nubs\Vectorix\Vector([1, 2]);                                                                                                             
$b = new \Nubs\Vectorix\Vector([5, 1]);                                                                                                             
$c = new \Nubs\Vectorix\Vector([2, 1, 7]);                                                                                                          
$d = new \Nubs\Vectorix\Vector(['x' => 3, 'y' => 2]);                                                                                               

var_dump($a->isSameVectorSpace($b));                                                                                                                
// bool(true)                                                                                                                                       

var_dump($a->isSameVectorSpace($c));                                                                                                                
// bool(false)                                                                                                                                      

var_dump($a->isSameVectorSpace($d));                                                                                                                
// bool(false)