Skip to content

Commit 1f1e761

Browse files
committed
Add positive semi-definite typehinting
1 parent 57f2740 commit 1f1e761

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- 3.0.1
2+
- Add positive semi-definite typehinting
23

34
- 3.0.0
45
- No changes

src/Matrix.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ class Matrix implements Tensor
4141
/**
4242
* The number of rows in the matrix.
4343
*
44-
* @var int
44+
* @var int<0,max>
4545
*/
4646
protected int $m;
4747

4848
/**
4949
* The number of columns in the matrix.
5050
*
51-
* @var int
51+
* @var int<0,max>
5252
*/
5353
protected int $n;
5454

@@ -389,7 +389,7 @@ public function __construct(array $a, bool $validate = true)
389389
/**
390390
* Return a tuple with the dimensionality of the tensor.
391391
*
392-
* @return int[]
392+
* @return array{int<0,max>,int<0,max>}
393393
*/
394394
public function shape() : array
395395
{
@@ -419,7 +419,7 @@ public function isSquare() : bool
419419
/**
420420
* Return the number of elements in the tensor.
421421
*
422-
* @return int
422+
* @return int<0,max>
423423
*/
424424
public function size() : int
425425
{
@@ -429,7 +429,7 @@ public function size() : int
429429
/**
430430
* Return the number of rows in the matrix.
431431
*
432-
* @return int
432+
* @return int<0,max>
433433
*/
434434
public function m() : int
435435
{
@@ -439,7 +439,7 @@ public function m() : int
439439
/**
440440
* Return the number of columns in the matrix.
441441
*
442-
* @return int
442+
* @return int<0,max>
443443
*/
444444
public function n() : int
445445
{

src/Vector.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Vector implements Tensor
3434
/**
3535
* The number of elements in the vector.
3636
*
37-
* @var int
37+
* @var int<0,max>
3838
*/
3939
protected int $n;
4040

@@ -294,7 +294,7 @@ final public function __construct(array $a, bool $validate = true)
294294
/**
295295
* Return a tuple with the dimensionality of the tensor.
296296
*
297-
* @return int[]
297+
* @return array{int<0,max>}
298298
*/
299299
public function shape() : array
300300
{
@@ -314,7 +314,7 @@ public function shapeString() : string
314314
/**
315315
* Return the number of elements in the vector.
316316
*
317-
* @return int
317+
* @return int<0,max>
318318
*/
319319
public function size() : int
320320
{
@@ -324,7 +324,7 @@ public function size() : int
324324
/**
325325
* Return the number of rows in the vector.
326326
*
327-
* @return int
327+
* @return int<0,max>
328328
*/
329329
public function m() : int
330330
{
@@ -334,7 +334,7 @@ public function m() : int
334334
/**
335335
* Return the number of columns in the vector.
336336
*
337-
* @return int
337+
* @return int<0,max>
338338
*/
339339
public function n() : int
340340
{

0 commit comments

Comments
 (0)