[Top][All Lists]

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

Re: error: feval: function 'pkg.m' not found

From: ola
Subject: Re: error: feval: function 'pkg.m' not found
Date: Fri, 11 Jan 2019 09:44:30 -0600 (CST)

Thank you! Your advice helped me to solve the problem.

Firstly, I added the path /usr/local/lib (with octave shared libraries) to
/etc/ It didn't help much.
The real solution was to use the linker option
/-Wl,-rpath=/usr/local/lib/octave/4.4.0/ with mkoctfile.

Now, I have one more octave-technical question about defining the structure
for function options (opt), e.g. balance(A, B, opt) or linsolve(A, B, opt).
I found that I can use the optimset() function for this purpose, but this
function has predefined possible optimization options. Among them there are
no options indicated for balance() or linsolve() functions [e.g. opt fields
for linesolve:].
If I use a random predefined field from optimset() in the program (e.g.
'ubound'), everything works, but this field is wrong for this function; if I
use the function-specific field, the optimset() returns an error: /warning:
optimset: unrecognized option: posdef/.
The question is: Is it possible to add a new field to the optimset()
function or are there pairs of corresponding fields (one from optimset() and
one from any function) or can I create in other way a struct of opts('key',
'value') from the c++ code level (e.g. using #include <lo-regexp.h>?  What
is the exact type of octave_struct opts - is it sth like
std::vector<std::pair&lt;T, T>> or can I call exact octave_struct for opts
(what is the name) just like I call the octave_struct 'Matrix'?

*Here is the code:*
#include <iostream>
#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/parse.h>
#include <octave/interpreter.h>
int main (void) {
  octave::interpreter interpreter;
  int status = interpreter.execute ();
  if (status != 0) {
    std::cerr << "creating embedded Octave interpreter failed!\n";
    return status;
    octave::feval ("pkg", ovl ("load", "optim"), 0);       //works :)

    octave_value_list rval1 = octave::feval("rand", ovl(2, 2), 1);
    Matrix A(rval1(0).matrix_value());
    octave_value_list rval2 = octave::feval("rand", ovl(2, 2), 1);
    Matrix B(rval2(0).matrix_value());

    octave_value_list val = octave::feval("optimset", ovl("ubound", 1), 1);     
//'unbound' from optimset() list - works
 //   octave_value_list val = octave::feval("optimset", ovl("posdef",
"true"), 1);    //'posdef' from linsolve fields - doesn't work
    octave_value_list retval4 = octave::feval("linsolve", ovl(A, B, val(0)),
    Matrix D(retval4(0).matrix_value());

I would be very grateful if you help me one more time.

Sent from:

reply via email to

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