diff --git a/help.html b/help.html index c48a36f80..59ab4ecc8 100644 --- a/help.html +++ b/help.html @@ -1,2 +1,2 @@ -
pub fn get_array_module<'py>(py: Python<'py>) -> PyResult<Bound<'_, PyModule>>
Returns a handle to NumPy’s multiarray module.
Safe interface for NumPy’s N-dimensional arrays
ndarray
class.PyArray0<T>
.PyArray<T, D>
.pub struct PyArray<T, D>(/* private fields */);
A safe, statically-typed wrapper for NumPy’s ndarray
class.
PyArray
has two type parametes T
and D
.
-T
represents the type of its elements, e.g. f32
or [PyObject
].
+T
represents the type of its elements, e.g. f32
or [PyObject
].
D
represents its dimensionality, e.g Ix2
or IxDyn
.
Element types are Rust types which implement the Element
trait.
Dimensions are represented by the ndarray::Dimension
trait.
Constructs a reference to a PyArray
from a raw pointer to a Python object.
Constructs a reference to a PyArray
from a raw pointer to a Python object.
This is a wrapper around [pyo3::FromPyPointer::from_owned_ptr_or_opt
] and inherits its safety contract.
Constructs a reference to a PyArray
from a raw point to a Python object.
Constructs a reference to a PyArray
from a raw point to a Python object.
This is a wrapper around [pyo3::FromPyPointer::from_borrowed_ptr_or_opt
] and inherits its safety contract.
PyArray::new_bound
in the futureCreates a new uninitialized NumPy array.
If is_fortran
is true, then it has Fortran/column-major order,
@@ -120,7 +120,7 @@
PyArray::borrow_from_array_bound
in the futureDeprecated form of PyArray<T, D>::borrow_from_array_bound
Same as PyArray<T, D>::borrow_from_array_bound
PyArray::zeros_bound
in the futureDeprecated form of PyArray<T, D>::zeros_bound
Construct a new NumPy array filled with zeros.
If is_fortran
is true, then it has Fortran/column-major order,
@@ -171,24 +171,24 @@
Returns an immutable view of the internal data as a slice.
+Returns an immutable view of the internal data as a slice.
Calling this method is undefined behaviour if the underlying array
is aliased mutably by other instances of PyArray
or concurrently modified by Python or other native code.
Please consider the safe alternative PyReadonlyArray::as_slice
.
Returns a mutable view of the internal data as a slice.
+Returns a mutable view of the internal data as a slice.
Calling this method is undefined behaviour if the underlying array
is aliased immutably or mutably by other instances of PyArray
or concurrently modified by Python or other native code.
Please consider the safe alternative PyReadwriteArray::as_slice_mut
.
Deprecated form of PyArray<T, D>::from_owned_array_bound
Deprecated form of PyArray<T, D>::from_owned_array_bound
Constructs a NumPy from an ndarray::Array
This method uses the internal Vec
of the ndarray::Array
as the base object of the NumPy array.
This method uses the internal Vec
of the ndarray::Array
as the base object of the NumPy array.
use numpy::{PyArray, PyArrayMethods};
use ndarray::array;
@@ -199,7 +199,7 @@ §Example
assert_eq!(pyarray.readonly().as_array(), array![[1, 2], [3, 4]]);
});
Get a reference of the specified element if the given index is valid.
+Same as get
, but returns Option<&mut T>
.
Same as uget
, but returns &mut T
.
Passing an invalid index is undefined behavior. The element must also have been initialized and other references to it must not exist.
See PyReadwriteArray::get_mut
for a safe alternative.
Turn an array with fixed dimensionality into one with dynamic dimensionality.
-Returns a copy of the internal data of the array as a Vec
.
Deprecated form of PyArray<T, D>::from_array_bound
Get an immutable borrow of the NumPy array
+Get an immutable borrow of the NumPy array
Get an immutable borrow of the NumPy array
Panics if the allocation backing the array is currently mutably borrowed.
For a non-panicking variant, use try_readonly
.
Get a mutable borrow of the NumPy array
+Get a mutable borrow of the NumPy array
Get a mutable borrow of the NumPy array
Panics if the allocation backing the array is currently borrowed or @@ -348,7 +348,7 @@
Calling this method invalidates all exclusive references to the internal data, e.g. ArrayViewMut
or MatrixSliceMut
.
Deprecated form of PyArray<T, D>::from_owned_object_array_bound
Deprecated form of PyArray<T, D>::from_owned_object_array_bound
Construct a NumPy array containing objects stored in a ndarray::Array
This method uses the internal Vec
of the ndarray::Array
as the base object of the NumPy array.
This method uses the internal Vec
of the ndarray::Array
as the base object of the NumPy array.
use ndarray::array;
use pyo3::{pyclass, Py, Python, types::PyAnyMethods};
@@ -402,10 +402,10 @@ §Example
assert!(pyarray.readonly().as_array().get(0).unwrap().bind(py).is_instance_of::<CustomElement>());
});
PyArray::from_slice_bound
in the futureDeprecated form of PyArray<T, Ix1>::from_slice_bound
Construct a one-dimensional array from a slice.
+PyArray::from_slice_bound
in the futureDeprecated form of PyArray<T, Ix1>::from_slice_bound
PyArray::from_vec_bound
in the futureDeprecated form of PyArray<T, Ix1>::from_vec_bound
Construct a one-dimensional array from a Vec<T>
.
PyArray::from_vec_bound
in the futureDeprecated form of PyArray<T, Ix1>::from_vec_bound
Deprecated form of PyArray<T, Ix1>::from_iter_bound
Deprecated form of PyArray<T, Ix1>::from_iter_bound
Construct a one-dimensional array from an Iterator
.
If no reliable size_hint
is available,
+ I: IntoIterator<Item = T>,
PyArray::from_vec2_bound
in the futureDeprecated form of PyArray<T, Ix2>::from_vec2_bound
PyArray::from_vec2_bound
in the futureDeprecated form of PyArray<T, Ix2>::from_vec2_bound
Construct a two-dimension array from a Vec<Vec<T>>
.
Construct a two-dimension array from a Vec<Vec<T>>
.
This function checks all dimensions of the inner vectors and returns an error if they are not all equal.
PyArray::from_vec3_bound
in the futureDeprecated form of PyArray<T, Ix3>::from_vec3_bound
PyArray::from_vec3_bound
in the futureDeprecated form of PyArray<T, Ix3>::from_vec3_bound
Construct a three-dimensional array from a Vec<Vec<Vec<T>>>
.
Construct a three-dimensional array from a Vec<Vec<Vec<T>>>
.
This function checks all dimensions of the inner vectors and returns an error if they are not all equal.
Copies self
into other
, performing a data type conversion if necessary.
See also PyArray_CopyInto
.
use numpy::{PyArray, PyArrayMethods};
@@ -511,7 +511,7 @@ §Example
});
Cast the PyArray<T>
to PyArray<U>
, by allocating a new array.
See also PyArray_CastToType
.
Special case of reshape_with_order
which keeps the memory order the same.
Extends or truncates the dimensions of an array.
+Extends or truncates the dimensions of an array.
This method works only on contiguous arrays.
Missing elements will be initialized as if calling zeros
.
See also ndarray.resize
and PyArray_Resize
.
Deprecated form of PyArray<T, Ix1>::arange_bound
Deprecated form of PyArray<T, Ix1>::arange_bound
Returns a raw pointer to the underlying PyArrayObject
.
Returns a raw pointer to the underlying PyArrayObject
.
Returns the dtype
of the array.
See also ndarray.dtype
and PyArray_DTYPE
.
Returns true
if the internal data of the array is contiguous,
+
Returns true
if the internal data of the array is Fortran-style/column-major contiguous.
Returns true
if the internal data of the array is C-style/row-major contiguous.
Returns true
if the internal data of the array is Fortran-style/column-major contiguous.
Returns true
if the internal data of the array is C-style/row-major contiguous.
Returns the number of dimensions of the array.
See also ndarray.ndim
and PyArray_NDIM
.
use numpy::{PyArray3, PyUntypedArrayMethods};
@@ -635,7 +635,7 @@ §Example
assert_eq!(arr.ndim(), 3);
});
Returns a slice indicating how many bytes to advance when iterating along each axis.
+Returns a slice indicating how many bytes to advance when iterating along each axis.
See also ndarray.strides
and PyArray_STRIDES
.
use numpy::{PyArray3, PyUntypedArrayMethods};
@@ -646,7 +646,7 @@ §Example
assert_eq!(arr.strides(), &[240, 48, 8]);
});
Returns whether self
and other
point to the same object. To compare
the equality of two objects (the ==
operator), use eq
.
This is equivalent to the Python expression self is other
.
Determines whether this object has the given attribute.
This is equivalent to the Python expression hasattr(self, attr_name)
.
To avoid repeated temporary allocations of Python strings, the [intern!
] macro can be used
@@ -673,7 +673,7 @@
Retrieves an attribute value.
This is equivalent to the Python expression self.attr_name
.
To avoid repeated temporary allocations of Python strings, the [intern!
] macro can be used
@@ -683,7 +683,7 @@
Sets an attribute value.
This is equivalent to the Python expression self.attr_name = value
.
Deletes an attribute.
This is equivalent to the Python statement del self.attr_name
.
To avoid repeated temporary allocations of Python strings, the [intern!
] macro can be used
to intern attr_name
.
Returns an Ordering
between self
and other
.
Returns an Ordering
between self
and other
.
This is equivalent to the following Python code:
if self == other:
return Equal
@@ -736,7 +736,7 @@ Result<&PyAny, PyErr>where
+) -> Result<&PyAny, PyErr>where
O: ToPyObject,
-pub fn lt<O>(&self, other: O) -> Result<bool, PyErr>where
O: ToPyObject,
Tests whether this object is less than another.
This is equivalent to the Python expression self < other
.
-pub fn le<O>(&self, other: O) -> Result<bool, PyErr>where
O: ToPyObject,
Tests whether this object is less than or equal to another.
This is equivalent to the Python expression self <= other
.
-pub fn eq<O>(&self, other: O) -> Result<bool, PyErr>where
O: ToPyObject,
Tests whether this object is equal to another.
This is equivalent to the Python expression self == other
.
-pub fn ne<O>(&self, other: O) -> Result<bool, PyErr>where
O: ToPyObject,
Tests whether this object is not equal to another.
This is equivalent to the Python expression self != other
.
-pub fn gt<O>(&self, other: O) -> Result<bool, PyErr>where
O: ToPyObject,
Tests whether this object is greater than another.
This is equivalent to the Python expression self > other
.
-pub fn ge<O>(&self, other: O) -> Result<bool, PyErr>where
O: ToPyObject,
Tests whether this object is greater than or equal to another.
This is equivalent to the Python expression self >= other
.
-pub fn is_callable(&self) -> bool
Determines whether this object appears callable.
+pub fn is_callable(&self) -> bool
Determines whether this object appears callable.
This is equivalent to Python’s callable()
function.
§Examples
use pyo3::prelude::*;
@@ -799,8 +799,8 @@ §Examples
pub fn call(
&self,
args: impl IntoPy<Py<PyTuple>>,
- kwargs: Option<&PyDict>
-) -> Result<&PyAny, PyErr>
Calls the object.
+ kwargs: Option<&PyDict>
+) -> Result<&PyAny, PyErr>Calls the object.
This is equivalent to the Python expression self(*args, **kwargs)
.
§Examples
use pyo3::prelude::*;
@@ -823,7 +823,7 @@ §Examples
assert_eq!(result.extract::<String>()?, "called with args and kwargs");
Ok(())
})
-pub fn call1(&self, args: impl IntoPy<Py<PyTuple>>) -> Result<&PyAny, PyErr>
Calls the object with only positional arguments.
+pub fn call1(&self, args: impl IntoPy<Py<PyTuple>>) -> Result<&PyAny, PyErr>
Calls the object with only positional arguments.
This is equivalent to the Python expression self(*args)
.
§Examples
use pyo3::prelude::*;
@@ -859,8 +859,8 @@ §Examples
&self,
name: N,
args: A,
- kwargs: Option<&PyDict>
-) -> Result<&PyAny, PyErr>where
+ kwargs: Option<&PyDict>
+) -> Result<&PyAny, PyErr>where
N: IntoPy<Py<PyString>>,
A: IntoPy<Py<PyTuple>>,Calls a method on the object.
This is equivalent to the Python expression self.name(*args, **kwargs)
.
@@ -889,7 +889,7 @@ §Examples
assert_eq!(result.extract::<String>()?, "called with args and kwargs");
Ok(())
})
-pub fn call_method0<N>(&self, name: N) -> Result<&PyAny, PyErr>where
+
pub fn call_method0<N>(&self, name: N) -> Result<&PyAny, PyErr>where
N: IntoPy<Py<PyString>>,
Calls a method on the object without arguments.
This is equivalent to the Python expression self.name()
.
To avoid repeated temporary allocations of Python strings, the [intern!
] macro can be used
@@ -913,7 +913,7 @@
§Examples
assert_eq!(result.extract::<String>()?, "called with no arguments");
Ok(())
})
-
pub fn call_method1<N, A>(&self, name: N, args: A) -> Result<&PyAny, PyErr>where
+
pub fn call_method1<N, A>(&self, name: N, args: A) -> Result<&PyAny, PyErr>where
N: IntoPy<Py<PyString>>,
A: IntoPy<Py<PyTuple>>,
Calls a method on the object with only positional arguments.
This is equivalent to the Python expression self.name(*args)
.
@@ -939,32 +939,32 @@ §Examples
assert_eq!(result.extract::<String>()?, "called with args");
Ok(())
})
-pub fn is_true(&self) -> Result<bool, PyErr>
👎Deprecated since 0.21.0: use .is_truthy()
instead
Returns whether the object is considered to be true.
+pub fn is_true(&self) -> Result<bool, PyErr>
👎Deprecated since 0.21.0: use .is_truthy()
instead
Returns whether the object is considered to be true.
This is equivalent to the Python expression bool(self)
.
-pub fn is_truthy(&self) -> Result<bool, PyErr>
Returns whether the object is considered to be true.
+pub fn is_truthy(&self) -> Result<bool, PyErr>
Returns whether the object is considered to be true.
This applies truth value testing equivalent to the Python expression bool(self)
.
-pub fn is_none(&self) -> bool
Returns whether the object is considered to be None.
This is equivalent to the Python expression self is None
.
-pub fn is_ellipsis(&self) -> bool
👎Deprecated since 0.20.0: use .is(py.Ellipsis())
instead
Returns whether the object is Ellipsis, e.g. ...
.
+pub fn is_ellipsis(&self) -> bool
👎Deprecated since 0.20.0: use .is(py.Ellipsis())
instead
Returns whether the object is Ellipsis, e.g. ...
.
This is equivalent to the Python expression self is ...
.
-pub fn is_empty(&self) -> Result<bool, PyErr>
Returns true if the sequence or mapping has a length of 0.
+pub fn is_empty(&self) -> Result<bool, PyErr>
Returns true if the sequence or mapping has a length of 0.
This is equivalent to the Python expression len(self) == 0
.
-pub fn get_item<K>(&self, key: K) -> Result<&PyAny, PyErr>where
K: ToPyObject,
Gets an item from the collection.
This is equivalent to the Python expression self[key]
.
-pub fn set_item<K, V>(&self, key: K, value: V) -> Result<(), PyErr>where
K: ToPyObject,
V: ToPyObject,
Sets a collection item value.
This is equivalent to the Python expression self[key] = value
.
-pub fn del_item<K>(&self, key: K) -> Result<(), PyErr>where
K: ToPyObject,
Deletes an item from the collection.
This is equivalent to the Python expression del self[key]
.
-pub fn iter(&self) -> Result<&PyIterator, PyErr>
Takes an object and returns an iterator for it.
This is typically a new iterator but if the argument is an iterator,
this returns itself.
pub fn get_type(&self) -> &PyType
Returns the Python type object for this object’s type.
-pub fn get_type_ptr(&self) -> *mut PyTypeObject
Returns the Python type pointer for this object.
-pub fn get_type_ptr(&self) -> *mut PyTypeObject
Returns the Python type pointer for this object.
+pub fn downcast<T>(&self) -> Result<&T, PyDowncastError<'_>>where
T: PyTypeCheck<AsRefTarget = T>,
Downcast this PyAny
to a concrete Python type or pyclass.
Note that you can often avoid downcasting yourself by just specifying
the desired type in function or method signatures.
@@ -1005,7 +1005,7 @@
assert_eq!(class_ref.i, 1);
Ok(())
})
-pub fn downcast_exact<T>(&self) -> Result<&T, PyDowncastError<'_>>where
+
pub fn downcast_exact<T>(&self) -> Result<&T, PyDowncastError<'_>>where
T: PyTypeInfo<AsRefTarget = T>,
Downcast this PyAny
to a concrete Python type or pyclass (but not a subclass of it).
It is almost always better to use [PyAny::downcast
] because it accounts for Python
subtyping. Use this method only when you do not want to allow subtypes.
@@ -1029,93 +1029,93 @@ assert!(any.downcast_exact::<PyBool>().is_ok());
});
-pub unsafe fn downcast_unchecked<T>(&self) -> &Twhere
+
pub unsafe fn downcast_unchecked<T>(&self) -> &Twhere
T: HasPyGilRef<AsRefTarget = T>,
Converts this PyAny
to a concrete Python type without checking validity.
§Safety
Callers must ensure that the type is valid or risk type confusion.
-pub fn extract<'py, D>(&'py self) -> Result<D, PyErr>where
D: FromPyObjectBound<'py, 'py>,
Extracts some type from the Python object.
This is a wrapper function around
FromPyObject::extract()
.
-pub fn get_refcnt(&self) -> isize
Returns the reference count for the Python object.
-pub fn get_refcnt(&self) -> isize
Returns the reference count for the Python object.
+pub fn repr(&self) -> Result<&PyString, PyErr>
Computes the “repr” representation of self.
This is equivalent to the Python expression repr(self)
.
-pub fn str(&self) -> Result<&PyString, PyErr>
Computes the “str” representation of self.
This is equivalent to the Python expression str(self)
.
-pub fn hash(&self) -> Result<isize, PyErr>
Retrieves the hash code of self.
This is equivalent to the Python expression hash(self)
.
-pub fn len(&self) -> Result<usize, PyErr>
Returns the length of the sequence or mapping.
This is equivalent to the Python expression len(self)
.
pub fn dir(&self) -> &PyList
Returns the list of attributes of this object.
This is equivalent to the Python expression dir(self)
.
-pub fn is_instance(&self, ty: &PyAny) -> Result<bool, PyErr>
Checks whether this object is an instance of type ty
.
+pub fn is_instance(&self, ty: &PyAny) -> Result<bool, PyErr>
Checks whether this object is an instance of type ty
.
This is equivalent to the Python expression isinstance(self, ty)
.
-pub fn is_exact_instance(&self, ty: &PyAny) -> bool
Checks whether this object is an instance of exactly type ty
(not a subclass).
+pub fn is_exact_instance(&self, ty: &PyAny) -> bool
Checks whether this object is an instance of exactly type ty
(not a subclass).
This is equivalent to the Python expression type(self) is ty
.
-pub fn is_instance_of<T>(&self) -> boolwhere
+
pub fn is_instance_of<T>(&self) -> boolwhere
T: PyTypeInfo,
Checks whether this object is an instance of type T
.
This is equivalent to the Python expression isinstance(self, T)
,
if the type T
is known at compile time.
-pub fn is_exact_instance_of<T>(&self) -> boolwhere
+
pub fn is_exact_instance_of<T>(&self) -> boolwhere
T: PyTypeInfo,
Checks whether this object is an instance of exactly type T
.
This is equivalent to the Python expression type(self) is T
,
if the type T
is known at compile time.
-pub fn contains<V>(&self, value: V) -> Result<bool, PyErr>where
V: ToPyObject,
Determines if self contains value
.
This is equivalent to the Python expression value in self
.
pub fn py(&self) -> Python<'_>
Returns a GIL marker constrained to the lifetime of this type.
-pub fn as_ptr(&self) -> *mut PyObject
Returns the raw FFI pointer represented by self.
§Safety
Callers are responsible for ensuring that the pointer does not outlive self.
The reference is borrowed; callers should not decrease the reference count
when they are finished with the pointer.
-pub fn into_ptr(&self) -> *mut PyObject
Returns an owned raw FFI pointer represented by self.
§Safety
The reference is owned; when finished the caller should either transfer ownership
of the pointer or decrease the reference count (e.g. with pyo3::ffi::Py_DecRef
).
-
Py<T>
smart pointer.object
is an instance of this type or a subclass of this type.PyTypeInfo::type_object
will be replaced by PyTypeInfo::type_object_bound
in a future PyO3 versionPyTypeInfo::is_type_of
will be replaced by PyTypeInfo::is_type_of_bound
in a future PyO3 versionobject
is an instance of this type or a subclass of this type.PyTypeInfo::is_exact_type_of
will be replaced by PyTypeInfo::is_exact_type_of_bound
in a future PyO3 versionobject
is an instance of this type.object
is an instance of this type.Py<T>
smart pointer.object
is an instance of this type or a subclass of this type.PyTypeInfo::type_object
will be replaced by PyTypeInfo::type_object_bound
in a future PyO3 versionPyTypeInfo::is_type_of
will be replaced by PyTypeInfo::is_type_of_bound
in a future PyO3 versionobject
is an instance of this type or a subclass of this type.PyTypeInfo::is_exact_type_of
will be replaced by PyTypeInfo::is_exact_type_of_bound
in a future PyO3 versionobject
is an instance of this type.object
is an instance of this type.Py::from_owned_ptr_or_opt(py, ptr)
or Bound::from_owned_ptr_or_opt(py, ptr)
insteadPyObject
. Read morePy::from_owned_ptr_or_opt(py, ptr)
or Bound::from_owned_ptr_or_opt(py, ptr)
insteadPyObject
. Read morePy::from_borrowed_ptr_or_opt(py, ptr)
or Bound::from_borrowed_ptr_or_opt(py, ptr)
insteadPyObject
. Read morePy::from_borrowed_ptr_or_opt(py, ptr)
or Bound::from_borrowed_ptr_or_opt(py, ptr)
insteadPyObject
. Read morePy::from_owned_ptr(py, ptr)
or Bound::from_owned_ptr(py, ptr)
insteadPyObject
or panic. Read morePy::from_owned_ptr(py, ptr)
or Bound::from_owned_ptr(py, ptr)
insteadPyObject
or panic. Read morePy::from_owned_ptr(py, ptr)
or Bound::from_owned_ptr(py, ptr)
insteadPyObject
or panic. Read morePy::from_owned_ptr(py, ptr)
or Bound::from_owned_ptr(py, ptr)
insteadPyObject
or panic. Read morePy::from_owned_ptr_or_err(py, ptr)
or Bound::from_owned_ptr_or_err(py, ptr)
insteadPyObject
. Read morePy::from_owned_ptr_or_err(py, ptr)
or Bound::from_owned_ptr_or_err(py, ptr)
insteadPyObject
. Read morePy::from_borrowed_ptr(py, ptr)
or Bound::from_borrowed_ptr(py, ptr)
insteadPyObject
. Read morePy::from_borrowed_ptr(py, ptr)
or Bound::from_borrowed_ptr(py, ptr)
insteadPyObject
. Read morePy::from_borrowed_ptr(py, ptr)
or Bound::from_borrowed_ptr(py, ptr)
insteadPyObject
. Read morePy::from_borrowed_ptr(py, ptr)
or Bound::from_borrowed_ptr(py, ptr)
insteadPyObject
. Read morevalue.downcast::<T>()
instead of T::try_from(value)
value.downcast_exact::<T>()
instead of T::try_from_exact(value)
value.downcast_unchecked::<T>()
instead of T::try_from_unchecked(value)
value.downcast::<T>()
instead of T::try_from(value)
value.downcast_exact::<T>()
instead of T::try_from_exact(value)
value.downcast_unchecked::<T>()
instead of T::try_from_unchecked(value)
self
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub trait PyArray0Methods<'py, T>: PyArrayMethods<'py, T, Ix0> {
// Provided method
fn item(&self) -> T
- where T: Element + Copy { ... }
+ where T: Element + Copy { ... }
}
Implementation of functionality for PyArray0<T>
.
pub trait PyArrayMethods<'py, T, D>: PyUntypedArrayMethods<'py> {
Show 29 methods
// Required methods
fn as_untyped(&self) -> &Bound<'py, PyUntypedArray>;
- fn data(&self) -> *mut T;
- unsafe fn get(&self, index: impl NpyIndex<Dim = D>) -> Option<&T>
+ fn data(&self) -> *mut T;
+ unsafe fn get(&self, index: impl NpyIndex<Dim = D>) -> Option<&T>
where T: Element,
D: Dimension;
- unsafe fn get_mut(&self, index: impl NpyIndex<Dim = D>) -> Option<&mut T>
+ unsafe fn get_mut(&self, index: impl NpyIndex<Dim = D>) -> Option<&mut T>
where T: Element,
D: Dimension;
fn to_dyn(&self) -> &Bound<'py, PyArray<T, IxDyn>>
where T: Element,
D: Dimension;
- fn try_readonly(&self) -> Result<PyReadonlyArray<'py, T, D>, BorrowError>
+ fn try_readonly(&self) -> Result<PyReadonlyArray<'py, T, D>, BorrowError>
where T: Element,
D: Dimension;
- fn try_readwrite(&self) -> Result<PyReadwriteArray<'py, T, D>, BorrowError>
+ fn try_readwrite(&self) -> Result<PyReadwriteArray<'py, T, D>, BorrowError>
where T: Element,
D: Dimension;
unsafe fn as_array(&self) -> ArrayView<'_, T, D>
@@ -33,11 +33,11 @@
fn copy_to<U: Element>(
&self,
other: &Bound<'py, PyArray<U, D>>
- ) -> PyResult<()>
+ ) -> PyResult<()>
where T: Element;
fn cast<U: Element>(
&self,
- is_fortran: bool
+ is_fortran: bool
) -> PyResult<Bound<'py, PyArray<U, D>>>
where T: Element;
fn reshape_with_order<ID: IntoDimension>(
@@ -46,11 +46,11 @@
order: NPY_ORDER
) -> PyResult<Bound<'py, PyArray<T, ID::Dim>>>
where T: Element;
- unsafe fn resize<ID: IntoDimension>(&self, dims: ID) -> PyResult<()>
+ unsafe fn resize<ID: IntoDimension>(&self, dims: ID) -> PyResult<()>
where T: Element;
unsafe fn try_as_matrix<R, C, RStride, CStride>(
&self
- ) -> Option<MatrixView<'_, T, R, C, RStride, CStride>>
+ ) -> Option<MatrixView<'_, T, R, C, RStride, CStride>>
where T: Scalar + Element,
D: Dimension,
R: Dim,
@@ -59,7 +59,7 @@
CStride: Dim;
unsafe fn try_as_matrix_mut<R, C, RStride, CStride>(
&self
- ) -> Option<MatrixViewMut<'_, T, R, C, RStride, CStride>>
+ ) -> Option<MatrixViewMut<'_, T, R, C, RStride, CStride>>
where T: Scalar + Element,
D: Dimension,
R: Dim,
@@ -70,29 +70,29 @@
// Provided methods
fn dims(&self) -> D
where D: Dimension { ... }
- unsafe fn as_slice(&self) -> Result<&[T], NotContiguousError>
+ unsafe fn as_slice(&self) -> Result<&[T], NotContiguousError>
where T: Element,
D: Dimension { ... }
- unsafe fn as_slice_mut(&self) -> Result<&mut [T], NotContiguousError>
+ unsafe fn as_slice_mut(&self) -> Result<&mut [T], NotContiguousError>
where T: Element,
D: Dimension { ... }
- unsafe fn uget<Idx>(&self, index: Idx) -> &T
+ unsafe fn uget<Idx>(&self, index: Idx) -> &T
where T: Element,
D: Dimension,
Idx: NpyIndex<Dim = D> { ... }
- unsafe fn uget_mut<Idx>(&self, index: Idx) -> &mut T
+ unsafe fn uget_mut<Idx>(&self, index: Idx) -> &mut T
where T: Element,
D: Dimension,
Idx: NpyIndex<Dim = D> { ... }
- unsafe fn uget_raw<Idx>(&self, index: Idx) -> *mut T
+ unsafe fn uget_raw<Idx>(&self, index: Idx) -> *mut T
where T: Element,
D: Dimension,
Idx: NpyIndex<Dim = D> { ... }
- fn get_owned<Idx>(&self, index: Idx) -> Option<T>
+ fn get_owned<Idx>(&self, index: Idx) -> Option<T>
where T: Element,
D: Dimension,
Idx: NpyIndex<Dim = D> { ... }
- fn to_vec(&self) -> Result<Vec<T>, NotContiguousError>
+ fn to_vec(&self) -> Result<Vec<T>, NotContiguousError>
where T: Element,
D: Dimension { ... }
fn readonly(&self) -> PyReadonlyArray<'py, T, D>
@@ -111,8 +111,8 @@
where T: Element { ... }
}
Implementation of functionality for PyArray<T, D>
.
Access an untyped representation of this array.
-Turn an array with fixed dimensionality into one with dynamic dimensionality.
-Get an immutable borrow of the NumPy array
-Get a mutable borrow of the NumPy array
Returns the internal array as RawArrayViewMut
enabling element access via raw pointers
Cast the PyArray<T>
to PyArray<U>
, by allocating a new array.
See also PyArray_CastToType
.
Extends or truncates the dimensions of an array.
This method works only on contiguous arrays.
Missing elements will be initialized as if calling zeros
.
Calling this method invalidates all exclusive references to the internal data, e.g. ArrayViewMut
or MatrixSliceMut
.
Returns an immutable view of the internal data as a slice.
PyArray
or concurrently modified by Python or other native code.
Please consider the safe alternative PyReadonlyArray::as_slice
.
Returns a mutable view of the internal data as a slice.
PyArray
or concurrently modified by Python or other native code.
Please consider the safe alternative PyReadwriteArray::as_slice_mut
.
Same as uget
, but returns &mut T
.
See PyReadwriteArray::get_mut
for a safe alternative.
Returns a copy of the internal data of the array as a Vec
.
Fails if the internal array is not contiguous. See also as_slice
.
use numpy::{PyArray2, PyArrayMethods};
@@ -395,13 +395,13 @@ §Example
dims: ID
) -> PyResult<Bound<'py, PyArray<T, ID::Dim>>>where
T: Element,Special case of reshape_with_order
which keeps the memory order the same.
-
Types to safely create references into NumPy arrays
It is assumed that unchecked code - which includes unsafe Rust and Python - is validated by its author which together with the dynamic borrow checking performed by this crate ensures that diff --git a/numpy/borrow/struct.PyReadonlyArray.html b/numpy/borrow/struct.PyReadonlyArray.html index bc05baeeb..7de395c71 100644 --- a/numpy/borrow/struct.PyReadonlyArray.html +++ b/numpy/borrow/struct.PyReadonlyArray.html @@ -1,4 +1,4 @@ -
pub struct PyReadonlyArray<'py, T, D>{ /* private fields */ }
Read-only borrow of an array.
@@ -8,14 +8,14 @@Provides an immutable array view of the interior of the NumPy array.
-Provide an immutable slice view of the interior of the NumPy array if it is contiguous.
-Provide an immutable slice view of the interior of the NumPy array if it is contiguous.
+Convert this two-dimensional array into a nalgebra::DMatrixView
using dynamic strides.
Panics if the array has negative strides.
-Immutably borrows the value T
.
Immutably borrows the value T
.
This borrow lasts while the returned [PyRef
] exists.
Multiple immutable borrows can be taken out at the same time.
For frozen classes, the simpler [get
][Self::get] is available.
Panics if the value is currently borrowed. For a non-panicking variant, use
try_borrow_mut
.
Attempts to immutably borrow the value T
, returning an error if the value is currently mutably borrowed.
Attempts to immutably borrow the value T
, returning an error if the value is currently mutably borrowed.
The borrow lasts while the returned [PyRef
] exists.
This is the non-panicking variant of borrow
.
For frozen classes, the simpler [get
][Self::get] is available.
Attempts to mutably borrow the value T
, returning an error if the value is currently borrowed.
The borrow lasts while the returned [PyRefMut
] exists.
This is the non-panicking variant of borrow_mut
.
Provide an immutable borrow of the value T
without acquiring the GIL.
This is available if the class is [frozen
][macro@crate::pyclass] and Sync
.
Returns the GIL token associated with this object.
-Casts this Bound<T>
as the corresponding “GIL Ref” type.
This is a helper to be used for migration from the deprecated “GIL Refs” API.
-Calls U::from(self)
.
self
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct PyReadwriteArray<'py, T, D>{ /* private fields */ }
Read-write borrow of an array.
@@ -8,14 +8,14 @@Provides a mutable array view of the interior of the NumPy array.
-Provide a mutable slice view of the interior of the NumPy array if it is contiguous.
-Provide a mutable slice view of the interior of the NumPy array if it is contiguous.
+Provides an immutable array view of the interior of the NumPy array.
+Provide an immutable slice view of the interior of the NumPy array if it is contiguous.
+Provide an immutable reference to an element of the NumPy array if the index is within bounds.
Convert this two-dimensional array into a nalgebra::DMatrixView
using dynamic strides.
Panics if the array has negative strides.
-Immutably borrows the value T
.
Immutably borrows the value T
.
This borrow lasts while the returned [PyRef
] exists.
Multiple immutable borrows can be taken out at the same time.
For frozen classes, the simpler [get
][Self::get] is available.
Panics if the value is currently borrowed. For a non-panicking variant, use
try_borrow_mut
.
Attempts to immutably borrow the value T
, returning an error if the value is currently mutably borrowed.
Attempts to immutably borrow the value T
, returning an error if the value is currently mutably borrowed.
The borrow lasts while the returned [PyRef
] exists.
This is the non-panicking variant of borrow
.
For frozen classes, the simpler [get
][Self::get] is available.
Attempts to mutably borrow the value T
, returning an error if the value is currently borrowed.
The borrow lasts while the returned [PyRefMut
] exists.
This is the non-panicking variant of borrow_mut
.
Provide an immutable borrow of the value T
without acquiring the GIL.
This is available if the class is [frozen
][macro@crate::pyclass] and Sync
.
Returns the GIL token associated with this object.
-Casts this Bound<T>
as the corresponding “GIL Ref” type.
This is a helper to be used for migration from the deprecated “GIL Refs” API.
-Calls U::from(self)
.
self
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub type PyReadonlyArray0<'py, T> = PyReadonlyArray<'py, T, Ix0>;
Read-only borrow of a zero-dimensional array.
struct PyReadonlyArray0<'py, T> { /* private fields */ }
pub type PyReadonlyArray1<'py, T> = PyReadonlyArray<'py, T, Ix1>;
Read-only borrow of a one-dimensional array.
struct PyReadonlyArray1<'py, T> { /* private fields */ }
pub type PyReadonlyArray2<'py, T> = PyReadonlyArray<'py, T, Ix2>;
Read-only borrow of a two-dimensional array.
struct PyReadonlyArray2<'py, T> { /* private fields */ }
pub type PyReadonlyArray3<'py, T> = PyReadonlyArray<'py, T, Ix3>;
Read-only borrow of a three-dimensional array.
struct PyReadonlyArray3<'py, T> { /* private fields */ }
pub type PyReadonlyArray4<'py, T> = PyReadonlyArray<'py, T, Ix4>;
Read-only borrow of a four-dimensional array.
struct PyReadonlyArray4<'py, T> { /* private fields */ }
pub type PyReadonlyArray5<'py, T> = PyReadonlyArray<'py, T, Ix5>;
Read-only borrow of a five-dimensional array.
struct PyReadonlyArray5<'py, T> { /* private fields */ }
pub type PyReadonlyArray6<'py, T> = PyReadonlyArray<'py, T, Ix6>;
Read-only borrow of a six-dimensional array.
struct PyReadonlyArray6<'py, T> { /* private fields */ }
pub type PyReadonlyArrayDyn<'py, T> = PyReadonlyArray<'py, T, IxDyn>;
Read-only borrow of an array whose dimensionality is determined at runtime.
struct PyReadonlyArrayDyn<'py, T> { /* private fields */ }
pub type PyReadwriteArray0<'py, T> = PyReadwriteArray<'py, T, Ix0>;
Read-write borrow of a zero-dimensional array.
struct PyReadwriteArray0<'py, T> { /* private fields */ }
pub type PyReadwriteArray1<'py, T> = PyReadwriteArray<'py, T, Ix1>;
Read-write borrow of a one-dimensional array.
struct PyReadwriteArray1<'py, T> { /* private fields */ }
pub type PyReadwriteArray2<'py, T> = PyReadwriteArray<'py, T, Ix2>;
Read-write borrow of a two-dimensional array.
struct PyReadwriteArray2<'py, T> { /* private fields */ }
pub type PyReadwriteArray3<'py, T> = PyReadwriteArray<'py, T, Ix3>;
Read-write borrow of a three-dimensional array.
struct PyReadwriteArray3<'py, T> { /* private fields */ }
pub type PyReadwriteArray4<'py, T> = PyReadwriteArray<'py, T, Ix4>;
Read-write borrow of a four-dimensional array.
struct PyReadwriteArray4<'py, T> { /* private fields */ }
pub type PyReadwriteArray5<'py, T> = PyReadwriteArray<'py, T, Ix5>;
Read-write borrow of a five-dimensional array.
struct PyReadwriteArray5<'py, T> { /* private fields */ }
pub type PyReadwriteArray6<'py, T> = PyReadwriteArray<'py, T, Ix6>;
Read-write borrow of a six-dimensional array.
struct PyReadwriteArray6<'py, T> { /* private fields */ }
pub type PyReadwriteArrayDyn<'py, T> = PyReadwriteArray<'py, T, IxDyn>;
Read-write borrow of an array whose dimensionality is determined at runtime.
struct PyReadwriteArrayDyn<'py, T> { /* private fields */ }
Defines conversion traits between Rust types and NumPy data types.
pub trait IntoPyArray: Sized {
+IntoPyArray in numpy::convert - Rust
+ Trait numpy::convert::IntoPyArray
source · pub trait IntoPyArray: Sized {
type Item: Element;
type Dim: Dimension;
@@ -41,15 +41,15 @@ §Example
self,
py: Python<'py>
) -> &'py PyArray<Self::Item, Self::Dim>
👎Deprecated since 0.21.0: will be replaced by IntoPyArray::into_pyarray_bound
in the futureDeprecated form of IntoPyArray::into_pyarray_bound
-Object Safety§
This trait is not object safe.Implementations on Foreign Types§
source§impl<A, D> IntoPyArray for ArrayBase<OwnedRepr<A>, D>where
+
pub trait NpyIndex: IntoDimension + Sealed { }
Trait implemented by types that can be used to index an array.
This is equivalent to ndarray::NdIndex
but accounts for
NumPy strides being in units of bytes instead of elements.
pub trait ToNpyDims: Dimension + Sealed { }
Utility trait to specify the dimensions of an array.
-pub trait ToPyArray {
type Item: Element;
type Dim: Dimension;
@@ -58,13 +58,13 @@ §Examples
py: Python<'py>
) -> Bound<'py, PyArray<Self::Item, Self::Dim>>
Note that the NumPy array always has Fortran memory layout
matching the memory layout used by nalgebra
.
Support datetimes and timedeltas
This module provides wrappers for NumPy’s datetime64
and timedelta64
types
which are used for time keeping with with an emphasis on scientific applications.
diff --git a/numpy/datetime/struct.Datetime.html b/numpy/datetime/struct.Datetime.html
index f882c7e59..151dcaebe 100644
--- a/numpy/datetime/struct.Datetime.html
+++ b/numpy/datetime/struct.Datetime.html
@@ -1,30 +1,30 @@
-
pub struct Datetime<U: Unit>(/* private fields */);
Corresponds to the datetime64
scalar type
get_dtype_bound
in the future.self
and other
) and is used by the <=
-operator. Read moreget_dtype_bound
in the future.self
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Timedelta<U: Unit>(/* private fields */);
Corresponds to the [timedelta64
][scalars-datetime64] scalar type
get_dtype_bound
in the future.self
and other
) and is used by the <=
-operator. Read moreget_dtype_bound
in the future.self
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub trait Unit: Send + Sync + Clone + Copy + PartialEq + Eq + Hash + PartialOrd + Ord {
+Unit in numpy::datetime - Rust
+ pub trait Unit: Send + Sync + Clone + Copy + PartialEq + Eq + Hash + PartialOrd + Ord {
const UNIT: NPY_DATETIMEUNIT;
- const ABBREV: &'static str;
+ const ABBREV: &'static str;
}
Expand description
Represents the datetime units supported by NumPy
Required Associated Constants§
sourceconst UNIT: NPY_DATETIMEUNIT
The matching NumPy datetime unit code
-Object Safety§
This trait is not object safe.Implementors§
source§impl Unit for Attoseconds
source§impl Unit for Femtoseconds
source§impl Unit for Microseconds
source§impl Unit for Milliseconds
source§impl Unit for Nanoseconds
source§impl Unit for Picoseconds
\ No newline at end of file
+
Predefined implementors of the Unit
trait
pub struct Attoseconds;
Attoseconds, i.e. 10^-18 seconds
-source
. Read moreself
and other
values to be equal, and is used
-by ==
.self
and other
) and is used by the <=
-operator. Read moresource
. Read moreself
and other
values to be equal, and is used
+by ==
.self
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Days;
Days, i.e. 24 hours
-self
and other
) and is used by the <=
-operator. Read moreself
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Femtoseconds;
Femtoseconds, i.e. 10^-15 seconds
-source
. Read moreself
and other
values to be equal, and is used
-by ==
.self
and other
) and is used by the <=
-operator. Read moresource
. Read moreself
and other
values to be equal, and is used
+by ==
.self
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Hours;
Hours, i.e. 60 minutes
-self
and other
) and is used by the <=
-operator. Read moreself
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Microseconds;
Microseconds, i.e. 10^-6 seconds
-source
. Read moreself
and other
values to be equal, and is used
-by ==
.self
and other
) and is used by the <=
-operator. Read moresource
. Read moreself
and other
values to be equal, and is used
+by ==
.self
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Milliseconds;
Milliseconds, i.e. 10^-3 seconds
-source
. Read moreself
and other
values to be equal, and is used
-by ==
.self
and other
) and is used by the <=
-operator. Read moresource
. Read moreself
and other
values to be equal, and is used
+by ==
.self
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Minutes;
Minutes, i.e. 60 seconds
-self
and other
) and is used by the <=
-operator. Read moreself
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Months;
Months, i.e. 30 days
-self
and other
) and is used by the <=
-operator. Read moreself
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Nanoseconds;
Nanoseconds, i.e. 10^-9 seconds
-source
. Read moreself
and other
values to be equal, and is used
-by ==
.self
and other
) and is used by the <=
-operator. Read moresource
. Read moreself
and other
values to be equal, and is used
+by ==
.self
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Picoseconds;
Picoseconds, i.e. 10^-12 seconds
-source
. Read moreself
and other
values to be equal, and is used
-by ==
.self
and other
) and is used by the <=
-operator. Read moresource
. Read moreself
and other
values to be equal, and is used
+by ==
.self
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Seconds;
Seconds
-self
and other
) and is used by the <=
-operator. Read moreself
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Weeks;
Weeks, i.e. 7 days
-self
and other
) and is used by the <=
-operator. Read moreself
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub struct Years;
Years, i.e. 12 months
-self
and other
) and is used by the <=
-operator. Read moreself
and other
) and is used by the <=
+operator. Read moreself
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.#[non_exhaustive]pub enum BorrowError {
AlreadyBorrowed,
NotWriteable,
}
Inidcates why borrowing an array failed.
self
from the equivalent element of its
-superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.self
from the equivalent element of its
+superset. Read moreself
is actually part of its subset T
(and can be converted to it).self.to_subset
but without any property checks. Always succeeds.self
to the equivalent element of its superset.pub fn Ix1(i0: usize) -> Dim<[usize; 1]>
Create a one-dimensional index
+pub fn Ix2(i0: usize, i1: usize) -> Dim<[usize; 2]>
Create a two-dimensional index
+pub fn Ix3(i0: usize, i1: usize, i2: usize) -> Dim<[usize; 3]>
Create a three-dimensional index
+pub fn Ix4(i0: usize, i1: usize, i2: usize, i3: usize) -> Dim<[usize; 4]>
Create a four-dimensional index
+pub fn Ix5(
- i0: usize,
- i1: usize,
- i2: usize,
- i3: usize,
- i4: usize
-) -> Dim<[usize; 5]>
Create a five-dimensional index
+ i0: usize, + i1: usize, + i2: usize, + i3: usize, + i4: usize +) -> Dim<[usize; 5]>Create a five-dimensional index
pub fn Ix6(
- i0: usize,
- i1: usize,
- i2: usize,
- i3: usize,
- i4: usize,
- i5: usize
-) -> Dim<[usize; 6]>
Create a six-dimensional index
+ i0: usize, + i1: usize, + i2: usize, + i3: usize, + i4: usize, + i5: usize +) -> Dim<[usize; 6]>Create a six-dimensional index
pub fn IxDyn(ix: &[usize]) -> Dim<IxDynImpl>
Create a dynamic-dimensional index
+pub fn dot<'py, T, DIN1, DIN2, OUT>(
array1: &'py PyArray<T, DIN1>,
array2: &'py PyArray<T, DIN2>
diff --git a/numpy/fn.dot_bound.html b/numpy/fn.dot_bound.html
index 69778d7e7..77e32fca4 100644
--- a/numpy/fn.dot_bound.html
+++ b/numpy/fn.dot_bound.html
@@ -1,4 +1,4 @@
-dot_bound in numpy - Rust
+dot_bound in numpy - Rust
pub fn dot_bound<'py, T, DIN1, DIN2, OUT>(
array1: &Bound<'py, PyArray<T, DIN1>>,
array2: &Bound<'py, PyArray<T, DIN2>>
diff --git a/numpy/fn.dtype.html b/numpy/fn.dtype.html
index 40715bd54..6eb1429bb 100644
--- a/numpy/fn.dtype.html
+++ b/numpy/fn.dtype.html
@@ -1,3 +1,3 @@
-dtype in numpy - Rust
+dtype in numpy - Rust
pub fn dtype<'py, T: Element>(py: Python<'py>) -> &'py PyArrayDescr
👎Deprecated since 0.21.0: This will be replaced by dtype_bound
in the future.Expand description
Returns the type descriptor (“dtype”) for a registered type.
\ No newline at end of file
diff --git a/numpy/fn.dtype_bound.html b/numpy/fn.dtype_bound.html
index f2a37fbfc..047bec1e2 100644
--- a/numpy/fn.dtype_bound.html
+++ b/numpy/fn.dtype_bound.html
@@ -1,3 +1,3 @@
-dtype_bound in numpy - Rust
+dtype_bound in numpy - Rust
Function numpy::dtype_bound
source · pub fn dtype_bound<'py, T: Element>(py: Python<'py>) -> Bound<'py, PyArrayDescr>
Expand description
Returns the type descriptor (“dtype”) for a registered type.
\ No newline at end of file
diff --git a/numpy/fn.einsum.html b/numpy/fn.einsum.html
index 8a766bd7e..8714a6d90 100644
--- a/numpy/fn.einsum.html
+++ b/numpy/fn.einsum.html
@@ -1,6 +1,6 @@
-einsum in numpy - Rust
+einsum in numpy - Rust
pub fn einsum<'py, T, OUT>(
- subscripts: &str,
+ subscripts: &str,
arrays: &[&'py PyArray<T, IxDyn>]
) -> PyResult<OUT>where
T: Element,
diff --git a/numpy/fn.einsum_bound.html b/numpy/fn.einsum_bound.html
index c7778f35c..86e2fb849 100644
--- a/numpy/fn.einsum_bound.html
+++ b/numpy/fn.einsum_bound.html
@@ -1,6 +1,6 @@
-einsum_bound in numpy - Rust
+einsum_bound in numpy - Rust
Function numpy::einsum_bound
source · pub fn einsum_bound<'py, T, OUT>(
- subscripts: &str,
+ subscripts: &str,
arrays: &[Borrowed<'_, 'py, PyArray<T, IxDyn>>]
) -> PyResult<OUT>where
T: Element,
diff --git a/numpy/fn.inner.html b/numpy/fn.inner.html
index 58502de33..08fee53f7 100644
--- a/numpy/fn.inner.html
+++ b/numpy/fn.inner.html
@@ -1,4 +1,4 @@
-inner in numpy - Rust
+inner in numpy - Rust
pub fn inner<'py, T, DIN1, DIN2, OUT>(
array1: &'py PyArray<T, DIN1>,
array2: &'py PyArray<T, DIN2>
diff --git a/numpy/fn.inner_bound.html b/numpy/fn.inner_bound.html
index 730107ca4..6f9d42529 100644
--- a/numpy/fn.inner_bound.html
+++ b/numpy/fn.inner_bound.html
@@ -1,4 +1,4 @@
-inner_bound in numpy - Rust
+inner_bound in numpy - Rust
Function numpy::inner_bound
source · pub fn inner_bound<'py, T, DIN1, DIN2, OUT>(
array1: &Bound<'py, PyArray<T, DIN1>>,
array2: &Bound<'py, PyArray<T, DIN2>>
diff --git a/numpy/index.html b/numpy/index.html
index 238d5fc07..464d76ff2 100644
--- a/numpy/index.html
+++ b/numpy/index.html
@@ -1,4 +1,4 @@
-numpy - Rust