Home | Trees | Indices | Help |
---|
|
Lets octave functions calculate things, collects results as numpy-matrices. Example usage qz decomposition with octave syntax [AA,BB,Q,Z,V,W,lambda] = qz(A,B): 1) "session approach" myoct = octave4numpy() myoct.definemats(['A', 'B'], [a, b]) # a and b: numpy arrays/matrices (AA,BB,Q,Z,V,W,lda) = myoct.execfunc('qz', ['A', 'B'], 7) # (7 is the number of returned objects, must be specified here in advance!) # (possibly execute other funcs after this) myoct.close() 2) or the "shortcut approach", quick way for one-time use: myoct = octave4numpy('qz', (a, b), 7) (AA,BB,Q,Z,V,W,lda) = myoct.results # (connection to octave is automatically closed in this variant) If something else than 'octave' is needed to invoke your octave version, specify the command string in optional keyword arg cmd, like so: myoct = octave4numpy(cmd = 'octave2.0') The user should not pass 1d-numpy-arrays; be explicit about row or col! to do: - test on windows - allow to set precision - test if it also works with complex numbers (it should) ...
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
opens the octave connection via pipes (is this really cross-platform?) optionally already executes a function for quick use, func is the name of an octave function; then assignments must match the number of return objects from that specific octave function |
transfers matrices (values, can be 1x1) to octave for further use names must be valid denominator strings examples: myoct.definemats('a', m) myoct.definemats(['a', 'b'], [m1, m2]) (since octave also accepts j for imaginary parts, should also work for complex numbers) |
parse (and thereby chop off) octave's stdout Converting the string to a numpy matrix is left to another method. |
creates numpy matrix from octave's matrix printout only one matrix per call should be passed |
executes an octave function call and returns matrix results For example, the octave function [AA,BB,Q,Z,V,W] = qz(A,B) would be called by (a, b, q, z, v, w) = myoctconn.exefunc('qz', ['myA', 'myB'], 6) The arg names must be given as strings, and must have been defined in octave before with definemats. If there's only one arg, it is admissible to provide just one arg string instead of an 1-element list |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Nov 4 13:39:28 2008 | http://epydoc.sourceforge.net |