Exemplo n.º 1
0
 /// <summary>
 /// array replication _ : TODO : implement correctly!
 /// </summary>
 /// <param name="X">input array to be replicated</param>
 /// <param name="rows">number of rows</param>
 /// <param name="sizeEx">number of columns and higher dimensions</param>
 /// <returns>reference ILArray as replication of X</returns>
 public static ILArray <T> repmat <T>(ILArray <T> X, object rows, params object[] sizeEx)
 {
     int [] size = new int[1 + sizeEx.Length];
     if (rows is ILArray <double> )
     {
         size[0] = (int)((ILArray <double>)rows).GetValue(0);
     }
     else if (rows is ILArray <float> )
     {
         size[0] = (int)((ILArray <float>)rows).GetValue(0);
     }
     else if (rows is ILArray <complex> )
     {
         size[0] = (int)((ILArray <complex>)rows).GetValue(0);
     }
     else if (rows is ILArray <fcomplex> )
     {
         size[0] = (int)((ILArray <fcomplex>)rows).GetValue(0);
     }
     else if (rows is ILArray <Int16> )
     {
         size[0] = (int)((ILArray <Int16>)rows).GetValue(0);
     }
     else if (rows is ILArray <Int32> )
     {
         size[0] = (int)((ILArray <Int32>)rows).GetValue(0);
     }
     else if (rows is ILArray <Int64> )
     {
         size[0] = (int)((ILArray <Int64>)rows).GetValue(0);
     }
     else if (rows is ILArray <UInt16> )
     {
         size[0] = (int)((ILArray <UInt16>)rows).GetValue(0);
     }
     else if (rows is ILArray <UInt32> )
     {
         size[0] = (int)((ILArray <UInt32>)rows).GetValue(0);
     }
     else if (rows is ILArray <UInt64> )
     {
         size[0] = (int)((ILArray <UInt64>)rows).GetValue(0);
     }
     else if (rows is ILArray <char> )
     {
         size[0] = (int)((ILArray <char>)rows).GetValue(0);
     }
     else if (rows is ILArray <byte> )
     {
         size[0] = (int)((ILArray <byte>)rows).GetValue(0);
     }
     for (int i = 0; i < sizeEx.Length; i++)
     {
         size[i + 1] = 0; // TODO: implement general parameter conversion routine! sizeEx[i];
     }
     return(X.Repmat(size));
 }
Exemplo n.º 2
0
 /// <summary>
 /// array replication
 /// </summary>
 /// <param name="X">input array to be replicated</param>
 /// <param name="rows">number of rows</param>
 /// <param name="sizeEx">number of columns and higher dimensions</param>
 /// <returns>reference ILArray as replication of X</returns>
 public static ILArray <T> repmat <T>(ILArray <T> X, int rows, params int[] sizeEx)
 {
     int [] size = new int[1 + sizeEx.Length];
     size[0] = rows;
     for (int i = 0; i < sizeEx.Length; i++)
     {
         size[i + 1] = sizeEx[i];
     }
     return(X.Repmat(size));
 }
Exemplo n.º 3
0
 /// <summary>
 /// array replication
 /// </summary>
 /// <param name="X">input array to be replicated</param>
 /// <param name="size">dimensions specifier, number of rows, columns .. to replicate this array</param>
 /// <returns>reference ILArray as replication of X</returns>
 public static ILArray <T> repmat <T>(ILArray <T> X, params int[] size)
 {
     return(X.Repmat(size));
 }
Exemplo n.º 4
0
        public void Test_Repmat() {
            int errorCode = 0;
            try {
                ILArray<double> A = new ILArray<double>(new double[24] {0,1,2,3,4,5,6,7,8,9
                                                ,10,11,12,13,14,15,16,17,18,19,20,21,22,23}, 6, 4);
                ILArray<double> B = A.Repmat(1, 1);

                Info("Test_Repmat needs to be implemented!");

                Success("Test_Repmat successfull");
            } catch (Exception e) {
                Error("Test_Repmat failed at errorCode: " + errorCode + " Reason: " + e.Message);
            }

        }