Kiko | 8 Aug 09:31 2014

Calculation of a hessian

Hi all,

I am trying to calculate a Hessian. I am using numdifftools for this (

My question is, is it possible to make it using pure numpy?.

The actual code is like this:

import numdifftools as nd
import numpy as np

def log_likelihood(params):
    sum1 = 0; sum2 = 0
    mu = params[0]; sigma = params[1]; xi = params[2]
    for z in data:
        x = 1 + xi * ((z-mu)/sigma)
        sum1 += np.log(x)
        sum2 += x**(-1.0/xi)
    return -((-len(data) * np.log(sigma)) - (1 + 1/xi)*sum1 - sum2) # negated so we can use 'minimum'

kk = nd.Hessian(log_likelihood)

Thanks in advance.
NumPy-Discussion mailing list
NumPy-Discussion <at>
Charles R Harris | 8 Aug 04:32 2014

OpenBLAS and dotblas

Hi All,

It looks like numpy dot only uses BLAS if ATLAS is present, see numpy/core/ Has anyone done the mods needed to use OpenBLAS? What is the current status of using OpenBLAS with numpy?

Also, I'm thinking of moving linalg/lapack_lite/blas_lite.c down into the core. Thoughts?

NumPy-Discussion mailing list
NumPy-Discussion <at>
Nicolas P. Rougier | 7 Aug 13:16 2014

Inverted indices


I've a small problem for which I cannot find a solution and I'm quite sure there is an obvious one:

I've an array Z (any dtype) with some data.
I've a (sorted) array I (of integer, same size as Z) that tells me the  index of Z[i]  (if necessary, the index
can be stored in Z).

Now, I have an arbitrary sequence S of indices (in the sense of I), how do I build the corresponding data ?

Here is a small example:

Z = [(0,0), (1,1), (2,2), (3,3), (4,4))
I  = [0, 20, 23, 24, 37]

S = [ 20,20,0,24]
-> Result should be [(1,1), (1,1), (0,0),(3,3)]

S = [15,15]
-> Wrong (15 not in I) but ideally, I would like this to be converted to [(0,0), (0,0)]

Any idea ?

Charles R Harris | 6 Aug 22:42 2014

How to give feedback to github

Does anyone know how to complain about features to github? The new author selection list for PRs is practically useless as 1) it only lists authors belonging to the project and 2) it doesn't list the number of PRs for each author. The old list was far more useful.

NumPy-Discussion mailing list
NumPy-Discussion <at>
Charles R Harris | 6 Aug 03:19 2014

Preliminary thoughts on implementing __matmul__

Hi All,

I've been looking to implement the " <at> " operator from Python 3.5. Looking at the current implementation of the dot function, it only uses a vector inner product, which is either that defined in arraytypes.c.src or a version using cblas defined in _dotblas for the float, cfloat, double, cdouble types. I note that the versions defined in arraytypes.c.src include all the numeric types plus boolean, datetime, timedelta, and object. I'm not clear why datetime and timedelta should have dot products, except perhaps for scalar multiplication. The boolean version has the advantage that it can short circuit. I also note that all the operations proposed for " <at> " can easily be done with einsum except for objects. So I'm wondering if one easy way to implement the functions is to extend einsum to work with objects and make it use blas when available.

Another thing that may be worth looking into would be some way to multiply by the complex conjugate, as that is easy to implement at the low level. I'd welcome any thoughts as to how that might be done.

Anyway, I'm just looking for a discussion and ideas here. Any input is welcome.

NumPy-Discussion mailing list
NumPy-Discussion <at>
Julian Taylor | 5 Aug 21:45 2014

ANN: NumPy 1.8.2 release candidate


I am pleased to announce the first release candidate for numpy 1.8.2, a
pure bugfix release for the 1.8.x series.

If no regressions show up the final release is planned this weekend.
The upgrade is recommended for all users of the 1.8.x series.

Following issues have been fixed:
* gh-4836: partition produces wrong results for multiple selections in
equal ranges
* gh-4656: Make fftpack._raw_fft threadsafe
* gh-4628: incorrect argument order to _copyto in in np.nanmax, np.nanmin
* gh-4613: Fix lack of NULL check in array_richcompare
* gh-4642: Hold GIL for converting dtypes types with fields
* gh-4733: fix np.linalg.svd(b, compute_uv=False)
* gh-4853: avoid unaligned simd load on reductions on i386
* gh-4774: avoid unaligned access for strided byteswap
* gh-650: Prevent division by zero when creating arrays from some buffers
* gh-4602: ifort has issues with optimization flag O2, use O1

Source tarballs, windows installers and release notes can be found at

Julian Taylor

NumPy-Discussion mailing list
NumPy-Discussion <at>
Jurgens de Bruin | 5 Aug 14:58 2014

Array2 subset of array1


I am new to numpy so any help would be greatly appreciated.

I have two arrays:

    array1 = np.arange(1,100+1)
    array2 = np.arange(1,50+1)

How can I calculate/determine if array2 is a subset of array1 (falls within array 1)

Something like : array2 in array1 = TRUE for the case above.

NumPy-Discussion mailing list
NumPy-Discussion <at>
Julian Taylor | 5 Aug 00:05 2014

last call for numpy 1.8.2 bugfixes

as numpy 1.9 is going to be a relative hard upgrade as indexing changes
expose a couple bugs in third party packages and the large amount of
small little incompatibilities I will create a numpy 1.8.2 release
tomorrow with a couple of important or hard to work around bugfixes.

The most important bugfix is fixing the wrong result partition with
multiple selections could produce if selections ended up in an equal
range, see (if the crash is
still unreproducable, help appreciated).

the rest of the fixes are small ones listed below.
If I have missed one or you consider one of the fixes to invasive for a
bugfix release please speak up now.
As the number of fixes is small I will skip a release candidate.

Make fftpack._raw_fft threadsafe

Prevent division by zero

Fix lack of NULL check in array_richcompare

incorrect argument order to _copyto in in np.nanmax, np.nanmin

Hold GIL for types with fields, fixes

svd ufunc typo

check alignment of strides for byteswap

add missing elementsize alignment check for simd reductions

ifort has issues with optimization flag /O2

NumPy-Discussion mailing list
NumPy-Discussion <at>
tpoole | 4 Aug 17:47 2014

Requesting Code Review of weighted covariance ENH

Hi everyone,

I've added the ability to handle weighted data in a covariance calculation,
in a similar manner to that already implemented for the calculation of a
weighted average.

Could an experienced someone please look over my changes before I submit a
pull request?

Validation of the formula can be found at 

"Exponential smoothing weighted correlations", F. Pozzi, T. Matteo, and T.
Aste, Eur. Phys. J. B. 85, 175 (2012).  --- though it is unfortunately


"An Analysis of WinCross, SPSS, and Mentor Procedures for Estimating the
Variance of a Weighted Mean", A. Madansky and H. G. B. Alexander,

for the "effective number of samples".



View this message in context:
Sent from the Numpy-discussion mailing list archive at
Charles R Harris | 2 Aug 23:33 2014

Class to experiment with ' <at> '

Hi All,

I've attached a subclass of ndarray that implements the new ' <at> ' operator for experimentation and comment. It is only intended for playing with that operator and may not work for other things. You will need to install python 3.5.0a1 to play with it.

Attachment ( text/x-python, 1292 bytes
NumPy-Discussion mailing list
NumPy-Discussion <at>
Charles R Harris | 2 Aug 19:14 2014

It lives! Or at least is not undead

charris <at> localhost [matmul (master)]$ python3.5
Python 3.5.0a0 (default:4425024f2e01, Aug  2 2014, 10:10:31)
[GCC 4.8.3 20140624 (Red Hat 4.8.3-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import testing
>>> a = np.ones(3).view(testing.marray)
>>> a <at> 3
marray([ 3.,  3.,  3.])
>>> 3 <at> a
marray([ 3.,  3.,  3.])
>>> a <at> np.eye(3)
marray([ 1.,  1.,  1.])
>>> np.eye(3) <at> a
marray([ 1.,  1.,  1.])

This was just for quick experimentation.

NumPy-Discussion mailing list
NumPy-Discussion <at>