fixed bug
This commit is contained in:
@@ -417,9 +417,8 @@ public class Matrix<T extends NumericType<T>> implements Iterable<Matrix.Element
|
|||||||
int[] pivotValues = pivotImpl.getValues();
|
int[] pivotValues = pivotImpl.getValues();
|
||||||
int size = getRows();
|
int size = getRows();
|
||||||
if (pivotValues.length != size) throw new SizeException(
|
if (pivotValues.length != size) throw new SizeException(
|
||||||
String.format("Pivot length is %d must be %d instead", pivotValues.length, size));
|
String.format("Pivot length is %d, it must be %d instead", pivotValues.length, size));
|
||||||
|
|
||||||
for (int i = 0; i < pivotValues.length; i++) pivotValues[i] = i;
|
|
||||||
Vector<T> x = Vector.of(numericTypeFactory, size);
|
Vector<T> x = Vector.of(numericTypeFactory, size);
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
|
@@ -54,11 +54,11 @@ public class Rational implements NumericType<Rational> {
|
|||||||
public Rational(BigInteger num, BigInteger den) {
|
public Rational(BigInteger num, BigInteger den) {
|
||||||
this.num = num;
|
this.num = num;
|
||||||
this.den = den;
|
this.den = den;
|
||||||
|
simplify();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rational(long num, long den) {
|
public Rational(long num, long den) {
|
||||||
this.num = BigInteger.valueOf(num);
|
this(BigInteger.valueOf(num), BigInteger.valueOf(den));
|
||||||
this.den = BigInteger.valueOf(den);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Rational of(long num, long den) {
|
public static Rational of(long num, long den) {
|
||||||
|
@@ -6,20 +6,20 @@ public class Chronometer {
|
|||||||
|
|
||||||
public enum UnitOfMeasure {
|
public enum UnitOfMeasure {
|
||||||
NANOSECONDS(1),
|
NANOSECONDS(1),
|
||||||
MICROSECONDS(NANOSECONDS.nanoseconds_size * 1000),
|
MICROSECONDS(NANOSECONDS.nanoseconds * 1000),
|
||||||
MILLISECONDS(MICROSECONDS.nanoseconds_size * 1000),
|
MILLISECONDS(MICROSECONDS.nanoseconds * 1000),
|
||||||
SECONDS(MILLISECONDS.nanoseconds_size * 1000),
|
SECONDS(MILLISECONDS.nanoseconds * 1000),
|
||||||
MINUTES(SECONDS.nanoseconds_size * 60),
|
MINUTES(SECONDS.nanoseconds * 60),
|
||||||
HOURS(MINUTES.nanoseconds_size * 60),
|
HOURS(MINUTES.nanoseconds * 60),
|
||||||
DAYS(HOURS.nanoseconds_size * 24),
|
DAYS(HOURS.nanoseconds * 24),
|
||||||
WEEKS(DAYS.nanoseconds_size * 7),
|
WEEKS(DAYS.nanoseconds * 7),
|
||||||
MONTHS(DAYS.nanoseconds_size * 30),
|
MONTHS(DAYS.nanoseconds * 30),
|
||||||
YEARS(DAYS.nanoseconds_size * 365);
|
YEARS(DAYS.nanoseconds * 365);
|
||||||
|
|
||||||
public long nanoseconds_size;
|
public final long nanoseconds;
|
||||||
|
|
||||||
UnitOfMeasure(long nanoseconds_size) {
|
UnitOfMeasure(long nanoseconds) {
|
||||||
this.nanoseconds_size = nanoseconds_size;
|
this.nanoseconds = nanoseconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,6 +39,6 @@ public class Chronometer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double elapsed(UnitOfMeasure unitOfMeasure) {
|
public double elapsed(UnitOfMeasure unitOfMeasure) {
|
||||||
return ((double) (System.nanoTime() - start)) / unitOfMeasure.nanoseconds_size;
|
return ((double) (System.nanoTime() - start)) / unitOfMeasure.nanoseconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -277,11 +277,11 @@ public class LruCache<K, V> implements Map<K, V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getAverageLoadingTime(Chronometer.UnitOfMeasure unitOfMeasure) {
|
public float getAverageLoadingTime(Chronometer.UnitOfMeasure unitOfMeasure) {
|
||||||
return (float) stats.loadingTime / calls / unitOfMeasure.nanoseconds_size;
|
return (float) stats.loadingTime / calls / unitOfMeasure.nanoseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getTotalLoadingTime(Chronometer.UnitOfMeasure unitOfMeasure) {
|
public float getTotalLoadingTime(Chronometer.UnitOfMeasure unitOfMeasure) {
|
||||||
return (float) stats.loadingTime / unitOfMeasure.nanoseconds_size;
|
return (float) stats.loadingTime / unitOfMeasure.nanoseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getAverageLoadingTime() {
|
public float getAverageLoadingTime() {
|
||||||
|
Reference in New Issue
Block a user