mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix stableNorm when input is zero-sized.
This commit is contained in:
@@ -55,6 +55,10 @@ typename MatrixType::RealScalar stable_norm_impl(const MatrixType& mat) {
|
||||
RealScalar invScale(1);
|
||||
RealScalar ssq(0); // sum of squares
|
||||
|
||||
if (mat.size() == 0) {
|
||||
return RealScalar(0);
|
||||
}
|
||||
|
||||
stable_norm_kernel(mat, ssq, scale, invScale);
|
||||
return scale * sqrt(ssq);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user