πŸ“ˆ More than cross-platform Octave process wrapper πŸ”¬
C#
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples Version bump. May 31, 2018
src Version bump. May 31, 2018
.gitignore Initial draft. May 29, 2018
.travis.yml Merge (squash) travis-ci-configuration branch May 30, 2018
LICENSE Initial commit May 28, 2018
README.md Update README.md Jun 20, 2018

README.md

Octave.NET Build Status NuGet

Octave.NET

πŸ“ˆ More than cross-platform Octave process wrapper πŸ”¬

Library is in an early stage and may not be suitable for real-time rocket physics

Motivation

Octave (matlab) has excellent library of ready to use components and lets us write simpler code for solving complex mathematical problems. This library is an attempt to bridge Octave and .NET worlds in a user-friendly and cross-platform manner while keeping single code-base and clean interface.

Installation

PM> Install-Package Octave.NET

Usage

  • Install latest octave
  • Add bin folder to system PATH variable or specify path to octave-cli binary in your code
  • Check the 'examples' folder

Confirmed compatibility

OS Octave Status
Windows 10 4.4.0 βœ”οΈ
Ubuntu 16.04 LTS 4.2.2 βœ”οΈ

How It's Made?

This library spawns octave processes and controls them via standard streams (stdin, stdout and stderr). To keep optimal performance every time OctaveContext is disposed underlying octave-cli process is returned to the object pool, so we don't waste precious time on spawning new worker processes.

FAQ

Is there anything I should know before using it?

In single-threaded scenario, there will be only one worker process spawned. In multithreaded scenario, library will try to supply demand for OctaveContext's by spawning more processes until limit is reached - by default the number of logical processors in your machine. If the limit is reached and all workers are in use, calling thread will be locked until some worker is freed. You may be interested in OctaveContext.OctaveSettings.MaximumConcurrency global setting.

What about applications that rarely use octave, are my resources wasted on idle processes?

Nope! After few seconds of inactivity (no attempts to execute octave commands) internal pool will start to slowly release its resources.

Sounds good but I'm running [insert some difficult analysis method here] on every HTTP request and they may happen every second or every hour. Cold starts are killing me. What can I do?

If you don't mind few more MBs that are not released until your application is closed, you can use global configuration and set OctaveContext.OctaveSettings.PreventColdStarts = true; Just remember to do this before first OctaveContext is created!

I set some variables in octave but later when I tried to access them they were undefined!

OctaveContext is called octave context because... well, it represent single octave context at the given point of time. Even though processes are reused, it is not guaranteed that you will get the same process. Your safest bet is to do all the work in single using(var octave = new OctaveContext()) {...} block. Contexts will not be cleared. If you require that, simply send clear command.

XYZ function does not work in octave - I get undefined!

If your script does not work when you run it manually in octave, it won't work there. Make sure that all packages that you need are installed and loaded.

I try to display plot but nothing appears.

There is an 2D plot example for that. "Async" octave operations are not supported, every operation should be locking and synchronous.