Skip to content

Commit e32ee3b

Browse files
committed
Add tarit SolveH
1 parent 72893d9 commit e32ee3b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/solveh.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,30 @@ use super::types::*;
99

1010
pub use lapack_traits::{Pivot, UPLO};
1111

12+
pub trait SolveH<A: Scalar> {
13+
fn solveh<S: Data<Elem = A>>(&self, a: &ArrayBase<S, Ix1>) -> Result<Array1<A>> {
14+
let mut a = replicate(a);
15+
self.solveh_mut(&mut a)?;
16+
Ok(a)
17+
}
18+
fn solveh_into<S: DataMut<Elem = A>>(&self, mut a: ArrayBase<S, Ix1>) -> Result<ArrayBase<S, Ix1>> {
19+
self.solveh_mut(&mut a)?;
20+
Ok(a)
21+
}
22+
fn solveh_mut<'a, S: DataMut<Elem = A>>(&self, &'a mut ArrayBase<S, Ix1>) -> Result<&'a mut ArrayBase<S, Ix1>>;
23+
}
24+
1225
pub struct FactorizedH<S: Data> {
1326
pub a: ArrayBase<S, Ix2>,
1427
pub ipiv: Pivot,
1528
}
1629

17-
impl<A, S> FactorizedH<S>
30+
impl<A, S> SolveH<A> for FactorizedH<S>
1831
where
1932
A: Scalar,
2033
S: Data<Elem = A>,
2134
{
22-
pub fn solveh<Sb>(&self, mut rhs: ArrayBase<Sb, Ix1>) -> Result<ArrayBase<Sb, Ix1>>
35+
fn solveh_mut<'a, Sb>(&self, rhs: &'a mut ArrayBase<Sb, Ix1>) -> Result<&'a mut ArrayBase<Sb, Ix1>>
2336
where
2437
Sb: DataMut<Elem = A>,
2538
{

0 commit comments

Comments
 (0)