help-octave
[Top][All Lists]
Advanced

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

Re: mldivide function in C++ API


From: c.
Subject: Re: mldivide function in C++ API
Date: Mon, 2 Jun 2014 20:40:42 +0200

On 2 Jun 2014, at 14:47, Pantxo <address@hidden> wrote:

> Hello,
> 
> Fmldivide expects and octave_value_list as input argument. The following
> should work:
> 
> #include <octave/oct.h>
> #include <octave/builtin-defun-decls.h>
> 
> DEFUN_DLD(test_mldiv, args, nargout, "\
> test_mldiv\n\
> ")
> {
>  octave_value_list retval;
>  octave_value_list input;
> 
>  Matrix A = args(0).matrix_value ();
>  ColumnVector B = args(1).column_vector_value ();
> 
>  if (! error_state)
>    {
>      input.append (A);
>      input.append (B);
>      retval = Fmldivide (input); 
> // Alternatively, use ovl (...) to build an octave_value_list in-place:
> retval = Fmldivide (ovl (A, B));
>    }
> 
>  return retval;
> }
> 
> Does it work for you?
> 
> Pantxo


As shown in the example I ponted to in another thread where the same
person asked the same question, there is actually no need to use Fmldivide
from C++, as it actually takes less effort to get the same result by invoking
the method Matrix::solve :

 Matrix A = args(0).matrix_value ();
 ColumnVector B = args(1).column_vector_value ();
 ColumnVector x = A.solve (B);

c.





reply via email to

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