/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:16 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_shtcc s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_shtcc.h" /* program DRSHTCC *>> 1994-10-19 DRSHTCC Krogh Changes to use M77CON *>> 1987-12-09 DRSHTCC Lawson Initial Code. * Demo driver for SHTCC, Householder transformations. *--S replaces "?": DR?HTCC, ?HTCC, ?MATP */ /* PARAMETER translations */ #define IDIM 3 #define JDIM 5 #define M 3 #define N 2 #define ZERO 0.0e0 /* end of PARAMETER translations */ int main( ) { long int j, _i, _r; float uparam; static float d[JDIM][IDIM]; static int _aini = 1; if( _aini ){ /* Do 1 TIME INITIALIZATIONS! */ { static float _itmp0[] = {0.870e0,0.796e0,1.0e0,0.0e0,0.0e0}; for (j = 1, _r = 0; j <= 5; j++) { d[j - 1][0] = _itmp0[_r++]; } } { static float _itmp1[] = {0.571e0,-0.804e0,0.0e0,1.0e0,0.0e0}; for (j = 1, _r = 0; j <= 5; j++) { d[j - 1][1] = _itmp1[_r++]; } } { static float _itmp2[] = {-0.960e0,0.346e0,0.0e0,0.0e0,1.0e0}; for (j = 1, _r = 0; j <= 5; j++) { d[j - 1][2] = _itmp2[_r++]; } } _aini = 0; } /* ------------------------------------------------------------------ */ printf("DRSHTCC.. Demonstrate computation of a QR decomposition.\n"); printf("Given matrix A, compute orthogonal Q and triangular R\n"); printf("such that A = Q * R.\n"); smatp( (float*)d, IDIM, M, N, "0 A =" ); for (j = 1; j <= N; j++) { shtcc( 1, j, j + 1, M, &d[j - 1][0], &uparam, &d[j][0], IDIM, M + N - j ); } smatp( &d[N][0], IDIM, M, M, "0 Q [Transposed] =" ); d[0][1] = ZERO; d[0][2] = ZERO; d[1][2] = ZERO; smatp( (float*)d, IDIM, M, N, "0 R =" ); exit(0); } /* end of function */