help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can Octave (Matlab code) be added to C++ as a library?


From: evansste
Subject: Re: Can Octave (Matlab code) be added to C++ as a library?
Date: Wed, 8 Apr 2020 13:35:32 -0500 (CDT)

Thanks to both of you.

To answer the question that "Carlo de Falco-2" asked -- yes, your link is
similar to what I'm trying to do.  The following link is also similar, since
it shows a compiled, yet C++, program running a native Octave function.

https://octave.org/doc/v5.2.0/Standalone-Programs.html

I've been trying to find a way to do this without having to use C++.  I
recognize that Octave uses LAPACK and BLAS, and that those subroutines are
written in Fortran.  I also ran across the following link:

https://www.math.utah.edu/software/c-with-fortran.html

It's very informative, and gives a good explanation as to why working with
mixed programming languages can be problematic, and why programmers are
still stuck with the reality of often resorting to it.  If I could use
native Octave functions without having to also include C++, that would be a
huge bonus.

It seems as if including C++, in my Fortran programs, would force me to pass
information using files.  I've been implementing an extremely clunky version
of that, up til now.  Portions of the programs are written in Octave, but
using files to implement Fortran.  It's been a migration process, since the
goal is to completely convert the program to Fortran, for the sake of speed. 
However, all speed is lost, and the program ends up being even slower, when
I use my Fortran versions of "ismember" and "unique", without using LAPACK
and BLAS.

As "siko1056" pointed out, it may be possible to get a static library by
compiling Octave with the appropriate static option.  I've recently learned
that the Octave library would then be pre-compiled, and in machine language. 
Because of this, shouldn't it be theoretically possible to use the functions
directly with Fortran, or any other language, or am I wrong about that?

I don't know how Octave is using LAPACK and BLAS to make its native
functions so fast, but that's clearly what I also need to do.  However, I'm
not quite sure where I'd begin with that option.  Linear Algebra techniques
appear to have nothing to do with matrix manipulation, which is what
"ismember" does.  So I can't begin to think of what the algorithm would be.

Because I'm not a seasoned programmer, I've been considering the idea of
hiring a programmer to write a Fortran version of "ismember", using LAPACK
and BLAS so that it can remain fast.  Is that feasible, or is the program so
complicated that I'd probably go broke going down that road?

Thanks again, for your input.



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]