Skip to content

Latest commit

 

History

History
78 lines (61 loc) · 2.54 KB

README.md

File metadata and controls

78 lines (61 loc) · 2.54 KB

ITensorBase.jl

Stable Dev Build Status Coverage Code Style: Blue Aqua

Support

Flatiron Center for Computational Quantum Physics logo.

ITensorBase.jl is supported by the Flatiron Institute, a division of the Simons Foundation.

Installation instructions

This package resides in the ITensor/ITensorRegistry local registry. In order to install, simply add that registry through your package manager. This step is only required once.

julia> using Pkg: Pkg

julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry")

or:

julia> Pkg.Registry.add(url="[email protected]:ITensor/ITensorRegistry.git")

if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages.

Then, 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.