commit_hash
stringlengths
40
40
author
stringlengths
1
57
date
timestamp[s]date
2010-07-26 04:45:09
2026-04-14 18:21:10
message
stringlengths
8
1.39M
diff
stringlengths
68
51.2k
files_changed
int64
1
136
insertions
int64
0
2.35k
deletions
int64
0
1.9k
c581425acf93cb54c84e85dd54479ab92c0da61e
Yuji Kanagawa
2021-11-06T08:45:04
Revise the document for Element with using #Safety
diff --git a/src/dtype.rs b/src/dtype.rs index 5736a371..051a6cd9 100644 --- a/src/dtype.rs +++ b/src/dtype.rs @@ -170,13 +170,17 @@ impl DataType { /// Represents that a type can be an element of `PyArray`. /// +/// Currently, only integer/float/complex types are supported. +/// If you come up with a nice implemen...
1
7
3
ebcd58bcaa54b5061b2bc36b9466f2d82ecbf108
Yuji Kanagawa
2021-11-05T13:06:29
Mark `Element` unsafe
diff --git a/src/dtype.rs b/src/dtype.rs index e3313766..5736a371 100644 --- a/src/dtype.rs +++ b/src/dtype.rs @@ -169,7 +169,15 @@ impl DataType { } /// Represents that a type can be an element of `PyArray`. -pub trait Element: Clone + Send { +/// +/// A type `T` that implements this trait should be safe when mana...
1
10
2
af362e23c59a9755aa14547f4ca0798cca25e159
messense
2021-11-04T03:33:28
Upgrade pyo3 to 0.15
diff --git a/Cargo.toml b/Cargo.toml index 73618a06..a39b6b9f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,10 +18,10 @@ libc = "0.2" num-complex = ">= 0.2, <= 0.4" num-traits = "0.2" ndarray = ">= 0.13, < 0.16" -pyo3 = { version = "0.14", default-features = false } +pyo3 = { version = "0.15", default-features = f...
3
4
4
a7d39921413998cf1b5702f89010dc8a47dc3b49
fzyzcjy
2021-10-09T02:41:32
fix typo in documentation
diff --git a/src/convert.rs b/src/convert.rs index ca85c197..a642556b 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -79,7 +79,7 @@ where /// Conversion trait from rust types to `PyArray`. /// -/// This trait takes `&self`, which means **it alocates in Python heap and then copies +/// This trait takes `&self`,...
1
1
1
3257fd9b952359d01e1a30639e01f404f97cb9bf
Adam Reichold
2021-09-18T20:03:53
Re-export ndarray to avoid having to specify the correct version in downstream crates.
diff --git a/src/lib.rs b/src/lib.rs index 0634495b..6b01a86a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -45,6 +45,8 @@ mod readonly; mod slice_box; mod sum_products; +pub use ndarray; + pub use crate::array::{ get_array_module, PyArray, PyArray0, PyArray1, PyArray2, PyArray3, PyArray4, PyArray5, PyArra...
1
2
0
f8a8e841ee98f67b9b2f0ded92593f4bb93bb80f
Matthew Treinish
2021-08-29T14:56:51
Remove resolver argument from Cargo.toml When building rust-numpy with the rust/cargo 1.48 packaged on Debian bullseye the build fails because in Cargo 1.48 the resolver option was a nightly only feature and Cargo errors. This feature wasn't stabilized until 1.51. I think we aren't catching this in the MSRV jobs becau...
diff --git a/Cargo.toml b/Cargo.toml index 4a532646..73618a06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,6 @@ edition = "2018" repository = "https://github.com/rust-numpy/rust-numpy" keywords = ["numpy", "python", "binding"] license = "BSD-2-Clause" -resolver = "2" [dependencies] cfg-if = "0.1"
1
0
1
f780c6f9d16eeaeaa799d9e9ee488fd568495292
Adam Reichold
2021-07-12T15:04:13
Avoid offset_from to keep compatibility with Rust 1.41.
diff --git a/src/convert.rs b/src/convert.rs index 4023db35..ca85c197 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -62,12 +62,12 @@ where let (strides, dim) = (self.npy_strides(), self.raw_dim()); let orig_ptr = self.as_ptr(); // Element of which size is 0 is not supported, but check i...
1
2
2
57df0bc37e4b247d8803f5cdbae31b32aff173f7
messense
2021-07-11T10:49:49
Use `#[cfg(test)]`
diff --git a/src/array.rs b/src/array.rs index 58cc91dd..ab91fe74 100644 --- a/src/array.rs +++ b/src/array.rs @@ -1074,20 +1074,25 @@ impl<T: Element + AsPrimitive<f64>> PyArray<T, Ix1> { } } -#[test] -fn test_get_unchecked() { - pyo3::Python::with_gil(|py| { - let array = PyArray::from_slice(py, &[1...
2
33
23
f81df0ad276faf8348713acb0dd60a15c80296ea
kngwyu
2021-07-12T01:20:50
Fix zero-size check in ArrayBase::into_pyarray
diff --git a/src/convert.rs b/src/convert.rs index 894976f5..4023db35 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -61,7 +61,8 @@ where fn into_pyarray<'py>(self, py: Python<'py>) -> &'py PyArray<Self::Item, Self::Dim> { let (strides, dim) = (self.npy_strides(), self.raw_dim()); let orig_p...
1
2
1
9e856a2337bf04c0531b718f1cfc7004ffce75ee
kngwyu
2021-07-10T08:55:49
Fix IntoPyArray for arrays of which the starting pointer is not equal to the pointer of the 1st element
diff --git a/src/array.rs b/src/array.rs index 512829ed..58cc91dd 100644 --- a/src/array.rs +++ b/src/array.rs @@ -415,14 +415,15 @@ impl<T: Element, D: Dimension> PyArray<T, D> { py: Python<'py>, dims: ID, strides: *const npy_intp, - slice: Box<[T]>, + boxed_slice: Box<[T]>, + ...
3
32
8
30c4be1667b9187972377bbb16b6509bfe45dd0f
kngwyu
2021-07-10T07:29:07
Convert int64 to NPY_LONG if possible
diff --git a/src/dtype.rs b/src/dtype.rs index 0e2f1b70..e3313766 100644 --- a/src/dtype.rs +++ b/src/dtype.rs @@ -132,6 +132,9 @@ impl DataType { DataType::Int8 => NPY_TYPES::NPY_BYTE, DataType::Int16 => NPY_TYPES::NPY_SHORT, DataType::Int32 => NPY_TYPES::NPY_INT, + #[...
1
3
0
537a0e6a420f3abefd56ddde6314df31df6e7191
Adam Reichold
2021-07-06T06:13:50
Avoid raw pointers in SliceBox and make the Send bound explicit.
diff --git a/src/array.rs b/src/array.rs index c52cefda..512829ed 100644 --- a/src/array.rs +++ b/src/array.rs @@ -422,7 +422,7 @@ impl<T: Element, D: Dimension> PyArray<T, D> { { let dims = dims.into_dimension(); let container = SliceBox::new(slice); - let data_ptr = container.data; + ...
3
17
18
99e09b7bee6145e8d20e08569590d77b71acdbfc
Adam Reichold
2021-07-04T17:27:48
Make Clippy (mostly) happy.
diff --git a/src/npyiter.rs b/src/npyiter.rs index 26ce4fdd..d03c1a98 100644 --- a/src/npyiter.rs +++ b/src/npyiter.rs @@ -51,7 +51,7 @@ pub enum NpyIterFlag { } impl NpyIterFlag { - fn to_c_enum(&self) -> npy_uint32 { + fn to_c_enum(self) -> npy_uint32 { use NpyIterFlag::*; match self { ...
2
5
7
cdb1ed9890809b2cb0815efd579cedd5c54f2393
Adam Reichold
2021-07-04T16:51:34
Avoid deprecation warnings in example projects.
diff --git a/examples/linalg/src/lib.rs b/examples/linalg/src/lib.rs index 339a2543..448f937d 100755 --- a/examples/linalg/src/lib.rs +++ b/examples/linalg/src/lib.rs @@ -5,7 +5,7 @@ use pyo3::prelude::{pymodule, PyErr, PyModule, PyResult, Python}; #[pymodule] fn rust_linalg(_py: Python<'_>, m: &PyModule) -> PyResu...
2
7
4
a7c73ea212ad2620792eca11df197b4516e14480
kngwyu
2021-06-07T09:26:07
Bump version to 0.13.2
diff --git a/Cargo.toml b/Cargo.toml index 79c114f1..9b3c3df9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "numpy" -version = "0.13.1" +version = "0.13.2" authors = [ "Toshiki Teramura <toshiki.teramura@gmail.com>", "Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>",
1
1
1
4e91fc7748e85ffd5758f309808414327f4d3d50
Jonathan Kelley
2021-05-09T20:28:10
Feat: bump numcomplex
diff --git a/Cargo.toml b/Cargo.toml index bb2b693e..514d34e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,10 @@ [package] name = "numpy" version = "0.13.1" -authors = ["Toshiki Teramura <toshiki.teramura@gmail.com>", "Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>"] +authors = [ + "Toshiki Teramura <toshi...
1
5
2
7817be6332ab3a0e0bb5943a45af7b0b63507ce1
Mara Bos
2021-05-06T11:17:01
Don't enable pyo3/macros by default.
diff --git a/Cargo.toml b/Cargo.toml index 8953518f..bb2b693e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ edition = "2018" repository = "https://github.com/rust-numpy/rust-numpy" keywords = ["numpy", "python", "binding"] license = "BSD-2-Clause" +resolver = "2" [dependencies] cfg-if = "0.1" @@ -15,6...
1
4
0
f848bc4e7aa195c2dffa25585458487dbe7c3873
Gaëtan Cassiers
2021-04-06T14:06:34
Support ndarray 0.15
diff --git a/Cargo.toml b/Cargo.toml index 40379726..a314ec38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ cfg-if = "0.1" libc = "0.2" num-complex = ">= 0.2, < 0.4" num-traits = "0.2" -ndarray = ">= 0.13, < 0.15" +ndarray = ">= 0.13, < 0.16" pyo3 = "0.13" [features]
1
1
1
50598d99ac47cbbe78d6b34f261e6d0aca89967c
Arun Lobo
2021-04-03T18:22:09
Publish with `license` field instead of `license-file` Specifying a `license-file` field informs crates.io that this crate is under a non-standard license[1], and it publishes the package as such[2]. Specifying the license with the `license` field allows crates.io to expose the actual license information, which allows...
diff --git a/Cargo.toml b/Cargo.toml index 40379726..8953518f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ documentation = "https://pyo3.github.io/rust-numpy/numpy" edition = "2018" repository = "https://github.com/rust-numpy/rust-numpy" keywords = ["numpy", "python", "binding"] -license-file = "LICENSE"...
1
1
1
eb99fe7a68c404a91cae37fb7102d6bb748fb8b0
kngwyu
2021-02-06T07:45:36
Add docs for inner, dot, einsum, and pyarray
diff --git a/src/array.rs b/src/array.rs index fa54d5a7..33fc6681 100644 --- a/src/array.rs +++ b/src/array.rs @@ -710,6 +710,8 @@ impl<T: Element, D: Dimension> PyArray<T, D> { impl<T: Copy + Element> PyArray<T, Ix0> { /// Get the element of zero-dimensional PyArray. + /// + /// See [inner](../fn.inner.h...
3
92
24
dd2266422c01fee6725e9ebecd48d8367bbb3871
kngwyu
2021-02-06T06:23:22
Add PyArray0
diff --git a/src/array.rs b/src/array.rs index b95fa792..fa54d5a7 100644 --- a/src/array.rs +++ b/src/array.rs @@ -77,6 +77,8 @@ use crate::slice_box::SliceBox; /// ``` pub struct PyArray<T, D>(PyAny, PhantomData<T>, PhantomData<D>); +/// Zero-dimensional array. +pub type PyArray0<T> = PyArray<T, Ix0>; /// One-dim...
2
11
4
877ba286737fbe215ec8a67ed50b9134e38cff75
kngwyu
2021-01-24T03:31:38
Remove unused items from examples
diff --git a/src/array.rs b/src/array.rs index 10f9ec15..b95fa792 100644 --- a/src/array.rs +++ b/src/array.rs @@ -64,10 +64,9 @@ use crate::slice_box::SliceBox; /// # Example /// ``` /// # #[macro_use] extern crate ndarray; -/// use pyo3::{GILGuard, Python}; /// use numpy::PyArray; /// use ndarray::Array; -/// Py...
1
3
5
8c59f1f11cc43aa772a9d02f05ab221dc62685ea
kngwyu
2021-01-23T08:58:23
inner, dot, einsum
diff --git a/src/lib.rs b/src/lib.rs index 146c4ae0..5183bd90 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,6 +43,7 @@ pub mod npyffi; pub mod npyiter; mod readonly; mod slice_box; +mod sum_products; pub use crate::array::{ get_array_module, PyArray, PyArray1, PyArray2, PyArray3, PyArray4, PyArray5, PyArra...
4
149
2
3bca703ef752d1b461563947c42e0f5358f182ca
Antony Lesage
2020-12-16T12:00:03
Add ndarray `rayon` feature
diff --git a/Cargo.toml b/Cargo.toml index 6bab3c92..d3ac062c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ pyo3 = "0.13" [features] # In default setting, python version is automatically detected default = [] +rayon = ["ndarray/rayon"] [workspace]
1
1
0
271fbfb14ae2cd87dbcf0a30e0dad9081135e3ba
kngwyu
2020-12-06T02:25:17
Address clippy warning
diff --git a/tests/to_py.rs b/tests/to_py.rs index 5ea72810..f11cec1d 100644 --- a/tests/to_py.rs +++ b/tests/to_py.rs @@ -42,7 +42,7 @@ fn iter_to_pyarray() { #[test] fn long_iter_to_pyarray() { pyo3::Python::with_gil(|py| { - let arr = PyArray::from_iter(py, (0u32..512).map(|x| x)).readonly(); + ...
1
1
1
a4092ed52ea989b3d118f5227871f702464cbe44
Ethan Smith
2020-11-28T22:31:52
Update num-complex
diff --git a/Cargo.toml b/Cargo.toml index 44ea6aae..091de689 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ license-file = "LICENSE" [dependencies] cfg-if = "0.1" libc = "0.2" -num-complex = "0.2" +num-complex = "0.3" num-traits = "0.2" ndarray = ">=0.13" pyo3 = ">=0.12"
1
1
1
6d05f1cb7c0aa21cd18970f3e0c28f6b5ae1372d
kngwyu
2020-10-11T08:16:45
More relaxed PyO3 requirements
diff --git a/Cargo.toml b/Cargo.toml index 53e49c10..3602a009 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ libc = "0.2" num-complex = "0.2" num-traits = "0.2" ndarray = ">=0.13" -pyo3 = "0.12.0" +pyo3 = "0.12" [features] # In default setting, python version is automatically detected diff --git a/ex...
3
3
3
41cb84aae52e4515cadd8506ff2fd0b862675ab4
kngwyu
2020-10-10T07:25:02
Document dtype
diff --git a/src/array.rs b/src/array.rs index 8f0d4c53..7631a1cc 100644 --- a/src/array.rs +++ b/src/array.rs @@ -152,6 +152,17 @@ impl<T, D> PyArray<T, D> { self.as_ptr() as _ } + /// Returns `dtype` of the array. + /// Counterpart of `array.dtype` in Python. + /// + /// # Example + ///...
4
68
25
7fcf952b9c2eff85cfce3f030d28a01a6a05340a
kngwyu
2020-09-24T05:30:21
Add some basic methods to PyArrayDescr
diff --git a/src/array.rs b/src/array.rs index ea48cfce..8f0d4c53 100644 --- a/src/array.rs +++ b/src/array.rs @@ -10,9 +10,9 @@ use std::{cell::Cell, mem, os::raw::c_int, ptr, slice}; use std::{iter::ExactSizeIterator, marker::PhantomData}; use crate::convert::{IntoPyArray, NpyIndex, ToNpyDims, ToPyArray}; +use cr...
8
206
168
8d510dbc7f9bdc963cc02a6923f39ba33eca2623
kngwyu
2020-09-23T13:50:21
Introduce PyArrayDescr
diff --git a/src/array.rs b/src/array.rs index 1e2e5634..ea48cfce 100644 --- a/src/array.rs +++ b/src/array.rs @@ -103,7 +103,7 @@ impl<T, D> type_object::PySizedLayout<PyArray<T, D>> for npyffi::PyArrayObject { pyobject_native_type_convert!( PyArray<T, D>, npyffi::PyArrayObject, - *npyffi::PY_ARRAY_API.g...
5
50
12
9703a151ce45ebfc1980258dec4f1e67ffaef41c
kngwyu
2020-09-23T07:44:15
Address clippy warnings
diff --git a/src/npyiter.rs b/src/npyiter.rs index 5848bda1..046fcc04 100644 --- a/src/npyiter.rs +++ b/src/npyiter.rs @@ -371,6 +371,12 @@ pub struct NpyMultiIterBuilder<'py, T, S: MultiIterMode> { was_writables: Vec<bool>, } +impl<'py, T: Element> Default for NpyMultiIterBuilder<'py, T, ()> { + fn default(...
2
17
5
a733708e9c35708040108b3d7da7d1e3b517bc3b
kngwyu
2020-09-19T07:19:20
Properly handle negative strides
diff --git a/src/array.rs b/src/array.rs index eee82a71..1e2e5634 100644 --- a/src/array.rs +++ b/src/array.rs @@ -298,15 +298,6 @@ impl<T, D> PyArray<T, D> { self.len() == 0 } - fn strides_usize(&self) -> &[usize] { - let n = self.ndim(); - let ptr = self.as_array_ptr(); - unsaf...
2
58
17
bda5de94d55b799283f05b11489ca07d1842f7e1
Gernot Bauer
2020-09-16T14:21:56
Removed Debug, added pyobject_native_type_fmt
diff --git a/src/array.rs b/src/array.rs index c8bf7d7a..95d8dad9 100644 --- a/src/array.rs +++ b/src/array.rs @@ -75,7 +75,6 @@ use crate::types::Element; /// array![[8., 15.], [12., 23.]] /// ); /// ``` -#[derive(Debug)] pub struct PyArray<T, D>(PyAny, PhantomData<T>, PhantomData<D>); /// One-dimensional a...
1
1
1
d701b128b288eed4910b1b1bd63fa5d09d5927cd
Matthew Treinish
2020-09-13T15:20:28
Add missing semicolon from with_gil() calls
diff --git a/src/npyffi/array.rs b/src/npyffi/array.rs index db40a445..dfa4bb17 100644 --- a/src/npyffi/array.rs +++ b/src/npyffi/array.rs @@ -45,7 +45,7 @@ impl PyArrayAPI { Python::with_gil(|py| { let api = get_numpy_api(py, MOD_NAME, CAPSULE_NAME); self.api.set(api); - ...
2
2
2
63da099ea00b3f82bd8b410124512788d5532d9c
Matthew Treinish
2020-09-13T15:13:00
Update PyO3 version in example Cargo.toml files
diff --git a/examples/linalg/Cargo.toml b/examples/linalg/Cargo.toml index 1a0bd157..f3c5f4f8 100644 --- a/examples/linalg/Cargo.toml +++ b/examples/linalg/Cargo.toml @@ -14,5 +14,5 @@ ndarray = ">= 0.13" ndarray-linalg = { version = "0.12", features = ["openblas"] } [dependencies.pyo3] -version = "0.11.1" +version...
2
2
2
29f1b36fd4dfa5defb6b241b7c92d580d220457e
Matthew Treinish
2020-09-13T15:01:52
Finish migration of error.rs This commit finishes the migration of error.rs to use the new exception API in 0.12.0. Most of the work was done on this, just a few little pieces that needed to be updated to conform to the new api.
diff --git a/src/error.rs b/src/error.rs index 87228688..620fbc8b 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,6 @@ //! Defines error types. use crate::types::DataType; -use pyo3::{exceptions as exc, PyErr, PyErrArguments, PyErrValue, PyObject, Python, ToPyObject}; +use pyo3::{exceptions as exc, PyErr, PyE...
1
3
3
11d29cce67328d6ca9c82e3d29cd529ad08edddf
Matthew Treinish
2020-09-13T14:24:52
Switch from pyo3::internal_utils::ensure_gil to with_gil In PyO3/PyO3#1115 the internal_utils module was removed from pyo3. There is a note in the review that rust-numpy will need to migrate to using with_gil() instead. This commit makes this change to enable running with pyo3 0.12.0.
diff --git a/Cargo.toml b/Cargo.toml index 2eab3cf3..6d982971 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ libc = "0.2" num-complex = "0.2" num-traits = "0.2" ndarray = ">=0.13" -pyo3 = { git = "https://github.com/PyO3/pyo3" } +pyo3 = "0.12.0" [features] # In default setting, python version is auto...
3
10
7
64c43a711caea506adbed18c3a981d5068021263
kngwyu
2020-09-12T08:25:37
Add Some examples to iterators
diff --git a/src/array.rs b/src/array.rs index c94ae133..c1161716 100644 --- a/src/array.rs +++ b/src/array.rs @@ -174,7 +174,7 @@ impl<T, D> PyArray<T, D> { /// use pyo3::types::IntoPyDict; /// let gil = pyo3::Python::acquire_gil(); /// let py = gil.python(); - /// let array = numpy::PyArray::arange(...
5
94
27
242590a61fc78f7f76a84807fcbb365bc028918b
Gernot Bauer
2020-09-07T12:06:21
Removed AsPyRef from test import
diff --git a/src/array.rs b/src/array.rs index 4f61cbb0..c8bf7d7a 100644 --- a/src/array.rs +++ b/src/array.rs @@ -132,7 +132,7 @@ impl<'a, T: Element, D: Dimension> FromPyObject<'a> for &'a PyArray<T, D> { fn extract(ob: &'a PyAny) -> PyResult<Self> { let array = unsafe { if npyffi::PyArray_...
1
2
2
28bbe9a84a9e377892ea6d423dd34e4bad7235cc
Gernot Bauer
2020-09-04T12:08:43
use PyDowncastError constructor and add Debug for test/array.rs
diff --git a/src/array.rs b/src/array.rs index c94ae133..4f61cbb0 100644 --- a/src/array.rs +++ b/src/array.rs @@ -75,6 +75,7 @@ use crate::types::Element; /// array![[8., 15.], [12., 23.]] /// ); /// ``` +#[derive(Debug)] pub struct PyArray<T, D>(PyAny, PhantomData<T>, PhantomData<D>); /// One-dimensional a...
1
2
1
507087c315abf9f9a1a526987ba1584150e14e14
Gernot Bauer
2020-09-04T11:40:13
started fixes to allow compilation with current pyo3 master
diff --git a/Cargo.toml b/Cargo.toml index 0e22b53f..2eab3cf3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ libc = "0.2" num-complex = "0.2" num-traits = "0.2" ndarray = ">=0.13" -pyo3 = "0.11.1" +pyo3 = { git = "https://github.com/PyO3/pyo3" } [features] # In default setting, python version is auto...
2
2
2
445a4843bc835a8c70d96278cd0198f50a9b0655
kngwyu
2020-08-22T08:40:06
[NpyIter] Takes PyReadonlyArray
diff --git a/src/npyiter.rs b/src/npyiter.rs index 911b3a69..96999c4b 100644 --- a/src/npyiter.rs +++ b/src/npyiter.rs @@ -1,25 +1,46 @@ +//! Wrapper of [Array Iterator API](https://numpy.org/doc/stable/reference/c-api/iterator.html). +//! +//! This module exposes two iterators: +//! [NpySingleIter](./struct.NpySingleI...
3
312
168
7c7da092a8bae8a7799402d0998748f1149e82d2
Sebastiaan Vermeulen
2020-08-04T06:39:56
Update Cargo.toml updated documentation location
diff --git a/Cargo.toml b/Cargo.toml index 9eb1469c..0e22b53f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "numpy" version = "0.11.0" authors = ["Toshiki Teramura <toshiki.teramura@gmail.com>", "Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>"] description = "Rust binding of NumPy C-API" -documenta...
1
2
2
a70446cb4bd99ba32cd731033263af6da3159398
Parth Nobel
2020-07-25T12:27:12
Resyncs the NpySingleIter and NpyMultiIter implmentations.
diff --git a/src/npyiter.rs b/src/npyiter.rs index 244cf6cd..911b3a69 100644 --- a/src/npyiter.rs +++ b/src/npyiter.rs @@ -109,13 +109,14 @@ pub struct NpySingleIter<'py, T> { iterator: ptr::NonNull<objects::NpyIter>, iternext: unsafe extern "C" fn(*mut objects::NpyIter) -> c_int, empty: bool, + iter_...
1
29
13
8de9fd9766e3a315aad4777fa7d111b5d555cba7
Parth Nobel
2020-07-25T12:04:31
Corrects error handling in NpyIter::new
diff --git a/src/error.rs b/src/error.rs index a276a5aa..a8a4136a 100644 --- a/src/error.rs +++ b/src/error.rs @@ -115,3 +115,15 @@ impl fmt::Display for NotContiguousError { } impl_pyerr!(NotContiguousError); + +/// Represents issues in NpyIterator instantiation. +#[derive(Debug)] +pub struct NpyIterInstantiationE...
2
29
6
a0f6cc6476a7b733fcf43a4a31a9500ff58750f1
kngwyu
2020-07-25T10:00:06
Refactor MultiIter implementation
diff --git a/src/lib.rs b/src/lib.rs index 351e4e25..4bd73ee6 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,6 +52,9 @@ pub use crate::array::{ pub use crate::convert::{IntoPyArray, NpyIndex, ToNpyDims, ToPyArray}; pub use crate::error::{FromVecError, NotContiguousError, ShapeError}; pub use crate::npyffi::{PY_ARRA...
3
146
211
0e6a618311d6fd2ac6747bc23bf19ca0aa1c9950
Parth Nobel
2020-06-26T23:19:13
Cleans up flag handling for NpyIter. Removes a bunch of unsafe enum flags.
diff --git a/src/npyiter.rs b/src/npyiter.rs index 0c86be67..c2a4c5ee 100644 --- a/src/npyiter.rs +++ b/src/npyiter.rs @@ -4,7 +4,7 @@ use crate::npyffi::{ types::{NPY_CASTING, NPY_ORDER}, *, }; -use crate::types::TypeNum; +use crate::types::Element; use pyo3::{prelude::*, PyNativeType}; use std::marker:...
2
43
39
ef40c03a7d6dee0112d5849021810fadc808b8ec
Parth Nobel
2020-06-25T12:38:24
Switches to macros to generate the impls for Iterator on MultiIter
diff --git a/src/npyiter.rs b/src/npyiter.rs index 7fa8a2d7..0c86be67 100644 --- a/src/npyiter.rs +++ b/src/npyiter.rs @@ -163,13 +163,13 @@ pub trait MultiIterMode {} impl MultiIterMode for () {} -pub struct RO<S> { +pub struct RO<S: MultiIterMode> { structure: PhantomData<S>, } impl<S: MultiIterMode> Mu...
1
138
77
dc3859c49b71b0689b4a1c55eb73d1b83aa92501
Parth Nobel
2020-06-24T06:44:27
Implements intial version of NpyMultiIterArray.
diff --git a/src/npyiter.rs b/src/npyiter.rs index f010401b..7fa8a2d7 100644 --- a/src/npyiter.rs +++ b/src/npyiter.rs @@ -158,3 +158,254 @@ impl<'py, T: 'py> std::iter::Iterator for NpyIterSingleArray<'py, T> { } } } + +pub trait MultiIterMode {} + +impl MultiIterMode for () {} + +pub struct RO<S> { + ...
2
278
2
2132036e38175bfa0a656ed07c569d2e347d0ec9
Parth Nobel
2020-06-19T07:25:16
Adds some more comments and a new test.
diff --git a/src/npyiter.rs b/src/npyiter.rs index f1165b39..f010401b 100644 --- a/src/npyiter.rs +++ b/src/npyiter.rs @@ -70,12 +70,17 @@ impl<'py, T: TypeNum> NpyIterBuilder<'py, T> { } } - pub fn add(mut self, flag: NpyIterFlag) -> Self { + pub fn set(mut self, flag: NpyIterFlag) -> Self { + ...
2
30
2
c79f220f3d0fe97e648c88c37dd91df0b7c0487f
kngwyu
2020-06-18T13:29:15
Mentoring: Refactor with PyO3 idioms and Add a test
diff --git a/src/npyffi/flags.rs b/src/npyffi/flags.rs index 5f8208af..ec842a86 100644 --- a/src/npyffi/flags.rs +++ b/src/npyffi/flags.rs @@ -1,3 +1,4 @@ +use super::npy_uint32; use std::os::raw::c_int; pub const NPY_ARRAY_C_CONTIGUOUS: c_int = 0x0001; @@ -28,3 +29,36 @@ pub const NPY_ARRAY_OUT_FARRAY: c_int = NPY...
3
95
78
f38bbd8a6b9ce1b59ee664ab09b2fcbfb4e3c2a9
Parth Nobel
2020-06-18T04:21:54
Starts work on a safe npyiter interface.
diff --git a/src/lib.rs b/src/lib.rs index 027eaa3c..351e4e25 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,6 +40,7 @@ pub mod array; pub mod convert; mod error; pub mod npyffi; +pub mod npyiter; mod readonly; mod slice_box; mod types; diff --git a/src/npyiter.rs b/src/npyiter.rs new file mode 100644 index 0000...
2
183
0
50ee9ef21b301f7bf1b5fb9a36efc9bce3ee89c5
kngwyu
2020-07-16T15:59:04
More verbose error reporting when importing numpy module
diff --git a/src/npyffi/mod.rs b/src/npyffi/mod.rs index 807a1433..507b1966 100644 --- a/src/npyffi/mod.rs +++ b/src/npyffi/mod.rs @@ -15,7 +15,7 @@ fn get_numpy_api(_py: Python, module: &str, capsule: &str) -> *const *const c_vo let numpy = ffi::PyImport_ImportModule(module.as_ptr()); assert!(!numpy....
1
1
1
d7d0d4d335780185b04f4fd8935a638ee3cc360f
kngwyu
2020-06-30T11:14:03
Address clippy warnings
diff --git a/src/array.rs b/src/array.rs index 1a29ac85..42793c8a 100644 --- a/src/array.rs +++ b/src/array.rs @@ -61,7 +61,7 @@ use crate::types::{NpyDataType, TypeNum}; /// /// # Example /// ``` -/// # #[macro_use] extern crate ndarray; fn main() { +/// # #[macro_use] extern crate ndarray; /// use pyo3::{GILGuard...
8
67
104
40d472c80b50a9cf5ff5329f05fe5aca769757c3
kngwyu
2020-06-22T14:47:40
Update with PyO3 0.11.0
diff --git a/Cargo.toml b/Cargo.toml index da9ff033..4af6f995 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,8 @@ libc = "0.2" num-complex = "0.2" num-traits = "0.2" ndarray = ">=0.13" -pyo3 = "0.10.1" +# pyo3 = "0.10.1" +pyo3 = { git = "https://github.com/PyO3/pyo3.git"} [features] # In default setting, ...
7
19
26
47a0636c1d2dfd789fa26f9a6faf423f1600d633
kngwyu
2020-05-16T04:03:54
Add some new FFIs
diff --git a/src/npyffi/array.rs b/src/npyffi/array.rs index c8ce9e33..78853f7d 100644 --- a/src/npyffi/array.rs +++ b/src/npyffi/array.rs @@ -313,6 +313,8 @@ impl PyArrayAPI { impl_api![299; PyDataMem_NEW_ZEROED(size: usize, elsize: usize) -> *mut c_void]; impl_api![300; PyArray_CheckAnyScalarExact(obj: *mut...
3
21
1
d2a6cbbd784d53312b3d9622cf189c9392edbd2c
kngwyu
2020-05-13T09:44:02
Cleanup imports
diff --git a/src/array.rs b/src/array.rs index 65ba3b85..de912023 100644 --- a/src/array.rs +++ b/src/array.rs @@ -4,11 +4,8 @@ use ndarray::*; use num_traits::AsPrimitive; use pyo3::{ffi, prelude::*, type_object, types::PyAny}; use pyo3::{AsPyPointer, PyDowncastError, PyNativeType}; -use std::iter::ExactSizeIterato...
4
16
22
9f225e5966b40c1c970134f9b9f81923ce004627
kngwyu
2020-05-13T09:29:16
Cleanup PyArray/PyUFunc API and use numpy.org URL
diff --git a/src/array.rs b/src/array.rs index ff045825..65ba3b85 100644 --- a/src/array.rs +++ b/src/array.rs @@ -16,7 +16,7 @@ use crate::slice_box::SliceBox; use crate::types::{NpyDataType, TypeNum}; /// A safe, static-typed interface for -/// [NumPy ndarray](https://docs.scipy.org/doc/numpy/reference/arrays.nda...
6
66
71
88e3b5788fc0bbaebca67932126d7062f58eced8
kngwyu
2020-03-19T11:34:51
fotran -> fortran
diff --git a/src/array.rs b/src/array.rs index be65aa59..b6771bd9 100644 --- a/src/array.rs +++ b/src/array.rs @@ -181,7 +181,7 @@ impl<T, D> PyArray<T, D> { } /// Returns `true` if the internal data of the array is Fortran-style contiguous. - pub fn is_fotran_contiguous(&self) -> bool { + pub fn is_f...
1
1
1
ce3a106e9fc960f0ae740bb0e3e59b821b73b297
kngwyu
2020-03-19T06:24:36
Make SliceBox::DESCRIPTION null-terminated
diff --git a/src/slice_box.rs b/src/slice_box.rs index 3047aa7b..52fee5b0 100644 --- a/src/slice_box.rs +++ b/src/slice_box.rs @@ -38,7 +38,7 @@ unsafe impl<T> type_object::PyTypeInfo for SliceBox<T> { type AsRefTarget = PyCell<Self>; const NAME: &'static str = "SliceBox"; const MODULE: Option<&'static s...
1
1
1
919c19e5a16df89deded5b1c71290b7646333c44
Masterchef365
2020-03-06T19:22:58
Switch pyo3 crate version from git to crates.io alpha
diff --git a/Cargo.toml b/Cargo.toml index f876f919..28753f3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ libc = "0.2" num-complex = "0.2" num-traits = "0.2" ndarray = ">=0.13" -pyo3 = { git = "https://github.com/PyO3/pyo3.git" } +pyo3 = "0.9.0-alpha.1" [features] # In default setting, python vers...
1
1
1
d75d8a6f0793214605d5267f6f04c1645ef73ee3
Maarten de Vries
2019-11-14T17:02:16
Use size_hint in PyArray::from_iter. Even though the size hint is not guaranteed to be correct, it is a better than a fixed guess.
diff --git a/src/array.rs b/src/array.rs index 2542c2eb..05db9b54 100644 --- a/src/array.rs +++ b/src/array.rs @@ -743,8 +743,8 @@ impl<T: TypeNum> PyArray<T, Ix1> { /// Construct one-dimension PyArray from a type which implements /// [`IntoIterator`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html...
1
7
5
6e8425d99ea46156244c526ab6bed5026c5eefc7
kngwyu
2019-11-09T12:27:53
Add a documentation about slice to PyArray conversion
diff --git a/src/convert.rs b/src/convert.rs index 60bea324..a0120e7b 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -71,12 +71,27 @@ where /// elements there**. /// # Example /// ``` -/// # fn main() { /// use numpy::{PyArray, ToPyArray}; /// let gil = pyo3::Python::acquire_gil(); /// let py_array = vec![1,...
2
30
2
550efd0f8d33e18b3f653d49c19b5911da2670df
kngwyu
2019-11-09T11:19:05
Fix array.slice.to_pyarray
diff --git a/src/array.rs b/src/array.rs index 56caf7c2..2542c2eb 100644 --- a/src/array.rs +++ b/src/array.rs @@ -296,7 +296,7 @@ impl<T, D> PyArray<T, D> { } /// Returns the pointer to the first element of the inner array. - unsafe fn data(&self) -> *mut T { + pub(crate) unsafe fn data(&self) -> *mu...
4
97
25
b75729e99cc82143383dc118ba315ccbad24cf94
kngwyu
2019-11-09T08:02:08
Use short array optimization for numpy strides
diff --git a/src/array.rs b/src/array.rs index 298c7db8..56caf7c2 100644 --- a/src/array.rs +++ b/src/array.rs @@ -355,7 +355,7 @@ impl<T: TypeNum, D: Dimension> PyArray<T, D> { pub(crate) unsafe fn new_<'py, ID>( py: Python<'py>, dims: ID, - strides: *mut npy_intp, + strides: *cons...
3
46
20
6d9572ea4843487336c3cd3e025c01e6fc4089f1
kngwyu
2019-11-09T06:52:52
Properly fetch errors in Python interpreter
diff --git a/src/array.rs b/src/array.rs index b1baf4fa..298c7db8 100644 --- a/src/array.rs +++ b/src/array.rs @@ -813,7 +813,7 @@ impl<T: TypeNum> PyArray<T, Ix1> { ) }; if res.is_null() { - Err(ErrorKind::dims_cast(self, dims)) + Err(ErrorKind::py(self.py())) ...
4
15
63
cbad0f4dca4c2c0c734d241c29bd56c37094ce6a
kngwyu
2019-11-02T16:56:07
Temporaray ignore dtype test
diff --git a/src/array.rs b/src/array.rs index 5e0ca4b6..91c996fd 100644 --- a/src/array.rs +++ b/src/array.rs @@ -379,7 +379,7 @@ impl<T: TypeNum, D: Dimension> PyArray<T, D> { pub(crate) unsafe fn from_boxed_slice<'py, ID>( py: Python<'py>, dims: ID, - strides: *mut npy_intp, + st...
3
11
10
eb6feb5742cf16593cfcfb2038525a50193e6b71
kngwyu
2019-11-02T13:54:31
Make usize_dtype test simpler
diff --git a/tests/to_py.rs b/tests/to_py.rs index c7072efe..b068bc01 100644 --- a/tests/to_py.rs +++ b/tests/to_py.rs @@ -74,14 +74,12 @@ fn usize_dtype() { let a: Vec<usize> = vec![1, 2, 3]; let x = a.into_pyarray(py); - let x_repr = format!("{:?}", x); - let x_repr_expected = if cfg!(target_point...
1
3
5
20ad58c8de04b68482f39af2d94d3343b87b6c7b
kngwyu
2019-11-02T13:09:51
Remove outdated docs
diff --git a/src/npyffi/mod.rs b/src/npyffi/mod.rs index 519bb0ce..2c402b80 100644 --- a/src/npyffi/mod.rs +++ b/src/npyffi/mod.rs @@ -1,13 +1,7 @@ //! Low-Level bindings for NumPy C API. //! //! https://docs.scipy.org/doc/numpy/reference/c-api.html -//! -//! Most of functions in this submodule are unsafe. -//! If y...
3
2
10
8771c83760a2c02d9bb446600f324f1687b865ec
kngwyu
2019-11-02T13:08:29
Remove unnecessary parentheses
diff --git a/src/npyffi/mod.rs b/src/npyffi/mod.rs index 55ea0bbe..519bb0ce 100644 --- a/src/npyffi/mod.rs +++ b/src/npyffi/mod.rs @@ -41,7 +41,7 @@ macro_rules! impl_api { #[allow(non_snake_case)] pub unsafe fn $fname(&self, $($arg : $t), *) $( -> $ret )* { let fptr = self.0.offset($offs...
1
1
1
cb309a465091275ce4438602684d42433abf3de2
kngwyu
2019-11-02T07:00:18
Unimplement TypeNum for *mut ffi::PyObject
diff --git a/src/types.rs b/src/types.rs index 7941bfb8..71391425 100644 --- a/src/types.rs +++ b/src/types.rs @@ -5,7 +5,6 @@ pub use num_complex::Complex32 as c32; pub use num_complex::Complex64 as c64; use super::npyffi::NPY_TYPES; -use pyo3::ffi::PyObject; /// An enum type represents numpy data type. /// @@...
4
112
142
745fc052ff19d9f6adf0303f691641f9a5832f6c
kngwyu
2019-09-07T05:37:17
Make it work with the latest ndarray
diff --git a/Cargo.toml b/Cargo.toml index 27c8b5be..9fa72de8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ cfg-if = "0.1" libc = "0.2" num-complex = "0.2" num-traits = "0.2" -ndarray = "0.12" +ndarray = ">=0.12" pyo3 = "0.8" [features] diff --git a/src/array.rs b/src/array.rs index ba166444..5e0ca4...
2
2
2
713d24f463e69d52f0c104909ee872021abd0d9a
kngwyu
2019-09-02T14:12:33
Update pyo3 to 0.8
diff --git a/Cargo.toml b/Cargo.toml index 9f0f4a34..0cd9d819 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ libc = "0.2" num-complex = "0.2" num-traits = "0.2" ndarray = "0.12" -pyo3 = "0.7" +pyo3 = {git = "https://github.com/PyO3/pyo3"} [features] # In default setting, python version is automatical...
3
5
3
d51b2c094202376e06cf077086e7c51f31210448
kngwyu
2019-07-29T06:49:52
Use Once::new instead of ONCE_INIT
diff --git a/src/npyffi/array.rs b/src/npyffi/array.rs index 4dcf2edc..fed96983 100644 --- a/src/npyffi/array.rs +++ b/src/npyffi/array.rs @@ -4,7 +4,7 @@ use pyo3::ffi::{self, PyObject, PyTypeObject}; use std::ops::Deref; use std::os::raw::*; use std::ptr; -use std::sync::{Once, ONCE_INIT}; +use std::sync::Once; ...
2
4
4
7632f343acb2109a392bc960bc0a580261495e86
Roman Yurchak
2019-07-16T19:49:40
MAINT Fix linalg example to use Pyo3 0.7
diff --git a/examples/linalg/Cargo.toml b/examples/linalg/Cargo.toml index bf1d09aa..6dcdcd67 100644 --- a/examples/linalg/Cargo.toml +++ b/examples/linalg/Cargo.toml @@ -14,5 +14,5 @@ ndarray = "0.12" ndarray-linalg = { version = "0.10", features = ["openblas"] } [dependencies.pyo3] -version = "0.6" +version = "0....
1
1
1
a3ba23b49cf8ed379fc08be5ee822236aa2ae3fe
kngwyu
2019-07-03T17:10:41
Add an example of PyArray::is_contiguous
diff --git a/src/array.rs b/src/array.rs index 76824db6..eafe63e6 100644 --- a/src/array.rs +++ b/src/array.rs @@ -150,15 +150,37 @@ impl<T, D> PyArray<T, D> { unsafe { (*self.as_array_ptr()).flags & flag == flag } } + /// Returns `true` if the internal data of the array is C-style contiguous + //...
1
23
1
3ad4272394b3fa537587a53ea6904d8026cdd249
kngwyu
2019-07-03T16:52:02
Fix doc examples where we use array.as_slice
diff --git a/src/array.rs b/src/array.rs index 75753fea..76824db6 100644 --- a/src/array.rs +++ b/src/array.rs @@ -155,7 +155,7 @@ impl<T, D> PyArray<T, D> { | self.check_flag(npyffi::NPY_ARRAY_F_CONTIGUOUS) } - pub fn is_forran_contiguous(&self) -> bool { + pub fn is_fotran_contiguous(&self) ...
3
27
16
2b411d2eae3ff0d4c55176371d122f311d1e8f58
kngwyu
2019-07-03T11:27:03
Add is_*contiguous methods + Modify as_slice* returns Result - To resolve #101, we check if the array is contiguous when getting a slice
diff --git a/src/array.rs b/src/array.rs index 66940cae..75753fea 100644 --- a/src/array.rs +++ b/src/array.rs @@ -145,6 +145,24 @@ impl<T, D> PyArray<T, D> { self.as_ptr() as _ } + #[inline(always)] + fn check_flag(&self, flag: c_int) -> bool { + unsafe { (*self.as_array_ptr()).flags & fla...
5
141
73
e86db8333a39f05727731499ce74273ed253d552
kngwyu
2019-07-03T06:26:13
FIx the documents of PyArray::get/get_mut
diff --git a/src/array.rs b/src/array.rs index d883f64d..66940cae 100644 --- a/src/array.rs +++ b/src/array.rs @@ -481,12 +481,11 @@ impl<T: TypeNum, D: Dimension> PyArray<T, D> { unsafe { ArrayViewMut::from_shape_ptr(self.ndarray_shape(), self.data()) } } - /// Get an immutable reference of a specif...
1
6
6
b54bb166c1c075bd730f20f60bb0f45c6cffd1f3
Roman Yurchak
2019-06-13T15:06:08
Support converting Array1<usize> (#98) * Support converting Array1<usize> * Review comments
diff --git a/src/types.rs b/src/types.rs index d4694567..7941bfb8 100644 --- a/src/types.rs +++ b/src/types.rs @@ -105,6 +105,17 @@ impl_type_num!(c32, Complex32, NPY_CFLOAT); impl_type_num!(c64, Complex64, NPY_CDOUBLE); impl_type_num!(*mut PyObject, PyObject, NPY_OBJECT); +cfg_if! { + if #[cfg(all(target_pointe...
2
30
1
01926dd97b23a0c8612a5204107db8809e291a69
Stefan Kroboth
2019-03-31T11:24:55
examples: changed PyO3 version to 0.6.0
diff --git a/examples/linalg/Cargo.toml b/examples/linalg/Cargo.toml index e19f8c0d..2f7feca7 100644 --- a/examples/linalg/Cargo.toml +++ b/examples/linalg/Cargo.toml @@ -14,5 +14,5 @@ ndarray = "0.12" ndarray-linalg = { version = "0.10", features = ["openblas"] } [dependencies.pyo3] -version = "0.5.3" +version = "...
4
6
6
f58438eb897409fa0de5212668e2191c287ee244
Stefan Kroboth
2019-03-31T11:01:50
initialize pointer in SliceBox constructor, replaced PyTypeObject impl with default impl, added PyMethodsProtocol impl for SliceBox
diff --git a/src/array.rs b/src/array.rs index ce87f267..d883f64d 100644 --- a/src/array.rs +++ b/src/array.rs @@ -37,7 +37,6 @@ use types::{NpyDataType, TypeNum}; /// So you can neither retrieve it nor deallocate it manually. /// /// # Reference -///Object /// Like [`new`](#method.new), all constractor methods of ...
2
5
25
70ae250a1926f466e1ece58b867bab1fddf52900
Stefan Kroboth
2019-03-30T06:33:34
bump to 0.6.0 (broken)
diff --git a/Cargo.toml b/Cargo.toml index 4facc270..2d1ed21a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ libc = "0.2.44" num-complex = "0.2.1" num-traits = "0.2.6" ndarray = "0.12" -pyo3 = "0.5.3" +pyo3 = "0.6.0" [features] # In default setting, python version is automatically detected diff --git...
4
37
31
851f7cacb5aa831772e4f5bcaaa5a5e0614fe41e
Matthieu Baumann
2019-03-27T13:22:30
fix Uint64 type for x86_64 architectures Passing a uint64 numpy array in an architecture x86 raises the following exception. Fix the following error: E TypeError: Extraction failed: E from=(dim=1, dtype=Uint64), to=(dim=_, dtype=Uint64) E context: [FromPyObject::extract] typecheck failed
diff --git a/src/types.rs b/src/types.rs index 88c61f09..d4694567 100644 --- a/src/types.rs +++ b/src/types.rs @@ -115,6 +115,6 @@ cfg_if! { impl_type_num!(i32, Int32, NPY_INT); impl_type_num!(u32, Uint32, NPY_UINT); impl_type_num!(i64, Int64, NPY_LONG, NPY_LONGLONG); - impl_type_num!(...
2
20
1
5e144f21534ff108452c8565e1b7f2f4351c613f
kngwyu
2019-01-05T05:32:14
Bump version to 0.4.1
diff --git a/Cargo.toml b/Cargo.toml index 1b0a9b4c..4facc270 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "numpy" -version = "0.4.0" +version = "0.4.1" authors = ["Toshiki Teramura <toshiki.teramura@gmail.com>", "Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com>"] description = "Rust bind...
3
4
4
98f1370fdbcc24f24d45906ce06f84de0d7829bd
kngwyu
2018-12-05T14:02:30
Add strides_usize and use it in ndarray_shape To avoid allocation
diff --git a/src/array.rs b/src/array.rs index afd1fd03..7492f807 100644 --- a/src/array.rs +++ b/src/array.rs @@ -264,6 +264,15 @@ impl<T, D> PyArray<T, D> { pub(crate) unsafe fn copy_ptr(&self, other: *const T, len: usize) { ptr::copy_nonoverlapping(other, self.data(), len) } + + fn strides_usiz...
1
13
6
d93f8b72e3e9dede0a4af09562861ac7c10fbaa8
Pavel Potoček
2018-12-05T12:50:45
Fix a panic when calling `to_owned_array` on a `PyArrayDyn`
diff --git a/src/array.rs b/src/array.rs index 78ba4b3b..afd1fd03 100644 --- a/src/array.rs +++ b/src/array.rs @@ -274,13 +274,13 @@ impl<T: TypeNum, D: Dimension> PyArray<T, D> { } fn ndarray_shape(&self) -> StrideShape<D> { - // FIXME may be done more simply let shape: Shape<_> = Dim(self....
1
5
5
9400e3a675b76d20ab7bcdc26718c54f217cf914
Pavel Potoček
2018-12-05T12:49:56
Add a panicking test
diff --git a/src/array.rs b/src/array.rs index 70b83dfc..78ba4b3b 100644 --- a/src/array.rs +++ b/src/array.rs @@ -997,3 +997,10 @@ fn test_get_unchecked() { assert_eq!(*array.uget([1]), 2); } } + +#[test] +fn test_dyn_to_owned_array() { + let gil = pyo3::Python::acquire_gil(); + let array = PyArra...
1
7
0
8b9a22b978ebc0207167ac60131685375dc39805
Roman Yurchak
2018-11-25T22:21:25
Also pin pyo3 dependency in the example
diff --git a/examples/simple-extension/Cargo.toml b/examples/simple-extension/Cargo.toml index 8e3459f5..70d0811b 100644 --- a/examples/simple-extension/Cargo.toml +++ b/examples/simple-extension/Cargo.toml @@ -12,5 +12,5 @@ numpy = { path = "../.." } ndarray = "0.12" [dependencies.pyo3] -version = "0.5.0-alpha.2" ...
1
1
1
4f479b262bcee68c0b9e6e55688b4b4beea4e19f
Roman Yurchak
2018-11-25T22:19:40
Also pin pyo3 dependecy to 0.5.0 for now
diff --git a/Cargo.toml b/Cargo.toml index 5bc7b342..679d0bab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ libc = "0.2.43" num-complex = "0.2.1" num-traits = "0.2.6" ndarray = "0.12.0" -pyo3 = "0.5.0" +pyo3 = "= 0.5.0" [features] # In default setting, python version is automatically detected
1
1
1
8baa60c4319eef40a2775f11d2af0cda346cea05
kngwyu
2018-11-13T05:24:41
Simplify impl PyTypeInfo for SliceBox
diff --git a/src/slice_box.rs b/src/slice_box.rs index 44906968..7ae5c4ff 100644 --- a/src/slice_box.rs +++ b/src/slice_box.rs @@ -2,6 +2,8 @@ use crate::types::TypeNum; use pyo3::{ffi, typeob, types::PyObjectRef, PyObjectAlloc, Python, ToPyPointer}; use std::os::raw::c_void; +/// It's a memory store for IntoPyArra...
1
4
2
a5d7f7538cab2106e8c520dee2a36db0971f4474
kngwyu
2018-11-13T03:09:05
Refactor error types
diff --git a/src/array.rs b/src/array.rs index 008f66a0..5c5a129a 100644 --- a/src/array.rs +++ b/src/array.rs @@ -2,7 +2,7 @@ use ndarray::*; use npyffi::{self, npy_intp, NPY_ORDER, PY_ARRAY_API}; use num_traits::AsPrimitive; -use pyo3::{exceptions::TypeError, ffi, prelude::*, types::PyObjectRef}; +use pyo3::{ffi, ...
5
153
96
b0bf34a074af0cd20f19af46cea7623a5b111afd
konstin
2018-11-12T14:03:01
Update pyo3 to a stable version
diff --git a/Cargo.toml b/Cargo.toml index 86b6f434..5bc7b342 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,12 +10,12 @@ keywords = ["numpy", "python", "binding"] license-file = "LICENSE" [dependencies] -cfg-if = "0.1.5" -libc = "0.2" -num-complex = "0.2" +cfg-if = "0.1.6" +libc = "0.2.43" +num-complex = "0.2.1" ...
1
5
5
776ea025c7f6ac3402ba7ee1b5e9d521f75c1b4f
kngwyu
2018-11-01T14:32:24
Add build.rs
diff --git a/build.rs b/build.rs new file mode 100644 index 00000000..4899fa8a --- /dev/null +++ b/build.rs @@ -0,0 +1,33 @@ +use std::process::{Command, Stdio}; +use std::str; +fn is_python2() -> bool { + let script = r" +import sys +print(sys.version_info[0]) +"; + let out = Command::new("python") + .arg...
1
33
0
f592b970b5d8243cd5cb08dcbb8749423c207478
kngwyu
2018-10-31T06:38:21
Add PyArray::to_owned_array
diff --git a/src/array.rs b/src/array.rs index e7d1eb1d..008f66a0 100644 --- a/src/array.rs +++ b/src/array.rs @@ -464,6 +464,28 @@ impl<T: TypeNum, D: Dimension> PyArray<T, D> { unsafe { ArrayViewMut::from_shape_ptr(self.ndarray_shape(), self.data()) } } + /// Get a copy of `PyArray` as + /// [`n...
1
22
0
a0e152154ecddcc248cd9ecc17f8bd9cc127a440
kngwyu
2018-10-30T07:08:00
More document
diff --git a/src/array.rs b/src/array.rs index b19cf15f..e7d1eb1d 100644 --- a/src/array.rs +++ b/src/array.rs @@ -23,7 +23,7 @@ use types::{NpyDataType, TypeNum}; /// - Case1: Constructed via [`IntoPyArray`](../convert/trait.IntoPyArray.html) or /// [`from_vec`](#method.from_vec) or [`from_owned_array`](#method.from...
2
35
25
e19e40d0f6f526759cfd46c17fcaf5085c2a9be1
kngwyu
2018-10-21T13:27:24
Documentation about rust-owned array
diff --git a/src/array.rs b/src/array.rs index 04c8b9c3..5025f785 100644 --- a/src/array.rs +++ b/src/array.rs @@ -18,13 +18,21 @@ use types::{NpyDataType, TypeNum}; /// [NumPy ndarray](https://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html). /// /// # Memory location -/// Numpy api allows to use a memory ar...
3
44
43
5a77972a75e0f57b9e8492df874a5ead355293ed
kngwyu
2018-10-21T06:38:48
Implement IntoPyArray for ndarray::ArrayBase<OwnedRepr..>
diff --git a/src/array.rs b/src/array.rs index 20c09428..04c8b9c3 100644 --- a/src/array.rs +++ b/src/array.rs @@ -9,7 +9,7 @@ use std::mem; use std::os::raw::c_int; use std::ptr; -use convert::{NpyIndex, ToNpyDims}; +use convert::{IntoPyArray, NpyIndex, ToNpyDims, ToPyArray}; use error::{ErrorKind, IntoPyResult};...
4
82
29
882d047ac87866d6f5b54691efdbd6d3c4d94278
Matthieu Bizien
2018-10-15T15:14:42
Fix experimental access to extern crates I can't compile the current code because of the following error: ``` error[E0658]: access to extern crates through prelude is experimental (see issue #44660) --> rust-numpy/src/array.rs:183:59 | 183 | pub unsafe fn from_borrowed_ptr(py: Python, ptr: *mut pyo3:...
diff --git a/src/array.rs b/src/array.rs index 03822f05..e6d15fa0 100644 --- a/src/array.rs +++ b/src/array.rs @@ -175,12 +175,12 @@ impl<T, D> PyArray<T, D> { } /// Constructs `PyArray` from raw python object without incrementing reference counts. - pub unsafe fn from_owned_ptr(py: Python, ptr: *mut pyo...
1
2
2
bc271a2213d916064f2fbd038b2838291eea3c8b
kngwyu
2018-10-10T04:06:30
Change the trait bound of move_to
diff --git a/src/array.rs b/src/array.rs index 95e41ab4..287eb1d1 100644 --- a/src/array.rs +++ b/src/array.rs @@ -1,6 +1,6 @@ //! Safe interface for NumPy ndarray use ndarray::*; -use npyffi::{self, npy_intp, PY_ARRAY_API, NPY_ORDER}; +use npyffi::{self, npy_intp, NPY_ORDER, PY_ARRAY_API}; use num_traits::AsPrimiti...
1
30
23