Skip to content
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

Upgrading installation to setuptools #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
32 changes: 27 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
sudo: false

language: python

addons:
apt:
packages:
- libeigen3-dev

python:
- 2.6
- 2.7
- 3.2
- 3.3
- 3.4

before_install:
- uname -a
- free -m
- df -h
- ulimit -a
- pip install -U pip wheel setuptools
- pip install numpy cython nose
- python -V

install:
- sudo apt-get install -qq libeigen3-dev
- pip install cython==0.19.2 --use-mirrors
- cython --version
- pip install .

script:
- BENCHMARK=1 python setup.py -v test
- cd $HOME
- mkdir empty
- cd empty
- BENCHMARK=1 nosetests ceygen

cache:
directories:
- $HOME/.cache/pip

3 changes: 1 addition & 2 deletions ceygen/core.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# Distributed under the terms of the GNU General Public License v2 or any
# later version of the license, at your option.

from dtype cimport dtype

from .dtype cimport dtype

cpdef bint set_is_malloc_allowed(bint allowed) nogil
cpdef tuple eigen_version()
Expand Down
11 changes: 8 additions & 3 deletions ceygen/core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# Copyright (c) 2013 Matěj Laitl <[email protected]>
# Distributed under the terms of the GNU General Public License v2 or any
# later version of the license, at your option.
from __future__ import absolute_import

cimport cython

from eigen_cython cimport *
from dispatch cimport *
from dtype cimport vector, matrix
from .eigen_cython cimport *
from .dispatch cimport *
from .dtype cimport vector, matrix, dtype


cpdef bint set_is_malloc_allowed(bint allowed) nogil:
Expand All @@ -27,6 +28,7 @@ cdef void dot_vv_worker(
y.init(y_data, y_shape, y_strides)
o[0] = x.dot(y)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype dot_vv(dtype[:] x, dtype[:] y) nogil except *:
Expand All @@ -49,6 +51,7 @@ cdef void dot_mv_worker(
o.init(o_data, o_shape, o_strides)
o.noalias_assign(x * y)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:] dot_mv(dtype[:, :] x, dtype[:] y, dtype[:] out = None) nogil:
Expand All @@ -74,6 +77,7 @@ cdef void dot_vm_worker(
o.init(o_data, o_shape, o_strides)
o.noalias_assign(x * y)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:] dot_vm(dtype[:] x, dtype[:, :] y, dtype[:] out = None) nogil:
Expand Down Expand Up @@ -102,6 +106,7 @@ cdef void dot_mm_worker(
o.init(o_data, o_shape, o_strides)
o.noalias_assign(x * y)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:, :] dot_mm(dtype[:, :] x, dtype[:, :] y, dtype[:, :] out = None) nogil:
Expand Down
3 changes: 3 additions & 0 deletions ceygen/dtype.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright (c) 2013 Matěj Laitl <[email protected]>
# Distributed under the terms of the GNU General Public License v2 or any
# later version of the license, at your option.
from __future__ import absolute_import

from cython cimport view

Expand All @@ -24,8 +25,10 @@ cdef inline str get_format(dtype *dummy):
if dtype is double:
return 'd'


cdef dtype[:] vector(int size, dtype *like) with gil:
return view.array(shape=(size,), itemsize=sizeof(dtype), format=get_format(like))


cdef dtype[:, :] matrix(int rows, int cols, dtype *like) with gil:
return view.array(shape=(rows, cols), itemsize=sizeof(dtype), format=get_format(like))
2 changes: 1 addition & 1 deletion ceygen/eigen_cython.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from libcpp cimport bool

from dtype cimport dtype
from .dtype cimport dtype


cdef extern from "eigen_cpp.h":
Expand Down
2 changes: 1 addition & 1 deletion ceygen/elemwise.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Distributed under the terms of the GNU General Public License v2 or any
# later version of the license, at your option.

from dtype cimport dtype
from .dtype cimport dtype


cdef dtype[:] add_vs(dtype[:] x, dtype y, dtype[:] out = *) nogil
Expand Down
21 changes: 18 additions & 3 deletions ceygen/elemwise.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# Copyright (c) 2013 Matěj Laitl <[email protected]>
# Distributed under the terms of the GNU General Public License v2 or any
# later version of the license, at your option.
from __future__ import absolute_import

cimport cython

from eigen_cython cimport *
from dispatch cimport *
from dtype cimport vector, matrix
from .eigen_cython cimport *
from .dispatch cimport *
from .dtype cimport vector, matrix, dtype


cdef void add_vs_worker(
Expand All @@ -20,6 +21,7 @@ cdef void add_vs_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x + y[0])


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:] add_vs(dtype[:] x, dtype y, dtype[:] out = None) nogil:
Expand All @@ -42,6 +44,7 @@ cdef void multiply_vs_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x * y[0])


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:] multiply_vs(dtype[:] x, dtype y, dtype[:] out = None) nogil:
Expand All @@ -64,6 +67,7 @@ cdef void power_vs_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x.pow(y[0]))


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:] power_vs(dtype[:] x, dtype y, dtype[:] out = None) nogil:
Expand All @@ -88,6 +92,7 @@ cdef void add_vv_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x + y)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:] add_vv(dtype[:] x, dtype[:] y, dtype[:] out = None) nogil:
Expand All @@ -112,6 +117,7 @@ cdef void subtract_vv_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x - y)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:] subtract_vv(dtype[:] x, dtype[:] y, dtype[:] out = None) nogil:
Expand All @@ -136,6 +142,7 @@ cdef void multiply_vv_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x * y)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:] multiply_vv(dtype[:] x, dtype[:] y, dtype[:] out = None) nogil:
Expand All @@ -160,6 +167,7 @@ cdef void divide_vv_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x / y)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:] divide_vv(dtype[:] x, dtype[:] y, dtype[:] out = None) nogil:
Expand All @@ -182,6 +190,7 @@ cdef void add_ms_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x + y[0])


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:, :] add_ms(dtype[:, :] x, dtype y, dtype[:, :] out = None) nogil:
Expand All @@ -206,6 +215,7 @@ cdef void multiply_ms_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x * y[0])


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:, :] multiply_ms(dtype[:, :] x, dtype y, dtype[:, :] out = None) nogil:
Expand All @@ -230,6 +240,7 @@ cdef void power_ms_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x.pow(y[0]))


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:, :] power_ms(dtype[:, :] x, dtype y, dtype[:, :] out = None) nogil:
Expand All @@ -256,6 +267,7 @@ cdef void add_mm_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x + y)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:, :] add_mm(dtype[:, :] x, dtype[:, :] y, dtype[:, :] out = None) nogil:
Expand Down Expand Up @@ -283,6 +295,7 @@ cdef void subtract_mm_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x - y)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:, :] subtract_mm(dtype[:, :] x, dtype[:, :] y, dtype[:, :] out = None) nogil:
Expand Down Expand Up @@ -310,6 +323,7 @@ cdef void multiply_mm_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x * y)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:, :] multiply_mm(dtype[:, :] x, dtype[:, :] y, dtype[:, :] out = None) nogil:
Expand Down Expand Up @@ -337,6 +351,7 @@ cdef void divide_mm_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x / y)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef dtype[:, :] divide_mm(dtype[:, :] x, dtype[:, :] y, dtype[:, :] out = None) nogil:
Expand Down
2 changes: 1 addition & 1 deletion ceygen/llt.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Distributed under the terms of the GNU General Public License v2 or any
# later version of the license, at your option.

from dtype cimport nonint_dtype
from .dtype cimport nonint_dtype


cdef nonint_dtype[:, :] cholesky(nonint_dtype[:, :] x, nonint_dtype[:, :] out = *) nogil
8 changes: 5 additions & 3 deletions ceygen/llt.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# Copyright (c) 2013 Matěj Laitl <[email protected]>
# Distributed under the terms of the GNU General Public License v2 or any
# later version of the license, at your option.
from __future__ import absolute_import

cimport cython

from eigen_cython cimport *
from dispatch cimport *
from dtype cimport matrix
from .eigen_cython cimport *
from .dispatch cimport *
from .dtype cimport matrix


cdef void cholesky_worker(
Expand All @@ -20,6 +21,7 @@ cdef void cholesky_worker(
o.init(o_data, o_shape, o_strides)
o.assign(x.llt_matrixL())


@cython.boundscheck(False)
@cython.wraparound(False)
cdef nonint_dtype[:, :] cholesky(nonint_dtype[:, :] x, nonint_dtype[:, :] out = None) nogil:
Expand Down
2 changes: 1 addition & 1 deletion ceygen/lu.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Distributed under the terms of the GNU General Public License v2 or any
# later version of the license, at your option.

from dtype cimport dtype, nonint_dtype
from .dtype cimport nonint_dtype, dtype


cdef nonint_dtype[:, :] inv(nonint_dtype[:, :] x, nonint_dtype[:, :] out = *) nogil
Expand Down
10 changes: 7 additions & 3 deletions ceygen/lu.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# Copyright (c) 2013 Matěj Laitl <[email protected]>
# Distributed under the terms of the GNU General Public License v2 or any
# later version of the license, at your option.
from __future__ import absolute_import

cimport cython

from eigen_cython cimport *
from dispatch cimport *
from dtype cimport matrix
from .eigen_cython cimport *
from .dispatch cimport *
from .dtype cimport matrix, nonint_dtype, dtype


cdef void inv_worker(
Expand All @@ -20,6 +21,7 @@ cdef void inv_worker(
o.init(o_data, o_shape, o_strides)
o.assign_inverse(x)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef nonint_dtype[:, :] inv(nonint_dtype[:, :] x, nonint_dtype[:, :] out = None) nogil:
Expand All @@ -42,6 +44,7 @@ cdef void iinv_worker(
# why this doesn't exhibit aliasing problems?
x.assign_inverse(x)


@cython.boundscheck(False)
@cython.wraparound(False)
cdef bint iinv(nonint_dtype[:, :] x) nogil except False:
Expand All @@ -59,6 +62,7 @@ cdef void det_worker(
x.init(x_data, x_shape, x_strides)
o[0] = x.determinant()


@cython.boundscheck(False)
@cython.wraparound(False)
cdef nonint_dtype det(nonint_dtype[:, :] x) nogil except *:
Expand Down
Loading