Closed crowlogic closed 4 months ago
jshell> var cool = F(Real.newVector(-4,4),Real.newVector(0.5),128,new RealPolynomial());
jshell> cool
cool ==> 1 - 32x + 160x² - 256x³ + 128x⁴
arb.exceptions.ExpressionCompilerException: expected closing parenthesis, instead got [ at position 2 in expression 'F([-2,3.5,1],[-2,3],1/2-x/2)' variableReference=F which is followed by [-2,3.5,1],[-2,3],1/2-x/2)
at arb4j/arb.expressions.Expression.throwMissingClosingParenthesisException(Expression.java:1741)
at arb4j/arb.expressions.Expression.resolveFunction(Expression.java:1668)
at arb4j/arb.expressions.Expression.resolveFunctionOrVariableReference(Expression.java:1683)
at arb4j/arb.expressions.Expression.evaluate(Expression.java:740)
at arb4j/arb.expressions.Expression.exponentiate(Expression.java:844)
at arb4j/arb.expressions.Expression.exponentiateMultiplyAndDivide(Expression.java:883)
at arb4j/arb.expressions.Expression.resolve(Expression.java:1605)
at arb4j/arb.expressions.Expression.parseRoot(Expression.java:1499)
at arb4j/arb.expressions.Compiler.express(Compiler.java:166)
at arb4j/arb.expressions.Compiler.express(Compiler.java:183)
at arb4j/arb.expressions.Compiler.express(Compiler.java:118)
at arb4j/arb.expressions.Expression.compile(Expression.java:193)
at arb4j/arb.expressions.Expression.instantiate(Expression.java:231)
at arb4j/arb.functions.real.RealFunction.express(RealFunction.java:655)
at arb4j/arb.functions.real.RealFunction.express(RealFunction.java:649)
at arb4j/arb.functions.real.RealFunction.express(RealFunction.java:628)
at arb4j/arb.expressions.ExpressionTest.testHypergeometricFuntion(ExpressionTest.java:24)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at junit@4.13.2/junit.framework.TestCase.runTest(TestCase.java:177)
at junit@4.13.2/junit.framework.TestCase.runBare(TestCase.java:142)
at junit@4.13.2/junit.framework.TestResult$1.protect(TestResult.java:122)
at junit@4.13.2/junit.framework.TestResult.runProtected(TestResult.java:142)
at junit@4.13.2/junit.framework.TestResult.run(TestResult.java:125)
at junit@4.13.2/junit.framework.TestCase.run(TestCase.java:130)
at junit@4.13.2/junit.framework.TestSuite.runTest(TestSuite.java:241)
at junit@4.13.2/junit.framework.TestSuite.run(TestSuite.java:236)
at junit@4.13.2/org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:757)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
java.lang.AssertionError: TODO: parse arguments of the hypergeometric function
at arb4j/arb.expressions.nodes.unary.HypergeometricFunction.<init>(HypergeometricFunction.java:22)
at arb4j/arb.expressions.Expression.resolveFunction(Expression.java:1641)
at arb4j/arb.expressions.Expression.resolveFunctionOrVariableReference(Expression.java:1673)
at arb4j/arb.expressions.Expression.evaluate(Expression.java:726)
at arb4j/arb.expressions.Expression.exponentiate(Expression.java:830)
at arb4j/arb.expressions.Expression.exponentiateMultiplyAndDivide(Expression.java:869)
at arb4j/arb.expressions.Expression.resolve(Expression.java:1591)
at arb4j/arb.expressions.Expression.parseRoot(Expression.java:1485)
at arb4j/arb.expressions.Compiler.express(Compiler.java:166)
at arb4j/arb.expressions.Compiler.express(Compiler.java:183)
at arb4j/arb.expressions.Compiler.express(Compiler.java:118)
at arb4j/arb.expressions.Expression.compile(Expression.java:179)
at arb4j/arb.expressions.Expression.instantiate(Expression.java:217)
at arb4j/arb.functions.real.RealFunction.express(RealFunction.java:655)
at arb4j/arb.functions.real.RealFunction.express(RealFunction.java:649)
at arb4j/arb.functions.real.RealFunction.express(RealFunction.java:628)
at arb4j/arb.expressions.ExpressionTest.testHypergeometricFuntion(ExpressionTest.java:24)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at junit@4.13.2/junit.framework.TestCase.runTest(TestCase.java:177)
at junit@4.13.2/junit.framework.TestCase.runBare(TestCase.java:142)
at junit@4.13.2/junit.framework.TestResult$1.protect(TestResult.java:122)
at junit@4.13.2/junit.framework.TestResult.runProtected(TestResult.java:142)
at junit@4.13.2/junit.framework.TestResult.run(TestResult.java:125)
at junit@4.13.2/junit.framework.TestCase.run(TestCase.java:130)
at junit@4.13.2/junit.framework.TestSuite.runTest(TestSuite.java:241)
at junit@4.13.2/junit.framework.TestSuite.run(TestSuite.java:236)
at junit@4.13.2/org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:757)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
java.lang.AssertionError: TODO: cast 1 of type class arb.expressions.nodes.LiteralConstant which generated a result of type class arb.Integer and not the requested result type class arb.Real, use Node.castTo
at arb4j/arb.expressions.nodes.LiteralConstant.generate(LiteralConstant.java:153)
at arb4j/arb.expressions.nodes.Vector.lambda$1(Vector.java:96)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at arb4j/arb.expressions.nodes.Vector.generate(Vector.java:82)
at arb4j/arb.expressions.nodes.unary.HypergeometricFunction.generate(HypergeometricFunction.java:31)
at arb4j/arb.expressions.Expression.generateEvaluationMethod(Expression.java:1013)
at arb4j/arb.expressions.Expression.compile(Expression.java:512)
at arb4j/arb.expressions.Compiler.express(Compiler.java:152)
at arb4j/arb.expressions.Compiler.express(Compiler.java:168)
at arb4j/arb.expressions.Compiler.express(Compiler.java:103)
at arb4j/arb.expressions.Expression.compile(Expression.java:180)
at arb4j/arb.expressions.Expression.instantiate(Expression.java:218)
at arb4j/arb.functions.real.RealFunction.express(RealFunction.java:656)
at arb4j/arb.functions.real.RealFunction.express(RealFunction.java:650)
at arb4j/arb.functions.real.RealFunction.express(RealFunction.java:629)
at arb4j/arb.expressions.ExpressionTest.testHypergeometricFuntion(ExpressionTest.java:24)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at junit@4.13.2/junit.framework.TestCase.runTest(TestCase.java:177)
at junit@4.13.2/junit.framework.TestCase.runBare(TestCase.java:142)
at junit@4.13.2/junit.framework.TestResult$1.protect(TestResult.java:122)
at junit@4.13.2/junit.framework.TestResult.runProtected(TestResult.java:142)
at junit@4.13.2/junit.framework.TestResult.run(TestResult.java:125)
at junit@4.13.2/junit.framework.TestCase.run(TestCase.java:130)
at junit@4.13.2/junit.framework.TestSuite.runTest(TestSuite.java:241)
at junit@4.13.2/junit.framework.TestSuite.run(TestSuite.java:236)
at junit@4.13.2/org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:757)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
further along...
==== pFqSubMinus23Point51SubMinus231Over2MinusxOver2.java ====
import arb.Integer;
import arb.Real;
import arb.functions.real.RealFunction;
public class pFqSubMinus23Point51SubMinus231Over2MinusxOver2 implements RealFunction {
Integer c1 = new Integer("2");
Integer c2 = new Integer("0");
Real c3 = new Real("3.5", 128);
Integer c4 = new Integer("1");
Integer c5 = new Integer("3");
public Real ℝ1 = new Real();
public Real ℝ2 = new Real();
public Real ℝ3 = new Real();
public Real ℝ4 = new Real();
public Real ℝ5 = new Real();
public Real ℝ6 = new Real();
public Real ℝ7 = new Real();
public Real evaluate(Real in, int order, int bits, Real result) {
Real[] var10000 = new Real[]{this.c2.sub(this.c1, bits, this.ℝ1), this.c3, this.c4.set(this.ℝ2)};
Real[] var10001 = new Real[]{this.c2.sub(this.c1, bits, this.ℝ3), this.c5.set(this.ℝ4)};
return this.c4.div(this.c1, bits, this.ℝ5).sub(in.div(this.c1, bits, this.ℝ6), bits, this.ℝ7);
}
public void close() {
this.c1.close();
this.c2.close();
this.c3.close();
this.c4.close();
this.c5.close();
this.ℝ1.close();
this.ℝ2.close();
this.ℝ3.close();
this.ℝ4.close();
this.ℝ5.close();
this.ℝ6.close();
this.ℝ7.close();
}
@Override
public String toString() {
return "x➔pFq([-2,3.5,1],[-2,3],1/2-x/2)";
}
}
further along
java.lang.NoSuchMethodError: 'arb.RealPolynomial arb.Real.sub(arb.RealPolynomial, int, arb.RealPolynomial)'
at pFqSubMinus23Point51SubMinus231Over2MinusxOver2.evaluate(Unknown Source)
at arb4j/arb.functions.Function.evaluate(Function.java:204)
at arb4j/arb.expressions.ExpressionTest.testHypergeometricFuntion(ExpressionTest.java:27)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at junit@4.13.2/junit.framework.TestCase.runTest(TestCase.java:177)
at junit@4.13.2/junit.framework.TestCase.runBare(TestCase.java:142)
at junit@4.13.2/junit.framework.TestResult$1.protect(TestResult.java:122)
at junit@4.13.2/junit.framework.TestResult.runProtected(TestResult.java:142)
at junit@4.13.2/junit.framework.TestResult.run(TestResult.java:125)
at junit@4.13.2/junit.framework.TestCase.run(TestCase.java:130)
at junit@4.13.2/junit.framework.TestSuite.runTest(TestSuite.java:241)
at junit@4.13.2/junit.framework.TestSuite.run(TestSuite.java:236)
at junit@4.13.2/org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:757)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
java.lang.AssertionError: TODO: handle resultant type for left=class java.lang.Void and right=class arb.Integer in \frac{x}{2} at arb4j/arb.expressions.nodes.binary.BinaryOperation.type(BinaryOperation.java:314) at arb4j/arb.expressions.nodes.binary.BinaryOperation.formatGenerationParameters(BinaryOperation.java:162) at arb4j/arb.expressions.nodes.binary.BinaryOperation.generate(BinaryOperation.java:138) at arb4j/arb.expressions.nodes.binary.Subtraction.generate(Subtraction.java:30) at arb4j/arb.expressions.nodes.unary.HypergeometricFunction.generate(HypergeometricFunction.java:35) at arb4j/arb.expressions.Expression.generateEvaluationMethod(Expression.java:1013) at arb4j/arb.expressions.Expression.compile(Expression.java:512) at arb4j/arb.expressions.Compiler.express(Compiler.java:157) at arb4j/arb.expressions.Compiler.express(Compiler.java:173) at arb4j/arb.expressions.Compiler.express(Compiler.java:103) at arb4j/arb.expressions.Expression.compile(Expression.java:180) at arb4j/arb.expressions.Expression.instantiate(Expression.java:218) at arb4j/arb.functions.real.RealPolynomialNullaryFunction.express(RealPolynomialNullaryFunction.java:20) at arb4j/arb.functions.real.RealPolynomialNullaryFunction.express(RealPolynomialNullaryFunction.java:30) at arb4j/arb.expressions.ExpressionTest.testHypergeometricFuntion(ExpressionTest.java:27)
To address your implementation of the hypergeometric function in an expression compiler for handling general expressions instead of scalar real-valued numbers, you need to incorporate symbolic manipulation capabilities into your compiler. This involves adjusting the compilation process to perform symbolic substitution of the argument into the hypergeometric function before the evaluation phase. Specifically, your compiler must:
This approach ensures that the argument, whether a polynomial or any other type of expression, is correctly integrated into the hypergeometric function before numerical evaluation, thus preserving the correct mathematical semantics of the operation.
java.lang.AssertionError: TODO: generate code to instantiate the HypergeometricPolynomial class with α=[0-2,3.5,1] and β=[0-2,3] arg=(1/2)-(x/2) that are now on the stack in that order and evaluate it so that the result gets put onto the stack.. this will be similiar to the loadFactorClass part of the NaryOperation but its using the HypergeometricPolynomial class rather than dynmically instantiating an expression as is the case there
at arb4j/arb.expressions.nodes.unary.HypergeometricFunction.generate(HypergeometricFunction.java:47)
at arb4j/arb.expressions.Expression.generateEvaluationMethod(Expression.java:1037)
at arb4j/arb.expressions.Expression.compile(Expression.java:542)
at arb4j/arb.expressions.Compiler.compile(Compiler.java:170)
at arb4j/arb.expressions.Compiler.express(Compiler.java:186)
at arb4j/arb.expressions.Compiler.express(Compiler.java:116)
at arb4j/arb.expressions.Expression.compile(Expression.java:183)
at arb4j/arb.expressions.Expression.instantiate(Expression.java:221)
at arb4j/arb.functions.real.RealPolynomialNullaryFunction.express(RealPolynomialNullaryFunction.java:23)
at arb4j/arb.functions.real.RealPolynomialNullaryFunction.express(RealPolynomialNullaryFunction.java:38)
at arb4j/arb.functions.polynomials.HypergeometricPolynomialTest.testHypergeometricFuntion(HypergeometricPolynomialTest.java:27)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at junit@4.13.2/junit.framework.TestCase.runTest(TestCase.java:177)
at junit@4.13.2/junit.framework.TestCase.runBare(TestCase.java:142)
at junit@4.13.2/junit.framework.TestResult$1.protect(TestResult.java:122)
at junit@4.13.2/junit.framework.TestResult.runProtected(TestResult.java:142)
at junit@4.13.2/junit.framework.TestResult.run(TestResult.java:125)
at junit@4.13.2/junit.framework.TestCase.run(TestCase.java:130)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:757)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
java.lang.AssertionError: dont call arg.generate here. call RealFunction.parse, the HypergeometricPolynomial object needs an Expression to substitute into its expression evaluator, not a Real scalar representing something already evalyated. this code isnt going to be used in tight loops anyway, plenty fast.
at arb4j/arb.expressions.nodes.unary.HypergeometricFunction.generate(HypergeometricFunction.java:46)
at arb4j/arb.expressions.Expression.generateEvaluationMethod(Expression.java:1037)
at arb4j/arb.expressions.Expression.compile(Expression.java:542)
at arb4j/arb.expressions.Compiler.compile(Compiler.java:170)
at arb4j/arb.expressions.Compiler.express(Compiler.java:186)
at arb4j/arb.expressions.Compiler.express(Compiler.java:116)
at arb4j/arb.expressions.Expression.compile(Expression.java:183)
at arb4j/arb.expressions.Expression.instantiate(Expression.java:221)
at arb4j/arb.functions.real.RealPolynomialNullaryFunction.express(RealPolynomialNullaryFunction.java:23)
at arb4j/arb.functions.real.RealPolynomialNullaryFunction.express(RealPolynomialNullaryFunction.java:38)
at arb4j/arb.functions.polynomials.HypergeometricPolynomialTest.testHypergeometricFuntion(HypergeometricPolynomialTest.java:27)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at junit@4.13.2/junit.framework.TestCase.runTest(TestCase.java:177)
at junit@4.13.2/junit.framework.TestCase.runBare(TestCase.java:142)
at junit@4.13.2/junit.framework.TestResult$1.protect(TestResult.java:122)
at junit@4.13.2/junit.framework.TestResult.runProtected(TestResult.java:142)
at junit@4.13.2/junit.framework.TestResult.run(TestResult.java:125)
at junit@4.13.2/junit.framework.TestCase.run(TestCase.java:130)
at junit@4.13.2/junit.framework.TestSuite.runTest(TestSuite.java:241)
at junit@4.13.2/junit.framework.TestSuite.run(TestSuite.java:236)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:757)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
java.lang.NullPointerException: Cannot invoke "arb.expressions.nodes.Variable.getName()" because "this.inputNode" is null
at arb4j/arb.expressions.Expression.substitute(Expression.java:1759)
at arb4j/arb.functions.polynomials.HypergeometricPolynomial.compileHypergeometricExpression(HypergeometricPolynomial.java:137)
at arb4j/arb.functions.polynomials.HypergeometricPolynomial.<init>(HypergeometricPolynomial.java:128)
at pFqopensubminus2comma3point5comma1commasubminus2comma3comma1over2minusxover2close.evaluate(Unknown Source)
at arb4j/arb.functions.real.NullaryFunction.evaluate(NullaryFunction.java:43)
at arb4j/arb.functions.polynomials.HypergeometricPolynomialTest.testHypergeometricFuntion(HypergeometricPolynomialTest.java:28)
closer
java.lang.NoClassDefFoundError: F
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3549)
at java.base/java.lang.Class.getConstructor0(Class.java:3754)
at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2930)
at arb4j/arb.expressions.Expression.getInstance(Expression.java:1223)
at arb4j/arb.expressions.Expression.instantiate(Expression.java:1305)
at arb4j/arb.functions.polynomials.HypergeometricPolynomial.compileHypergeometricExpression(HypergeometricPolynomial.java:139)
at arb4j/arb.functions.polynomials.HypergeometricPolynomial.<init>(HypergeometricPolynomial.java:128)
at pFqopensubminus2comma3point5comma1commasubminus2comma3comma1over2minusxover2close.evaluate(Unknown Source)
at arb4j/arb.functions.real.NullaryFunction.evaluate(NullaryFunction.java:43)
at arb4j/arb.functions.polynomials.HypergeometricPolynomialTest.testHypergeometricFuntion(HypergeometricPolynomialTest.java:28)
probably need to clone the expression and merge the respective variable and function contexts since those arent tied to the generic type of the expression
its incorrectly identifying n as the indeterminate variable
Rerun arb.functions.polynomials.HypergeometricPolynomialTest.testHypergeometricFuntion
testHypergeometricFuntion(arb.functions.polynomials.HypergeometricPolynomialTest)
java.lang.NoSuchMethodError: 'arb.RealPolynomial arb.Integer.pow(arb.RealPolynomial, int, arb.RealPolynomial)'
at factorXℝ1.evaluate(Unknown Source)
at arb4j@0.91/arb.functions.Function.evaluate(Function.java:210)
at F.evaluate(Unknown Source)
at arb4j@0.91/arb.functions.polynomials.HypergeometricPolynomial.evaluate(HypergeometricPolynomial.java:137)
at pFqopensubminus2comma3point5comma1commasubminus2comma3comma1over2minusxover2close.evaluate(Unknown Source)
at arb4j@0.91/arb.functions.NullaryFunction.evaluate(NullaryFunction.java:41)
at arb4j@0.91/arb.functions.polynomials.HypergeometricPolynomialTest.testHypergeometricFuntion(HypergeometricPolynomialTest.java:28)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at junit@4.13.2/junit.framework.TestCase.runTest(TestCase.java:177)
at junit@4.13.2/junit.framework.TestCase.runBare(TestCase.java:142)
at junit@4.13.2/junit.framework.TestResult$1.protect(TestResult.java:122)
at junit@4.13.2/junit.framework.TestResult.runProtected(TestResult.java:142)
at junit@4.13.2/junit.framework.TestResult.run(TestResult.java:125)
at junit@4.13.2/junit.framework.TestCase.run(TestCase.java:130)
at junit@4.13.2/junit.framework.TestSuite.runTest(TestSuite.java:241)
at junit@4.13.2/junit.framework.TestSuite.run(TestSuite.java:236)
at junit@4.13.2/org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:757)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Variable(#1277009227).resolveReference(reference=n)
Checking if n is the indeterminant variable in a polynomial expression
Expression(#349420578) declaring n to be the indeterminant
new class arb.expressions.nodes.binary.Exponentiation at pos 3
new class arb.expressions.nodes.nary.NaryMultiplication at pos 5
new class arb.expressions.nodes.LiteralConstant at pos 18
new class arb.expressions.nodes.Variable at pos 20
Variable(#1157726741).resolveReference(reference=p)
Declaring p as a contextual variable of type class arb.Integer
new class arb.expressions.nodes.binary.Multiplication at pos 21
new class arb.expressions.nodes.Variable at pos 24
The exception stack trace you provided indicates that there is an assertion error during the class loading process in CompiledExpressionClassLoader.findClass()
. This error arises because there is a mismatch between the className
and name
in a functionMapping
.
Here's a detailed breakdown of the issue based on the provided stack trace:
Assertion Error: The message "className=arb.functions.Function != name=factorXℝ1" suggests that the class name obtained from functionMapping.functionInterface.getName()
does not match the expected class name stored in name
. This is a fundamental assertion to ensure that the function mapping has the correct interface associated with it.
Location of Error:
CompiledExpressionClassLoader.java
findClass()
Detailed Error Explanation:
findClass
in CompiledExpressionClassLoader
attempts to load a class by name from a compiledClasses
map.functionMapping
from context.functions.map
using the class name as a key.functionMapping.functionInterface.getName()
) matches the expected name. The failure of this assertion leads to the exception.Steps to Fix the Issue:
Confirm Mapping Consistency: Ensure that all function mappings in context.functions.map
correctly map function names to their respective function interface. This means that the functionMapping
objects must have their functionInterface
properly set, matching the name
that is used as a key in the map.
Check Function Mapping Creation: Review how functionMapping
objects are created and added to context.functions.map
in your application. This likely happens in Context.registerFunctionMapping()
. Make sure that the functionInterface
is correctly set during this registration.
Debugging: Add more detailed logging before the assertion to log the values of className
and name
along with functionMapping
to better understand what's being compared.
Adjust Assertion: If the logic for setting the functionInterface
or its name is complex or can vary, consider adjusting the assertion logic to accommodate these variations, or handle this scenario gracefully without asserting.
If you need to review or modify specific parts of the source code to apply these fixes or for more detailed analysis, let me know!
Analyzing the order of operations from your console output, here's a breakdown of the flow and the potential source of issues that could lead to the assertion error:
Variable Resolution and Expression Declaration:
x
, N
, z
, n
, p
, q
) are resolved and declared. This includes declaring certain variables as contextual (belonging to the function's external context) and others as indeterminate or input nodes within specific expressions.Expression Compilation and Class Definition:
Expression(#2011791487)
, representing a summation formula involving a product and factorial terms, is defined as a class named F
.functions=FunctionMappings(#439928219)[map={}]
), but variables are populated (variables=Variables(#2138564891)[[p, q, α, β, N, n]]
).Expression Parsing and Function Mapping:
registerFunctionMapping(factorExpression=...)
), where a function mapping for factorXℝ1
is attempted. This function appears to be mapped to handle parts of the factorial product operations in the summation.Assertion Error Origin:
findClass
method attempts to find a class for factorXℝ1
in compiledClasses
. It finds a class named F
already defined, but it seems that it checks against a function mapping that either doesn't match the expected class or is incorrectly linked (instance=null, domain=arb.Integer, range=arb.RealPolynomial, functionInterface=interface arb.functions.Function
).arb.functions.Function
) and what is registered or instantiated in the actual context.Suggestions for Troubleshooting and Resolution:
Verify Function Mappings: Ensure that the function mappings are correctly set up in the context. The mapping should correctly link the function name (factorXℝ1
) to the appropriate function interface and implementation if available. This includes checking whether the function interface and class names are aligned and if the function is correctly instantiated before it's used.
Context and ClassLoader Consistency: Review how the context is passed around and used, especially in methods like registerFunctionMapping
and during the instantiation of Expression
classes. Ensure that the context remains consistent and contains all necessary mappings and variables as expected throughout the expression parsing and compilation phases.
Debugging and Logging: Enhance logging around critical operations, especially when function mappings are added to the context and when classes are being defined and looked up. This can help pinpoint exactly where the discrepancy arises.
Review Class and Interface Definitions: Double-check that the interfaces and classes used in function mappings are correctly defined and available in the runtime environment. Any mismatch in the expected types could lead to assertions failing.
If further detailed code review or specific debugging steps are needed, let me know, and we can dive deeper into the parts of the code that handle these operations!