Write a program that uses the LAPACK routine DGESV to solve the linear sistem Ax=b, where:
b(i) = 207-i
A(i,j) = 10000 if i=j
A(i,j) = i+j/2 if i≠j
Print the solutions vector.
For a 10x10 system the solutions are:
1 0.02052855547
2 0.02041159784
3 0.02029460511
4 0.02017757726
5 0.02006051428
6 0.01994341614
7 0.01982628284
8 0.01970911435
9 0.01959191067
10 0.01947467177
To compile (on Galileo):
#GNU Compilers: module load gnu/4.9.2 module load blas/3.5.0--gnu--4.9.2 module load lapack/3.5.0--gnu--4.9.2 #FORTRAN: LALIB="-L${LAPACK_LIB} -llapack -L${BLAS_LIB} -lblas" gfortran -o program.x program.f90 ${LALIB} #C: remember to include the header files "cblas.h" and/or “lapacke.h” LALIB="-I${BLAS_INC} -I${LAPACK_INC} \ -L${LAPACK_LIB} -llapacke -llapack \ -L${BLAS_LIB} -lcblas -lblas -lgfortran -lm" gcc -o program.x program.f90 ${LALIB}
#Intel Compilers:
module load intel/pe-xe-2016--binary module load mkl/11.3.0--binary LALIB="-I${MKL_INC} -L${MKL_LIB} -lmkl_intel_lp64 \ -lmkl_sequential -lmkl_core -lpthread -lm -ldl" #C: remember to include the header file "mkl.h" icc -o program.x program.c ${LALIB} icc -mkl -o program.x program.c -lpthread -lm -ldl #FORTRAN: ifort -o program.x program.f90 ${LALIB} ifort -mkl -o program.x program.f90 -lpthread -lm -ldl
http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor