API
Index
Muscle.TensorMuscle.TensorBase.adjointBase.catBase.conjBase.dropdimsBase.getindexBase.lengthBase.parentBase.permutedimsBase.replaceBase.selectdimBase.setindex!Base.similarBase.sizeBase.viewBase.zeroEinExprs.indsMuscle.binary_einsumMuscle.binary_einsum!Muscle.dimMuscle.expandMuscle.extendMuscle.fuseMuscle.tensor_eigen_thinMuscle.tensor_qr_thinMuscle.tensor_svd_thinMuscle.tensor_svd_truncMuscle.tensor_svd_truncMuscle.unary_einsumMuscle.unary_einsum!
Reference
Muscle.Tensor — TypeTensor{T,N,A<:AbstractArray{T,N}} <: AbstractArray{T,N}An array-like object with named dimensions (i.e. Index).
Muscle.Tensor — MethodTensor(data::AbstractArray{T,N}, inds::AbstractVector{Index})
Tensor(data::AbstractArray{T,N}, inds::NTuple{N,Index}) where {T,N}
Tensor(data::AbstractArray{T,0}) where {T}
Tensor(data::Number)Construct a tensor with the given data and indices.
Base.adjoint — MethodBase.adjoint(::Tensor)Return the adjoint of the tensor.
This method doesn't transpose the array. It is equivalent to conj.
Base.cat — MethodBase.cat(a::Tensor, b::Tensor; dims)Concatenate two tensors a and b along the specified dimensions dims.
The indices of the tensors must be equal, otherwise the second tensor will be permuted to match the first one.
Base.conj — MethodBase.conj(::Tensor)Return the conjugate of the tensor.
Base.dropdims — MethodBase.dropdims(tensor::Tensor; dims)Return a tensor where the dimensions specified by dims are removed. size(tensor, dim) == 1 for each dimension in dims.
Base.getindex — MethodBase.getindex(::Tensor, i...)
Base.getindex(::Tensor; i...)
(::Tensor)[index=i...]Return the element of the tensor at the given indices.
Base.length — MethodBase.length(::Tensor)Return the length of the underlying array.
Base.parent — MethodBase.parent(::Tensor)Return the underlying array of the tensor.
Base.permutedims — MethodBase.permutedims(tensor::Tensor, perm)Permute the dimensions of tensor according to the given permutation perm. The inds will be permuted accordingly.
Base.replace — MethodBase.replace(::Tensor, old_new::Pair{Index,Index}...)Replace the indices of the tensor according to the given pairs of old and new indices.
Base.selectdim — MethodBase.selectdim(tensor::Tensor, dim::Index, i)
Base.selectdim(tensor::Tensor, dim::Integer, i)Return a view of the tensor where the index for dimension dim equals i.
See also: selectdim
Base.setindex! — MethodBase.setindex!(t::Tensor, v, i...)
Base.setindex(::Tensor; i...)
(::Tensor)[index=i...]Set the element of the tensor at the given indices to v.
Base.similar — MethodBase.similar(::Tensor{T,N}[, S::Type, dims::Base.Dims{N}; inds])Return a uninitialize tensor of the same size, eltype and inds as tensor. If S is provided, the eltype of the tensor will be S. If dims is provided, the size of the tensor will be dims.
Base.size — MethodBase.size(::Tensor[, i::Index])Return the size of the underlying array. If the dimension i (specified by Index or Integer) is specified, then the size of the corresponding dimension is returned.
Base.view — MethodBase.view(tensor::Tensor, i...)
Base.view(tensor::Tensor, inds::Pair{<:Index,<:Any}...)Return a view of the tensor with the given indices. If a Pair is given, the index is replaced by the value of the pair.
Base.zero — MethodBase.zero(tensor::Tensor)Return a tensor of the same size, eltype and inds as tensor but filled with zeros.
EinExprs.inds — Methodinds(::Tensor)Return the indices of the Tensor.
Muscle.binary_einsum — Functionbinary_einsum(a::Tensor, b::Tensor; dims=∩(inds(a), inds(b)), out=nothing)Perform a binary tensor contraction operation.
Keyword arguments
- `dims`: indices to contract over. Defaults to the set intersection of the indices of `a` and `b`.
- `out`: indices of the output tensor. Defaults to the set difference of the indices of `a` and `b`.Muscle.binary_einsum! — Functionbinary_einsum!(c::Tensor, a::Tensor, b::Tensor)Perform a binary tensor contraction operation between a and b and store the result in c.
Muscle.dim — Methoddim(tensor::Tensor, i)Return the location of the dimension of tensor corresponding to the given index i.
Muscle.expand — Methodexpand(tensor::Tensor, ind::Index, size; method=:zeros)Pad the tensor along the dimension specified by ind to reach new size. Supported methods are :zeros and :rand.
Muscle.extend — Methodextend(tensor::Tensor; label[, axis=1, size=1, method=:zeros])Expand the tensor by adding a new dimension label with the given size at the specified axis. Currently the supported methods are :zeros and :repeat.
Muscle.fuse — Methodfuse(tensor, parinds; ind=first(parinds))Fuses parinds, leaves them on the right-side internally permuted with permutator and names it as ind.
Muscle.tensor_eigen_thin — FunctionMuscle.tensor_eigen_thin(tensor::Tensor; inds_u, inds_uinv, ind_lambda, kwargs...)Perform eigen factorization on a tensor. Either inds_u or inds_uinv must be specified.
Keyword arguments
inds_u: left / U indices to be used in the eigen factorization, except forind_lambda.inds_uinv: right / right indices to be used in the eigen factorization, except forind_lambda.ind_lambda: name of the virtual bond.inplace: Iftrue, it will useAas workspace variable to save space. Defaults tofalse.kwargs...: additional keyword arguments to be passed toLinearAlgebra.eigen.
Muscle.tensor_qr_thin — Functiontensor_qr_thin(tensor::Tensor; inds_q, inds_r, ind_virtual, kwargs...)Perform QR factorization on a tensor. Either inds_q or inds_r must be specified.
Keyword arguments
inds_q: left indices to be used in the QR factorization. Defaults to all indices oftexceptinds_r.inds_r: right indices to be used in the QR factorization. Defaults to all indices oftexceptinds_q.ind_virtual: name of the virtual bond. Defaults to a randomIndex{Symbol}.
Muscle.tensor_svd_thin — FunctionMuscle.tensor_svd_thin(tensor::Tensor; inds_u, inds_v, ind_s, kwargs...)Perform SVD factorization on a tensor. Either inds_u or inds_v must be specified.
Keyword arguments
inds_u: left / U indices to be used in the SVD factorization, except forind_s.inds_v: right / right indices to be used in the SVD factorization, except forind_s.ind_s: name of the virtual bond.inplace: Iftrue, it will useAas workspace variable to save space. Defaults tofalse.kwargs...: additional keyword arguments to be passed toLinearAlgebra.svd.
Muscle.tensor_svd_trunc — FunctionMuscle.tensor_svd_trunc(tensor::Tensor; inds_u, inds_v, ind_s, threshold, maxbondim, kwargs...)Same as tensorsvdthin() but with truncation, additional keyword arguments are
threshold: relative cutoff for singular valuesmaxdim: maximum bond dimension
Muscle.tensor_svd_trunc — MethodTruncate SVD. With these defaults, it could be used as inplace replacement for tensorsvdthin
Muscle.unary_einsum — Functionunary_einsum(a::Tensor; dims=∩(inds(a), inds(b)), out=nothing)Perform a unary tensor contraction operation.
Keyword arguments
- `dims`: indices to contract over. Defaults to the repeated indices.
- `out`: indices of the output tensor. Defaults to the unique indices.Muscle.unary_einsum! — Functionunary_einsum!(c::Tensor, a::Tensor)Perform a unary tensor contraction operation on a and store the result in c.