Skip to content

Commit 8830561

Browse files
committed
base
1 parent 21682e6 commit 8830561

File tree

16 files changed

+206
-0
lines changed

16 files changed

+206
-0
lines changed

.github/workflows/CI.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags: ['*']
7+
pull_request:
8+
workflow_dispatch:
9+
concurrency:
10+
# Skip intermediate builds: always.
11+
# Cancel intermediate builds: only if it is a pull request build.
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
14+
jobs:
15+
test:
16+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
17+
runs-on: ${{ matrix.os }}
18+
timeout-minutes: 60
19+
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
20+
actions: write
21+
contents: read
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
version:
26+
- '1'
27+
os:
28+
- ubuntu-latest
29+
arch:
30+
- x64
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: julia-actions/setup-julia@v2
34+
with:
35+
version: ${{ matrix.version }}
36+
arch: ${{ matrix.arch }}
37+
- uses: julia-actions/cache@v2
38+
- uses: julia-actions/julia-buildpkg@v1
39+
- uses: julia-actions/julia-runtest@v1
40+
- uses: julia-actions/julia-processcoverage@v1
41+
- uses: codecov/codecov-action@v4
42+
with:
43+
file: lcov.info
44+
token: ${{ secrets.CODECOV_TOKEN }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
permissions:
12+
contents: write
13+
pull-requests: read
14+
statuses: write
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: julia-actions/setup-julia@v2
19+
with:
20+
version: '1'
21+
- uses: julia-actions/cache@v2
22+
- name: Install dependencies
23+
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
24+
- name: Build and deploy
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: julia --project=docs/ docs/make.jl

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Manifest*.toml

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Klamkin, Michael <[email protected]> and contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Project.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name = "BatchPOIKernels"
2+
uuid = "afeb8112-68be-11f0-3c37-57b6e69465f2"
3+
authors = ["Klamkin", "Michael <[email protected]> and contributors"]
4+
version = "1.0.0-DEV"
5+
6+
[deps]
7+
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
8+
ParametricOptInterface = "0ce4ce61-57bf-432b-a095-efac525d185e"
9+
10+
[weakdeps]
11+
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
12+
13+
[extensions]
14+
BPKChainRulesCore = "ChainRulesCore"
15+
16+
[compat]
17+
KernelAbstractions = "0.9.38"

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/
2+
site/

docs/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

docs/definitions.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""
2+
convert_newcommand_to_pair(s::AbstractString)
3+
4+
Converts a string of LaTeX to a pair, e.g. \\newcommand{\\RR}{\\mathbb{R}} to :RR => "\\mathbb{R}".
5+
"""
6+
function convert_newcommand_to_pair(s::AbstractString)
7+
if startswith(s, "\\newcommand{\\")
8+
parts = split(s, "}{")
9+
@assert length(parts) == 2
10+
cmd = replace(parts[1], "\\newcommand{\\" => "")
11+
return Symbol(cmd) => parts[2][1:end-1]
12+
end
13+
14+
return nothing
15+
end
16+
17+
"""
18+
make_macros_dict(definitions_path::AbstractString)
19+
20+
Create a `Documenter.HTMLWriter.MathJax3` `config` based on a LaTeX file containing `\\newcomand` definitions.
21+
"""
22+
function make_macros_dict(definitions_path::AbstractString)
23+
defs_txt = read(definitions_path, String)
24+
pairs = filter(
25+
!isnothing,
26+
map(convert_newcommand_to_pair strip, split(defs_txt, "\n"))
27+
)
28+
return Dict(pairs)
29+
end

docs/make.jl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Documenter
2+
using BatchPOIKernels
3+
4+
5+
include("definitions.jl")
6+
7+
makedocs(
8+
modules=[BatchPOIKernels],
9+
sitename = "BatchPOIKernels.jl",
10+
format = Documenter.HTML(;
11+
assets = ["assets/wider.css", "assets/redlinks.css"],
12+
mathengine = Documenter.MathJax3(Dict(
13+
:tex => Dict(
14+
"macros" => make_macros_dict("docs/src/assets/definitions.tex"),
15+
"inlineMath" => [["\$","\$"], ["\\(","\\)"]],
16+
"tags" => "ams",
17+
),
18+
)),
19+
),
20+
pages = [
21+
"Home" => "index.md",
22+
],
23+
)
24+
25+
# Documenter can also automatically deploy documentation to gh-pages.
26+
# See "Hosting Documentation" and deploydocs() in the Documenter manual
27+
# for more information.
28+
deploydocs(
29+
repo="github.com/LearningToOptimize/BatchPOIKernels.jl.git",
30+
push_preview=true,
31+
)

docs/src/assets/definitions.tex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
% Imaginary unit
2+
\newcommand{\im}{\mathbf{j}}

0 commit comments

Comments
 (0)