i have a matlab function that reads a big matrix and calculates the Singular Value Decomposition SVD. I however need to run that on a linux system without needing to install matlab on every new system, so id like to have it converted into c source code. The code is realy simple:
function singular(m) load c:\som\matlab.txt [U,S,V]=svd(matlab); m = str2num(m); U1=U(:,1:floor(sqrt(m))); V1=V'; Vt=V1(1:floor(sqrt(m)),:); S1=S(1:floor(sqrt(m)),1:floor(sqrt(m))); matlab1=U1*S1*Vt; matlab2=abs(matlab1); save c:\som\matlab1.txt matlab1 -ascii save c:\som\matlab2.txt matlab2 -asciiAnswer1:
You can use the <a href="https://www.mathworks.es/products/matlab-coder/" rel="nofollow">Matlab coder</a>, but I advise you to make it manually, because some functions are not convertible, and the performance is not much better that mading it manually.
To make svd manually: <a href="http://www.public.iastate.edu/~dicook/JSS/paper/code/svd.c" rel="nofollow">SVD</a>