https://github.com/atomtomate/equivalenceclassesconstructor.jl
Construction of minimal set of representatives from a given set, under a number of equivalence relations. A mapping back to the original set is also computed.
https://github.com/atomtomate/equivalenceclassesconstructor.jl
auxiliary numerics
Last synced: 8 months ago
JSON representation
Construction of minimal set of representatives from a given set, under a number of equivalence relations. A mapping back to the original set is also computed.
- Host: GitHub
- URL: https://github.com/atomtomate/equivalenceclassesconstructor.jl
- Owner: Atomtomate
- License: mit
- Created: 2020-11-13T14:28:31.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-05-27T14:03:45.000Z (about 1 year ago)
- Last Synced: 2025-05-27T15:20:54.946Z (about 1 year ago)
- Topics: auxiliary, numerics
- Language: Julia
- Homepage: https://juliansbastelecke.com/EquivalenceClasses/Introduction
- Size: 275 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Equivalence Classes Constructor
===========
This Project aims to provide a tool package that can construct equivalence classes from symmetry predicates over
a given set or mappings between elements.
The reason being that subsequent calculations may be sped up by only considering one representative of each
equivalence class.
This code contains collection of methods that are able to construct mappings between full and reduced sets.
Specifically, for any indices `x, y` in some given set `vl` the known symmetries are given as input in the
form of predicates, i.e. `p(x,y)` ∈ `{true, false}` or in form of mappings `m(x) = y`.
The latter greatly increases performance but may lead to unexpected behavior with non monotonic mappings[1](#footnote1).
As result, the original set `vl` is supplemented with a reduced set `vl_red` and a mapping `expand_vl` which
can be used to expand subsequent calculations over the reduced set back to the full one.
| Build Status | Coverage | Documentation | Social |
| ------------------- |:------------------:| :-------------:| :-------------:|
| [](https://github.com/Atomtomate/EquivalenceClassesConstructor.jl/actions) | [](https://codecov.io/gh/Atomtomate/EquivalenceClassesConstructor.jl) | [](https://Atomtomate.github.io/EquivalenceClassesConstructor.jl/stable) |[](https://gitter.im/JuliansBastelecke/EquivalenceClasses?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) |
Setup
-----------
Basic Usage
-----------
By default, the constructor of the `EquivalenceClasses` will do the heavy lifting. You should therefore expect
this line of the code to use up substential amount of compute time for large inputs.
The first step is to define a seg `S` and a relationship between elements of `S`.
```
using EquivalenceClassesConstructor
S = -4:3
m1 = Mapping(x -> [-x])
p1 = Predicate((x,y) -> x == -y)
```
In cases where a mapping is known, it should be prefered over predicates since it requires substantially less evaluation time.
Once the relationships and grid are defined we can compute a minimal set of representatives from all equivalence classes of `S`
under `m1` or `p1`.
```
eqc = EquivalenceClasses(m1, S)
eqc_2 = EquivalenceClasses(p1, S)
```
Both computations should yield a minimal set and a mapping back to `S`.
Ordering is not guaranteed, but can be forced by adding the optional parameter `sorted=true` to the `EquivalenceClasses`
constructor.
Since the output is most likely part of a larger computation, the package provides some IO options. For example as fixed width
human readable files.
```
open("eqc_out.txt", "w") do io
write_fixed_width(io, eqc)
end;
```
Examples
-----------
`VertexReducedGrid.jl` constructs a minimal set for the input vertex of ['LadderDGA.jl'](https://github.com/Atomtomate/LadderDGA.jl).
1: The reason being, that `m(m(x))` may lie in `vl` but `m(x))` may not, forcing the algorithm to terminate.