Skip to content

Commit 83be10b

Browse files
committed
impl inv()
1 parent 98a5cb4 commit 83be10b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/solve.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,27 @@ impl<'a, A, S> Factorize<OwnedRepr<A>> for &'a ArrayBase<S, Ix2>
6464
Ok(Factorized { a: a, ipiv: ipiv })
6565
}
6666
}
67+
68+
pub trait Inverse<Inv> {
69+
fn inv(self) -> Result<Inv>;
70+
}
71+
72+
impl<A, S> Inverse<ArrayBase<S, Ix2>> for ArrayBase<S, Ix2>
73+
where A: LapackScalar,
74+
S: DataMut<Elem = A>
75+
{
76+
fn inv(self) -> Result<ArrayBase<S, Ix2>> {
77+
let f = self.factorize()?;
78+
f.into_inverse()
79+
}
80+
}
81+
82+
impl<'a, A, S> Inverse<Array2<A>> for &'a ArrayBase<S, Ix2>
83+
where A: LapackScalar + Clone,
84+
S: Data<Elem = A>
85+
{
86+
fn inv(self) -> Result<Array2<A>> {
87+
let f = self.factorize()?;
88+
f.into_inverse()
89+
}
90+
}

0 commit comments

Comments
 (0)