Skip to content

A rewrite of ITensors.jl based on NamedDimsArrays.jl.

License

Notifications You must be signed in to change notification settings

ITensor/ITensorBase.jl

Repository files navigation

ITensorBase.jl

Stable Dev Build Status Coverage Code Style: Blue Aqua

Installation instructions

The package can be added as usual through the package manager:

julia> Pkg.add("ITensorBase")

Examples

using ITensorBase: ITensorBase, ITensor, Index
using LinearAlgebra: qr
using NamedDimsArrays: aligndims, unname
using Test: @test
i = Index(2)
j = Index(2)
k = Index(2)
a = randn(i, j)
@test a[j[2], i[1]] == a[1, 2]
@test a[j => 2, i => 1] == a[1, 2]
a′ = randn(j, i)
b = randn(j, k)
c = a * b
@test unname(c, (i, k))  unname(a, (i, j)) * unname(b, (j, k))
d = a + a′
@test unname(d, (i, j))  unname(a, (i, j)) + unname(a′, (i, j))
@test a  aligndims(a, (j, i))
q, r = qr(a, (i,))
@test q * r  a

Automatic allocation

a = ITensor(i, j)
a[j[1], i[2]] = 1 + 2im
eltype(a) == Complex{Int}
@test a[i[2], j[1]] == 1 + 2im

This page was generated using Literate.jl.

About

A rewrite of ITensors.jl based on NamedDimsArrays.jl.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages