Open rotu opened 1 year ago
Note this might have been at least partly obscured by TypeScript itself. Changing the dynamic require('nblas')
to a static import import * as nblas from 'nblas'
causes a number of typescript warnings in blas.ts
to surface. Notably, blas.ts
does not seem to check whether the TypedArray
s match the provided dtype
(or are even the same type, for multi-argument functions), which I think could lead to a runtime segfault.
Good catch!
It's a result of having the nblas module optional. When I implemented the try..catch-require, it made typescript typing impossible because the nblas types (https://github.com/nperf/nblas/blob/master/src/types.ts) are not there because the package is not installed. Maybe there is a modern solution for this?
The
axpy
test checks that the return value ofaxpy
is the same as the return value ofnblas.daxpy
. These functions actually have return typevoid
so the check is just thatundefined === undefined
!The actual thing
saxpy
/daxpy
should do is mutatey
in place. https://github.com/mateogianolio/vectorious/blob/3ec25615d3871224cbcb6f5bb3e154208faab276/src/blas.spec.ts#L17