Skip to content

Commit e5e710b

Browse files
committed
impl Eigh for &ArrayBase
1 parent 1cf04b7 commit e5e710b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/eigh.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ impl<A, S, Se> Eigh<ArrayBase<Se, Ix1>, ArrayBase<S, Ix2>> for ArrayBase<S, Ix2>
2121
}
2222
}
2323

24+
impl<'a, A, S, Se, So> Eigh<ArrayBase<Se, Ix1>, ArrayBase<So, Ix2>> for &'a ArrayBase<S, Ix2>
25+
where A: LapackScalar + Copy,
26+
S: Data<Elem = A>,
27+
Se: DataOwned<Elem = A::Real>,
28+
So: DataOwned<Elem = A> + DataMut
29+
{
30+
fn eigh(self, uplo: UPLO) -> Result<(ArrayBase<Se, Ix1>, ArrayBase<So, Ix2>)> {
31+
let mut a = replicate(self);
32+
let s = A::eigh(true, a.square_layout()?, uplo, a.as_allocated_mut()?)?;
33+
Ok((ArrayBase::from_vec(s), a))
34+
}
35+
}
36+
2437
impl<'a, A, S, Se> Eigh<ArrayBase<Se, Ix1>, &'a mut ArrayBase<S, Ix2>> for &'a mut ArrayBase<S, Ix2>
2538
where A: LapackScalar,
2639
S: DataMut<Elem = A>,

0 commit comments

Comments
 (0)