The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Solving linear equations with help of NAG Library

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
tillomat Posted - 11/12/2015 : 09:50:12 AM
Hello,

I am currently trying to solve complex linear equations with the help of the NAG library by using nag_complex_lin_eqn_mult_rhs (f04adc). However, I am not really successful doing it. The library function document is unfortunately not a great help. The following code is used for testing:

#include <Origin.h>
#include <OC_nag8.h>
#include <NAG\OC_nag_ex.h>
#include <NAG\nagx04.h>
#include <NAG\nag_stdlib.h>
#include <NAG\nagf04.h>

void test()
{

Complex a[4], b[2], x[2];
int i;
NagError fail;


a[0].re= 1;
a[0].im= 0;
a[1].re= 1;
a[1].im= 2;
a[2].re= 1;
a[2].im= 1;
a[3].re= 0;
a[3].im= 3;

b[0].re= 1;
b[0].im= 0;
b[1].re= 0;
b[1].im= 0;


printf("Solution\n");
for (i = 0; i < 4; i++)
printf("(%7.4f, %7.4f)\n", a[i].re, a[i].im);

printf("Solution\n");
for (i = 0; i < 2; i++)
printf("(%7.4f, %7.4f)\n", b[i].re, b[i].im);

nag_complex_lin_eqn_mult_rhs(2, 1, a, 2, b, 1, x, 1, &fail);

}

The error which I get is : "cannot convert argument in function call". I know this can happen in case a callback function is not correctly defined but in this case none is needed. I would really appreciate your help.

Kind Regards,
Till
2   L A T E S T    R E P L I E S    (Newest First)
tillomat Posted - 11/13/2015 : 1:57:36 PM
Dear Sophy,

thank you for your help! It now works absolutely fine.

Best Regards,
Till
Sophy Posted - 11/12/2015 : 10:37:15 PM
hi, Till:

Complex is a struct data type in nag, while complex is built-in data type in Origin C, please update to code like the following:

#include <Origin.h>
#include <OC_nag8.h>
#include <NAG\OC_nag_ex.h>
#include <NAG\nagx04.h>
#include <NAG\nag_stdlib.h>
#include <NAG\nagf04.h> 

void test()
{

complex a[4], b[2], x[2];
int i;
NagError fail;


a[0].m_re= 1;
a[0].m_im= 0;
a[1].m_re= 1;
a[1].m_im= 2;
a[2].m_re= 1;
a[2].m_im= 1;
a[3].m_re= 0;
a[3].m_im= 3;

b[0].m_re= 1;
b[0].m_im= 0;
b[1].m_re= 0;
b[1].m_im= 0;


printf("Solution\n");
for (i = 0; i < 4; i++)
printf("(%7.4f, %7.4f)\n", a[i].m_re, a[i].m_im);

printf("Solution\n");
for (i = 0; i < 2; i++)
printf("(%7.4f, %7.4f)\n", b[i].m_re, b[i].m_im);

nag_complex_lin_eqn_mult_rhs(2, 1, a, 2, b, 1, x, 1, &fail);
return;
} 

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000