Hi, it is a follow up of a previous question, but I have not successfully solved it.
Assume I have a large matrix(many rows), and try to remove as many rows as I want. The criterion of removing a row j is that if there is a row i in lower row# (i<j) and row i<=row j and then we call row i dominates row j rand remove row j(while keep row i).
To do a complete removal, I need to check to every row, check if any of its row above it can dominates it. When the size of matrix is very large (in my case) the program is very slow.
Now I think of a method that can avoid wasting time on dominated rows. Whenever I find 1000 rows that are dominated, I delete them from the matrix and continue the work. In such a way, the size of matrix can get smaller and smaller. However I am aware that changing the size of a variable also costs time. There is a tradeoff.
Last week Walter Roberson communicated with me about if there is opportunity of speedup if keeping the size of variable smaller. It seems that not very possible unless we need additional memory on hard drive. Otherwise if in the RAM, there might not be a difference on large of small size of your data.
If so, let me go back to my problem, changing the variable may not be good. How about keep a linked array that it only contains non-dominated rows but in reverse order and it likes "10->8->5->2->1" I would like to save it as a stack, i.e., Whenever I push a number number, it shows up in the first entry.
How to define and make a stack happen? Note I have to define the size, but I do not know it yet.
No products are associated with this question.
Play games and win prizes!Learn more