program test * * File: ~/numerical/test_la.f * * Author: Chuck Gartland (6-99, 10-01, 10-05) * * Fortran test program for using LAPACK on the Linux machines on the * Kent Math/CS Network. * * Library locations: * * LAPACK: /usr/lib/liblapack.[a|so|...] * BLAS: /usr/lib/libblas.[a|so|...] * * Compiling: * * $ f77 test_la.f -llapack * * See man page for "g77". * * Test prob: [ 1 2 3 ][x] [ 6] , w/ true sol'n [1] * [ 4 5 6 ][y] = [15] [1] * [ 7 8 0 ][z] [15] [1] * character*1 trans dimension A(4,5), b(3), ipiv(3) ! deliberately chosen larger dimensions ! to illustrate role of 'lda' data A / 1., 4., 7., 0., 2., 5., 8., 0., 3., 6., 0., 0., 8*0. / data b / 6., 15., 15. / data trans, m, n, lda, ldb, nrhs / 'N', 3, 3, 4, 3, 1 / call sgetrf( m, n, A, lda, ipiv, info ) ! LU-factor print *, ' info, ipiv = ', info, ipiv call sgetrs( trans, n, nrhs, A, lda, ipiv, b, ldb, info ) ! back solve print *, ' info, b = ', info, b stop end * * Appended sample output: * * info, ipiv = 0 3 3 3 * info, b = 0 1.00000012 0.999999881 1. *