//http://cbucks.codeplex.com/
//ACADEMIC FREE LICENSE ("AFL") V. 3.0
using System;
using System.Collections.Generic;
using System.Text;
namespace CBucks {
/// <summary>
/// The class which provides the array utility functions
/// </summary>
internal staticclass ArrayUtils {
/// <summary>
/// Computes the indices
/// </summary>
/// <param name="ind"> The linearized index </param>
/// <param name="cumSizes"> The array cumulative sizes </param>
/// <returns> The multidimensional indices </returns>
internal staticint[] getIndices(int ind, int[] cumSizes) {
int[] inds = newint[cumSizes.Length];
int rm = ind;
for(int i = 0; i < inds.Length - 1; i++) {
inds[i] = rm / cumSizes[inds.Length - i - 2];
rm %= cumSizes[inds.Length - i - 2];
} // end of for()
inds[inds.Length - 1] = rm;
return inds;
} // end of getIndices()
} // end of internal static class ArrayUtils
} // end of namespace CBucks