Package gov.nih.mipav.model.algorithms
Class QuarticEquationEP
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.QuarticEquationEP
-
public class QuarticEquationEP extends java.lang.Object
Copyright Yair Chuchem 2011. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of Yair Chuchem nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The equation is a*x**4 + b*x**3 + c*x**2 + d*x + e = 0 /* Solve Polynomials of up to the fourth degree. (over complex numbers) Algorithms by Ferrari, Tartaglia, Cardano, et al. (16th century Italy)- Author:
- ilb
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
QuarticEquationEP.complex_t
-
Field Summary
Fields Modifier and Type Field Description private DoubleDouble
aimag
private DoubleDouble
areal
private DoubleDouble
bimag
private DoubleDouble
breal
private DoubleDouble
cimag
(package private) int
COMPLEX_ROOTS
private DoubleDouble
creal
private int
degree
private DoubleDouble
dimag
private DoubleDouble
dreal
private DoubleDouble
eimag
private DoubleDouble
ereal
(package private) int
inputType
private int
MAX_DEGREE
private int[]
num_sols
(package private) int
ONLY_REAL_ROOTS
private double[]
solsimag
private double[]
solsreal
-
Constructor Summary
Constructors Constructor Description QuarticEquationEP()
QuarticEquationEP(int degree, double areal, double aimag, double breal, double bimag, double creal, double cimag, double dreal, double dimag, double ereal, double eimag, int[] num_sols, double[] solsreal, double[] solsimag)
QuarticEquationEP(int degree, double areal, double breal, double creal, double dreal, double ereal, int[] num_sols, double[] sols)
-
Method Summary
-
-
-
Field Detail
-
degree
private int degree
-
areal
private DoubleDouble areal
-
aimag
private DoubleDouble aimag
-
breal
private DoubleDouble breal
-
bimag
private DoubleDouble bimag
-
creal
private DoubleDouble creal
-
cimag
private DoubleDouble cimag
-
dreal
private DoubleDouble dreal
-
dimag
private DoubleDouble dimag
-
ereal
private DoubleDouble ereal
-
eimag
private DoubleDouble eimag
-
num_sols
private int[] num_sols
-
solsreal
private double[] solsreal
-
solsimag
private double[] solsimag
-
MAX_DEGREE
private final int MAX_DEGREE
- See Also:
- Constant Field Values
-
ONLY_REAL_ROOTS
final int ONLY_REAL_ROOTS
- See Also:
- Constant Field Values
-
COMPLEX_ROOTS
final int COMPLEX_ROOTS
- See Also:
- Constant Field Values
-
inputType
int inputType
-
-
Constructor Detail
-
QuarticEquationEP
public QuarticEquationEP()
-
QuarticEquationEP
public QuarticEquationEP(int degree, double areal, double aimag, double breal, double bimag, double creal, double cimag, double dreal, double dimag, double ereal, double eimag, int[] num_sols, double[] solsreal, double[] solsimag)
-
QuarticEquationEP
public QuarticEquationEP(int degree, double areal, double breal, double creal, double dreal, double ereal, int[] num_sols, double[] sols)
-
-
Method Detail
-
selfTest
public void selfTest()
-
run
public void run()
-
runReal
public void runReal()
-
solve_real_poly
int solve_real_poly(int degree, DoubleDouble[] poly, double[] results)
-
solve_real_poly
int solve_real_poly(int degree, DoubleDouble[] poly, DoubleDouble[] results)
-
stableness_score
private DoubleDouble stableness_score(DoubleDouble a, DoubleDouble b)
-
solve_normalized_poly
private int solve_normalized_poly(int degree, DoubleDouble[] poly, double[] results)
-
solve_normalized_poly
private int solve_normalized_poly(int degree, DoubleDouble[] poly, DoubleDouble[] results)
-
calc_shifted_coefs
private void calc_shifted_coefs(DoubleDouble shift, int degree, DoubleDouble[] src, DoubleDouble[] dst)
-
calc_powers
private void calc_powers(DoubleDouble x, int max_power, DoubleDouble[] dst)
-
solve_depressed_poly
private int solve_depressed_poly(int degree, DoubleDouble[] poly, DoubleDouble[] results)
-
solve_depressed_quartic
private int solve_depressed_quartic(DoubleDouble[] poly, DoubleDouble[] results)
-
solve_depressed_cubic
private int solve_depressed_cubic(DoubleDouble[] poly, DoubleDouble[] results)
-
cubic_root
private DoubleDouble cubic_root(DoubleDouble x)
-
solve_depressed_quadratic
private int solve_depressed_quadratic(DoubleDouble[] poly, DoubleDouble[] results)
-
runComplex
public void runComplex()
-
solve_poly
private int solve_poly(int degree, QuarticEquationEP.complex_t[] poly, QuarticEquationEP.complex_t[] results)
-
solve_normalized_poly
private int solve_normalized_poly(int degree, QuarticEquationEP.complex_t[] poly, QuarticEquationEP.complex_t[] results)
-
calc_shifted_coefs
private void calc_shifted_coefs(QuarticEquationEP.complex_t shift, int degree, QuarticEquationEP.complex_t[] src, QuarticEquationEP.complex_t[] dst)
-
calc_binomials
private void calc_binomials(int num_binoms, int stride, DoubleDouble[][] dst)
-
solve_depressed_poly
private int solve_depressed_poly(int degree, QuarticEquationEP.complex_t[] poly, QuarticEquationEP.complex_t[] results)
-
solve_depressed_quartic
private int solve_depressed_quartic(QuarticEquationEP.complex_t[] poly, QuarticEquationEP.complex_t[] results)
-
solve_depressed_cubic
private int solve_depressed_cubic(QuarticEquationEP.complex_t[] poly, QuarticEquationEP.complex_t[] results)
-
solve_depressed_quadratic
private int solve_depressed_quadratic(QuarticEquationEP.complex_t[] poly, QuarticEquationEP.complex_t[] results)
-
calc_powers
private void calc_powers(QuarticEquationEP.complex_t x, int max_power, QuarticEquationEP.complex_t[] dst)
-
complex_eq
private static boolean complex_eq(QuarticEquationEP.complex_t a, QuarticEquationEP.complex_t b)
-
complex_from_real
private QuarticEquationEP.complex_t complex_from_real(DoubleDouble x)
-
stableness_score
private static DoubleDouble stableness_score(QuarticEquationEP.complex_t a, QuarticEquationEP.complex_t b)
-
complex_sqr_norm
private static DoubleDouble complex_sqr_norm(QuarticEquationEP.complex_t x)
-
complex_inverse
private QuarticEquationEP.complex_t complex_inverse(QuarticEquationEP.complex_t x)
-
complex_div
private QuarticEquationEP.complex_t complex_div(QuarticEquationEP.complex_t a, QuarticEquationEP.complex_t b)
-
complex_add
private QuarticEquationEP.complex_t complex_add(QuarticEquationEP.complex_t a, QuarticEquationEP.complex_t b)
-
complex_mult
private QuarticEquationEP.complex_t complex_mult(QuarticEquationEP.complex_t a, QuarticEquationEP.complex_t b)
-
complex_mult_real
private QuarticEquationEP.complex_t complex_mult_real(DoubleDouble c, QuarticEquationEP.complex_t x)
-
complex_negate
private QuarticEquationEP.complex_t complex_negate(QuarticEquationEP.complex_t x)
-
complex_sqrt
private QuarticEquationEP.complex_t complex_sqrt(QuarticEquationEP.complex_t x)
-
complex_pow_real
private QuarticEquationEP.complex_t complex_pow_real(QuarticEquationEP.complex_t x, DoubleDouble power)
-
-