Octave's octave_value_list class.
More...
#include <Octave.H>
|
| Octave (const vector< std::string > &args) |
|
void | startOctave (const vector< std::string > &args) |
|
| Octave (void) |
|
virtual | ~Octave () |
| Destructor. More...
|
|
bool | isReady (void) |
|
void | stopOctaveAndExit () |
|
void | stopOctave () |
|
template<class TYPE > |
vector< vector< vector< TYPE > > > & | runM (const char *commandName, const vector< vector< vector< TYPE > > > &in, vector< vector< vector< TYPE > > > &out) |
|
template<class TYPE > |
vector< Eigen::Matrix< TYPE, Eigen::Dynamic, Eigen::Dynamic > > & | runM (const char *commandName, const vector< Eigen::Matrix< TYPE, Eigen::Dynamic, Eigen::Dynamic > > &in, vector< Eigen::Matrix< TYPE, Eigen::Dynamic, Eigen::Dynamic > > &out) |
|
octave_value_list | runMWithInput (const char *commandName) |
|
void | runM (const char *commandName) |
|
template<typename Derived > |
int | setGlobalVariable (const std::string &name, const Eigen::DenseBase< Derived > &var) |
|
int | setGlobalVariable (const std::string &name, Matrix &m) |
|
Octave_map | setGlobalSubVariable (const vector< std::string > &varNames, const Matrix &m, int index, octave_value &base) |
|
Octave_map | createGlobalSubVariable (const vector< std::string > &varNames, const Matrix &m, int index, Octave_map &base) |
|
void | clearAll (void) |
|
template<typename TYPE > |
Eigen::Matrix< TYPE, Eigen::Dynamic, 1 > | str2Mat (char *str) |
|
template<typename TYPE > |
Eigen::Matrix< TYPE, Eigen::Dynamic, 1 > | str2Mat (std::string str) |
|
template<typename TYPE > |
vector< TYPE > | str2Vec (std::string str) |
|
|
octave_value_list * | input |
| The inputs to pass to the octave .m file. More...
|
|
Octave's octave_value_list class.
Class to interface to GNU Octave (octave.org). Requires octave headers installed on the system.
First implementation is limited to matrix inputs and outputs to arbitrary .m files.
Usage like so :
vector<std::string> args(3); args[0]=std::string("--silent"); args[1]=std::string("--path"); args[2]=std::string("/tmp");
vector<Eigen::Matrix<float, Dynamic, Dynamic> >
input(1), output;
Eigen::Matrix<float, Dynamic, Dynamic> a(10,10); Eigen::Matrix<float, Dynamic, Dynamic>::Zero(10,10);
output = octave.runM(
"yourMFile",
input);
- Examples:
- AudioMaskerExample.C, ComplexFFTExample.C, FIRTest.C, IIRCascadeTest.C, IIRTest.C, OctaveOpenCVTest.C, OctaveTest.C, Real2DFFTExample.C, and RealFFTExample.C.
Definition at line 95 of file Octave.H.
◆ Octave() [1/2]
Octave::Octave |
( |
const vector< std::string > & |
args | ) |
|
Constructor starts an octave instance using args to pass to octave
- Parameters
-
args | Arguments to pass into octave |
Definition at line 74 of file Octave.C.
◆ Octave() [2/2]
Construct Octave, but don't start, make sure you call startOctave before you try to runM
Definition at line 55 of file Octave.C.
◆ ~Octave()
Destructor.
Definition at line 88 of file Octave.C.
◆ clearAll()
void Octave::clearAll |
( |
void |
| ) |
|
Clear everything.
Definition at line 377 of file Octave.C.
◆ createGlobalSubVariable()
Octave_map Octave::createGlobalSubVariable |
( |
const vector< std::string > & |
varNames, |
|
|
const Matrix & |
m, |
|
|
int |
index, |
|
|
Octave_map & |
base |
|
) |
| |
This method is used to construct the new branch from varNames[index] onwards.
- Parameters
-
varNames | The tokenised list of base names and find name from setGlobalVariable where the base1 name is stripped off. |
m | The matrix to set the global variable to. |
index | The current index into the varNames vector. |
base | The octave_value to search for the varNames index+1 in. |
Definition at line 352 of file Octave.C.
◆ deleteMatrix()
void Octave::deleteMatrix |
( |
Matrix * |
m | ) |
|
|
private |
◆ init()
void Octave::init |
( |
void |
| ) |
|
|
private |
Initialisation method common to all constructors.
Definition at line 63 of file Octave.C.
◆ isReady()
bool Octave::isReady |
( |
void |
| ) |
|
Check if octave is ready.
- Returns
- true if ready
- Examples:
- OctaveTest.C.
Definition at line 59 of file Octave.C.
◆ newMatrix()
Matrix * Octave::newMatrix |
( |
int |
r, |
|
|
int |
c |
|
) |
| |
|
private |
Method to create an octave matrix of a particular size : Matrix(r,c).
- See also
- setMatrixElem, deleteMatrix
- Parameters
-
r | The number of rows |
c | The number of cols |
Definition at line 366 of file Octave.C.
◆ runM() [1/3]
template<class TYPE >
vector< vector< vector< TYPE > > > & Octave::runM |
( |
const char * |
commandName, |
|
|
const vector< vector< vector< TYPE > > > & |
in, |
|
|
vector< vector< vector< TYPE > > > & |
out |
|
) |
| |
Runs the matlab script commandName+".m", passing in a vector of std matrices (a vector of a vector) and returning the out vector of matrices (vector of a vector). NOTE: All vector<vector<vector<TYPE> > > data types are vectors of matrices, where the vector.size() are the number of rows and vector[0].size() is the number of columns.
- Template Parameters
-
TYPE | The data type to input and return, must be a scalar type such as int, float, double, etc. |
- Parameters
-
commandName | The .m file name to run |
in | The vector of matrices (the vector of vectors of vectors) to input to the .m file. |
out | The vector of matrices (the vector of vectors of vectors) output from the .m file. |
- Returns
- The a reference to the variable out.
< Output variables returned from Octave
- Examples:
- AudioMaskerExample.C, ComplexFFTExample.C, FIRTest.C, IIRCascadeTest.C, IIRTest.C, OctaveOpenCVTest.C, OctaveTest.C, Real2DFFTExample.C, and RealFFTExample.C.
Definition at line 104 of file Octave.C.
◆ runM() [2/3]
template<class TYPE >
vector< Eigen::Matrix< TYPE, Eigen::Dynamic, Eigen::Dynamic > > & Octave::runM |
( |
const char * |
commandName, |
|
|
const vector< Eigen::Matrix< TYPE, Eigen::Dynamic, Eigen::Dynamic > > & |
in, |
|
|
vector< Eigen::Matrix< TYPE, Eigen::Dynamic, Eigen::Dynamic > > & |
out |
|
) |
| |
Runs the matlab script commandName+".m", passing in a vector of eigen matrices and returning the out vector of matrices which contains the results.
- Template Parameters
-
TYPE | The Eigen::Matrix types to input and return |
- Parameters
-
commandName | The .m file name to run |
in | The vector of Eigen::Matrix (the vector of matrices) to input to the .m file. |
out | The vector of Eigen::Matrix (the vector of matrices) output from the .m file. |
- Returns
- The a reference to the variable out.
< Output variables returned from Octave
Definition at line 169 of file Octave.C.
◆ runM() [3/3]
void Octave::runM |
( |
const char * |
commandName | ) |
|
Runs the matlab script commandName+".m", this version takes no input and output and returns no output.
- Parameters
-
commandName | The .m file name to run |
Definition at line 216 of file Octave.C.
◆ runMWithInput()
octave_value_list Octave::runMWithInput |
( |
const char * |
commandName | ) |
|
Runs the matlab script commandName+".m", this version takes no input (you can specify input by manually filling in the input class variable)
- Parameters
-
commandName | The .m file name to run |
- Returns
- The output variables are returned in an Octave octave_value_list
< Output variables returned from Octave
Definition at line 210 of file Octave.C.
◆ setGlobalSubVariable()
Octave_map Octave::setGlobalSubVariable |
( |
const vector< std::string > & |
varNames, |
|
|
const Matrix & |
m, |
|
|
int |
index, |
|
|
octave_value & |
base |
|
) |
| |
Method helpiing setGlobalVariable parse the global variabl structure at the base of name. This method searches an already existing octave_value class for the desired varName[index+1] path.
- Parameters
-
varNames | The tokenised list of base names and find name from setGlobalVariable where the base1 name is stripped off. |
m | The matrix to set the global variable to. |
index | The current index into the varNames vector. |
base | The octave_value to search for the varNames index+1 in. |
Definition at line 292 of file Octave.C.
◆ setGlobalVariable() [1/2]
template<typename Derived >
int Octave::setGlobalVariable |
( |
const std::string & |
name, |
|
|
const Eigen::DenseBase< Derived > & |
var |
|
) |
| |
|
inline |
Method to set an Eigen3 matrix or array as a global variable.
- Parameters
-
name | The global variable name of the following format "base1.base2.name" |
var | An Eigen3 Matrix, Vector or Array type. |
Definition at line 211 of file Octave.H.
◆ setGlobalVariable() [2/2]
int Octave::setGlobalVariable |
( |
const std::string & |
name, |
|
|
Matrix & |
m |
|
) |
| |
Method to set an octave matrix as a global variable.
- Parameters
-
name | The global variable name of the following format "base1.base2.name" |
m | An octave matrix to use for setting. |
Definition at line 273 of file Octave.C.
◆ setMatrixElem()
void Octave::setMatrixElem |
( |
Matrix * |
m, |
|
|
int |
i, |
|
|
int |
j, |
|
|
double |
val |
|
) |
| |
|
private |
Method to set an octave matrix : m.elem(i,j)=val;
- See also
- newMatrix, deleteMatrix
- Parameters
-
m | The matrix |
i | The row |
j | The col |
val | The value to set. |
Definition at line 369 of file Octave.C.
◆ startOctave()
void Octave::startOctave |
( |
const vector< std::string > & |
args | ) |
|
◆ stopOctave()
void Octave::stopOctave |
( |
| ) |
|
Stop the octave instance.
Definition at line 99 of file Octave.C.
◆ stopOctaveAndExit()
void Octave::stopOctaveAndExit |
( |
| ) |
|
Stop the octave instance and exit.
Definition at line 95 of file Octave.C.
◆ str2Mat() [1/2]
template<typename TYPE >
Eigen::Matrix<TYPE, Eigen::Dynamic, 1> Octave::str2Mat |
( |
char * |
str | ) |
|
|
inline |
Convert a std::string to a matrix.
- Parameters
-
- Returns
- A matrix containing the ascii representation of the str.
- Examples:
- OctaveTest.C.
Definition at line 253 of file Octave.H.
◆ str2Mat() [2/2]
template<typename TYPE >
Eigen::Matrix<TYPE, Eigen::Dynamic, 1> Octave::str2Mat |
( |
std::string |
str | ) |
|
|
inline |
Convert a std::string to a matrix.
- Parameters
-
- Returns
- A matrix containing the ascii representation of the str.
Definition at line 262 of file Octave.H.
◆ str2Vec()
template<typename TYPE >
vector<TYPE> Octave::str2Vec |
( |
std::string |
str | ) |
|
|
inline |
Convert a std::string to a vector.
- Parameters
-
- Returns
- A matrix containing the ascii representation of the str.
- Examples:
- OctaveTest.C.
Definition at line 271 of file Octave.H.
◆ input
octave_value_list* Octave::input |
The inputs to pass to the octave .m file.
Definition at line 122 of file Octave.H.
The documentation for this class was generated from the following files: