Innerproduct work. Testing, visualization, and 2D - NOTE there are bugs in anything but a uniform LOM

Not very helpful yet!
This commit is contained in:
Rowan Cockett
2013-08-05 11:51:03 -07:00
parent e2e38074fc
commit e073eaeb8b
9 changed files with 465 additions and 116 deletions
+9 -1
View File
@@ -319,4 +319,12 @@ def sub2ind(shape, subs):
def getSubArray(A, ind):
"""subArray"""
return A[ind[0], :, :][:, ind[1], :][:, :, ind[2]]
assert type(ind) == list, "ind must be a list of vectors"
assert len(A.shape) == len(ind), "ind must have the same length as the dimension of A"
if len(A.shape) == 2:
return A[ind[0], :][:, ind[1]]
elif len(A.shape) == 3:
return A[ind[0], :, :][:, ind[1], :][:, :, ind[2]]
else:
raise Exception("getSubArray does not support dimension asked.")