Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complex Numbers

Status
Not open for further replies.

gbade

Technical User
Jun 1, 2001
2
0
0
GB
I have a project involving multiplications, divisions, inverses etc of large matrices of complex numbers ( of form a + jb )and will require some assistance in handling such with the 'c' language. Can anyone help with some suggestions? Books i have read did not offer typical pathways to solving problems of this nature.
Is there any community or forum that deals with such?
Are there any available resources on the web with examples of similar problems?
 
The best idea is to use C++ with operators voerloading and C++ classes. But in C you can do:
typedef tagcomplex
{
int r;
int i;
}complex;

complex add(complex a,complex b);
complex otherfunctions...
int main()
{
complex x;
complex y[10];
complex z[10][10];
return 0;
}
complex add(complex a,complex b)
{
complex z;
z.r=a.r+b.r;
z.i=a.i+b.i;
return z;
}
John Fill
1c.bmp


ivfmd@mail.md
 
Same as the one above. I would suggest you use pointers instead.

i.e complex add(const complex *a,const complex *b)

will prove to be faster (just for the heck of it).
 
If you work in C++ I suggest you to use overloaded operators and references instead of functions and pointers. John Fill
1c.bmp


ivfmd@mail.md
 
Hello:

One of the best books I have found on this type of programming is
Numerical Recipes In C
The Art Of Scientific Computing
Press, Flannery, Teukolsky and Vetterling
ISBN 0-521-35465-X

Hope that helps.
 
Thanks to all who have helped out on this thread. I am working slowly and will request once i get stuck again. I am ordering the Numerical recipes book also.
Gbade.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top