Package gov.nih.mipav.model.algorithms
Class Psi
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.Psi
-
public class Psi extends java.lang.ObjectThis code calculates the psi function of an input argument x.
A typical real variable usage would be:double result[] = new double[1]; Psi psiTest = new Psi(5.0, result); psiTest.run(); Preferences.debug("Psi(5.0) = " + result[0] + "\n"); UI.setDataText("Psi(5.0) = " + result[0] + "\n");A typical complex variable usage would be:
double realResult[] = new double[1]; double imagResult[] = new double[1]; Psi psiTest = new Psi(5.0, -1.0, realResult, imagResult); psiTest.run(); Preferences.debug("Psi(5.0,-1.0) = " + realResult[0] + ", " + imagResult[0] + "\n");
The FORTRAN code this class is based upon is from Computation of Special Functions by Shanjie Zhang and Jianming Jin and copyright 1996 John Wiley & Sons, Inc.
From the diskette that the FORTRAN code came on:
DISCLAIMER OF WARRANTY Although we have made a great effort to test and validate the computer programs, we make no warranties, express or implied, that these programs are free of error, or are consistent with any particular standard of merchantability, or that they will meet your requirements for any particular application. They should not be relied on for solving problems whose incorrect solution could result in injury to a person or loss of property. If you do use the programs in such a manner, it is at your own risk. The authors and publisher disclaim all liability for direct or consequential damages resulting from your use of the programs.
-
-
Field Summary
Fields Modifier and Type Field Description static intCOMPLEX_VERSIONprivate double[]imagResultImaginary part of output resultprivate doubleimagXImaginary part of input argumentstatic intREAL_VERSIONprivate double[]realResultReal part of output resultprivate doublerealXReal part of input argumentprivate double[]resultoutput resultprivate intversionREAL_VERSION or COMPLEX_VERSIONprivate doublexinput argument
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomplexPsi()This code is a port of the FORTRAN routine CPSI from the book Computation of Special Functions by Shanjie Zhang and Jianming Jin, John Wiley & Sons, Inc., 1996, pp. 59-60.voidfinalize()Cleanup memory.voidrealPsi()This code is a port of the FORTRAN routine PSI from the book Computation of Special Functions by Shanjie Zhang and Jianming Jin, John Wiley & Sons, Inc., 1996, pp. 58-59.voidrun()voidtestcomplexPsi()voidtestrealPsi()
-
-
-
Field Detail
-
REAL_VERSION
public static final int REAL_VERSION
- See Also:
- Constant Field Values
-
COMPLEX_VERSION
public static final int COMPLEX_VERSION
- See Also:
- Constant Field Values
-
x
private double x
input argument
-
result
private double[] result
output result
-
version
private int version
REAL_VERSION or COMPLEX_VERSION
-
realX
private double realX
Real part of input argument
-
imagX
private double imagX
Imaginary part of input argument
-
realResult
private double[] realResult
Real part of output result
-
imagResult
private double[] imagResult
Imaginary part of output result
-
-
Constructor Detail
-
Psi
public Psi()
-
Psi
public Psi(double x, double[] result)- Parameters:
x- Input argumentresult- outputted psi(x)
-
Psi
public Psi(double realX, double imagX, double[] realResult, double[] imagResult)- Parameters:
realX- real part of input argumentimagX- imaginary part of input argumentrealResult- real part of outputted psi(x)imagResult- imaginary part of outputted psi(x)
-
-
Method Detail
-
finalize
public void finalize() throws java.lang.ThrowableCleanup memory.- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable- DOCUMENT ME!
-
run
public void run()
-
testrealPsi
public void testrealPsi()
-
testcomplexPsi
public void testcomplexPsi()
-
realPsi
public void realPsi()
This code is a port of the FORTRAN routine PSI from the book Computation of Special Functions by Shanjie Zhang and Jianming Jin, John Wiley & Sons, Inc., 1996, pp. 58-59.
-
complexPsi
public void complexPsi()
This code is a port of the FORTRAN routine CPSI from the book Computation of Special Functions by Shanjie Zhang and Jianming Jin, John Wiley & Sons, Inc., 1996, pp. 59-60.
-
-