Skip to content

Commit

Permalink
qrfactor.c: prototypes
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin PELLEMOINE committed May 23, 2024
1 parent d65eac6 commit 5019ce5
Showing 1 changed file with 13 additions and 34 deletions.
47 changes: 13 additions & 34 deletions src/cpp/meschach/mesch12a/src/qrfactor.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ extern VEC *Usolve(); /* See matrix2.h */
/* QRfactor -- forms the QR factorisation of A -- factorisation stored in
compact form as described above ( not quite standard format ) */
/* MAT *QRfactor(A,diag,beta) */
MAT *QRfactor(A,diag)
MAT *A;
VEC *diag /* ,*beta */;
MAT *QRfactor(MAT *A, VEC *diag)
//VEC *diag /* ,*beta */;
{
u_int k,limit;
Real beta;
Expand Down Expand Up @@ -98,10 +97,8 @@ VEC *diag /* ,*beta */;
-- factorisation stored in compact form as described above
( not quite standard format ) */
/* MAT *QRCPfactor(A,diag,beta,px) */
MAT *QRCPfactor(A,diag,px)
MAT *A;
VEC *diag /* , *beta */;
PERM *px;
MAT *QRCPfactor(MAT *A, VEC *diag, PERM *px)
//VEC *diag /* , *beta */;
{
u_int i, i_max, j, k, limit;
static VEC *gamma=VNULL, *tmp1=VNULL, *tmp2=VNULL;
Expand Down Expand Up @@ -181,9 +178,7 @@ PERM *px;
/* Qsolve -- solves Qx = b, Q is an orthogonal matrix stored in compact
form a la QRfactor() -- may be in-situ */
/* VEC *_Qsolve(QR,diag,beta,b,x,tmp) */
VEC *_Qsolve(QR,diag,b,x,tmp)
MAT *QR;
VEC *diag /* ,*beta */ , *b, *x, *tmp;
VEC *_Qsolve(MAT *QR, VEC *diag, VEC *b, VEC *x, VEC *tmp)
{
u_int dynamic;
int k, limit;
Expand Down Expand Up @@ -222,9 +217,7 @@ VEC *diag /* ,*beta */ , *b, *x, *tmp;
/* makeQ -- constructs orthogonal matrix from Householder vectors stored in
compact QR form */
/* MAT *makeQ(QR,diag,beta,Qout) */
MAT *makeQ(QR,diag,Qout)
MAT *QR,*Qout;
VEC *diag /* , *beta */;
MAT *makeQ(MAT *QR, VEC *diag, MAT *Qout)
{
static VEC *tmp1=VNULL,*tmp2=VNULL;
u_int i, limit;
Expand Down Expand Up @@ -272,8 +265,7 @@ VEC *diag /* , *beta */;

/* makeR -- constructs upper triangular matrix from QR (compact form)
-- may be in-situ (all it does is zero the lower 1/2) */
MAT *makeR(QR,Rout)
MAT *QR,*Rout;
MAT *makeR(MAT *QR, MAT *Rout)
{
u_int i,j;

Expand All @@ -291,9 +283,7 @@ MAT *QR,*Rout;
/* QRsolve -- solves the system Q.R.x=b where Q & R are stored in compact form
-- returns x, which is created if necessary */
/* VEC *QRsolve(QR,diag,beta,b,x) */
VEC *QRsolve(QR,diag,b,x)
MAT *QR;
VEC *diag /* , *beta */ , *b, *x;
VEC *QRsolve(MAT *QR, VEC *diag, VEC *b, VEC *x)
{
int limit;
static VEC *tmp = VNULL;
Expand All @@ -317,11 +307,7 @@ VEC *diag /* , *beta */ , *b, *x;
/* QRCPsolve -- solves A.x = b where A is factored by QRCPfactor()
-- assumes that A is in the compact factored form */
/* VEC *QRCPsolve(QR,diag,beta,pivot,b,x) */
VEC *QRCPsolve(QR,diag,pivot,b,x)
MAT *QR;
VEC *diag /* , *beta */;
PERM *pivot;
VEC *b, *x;
VEC *QRCPsolve(MAT *QR, VEC *diag, PERM *pivot, VEC *b, VEC *x)
{
static VEC *tmp=VNULL;

Expand All @@ -339,9 +325,7 @@ VEC *b, *x;

/* Umlt -- compute out = upper_triang(U).x
-- may be in situ */
static VEC *Umlt(U,x,out)
MAT *U;
VEC *x, *out;
static VEC *Umlt(MAT *U, VEC *x, VEC *out)
{
int i, limit;

Expand All @@ -359,9 +343,7 @@ VEC *x, *out;
}

/* UTmlt -- returns out = upper_triang(U)^T.x */
static VEC *UTmlt(U,x,out)
MAT *U;
VEC *x, *out;
static VEC *UTmlt(MAT *U, VEC *x, VEC *out)
{
Real sum;
int i, j, limit;
Expand All @@ -386,9 +368,7 @@ VEC *x, *out;
compact form
-- returns sc
-- original due to Mike Osborne modified Wed 09th Dec 1992 */
VEC *QRTsolve(A,diag,c,sc)
MAT *A;
VEC *diag, *c, *sc;
VEC *QRTsolve(MAT *A, VEC *diag, VEC *c, VEC *sc)
{
int i, j, k, n, p;
Real beta, r_ii, s, tmp_val;
Expand Down Expand Up @@ -445,8 +425,7 @@ VEC *diag, *c, *sc;
-- if the matrix is exactly singular, HUGE is returned
-- note that QRcondest() is likely to be more reliable for
matrices factored using QRCPfactor() */
double QRcondest(QR)
MAT *QR;
double QRcondest(MAT *QR)
{
static VEC *y=VNULL;
Real norm1, norm2, sum, tmp1, tmp2;
Expand Down

0 comments on commit 5019ce5

Please sign in to comment.