Skip to content

Commit 1948933

Browse files
committed
Implement HermiteMatrix for RcArray<A, Ix2>
1 parent 15b214e commit 1948933

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/hermite.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Define trait for Hermite matrices
22
3-
use ndarray::{Ix2, Array};
3+
use ndarray::{Ix2, Array, RcArray};
44
use lapack::c::Layout;
55

66
use matrix::{Matrix, MFloat};
@@ -71,3 +71,25 @@ impl<A: HMFloat> HermiteMatrix for Array<A, Ix2> {
7171
Ok(rt * rt)
7272
}
7373
}
74+
75+
impl<A: HMFloat> HermiteMatrix for RcArray<A, Ix2> {
76+
fn eigh(self) -> Result<(Self::Vector, Self), LinalgError> {
77+
// XXX unnecessray clone (should use into_owned())
78+
let (e, v) = self.to_owned().eigh()?;
79+
Ok((e.into_shared(), v.into_shared()))
80+
}
81+
fn ssqrt(self) -> Result<Self, LinalgError> {
82+
// XXX unnecessray clone (should use into_owned())
83+
let s = self.to_owned().ssqrt()?;
84+
Ok(s.into_shared())
85+
}
86+
fn cholesky(self) -> Result<Self, LinalgError> {
87+
// XXX unnecessray clone (should use into_owned())
88+
let s = self.to_owned().cholesky()?;
89+
Ok(s.into_shared())
90+
}
91+
fn deth(self) -> Result<Self::Scalar, LinalgError> {
92+
// XXX unnecessray clone (should use into_owned())
93+
self.to_owned().deth()
94+
}
95+
}

0 commit comments

Comments
 (0)