data-structure-typed 2.6.1 → 2.6.2

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.
Files changed (116) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/cjs/binary-tree.cjs +2927 -23688
  3. package/dist/cjs/graph.cjs +845 -2634
  4. package/dist/cjs/hash.cjs +185 -616
  5. package/dist/cjs/heap.cjs +266 -818
  6. package/dist/cjs/index.cjs +5116 -31358
  7. package/dist/cjs/linked-list.cjs +644 -2615
  8. package/dist/cjs/matrix.cjs +220 -535
  9. package/dist/cjs/priority-queue.cjs +266 -818
  10. package/dist/cjs/queue.cjs +637 -2343
  11. package/dist/cjs/stack.cjs +124 -530
  12. package/dist/cjs/trie.cjs +145 -592
  13. package/dist/cjs-legacy/binary-tree.cjs +4352 -25113
  14. package/dist/cjs-legacy/graph.cjs +847 -2636
  15. package/dist/cjs-legacy/hash.cjs +181 -612
  16. package/dist/cjs-legacy/heap.cjs +266 -818
  17. package/dist/cjs-legacy/index.cjs +6657 -32899
  18. package/dist/cjs-legacy/linked-list.cjs +640 -2611
  19. package/dist/cjs-legacy/matrix.cjs +220 -535
  20. package/dist/cjs-legacy/priority-queue.cjs +266 -818
  21. package/dist/cjs-legacy/queue.cjs +634 -2340
  22. package/dist/cjs-legacy/stack.cjs +124 -530
  23. package/dist/cjs-legacy/trie.cjs +145 -592
  24. package/dist/esm/binary-tree.mjs +2927 -23688
  25. package/dist/esm/graph.mjs +845 -2634
  26. package/dist/esm/hash.mjs +185 -616
  27. package/dist/esm/heap.mjs +266 -818
  28. package/dist/esm/index.mjs +5116 -31358
  29. package/dist/esm/linked-list.mjs +644 -2615
  30. package/dist/esm/matrix.mjs +220 -535
  31. package/dist/esm/priority-queue.mjs +266 -818
  32. package/dist/esm/queue.mjs +637 -2343
  33. package/dist/esm/stack.mjs +124 -530
  34. package/dist/esm/trie.mjs +145 -592
  35. package/dist/esm-legacy/binary-tree.mjs +4352 -25113
  36. package/dist/esm-legacy/graph.mjs +847 -2636
  37. package/dist/esm-legacy/hash.mjs +181 -612
  38. package/dist/esm-legacy/heap.mjs +266 -818
  39. package/dist/esm-legacy/index.mjs +6657 -32899
  40. package/dist/esm-legacy/linked-list.mjs +640 -2611
  41. package/dist/esm-legacy/matrix.mjs +220 -535
  42. package/dist/esm-legacy/priority-queue.mjs +266 -818
  43. package/dist/esm-legacy/queue.mjs +634 -2340
  44. package/dist/esm-legacy/stack.mjs +124 -530
  45. package/dist/esm-legacy/trie.mjs +145 -592
  46. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +29 -500
  47. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +38 -563
  48. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +230 -1212
  49. package/dist/types/data-structures/binary-tree/bst.d.ts +124 -1063
  50. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +99 -854
  51. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +62 -314
  52. package/dist/types/data-structures/binary-tree/tree-map.d.ts +366 -5057
  53. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +277 -4885
  54. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +253 -3929
  55. package/dist/types/data-structures/binary-tree/tree-set.d.ts +261 -4782
  56. package/dist/types/data-structures/graph/abstract-graph.d.ts +44 -44
  57. package/dist/types/data-structures/graph/directed-graph.d.ts +130 -527
  58. package/dist/types/data-structures/graph/undirected-graph.d.ts +125 -482
  59. package/dist/types/data-structures/hash/hash-map.d.ts +132 -562
  60. package/dist/types/data-structures/heap/heap.d.ts +194 -746
  61. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +120 -809
  62. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +121 -733
  63. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +193 -863
  64. package/dist/types/data-structures/matrix/matrix.d.ts +159 -474
  65. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -6
  66. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +6 -11
  67. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +1 -1
  68. package/dist/types/data-structures/queue/deque.d.ts +196 -804
  69. package/dist/types/data-structures/queue/queue.d.ts +99 -585
  70. package/dist/types/data-structures/stack/stack.d.ts +75 -481
  71. package/dist/types/data-structures/trie/trie.d.ts +98 -584
  72. package/dist/umd/data-structure-typed.js +6580 -32822
  73. package/dist/umd/data-structure-typed.min.js +3 -3
  74. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +162 -215
  75. package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +9 -9
  76. package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +47 -47
  77. package/docs-site-docusaurus/docs/api/classes/BST.md +155 -208
  78. package/docs-site-docusaurus/docs/api/classes/BSTNode.md +7 -7
  79. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +13 -29
  80. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +104 -158
  81. package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
  82. package/docs-site-docusaurus/docs/api/classes/Deque.md +72 -104
  83. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +60 -80
  84. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +67 -101
  85. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +6 -6
  86. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
  87. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
  88. package/docs-site-docusaurus/docs/api/classes/HashMap.md +52 -48
  89. package/docs-site-docusaurus/docs/api/classes/Heap.md +40 -68
  90. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +17 -17
  91. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +38 -38
  92. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +45 -45
  93. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +23 -23
  94. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +68 -96
  95. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +60 -80
  96. package/docs-site-docusaurus/docs/api/classes/Matrix.md +57 -52
  97. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +38 -66
  98. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +41 -74
  99. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +38 -66
  100. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +46 -79
  101. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +40 -68
  102. package/docs-site-docusaurus/docs/api/classes/Queue.md +54 -78
  103. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +171 -225
  104. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -22
  105. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +68 -98
  106. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +4 -4
  107. package/docs-site-docusaurus/docs/api/classes/SkipList.md +98 -75
  108. package/docs-site-docusaurus/docs/api/classes/Stack.md +33 -53
  109. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +104 -129
  110. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +57 -124
  111. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +45 -116
  112. package/docs-site-docusaurus/docs/api/classes/Trie.md +37 -61
  113. package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
  114. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +59 -77
  115. package/package.json +1 -1
  116. package/src/data-structures/binary-tree/tree-multi-set.ts +15 -11
@@ -134,6 +134,35 @@ export declare class Matrix {
134
134
  * @returns The `_multiplyFn` property is being returned.
135
135
  */
136
136
  get multiplyFn(): (a: number, b: number) => number;
137
+ /**
138
+ * Returns [rows, cols] dimensions tuple.
139
+ */
140
+ get size(): [number, number];
141
+ /**
142
+ * Creates a rows×cols zero matrix.
143
+ * @example
144
+ * ```ts
145
+ * const z = Matrix.zeros(2, 3); // [[0,0,0],[0,0,0]]
146
+ * ```
147
+ */
148
+ static zeros(rows: number, cols: number): Matrix;
149
+ /**
150
+ * Creates an n×n identity matrix.
151
+ * @example
152
+ * ```ts
153
+ * const I = Matrix.identity(3); // [[1,0,0],[0,1,0],[0,0,1]]
154
+ * ```
155
+ */
156
+ static identity(n: number): Matrix;
157
+ /**
158
+ * Creates a Matrix from a plain 2D array (deep copy).
159
+ * @example
160
+ * ```ts
161
+ * const m = Matrix.from([[1, 2], [3, 4]]);
162
+ * m.get(0, 1); // 2
163
+ * ```
164
+ */
165
+ static from(data: number[][]): Matrix;
137
166
  /**
138
167
  * The `get` function returns the value at the specified row and column index if it is a valid index.
139
168
  * @param {number} row - The `row` parameter represents the row index of the element you want to
@@ -142,64 +171,22 @@ export declare class Matrix {
142
171
  * retrieve from the data array.
143
172
  * @returns The `get` function returns a number if the provided row and column indices are valid.
144
173
  * Otherwise, it returns `undefined`.
145
-
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
- * @example
188
- * // Get and set individual cells
189
- * const m = new Matrix([
190
- * [0, 0, 0],
191
- * [0, 0, 0]
192
- * ]);
193
- *
194
- * m.set(0, 1, 42);
195
- * m.set(1, 2, 99);
196
- *
197
- * console.log(m.get(0, 1)); // 42;
198
- * console.log(m.get(1, 2)); // 99;
199
- * console.log(m.get(0, 0)); // 0;
200
- *
201
- * // Out of bounds returns undefined
202
- * console.log(m.get(5, 5)); // undefined;
174
+ * @example
175
+ * // Get and set individual cells
176
+ * const m = new Matrix([
177
+ * [0, 0, 0],
178
+ * [0, 0, 0]
179
+ * ]);
180
+ *
181
+ * m.set(0, 1, 42);
182
+ * m.set(1, 2, 99);
183
+ *
184
+ * console.log(m.get(0, 1)); // 42;
185
+ * console.log(m.get(1, 2)); // 99;
186
+ * console.log(m.get(0, 0)); // 0;
187
+ *
188
+ * // Out of bounds returns undefined
189
+ * console.log(m.get(5, 5)); // undefined;
203
190
  */
204
191
  get(row: number, col: number): number | undefined;
205
192
  /**
@@ -213,55 +200,13 @@ export declare class Matrix {
213
200
  * @returns a boolean value. It returns true if the index (row, col) is valid and the value is
214
201
  * successfully set in the data array. It returns false if the index is invalid and the value is not
215
202
  * set.
216
-
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
-
255
-
256
-
257
-
258
- * @example
259
- * // Modify individual cells
260
- * const m = Matrix.zeros(2, 2);
261
- * console.log(m.set(0, 0, 5)); // true;
262
- * console.log(m.set(1, 1, 10)); // true;
263
- * console.log(m.get(0, 0)); // 5;
264
- * console.log(m.get(1, 1)); // 10;
203
+ * @example
204
+ * // Modify individual cells
205
+ * const m = Matrix.zeros(2, 2);
206
+ * console.log(m.set(0, 0, 5)); // true;
207
+ * console.log(m.set(1, 1, 10)); // true;
208
+ * console.log(m.get(0, 0)); // 5;
209
+ * console.log(m.get(1, 1)); // 10;
265
210
  */
266
211
  set(row: number, col: number, value: number): boolean;
267
212
  /**
@@ -276,70 +221,28 @@ export declare class Matrix {
276
221
  * @param {Matrix} matrix - The `matrix` parameter is an instance of the `Matrix` class.
277
222
  * @returns The `add` method returns a new `Matrix` object that represents the result of adding the
278
223
  * current matrix with the provided `matrix` parameter.
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
-
304
-
305
-
306
-
307
-
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
- * @example
322
- * // Basic matrix arithmetic
323
- * const a = new Matrix([
324
- * [1, 2],
325
- * [3, 4]
326
- * ]);
327
- * const b = new Matrix([
328
- * [5, 6],
329
- * [7, 8]
330
- * ]);
331
- *
332
- * const sum = a.add(b);
333
- * console.log(sum?.data); // [
334
- * // [6, 8],
335
- * // [10, 12]
336
- * // ];
337
- *
338
- * const diff = b.subtract(a);
339
- * console.log(diff?.data); // [
340
- * // [4, 4],
341
- * // [4, 4]
342
- * // ];
224
+ * @example
225
+ * // Basic matrix arithmetic
226
+ * const a = new Matrix([
227
+ * [1, 2],
228
+ * [3, 4]
229
+ * ]);
230
+ * const b = new Matrix([
231
+ * [5, 6],
232
+ * [7, 8]
233
+ * ]);
234
+ *
235
+ * const sum = a.add(b);
236
+ * console.log(sum?.data); // [
237
+ * // [6, 8],
238
+ * // [10, 12]
239
+ * // ];
240
+ *
241
+ * const diff = b.subtract(a);
242
+ * console.log(diff?.data); // [
243
+ * // [4, 4],
244
+ * // [4, 4]
245
+ * // ];
343
246
  */
344
247
  add(matrix: Matrix): Matrix | undefined;
345
248
  /**
@@ -348,54 +251,21 @@ export declare class Matrix {
348
251
  * @param {Matrix} matrix - The `matrix` parameter is an instance of the `Matrix` class. It
349
252
  * represents the matrix that you want to subtract from the current matrix.
350
253
  * @returns a new Matrix object with the result of the subtraction operation.
351
-
352
-
353
-
354
-
355
-
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
-
366
-
367
-
368
-
369
-
370
-
371
-
372
-
373
-
374
-
375
-
376
-
377
-
378
-
379
-
380
-
381
-
382
-
383
-
384
-
385
-
386
-
387
-
388
-
389
-
390
-
391
-
392
-
393
- * @example
394
- * // Element-wise subtraction
395
- * const a = Matrix.from([[5, 6], [7, 8]]);
396
- * const b = Matrix.from([[1, 2], [3, 4]]);
397
- * const result = a.subtract(b);
398
- * console.log(result?.toArray()); // [[4, 4], [4, 4]];
254
+ * @example
255
+ * // Element-wise subtraction
256
+ * const a = Matrix.from([
257
+ * [5, 6],
258
+ * [7, 8]
259
+ * ]);
260
+ * const b = Matrix.from([
261
+ * [1, 2],
262
+ * [3, 4]
263
+ * ]);
264
+ * const result = a.subtract(b);
265
+ * console.log(result?.toArray()); // [
266
+ * // [4, 4],
267
+ * // [4, 4]
268
+ * // ];
399
269
  */
400
270
  subtract(matrix: Matrix): Matrix | undefined;
401
271
  /**
@@ -403,249 +273,93 @@ export declare class Matrix {
403
273
  * as a new matrix.
404
274
  * @param {Matrix} matrix - The `matrix` parameter is an instance of the `Matrix` class.
405
275
  * @returns a new Matrix object.
406
-
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
-
415
-
416
-
417
-
418
-
419
-
420
-
421
-
422
-
423
-
424
-
425
-
426
-
427
-
428
-
429
-
430
-
431
-
432
-
433
-
434
-
435
-
436
-
437
-
438
-
439
-
440
-
441
-
442
-
443
-
444
-
445
-
446
-
447
-
448
- * @example
449
- * // Matrix multiplication for transformations
450
- * // 2x3 matrix * 3x2 matrix = 2x2 matrix
451
- * const a = new Matrix([
452
- * [1, 2, 3],
453
- * [4, 5, 6]
454
- * ]);
455
- * const b = new Matrix([
456
- * [7, 8],
457
- * [9, 10],
458
- * [11, 12]
459
- * ]);
460
- *
461
- * const product = a.multiply(b);
462
- * console.log(product?.rows); // 2;
463
- * console.log(product?.cols); // 2;
464
- * // Row 0: 1*7+2*9+3*11=58, 1*8+2*10+3*12=64
465
- * // Row 1: 4*7+5*9+6*11=139, 4*8+5*10+6*12=154
466
- * console.log(product?.data); // [
467
- * // [58, 64],
468
- * // [139, 154]
469
- * // ];
276
+ * @example
277
+ * // Matrix multiplication for transformations
278
+ * // 2x3 matrix * 3x2 matrix = 2x2 matrix
279
+ * const a = new Matrix([
280
+ * [1, 2, 3],
281
+ * [4, 5, 6]
282
+ * ]);
283
+ * const b = new Matrix([
284
+ * [7, 8],
285
+ * [9, 10],
286
+ * [11, 12]
287
+ * ]);
288
+ *
289
+ * const product = a.multiply(b);
290
+ * console.log(product?.rows); // 2;
291
+ * console.log(product?.cols); // 2;
292
+ * // Row 0: 1*7+2*9+3*11=58, 1*8+2*10+3*12=64
293
+ * // Row 1: 4*7+5*9+6*11=139, 4*8+5*10+6*12=154
294
+ * console.log(product?.data); // [
295
+ * // [58, 64],
296
+ * // [139, 154]
297
+ * // ];
470
298
  */
471
299
  multiply(matrix: Matrix): Matrix | undefined;
472
300
  /**
473
301
  * The transpose function takes a matrix and returns a new matrix that is the transpose of the
474
302
  * original matrix.
475
303
  * @returns The transpose() function returns a new Matrix object with the transposed data.
476
-
477
-
478
-
479
-
480
-
481
-
482
-
483
-
484
-
485
-
486
-
487
-
488
-
489
-
490
-
491
-
492
-
493
-
494
-
495
-
496
-
497
-
498
-
499
-
500
-
501
-
502
-
503
-
504
-
505
-
506
-
507
-
508
-
509
-
510
-
511
-
512
-
513
-
514
-
515
-
516
-
517
-
518
- * @example
519
- * // Matrix transpose (square matrix)
520
- * const m = new Matrix([
521
- * [1, 2, 3],
522
- * [4, 5, 6],
523
- * [7, 8, 9]
524
- * ]);
525
- *
526
- * const transposed = m.transpose();
527
- * console.log(transposed.rows); // 3;
528
- * console.log(transposed.cols); // 3;
529
- * console.log(transposed.data); // [
530
- * // [1, 4, 7],
531
- * // [2, 5, 8],
532
- * // [3, 6, 9]
533
- * // ];
534
- *
535
- * // Transpose of transpose = original
536
- * console.log(transposed.transpose().data); // m.data;
304
+ * @example
305
+ * // Matrix transpose (square matrix)
306
+ * const m = new Matrix([
307
+ * [1, 2, 3],
308
+ * [4, 5, 6],
309
+ * [7, 8, 9]
310
+ * ]);
311
+ *
312
+ * const transposed = m.transpose();
313
+ * console.log(transposed.rows); // 3;
314
+ * console.log(transposed.cols); // 3;
315
+ * console.log(transposed.data); // [
316
+ * // [1, 4, 7],
317
+ * // [2, 5, 8],
318
+ * // [3, 6, 9]
319
+ * // ];
320
+ *
321
+ * // Transpose of transpose = original
322
+ * console.log(transposed.transpose().data); // m.data;
537
323
  */
538
324
  transpose(): Matrix;
539
325
  /**
540
326
  * The `inverse` function calculates the inverse of a square matrix using Gaussian elimination.
541
327
  * @returns a Matrix object, which represents the inverse of the original matrix.
542
-
543
-
544
-
545
-
546
-
547
-
548
-
549
-
550
-
551
-
552
-
553
-
554
-
555
-
556
-
557
-
558
-
559
-
560
-
561
-
562
-
563
-
564
-
565
-
566
-
567
-
568
-
569
-
570
-
571
-
572
-
573
-
574
-
575
-
576
-
577
-
578
-
579
-
580
-
581
-
582
-
583
-
584
- * @example
585
- * // Compute the inverse of a 2x2 matrix
586
- * const m = Matrix.from([[4, 7], [2, 6]]);
587
- * const inv = m.inverse();
588
- * console.log(inv); // defined;
589
- * // A * A^-1 should ≈ Identity
590
- * const product = m.multiply(inv!);
591
- * console.log(product?.get(0, 0)); // toBeCloseTo;
592
- * console.log(product?.get(0, 1)); // toBeCloseTo;
593
- * console.log(product?.get(1, 0)); // toBeCloseTo;
594
- * console.log(product?.get(1, 1)); // toBeCloseTo;
328
+ * @example
329
+ * // Compute the inverse of a 2x2 matrix
330
+ * const m = Matrix.from([
331
+ * [4, 7],
332
+ * [2, 6]
333
+ * ]);
334
+ * const inv = m.inverse();
335
+ * console.log(inv); // defined;
336
+ * // A * A^-1 should ≈ Identity
337
+ * const product = m.multiply(inv!);
338
+ * console.log(product?.get(0, 0)); // toBeCloseTo;
339
+ * console.log(product?.get(0, 1)); // toBeCloseTo;
340
+ * console.log(product?.get(1, 0)); // toBeCloseTo;
341
+ * console.log(product?.get(1, 1)); // toBeCloseTo;
595
342
  */
596
343
  inverse(): Matrix | undefined;
597
344
  /**
598
345
  * The dot function calculates the dot product of two matrices and returns a new matrix.
599
346
  * @param {Matrix} matrix - The `matrix` parameter is an instance of the `Matrix` class.
600
347
  * @returns a new Matrix object.
601
-
602
-
603
-
604
-
605
-
606
-
607
-
608
-
609
-
610
-
611
-
612
-
613
-
614
-
615
-
616
-
617
-
618
-
619
-
620
-
621
-
622
-
623
-
624
-
625
-
626
-
627
-
628
-
629
-
630
-
631
-
632
-
633
-
634
-
635
-
636
-
637
-
638
-
639
-
640
-
641
-
642
-
643
- * @example
644
- * // Dot product of two matrices
645
- * const a = Matrix.from([[1, 2], [3, 4]]);
646
- * const b = Matrix.from([[5, 6], [7, 8]]);
647
- * const result = a.dot(b);
648
- * console.log(result?.toArray()); // [[19, 22], [43, 50]];
348
+ * @example
349
+ * // Dot product of two matrices
350
+ * const a = Matrix.from([
351
+ * [1, 2],
352
+ * [3, 4]
353
+ * ]);
354
+ * const b = Matrix.from([
355
+ * [5, 6],
356
+ * [7, 8]
357
+ * ]);
358
+ * const result = a.dot(b);
359
+ * console.log(result?.toArray()); // [
360
+ * // [19, 22],
361
+ * // [43, 50]
362
+ * // ];
649
363
  */
650
364
  dot(matrix: Matrix): Matrix | undefined;
651
365
  /**
@@ -664,10 +378,6 @@ export declare class Matrix {
664
378
  * and properties as the current instance.
665
379
  */
666
380
  clone(): Matrix;
667
- /**
668
- * Returns [rows, cols] dimensions tuple.
669
- */
670
- get size(): [number, number];
671
381
  isEmpty(): boolean;
672
382
  /**
673
383
  * Returns a deep copy of the data as a plain 2D array.
@@ -690,31 +400,6 @@ export declare class Matrix {
690
400
  */
691
401
  map(callback: (value: number, row: number, col: number) => number): Matrix;
692
402
  print(): void;
693
- /**
694
- * Creates a rows×cols zero matrix.
695
- * @example
696
- * ```ts
697
- * const z = Matrix.zeros(2, 3); // [[0,0,0],[0,0,0]]
698
- * ```
699
- */
700
- static zeros(rows: number, cols: number): Matrix;
701
- /**
702
- * Creates an n×n identity matrix.
703
- * @example
704
- * ```ts
705
- * const I = Matrix.identity(3); // [[1,0,0],[0,1,0],[0,0,1]]
706
- * ```
707
- */
708
- static identity(n: number): Matrix;
709
- /**
710
- * Creates a Matrix from a plain 2D array (deep copy).
711
- * @example
712
- * ```ts
713
- * const m = Matrix.from([[1, 2], [3, 4]]);
714
- * m.get(0, 1); // 2
715
- * ```
716
- */
717
- static from(data: number[][]): Matrix;
718
403
  protected _addFn(a: number | undefined, b: number): number | undefined;
719
404
  protected _subtractFn(a: number, b: number): number;
720
405
  protected _multiplyFn(a: number, b: number): number;
@@ -65,12 +65,7 @@ import { PriorityQueue } from './priority-queue';
65
65
  * while (cpuQueue.size > 0) {
66
66
  * order.push(cpuQueue.poll()![1]);
67
67
  * }
68
- * console.log(order); // [
69
- * // 'User interaction',
70
- * // 'System process',
71
- * // 'Network sync',
72
- * // 'Background task'
73
- * // ];
68
+ * console.log(order); // ['User interaction', 'System process', 'Network sync', 'Background task'];
74
69
  */
75
70
  export declare class MaxPriorityQueue<E = any, R = any> extends PriorityQueue<E, R> {
76
71
  /**