help-octave
[Top][All Lists]
Advanced

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

Problem with a dynamically linked function


From: alejandro zamora soto
Subject: Problem with a dynamically linked function
Date: Thu, 5 May 2011 16:31:03 +0200

Dear all,

   I wrote a program with Octave and now I want to rewrite my functions in C++.

   First of all, I'm trying to use C++ to write a linked extension for Octave of a toy program that permutes  the indices
of a tensor, in Octave:

    function gamp=mi_funcion(gam,perm_index)
         gamp=permute(gam, perm_index);
    end

Then if i write this:


#include <octave/oct.h>
#include <iostream>

DEFUN_DLD(mi_funcion, args, ,
          "Return b = permute(a,perm_index).")
{
  const MArray<int> perm_index=args(1).array_value();
  MArray<double> a(args(0).array_value());  
 
  // std::cout << perm_index << std::endl;

 
    MArray<double> b( a.permute(perm_index));
    return octave_value(b);           
}

I don't have problems during the compilation with "mkoctfile",
But I have problems when I use this function:

"error: mi_funcion: permute: permutation vector contains an invalid element"

could you help me to solve this problem?


Kind regards,

Alex Zamora






reply via email to

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