[Mathlib-commitlog] mathlib/Source/MathLib/Functions/Matrix abs.java, NONE, 1.1
Status: Beta
Brought to you by:
st_mueller
|
From: Stefan M. <st_...@us...> - 2007-01-12 21:48:34
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv637/Source/MathLib/Functions/Matrix Added Files: abs.java Log Message: --- NEW FILE: abs.java --- package MathLib.Functions.Matrix; import MathLib.Functions.ExternalElementWiseFunction; public class abs extends ExternalElementWiseFunction { public abs() { name = "abs"; } /**Standard functions - absolute value * @param double array * @return the result as a double array */ public double[] evaluateValue(double[] arg) { double[] result = new double[2]; if (arg[IMAG]==0) { result[REAL] = Math.abs(arg[REAL]); result[IMAG] = 0; } else { result[REAL] = Math.sqrt(arg[REAL]*arg[REAL] + arg[IMAG]*arg[IMAG]); result[IMAG] = 0; } return result; } } /* @GROUP matrix @SYNTAX abs(value) @DOC Returns the absolute positive value of value. @NOTES @EXAMPLES abs(-5) = 5 abs(2) = 2 abs(3 + 4I) = 5 */ |