```
function f=loss_fun(W,a,S,M,X,Y,C,N)
%S is the variable(3d tensor), other inputs are parameters given
f=0;
for n=1:N
for c=1:C
sum=zeros(X,Y);
for m=1:M
sum=sum+a(m,c,n)*S(:,:,m);
end
f=f+power(norm(W(:,:,c,n)-sum),2);
end
end
end
```

this function is defined by myself and to be minimize. The function is surely convex. But there is an error : Undefined function ‘sparse’ for input arguments of type ‘single’. What does this error mean?