Update to alga 0.8.

This commit is contained in:
sebcrozet 2019-02-03 15:45:25 +01:00
parent 7be7fc8776
commit 08f31837a8
15 changed files with 50 additions and 50 deletions

View File

@ -35,13 +35,13 @@ rand = { version = "0.6", default-features = false }
num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.2", default-features = false }
approx = { version = "0.3", default-features = false }
alga = { version = "0.7", default-features = false }
alga = { version = "0.8", default-features = false }
matrixmultiply = { version = "0.2", optional = true }
serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }
abomonation = { version = "0.7", optional = true }
mint = { version = "0.5", optional = true }
quickcheck = { version = "0.7", optional = true }
quickcheck = { version = "0.8", optional = true }
pest = { version = "2.0", optional = true }
pest_derive = { version = "2.0", optional = true }
@ -50,4 +50,4 @@ serde_json = "1.0"
rand_xorshift = "0.1"
[workspace]
members = [ "nalgebra-lapack", "nalgebra-glm" ]
members = [ "nalgebra-lapack", "nalgebra-glm" ]

View File

@ -23,5 +23,5 @@ abomonation-serialize = [ "nalgebra/abomonation-serialize" ]
[dependencies]
num-traits = { version = "0.2", default-features = false }
approx = { version = "0.3", default-features = false }
alga = { version = "0.7", default-features = false }
alga = { version = "0.8", default-features = false }
nalgebra = { path = "..", version = "^0.16.13", default-features = false }

View File

@ -25,7 +25,7 @@ intel-mkl = ["lapack-src/intel-mkl"]
nalgebra = { version = "0.16", path = ".." }
num-traits = "0.2"
num-complex = { version = "0.2", default-features = false }
alga = { version = "0.7", default-features = false }
alga = { version = "0.8", default-features = false }
serde = { version = "1.0", optional = true }
serde_derive = { version = "1.0", optional = true }
lapack = { version = "0.16", default-features = false }
@ -34,6 +34,6 @@ lapack-src = { version = "0.2", default-features = false }
[dev-dependencies]
nalgebra = { version = "0.16", path = "..", features = [ "arbitrary" ] }
quickcheck = "0.7"
quickcheck = "0.8"
approx = "0.3"
rand = "0.6"

View File

@ -6,7 +6,7 @@ use num::{One, Zero};
use alga::general::{
AbstractGroup, AbstractGroupAbelian, AbstractLoop, AbstractMagma, AbstractModule,
AbstractMonoid, AbstractQuasigroup, AbstractSemigroup, Additive, ClosedAdd, ClosedMul,
ClosedNeg, Field, Identity, Inverse, JoinSemilattice, Lattice, MeetSemilattice, Module,
ClosedNeg, Field, Identity, TwoSidedInverse, JoinSemilattice, Lattice, MeetSemilattice, Module,
Multiplicative, Real, RingCommutative,
};
use alga::linear::{
@ -45,18 +45,18 @@ where
}
}
impl<N, R: DimName, C: DimName> Inverse<Additive> for MatrixMN<N, R, C>
impl<N, R: DimName, C: DimName> TwoSidedInverse<Additive> for MatrixMN<N, R, C>
where
N: Scalar + ClosedNeg,
DefaultAllocator: Allocator<N, R, C>,
{
#[inline]
fn inverse(&self) -> MatrixMN<N, R, C> {
fn two_sided_inverse(&self) -> MatrixMN<N, R, C> {
-self
}
#[inline]
fn inverse_mut(&mut self) {
fn two_sided_inverse_mut(&mut self) {
*self = -self.clone()
}
}

View File

@ -166,7 +166,7 @@ where DefaultAllocator: Allocator<N, D>
/// ```
#[inline]
pub fn inverse_mut(&mut self) {
self.rotation.inverse_mut();
self.rotation.two_sided_inverse_mut();
self.translation.inverse_mut();
self.translation.vector = self.rotation.transform_vector(&self.translation.vector);
}

View File

@ -1,6 +1,6 @@
use alga::general::{
AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid, AbstractQuasigroup,
AbstractSemigroup, Id, Identity, Inverse, Multiplicative, Real,
AbstractSemigroup, Id, Identity, TwoSidedInverse, Multiplicative, Real,
};
use alga::linear::Isometry as AlgaIsometry;
use alga::linear::{
@ -30,18 +30,18 @@ where
}
}
impl<N: Real, D: DimName, R> Inverse<Multiplicative> for Isometry<N, D, R>
impl<N: Real, D: DimName, R> TwoSidedInverse<Multiplicative> for Isometry<N, D, R>
where
R: Rotation<Point<N, D>>,
DefaultAllocator: Allocator<N, D>,
{
#[inline]
fn inverse(&self) -> Self {
fn two_sided_inverse(&self) -> Self {
self.inverse()
}
#[inline]
fn inverse_mut(&mut self) {
fn two_sided_inverse_mut(&mut self) {
self.inverse_mut()
}
}

View File

@ -200,8 +200,8 @@ isometry_binop_assign_impl_all!(
DivAssign, div_assign;
self: Isometry<N, D, R>, rhs: R;
// FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse();
[ref] => *self *= rhs.inverse();
[val] => *self *= rhs.two_sided_inverse();
[ref] => *self *= rhs.two_sided_inverse();
);
// Isometry × R

View File

@ -2,7 +2,7 @@ use num::Zero;
use alga::general::{
AbstractGroup, AbstractGroupAbelian, AbstractLoop, AbstractMagma, AbstractModule,
AbstractMonoid, AbstractQuasigroup, AbstractSemigroup, Additive, Id, Identity, Inverse, Module,
AbstractMonoid, AbstractQuasigroup, AbstractSemigroup, Additive, Id, Identity, TwoSidedInverse, Module,
Multiplicative, Real,
};
use alga::linear::{
@ -42,9 +42,9 @@ impl<N: Real> AbstractMagma<Additive> for Quaternion<N> {
}
}
impl<N: Real> Inverse<Additive> for Quaternion<N> {
impl<N: Real> TwoSidedInverse<Additive> for Quaternion<N> {
#[inline]
fn inverse(&self) -> Self {
fn two_sided_inverse(&self) -> Self {
-self
}
}
@ -173,14 +173,14 @@ impl<N: Real> AbstractMagma<Multiplicative> for UnitQuaternion<N> {
}
}
impl<N: Real> Inverse<Multiplicative> for UnitQuaternion<N> {
impl<N: Real> TwoSidedInverse<Multiplicative> for UnitQuaternion<N> {
#[inline]
fn inverse(&self) -> Self {
fn two_sided_inverse(&self) -> Self {
self.inverse()
}
#[inline]
fn inverse_mut(&mut self) {
fn two_sided_inverse_mut(&mut self) {
self.inverse_mut()
}
}

View File

@ -1,6 +1,6 @@
use alga::general::{
AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid, AbstractQuasigroup,
AbstractSemigroup, Id, Identity, Inverse, Multiplicative, Real,
AbstractSemigroup, Id, Identity, TwoSidedInverse, Multiplicative, Real,
};
use alga::linear::{
self, AffineTransformation, DirectIsometry, Isometry, OrthogonalTransformation,
@ -27,16 +27,16 @@ where DefaultAllocator: Allocator<N, D, D>
}
}
impl<N: Real, D: DimName> Inverse<Multiplicative> for Rotation<N, D>
impl<N: Real, D: DimName> TwoSidedInverse<Multiplicative> for Rotation<N, D>
where DefaultAllocator: Allocator<N, D, D>
{
#[inline]
fn inverse(&self) -> Self {
fn two_sided_inverse(&self) -> Self {
self.transpose()
}
#[inline]
fn inverse_mut(&mut self) {
fn two_sided_inverse_mut(&mut self) {
self.transpose_mut()
}
}

View File

@ -1,6 +1,6 @@
use alga::general::{
AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid, AbstractQuasigroup,
AbstractSemigroup, Identity, Inverse, Multiplicative, Real,
AbstractSemigroup, Identity, TwoSidedInverse, Multiplicative, Real,
};
use alga::linear::Similarity as AlgaSimilarity;
use alga::linear::{AffineTransformation, ProjectiveTransformation, Rotation, Transformation};
@ -27,18 +27,18 @@ where
}
}
impl<N: Real, D: DimName, R> Inverse<Multiplicative> for Similarity<N, D, R>
impl<N: Real, D: DimName, R> TwoSidedInverse<Multiplicative> for Similarity<N, D, R>
where
R: Rotation<Point<N, D>>,
DefaultAllocator: Allocator<N, D>,
{
#[inline]
fn inverse(&self) -> Self {
fn two_sided_inverse(&self) -> Self {
self.inverse()
}
#[inline]
fn inverse_mut(&mut self) {
fn two_sided_inverse_mut(&mut self) {
self.inverse_mut()
}
}

View File

@ -222,8 +222,8 @@ similarity_binop_assign_impl_all!(
DivAssign, div_assign;
self: Similarity<N, D, R>, rhs: R;
// FIXME: don't invert explicitly?
[val] => *self *= rhs.inverse();
[ref] => *self *= rhs.inverse();
[val] => *self *= rhs.two_sided_inverse();
[ref] => *self *= rhs.two_sided_inverse();
);
// Similarity × R

View File

@ -1,6 +1,6 @@
use alga::general::{
AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid, AbstractQuasigroup,
AbstractSemigroup, Identity, Inverse, Multiplicative, Real,
AbstractSemigroup, Identity, TwoSidedInverse, Multiplicative, Real,
};
use alga::linear::{ProjectiveTransformation, Transformation};
@ -26,18 +26,18 @@ where
}
}
impl<N: Real, D: DimNameAdd<U1>, C> Inverse<Multiplicative> for Transform<N, D, C>
impl<N: Real, D: DimNameAdd<U1>, C> TwoSidedInverse<Multiplicative> for Transform<N, D, C>
where
C: SubTCategoryOf<TProjective>,
DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
{
#[inline]
fn inverse(&self) -> Self {
fn two_sided_inverse(&self) -> Self {
self.clone().inverse()
}
#[inline]
fn inverse_mut(&mut self) {
fn two_sided_inverse_mut(&mut self) {
self.inverse_mut()
}
}
@ -116,12 +116,12 @@ where
{
#[inline]
fn inverse_transform_point(&self, pt: &Point<N, D>) -> Point<N, D> {
self.inverse() * pt
self.two_sided_inverse() * pt
}
#[inline]
fn inverse_transform_vector(&self, v: &VectorN<N, D>) -> VectorN<N, D> {
self.inverse() * v
self.two_sided_inverse() * v
}
}

View File

@ -1,6 +1,6 @@
use alga::general::{
AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid, AbstractQuasigroup,
AbstractSemigroup, Id, Identity, Inverse, Multiplicative, Real,
AbstractSemigroup, Id, Identity, TwoSidedInverse, Multiplicative, Real,
};
use alga::linear::Translation as AlgaTranslation;
use alga::linear::{
@ -28,16 +28,16 @@ where DefaultAllocator: Allocator<N, D>
}
}
impl<N: Real, D: DimName> Inverse<Multiplicative> for Translation<N, D>
impl<N: Real, D: DimName> TwoSidedInverse<Multiplicative> for Translation<N, D>
where DefaultAllocator: Allocator<N, D>
{
#[inline]
fn inverse(&self) -> Self {
fn two_sided_inverse(&self) -> Self {
self.inverse()
}
#[inline]
fn inverse_mut(&mut self) {
fn two_sided_inverse_mut(&mut self) {
self.inverse_mut()
}
}

View File

@ -1,6 +1,6 @@
use alga::general::{
AbstractGroup, AbstractLoop, AbstractMagma, AbstractMonoid, AbstractQuasigroup,
AbstractSemigroup, Id, Identity, Inverse, Multiplicative, Real,
AbstractSemigroup, Id, Identity, TwoSidedInverse, Multiplicative, Real,
};
use alga::linear::{
AffineTransformation, DirectIsometry, Isometry, OrthogonalTransformation,
@ -31,14 +31,14 @@ impl<N: Real> AbstractMagma<Multiplicative> for UnitComplex<N> {
}
}
impl<N: Real> Inverse<Multiplicative> for UnitComplex<N> {
impl<N: Real> TwoSidedInverse<Multiplicative> for UnitComplex<N> {
#[inline]
fn inverse(&self) -> Self {
fn two_sided_inverse(&self) -> Self {
self.inverse()
}
#[inline]
fn inverse_mut(&mut self) {
fn two_sided_inverse_mut(&mut self) {
self.inverse_mut()
}
}

View File

@ -153,7 +153,7 @@ pub use sparse::*;
use std::cmp::{self, Ordering, PartialOrd};
use alga::general::{
Additive, AdditiveGroup, Identity, Inverse, JoinSemilattice, Lattice, MeetSemilattice,
Additive, AdditiveGroup, Identity, TwoSidedInverse, JoinSemilattice, Lattice, MeetSemilattice,
Multiplicative, SupersetOf,
};
use alga::linear::SquareMatrix as AlgaSquareMatrix;
@ -427,8 +427,8 @@ pub fn try_inverse<M: AlgaSquareMatrix>(m: &M) -> Option<M> {
///
/// * [`try_inverse`](fn.try_inverse.html)
#[inline]
pub fn inverse<M: Inverse<Multiplicative>>(m: &M) -> M {
m.inverse()
pub fn inverse<M: TwoSidedInverse<Multiplicative>>(m: &M) -> M {
m.two_sided_inverse()
}
/*