|
1 | 1 | # TODO: Define this properly. |
| 2 | +# TODO: Rename this to `dual`. |
2 | 3 | dag(i::Index) = i |
3 | 4 | # TODO: Define this properly. |
| 5 | +# TODO: Rename this to `dual`. |
4 | 6 | dag(a::ITensor) = a |
5 | | -# TODO: Deprecate. |
| 7 | + |
| 8 | +# TODO: Deprecate, just use `Int(length(i))` or |
| 9 | +# `unname(length(i))` directly. |
6 | 10 | # Conversion to `Int` is used in case the output is named. |
7 | 11 | dim(i::Index) = Int(length(i)) |
8 | 12 | # TODO: Deprecate. |
9 | 13 | # Conversion to `Int` is used in case the output is named. |
| 14 | +# TODO: Deprecate, just use `Int(length(i))` or |
| 15 | +# `unname(length(i))` directly. |
10 | 16 | dim(a::AbstractITensor) = Int(length(a)) |
| 17 | + |
11 | 18 | # TODO: Define this properly. |
12 | | -hasqns(i::Index) = false |
| 19 | +# TODO: Maybe rename to `isgraded(i::Index) = isgraded(dename(i))`. |
| 20 | +hasqns(::Index) = false |
13 | 21 | # TODO: Define this properly. |
14 | | -hasqns(i::AbstractITensor) = false |
| 22 | +# TODO: Maybe rename to `isgraded(a) = all(isgraded, axes(a))`. |
| 23 | +hasqns(::AbstractITensor) = false |
15 | 24 |
|
16 | 25 | # This seems to be needed to get broadcasting working. |
17 | 26 | # TODO: Investigate this and see if we can get rid of it. |
18 | 27 | Base.Broadcast.extrude(a::AbstractITensor) = a |
19 | 28 |
|
20 | | -# TODO: Generalize this. |
21 | | -# Maybe define it as `oneelement`, and base it on |
22 | | -# `FillArrays.OneElement` (https://juliaarrays.github.io/FillArrays.jl/stable/#FillArrays.OneElement). |
23 | | -function onehot(elt::Type{<:Number}, iv::Pair{<:Index,<:Int}) |
24 | | - a = ITensor(first(iv)) |
25 | | - a[last(iv)] = one(elt) |
26 | | - return a |
27 | | -end |
28 | | -onehot(iv::Pair{<:Index,<:Int}) = onehot(Bool, iv) |
29 | | - |
30 | 29 | # TODO: This is just a stand-in for truncated SVD |
31 | 30 | # that only makes use of `maxdim`, just to get some |
32 | 31 | # functionality running in `ITensorMPS.jl`. |
|
0 commit comments