Skip to content

Commit

Permalink
Update to alga 0.8.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebcrozet committed Feb 3, 2019
1 parent 7be7fc8 commit 08f3183
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 50 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand All @@ -50,4 +50,4 @@ serde_json = "1.0"
rand_xorshift = "0.1"

[workspace]
members = [ "nalgebra-lapack", "nalgebra-glm" ]
members = [ "nalgebra-lapack", "nalgebra-glm" ]
2 changes: 1 addition & 1 deletion nalgebra-glm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
4 changes: 2 additions & 2 deletions nalgebra-lapack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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"
8 changes: 4 additions & 4 deletions src/base/matrix_alga.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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()
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/geometry/isometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions src/geometry/isometry_alga.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -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()
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/geometry/isometry_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/geometry/quaternion_alga.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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()
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/geometry/rotation_alga.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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()
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/geometry/similarity_alga.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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()
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/geometry/similarity_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/geometry/transform_alga.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand All @@ -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()
}
}
Expand Down Expand Up @@ -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
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/geometry/translation_alga.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -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()
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/geometry/unit_complex_alga.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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()
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
}

/*
Expand Down

0 comments on commit 08f3183

Please sign in to comment.