many changes

This commit is contained in:
dino.celebic 2025-11-03 22:35:52 +01:00
commit 7e2626266e
35 changed files with 276 additions and 6417 deletions

104
ex1/ex1_results.txt Normal file
View file

@ -0,0 +1,104 @@
-------------- Task A --------------
means(1,4,16) = (7.000000, 4.000000, 2.285714)
means(2,3,5) = (3.333333, 3.107233, 2.903226)
means(1000,4000,16000) = (7000.000000, 4000.000000, 2285.714286)
means(4,8,15,16,23,42) = (18.000000, 13.965497, 10.499524)
-------------- Task B --------------
Minimum: 1.000000
Maximum: 1000.000000
Arithmetic: 498.184000
Geometric: 364.411859
Harmonic: 95.685690
Deviation: 287.905085
-------------- Task C --------------
n = 15
For-loop funtion: result = 60 | time = 0.018645 milliseconds
Formula funtion: result = 60 | time = 0.000038 milliseconds
n = 1001
For-loop funtion: result = 234168 | time = 1.219296 milliseconds
Formula funtion: result = 234168 | time = 0.000039 milliseconds
n = 1432987
For-loop funtion: result = 479139074204 | time = 1625.893479 milliseconds
Formula funtion: result = 479139074204 | time = 0.000106 milliseconds
-------------- Task D --------------
Memory allocation
0.75 GByte Memory allocated
Start Benchmarking Normal sum
Sum = 1.6449340468482272
Timing in sec. : 0.36
GFLOPS : 0.26
GiByte/s : 2.1
Start Benchmarking Kahan summation
Sum = 1.6449340468482272
Timing in sec. : 0.31
GFLOPS : 0.3
GiByte/s : 2.4
Limit = 1.6449340668482264
-------------- Task E --------------
Vector insertion time for n = 100: 26 microseconds.
List insertion time for n = 100: 45 microseconds.
Vector insertion time for n = 1000: 121 microseconds.
List insertion time for n = 1000: 4059 microseconds.
Vector insertion time for n = 10000: 5932 microseconds.
List insertion time for n = 10000: 568042 microseconds.
-------------- Task F --------------
single_goldbach(k = 694) = 19
Decompositions for k = 694: 3 + 691, 11 + 683, 17 + 677, 41 + 653, 47 + 647, 53 + 641, 101 + 593, 107 + 587, 131 + 563, 137 + 557, 173 + 521, 191 + 503, 227 + 467, 233 + 461, 251 + 443, 263 + 431, 293 + 401, 311 + 383, 347 + 347,
NOTE: For n=2'000'000 it will take ~30 seconds.
count_goldbach(n = 10000): k = 9240, decompositions = 329, time elapsed: 1.055767 milliseconds
count_goldbach(n = 100000): k = 99330, decompositions = 2168, time elapsed: 42.025990 milliseconds
count_goldbach(n = 400000): k = 390390, decompositions = 7094, time elapsed: 530.372813 milliseconds
count_goldbach(n = 1000000): k = 990990, decompositions = 15594, time elapsed: 3973.183267 milliseconds
-------------- Task G --------------
M =
0.000045 0.000508 0.003346
0.000508 0.005754 0.037929
0.003346 0.037929 0.250000
0.006185 0.070104 0.462071
0.006648 0.075350 0.496654
u = 1 2 3
M * u = 0.011099 0.1258 0.8292 1.5326 1.6473
v = -1 2 -3 4 -5
M^T * v = -0.017568 -0.19912 -1.3125
Results for 3000x3000 matrix vector multiplication doing 100 loops
Time for initialization: 0.392896 seconds.
Time for Mult : 0.996829 seconds, 0.009968 per loop.
Time for MultT : 6.502881 seconds, 0.065029 per loop.
Results for 3000x3000 matrix vector multiplication doing 100 loops taking advantage of tensor product structure of the matrix
Time for initialization: 0.000088 seconds.
Time for Mult : 0.000164 seconds, 0.000002 per loop.
Time for MultT : 0.000197 seconds, 0.000002 per loop.