Example #1
0
 public static T Bat <T>(Narray <T> a, int i, int j, T value)
 {
     unchecked
     {
         if ((uint)(i) >= (uint)(a.Dim(0)))
         {
             return(value);
         }
         if ((uint)(j) >= (uint)(a.Dim(1)))
         {
             return(value);
         }
     }
     return(a.UnsafeAt(i, j));
 }
Example #2
0
 /// <summary>
 /// Array subscripting with extending boundary conditions.
 /// </summary>
 public static T Ext <T>(Narray <T> a, int i, int j)
 {
     i = Math.Max(0, Math.Min(i, a.Dim(0) - 1));
     j = Math.Max(0, Math.Min(j, a.Dim(1) - 1));
     return(a.UnsafeAt(i, j));
 }