Skip to content

Commit 88510bc

Browse files
committed
fix docstrings
1 parent e970a26 commit 88510bc

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

docs/src/lib/tensors.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Tensor
3434

3535
A `TensorMap` with undefined data can be constructed by specifying its domain and codomain:
3636
```@docs
37-
TensorMap{T}(::UndefInitializer, V::TensorMapSpace{S,N₁,N₂}) where {T,S,N₁,N₂}
37+
TensorMap{T}(::UndefInitializer, V::TensorMapSpace)
3838
```
3939

4040
The resulting object can then be filled with data using the `setindex!` method as discussed
@@ -45,8 +45,8 @@ in an `@tensor output[...] = ...` expression.
4545
Alternatively, a `TensorMap` can be constructed by specifying its data, codmain and domain
4646
in one of the following ways:
4747
```@docs
48-
TensorMap(data::AbstractDict{<:Sector,<:AbstractMatrix}, V::TensorMapSpace{S,N₁,N₂}) where {S,N₁,N₂}
49-
TensorMap(data::AbstractArray, V::TensorMapSpace{S,N₁,N₂}; tol) where {S<:IndexSpace,N₁,N₂}
48+
TensorMap(data::AbstractDict{<:Sector,<:AbstractMatrix}, V::TensorMapSpace)
49+
TensorMap(data::AbstractArray, V::TensorMapSpace; tol)
5050
```
5151

5252
Finally, we also support the following `Array`-like constructors

src/tensors/tensor.jl

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,11 @@ const _Tensor{T, A <: DenseVector{T}, S, N} = Tensor{T, S, N, A}
8787
# - select A and map to _TensorMap{T, A}
8888
# - select S, N1, N2 and map to TensorMap{T,S,N1,N2,A}
8989
"""
90-
TensorMap{T}(undef, codomain::ProductSpace{S,N₁}, domain::ProductSpace{S,N₂}) where {T,S,N₁,N₂}
90+
TensorMap{T}(undef, codomain::ProductSpace{S, N₁}, domain::ProductSpace{S, N₂}) where {T, S, N₁, N₂}
9191
TensorMap{T}(undef, codomain ← domain)
9292
TensorMap{T}(undef, domain → codomain)
93-
# expert mode: select storage type `A`
94-
TensorMap{T,S,N₁,N₂,A}(undef, codomain ← domain)
95-
TensorMap{T,S,N₁,N₂,A}(undef, domain → domain)
9693
97-
Construct a `TensorMap` with uninitialized data.
94+
Construct a `TensorMap` with uninitialized data with elements of type `T`.
9895
"""
9996
TensorMap{T}(::UndefInitializer, V::TensorMapSpace) where {T} =
10097
_TensorMap{T, _tensormap_storagetype(T)}(undef, V)
@@ -103,6 +100,13 @@ TensorMap{T}(::UndefInitializer, codomain::TensorSpace, domain::TensorSpace) whe
103100
Tensor{T}(::UndefInitializer, V::TensorSpace) where {T} = TensorMap{T}(undef, V one(V))
104101

105102
# specifying storagetype, fill in other parameters
103+
"""
104+
(TensorMap{T, S, N₁, N₂, A} where {S, N₁, N₂})(undef, codomain, domain) where {T, A}
105+
(TensorMap{T, S, N₁, N₂, A} where {S, N₁, N₂})(undef, codomain ← domain) where {T, A}
106+
(TensorMap{T, S, N₁, N₂, A} where {S, N₁, N₂})(undef, domain → codomain) where {T, A}
107+
108+
Construct a `TensorMap` with uninitialized data stored as `A <: DenseVector{T}`.
109+
"""
106110
_TensorMap{T, A}(::UndefInitializer, V::TensorMapSpace) where {T, A} =
107111
TensorMap{T, spacetype(V), numout(V), numin(V), A}(undef, V)
108112
_TensorMap{T, A}(::UndefInitializer, codomain::TensorSpace, domain::TensorSpace) where {T, A} =
@@ -126,20 +130,19 @@ _TensorMap{T, A}(data::DenseVector{T}, codomain::TensorSpace, domain::TensorSpac
126130
const _BlockData{I <: Sector, A <: AbstractMatrix} = AbstractDict{I, A}
127131

128132
"""
129-
TensorMap(data::AbstractDict{<:Sector,<:AbstractMatrix}, codomain::ProductSpace{S,N₁},
130-
domain::ProductSpace{S,N₂}) where {S<:ElementarySpace,N₁,N₂}
133+
TensorMap(data::AbstractDict{<:Sector, <:AbstractMatrix}, codomain::ProductSpace, domain::ProductSpace)
131134
TensorMap(data, codomain ← domain)
132135
TensorMap(data, domain → codomain)
133136
134137
Construct a `TensorMap` by explicitly specifying its block data.
135138
136139
## Arguments
137-
- `data::AbstractDict{<:Sector,<:AbstractMatrix}`: dictionary containing the block data for
140+
- `data::AbstractDict{<:Sector, <:AbstractMatrix}`: dictionary containing the block data for
138141
each coupled sector `c` as a matrix of size `(blockdim(codomain, c), blockdim(domain, c))`.
139-
- `codomain::ProductSpace{S,N₁}`: the codomain as a `ProductSpace` of `N₁` spaces of type
140-
`S<:ElementarySpace`.
141-
- `domain::ProductSpace{S,N₂}`: the domain as a `ProductSpace` of `N₂` spaces of type
142-
`S<:ElementarySpace`.
142+
- `codomain::ProductSpace{S, N₁}`: the codomain as a `ProductSpace` of `N₁` spaces of type
143+
`S <: ElementarySpace`.
144+
- `domain::ProductSpace{S, N₂}`: the domain as a `ProductSpace` of `N₂` spaces of type
145+
`S <: ElementarySpace`.
143146
144147
Alternatively, the domain and codomain can be specified by passing a [`HomSpace`](@ref)
145148
using the syntax `codomain ← domain` or `domain → codomain`.

0 commit comments

Comments
 (0)