home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d01xx
/
d0164.lha
/
Newton
/
ds.c
< prev
next >
Wrap
C/C++ Source or Header
|
1988-11-22
|
775b
|
48 lines
/* ds.c: Data structure routines.
*
* Written by Daniel Barrett. 100% PUBLIC DOMAIN. */
#include "decl.h"
InitPoly(poly, n)
/* Initialize the polynomial to all zeroes. */
complex poly[];
int n;
{
int i;
for (i=0; i<n; i++)
AssignComplex(&poly[i], 0.0, 0.0);
}
AssignComplex(comp, realPart, imagPart)
/* Assign the real & imaginary parts to a complex number. */
complex *comp;
double realPart, imagPart;
{
comp->n[REAL] = realPart;
comp->n[IMAG] = imagPart;
}
CopyPoly(poly1, poly2, degree)
/* Copy poly1 into poly2. */
complex poly1[], poly2[];
int degree;
{
int i;
for (i=0; i<=degree; i++)
CopyComplex(poly1[i], &poly2[i]);
}
CopyComplex(c1, c2)
/* Copy complex number c1 into c2. */
complex c1, *c2;
{
AssignComplex(c2, c1.n[REAL], c1.n[IMAG]);
}