8000 Upgrade to Lapack lite 3.2.2 by eric-wieser · Pull Request #8649 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Upgrade to Lapack lite 3.2.2 #8649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions doc/release/1.13.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,18 @@ array, in the same way that ``sort`` already did. Additionally, the
Note that this argument is not added at the end, so breaks any code that
passed ``fill_value`` as a positional argument.

Bundled version of LAPACK is now 3.2.2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NumPy comes bundled with a minimal implementation of lapack for systems without
a lapack library installed, under the name of ``lapack_lite``. This has been
upgraded from LAPACK 3.0.0 (June 30, 1999) to LAPACK 3.2.2 (June 30, 2010). See
the `LAPACK changelogs`_ for details on the all the changes this entails.

While no new features are exposed through ``numpy``, this fixes some bugs
regarding "workspace" sizes, and in some places may use faster algorithms.

.. _`LAPACK changelogs`: http://www.netlib.org/lapack/release_notes.html#_4_history_of_lapack_releases

Changes
=======

Expand Down
12 changes: 6 additions & 6 deletions numpy/linalg/lapack_lite/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Regenerating lapack_lite source
===============================

:Author: David M. Cooke <cookedm@physics.mcmaster.ca>
:Authors: * David M. Cooke <cookedm@physics.mcmaster.ca>
* Eric Wieser (upgraded lapack version on 2017-03-26)

The ``numpy/linalg/f2c_*.c`` files are ``f2c``'d versions of the LAPACK routines
required by the ``LinearAlgebra`` module, and wrapped by the ``lapack_lite``
Expand All @@ -27,10 +28,9 @@ similar to that done to generate the CLAPACK_ distribution.

.. _CLAPACK: http://netlib.org/clapack/index.html

The versions in the numpy git repo use the LAPACK source from the
`Debian package lapack3`_, version 3.0.20000531a-6. It was found that these
(being regularly maintained) worked better than the patches to the last
released version of LAPACK available at the LAPACK_ page.
The output C files in git use the LAPACK source from the LAPACK_ page, using
version 3.2.2. Unfortunately, newer versions use newer FORTRAN features, which
are increasingly not supported by ``f2c``. As these are found, the patch files
will need to be changed to re-express new constructs with legacy constructs.

.. _Debian package lapack3: https://archive.debian.net/source/etch/lapack3
.. _LAPACK: http://netlib.org/lapack/index.html
2 changes: 1 addition & 1 deletion numpy/linalg/lapack_lite/clapack_scrub.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def endArgs(self, text):
"i_len", "do_fio", "do_lio") + iofun

# Routines to not scrub the ftnlen argument from
keep_ftnlen = (Str('ilaenv_') | Str('s_rnge')) + Str('(')
keep_ftnlen = (Str('ilaenv_') | Str('iparmq_') | Str('s_rnge')) + Str('(')

lexicon = Lexicon([
(iofunctions, TEXT),
Expand Down
84 changes: 84 additions & 0 deletions numpy/linalg/lapack_lite/f2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,17 @@ return( (*x)>=0 ?
}


#ifdef KR_headers
double floor();
integer i_nint(x) real *x;
#else
#undef abs
integer i_nint(real *x)
#endif
{
return (integer)(*x >= 0 ? floor(*x + .5) : -floor(.5 - *x));
}

#ifdef KR_headers
double pow();
double pow_dd(ap, bp) doublereal *ap, *bp;
Expand Down Expand Up @@ -272,6 +283,79 @@ if(n != 0)
}
return(pow);
}

#ifdef KR_headers
VOID pow_zi(p, a, b) /* p = a**b */
doublecomplex *p, *a; integer *b;
#else
extern void z_div(doublecomplex*, doublecomplex*, doublecomplex*);
void pow_zi(doublecomplex *p, doublecomplex *a, integer *b) /* p = a**b */
#endif
{
integer n;
unsigned long u;
double t;
doublecomplex q, x;
static doublecomplex one = {1.0, 0.0};

n = *b;
q.r = 1;
q.i = 0;

if(n == 0)
goto done;
if(n < 0)
{
n = -n;
z_div(&x, &one, a);
}
else
{
x.r = a->r;
x.i = a->i;
}

for(u = n; ; )
{
if(u & 01)
{
t = q.r * x.r - q.i * x.i;
q.i = q.r * x.i + q.i * x.r;
q.r = t;
}
if(u >>= 1)
{
t = x.r * x.r - x.i * x.i;
x.i = 2 * x.r * x.i;
x.r = t;
}
else
break;
}
done:
p->i = q.i;
p->r = q.r;
}

#ifdef KR_headers
VOID pow_ci(p, a, b) /* p = a**b */
complex *p, *a; integer *b;
#else
extern void pow_zi(doublecomplex*, doublecomplex*, integer*);
void pow_ci(complex *p, complex *a, integer *b) /* p = a**b */
#endif
{
doublecomplex p1, a1;

a1.r = a->r;
a1.i = a->i;

pow_zi(&p1, &a1, b);

p->r = p1.r;
p->i = p1.i;
}

/* Unless compiled with -DNO_OVERWRITE, this variant of s_cat allows the
* target of a concatenation to appear on its right-hand side (contrary
* to the Fortran 77 Standard, but in accordance with Fortran 90).
Expand Down
Loading
0