/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:08 */
/*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_ccoef s=dbov str=l x=f - prototypes */
#include <math.h>
#include "fcrt.h"
#include <stdio.h>
#include <stdlib.h>
#include "p_ccoef.h"
/*     program DRCCOEF
 *>> 1996-06-25 DRCCOEF Krogh Set for deriving C vers.
 *>> 1994-07-15 CLL
 *>> 1987-12-09 DRCCOEF  Lawson  Initial Code.
 * Conversion should only be done from "Z" to "C" for processing to C.
 *--C replaces "?": DR?COEF, ?COEF
 *     Demo driver for CCOEF
 *     C. L. Lawson & S. Chiu, JPL, 1987 Feb 17.
 *     ------------------------------------------------------------------ */
 
int main( )
{
	long int i, _i, _r;
	float zc[4][2];
	static float rt1[3][2], rt2[2][2];
	static long ndeg1 = 3;
	static long ndeg2 = 2;
	static int _aini = 1;
	if( _aini ){ /* Do 1 TIME INITIALIZATIONS! */
		{ static float _itmp0[] = {1.e0,1.e0,3.e0};
		for (i = 1, _r = 0; i <= 3; i++)
		{
			rt1[i - 1][0] = _itmp0[_r++];
			}
		}
		{ static float _itmp1[] = {1.e0,-1.e0,0.e0};
		for (i = 1, _r = 0; i <= 3; i++)
		{
			rt1[i - 1][1] = _itmp1[_r++];
			}
		}
		{ static float _itmp2[] = {2.e0,3.e0};
		for (i = 1, _r = 0; i <= 2; i++)
		{
			rt2[i - 1][0] = _itmp2[_r++];
			}
		}
		{ static float _itmp3[] = {1.e0,2.e0};
		for (i = 1, _r = 0; i <= 2; i++)
		{
			rt2[i - 1][1] = _itmp3[_r++];
			}
		}
		_aini = 0;
	}
 
	/*     ------------------------------------------------------------------
	 * */
 
	ccoef( ndeg1, rt1, zc );
	/*++ CODE for ~.C. is inactive
	 *  100 format(1X/1X,A,I3)
	 *  200 format(1x,A/ (1X,'(',F12.9,',',F12.9,')':
	 *     *                 ' (',F12.9,',',F12.9,')'))
	 *      print 100,'Degree   =',NDEG1
	 *      print 200,'Roots    =',(RT1(1,I),RT1(2,I),I=1,NDEG1)
	 *      print 200,'Coeffs   =',(ZC(1,I),ZC(2,I),I=1,NDEG1+1)
	 *      print '(/)'
	 *c
	 *      call CCOEF(NDEG2,RT2,ZC)
	 *      print 100,'Degree   =',NDEG2
	 *      print 200,'Roots    =',(RT2(1,I),RT2(2,I),I=1,NDEG2)
	 *      print 200,'Coeffs   =',(ZC(1,I),ZC(2,I),I=1,NDEG2+1)
	 *++ CODE for .C. is active */
   printf(" \n Degree   =%3ld", ndeg1);
   printf(" \n Roots    =\n");
   for (i = 0; i < ndeg1; i+=2){
      printf(" (%12.9f,%12.9f )", rt1[i][0], rt1[i][1]);
      if (i < ndeg1-1) printf("  (%12.9f,%12.9f )", rt1[i+1][0], rt1[i+1][1]);
      printf("\n");}
   printf(" \n  Coeffs   =\n");
   for (i = 0; i <= ndeg1; i+=2){
      printf(" (%12.9f,%12.9f )", zc[i][0], zc[i][1]);
      if (i < ndeg1) printf("  (%12.9f,%12.9f )", zc[i+1][0], zc[i+1][1]);
      printf("\n");}
 
   printf("\n\n");
   ccoef( ndeg2, rt2, zc );
   printf(" \n Degree   =%3ld", ndeg2);
   printf(" \n Roots    =\n");
   for (i = 0; i < ndeg2; i+=2){
      printf(" (%12.9f,%12.9f )", rt2[i][0], rt2[i][1]);
      if (i < ndeg2-1) printf("  (%12.9f,%12.9f )", rt2[i+1][0], rt2[i+1][1]);
      printf("\n");}
   printf(" \n  Coeffs   =\n");
   for (i = 0; i <= ndeg2; i+=2){
      printf(" (%12.9f,%12.9f )", zc[i][0], zc[i][1]);
      if (i < ndeg2) printf("  (%12.9f,%12.9f )", zc[i+1][0], zc[i+1][1]);
      printf("\n");}
	exit(0);
} /* end of function */
/*++ END */