Package gov.nih.mipav.model.algorithms
Class QuarticEquation
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.QuarticEquation
-
public class QuarticEquation 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
QuarticEquation.complex_t
-
Field Summary
Fields Modifier and Type Field Description private double
aimag
private double
areal
private double
bimag
private double
breal
private double
cimag
(package private) int
COMPLEX_ROOTS
private double
creal
private int
degree
private double
dimag
private double
dreal
private double
eimag
private double
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 QuarticEquation()
QuarticEquation(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)
QuarticEquation(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 double areal
-
aimag
private double aimag
-
breal
private double breal
-
bimag
private double bimag
-
creal
private double creal
-
cimag
private double cimag
-
dreal
private double dreal
-
dimag
private double dimag
-
ereal
private double ereal
-
eimag
private double 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
-
QuarticEquation
public QuarticEquation()
-
QuarticEquation
public QuarticEquation(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)
-
QuarticEquation
public QuarticEquation(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, double[] poly, double[] results)
-
stableness_score
private double stableness_score(double a, double b)
-
solve_normalized_poly
private int solve_normalized_poly(int degree, double[] poly, double[] results)
-
calc_shifted_coefs
private void calc_shifted_coefs(double shift, int degree, double[] src, double[] dst)
-
calc_powers
private void calc_powers(double x, int max_power, double[] dst)
-
solve_depressed_poly
private int solve_depressed_poly(int degree, double[] poly, double[] results)
-
solve_depressed_quartic
private int solve_depressed_quartic(double[] poly, double[] results)
-
solve_depressed_cubic
private int solve_depressed_cubic(double[] poly, double[] results)
-
cubic_root
private double cubic_root(double x)
-
solve_depressed_quadratic
private int solve_depressed_quadratic(double[] poly, double[] results)
-
runComplex
public void runComplex()
-
solve_poly
private int solve_poly(int degree, QuarticEquation.complex_t[] poly, QuarticEquation.complex_t[] results)
-
solve_normalized_poly
private int solve_normalized_poly(int degree, QuarticEquation.complex_t[] poly, QuarticEquation.complex_t[] results)
-
calc_shifted_coefs
private void calc_shifted_coefs(QuarticEquation.complex_t shift, int degree, QuarticEquation.complex_t[] src, QuarticEquation.complex_t[] dst)
-
calc_binomials
private void calc_binomials(int num_binoms, int stride, double[][] dst)
-
solve_depressed_poly
private int solve_depressed_poly(int degree, QuarticEquation.complex_t[] poly, QuarticEquation.complex_t[] results)
-
solve_depressed_quartic
private int solve_depressed_quartic(QuarticEquation.complex_t[] poly, QuarticEquation.complex_t[] results)
-
solve_depressed_cubic
private int solve_depressed_cubic(QuarticEquation.complex_t[] poly, QuarticEquation.complex_t[] results)
-
solve_depressed_quadratic
private int solve_depressed_quadratic(QuarticEquation.complex_t[] poly, QuarticEquation.complex_t[] results)
-
calc_powers
private void calc_powers(QuarticEquation.complex_t x, int max_power, QuarticEquation.complex_t[] dst)
-
complex_eq
private static boolean complex_eq(QuarticEquation.complex_t a, QuarticEquation.complex_t b)
-
complex_from_real
private QuarticEquation.complex_t complex_from_real(double x)
-
stableness_score
private static double stableness_score(QuarticEquation.complex_t a, QuarticEquation.complex_t b)
-
complex_sqr_norm
private static double complex_sqr_norm(QuarticEquation.complex_t x)
-
complex_inverse
private QuarticEquation.complex_t complex_inverse(QuarticEquation.complex_t x)
-
complex_div
private QuarticEquation.complex_t complex_div(QuarticEquation.complex_t a, QuarticEquation.complex_t b)
-
complex_add
private QuarticEquation.complex_t complex_add(QuarticEquation.complex_t a, QuarticEquation.complex_t b)
-
complex_mult
private QuarticEquation.complex_t complex_mult(QuarticEquation.complex_t a, QuarticEquation.complex_t b)
-
complex_mult_real
private QuarticEquation.complex_t complex_mult_real(double c, QuarticEquation.complex_t x)
-
complex_negate
private QuarticEquation.complex_t complex_negate(QuarticEquation.complex_t x)
-
complex_sqrt
private QuarticEquation.complex_t complex_sqrt(QuarticEquation.complex_t x)
-
complex_pow_real
private QuarticEquation.complex_t complex_pow_real(QuarticEquation.complex_t x, double power)
-
-