Skip to content

Replace tuples by functions in univariate_expressions#26

Merged
SophieL1 merged 6 commits intomainfrom
sl/ChainRules
Feb 10, 2026
Merged

Replace tuples by functions in univariate_expressions#26
SophieL1 merged 6 commits intomainfrom
sl/ChainRules

Conversation

@SophieL1
Copy link
Collaborator

@SophieL1 SophieL1 commented Feb 9, 2026

No description provided.

@SophieL1 SophieL1 requested a review from blegat February 9, 2026 09:45
@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 40.50633% with 94 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.65%. Comparing base (6caa6c9) to head (9dd38d5).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/univariate_expressions.jl 6.84% 68 Missing ⚠️
src/univariate_expressions_generator.jl 0.00% 16 Missing ⚠️
src/operators.jl 85.07% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #26      +/-   ##
==========================================
- Coverage   94.45%   90.65%   -3.80%     
==========================================
  Files          14       16       +2     
  Lines        2110     2258     +148     
==========================================
+ Hits         1993     2047      +54     
- Misses        117      211      +94     

☔ View full report in Codecov by Sentry.
📢 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.

src/operators.jl Outdated
)
# Assumption 1: check that `f` can be called with `Float64` arguments.
y = 0.0
try
Copy link
Owner

@blegat blegat Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use hasmethod(f, (Array{dimension,Float64})) and hasmethod(f, Float64):

julia> hasmethod(size, (Array{3,Int},))
true

julia> hasmethod(log, (Array{3,Int},))
false

src/operators.jl Outdated
# Assumption 1: check that `f` can be called with `Float64` arguments.
y = 0.0
try
if dimension == 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For scalars, dimension should be 0 I think

Copy link
Collaborator Author

@SophieL1 SophieL1 Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we decide. I copy-pasted it from Nonlinear as it was needed in _UnivariateOperator which I also copy-pasted. It's the only place it is used for now, and dimension 1 is hard-coded for saying 'there's one argument' I guess.
I changed it to 0 as it may make more sense if we have vectors in the future.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, renaming nb_args sounds good :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sorry I've changed my mind; I put nb_args=1 indeed to make it clear :)

See comment by BL on PR, arbitrary choice for now
Dimension in this function represents the number of arguments the function has
@SophieL1 SophieL1 merged commit 68dbc68 into main Feb 10, 2026
3 of 5 checks passed
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.

2 participants