Files
examples
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
# # BlockSparseArrays.jl # # [](https://itensor.github.io/BlockSparseArrays.jl/stable/) # [](https://itensor.github.io/BlockSparseArrays.jl/dev/) # [](https://github.com/ITensor/BlockSparseArrays.jl/actions/workflows/Tests.yml?query=branch%3Amain) # [](https://codecov.io/gh/ITensor/BlockSparseArrays.jl) # [](https://github.com/invenia/BlueStyle) # [](https://github.com/JuliaTesting/Aqua.jl) # A block sparse array type in Julia based on the [`BlockArrays.jl`](https://github.com/JuliaArrays/BlockArrays.jl) interface. # ## Support # # {CCQ_LOGO} # # BlockSparseArrays.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 julia> using Pkg: Pkg julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry") ``` =# # or: #= ```julia 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 julia> Pkg.add("BlockSparseArrays") ``` =# # ## Examples using BlockArrays: Block using BlockSparseArrays: BlockSparseArray, blockstoredlength using Test: @test a = BlockSparseArray{Float64}(undef, [2, 3], [2, 3]) a[Block(1, 2)] = randn(2, 3) a[Block(2, 1)] = randn(3, 2) @test blockstoredlength(a) == 2 b = a .+ 2 .* a' @test Array(b) ≈ Array(a) + 2 * Array(a') @test blockstoredlength(b) == 2