Fortran 90/95 library for sparse matrices?

前端 未结 1 415
广开言路
广开言路 2021-02-05 12:36

I am looking for a library for dealing with sparse matrices in fortran 90/95. I only need very basic operations like matrix-vector multiplication. What do you suggest I use?

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-05 13:00

    OK, I'll partially answer my own questions:

    Where to find a full f95 implementation of Sparse BLAS was provided by @alexurba above:

    http://www.netlib.org/toms/818

    That was it! This script creates all the source code in the folder that you run it (I have never seen software provided in this manner before).

    To make the INSTALL script work I needed to do some changes: The install instructions tell you to edit the INSTALL script and choose the appropriate "arch". Your choices are: AIX, ALPHA, CRAY, HP, NAG, SGI and SUN. Neither of these seemed appropriate to me, as I am using linux and the only fortran compiler I have on this computer is gfortran. I didn't quite understand the purpose of this option, but what I did that worked was the following:

    1) In INSTALL, make up a new "arch" I called GNU by setting the variable SB_ARCH='GNU'. 2) In SOFTWARE/Makefile change FC = f90 to FC = gfortran, 3) In TESTER/ copy the file Makefile.NAG to Makefile.GNU, change FC = f90 to FC = gfortran, and change all instances of the the word 'NAG' to 'GNU'. (You'll probably also want to change the FFLAGS option in the Makefiles.)

    After this I ran INSTALL, and then TESTER/test_all, and the tests spit out "0.000..." as errors, which I assume to mean everything is working.

    I must say I found finding this source code unusually difficult. Luckily this thread comes up quite high on google when searching "fortran 90 sparse matrix library" now.

    My final solution: Ironically, after finally finding a full implementation of Sparse BLAS I have decided that for my problem it is better to use a more direct approach, since all I'll probably need is matrix-vector multiplication: Figure out what sparse matrix representation to use (Compressed Sparse Row (CSR) seems to be appropriate for my problem), dig out the corresponding matrix-vector multiplication routine from the Sparse BLAS source code, see how it wants it input, and just use that directly in my code.

    0 讨论(0)
提交回复
热议问题