octave to independent C code

View: New views
6 Messages — Rating Filter:   Alert me  

octave to independent C code

by David Riano-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I wrote code in Matlab that I now need to
redistribute as C-code to be combined with other C-code.
I can not redistribute the matlab libraries for free.
I was thinking to convert the Matlab code to
Octave, but I want my program to run as well independently from Octave.

So I was thinking to:
1. Convert M-code to Octave
2. Convert Octave code to C code. Is it possible?
3. Export the Octave libraries. How do you do that?
4. Go to a computer without Octave installed,
both Linux and Windows. Run gcc to compile my
C-code with the octave libraries. Any hints?
5. Run my program in Linux/Windows without
needing to have Octave or Matlab installed.

Is it possible? Can anybody give me any hints?

I have been trying to solve this problem a few weeks now....

Any help would be highly appreciated.
Thanks

da

David RiaƱo
Center for Spatial Technologies and Remote Sensing (CSTARS)
University of California
250-N, The Barn
One Shields Avenue
Davis, CA 95616-8527
USA
1-(517) 629-5499
http://www.cstars.ucdavis.edu/~driano/index.html
http://www.cstars.ucdavis.edu


_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

octave to independent C code

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 28-Feb-2008, David Riano wrote:

| I wrote code in Matlab that I now need to
| redistribute as C-code to be combined with other C-code.
| I can not redistribute the matlab libraries for free.
| I was thinking to convert the Matlab code to
| Octave, but I want my program to run as well independently from Octave.
|
| So I was thinking to:
| 1. Convert M-code to Octave
| 2. Convert Octave code to C code. Is it possible?

Yes, but I think you have to do it by hand. I don't know of any
automatic Octave -> C/C++ translator.

| 3. Export the Octave libraries. How do you do that?

What do you mean by "export"?

| 4. Go to a computer without Octave installed,
| both Linux and Windows. Run gcc to compile my
| C-code with the octave libraries. Any hints?

| 5. Run my program in Linux/Windows without
| needing to have Octave or Matlab installed.

But your application would still be linked to the Octave libraries,
correct?  If so, then what are the license for your code?  If you link
with Octave's libraries, it must be GPL compatible.

Also, what is the "other C-code" you refer to above?

Finally, since Octave is free software, why not just stop at step 1 and
distribute Octave along with your code?

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: octave to independent C code

by david moloney :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
In our group we are currently working on a compiler for Octave. The
compiler translates Octave code to C++ code. The compiler is implemented
mostly in Stratego (see www.stratego.org).

It consists of the following packages:
  - octave-front, the front-end, containing parser etc.
  - octave-opt, the optimizer
  - octave-tc, the type checker/inferencer
  - octave2c, back-end


On Thu, Feb 28, 2008 at 6:59 PM, John W. Eaton <jwe@...> wrote:
On 28-Feb-2008, David Riano wrote:

| I wrote code in Matlab that I now need to
| redistribute as C-code to be combined with other C-code.
| I can not redistribute the matlab libraries for free.
| I was thinking to convert the Matlab code to
| Octave, but I want my program to run as well independently from Octave.
|
| So I was thinking to:
| 1. Convert M-code to Octave
| 2. Convert Octave code to C code. Is it possible?

Yes, but I think you have to do it by hand. I don't know of any
automatic Octave -> C/C++ translator.

| 3. Export the Octave libraries. How do you do that?

What do you mean by "export"?

| 4. Go to a computer without Octave installed,
| both Linux and Windows. Run gcc to compile my
| C-code with the octave libraries. Any hints?

| 5. Run my program in Linux/Windows without
| needing to have Octave or Matlab installed.

But your application would still be linked to the Octave libraries,
correct?  If so, then what are the license for your code?  If you link
with Octave's libraries, it must be GPL compatible.

Also, what is the "other C-code" you refer to above?

Finally, since Octave is free software, why not just stop at step 1 and
distribute Octave along with your code?

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave


_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave

Re: octave to independent C code

by Eric Chassande-Mottin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>
> In our group we are currently working on a compiler for Octave. The
> compiler translates Octave code to C++ code. The compiler is implemented
> mostly in Stratego (see www.stratego.org).
>
> It consists of the following packages:
>  - octave-front, the front-end, containing parser etc.
>  - octave-opt, the optimizer
>  - octave-tc, the type checker/inferencer
>  - octave2c, back-end

could you tell us which level of maturity has your Octave to C++ converter?
is it possible to give it a try?

I could find the home page for the converter:
http://strategoxt.org/Octave/WebHome
but the link to the current release seems broken.

thanks,
eric.

Re: octave to independent C code

by dbateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


david moloney wrote:
http://velveeta.che.wisc.edu/octave/lists/archive/octave-maintainers.2004/msg00667.html

In our group we are currently working on a compiler for Octave. The
compiler translates Octave code to C++ code. The compiler is implemented
mostly in Stratego (see www.stratego.org).
I thought the octave stratego compiler was dead as I'd seen little work on it in the past few years. If its not, I'm glad to hear it. I believe the mistake in the past was not to discuss the work on this compiler on the Octave lists themselves and so few were even aware of this effort. I hope therefore to see lots of mails from you in the future :-)

D.

Re: octave to independent C code

by John W. Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

[Sorry for the long delay in responding to this thread.  I started
composing this message almost a month ago, but then was distracted,
had some travel, and didn't find my draft until today.  --jwe]

On 29-Feb-2008, david moloney wrote:

| http://velveeta.che.wisc.edu/octave/lists/archive/octave-maintainers.2004/msg00667.html

In the last message in this thread:

  http://velveeta.che.wisc.edu/octave/lists/archive/octave-maintainers.2004/msg00754.html

I asked

  Have you needed to make any changes to the internals of Octave to
  support your compiler?  If so, can you please submit the changes along
  with explanations about why they are needed?

and I don't think I ever saw a reply.

The most recent entry on this page:

  http://strategoxt.org/Octave/WhatsGoingOn

is from Jan 2005.  Is there anything newer than that?

Bugs and "daily generated documentation" links are broken.

The link to the SVN archive on this page

  http://strategoxt.org/Octave/OctaveFrontend

is broken.

OK, the link to the latest sources on this page

  http://strategoxt.org/Octave/OctaveCompilerDownload

does work, but it is not clear from the web interface when the last
update happened.

OK, I checked out a copy and I see that it has been updated some in
late 2007 and early 2008; before that december 2005 and it looks like
it has been updated to work with the Octave 3.0.0.

However, it looks like it will need some work for the current sources
because of all the recent changes to the symbol table code to support
objects and private functions.

| In our group we are currently working on a compiler for Octave. The
| compiler translates Octave code to C++ code. The compiler is implemented
| mostly in Stratego (see www.stratego.org).
|
| It consists of the following packages:
|   - octave-front, the front-end, containing parser etc.
|   - octave-opt, the optimizer
|   - octave-tc, the type checker/inferencer
|   - octave2c, back-end

These would certainly be useful things to have, so I would like to
help in whatever way I can.  Would you be interested in collaborating
more closely with us so that the work you do can more easily track any
changes in the internals of Octave?

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www.cae.wisc.edu/mailman/listinfo/help-octave