J
jccorreu
I'm taking in data from multiple files that represents complex numbers
for charateristics of different elements. I begin with arrays of
doubles and interpolate to get standard values in real and imaginary
portions. To this end I have some dynamic arrays of doubles to hold
the standardized individual rael and imaginary parts.
double *ANreal, *ANimag, *BNreal, *BNimag, *CNreal, *CNimag;
ANreal = new double[num];
ANimag = new double[num];
etc....
Later I want to combine the seperate portions into the complex class.
complex<double> *AN, *BN, *CN;
AN = new complex<double>[count];
etc...
AN.real = ANreal[k];
AN.imag = ANreal[k];
etc...
but this is not working. I get an error that forming
apointer-to-member requires use the address-of operator (''.), and that
"=" overloaded function as left operand. I do not want to use vectors,
I want to do it using this paradigm so I can better learn its
intricacies. When I use the -> operator in place of the .dot i am told
that std::complex<double> does not have that overloaded member
operator, and that left of ->real must point to class/struct. If I
throw either a * or & out front I get illegal operaton on bound member
function.
Later I will use an array of pointers to these arrays of class objects
complex<double> **BigN[4] = {*AN, *CN, *BN, *CN};
so I can do the actual caclulations that this all builds up to, using a
loop within a loop, so that I can go through the first element in each
array in the order the arrays are listed in BigN, then go to the next
element in each array in that order. Something like:
for(int i = 0; i<count; i++)
{
for(int j = 0; j<3; j++)
{
result[j]=BigN[j] * BigN[j+1] etc...;
}
*AN++;
*BN++;
*CN++;
}
So the main question I have here is how to set the real and imaginary
parts of the objects in the array of class complex<double>.
thanks in advance
James
for charateristics of different elements. I begin with arrays of
doubles and interpolate to get standard values in real and imaginary
portions. To this end I have some dynamic arrays of doubles to hold
the standardized individual rael and imaginary parts.
double *ANreal, *ANimag, *BNreal, *BNimag, *CNreal, *CNimag;
ANreal = new double[num];
ANimag = new double[num];
etc....
Later I want to combine the seperate portions into the complex class.
complex<double> *AN, *BN, *CN;
AN = new complex<double>[count];
etc...
AN.real = ANreal[k];
AN.imag = ANreal[k];
etc...
but this is not working. I get an error that forming
apointer-to-member requires use the address-of operator (''.), and that
"=" overloaded function as left operand. I do not want to use vectors,
I want to do it using this paradigm so I can better learn its
intricacies. When I use the -> operator in place of the .dot i am told
that std::complex<double> does not have that overloaded member
operator, and that left of ->real must point to class/struct. If I
throw either a * or & out front I get illegal operaton on bound member
function.
Later I will use an array of pointers to these arrays of class objects
complex<double> **BigN[4] = {*AN, *CN, *BN, *CN};
so I can do the actual caclulations that this all builds up to, using a
loop within a loop, so that I can go through the first element in each
array in the order the arrays are listed in BigN, then go to the next
element in each array in that order. Something like:
for(int i = 0; i<count; i++)
{
for(int j = 0; j<3; j++)
{
result[j]=BigN[j] * BigN[j+1] etc...;
}
*AN++;
*BN++;
*CN++;
}
So the main question I have here is how to set the real and imaginary
parts of the objects in the array of class complex<double>.
thanks in advance
James