Commit graph

3 commits

Author SHA1 Message Date
95d81d0338 feat: Implement Vector type (#28)
All checks were successful
/ test (push) Successful in 18s
The Vector type is simply a generic type for built-in JavaScript Arrays. The parameter type is the type of all of the entries of the Array. The Vector type also supports inhomogeneous arrays by using the special type `Unknown` as the argument type, but note that when computing with inhomogeneous arrays, method dispatch must be performed separately for every entry in a calculation, making all operations considerably slower than on homogeneous Vector instances.

Note also that arithmetic operations on nested Vectors, e.g. `Vector(Vector(NumberT))` are defined so as to interpret such entities as ordinary matrices, represented in row-major format (i.e., the component `Vector(NumberT)` items of such an entity are the _rows_ of the matrix.

Reviewed-on: #28
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-committed-by: Glen Whitney <glen@studioinfinity.org>
2025-05-07 00:03:49 +00:00
0765ba7202 feat: Add return typing strategies and implement sqrt with them (#26)
All checks were successful
/ test (push) Successful in 17s
Resolves #25

Reviewed-on: #26
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-committed-by: Glen Whitney <glen@studioinfinity.org>
2025-04-28 16:29:33 +00:00
036def4a0c test: Set up a mocha test harness (#5)
We use [mocha](https://mochajs.org/) as the test framework, as it is
  the tool used by mathjs and we would like to make tests as similar
  as possible. However, to tighten the linkage between source code and
  tests, we adopt a somewhat different file organization: unit tests
  for a given source file `blah/foo.js` are in `blah/__test__/foo.spec.js`.

  To run all unit tests, execute the script `pnpm test`.

  Resolves #3.

Reviewed-on: glen/nanomath#5
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-committed-by: Glen Whitney <glen@studioinfinity.org>
2025-04-07 16:18:46 +00:00