OptimalGrowth.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_POLICIES_OPTIMALGROWTH_H_
36 #define _BLAZE_UTIL_POLICIES_OPTIMALGROWTH_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Functions.h>
44 #include <blaze/util/Types.h>
45 
46 
47 namespace blaze {
48 
49 //=================================================================================================
50 //
51 // CLASS DEFINITION
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
66 {
67  //**Utility functions***************************************************************************
70  inline size_t operator()( size_t oldSize, size_t minSize ) const;
72  //**********************************************************************************************
73 };
74 //*************************************************************************************************
75 
76 
77 
78 
79 //=================================================================================================
80 //
81 // UTILITY FUNCTIONS
82 //
83 //=================================================================================================
84 
85 //*************************************************************************************************
92 inline size_t OptimalGrowth::operator()( size_t old, size_t minimum ) const
93 {
94  const size_t needed( max( static_cast<size_t>( old*1.5 ), minimum ) );
95  return ( ( needed )?( 4 * ( (needed-1)/4 + 1 ) ):( 0 ) );
96 }
97 //*************************************************************************************************
98 
99 } // namespace blaze
100 
101 #endif
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1729
Header file for mathematical functions.
Header file for basic type definitions.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
size_t operator()(size_t oldSize, size_t minSize) const
Returns a new size depending on the given old size and the required minimum size. ...
Definition: OptimalGrowth.h:92
Optimal growth policy class.The OptimalGrowth policy class implements the optimal growth strategy sug...
Definition: OptimalGrowth.h:65