I have a function like,
function ObjVal=fun(Chrom,a)
[Nind,Nvar] = size(Chrom);
[m n]=size(a);
for i=1:Nind
c=Chrom(i,:);
Cmat=repmat(c',1,n);
ax=abs(sum(Cmat.*a)).^2;
ObjVal(i)= 10*log10(max(ax)./(mean(ax)));
end;
Chrom=16*16 and a=16*1024 array. I'm trying to find the fastest way on gpu. Only gpuarray is slower. When I use arrayfun or bsxfun I get some errors.
function valmult=mult(Cmat,a)
valmult=abs(sum(Cmat.*a)).^2;
ax=arrayfun(@mult,Cmat,a); I get Function passed as first input argument contains unsupported or unknown function 'sum'.)
I am new in MATLAB with GPU. Any suggestions which way is the best and how can I maximize code performance with gpuarray?