RogueWave?


Kevin Dolan
06-11-2002, 08:39 AM
I am curious about using NR C++ with the RogueWave Math.h++ libraries.

I know that my wrapper class must deal with the fact that RW indexes matrices with (i, J) rather than [i][j]. What really concerns me is the fact that RW works with views of data. This leads me to the following questions:

1) Do any of the NR routines explicitely use the copy constructor to create copies of data that can be modified without modifying the original data? for example:


void func(Vec_I_DP &x)
{
Vec_DP y(x);
for (int i = 0; i < y.size(); i++)
y[i] *= i;

...
}


2) Do any of the NR routines use the matrix subscripting operator to directly access a pointer to a column of a matrix?

3) Do any of the NR routines use the assignement operator to resize vectors or matrices?


Thanks,

Kevin Dolan

Saul Teukolsky
06-14-2002, 07:43 PM
Hi Kevin,

The copy constructor is not used in any of the Recipes. It is used in a few of the demo programs, mainly in initializing matrices:

Mat_DP ai=a;

It is easy to work around this if necessary.

Nowhere is a row of a matrix accessed with [].
Nowhere is resizing done by assignment.

If you get something working, please consider submitting it to our User Contributions. Just send e-mail to nr@nr.com.

Saul Teukolsky

Kevin Dolan
06-15-2002, 02:58 PM
Thanks for the reply.

Actually, since I posted this question, I have started working on a set of vector and matrix classes of my own. I am using a view model similar to that of RogueWave though, so I am glad to here that a copy constructor that produces shallow copies won't pose a serious problem for the recipes.

Kevin Dolan