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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Solving linear equations with help of NAG Library
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tillomat

Austria
Posts

Posted - 11/12/2015 :  09:50:12 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Sophy

China
Posts

Posted - 11/12/2015 :  10:37:15 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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;
} 
Go to Top of Page

tillomat

Austria
Posts

Posted - 11/13/2015 :  1:57:36 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Sophy,

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

Best Regards,
Till
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000