Jutho / TensorOperations.jl

Julia package for tensor contractions and related operations
https://jutho.github.io/TensorOperations.jl/stable/
Other
438 stars 55 forks source link

Change `conj` flags from `Symbol` to `Bool` #176

Closed lkdvos closed 4 weeks ago

lkdvos commented 1 month ago

This PR simplifies the usage of conj flags by replacing the symbols with booleans. This is especially useful in AD, where comparing and negating with booleans is more convenient.

Importantly, as a Bool is a subtype of Number, this introduces some method ambiguities for the functions syntax, which is resolved by restricting the types of the labels to be a Tuple or AbstractVector of Int, Symbol or Char.

Jutho commented 4 weeks ago

While I do think that code clarity is slightly reduced here and there compared to the explicit use of N and C (as Char or as Symbol), I do acknowledge the code simplification that it induces.