/** * Constructs a new {@code SparseBinaryMatrix} with the specified dimensions, * allowing the specification of column major ordering if desired. * (defaults to row major ordering) * * @param dimensions each indexed value is a dimension size * @param useColumnMajorOrdering if true, indicates column first iteration, otherwise * row first iteration is the default (if false). */ public SparseBinaryMatrix(int[] dimensions, bool useColumnMajorOrdering, IDistributedArray distArray = null) : base(dimensions, useColumnMajorOrdering) { // We create here a simple array on a single node. if (distArray == null) { this.backingArray = new InMemoryArray(1, typeof(int), dimensions); } else { this.backingArray = distArray; } }
/// <summary> /// Gets the access to a row inside of multidimensional array. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="array"></param> /// <param name="row"></param> /// <returns></returns> //public static T[] GetRow<T>(this T[,] array, int row) private static T[] getRow <T>(IDistributedArray array, int row) { if (array == null) { throw new ArgumentNullException("array"); } int cols = array.GetUpperBound(1) + 1; T[] result = new T[cols]; for (int i = 0; i < cols; i++) { result[i] = (T)array[row, i]; } return(result); }