Skip to content

Commit 28b23b8

Browse files
authored
Merge pull request #2 from stefan-zobel/Tensors
Merge Tensors branch
2 parents a3e4b63 + 3129593 commit 28b23b8

22 files changed

+2216
-239
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>net.sourceforge.streamsupport</groupId>
55
<artifactId>jamu</artifactId>
66
<packaging>jar</packaging>
7-
<version>1.3.1</version>
7+
<version>1.4.0-SNAPSHOT</version>
88
<name>JAMU</name>
99
<description>Java Matrix Utilities built on top of Intel MKL</description>
1010
<url>https://github.com/stefan-zobel/JAMU/</url>
@@ -33,7 +33,7 @@
3333
<dependency>
3434
<groupId>net.sourceforge.streamsupport</groupId>
3535
<artifactId>dedekind-mkl</artifactId>
36-
<version>1.0.1</version>
36+
<version>1.1.0</version>
3737
<scope>compile</scope>
3838
</dependency>
3939
</dependencies>

src/main/java/net/jamu/matrix/Checks.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019, 2021 Stefan Zobel
2+
* Copyright 2019, 2023 Stefan Zobel
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -293,20 +293,20 @@ static void checkStdDev(double stdDev) {
293293
}
294294
}
295295

296-
static void throwInfiniteOrNan(Dimensions A, int index) {
296+
static void throwInfiniteOrNan(MatrixDimensions A, int index) {
297297
int row = rowIdx(A, index);
298298
int col = colIdx(A, index, row);
299299
throw new IllegalArgumentException("Infinite or NaN at (" + row + ", " + col + ")");
300300
}
301301

302-
static int rowIdx(Dimensions A, int index) {
302+
static int rowIdx(MatrixDimensions A, int index) {
303303
if (A.isComplex()) {
304304
index = index / 2;
305305
}
306306
return index % A.numRows();
307307
}
308308

309-
static int colIdx(Dimensions A, int index, int rowIdx) {
309+
static int colIdx(MatrixDimensions A, int index, int rowIdx) {
310310
if (A.isComplex()) {
311311
index = index / 2;
312312
}

src/main/java/net/jamu/matrix/ComplexMatrixD.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* layout. The addressing is zero based. All operations throw a
2626
* {@code NullPointerException} if any of the method arguments is {@code null}.
2727
*/
28-
public interface ComplexMatrixD extends Dimensions, ComplexMatrixDConduct {
28+
public interface ComplexMatrixD extends MatrixDimensions, ComplexMatrixDConduct {
2929

3030
/**
3131
* Get the single element as a scalar if this matrix is 1-by-1.

src/main/java/net/jamu/matrix/ComplexMatrixDConduct.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public interface ComplexMatrixDConduct {
154154
ComplexMatrixD mrdivide(ComplexMatrixD B);
155155

156156
/**
157-
* {@code A * B} convenience multiplication. None of the operands is
157+
* {@code A * B} convenience multiplication. None of the operands are
158158
* mutated.
159159
*
160160
* @param B
@@ -166,7 +166,7 @@ public interface ComplexMatrixDConduct {
166166
/**
167167
* {@code A * B * C} convenience multiplication. The optimal
168168
* parenthesization of the involved product of 3 matrices will be determined
169-
* automatically. None of the operands is mutated.
169+
* automatically. None of the operands are mutated.
170170
*
171171
* @param B
172172
* second multiplicand
@@ -181,7 +181,7 @@ public interface ComplexMatrixDConduct {
181181
* multiplication. This is much more efficient than the equivalent
182182
* {@code A.times(B1).times(B2).times(B3) ... .times(Bn)} multiplication as
183183
* the cheapest sequence for performing these multiplications is determined
184-
* automatically by this method. None of the operands is mutated.
184+
* automatically by this method. None of the operands are mutated.
185185
*
186186
* @param m
187187
* the first matrix to right-multiply (the {@code B1} from above)
@@ -196,7 +196,7 @@ public interface ComplexMatrixDConduct {
196196
/**
197197
* <code>A * A<sup>*</sup></code> multiplication. This is much more
198198
* efficient than the equivalent {@code A.times(A.conjugateTranspose())}.
199-
* None of the operands is mutated. For the reversed order multiplication
199+
* None of the operands are mutated. For the reversed order multiplication
200200
* <code>A<sup>*</sup> * A</code> use {@link #conjugateTransposedTimes()}.
201201
*
202202
* @return the result of the multiplication
@@ -207,7 +207,7 @@ public interface ComplexMatrixDConduct {
207207
/**
208208
* <code>A * B<sup>*</sup></code> multiplication. This is much more
209209
* efficient than the equivalent {@code A.times(B.conjugateTranspose())}.
210-
* None of the operands is mutated. For the reversed order multiplication
210+
* None of the operands are mutated. For the reversed order multiplication
211211
* <code>A<sup>*</sup> * B</code> use
212212
* {@link #conjugateTransposedTimes(ComplexMatrixD)}.
213213
*
@@ -221,7 +221,7 @@ public interface ComplexMatrixDConduct {
221221
/**
222222
* <code>A<sup>*</sup> * A</code> multiplication. This is much more
223223
* efficient than the equivalent {@code A.conjugateTranspose().times(A)}.
224-
* None of the operands is mutated. For the reversed order multiplication
224+
* None of the operands are mutated. For the reversed order multiplication
225225
* <code>A * A<sup>*</sup></code> use {@link #timesConjugateTransposed()}.
226226
*
227227
* @return the result of the multiplication
@@ -232,7 +232,7 @@ public interface ComplexMatrixDConduct {
232232
/**
233233
* <code>A<sup>*</sup> * B</code> multiplication. This is much more
234234
* efficient than the equivalent {@code A.conjugateTranspose().times(B)}.
235-
* None of the operands is mutated. For the reversed order multiplication
235+
* None of the operands are mutated. For the reversed order multiplication
236236
* <code>A * B<sup>*</sup></code> use
237237
* {@link #timesConjugateTransposed(ComplexMatrixD)}.
238238
*
@@ -246,7 +246,7 @@ public interface ComplexMatrixDConduct {
246246
/**
247247
* Multiply this matrix {@code A} with a real matrix {@code B} returning
248248
* the result of the multiplication {@code A * B} as a complex matrix. None
249-
* of the operands is mutated.
249+
* of the operands are mutated.
250250
*
251251
* @param B
252252
* second multiplicand (a real matrix)
@@ -255,7 +255,7 @@ public interface ComplexMatrixDConduct {
255255
ComplexMatrixD times(MatrixD B);
256256

257257
/**
258-
* {@code A + B} convenience addition. None of the operands is mutated.
258+
* {@code A + B} convenience addition. None of the operands are mutated.
259259
*
260260
* @param B
261261
* the addend
@@ -265,7 +265,7 @@ public interface ComplexMatrixDConduct {
265265

266266
/**
267267
* {@code A * B + C} convenience multiplication plus addition. None of the
268-
* operands is mutated.
268+
* operands are mutated.
269269
*
270270
* @param B
271271
* second multiplicand
@@ -277,7 +277,7 @@ public interface ComplexMatrixDConduct {
277277

278278
/**
279279
* {@code A * B - C} convenience multiplication and subtraction. None of
280-
* the operands is mutated.
280+
* the operands are mutated.
281281
*
282282
* @param B
283283
* second multiplicand
@@ -289,7 +289,7 @@ public interface ComplexMatrixDConduct {
289289
ComplexMatrixD timesMinus(ComplexMatrixD B, ComplexMatrixD C);
290290

291291
/**
292-
* {@code A - B} convenience subtraction. None of the operands is mutated.
292+
* {@code A - B} convenience subtraction. None of the operands are mutated.
293293
*
294294
* @param B
295295
* the subtrahend
@@ -298,7 +298,7 @@ public interface ComplexMatrixDConduct {
298298
ComplexMatrixD minus(ComplexMatrixD B);
299299

300300
/**
301-
* Unary minus {@code -A} convenience method. None of the operands is
301+
* Unary minus {@code -A} convenience method. None of the operands are
302302
* mutated.
303303
*
304304
* @return {@code -A}
@@ -308,29 +308,29 @@ public interface ComplexMatrixDConduct {
308308
/**
309309
* Returns {@code |A|}, i.e. a matrix where all elements
310310
* <code>a<sub>ij</sub></code> have been replaced by their absolute value
311-
* <code>|a<sub>ij</sub>|</code>. None of the operands is mutated.
311+
* <code>|a<sub>ij</sub>|</code>. None of the operands are mutated.
312312
*
313313
* @return {@code |A|}, the matrix of absolute values of {@code A}
314314
*/
315315
ComplexMatrixD abs();
316316

317317
/**
318-
* Returns <code>A<sup>*</sup></code>. None of the operands is mutated.
318+
* Returns <code>A<sup>*</sup></code>. None of the operands are mutated.
319319
*
320320
* @return the conjugate transpose of this matrix
321321
*/
322322
ComplexMatrixD conjugateTranspose();
323323

324324
/**
325-
* Returns <code>A<sup>T</sup></code>. None of the operands is mutated.
325+
* Returns <code>A<sup>T</sup></code>. None of the operands are mutated.
326326
*
327327
* @return the transposed matrix
328328
*/
329329
ComplexMatrixD transpose();
330330

331331
/**
332332
* Returns <code>A<sup>-1</sup></code> for quadratic matrices. None of the
333-
* operands is mutated.
333+
* operands are mutated.
334334
*
335335
* @return the inverse of this matrix if it is quadratic
336336
* @throws IllegalArgumentException
@@ -375,7 +375,7 @@ public interface ComplexMatrixDConduct {
375375
* The new shape must be compatible with the original shape in the sense
376376
* that {@code rows x cols == this.numRows() x this.numColumns()} is
377377
* required, otherwise an {@code IllegalArgumentException} is thrown. None
378-
* of the operands is mutated.
378+
* of the operands are mutated.
379379
*
380380
* @param rows
381381
* the desired number of rows of the reshaped matrix

src/main/java/net/jamu/matrix/ComplexMatrixF.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* layout. The addressing is zero based. All operations throw a
2626
* {@code NullPointerException} if any of the method arguments is {@code null}.
2727
*/
28-
public interface ComplexMatrixF extends Dimensions, ComplexMatrixFConduct {
28+
public interface ComplexMatrixF extends MatrixDimensions, ComplexMatrixFConduct {
2929

3030
/**
3131
* Get the single element as a scalar if this matrix is 1-by-1.

src/main/java/net/jamu/matrix/ComplexMatrixFConduct.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public interface ComplexMatrixFConduct {
154154
ComplexMatrixF mrdivide(ComplexMatrixF B);
155155

156156
/**
157-
* {@code A * B} convenience multiplication. None of the operands is
157+
* {@code A * B} convenience multiplication. None of the operands are
158158
* mutated.
159159
*
160160
* @param B
@@ -166,7 +166,7 @@ public interface ComplexMatrixFConduct {
166166
/**
167167
* {@code A * B * C} convenience multiplication. The optimal
168168
* parenthesization of the involved product of 3 matrices will be determined
169-
* automatically. None of the operands is mutated.
169+
* automatically. None of the operands are mutated.
170170
*
171171
* @param B
172172
* second multiplicand
@@ -181,7 +181,7 @@ public interface ComplexMatrixFConduct {
181181
* multiplication. This is much more efficient than the equivalent
182182
* {@code A.times(B1).times(B2).times(B3) ... .times(Bn)} multiplication as
183183
* the cheapest sequence for performing these multiplications is determined
184-
* automatically by this method. None of the operands is mutated.
184+
* automatically by this method. None of the operands are mutated.
185185
*
186186
* @param m
187187
* the first matrix to right-multiply (the {@code B1} from above)
@@ -196,7 +196,7 @@ public interface ComplexMatrixFConduct {
196196
/**
197197
* <code>A * A<sup>*</sup></code> multiplication. This is much more
198198
* efficient than the equivalent {@code A.times(A.conjugateTranspose())}.
199-
* None of the operands is mutated. For the reversed order multiplication
199+
* None of the operands are mutated. For the reversed order multiplication
200200
* <code>A<sup>*</sup> * A</code> use {@link #conjugateTransposedTimes()}.
201201
*
202202
* @return the result of the multiplication
@@ -207,7 +207,7 @@ public interface ComplexMatrixFConduct {
207207
/**
208208
* <code>A * B<sup>*</sup></code> multiplication. This is much more
209209
* efficient than the equivalent {@code A.times(B.conjugateTranspose())}.
210-
* None of the operands is mutated. For the reversed order multiplication
210+
* None of the operands are mutated. For the reversed order multiplication
211211
* <code>A<sup>*</sup> * B</code> use
212212
* {@link #conjugateTransposedTimes(ComplexMatrixF)}.
213213
*
@@ -221,7 +221,7 @@ public interface ComplexMatrixFConduct {
221221
/**
222222
* <code>A<sup>*</sup> * A</code> multiplication. This is much more
223223
* efficient than the equivalent {@code A.conjugateTranspose().times(A)}.
224-
* None of the operands is mutated. For the reversed order multiplication
224+
* None of the operands are mutated. For the reversed order multiplication
225225
* <code>A * A<sup>*</sup></code> use {@link #timesConjugateTransposed()}.
226226
*
227227
* @return the result of the multiplication
@@ -232,7 +232,7 @@ public interface ComplexMatrixFConduct {
232232
/**
233233
* <code>A<sup>*</sup> * B</code> multiplication. This is much more
234234
* efficient than the equivalent {@code A.conjugateTranspose().times(B)}.
235-
* None of the operands is mutated. For the reversed order multiplication
235+
* None of the operands are mutated. For the reversed order multiplication
236236
* <code>A * B<sup>*</sup></code> use
237237
* {@link #timesConjugateTransposed(ComplexMatrixF)}.
238238
*
@@ -246,7 +246,7 @@ public interface ComplexMatrixFConduct {
246246
/**
247247
* Multiply this matrix {@code A} with a real matrix {@code B} returning
248248
* the result of the multiplication {@code A * B} as a complex matrix. None
249-
* of the operands is mutated.
249+
* of the operands are mutated.
250250
*
251251
* @param B
252252
* second multiplicand (a real matrix)
@@ -255,7 +255,7 @@ public interface ComplexMatrixFConduct {
255255
ComplexMatrixF times(MatrixF B);
256256

257257
/**
258-
* {@code A + B} convenience addition. None of the operands is mutated.
258+
* {@code A + B} convenience addition. None of the operands are mutated.
259259
*
260260
* @param B
261261
* the addend
@@ -265,7 +265,7 @@ public interface ComplexMatrixFConduct {
265265

266266
/**
267267
* {@code A * B + C} convenience multiplication plus addition. None of the
268-
* operands is mutated.
268+
* operands are mutated.
269269
*
270270
* @param B
271271
* second multiplicand
@@ -277,7 +277,7 @@ public interface ComplexMatrixFConduct {
277277

278278
/**
279279
* {@code A * B - C} convenience multiplication and subtraction. None of
280-
* the operands is mutated.
280+
* the operands are mutated.
281281
*
282282
* @param B
283283
* second multiplicand
@@ -289,7 +289,7 @@ public interface ComplexMatrixFConduct {
289289
ComplexMatrixF timesMinus(ComplexMatrixF B, ComplexMatrixF C);
290290

291291
/**
292-
* {@code A - B} convenience subtraction. None of the operands is mutated.
292+
* {@code A - B} convenience subtraction. None of the operands are mutated.
293293
*
294294
* @param B
295295
* the subtrahend
@@ -298,7 +298,7 @@ public interface ComplexMatrixFConduct {
298298
ComplexMatrixF minus(ComplexMatrixF B);
299299

300300
/**
301-
* Unary minus {@code -A} convenience method. None of the operands is
301+
* Unary minus {@code -A} convenience method. None of the operands are
302302
* mutated.
303303
*
304304
* @return {@code -A}
@@ -308,29 +308,29 @@ public interface ComplexMatrixFConduct {
308308
/**
309309
* Returns {@code |A|}, i.e. a matrix where all elements
310310
* <code>a<sub>ij</sub></code> have been replaced by their absolute value
311-
* <code>|a<sub>ij</sub>|</code>. None of the operands is mutated.
311+
* <code>|a<sub>ij</sub>|</code>. None of the operands are mutated.
312312
*
313313
* @return {@code |A|}, the matrix of absolute values of {@code A}
314314
*/
315315
ComplexMatrixF abs();
316316

317317
/**
318-
* Returns <code>A<sup>*</sup></code>. None of the operands is mutated.
318+
* Returns <code>A<sup>*</sup></code>. None of the operands are mutated.
319319
*
320320
* @return the conjugate transpose of this matrix
321321
*/
322322
ComplexMatrixF conjugateTranspose();
323323

324324
/**
325-
* Returns <code>A<sup>T</sup></code>. None of the operands is mutated.
325+
* Returns <code>A<sup>T</sup></code>. None of the operands are mutated.
326326
*
327327
* @return the transposed matrix
328328
*/
329329
ComplexMatrixF transpose();
330330

331331
/**
332332
* Returns <code>A<sup>-1</sup></code> for quadratic matrices. None of the
333-
* operands is mutated.
333+
* operands are mutated.
334334
*
335335
* @return the inverse of this matrix if it is quadratic
336336
* @throws IllegalArgumentException
@@ -375,7 +375,7 @@ public interface ComplexMatrixFConduct {
375375
* The new shape must be compatible with the original shape in the sense
376376
* that {@code rows x cols == this.numRows() x this.numColumns()} is
377377
* required, otherwise an {@code IllegalArgumentException} is thrown. None
378-
* of the operands is mutated.
378+
* of the operands are mutated.
379379
*
380380
* @param rows
381381
* the desired number of rows of the reshaped matrix

0 commit comments

Comments
 (0)