フィルターのクリア

How working on a matrix with a large number of rows?

5 ビュー (過去 30 日間)
l.l.
l.l. 2014 年 10 月 31 日
コメント済み: l.l. 2014 年 11 月 3 日
Hello everybody! I have a very large array, about 80000 rows and 3 columns. I need to calculate the distances between each line and the others.
I tried to calculate the possible combinations with the function nchoosek , but does not: out of memory
with a loop on the array takes too long ...
how can I do?
  3 件のコメント
per isakson
per isakson 2014 年 10 月 31 日
Image Analyst
Image Analyst 2014 年 10 月 31 日
What are you really trying to do? Give us the big picture. It may be possible to do that without having all those distances held in memory at the same time . By the way, 240,000 numbers is not large at all (it's way smaller than a typical digital image) - it's the fact that you need distances of every row/line to every other line that takes up all the memory.

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

採用された回答

Mohammad Abouali
Mohammad Abouali 2014 年 10 月 31 日
編集済み: Mohammad Abouali 2014 年 10 月 31 日
try this:
Assuming X is storing your coordinates, (1 point per row) and (x,y,z) are the three columns, use pdist as follows:
d=pdist(X);
or if you are running out of memory:
d=pdist(single(X));
if you still go out of memory then you need bigger machine
Using pdist doesn't require you to calculate possible combination manually hence you save some memory there. Your original data 80000x3 at double precision takes less than 2MB of memory; so, I wouldn't worry about that loading it in memory. But your results in single precision would take about 12GB. Double precision make that double.
  1 件のコメント
l.l.
l.l. 2014 年 11 月 3 日
thank you so much, but I fear the problem is the hardware :(

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by