forked from boostorg/multiprecision
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[/ | ||
] | ||
[section:barrett_params Barrett params] | ||
`` | ||
namespace boost { | ||
namespace multiprecision { | ||
namespace backends { | ||
template <typename Backend> | ||
class barrett_params; | ||
}} | ||
`` | ||
The class `barrett_params` is inherited from the [link boost_multiprecision.tut.modular.modular_adaptor.modular_params.base_params `base_params`] class. | ||
This class perform the modular reductions using the Barrett reduction algorithm. | ||
The constructor of class set the base_params and precomputed values. | ||
The function `inline void eval_barret_reduce` compute the number that need to be reduced on modulo. | ||
Inside of the fuction only multiplications, subtractions, additions and shifts are used. | ||
|
||
[h2 API barrett_params] | ||
[h3 Constructors] | ||
* `barrett_params()` | ||
* `barrett_params(const Number& p)` | ||
[h3 Operators] | ||
* `barrett_params& operator=(const V& v)` | ||
[h3 Getters] | ||
`inline const number_type& mu() const` | ||
[h3 Class member functions] | ||
* `inline void eval_barret_reduce(Backend& result) const` | ||
This void perform the Barrett's modular reduction. | ||
|
||
[endsect][/section:barrett_params barrett_params] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[/ | ||
] | ||
|
||
[section:base_params Base_params] | ||
`` | ||
namespace boost { | ||
namespace multiprecision { | ||
namespace backends { | ||
|
||
template <typename Backend> | ||
class base_params; | ||
}} | ||
`` | ||
The class `base_params` initialize the module for modular calculations. | ||
|
||
[h2 API base_params] | ||
[h3 Constructors] | ||
* `base_params()` | ||
* `base_params(const Number& p)` | ||
|
||
[h3 Getter] | ||
`const number_type& mod() const` - return the modules value. | ||
|
||
[endsect] [/section:base_params base_params] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,40 @@ | ||
[/ | ||
] | ||
|
||
[section:modular_params Modular_params] | ||
[section:modular_params Modular params] | ||
|
||
`` | ||
namespace boost { | ||
namespace multiprecision { | ||
|
||
template <typename Backend> | ||
class modular_params; | ||
}} | ||
`` | ||
|
||
The class `modular_params` is inherited from the | ||
[link boost_multiprecision.tut.modular.modular_adaptor.modular_params.montgomery_params `public backends::montgomery_params<Backend>`] | ||
and [link boost_multiprecision.tut.modular.modular_adaptor.modular_params.barrett_params `public backends::barrett_params<Backend>`]classes. | ||
[include tutorial_montgomery_params.qbk] | ||
[include tutorial_barrett_params.qbk] | ||
[include tutorial_base_params.qbk] | ||
|
||
[h2 API modular_params] | ||
[h3 Constructors] | ||
* `modular_params()` | ||
* `modular_params(const Number& p)` | ||
[h3 Operators] | ||
* `modular_params& operator=(const modular_params<Backend>& v)` | ||
* `modular_params& operator=(const Number& v)` | ||
* `operator number<BackendT, ExpressionTemplates>()` | ||
* `friend std::ostream& operator<<(std::ostream& o, modular_params<Backend> const& a)` | ||
[h3 Getters] | ||
* `number_type get_mod() const` | ||
[h3 Class member functions] | ||
* `void reduce(Backend& result) const` | ||
This void perform the Montgomery's modular reduction for odd numbers and Barrett's modular reductions for even. | ||
* `void adjust_modular(Backend& result)` | ||
* `void adjust_regular(Backend& result, const Backend& input) const` | ||
* `int compare(const modular_params<Backend>& o) const` | ||
|
||
[endsect] [/section:modular_params modular_params] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[/ | ||
] | ||
[section:montgomery_params Montgomery params] | ||
`` | ||
namespace boost { | ||
namespace multiprecision { | ||
namespace backends { | ||
template <typename Backend> | ||
class montgomery_params; | ||
}}} | ||
`` | ||
The class `montgomery_params` is inherited from the [link boost_multiprecision.tut.modular.modular_adaptor.modular_params.base_params `base_params`] class. | ||
This class perform the modular reductions using the Montgomery reduction algorithm. | ||
The constructor of class set the base_params and precomputed values. | ||
The function `inline void eval_montgomery_reduce` compute the number that need to be reduced on modulo. | ||
Inside of the fuction only multiplications, subtractions, additions and shifts are used. | ||
|
||
|
||
[h2 API barrett_params] | ||
[h3 Constructors] | ||
* `montgomery_params()` | ||
* `montgomery_params(const Number& p)` | ||
[h3 Operators] | ||
* `montgomery_params& operator=(const V& v)` | ||
[h3 Getters] | ||
* `inline const number_type& r2() const ` | ||
* `inline limb_type p_dash() const ` | ||
* `inline size_t p_words() const` | ||
[h3 Class member functions] | ||
* `inline void eval_montgomery_reduce(Backend& result) const` | ||
This void perform the Montgomery's modular reduction. | ||
|
||
[endsect][/section:montgomery_params montgomery_params] |