Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
タイトルがすべてを物語るようにしてみました。
行列があり、列の組み合わせの外積の合計を計算する必要があります。forループでそれを行う方法を知っています。しかし、それを行うためのベクトル化された方法はありますか?
testData = rand(x); answer = zeros(x); for i=1:x for j=1:x answer = answer + testData(:,i)'*testData(:,j); end end
答えはこの質問にあるFast Outer Product
answer = testData.'*testData;
注: これは、行の外積の合計を示します。