Skip to content

Commit

Permalink
Fix docs indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Nov 24, 2023
1 parent 5535434 commit 47296a7
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/MaybeInplace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ __bangbang__docs = """
The `@bangbang` macro rewrites expressions to use out-of-place operations if needed. The
following operations are supported:
1. `copyto!(y, x)`
2. `x .(+/-/*)= <expr>`
3. `x ./= <expr>`
4. `copy(x)`
5. `x .= <expr>`
6. `@. <expr>`
1. `copyto!(y, x)`
2. `x .(+/-/*)= <expr>`
3. `x ./= <expr>`
4. `copy(x)`
5. `x .= <expr>`
6. `@. <expr>`
7. `x = copy(y)`
This macro also allows some custom operators:
1. `×` (typed with `\\times<tab>`): This is effectively a matmul operator. It is
rewritten to use `mul!` if `y` can be setindex-ed else it is rewritten to use
`restructure` to create a new array. If there is a `vec` on the rhs, `vec` is also
applied to the lhs. This is useful for handling arbitrary dimensional arrays by
flattening them.
1. `×` (typed with `\\times<tab>`): This is effectively a matmul operator. It is
rewritten to use `mul!` if `y` can be setindex-ed else it is rewritten to use
`restructure` to create a new array. If there is a `vec` on the rhs, `vec` is also
applied to the lhs. This is useful for handling arbitrary dimensional arrays by
flattening them.
!!! warning
Expand Down Expand Up @@ -78,7 +79,7 @@ all operations on the list.
## Main Function
function __bangbang__(M, expr; depth::Int = 1)
new_expr = nothing
if @capture(expr, a_Symbol = copy(b_))
if @capture(expr, a_Symbol=copy(b_))
new_expr = :($(a) = $(__copy)($(setindex_trait)($(b)), $(b)))
elseif @capture(expr, f_(a_Symbol, args__))
g = get(OP_MAPPING, f, nothing)
Expand Down

0 comments on commit 47296a7

Please sign in to comment.