Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Fmath.hh
Go to the documentation of this file.
1 #ifndef INCLUDED_ObjexxFCL_Fmath_hh
2 #define INCLUDED_ObjexxFCL_Fmath_hh
3 
4 
5 // Fortran Intrinsic-Compatible and General Math Functions
6 //
7 // Project: Objexx Fortran Compatibility Library (ObjexxFCL)
8 //
9 // Version: 3.0.0
10 //
11 // Language: C++
12 //
13 // Copyright (c) 2000-2009 Objexx Engineering, Inc. All Rights Reserved.
14 // Use of this source code or any derivative of it is restricted by license.
15 // Licensing is available from Objexx Engineering, Inc.: http://objexx.com Objexx@objexx.com
16 
17 
18 // C++ Headers
19 #include <algorithm>
20 #include <cassert>
21 #include <cmath>
22 #include <cstddef>
23 #include <limits>
24 
25 
26 namespace ObjexxFCL {
27 
28 
29 typedef ptrdiff_t SSize;
30 
31 
32 // min Functions
33 
34 
35 /// @brief min( short int, short int )
36 inline
37 short int
38 min( short int const a, short int const b )
39 {
40  return ( a < b ? a : b );
41 }
42 
43 
44 /// @brief min( int, int )
45 inline
46 int
47 min( int const a, int const b )
48 {
49  return ( a < b ? a : b );
50 }
51 
52 
53 /// @brief min( long int, long int )
54 inline
55 long int
56 min( long int const a, long int const b )
57 {
58  return ( a < b ? a : b );
59 }
60 
61 
62 /// @brief min( unsigned short int, unsigned short int )
63 inline
64 unsigned short int
65 min( unsigned short int const a, unsigned short int const b )
66 {
67  return ( a < b ? a : b );
68 }
69 
70 
71 /// @brief min( unsigned int, unsigned int )
72 inline
73 unsigned int
74 min( unsigned int const a, unsigned int const b )
75 {
76  return ( a < b ? a : b );
77 }
78 
79 
80 /// @brief min( unsigned long int, unsigned long int )
81 inline
82 unsigned long int
83 min( unsigned long int const a, unsigned long int const b )
84 {
85  return ( a < b ? a : b );
86 }
87 
88 
89 /// @brief min( float, float )
90 inline
91 float
92 min( float const a, float const b )
93 {
94  return ( a < b ? a : b );
95 }
96 
97 
98 /// @brief min( double, double )
99 inline
100 double
101 min( double const a, double const b )
102 {
103  return ( a < b ? a : b );
104 }
105 
106 
107 /// @brief min( long double, long double )
108 inline
109 long double
110 min( long double const a, long double const b )
111 {
112  return ( a < b ? a : b );
113 }
114 
115 
116 /// @brief Use std::min for 2 arguments
117 using std::min;
118 
119 
120 /// @brief min( a, b, c )
121 template< typename T >
122 inline
123 T const &
124 min( T const & a, T const & b, T const & c )
125 {
126  return ( a < b ? ( a < c ? a : c ) : ( b < c ? b : c ) );
127 }
128 
129 
130 /// @brief min( a, b, c, d )
131 template< typename T >
132 inline
133 T const &
134 min( T const & a, T const & b, T const & c, T const & d )
135 {
136  return std::min( std::min( a, b ), std::min( c, d ) );
137 }
138 
139 
140 /// @brief min( a, b, c, d, e )
141 template< typename T >
142 inline
143 T const &
144 min( T const & a, T const & b, T const & c, T const & d, T const & e )
145 {
146  return min( std::min( a, b ), std::min( c, d ), e );
147 }
148 
149 
150 /// @brief min( a, b, c, d, e, f )
151 template< typename T >
152 inline
153 T const &
154 min( T const & a, T const & b, T const & c, T const & d, T const & e, T const & f )
155 {
156  return min( std::min( a, b ), std::min( c, d ), std::min( e, f ) );
157 }
158 
159 
160 // max Functions
161 
162 
163 /// @brief max( short int, short int )
164 inline
165 short int
166 max( short int const a, short int const b )
167 {
168  return ( a < b ? b : a );
169 }
170 
171 
172 /// @brief max( int, int )
173 inline
174 int
175 max( int const a, int const b )
176 {
177  return ( a < b ? b : a );
178 }
179 
180 
181 /// @brief max( long int, long int )
182 inline
183 long int
184 max( long int const a, long int const b )
185 {
186  return ( a < b ? b : a );
187 }
188 
189 
190 /// @brief max( unsigned short int, unsigned short int )
191 inline
192 unsigned short int
193 max( unsigned short int const a, unsigned short int const b )
194 {
195  return ( a < b ? b : a );
196 }
197 
198 
199 /// @brief max( unsigned int, unsigned int )
200 inline
201 unsigned int
202 max( unsigned int const a, unsigned int const b )
203 {
204  return ( a < b ? b : a );
205 }
206 
207 
208 /// @brief max( unsigned long int, unsigned long int )
209 inline
210 unsigned long int
211 max( unsigned long int const a, unsigned long int const b )
212 {
213  return ( a < b ? b : a );
214 }
215 
216 
217 /// @brief max( float, float )
218 inline
219 float
220 max( float const a, float const b )
221 {
222  return ( a < b ? b : a );
223 }
224 
225 
226 /// @brief max( double, double )
227 inline
228 double
229 max( double const a, double const b )
230 {
231  return ( a < b ? b : a );
232 }
233 
234 
235 /// @brief max( long double, long double )
236 inline
237 long double
238 max( long double const a, long double const b )
239 {
240  return ( a < b ? b : a );
241 }
242 
243 
244 /// @brief Use std::max for 2 arguments
245 using std::max;
246 
247 
248 /// @brief max( a, b, c )
249 template< typename T >
250 inline
251 T const &
252 max( T const & a, T const & b, T const & c )
253 {
254  return ( a < b ? ( b < c ? c : b ) : ( a < c ? c : a ) );
255 }
256 
257 
258 /// @brief max( a, b, c, d )
259 template< typename T >
260 inline
261 T const &
262 max( T const & a, T const & b, T const & c, T const & d )
263 {
264  return std::max( std::max( a, b ), std::max( c, d ) );
265 }
266 
267 
268 /// @brief max( a, b, c, d, e )
269 template< typename T >
270 inline
271 T const &
272 max( T const & a, T const & b, T const & c, T const & d, T const & e )
273 {
274  return max( std::max( a, b ), std::max( c, d ), e );
275 }
276 
277 
278 /// @brief max( a, b, c, d, e, f )
279 template< typename T >
280 inline
281 T const &
282 max( T const & a, T const & b, T const & c, T const & d, T const & e, T const & f )
283 {
284  return max( std::max( a, b ), std::max( c, d ), std::max( e, f ) );
285 }
286 
287 
288 // Math Functions
289 
290 
291 /// @brief std::abs( x ) == | x |
292 template< typename T >
293 inline
294 T
295 abs( T const & x )
296 {
297  return ( x < T( 0 ) ? -x : x );
298 }
299 
300 
301 /// @brief square( x ) == x^2
302 template< typename T >
303 inline
304 T
305 square( T const & x )
306 {
307  return x * x;
308 }
309 
310 
311 /// @brief cube( x ) == x^3
312 template< typename T >
313 inline
314 T
315 cube( T const & x )
316 {
317  return x * x * x;
318 }
319 
320 
321 /// @brief sign( x )
322 template< typename T >
323 inline
324 int
325 sign( T const & x )
326 {
327  return ( x >= T( 0 ) ? +1 : -1 );
328 }
329 
330 
331 /// @brief Sign Transfer from Second Argument to First Argument
332 template< typename X, typename Y >
333 inline
334 X
335 sign( X const & x, Y const & y )
336 {
337  return ( y >= Y( 0 ) ? std::abs( x ) : -std::abs( x ) );
338 }
339 
340 
341 /// @brief Nearest function selector class for R non-integer or T integer
342 template< typename R, typename T, bool >
344 {
345  inline
346  static
347  R
348  nearest( T const & x )
349  {
350  return R( x );
351  }
352 };
353 
354 
355 /// @brief Nearest function selector class for R integer and T non-integer
356 template< typename R, typename T >
357 struct NearestSelector< R, T, true >
358 {
359  inline
360  static
361  R
362  nearest( T const & x )
363  {
364  return R( x + ( sign( x ) * T( 0.5 ) ) );
365  }
366 };
367 
368 
369 /// @brief nearest< R >( x ): Nearest R
370 template< typename R, typename T >
371 inline
372 R
373 nearest( T const & x )
374 {
375  return NearestSelector< R, T, ( ( std::numeric_limits< R >::is_integer ) && ( ! std::numeric_limits< T >::is_integer ) ) >::nearest( x );
376 }
377 
378 
379 /// @brief nearest_size( x ): Nearest std::size_t
380 template< typename T >
381 inline
382 std::size_t
383 nearest_size( T const & x )
384 {
385  return std::size_t( x > T( 0 ) ? x + ( sign( x ) * T( 0.5 ) ) : 0 );
386 }
387 
388 
389 /// @brief nearest_ssize( x ): Nearest SSize
390 template< typename T >
391 inline
392 SSize
393 nearest_ssize( T const & x )
394 {
395  return SSize( x + ( sign( x ) * T( 0.5 ) ) );
396 }
397 
398 
399 /// @brief nearest_int( x ): Nearest int
400 template< typename T >
401 inline
402 int
403 nearest_int( T const & x )
404 {
405  return static_cast< int >( x + ( sign( x ) * T( 0.5 ) ) );
406 }
407 
408 
409 /// @brief nint( x ): Nearest int
410 template< typename T >
411 inline
412 int
413 nint( T const & x )
414 {
415  return static_cast< int >( x + ( sign( x ) * T( 0.5 ) ) );
416 }
417 
418 
419 /// @brief nsint( x ): Nearest short int
420 template< typename T >
421 inline
422 short int
423 nsint( T const & x )
424 {
425  return static_cast< short int >( x + ( sign( x ) * T( 0.5 ) ) );
426 }
427 
428 
429 /// @brief nlint( x ): Nearest long int
430 template< typename T >
431 inline
432 long int
433 nlint( T const & x )
434 {
435  return static_cast< long int >( x + ( sign( x ) * T( 0.5 ) ) );
436 }
437 
438 
439 /// @brief Mod function selector class for non-integer types
440 template< typename T, bool >
442 {
443  inline
444  static
445  T
446  mod( T const & x, T const & y )
447  {
448  return ( y != T( 0 ) ? x - ( T( static_cast< SSize >( x / y ) ) * y ) : T( 0 ) );
449  }
450 };
451 
452 
453 /// @brief Mod function selector class for integer types
454 /// @note When used with negative integer arguments this assumes integer division
455 /// rounds towards zero (de facto and future official standard)
456 template< typename T >
457 struct ModSelector< T, true >
458 {
459  inline
460  static
461  T
462  mod( T const & x, T const & y )
463  {
464  return ( y != T( 0 ) ? x - ( ( x / y ) * y ) : T( 0 ) );
465  }
466 };
467 
468 
469 /// @brief x(mod y) computational modulo returning magnitude < | y | and sign of x
470 /// @note When used with negative integer arguments this assumes integer division
471 /// rounds towards zero (de facto and future official standard)
472 template< typename T >
473 inline
474 T
475 mod( T const & x, T const & y )
476 {
478 }
479 
480 
481 /// @brief i(mod n) : float Arguments
482 inline
483 float
484 mod( float const & i, float const & n )
485 {
486  assert( n != 0.0f );
487  return ( n == 0.0f ? 0.0f : std::fmod( i, n ) );
488 }
489 
490 
491 /// @brief i(mod n) : double Arguments
492 inline
493 double
494 mod( double const & i, double const & n )
495 {
496  assert( n != 0.0 );
497  return ( n == 0.0 ? 0.0 : std::fmod( i, n ) );
498 }
499 
500 
501 /// @brief i(mod n) : long double Arguments
502 inline
503 long double
504 mod( long double const & i, long double const & n )
505 {
506  assert( n != 0.0l );
507  return ( n == 0.0l ? 0.0l : std::fmod( i, n ) );
508 }
509 
510 
511 /// @brief Modulo function selector class for non-integer types
512 template< typename T, bool >
514 {
515  inline
516  static
517  T
518  modulo( T const & x, T const & y )
519  {
520  return ( y != T( 0 ) ? x - ( std::floor( x / y ) * y ) : T( 0 ) );
521  }
522 };
523 
524 
525 /// @brief Modulo function selector class for integer types
526 template< typename T >
527 struct ModuloSelector< T, true >
528 {
529  inline
530  static
531  T
532  modulo( T const & x, T const & y )
533  {
534  return ( y != T( 0 ) ? x - ( T( std::floor( static_cast< long double >( x ) / y ) ) * y ) : T( 0 ) );
535  }
536 };
537 
538 
539 /// @brief x(mod y) mathematical modulo returning magnitude < | y | and sign of y
540 template< typename T >
541 inline
542 T
543 modulo( T const & x, T const & y )
544 {
546 }
547 
548 
549 /// @brief Remainder function selector class for non-integer types
550 template< typename T, bool >
552 {
553  inline
554  static
555  T
556  remainder( T const & x, T const & y )
557  {
558  if ( y == T( 0 ) ) { // Degenerate y == 0 case
559  return T( 0 );
560  } else { // Normal y != 0 case
561  T const x_over_y( x / y );
562  SSize n( nearest_ssize( x_over_y ) );
563  if ( mod( n, SSize( 2 ) ) == 1 ) { // Odd: Check for ( n - ( x / y ) ) == .5
564  T const n_minus_x_over_y( T( n ) - x_over_y );
565  if ( n_minus_x_over_y == T( 0.5 ) ) {
566  --n;
567  } else if ( n_minus_x_over_y == T( -0.5 ) ) { // Never happens if .5 rounds up
568  ++n;
569  }
570  }
571  return ( x - ( n * y ) );
572  }
573  }
574 };
575 
576 
577 /// @brief Remainder function selector class for integer types
578 template< typename T >
579 struct RemainderSelector< T, true >
580 {
581  inline
582  static
583  T
584  remainder( T const & x, T const & y )
585  {
586  if ( y == T( 0 ) ) { // Degenerate y == 0 case
587  return T( 0 );
588  } else { // Normal y != 0 case
589  long double const x_over_y( static_cast< long double >( x ) / y );
590  SSize n( nearest_ssize( x_over_y ) );
591  if ( mod( n, SSize( 2 ) ) == 1 ) { // Odd: Check for ( n - ( x / y ) ) == .5
592  long double const n_minus_x_over_y( static_cast< long double >( n ) - x_over_y );
593  if ( n_minus_x_over_y == 0.5l ) {
594  --n;
595  } else if ( n_minus_x_over_y == -0.5l ) { // Never happens if .5 rounds up
596  ++n;
597  }
598  }
599  return ( x - ( n * y ) );
600  }
601  }
602 };
603 
604 
605 /// @brief Remainder of x with respect to division by y that is of smallest magnitude
606 /// @note Emulates the C99 remainder function but also supports integer arguments
607 /// @note Returns zero if y is zero
608 /// @note Return value has magnitude <= | y / 2 |
609 /// @note If | n - ( x / y ) | == .5 the nearest even n is used
610 template< typename T >
611 inline
612 T
613 remainder( T const & x, T const & y )
614 {
616 }
617 
618 
619 /// @brief Fast remainder function selector class for non-integer types
620 template< typename T, bool >
622 {
623  inline
624  static
625  T
626  fast_remainder( T const & x, T const & y )
627  {
628  return ( y != T( 0 ) ? x - ( nearest_ssize( x / y ) * y ) : T( 0 ) );
629  }
630 };
631 
632 
633 /// @brief Fast remainder function selector class for integer types
634 template< typename T >
635 struct FastRemainderSelector< T, true >
636 {
637  inline
638  static
639  T
640  fast_remainder( T const & x, T const & y )
641  {
642  return ( y != T( 0 ) ? x - ( nearest_ssize( static_cast< long double >( x ) / y ) * y ) : T( 0 ) );
643  }
644 };
645 
646 
647 /// @brief Remainder of x with respect to division by y that is of smallest magnitude
648 /// @note Emulates the C99 remainder function except for rounding halfway values to even multiples
649 /// @note Returns zero if y is zero
650 /// @note Return value has magnitude <= | y / 2 |
651 template< typename T >
652 inline
653 T
654 fast_remainder( T const & x, T const & y )
655 {
657 }
658 
659 
660 /// @brief Remainder and result of conversion to a different type
661 template< typename T, typename S >
662 inline
663 T
664 remainder_conversion( T const & t, S & s )
665 {
666  s = S( t );
667  return t - s;
668 }
669 
670 
671 /// @brief Greatest Common Divisor
672 template< typename T >
673 inline
674 T
675 gcd( T const & m, T const & n )
676 {
677  T lo( min( m, n ) );
678  T hi( max( m, n ) );
679  while ( lo > T( 0 ) ) {
680  T const rem( mod( hi, lo ) );
681  hi = lo;
682  lo = rem;
683  }
684  return hi;
685 }
686 
687 
688 // Comparison-With-Tolerance Functions
689 
690 
691 /// @brief Equal within specified relative and absolute tolerances?
692 template< typename T >
693 inline
694 bool
695 eq_tol( T const & x, T const & y, T const & r_tol, T const & a_tol )
696 {
697  using std::abs; // Can use std::abs or user-defined abs
698  assert( r_tol >= T( 0 ) );
699  assert( a_tol >= T( 0 ) );
700  return ( std::abs( x - y ) <= min( r_tol * max( std::abs( x ), std::abs( y ) ), a_tol ) );
701 }
702 
703 
704 /// @brief Less than within specified relative and absolute tolerances?
705 template< typename T >
706 inline
707 bool
708 lt_tol( T const & x, T const & y, T const & r_tol, T const & a_tol )
709 {
710  using std::abs; // Can use std::abs or user-defined abs
711  assert( r_tol >= T( 0 ) );
712  assert( a_tol >= T( 0 ) );
713  return ( x < y + min( r_tol * max( std::abs( x ), std::abs( y ) ), a_tol ) );
714 }
715 
716 
717 /// @brief Less than or equal within specified relative and absolute tolerances?
718 template< typename T >
719 inline
720 bool
721 le_tol( T const & x, T const & y, T const & r_tol, T const & a_tol )
722 {
723  using std::abs; // Can use std::abs or user-defined abs
724  assert( r_tol >= T( 0 ) );
725  assert( a_tol >= T( 0 ) );
726  return ( x <= y + min( r_tol * max( std::abs( x ), std::abs( y ) ), a_tol ) );
727 }
728 
729 
730 /// @brief Greater than or equal within specified relative and absolute tolerances?
731 template< typename T >
732 inline
733 bool
734 ge_tol( T const & x, T const & y, T const & r_tol, T const & a_tol )
735 {
736  using std::abs; // Can use std::abs or user-defined abs
737  assert( r_tol >= T( 0 ) );
738  assert( a_tol >= T( 0 ) );
739  return ( x >= y - min( r_tol * max( std::abs( x ), std::abs( y ) ), a_tol ) );
740 }
741 
742 
743 /// @brief Greater than within specified relative and absolute tolerances?
744 template< typename T >
745 inline
746 bool
747 gt_tol( T const & x, T const & y, T const & r_tol, T const & a_tol )
748 {
749  using std::abs; // Can use std::abs or user-defined abs
750  assert( r_tol >= T( 0 ) );
751  assert( a_tol >= T( 0 ) );
752  return ( x > y - min( r_tol * max( std::abs( x ), std::abs( y ) ), a_tol ) );
753 }
754 
755 
756 // Bit Functions
757 namespace bit { // Protect from collisions with C++0x <functional> functors
758 
759 
760 /// @brief Bitwise Not
761 template< typename T >
762 inline
763 T
764 bit_not( T const & x )
765 {
766  return ( ~x );
767 }
768 
769 
770 /// @brief Bitwise And
771 template< typename T >
772 inline
773 T
774 bit_and( T const & x, T const & y )
775 {
776  return ( x & y );
777 }
778 
779 
780 /// @brief Bitwise Inclusive Or
781 template< typename T >
782 inline
783 T
784 bit_or( T const & x, T const & y )
785 {
786  return ( x | y );
787 }
788 
789 
790 /// @brief Bitwise Exclusive Or
791 template< typename T >
792 inline
793 T
794 bit_xor( T const & x, T const & y )
795 {
796  return ( x ^ y );
797 }
798 
799 
800 /// @brief Bit Value Set to 1
801 template< typename T >
802 inline
803 T
804 bit_set( T const & x, T const & pos )
805 {
806  assert( pos >= T( 0 ) );
807  return ( x | ( T( 1 ) << pos ) );
808 }
809 
810 
811 /// @brief Bit Value Set to 0
812 template< typename T >
813 inline
814 T
815 bit_clr( T const & x, T const & pos )
816 {
817  assert( pos >= T( 0 ) );
818  return ( x & ~( T( 1 ) << pos ) );
819 }
820 
821 
822 /// @brief Bit Value Test
823 template< typename T >
824 inline
825 bool
826 bit_test( T const & x, T const & pos )
827 {
828  assert( pos >= T( 0 ) );
829  return ( x & ( T( 1 ) << pos ) );
830 }
831 
832 
833 } // namespace bit
834 
835 
836 } // namespace ObjexxFCL
837 
838 
839 #endif // INCLUDED_ObjexxFCL_Fmath_HH
static T min(T x, T y)
Definition: Svm.cc:16
Fast remainder function selector class for non-integer types.
Definition: Fmath.hh:621
short int nsint(T const &x)
nsint( x ): Nearest short int
Definition: Fmath.hh:423
T bit_xor(T const &x, T const &y)
Bitwise Exclusive Or.
Definition: Fmath.hh:794
DimensionExpressionCube cube(Dimension const &dim)
cube( Dimension )
DimensionExpressionMin min(Dimension const &dim1, Dimension const &dim2)
min( Dimension, Dimension )
T gcd(T const &m, T const &n)
Greatest Common Divisor.
Definition: Fmath.hh:675
std::string X(int const w)
Blank string.
Definition: format.cc:263
Mod function selector class for non-integer types.
Definition: Fmath.hh:441
Nearest function selector class for R non-integer or T integer.
Definition: Fmath.hh:343
FileVectorOptionKey const s
Definition: SQLPDB.py:309
bool lt_tol(T const &x, T const &y, T const &r_tol, T const &a_tol)
Less than within specified relative and absolute tolerances?
Definition: Fmath.hh:708
bool gt_tol(T const &x, T const &y, T const &r_tol, T const &a_tol)
Greater than within specified relative and absolute tolerances?
Definition: Fmath.hh:747
def x
int sign(T const &x)
sign( x )
Definition: Fmath.hh:325
std::size_t nearest_size(T const &x)
nearest_size( x ): Nearest std::size_t
Definition: Fmath.hh:383
static T mod(T const &x, T const &y)
Definition: Fmath.hh:446
R nearest(T const &x)
nearest< R >( x ): Nearest R
Definition: Fmath.hh:373
static T fast_remainder(T const &x, T const &y)
Definition: Fmath.hh:640
static T mod(T const &x, T const &y)
Definition: Fmath.hh:462
static T remainder(T const &x, T const &y)
Definition: Fmath.hh:584
T remainder(T const &x, T const &y)
Remainder of x with respect to division by y that is of smallest magnitude.
Definition: Fmath.hh:613
Remainder function selector class for non-integer types.
Definition: Fmath.hh:551
T bit_and(T const &x, T const &y)
Bitwise And.
Definition: Fmath.hh:774
static R nearest(T const &x)
Definition: Fmath.hh:348
T abs(T const &x)
std::abs( x ) == | x |
Definition: Fmath.hh:295
T bit_clr(T const &x, T const &pos)
Bit Value Set to 0.
Definition: Fmath.hh:815
long int nlint(T const &x)
nlint( x ): Nearest long int
Definition: Fmath.hh:433
int nint(T const &x)
nint( x ): Nearest int
Definition: Fmath.hh:413
ptrdiff_t SSize
Definition: Fmath.hh:29
SSize nearest_ssize(T const &x)
nearest_ssize( x ): Nearest SSize
Definition: Fmath.hh:393
bool ge_tol(T const &x, T const &y, T const &r_tol, T const &a_tol)
Greater than or equal within specified relative and absolute tolerances?
Definition: Fmath.hh:734
static T remainder(T const &x, T const &y)
Definition: Fmath.hh:556
T remainder_conversion(T const &t, S &s)
Remainder and result of conversion to a different type.
Definition: Fmath.hh:664
int nearest_int(T const &x)
nearest_int( x ): Nearest int
Definition: Fmath.hh:403
T mod(T const &x, T const &y)
x(mod y) computational modulo returning magnitude < | y | and sign of x
Definition: Fmath.hh:475
T bit_not(T const &x)
Bitwise Not.
Definition: Fmath.hh:764
DimensionExpressionMax max(Dimension const &dim1, Dimension const &dim2)
max( Dimension, Dimension )
T bit_or(T const &x, T const &y)
Bitwise Inclusive Or.
Definition: Fmath.hh:784
Modulo function selector class for non-integer types.
Definition: Fmath.hh:513
T modulo(T const &x, T const &y)
x(mod y) mathematical modulo returning magnitude < | y | and sign of y
Definition: Fmath.hh:543
static T modulo(T const &x, T const &y)
Definition: Fmath.hh:532
T bit_set(T const &x, T const &pos)
Bit Value Set to 1.
Definition: Fmath.hh:804
bool eq_tol(T const &x, T const &y, T const &r_tol, T const &a_tol)
Equal within specified relative and absolute tolerances?
Definition: Fmath.hh:695
T fast_remainder(T const &x, T const &y)
Remainder of x with respect to division by y that is of smallest magnitude.
Definition: Fmath.hh:654
static T modulo(T const &x, T const &y)
Definition: Fmath.hh:518
bool bit_test(T const &x, T const &pos)
Bit Value Test.
Definition: Fmath.hh:826
static T max(T x, T y)
Definition: Svm.cc:19
DimensionExpressionSquare square(Dimension const &dim)
square( Dimension )
bool le_tol(T const &x, T const &y, T const &r_tol, T const &a_tol)
Less than or equal within specified relative and absolute tolerances?
Definition: Fmath.hh:721
def y
FileVectorOptionKey const l
static T fast_remainder(T const &x, T const &y)
Definition: Fmath.hh:626
FileVectorOptionKey const t