Allow enabling sqrt optimizations while computing
This commit is contained in:
parent
d54c6743e7
commit
c62f027656
2 changed files with 15 additions and 3 deletions
|
@ -58,7 +58,17 @@ void FactorizationController::setUseSqrtOptimization(bool value) {
|
||||||
|
|
||||||
m_useSqrtOptimization = value;
|
m_useSqrtOptimization = value;
|
||||||
emit useSqrtOptimizationChanged();
|
emit useSqrtOptimizationChanged();
|
||||||
reset();
|
|
||||||
|
// We're in a reset state
|
||||||
|
if (m_originalNumber == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_useSqrtOptimization)
|
||||||
|
m_stopFactor = static_cast<unsigned long long>(std::sqrt(m_currentFactNumber));
|
||||||
|
else
|
||||||
|
m_stopFactor = m_currentFactNumber - 1;
|
||||||
|
emit stopFactorChanged();
|
||||||
|
emit progressChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FactorizationController::pauseOnFound() const {
|
bool FactorizationController::pauseOnFound() const {
|
||||||
|
|
|
@ -167,8 +167,10 @@ class FactorizationController : public QObject {
|
||||||
* Generally, there's no reason to disable this optimization, however, if you wish to
|
* Generally, there's no reason to disable this optimization, however, if you wish to
|
||||||
* perform a slower search, it is a way to achieve that.
|
* perform a slower search, it is a way to achieve that.
|
||||||
*
|
*
|
||||||
* Note that changing this value while the computation is in progress will reset the
|
* This value can be changed even as a computation is ongoing; if you do so, the stop factor
|
||||||
* computation.
|
* will change immediately, which will very likely cause the progress bar to rapidly change.
|
||||||
|
* It is possible that after enabling, the computation will immediately finish, as the stop
|
||||||
|
* factor will be less than the sqrt(x).
|
||||||
*/
|
*/
|
||||||
void setUseSqrtOptimization(bool value);
|
void setUseSqrtOptimization(bool value);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue