diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 080986e..635cd4b 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-27T01:40:32","documenter_version":"1.8.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-27T22:54:40","documenter_version":"1.8.0"}} \ No newline at end of file diff --git a/dev/index.html b/dev/index.html index fe723d2..ecde156 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,7 +1,15 @@ Home · DiagonalArrays.jl

DiagonalArrays.jl

Stable Dev Build Status Coverage Code Style: Blue Aqua

A n-dimensional diagonal array type in Julia.

Installation instructions

julia> using Pkg: Pkg
 
-julia> Pkg.add("https://github.com/ITensor/DiagonalArrays.jl")

Examples

using DiagonalArrays:
+julia> Pkg.add(url="https://github.com/ITensor/BroadcastMapConversion.jl")
+
+julia> Pkg.add(url="https://github.com/ITensor/NestedPermutedDimsArrays.jl")
+
+julia> Pkg.add(url="https://github.com/ITensor/TypeParameterAccessors.jl")
+
+julia> Pkg.add(url="https://github.com/ITensor/SparseArraysBase.jl")
+
+julia> Pkg.add(url="https://github.com/ITensor/DiagonalArrays.jl")

Examples

using DiagonalArrays:
   DiagonalArray, DiagonalMatrix, DiagIndex, DiagIndices, diaglength, isdiagindex
 using Test: @test
 
@@ -65,4 +73,4 @@
   return nothing
 end
 
-main()

This page was generated using Literate.jl.

+main()

This page was generated using Literate.jl.

diff --git a/dev/search_index.js b/dev/search_index.js index 91fff0a..2bf99e1 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"","page":"Home","title":"Home","text":"EditURL = \"../../examples/README.jl\"","category":"page"},{"location":"#DiagonalArrays.jl","page":"Home","title":"DiagonalArrays.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"(Image: Stable) (Image: Dev) (Image: Build Status) (Image: Coverage) (Image: Code Style: Blue) (Image: Aqua)","category":"page"},{"location":"","page":"Home","title":"Home","text":"A n-dimensional diagonal array type in Julia.","category":"page"},{"location":"#Installation-instructions","page":"Home","title":"Installation instructions","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"julia> using Pkg: Pkg\n\njulia> Pkg.add(\"https://github.com/ITensor/DiagonalArrays.jl\")","category":"page"},{"location":"#Examples","page":"Home","title":"Examples","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"using DiagonalArrays:\n DiagonalArray, DiagonalMatrix, DiagIndex, DiagIndices, diaglength, isdiagindex\nusing Test: @test\n\nfunction main()\n d = DiagonalMatrix([1.0, 2.0, 3.0])\n @test eltype(d) == Float64\n @test diaglength(d) == 3\n @test size(d) == (3, 3)\n @test d[1, 1] == 1\n @test d[2, 2] == 2\n @test d[3, 3] == 3\n @test d[1, 2] == 0\n\n d = DiagonalArray([1.0, 2.0, 3.0], 3, 4, 5)\n @test eltype(d) == Float64\n @test diaglength(d) == 3\n @test d[1, 1, 1] == 1\n @test d[2, 2, 2] == 2\n @test d[3, 3, 3] == 3\n @test d[1, 2, 1] == 0\n\n d[2, 2, 2] = 22\n @test d[2, 2, 2] == 22\n\n d_r = reshape(d, 3, 20)\n @test size(d_r) == (3, 20)\n @test all(I -> d_r[I] == d[I], LinearIndices(d))\n\n @test length(d[DiagIndices(:)]) == 3\n @test Array(d) == d\n @test d[DiagIndex(2)] == d[2, 2, 2]\n\n d[DiagIndex(2)] = 222\n @test d[2, 2, 2] == 222\n\n a = randn(3, 4, 5)\n new_diag = randn(3)\n a[DiagIndices(:)] = new_diag\n d[DiagIndices(:)] = a[DiagIndices(:)]\n\n @test a[DiagIndices(:)] == new_diag\n @test d[DiagIndices(:)] == new_diag\n\n permuted_d = permutedims(d, (3, 2, 1))\n @test permuted_d isa DiagonalArray\n @test permuted_d[DiagIndices(:)] == d[DiagIndices(:)]\n @test size(d) == (3, 4, 5)\n @test size(permuted_d) == (5, 4, 3)\n for I in eachindex(d)\n if !isdiagindex(d, I)\n @test iszero(d[I])\n else\n @test !iszero(d[I])\n end\n end\n\n mapped_d = map(x -> 2x, d)\n @test mapped_d isa DiagonalArray\n @test mapped_d == map(x -> 2x, Array(d))\n\n return nothing\nend\n\nmain()","category":"page"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"","page":"Home","title":"Home","text":"This page was generated using Literate.jl.","category":"page"}] +[{"location":"","page":"Home","title":"Home","text":"EditURL = \"../../examples/README.jl\"","category":"page"},{"location":"#DiagonalArrays.jl","page":"Home","title":"DiagonalArrays.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"(Image: Stable) (Image: Dev) (Image: Build Status) (Image: Coverage) (Image: Code Style: Blue) (Image: Aqua)","category":"page"},{"location":"","page":"Home","title":"Home","text":"A n-dimensional diagonal array type in Julia.","category":"page"},{"location":"#Installation-instructions","page":"Home","title":"Installation instructions","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"julia> using Pkg: Pkg\n\njulia> Pkg.add(url=\"https://github.com/ITensor/BroadcastMapConversion.jl\")\n\njulia> Pkg.add(url=\"https://github.com/ITensor/NestedPermutedDimsArrays.jl\")\n\njulia> Pkg.add(url=\"https://github.com/ITensor/TypeParameterAccessors.jl\")\n\njulia> Pkg.add(url=\"https://github.com/ITensor/SparseArraysBase.jl\")\n\njulia> Pkg.add(url=\"https://github.com/ITensor/DiagonalArrays.jl\")","category":"page"},{"location":"#Examples","page":"Home","title":"Examples","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"using DiagonalArrays:\n DiagonalArray, DiagonalMatrix, DiagIndex, DiagIndices, diaglength, isdiagindex\nusing Test: @test\n\nfunction main()\n d = DiagonalMatrix([1.0, 2.0, 3.0])\n @test eltype(d) == Float64\n @test diaglength(d) == 3\n @test size(d) == (3, 3)\n @test d[1, 1] == 1\n @test d[2, 2] == 2\n @test d[3, 3] == 3\n @test d[1, 2] == 0\n\n d = DiagonalArray([1.0, 2.0, 3.0], 3, 4, 5)\n @test eltype(d) == Float64\n @test diaglength(d) == 3\n @test d[1, 1, 1] == 1\n @test d[2, 2, 2] == 2\n @test d[3, 3, 3] == 3\n @test d[1, 2, 1] == 0\n\n d[2, 2, 2] = 22\n @test d[2, 2, 2] == 22\n\n d_r = reshape(d, 3, 20)\n @test size(d_r) == (3, 20)\n @test all(I -> d_r[I] == d[I], LinearIndices(d))\n\n @test length(d[DiagIndices(:)]) == 3\n @test Array(d) == d\n @test d[DiagIndex(2)] == d[2, 2, 2]\n\n d[DiagIndex(2)] = 222\n @test d[2, 2, 2] == 222\n\n a = randn(3, 4, 5)\n new_diag = randn(3)\n a[DiagIndices(:)] = new_diag\n d[DiagIndices(:)] = a[DiagIndices(:)]\n\n @test a[DiagIndices(:)] == new_diag\n @test d[DiagIndices(:)] == new_diag\n\n permuted_d = permutedims(d, (3, 2, 1))\n @test permuted_d isa DiagonalArray\n @test permuted_d[DiagIndices(:)] == d[DiagIndices(:)]\n @test size(d) == (3, 4, 5)\n @test size(permuted_d) == (5, 4, 3)\n for I in eachindex(d)\n if !isdiagindex(d, I)\n @test iszero(d[I])\n else\n @test !iszero(d[I])\n end\n end\n\n mapped_d = map(x -> 2x, d)\n @test mapped_d isa DiagonalArray\n @test mapped_d == map(x -> 2x, Array(d))\n\n return nothing\nend\n\nmain()","category":"page"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"","page":"Home","title":"Home","text":"This page was generated using Literate.jl.","category":"page"}] }