lambda_ is an input, so nothing resets it - #109
Conversation
`setup_clean_leaf()` cleared `lambda_`, so whether a prescribed Sperry marginal water cost survived depended on which of two interchangeable-looking calls came next: `set_drivers()` kept it, `set_traits()` lost it, and neither warned. It is the caller's input -- read only by `profit_psi_stem_Sperry`, written by no model code -- and the only input in that function's list. Both it and `lambda_analytical_` now carry their NA default at the declaration, so a fresh Leaf still reads NA. Derived state and solved outputs are cleared exactly as before. Closes #96.
Which option, and whyThe issue offered two, with no strong view. This is option 2 — leave both calls alone and take the field out of
Option 1 (clear it in The one way this could have gone wrong quietly
Verification
Bit-identity is expected rather than reassuring here: Test shapeBoth arms are asserted, deliberately. Two things noticed and not fixed here
|
# Conflicts: # inst/include/phylloptim/leaf_model.hpp
Correction, and an interaction with #93#93 merged after this PR was opened. Two things in my first comment are now wrong, and one of them matters. The table above is wrong in one cell. I wrote that // Reported so the equivalence above is inspectable rather than asserted: this
// is the lambda that makes optimise_psi_stem_Sperry find the same point.
lambda_ = profitmax_A_max_ / profitmax_k_span_;So
It does not change the decision. A field that is an input on any path must not be wiped on the caller's behalf, so option 2 still holds — and the dual role is an argument for it, not against: What the merge required beyond the mechanical conflictThe conflict itself was mechanical — #93 added six ProfitMax fields to The substantive part: #93 wrote this issue's asymmetry into a guard, as documentation of a live bug.
with the error message asserting And the guard has a hole #93 could not have known it had, now documented at the site: because ProfitMax writes Verification after the merge
One test added: Also worth noting on #113The dual role suggests its own fix, which I have added there: ProfitMax's λ is a report, and there is already a dead field named |
It changes observable behaviour and moves no numbers, so the fingerprint cannot signal it and NEWS is the only notice a consumer gets. Filed under the 0.5.0 heading #111 opened.
setup_clean_leaf()clearedlambda_, so whether a prescribedSperry marginal water cost survived depended on which of two
interchangeable-looking calls came next:
set_drivers()kept it,set_traits()lost it, and neither warned. It is the caller'sinput -- read only by
profit_psi_stem_Sperry, written by no modelcode -- and the only input in that function's list.
Both it and
lambda_analytical_now carry their NA default at thedeclaration, so a fresh Leaf still reads NA. Derived state and
solved outputs are cleared exactly as before. Closes #96.