/// <summary>
        ///     Sorts the columns of a matrix by sorting keys.
        /// </summary>
        /// <param name="keys">The key value for each column.</param>
        /// <param name="values">The matrix to be sorted.</param>
        /// <param name="comparer">The comparer to use.</param>
        public static TValue[,] Sort <TKey, TValue>(TKey[] keys, TValue[,] values, IComparer <TKey> comparer)
        {
            var indices = Vector.Range(keys.Length);

            Array.Sort(keys.Copy(), indices, comparer);
            return(values.Get(0, values.Rows(), indices));
        }
Beispiel #2
0
 /// <summary>
 ///   Sorts the columns of a matrix by sorting keys.
 /// </summary>
 ///
 /// <param name="keys">The key value for each column.</param>
 /// <param name="values">The matrix to be sorted.</param>
 /// <param name="comparer">The comparer to use.</param>
 ///
 public static TValue[,] Sort <TKey, TValue>(TKey[] keys, TValue[,] values, IComparer <TKey> comparer)
 {
     int[] indices = Accord.Math.Vector.Range(keys.Length);
     Array.Sort <TKey, int>(keys, indices, comparer);
     return(values.Get(0, values.Rows(), indices));
 }