Very small changes

Considering ways to take the algorithm and turn it into
OpenCL/Boost::Compute functions/code which would offer
a large speed increase.

Also, if I can figure out how to start from any arbitrary
digit (which is supposed to be possible) then multi-threading
would also give great speedups.
This commit is contained in:
A.M. Rowsell 2023-10-08 07:29:55 -04:00
parent 7b3fc5cdf8
commit ec2a96b0ad
Signed by: amr
GPG key ID: 0B6E2D8375CF79A9
2 changed files with 14 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
cfg/
*.txt *.txt
main main
.gdb_history .gdb_history

View file

@ -15,6 +15,12 @@ void Spigot::pump(void) {
int tempPreDigit = 0; int tempPreDigit = 0;
int j = this->spigotListLength - 1; int j = this->spigotListLength - 1;
int i = j; int i = j;
/*
* This could be handled using boost::compute
* with a BOOST_COMPUTE_FUNCTION that just
* multiplies every item by 10.
*/
while(i >= 0) { while(i >= 0) {
this->spigotList[i] *= 10; this->spigotList[i] *= 10;
i--; i--;
@ -22,6 +28,13 @@ void Spigot::pump(void) {
this->carry = 0; this->carry = 0;
i = j; i = j;
// note this does *not* handle the i=0 case // note this does *not* handle the i=0 case
/*
* This might also be able to be sped up
* with OpenCL/boost::compute by creating
* another custom function, but because
* the carry has to be passed along this might
* not work well
*/
while(i > 0) { while(i > 0) {
this->spigotList[i] += this->carry; this->spigotList[i] += this->carry;
this->carry = (this->spigotList[i] / (i * 2 + 1)) * i; this->carry = (this->spigotList[i] / (i * 2 + 1)) * i;