help-octave
[Top][All Lists]
Advanced

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

Re: Using mldivide function of Octave in C++?


From: Jeremy Yan
Subject: Re: Using mldivide function of Octave in C++?
Date: Wed, 4 Jun 2014 11:28:54 -0400




On Wed, Jun 4, 2014 at 6:12 AM, c. <address@hidden> wrote:
----------------------------
octave_value_list retval;
octave_value_list input;

Matrix A;
ColumnVector B;

// assign values

input.append (A);
input.append (B);

retval = Fmldivide (input);
----------------------------

If you want to get the result as a ColumnVector you can then do:

------
ColumnVector X = retval(0).column_vector_value ();
------

why is this answer not satisfying to you? is there anything
specific that you need clarified about it?
 
Dear c.
Thank you so much for the code. But it stills shows Segmentation fault: 11. It seems the input.append just appends the matrix A, and it cannot include the vector b in it. 
 
After Pantxo's reply I pointed out that you don't need to
call Fmldivide (which is a built-in function in liboctinterp)
but you can use methods in the liboctave class library directly
and do:

----------------------------
Matrix A;
ColumnVector B;

// assign values

ColumnVector X = A.solve (b);
----------------------------

which gives the same result with less overhead and fewer lines of code.
Why is this solution not satisfactory to you?

Thanks for pointing it out. Is A.solve(b) completely equivalent ( in algorithm ) to the powerful left matrix division function mldivide, even for big size linear equation? Thanks for your patience!



--
Best regards,
Jeremy

reply via email to

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