I have a piece of code that uses lists instead of vectors and recently, it crashed, it ran out of memory. Long story short, if I use vectors instead of lists, the performance is much better and optimal (this I knew but I was lazy to translate all my code). However, there's one single line that I cannot efficiently translate and it's the one that uses the function member(). Before, I had the following (it's an oversimplification of my code in order to easily discuss it in here):
Where the basis list in my code is actually very long(up to 7,000 inner lists). After the translation to vectors, the code looks something like this:
>basis:=Vector([4,0,0,0]): basis:=Vector([3,2,0,0]): basis:=Vector([2,0,0,2]): basis:=Vector([1,1,2,0]):
The problem now is that I cannot use member(v,basis,index) any longer.
Do you guys know any work around this problem ? Having a unique way to index the vectors in the basis would also solve my problem (perhaps more optimally?) but I don't know how to do it yet(the number of elements of the inner lists is around 45 so trivial indexing is not a good option).