84094

Converting matlab code, into c

Question:

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 -ascii

Answer1:

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>

Recommend

  • Server and SSL API Security
  • How do i deploy MVC3 website to server via ftp
  • BMP280 ServiceSpecificException: I/O error (code 5)
  • Best way to load big background in libgdx
  • Numpy - Finding matches across multiple co-ordinates
  • Passing Context In Odoo
  • import XML to HTML
  • Creating a Countdown Watch with a slider in Xcode
  • getting cpu usage of one process using c++ (win32)
  • solving a singular matrix
  • Arduino: error: 'abs' was not declared in this scope
  • Python equivalent of R c() function?
  • How to make a field required without data annotation
  • find specific file type from folder and its sub folder
  • Group by month+year with counts
  • Generic DB Table
  • AngularJS - ngBind and Bootstrap Switch
  • python struct.pack(): pack multiple datas in a list or a tuple
  • Is a .txt file created in VB different than one I'd randomly create?
  • OSX - always hide certain files
  • Compiling dlib on OS X
  • Default parameter as generic type
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • How to generate and display a QR Code in ionic 2
  • Loading .coffee files via a view in Rails
  • Create DicomImage from scratch using Dcmtk
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Counter field in MS Access, how to generate?
  • Javascript + PHP Encryption with pidCrypt
  • Websockets service method fails during R startup
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Acquiring multiple attributes from .xml file in c#
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How to stop GridView from loading again when I press back button?
  • How can I remove ASP.NET Designer.cs files?
  • java string with new operator and a literal
  • How to load view controller without button in storyboard?