Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > typedef double complex[2]

Reply
Thread Tools

typedef double complex[2]

 
 
seia0106
Guest
Posts: n/a
 
      05-11-2004
Hello,
I have an array
X=[0,0,1,0,0,0,-1,0,0,0,1,0,0,0,-1,0], whose even and odd indices
should represent
real and imaginary parts of complex numbers.
This I want to use in a routine that uses the
typedef double Cx[2]; for storing complex numbers.

I want to declare an array of complex numbers(with 8 elements) of this
type(Cx), such that even and odd indices of array X are loaded as real
and imaginary parts of complex numbers of this array. Would someone
please tell me how this can be done?

Thanks.
 
Reply With Quote
 
 
 
 
Kevin Bracey
Guest
Posts: n/a
 
      05-11-2004
In message <(E-Mail Removed) >
http://www.velocityreviews.com/forums/(E-Mail Removed) (seia0106) wrote:

> Hello,
> I have an array
> X=[0,0,1,0,0,0,-1,0,0,0,1,0,0,0,-1,0], whose even and odd indices
> should represent
> real and imaginary parts of complex numbers.
> This I want to use in a routine that uses the
> typedef double Cx[2]; for storing complex numbers.
>
> I want to declare an array of complex numbers(with 8 elements) of this
> type(Cx), such that even and odd indices of array X are loaded as real
> and imaginary parts of complex numbers of this array. Would someone
> please tell me how this can be done?


Given the typedef, an array of complex numbers can be defined and initialised
as:

Cx myarray[8] = { {0,0}, {1,0}, {0,0}, {-1,0},
{0,0}, {1,0}, {0,0}, {-1,0} };

The inner braces can be optionally omitted, but it's probably best to
keep them for clarity.

Does that answer your question?

--
Kevin Bracey, Principal Software Engineer
Tematic Ltd Tel: +44 (0) 1223 503464
182-190 Newmarket Road Fax: +44 (0) 1223 503458
Cambridge, CB5 8HE, United Kingdom WWW: http://www.tematic.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Typedef for float or double PeteUK C++ 8 07-20-2009 03:55 PM
CRTP-problem: How can the base class typedef a derived class' typedef? oor C++ 0 05-20-2008 12:39 PM
from List <double> to double[] Web learner ASP .Net 3 04-26-2006 05:26 PM
cannot convert parameter from 'double (double)' to 'double (__cdecl *)(double)' error Sydex C++ 12 02-17-2005 06:30 PM
Double double display display problem problem Tom Accuosti Firefox 3 09-27-2004 10:02 PM



Advertisments