0

I am looking to perform matrix exponentials, which apparently the Expokit library is suitable for. Sadly unlike Lapack or OpenMP this is not easily installed from Cygwin or Mingw for Windows. Therefore I have downloaded the library from 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), as it doesn't give any indication of how the Expokit library is linked.

I would greatly appreciate any guidance on how to install Expokit on Windows, or alternatively on Ubuntu if Windows is not suitable.

Making the change suggested by ripero and running 'make sample_d' on Ubuntu I get the log shown below. I assume this means the sample has been compiled successfully, but I have no idea how this enables me to use Expokit as a library in my Fortran programs. Could someone please provide guidance on this?

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 
2
  • have you seen this? Commented Jul 3, 2018 at 20:20
  • The only mention of using the library is 'make sample_d' which obviously doesn't work on Windows, and on my Ubuntu installation returns an error which I'll post above. Even if this worked, I'm not sure I understand how this would be used in a normal program to link to Expokit. Commented Jul 3, 2018 at 20:24

1 Answer 1

1

Your Fortran compiler fails to compile file sample_d.f due to a non-standard format statement. The source code of the same file provides instructions for how to fix it if this happens:

 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) ) 

If you comment the first line above (add a * as the first character of the line) and uncomment the last line (remove the leading *), the error should disappear.


I don't think there is a particular significance to running make sample_d other than ensuring that the object files are created and that a sample program can be compiled and linked against them in order to create a working binary.

First, you should be aware that you have compiled Expokit and one of the sample programs using what their Makefile calls case 3, where the required BLAS and LAPACK subroutines are provided by files blas.o and lapack.o, respectively, compiled from their .f counterparts provided by Expokit.

# 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 = 

If your system already has BLAS and LAPACK libraries, they very likely are more optimized than the ones in blas.o and lapack.o, and you probably will want to change the case in the Makefile (add/remove leading # to comment/uncomment the appropriate definitions of OBJLIBS and LIBS) so that you can use the system BLAS and LAPACK.

In order to use Expokit in your Fortran programs, you need to call from your source code the relevant subroutines (see the Expokit paper and the source code of expokit.f and mataid.f in order to read about the provided subroutines) and then the simplest is to add to your linking line the following

  1. object files: expokit.o mataid.o followed by all the object files listed in the active OBJLIBS variable in the Expokit Makefile, if any; and
  2. libraries: all the ones listed in the active LIBS variable in the Expokit Makefile, if any.
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your help, I've been able to run the command successfully now. Would you be able to please explain how to link to this library in my own code, as I don't understand the significance of running 'make sample_d'.
Many thanks for your explanation and help, that worked for me. Would it possible to compile Expokit as a static library to avoid linking the .o files every time? I tried using ar cr expokit.a *.o and linking to the .a file but haven't had any luck.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.