[Quantproject-developers] QuantProject/b1_ADT ExtendedMath.cs, 1.1, 1.2
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2008-01-14 23:11:22
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv8993/b1_ADT Modified Files: ExtendedMath.cs Log Message: Added static method ArrayOfAbs Index: ExtendedMath.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ExtendedMath.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExtendedMath.cs 8 Sep 2006 15:18:22 -0000 1.1 --- ExtendedMath.cs 14 Jan 2008 23:11:19 -0000 1.2 *************** *** 25,28 **** --- 25,51 ---- return factorial; } + #region ArrayOfAbs + public static double[] ArrayOfAbs( double[] sourceArray ) + { + double[] arrayOfAbs = new double[sourceArray.Length]; + for(int i = 0; i < sourceArray.Length; i++) + arrayOfAbs[i] = Math.Abs( sourceArray[i] ); + return arrayOfAbs; + } + public static float[] ArrayOfAbs( float[] sourceArray ) + { + float[] arrayOfAbs = new float[sourceArray.Length]; + for(int i = 0; i < sourceArray.Length; i++) + arrayOfAbs[i] = Math.Abs( sourceArray[i] ); + return arrayOfAbs; + } + public static int[] ArrayOfAbs( int[] sourceArray ) + { + int[] arrayOfAbs = new int[sourceArray.Length]; + for(int i = 0; i < sourceArray.Length; i++) + arrayOfAbs[i] = Math.Abs( sourceArray[i] ); + return arrayOfAbs; + } + #endregion } } |