-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 864e467
Showing
37 changed files
with
3,612 additions
and
0 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,47 @@ | ||
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 }} | ||
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.10' | ||
- '1.11' | ||
- 'pre' | ||
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 | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
files: lcov.info | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: false |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.jl.*.cov | ||
*.jl.cov | ||
*.jl.mem | ||
/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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2025 Daan Huybrechs <[email protected]> and contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 @@ | ||
name = "FunctionMaps" | ||
uuid = "a85aefff-f8ca-4649-a888-c8e5398bc76c" | ||
authors = ["Daan Huybrechs <[email protected]> and contributors"] | ||
version = "0.1.0" | ||
|
||
[deps] | ||
CompositeTypes = "b152e2b5-7a66-4b01-a709-34e65c35f657" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" | ||
|
||
[compat] | ||
Aqua = "0.8" | ||
CompositeTypes = "0.1.3" | ||
LinearAlgebra = "1" | ||
StaticArrays = "1" | ||
Test = "1" | ||
julia = "1.10" | ||
|
||
[extras] | ||
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["Test", "Aqua"] |
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,5 @@ | ||
# FunctionMaps | ||
|
||
[](https://github.com/daanhb/FunctionMaps.jl/actions/workflows/CI.yml?query=branch%3Amain) | ||
[](https://codecov.io/gh/daanhb/FunctionMaps.jl) | ||
[](https://github.com/JuliaTesting/Aqua.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 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
FunctionMaps = "a85aefff-f8ca-4649-a888-c8e5398bc76c" |
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,17 @@ | ||
using FunctionMaps | ||
using Documenter | ||
|
||
DocMeta.setdocmeta!(FunctionMaps, :DocTestSetup, :(using FunctionMaps); recursive=true) | ||
|
||
makedocs(; | ||
modules=[FunctionMaps], | ||
authors="Daan Huybrechs <[email protected]> and contributors", | ||
sitename="FunctionMaps.jl", | ||
format=Documenter.HTML(; | ||
edit_link="main", | ||
assets=String[], | ||
), | ||
pages=[ | ||
"Home" => "index.md", | ||
], | ||
) |
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,14 @@ | ||
```@meta | ||
CurrentModule = FunctionMaps | ||
``` | ||
|
||
# FunctionMaps | ||
|
||
Documentation for [FunctionMaps](https://github.com/daanhb/FunctionMaps.jl). | ||
|
||
```@index | ||
``` | ||
|
||
```@autodocs | ||
Modules = [FunctionMaps] | ||
``` |
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,58 @@ | ||
module FunctionMaps | ||
|
||
using CompositeTypes, CompositeTypes.Display, CompositeTypes.Indexing | ||
using LinearAlgebra | ||
using StaticArrays | ||
|
||
import Base: | ||
convert, show, | ||
==, hash # for the equality of maps | ||
|
||
import CompositeTypes: component, components | ||
|
||
# Exhaustive list of exports: | ||
|
||
# from util/common.jl | ||
export prectype, numtype | ||
|
||
# from generic/map.jl | ||
export Map, MapRef, | ||
applymap, isequalmap, | ||
domaintype, codomaintype, | ||
inverse, leftinverse, rightinverse, | ||
mapsize, jacobian, jacdet, diffvolume, | ||
isrealmap | ||
# from generic/canonical.jl | ||
export canonicalmap | ||
# from generic/composite.jl | ||
export composedmap | ||
# from generic/product.jl | ||
export productmap | ||
|
||
# from types/basic.jl | ||
export IdentityMap, | ||
StaticIdentityMap, VectorIdentityMap, | ||
ZeroMap, UnityMap, ConstantMap, | ||
isconstantmap, mapconstant | ||
# from types/affine.jl | ||
export AffineMap, Translation, LinearMap, | ||
affinematrix, affinevector, | ||
islinearmap, isaffinemap | ||
|
||
include("util/common.jl") | ||
|
||
include("generic/map.jl") | ||
include("generic/interface.jl") | ||
include("generic/canonical.jl") | ||
include("generic/lazy.jl") | ||
include("generic/inverse.jl") | ||
include("generic/jacobian.jl") | ||
include("generic/composite.jl") | ||
include("generic/product.jl") | ||
include("generic/isomorphism.jl") | ||
include("types/basic.jl") | ||
include("types/affine.jl") | ||
include("types/coordinates.jl") | ||
include("types/arithmetics.jl") | ||
|
||
end |
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,94 @@ | ||
""" | ||
canonicalmap([ctype::CanonicalType, ]map) | ||
Return an associated canonical map, if any, of the given map. | ||
Optionally, a canonical type argument may specify an alternative canonical map. | ||
Canonical maps help with converting between equal maps of different types. | ||
""" | ||
canonicalmap(m) = m | ||
|
||
"Does the map have a canonical map?" | ||
hascanonicalmap(m) = !(m === canonicalmap(m)) | ||
|
||
|
||
"Supertype of different kinds of canonical objects." | ||
abstract type CanonicalType end | ||
|
||
canonicalmap(ctype::CanonicalType, m) = m | ||
hascanonicalmap(ctype::CanonicalType, m) = !(m === canonicalmap(ctype, m)) | ||
|
||
|
||
""" | ||
Equal <: CanonicalType | ||
A canonical object that is equal but simpler. | ||
""" | ||
struct Equal <: CanonicalType end | ||
|
||
canonicalmap(::Equal, m) = m | ||
equalmap(m) = canonicalmap(Equal(), m) | ||
hasequalmap(m) = hascanonicalmap(Equal(), m) | ||
|
||
""" | ||
simplify(m) | ||
Simplify the given map to an equal map. | ||
""" | ||
simplify(m) = equalmap(m) | ||
""" | ||
simplifies(m) | ||
Does the map simplify? | ||
""" | ||
simplifies(m) = hasequalmap(m) | ||
|
||
"Convert the given map to a map defined in FunctionMaps.jl." | ||
tofunctionmap(m::Map) = m | ||
tofunctionmap(m::MapRef) = tofunctionmap(functionmap(m)) | ||
|
||
|
||
""" | ||
Equivalent <: CanonicalType | ||
A canonical object that is equivalent but may have different type. | ||
""" | ||
struct Equivalent <: CanonicalType end | ||
|
||
canonicalmap(::Equivalent, m) = canonicalmap(Equal(), m) | ||
|
||
canonicalmap(::Equivalent, m::Map{<:StaticVector{1,T}}) where {T} = convert(Map{T}, m) | ||
canonicalmap(::Equivalent, m::Map{NTuple{N,T}}) where {N,T} = convert(Map{SVector{N,T}}, m) | ||
|
||
equivalentmap(m) = canonicalmap(Equivalent(), m) | ||
hasequivalentmap(m) = hascanonicalmap(Equivalent(), m) | ||
|
||
""" | ||
CanonicalExtensionType <: CanonicalType | ||
Canonical types used to translate between packages. | ||
""" | ||
abstract type CanonicalExtensionType <: CanonicalType | ||
end | ||
|
||
"Return the extension type associated with the given object." | ||
canonicalextensiontype(m) = canonicalextensiontype(typeof(m)) | ||
|
||
|
||
==(m1::Map, m2::Map) = isequalmap(m1, m2) # Method from Base | ||
|
||
""" | ||
isequalmap(map1, map2) | ||
Are the two given maps equal? | ||
""" | ||
isequalmap(m1, m2) = isequalmap1(m1, m2) | ||
isequalmap1(m1, m2) = simplifies(m1) ? isequalmap(simplify(m1), m2) : isequalmap2(m1, m2) | ||
isequalmap2(m1, m2) = simplifies(m2) ? isequalmap(m1, simplify(m2)) : default_isequalmap(m1, m2) | ||
default_isequalmap(m1, m2) = m1===m2 | ||
|
||
# Associated with == we have to define the hashes of maps | ||
Base.hash(m::Map, h::UInt) = map_hash(m, h) | ||
|
||
map_hash(m) = map_hash(m, zero(UInt)) | ||
map_hash(m, h::UInt) = invoke(hash, Tuple{Any,UInt}, m, h) |
Oops, something went wrong.