super(1);
_value = value;
}
- @Override
+
protected ValueEval getItemInternal(int index) {
return _value;
}
super(1);
_ref = ref;
}
- @Override
+
protected ValueEval getItemInternal(int index) {
return _ref.getInnerValueEval();
}
_ae = ae;
_width = ae.getWidth();
}
- @Override
+
protected ValueEval getItemInternal(int index) {
int rowIx = index / _width;
int colIx = index % _width;
ValueEval arg0, ValueEval arg1) {
double result;
try {
- ValueVector vvX = createValueVector(arg0);
- ValueVector vvY = createValueVector(arg1);
+ ValueVector vvY = createValueVector(arg0);
+ ValueVector vvX = createValueVector(arg1);
int size = vvX.getSize();
if (size == 0 || vvY.getSize() != size) {
return ErrorEval.NA;
ErrorEval firstXerr = null;
ErrorEval firstYerr = null;
boolean accumlatedSome = false;
- double result = 0.0;
// first pass: read in data, compute xbar and ybar
double sumx = 0.0, sumy = 0.0;
public void testBasic() {
Double exp = Math.pow(10, 7.5);
- ValueEval[] xValues = {
+ ValueEval[] yValues = {
new NumberEval(3+exp),
new NumberEval(4+exp),
new NumberEval(2+exp),
new NumberEval(4+exp),
new NumberEval(7+exp),
};
- ValueEval areaEvalX = createAreaEval(xValues);
+ ValueEval areaEvalY = createAreaEval(yValues);
- ValueEval[] yValues = {
+ ValueEval[] xValues = {
new NumberEval(1),
new NumberEval(2),
new NumberEval(3),
new NumberEval(5),
new NumberEval(6),
};
- ValueEval areaEvalY = createAreaEval(yValues);
+ ValueEval areaEvalX = createAreaEval(xValues);
confirm(INTERCEPT, areaEvalX, areaEvalY, -24516534.39905822);
// Excel 2010 gives -24516534.3990583
}
* number of items in array is not limited to 30
*/
public void testLargeArrays() {
- ValueEval[] xValues = createMockNumberArray(100, 3); // [1,2,0,1,2,0,...,0,1]
- xValues[0] = new NumberEval(2.0); // Changes first element to 2
- ValueEval[] yValues = createMockNumberArray(100, 101); // [1,2,3,4,...,99,100]
+ ValueEval[] yValues = createMockNumberArray(100, 3); // [1,2,0,1,2,0,...,0,1]
+ yValues[0] = new NumberEval(2.0); // Changes first element to 2
+ ValueEval[] xValues = createMockNumberArray(100, 101); // [1,2,3,4,...,99,100]
confirm(INTERCEPT, createAreaEval(xValues), createAreaEval(yValues), 51.74384236453202);
// Excel 2010 gives 51.74384236453200
confirmError(areaEvalX, areaEvalX, ErrorEval.REF_INVALID);
// search for errors array by array, not pair by pair
- confirmError(areaEvalX, areaEvalY, ErrorEval.REF_INVALID);
- confirmError(areaEvalY, areaEvalX, ErrorEval.NULL_INTERSECTION);
+ confirmError(areaEvalX, areaEvalY, ErrorEval.NULL_INTERSECTION);
+ confirmError(areaEvalY, areaEvalX, ErrorEval.REF_INVALID);
}
/**
public void testBasic() {
Double exp = Math.pow(10, 7.5);
- ValueEval[] xValues = {
+ ValueEval[] yValues = {
new NumberEval(3+exp),
new NumberEval(4+exp),
new NumberEval(2+exp),
new NumberEval(4+exp),
new NumberEval(7+exp),
};
- ValueEval areaEvalX = createAreaEval(xValues);
+ ValueEval areaEvalY = createAreaEval(yValues);
- ValueEval[] yValues = {
+ ValueEval[] xValues = {
new NumberEval(1),
new NumberEval(2),
new NumberEval(3),
new NumberEval(5),
new NumberEval(6),
};
- ValueEval areaEvalY = createAreaEval(yValues);
+ ValueEval areaEvalX = createAreaEval(xValues);
confirm(SLOPE, areaEvalX, areaEvalY, 0.7752808988764045);
// Excel 2010 gives 0.775280898876405
}
* number of items in array is not limited to 30
*/
public void testLargeArrays() {
- ValueEval[] xValues = createMockNumberArray(100, 3); // [1,2,0,1,2,0,...,0,1]
- xValues[0] = new NumberEval(2.0); // Changes first element to 2
- ValueEval[] yValues = createMockNumberArray(100, 101); // [1,2,3,4,...,99,100]
+ ValueEval[] yValues = createMockNumberArray(100, 3); // [1,2,0,1,2,0,...,0,1]
+ yValues[0] = new NumberEval(2.0); // Changes first element to 2
+ ValueEval[] xValues = createMockNumberArray(100, 101); // [1,2,3,4,...,99,100]
confirm(SLOPE, createAreaEval(xValues), createAreaEval(yValues), -1.231527093596059);
// Excel 2010 gives -1.23152709359606
confirmError(areaEvalX, areaEvalX, ErrorEval.REF_INVALID);
// search for errors array by array, not pair by pair
- confirmError(areaEvalX, areaEvalY, ErrorEval.REF_INVALID);
- confirmError(areaEvalY, areaEvalX, ErrorEval.NULL_INTERSECTION);
+ confirmError(areaEvalX, areaEvalY, ErrorEval.NULL_INTERSECTION);
+ confirmError(areaEvalY, areaEvalX, ErrorEval.REF_INVALID);
}
}