/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:15 */
/*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_schol s=dbov str=l x=f - prototypes */
#include <math.h>
#include "fcrt.h"
#include <stdio.h>
#include <stdlib.h>
#include "p_schol.h"
/*     program DRSCHOL
 *>> 1996-06-17 DRSCHOL Krogh  Minor format change for C conversion.
 *>> 1996-05-28 DRSCHOL Krogh Added external statement.
 *>> 1994-10-19 DRSCHOL Krogh  Changes to use M77CON
 *>> 1994-08-09 DRSCHOL WVS remove '0' from formats
 *>> 1992-03-04 DRSCHOL Krogh Initial version.
 *  Demonstration driver for SCHOL
 *     ------------------------------------------------------------------
 *--S replaces "?": DR?CHOL, ?CHOL, ?DOT
 *     ------------------------------------------------------------------ */
		/* PARAMETER translations */
#define	LDP	2
#define	M	3
#define	N	2
		/* end of PARAMETER translations */
 
 
int main( )
{
	long int i, ierr, j, _i, _r;
	float d[LDP], p[LDP][LDP], u;
	static float a[N][M], b[M];
	static int _aini = 1;
		/* OFFSET Vectors w/subscript range: 1 to dimension */
	float *const B = &b[0] - 1;
	float *const D = &d[0] - 1;
		/* end of OFFSET VECTORS */
	if( _aini ){ /* Do 1 TIME INITIALIZATIONS! */
		a[0][0] = 0.7e0;
		a[1][0] = 0.6e0;
		B[1] = 1.726e0;
		a[0][1] = -0.8e0;
		a[1][1] = 0.5e0;
		B[2] = -5.415e0;
		a[0][2] = 0.6e0;
		a[1][2] = -0.7e0;
		B[3] = 5.183e0;
		_aini = 0;
	}
 
	/*     ------------------------------------------------------------------ */
	u = sdot( M, b, 1, b, 1 );
	for (i = 1; i <= N; i++)
	{
		D[i] = sdot( M, &a[i - 1][0], 1, b, 1 );
		for (j = 1; j <= N; j++)
		{
			p[j - 1][i - 1] = sdot( M, &a[i - 1][0], 1, &a[j - 1][0],
			 1 );
		}
	}
	schol( (float*)p, LDP, N, d, &u, 0.0e0, &ierr );
	printf(" X()   = %15.6f%15.6f\n", D[1], D[2]);
	printf(" RNORM = %15.6f\n", u);
	if (ierr != 0)
		{
		printf(" Matrix failed conditioning test in SCHOL, IERR = %3ld\n", ierr);
		}
	exit(0);
} /* end of function */