Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion conda-recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
"%PYTHON%" setup.py install
:: Uncoment following two lines for local test build
cd %RECIPE_DIR%
cd ..

"%PYTHON%" setup.py build --compiler=mingw32
"%PYTHON%" setup.py install --skip-build

if errorlevel 1 exit 1

:: Add more build steps here, if they are necessary.
Expand Down
2 changes: 2 additions & 0 deletions conda-recipe/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd $RECIPE_DIR/..
LDFLAGS="-shared" FFLAGS="-fPIC" $PYTHON setup.py install
7 changes: 2 additions & 5 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ package:
build:
number: 1

script:
- cd $RECIPE_DIR/..
- $PYTHON setup.py install

requirements:
build:
- python
- numpy
- numpy >=1.13.3
- lapack
- m2w64-gcc-fortran # [win]

run:
- python
Expand Down
30 changes: 27 additions & 3 deletions slycot/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import glob
import os
import sys

import sysconfig

def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
Expand All @@ -21,14 +21,38 @@ def configuration(parent_package='', top_path=None):

f2py_sources = ['src/_wrapper.pyf']

pyver = sysconfig.get_config_var('VERSION')

if sys.platform == 'win32':
liblist = ['liblapack', 'libblas']
liblist = [
'lapack', 'lapacke', 'blas', 'gfortran'
]
extra_objects = [
]
ppath = os.sep.join(sys.executable.split(os.sep)[:-1])
library_dirs = [r'\Library\lib', ]
library_dirs = [ppath + l for l in library_dirs]
extra_link_args = [ ]
extra_compile_args = [ ]
else:
liblist = ['lapack']
# this is needed on Py 3.x, and fails on Py 2.7
try:
abiflags = sys.abiflags
except AttributeError:
abiflags = ''
liblist = ['lapack', 'blas', 'python'+pyver+abiflags]
extra_objects = []
library_dirs = []
extra_link_args = []
extra_compile_args = []

config.add_extension(
name='_wrapper',
libraries=liblist,
extra_objects=extra_objects,
extra_link_args=extra_link_args,
library_dirs=library_dirs,
extra_compile_args=extra_compile_args,
sources=fortran_sources + f2py_sources)

config.make_config_py() # installs __config__.py
Expand Down
7 changes: 4 additions & 3 deletions slycot/src/AB08NX.f
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ SUBROUTINE AB08NX( N, M, P, RO, SIGMA, SVLMAX, ABCD, LDABCD,
INTEGER ILAENV
EXTERNAL ILAENV
C .. External Subroutines ..
EXTERNAL DLAPMT, DLARFG, DLASET, DLATZM, DORMQR, DORMRQ,
$ MB03OY, MB03PY, XERBLA
EXTERNAL DLAPMT, DLARFG, DLASET, SLCT_DLATZM, DORMQR,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a particularly strong view on this, but why not just call it DLATZM? In my admittedly limited and rusty understanding of linking, this should work whether or not the LAPACK linked against provides DLATZM.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also possible. I came across this in the LAPACK license:

Like all software, it is copyrighted. It is not trademarked, but we do ask the following:

If you modify the source for these routines we ask that you change the name of the routine and comment the changes made to the original.

We will gladly answer any questions regarding the software. If a modification is done, however, it is the responsibility of the person who modified the routine to provide support.

This makes it clearer we are using our own copy. The six-letter limit for fortran variable names is only relevant for FORTRAN 4 or 5, I think it was already dropped for FORTRAN 77

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, fair enough.

FWIW, my go-to reference for Fortran 77 says "One of the most irksome restrictions of Fortran77 is that symbolic names cannot be more than six characters long."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK then, our machine had an extension to its FORTRAN 77 then. I actually sold my FORTRAN book to some Indonesian visitors years ago ....

$ DORMRQ, MB03OY, MB03PY, XERBLA
C .. Intrinsic Functions ..
INTRINSIC INT, MAX, MIN
C .. Executable Statements ..
Expand Down Expand Up @@ -308,7 +308,8 @@ SUBROUTINE AB08NX( N, M, P, RO, SIGMA, SVLMAX, ABCD, LDABCD,
C
DO 40 I1 = 1, SIGMA
CALL DLARFG( RO+1, ABCD(IROW,I1), ABCD(IROW+1,I1), 1, T )
CALL DLATZM( 'L', RO+1, MNU-I1, ABCD(IROW+1,I1), 1, T,
CALL SLCT_DLATZM( 'L', RO+1, MNU-I1, ABCD(IROW+1,I1),
$ 1, T,
$ ABCD(IROW,I1+1), ABCD(IROW+1,I1+1), LDABCD,
$ DWORK )
IROW = IROW + 1
Expand Down
5 changes: 4 additions & 1 deletion slycot/src/AB13AD.f
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ DOUBLE PRECISION FUNCTION AB13AD( DICO, EQUIL, N, M, P, ALPHA, A,
C Nov. 1998, V. Sima, Research Institute for Informatics, Bucharest.
C Dec. 1998, V. Sima, Katholieke Univ. Leuven, Leuven.
C Oct. 2001, V. Sima, Research Institute for Informatics, Bucharest.
C Jun. 2017, RvP, made 1st error return value zero
C
C KEYWORDS
C
Expand Down Expand Up @@ -260,8 +261,10 @@ DOUBLE PRECISION FUNCTION AB13AD( DICO, EQUIL, N, M, P, ALPHA, A,
C
IF( INFO.NE.0 ) THEN
C
C Error return.
C Error return.
C
C
AB13AD = ZERO
CALL XERBLA( 'AB13AD', -INFO )
RETURN
END IF
Expand Down
1 change: 1 addition & 0 deletions slycot/src/AB13AX.f
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ DOUBLE PRECISION FUNCTION AB13AX( DICO, N, M, P, A, LDA, B, LDB,
C
C Error return.
C
AB13AX = ZERO
CALL XERBLA( 'AB13AX', -INFO )
RETURN
END IF
Expand Down
2 changes: 2 additions & 0 deletions slycot/src/AB13BD.f
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ DOUBLE PRECISION FUNCTION AB13BD( DICO, JOBN, N, M, P, A, LDA,
C
C Error return.
C
AB13BD = ZERO
CALL XERBLA( 'AB13BD', -INFO )
RETURN
END IF
Expand All @@ -300,6 +301,7 @@ DOUBLE PRECISION FUNCTION AB13BD( DICO, JOBN, N, M, P, A, LDA,
C
S2NORM = DLANGE( 'Frobenius', P, M, D, LDD, DWORK )
IF( .NOT.DISCR .AND. S2NORM.NE.ZERO ) THEN
AB13BD = ZERO
INFO = 5
RETURN
END IF
Expand Down
7 changes: 6 additions & 1 deletion slycot/src/AB13CD.f
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,17 @@ DOUBLE PRECISION FUNCTION AB13CD( N, M, NP, A, LDA, B, LDB, C,
INFO = -17
END IF
IF( INFO.NE.0 ) THEN
AB13CD = ZERO
CALL XERBLA( 'AB13CD', -INFO )
RETURN
END IF
C
C Quick return if possible.
C
IF( M.EQ.0 .OR. NP.EQ.0 ) RETURN
IF( M.EQ.0 .OR. NP.EQ.0 ) THEN
AB13CD = ZERO
RETURN
END IF
C
C Workspace usage.
C
Expand All @@ -262,6 +266,7 @@ DOUBLE PRECISION FUNCTION AB13CD( N, M, NP, A, LDA, B, LDB, C,
$ INFO2 )
IF( INFO2.GT.0 ) THEN
INFO = 4
AB13CD = ZERO
RETURN
END IF
GAMMAL = DWORK( IW6+1 )
Expand Down
5 changes: 5 additions & 0 deletions slycot/src/AB13DX.f
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ DOUBLE PRECISION FUNCTION AB13DX( DICO, JOBE, JOBD, N, M, P,
END IF
C
IF( INFO.NE.0 ) THEN
AB13DX = ZERO
CALL XERBLA( 'AB13DX', -INFO )
RETURN
END IF
Expand Down Expand Up @@ -360,6 +361,7 @@ DOUBLE PRECISION FUNCTION AB13DX( DICO, JOBE, JOBD, N, M, P,
$ LDWORK-IWRK+1, IERR )
IF( IERR.GT.0 ) THEN
INFO = N + 1
AB13DX = ZERO
RETURN
END IF
AB13DX = DWORK( IS )
Expand Down Expand Up @@ -391,6 +393,7 @@ DOUBLE PRECISION FUNCTION AB13DX( DICO, JOBE, JOBD, N, M, P,
INFO = IERR
DWORK( 1 ) = ONE
CWORK( 1 ) = ONE
AB13DX = ZERO
RETURN
END IF
CALL MB02RD( 'No Transpose', N, M, A, LDA, IWORK, B, LDB,
Expand All @@ -415,6 +418,7 @@ DOUBLE PRECISION FUNCTION AB13DX( DICO, JOBE, JOBD, N, M, P,
END IF
IF( IERR.GT.0 ) THEN
INFO = N + 1
AB13DX = ZERO
RETURN
END IF
C
Expand Down Expand Up @@ -515,6 +519,7 @@ DOUBLE PRECISION FUNCTION AB13DX( DICO, JOBE, JOBD, N, M, P,
INFO = IERR
DWORK( 1 ) = ONE
CWORK( 1 ) = ICWK - 1
AB13DX = ZERO
RETURN
END IF
CALL MB02RZ( 'No Transpose', N, M, CWORK, N, IWORK,
Expand Down
8 changes: 5 additions & 3 deletions slycot/src/AB8NXZ.f
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ SUBROUTINE AB8NXZ( N, M, P, RO, SIGMA, SVLMAX, ABCD, LDABCD,
LOGICAL LQUERY
INTEGER I1, IK, IROW, ITAU, IZ, JWORK, MM1, MNTAU, MNU,
$ MPM, NB, NP, RANK, RO1, TAU, WRKOPT
COMPLEX*16 TC
COMPLEX*16 TC, TCCONJ
C .. Local Arrays ..
DOUBLE PRECISION SVAL(3)
C .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
C .. External Subroutines ..
EXTERNAL MB3OYZ, MB3PYZ, XERBLA, ZLAPMT, ZLARFG, ZLASET,
$ ZLATZM, ZUNMQR, ZUNMRQ
$ SLCT_ZLATZM, ZUNMQR, ZUNMRQ
C .. Intrinsic Functions ..
INTRINSIC DCONJG, INT, MAX, MIN
C .. Executable Statements ..
Expand Down Expand Up @@ -315,7 +315,9 @@ SUBROUTINE AB8NXZ( N, M, P, RO, SIGMA, SVLMAX, ABCD, LDABCD,
DO 40 I1 = 1, SIGMA
CALL ZLARFG( RO+1, ABCD(IROW,I1), ABCD(IROW+1,I1), 1,
$ TC )
CALL ZLATZM( 'L', RO+1, MNU-I1, ABCD(IROW+1,I1), 1,
C RvP 170623 slicot-specific ZLATZM
TCCONJ = DCONJG( TC )
CALL SLCT_ZLATZM( 'L', RO+1, MNU-I1, ABCD(IROW+1,I1), 1,
$ DCONJG( TC ), ABCD(IROW,I1+1),
$ ABCD(IROW+1,I1+1), LDABCD, ZWORK )
IROW = IROW + 1
Expand Down
6 changes: 4 additions & 2 deletions slycot/src/AG08BY.f
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ SUBROUTINE AG08BY( FIRST, N, M, P, SVLMAX, ABCD, LDABCD, E, LDE,
EXTERNAL DLAMCH, DNRM2, IDAMAX, ILAENV
C .. External Subroutines ..
EXTERNAL DCOPY, DLAIC1, DLAPMT, DLARFG, DLARTG, DLASET,
$ DLATZM, DORMQR, DROT, DSWAP, MB03OY, XERBLA
$ SLCT_DLATZM, DORMQR, DROT, DSWAP, MB03OY,
$ XERBLA
C .. Intrinsic Functions ..
INTRINSIC ABS, DBLE, INT, MAX, MIN, SQRT
C .. Executable Statements ..
Expand Down Expand Up @@ -398,7 +399,8 @@ SUBROUTINE AG08BY( FIRST, N, M, P, SVLMAX, ABCD, LDABCD, E, LDE,
IROW = IROW + 1
CALL DLARFG( RO+1, ABCD(IROW,ICOL), ABCD(IROW+1,ICOL), 1,
$ T )
CALL DLATZM( 'L', RO+1, MNR-ICOL, ABCD(IROW+1,ICOL), 1, T,
CALL SLCT_DLATZM( 'L', RO+1, MNR-ICOL, ABCD(IROW+1,ICOL),
$ 1, T,
$ ABCD(IROW,ICOL+1), ABCD(IROW+1,ICOL+1),
$ LDABCD, DWORK )
CALL DCOPY( PR-ICOL, DUM, 0, ABCD(IROW+1,ICOL), 1 )
Expand Down
6 changes: 4 additions & 2 deletions slycot/src/AG8BYZ.f
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ SUBROUTINE AG8BYZ( FIRST, N, M, P, SVLMAX, ABCD, LDABCD, E, LDE,
EXTERNAL DLAMCH, DZNRM2, IDAMAX, ILAENV
C .. External Subroutines ..
EXTERNAL MB3OYZ, XERBLA, ZCOPY, ZLAIC1, ZLAPMT, ZLARFG,
$ ZLARTG, ZLASET, ZLATZM, ZROT, ZSWAP, ZUNMQR
$ ZLARTG, ZLASET, SLCT_ZLATZM, ZROT, ZSWAP,
$ ZUNMQR
C .. Intrinsic Functions ..
INTRINSIC ABS, DBLE, DCONJG, INT, MAX, MIN, SQRT
C .. Executable Statements ..
Expand Down Expand Up @@ -406,7 +407,8 @@ SUBROUTINE AG8BYZ( FIRST, N, M, P, SVLMAX, ABCD, LDABCD, E, LDE,
IROW = IROW + 1
CALL ZLARFG( RO+1, ABCD(IROW,ICOL), ABCD(IROW+1,ICOL), 1,
$ TC )
CALL ZLATZM( 'L', RO+1, MNR-ICOL, ABCD(IROW+1,ICOL), 1,
C RvP, replaced by slicot replacement for obsolete lapack routine
CALL SLCT_ZLATZM( 'L', RO+1, MNR-ICOL, ABCD(IROW+1,ICOL), 1,
$ DCONJG( TC ), ABCD(IROW,ICOL+1),
$ ABCD(IROW+1,ICOL+1), LDABCD, ZWORK )
CALL ZCOPY( PR-ICOL, DUM, 0, ABCD(IROW+1,ICOL), 1 )
Expand Down
1 change: 1 addition & 0 deletions slycot/src/MB03ND.f
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ INTEGER FUNCTION MB03ND( N, THETA, Q2, E2, PIVMIN, INFO )
C
C Error return.
C
MB03ND = ZERO
CALL XERBLA( 'MB03ND', -INFO )
RETURN
END IF
Expand Down
3 changes: 3 additions & 0 deletions slycot/src/MB03NY.f
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ DOUBLE PRECISION FUNCTION MB03NY( N, OMEGA, A, LDA, S, DWORK,
C
C Error return.
C
MB03NY = ZERO
CALL XERBLA( 'MB03NY', -INFO )
RETURN
END IF
Expand All @@ -177,6 +178,7 @@ DOUBLE PRECISION FUNCTION MB03NY( N, OMEGA, A, LDA, S, DWORK,
$ 1, DUMMY, 1, DWORK, LDWORK, INFO )
IF ( INFO.NE.0 ) THEN
INFO = 2
MB03NY = ZERO
RETURN
END IF
ELSE
Expand All @@ -196,6 +198,7 @@ DOUBLE PRECISION FUNCTION MB03NY( N, OMEGA, A, LDA, S, DWORK,
$ DWORK, INFO )
IF ( INFO.NE.0 ) THEN
INFO = 2
MB03NY = ZERO
RETURN
END IF
CWORK(1) = CWORK(N*N+1) + DBLE( N*N ) * CONE
Expand Down
16 changes: 9 additions & 7 deletions slycot/src/SB01BY.f
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ SUBROUTINE SB01BY( N, M, S, P, A, B, F, TOL, DWORK, INFO )
DOUBLE PRECISION DLAMC3, DLAMCH
EXTERNAL DLAMC3, DLAMCH
C .. External Subroutines ..
EXTERNAL DLANV2, DLARFG, DLASET, DLASV2, DLATZM, DROT
EXTERNAL DLANV2, DLARFG, DLASET, DLASV2, SLCT_DLATZM, DROT
C .. Intrinsic Functions ..
INTRINSIC ABS, MIN
C .. Executable Statements ..
Expand All @@ -148,7 +148,8 @@ SUBROUTINE SB01BY( N, M, S, P, A, B, F, TOL, DWORK, INFO )
F(1,1) = ( S - A(1,1) )/B1
IF( M.GT.1 ) THEN
CALL DLASET( 'Full', M-1, 1, ZERO, ZERO, F(2,1), M )
CALL DLATZM( 'Left', M, N, B(1,2), N, TAU1, F(1,1), F(2,1),
CALL SLCT_DLATZM( 'Left', M, N, B(1,2), N, TAU1,
$ F(1,1), F(2,1),
$ M, DWORK )
END IF
RETURN
Expand Down Expand Up @@ -185,7 +186,8 @@ SUBROUTINE SB01BY( N, M, S, P, A, B, F, TOL, DWORK, INFO )
C and H2.
C
CALL DLARFG( M, B(1,1), B(1,2), N, TAU1 )
CALL DLATZM( 'Right', N-1, M, B(1,2), N, TAU1, B(2,1), B(2,2),
CALL SLCT_DLATZM( 'Right', N-1, M, B(1,2), N, TAU1,
$ B(2,1), B(2,2),
$ N, DWORK )
B1 = B(1,1)
B21 = B(2,1)
Expand Down Expand Up @@ -322,10 +324,10 @@ SUBROUTINE SB01BY( N, M, S, P, A, B, F, TOL, DWORK, INFO )
C Compute H1*H2*F.
C
IF( M.GT.2 )
$ CALL DLATZM( 'Left', M-1, N, B(2,3), N, TAU2, F(2,1), F(3,1),
$ M, DWORK )
CALL DLATZM( 'Left', M, N, B(1,2), N, TAU1, F(1,1), F(2,1), M,
$ DWORK )
$ CALL SLCT_DLATZM( 'Left', M-1, N, B(2,3), N, TAU2,
$ F(2,1), F(3,1), M, DWORK )
CALL SLCT_DLATZM( 'Left', M, N, B(1,2), N, TAU1,
$ F(1,1), F(2,1), M, DWORK )
C
RETURN
C *** Last line of SB01BY ***
Expand Down
6 changes: 3 additions & 3 deletions slycot/src/SB01FY.f
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ SUBROUTINE SB01FY( DISCR, N, M, A, LDA, B, LDB, F, LDF, V, LDV,
DOUBLE PRECISION DLAPY2, DLAPY3
EXTERNAL DLAPY2, DLAPY3
C .. External Subroutines ..
EXTERNAL DLARFG, DLASET, DLATZM, DROTG, DTRTRI, MA02AD,
$ MB04OX, SB03OY
EXTERNAL DLARFG, DLASET, SLCT_DLATZM, DROTG, DTRTRI,
$ MA02AD, MB04OX, SB03OY
C .. Intrinsic Functions ..
INTRINSIC ABS, SQRT
C .. Executable Statements ..
Expand Down Expand Up @@ -180,7 +180,7 @@ SUBROUTINE SB01FY( DISCR, N, M, A, LDA, B, LDB, F, LDF, V, LDV,
C
IF( M.GT.1 ) THEN
CALL DLARFG( M, F(1,1), F(2,1), 1, TEMP )
CALL DLATZM( 'Left', M, N-1, F(2,1), 1, TEMP, F(1,2),
CALL SLCT_DLATZM( 'Left', M, N-1, F(2,1), 1, TEMP, F(1,2),
$ F(2,2), LDF, V )
END IF
R11 = F(1,1)
Expand Down
2 changes: 1 addition & 1 deletion slycot/src/SB03MD.f
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBROUTINE SB03MD( DICO, JOB, FACT, TRANA, N, C, LDC, A, LDA, U,
SUBROUTINE SB03MD( DICO, JOB, FACT, TRANA, N, C, LDC, A, LDA, U,
$ LDU, SCALE, SEP, FERR, WR, WI, IWORK, DWORK,
$ LDWORK, INFO )
C
Expand Down
Loading