mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
impl. helper functions for easier use
This commit is contained in:
parent
3026fec00c
commit
89e645a0cd
|
|
@ -79,6 +79,23 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create matrix from array
|
||||
*
|
||||
* @param array $matrix Matrix array
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function fromArray(array $matrix) : self
|
||||
{
|
||||
$m = new self();
|
||||
$m->setMatrix($matrix);
|
||||
|
||||
return $m;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -24,6 +24,23 @@ namespace phpOMS\Math\Matrix;
|
|||
*/
|
||||
final class Vector extends Matrix
|
||||
{
|
||||
/**
|
||||
* Create vector from array
|
||||
*
|
||||
* @param array $vector Matrix array
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function fromArray(array $vector) : Vector
|
||||
{
|
||||
$v = new self();
|
||||
$v->setMatrixV($vector);
|
||||
|
||||
return $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set vector value
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user