#! /bin/sh /usr/share/dpatch/dpatch-run ## 20_preprocessor.dpatch by ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. Index: itsol-1.0.0/CMakeLists.txt =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ itsol-1.0.0/CMakeLists.txt 2010-04-02 21:13:25.000000000 -0400 @@ -0,0 +1,75 @@ +cmake_minimum_required(VERSION 2.6) + +project (ITSOL) + + +set(STATIC_LIBRARY_FLAGS "-rcv") +set(CMAKE_Fortran_FLAGS " -c -g -ffixed-line-length-none -ffree-line-length-none") +#set(CMAKE_Fortran_FLAGS " -c -g -Wall -ffixed-line-length-none -ffree-line-length-none") + +enable_language(Fortran) + +#SET_TARGET_PROPERTIES( PROPERTIES LINKER_LANGUAGE CXX) + + +# Create a library called "itsol". +add_library (itsol + arms2.c + auxill.c + fgmr.c + iluk.c + ilut.c + vbiluk.c + vbilut.c + LIB/PQ.c + LIB/ilutpC.c + LIB/indsetC.c + LIB/MatOps.c + LIB/misc.c + LIB/piluNEW.c + LIB/PQ.c + LIB/setblks.c + LIB/sets.c + LIB/svdInvC.c + LIB/systimer.c + LIB/tools.f +) + +SET_TARGET_PROPERTIES(itsol PROPERTIES + LINKER_LANGUAGE CXX + SOVERSION 1 + VERSION 1.0.0 +) + +install(TARGETS itsol + RUNTIME DESTINATION bin COMPONENT RuntimeLibraries + LIBRARY DESTINATION lib COMPONENT RuntimeLibraries + ARCHIVE DESTINATION lib COMPONENT Development +) + +install(DIRECTORY TESTS_COO/MATRICES TESTS_COO/OUT + DESTINATION share/itsol/tests/TESTS_COO +) + +install(FILES TESTS_COO/inputs TESTS_COO/matfile_coo + DESTINATION share/itsol/tests/TESTS_COO/ +) + + + +install(DIRECTORY TESTS_HB/MATRICES TESTS_HB/OUT + DESTINATION share/itsol/tests/TESTS_HB +) + +install(FILES TESTS_HB/inputs TESTS_HB/matfile_hb + DESTINATION share/itsol/tests/TESTS_HB/ +) + + + +#add_library (itsol LIB/tools.f) +# ./LIB/indsetC.c ./LIB/sets.c ./LIB/tools.c ./LIB/systimer.c ./LIB/misc.c ./LIB/MatOps.c ./LIB/ilutpC.c ./LIB/setblks.c ./LIB/svdInvC.c) + + +add_subdirectory (TESTS_HB) +#add_subdirectory (TESTS_COO) Index: itsol-1.0.0/TESTS_COO/CMakeLists.txt =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ itsol-1.0.0/TESTS_COO/CMakeLists.txt 2010-04-02 21:13:25.000000000 -0400 @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 2.6) + + +set(CMAKE_Fortran_FLAGS " -c -g -Wall -ffixed-line-length-none -ffree-line-length-none") + + +# Make sure the linker can find the ITSOL library once it is built. +link_directories (${ITSOL_BINARY_DIR}/LIB) + + +add_executable (coo_iluk.exe mainILUKcoo.c) +add_executable (coo_arms.exe mainARMScoo.c) +add_executable (coo_ilut.exe mainILUTcoo.c) +add_executable (coo_vbiluk.exe mainVBILUKcoo.c) +add_executable (coo_vbilut.exe mainVBILUTcoo.c) + + +# Link the executable to the ITSOL library. +target_link_libraries (coo_iluk.exe itsol lapack blas m) +target_link_libraries (coo_arms.exe itsol lapack blas m) +target_link_libraries (coo_ilut.exe itsol lapack blas m) +target_link_libraries (coo_vbiluk.exe itsol lapack blas m) +target_link_libraries (coo_vbilut.exe itsol lapack blas m) + + +install(TARGETS coo_iluk.exe coo_arms.exe coo_ilut.exe coo_vbiluk.exe coo_vbilut.exe + DESTINATION share/itsol/tests/TESTS_COO +) Index: itsol-1.0.0/TESTS_HB/CMakeLists.txt =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ itsol-1.0.0/TESTS_HB/CMakeLists.txt 2010-04-02 21:21:04.000000000 -0400 @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 2.6) + + +set(CMAKE_Fortran_FLAGS " -c -g -Wall -ffixed-line-length-none -ffree-line-length-none") + + +# Make sure the linker can find the ITSOL library once it is built. +link_directories (${ITSOL_BINARY_DIR}/LIB) + + +add_executable (hb_iluk.exe mainILUKhb.c) +add_executable (hb_arms.exe mainARMShb.c) +add_executable (hb_ilut.exe mainILUThb.c) +add_executable (hb_vbiluk.exe mainVBILUKhb.c) +add_executable (hb_vbilut.exe mainVBILUThb.c) + + +# Link the executable to the ITSOL library. +target_link_libraries (hb_iluk.exe itsol lapack blas gfortran m) +target_link_libraries (hb_arms.exe itsol lapack blas gfortran m) +target_link_libraries (hb_ilut.exe itsol lapack blas gfortran m) +target_link_libraries (hb_vbiluk.exe itsol lapack blas gfortran m) +target_link_libraries (hb_vbilut.exe itsol lapack blas gfortran m) + +install(TARGETS hb_iluk.exe hb_arms.exe hb_ilut.exe hb_vbiluk.exe hb_vbilut.exe + DESTINATION share/itsol/tests/TESTS_HB +) Index: itsol-1.0.0/TESTS_COO/makefile =================================================================== --- itsol-1.0.0.orig/TESTS_COO/makefile 2010-04-02 21:13:25.000000000 -0400 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -# this makefile is for LINUX machines only -# - -LINKS = -L../ -litsol \ - -L/project/scicom/scicom00/SOFT/lib/Linux32 -llapack \ - -L/project/scicom/scicom00/SOFT/lib/linux32 -lblas - -##-L/project/scicom/scicom00/SOFT/lib/linux/linux32 -llapack_LINUX \ -## -L/project/scicom/scicom00/SOFT/lib/linux/linux32 -lblas_LINUX -# -FC = f77 -FCFLAGS = -c -g -Wall -CC = cc -CCFLAGS = -c -DLINUX -Wall -O3 -LD = f77 -LDFLAGS = -# -# clear list of default suffixes, and declare default suffixes -.SUFFIXES: -.SUFFIXES: .f .c .o -# default rule to make .o files from .f files -.f.o : ; $(FC) $(FCFLAGS) $*.f -o $*.o -.c.o : ; $(CC) $(CCFLAGS) $*.c -o $*.o -# - -#all: arms.ex iluk.ex ilut.ex iluc.ex vbiluk.ex vbilut.ex - -all: arms.ex iluk.ex ilut.ex vbiluk.ex vbilut.ex - -arms.ex: mainARMScoo.o - $(LD) $(LDFLAGS) mainARMScoo.o $(LINKS) -o arms.ex - -iluk.ex: mainILUKcoo.o - $(LD) $(LDFLAGS) mainILUKcoo.o $(LINKS) -o iluk.ex - -ilut.ex: mainILUTcoo.o - $(LD) $(LDFLAGS) mainILUTcoo.o $(LINKS) -o ilut.ex - -##iluc.ex: mainILUCcoo.o -## $(LD) $(LDFLAGS) mainILUCcoo.o $(LINKS) -o iluc.ex - -vbiluk.ex: mainVBILUKcoo.o - $(LD) $(LDFLAGS) mainVBILUKcoo.o $(LINKS) -o vbiluk.ex - -vbilut.ex: mainVBILUTcoo.o - $(LD) $(LDFLAGS) mainVBILUTcoo.o $(LINKS) -o vbilut.ex -# -clean : - rm -f *.o *.ex *~ core *.cache OUT/* Index: itsol-1.0.0/TESTS_HB/makefile =================================================================== --- itsol-1.0.0.orig/TESTS_HB/makefile 2010-04-02 21:13:25.000000000 -0400 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -# this makefile is for LINUX machines only -# - -LINKS = -L../ -litsol \ - -L/project/scicom/scicom00/SOFT/lib/Linux32 -llapack \ - -L/project/scicom/scicom00/SOFT/lib/linux32 -lblas - -# -FC = f77 -FCFLAGS = -c -g -Wall -CC = cc -CCFLAGS = -c -g -DLINUX -Wall -O3 -LD = f77 -LDFLAGS = -# -# clear list of default suffixes, and declare default suffixes -.SUFFIXES: -.SUFFIXES: .f .c .o -# default rule to make .o files from .f files -.f.o : ; $(FC) $(FCFLAGS) $*.f -o $*.o -.c.o : ; $(CC) $(CCFLAGS) $*.c -o $*.o -# - -#all: arms.ex iluk.ex ilut.ex iluc.ex vbiluk.ex vbilut.ex - -all: arms.ex iluk.ex ilut.ex vbiluk.ex vbilut.ex - -arms.ex: mainARMShb.o - $(LD) $(LDFLAGS) mainARMShb.o $(LINKS) -o arms.ex - -iluk.ex: mainILUKhb.o - $(LD) $(LDFLAGS) mainILUKhb.o $(LINKS) -o iluk.ex - -ilut.ex: mainILUThb.o - $(LD) $(LDFLAGS) mainILUThb.o $(LINKS) -o ilut.ex - -## iluc.ex: mainILUChb.o -## $(LD) $(LDFLAGS) mainILUChb.o $(LINKS) -o iluc.ex - -vbiluk.ex: mainVBILUKhb.o - $(LD) $(LDFLAGS) mainVBILUKhb.o $(LINKS) -o vbiluk.ex - -vbilut.ex: mainVBILUThb.o - $(LD) $(LDFLAGS) mainVBILUThb.o $(LINKS) -o vbilut.ex -# -clean : - rm -f *.o *.ex *~ core *.cache OUT/* \ No newline at end of file Index: itsol-1.0.0/makefile =================================================================== --- itsol-1.0.0.orig/makefile 2010-04-02 21:13:25.000000000 -0400 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -# this makefile is for LINUX machines only -# ILUC removed.. -OBJ = fgmr.o iluk.o ilut.o arms2.o vbiluk.o vbilut.o auxill.o - -LIB = ./LIB/PQ.o ./LIB/piluNEW.o ./LIB/indsetC.o \ - ./LIB/sets.o ./LIB/tools.o ./LIB/systimer.o ./LIB/misc.o \ - ./LIB/MatOps.o ./LIB/ilutpC.o ./LIB/setblks.o ./LIB/svdInvC.o - -AR = ar -rcv - -# -FC = f77 -FCFLAGS = -c -g -Wall -CC = gcc -CCFLAGS = -c -g -DLINUX -Wall -O3 -LD = f77 -LDFLAGS = -# -# clear list of default suffixes, and declare default suffixes -.SUFFIXES: -.SUFFIXES: .f .c .o -# default rule to make .o files from .f files -.f.o : ; $(FC) $(FCFLAGS) $*.f -o $*.o -.c.o : ; $(CC) $(CCFLAGS) $*.c -o $*.o -# - -lib libitsol.a: $(OBJ) $(LIB) - $(AR) libitsol.a $(OBJ) $(LIB) -## ranlib libitsol.a - -# -clean : - rm -f ${OBJ} *.o *.ex *~ core *.cache ${LIB} LIB/*~ LIB/*.cache OUT/* - -cleanall : - rm -f ${OBJ} *.o *.ex *.a *.cache *~ core ${LIB} \ - LIB/*~ LIB/*.cache OUT/* TESTS_COO/*.o TESTS_COO/*.ex \ - TESTS_HB/*.o TESTS_HB/*.ex Index: itsol-1.0.0/LIB/PQ.c =================================================================== --- itsol-1.0.0.orig/LIB/PQ.c 2010-04-02 21:13:25.000000000 -0400 +++ itsol-1.0.0/LIB/PQ.c 2010-04-02 21:13:25.000000000 -0400 @@ -126,216 +126,6 @@ |-----end-of-indsetPQ-------------------------------------------------- |--------------------------------------------------------------------*/ -int add2is(int *last, int nod, int *iord, int *riord) -{ -/*---------------------------------------------------------------------- -| adds element nod to independent set -|---------------------------------------------------------------------*/ - (*last)++; - iord[nod] = *last; - riord[*last] = nod; - return 0; -} -/*--------------------------------------------------------------------- -|---- end of add2is --------------------------------------------------- -|--------------------------------------------------------------------*/ -int add2com(int *nback, int nod, int *iord, int *riord) -{ -/*---------------------------------------------------------------------- -| adds element nod to independent set -|---------------------------------------------------------------------*/ - iord[nod] = *nback; - riord[*nback] = nod; - (*nback)--; - return 0; -} -/*--------------------------------------------------------------------- -|---- end of add2com -------------------------------------------------- -|--------------------------------------------------------------------*/ -int indsetC(csptr mat, int bsize, int *iord, int *nnod, double tol) -{ -/*--------------------------------------------------------------------- -| greedy algorithm for independent set ordering -- -|---------------------------------------------------------------------- -| Input parameters: -| ----------------- -| (mat) = matrix in SpaFmt format -| -| bsize = integer (input) the target size of each block. -| each block is of size >= bsize. -| -| w = weight factors for the selection of the elements in the -| independent set. If w(i) is small i will be left for the -| vertex cover set. -| -| tol = a tolerance for excluding a row from independent set. -| -| Output parameters: -| ------------------ -| iord = permutation array corresponding to the independent set -| ordering. Row number i will become row number iord[i] in -| permuted matrix. -| -| nnod = (output) number of elements in the independent set. -| -|----------------------------------------------------------------------- -| the algorithm searches nodes in lexicographic order and groups -| the (BSIZE-1) nearest nodes of the current to form a block of -| size BSIZE. The current algorithm does not use values of the matrix. -|---------------------------------------------------------------------*/ -/* local variables */ - int nod, jcount, lastlev, begin, last0, last, nback, mid, - j1, j2, jcol, inod, jnod, j, k, jcount0, begin0, *rowj; - int prog, n=mat->n, *riord; - double *w; - csptr matT,gmat; - -/*-----------------------------------------------------------------------*/ - riord = (int *) Malloc(n*sizeof(int), "indsetC:1" ); - w = (double *) Malloc(n*sizeof(double), "indsetC:2" ); - matT = (csptr) Malloc(sizeof(SparMat), "indsetC:3" ); -/* call weights to compute the weights for input matrix.. */ - setupCS(matT, mat->n,1); - SparTran(mat, matT, 1, 0); - SparTran(matT, mat, 1, 1); - weightsC(mat, w); -/*---------------------------------------------------------------------- -| scan all nodes first to eliminate those not satisfying DD criterion -+----------------------------------------------------------------------*/ - nback = n-1; - nod = 0; - for(j=0; j= mat->n) goto label50; - } -/*-------------------- initialize level-set - contains nod (only)*/ - add2is(&last, nod, iord, riord); - begin = last; - begin0 = begin; - lastlev = begin; - jcount = 1; -/*---------------------------------------------------------------------- -| put all the nearest neighbor nodes of the current node into -| the block until the number is BSIZE. -|---------------------------------------------------------------------*/ - prog = 1; - while (jcount < bsize && prog) { -/*-------------------- traverse all the current level-set */ - last0 = last; - jcount0 = jcount; - for (inod=begin; inod<=last0; inod++) { - jnod = riord[inod]; -/*-------------------- This assumes A is not symmetric. */ - gmat = mat; - for (k=0; k<2; k++) { - rowj = gmat->ja[jnod]; - for (j=0; jnzcount[jnod]; j++) { - jcol = rowj[j]; - if (iord[jcol] == -1 ) { - add2is(&last, jcol, iord, riord); - jcount++; - } - } - gmat = matT; - } - } - prog = jcount > jcount0 ? 1 : 0; - lastlev = begin; - begin = last0+1; - } -/*----------------------------------------------------------------------- -| the neighbors of elements of last level go to the complement -| gmat loop over original matrix and its transpose -+-----------------------------------------------------------------------*/ - gmat = mat; - for (k=0; k<2; k++) { - for (inod=lastlev; inod<=last; inod++) { - jnod = riord[inod]; - rowj = gmat->ja[jnod]; - for (j=0; jnzcount[jnod]; j++){ - jcol = rowj[j]; - if (iord[jcol] == -1) - add2com(&nback, jcol, iord, riord); - } - } - gmat = matT; - } -/* reverse ordering for this level */ - mid = (begin0+last) / 2; - for (inod=begin0; inod<=mid; inod++) { - j = last - inod + begin0; - jnod = riord[inod]; - riord[inod] = riord[j]; - riord[j] = jnod; - } - } -/*-------------------------------------------------- -| end-main-loop -|-------------------------------------------------*/ -/*-------------------- relabel nodes of vertex cover */ -label50: - *nnod = last; - j1 = *nnod; - for (j2=*nnod+1; j2 -1) { - if (++j1 != j2) { - j = riord[j2]; - riord[j2] = riord[j1]; - riord[j1] = j; - } - } - } -/*-------------------- obtain reverse permutation array */ - for (j=0; jn, *kj, kz; - double tdia, wmax=0.0, tnorm, *kr; - for (irow=0; irownzcount[irow]; - kr = mat->ma[irow]; - kj = mat->ja[irow]; - tnorm = 0.0; - tdia = 0.0; - for (k=0; k 0.0) - tnorm = tdia / tnorm; - w[irow] = tnorm; - if (tnorm > wmax) wmax = tnorm; - } - for (irow=0; irown, *kj, kz; + double tdia, wmax=0.0, tnorm, *kr; + for (irow=0; irownzcount[irow]; + kr = mat->ma[irow]; + kj = mat->ja[irow]; + tnorm = 0.0; + tdia = 0.0; + for (k=0; k 0.0) + tnorm = tdia / tnorm; + w[irow] = tnorm; + if (tnorm > wmax) wmax = tnorm; + } + for (irow=0; irow + #include #include #include #include @@ -7,32 +7,7 @@ void *Malloc( int, char * ); -int add2is(int *last, int nod, int *iord, int *riord) -{ -/*---------------------------------------------------------------------- -| adds element nod to independent set -|---------------------------------------------------------------------*/ - (*last)++; - iord[nod] = *last; - riord[*last] = nod; - return 0; -} -/*--------------------------------------------------------------------- -|---- end of add2is --------------------------------------------------- -|--------------------------------------------------------------------*/ -int add2com(int *nback, int nod, int *iord, int *riord) -{ -/*---------------------------------------------------------------------- -| adds element nod to independent set -|---------------------------------------------------------------------*/ - iord[nod] = *nback; - riord[*nback] = nod; - (*nback)--; - return 0; -} -/*--------------------------------------------------------------------- -|---- end of add2com -------------------------------------------------- -|--------------------------------------------------------------------*/ + int indsetC(csptr mat, int bsize, int *iord, int *nnod, double tol) { /*--------------------------------------------------------------------- @@ -70,7 +45,7 @@ int prog, n=mat->n, *riord; double *w; csptr matT,gmat; - int weightsC(csptr, double *); + /*-----------------------------------------------------------------------*/ riord = (int *) Malloc(n*sizeof(int), "indsetC:1" ); w = (double *) Malloc(n*sizeof(double), "indsetC:2" ); @@ -187,32 +162,3 @@ /*--------------------------------------------------------------------- |-----end-of-indsetC--------------------------------------------------- |--------------------------------------------------------------------*/ -int weightsC(csptr mat, double *w) -{ -/*--------------------------------------------------------------------- -| defines weights based on diagonal dominance ratios -|--------------------------------------------------------------------*/ - int irow, k, n=mat->n, *kj, kz; - double tdia, wmax=0.0, tnorm, *kr; - for (irow=0; irownzcount[irow]; - kr = mat->ma[irow]; - kj = mat->ja[irow]; - tnorm = 0.0; - tdia = 0.0; - for (k=0; k 0.0) - tnorm = tdia / tnorm; - w[irow] = tnorm; - if (tnorm > wmax) wmax = tnorm; - } - for (irow=0; irowD; /* symbolic factorization to calculate level of fill index arrays */ - if( ( ierr = lofC( lofM, csmat, lu, fp ) ) != 0 ) { + if( ( ierr = iluk_lofC( lofM, csmat, lu, fp ) ) != 0 ) { fprintf( fp, "Error: lofC\n" ); return -1; } @@ -150,7 +150,7 @@ return 0; } -int lofC( int lofM, csptr csmat, iluptr lu, FILE *fp ) +int iluk_lofC( int lofM, csptr csmat, iluptr lu, FILE *fp ) { /*-------------------------------------------------------------------- * symbolic ilu factorization to calculate structure of ilu matrix Index: itsol-1.0.0/LIB/protos.h =================================================================== --- itsol-1.0.0.orig/LIB/protos.h 2010-04-02 21:13:25.000000000 -0400 +++ itsol-1.0.0/LIB/protos.h 2010-04-02 21:13:25.000000000 -0400 @@ -1,6 +1,7 @@ #ifndef __ITSOL_INCLUDED_PROTOS_H__ #define __ITSOL_INCLUDED_PROTOS_H__ +#include #include #include "globheads.h"