Example #1
0
 public static bool contains_only <T, U, V>(Narray <T> a, U value1, V value2)
 {
     for (int i = 0; i < a.Length1d(); i++)
     {
         if (!a.At1d(i).Equals(value1) && !a.At1d(i).Equals(value2))
         {
             return(false);
         }
     }
     return(true);
 }
Example #2
0
 /// <summary>
 /// 1D subscripting.
 /// </summary>
 public T this[int i0]
 {
     get
     {
         return(data.At1d(i0));
     }
     set
     {
         data.Put1d(i0, value);
     }
 }
Example #3
0
        public static double Sum <T>(Narray <T> data)
        {
            double result = 0.0;
            int    n      = data.Length1d();

            for (int i = 0; i < n; i++)
            {
                result += Convert.ToDouble(data.At1d(i));
            }
            return(result);
        }