help-octave
[Top][All Lists]
Advanced

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

How to use "do_colon_op" in an oct-file?


From: Lukas Reichlin
Subject: How to use "do_colon_op" in an oct-file?
Date: Thu, 15 Oct 2015 13:08:11 +0200

Dear Octave Community

I'm writing an oct-file [1] for the control package where I want to use the 
colon operator:

        octave_value mat_idx = do_colon_op (1, idx);

However, I get the following compiler error:

__lti_input_idx__.cc:50:28: error: use of undeclared identifier 'do_colon_op'
    octave_value mat_idx = do_colon_op (1, idx);
                           ^

How can I fix this error? Thanks in advance for every help!

Best regards,
Lukas


[1]
https://bitbucket.org/paramaniac/control/src/c9a860ebebc4e5894ac501d5962996b3148c55eb/src/__lti_input_idx__.cc?at=oct&fileviewer=file-view-default


#include <octave/oct.h>
//#include <octave/ov.h>
//#include <octave/ov-colon.h>


DEFUN_DLD (__lti_input_idx__, args, ,
       "-*- texinfo -*-\n\
@deftypefn {Built-in Function} {} ischar (@var{x})\n\
Return true if @var{x} is a character array.\n\
@seealso{isfloat, isinteger, islogical, isnumeric, iscellstr, isa}\n\
@end deftypefn")
{
  octave_value_list retval;
  octave_idx_type nargin = args.length ();

  if (nargin == 1 && args(0).is_defined () && args(0).is_cell ())
  {
    octave_idx_type len = args(0).cell_value().nelem();
    octave_idx_type idx = len;
    
    for (octave_idx_type i = 0; i < len; i++)
    {
      if (args(0).cell_value().elem(i).is_string ())
      {
        idx = i;
        break;
      }
    }
    
    octave_value mat_idx = do_colon_op (1, idx);
    octave_value opt_idx = do_colon_op (idx+1, len);

    retval(0) = mat_idx;
    retval(1) = opt_idx;
  }
  else
  {
    print_usage ();
  }

  return retval;
}






octave:1> makefile_control 
rm -rf *.o core octave-core *.oct *~ *.f slicot sltmp
LFLAGS="-L/sw/lib/octave/3.8.2 -L/sw/lib -L/sw/lib/lapack/3.5.0 -lreflapack 
-L/sw/lib/lapack/3.5.0 -lrefblas -L/sw/lib/gcc4.9/lib -lgfortran" \
    mkoctfile __control_slicot_functions__.cc common.cc slicotlibrary.a
mkoctfile is_real_scalar.cc
mkoctfile is_real_vector.cc
mkoctfile is_real_matrix.cc
mkoctfile is_real_square_matrix.cc
mkoctfile is_matrix.cc
mkoctfile nfields2.cc
mkoctfile __lti_input_idx__.cc
__lti_input_idx__.cc:50:28: error: use of undeclared identifier 'do_colon_op'
    octave_value mat_idx = do_colon_op (1, idx);
                           ^
__lti_input_idx__.cc:51:28: error: use of undeclared identifier 'do_colon_op'
    octave_value opt_idx = do_colon_op (idx+1, len);
                           ^
2 errors generated.
Makefile:69: recipe for target '__lti_input_idx__.oct' failed
make: *** [__lti_input_idx__.oct] Error 1
make: *** Waiting for unfinished jobs....
ld: warning: could not create compact unwind for _sb10yd_: stack subq 
instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _mb03xp_: stack subq 
instruction is too different from dwarf stack size
octave:2> 




reply via email to

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