I was trying to write the following code:
def ordering(n):
eqvec=np.zeros(n)
bvec=[]
for i in range(n):
eqvec[i]=orderingeq(n,i+1)
while eqvec:
index_max=np.argmax(eqvec)
bvec.append(index_max)
eqvec.remove(index_max)
return bvec
In this code I have two vectors. The first vector 'eqvec' contains some numbers which are determined with the equation 'orderingeq'. From this point I need to fill the vector 'bvec' with the index values of maximum of the vector 'eqvec'. From what I have found online is that this should work, or at least I have not found an alternate way to do this. But I get the error message corresponding to the line 'while eqvec:'.
The truth value of an array with more than one element is ambiguous. Use a.any() or a.all().
Could someone help me by telling me what is wrong with my code and maybe tell me how it should be done?