安装 Fortran 库 Expokit (Windows/Ubuntu)

Installing Fortran library Expokit (Windows/Ubuntu)

我正在寻找执行矩阵指数,显然 Expokit 库适合。遗憾的是,与 Lapack 或 OpenMP 不同,这并不容易从 Cygwin 或 Mingw 安装 Windows。因此我从 here, however once unpacked it consists purely of .f files with little guidance on how to use them. The only site I've found online isn't much use (Fortran Wiki) 下载了这个库,因为它没有给出任何关于 Expokit 库是如何链接的指示。

如果 Windows 不合适,我将非常感谢有关如何在 Windows 或 Ubuntu 上安装 Expokit 的指导。

根据 ripero 和 运行 'make sample_d' 在 Ubuntu 上进行的更改,我得到了如下所示的日志。我认为这意味着示例已成功编译,但我不知道这如何使我能够在我的 Fortran 程序中将 Expokit 用作库。有人可以为此提供指导吗?

XX:~/programs/expokit/expokit/fortran$ make sample_d
f77 -O3 -c blas.f
blas.f:404:72:

    10 assign 30 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:409:19:

    20    go to next,(30, 50, 70, 110)
                   1
Warning: Deleted feature: Assigned GOTO statement at (1)
blas.f:411:72:

       assign 50 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:420:72:

       assign 70 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:427:72:

       assign 110 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:1621:72:

    10 assign 30 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:1628:19:

          go to next,(30, 50, 70, 90, 110)
                   1
Warning: Deleted feature: Assigned GOTO statement at (1)
blas.f:1630:72:

       assign 50 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:1639:72:

       assign 70 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:1644:72:

   100 assign 110 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:1671:72:

    85 assign 90 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:1689:16:

       go to next,(  50, 70, 90, 110 )
                1
Warning: Deleted feature: Assigned GOTO statement at (1)
f77 -O3 -c lapack.f
f77 -o sample_d sample_d.o clock.o expokit.o mataid.o blas.o lapack.o 

由于非标准格式语句,您的 Fortran 编译器无法编译文件 sample_d.f。同一文件的源代码提供了发生这种情况时如何修复它的说明:

 9001 format( <mprint>(1X,D11.4) )    
*--- Some compliers (e.g., g77) generate 'Unsupported FORMAT specifier' 
* with the specification above. In this case, simply use this form: 
* 9001 format( 5(1X,D11.4) )

如果您注释上面的第一行(添加 * 作为该行的第一个字符)并取消注释最后一行(删除前导 *),错误应该消失。


我认为 运行 make sample_d 除了确保创建目标文件以及可以针对它们编译和链接示例程序以便创建一个工作二进制文件。

首先,您应该知道您已经编译了 Expokit 和其中一个示例程序,其中使用了他们的 Makefile 调用的案例 3,其中所需的 BLAS 和 LAPACK 子例程由文件 blas.o 和 lapack.o,分别从 Expokit 提供的 .f 对应文件编译而来。

# Among the 3 possibilities below, uncomment the appropriate
# case for your environment and comment the others.

# case 1: works when LAPACK and BLAS are installed.
OBJLIBS =
LIBS    = -llapack -lblas

# case 2: works when LAPACK is not installed but BLAS is.
#LIBS    = -lblas
#OBJLIBS = lapack.o

# case 3: works when neither LAPACK nor BLAS are installed.
#OBJLIBS = blas.o lapack.o
#LIBS   =

如果您的系统已经有 BLAS 和 LAPACK 库,它们很可能比 blas.o 和 lapack.o 中的库更优化,并且您可能想要更改 Makefile 中的大小写 ( add/remove 引导 # 到 comment/uncomment OBJLIBSLIBS 的适当定义)以便您可以使用系统 BLAS 和 LAPACK。

为了在您的 Fortran 程序中使用 Expokit,您需要从您的源代码中调用相关的子例程(请参阅 Expokit 论文和 expokit.f 和 mataid.f 的源代码以便阅读提供的子程序),然后最简单的方法是将以下内容添加到您的链接行

  1. 目标文件:expokit.o mataid.o后跟Expokit Makefile中活动OBJLIBS变量中列出的所有目标文件,如果有的话;和
  2. 库:Expokit Makefile 中的活动 LIBS 变量中列出的所有库,如果有的话。