@@ -474,9 +474,9 @@ Mat<eT>::Mat(const char* text)
474
474
475
475
init ( std::string (text) );
476
476
}
477
-
478
-
479
-
477
+
478
+
479
+
480
480
// ! create the matrix from a textual description
481
481
template <typename eT>
482
482
inline
@@ -489,8 +489,8 @@ Mat<eT>::operator=(const char* text)
489
489
490
490
return *this ;
491
491
}
492
-
493
-
492
+
493
+
494
494
495
495
// ! create the matrix from a textual description
496
496
template <typename eT>
@@ -508,9 +508,9 @@ Mat<eT>::Mat(const std::string& text)
508
508
509
509
init (text);
510
510
}
511
-
512
-
513
-
511
+
512
+
513
+
514
514
// ! create the matrix from a textual description
515
515
template <typename eT>
516
516
inline
@@ -5185,6 +5185,14 @@ Mat<eT>::Mat(const eOp<T1, eop_type>& X)
5185
5185
5186
5186
init_cold ();
5187
5187
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
+
5188
5196
eop_type::apply (*this , X);
5189
5197
}
5190
5198
@@ -5207,6 +5215,14 @@ Mat<eT>::operator=(const eOp<T1, eop_type>& X)
5207
5215
5208
5216
init_warm (X.get_n_rows (), X.get_n_cols ());
5209
5217
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
+
5210
5226
eop_type::apply (*this , X);
5211
5227
5212
5228
return *this ;
@@ -5228,6 +5244,14 @@ Mat<eT>::operator+=(const eOp<T1, eop_type>& X)
5228
5244
5229
5245
if (bad_alias) { const Mat<eT> tmp (X); return (*this ).operator +=(tmp); }
5230
5246
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
+
5231
5255
eop_type::apply_inplace_plus (*this , X);
5232
5256
5233
5257
return *this ;
@@ -5249,6 +5273,14 @@ Mat<eT>::operator-=(const eOp<T1, eop_type>& X)
5249
5273
5250
5274
if (bad_alias) { const Mat<eT> tmp (X); return (*this ).operator -=(tmp); }
5251
5275
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
+
5252
5284
eop_type::apply_inplace_minus (*this , X);
5253
5285
5254
5286
return *this ;
@@ -5287,6 +5319,14 @@ Mat<eT>::operator%=(const eOp<T1, eop_type>& X)
5287
5319
5288
5320
if (bad_alias) { const Mat<eT> tmp (X); return (*this ).operator %=(tmp); }
5289
5321
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
+
5290
5330
eop_type::apply_inplace_schur (*this , X);
5291
5331
5292
5332
return *this ;
@@ -5308,6 +5348,14 @@ Mat<eT>::operator/=(const eOp<T1, eop_type>& X)
5308
5348
5309
5349
if (bad_alias) { const Mat<eT> tmp (X); return (*this ).operator /=(tmp); }
5310
5350
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
+
5311
5359
eop_type::apply_inplace_div (*this , X);
5312
5360
5313
5361
return *this ;
0 commit comments