Faster calculation of a porwer sum

3 ビュー (過去 30 日間)
Ivan Gonzalez Bustos
Ivan Gonzalez Bustos 2018 年 7 月 26 日
This function in my code is a bottleneck. Is it possible to make it run faster?
x and y are vectors of the same length and out is a matrix containing the power sum of x and y.
function [out] = powerSum2(x,y,order)
out = zeros(order+1);
for ii = 0:order
for jj = 0:order
out(ii+1,jj+1) = sum(x.^ii.*y.^jj);
end
end
end

回答 (0 件)

カテゴリ

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

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by