public void TestRavelUnravel(int[] shape, int[] indices) { Multiarray <int> array = new Multiarray <int>(shape); Assert.AreEqual(indices, array.UnravelIndex(array.RavelIndex(indices))); Assert.AreEqual(array[indices], array[array.RavelIndex(indices)]); }
public void TestUnravelRavel(int[] shape, int index) { Multiarray <int> array = new Multiarray <int>(shape); Assert.AreEqual(index, array.RavelIndex(array.UnravelIndex(index))); Assert.AreEqual(array[index], array[array.UnravelIndex(index)]); }
public void TestRankMismatch(string arrayKey, int[] indices) { Multiarray <int> array = TestIntegerArrays[arrayKey]; Assert.Throws <RankException>(delegate { int value = array[indices]; }); Assert.Throws <RankException>(delegate { array[indices] = 0; }); Assert.Throws <RankException>(delegate { array.RavelIndex(indices); }); }