-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
708 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: ['*'] | ||
pull_request: | ||
workflow_dispatch: | ||
concurrency: | ||
# Skip intermediate builds: always. | ||
# Cancel intermediate builds: only if it is a pull request build. | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | ||
jobs: | ||
test: | ||
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 60 | ||
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created | ||
actions: write | ||
contents: read | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: | ||
- '1.0' | ||
- '1.7' | ||
os: | ||
- ubuntu-latest | ||
arch: | ||
- x64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v2 | ||
with: | ||
version: ${{ matrix.version }} | ||
arch: ${{ matrix.arch }} | ||
- uses: julia-actions/cache@v2 | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-runtest@v1 | ||
docs: | ||
name: Documentation | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write # needed to allow julia-actions/cache to proactively delete old caches that it has created | ||
contents: write | ||
statuses: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v2 | ||
with: | ||
version: '1' | ||
- uses: julia-actions/cache@v2 | ||
- name: Configure doc environment | ||
shell: julia --project=docs --color=yes {0} | ||
run: | | ||
using Pkg | ||
Pkg.develop(PackageSpec(path=pwd())) | ||
Pkg.instantiate() | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-docdeploy@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} | ||
- name: Run doctests | ||
shell: julia --project=docs --color=yes {0} | ||
run: | | ||
using Documenter: DocMeta, doctest | ||
using FiniteDifferenceMatrices | ||
DocMeta.setdocmeta!(FiniteDifferenceMatrices, :DocTestSetup, :(using FiniteDifferenceMatrices); recursive=true) | ||
doctest(FiniteDifferenceMatrices) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: CompatHelper | ||
on: | ||
schedule: | ||
- cron: 0 0 * * * | ||
workflow_dispatch: | ||
jobs: | ||
CompatHelper: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Pkg.add("CompatHelper") | ||
run: julia -e 'using Pkg; Pkg.add("CompatHelper")' | ||
- name: CompatHelper.main() | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} | ||
run: julia -e 'using CompatHelper; CompatHelper.main()' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: TagBot | ||
on: | ||
issue_comment: | ||
types: | ||
- created | ||
workflow_dispatch: | ||
inputs: | ||
lookback: | ||
default: "3" | ||
permissions: | ||
actions: read | ||
checks: read | ||
contents: write | ||
deployments: read | ||
issues: read | ||
discussions: read | ||
packages: read | ||
pages: read | ||
pull-requests: read | ||
repository-projects: read | ||
security-events: read | ||
statuses: read | ||
jobs: | ||
TagBot: | ||
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: JuliaRegistries/TagBot@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
ssh: ${{ secrets.DOCUMENTER_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,3 @@ | ||
# Files generated by invoking Julia with --code-coverage | ||
*.jl.cov | ||
*.jl.*.cov | ||
|
||
# Files generated by invoking Julia with --track-allocation | ||
*.jl.mem | ||
|
||
# System-specific files and directories generated by the BinaryProvider and BinDeps packages | ||
# They contain absolute paths specific to the host computer, and so should not be committed | ||
deps/deps.jl | ||
deps/build.log | ||
deps/downloads/ | ||
deps/usr/ | ||
deps/src/ | ||
|
||
# Build artifacts for creating documentation generated by the Documenter package | ||
docs/build/ | ||
docs/site/ | ||
|
||
# File generated by Pkg, the package manager, based on a corresponding Project.toml | ||
# It records a fixed state of all packages used by the project. As such, it should not be | ||
# committed for packages, but should be committed for applications that require a static | ||
# environment. | ||
Manifest.toml | ||
/Manifest.toml | ||
/docs/Manifest.toml | ||
/docs/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name = "FiniteDifferenceMatrices" | ||
uuid = "a7a66f33-e7b8-47af-b618-f9b5bea05f3d" | ||
authors = ["Shuhei Ohno"] | ||
version = "0.0.1" | ||
|
||
[deps] | ||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | ||
|
||
[compat] | ||
julia = "1" | ||
|
||
[extras] | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["Test"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,67 @@ | ||
# FiniteDifferenceMatrices.jl | ||
```@meta | ||
CurrentModule = FiniteDifferenceMatrices | ||
``` | ||
|
||
# FiniteDifferenceMatrices.jl | ||
|
||
[![Build Status](https://github.com/ohno/FiniteDifferenceMatrices.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ohno/FiniteDifferenceMatrices.jl/actions/workflows/CI.yml?query=branch%3Amain) | ||
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://ohno.github.io/FiniteDifferenceMatrices.jl/stable/) | ||
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://ohno.github.io/FiniteDifferenceMatrices.jl/dev/) | ||
|
||
A Julia package for discrete approximations of differential operators | ||
|
||
## Install | ||
|
||
Run the following code on the to install this package. | ||
```julia | ||
import Pkg; Pkg.add(url="https://github.com/ohno/FiniteDifferenceMatrices.jl.git") | ||
``` | ||
|
||
## Usage | ||
|
||
Run the following code before each use. | ||
```@example index | ||
using FiniteDifferenceMatrices | ||
``` | ||
|
||
A central finite difference of the second-order derivative is | ||
```math | ||
\frac{\mathrm{d}^{2}f(x)}{\mathrm{d} x^{2}} = \frac{f(x+\Delta x) - 2f(x) + f(x-\Delta x)}{\Delta x^{2}} + O(\Delta x^{2}). | ||
``` | ||
```@repl index | ||
fdcoefficient(n=2, m=2, d=:c) | ||
``` | ||
|
||
A discrete approximation of the second-order differential operator is | ||
```math | ||
\frac{\mathrm{d}^2}{\mathrm{d} x^2} | ||
\simeq | ||
\frac{1}{\Delta x^2} | ||
\left(\begin{array}{ccccccc} | ||
-2 & 1 & 0 & \ldots & 0 & 0 & 0 \\ | ||
1 & -2 & 1 & \ldots & 0 & 0 & 0 \\ | ||
0 & 1 & -2 & \ldots & 0 & 0 & 0 \\ | ||
\vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots \\ | ||
0 & 0 & 0 & \ldots & -2 & 1 & 0 \\ | ||
0 & 0 & 0 & \ldots & 1 & -2 & 1 \\ | ||
0 & 0 & 0 & \ldots & 0 & 1 & -2 | ||
\end{array}\right). | ||
``` | ||
```@repl index | ||
fdmatrix(5, n=2, m=2, d=:c, h=1//1) | ||
``` | ||
|
||
Please see the [API reference](https://ohno.github.io/FiniteDifferenceMatrices.jl/dev/API/) for details and more examples. | ||
|
||
## Developer's Guide | ||
|
||
There are several tools for developers. | ||
|
||
```sh | ||
git clone https://github.com/ohno/FiniteDifferenceMatrices.jl.git | ||
cd FiniteDifferenceMatrices.jl | ||
julia | ||
julia> include("dev/revice.jl") | ||
julia> include("dev/test.jl") | ||
julia> include("dev/docs.jl") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# This is just a reminder. You don't use it. | ||
|
||
# import Pkg; Pkg.add("DocumenterTools") | ||
using DocumenterTools | ||
|
||
DocumenterTools.genkeys(user="ohno", repo="FiniteDifferenceMatrices.jl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Please run `include("./dev/docs.jl")` on RELP. | ||
|
||
run(`julia --project=docs/ -e 'using Pkg; Pkg.activate("./"); cd("docs"); include("make.jl")'`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This is just a reminder. You don't use it. | ||
|
||
# import Pkg; Pkg.add("PkgTemplates") | ||
using PkgTemplates | ||
|
||
t = Template(; | ||
user = "ohno", | ||
authors = ["Shuhei Ohno"], | ||
dir = pwd(), | ||
julia = v"1", | ||
plugins = [ | ||
License(; name = "MIT"), | ||
ProjectFile(; version=v"0.0.1"), | ||
Git(; manifest = false, ssh = true), | ||
GitHubActions(; | ||
extra_versions = ["1.7"] | ||
), | ||
Documenter{GitHubActions}(), | ||
Readme(; | ||
inline_badges = true, | ||
badge_order = DataType[ | ||
GitHubActions, | ||
Documenter{GitHubActions}, | ||
], | ||
), | ||
], | ||
) | ||
|
||
generate("FiniteDifferenceMatrices", t) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Please run `include("./dev/revice.jl")` on RELP | ||
|
||
# import Pkg; Pkg.add("Revise") | ||
using Revise | ||
|
||
dir = dirname(@__FILE__) * "/../" | ||
cd(dir) | ||
@show pwd() | ||
import Pkg; Pkg.activate(".") | ||
using FiniteDifferenceMatrices |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Please run `include("./dev/test.jl")` on RELP. | ||
|
||
dir = dirname(@__FILE__) * "/../" | ||
cd(dir) | ||
@show pwd() | ||
|
||
using Pkg | ||
Pkg.activate(dir) | ||
Pkg.test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
FiniteDifferenceMatrices = "a7a66f33-e7b8-47af-b618-f9b5bea05f3d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using FiniteDifferenceMatrices | ||
using Documenter | ||
|
||
DocMeta.setdocmeta!(FiniteDifferenceMatrices, :DocTestSetup, :(using FiniteDifferenceMatrices); recursive=true) | ||
|
||
makedocs(; | ||
modules=[FiniteDifferenceMatrices], | ||
authors="Shuhei Ohno", | ||
sitename="FiniteDifferenceMatrices.jl", | ||
format=Documenter.HTML(; | ||
canonical="https://ohno.github.io/FiniteDifferenceMatrices.jl", | ||
edit_link="main", | ||
assets=String[], | ||
), | ||
pages=[ | ||
"Home" => "index.md", | ||
"API reference" => "API.md", | ||
], | ||
) | ||
|
||
deploydocs(; | ||
repo="github.com/ohno/FiniteDifferenceMatrices.jl", | ||
devbranch="main", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
```@meta | ||
CurrentModule = FiniteDifferenceMatrices | ||
``` | ||
|
||
# API reference | ||
|
||
```@index | ||
``` | ||
|
||
```@autodocs | ||
Modules = [FiniteDifferenceMatrices] | ||
``` |
Oops, something went wrong.