Skip to content

Commit

Permalink
Add positive semi-definite typehinting
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdalpino committed Oct 31, 2021
1 parent 57f2740 commit 1f1e761
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- 3.0.1
- Add positive semi-definite typehinting

- 3.0.0
- No changes
Expand Down
12 changes: 6 additions & 6 deletions src/Matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ class Matrix implements Tensor
/**
* The number of rows in the matrix.
*
* @var int
* @var int<0,max>
*/
protected int $m;

/**
* The number of columns in the matrix.
*
* @var int
* @var int<0,max>
*/
protected int $n;

Expand Down Expand Up @@ -389,7 +389,7 @@ public function __construct(array $a, bool $validate = true)
/**
* Return a tuple with the dimensionality of the tensor.
*
* @return int[]
* @return array{int<0,max>,int<0,max>}
*/
public function shape() : array
{
Expand Down Expand Up @@ -419,7 +419,7 @@ public function isSquare() : bool
/**
* Return the number of elements in the tensor.
*
* @return int
* @return int<0,max>
*/
public function size() : int
{
Expand All @@ -429,7 +429,7 @@ public function size() : int
/**
* Return the number of rows in the matrix.
*
* @return int
* @return int<0,max>
*/
public function m() : int
{
Expand All @@ -439,7 +439,7 @@ public function m() : int
/**
* Return the number of columns in the matrix.
*
* @return int
* @return int<0,max>
*/
public function n() : int
{
Expand Down
10 changes: 5 additions & 5 deletions src/Vector.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Vector implements Tensor
/**
* The number of elements in the vector.
*
* @var int
* @var int<0,max>
*/
protected int $n;

Expand Down Expand Up @@ -294,7 +294,7 @@ final public function __construct(array $a, bool $validate = true)
/**
* Return a tuple with the dimensionality of the tensor.
*
* @return int[]
* @return array{int<0,max>}
*/
public function shape() : array
{
Expand All @@ -314,7 +314,7 @@ public function shapeString() : string
/**
* Return the number of elements in the vector.
*
* @return int
* @return int<0,max>
*/
public function size() : int
{
Expand All @@ -324,7 +324,7 @@ public function size() : int
/**
* Return the number of rows in the vector.
*
* @return int
* @return int<0,max>
*/
public function m() : int
{
Expand All @@ -334,7 +334,7 @@ public function m() : int
/**
* Return the number of columns in the vector.
*
* @return int
* @return int<0,max>
*/
public function n() : int
{
Expand Down

0 comments on commit 1f1e761

Please sign in to comment.