Skip to content

Commit a092e4e

Browse files
build
- Tuning build script lint - Fixing stuff error prone is complaining about
1 parent 3b23a62 commit a092e4e

File tree

6 files changed

+17
-28
lines changed

6 files changed

+17
-28
lines changed

build.gradle

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ subprojects {
169169
// for vectors or scalars. Perhaps a more verbose name should be used but it's disabled for now to reduce build spam
170170
tasks.withType(JavaCompile).configureEach {
171171
options.errorprone.enabled = false
172-
if (path.contains("Benchmarks") || path.contains("examples") || path.contains("regression"))
172+
if (path.contains("Benchmarks") || path.contains("examples") || path.contains("regression") || name.contains("Test"))
173173
return
174174

175175
options.errorprone.enabled = true
@@ -191,14 +191,6 @@ subprojects {
191191
option("NullAway:TreatGeneratedAsUnannotated", true)
192192
option("NullAway:AnnotatedPackages", "org.ejml")
193193
}
194-
195-
// Include to disable on test code
196-
if (name.toLowerCase().contains("test")) {
197-
options.errorprone {
198-
disable("NullAway")
199-
}
200-
options.errorprone.enabled = false
201-
}
202194
}
203195

204196
// Skip these codeless directories when publishing jars locally or to a remote destination

main/ejml-core/src/org/ejml/UtilEjml.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, Peter Abeles. All Rights Reserved.
2+
* Copyright (c) 2023, Peter Abeles. All Rights Reserved.
33
*
44
* This file is part of Efficient Java Matrix Library (EJML).
55
*
@@ -270,11 +270,13 @@ public static void checkValidMatrixShapeComplex( int rows, int cols ) {
270270
checkTooLargeComplex(rows, cols);
271271
}
272272

273+
@SuppressWarnings({"NarrowCalculation", "IntegerMultiplicationImplicitCastToLong"})
273274
public static void checkTooLarge( int rows, int cols ) {
274275
if ((rows*cols) != ((long)rows*cols))
275276
throw new IllegalArgumentException("Matrix size exceeds the size of an integer");
276277
}
277278

279+
@SuppressWarnings({"NarrowCalculation", "IntegerMultiplicationImplicitCastToLong"})
278280
public static void checkTooLargeComplex( int rows, int cols ) {
279281
if ((2*rows*cols) != ((long)rows*cols*2))
280282
throw new IllegalArgumentException("Matrix size exceeds the size of an integer");
@@ -673,19 +675,19 @@ public static boolean exceedsMaxMatrixSize( int numRows, int numCols ) {
673675
return numCols > Integer.MAX_VALUE/numRows;
674676
}
675677

676-
public static void printTime( String message, Process timer ) {
678+
public static void printTime( String message, EjmlProcess timer ) {
677679
printTime("Processing... ", message, timer);
678680
}
679681

680-
public static void printTime( String pre, String message, Process timer ) {
682+
public static void printTime( String pre, String message, EjmlProcess timer ) {
681683
System.out.printf(pre);
682684
long time0 = System.nanoTime();
683685
timer.process();
684686
long time1 = System.nanoTime();
685687
System.out.println(message + " " + ((time1 - time0)*1e-6) + " (ms)");
686688
}
687689

688-
public interface Process {
690+
public interface EjmlProcess {
689691
void process();
690692
}
691693

main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
package org.ejml.dense.row;
1919

2020
import org.ejml.UtilEjml;
21-
import org.ejml.data.*;
21+
import org.ejml.data.DMatrixD1;
2222
import org.ejml.dense.row.decomposition.chol.CholeskyDecompositionInner_DDRM;
2323
import org.ejml.dense.row.factory.DecompositionFactory_DDRM;
2424
import org.ejml.dense.row.mult.VectorVectorMult_DDRM;
@@ -578,11 +578,6 @@ public static boolean isDiagonalPositive( DMatrixRMaj a ) {
578578
return true;
579579
}
580580

581-
// TODO write this
582-
public static boolean isFullRank( DMatrixRMaj a ) {
583-
throw new RuntimeException("Implement");
584-
}
585-
586581
/**
587582
* <p>
588583
* Checks to see if the two matrices are the negative of each other:<br>

main/ejml-ddense/src/org/ejml/dense/row/linsol/qr/LinearSolverQrHouseCol_MT_DDRM.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, Peter Abeles. All Rights Reserved.
2+
* Copyright (c) 2023, Peter Abeles. All Rights Reserved.
33
*
44
* This file is part of Efficient Java Matrix Library (EJML).
55
*
@@ -95,7 +95,6 @@ public void solve( DMatrixRMaj B, DMatrixRMaj X ) {
9595

9696
private static class Work {
9797
public final DMatrixRMaj a = new DMatrixRMaj(1, 1);
98-
public final DMatrixRMaj u = new DMatrixRMaj(1, 1);
9998
public final DGrowArray tmp = new DGrowArray();
10099
}
101100
}

main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, Peter Abeles. All Rights Reserved.
2+
* Copyright (c) 2023, Peter Abeles. All Rights Reserved.
33
*
44
* This file is part of Efficient Java Matrix Library (EJML).
55
*
@@ -243,7 +243,7 @@ public static int nonzero( int numRows, int numCols, double minFill, double maxF
243243
* @return Random matrix
244244
*/
245245
public static DMatrixSparseCSC triangle( boolean upper, int N, double minFill, double maxFill, Random rand ) {
246-
int nz = (int)(((N - 1)*(N - 1)/2)*(rand.nextDouble()*(maxFill - minFill) + minFill)) + N;
246+
int nz = Math.toIntExact((((N - 1L)*(N - 1L)/2L)*(long)(rand.nextDouble()*(maxFill - minFill) + minFill)) + N);
247247

248248
if (upper) {
249249
return triangleUpper(N, 0, nz, -1, 1, rand);
@@ -300,6 +300,7 @@ public static DMatrixSparseCSC symmetricPosDef( int width, double probabilityZer
300300
* @param rand Random number generator
301301
* @return Randomly generated matrix
302302
*/
303+
@SuppressWarnings("NarrowCalculation")
303304
public static DMatrixSparseCSC generateUniform( int numRows, int numCols, int nzEntriesPerColumn,
304305
double min, double max, Random rand ) {
305306
if (nzEntriesPerColumn > numRows) {

main/ejml-simple/src/org/ejml/equation/Macro.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, Peter Abeles. All Rights Reserved.
2+
* Copyright (c) 2023, Peter Abeles. All Rights Reserved.
33
*
44
* This file is part of Efficient Java Matrix Library (EJML).
55
*
@@ -19,8 +19,8 @@
1919
package org.ejml.equation;
2020

2121
import java.util.ArrayList;
22-
import java.util.HashMap;
2322
import java.util.List;
23+
import java.util.Map;
2424

2525
/**
2626
* Definition of a macro. Each input will replace the word of its name
@@ -60,9 +60,9 @@ public TokenList execute( List<TokenList.Token> replacements ) {
6060

6161
public class Assign extends Operation {
6262

63-
HashMap<String, Macro> macros;
63+
Map<String, Macro> macros;
6464

65-
protected Assign( HashMap<String, Macro> macros ) {
65+
protected Assign( Map<String, Macro> macros ) {
6666
super("Macro:" + Macro.this.name);
6767
this.macros = macros;
6868
}
@@ -73,7 +73,7 @@ public void process() {
7373
}
7474
}
7575

76-
public Operation createOperation( HashMap<String, Macro> macros ) {
76+
public Operation createOperation( Map<String, Macro> macros ) {
7777
return new Assign(macros);
7878
}
7979
}

0 commit comments

Comments
 (0)