You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a function blockrange which returns the range of Index values of a specified block or QN. For example:
# Get the range of values of a blockblockrange(i::Index, b::Block) =_blockrange(i, Int(b))
function_blockrange(i::Index, b)
start =1for j in1:b-1
start += ITensors.blockdim(i, j)
endreturn start:start+ITensors.blockdim(i, b)-1endfunctionblockrange(i::Index, find_qn::QN)
# The block the QN is in
b = ITensors.findfirstblock(x ->qn(x) == find_qn, i)
returnblockrange(i, b)
end
The version taking QN may be ambiguous since multiple blocks could have the same QN.
This could also work for an ITensor, where a block or a tuple of QNs in each dimension is specified and it returns a CartesianIndices object for the range of values of the block.
I think better names for this could be eachindex to match with Julia's usage of index or eachval to match with the ITensor usage of val as a value an Index gets set to.
Add a function
blockrange
which returns the range of Index values of a specified block or QN. For example:The version taking
QN
may be ambiguous since multiple blocks could have the same QN.This could also work for an ITensor, where a block or a tuple of QNs in each dimension is specified and it returns a
CartesianIndices
object for the range of values of the block.See the discussion here for a motivating example: http://itensor.org/support/2879/extract-project-iqtensor-on-a-qn-subspace
The text was updated successfully, but these errors were encountered: