Lines Matching refs:res

1074      * array and place the non-complex roots into the <code>res</code>
1084 * @param res the array that contains the non-complex roots
1089 public static int solveCubic(double eqn[], double res[]) {
1094 return QuadCurve2D.solveQuadratic(eqn, res);
1128 if (res == eqn) {
1132 res[ 0 ] = ( t * Math.cos(phi));
1133 res[ 1 ] = (-t * Math.cos(phi + Math.PI / 3));
1134 res[ 2 ] = (-t * Math.cos(phi - Math.PI / 3));
1138 res[ i ] -= sub;
1153 if (res == eqn) {
1156 res[1] = -(uv / 2) - sub;
1160 res[ 0 ] = uv - sub;
1164 num = fixRoots(eqn, res, num);
1166 if (num > 2 && (res[2] == res[1] || res[2] == res[0])) {
1169 if (num > 1 && res[1] == res[0]) {
1170 res[1] = res[--num]; // Copies res[2] to res[1] if needed
1175 // preconditions: eqn != res && eqn[3] != 0 && num > 1
1177 // should be in res). It also might eliminate roots in res if it decideds
1179 // computation of res might have missed, so this method should only be
1180 // used when the roots in res have been computed using an algorithm
1182 private static int fixRoots(double[] eqn, double[] res, int num) {
1201 // where num > 1 but critCount < 2, we eliminate all roots in res
1208 Arrays.sort(res, 0, num);
1212 res[0] = refineRootWithHint(eqn, x0, intervals[0], res[0]);
1213 res[1] = refineRootWithHint(eqn, intervals[0], intervals[1], res[1]);
1214 res[2] = refineRootWithHint(eqn, intervals[1], xe, res[2]);
1237 res[0] = bisectRootWithHint(eqn, x0, x1, res[0]);
1239 res[0] = bisectRootWithHint(eqn, x1, xe, res[2]);
1241 res[0] = x1;
1245 res[0] = bisectRootWithHint(eqn, x0, xe, res[1]);
1249 // XXX: here we assume that res[0] has better accuracy than res[1].
1251 // which puts in res[0] the root that it would compute anyway even
1255 // goodRoot = (abs(eqn'(res[0])) > abs(eqn'(res[1]))) ? res[0] : res[1]
1257 double goodRoot = res[0];
1258 double badRoot = res[1];
1265 // it is zero (or close enough) we put x in res[1] (or badRoot, if
1273 res[1] = abs(badRootVal) < abs(fx) ? badRoot : x;
1276 } // else there can only be one root - goodRoot, and it is already in res[0]