@@ -8,16 +8,27 @@ use super::types::*;
88
99pub use lapack_traits:: NormType ;
1010
11+ /// Operator norm using `*lange` LAPACK routines
12+ ///
13+ /// https://en.wikipedia.org/wiki/Operator_norm
1114pub trait OperationNorm {
12- type Output ;
13- fn opnorm ( & self , t : NormType ) -> Self :: Output ;
14- fn opnorm_one ( & self ) -> Self :: Output {
15+ /// the value of norm
16+ type Output : RealScalar ;
17+
18+ fn opnorm ( & self , t : NormType ) -> Result < Self :: Output > ;
19+
20+ /// the one norm of a matrix (maximum column sum)
21+ fn opnorm_one ( & self ) -> Result < Self :: Output > {
1522 self . opnorm ( NormType :: One )
1623 }
17- fn opnorm_inf ( & self ) -> Self :: Output {
24+
25+ /// the infinity norm of a matrix (maximum row sum)
26+ fn opnorm_inf ( & self ) -> Result < Self :: Output > {
1827 self . opnorm ( NormType :: Infinity )
1928 }
20- fn opnorm_fro ( & self ) -> Self :: Output {
29+
30+ /// the Frobenius norm of a matrix (square root of sum of squares)
31+ fn opnorm_fro ( & self ) -> Result < Self :: Output > {
2132 self . opnorm ( NormType :: Frobenius )
2233 }
2334}
2738 A : Scalar ,
2839 S : Data < Elem = A > ,
2940{
30- type Output = Result < A :: Real > ;
41+ type Output = A :: Real ;
3142
32- fn opnorm ( & self , t : NormType ) -> Self :: Output {
43+ fn opnorm ( & self , t : NormType ) -> Result < Self :: Output > {
3344 let l = self . layout ( ) ?;
3445 let a = self . as_allocated ( ) ?;
3546 Ok ( A :: opnorm ( t, l, a) )
0 commit comments