update to 2024.01.31

This commit is contained in:
2024-01-31 06:53:52 +08:00
parent ecbae35415
commit 21753f8e0c
26 changed files with 1589 additions and 58 deletions

View File

@@ -16,7 +16,7 @@ dependencies {
implementation project(':jmath')
}
envelopeJar {
application {
mainClass = 'net.woggioni.jmath.benchmark.Main'
}

View File

@@ -1,5 +1,7 @@
{
"resources":{
"includes":[]},
"includes":[{
"pattern":"\\QMETA-INF/services/java.time.zone.ZoneRulesProvider\\E"
}]},
"bundles":[]
}

View File

@@ -24,10 +24,15 @@ public class Main {
Matrix<Rational> mtx = Matrix.of(numericTypeFactory, size, size, init);
Matrix<Rational> lu = mtx.clone();
Matrix.Pivot pivot = lu.lup();
IntFunction<Rational> initVector = (i) -> Rational.of(rnd.nextInt(0, size), size);
Vector<Rational> b = Vector.of(numericTypeFactory, size, initVector);
Vector<Rational> x = lu.luSolve(b, pivot);
Vector<Rational> error = mtx.mmul(x).sub(b);
System.out.println(error.norm());
for(int i = 0; i < size; i++) {
IntFunction<Rational> initVector = (j) -> Rational.of(rnd.nextInt(0, size), size);
Vector<Rational> b = Vector.of(numericTypeFactory, size, initVector);
Vector<Rational> x = lu.luSolve(b, pivot);
Vector<Rational> error = mtx.mmul(x).sub(b);
Rational norm = error.norm();
if(norm.compareTo(Rational.ZERO) != 0) {
throw new RuntimeException(String.format("Error is %s", norm));
}
}
}
}