diff --git a/Meschach.pri b/Meschach.pri new file mode 100644 index 0000000..4c2101c --- /dev/null +++ b/Meschach.pri @@ -0,0 +1,71 @@ +INCLUDEPATH += $$PWD + +HEADERS += $$PWD/*.h + +# Only use the source files without a main function, +# so this file can be used for other programs to +# use Meschach +SOURCES += \ + $$PWD/arnoldi.c \ + $$PWD/bdfactor.c \ + $$PWD/bkpfacto.c \ + $$PWD/chfactor.c \ + $$PWD/conjgrad.c \ + $$PWD/copy.c \ + $$PWD/err.c \ + $$PWD/extras.c \ + $$PWD/fft.c \ + $$PWD/givens.c \ + $$PWD/hessen.c \ + $$PWD/hsehldr.c \ + $$PWD/init.c \ + $$PWD/iter0.c \ + $$PWD/iternsym.c \ + $$PWD/itersym.c \ + #$$PWD/itertort.c \ + $$PWD/ivecop.c \ + $$PWD/lanczos.c \ + $$PWD/lufactor.c \ + $$PWD/machine.c \ + $$PWD/matlab.c \ + $$PWD/matop.c \ + $$PWD/matrixio.c \ + $$PWD/meminfo.c \ + $$PWD/memory.c \ + $$PWD/memstat.c \ + $$PWD/mfunc.c \ + $$PWD/norm.c \ + $$PWD/otherio.c \ + $$PWD/pxop.c \ + $$PWD/qrfactor.c \ + $$PWD/schur.c \ + $$PWD/solve.c \ + $$PWD/sparse.c \ + $$PWD/sparseio.c \ + $$PWD/spbkp.c \ + $$PWD/spchfctr.c \ + $$PWD/splufctr.c \ + $$PWD/sprow.c \ + $$PWD/spswap.c \ + $$PWD/submat.c \ + $$PWD/svd.c \ + $$PWD/symmeig.c \ + $$PWD/update.c \ + $$PWD/vecop.c \ + $$PWD/version.c \ + $$PWD/zcopy.c \ + $$PWD/zfunc.c \ + $$PWD/zgivens.c \ + $$PWD/zhessen.c \ + $$PWD/zhsehldr.c \ + $$PWD/zlufctr.c \ + $$PWD/zmachine.c \ + $$PWD/zmatio.c \ + $$PWD/zmatlab.c \ + $$PWD/zmatop.c \ + $$PWD/zmemory.c \ + $$PWD/znorm.c \ + $$PWD/zqrfctr.c \ + $$PWD/zschur.c \ + $$PWD/zsolve.c \ + $$PWD/zvecop.c diff --git a/bkpfacto.c b/bkpfacto.c index 8eecdb5..df0bf54 100644 --- a/bkpfacto.c +++ b/bkpfacto.c @@ -51,10 +51,10 @@ static void interchange(A,i,j) MAT *A; /* assumed != NULL & also SQUARE */ int i, j; /* assumed in range */ { - Real **A_me, tmp; + Real tmp; int k, n; - A_me = A->me; n = A->n; + n = A->n; if ( i == j ) return; if ( i > j ) @@ -108,7 +108,7 @@ MAT *BKPfactor(MAT *A, PERM *pivot, PERM *blocks) #endif { int i, j, k, n, onebyone, r; - Real **A_me, aii, aip1, aip1i, lambda, sigma, tmp; + Real aii, aip1, aip1i, lambda, sigma, tmp; Real det, s, t; if ( ! A || ! pivot || ! blocks ) @@ -119,7 +119,6 @@ MAT *BKPfactor(MAT *A, PERM *pivot, PERM *blocks) error(E_SIZES,"BKPfactor"); n = A->n; - A_me = A->me; px_ident(pivot); px_ident(blocks); for ( i = 0; i < n; i = onebyone ? i+1 : i+2 ) @@ -240,7 +239,7 @@ VEC *BKPsolve(const MAT *A, PERM *pivot, const PERM *block, { STATIC VEC *tmp=VNULL; /* dummy storage needed */ int i, j, n, onebyone; - Real **A_me, a11, a12, a22, b1, b2, det, sum, *tmp_ve, tmp_diag; + Real a11, a12, a22, b1, b2, det, sum, tmp_diag; if ( ! A || ! pivot || ! block || ! b ) error(E_NULL,"BKPsolve"); @@ -253,8 +252,6 @@ VEC *BKPsolve(const MAT *A, PERM *pivot, const PERM *block, tmp = v_resize(tmp,n); MEM_STAT_REG(tmp,TYPE_VEC); - A_me = A->me; tmp_ve = tmp->ve; - px_vec(pivot,b,tmp); /* solve for lower triangular part */ for ( i = 0; i < n; i++ ) diff --git a/copy.c b/copy.c index b2b360b..b8ab0f6 100644 --- a/copy.c +++ b/copy.c @@ -225,7 +225,7 @@ MAT *vm_move(const VEC *in, int i0, MAT *out, int i1, int j1, int m1, int n1) #endif { - int dim0, i; + int i; if ( ! in ) error(E_NULL,"vm_move"); @@ -238,7 +238,6 @@ MAT *vm_move(const VEC *in, int i0, else out = m_resize(out,max(i1+m1,out->m),max(j1+n1,out->n)); - dim0 = m1*n1; for ( i = 0; i < m1; i++ ) MEM_COPY(&(in->ve[i0+i*n1]),&(out->me[i1+i][j1]),n1*sizeof(Real)); diff --git a/iter0.c b/iter0.c index 4444153..b552134 100644 --- a/iter0.c +++ b/iter0.c @@ -239,7 +239,7 @@ ITER *iter_copy2(ITER *ip1, ITER *ip2) mem_numvar(TYPE_ITER,1); } ip2->x = ip2->b = NULL; - ip2->shared_x = ip2->shared_x = FALSE; + ip2->shared_x = ip2->shared_b = FALSE; } x = ip2->x; diff --git a/ivecop.c b/ivecop.c index 944a054..7e317fd 100644 --- a/ivecop.c +++ b/ivecop.c @@ -125,7 +125,7 @@ IVEC *iv_resize(IVEC *iv, int new_dim) mem_bytes(TYPE_IVEC,iv->max_dim*sizeof(int), new_dim*sizeof(int)); } - iv->ive = RENEW(iv->ive,new_dim,int); + RENEW(iv->ive,new_dim,int); if ( ! iv->ive ) error(E_MEM,"iv_resize"); iv->max_dim = new_dim; diff --git a/memory.c b/memory.c index 89cdc73..e75cda3 100644 --- a/memory.c +++ b/memory.c @@ -315,7 +315,7 @@ MAT *m_resize(MAT *A,int new_m, int new_n) new_m*sizeof(Real *)); } - A->me = RENEW(A->me,new_m,Real *); + RENEW(A->me,new_m,Real *); if ( ! A->me ) error(E_MEM,"m_resize"); } @@ -453,7 +453,7 @@ PERM *px_resize(PERM *px, int new_size) mem_bytes(TYPE_PERM,px->max_size*sizeof(unsigned int), new_size*sizeof(unsigned int)); } - px->pe = RENEW(px->pe,new_size,unsigned int); + RENEW(px->pe,new_size,unsigned int); if ( ! px->pe ) error(E_MEM,"px_resize"); px->max_size = new_size; @@ -502,7 +502,7 @@ VEC *v_resize(VEC *x, int new_dim) new_dim*sizeof(Real)); } - x->ve = RENEW(x->ve,new_dim,Real); + RENEW(x->ve,new_dim,Real); if ( ! x->ve ) error(E_MEM,"v_resize"); x->max_dim = new_dim; diff --git a/schur.c b/schur.c index 416f338..6c29d13 100644 --- a/schur.c +++ b/schur.c @@ -70,12 +70,12 @@ static void hhldr3cols(MAT *A, int k, int j0, double beta, double nu1, double nu2, double nu3) #endif { - Real **A_me, ip, prod; + Real ip, prod; int j, n; if ( k < 0 || k+3 > A->m || j0 < 0 ) error(E_BOUNDS,"hhldr3cols"); - A_me = A->me; n = A->n; + n = A->n; /* printf("hhldr3cols:(l.%d) j0 = %d, k = %d, A at 0x%lx, m = %d, n = %d\n", __LINE__, j0, k, (long)A, A->m, A->n); */ @@ -119,14 +119,14 @@ static void hhldr3rows(MAT *A, int k, int i0, double beta, double nu1, double nu2, double nu3) #endif { - Real **A_me, ip, prod; + Real ip, prod; int i, m; /* printf("hhldr3rows:(l.%d) A at 0x%lx\n", __LINE__, (long)A); */ /* printf("hhldr3rows: k = %d\n", k); */ if ( k < 0 || k+3 > A->n ) error(E_BOUNDS,"hhldr3rows"); - A_me = A->me; m = A->m; + m = A->m; i0 = min(i0,m-1); for ( i = 0; i <= i0; i++ ) diff --git a/sparse.c b/sparse.c index 4cda289..6ccbb0b 100644 --- a/sparse.c +++ b/sparse.c @@ -103,7 +103,7 @@ double sp_set_val(SPMAT *A, int i, int j, double val) new_len*sizeof(row_elt)); } - r->elt = RENEW(r->elt,new_len,row_elt); + RENEW(r->elt,new_len,row_elt); if ( ! r->elt ) /* can't allocate */ error(E_MEM,"sp_set_val"); r->maxlen = 2*r->maxlen+1; diff --git a/zvecop.c b/zvecop.c index 30a8fc1..d79ef4c 100644 --- a/zvecop.c +++ b/zvecop.c @@ -277,7 +277,7 @@ ZVEC *zv_linlist(ZVEC *out,ZVEC *v1,complex a1,...) va_start(ap, a1); out = zv_mlt(a1,v1,out); - while (par = va_arg(ap,ZVEC *)) { /* NULL ends the list*/ + while ((par = va_arg(ap,ZVEC *))) { /* NULL ends the list*/ a_par = va_arg(ap,complex); if (a_par.re == 0.0 && a_par.im == 0.0) continue; if ( out == par )