Skip to content

Commit bfc9ae7

Browse files
committed
Add documentation blocktype
1 parent 2051327 commit bfc9ae7

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

docs/src/lib/tensors.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ spacetype(::Type{<:AbstractTensorMap{<:Any,S}}) where {S}
8282
sectortype(::Type{TT}) where {TT<:AbstractTensorMap}
8383
field(::Type{TT}) where {TT<:AbstractTensorMap}
8484
storagetype
85+
blocktype
8586
```
8687

8788
To obtain information about the indices, you can use:

src/tensors/abstracttensor.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ sectortype(t::AbstractTensorMap) = sectortype(typeof(t))
195195
InnerProductStyle(t::AbstractTensorMap) = InnerProductStyle(typeof(t))
196196
field(t::AbstractTensorMap) = field(typeof(t))
197197
storagetype(t::AbstractTensorMap) = storagetype(typeof(t))
198+
blocktype(t::AbstractTensorMap) = blocktype(typeof(t))
198199
similarstoragetype(t::AbstractTensorMap, T=scalartype(t)) = similarstoragetype(typeof(t), T)
199200

200201
numout(t::AbstractTensorMap) = numout(typeof(t))
@@ -310,6 +311,15 @@ Return the matrix block of a tensor corresponding to a coupled sector `c`.
310311
See also [`blocks`](@ref), [`blocksectors`](@ref), [`blockdim`](@ref) and [`hasblock`](@ref).
311312
""" block
312313

314+
@doc """
315+
blocktype(t)
316+
317+
Return the type of the matrix blocks of a tensor.
318+
""" blocktype
319+
function blocktype(::Type{T}) where {T<:AbstractTensorMap}
320+
return Core.Compiler.return_type(block, Tuple{T,sectortype(T)})
321+
end
322+
313323
# Derived indexing behavior for tensors with trivial symmetry
314324
#-------------------------------------------------------------
315325
using TensorKit.Strided: SliceIndex

0 commit comments

Comments
 (0)