-
Notifications
You must be signed in to change notification settings - Fork 54
/
matrix.d.ts
1597 lines (1391 loc) · 42 KB
/
matrix.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
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
394
395
396
397
398
399
400
401
402
403
404
405
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
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
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
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
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
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
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
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
type MaybeMatrix = AbstractMatrix | ArrayLike<ArrayLike<number>>;
type ScalarOrMatrix = number | MaybeMatrix;
type MatrixDimension = 'row' | 'column';
type MaskValue = 0 | 1 | number | boolean;
/**
* allow use of numbers (only 0 is considered false) and booleans
*/
type Mask = MaskValue[];
export interface IRandomOptions {
/**
* Random number generator.
* @default `Math.random`
*/
random: () => number;
}
export interface IRandomIntOptions {
/**
* Minimum value.
* @default `0`
*/
min: number;
/**
* Maximum value.
* @default `1000`
*/
max: number;
/**
* Random number generator.
* @default `Math.random`
*/
random: () => number;
}
export interface IRepeatOptions {
/**
* Number of times the rows should be repeated.
* @default `1`
*/
rows?: number;
/**
* Number of times the columns should be repeated.
* @default `1`
*/
columns?: number;
}
export interface IScaleOptions {
/**
* Minimum scaled value.
* @default `0`
*/
min?: number;
/**
* Maximum scaled value.
* @default `1`
*/
max?: number;
}
export interface IVarianceOptions {
unbiased?: boolean;
mean?: number;
}
export interface IVarianceByOptions {
unbiased?: boolean;
mean?: ArrayLike<number>;
}
export interface ICenterOptions {
center?: number;
}
export interface ICenterByOptions {
center?: ArrayLike<number>;
}
export interface IScaleOptions {
scale?: number;
}
export interface IScaleByOptions {
scale?: ArrayLike<number>;
}
export interface ICovarianceOptions {
/**
* @default `true`
*/
center?: boolean;
}
export interface ICorrelationOptions {
/**
* @default `true`
*/
center?: boolean;
/**
* @default `true`
*/
scale?: boolean;
}
export interface IToStringOptions {
/**
* Maximum number of printed rows.
* @default `15`
*/
maxRows?: number;
/**
* Maximum number of printed columns.
* @default `10`
*/
maxColumns?: number;
/**
* Maximum size (number of characters) of printed numbers.
* @default `8`
*/
maxNumSize?: number;
/**
* Place minus signs in their own column.
* @default `'auto'`
*/
padMinus?: true | false | 'auto';
}
export abstract class AbstractMatrix {
/**
* Total number of elements in the matrix.
*/
readonly size: number;
/**
* Number of rows of the matrix.
*/
readonly rows: number;
/**
* Number of columns of the matrix.
*/
readonly columns: number;
/**
* Constructs a matrix with the chosen dimensions from a 1D array.
* @param newRows - Number of rows.
* @param newColumns - Number of columns.
* @param newData - A 1D array containing data for the matrix.
* @returns The new matrix.
*/
static from1DArray(
newRows: number,
newColumns: number,
newData: ArrayLike<number>,
): Matrix;
/**
* Creates a row vector, a matrix with only one row.
* @param newData - A 1D array containing data for the vector.
* @returns The new matrix.
*/
static rowVector(newData: ArrayLike<number>): Matrix;
/**
* Creates a column vector, a matrix with only one column.
* @param newData - A 1D array containing data for the vector.
* @returns The new matrix.
*/
static columnVector(newData: ArrayLike<number>): Matrix;
/**
* Creates a matrix with the given dimensions. Values will be set to zero.
* This is equivalent to calling the Matrix constructor.
* @param rows - Number of rows.
* @param columns - Number of columns.
* @template _M is private. Don't override it.
* @returns The new matrix.
*/
static zeros<_M extends AbstractMatrix = Matrix>(
rows: number,
columns: number,
): _M;
/**
* Creates a matrix with the given dimensions. Values will be set to one.
* @param rows - Number of rows.
* @param columns - Number of columns.
* @returns The new matrix.
*/
static ones<M extends AbstractMatrix = Matrix>(
rows: number,
columns: number,
): M;
/**
* Creates a matrix with the given dimensions. Values will be randomly set.
* @param rows - Number of rows.
* @param columns - Number of columns.
* @param options - Options object.
* @returns The new matrix.
*/
static rand(rows: number, columns: number, options?: IRandomOptions): Matrix;
static random(
rows: number,
columns: number,
options?: IRandomOptions,
): Matrix;
/**
* Creates a matrix with the given dimensions. Values will be random integers.
* @param rows - Number of rows.
* @param columns - Number of columns.
* @param options
* @returns - The new matrix.
*/
static randInt(
rows: number,
columns: number,
options?: IRandomIntOptions,
): Matrix;
/**
* Creates an identity matrix with the given dimension. Values of the diagonal will be 1 and others will be 0.
* @param rows - Number of rows.
* @param columns - Number of columns. Default: `rows`.
* @param value - Value to fill the diagonal with. Default: `1`.
* @returns - The new identity matrix.
*/
static eye(rows: number, columns?: number, value?: number): Matrix;
/**
* Alias for {@link AbstractMatrix.eye}.
*/
static identity(rows: number, columns?: number, value?: number): Matrix;
/**
* Creates a diagonal matrix based on the given array.
* @param data - Array containing the data for the diagonal.
* @param rows - Number of rows. Default: `data.length`.
* @param columns - Number of columns. Default: `rows`.
* @returns - The new diagonal matrix.
*/
static diag(data: ArrayLike<number>, rows?: number, columns?: number): Matrix;
/**
* Alias for {@link AbstractMatrix.diag}.
*/
static diagonal(
data: ArrayLike<number>,
rows?: number,
columns?: number,
): Matrix;
/**
* Returns a matrix whose elements are the minimum between `matrix1` and `matrix2`.
*/
static min(matrix1: MaybeMatrix, matrix2: MaybeMatrix): Matrix;
/**
* Returns a matrix whose elements are the maximum between `matrix1` and `matrix2`.
* @param matrix1
* @param matrix2
*/
static max(matrix1: MaybeMatrix, matrix2: MaybeMatrix): Matrix;
/**
* Check that the provided value is a Matrix and tries to instantiate one if not.
* @param value - The value to check.
*/
static checkMatrix(value: any): Matrix;
/**
* Returns whether `value` is a Matrix.
* @param value - The value to check.
*/
static isMatrix(value: any): value is AbstractMatrix;
/**
* Sets a given element of the matrix.
* @param rowIndex - Index of the element's row.
* @param columnIndex - Index of the element's column.
* @param value - The new value for the element.
*/
abstract set(rowIndex: number, columnIndex: number, value: number): this;
/**
* Returns the value of the given element of the matrix.
* @param rowIndex - Index of the element's row.
* @param columnIndex - Index of the element's column.
* @returns - The value of the element.
*/
abstract get(rowIndex: number, columnIndex: number): number;
/**
* Applies a callback for each element of the matrix. The function is called in the matrix (this) context.
* @param callback - Function that will be called for each element in the matrix.
*/
apply(callback: (row: number, column: number) => void): this;
/**
* Returns a new 1D array filled row by row with the matrix values.
*/
to1DArray(): number[];
/**
* Returns a 2D array containing a copy of the matrix data.
*/
to2DArray(): number[][];
toJSON(): number[][];
/**
* Returns whether the matrix has one row.
*/
isRowVector(): boolean;
/**
* Returns whether the matrix has one column.
*/
isColumnVector(): boolean;
/**
* Returns whether the matrix has one row or one column.
*/
isVector(): boolean;
/**
* Returns whether the matrix has the same number of rows and columns.
*/
isSquare(): boolean;
/**
* Returns whether the matrix is symmetric and diagonal values are equals to 0
*/
isDistance(): boolean;
/**
* Returns whether the number of rows or columns (or both) is zero.
*/
isEmpty(): boolean;
/**
* Returns whether the matrix is square and has the same values on both sides of the diagonal.
*/
isSymmetric(): boolean;
/**
* Returns whether the matrix is in row echelon form.
*/
isEchelonForm(): boolean;
/**
* Returns whether the matrix is in reduced row echelon form.
*/
isReducedEchelonForm(): boolean;
/**
* Returns the row echelon form of the matrix computed using gaussian
* elimination.
*/
echelonForm(): Matrix;
/**
* Returns the reduced row echelon form of the matrix computed using
* gaussian elimination.
*/
reducedEchelonForm(): Matrix;
/**
* Creates a new matrix that is a repetition of the current matrix. New matrix has rows times the number of
* rows of the original matrix, and columns times the number of columns of the original matrix.
*
* @example
* var matrix = new Matrix([[1, 2]]);
* matrix.repeat({ rows: 2 }); // [[1, 2], [1, 2]]
*/
repeat(options?: IRepeatOptions): Matrix;
/**
* Fills the matrix with a given value. All elements will be set to this value.
* @param value - New value.
*/
fill(value: number): this;
/**
* Negates the matrix. All elements will be multiplied by `-1`.
*/
neg(): this;
/**
* Alias for {@link AbstractMatrix.neg}.
*/
negate(): this;
/**
* Returns a new array with the values from the given row index.
* @param index - Row index.
*/
getRow(index: number): number[];
/**
* Returns a new row vector with the values from the given row index.
* @param index - Row index.
*/
getRowVector(index: number): Matrix;
/**
* Sets a row at the given index.
* @param index - Row index.
* @param array - Array or vector to set.
*/
setRow(index: number, array: ArrayLike<number> | AbstractMatrix): this;
/**
* Swap two rows.
* @param row1 - First row index.
* @param row2 - Second row index.
*/
swapRows(row1: number, row2: number): this;
/**
* Returns a new array with the values from the given column index.
* @param index - Column index.
*/
getColumn(index: number): number[];
/**
* Returns a new column vector with the values from the given column index.
* @param index - Column index.
*/
getColumnVector(index: number): Matrix;
/**
* Sets a column at the given index.
* @param index - Column index.
* @param array - Array or vector to set.
*/
setColumn(index: number, array: ArrayLike<number> | AbstractMatrix): this;
/**
* Swap two columns.
* @param column1 - First column index.
* @param column2 - Second column index.
*/
swapColumns(column1: number, column2: number): this;
/**
* Adds the values of a vector to each row.
* @param vector - Array or vector.
*/
addRowVector(vector: ArrayLike<number> | AbstractMatrix): this;
/**
* Subtracts the values of a vector from each row.
* @param vector - Array or vector.
*/
subRowVector(vector: ArrayLike<number> | AbstractMatrix): this;
/**
* Multiplies the values of a vector with each row.
* @param vector - Array or vector.
*/
mulRowVector(vector: ArrayLike<number> | AbstractMatrix): this;
/**
* Divides the values of each row by those of a vector.
* @param vector - Array or vector.
*/
divRowVector(vector: ArrayLike<number> | AbstractMatrix): this;
/**
* Adds the values of a vector to each column.
* @param vector - Array or vector.
*/
addColumnVector(vector: ArrayLike<number> | AbstractMatrix): this;
/**
* Subtracts the values of a vector from each column.
* @param vector - Array or vector.
*/
subColumnVector(vector: ArrayLike<number> | AbstractMatrix): this;
/**
* Multiplies the values of a vector with each column.
* @param vector - Array or vector.
*/
mulColumnVector(vector: ArrayLike<number> | AbstractMatrix): this;
/**
* Divides the values of each column by those of a vector.
* @param vector - Array or vector.
*/
divColumnVector(vector: ArrayLike<number> | AbstractMatrix): this;
/**
* Multiplies the values of a row with a scalar.
* @param index - Row index.
* @param value
*/
mulRow(index: number, value: number): this;
/**
* Multiplies the values of a column with a scalar.
* @param index - Column index.
* @param value
*/
mulColumn(index: number, value: number): this;
/**
* Returns the maximum value of the matrix.
*/
max(): number;
/**
* Returns the maximum value by the given dimension.
* @param by - max by 'row' or 'column'.
*/
max(by: MatrixDimension): number[];
/**
* Returns the index of the maximum value.
*/
maxIndex(): [number, number];
/**
* Returns the minimum value of the matrix.
*/
min(): number;
/**
* Returns the minimum value by the given dimension.
* @param by - min by 'row' or 'column'.
*/
min(by: MatrixDimension): number[];
/**
* Returns the index of the minimum value.
*/
minIndex(): [number, number];
/**
* Returns the maximum value of one row.
* @param row - Row index.
*/
maxRow(row: number): number;
/**
* Returns the index of the maximum value of one row.
* @param row - Row index.
*/
maxRowIndex(row: number): [number, number];
/**
* Returns the minimum value of one row.
* @param row - Row index.
*/
minRow(row: number): number;
/**
* Returns the index of the maximum value of one row.
* @param row - Row index.
*/
minRowIndex(row: number): [number, number];
/**
* Returns the maximum value of one column.
* @param column - Column index.
*/
maxColumn(column: number): number;
/**
* Returns the index of the maximum value of one column.
* @param column - Column index.
*/
maxColumnIndex(column: number): [number, number];
/**
* Returns the minimum value of one column.
* @param column - Column index.
*/
minColumn(column: number): number;
/**
* Returns the index of the minimum value of one column.
* @param column - Column index.
*/
minColumnIndex(column: number): [number, number];
/**
* Returns an array containing the diagonal values of the matrix.
*/
diag(): number[];
/**
* Alias for {@link AbstractMatrix.diag}.
*/
diagonal(): number[];
/**
* Returns the norm of a matrix.
* @param type - Norm type. Default: `'frobenius'`.
*/
norm(type?: 'frobenius' | 'max'): number;
/**
* Computes the cumulative sum of the matrix elements (in place, row by row).
*/
cumulativeSum(): this;
/**
* Computes the dot (scalar) product between the matrix and another.
* @param vector
*/
dot(vector: AbstractMatrix): number;
/**
* Returns the matrix product between `this` and `other`.
* @param other - Other matrix.
*/
mmul(other: MaybeMatrix): Matrix;
/**
* Returns the square matrix raised to the given power
* @param scalar - the non-negative integer power to raise this matrix to
*/
mpow(scalar: number): Matrix;
strassen2x2(other: MaybeMatrix): Matrix;
strassen3x3(other: MaybeMatrix): Matrix;
mmulStrassen(y: MaybeMatrix): Matrix;
/**
* Returns a new row-by-row scaled matrix.
* @param options
*/
scaleRows(options?: IScaleOptions): Matrix;
/**
* Returns a new column-by-column scaled matrix.
* @param options
* @example
* var matrix = new Matrix([[1, 2], [-1, 0]]);
* var scaledMatrix = matrix.scaleColumns(); // [[1, 1], [0, 0]]
*/
scaleColumns(options?: IScaleOptions): Matrix;
flipRows(): this;
flipColumns(): this;
/**
* Returns the Kronecker product (also known as tensor product) between `this` and `other`.
* @link https://en.wikipedia.org/wiki/Kronecker_product
* @param other - Other matrix.
*/
kroneckerProduct(other: MaybeMatrix): Matrix;
/**
* Returns the Kronecker sum between `this` and `other`.
* @link https://en.wikipedia.org/wiki/Kronecker_product#Kronecker_sum
* @param other - Other matrix.
*/
kroneckerSum(other: MaybeMatrix): Matrix;
/**
* Alias for {@link AbstractMatrix.kroneckerProduct}.
*/
tensorProduct(other: MaybeMatrix): Matrix;
/**
* Transposes the matrix and returns a new one containing the result.
*/
transpose(): Matrix;
/**
* Sorts the rows in-place.
* @param compareFunction
*/
sortRows(compareFunction?: (a: number, b: number) => number): this;
/**
* Sorts the columns in-place.
* @param compareFunction
*/
sortColumns(compareFunction?: (a: number, b: number) => number): this;
/**
* Returns a subset of the matrix.
* @param startRow - First row index.
* @param endRow - Last row index.
* @param startColumn - First column index.
* @param endColumn - Last column index.
*/
subMatrix(
startRow: number,
endRow: number,
startColumn: number,
endColumn: number,
): Matrix;
/**
* Returns a subset of the matrix based on an array of row indices.
* @param indices - Array containing the row indices.
* @param startColumn - First column index. Default: `0`.
* @param endColumn - Last column index. Default: `this.columns - 1`.
*/
subMatrixRow(
indices: ArrayLike<number>,
startColumn?: number,
endColumn?: number,
): Matrix;
/**
* Returns a subset of the matrix based on an array of column indices.
* @param indices - Array containing the column indices.
* @param startRow - First row index. Default: `0`.
* @param endRow - Last row index. Default: `this.rows - 1`.
*/
subMatrixColumn(
indices: ArrayLike<number>,
startRow?: number,
endRow?: number,
): Matrix;
/**
* Set a part of the matrix to the given sub-matrix.
* @param matrix - The source matrix from which to extract values.
* @param startRow - The index of the first row to set.
* @param startColumn - The index of the first column to set.
*/
setSubMatrix(
matrix: MaybeMatrix,
startRow: number,
startColumn: number,
): this;
/**
* Return a new matrix based on a selection of rows and columns.
* Order of the indices matters and the same index can be used more than once.
* @param rowIndices - The row indices to select.
* @param columnIndices - The column indices to select.
*/
selection(
rowIndices: ArrayLike<number>,
columnIndices: ArrayLike<number>,
): Matrix;
/**
* Returns the trace of the matrix (sum of the diagonal elements).
*/
trace(): number;
/**
* Creates an exact and independent copy of the matrix.
*/
clone(): this;
static copy<M extends AbstractMatrix>(from: AbstractMatrix, to: M): M;
/**
* Returns the sum of all elements of the matrix.
*/
sum(): number;
/**
* Returns the sum by the given dimension.
* @param by - sum by 'row' or 'column'.
*/
sum(by: MatrixDimension): number[];
/**
* Returns the product of all elements of the matrix.
*/
product(): number;
/**
* Returns the product by the given dimension.
* @param by - product by 'row' or 'column'.
*/
product(by: MatrixDimension): number[];
/**
* Returns the mean of all elements of the matrix.
*/
mean(): number;
/**
* Returns the mean by the given dimension.
* @param by - mean by 'row' or 'column'.
*/
mean(by: MatrixDimension): number[];
/**
* Returns the variance of all elements of the matrix.
* @param options
*/
variance(options?: IVarianceOptions): number;
/**
* Returns the variance by the given dimension.
* @param by - variance by 'row' or 'column'.
* @param options
*/
variance(by: MatrixDimension, options?: IVarianceByOptions): number[];
/**
* Returns the standard deviation of all elements of the matrix.
* @param options
*/
standardDeviation(options?: IVarianceOptions): number;
/**
* Returns the standard deviation by the given dimension.
* @param by - standard deviation by 'row' or 'column'.
* @param options
*/
standardDeviation(
by: MatrixDimension,
options?: IVarianceByOptions,
): number[];
/**
* Center the matrix in-place. By default, the mean value of the matrix is
* subtracted from every value.
* @param options
*/
center(options?: ICenterOptions): this;
/**
* Center the matrix in-place. By default, the mean values in the give
* dimension are subtracted from the values.
* @param by - center by 'row' or 'column'.
* @param options
*/
center(by: MatrixDimension, options?: ICenterByOptions): this;
/**
* Scale the matrix in-place. By default, values are divided by their
* standard deviation.
* @param options
*/
scale(options?: IScaleOptions): this;
/**
* Scale the matrix in-place. By default, values are divided by the
* standard deviation in the given dimension.
* @param by - scale by 'row' or 'column'.
* @param options
*/
scale(by: MatrixDimension, options?: IScaleByOptions): this;
toString(options?: IToStringOptions): string;
// iterators methods
/**
* iterator from left to right, from top to bottom
* yield [row, column, value]
*/
[Symbol.iterator](): Generator<
[row: number, column: number, value: number],
void,
void
>;
/**
* iterator from left to right, from top to bottom
* yield [row, column, value]
*/
entries(): Generator<
[row: number, column: number, value: number],
void,
void
>;
/**
* iterator from left to right, from top to bottom
* yield value
*/
values(): Generator<number, void, void>;
// From here we document methods dynamically generated from operators
// Mathematical operators
// inplace
add(value: ScalarOrMatrix): this;
sub(value: ScalarOrMatrix): this;
subtract(value: ScalarOrMatrix): this;
mul(value: ScalarOrMatrix): this;
multiply(value: ScalarOrMatrix): this;
div(value: ScalarOrMatrix): this;
divide(value: ScalarOrMatrix): this;
mod(value: ScalarOrMatrix): this;
modulus(value: ScalarOrMatrix): this;
and(value: ScalarOrMatrix): this;
or(value: ScalarOrMatrix): this;
xor(value: ScalarOrMatrix): this;
leftShift(value: ScalarOrMatrix): this;
signPropagatingRightShift(value: ScalarOrMatrix): this;
rightShift(value: ScalarOrMatrix): this;
zeroFillRightShift(value: ScalarOrMatrix): this;
// new matrix
static add(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static sub(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static subtract(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static mul(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static multiply(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static div(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static divide(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static mod(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static modulus(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static and(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static or(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static xor(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static leftShift(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static signPropagatingRightShift(
matrix: MaybeMatrix,
value: ScalarOrMatrix,
): Matrix;
static rightShift(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
static zeroFillRightShift(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
// Functional operators (one arg)
// inplace
not(): this;
abs(): this;
acos(): this;
acosh(): this;
asin(): this;
asinh(): this;
atan(): this;
atanh(): this;
cbrt(): this;
ceil(): this;
clz32(): this;
cos(): this;
cosh(): this;
exp(): this;
expm1(): this;
floor(): this;
fround(): this;
log(): this;
log1p(): this;
log10(): this;
log2(): this;
round(): this;
sign(): this;
sin(): this;
sinh(): this;
sqrt(): this;
tan(): this;
tanh(): this;
trunc(): this;
// new matrix
static not(value: MaybeMatrix): Matrix;
static abs(value: MaybeMatrix): Matrix;
static acos(value: MaybeMatrix): Matrix;
static acosh(value: MaybeMatrix): Matrix;
static asin(value: MaybeMatrix): Matrix;
static asinh(value: MaybeMatrix): Matrix;
static atan(value: MaybeMatrix): Matrix;
static atanh(value: MaybeMatrix): Matrix;
static cbrt(value: MaybeMatrix): Matrix;
static ceil(value: MaybeMatrix): Matrix;
static clz32(value: MaybeMatrix): Matrix;
static cos(value: MaybeMatrix): Matrix;
static cosh(value: MaybeMatrix): Matrix;
static exp(value: MaybeMatrix): Matrix;
static expm1(value: MaybeMatrix): Matrix;
static floor(value: MaybeMatrix): Matrix;
static fround(value: MaybeMatrix): Matrix;
static log(value: MaybeMatrix): Matrix;
static log1p(value: MaybeMatrix): Matrix;
static log10(value: MaybeMatrix): Matrix;
static log2(value: MaybeMatrix): Matrix;
static round(value: MaybeMatrix): Matrix;
static sign(value: MaybeMatrix): Matrix;
static sin(value: MaybeMatrix): Matrix;
static sinh(value: MaybeMatrix): Matrix;
static sqrt(value: MaybeMatrix): Matrix;
static tan(value: MaybeMatrix): Matrix;
static tanh(value: MaybeMatrix): Matrix;
static trunc(value: MaybeMatrix): Matrix;
// Functional operators with one arg
// inplace
pow(value: ScalarOrMatrix): this;
// new matrix
static pow(matrix: MaybeMatrix, value: ScalarOrMatrix): Matrix;
}
export class Matrix extends AbstractMatrix {
constructor(nRows: number, nColumns: number);
constructor(data: ArrayLike<ArrayLike<number>>);
constructor(otherMatrix: AbstractMatrix);
set(rowIndex: number, columnIndex: number, value: number): this;
get(rowIndex: number, columnIndex: number): number;
/**
* Removes a column from the matrix (in place).