Merge pull request #607 from cauthmann/dev
Add #[must_use] to all functions with a _mut variant (#598)
This commit is contained in:
commit
a67c451ae5
|
@ -156,6 +156,7 @@ impl<N: RealField> Matrix4<N> {
|
||||||
impl<N: Scalar + Ring, D: DimName, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
|
impl<N: Scalar + Ring, D: DimName, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
|
||||||
/// Computes the transformation equal to `self` followed by an uniform scaling factor.
|
/// Computes the transformation equal to `self` followed by an uniform scaling factor.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use append_scaling_mut()?"]
|
||||||
pub fn append_scaling(&self, scaling: N) -> MatrixN<N, D>
|
pub fn append_scaling(&self, scaling: N) -> MatrixN<N, D>
|
||||||
where
|
where
|
||||||
D: DimNameSub<U1>,
|
D: DimNameSub<U1>,
|
||||||
|
@ -168,6 +169,7 @@ impl<N: Scalar + Ring, D: DimName, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
|
||||||
|
|
||||||
/// Computes the transformation equal to an uniform scaling factor followed by `self`.
|
/// Computes the transformation equal to an uniform scaling factor followed by `self`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use prepend_scaling_mut()?"]
|
||||||
pub fn prepend_scaling(&self, scaling: N) -> MatrixN<N, D>
|
pub fn prepend_scaling(&self, scaling: N) -> MatrixN<N, D>
|
||||||
where
|
where
|
||||||
D: DimNameSub<U1>,
|
D: DimNameSub<U1>,
|
||||||
|
@ -180,6 +182,7 @@ impl<N: Scalar + Ring, D: DimName, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
|
||||||
|
|
||||||
/// Computes the transformation equal to `self` followed by a non-uniform scaling factor.
|
/// Computes the transformation equal to `self` followed by a non-uniform scaling factor.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use append_nonuniform_scaling_mut()?"]
|
||||||
pub fn append_nonuniform_scaling<SB>(
|
pub fn append_nonuniform_scaling<SB>(
|
||||||
&self,
|
&self,
|
||||||
scaling: &Vector<N, DimNameDiff<D, U1>, SB>,
|
scaling: &Vector<N, DimNameDiff<D, U1>, SB>,
|
||||||
|
@ -196,6 +199,7 @@ impl<N: Scalar + Ring, D: DimName, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
|
||||||
|
|
||||||
/// Computes the transformation equal to a non-uniform scaling factor followed by `self`.
|
/// Computes the transformation equal to a non-uniform scaling factor followed by `self`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use prepend_nonuniform_scaling_mut()?"]
|
||||||
pub fn prepend_nonuniform_scaling<SB>(
|
pub fn prepend_nonuniform_scaling<SB>(
|
||||||
&self,
|
&self,
|
||||||
scaling: &Vector<N, DimNameDiff<D, U1>, SB>,
|
scaling: &Vector<N, DimNameDiff<D, U1>, SB>,
|
||||||
|
@ -212,6 +216,7 @@ impl<N: Scalar + Ring, D: DimName, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
|
||||||
|
|
||||||
/// Computes the transformation equal to `self` followed by a translation.
|
/// Computes the transformation equal to `self` followed by a translation.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use append_translation_mut()?"]
|
||||||
pub fn append_translation<SB>(&self, shift: &Vector<N, DimNameDiff<D, U1>, SB>) -> MatrixN<N, D>
|
pub fn append_translation<SB>(&self, shift: &Vector<N, DimNameDiff<D, U1>, SB>) -> MatrixN<N, D>
|
||||||
where
|
where
|
||||||
D: DimNameSub<U1>,
|
D: DimNameSub<U1>,
|
||||||
|
@ -225,6 +230,7 @@ impl<N: Scalar + Ring, D: DimName, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
|
||||||
|
|
||||||
/// Computes the transformation equal to a translation followed by `self`.
|
/// Computes the transformation equal to a translation followed by `self`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use prepend_translation_mut()?"]
|
||||||
pub fn prepend_translation<SB>(
|
pub fn prepend_translation<SB>(
|
||||||
&self,
|
&self,
|
||||||
shift: &Vector<N, DimNameDiff<D, U1>, SB>,
|
shift: &Vector<N, DimNameDiff<D, U1>, SB>,
|
||||||
|
|
|
@ -610,6 +610,7 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
|
|
||||||
/// Transposes `self`.
|
/// Transposes `self`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use transpose_mut()?"]
|
||||||
pub fn transpose(&self) -> MatrixMN<N, C, R>
|
pub fn transpose(&self) -> MatrixMN<N, C, R>
|
||||||
where DefaultAllocator: Allocator<N, C, R> {
|
where DefaultAllocator: Allocator<N, C, R> {
|
||||||
let (nrows, ncols) = self.data.shape();
|
let (nrows, ncols) = self.data.shape();
|
||||||
|
@ -941,6 +942,7 @@ impl<N: ComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
|
|
||||||
/// The adjoint (aka. conjugate-transpose) of `self`.
|
/// The adjoint (aka. conjugate-transpose) of `self`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use adjoint_mut()?"]
|
||||||
pub fn adjoint(&self) -> MatrixMN<N, C, R>
|
pub fn adjoint(&self) -> MatrixMN<N, C, R>
|
||||||
where DefaultAllocator: Allocator<N, C, R> {
|
where DefaultAllocator: Allocator<N, C, R> {
|
||||||
let (nrows, ncols) = self.data.shape();
|
let (nrows, ncols) = self.data.shape();
|
||||||
|
@ -976,6 +978,7 @@ impl<N: ComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
|
|
||||||
/// The conjugate of `self`.
|
/// The conjugate of `self`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use conjugate_mut()?"]
|
||||||
pub fn conjugate(&self) -> MatrixMN<N, R, C>
|
pub fn conjugate(&self) -> MatrixMN<N, R, C>
|
||||||
where DefaultAllocator: Allocator<N, R, C> {
|
where DefaultAllocator: Allocator<N, R, C> {
|
||||||
self.map(|e| e.conjugate())
|
self.map(|e| e.conjugate())
|
||||||
|
@ -983,6 +986,7 @@ impl<N: ComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
|
|
||||||
/// Divides each component of the complex matrix `self` by the given real.
|
/// Divides each component of the complex matrix `self` by the given real.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use unscale_mut()?"]
|
||||||
pub fn unscale(&self, real: N::RealField) -> MatrixMN<N, R, C>
|
pub fn unscale(&self, real: N::RealField) -> MatrixMN<N, R, C>
|
||||||
where DefaultAllocator: Allocator<N, R, C> {
|
where DefaultAllocator: Allocator<N, R, C> {
|
||||||
self.map(|e| e.unscale(real))
|
self.map(|e| e.unscale(real))
|
||||||
|
@ -990,6 +994,7 @@ impl<N: ComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
|
|
||||||
/// Multiplies each component of the complex matrix `self` by the given real.
|
/// Multiplies each component of the complex matrix `self` by the given real.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use scale_mut()?"]
|
||||||
pub fn scale(&self, real: N::RealField) -> MatrixMN<N, R, C>
|
pub fn scale(&self, real: N::RealField) -> MatrixMN<N, R, C>
|
||||||
where DefaultAllocator: Allocator<N, R, C> {
|
where DefaultAllocator: Allocator<N, R, C> {
|
||||||
self.map(|e| e.scale(real))
|
self.map(|e| e.scale(real))
|
||||||
|
|
|
@ -51,6 +51,7 @@ where
|
||||||
DefaultAllocator: Allocator<N, R, C>,
|
DefaultAllocator: Allocator<N, R, C>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use two_sided_inverse_mut()?"]
|
||||||
fn two_sided_inverse(&self) -> Self {
|
fn two_sided_inverse(&self) -> Self {
|
||||||
-self
|
-self
|
||||||
}
|
}
|
||||||
|
@ -162,6 +163,7 @@ where DefaultAllocator: Allocator<N, R, C>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use normalize_mut()?"]
|
||||||
fn normalize(&self) -> Self {
|
fn normalize(&self) -> Self {
|
||||||
self.normalize()
|
self.normalize()
|
||||||
}
|
}
|
||||||
|
@ -172,6 +174,7 @@ where DefaultAllocator: Allocator<N, R, C>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use try_normalize_mut()?"]
|
||||||
fn try_normalize(&self, min_norm: N::RealField) -> Option<Self> {
|
fn try_normalize(&self, min_norm: N::RealField) -> Option<Self> {
|
||||||
self.try_normalize(min_norm)
|
self.try_normalize(min_norm)
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,6 +187,7 @@ impl<N: ComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
|
|
||||||
/// Returns a normalized version of this matrix.
|
/// Returns a normalized version of this matrix.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use normalize_mut()?"]
|
||||||
pub fn normalize(&self) -> MatrixMN<N, R, C>
|
pub fn normalize(&self) -> MatrixMN<N, R, C>
|
||||||
where DefaultAllocator: Allocator<N, R, C> {
|
where DefaultAllocator: Allocator<N, R, C> {
|
||||||
self.unscale(self.norm())
|
self.unscale(self.norm())
|
||||||
|
@ -194,6 +195,7 @@ impl<N: ComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
|
|
||||||
/// Returns a normalized version of this matrix unless its norm as smaller or equal to `eps`.
|
/// Returns a normalized version of this matrix unless its norm as smaller or equal to `eps`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use try_normalize_mut()?"]
|
||||||
pub fn try_normalize(&self, min_norm: N::RealField) -> Option<MatrixMN<N, R, C>>
|
pub fn try_normalize(&self, min_norm: N::RealField) -> Option<MatrixMN<N, R, C>>
|
||||||
where DefaultAllocator: Allocator<N, R, C> {
|
where DefaultAllocator: Allocator<N, R, C> {
|
||||||
let n = self.norm();
|
let n = self.norm();
|
||||||
|
|
|
@ -829,6 +829,7 @@ where
|
||||||
impl<N: Scalar + ClosedAdd, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
impl<N: Scalar + ClosedAdd, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||||
/// Adds a scalar to `self`.
|
/// Adds a scalar to `self`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use add_scalar_mut()?"]
|
||||||
pub fn add_scalar(&self, rhs: N) -> MatrixMN<N, R, C>
|
pub fn add_scalar(&self, rhs: N) -> MatrixMN<N, R, C>
|
||||||
where DefaultAllocator: Allocator<N, R, C> {
|
where DefaultAllocator: Allocator<N, R, C> {
|
||||||
let mut res = self.clone_owned();
|
let mut res = self.clone_owned();
|
||||||
|
|
|
@ -144,6 +144,7 @@ where DefaultAllocator: Allocator<N, D>
|
||||||
/// assert_eq!(inv * (iso * pt), pt);
|
/// assert_eq!(inv * (iso * pt), pt);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use inverse_mut()?"]
|
||||||
pub fn inverse(&self) -> Self {
|
pub fn inverse(&self) -> Self {
|
||||||
let mut res = self.clone();
|
let mut res = self.clone();
|
||||||
res.inverse_mut();
|
res.inverse_mut();
|
||||||
|
|
|
@ -36,6 +36,7 @@ where
|
||||||
DefaultAllocator: Allocator<N, D>,
|
DefaultAllocator: Allocator<N, D>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use two_sided_inverse_mut()?"]
|
||||||
fn two_sided_inverse(&self) -> Self {
|
fn two_sided_inverse(&self) -> Self {
|
||||||
self.inverse()
|
self.inverse()
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,6 +120,7 @@ impl<N: RealField> Quaternion<N> {
|
||||||
/// relative_eq!(q_normalized.norm(), 1.0);
|
/// relative_eq!(q_normalized.norm(), 1.0);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use normalize_mut()?"]
|
||||||
pub fn normalize(&self) -> Self {
|
pub fn normalize(&self) -> Self {
|
||||||
Self::from(self.coords.normalize())
|
Self::from(self.coords.normalize())
|
||||||
}
|
}
|
||||||
|
@ -140,6 +141,7 @@ impl<N: RealField> Quaternion<N> {
|
||||||
/// assert!(conj.i == -2.0 && conj.j == -3.0 && conj.k == -4.0 && conj.w == 1.0);
|
/// assert!(conj.i == -2.0 && conj.j == -3.0 && conj.k == -4.0 && conj.w == 1.0);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use conjugate_mut()?"]
|
||||||
pub fn conjugate(&self) -> Self {
|
pub fn conjugate(&self) -> Self {
|
||||||
Self::from_parts(self.w, -self.imag())
|
Self::from_parts(self.w, -self.imag())
|
||||||
}
|
}
|
||||||
|
@ -163,6 +165,7 @@ impl<N: RealField> Quaternion<N> {
|
||||||
/// assert!(inv_q.is_none());
|
/// assert!(inv_q.is_none());
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use try_inverse_mut()?"]
|
||||||
pub fn try_inverse(&self) -> Option<Self> {
|
pub fn try_inverse(&self) -> Option<Self> {
|
||||||
let mut res = Self::from(self.coords.clone_owned());
|
let mut res = Self::from(self.coords.clone_owned());
|
||||||
|
|
||||||
|
@ -974,6 +977,7 @@ impl<N: RealField> UnitQuaternion<N> {
|
||||||
/// assert_eq!(conj, UnitQuaternion::from_axis_angle(&-axis, 1.78));
|
/// assert_eq!(conj, UnitQuaternion::from_axis_angle(&-axis, 1.78));
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use conjugate_mut()?"]
|
||||||
pub fn conjugate(&self) -> Self {
|
pub fn conjugate(&self) -> Self {
|
||||||
Self::new_unchecked(self.as_ref().conjugate())
|
Self::new_unchecked(self.as_ref().conjugate())
|
||||||
}
|
}
|
||||||
|
@ -990,6 +994,7 @@ impl<N: RealField> UnitQuaternion<N> {
|
||||||
/// assert_eq!(inv * rot, UnitQuaternion::identity());
|
/// assert_eq!(inv * rot, UnitQuaternion::identity());
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use inverse_mut()?"]
|
||||||
pub fn inverse(&self) -> Self {
|
pub fn inverse(&self) -> Self {
|
||||||
self.conjugate()
|
self.conjugate()
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,6 +270,7 @@ where DefaultAllocator: Allocator<N, D, D>
|
||||||
/// assert_relative_eq!(tr_rot * rot, Rotation2::identity(), epsilon = 1.0e-6);
|
/// assert_relative_eq!(tr_rot * rot, Rotation2::identity(), epsilon = 1.0e-6);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use transpose_mut()?"]
|
||||||
pub fn transpose(&self) -> Self {
|
pub fn transpose(&self) -> Self {
|
||||||
Self::from_matrix_unchecked(self.matrix.transpose())
|
Self::from_matrix_unchecked(self.matrix.transpose())
|
||||||
}
|
}
|
||||||
|
@ -293,6 +294,7 @@ where DefaultAllocator: Allocator<N, D, D>
|
||||||
/// assert_relative_eq!(inv * rot, Rotation2::identity(), epsilon = 1.0e-6);
|
/// assert_relative_eq!(inv * rot, Rotation2::identity(), epsilon = 1.0e-6);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use inverse_mut()?"]
|
||||||
pub fn inverse(&self) -> Self {
|
pub fn inverse(&self) -> Self {
|
||||||
self.transpose()
|
self.transpose()
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ impl<N: RealField, D: DimName> TwoSidedInverse<Multiplicative> for Rotation<N, D
|
||||||
where DefaultAllocator: Allocator<N, D, D>
|
where DefaultAllocator: Allocator<N, D, D>
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use two_sided_inverse_mut()?"]
|
||||||
fn two_sided_inverse(&self) -> Self {
|
fn two_sided_inverse(&self) -> Self {
|
||||||
self.transpose()
|
self.transpose()
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,7 @@ where
|
||||||
|
|
||||||
/// Inverts `self`.
|
/// Inverts `self`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use inverse_mut()?"]
|
||||||
pub fn inverse(&self) -> Self {
|
pub fn inverse(&self) -> Self {
|
||||||
let mut res = self.clone();
|
let mut res = self.clone();
|
||||||
res.inverse_mut();
|
res.inverse_mut();
|
||||||
|
@ -166,6 +167,7 @@ where
|
||||||
|
|
||||||
/// The similarity transformation that applies a scaling factor `scaling` before `self`.
|
/// The similarity transformation that applies a scaling factor `scaling` before `self`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use prepend_scaling_mut()?"]
|
||||||
pub fn prepend_scaling(&self, scaling: N) -> Self {
|
pub fn prepend_scaling(&self, scaling: N) -> Self {
|
||||||
assert!(
|
assert!(
|
||||||
!relative_eq!(scaling, N::zero()),
|
!relative_eq!(scaling, N::zero()),
|
||||||
|
@ -177,6 +179,7 @@ where
|
||||||
|
|
||||||
/// The similarity transformation that applies a scaling factor `scaling` after `self`.
|
/// The similarity transformation that applies a scaling factor `scaling` after `self`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use append_scaling_mut()?"]
|
||||||
pub fn append_scaling(&self, scaling: N) -> Self {
|
pub fn append_scaling(&self, scaling: N) -> Self {
|
||||||
assert!(
|
assert!(
|
||||||
!relative_eq!(scaling, N::zero()),
|
!relative_eq!(scaling, N::zero()),
|
||||||
|
|
|
@ -33,6 +33,7 @@ where
|
||||||
DefaultAllocator: Allocator<N, D>,
|
DefaultAllocator: Allocator<N, D>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use two_sided_inverse_mut()?"]
|
||||||
fn two_sided_inverse(&self) -> Self {
|
fn two_sided_inverse(&self) -> Self {
|
||||||
self.inverse()
|
self.inverse()
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,6 +370,7 @@ where DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>
|
||||||
/// assert!(t.try_inverse().is_none());
|
/// assert!(t.try_inverse().is_none());
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use try_inverse_mut()?"]
|
||||||
pub fn try_inverse(self) -> Option<Transform<N, D, C>> {
|
pub fn try_inverse(self) -> Option<Transform<N, D, C>> {
|
||||||
if let Some(m) = self.matrix.try_inverse() {
|
if let Some(m) = self.matrix.try_inverse() {
|
||||||
Some(Transform::from_matrix_unchecked(m))
|
Some(Transform::from_matrix_unchecked(m))
|
||||||
|
@ -395,6 +396,7 @@ where DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>
|
||||||
/// assert_relative_eq!(inv_t * proj, Projective2::identity());
|
/// assert_relative_eq!(inv_t * proj, Projective2::identity());
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use inverse_mut()?"]
|
||||||
pub fn inverse(self) -> Transform<N, D, C>
|
pub fn inverse(self) -> Transform<N, D, C>
|
||||||
where C: SubTCategoryOf<TProjective> {
|
where C: SubTCategoryOf<TProjective> {
|
||||||
// FIXME: specialize for TAffine?
|
// FIXME: specialize for TAffine?
|
||||||
|
|
|
@ -32,6 +32,7 @@ where
|
||||||
DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
|
DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use two_sided_inverse_mut()?"]
|
||||||
fn two_sided_inverse(&self) -> Self {
|
fn two_sided_inverse(&self) -> Self {
|
||||||
self.clone().inverse()
|
self.clone().inverse()
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,7 @@ where DefaultAllocator: Allocator<N, D>
|
||||||
/// assert_eq!(t.inverse() * t, Translation2::identity());
|
/// assert_eq!(t.inverse() * t, Translation2::identity());
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use inverse_mut()?"]
|
||||||
pub fn inverse(&self) -> Translation<N, D>
|
pub fn inverse(&self) -> Translation<N, D>
|
||||||
where N: ClosedNeg {
|
where N: ClosedNeg {
|
||||||
Translation::from(-&self.vector)
|
Translation::from(-&self.vector)
|
||||||
|
|
|
@ -32,6 +32,7 @@ impl<N: RealField, D: DimName> TwoSidedInverse<Multiplicative> for Translation<N
|
||||||
where DefaultAllocator: Allocator<N, D>
|
where DefaultAllocator: Allocator<N, D>
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use two_sided_inverse_mut()?"]
|
||||||
fn two_sided_inverse(&self) -> Self {
|
fn two_sided_inverse(&self) -> Self {
|
||||||
self.inverse()
|
self.inverse()
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,7 @@ impl<N: RealField> UnitComplex<N> {
|
||||||
/// assert_eq!(rot.complex().re, conj.complex().re);
|
/// assert_eq!(rot.complex().re, conj.complex().re);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use conjugate_mut()?"]
|
||||||
pub fn conjugate(&self) -> Self {
|
pub fn conjugate(&self) -> Self {
|
||||||
Self::new_unchecked(self.conj())
|
Self::new_unchecked(self.conj())
|
||||||
}
|
}
|
||||||
|
@ -123,6 +124,7 @@ impl<N: RealField> UnitComplex<N> {
|
||||||
/// assert_relative_eq!(inv * rot, UnitComplex::identity(), epsilon = 1.0e-6);
|
/// assert_relative_eq!(inv * rot, UnitComplex::identity(), epsilon = 1.0e-6);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use inverse_mut()?"]
|
||||||
pub fn inverse(&self) -> Self {
|
pub fn inverse(&self) -> Self {
|
||||||
self.conjugate()
|
self.conjugate()
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ impl<N: RealField> AbstractMagma<Multiplicative> for UnitComplex<N> {
|
||||||
|
|
||||||
impl<N: RealField> TwoSidedInverse<Multiplicative> for UnitComplex<N> {
|
impl<N: RealField> TwoSidedInverse<Multiplicative> for UnitComplex<N> {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use two_sided_inverse_mut()?"]
|
||||||
fn two_sided_inverse(&self) -> Self {
|
fn two_sided_inverse(&self) -> Self {
|
||||||
self.inverse()
|
self.inverse()
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ use crate::linalg::lu;
|
||||||
impl<N: ComplexField, D: Dim, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
|
impl<N: ComplexField, D: Dim, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
|
||||||
/// Attempts to invert this matrix.
|
/// Attempts to invert this matrix.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[must_use = "Did you mean to use try_inverse_mut()?"]
|
||||||
pub fn try_inverse(self) -> Option<MatrixN<N, D>>
|
pub fn try_inverse(self) -> Option<MatrixN<N, D>>
|
||||||
where DefaultAllocator: Allocator<N, D, D> {
|
where DefaultAllocator: Allocator<N, D, D> {
|
||||||
let mut me = self.into_owned();
|
let mut me = self.into_owned();
|
||||||
|
|
Loading…
Reference in New Issue