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
 Getting data from Matrix/Vector into NAG functions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Frank_H

Germany
Posts

Posted - 04/03/2006 :  1:09:53 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5 SR6
Operating System: XP

Dear all

I want to use some routines from the NAG library. The problem is that the NAG functions are not prototyped to use matrix or vector but instead always use 1d arrays like double[]. I would expect that within the matrix or the vector object there is such an array, but I did not find any method which would allow me to get an appropiate pointer. But there has to be a better method than a nested loop copying each entry into a new array before calling the NAG function. Any ideas how to do it more efficiently and even better perhaps without creating an unnecessary copy of the data?

Cheers,
Frank

Frank_H

Germany
Posts

Posted - 04/03/2006 :  1:19:57 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I admit, I am guilty of not searching carefully enough:
The solution is already in the forum
http://www.originlab.com/forum/topic.asp?TOPIC_ID=1929
The following code was posted by easwar

void test_nag_real_lin_eqn()
{
int n = 3;
matrix a = { {33, 16, 72}, {-24, -10, -57}, {-8, -4, -17} };
vector b = {-359, 281, 85};
vector x(3);
nag_real_lin_eqn(n, a, n, b, x);
printf("Solution\n");
for (int i=0; i<n; i++)
printf("%9.4f\n",x[i]);
}

So I can directly plug my matrix and vector into the NAG functions.
Origin developers, please add a brief introduction on using the NAG library into the help file which explains these possibility (and any limitations if present).

Cheers,
Frank

Go to Top of Page

easwar

USA
1965 Posts

Posted - 04/06/2006 :  09:03:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

Origin developers, please add a brief introduction on using the NAG library into the help file which explains these possibility (and any limitations if present).



Dear Frank,

Thanks for the suggestion. We have a section in the Programming help file on calling NAG library, under the Programming Guide chapter, and we will work on adding more info to this section in the next version.

Easwar
OriginLab

Go to Top of Page

Frank_H

Germany
Posts

Posted - 04/07/2006 :  05:34:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Easwar

Thanks for pointing that out - I overlooked that part of the manual.
One suggestion: Is it possible to add a small introduction also to the section level of
Origin C Language Reference->Global Functions->NAG Functions
(similar to the ones for the object reference) which then also could contain a hyperlink to the chapter in the Programming Guide? Also usefull would be a kind of index to the NAG pdfs or perhaps for the help entry of each NAG function a reference to the full name of the NAG pdf file - the names of the pdf files are a bit cryptic :-)

Cheers,
Frank

Go to Top of Page

easwar

USA
1965 Posts

Posted - 04/07/2006 :  09:05:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Frank,

Thanks for the additional comments. We will look into improving this in the next version.

Easwar
OriginLab

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