helib::SumRegister< T > Class Template Reference
Class to do a binary tree summation as results appear to keep memory usage to a minimum. More...
#include <SumRegister.h>
Public Member Functions | |
| SumRegister (unsigned int _maxNumOfInputs) | |
| Constructor. More... | |
| void | add (std::unique_ptr< T > &t) |
Add to the sum another object of type T. More... | |
| std::unique_ptr< T > | getResult () |
| Get the result of the summation. More... | |
| bool | hasResult () const |
| Check result exists. More... | |
| size_t | getDepth () const |
| Get depth of summation binary tree. More... | |
| void | flush () |
| Flush the binary tree to force producing a result on current tree. More... | |
| void | print () |
| Print the information in the binary tree. More... | |
| std::vector< std::unique_ptr< T > > & | getIntermediates () |
| Get the intermediate results. More... | |
Detailed Description
template<typename T>
class helib::SumRegister< T >
Class to do a binary tree summation as results appear to keep memory usage to a minimum.
- Template Parameters
-
T The type of object to be summed.
Constructor & Destructor Documentation
◆ SumRegister()
template<typename T >
|
inline |
Constructor.
- Parameters
-
_maxNumOfInputs The maximum number expected to be summed together.
Member Function Documentation
◆ add()
template<typename T >
|
inline |
Add to the sum another object of type T.
- Parameters
-
t The object of type Tto be added to the sum.
- Note
- This method is destructive on the input argument.
◆ flush()
template<typename T >
|
inline |
Flush the binary tree to force producing a result on current tree.
◆ getDepth()
template<typename T >
|
inline |
Get depth of summation binary tree.
- Returns
- The size of the depth of the summation binary tree.
◆ getIntermediates()
template<typename T >
|
inline |
Get the intermediate results.
- Returns
- The intermediate results in a
std::vector.
◆ getResult()
template<typename T >
|
inline |
Get the result of the summation.
- Returns
- The result of the summation as a
std::unique_ptr<T>.
- Note
- This is destructive on the result, thus should only be called once.
◆ hasResult()
template<typename T >
|
inline |
Check result exists.
- Returns
trueif there is a resultfalseotherwise.
◆ print()
template<typename T >
|
inline |
Print the information in the binary tree.
1.9.1