Skip to content

Commit e4aaa6d

Browse files
eliascarvjuliohm
andauthored
Export the isinvertible and inverse functions (#287)
* Export the 'isinvertible' and 'inverse' functions * Update docs/src/index.md --------- Co-authored-by: Júlio Hoffimann <[email protected]>
1 parent b173f0a commit e4aaa6d

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using TransformsBase
66
DocMeta.setdocmeta!(TableTransforms, :DocTestSetup, :(using TableTransforms); recursive=true)
77

88
makedocs(;
9-
warnonly=[:missing_docs, :cross_references],
9+
warnonly=[:missing_docs],
1010
modules=[TableTransforms, TransformsBase],
1111
authors="Júlio Hoffimann <[email protected]> and contributors",
1212
repo="https://github.com/JuliaML/TableTransforms.jl/blob/{commit}{path}#{line}",

docs/src/index.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,39 @@ Using the cache we can revert the transform:
150150
original = revert(transform, newtable, cache)
151151
```
152152

153+
### Inverting transforms
154+
155+
Some transforms have an inverse that can be created with the [`inverse`](@ref) function.
156+
The function [`isinvertible`](@ref) can be used to check if a transform is invertible.
157+
158+
```@docs
159+
inverse
160+
isinvertible
161+
```
162+
163+
Let's exemplify this:
164+
165+
```@example usage
166+
a = [5.1, 1.5, 9.4, 2.4]
167+
b = [7.6, 6.2, 5.8, 3.0]
168+
c = [6.3, 7.9, 7.6, 8.4]
169+
table = (; a, b, c)
170+
```
171+
172+
Choose a transform and check that it is invertible:
173+
174+
```@example usage
175+
transform = Functional(exp)
176+
isinvertible(transform)
177+
```
178+
179+
Now, let's test the inverse transform:
180+
181+
```@example usage
182+
invtransform = inverse(transform)
183+
invtransform(transform(table))
184+
```
185+
153186
### Reapplying transforms
154187

155188
Finally, it is sometimes useful to [`reapply`](@ref) a transform that was

src/TableTransforms.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ export
4343

4444
# interface
4545
isrevertible,
46+
isinvertible,
4647
apply,
4748
revert,
4849
reapply,
50+
inverse,
4951

5052
# built-in
5153
Assert,

0 commit comments

Comments
 (0)