You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by jo...@apache.org on 2009/05/20 02:14:25 UTC
svn commit: r776505 [3/3] - in /poi/trunk/src:
java/org/apache/poi/hssf/record/formula/eval/
java/org/apache/poi/hssf/record/formula/functions/
testcases/org/apache/poi/hssf/record/formula/functions/
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumproduct.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumproduct.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumproduct.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumproduct.java Wed May 20 00:14:19 2009
@@ -1,20 +1,19 @@
-/*
-* 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.
-*/
-
+/* ====================================================================
+ 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.
+==================================================================== */
package org.apache.poi.hssf.record.formula.functions;
@@ -32,23 +31,23 @@
/**
* Implementation for the Excel function SUMPRODUCT<p>
- *
+ *
* Syntax : <br/>
* SUMPRODUCT ( array1[, array2[, array3[, ...]]])
* <table border="0" cellpadding="1" cellspacing="0" summary="Parameter descriptions">
- * <tr><th>array1, ... arrayN </th><td>typically area references,
+ * <tr><th>array1, ... arrayN </th><td>typically area references,
* possibly cell references or scalar values</td></tr>
* </table><br/>
- *
- * Let A<b>n</b><sub>(<b>i</b>,<b>j</b>)</sub> represent the element in the <b>i</b>th row <b>j</b>th column
- * of the <b>n</b>th array<br/>
- * Assuming each array has the same dimensions (W, H), the result is defined as:<br/>
+ *
+ * Let A<b>n</b><sub>(<b>i</b>,<b>j</b>)</sub> represent the element in the <b>i</b>th row <b>j</b>th column
+ * of the <b>n</b>th array<br/>
+ * Assuming each array has the same dimensions (W, H), the result is defined as:<br/>
* SUMPRODUCT = Σ<sub><b>i</b>: 1..H</sub>
* ( Σ<sub><b>j</b>: 1..W</sub>
- * ( Π<sub><b>n</b>: 1..N</sub>
+ * ( Π<sub><b>n</b>: 1..N</sub>
* A<b>n</b><sub>(<b>i</b>,<b>j</b>)</sub>
* )
- * )
+ * )
* </p>
* @author Josh Micich
*/
@@ -56,9 +55,9 @@
public Eval evaluate(Eval[] args, int srcCellRow, short srcCellCol) {
-
+
int maxN = args.length;
-
+
if(maxN < 1) {
return ErrorEval.VALUE_INVALID;
}
@@ -80,7 +79,7 @@
} catch (EvaluationException e) {
return e.getErrorEval();
}
- throw new RuntimeException("Invalid arg type for SUMPRODUCT: ("
+ throw new RuntimeException("Invalid arg type for SUMPRODUCT: ("
+ firstArg.getClass().getName() + ")");
}
@@ -96,7 +95,7 @@
}
private static double getScalarValue(Eval arg) throws EvaluationException {
-
+
Eval eval;
if (arg instanceof RefEval) {
RefEval re = (RefEval) arg;
@@ -104,7 +103,7 @@
} else {
eval = arg;
}
-
+
if (eval == null) {
throw new RuntimeException("parameter may not be null");
}
@@ -118,10 +117,10 @@
}
if (!(eval instanceof ValueEval)) {
- throw new RuntimeException("Unexpected value eval class ("
+ throw new RuntimeException("Unexpected value eval class ("
+ eval.getClass().getName() + ")");
}
-
+
return getProductTerm((ValueEval) eval, true);
}
@@ -135,15 +134,15 @@
return ErrorEval.VALUE_INVALID;
}
-
+
AreaEval firstArg = args[0];
-
+
int height = firstArg.getHeight();
int width = firstArg.getWidth(); // TODO - junit
-
+
// first check dimensions
if (!areasAllSameSize(args, height, width)) {
- // normally this results in #VALUE!,
+ // normally this results in #VALUE!,
// but errors in individual cells take precedence
for (int i = 1; i < args.length; i++) {
throwFirstError(args[i]);
@@ -152,7 +151,7 @@
}
double acc = 0;
-
+
for (int rrIx=0; rrIx<height; rrIx++) {
for (int rcIx=0; rcIx<width; rcIx++) {
double term = 1D;
@@ -163,7 +162,7 @@
acc += term;
}
}
-
+
return new NumberEval(acc);
}
@@ -196,11 +195,11 @@
/**
- * Determines a <code>double</code> value for the specified <code>ValueEval</code>.
+ * Determines a <code>double</code> value for the specified <code>ValueEval</code>.
* @param isScalarProduct <code>false</code> for SUMPRODUCTs over area refs.
* @throws EvaluationException if <code>ve</code> represents an error value.
* <p/>
- * Note - string values and empty cells are interpreted differently depending on
+ * Note - string values and empty cells are interpreted differently depending on
* <code>isScalarProduct</code>. For scalar products, if any term is blank or a string, the
* error (#VALUE!) is raised. For area (sum)products, if any term is blank or a string, the
* result is zero.
@@ -215,7 +214,7 @@
}
return 0;
}
-
+
if(ve instanceof ErrorEval) {
throw new EvaluationException((ErrorEval)ve);
}
@@ -231,7 +230,7 @@
NumericValueEval nve = (NumericValueEval) ve;
return nve.getNumberValue();
}
- throw new RuntimeException("Unexpected value eval class ("
+ throw new RuntimeException("Unexpected value eval class ("
+ ve.getClass().getName() + ")");
}
}
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2my2.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2my2.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2my2.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2my2.java Wed May 20 00:14:19 2009
@@ -20,14 +20,14 @@
/**
* Implementation of Excel function SUMX2MY2()<p/>
- *
+ *
* Calculates the sum of differences of squares in two arrays of the same size.<br/>
* <b>Syntax</b>:<br/>
* <b>SUMX2MY2</b>(<b>arrayX</b>, <b>arrayY</b>)<p/>
- *
+ *
* result = Σ<sub>i: 0..n</sub>(x<sub>i</sub><sup>2</sup>-y<sub>i</sub><sup>2</sup>)
- *
- * @author Amol S. Deshmukh < amolweb at ya hoo dot com >
+ *
+ * @author Amol S. Deshmukh < amolweb at ya hoo dot com >
*/
public final class Sumx2my2 extends XYNumericFunction {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2py2.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2py2.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2py2.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumx2py2.java Wed May 20 00:14:19 2009
@@ -20,14 +20,14 @@
/**
* Implementation of Excel function SUMX2PY2()<p/>
- *
+ *
* Calculates the sum of squares in two arrays of the same size.<br/>
* <b>Syntax</b>:<br/>
* <b>SUMX2PY2</b>(<b>arrayX</b>, <b>arrayY</b>)<p/>
- *
+ *
* result = Σ<sub>i: 0..n</sub>(x<sub>i</sub><sup>2</sup>+y<sub>i</sub><sup>2</sup>)
- *
- * @author Amol S. Deshmukh < amolweb at ya hoo dot com >
+ *
+ * @author Amol S. Deshmukh < amolweb at ya hoo dot com >
*/
public final class Sumx2py2 extends XYNumericFunction {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumxmy2.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumxmy2.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumxmy2.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Sumxmy2.java Wed May 20 00:14:19 2009
@@ -19,14 +19,14 @@
/**
* Implementation of Excel function SUMXMY2()<p/>
- *
+ *
* Calculates the sum of squares of differences between two arrays of the same size.<br/>
* <b>Syntax</b>:<br/>
* <b>SUMXMY2</b>(<b>arrayX</b>, <b>arrayY</b>)<p/>
- *
+ *
* result = Σ<sub>i: 0..n</sub>(x<sub>i</sub>-y<sub>i</sub>)<sup>2</sup>
- *
- * @author Amol S. Deshmukh < amolweb at ya hoo dot com >
+ *
+ * @author Amol S. Deshmukh < amolweb at ya hoo dot com >
*/
public final class Sumxmy2 extends XYNumericFunction {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/T.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/T.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/T.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/T.java Wed May 20 00:14:19 2009
@@ -1,23 +1,20 @@
-/*
-* 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.
-*/
-/*
- * Created on May 15, 2005
- *
- */
+/* ====================================================================
+ 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.
+==================================================================== */
+
package org.apache.poi.hssf.record.formula.functions;
import org.apache.poi.hssf.record.formula.eval.ErrorEval;
@@ -39,12 +36,12 @@
RefEval re = (RefEval) arg;
arg = re.getInnerValueEval();
}
-
+
if (arg instanceof StringEval) {
// Text values are returned unmodified
return arg;
}
-
+
if (arg instanceof ErrorEval) {
// Error values also returned unmodified
return arg;
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/TextFunction.java Wed May 20 00:14:19 2009
@@ -54,7 +54,7 @@
protected abstract ValueEval evaluateFunc(Eval[] args, int srcCellRow, short srcCellCol) throws EvaluationException;
/* ---------------------------------------------------------------------- */
-
+
private static abstract class SingleArgTextFunc extends TextFunction {
protected SingleArgTextFunc() {
@@ -102,10 +102,10 @@
* An implementation of the MID function<br/>
* MID returns a specific number of
* characters from a text string, starting at the specified position.<p/>
- *
+ *
* <b>Syntax<b>:<br/> <b>MID</b>(<b>text</b>, <b>start_num</b>,
* <b>num_chars</b>)<br/>
- *
+ *
* Author: Manda Wilson < wilson at c bio dot msk cc dot org >
*/
public static final Function MID = new TextFunction() {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Time.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Time.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Time.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Time.java Wed May 20 00:14:19 2009
@@ -43,7 +43,7 @@
return ErrorEval.VALUE_INVALID;
}
double result;
-
+
try {
result = evaluate(evalArg(args[0]), evalArg(args[1]), evalArg(args[2]));
} catch (EvaluationException e) {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Today.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Today.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Today.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Today.java Wed May 20 00:14:19 2009
@@ -27,10 +27,10 @@
/**
* Implementation of Excel TODAY() Function<br/>
- *
+ *
* @author Frank Taffelt
*/
-public class Today implements Function {
+public final class Today implements Function {
public Eval evaluate(Eval[] evals, int srcCellRow, short srcCellCol) {
if (evals.length > 0) {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/True.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/True.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/True.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/True.java Wed May 20 00:14:19 2009
@@ -1,23 +1,20 @@
-/*
-* 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.
-*/
-/*
- * Created on May 6, 2005
- *
- */
+/* ====================================================================
+ 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.
+==================================================================== */
+
package org.apache.poi.hssf.record.formula.functions;
import org.apache.poi.hssf.record.formula.eval.BoolEval;
@@ -27,9 +24,9 @@
/**
* @author Amol S. Deshmukh < amolweb at ya hoo dot com >
- *
+ *
*/
-public class True implements Function {
+public final class True implements Function {
public Eval evaluate(Eval[] operands, int srcRow, short srcCol) {
ValueEval retval;
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Value.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Value.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Value.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Value.java Wed May 20 00:14:19 2009
@@ -26,14 +26,14 @@
/**
* Implementation for Excel VALUE() function.<p/>
- *
+ *
* <b>Syntax</b>:<br/> <b>VALUE</b>(<b>text</b>)<br/>
- *
+ *
* Converts the text argument to a number. Leading and/or trailing whitespace is
* ignored. Currency symbols and thousands separators are stripped out.
* Scientific notation is also supported. If the supplied text does not convert
* properly the result is <b>#VALUE!</b> error. Blank string converts to zero.
- *
+ *
* @author Josh Micich
*/
public final class Value implements Function {
@@ -61,8 +61,8 @@
}
/**
- * TODO see if the same functionality is needed in {@link OperandResolver#parseDouble(String)}
- *
+ * TODO see if the same functionality is needed in {@link OperandResolver#parseDouble(String)}
+ *
* @return <code>null</code> if there is any problem converting the text
*/
private static Double convertTextToNumber(String strText) {
@@ -156,7 +156,7 @@
lastThousandsSeparatorIndex = i;
// don't append ','
continue;
-
+
case 'E':
case 'e':
if (i - lastThousandsSeparatorIndex < MIN_DISTANCE_BETWEEN_THOUSANDS_SEPARATOR) {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/Vlookup.java Wed May 20 00:14:19 2009
@@ -26,22 +26,22 @@
import org.apache.poi.hssf.record.formula.functions.LookupUtils.ValueVector;
/**
* Implementation of the VLOOKUP() function.<p/>
- *
+ *
* VLOOKUP finds a row in a lookup table by the first column value and returns the value from another column.<br/>
- *
+ *
* <b>Syntax</b>:<br/>
* <b>VLOOKUP</b>(<b>lookup_value</b>, <b>table_array</b>, <b>col_index_num</b>, range_lookup)<p/>
- *
+ *
* <b>lookup_value</b> The value to be found in the first column of the table array.<br/>
* <b>table_array</b> An area reference for the lookup data. <br/>
* <b>col_index_num</b> a 1 based index specifying which column value of the lookup data will be returned.<br/>
- * <b>range_lookup</b> If TRUE (default), VLOOKUP finds the largest value less than or equal to
- * the lookup_value. If FALSE, only exact matches will be considered<br/>
- *
+ * <b>range_lookup</b> If TRUE (default), VLOOKUP finds the largest value less than or equal to
+ * the lookup_value. If FALSE, only exact matches will be considered<br/>
+ *
* @author Josh Micich
*/
public final class Vlookup implements Function {
-
+
public Eval evaluate(Eval[] args, int srcCellRow, short srcCellCol) {
Eval arg3 = null;
switch(args.length) {
@@ -71,9 +71,9 @@
/**
* Returns one column from an <tt>AreaEval</tt>
- *
+ *
* @param colIndex assumed to be non-negative
- *
+ *
* @throws EvaluationException (#REF!) if colIndex is too high
*/
private ValueVector createResultColumnVector(AreaEval tableArray, int colIndex) throws EvaluationException {
Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/functions/XYNumericFunction.java Wed May 20 00:14:19 2009
@@ -28,7 +28,7 @@
/**
* @author Amol S. Deshmukh < amolweb at ya hoo dot com >
- *
+ *
*/
public abstract class XYNumericFunction implements Function {
Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java?rev=776505&r1=776504&r2=776505&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java Wed May 20 00:14:19 2009
@@ -458,54 +458,6 @@
}
- public void testSumproduct() {
- double d = 0;
- double[][] darr = new double[][]
- {{0 ,0.11 ,23.23},
- {1 ,0.22 ,46.46},
- {2 ,0.33 ,69.69},
- {3 ,0.44 ,92.92},
- {4 ,0.55 ,116.15},
- {5 ,0.66 ,139.38},
- {6 ,0.77 ,162.61},
- {7 ,0.88 ,185.84},
- {8 ,0.99 ,209.07},
- {9 ,1.1 ,232.3},
- {10 ,1.21 ,255.53}};
- d = MathX.sumproduct(darr);
- assertEquals("Sumproduct ", 4.243234425E+22, d);
- darr = new double[][]
- {{0 ,0.11 ,23.23},
- {0 ,0.22 ,46.46},
- {0 ,0.33 ,69.69},
- {0 ,0.44 ,92.92},
- {0 ,0.55 ,116.15},
- {0 ,0.66 ,139.38},
- {0 ,0.77 ,162.61},
- {0 ,0.88 ,185.84},
- {0 ,0.99 ,209.07},
- {0 ,1.1 ,232.3},
- {0 ,1.21 ,255.53}};
- d = MathX.sumproduct(darr);
- assertEquals("Sumproduct ", 4.243234425E+22, d);
-
- darr = new double[][]
- {{0, 0, 0, 0, 0, 0, 0, 0},
- {0.11, 0.22, 0.33, 0.44, 0.55, 0.66, 0.77, 0.88},
- {23.23, 46.46, 69.69, 92.92, 116.15, 139.38, 162.61, 185.84}};
- d = MathX.sumproduct(darr);
- assertEquals("Sumproduct ", 0, d);
-
- darr = new double[][]
- {{0, 1, 2, 3, 4, 5, 6, 7},
- {0.11, 0.22, 0.33, 0.44, 0.55, 0.66, 0.77, 0.88},
- {23.23, 46.46, 69.69, 92.92, 116.15, 139.38, 162.61, 185.84}};
- d = MathX.sumproduct(darr);
- assertEquals("Sumproduct ", 2790.3876, d);
-
-
- }
-
public void testSumsq() {
double[] d = new double[100];
d[0] = 1.1; d[1] = 2.1; d[2] = 3.1; d[3] = 4.1;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org