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: c .
Subject: Re: Using mldivide function of Octave in C++?
Date: Wed, 4 Jun 2014 12:12:57 +0200

On 4 Jun 2014, at 06:19, Jeremy Yan <address@hidden> wrote:
> On 4 Jun 2014, at 00:22, Jeremy Yan <address@hidden> wrote:
>> On Tue, Jun 3, 2014 at 2:27 PM, c. <address@hidden> wrote:
>> On 3 Jun 2014, at 19:47, Jeremy Yan <address@hidden> wrote:
>> 
>>> Dear c.,
>>> 
>>> Thank you! Maybe I should be more specific and clear. Yes, I read the 
>>> sample code you sent me and I can run it successfully.
>>> 
>>> But, my real question is about what is the right way to use Fmldivide?  I 
>>> want to solve Ax=b. But the instruction of Fmldivide is not so clear about 
>>> what arguments one should put in. I tried the simple attached code by 
>>> following most of your sample code. However, it doesn't work. If you can 
>>> have a look at it, I will be very grateful.
>>> 
>>> Thanks for your patience and kind help!
>>> 
>>> Bests,
>>> Jeremy
>> 
>> please use bottom posting if you want me to answer your question.
>> c.
>> 
>> Thank you c. Now I know how reply in bottom posting :) 
>> 
>>> But, my real question is about what is the right way to use Fmldivide?  I 
>>> want to solve Ax=b. But the instruction of Fmldivide is not so clear about 
>>> what arguments one should put in. I tried the simple attached code by 
>>> following most of your sample code. However, it doesn't work. If you can 
>>> have a look at it, I will be very grateful.
>> 
>> Can you please answer my question? Thank you!
> Yes, I will, if you remember to add the list in CC.
> c.
> 
>  Sorry. I assume I should CC to address@hidden Please let me know and correct 
> me if I am wrong.
> Thank you!

Jeremy,

The answer to your question was already in Pantxo's message,
wich can be summarized as:

----------------------------
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?

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?


> -- 
> Best regards,
> Jeremy
c.


reply via email to

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