From b5897cd5618b16faff16b73d15c90ecf359fcaba Mon Sep 17 00:00:00 2001 From: Mathias Lang Date: Sun, 25 May 2025 19:53:31 +0200 Subject: [PATCH 1/3] trivial: Remove trailing whitespaces --- .github/workflows/ci.yml | 22 ++++++++++------------ source/mir/optim/least_squares.d | 6 +++--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6165b8f..fae5ee8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: const compilers = {"windows": [], "macos": [], "ubuntu": []}; const {owner, repo} = context.repo; let commit_sha = context.sha; - if (context.eventName == "pull_request") + if (context.eventName == "pull_request") { commit_sha = context.payload.pull_request.head.sha; } @@ -75,11 +75,11 @@ jobs: matrix: dc: ${{ fromJSON(needs.setup.outputs.compilers).macos }} steps: - - name: Checkout repo + - name: Checkout repo uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 with: fetch-depth: 0 - - name: Setup D compiler + - name: Setup D compiler uses: dlang-community/setup-dlang@763d869b4d67e50c3ccd142108c8bca2da9df166 with: compiler: ${{ matrix.dc }} @@ -112,17 +112,17 @@ jobs: env: # Ubuntu no longer has a 32-bit version of LAPACK available, so # we have to drop support. :( - ARCH: x86_64 + ARCH: x86_64 strategy: fail-fast: false matrix: dc: ${{ fromJSON(needs.setup.outputs.compilers).ubuntu }} steps: - - name: Checkout repo + - name: Checkout repo uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 with: fetch-depth: 0 - - name: Setup D compiler + - name: Setup D compiler uses: dlang-community/setup-dlang@763d869b4d67e50c3ccd142108c8bca2da9df166 with: compiler: ${{ matrix.dc }} @@ -137,13 +137,13 @@ jobs: key: ubuntu-latest-build-${{ hashFiles('**/dub.sdl', '**/dub.json') }} restore-keys: | ubuntu-latest-build- - - name: Build / test + - name: Build / test run: | dub test --arch=$ARCH --build=unittest-cov -c unittest-blas shell: bash - name: Upload coverage data uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b - + windows: name: '[windows] x86_64/${{ matrix.dc }}' runs-on: windows-latest @@ -158,11 +158,11 @@ jobs: matrix: dc: ${{ fromJSON(needs.setup.outputs.compilers).windows }} steps: - - name: Checkout repo + - name: Checkout repo uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 with: fetch-depth: 0 - - name: Setup D compiler + - name: Setup D compiler uses: dlang-community/setup-dlang@763d869b4d67e50c3ccd142108c8bca2da9df166 with: compiler: ${{ matrix.dc }} @@ -189,5 +189,3 @@ jobs: shell: bash - name: Upload coverage data uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b - - diff --git a/source/mir/optim/least_squares.d b/source/mir/optim/least_squares.d index 84ba850..2a2a6c3 100644 --- a/source/mir/optim/least_squares.d +++ b/source/mir/optim/least_squares.d @@ -151,7 +151,7 @@ algorithm, and an estimate of the Jacobian of `f` at x. The function `f` should take an input vector of length `n`, and fill an output vector of length `m`. -The function `g` is the Jacobian of `f`, and should fill a row-major `m x n` matrix. +The function `g` is the Jacobian of `f`, and should fill a row-major `m x n` matrix. Throws: $(LREF LeastSquaresException) Params: @@ -442,7 +442,7 @@ algorithm, and an estimate of the Jacobian of `f` at x. The function `f` should take an input vector of length `n`, and fill an output vector of length `m`. -The function `g` is the Jacobian of `f`, and should fill a row-major `m x n` matrix. +The function `g` is the Jacobian of `f`, and should fill a row-major `m x n` matrix. Returns: optimization status. Params: @@ -1201,7 +1201,7 @@ uint normalizeSafety()(uint attrs) auto trustedAllAttr(T)(scope return T t) @trusted if (isFunctionPointer!T || isDelegate!T) { - enum attrs = (functionAttributes!T & ~FunctionAttribute.system) + enum attrs = (functionAttributes!T & ~FunctionAttribute.system) | FunctionAttribute.pure_ | FunctionAttribute.safe | FunctionAttribute.nogc From 19a3522c8a0843a3d717e1eed4630f5dbac35b09 Mon Sep 17 00:00:00 2001 From: Mathias Lang Date: Sun, 25 May 2025 19:54:58 +0200 Subject: [PATCH 2/3] fix(actions): Run on a supported platform --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fae5ee8..8335eba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ on: jobs: setup: name: 'Load job configuration' - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 outputs: compilers: ${{ steps.load-config.outputs.compilers }} steps: From 2e22d9372d25e05ebb1bec2700e2090d56044d5e Mon Sep 17 00:00:00 2001 From: Mathias Lang Date: Sun, 25 May 2025 19:54:31 +0200 Subject: [PATCH 3/3] fix(least_squares): Wrap unsafe cast in trusted Not a great thing to do since it breaks the typesystem but at least Buildkite will pass again, as it is currently broken following yesterday's release. --- source/mir/optim/least_squares.d | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/mir/optim/least_squares.d b/source/mir/optim/least_squares.d index 2a2a6c3..83f521e 100644 --- a/source/mir/optim/least_squares.d +++ b/source/mir/optim/least_squares.d @@ -173,10 +173,10 @@ LeastSquaresResult!T optimize(alias f, alias g = null, alias tm = null, T)( { auto ret = optimizeLeastSquares!(f, g, tm, T)(settings, m, x, l, u); if (ret.status == -1) - throw cast()leastSquaresException_maxIterations; + () @trusted { throw cast()leastSquaresException_maxIterations; }(); else if (ret.status < -1) - throw cast()leastSquaresExceptions[ret.status + 32]; + () @trusted { throw cast()leastSquaresExceptions[ret.status + 32]; }(); return ret; } @@ -207,10 +207,10 @@ LeastSquaresResult!T optimize(alias f, TaskPool, T)( auto ret = optimizeLeastSquares!(f, null, tm, T)(settings, m, x, l, u); if (ret.status == -1) - throw leastSquaresException_maxIterations; + () @trusted { throw cast()leastSquaresException_maxIterations; }(); else if (ret.status < -1) - throw leastSquaresExceptions[ret.status + 32]; + () @trusted { throw cast()leastSquaresExceptions[ret.status + 32]; }(); return ret; }