コード例 #1
0
        public static Symmetric Operate(Symmetric a, Symmetric b)
        {
            Trace.Assert(a.Size == b.Size);
            int size = a.Size;

            int[] res = new int[size];
            for (int i = 0; i < size; i++)
            {
                res[i] = b[a[i]];
            }
            return(new Symmetric(res));
        }
コード例 #2
0
 public static T[] Operate <T>(T[] arr, Symmetric op)
 {
     if (arr.Length != op.Size)
     {
         throw new ArgumentException($"operator size should be equal with array length({arr.Length})", nameof(op));
     }
     T[] res = new T[arr.Length];
     for (int i = 0; i < arr.Length; i++)
     {
         res[op[i]] = arr[i];
     }
     return(res);
 }