コード例 #1
0
 public static MyDouble Sqrt(MyDouble v)
 {
     double[] arr = new double[v.length * 2];
     for (int i = 0; i < v.length; i++)
     {
         double t = Math.Sqrt(v.arr[i]);
         arr[2 * i]     = -t;
         arr[2 * i + 1] = t;
     }
     return(new MyDouble(arr, arr.Length));
 }
コード例 #2
0
        private static MyDouble Iter(MyDouble a, MyDouble b, Func <double, double, double> f)
        {
            double[] arr = new double[a.length * b.length];
            for (int ia = 0, i = 0; ia < a.length; ia++)
            {
                for (int ib = 0; ib < b.length; ib++, i++)
                {
                    arr[i] = f(a.arr[ia], b.arr[ib]);
                }
            }

            return(new MyDouble(arr, arr.Length));
        }