Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance #89

Open
wants to merge 2 commits into
base: SNAPSHOT
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/src/org/ejml/example/PolynomialFit.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ private void removeObservation( int index ) {
final double d[] = y.data;

// shift
for( int i = index; i < N; i++ ) {
d[i] = d[i+1];
if (N - index >= 0) {
System.arraycopy(d, index + 1, d, index, N - index);
}
y.numRows--;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ private void printClassParam( int dimen ) {
}

private void printFunctionParam( int spaces, int dimen ) {
String s = "";
StringBuilder s = new StringBuilder();
for (int i = 0; i < spaces; i++) {
s += " ";
s.append(" ");
}
for( int y = 1; y <= dimen; y++ ) {
if( y == 1 )
Expand Down
4 changes: 2 additions & 2 deletions main/ejml-core/src/org/ejml/data/DMatrixSparseTriplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ public void remove(int row, int col) {
if( where >= 0 ) {

nz_length -= 1;
for (int i = where; i < nz_length; i++) {
nz_value.data[i] = nz_value.data[i+1];
if (nz_length - where >= 0) {
System.arraycopy(nz_value.data, where + 1, nz_value.data, where, nz_length - where);
}
int end = nz_length*2;
for (int i = where*2; i < end; i += 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ private void hasUncountable(int dimen ){
out.print(" public static boolean hasUncountable("+nameMatrix+" a ) {\n");

for( int y = 1; y <= dimen; y++ ) {
String row = "";
StringBuilder row = new StringBuilder();

for( int x = 1; x <= dimen; x++ ) {
String n = y+""+x;
if( x > 1 )
row += "+ ";
row += "a.a"+n;
row.append("+ ");
row.append("a.a").append(n);
}
out.print(" if( UtilEjml.isUncountable("+row+"))\n"+
" return true;\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ public DMatrixRMaj getQ(@Nullable DMatrixRMaj Q , boolean transposed ) {
if( transposed ) {
for( int j = N-2; j >= 0; j-- ) {
w[j+1] = 1;
for( int i = j+2; i < N; i++ ) {
w[i] = QT.data[j*N+i];
if (N - j + 2 >= 0) {
System.arraycopy(QT.data, j * N + j + 2, w, j + 2, N - j + 2);
}
QrHelperFunctions_DDRM.rank1UpdateMultL(Q, w, gammas[j + 1], j + 1, j + 1, N);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ private int openRemove( int where ) {

private void openAdd( int where, int val )
{
for( int i = numOpen; i > where; i-- ) {
open[i] = open[i-1];
if (numOpen - where >= 0) {
System.arraycopy(open, where, open, where + 1, numOpen - where);
}
numOpen++;
open[where] = val;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public DMatrixRMaj getW(@Nullable DMatrixRMaj W ) {
W.zero();
}

for( int i = 0; i < numSingular; i++ ) {
W.data[i*W.numCols+i] = singularValues[i];
if (numSingular >= 0) {
System.arraycopy(singularValues, 0, W.data, 0 * W.numCols + 0, numSingular);
}

return W;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public DMatrixRMaj getW(@Nullable DMatrixRMaj W ) {
W.zero();
}

for( int i = 0; i < numSingular; i++ ) {
W.data[i*W.numCols+i] = singularValues[i];
if (numSingular >= 0) {
System.arraycopy(singularValues, 0, W.data, 0 * W.numCols + 0, numSingular);
}

return W;
Expand Down
6 changes: 3 additions & 3 deletions main/ejml-simple/src/org/ejml/equation/TokenList.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@ public void insertAfter(Token before, TokenList list ) {
*/
@Override
public String toString() {
String ret = "";
StringBuilder ret = new StringBuilder();
Token t = first;
while( t != null ) {
ret += t +" ";
ret.append(t).append(" ");
t = t.next;
}
return ret;
return ret.toString();
}

/**
Expand Down