chore: update to simba 0.9 (#1415)

This commit is contained in:
Sébastien Crozet 2024-06-22 19:06:20 +02:00 committed by GitHub
parent f812694959
commit 292abfbaa0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
54 changed files with 331 additions and 362 deletions

View File

@ -1,15 +1,15 @@
[package]
name = "nalgebra"
name = "nalgebra"
version = "0.32.3"
authors = [ "Sébastien Crozet <developer@crozet.re>" ]
authors = ["Sébastien Crozet <developer@crozet.re>"]
description = "General-purpose linear algebra library with transformations and statically-sized or dynamically-sized matrices."
documentation = "https://www.nalgebra.org/docs"
homepage = "https://nalgebra.org"
repository = "https://github.com/dimforge/nalgebra"
readme = "README.md"
categories = [ "science", "mathematics", "wasm", "no-std" ]
keywords = [ "linear", "algebra", "matrix", "vector", "math" ]
categories = ["science", "mathematics", "wasm", "no-std"]
keywords = ["linear", "algebra", "matrix", "vector", "math"]
license = "Apache-2.0"
edition = "2018"
exclude = ["/ci/*", "/.travis.yml", "/Makefile"]
@ -22,108 +22,108 @@ name = "nalgebra"
path = "src/lib.rs"
[features]
default = [ "std", "macros" ]
std = [ "matrixmultiply", "num-traits/std", "num-complex/std", "num-rational/std", "approx/std", "simba/std" ]
sparse = [ ]
debug = [ "approx/num-complex", "rand" ]
alloc = [ ]
io = [ "pest", "pest_derive" ]
compare = [ "matrixcompare-core" ]
libm = [ "simba/libm" ]
libm-force = [ "simba/libm_force" ]
macros = [ "nalgebra-macros" ]
default = ["std", "macros"]
std = ["matrixmultiply", "num-traits/std", "num-complex/std", "num-rational/std", "approx/std", "simba/std"]
sparse = []
debug = ["approx/num-complex", "rand"]
alloc = []
io = ["pest", "pest_derive"]
compare = ["matrixcompare-core"]
libm = ["simba/libm"]
libm-force = ["simba/libm_force"]
macros = ["nalgebra-macros"]
# Conversion
convert-mint = [ "mint" ]
convert-bytemuck = [ "bytemuck" ]
convert-glam014 = [ "glam014" ]
convert-glam015 = [ "glam015" ]
convert-glam016 = [ "glam016" ]
convert-glam017 = [ "glam017" ]
convert-glam018 = [ "glam018" ]
convert-glam019 = [ "glam019" ]
convert-glam020 = [ "glam020" ]
convert-glam021 = [ "glam021" ]
convert-glam022 = [ "glam022" ]
convert-glam023 = [ "glam023" ]
convert-glam024 = [ "glam024" ]
convert-glam025 = [ "glam025" ]
convert-glam027 = [ "glam027" ]
convert-glam028 = [ "glam028" ]
convert-mint = ["mint"]
convert-bytemuck = ["bytemuck"]
convert-glam014 = ["glam014"]
convert-glam015 = ["glam015"]
convert-glam016 = ["glam016"]
convert-glam017 = ["glam017"]
convert-glam018 = ["glam018"]
convert-glam019 = ["glam019"]
convert-glam020 = ["glam020"]
convert-glam021 = ["glam021"]
convert-glam022 = ["glam022"]
convert-glam023 = ["glam023"]
convert-glam024 = ["glam024"]
convert-glam025 = ["glam025"]
convert-glam027 = ["glam027"]
convert-glam028 = ["glam028"]
# Serialization
## To use serde in a #[no-std] environment, enable the
## `serde-serialize-no-std` feature instead of `serde-serialize`.
## Serialization of dynamically-sized matrices/vectors require
## `serde-serialize`.
serde-serialize-no-std = [ "serde", "num-complex/serde" ]
serde-serialize = [ "serde-serialize-no-std", "serde/std" ]
rkyv-serialize-no-std = [ "rkyv/size_32" ]
rkyv-serialize = [ "rkyv-serialize-no-std", "rkyv/std", "rkyv/validation" ]
serde-serialize-no-std = ["serde", "num-complex/serde"]
serde-serialize = ["serde-serialize-no-std", "serde/std"]
rkyv-serialize-no-std = ["rkyv/size_32"]
rkyv-serialize = ["rkyv-serialize-no-std", "rkyv/std", "rkyv/validation"]
# Randomness
## To use rand in a #[no-std] environment, enable the
## `rand-no-std` feature instead of `rand`.
rand-no-std = [ "rand-package" ]
rand = [ "rand-no-std", "rand-package/std", "rand-package/std_rng", "rand_distr" ]
rand-no-std = ["rand-package"]
rand = ["rand-no-std", "rand-package/std", "rand-package/std_rng", "rand_distr"]
# Tests
arbitrary = [ "quickcheck" ]
proptest-support = [ "proptest" ]
slow-tests = []
rkyv-safe-deser = [ "rkyv-serialize", "rkyv/validation" ]
arbitrary = ["quickcheck"]
proptest-support = ["proptest"]
slow-tests = []
rkyv-safe-deser = ["rkyv-serialize", "rkyv/validation"]
[dependencies]
nalgebra-macros = { version = "0.2.1", path = "nalgebra-macros", optional = true }
typenum = "1.12"
rand-package = { package = "rand", version = "0.8", optional = true, default-features = false }
num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.4", default-features = false }
num-rational = { version = "0.4", default-features = false }
approx = { version = "0.5", default-features = false }
simba = { version = "0.8", default-features = false }
alga = { version = "0.9", default-features = false, optional = true }
rand_distr = { version = "0.4", default-features = false, optional = true }
typenum = "1.12"
rand-package = { package = "rand", version = "0.8", optional = true, default-features = false }
num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.4", default-features = false }
num-rational = { version = "0.4", default-features = false }
approx = { version = "0.5", default-features = false }
simba = { version = "0.9", default-features = false }
alga = { version = "0.9", default-features = false, optional = true }
rand_distr = { version = "0.4", default-features = false, optional = true }
matrixmultiply = { version = "0.3", optional = true }
serde = { version = "1.0", default-features = false, features = [ "derive" ], optional = true }
rkyv = { version = "0.7.41", default-features = false, optional = true }
mint = { version = "0.5", optional = true }
quickcheck = { version = "1", optional = true }
pest = { version = "2", optional = true }
pest_derive = { version = "2", optional = true }
bytemuck = { version = "1.5", optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
rkyv = { version = "0.7.41", default-features = false, optional = true }
mint = { version = "0.5", optional = true }
quickcheck = { version = "1", optional = true }
pest = { version = "2", optional = true }
pest_derive = { version = "2", optional = true }
bytemuck = { version = "1.5", optional = true }
matrixcompare-core = { version = "0.1", optional = true }
proptest = { version = "1", optional = true, default-features = false, features = ["std"] }
glam014 = { package = "glam", version = "0.14", optional = true }
glam015 = { package = "glam", version = "0.15", optional = true }
glam016 = { package = "glam", version = "0.16", optional = true }
glam017 = { package = "glam", version = "0.17", optional = true }
glam018 = { package = "glam", version = "0.18", optional = true }
glam019 = { package = "glam", version = "0.19", optional = true }
glam020 = { package = "glam", version = "0.20", optional = true }
glam021 = { package = "glam", version = "0.21", optional = true }
glam022 = { package = "glam", version = "0.22", optional = true }
glam023 = { package = "glam", version = "0.23", optional = true }
glam024 = { package = "glam", version = "0.24", optional = true }
glam025 = { package = "glam", version = "0.25", optional = true }
glam027 = { package = "glam", version = "0.27", optional = true }
glam028 = { package = "glam", version = "0.28", optional = true }
rayon = { version = "1.6", optional = true }
proptest = { version = "1", optional = true, default-features = false, features = ["std"] }
glam014 = { package = "glam", version = "0.14", optional = true }
glam015 = { package = "glam", version = "0.15", optional = true }
glam016 = { package = "glam", version = "0.16", optional = true }
glam017 = { package = "glam", version = "0.17", optional = true }
glam018 = { package = "glam", version = "0.18", optional = true }
glam019 = { package = "glam", version = "0.19", optional = true }
glam020 = { package = "glam", version = "0.20", optional = true }
glam021 = { package = "glam", version = "0.21", optional = true }
glam022 = { package = "glam", version = "0.22", optional = true }
glam023 = { package = "glam", version = "0.23", optional = true }
glam024 = { package = "glam", version = "0.24", optional = true }
glam025 = { package = "glam", version = "0.25", optional = true }
glam027 = { package = "glam", version = "0.27", optional = true }
glam028 = { package = "glam", version = "0.28", optional = true }
rayon = { version = "1.6", optional = true }
[dev-dependencies]
serde_json = "1.0"
rand_xorshift = "0.3"
rand_isaac = "0.3"
criterion = { version = "0.4", features = ["html_reports"] }
nalgebra = { path = ".", features = ["debug", "compare", "rand", "macros"]}
nalgebra = { path = ".", features = ["debug", "compare", "rand", "macros"] }
# For matrix comparison macro
matrixcompare = "0.3.0"
itertools = "0.13"
[workspace]
members = [ "nalgebra-lapack", "nalgebra-glm", "nalgebra-sparse", "nalgebra-macros" ]
members = ["nalgebra-lapack", "nalgebra-glm", "nalgebra-sparse", "nalgebra-macros"]
resolver = "2"
[[example]]

View File

@ -8,8 +8,8 @@ documentation = "https://www.nalgebra.org/docs"
homepage = "https://nalgebra.org"
repository = "https://github.com/dimforge/nalgebra"
readme = "../README.md"
categories = [ "science", "mathematics", "wasm", "no standard library" ]
keywords = [ "linear", "algebra", "matrix", "vector", "math" ]
categories = ["science", "mathematics", "wasm", "no standard library"]
keywords = ["linear", "algebra", "matrix", "vector", "math"]
license = "Apache-2.0"
edition = "2018"
@ -17,22 +17,22 @@ edition = "2018"
maintenance = { status = "actively-developed" }
[features]
default = [ "std" ]
std = [ "nalgebra/std", "simba/std" ]
arbitrary = [ "nalgebra/arbitrary" ]
serde-serialize = [ "nalgebra/serde-serialize-no-std" ]
default = ["std"]
std = ["nalgebra/std", "simba/std"]
arbitrary = ["nalgebra/arbitrary"]
serde-serialize = ["nalgebra/serde-serialize-no-std"]
# Conversion
convert-mint = [ "nalgebra/mint" ]
convert-bytemuck = [ "nalgebra/bytemuck" ]
convert-glam014 = [ "nalgebra/glam014" ]
convert-glam015 = [ "nalgebra/glam015" ]
convert-glam016 = [ "nalgebra/glam016" ]
convert-glam017 = [ "nalgebra/glam017" ]
convert-glam018 = [ "nalgebra/glam018" ]
convert-mint = ["nalgebra/mint"]
convert-bytemuck = ["nalgebra/bytemuck"]
convert-glam014 = ["nalgebra/glam014"]
convert-glam015 = ["nalgebra/glam015"]
convert-glam016 = ["nalgebra/glam016"]
convert-glam017 = ["nalgebra/glam017"]
convert-glam018 = ["nalgebra/glam018"]
[dependencies]
num-traits = { version = "0.2", default-features = false }
approx = { version = "0.5", default-features = false }
simba = { version = "0.8", default-features = false }
nalgebra = { path = "..", version = "0.32", default-features = false }
simba = { version = "0.9", default-features = false }
nalgebra = { path = "..", version = "0.32", default-features = false }

View File

@ -2,16 +2,16 @@ use approx::AbsDiffEq;
use num::{Bounded, Signed};
use na::Scalar;
use simba::scalar::{ClosedAdd, ClosedMul, ClosedSub, RealField};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign, ClosedSubAssign, RealField};
/// A number that can either be an integer or a float.
pub trait Number:
Scalar
+ Copy
+ PartialOrd
+ ClosedAdd
+ ClosedSub
+ ClosedMul
+ ClosedAddAssign
+ ClosedSubAssign
+ ClosedMulAssign
+ AbsDiffEq<Epsilon = Self>
+ Signed
+ Bounded
@ -22,9 +22,9 @@ impl<
T: Scalar
+ Copy
+ PartialOrd
+ ClosedAdd
+ ClosedSub
+ ClosedMul
+ ClosedAddAssign
+ ClosedSubAssign
+ ClosedMulAssign
+ AbsDiffEq<Epsilon = Self>
+ Signed
+ Bounded,

View File

@ -32,7 +32,7 @@ intel-mkl = ["lapack-src/intel-mkl"]
nalgebra = { version = "0.32", path = ".." }
num-traits = "0.2"
num-complex = { version = "0.4", default-features = false }
simba = "0.8"
simba = "0.9"
serde = { version = "1.0", features = ["derive"], optional = true }
lapack = { version = "0.19", default-features = false }
lapack-src = { version = "0.8", default-features = false }

View File

@ -3,7 +3,7 @@ use crate::coo::CooMatrix;
use crate::csc::CscMatrix;
use crate::csr::CsrMatrix;
use nalgebra::storage::RawStorage;
use nalgebra::{ClosedAdd, DMatrix, Dim, Matrix, Scalar};
use nalgebra::{ClosedAddAssign, DMatrix, Dim, Matrix, Scalar};
use num_traits::Zero;
impl<'a, T, R, C, S> From<&'a Matrix<T, R, C, S>> for CooMatrix<T>
@ -20,7 +20,7 @@ where
impl<'a, T> From<&'a CooMatrix<T>> for DMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
fn from(coo: &'a CooMatrix<T>) -> Self {
convert_coo_dense(coo)
@ -29,7 +29,7 @@ where
impl<'a, T> From<&'a CooMatrix<T>> for CsrMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
fn from(matrix: &'a CooMatrix<T>) -> Self {
convert_coo_csr(matrix)
@ -38,7 +38,7 @@ where
impl<'a, T> From<&'a CsrMatrix<T>> for CooMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
fn from(matrix: &'a CsrMatrix<T>) -> Self {
convert_csr_coo(matrix)
@ -59,7 +59,7 @@ where
impl<'a, T> From<&'a CsrMatrix<T>> for DMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
fn from(matrix: &'a CsrMatrix<T>) -> Self {
convert_csr_dense(matrix)
@ -68,7 +68,7 @@ where
impl<'a, T> From<&'a CooMatrix<T>> for CscMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
fn from(matrix: &'a CooMatrix<T>) -> Self {
convert_coo_csc(matrix)
@ -98,7 +98,7 @@ where
impl<'a, T> From<&'a CscMatrix<T>> for DMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
fn from(matrix: &'a CscMatrix<T>) -> Self {
convert_csc_dense(matrix)

View File

@ -8,7 +8,7 @@ use std::ops::Add;
use num_traits::Zero;
use nalgebra::storage::RawStorage;
use nalgebra::{ClosedAdd, DMatrix, Dim, Matrix, Scalar};
use nalgebra::{ClosedAddAssign, DMatrix, Dim, Matrix, Scalar};
use crate::coo::CooMatrix;
use crate::cs;
@ -41,7 +41,7 @@ where
/// Converts a [`CooMatrix`] to a dense matrix.
pub fn convert_coo_dense<T>(coo: &CooMatrix<T>) -> DMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
let mut output = DMatrix::repeat(coo.nrows(), coo.ncols(), T::zero());
for (i, j, v) in coo.triplet_iter() {
@ -80,7 +80,7 @@ pub fn convert_csr_coo<T: Scalar>(csr: &CsrMatrix<T>) -> CooMatrix<T> {
/// Converts a [`CsrMatrix`] to a dense matrix.
pub fn convert_csr_dense<T>(csr: &CsrMatrix<T>) -> DMatrix<T>
where
T: Scalar + ClosedAdd + Zero,
T: Scalar + ClosedAddAssign + Zero,
{
let mut output = DMatrix::zeros(csr.nrows(), csr.ncols());
@ -157,7 +157,7 @@ where
/// Converts a [`CscMatrix`] to a dense matrix.
pub fn convert_csc_dense<T>(csc: &CscMatrix<T>) -> DMatrix<T>
where
T: Scalar + ClosedAdd + Zero,
T: Scalar + ClosedAddAssign + Zero,
{
let mut output = DMatrix::zeros(csc.nrows(), csc.ncols());

View File

@ -10,8 +10,8 @@ use nalgebra::allocator::Allocator;
use nalgebra::base::storage::RawStorage;
use nalgebra::constraint::{DimEq, ShapeConstraint};
use nalgebra::{
ClosedAdd, ClosedDiv, ClosedMul, ClosedSub, DefaultAllocator, Dim, Dyn, Matrix, OMatrix,
Scalar, U1,
ClosedAddAssign, ClosedDivAssign, ClosedMulAssign, ClosedSubAssign, DefaultAllocator, Dim, Dyn,
Matrix, OMatrix, Scalar, U1,
};
use num_traits::{One, Zero};
use std::ops::{Add, Div, DivAssign, Mul, MulAssign, Neg, Sub};
@ -28,7 +28,7 @@ macro_rules! impl_bin_op {
// Note: The Neg bound is currently required because we delegate e.g.
// Sub to SpAdd with negative coefficients. This is not well-defined for
// unsigned data types.
$($scalar_type: $($bounds + )? Scalar + ClosedAdd + ClosedSub + ClosedMul + Zero + One + Neg<Output=T>)?
$($scalar_type: $($bounds + )? Scalar + ClosedAddAssign + ClosedSubAssign + ClosedMulAssign + Zero + One + Neg<Output=T>)?
{
type Output = $ret;
fn $method(self, $b: $b_type) -> Self::Output {
@ -164,7 +164,7 @@ macro_rules! impl_scalar_mul {
impl<T> MulAssign<T> for $matrix_type<T>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One
{
fn mul_assign(&mut self, scalar: T) {
for val in self.values_mut() {
@ -175,7 +175,7 @@ macro_rules! impl_scalar_mul {
impl<'a, T> MulAssign<&'a T> for $matrix_type<T>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One
{
fn mul_assign(&mut self, scalar: &'a T) {
for val in self.values_mut() {
@ -227,15 +227,15 @@ impl_neg!(CscMatrix);
macro_rules! impl_div {
($matrix_type:ident) => {
impl_bin_op!(Div, div, <T: ClosedDiv>(matrix: $matrix_type<T>, scalar: T) -> $matrix_type<T> {
impl_bin_op!(Div, div, <T: ClosedDivAssign>(matrix: $matrix_type<T>, scalar: T) -> $matrix_type<T> {
let mut matrix = matrix;
matrix /= scalar;
matrix
});
impl_bin_op!(Div, div, <'a, T: ClosedDiv>(matrix: $matrix_type<T>, scalar: &T) -> $matrix_type<T> {
impl_bin_op!(Div, div, <'a, T: ClosedDivAssign>(matrix: $matrix_type<T>, scalar: &T) -> $matrix_type<T> {
matrix / scalar.clone()
});
impl_bin_op!(Div, div, <'a, T: ClosedDiv>(matrix: &'a $matrix_type<T>, scalar: T) -> $matrix_type<T> {
impl_bin_op!(Div, div, <'a, T: ClosedDivAssign>(matrix: &'a $matrix_type<T>, scalar: T) -> $matrix_type<T> {
let new_values = matrix.values()
.iter()
.map(|v_i| v_i.clone() / scalar.clone())
@ -243,12 +243,12 @@ macro_rules! impl_div {
$matrix_type::try_from_pattern_and_values(matrix.pattern().clone(), new_values)
.unwrap()
});
impl_bin_op!(Div, div, <'a, T: ClosedDiv>(matrix: &'a $matrix_type<T>, scalar: &'a T) -> $matrix_type<T> {
impl_bin_op!(Div, div, <'a, T: ClosedDivAssign>(matrix: &'a $matrix_type<T>, scalar: &'a T) -> $matrix_type<T> {
matrix / scalar.clone()
});
impl<T> DivAssign<T> for $matrix_type<T>
where T : Scalar + ClosedAdd + ClosedMul + ClosedDiv + Zero + One
where T : Scalar + ClosedAddAssign + ClosedMulAssign + ClosedDivAssign + Zero + One
{
fn div_assign(&mut self, scalar: T) {
self.values_mut().iter_mut().for_each(|v_i| *v_i /= scalar.clone());
@ -256,7 +256,7 @@ macro_rules! impl_div {
}
impl<'a, T> DivAssign<&'a T> for $matrix_type<T>
where T : Scalar + ClosedAdd + ClosedMul + ClosedDiv + Zero + One
where T : Scalar + ClosedAddAssign + ClosedMulAssign + ClosedDivAssign + Zero + One
{
fn div_assign(&mut self, scalar: &'a T) {
*self /= scalar.clone();
@ -298,7 +298,7 @@ macro_rules! impl_spmm_cs_dense {
{
impl<'a, T, R, C, S> Mul<$dense_matrix_type> for $sparse_matrix_type
where
T: Scalar + ClosedMul + ClosedAdd + ClosedSub + ClosedDiv + Neg + Zero + One,
T: Scalar + ClosedMulAssign + ClosedAddAssign + ClosedSubAssign + ClosedDivAssign + Neg + Zero + One,
R: Dim,
C: Dim,
S: RawStorage<T, R, C>,

View File

@ -2,7 +2,7 @@ use crate::cs::CsMatrix;
use crate::ops::serial::{OperationError, OperationErrorKind};
use crate::ops::Op;
use crate::SparseEntryMut;
use nalgebra::{ClosedAdd, ClosedMul, DMatrixView, DMatrixViewMut, Scalar};
use nalgebra::{ClosedAddAssign, ClosedMulAssign, DMatrixView, DMatrixViewMut, Scalar};
use num_traits::{One, Zero};
fn spmm_cs_unexpected_entry() -> OperationError {
@ -28,7 +28,7 @@ pub fn spmm_cs_prealloc_unchecked<T>(
b: &CsMatrix<T>,
) -> Result<(), OperationError>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
assert_eq!(c.pattern().major_dim(), a.pattern().major_dim());
assert_eq!(c.pattern().minor_dim(), b.pattern().minor_dim());
@ -73,7 +73,7 @@ pub fn spmm_cs_prealloc<T>(
b: &CsMatrix<T>,
) -> Result<(), OperationError>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
for i in 0..c.pattern().major_dim() {
let a_lane_i = a.get_lane(i).unwrap();
@ -119,7 +119,7 @@ pub fn spadd_cs_prealloc<T>(
a: Op<&CsMatrix<T>>,
) -> Result<(), OperationError>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
match a {
Op::NoOp(a) => {
@ -181,7 +181,7 @@ pub fn spmm_cs_dense<T>(
a: Op<&CsMatrix<T>>,
b: Op<DMatrixView<'_, T>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
match a {
Op::NoOp(a) => {

View File

@ -4,7 +4,7 @@ use crate::ops::serial::cs::{
};
use crate::ops::serial::{OperationError, OperationErrorKind};
use crate::ops::Op;
use nalgebra::{ClosedAdd, ClosedMul, DMatrixView, DMatrixViewMut, RealField, Scalar};
use nalgebra::{ClosedAddAssign, ClosedMulAssign, DMatrixView, DMatrixViewMut, RealField, Scalar};
use num_traits::{One, Zero};
use std::borrow::Cow;
@ -21,7 +21,7 @@ pub fn spmm_csc_dense<'a, T>(
a: Op<&CscMatrix<T>>,
b: Op<impl Into<DMatrixView<'a, T>>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
let b = b.convert();
spmm_csc_dense_(beta, c.into(), alpha, a, b)
@ -34,7 +34,7 @@ fn spmm_csc_dense_<T>(
a: Op<&CscMatrix<T>>,
b: Op<DMatrixView<'_, T>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
assert_compatible_spmm_dims!(c, a, b);
// Need to interpret matrix as transposed since the spmm_cs_dense function assumes CSR layout
@ -57,7 +57,7 @@ pub fn spadd_csc_prealloc<T>(
a: Op<&CscMatrix<T>>,
) -> Result<(), OperationError>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
assert_compatible_spadd_dims!(c, a);
spadd_cs_prealloc(beta, &mut c.cs, alpha, a.map_same_op(|a| &a.cs))
@ -81,7 +81,7 @@ pub fn spmm_csc_prealloc<T>(
b: Op<&CscMatrix<T>>,
) -> Result<(), OperationError>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
assert_compatible_spmm_dims!(c, a, b);
@ -109,7 +109,7 @@ pub fn spmm_csc_prealloc_unchecked<T>(
b: Op<&CscMatrix<T>>,
) -> Result<(), OperationError>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
assert_compatible_spmm_dims!(c, a, b);
@ -133,7 +133,7 @@ fn spmm_csc_transposed<T, F>(
spmm_kernel: F,
) -> Result<(), OperationError>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
F: Fn(
T,
&mut CscMatrix<T>,

View File

@ -4,7 +4,7 @@ use crate::ops::serial::cs::{
};
use crate::ops::serial::OperationError;
use crate::ops::Op;
use nalgebra::{ClosedAdd, ClosedMul, DMatrixView, DMatrixViewMut, Scalar};
use nalgebra::{ClosedAddAssign, ClosedMulAssign, DMatrixView, DMatrixViewMut, Scalar};
use num_traits::{One, Zero};
use std::borrow::Cow;
@ -16,7 +16,7 @@ pub fn spmm_csr_dense<'a, T>(
a: Op<&CsrMatrix<T>>,
b: Op<impl Into<DMatrixView<'a, T>>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
let b = b.convert();
spmm_csr_dense_(beta, c.into(), alpha, a, b)
@ -29,7 +29,7 @@ fn spmm_csr_dense_<T>(
a: Op<&CsrMatrix<T>>,
b: Op<DMatrixView<'_, T>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
assert_compatible_spmm_dims!(c, a, b);
spmm_cs_dense(beta, c, alpha, a.map_same_op(|a| &a.cs), b)
@ -52,7 +52,7 @@ pub fn spadd_csr_prealloc<T>(
a: Op<&CsrMatrix<T>>,
) -> Result<(), OperationError>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
assert_compatible_spadd_dims!(c, a);
spadd_cs_prealloc(beta, &mut c.cs, alpha, a.map_same_op(|a| &a.cs))
@ -75,7 +75,7 @@ pub fn spmm_csr_prealloc<T>(
b: Op<&CsrMatrix<T>>,
) -> Result<(), OperationError>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
assert_compatible_spmm_dims!(c, a, b);
@ -100,7 +100,7 @@ pub fn spmm_csr_prealloc_unchecked<T>(
b: Op<&CsrMatrix<T>>,
) -> Result<(), OperationError>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
{
assert_compatible_spmm_dims!(c, a, b);
@ -121,7 +121,7 @@ fn spmm_csr_transposed<T, F>(
spmm_kernel: F,
) -> Result<(), OperationError>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
F: Fn(
T,
&mut CsrMatrix<T>,

View File

@ -1,6 +1,6 @@
use crate::{RawStorage, SimdComplexField};
use num::{One, Zero};
use simba::scalar::{ClosedAdd, ClosedMul};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign};
use crate::base::allocator::Allocator;
use crate::base::blas_uninit::{axcpy_uninit, gemm_uninit, gemv_uninit};
@ -17,7 +17,7 @@ use crate::base::{
/// # Dot/scalar product
impl<T, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S>
where
T: Scalar + Zero + ClosedAdd + ClosedMul,
T: Scalar + Zero + ClosedAddAssign + ClosedMulAssign,
{
#[inline(always)]
fn dotx<R2: Dim, C2: Dim, SB>(
@ -275,7 +275,7 @@ where
/// # BLAS functions
impl<T, D: Dim, S> Vector<T, D, S>
where
T: Scalar + Zero + ClosedAdd + ClosedMul,
T: Scalar + Zero + ClosedAddAssign + ClosedMulAssign,
S: StorageMut<T, D>,
{
/// Computes `self = a * x * c + b * self`.
@ -609,7 +609,7 @@ where
impl<T, R1: Dim, C1: Dim, S: StorageMut<T, R1, C1>> Matrix<T, R1, C1, S>
where
T: Scalar + Zero + ClosedAdd + ClosedMul,
T: Scalar + Zero + ClosedAddAssign + ClosedMulAssign,
{
#[inline(always)]
fn gerx<D2: Dim, D3: Dim, SB, SC>(
@ -862,7 +862,7 @@ where
impl<T, R1: Dim, C1: Dim, S: StorageMut<T, R1, C1>> Matrix<T, R1, C1, S>
where
T: Scalar + Zero + ClosedAdd + ClosedMul,
T: Scalar + Zero + ClosedAddAssign + ClosedMulAssign,
{
#[inline(always)]
fn xxgerx<D2: Dim, D3: Dim, SB, SC>(
@ -1010,7 +1010,7 @@ where
impl<T, D1: Dim, S: StorageMut<T, D1, D1>> SquareMatrix<T, D1, S>
where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
{
/// Computes the quadratic form `self = alpha * lhs * mid * lhs.transpose() + beta * self`.
///

View File

@ -11,7 +11,7 @@
#[cfg(feature = "std")]
use matrixmultiply;
use num::{One, Zero};
use simba::scalar::{ClosedAdd, ClosedMul};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign};
#[cfg(feature = "std")]
use std::{any::TypeId, mem};
@ -41,7 +41,7 @@ unsafe fn array_axcpy<Status, T>(
len: usize,
) where
Status: InitStatus<T>,
T: Scalar + Zero + ClosedAdd + ClosedMul,
T: Scalar + Zero + ClosedAddAssign + ClosedMulAssign,
{
for i in 0..len {
let y = Status::assume_init_mut(y.get_unchecked_mut(i * stride1));
@ -61,7 +61,7 @@ fn array_axc<Status, T>(
len: usize,
) where
Status: InitStatus<T>,
T: Scalar + Zero + ClosedAdd + ClosedMul,
T: Scalar + Zero + ClosedAddAssign + ClosedMulAssign,
{
for i in 0..len {
unsafe {
@ -89,7 +89,7 @@ pub unsafe fn axcpy_uninit<Status, T, D1: Dim, D2: Dim, SA, SB>(
c: T,
b: T,
) where
T: Scalar + Zero + ClosedAdd + ClosedMul,
T: Scalar + Zero + ClosedAddAssign + ClosedMulAssign,
SA: RawStorageMut<Status::Value, D1>,
SB: RawStorage<T, D2>,
ShapeConstraint: DimEq<D1, D2>,
@ -129,7 +129,7 @@ pub unsafe fn gemv_uninit<Status, T, D1: Dim, R2: Dim, C2: Dim, D3: Dim, SA, SB,
beta: T,
) where
Status: InitStatus<T>,
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
SA: RawStorageMut<Status::Value, D1>,
SB: RawStorage<T, R2, C2>,
SC: RawStorage<T, D3>,
@ -199,7 +199,7 @@ pub unsafe fn gemm_uninit<
beta: T,
) where
Status: InitStatus<T>,
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
SA: RawStorageMut<Status::Value, R1, C1>,
SB: RawStorage<T, R2, C2>,
SC: RawStorage<T, R3, C3>,

View File

@ -19,7 +19,7 @@ use crate::geometry::{
Rotation3,
};
use simba::scalar::{ClosedAdd, ClosedMul, RealField};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign, RealField};
/// # Translation and scaling in any dimension
impl<T, D: DimName> OMatrix<T, D, D>
@ -207,8 +207,11 @@ impl<T: RealField> Matrix4<T> {
}
/// # Append/prepend translation and scaling
impl<T: Scalar + Zero + One + ClosedMul + ClosedAdd, D: DimName, S: Storage<T, D, D>>
SquareMatrix<T, D, S>
impl<
T: Scalar + Zero + One + ClosedMulAssign + ClosedAddAssign,
D: DimName,
S: Storage<T, D, D>,
> SquareMatrix<T, D, S>
{
/// Computes the transformation equal to `self` followed by an uniform scaling factor.
#[inline]

View File

@ -3,7 +3,7 @@
use num::{Signed, Zero};
use std::ops::{Add, Mul};
use simba::scalar::{ClosedDiv, ClosedMul};
use simba::scalar::{ClosedDivAssign, ClosedMulAssign};
use simba::simd::SimdPartialOrd;
use crate::base::allocator::{Allocator, SameShapeAllocator};
@ -11,7 +11,7 @@ use crate::base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstr
use crate::base::dimension::Dim;
use crate::base::storage::{Storage, StorageMut};
use crate::base::{DefaultAllocator, Matrix, MatrixSum, OMatrix, Scalar};
use crate::ClosedAdd;
use crate::ClosedAddAssign;
/// The type of the result of a matrix component-wise operation.
pub type MatrixComponentOp<T, R1, C1, R2, C2> = MatrixSum<T, R1, C1, R2, C2>;
@ -148,7 +148,7 @@ macro_rules! component_binop_impl(
/// # Componentwise operations
impl<T: Scalar, R1: Dim, C1: Dim, SA: Storage<T, R1, C1>> Matrix<T, R1, C1, SA> {
component_binop_impl!(
component_mul, component_mul_mut, component_mul_assign, cmpy, ClosedMul.mul.mul_assign,
component_mul, component_mul_mut, component_mul_assign, cmpy, ClosedMulAssign.mul.mul_assign,
r"
Componentwise matrix or vector multiplication.
@ -193,7 +193,7 @@ impl<T: Scalar, R1: Dim, C1: Dim, SA: Storage<T, R1, C1>> Matrix<T, R1, C1, SA>
assert_eq!(a, expected);
```
";
component_div, component_div_mut, component_div_assign, cdpy, ClosedDiv.div.div_assign,
component_div, component_div_mut, component_div_assign, cdpy, ClosedDivAssign.div.div_assign,
r"
Componentwise matrix or vector division.
@ -320,7 +320,7 @@ impl<T: Scalar, R1: Dim, C1: Dim, SA: Storage<T, R1, C1>> Matrix<T, R1, C1, SA>
#[must_use = "Did you mean to use add_scalar_mut()?"]
pub fn add_scalar(&self, rhs: T) -> OMatrix<T, R1, C1>
where
T: ClosedAdd,
T: ClosedAddAssign,
DefaultAllocator: Allocator<R1, C1>,
{
let mut res = self.clone_owned();
@ -343,7 +343,7 @@ impl<T: Scalar, R1: Dim, C1: Dim, SA: Storage<T, R1, C1>> Matrix<T, R1, C1, SA>
#[inline]
pub fn add_scalar_mut(&mut self, rhs: T)
where
T: ClosedAdd,
T: ClosedAddAssign,
SA: StorageMut<T, R1, C1>,
{
for e in self.iter_mut() {

View File

@ -16,7 +16,7 @@ use rand::{
use std::iter;
use typenum::{self, Cmp, Greater};
use simba::scalar::{ClosedAdd, ClosedMul};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign};
use crate::base::allocator::Allocator;
use crate::base::dimension::{Dim, DimName, Dyn, ToTypenum};
@ -814,7 +814,7 @@ impl_constructors_from_data!(data; Dyn, Dyn;
*/
impl<T, R: DimName, C: DimName> Zero for OMatrix<T, R, C>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
DefaultAllocator: Allocator<R, C>,
{
#[inline]
@ -830,7 +830,7 @@ where
impl<T, D: DimName> One for OMatrix<T, D, D>
where
T: Scalar + Zero + One + ClosedMul + ClosedAdd,
T: Scalar + Zero + One + ClosedMulAssign + ClosedAddAssign,
DefaultAllocator: Allocator<D, D>,
{
#[inline]

View File

@ -2,11 +2,14 @@ use crate::storage::Storage;
use crate::{
Allocator, DefaultAllocator, Dim, OVector, One, RealField, Scalar, Unit, Vector, Zero,
};
use simba::scalar::{ClosedAdd, ClosedMul, ClosedSub};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign, ClosedSubAssign};
/// # Interpolation
impl<T: Scalar + Zero + One + ClosedAdd + ClosedSub + ClosedMul, D: Dim, S: Storage<T, D>>
Vector<T, D, S>
impl<
T: Scalar + Zero + One + ClosedAddAssign + ClosedSubAssign + ClosedMulAssign,
D: Dim,
S: Storage<T, D>,
> Vector<T, D, S>
{
/// Returns `self * (1.0 - t) + rhs * t`, i.e., the linear blend of the vectors x and y using the scalar value a.
///

View File

@ -18,7 +18,7 @@ use rkyv::bytecheck;
#[cfg(feature = "rkyv-serialize-no-std")]
use rkyv::{with::With, Archive, Archived};
use simba::scalar::{ClosedAdd, ClosedMul, ClosedSub, Field, SupersetOf};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign, ClosedSubAssign, Field, SupersetOf};
use simba::simd::SimdPartialOrd;
use crate::base::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR};
@ -1586,7 +1586,7 @@ impl<T: Scalar, D: Dim, S: RawStorage<T, D, D>> SquareMatrix<T, D, S> {
#[must_use]
pub fn trace(&self) -> T
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
assert!(
self.is_square(),
@ -2002,8 +2002,12 @@ mod tests {
}
/// # Cross product
impl<T: Scalar + ClosedAdd + ClosedSub + ClosedMul, R: Dim, C: Dim, S: RawStorage<T, R, C>>
Matrix<T, R, C, S>
impl<
T: Scalar + ClosedAddAssign + ClosedSubAssign + ClosedMulAssign,
R: Dim,
C: Dim,
S: RawStorage<T, R, C>,
> Matrix<T, R, C, S>
{
/// The perpendicular product between two 2D column vectors, i.e. `a.x * b.y - a.y * b.x`.
#[inline]

View File

@ -17,14 +17,10 @@ where
T::Element: Scalar,
DefaultAllocator: Allocator<R, C>,
{
const LANES: usize = T::LANES;
type Element = OMatrix<T::Element, R, C>;
type SimdBool = T::SimdBool;
#[inline]
fn lanes() -> usize {
T::lanes()
}
#[inline]
fn splat(val: Self::Element) -> Self {
val.map(T::splat)

View File

@ -4,7 +4,9 @@ use std::ops::{
Add, AddAssign, Div, DivAssign, Index, IndexMut, Mul, MulAssign, Neg, Sub, SubAssign,
};
use simba::scalar::{ClosedAdd, ClosedDiv, ClosedMul, ClosedNeg, ClosedSub};
use simba::scalar::{
ClosedAddAssign, ClosedDivAssign, ClosedMulAssign, ClosedNeg, ClosedSubAssign,
};
use crate::base::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR};
use crate::base::blas_uninit::gemm_uninit;
@ -357,16 +359,16 @@ macro_rules! componentwise_binop_impl(
}
);
componentwise_binop_impl!(Add, add, ClosedAdd;
componentwise_binop_impl!(Add, add, ClosedAddAssign;
AddAssign, add_assign, add_assign_statically_unchecked, add_assign_statically_unchecked_mut;
add_to, add_to_statically_unchecked_uninit);
componentwise_binop_impl!(Sub, sub, ClosedSub;
componentwise_binop_impl!(Sub, sub, ClosedSubAssign;
SubAssign, sub_assign, sub_assign_statically_unchecked, sub_assign_statically_unchecked_mut;
sub_to, sub_to_statically_unchecked_uninit);
impl<T, R: DimName, C: DimName> iter::Sum for OMatrix<T, R, C>
where
T: Scalar + ClosedAdd + Zero,
T: Scalar + ClosedAddAssign + Zero,
DefaultAllocator: Allocator<R, C>,
{
fn sum<I: Iterator<Item = OMatrix<T, R, C>>>(iter: I) -> OMatrix<T, R, C> {
@ -376,7 +378,7 @@ where
impl<T, C: Dim> iter::Sum for OMatrix<T, Dyn, C>
where
T: Scalar + ClosedAdd + Zero,
T: Scalar + ClosedAddAssign + Zero,
DefaultAllocator: Allocator<Dyn, C>,
{
/// # Example
@ -406,7 +408,7 @@ where
impl<'a, T, R: DimName, C: DimName> iter::Sum<&'a OMatrix<T, R, C>> for OMatrix<T, R, C>
where
T: Scalar + ClosedAdd + Zero,
T: Scalar + ClosedAddAssign + Zero,
DefaultAllocator: Allocator<R, C>,
{
fn sum<I: Iterator<Item = &'a OMatrix<T, R, C>>>(iter: I) -> OMatrix<T, R, C> {
@ -416,7 +418,7 @@ where
impl<'a, T, C: Dim> iter::Sum<&'a OMatrix<T, Dyn, C>> for OMatrix<T, Dyn, C>
where
T: Scalar + ClosedAdd + Zero,
T: Scalar + ClosedAddAssign + Zero,
DefaultAllocator: Allocator<Dyn, C>,
{
/// # Example
@ -506,8 +508,8 @@ macro_rules! componentwise_scalarop_impl(
}
);
componentwise_scalarop_impl!(Mul, mul, ClosedMul; MulAssign, mul_assign);
componentwise_scalarop_impl!(Div, div, ClosedDiv; DivAssign, div_assign);
componentwise_scalarop_impl!(Mul, mul, ClosedMulAssign; MulAssign, mul_assign);
componentwise_scalarop_impl!(Div, div, ClosedDivAssign; DivAssign, div_assign);
macro_rules! left_scalar_mul_impl(
($($T: ty),* $(,)*) => {$(
@ -551,7 +553,7 @@ left_scalar_mul_impl!(u8, u16, u32, u64, usize, i8, i16, i32, i64, isize, f32, f
impl<'a, 'b, T, R1: Dim, C1: Dim, R2: Dim, C2: Dim, SA, SB> Mul<&'b Matrix<T, R2, C2, SB>>
for &'a Matrix<T, R1, C1, SA>
where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
SA: Storage<T, R1, C1>,
SB: Storage<T, R2, C2>,
DefaultAllocator: Allocator<R1, C2>,
@ -573,7 +575,7 @@ where
impl<'a, T, R1: Dim, C1: Dim, R2: Dim, C2: Dim, SA, SB> Mul<Matrix<T, R2, C2, SB>>
for &'a Matrix<T, R1, C1, SA>
where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
SB: Storage<T, R2, C2>,
SA: Storage<T, R1, C1>,
DefaultAllocator: Allocator<R1, C2>,
@ -590,7 +592,7 @@ where
impl<'b, T, R1: Dim, C1: Dim, R2: Dim, C2: Dim, SA, SB> Mul<&'b Matrix<T, R2, C2, SB>>
for Matrix<T, R1, C1, SA>
where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
SB: Storage<T, R2, C2>,
SA: Storage<T, R1, C1>,
DefaultAllocator: Allocator<R1, C2>,
@ -607,7 +609,7 @@ where
impl<T, R1: Dim, C1: Dim, R2: Dim, C2: Dim, SA, SB> Mul<Matrix<T, R2, C2, SB>>
for Matrix<T, R1, C1, SA>
where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
SB: Storage<T, R2, C2>,
SA: Storage<T, R1, C1>,
DefaultAllocator: Allocator<R1, C2>,
@ -629,7 +631,7 @@ where
R1: Dim,
C1: Dim,
R2: Dim,
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
SB: Storage<T, R2, C1>,
SA: StorageMut<T, R1, C1> + IsContiguous + Clone, // TODO: get rid of the IsContiguous
ShapeConstraint: AreMultipliable<R1, C1, R2, C1>,
@ -646,7 +648,7 @@ where
R1: Dim,
C1: Dim,
R2: Dim,
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
SB: Storage<T, R2, C1>,
SA: StorageMut<T, R1, C1> + IsContiguous + Clone, // TODO: get rid of the IsContiguous
ShapeConstraint: AreMultipliable<R1, C1, R2, C1>,
@ -662,7 +664,7 @@ where
/// # Special multiplications.
impl<T, R1: Dim, C1: Dim, SA> Matrix<T, R1, C1, SA>
where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
SA: Storage<T, R1, C1>,
{
/// Equivalent to `self.transpose() * rhs`.
@ -799,7 +801,7 @@ where
rhs: &Matrix<T, R2, C2, SB>,
) -> OMatrix<T, DimProd<R1, R2>, DimProd<C1, C2>>
where
T: ClosedMul,
T: ClosedMulAssign,
R1: DimMul<R2>,
C1: DimMul<C2>,
SB: Storage<T, R2, C2>,
@ -835,7 +837,7 @@ where
impl<T, D: DimName> iter::Product for OMatrix<T, D, D>
where
T: Scalar + Zero + One + ClosedMul + ClosedAdd,
T: Scalar + Zero + One + ClosedMulAssign + ClosedAddAssign,
DefaultAllocator: Allocator<D, D>,
{
fn product<I: Iterator<Item = OMatrix<T, D, D>>>(iter: I) -> OMatrix<T, D, D> {
@ -845,7 +847,7 @@ where
impl<'a, T, D: DimName> iter::Product<&'a OMatrix<T, D, D>> for OMatrix<T, D, D>
where
T: Scalar + Zero + One + ClosedMul + ClosedAdd,
T: Scalar + Zero + One + ClosedMulAssign + ClosedAddAssign,
DefaultAllocator: Allocator<D, D>,
{
fn product<I: Iterator<Item = &'a OMatrix<T, D, D>>>(iter: I) -> OMatrix<T, D, D> {

View File

@ -2,7 +2,7 @@
use approx::RelativeEq;
use num::{One, Zero};
use simba::scalar::{ClosedAdd, ClosedMul, ComplexField, RealField};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign, ComplexField, RealField};
use crate::base::allocator::Allocator;
use crate::base::dimension::{Dim, DimMin};
@ -88,7 +88,7 @@ impl<T: ComplexField, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
#[must_use]
pub fn is_orthogonal(&self, eps: T::Epsilon) -> bool
where
T: Zero + One + ClosedAdd + ClosedMul + RelativeEq,
T: Zero + One + ClosedAddAssign + ClosedMulAssign + RelativeEq,
S: Storage<T, R, C>,
T::Epsilon: Clone,
DefaultAllocator: Allocator<R, C> + Allocator<C, C>,

View File

@ -2,7 +2,7 @@ use crate::allocator::Allocator;
use crate::storage::RawStorage;
use crate::{Const, DefaultAllocator, Dim, Matrix, OVector, RowOVector, Scalar, VectorView, U1};
use num::{One, Zero};
use simba::scalar::{ClosedAdd, ClosedMul, Field, SupersetOf};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign, Field, SupersetOf};
use std::mem::MaybeUninit;
/// # Folding on columns and rows
@ -104,7 +104,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
#[must_use]
pub fn sum(&self) -> T
where
T: ClosedAdd + Zero,
T: ClosedAddAssign + Zero,
{
self.iter().cloned().fold(T::zero(), |a, b| a + b)
}
@ -132,7 +132,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
#[must_use]
pub fn row_sum(&self) -> RowOVector<T, C>
where
T: ClosedAdd + Zero,
T: ClosedAddAssign + Zero,
DefaultAllocator: Allocator<U1, C>,
{
self.compress_rows(|col| col.sum())
@ -159,7 +159,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
#[must_use]
pub fn row_sum_tr(&self) -> OVector<T, C>
where
T: ClosedAdd + Zero,
T: ClosedAddAssign + Zero,
DefaultAllocator: Allocator<C>,
{
self.compress_rows_tr(|col| col.sum())
@ -186,7 +186,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
#[must_use]
pub fn column_sum(&self) -> OVector<T, R>
where
T: ClosedAdd + Zero,
T: ClosedAddAssign + Zero,
DefaultAllocator: Allocator<R>,
{
let nrows = self.shape_generic().0;
@ -215,7 +215,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
#[must_use]
pub fn product(&self) -> T
where
T: ClosedMul + One,
T: ClosedMulAssign + One,
{
self.iter().cloned().fold(T::one(), |a, b| a * b)
}
@ -243,7 +243,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
#[must_use]
pub fn row_product(&self) -> RowOVector<T, C>
where
T: ClosedMul + One,
T: ClosedMulAssign + One,
DefaultAllocator: Allocator<U1, C>,
{
self.compress_rows(|col| col.product())
@ -270,7 +270,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
#[must_use]
pub fn row_product_tr(&self) -> OVector<T, C>
where
T: ClosedMul + One,
T: ClosedMulAssign + One,
DefaultAllocator: Allocator<C>,
{
self.compress_rows_tr(|col| col.product())
@ -297,7 +297,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
#[must_use]
pub fn column_product(&self) -> OVector<T, R>
where
T: ClosedMul + One,
T: ClosedMulAssign + One,
DefaultAllocator: Allocator<R>,
{
let nrows = self.shape_generic().0;

View File

@ -1,10 +1,10 @@
use crate::geometry::{Rotation, UnitComplex, UnitQuaternion};
use crate::{Const, OVector, Point, SVector, Scalar, SimdRealField, Unit};
use simba::scalar::ClosedMul;
use simba::scalar::ClosedMulAssign;
/// Trait implemented by rotations that can be used inside of an `Isometry` or `Similarity`.
pub trait AbstractRotation<T: Scalar, const D: usize>: PartialEq + ClosedMul + Clone {
pub trait AbstractRotation<T: Scalar, const D: usize>: PartialEq + ClosedMulAssign + Clone {
/// The rotation identity.
fn identity() -> Self;
/// The rotation inverse.

View File

@ -4,7 +4,7 @@
use num::{One, Zero};
use std::ops::{Div, DivAssign, Mul, MulAssign};
use simba::scalar::{ClosedAdd, ClosedMul};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign};
use simba::simd::SimdRealField;
use crate::base::{SVector, Unit};

View File

@ -10,14 +10,10 @@ where
R: SimdValue<SimdBool = T::SimdBool> + AbstractRotation<T, D>,
R::Element: AbstractRotation<T::Element, D>,
{
const LANES: usize = T::LANES;
type Element = Isometry<T::Element, R::Element, D>;
type SimdBool = T::SimdBool;
#[inline]
fn lanes() -> usize {
T::lanes()
}
#[inline]
fn splat(val: Self::Element) -> Self {
Isometry::from_parts(Translation::splat(val.translation), R::splat(val.rotation))

View File

@ -21,7 +21,7 @@ macro_rules! md_impl(
// Lifetime.
$($lives: tt),*) => {
impl<$($lives ,)* T $(, $DimsDecl)* $(, const $D: usize)*> $Op<$Rhs> for $Lhs
where T: Scalar + Zero + One + ClosedAdd + ClosedMul $($(+ $ScalarBounds)*)*,
where T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign $($(+ $ScalarBounds)*)*,
$( $ConstraintType: $ConstraintBound$(<$( $ConstraintBoundParams $( = $EqBound )*),*>)* ),*
{
type Output = $Result;
@ -112,7 +112,7 @@ macro_rules! md_assign_impl(
// Actual implementation and lifetimes.
$action: expr; $($lives: tt),*) => {
impl<$($lives ,)* T $(, $DimsDecl)* $(, const $D: usize)*> $Op<$Rhs> for $Lhs
where T: Scalar + Zero + One + ClosedAdd + ClosedMul $($(+ $ScalarBounds)*)*,
where T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign $($(+ $ScalarBounds)*)*,
$($(T::Element: $ElementBounds,)*)*
$( $ConstraintType: $ConstraintBound $(<$( $ConstraintBoundParams $( = $EqBound )*),*>)* ),*
{

View File

@ -15,7 +15,7 @@ use crate::base::allocator::Allocator;
use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1};
use crate::base::iter::{MatrixIter, MatrixIterMut};
use crate::base::{Const, DefaultAllocator, OVector, Scalar};
use simba::scalar::{ClosedAdd, ClosedMul, ClosedSub};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign, ClosedSubAssign};
use std::mem::MaybeUninit;
/// A point in an euclidean space.
@ -234,7 +234,7 @@ where
#[must_use]
pub fn lerp(&self, rhs: &OPoint<T, D>, t: T) -> OPoint<T, D>
where
T: Scalar + Zero + One + ClosedAdd + ClosedSub + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedSubAssign + ClosedMulAssign,
{
OPoint {
coords: self.coords.lerp(&rhs.coords, t),

View File

@ -15,7 +15,7 @@ use crate::{
Const, DimName, OPoint, OVector, Point1, Point2, Point3, Point4, Point5, Point6, Vector1,
Vector2, Vector3, Vector4, Vector5, Vector6,
};
use simba::scalar::{ClosedDiv, SupersetOf};
use simba::scalar::{ClosedDivAssign, SupersetOf};
use crate::geometry::Point;
@ -108,7 +108,7 @@ where
#[inline]
pub fn from_homogeneous(v: OVector<T, DimNameSum<D, U1>>) -> Option<Self>
where
T: Scalar + Zero + One + ClosedDiv,
T: Scalar + Zero + One + ClosedDivAssign,
D: DimNameAdd<U1>,
DefaultAllocator: Allocator<DimNameSum<D, U1>>,
{

View File

@ -1,5 +1,5 @@
use num::{One, Zero};
use simba::scalar::{ClosedDiv, SubsetOf, SupersetOf};
use simba::scalar::{ClosedDivAssign, SubsetOf, SupersetOf};
use simba::simd::PrimitiveSimdValue;
use crate::base::allocator::Allocator;
@ -45,7 +45,7 @@ impl<T1, T2, D> SubsetOf<OVector<T2, DimNameSum<D, U1>>> for OPoint<T1, D>
where
D: DimNameAdd<U1>,
T1: Scalar,
T2: Scalar + Zero + One + ClosedDiv + SupersetOf<T1>,
T2: Scalar + Zero + One + ClosedDivAssign + SupersetOf<T1>,
DefaultAllocator: Allocator<D> + Allocator<DimNameSum<D, U1>>,
// + Allocator<T1, D>
// + Allocator<D>,

View File

@ -3,7 +3,9 @@ use std::ops::{
Add, AddAssign, Div, DivAssign, Index, IndexMut, Mul, MulAssign, Neg, Sub, SubAssign,
};
use simba::scalar::{ClosedAdd, ClosedDiv, ClosedMul, ClosedNeg, ClosedSub};
use simba::scalar::{
ClosedAddAssign, ClosedDivAssign, ClosedMulAssign, ClosedNeg, ClosedSubAssign,
};
use crate::base::constraint::{
AreMultipliable, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint,
@ -79,32 +81,32 @@ where
*/
// Point - Point
add_sub_impl!(Sub, sub, ClosedSub;
add_sub_impl!(Sub, sub, ClosedSubAssign;
(D, U1), (D, U1) -> (D, U1)
const; for D; where D: DimName, DefaultAllocator: Allocator<D>;
self: &'a OPoint<T, D>, right: &'b OPoint<T, D>, Output = OVector<T, D>;
&self.coords - &right.coords; 'a, 'b);
add_sub_impl!(Sub, sub, ClosedSub;
add_sub_impl!(Sub, sub, ClosedSubAssign;
(D, U1), (D, U1) -> (D, U1)
const; for D; where D: DimName, DefaultAllocator: Allocator<D>;
self: &'a OPoint<T, D>, right: OPoint<T, D>, Output = OVector<T, D>;
&self.coords - right.coords; 'a);
add_sub_impl!(Sub, sub, ClosedSub;
add_sub_impl!(Sub, sub, ClosedSubAssign;
(D, U1), (D, U1) -> (D, U1)
const; for D; where D: DimName, DefaultAllocator: Allocator<D>;
self: OPoint<T, D>, right: &'b OPoint<T, D>, Output = OVector<T, D>;
self.coords - &right.coords; 'b);
add_sub_impl!(Sub, sub, ClosedSub;
add_sub_impl!(Sub, sub, ClosedSubAssign;
(D, U1), (D, U1) -> (D, U1)
const; for D; where D: DimName, DefaultAllocator: Allocator<D>;
self: OPoint<T, D>, right: OPoint<T, D>, Output = OVector<T, D>;
self.coords - right.coords; );
// Point - Vector
add_sub_impl!(Sub, sub, ClosedSub;
add_sub_impl!(Sub, sub, ClosedSubAssign;
(D1, U1), (D2, U1) -> (D1, U1)
const;
for D1, D2, SB;
@ -112,7 +114,7 @@ add_sub_impl!(Sub, sub, ClosedSub;
self: &'a OPoint<T, D1>, right: &'b Vector<T, D2, SB>, Output = OPoint<T, D1>;
Self::Output::from(&self.coords - right); 'a, 'b);
add_sub_impl!(Sub, sub, ClosedSub;
add_sub_impl!(Sub, sub, ClosedSubAssign;
(D1, U1), (D2, U1) -> (D1, U1)
const;
for D1, D2, SB;
@ -120,7 +122,7 @@ add_sub_impl!(Sub, sub, ClosedSub;
self: &'a OPoint<T, D1>, right: Vector<T, D2, SB>, Output = OPoint<T, D1>;
Self::Output::from(&self.coords - &right); 'a); // TODO: should not be a ref to `right`.
add_sub_impl!(Sub, sub, ClosedSub;
add_sub_impl!(Sub, sub, ClosedSubAssign;
(D1, U1), (D2, U1) -> (D1, U1)
const;
for D1, D2, SB;
@ -128,7 +130,7 @@ add_sub_impl!(Sub, sub, ClosedSub;
self: OPoint<T, D1>, right: &'b Vector<T, D2, SB>, Output = OPoint<T, D1>;
Self::Output::from(self.coords - right); 'b);
add_sub_impl!(Sub, sub, ClosedSub;
add_sub_impl!(Sub, sub, ClosedSubAssign;
(D1, U1), (D2, U1) -> (D1, U1)
const;
for D1, D2, SB;
@ -137,7 +139,7 @@ add_sub_impl!(Sub, sub, ClosedSub;
Self::Output::from(self.coords - right); );
// Point + Vector
add_sub_impl!(Add, add, ClosedAdd;
add_sub_impl!(Add, add, ClosedAddAssign;
(D1, U1), (D2, U1) -> (D1, U1)
const;
for D1, D2, SB;
@ -145,7 +147,7 @@ add_sub_impl!(Add, add, ClosedAdd;
self: &'a OPoint<T, D1>, right: &'b Vector<T, D2, SB>, Output = OPoint<T, D1>;
Self::Output::from(&self.coords + right); 'a, 'b);
add_sub_impl!(Add, add, ClosedAdd;
add_sub_impl!(Add, add, ClosedAddAssign;
(D1, U1), (D2, U1) -> (D1, U1)
const;
for D1, D2, SB;
@ -153,7 +155,7 @@ add_sub_impl!(Add, add, ClosedAdd;
self: &'a OPoint<T, D1>, right: Vector<T, D2, SB>, Output = OPoint<T, D1>;
Self::Output::from(&self.coords + &right); 'a); // TODO: should not be a ref to `right`.
add_sub_impl!(Add, add, ClosedAdd;
add_sub_impl!(Add, add, ClosedAddAssign;
(D1, U1), (D2, U1) -> (D1, U1)
const;
for D1, D2, SB;
@ -161,7 +163,7 @@ add_sub_impl!(Add, add, ClosedAdd;
self: OPoint<T, D1>, right: &'b Vector<T, D2, SB>, Output = OPoint<T, D1>;
Self::Output::from(self.coords + right); 'b);
add_sub_impl!(Add, add, ClosedAdd;
add_sub_impl!(Add, add, ClosedAddAssign;
(D1, U1), (D2, U1) -> (D1, U1)
const;
for D1, D2, SB;
@ -199,8 +201,8 @@ macro_rules! op_assign_impl(
);
op_assign_impl!(
AddAssign, add_assign, ClosedAdd;
SubAssign, sub_assign, ClosedSub;
AddAssign, add_assign, ClosedAddAssign;
SubAssign, sub_assign, ClosedSubAssign;
);
/*
@ -263,8 +265,8 @@ macro_rules! componentwise_scalarop_impl(
}
);
componentwise_scalarop_impl!(Mul, mul, ClosedMul; MulAssign, mul_assign);
componentwise_scalarop_impl!(Div, div, ClosedDiv; DivAssign, div_assign);
componentwise_scalarop_impl!(Mul, mul, ClosedMulAssign; MulAssign, mul_assign);
componentwise_scalarop_impl!(Div, div, ClosedDivAssign; DivAssign, div_assign);
macro_rules! left_scalar_mul_impl(
($($T: ty),* $(,)*) => {$(

View File

@ -8,14 +8,10 @@ impl<T: Scalar + SimdValue, const D: usize> SimdValue for Point<T, D>
where
T::Element: Scalar,
{
const LANES: usize = T::LANES;
type Element = Point<T::Element, D>;
type SimdBool = T::SimdBool;
#[inline]
fn lanes() -> usize {
T::lanes()
}
#[inline]
fn splat(val: Self::Element) -> Self {
OVector::splat(val.coords).into()

View File

@ -8,14 +8,10 @@ impl<T: Scalar + SimdValue> SimdValue for Quaternion<T>
where
T::Element: Scalar,
{
const LANES: usize = T::LANES;
type Element = Quaternion<T::Element>;
type SimdBool = T::SimdBool;
#[inline]
fn lanes() -> usize {
T::lanes()
}
#[inline]
fn splat(val: Self::Element) -> Self {
Vector4::splat(val.coords).into()
@ -51,14 +47,10 @@ impl<T: Scalar + SimdValue> SimdValue for UnitQuaternion<T>
where
T::Element: Scalar,
{
const LANES: usize = T::LANES;
type Element = UnitQuaternion<T::Element>;
type SimdBool = T::SimdBool;
#[inline]
fn lanes() -> usize {
T::lanes()
}
#[inline]
fn splat(val: Self::Element) -> Self {
UnitQuaternion::new_unchecked(Quaternion::splat(val.into_inner()))

View File

@ -1,6 +1,6 @@
use num::{One, Zero};
use simba::scalar::{ClosedAdd, ClosedMul, SupersetOf};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign, SupersetOf};
use crate::base::{SMatrix, Scalar};
@ -64,7 +64,7 @@ impl<T: Scalar, const D: usize> Rotation<T, D> {
impl<T, const D: usize> One for Rotation<T, D>
where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
{
#[inline]
fn one() -> Self {

View File

@ -20,7 +20,7 @@
use num::{One, Zero};
use std::ops::{Div, DivAssign, Index, Mul, MulAssign};
use simba::scalar::{ClosedAdd, ClosedMul};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign};
use crate::base::allocator::Allocator;
use crate::base::constraint::{AreMultipliable, ShapeConstraint};

View File

@ -9,14 +9,10 @@ where
T: Scalar + SimdValue,
T::Element: Scalar,
{
const LANES: usize = T::LANES;
type Element = Rotation<T::Element, D>;
type SimdBool = T::SimdBool;
#[inline]
fn lanes() -> usize {
T::lanes()
}
#[inline]
fn splat(val: Self::Element) -> Self {
Rotation::from_matrix_unchecked(OMatrix::splat(val.into_inner()))

View File

@ -10,8 +10,8 @@ use crate::base::allocator::Allocator;
use crate::base::dimension::{DimNameAdd, DimNameSum, U1};
use crate::base::storage::Owned;
use crate::base::{Const, DefaultAllocator, OMatrix, OVector, SVector, Scalar};
use crate::ClosedDiv;
use crate::ClosedMul;
use crate::ClosedDivAssign;
use crate::ClosedMulAssign;
use crate::geometry::Point;
@ -121,7 +121,7 @@ impl<T: Scalar, const D: usize> Scale<T, D> {
#[must_use = "Did you mean to use try_inverse_mut()?"]
pub fn try_inverse(&self) -> Option<Scale<T, D>>
where
T: ClosedDiv + One + Zero,
T: ClosedDivAssign + One + Zero,
{
for i in 0..D {
if self.vector[i] == T::zero() {
@ -156,7 +156,7 @@ impl<T: Scalar, const D: usize> Scale<T, D> {
#[must_use]
pub unsafe fn inverse_unchecked(&self) -> Scale<T, D>
where
T: ClosedDiv + One,
T: ClosedDivAssign + One,
{
self.vector.map(|e| T::one() / e).into()
}
@ -184,7 +184,7 @@ impl<T: Scalar, const D: usize> Scale<T, D> {
#[must_use]
pub fn pseudo_inverse(&self) -> Scale<T, D>
where
T: ClosedDiv + One + Zero,
T: ClosedDivAssign + One + Zero,
{
self.vector
.map(|e| {
@ -260,7 +260,7 @@ impl<T: Scalar, const D: usize> Scale<T, D> {
#[inline]
pub fn try_inverse_mut(&mut self) -> bool
where
T: ClosedDiv + One + Zero,
T: ClosedDivAssign + One + Zero,
{
if let Some(v) = self.try_inverse() {
self.vector = v.vector;
@ -271,7 +271,7 @@ impl<T: Scalar, const D: usize> Scale<T, D> {
}
}
impl<T: Scalar + ClosedMul, const D: usize> Scale<T, D> {
impl<T: Scalar + ClosedMulAssign, const D: usize> Scale<T, D> {
/// Translate the given point.
///
/// This is the same as the multiplication `self * pt`.
@ -290,7 +290,7 @@ impl<T: Scalar + ClosedMul, const D: usize> Scale<T, D> {
}
}
impl<T: Scalar + ClosedDiv + ClosedMul + One + Zero, const D: usize> Scale<T, D> {
impl<T: Scalar + ClosedDivAssign + ClosedMulAssign + One + Zero, const D: usize> Scale<T, D> {
/// Translate the given point by the inverse of this Scale.
///
/// # Example

View File

@ -10,7 +10,7 @@ use rand::{
Rng,
};
use simba::scalar::{ClosedMul, SupersetOf};
use simba::scalar::{ClosedMulAssign, SupersetOf};
use crate::base::{SVector, Scalar};
use crate::geometry::Scale;
@ -55,7 +55,7 @@ impl<T: Scalar, const D: usize> Scale<T, D> {
}
}
impl<T: Scalar + One + ClosedMul, const D: usize> One for Scale<T, D> {
impl<T: Scalar + One + ClosedMulAssign, const D: usize> One for Scale<T, D> {
#[inline]
fn one() -> Self {
Self::identity()

View File

@ -1,6 +1,6 @@
use std::ops::{Mul, MulAssign};
use simba::scalar::ClosedMul;
use simba::scalar::ClosedMulAssign;
use crate::base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
use crate::base::dimension::U1;
@ -9,117 +9,117 @@ use crate::base::{Const, SVector, Scalar};
use crate::geometry::{Point, Scale};
// Scale × Scale
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Scale<T, D>, right: &'b Scale<T, D>, Output = Scale<T, D>;
Scale::from(self.vector.component_mul(&right.vector));
'a, 'b);
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Scale<T, D>, right: Scale<T, D>, Output = Scale<T, D>;
Scale::from(self.vector.component_mul(&right.vector));
'a);
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Scale<T, D>, right: &'b Scale<T, D>, Output = Scale<T, D>;
Scale::from(self.vector.component_mul(&right.vector));
'b);
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Scale<T, D>, right: Scale<T, D>, Output = Scale<T, D>;
Scale::from(self.vector.component_mul(&right.vector)); );
// Scale × scalar
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Scale<T, D>, right: T, Output = Scale<T, D>;
Scale::from(&self.vector * right);
'a);
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Scale<T, D>, right: T, Output = Scale<T, D>;
Scale::from(self.vector * right); );
// Scale × Point
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Scale<T, D>, right: &'b Point<T, D>, Output = Point<T, D>;
Point::from(self.vector.component_mul(&right.coords));
'a, 'b);
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Scale<T, D>, right: Point<T, D>, Output = Point<T, D>;
Point::from(self.vector.component_mul(&right.coords));
'a);
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Scale<T, D>, right: &'b Point<T, D>, Output = Point<T, D>;
Point::from(self.vector.component_mul(&right.coords));
'b);
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Scale<T, D>, right: Point<T, D>, Output = Point<T, D>;
Point::from(self.vector.component_mul(&right.coords)); );
// Scale * Vector
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Scale<T, D>, right: &'b SVector<T, D>, Output = SVector<T, D>;
self.vector.component_mul(right);
'a, 'b);
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Scale<T, D>, right: SVector<T, D>, Output = SVector<T, D>;
self.vector.component_mul(&right);
'a);
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Scale<T, D>, right: &'b SVector<T, D>, Output = SVector<T, D>;
self.vector.component_mul(right);
'b);
add_sub_impl!(Mul, mul, ClosedMul;
add_sub_impl!(Mul, mul, ClosedMulAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Scale<T, D>, right: SVector<T, D>, Output = SVector<T, D>;
self.vector.component_mul(&right); );
// Scale *= Scale
add_sub_assign_impl!(MulAssign, mul_assign, ClosedMul;
add_sub_assign_impl!(MulAssign, mul_assign, ClosedMulAssign;
const D;
self: Scale<T, D>, right: &'b Scale<T, D>;
self.vector.component_mul_assign(&right.vector);
'b);
add_sub_assign_impl!(MulAssign, mul_assign, ClosedMul;
add_sub_assign_impl!(MulAssign, mul_assign, ClosedMulAssign;
const D;
self: Scale<T, D>, right: Scale<T, D>;
self.vector.component_mul_assign(&right.vector); );
// Scale ×= scalar
add_sub_assign_impl!(MulAssign, mul_assign, ClosedMul;
add_sub_assign_impl!(MulAssign, mul_assign, ClosedMulAssign;
const D;
self: Scale<T, D>, right: T;
self.vector *= right; );

View File

@ -9,14 +9,10 @@ impl<T: Scalar + SimdValue, const D: usize> SimdValue for Scale<T, D>
where
T::Element: Scalar,
{
const LANES: usize = T::LANES;
type Element = Scale<T::Element, D>;
type SimdBool = T::SimdBool;
#[inline]
fn lanes() -> usize {
T::lanes()
}
#[inline]
fn splat(val: Self::Element) -> Self {
OVector::splat(val.vector).into()

View File

@ -4,7 +4,7 @@
use num::{One, Zero};
use std::ops::{Div, DivAssign, Mul, MulAssign};
use simba::scalar::{ClosedAdd, ClosedMul};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign};
use simba::simd::SimdRealField;
use crate::base::{SVector, Scalar};

View File

@ -8,14 +8,10 @@ where
R: SimdValue<SimdBool = T::SimdBool> + AbstractRotation<T, D>,
R::Element: AbstractRotation<T::Element, D>,
{
const LANES: usize = T::LANES;
type Element = Similarity<T::Element, R::Element, D>;
type SimdBool = T::SimdBool;
#[inline]
fn lanes() -> usize {
T::lanes()
}
#[inline]
fn splat(val: Self::Element) -> Self {
let scaling = T::splat(val.scaling());

View File

@ -4,7 +4,7 @@
use num::{One, Zero};
use std::ops::{Div, DivAssign, Index, IndexMut, Mul, MulAssign};
use simba::scalar::{ClosedAdd, ClosedMul, RealField, SubsetOf};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign, RealField, SubsetOf};
use crate::base::allocator::Allocator;
use crate::base::dimension::{DimNameAdd, DimNameSum, U1};

View File

@ -14,14 +14,10 @@ where
Const<D>: DimNameAdd<U1>,
DefaultAllocator: Allocator<DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
{
const LANES: usize = T::LANES;
type Element = Transform<T::Element, C, D>;
type SimdBool = T::SimdBool;
#[inline]
fn lanes() -> usize {
T::lanes()
}
#[inline]
fn splat(val: Self::Element) -> Self {
Transform::from_matrix_unchecked(OMatrix::splat(val.into_inner()))

View File

@ -6,7 +6,7 @@ use std::hash;
#[cfg(feature = "serde-serialize-no-std")]
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use simba::scalar::{ClosedAdd, ClosedNeg, ClosedSub};
use simba::scalar::{ClosedAddAssign, ClosedNeg, ClosedSubAssign};
use crate::base::allocator::Allocator;
use crate::base::dimension::{DimNameAdd, DimNameSum, U1};
@ -188,7 +188,7 @@ impl<T: Scalar, const D: usize> Translation<T, D> {
}
}
impl<T: Scalar + ClosedAdd, const D: usize> Translation<T, D> {
impl<T: Scalar + ClosedAddAssign, const D: usize> Translation<T, D> {
/// Translate the given point.
///
/// This is the same as the multiplication `self * pt`.
@ -207,7 +207,7 @@ impl<T: Scalar + ClosedAdd, const D: usize> Translation<T, D> {
}
}
impl<T: Scalar + ClosedSub, const D: usize> Translation<T, D> {
impl<T: Scalar + ClosedSubAssign, const D: usize> Translation<T, D> {
/// Translate the given point by the inverse of this translation.
///
/// # Example

View File

@ -10,7 +10,7 @@ use rand::{
Rng,
};
use simba::scalar::{ClosedAdd, SupersetOf};
use simba::scalar::{ClosedAddAssign, SupersetOf};
use crate::base::{SVector, Scalar};
use crate::geometry::Translation;
@ -61,7 +61,7 @@ impl<T: Scalar, const D: usize> Translation<T, D> {
}
}
impl<T: Scalar + Zero + ClosedAdd, const D: usize> One for Translation<T, D> {
impl<T: Scalar + Zero + ClosedAddAssign, const D: usize> One for Translation<T, D> {
#[inline]
fn one() -> Self {
Self::identity()

View File

@ -1,6 +1,6 @@
use std::ops::{Div, DivAssign, Mul, MulAssign};
use simba::scalar::{ClosedAdd, ClosedSub};
use simba::scalar::{ClosedAddAssign, ClosedSubAssign};
use crate::base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
use crate::base::dimension::U1;
@ -9,28 +9,28 @@ use crate::base::{Const, Scalar};
use crate::geometry::{Point, Translation};
// Translation × Translation
add_sub_impl!(Mul, mul, ClosedAdd;
add_sub_impl!(Mul, mul, ClosedAddAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Translation<T, D>, right: &'b Translation<T, D>, Output = Translation<T, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(&self.vector + &right.vector) };
'a, 'b);
add_sub_impl!(Mul, mul, ClosedAdd;
add_sub_impl!(Mul, mul, ClosedAddAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Translation<T, D>, right: Translation<T, D>, Output = Translation<T, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(&self.vector + right.vector) };
'a);
add_sub_impl!(Mul, mul, ClosedAdd;
add_sub_impl!(Mul, mul, ClosedAddAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Translation<T, D>, right: &'b Translation<T, D>, Output = Translation<T, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(self.vector + &right.vector) };
'b);
add_sub_impl!(Mul, mul, ClosedAdd;
add_sub_impl!(Mul, mul, ClosedAddAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Translation<T, D>, right: Translation<T, D>, Output = Translation<T, D>;
@ -38,28 +38,28 @@ add_sub_impl!(Mul, mul, ClosedAdd;
// Translation ÷ Translation
// TODO: instead of calling inverse explicitly, could we just add a `mul_tr` or `mul_inv` method?
add_sub_impl!(Div, div, ClosedSub;
add_sub_impl!(Div, div, ClosedSubAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Translation<T, D>, right: &'b Translation<T, D>, Output = Translation<T, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(&self.vector - &right.vector) };
'a, 'b);
add_sub_impl!(Div, div, ClosedSub;
add_sub_impl!(Div, div, ClosedSubAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Translation<T, D>, right: Translation<T, D>, Output = Translation<T, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(&self.vector - right.vector) };
'a);
add_sub_impl!(Div, div, ClosedSub;
add_sub_impl!(Div, div, ClosedSubAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Translation<T, D>, right: &'b Translation<T, D>, Output = Translation<T, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { Translation::from(self.vector - &right.vector) };
'b);
add_sub_impl!(Div, div, ClosedSub;
add_sub_impl!(Div, div, ClosedSubAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Translation<T, D>, right: Translation<T, D>, Output = Translation<T, D>;
@ -68,52 +68,52 @@ add_sub_impl!(Div, div, ClosedSub;
// Translation × Point
// TODO: we don't handle properly non-zero origins here. Do we want this to be the intended
// behavior?
add_sub_impl!(Mul, mul, ClosedAdd;
add_sub_impl!(Mul, mul, ClosedAddAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Translation<T, D>, right: &'b Point<T, D>, Output = Point<T, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { right + &self.vector };
'a, 'b);
add_sub_impl!(Mul, mul, ClosedAdd;
add_sub_impl!(Mul, mul, ClosedAddAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: &'a Translation<T, D>, right: Point<T, D>, Output = Point<T, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { right + &self.vector };
'a);
add_sub_impl!(Mul, mul, ClosedAdd;
add_sub_impl!(Mul, mul, ClosedAddAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Translation<T, D>, right: &'b Point<T, D>, Output = Point<T, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { right + self.vector };
'b);
add_sub_impl!(Mul, mul, ClosedAdd;
add_sub_impl!(Mul, mul, ClosedAddAssign;
(Const<D>, U1), (Const<D>, U1) -> (Const<D>, U1)
const D; for; where;
self: Translation<T, D>, right: Point<T, D>, Output = Point<T, D>;
#[allow(clippy::suspicious_arithmetic_impl)] { right + self.vector }; );
// Translation *= Translation
add_sub_assign_impl!(MulAssign, mul_assign, ClosedAdd;
add_sub_assign_impl!(MulAssign, mul_assign, ClosedAddAssign;
const D;
self: Translation<T, D>, right: &'b Translation<T, D>;
#[allow(clippy::suspicious_op_assign_impl)] { self.vector += &right.vector };
'b);
add_sub_assign_impl!(MulAssign, mul_assign, ClosedAdd;
add_sub_assign_impl!(MulAssign, mul_assign, ClosedAddAssign;
const D;
self: Translation<T, D>, right: Translation<T, D>;
#[allow(clippy::suspicious_op_assign_impl)] { self.vector += right.vector }; );
add_sub_assign_impl!(DivAssign, div_assign, ClosedSub;
add_sub_assign_impl!(DivAssign, div_assign, ClosedSubAssign;
const D;
self: Translation<T, D>, right: &'b Translation<T, D>;
#[allow(clippy::suspicious_op_assign_impl)] { self.vector -= &right.vector };
'b);
add_sub_assign_impl!(DivAssign, div_assign, ClosedSub;
add_sub_assign_impl!(DivAssign, div_assign, ClosedSubAssign;
const D;
self: Translation<T, D>, right: Translation<T, D>;
#[allow(clippy::suspicious_op_assign_impl)] { self.vector -= right.vector }; );

View File

@ -9,14 +9,10 @@ impl<T: Scalar + SimdValue, const D: usize> SimdValue for Translation<T, D>
where
T::Element: Scalar,
{
const LANES: usize = T::LANES;
type Element = Translation<T::Element, D>;
type SimdBool = T::SimdBool;
#[inline]
fn lanes() -> usize {
T::lanes()
}
#[inline]
fn splat(val: Self::Element) -> Self {
OVector::splat(val.vector).into()

View File

@ -10,14 +10,10 @@ impl<T: SimdRealField> SimdValue for UnitComplex<T>
where
T::Element: SimdRealField,
{
const LANES: usize = T::LANES;
type Element = UnitComplex<T::Element>;
type SimdBool = T::SimdBool;
#[inline]
fn lanes() -> usize {
T::lanes()
}
#[inline]
fn splat(val: Self::Element) -> Self {
Unit::new_unchecked(Complex::splat(val.into_inner()))

View File

@ -165,7 +165,8 @@ use num::{One, Signed, Zero};
use base::allocator::Allocator;
pub use num_complex::Complex;
pub use simba::scalar::{
ClosedAdd, ClosedDiv, ClosedMul, ClosedSub, ComplexField, Field, RealField,
ClosedAddAssign, ClosedDivAssign, ClosedMulAssign, ClosedSubAssign, ComplexField, Field,
RealField,
};
pub use simba::simd::{SimdBool, SimdComplexField, SimdPartialOrd, SimdRealField, SimdValue};
@ -206,7 +207,7 @@ pub fn zero<T: Zero>() -> T {
#[inline]
pub fn wrap<T>(mut val: T, min: T, max: T) -> T
where
T: Copy + PartialOrd + ClosedAdd + ClosedSub,
T: Copy + PartialOrd + ClosedAddAssign + ClosedSubAssign,
{
assert!(min < max, "Invalid wrapping bounds.");
let width = max - min;

View File

@ -430,7 +430,7 @@ where
let abs_c_recip = choose_2m_m * factorial(2 * m + 1);
let alpha = a_abs_onenorm / one_norm(a);
let alpha: f64 = try_convert(alpha).unwrap() / abs_c_recip as f64;
let alpha: f64 = try_convert::<_, f64>(alpha).unwrap() / abs_c_recip as f64;
let u = 2_f64.powf(-53.0);
let log2_alpha_div_u = (alpha / u).log2();
@ -523,7 +523,7 @@ where
let mut s = if eta_5 == T::RealField::zero() {
0
} else {
let l2 = try_convert((eta_5 / theta_13).log2().ceil()).unwrap();
let l2 = try_convert::<_, f64>((eta_5 / theta_13).log2().ceil()).unwrap();
if l2 < 0.0 {
0

View File

@ -37,14 +37,10 @@ mod udu;
pub use self::bidiagonal::*;
pub use self::cholesky::*;
pub use self::col_piv_qr::*;
pub use self::convolution::*;
#[cfg(feature = "std")]
pub use self::exp::*;
pub use self::full_piv_lu::*;
pub use self::hessenberg::*;
pub use self::lu::*;
pub use self::permutation_sequence::*;
pub use self::pow::*;
pub use self::qr::*;
pub use self::schur::*;
pub use self::svd::*;

View File

@ -6,11 +6,11 @@ use crate::{
DefaultAllocator, DimMin, Matrix, OMatrix, Scalar,
};
use num::{One, Zero};
use simba::scalar::{ClosedAdd, ClosedMul};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign};
impl<T, D, S> Matrix<T, D, D, S>
where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
D: DimMin<D, Output = D>,
S: StorageMut<T, D, D>,
DefaultAllocator: Allocator<D, D> + Allocator<D>,
@ -56,7 +56,7 @@ where
impl<T, D, S: Storage<T, D, D>> Matrix<T, D, D, S>
where
T: Scalar + Zero + One + ClosedAdd + ClosedMul,
T: Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
D: DimMin<D, Output = D>,
S: StorageMut<T, D, D>,
DefaultAllocator: Allocator<D, D> + Allocator<D>,

View File

@ -1,5 +1,5 @@
use num::Zero;
use simba::scalar::ClosedAdd;
use simba::scalar::ClosedAddAssign;
use std::iter;
use std::marker::PhantomData;
use std::ops::Range;
@ -294,7 +294,7 @@ where
vals: Vec<T>,
) -> Self
where
T: Zero + ClosedAdd,
T: Zero + ClosedAddAssign,
DefaultAllocator: Allocator<R>,
{
assert_eq!(ncols.value(), p.len(), "Invalid inptr size.");
@ -333,7 +333,7 @@ where
}
/*
impl<T: Scalar + Zero + ClosedAdd> CsMatrix<T> {
impl<T: Scalar + Zero + ClosedAddAssign> CsMatrix<T> {
pub(crate) fn from_parts(
nrows: usize,
ncols: usize,
@ -501,7 +501,7 @@ where
// Remove duplicate entries on a sorted CsMatrix.
pub(crate) fn dedup(&mut self)
where
T: Zero + ClosedAdd,
T: Zero + ClosedAddAssign,
{
let mut curr_i = 0;

View File

@ -1,5 +1,5 @@
use num::Zero;
use simba::scalar::ClosedAdd;
use simba::scalar::ClosedAddAssign;
use crate::allocator::Allocator;
use crate::sparse::cs_utils;
@ -7,7 +7,7 @@ use crate::sparse::{CsMatrix, CsStorage};
use crate::storage::Storage;
use crate::{DefaultAllocator, Dim, Dyn, Matrix, OMatrix, Scalar};
impl<'a, T: Scalar + Zero + ClosedAdd> CsMatrix<T> {
impl<'a, T: Scalar + Zero + ClosedAddAssign> CsMatrix<T> {
/// Creates a column-compressed sparse matrix from a sparse matrix in triplet form.
pub fn from_triplet(
nrows: usize,
@ -20,7 +20,7 @@ impl<'a, T: Scalar + Zero + ClosedAdd> CsMatrix<T> {
}
}
impl<'a, T: Scalar + Zero + ClosedAdd, R: Dim, C: Dim> CsMatrix<T, R, C>
impl<'a, T: Scalar + Zero + ClosedAddAssign, R: Dim, C: Dim> CsMatrix<T, R, C>
where
DefaultAllocator: Allocator<C> + Allocator<R>,
{

View File

@ -1,5 +1,5 @@
use num::{One, Zero};
use simba::scalar::{ClosedAdd, ClosedMul};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign};
use std::ops::{Add, Mul};
use crate::allocator::Allocator;
@ -20,7 +20,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: CsStorage<T, R, C>> CsMatrix<T, R, C, S> {
res: &mut CsMatrix<T, R2, C2>,
) -> usize
where
T: ClosedAdd + ClosedMul,
T: ClosedAddAssign + ClosedMulAssign,
DefaultAllocator: Allocator<C2>,
{
for (i, val) in self.data.column_entries(j) {
@ -76,7 +76,9 @@ impl<T: Scalar, R, S> CsVector<T, R, S> {
}
*/
impl<T: Scalar + Zero + ClosedAdd + ClosedMul, D: Dim, S: StorageMut<T, D>> Vector<T, D, S> {
impl<T: Scalar + Zero + ClosedAddAssign + ClosedMulAssign, D: Dim, S: StorageMut<T, D>>
Vector<T, D, S>
{
/// Perform a sparse axpy operation: `self = alpha * x + beta * self` operation.
pub fn axpy_cs<D2: Dim, S2>(&mut self, alpha: T, x: &CsVector<T, D2, S2>, beta: T)
where
@ -126,7 +128,7 @@ impl<T: Scalar + Zero + ClosedAdd + ClosedMul, D: Dim, S: StorageMut<T, D>> Vect
impl<'a, 'b, T, R1, R2, C1, C2, S1, S2> Mul<&'b CsMatrix<T, R2, C2, S2>>
for &'a CsMatrix<T, R1, C1, S1>
where
T: Scalar + ClosedAdd + ClosedMul + Zero,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero,
R1: Dim,
C1: Dim,
R2: Dim,
@ -219,7 +221,7 @@ where
impl<'a, 'b, T, R1, R2, C1, C2, S1, S2> Add<&'b CsMatrix<T, R2, C2, S2>>
for &'a CsMatrix<T, R1, C1, S1>
where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero + One,
R1: Dim,
C1: Dim,
R2: Dim,
@ -287,7 +289,7 @@ where
impl<'a, 'b, T, R, C, S> Mul<T> for CsMatrix<T, R, C, S>
where
T: Scalar + ClosedAdd + ClosedMul + Zero,
T: Scalar + ClosedAddAssign + ClosedMulAssign + Zero,
R: Dim,
C: Dim,
S: CsStorageMut<T, R, C>,