Skip to content

C++ overhaul#77

Open
Enchufa2 wants to merge 8 commits into
masterfrom
cpp_overhaul
Open

C++ overhaul#77
Enchufa2 wants to merge 8 commits into
masterfrom
cpp_overhaul

Conversation

@Enchufa2

Copy link
Copy Markdown
Member

Whole algorithm rewritten in C++, which improves performance by a couple of orders of magnitude. In principle, tests still pass with few adjustments. But please test it carefully with known examples.

@Enchufa2 Enchufa2 requested a review from moralapablo July 11, 2026 00:32
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.20772% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.74%. Comparing base (e9f3dae) to head (3604a5a).

Files with missing lines Patch % Lines
src/taylor.h 69.04% 13 Missing ⚠️
src/nn2poly.cpp 92.64% 10 Missing ⚠️
R/plot_taylor_and_activation_potentials.R 0.00% 5 Missing ⚠️
src/partitions.cpp 91.42% 3 Missing ⚠️
src/partitions.h 97.40% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #77      +/-   ##
==========================================
+ Coverage   78.59%   79.74%   +1.15%     
==========================================
  Files          16       18       +2     
  Lines         710      780      +70     
==========================================
+ Hits          558      622      +64     
- Misses        152      158       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Enchufa2

Enchufa2 commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

Thought: we need to have a toy example computed by hand for the tests, simple enough to be doable, but complex enough to act as a gold standard to validate the algorithm. Something like

set.seed(1234)
(w <- list("tanh"   = matrix(rnorm(8, sd=0.3), nrow = 4, ncol = 2),
           "linear" = matrix(rnorm(3, sd=100), nrow = 3, ncol = 1)))
#> $tanh
#>             [,1]       [,2]
#> [1,] -0.36211972  0.1287374
#> [2,]  0.08322877  0.1518168
#> [3,]  0.32533235 -0.1724220
#> [4,] -0.70370931 -0.1639896
#> 
#> $linear
#>           [,1]
#> [1,] -56.44520
#> [2,] -89.00378
#> [3,] -47.71927
nn2poly::nn2poly(w, max_order = 4, taylor_orders = 5)
#> nn2poly p=3 max_order=4 (35 coefficients)
#>      Label         Value
#> 1        0 -31.659604601
#> 2        1 -13.647064990
#> 3        2 -17.397754477
#> 4        3  62.834901741
#> 5      1 1  -0.045760703
#> 6      1 2  -1.754732147
#> 7      1 3   2.816135856
#> 8      2 2  -2.636235198
#> 9      2 3  12.516969394
#> 10     3 3 -13.008416891
#> 11   1 1 1   0.060101496
#> 12   1 1 2  -0.081696362
#> 13   1 1 3  -0.374697060
#> 14   1 2 2  -0.081696362
#> 15   1 2 3  -1.230204385
#> 16   1 3 3  -0.374697060
#> 17   2 2 2   0.409603306
#> 18   2 2 3  -3.369221361
#> 19   2 3 3  -3.369221361
#> 20   3 3 3  -4.981328101
#> 21 1 1 1 1  -0.001144625
#> 22 1 1 1 2   0.026004139
#> 23 1 1 1 3  -0.025468972
#> 24 1 1 2 2   0.077681934
#> 25 1 1 2 3  -0.440929513
#> 26 1 1 3 3   0.427005053
#> 27 1 2 2 2   0.026004139
#> 28 1 2 2 3  -0.440929513
#> 29 1 2 3 3  -0.440929513
#> 30 1 3 3 3  -0.025468972
#> 31 2 2 2 2   0.237081539
#> 32 2 2 2 3  -2.096364041
#> 33 2 2 3 3   6.737475619
#> 34 2 3 3 3  -2.096364041
#> 35 3 3 3 3   5.266212538

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant