shsajjadi / OctaveCoder

Octave Coder __ A code generator and build system that converts Octave to C++
Other
27 stars 3 forks source link

Nice work #17

Closed DanielMartensson closed 1 year ago

DanielMartensson commented 1 year ago

Nice work you have made here.

Can you show an example how to use this library?

shsajjadi commented 1 year ago

Thank you! Coder is an Octave package. It can be installed like other packages. You need to get the latest .ta.gz file from this repository and install it. Run Octave and type:

pkg install "https://github.com/shsajjadi/OctaveCoder/archive/refs/tags/coder-1.7.0.tar.gz"

After installation you need to load the package:

pkg load coder

Now Coder can convert your .m function file to C++ and compile it to a .oct file.

Assume that you have a function "myfunction" that is saved in a myfunction.m

function out = myfunction (a) out = a; for k = 1:1000; out = out + k; end end

You simply can use:

octave2oct("myfunction")

The created .oct file is generally faster than the original .m file. Please let my to know if you have any other question.