@danielsimonjr/mathts-compat 0.3.32 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -100,13 +100,22 @@ declare function det(m: DenseMatrix | number[][]): number;
100
100
  */
101
101
  declare function identity(n: number): DenseMatrix;
102
102
  /**
103
- * Zeros matrix (mathjs-compatible)
103
+ * Zeros (mathjs-compatible).
104
+ *
105
+ * Single-arg `zeros(n)` is a length-`n` **vector** matching mathjs
106
+ * (`math.zeros(3).toArray()` === `[0,0,0]`, size `[3]`); two-arg `zeros(r,c)` is
107
+ * an `r×c` DenseMatrix. (matrix's DenseMatrix is strictly 2-D, so the vector case
108
+ * returns a `number[]`.)
104
109
  */
105
- declare function zeros(rows: number, cols?: number): DenseMatrix;
110
+ declare function zeros(rows: number, cols?: number): DenseMatrix | number[];
106
111
  /**
107
- * Ones matrix (mathjs-compatible)
112
+ * Ones (mathjs-compatible).
113
+ *
114
+ * Single-arg `ones(n)` is a length-`n` **vector** matching mathjs
115
+ * (`math.ones(3).toArray()` === `[1,1,1]`); two-arg `ones(r,c)` is an `r×c`
116
+ * DenseMatrix.
108
117
  */
109
- declare function ones(rows: number, cols?: number): DenseMatrix;
118
+ declare function ones(rows: number, cols?: number): DenseMatrix | number[];
110
119
  /**
111
120
  * Matrix size (mathjs-compatible)
112
121
  */
package/dist/index.js CHANGED
@@ -272,10 +272,16 @@ function identity(n) {
272
272
  return DenseMatrix.identity(n);
273
273
  }
274
274
  function zeros(rows, cols) {
275
- return DenseMatrix.zeros(rows, cols ?? rows);
275
+ if (cols === void 0) {
276
+ return new Array(rows).fill(0);
277
+ }
278
+ return DenseMatrix.zeros(rows, cols);
276
279
  }
277
280
  function ones(rows, cols) {
278
- return DenseMatrix.ones(rows, cols ?? rows);
281
+ if (cols === void 0) {
282
+ return new Array(rows).fill(1);
283
+ }
284
+ return DenseMatrix.ones(rows, cols);
279
285
  }
280
286
  function size(m) {
281
287
  if (Array.isArray(m)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielsimonjr/mathts-compat",
3
- "version": "0.3.32",
3
+ "version": "0.4.0",
4
4
  "description": "mathjs compatibility layer for MathTS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,10 +24,10 @@
24
24
  "build:prod": "tsup src/index.ts --format esm --dts --clean --minify --treeshake"
25
25
  },
26
26
  "dependencies": {
27
- "@danielsimonjr/mathts-core": "^0.12.0",
28
- "@danielsimonjr/mathts-functions": "^0.43.1",
29
- "@danielsimonjr/mathts-matrix": "^0.6.2",
30
- "@danielsimonjr/mathts-parallel": "^0.6.2"
27
+ "@danielsimonjr/mathts-core": "^0.13.0",
28
+ "@danielsimonjr/mathts-functions": "^0.43.2",
29
+ "@danielsimonjr/mathts-matrix": "^0.6.3",
30
+ "@danielsimonjr/mathts-parallel": "^0.6.3"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^25.5.2",