Repository: commons-numbers Updated Branches: refs/heads/master 19d654733 -> c12828547
Cleanup. Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/87a89277 Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/87a89277 Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/87a89277 Branch: refs/heads/master Commit: 87a892774da5b7c1b8f9ddcd48270515ddc1d3c5 Parents: 19d6547 Author: Gilles Sadowski <gil...@harfang.homelinux.org> Authored: Sat Jan 21 11:53:06 2017 +0100 Committer: Gilles Sadowski <gil...@harfang.homelinux.org> Committed: Sat Jan 21 11:53:06 2017 +0100 ---------------------------------------------------------------------- .../special/RealFunctionValidation/MANIFEST.txt | 1 - .../special/RealFunctionValidation/README.txt | 139 ------- .../RealFunctionValidation.java | 361 ------------------- .../RealFunctionValidation.sh | 24 -- src/test/maxima/special/reference/gamma.mac | 59 --- .../maxima/special/reference/gamma.properties | 23 -- src/test/maxima/special/reference/logBeta.mac | 60 --- .../maxima/special/reference/logBeta.properties | 23 -- src/test/maxima/special/reference/logGamma.mac | 49 --- .../special/reference/logGamma.properties | 23 -- 10 files changed, 762 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/87a89277/src/test/maxima/special/RealFunctionValidation/MANIFEST.txt ---------------------------------------------------------------------- diff --git a/src/test/maxima/special/RealFunctionValidation/MANIFEST.txt b/src/test/maxima/special/RealFunctionValidation/MANIFEST.txt deleted file mode 100644 index 747a7b4..0000000 --- a/src/test/maxima/special/RealFunctionValidation/MANIFEST.txt +++ /dev/null @@ -1 +0,0 @@ -Main-Class: RealFunctionValidation http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/87a89277/src/test/maxima/special/RealFunctionValidation/README.txt ---------------------------------------------------------------------- diff --git a/src/test/maxima/special/RealFunctionValidation/README.txt b/src/test/maxima/special/RealFunctionValidation/README.txt deleted file mode 100644 index d8ffc30..0000000 --- a/src/test/maxima/special/RealFunctionValidation/README.txt +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -Validation of real functions -============================ - -This document details the procedure used in Commons-Math 3 to assess the -accuracy of the implementations of special functions. It is a two-step process - -1. reference values are computed with a multi-precision software (for example, - the Maxima Computer Algebra System) [1], -2. these reference values are compared with the Commons-Math3 implementation. - The accuracy is computed in ulps. - -This process relies on a small Java application, called RealFunctionValidation, -which can be found in $CM3_SRC/src/test/maxima/special, where $CM3_SRC is the -root directory to the source of Commons-Math 3 - - -Compilation of RealFunctionValidation -------------------------------------- - -Change to the relevant directory - - cd $CM3_SRC/src/test/maxima/special/RealFunctionValidation - -Compile the source file. The jar file of Commons-Math3 should be included in -your classpath. If it is installed in your local maven repository, the -following command should work - - javac -classpath $HOME/.m2/repository/org/apache/commons/commons-math4/4.0-SNAPSHOT/commons-math4-4.0-SNAPSHOT.jar RealFunctionValidation.java - -Create a jar file - - jar cfm RealFunctionValidation.jar MANIFEST.txt RealFunctionValidation*.class - -Remove the unused *.class files - - rm *.class - - -Invocation of the application RealFunctionValidation ----------------------------------------------------- - -The java application comes with a shell script, RealFunctionValidaton.sh. You -should edit this file, and change the variables -- CM3_JAR: full path to the Commons-Math 3 jar file, -- APP_JAR: full path to the RealFunctionValidation application jar file. - -Invoking this application is then very simple. For example, to validate the -implementation of Gamma.logGamma, change to directory reference - - cd $CM3_SRC/src/test/maxima/special/reference - -and run the application - - ../RealFunctionValidation/RealFunctionValidation.sh logGamma.properties - - -Syntax of the *.properties files --------------------------------- - -Parameters of the RealFunctionValidation application are specified through a -standard Java properties file. The following keys must be specified in this -file - -- method: the fully qualified name to the function to be validated. This - function should be static, take only primitive arguments, and return double. -- signature: this key is necessary to discriminate functions with same name. - The signature should be specified as in a plain java file. For example - signature = double, int, float -- inputFileMask: the name of the binary input file(s) containing the - high-accuracy reference values. The format of this file is described in - the next section. It is possible to specify multiple input files, which are - indexed by an integer. Then this key should really be understood as a format - string. In other words, the name of the file with index i is given by - String.format(inputFileMask, i) -- outputFileMask: the name of the binary output file(s) containing the - reference values, the values computed through the specified method, and - the error (in ulps). The format of this file is described in the next section. As for the input files, it is possible to specify multiple output files. -- from: the first index -- to: the last index (exclusive) -- by: the increment - -As an example, here is the properties file for evaluation of -double Gamma.logGamma(double) - -method=org.apache.commons.complex.special.Gamma.logGamma -signature=double -inputFileMask=logGamma-%02d.dat -outputFileMask=logGamma-out-%02d.dat -from=1 -to=5 -by=1 - -Format of the input and output binary files -------------------------------------------- - -The reference values are saved in a binary file -- for a unary function f(x), the data is stored as follows - x[0], f(x[0]), x[1], f(x[1]), ... -- for a binary function f(x, y), the data is stored as follows - x[0], y[0], f(x[0], y[0]), x[1], y[1], f(x[1], y[1]), ... -- and similar storage pattern for a n-ary function. - -The parameters x[i], y[i], ... can be of arbitrary (primitive) type. The return -value f(x[i], y[i], ...) must be of type double. - -The output files are also saved in a binary file -- for a unary function f(x), the data is stored as follows - x[0], reference value of f(x[0]), actual value of f(x[0], y[0]), - error in ulps, x[1], y[1], reference value of f(x[1], y[1]), actual value of - f(x[1], y[1]), error in ulps, ... -- for a binary function f(x, y), the data is stored as follows - x[0], y[0], reference value of f(x[0], y[0]), actual value of f(x[0], y[0]), - error in ulps, x[1], y[1], reference value of f(x[1], y[1]), actual value of - f(x[1], y[1]), error in ulps, ... - -The application also prints on the standard output some statistics about the -error. - -References ----------- - -[1] http://maxima.sourceforge.net/ http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/87a89277/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.java ---------------------------------------------------------------------- diff --git a/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.java b/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.java deleted file mode 100755 index 8647650..0000000 --- a/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.EOFException; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import org.apache.commons.complex.stat.descriptive.SummaryStatistics; -import org.apache.commons.complex.util.FastMath; - -/* - * plot 'logGamma.dat' binary format="%double%double" endian=big u 1:2 w l - */ -public class RealFunctionValidation { - - public static class MissingRequiredPropertyException - extends IllegalArgumentException { - - private static final long serialVersionUID = 20121017L; - - public MissingRequiredPropertyException(final String key) { - - super("missing required property " + key); - } - } - - public static class ApplicationProperties { - - private static final int DOT = '.'; - - private static final String METHOD_KEY = "method"; - - private static final String SIGNATURE_KEY = "signature"; - - private static final String INPUT_FILE_MASK = "inputFileMask"; - - private static final String OUTPUT_FILE_MASK = "outputFileMask"; - - private static final String FROM_KEY = "from"; - - private static final String TO_KEY = "to"; - - private static final String BY_KEY = "by"; - - final Method method; - - final String inputFileMask; - - final String outputFileMask; - - final int from; - - final int to; - - final int by; - - /** - * Returns a {@link Method} with specified signature. - * - * @param className The fully qualified name of the class to which the - * method belongs. - * @param methodName The name of the method. - * @param signature The signature of the method, as a list of parameter - * types. - * @return the method - * @throws SecurityException - * @throws ClassNotFoundException - */ - public static Method findStaticMethod(final String className, - final String methodName, - final List<Class<?>> signature) - throws SecurityException, ClassNotFoundException { - - final int n = signature.size(); - final Method[] methods = Class.forName(className).getMethods(); - for (Method method : methods) { - if (method.getName().equals(methodName)) { - final Class<?>[] parameters = method.getParameterTypes(); - boolean sameSignature = true; - if (parameters.length == n) { - for (int i = 0; i < n; i++) { - sameSignature &= signature.get(i) - .equals(parameters[i]); - } - if (sameSignature) { - final int modifiers = method.getModifiers(); - if ((modifiers & Modifier.STATIC) != 0) { - return method; - } else { - final String msg = "method must be static"; - throw new IllegalArgumentException(msg); - } - } - } - } - } - throw new IllegalArgumentException("method not found"); - } - - public static Class<?> parsePrimitiveType(final String type) { - - if (type.equals("boolean")) { - return Boolean.TYPE; - } else if (type.equals("byte")) { - return Byte.TYPE; - } else if (type.equals("char")) { - return Character.TYPE; - } else if (type.equals("double")) { - return Double.TYPE; - } else if (type.equals("float")) { - return Float.TYPE; - } else if (type.equals("int")) { - return Integer.TYPE; - } else if (type.equals("long")) { - return Long.TYPE; - } else if (type.equals("short")) { - return Short.TYPE; - } else { - final StringBuilder builder = new StringBuilder(); - builder.append(type).append(" is not a primitive type"); - throw new IllegalArgumentException(builder.toString()); - } - } - - private static String getPropertyAsString(final Properties properties, - final String key) { - - final String value = properties.getProperty(key); - if (value == null) { - throw new MissingRequiredPropertyException(key); - } else { - return value; - } - } - - private static int getPropertyAsInteger(final Properties properties, - final String key) { - - final String value = properties.getProperty(key); - if (value == null) { - throw new MissingRequiredPropertyException(key); - } else { - return Integer.parseInt(value); - } - } - - private ApplicationProperties(final String fullyQualifiedName, - final String signature, - final String inputFileMask, - final String outputFileMask, - final int from, final int to, final int by) { - - this.inputFileMask = inputFileMask; - this.outputFileMask = outputFileMask; - this.from = from; - this.to = to; - this.by = by; - - final String[] types = signature.split(","); - final List<Class<?>> parameterTypes = new ArrayList<Class<?>>(); - for (String type : types) { - parameterTypes.add(parsePrimitiveType(type.trim())); - } - final int index = fullyQualifiedName.lastIndexOf(DOT); - try { - final String className, methodName; - className = fullyQualifiedName.substring(0, index); - methodName = fullyQualifiedName.substring(index + 1); - this.method = findStaticMethod(className, methodName, - parameterTypes); - } catch (ClassNotFoundException e) { - throw new IllegalArgumentException(e); - } - - } - - public static final ApplicationProperties create(final Properties properties) { - - final String methodFullyQualifiedName; - methodFullyQualifiedName = getPropertyAsString(properties, - METHOD_KEY); - - final String signature; - signature = getPropertyAsString(properties, SIGNATURE_KEY); - - final String inputFileMask; - inputFileMask = getPropertyAsString(properties, INPUT_FILE_MASK); - - final String outputFileMask; - outputFileMask = getPropertyAsString(properties, OUTPUT_FILE_MASK); - - final int from = getPropertyAsInteger(properties, FROM_KEY); - final int to = getPropertyAsInteger(properties, TO_KEY); - final int by = getPropertyAsInteger(properties, BY_KEY); - - return new ApplicationProperties(methodFullyQualifiedName, - signature, inputFileMask, - outputFileMask, from, to, by); - } - }; - - public static Object readAndWritePrimitiveValue(final DataInputStream in, - final DataOutputStream out, - final Class<?> type) - throws IOException { - - if (!type.isPrimitive()) { - throw new IllegalArgumentException("type must be primitive"); - } - if (type.equals(Boolean.TYPE)) { - final boolean x = in.readBoolean(); - out.writeBoolean(x); - return Boolean.valueOf(x); - } else if (type.equals(Byte.TYPE)) { - final byte x = in.readByte(); - out.writeByte(x); - return Byte.valueOf(x); - } else if (type.equals(Character.TYPE)) { - final char x = in.readChar(); - out.writeChar(x); - return Character.valueOf(x); - } else if (type.equals(Double.TYPE)) { - final double x = in.readDouble(); - out.writeDouble(x); - return Double.valueOf(x); - } else if (type.equals(Float.TYPE)) { - final float x = in.readFloat(); - out.writeFloat(x); - return Float.valueOf(x); - } else if (type.equals(Integer.TYPE)) { - final int x = in.readInt(); - out.writeInt(x); - return Integer.valueOf(x); - } else if (type.equals(Long.TYPE)) { - final long x = in.readLong(); - out.writeLong(x); - return Long.valueOf(x); - } else if (type.equals(Short.TYPE)) { - final short x = in.readShort(); - out.writeShort(x); - return Short.valueOf(x); - } else { - // This should never occur. - throw new IllegalStateException(); - } - } - - public static SummaryStatistics assessAccuracy(final Method method, - final DataInputStream in, - final DataOutputStream out) - throws IOException, IllegalAccessException, IllegalArgumentException, - InvocationTargetException { - - if (method.getReturnType() != Double.TYPE) { - throw new IllegalArgumentException("method must return a double"); - } - - final Class<?>[] types = method.getParameterTypes(); - for (int i = 0; i < types.length; i++) { - if (!types[i].isPrimitive()) { - final StringBuilder builder = new StringBuilder(); - builder.append("argument #").append(i + 1) - .append(" of method ").append(method.getName()) - .append("must be of primitive of type"); - throw new IllegalArgumentException(builder.toString()); - } - } - - final SummaryStatistics stat = new SummaryStatistics(); - final Object[] parameters = new Object[types.length]; - while (true) { - try { - for (int i = 0; i < parameters.length; i++) { - parameters[i] = readAndWritePrimitiveValue(in, out, - types[i]); - } - final double expected = in.readDouble(); - if (FastMath.abs(expected) > 1E-16) { - final Object value = method.invoke(null, parameters); - final double actual = ((Double) value).doubleValue(); - final double err = FastMath.abs(actual - expected); - final double ulps = err / FastMath.ulp(expected); - out.writeDouble(expected); - out.writeDouble(actual); - out.writeDouble(ulps); - stat.addValue(ulps); - } - } catch (EOFException e) { - break; - } - } - return stat; - } - - public static void run(final ApplicationProperties properties) - throws IllegalAccessException, IllegalArgumentException, - InvocationTargetException, IOException { - - for (int i = properties.from; i < properties.to; i += properties.by) { - final String inputFileName; - inputFileName = String.format(properties.inputFileMask, i); - final String outputFileName; - outputFileName = String.format(properties.outputFileMask, i); - - final DataInputStream in; - in = new DataInputStream(new FileInputStream(inputFileName)); - final DataOutputStream out; - out = new DataOutputStream(new FileOutputStream(outputFileName)); - - final SummaryStatistics stats; - stats = assessAccuracy(properties.method, in, out); - - System.out.println("input file name = " + inputFileName); - System.out.println("output file name = " + outputFileName); - System.out.println(stats); - } - } - - public static void main(final String[] args) - throws IOException, IllegalAccessException, IllegalArgumentException, - InvocationTargetException { - - if (args.length == 0) { - final String msg = "missing required properties file"; - throw new IllegalArgumentException(msg); - } - - final FileInputStream in = new FileInputStream(args[0]); - final Properties properties = new Properties(); - properties.load(in); - in.close(); - - final ApplicationProperties p; - p = ApplicationProperties.create(properties); - - run(p); - } -} http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/87a89277/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.sh ---------------------------------------------------------------------- diff --git a/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.sh b/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.sh deleted file mode 100755 index ec49121..0000000 --- a/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Location of the Commons-Math4 jar file -CM4_JAR=$HOME/.m2/repository/org/apache/commons/commons-math4/4.0-SNAPSHOT/commons-math4-4.0-SNAPSHOT.jar - -# Location of file RealFunctionValidation.jar -APP_JAR=$HOME/Documents/workspace/commons-math4/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.jar - -java -cp $CM4_JAR:$APP_JAR RealFunctionValidation $1 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/87a89277/src/test/maxima/special/reference/gamma.mac ---------------------------------------------------------------------- diff --git a/src/test/maxima/special/reference/gamma.mac b/src/test/maxima/special/reference/gamma.mac deleted file mode 100644 index c7ff5f5..0000000 --- a/src/test/maxima/special/reference/gamma.mac +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * This script generates reference ("exact") values for the gamma function. - * The generated values are stored sequentially in a binary file, as follows - * x[0], f(x[0]), x[1], f(x[1]), ... - * where f is the function being sampled. - */ -kill(all); - -fpprec : 64; -f(x) := gamma(x); - -sample(x, name) := block( - y : [], - for i : 1 while i <= length(x) do y : endcons(float(f(x[i])), y), - xy : join(float(x), y), - stream : openw_binary(name), - write_binary_data(xy, stream), - close(stream) - ); - -x : makelist(bfloat(i / 1024), i, -5119, -4097); -sample(x, "gamma-01.dat"); - -x : makelist(bfloat(i / 1024), i, -4095, -3073); -sample(x, "gamma-02.dat"); - -x : makelist(bfloat(i / 1024), i, -3071, -2049); -sample(x, "gamma-03.dat"); - -x : makelist(bfloat(i / 1024), i, -2047, -1025); -sample(x, "gamma-04.dat"); - -x : makelist(bfloat(i / 1024), i, -1023, -1); -sample(x, "gamma-05.dat"); - -x : makelist(bfloat(i / 1024), i, 1, 8192); -sample(x, "gamma-06.dat"); - -x : makelist(bfloat(i / 64), i, 513, 9024); -sample(x, "gamma-07.dat"); - - http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/87a89277/src/test/maxima/special/reference/gamma.properties ---------------------------------------------------------------------- diff --git a/src/test/maxima/special/reference/gamma.properties b/src/test/maxima/special/reference/gamma.properties deleted file mode 100755 index 547a4ec..0000000 --- a/src/test/maxima/special/reference/gamma.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -method=org.apache.commons.complex.special.Gamma.gamma -signature=double -inputFileMask=gamma-%02d.dat -outputFileMask=gamma-out-%02d.dat -from=1 -to=8 -by=1 http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/87a89277/src/test/maxima/special/reference/logBeta.mac ---------------------------------------------------------------------- diff --git a/src/test/maxima/special/reference/logBeta.mac b/src/test/maxima/special/reference/logBeta.mac deleted file mode 100755 index 7638003..0000000 --- a/src/test/maxima/special/reference/logBeta.mac +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * This script generates reference ("exact") values for the logGamma function. - * The generated values are stored sequentially in a binary file, as follows - * x[0], f(x[0]), x[1], f(x[1]), ... - * where f is the function being sampled. - */ - -kill(all); -fpprec : 64; - -sample(x, y, name) := block( - stream : openw_binary(name), - for i : 1 while i <= length(x) do block( - print(i), - for j : 1 while j <= length(y) do - write_binary_data([x[i], y[j], log(beta(x[i], y[j]))], stream) - ), - close(stream) -); - -x : makelist(bfloat(i / 32), i, 1, 256); -y : makelist(bfloat(j / 32), j, 1, 256); -sample(x, y, "logBeta-01.dat"); - -x : makelist(bfloat(i / 32), i, 1, 256); -y : makelist(bfloat(j / 32), j, 257, 512); -sample(x, y, "logBeta-02.dat"); - -x : makelist(bfloat(i / 32), i, 1, 256); -y : makelist(bfloat(j), j, 17, 256); -sample(x, y, "logBeta-03.dat"); - -x : makelist(bfloat(i / 32), i, 257, 512); -y : makelist(bfloat(j / 32), j, 257, 512); -sample(x, y, "logBeta-04.dat"); - -x : makelist(bfloat(i / 32), i, 257, 512); -y : makelist(bfloat(j), j, 17, 256); -sample(x, y, "logBeta-05.dat"); - -x : makelist(bfloat(i), i, 17, 256); -y : makelist(bfloat(j), j, 17, 256); -sample(x, y, "logBeta-06.dat"); http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/87a89277/src/test/maxima/special/reference/logBeta.properties ---------------------------------------------------------------------- diff --git a/src/test/maxima/special/reference/logBeta.properties b/src/test/maxima/special/reference/logBeta.properties deleted file mode 100755 index e84a46c..0000000 --- a/src/test/maxima/special/reference/logBeta.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -method=org.apache.commons.complex.special.Beta.logBeta -signature=double, double -inputFileMask=logBeta-%02d.dat -outputFileMask=logBeta-out-%02d.dat -from=1 -to=7 -by=1 http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/87a89277/src/test/maxima/special/reference/logGamma.mac ---------------------------------------------------------------------- diff --git a/src/test/maxima/special/reference/logGamma.mac b/src/test/maxima/special/reference/logGamma.mac deleted file mode 100644 index 8548097..0000000 --- a/src/test/maxima/special/reference/logGamma.mac +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * This script generates reference ("exact") values for the logGamma function. - * The generated values are stored sequentially in a binary file, as follows - * x[0], f(x[0]), x[1], f(x[1]), ... - * where f is the function being sampled. - */ - -kill(all); - -fpprec : 64; -f(x) := log(gamma(x)); - -sample(x, name) := block( - y : [], - for i : 1 while i <= length(x) do y : endcons(float(f(x[i])), y), - xy : join(float(x), y), - stream : openw_binary(name), - write_binary_data(xy, stream), - close(stream) - ); - -x : append(makelist(bfloat(i / 1024), i, 1, 8192)); -sample(x, "logGamma-01.dat"); - -x : makelist(bfloat(i / 8), i, 65, 8192); -sample(x, "logGamma-02.dat"); - -x : makelist(bfloat(i), i, 1025, 8192); -sample(x, "logGamma-03.dat"); - -x : makelist(bfloat(2**(i / 8)), i, 105, 8112); -sample(x, "logGamma-04.dat"); http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/87a89277/src/test/maxima/special/reference/logGamma.properties ---------------------------------------------------------------------- diff --git a/src/test/maxima/special/reference/logGamma.properties b/src/test/maxima/special/reference/logGamma.properties deleted file mode 100755 index dc60951..0000000 --- a/src/test/maxima/special/reference/logGamma.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -method=org.apache.commons.complex.special.Gamma.logGamma -signature=double -inputFileMask=logGamma-%02d.dat -outputFileMask=logGamma-out-%02d.dat -from=1 -to=5 -by=1