Skip to content

Releases: nubs/vectorix

Version 1.1.0

05 May 11:24
Compare
Choose a tag to compare

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)                                                                                                                                      

Version 1.0.0

03 May 01:55
Compare
Choose a tag to compare

This is the initial release of Vectorix: a PHP library for euclidean vectors.

There are plenty of methods available, check out the README for all the details.