multiplying a matrix into its transpose

8 ビュー (過去 30 日間)
Mohsen
Mohsen 2012 年 4 月 17 日
コメント済み: Prasad Reddy 2020 年 4 月 23 日
Hi,
I have an sparse and large matrix (A). I would like to do this operation:
C=A*(A');
Using above command takes about 17 sec if size(A)=[31494 277254].
Is there any more efficient command to do the task? Since C matrix will be symmetric so compiler just need to compute half of the C.
  1 件のコメント
Prasad Reddy
Prasad Reddy 2020 年 4 月 23 日
First define matrix c as a zeros matrix of same size and chech if it works.
This is called pre allocation.
Generally preallocation reduces the timeof execution.
command is
C=zeros(31494,277254)
C=A*(A')
if you want to form only half of the matrix then yu can use for lops.

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by