Skip to content

Commit d7e5672

Browse files
committed
Add check in EighInplace for compatible shapes
1 parent 10d7b55 commit d7e5672

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ndarray-linalg/src/eigh.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,17 @@ where
111111
{
112112
type EigVal = Array1<A::Real>;
113113

114+
/// Solves the generalized eigenvalue problem.
115+
///
116+
/// # Panics
117+
///
118+
/// Panics if the shapes of the matrices are different.
114119
fn eigh_inplace(&mut self, uplo: UPLO) -> Result<(Self::EigVal, &mut Self)> {
120+
assert_eq!(
121+
self.0.shape(),
122+
self.1.shape(),
123+
"The shapes of the matrices must be identical.",
124+
);
115125
let layout = self.0.square_layout()?;
116126
// XXX Force layout to be Fortran (see #146)
117127
match layout {

0 commit comments

Comments
 (0)