@@ -474,9 +474,9 @@ Mat<eT>::Mat(const char* text)
474474
475475 init ( std::string (text) );
476476 }
477-
478-
479-
477+
478+
479+
480480// ! create the matrix from a textual description
481481template <typename eT>
482482inline
@@ -489,8 +489,8 @@ Mat<eT>::operator=(const char* text)
489489
490490 return *this ;
491491 }
492-
493-
492+
493+
494494
495495// ! create the matrix from a textual description
496496template <typename eT>
@@ -508,9 +508,9 @@ Mat<eT>::Mat(const std::string& text)
508508
509509 init (text);
510510 }
511-
512-
513-
511+
512+
513+
514514// ! create the matrix from a textual description
515515template <typename eT>
516516inline
@@ -5185,6 +5185,14 @@ Mat<eT>::Mat(const eOp<T1, eop_type>& X)
51855185
51865186 init_cold ();
51875187
5188+ if (is_same_type<eop_type, eop_pow>::value)
5189+ {
5190+ constexpr bool eT_non_int = is_non_integral<eT>::value;
5191+
5192+ if ( X.aux == eT (2 ) ) { eop_square::apply (*this , reinterpret_cast < const eOp<T1, eop_square>& >(X)); return ; }
5193+ if (eT_non_int && (X.aux == eT (0.5 ))) { eop_sqrt::apply (*this , reinterpret_cast < const eOp<T1, eop_sqrt >& >(X)); return ; }
5194+ }
5195+
51885196 eop_type::apply (*this , X);
51895197 }
51905198
@@ -5207,6 +5215,14 @@ Mat<eT>::operator=(const eOp<T1, eop_type>& X)
52075215
52085216 init_warm (X.get_n_rows (), X.get_n_cols ());
52095217
5218+ if (is_same_type<eop_type, eop_pow>::value)
5219+ {
5220+ constexpr bool eT_non_int = is_non_integral<eT>::value;
5221+
5222+ if ( X.aux == eT (2 ) ) { eop_square::apply (*this , reinterpret_cast < const eOp<T1, eop_square>& >(X)); return *this ; }
5223+ if (eT_non_int && (X.aux == eT (0.5 ))) { eop_sqrt::apply (*this , reinterpret_cast < const eOp<T1, eop_sqrt >& >(X)); return *this ; }
5224+ }
5225+
52105226 eop_type::apply (*this , X);
52115227
52125228 return *this ;
@@ -5228,6 +5244,14 @@ Mat<eT>::operator+=(const eOp<T1, eop_type>& X)
52285244
52295245 if (bad_alias) { const Mat<eT> tmp (X); return (*this ).operator +=(tmp); }
52305246
5247+ if (is_same_type<eop_type, eop_pow>::value)
5248+ {
5249+ constexpr bool eT_non_int = is_non_integral<eT>::value;
5250+
5251+ if ( X.aux == eT (2 ) ) { eop_square::apply_inplace_plus (*this , reinterpret_cast < const eOp<T1, eop_square>& >(X)); return *this ; }
5252+ if (eT_non_int && (X.aux == eT (0.5 ))) { eop_sqrt::apply_inplace_plus (*this , reinterpret_cast < const eOp<T1, eop_sqrt >& >(X)); return *this ; }
5253+ }
5254+
52315255 eop_type::apply_inplace_plus (*this , X);
52325256
52335257 return *this ;
@@ -5249,6 +5273,14 @@ Mat<eT>::operator-=(const eOp<T1, eop_type>& X)
52495273
52505274 if (bad_alias) { const Mat<eT> tmp (X); return (*this ).operator -=(tmp); }
52515275
5276+ if (is_same_type<eop_type, eop_pow>::value)
5277+ {
5278+ constexpr bool eT_non_int = is_non_integral<eT>::value;
5279+
5280+ if ( X.aux == eT (2 ) ) { eop_square::apply_inplace_minus (*this , reinterpret_cast < const eOp<T1, eop_square>& >(X)); return *this ; }
5281+ if (eT_non_int && (X.aux == eT (0.5 ))) { eop_sqrt::apply_inplace_minus (*this , reinterpret_cast < const eOp<T1, eop_sqrt >& >(X)); return *this ; }
5282+ }
5283+
52525284 eop_type::apply_inplace_minus (*this , X);
52535285
52545286 return *this ;
@@ -5287,6 +5319,14 @@ Mat<eT>::operator%=(const eOp<T1, eop_type>& X)
52875319
52885320 if (bad_alias) { const Mat<eT> tmp (X); return (*this ).operator %=(tmp); }
52895321
5322+ if (is_same_type<eop_type, eop_pow>::value)
5323+ {
5324+ constexpr bool eT_non_int = is_non_integral<eT>::value;
5325+
5326+ if ( X.aux == eT (2 ) ) { eop_square::apply_inplace_schur (*this , reinterpret_cast < const eOp<T1, eop_square>& >(X)); return *this ; }
5327+ if (eT_non_int && (X.aux == eT (0.5 ))) { eop_sqrt::apply_inplace_schur (*this , reinterpret_cast < const eOp<T1, eop_sqrt >& >(X)); return *this ; }
5328+ }
5329+
52905330 eop_type::apply_inplace_schur (*this , X);
52915331
52925332 return *this ;
@@ -5308,6 +5348,14 @@ Mat<eT>::operator/=(const eOp<T1, eop_type>& X)
53085348
53095349 if (bad_alias) { const Mat<eT> tmp (X); return (*this ).operator /=(tmp); }
53105350
5351+ if (is_same_type<eop_type, eop_pow>::value)
5352+ {
5353+ constexpr bool eT_non_int = is_non_integral<eT>::value;
5354+
5355+ if ( X.aux == eT (2 ) ) { eop_square::apply_inplace_div (*this , reinterpret_cast < const eOp<T1, eop_square>& >(X)); return *this ; }
5356+ if (eT_non_int && (X.aux == eT (0.5 ))) { eop_sqrt::apply_inplace_div (*this , reinterpret_cast < const eOp<T1, eop_sqrt >& >(X)); return *this ; }
5357+ }
5358+
53115359 eop_type::apply_inplace_div (*this , X);
53125360
53135361 return *this ;
0 commit comments