フィルターのクリア

About changing the size of array

1 回表示 (過去 30 日間)
C Zeng
C Zeng 2013 年 6 月 20 日
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.
Thanks.
  3 件のコメント
Jan
Jan 2013 年 8 月 5 日
I do not understand the question completely. How large is your matrix? "Very large" could mean 2000 or 20'000'000 rows. "Very slow" can mean seconds or weeks. Do you want to improve the performance of your code? Then post it here. Operating on rows must be slower than on columns due to accessing neighboring elements of the memory.
I cannot follow at these points:
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.
What is a "linked array" in your case or what does "saving as a stack" exactly mean?
C Zeng
C Zeng 2013 年 8 月 6 日
Hi, Jan, it has been two months, and now I found a method to solve this problem. No need to be a stack. What I did is simply create another array to record the subset number and its order.
Thanks all the same.

サインインしてコメントする。

採用された回答

C Zeng
C Zeng 2013 年 6 月 20 日
編集済み: C Zeng 2013 年 6 月 20 日
  3 件のコメント
Jan
Jan 2013 年 8 月 5 日
@C Zhend: You have accepted the answer, which means, that the problem is solved. Now you are asking for an advice?
C Zeng
C Zeng 2013 年 8 月 6 日
Hi, Jan, yes I posted a potential answer but not necessary to be true.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by