Esempio n. 1
0
        /// <summary>
        ///   Gets a column vector from a matrix.
        /// </summary>
        ///
        public static T[,] GetPlane <T>(this T[,,] m, int index, T[,] result = null)
        {
            int rows  = m.Rows();
            int cols  = m.Columns();
            int depth = m.Depth();

            if (result == null)
            {
                result = new T[rows, cols];
            }

            index = Matrix.index(index, depth);
            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    result[i, j] = m[i, j, index];
                }
            }

            return(result);
        }