3 ms·
Shape typing NumPy with pyright and variadic generics
- Bostonian 4y agoIn Fortran (which since the 1990 standard has operations on arrays and array sections) the declarations tell you the array ranks, for example function matvec(a,x) result(b) real, intent(in) :: a(:,:), x(:) real :: b(size(a,1)) if (size(a,2) /= size(x)) stop "mismatched inputs" ... or alternatively function matvec(a,x,n1,n2) result(b) real, intent(in) :: a(n1,n2), x(n2) real :: b(n1) ...
- thecmrfrd 4y agoHey I'm the author, happy to answer any questions!