コード例 #1
0
        public static NDArray <T> operator +(NDArray <T> np, NDArray <T> np2)
        {
            dynamic sum    = null;
            dynamic np1Dyn = np.Data.ToArray();
            dynamic np2Dyn = np2.Data.ToArray();

            var dataType = typeof(T);

            switch (dataType.Name)
            {
            case ("Double"): sum = new NDArray <double>().Array(((double[])Addition.AddDoubleArrayToDoubleArray(np1Dyn, np2Dyn)).ToList()); break;

            case ("Float"): sum = new NDArray <float>().Array(((float[])Addition.AddfloatArrayTofloatArray(np1Dyn, np2Dyn)).ToList()); break;

            case ("Complex"): sum = new NDArray <Complex>().Array(((Complex[])Addition.AddComplexArrayToComplexArray(np1Dyn, np2Dyn)).ToList()); break;

            case ("Quaternion"): sum = new NDArray <Quaternion>().Array(((Quaternion[])Addition.AddQuaternionArrayToQuaternionArray(np1Dyn, np2Dyn)).ToList()); break;
            }

            return((NDArray <T>)sum);
        }