예제 #1
0
 /// <summary>
 /// Vector scalar division
 /// </summary>
 /// <param name="L">Left vector</param>
 /// <param name="k">Scalar multiple</param>
 /// <returns>new Vector(L/k)</returns>
 public static Vector <T> operator /(Vector <T> L, T k)
 {
     T[] result = new T[L.numEntries];
     for (int i = 0; i < result.Length; i++)
     {
         result[i] = operators.divide(L.values[i], k);
     }
     return(new Vector <T>(result));
 }
예제 #2
0
파일: Matrix.cs 프로젝트: tantock/Math.NET
        /// <summary>
        /// Matrix scalar division
        /// </summary>
        /// <param name="L">Left matrix</param>
        /// <param name="k">Scalar divisor</param>
        /// <returns>new Matrix(L/k)</returns>
        public static Matrix <U> operator /(Matrix <U> L, U k)
        {
            int m = L.numRows;
            int n = L.numColumns;

            U[][] result = new U[m][];
            //create new 2d array
            for (int i = 0; i < m; i++)
            {
                result[i] = new U[n];
            }
            for (int i = 0; i < m; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    result[i][j] = operators.divide(L.values[i][j], k);
                }
            }
            return(new Matrix <U>(result));
        }