Skip to content

Commit 7e8e8d1

Browse files
authored
Merge pull request #147 from USACE-RMC/bug-fixes-and-enhancements
Prepare v2.2.0 release
2 parents 2a0357a + f983559 commit 7e8e8d1

314 files changed

Lines changed: 58878 additions & 6634 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/Integration.yml‎

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,31 @@ on:
66

77
jobs:
88
CI:
9-
uses: HydrologicEngineeringCenter/dotnet-workflows/.github/workflows/integration.yml@main
10-
with:
11-
dotnet-version: '10.0.x'
12-
run-tests: true
9+
# Preserve the check name used by the previous reusable workflow.
10+
name: CI / CI
11+
runs-on: windows-latest
12+
timeout-minutes: 90
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup .NET SDKs
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: |
24+
8.0.x
25+
9.0.x
26+
10.0.x
27+
28+
- name: Build
29+
run: dotnet build -c Release
30+
31+
- name: Test
32+
env:
33+
VSTEST_CONNECTION_TIMEOUT: '600'
34+
# Live provider outages and full-record download timeouts must not block PRs.
35+
# Keep deterministic download, parsing, validation, and numerical tests in the gate.
36+
run: dotnet test -c Release --no-build --filter "TestCategory!=LiveServiceIntegration"

‎.github/workflows/Snapshot.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
with:
1111
dotnet-version: '10.0.x'
1212
project-names: 'Numerics'
13-
# Snapshot workflow appends .<run_number>-dev, so this tracks the next development patch after v2.1.4.
14-
version: '2.1.5'
13+
# Snapshot workflow appends .<run_number>-dev, so this tracks the next development patch after v2.2.0.
14+
version: '2.2.1'
1515
# PR integration already runs the full multi-target test suite.
1616
run-tests: false
1717
nuget-source: 'https://www.hec.usace.army.mil/nexus/repository/consequences-nuget-public/'

‎.gitignore‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,5 @@ MigrationBackup/
372372
/TestResults
373373

374374
# Local developer guidance and settings. These files are for developer machines only.
375-
/CLAUDE.md
376-
/Claude.md
377-
/AGENTS.md
378-
/Agents.md
379375
/.claude/
380376
/.agents/

‎AGENTS.md‎

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Numerics Local Development Rules
2+
3+
## Technical Authority and Algorithm Change Control (NON-NEGOTIABLE)
4+
5+
Haden Smith is the final technical and numerical authority for this repository. AI agents,
6+
including Codex and Claude, must never change an established algorithm, formula,
7+
probability-combination rule, numerical method, convergence rule, default tolerance,
8+
random-seed behavior, clipping or normalization policy, or reference-result contract without
9+
Haden Smith's explicit prior approval. A failing test authorizes diagnosis and a proposed fix
10+
only; it does not authorize tuning or replacing the algorithm. When an agent's reasoning
11+
conflicts with Haden Smith's direction or domain judgment, the agent must stop, present the
12+
evidence, and request a decision. AI confidence is not technical authority.
13+
14+
## Quality Gate
15+
16+
- No compiler errors.
17+
- No compiler warnings.
18+
- Do not suppress warnings to make a build pass; fix the code, XML documentation, or invalid reference.
19+
- Empty catch blocks are not allowed. Preserve exception context when rethrowing or wrapping.
20+
21+
## XML Documentation
22+
23+
- XML documentation is mandatory for all public API additions and changes.
24+
- Public classes, structs, interfaces, enums, constructors, properties, methods, events, and fields require accurate XML documentation.
25+
- Private or internal methods with non-obvious algorithms should also be documented.
26+
- Include `<summary>`, `<param>`, `<returns>`, `<exception>`, and `<remarks>` whenever they apply.
27+
- Use `<remarks>` for numerical method notes, assumptions, references, and domain-specific constraints.
28+
- XML documentation warnings `CS1570`, `CS1571`, `CS1572`, `CS1573`, `CS1574`, `CS1584`, `CS1587`, `CS1589`, and `CS1591` are build errors when `EnforceXmlDocumentation=true`.
29+
30+
## Unit Tests
31+
32+
- Every behavior change must include unit tests or an explicit reason no test is useful.
33+
- Every new public class requires corresponding coverage in `Test_Numerics`.
34+
- Statistical and numerical methods must cover known values, edge cases, invalid inputs, and regression cases.
35+
- Use small inline fixtures in tests unless a shared fixture already exists for the exact scenario.
36+
37+
## Required Validation
38+
39+
Run validation before committing:
40+
41+
```powershell
42+
dotnet build -c Release
43+
dotnet test -c Release --no-build
44+
```
45+
46+
Both commands must complete with zero errors, zero warnings, and zero failed tests. If validation fails, fix the issue before committing.
47+
48+
## Git Workflow
49+
50+
- Commit after successful build and test validation for the completed logical change.
51+
- Stage only files that belong to the validated change.
52+
- Do not include unrelated tracked changes or untracked local files.
53+
- Use concise commit messages that describe the change.
54+
- Do not push unless explicitly asked.
55+
56+
## PR and Release Workflow
57+
58+
Use this workflow for release-preparation pull requests and public package releases.
59+
60+
### Release PR Planning
61+
62+
- Base release PRs on `bug-fixes-and-enhancements` targeting `main` unless the user gives a different branch plan.
63+
- Identify the last merged PR from the release branch and list every commit since that merge.
64+
- Merge `origin/main` into the release branch before editing so current README, JOSS, citation, and metadata updates are preserved.
65+
- Define the release outcome up front, including the exact `RMC.Numerics` version that NuGet.org must show as the latest public package after publishing.
66+
67+
### Version and Metadata Checklist
68+
69+
Update and cross-check every version-bearing file for each release:
70+
71+
- `Numerics/Numerics.csproj`: set `Version`, `AssemblyVersion`, and `PackageReleaseNotes`.
72+
- `CITATION.cff`: set `version` and `date-released`.
73+
- `codemeta.json`: set `version` and `dateModified`.
74+
- `.github/workflows/Snapshot.yml`: advance the snapshot version to the next patch after the release.
75+
- Keep `PackageReleaseNotes` concise because NuGet.org displays this field on the package page.
76+
77+
### PR Message Checklist
78+
79+
Use a title like `Prepare vX.Y.Z release`.
80+
81+
Include these sections in the PR body:
82+
83+
- `Summary`: package, citation, CodeMeta, and snapshot metadata updates.
84+
- `Summary`: user-facing fixes, reliability changes, API changes, and test coverage added since the previous release branch merge.
85+
- `Validation`: required commands and package inspection results.
86+
87+
Use this validation checklist:
88+
89+
```markdown
90+
- [ ] `dotnet restore`
91+
- [ ] `dotnet build Numerics/Numerics.csproj -c Release /p:Version=X.Y.Z`
92+
- [ ] `dotnet test -c Release` with `VSTEST_CONNECTION_TIMEOUT=600`
93+
- [ ] `dotnet pack Numerics/Numerics.csproj -c Release /p:Version=X.Y.Z --no-build -o ./packages`
94+
- [ ] Inspect the `.nupkg` metadata and confirm version `X.Y.Z` and release notes are correct.
95+
```
96+
97+
### Release Message Checklist
98+
99+
Create a GitHub Release titled `Numerics vX.Y.Z`.
100+
101+
Include these sections in the release body:
102+
103+
- `Highlights`: short release overview.
104+
- `Reliability and Fixes`: behavior fixes and reliability improvements.
105+
- Domain-specific sections for API, statistics, time-series, numerical methods, or other notable changes.
106+
- `Install`: package install command.
107+
108+
Use this install command format:
109+
110+
```bash
111+
dotnet add package RMC.Numerics --version X.Y.Z
112+
```
113+
114+
### Publish Workflow
115+
116+
- Merge the validated PR to `main`.
117+
- Tag the merge commit as `vX.Y.Z`.
118+
- Push the tag so `.github/workflows/Release.yml` publishes to the internal Nexus feed.
119+
- Create and publish a non-draft, non-prerelease GitHub Release for `vX.Y.Z`.
120+
- Confirm `.github/workflows/NuGetPublish.yml` publishes `RMC.Numerics.X.Y.Z.nupkg` to NuGet.org.
121+
- Verify NuGet.org shows `RMC.Numerics X.Y.Z` as the latest public package.

‎CITATION.cff‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ cff-version: 1.2.0
22
message: "If you use this software, please cite our article in the Journal of Open Source Software."
33
type: software
44
title: "Numerics: A .NET Library for Numerical Computing, Statistical Analysis, and Risk Assessment"
5-
version: "2.1.4"
6-
date-released: "2026-07-17"
5+
version: "2.2.0"
6+
date-released: "2026-09-18"
77
license: 0BSD
88
repository-code: "https://github.com/USACE-RMC/Numerics"
99
url: "https://github.com/USACE-RMC/Numerics"

‎CLAUDE.md‎

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Numerics Local Development Rules
2+
3+
## Technical Authority and Algorithm Change Control (NON-NEGOTIABLE)
4+
5+
Haden Smith is the final technical and numerical authority for this repository. AI agents,
6+
including Codex and Claude, must never change an established algorithm, formula,
7+
probability-combination rule, numerical method, convergence rule, default tolerance,
8+
random-seed behavior, clipping or normalization policy, or reference-result contract without
9+
Haden Smith's explicit prior approval. A failing test authorizes diagnosis and a proposed fix
10+
only; it does not authorize tuning or replacing the algorithm. When an agent's reasoning
11+
conflicts with Haden Smith's direction or domain judgment, the agent must stop, present the
12+
evidence, and request a decision. AI confidence is not technical authority.
13+
14+
## Quality Gate
15+
16+
- No compiler errors.
17+
- No compiler warnings.
18+
- Do not suppress warnings to make a build pass; fix the code, XML documentation, or invalid reference.
19+
- Empty catch blocks are not allowed. Preserve exception context when rethrowing or wrapping.
20+
21+
## XML Documentation
22+
23+
- XML documentation is mandatory for all public API additions and changes.
24+
- Public classes, structs, interfaces, enums, constructors, properties, methods, events, and fields require accurate XML documentation.
25+
- Private or internal methods with non-obvious algorithms should also be documented.
26+
- Include `<summary>`, `<param>`, `<returns>`, `<exception>`, and `<remarks>` whenever they apply.
27+
- Use `<remarks>` for numerical method notes, assumptions, references, and domain-specific constraints.
28+
- XML documentation warnings `CS1570`, `CS1571`, `CS1572`, `CS1573`, `CS1574`, `CS1584`, `CS1587`, `CS1589`, and `CS1591` are build errors when `EnforceXmlDocumentation=true`.
29+
30+
## Unit Tests
31+
32+
- Every behavior change must include unit tests or an explicit reason no test is useful.
33+
- Every new public class requires corresponding coverage in `Test_Numerics`.
34+
- Statistical and numerical methods must cover known values, edge cases, invalid inputs, and regression cases.
35+
- Use small inline fixtures in tests unless a shared fixture already exists for the exact scenario.
36+
37+
## Required Validation
38+
39+
Run validation before committing:
40+
41+
```powershell
42+
dotnet build -c Release
43+
dotnet test -c Release --no-build
44+
```
45+
46+
Both commands must complete with zero errors, zero warnings, and zero failed tests. If validation fails, fix the issue before committing.
47+
48+
## Git Workflow
49+
50+
- Commit after successful build and test validation for the completed logical change.
51+
- Stage only files that belong to the validated change.
52+
- Do not include unrelated tracked changes or untracked local files.
53+
- Use concise commit messages that describe the change.
54+
- Do not push unless explicitly asked.
55+
56+
## PR and Release Workflow
57+
58+
Use this workflow for release-preparation pull requests and public package releases.
59+
60+
### Release PR Planning
61+
62+
- Base release PRs on `bug-fixes-and-enhancements` targeting `main` unless the user gives a different branch plan.
63+
- Identify the last merged PR from the release branch and list every commit since that merge.
64+
- Merge `origin/main` into the release branch before editing so current README, JOSS, citation, and metadata updates are preserved.
65+
- Define the release outcome up front, including the exact `RMC.Numerics` version that NuGet.org must show as the latest public package after publishing.
66+
67+
### Version and Metadata Checklist
68+
69+
Update and cross-check every version-bearing file for each release:
70+
71+
- `Numerics/Numerics.csproj`: set `Version`, `AssemblyVersion`, and `PackageReleaseNotes`.
72+
- `CITATION.cff`: set `version` and `date-released`.
73+
- `codemeta.json`: set `version` and `dateModified`.
74+
- `.github/workflows/Snapshot.yml`: advance the snapshot version to the next patch after the release.
75+
- Keep `PackageReleaseNotes` concise because NuGet.org displays this field on the package page.
76+
77+
### PR Message Checklist
78+
79+
Use a title like `Prepare vX.Y.Z release`.
80+
81+
Include these sections in the PR body:
82+
83+
- `Summary`: package, citation, CodeMeta, and snapshot metadata updates.
84+
- `Summary`: user-facing fixes, reliability changes, API changes, and test coverage added since the previous release branch merge.
85+
- `Validation`: required commands and package inspection results.
86+
87+
Use this validation checklist:
88+
89+
```markdown
90+
- [ ] `dotnet restore`
91+
- [ ] `dotnet build Numerics/Numerics.csproj -c Release /p:Version=X.Y.Z`
92+
- [ ] `dotnet test -c Release` with `VSTEST_CONNECTION_TIMEOUT=600`
93+
- [ ] `dotnet pack Numerics/Numerics.csproj -c Release /p:Version=X.Y.Z --no-build -o ./packages`
94+
- [ ] Inspect the `.nupkg` metadata and confirm version `X.Y.Z` and release notes are correct.
95+
```
96+
97+
### Release Message Checklist
98+
99+
Create a GitHub Release titled `Numerics vX.Y.Z`.
100+
101+
Include these sections in the release body:
102+
103+
- `Highlights`: short release overview.
104+
- `Reliability and Fixes`: behavior fixes and reliability improvements.
105+
- Domain-specific sections for API, statistics, time-series, numerical methods, or other notable changes.
106+
- `Install`: package install command.
107+
108+
Use this install command format:
109+
110+
```bash
111+
dotnet add package RMC.Numerics --version X.Y.Z
112+
```
113+
114+
### Publish Workflow
115+
116+
- Merge the validated PR to `main`.
117+
- Tag the merge commit as `vX.Y.Z`.
118+
- Push the tag so `.github/workflows/Release.yml` publishes to the internal Nexus feed.
119+
- Create and publish a non-draft, non-prerelease GitHub Release for `vX.Y.Z`.
120+
- Confirm `.github/workflows/NuGetPublish.yml` publishes `RMC.Numerics.X.Y.Z.nupkg` to NuGet.org.
121+
- Verify NuGet.org shows `RMC.Numerics X.Y.Z` as the latest public package.

‎Numerics/Data/Interpolation/Polynomial.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class Polynomial : Interpolater
4242
/// <param name="sortOrder">The sort order of the x-values, either ascending or descending. Default = Ascending. </param>
4343
public Polynomial(int order, IList<double> xValues, IList<double> yValues, SortOrder sortOrder = SortOrder.Ascending) : base(xValues, yValues, sortOrder)
4444
{
45-
if (order >= Count) throw new ArgumentException(nameof(order), "The order must be less than the length of the x value list.");
45+
if (order >= Count) throw new ArgumentException("The order must be less than the length of the x value list.", nameof(order));
4646
Order = order;
4747

4848
}

‎Numerics/Data/Interpolation/Support/Interpolater.cs‎

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,20 @@ public Interpolater(IList<double> xValues, IList<double> yValues, SortOrder sort
3333
Count = xValues.Count;
3434

3535
// Validate
36-
if (yValues.Count != Count) throw new ArgumentException(nameof(xValues), "The x and y lists must be the same length.");
37-
if (Count < 2) throw new ArgumentException(nameof(xValues), "The x list is too small. It must have at least 2 values.");
36+
if (yValues.Count != Count) throw new ArgumentException("The x and y lists must be the same length.", nameof(xValues));
37+
if (Count < 2) throw new ArgumentException("The x list is too small. It must have at least 2 values.", nameof(xValues));
3838
for (int i = 1; i < xValues.Count; ++i)
3939
{
40-
if (xValues[i] == xValues[i - 1]) throw new ArgumentException(nameof(xValues), "All x values should be unique.");
41-
if (sortOrder == SortOrder.Ascending && xValues[i] < xValues[i - 1]) throw new ArgumentException(nameof(xValues), "The x values are not in ascending order.");
42-
if (sortOrder == SortOrder.Descending && xValues[i] > xValues[i - 1]) throw new ArgumentException(nameof(xValues), "The x values are not in descending order.");
40+
if (xValues[i] == xValues[i - 1]) throw new ArgumentException("All x values should be unique.", nameof(xValues));
41+
if (sortOrder == SortOrder.Ascending && xValues[i] < xValues[i - 1]) throw new ArgumentException("The x values are not in ascending order.", nameof(xValues));
42+
if (sortOrder == SortOrder.Descending && xValues[i] > xValues[i - 1]) throw new ArgumentException("The x values are not in descending order.", nameof(xValues));
4343
}
4444
this.XValues = xValues;
45-
this.YValues = yValues;
46-
deltaStart = Math.Min(1, (int)Math.Pow((double)Count, 0.25));
45+
this.YValues = yValues;
46+
// Scale the correlated-search window with the table size (Numerical Recipes' N^0.25 hunt
47+
// heuristic). Math.Max keeps the window at least 1 and lets it grow with the table; a
48+
// window pinned to a constant starves the hunt path. See the remarks on deltaStart.
49+
deltaStart = Math.Max(1, (int)Math.Pow((double)Count, 0.25));
4750
SortOrder = sortOrder;
4851

4952
}
@@ -59,8 +62,17 @@ public Interpolater(IList<double> xValues, IList<double> yValues, SortOrder sort
5962
public int SearchStart { get; set; } = 0;
6063

6164
/// <summary>
62-
/// Keeps track of the difference is start locations.
65+
/// The maximum distance between consecutive search results for which those searches are still
66+
/// treated as correlated, selecting the hunt search over bisection.
6367
/// </summary>
68+
/// <remarks>
69+
/// The constructor assigns <c>Math.Max(1, (int)Math.Pow(Count, 0.25))</c>, the Numerical
70+
/// Recipes N^0.25 hunt heuristic, so the window grows with the table size. The value affects
71+
/// only which search path runs — hunt and bisection return the same bracket for the same
72+
/// input — so it is a performance characteristic rather than a correctness one.
73+
/// <see cref="SearchStart"/> and <see cref="UseSmartSearch"/> are public and settable, so a
74+
/// consumer that wants different search behaviour can steer the search directly.
75+
/// </remarks>
6476
protected int deltaStart = 0;
6577

6678
/// <summary>

0 commit comments

Comments
 (0)