Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 2.03 KB

README.md

File metadata and controls

53 lines (41 loc) · 2.03 KB

BroadcastMapConversion.jl

Stable Dev Build Status Coverage Code Style: Blue Aqua

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("BroadcastMapConversion")

Examples

using Base.Broadcast: broadcasted
using BroadcastMapConversion: Mapped, mapped
using Test: @test

a = randn(2, 2)
bc = broadcasted(*, 2, a)
m = Mapped(bc)
m′ = mapped(x -> 2x, a)
@test copy(m)  map(m.f, m.args...)
@test copy(m)  copy(m′)
@test copy(m)  copy(bc)
@test axes(m) == axes(bc)
@test copyto!(similar(m, Float64), m)  copyto!(similar(bc, Float64), bc)

This page was generated using Literate.jl.