Example #1
0
 public static void Assign <T, L, R>(this ArraySliceBase <T, L> lhs, ArraySliceBase <T, R> rhs)
     where L : unmanaged, Native.Handle.IUniversalSlice
     where R : unmanaged, Native.Handle.IUniversalSlice
 {
     if (lhs.Count != rhs.Count)
     {
         throw new ArgumentException("'lhs' and 'rhs' must have the same length");
     }
     for (int i = 0; i < lhs.Count; i++)
     {
         lhs[i] = rhs[i];
     }
 }
Example #2
0
 public static void Each <T1, T2, I1, I2>(this ArraySliceBase <T1, I1> slice1, ArraySliceBase <T2, I2> slice2, Action <T1, T2> func)
     where I1 : unmanaged
     where I2 : unmanaged
 {
     if (slice1.Count != slice2.Count)
     {
         throw new ArgumentException("'slice1' and 'slice2' must have the same shape");
     }
     for (int i = 0; i < slice1.Count; i++)
     {
         func(slice1[i], slice2[i]);
     }
 }