Skip to content

Commit

Permalink
build based on e0588f2
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Dec 9, 2024
1 parent 2e7ee2a commit f1f0c47
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.11.2","generation_timestamp":"2024-12-03T22:58:57","documenter_version":"1.8.0"}}
{"documenter":{"julia_version":"1.11.2","generation_timestamp":"2024-12-09T01:57:11","documenter_version":"1.8.0"}}
14 changes: 7 additions & 7 deletions dev/blocktensors/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
[1,1,2] = TensorMap(ℂ^1 ← (ℂ^1 ⊗ ℂ^2))
[2,1,2] = TensorMap(ℂ^2 ← (ℂ^1 ⊗ ℂ^2))
[1,2,2] = TensorMap(ℂ^1 ← (ℂ^2 ⊗ ℂ^2))
[2,2,2] = TensorMap(ℂ^2 ← (ℂ^2 ⊗ ℂ^2))</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; eltype(t)</code><code class="nohighlight hljs ansi" style="display:block;">TensorKit.TensorMap{Float64, TensorKit.ComplexSpace, 1, 2, Vector{Float64}}</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; s = sprand(W, 0.5)</code><code class="nohighlight hljs ansi" style="display:block;">2×2×2 SparseBlockTensorMap{TensorKit.TensorMap{Float64, TensorKit.ComplexSpace, 1, 2, Vector{Float64}}}((ℂ^1 ⊕ ℂ^2) ← ((ℂ^1 ⊕ ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^2))) with 4 stored entries:
⎡⠈
⎣⣀⠀⎦</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; eltype(s)</code><code class="nohighlight hljs ansi" style="display:block;">TensorKit.TensorMap{Float64, TensorKit.ComplexSpace, 1, 2, Vector{Float64}}</code></pre><div class="admonition is-info"><header class="admonition-header">Note</header><div class="admonition-body"><p>In analogy to <code>TensorKit</code>, most of the functionality that requires a <code>space</code> object can equally well be called in terms of <code>codomain(space), domain(space)</code>, if that is more convenient.</p></div></div><h3 id="Indexing"><a class="docs-heading-anchor" href="#Indexing">Indexing</a><a id="Indexing-1"></a><a class="docs-heading-anchor-permalink" href="#Indexing" title="Permalink"></a></h3><p>For indexing operators, <code>AbstractBlockTensorMap</code> behaves like an <code>AbstractArray{AbstractTensorMap}</code>, and the individual tensors can be accessed via the <code>getindex</code> and <code>setindex!</code> functions. In particular, the <code>getindex</code> function returns a <code>TT</code> object, and the <code>setindex!</code> function expects a <code>TT</code> object. Both linear and cartesian indexing styles are supported.</p><pre><code class="language-julia-repl hljs" style="display:block;">julia&gt; t[1] isa eltype(t)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; t[1] == t[1, 1, 1]</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; t[2] = 3 * t[2]</code><code class="nohighlight hljs ansi" style="display:block;">TensorMap(ℂ^2 ← (ℂ^1 ⊗ ℂ^1)):
[2,2,2] = TensorMap(ℂ^2 ← (ℂ^2 ⊗ ℂ^2))</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; eltype(t)</code><code class="nohighlight hljs ansi" style="display:block;">TensorKit.TensorMap{Float64, TensorKit.ComplexSpace, 1, 2, Vector{Float64}}</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; s = sprand(W, 0.5)</code><code class="nohighlight hljs ansi" style="display:block;">2×2×2 SparseBlockTensorMap{TensorKit.TensorMap{Float64, TensorKit.ComplexSpace, 1, 2, Vector{Float64}}}((ℂ^1 ⊕ ℂ^2) ← ((ℂ^1 ⊕ ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^2))) with 3 stored entries:
⎡⠈
⎣⢀⢀⎦</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; eltype(s)</code><code class="nohighlight hljs ansi" style="display:block;">TensorKit.TensorMap{Float64, TensorKit.ComplexSpace, 1, 2, Vector{Float64}}</code></pre><div class="admonition is-info"><header class="admonition-header">Note</header><div class="admonition-body"><p>In analogy to <code>TensorKit</code>, most of the functionality that requires a <code>space</code> object can equally well be called in terms of <code>codomain(space), domain(space)</code>, if that is more convenient.</p></div></div><h3 id="Indexing"><a class="docs-heading-anchor" href="#Indexing">Indexing</a><a id="Indexing-1"></a><a class="docs-heading-anchor-permalink" href="#Indexing" title="Permalink"></a></h3><p>For indexing operators, <code>AbstractBlockTensorMap</code> behaves like an <code>AbstractArray{AbstractTensorMap}</code>, and the individual tensors can be accessed via the <code>getindex</code> and <code>setindex!</code> functions. In particular, the <code>getindex</code> function returns a <code>TT</code> object, and the <code>setindex!</code> function expects a <code>TT</code> object. Both linear and cartesian indexing styles are supported.</p><pre><code class="language-julia-repl hljs" style="display:block;">julia&gt; t[1] isa eltype(t)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; t[1] == t[1, 1, 1]</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; t[2] = 3 * t[2]</code><code class="nohighlight hljs ansi" style="display:block;">TensorMap(ℂ^2 ← (ℂ^1 ⊗ ℂ^1)):
[:, :, 1] =
0.9463080999247183
1.0041735072632503</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; s[1] isa eltype(t)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; s[1] == s[1, 1, 1]</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; s[1] += 2 * s[1]</code><code class="nohighlight hljs ansi" style="display:block;">TensorMap(ℂ^1 ← (ℂ^1 ⊗ ℂ^1)):
1.2512361159050966
1.7400403696910351</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; s[1] isa eltype(t)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; s[1] == s[1, 1, 1]</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; s[1] += 2 * s[1]</code><code class="nohighlight hljs ansi" style="display:block;">TensorMap(ℂ^1 ← (ℂ^1 ⊗ ℂ^1)):
[:, :, 1] =
0.0</code></pre><p>Slicing operations are also supported, and the <code>AbstractBlockTensorMap</code> can be sliced in the same way as an <code>AbstractArray{AbstractTensorMap}</code>. There is however one elementary difference: as the slices still contain tensors with the same amount of legs, there can be no reduction in the number of dimensions. In particular, in contrast to <code>AbstractArray</code>, scalar dimensions are not discarded, and as a result, linear index slicing is not allowed.</p><pre><code class="language-julia-repl hljs" style="display:block;">julia&gt; ndims(t[1, 1, :]) == 3</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; ndims(t[:, 1:2, [1, 1]]) == 3</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; t[1:2] # error</code><code class="nohighlight hljs ansi" style="display:block;">ERROR: ArgumentError: Cannot index TensorKit.TensorMapSpace{TensorKit.ComplexSpace, 1, 2}[ℂ^1 ← (ℂ^1 ⊗ ℂ^1) ℂ^1 ← (ℂ^2 ⊗ ℂ^1); ℂ^2 ← (ℂ^1 ⊗ ℂ^1) ℂ^2 ← (ℂ^2 ⊗ ℂ^1);;; ℂ^1 ← (ℂ^1 ⊗ ℂ^2) ℂ^1 ← (ℂ^2 ⊗ ℂ^2); ℂ^2 ← (ℂ^1 ⊗ ℂ^2) ℂ^2 ← (ℂ^2 ⊗ ℂ^2)] with 1:2</code></pre><h3 id="VectorInterface.jl"><a class="docs-heading-anchor" href="#VectorInterface.jl">VectorInterface.jl</a><a id="VectorInterface.jl-1"></a><a class="docs-heading-anchor-permalink" href="#VectorInterface.jl" title="Permalink"></a></h3><p>As part of the <code>TensorKit</code> interface, <code>AbstractBlockTensorMap</code> also implements <code>VectorInterface</code>. This means that you can efficiently add, scale, and compute the inner product of <code>AbstractBlockTensorMap</code> objects.</p><pre><code class="language-julia-repl hljs" style="display:block;">julia&gt; t1, t2 = rand!(similar(t)), rand!(similar(t));</code><code class="nohighlight hljs ansi" style="display:block;"></code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; add(t1, t2, rand())</code><code class="nohighlight hljs ansi" style="display:block;">2×2×2 BlockTensorMap{TensorKit.TensorMap{Float64, TensorKit.ComplexSpace, 1, 2, Vector{Float64}}}((ℂ^1 ⊕ ℂ^2) ← ((ℂ^1 ⊕ ℂ^2) ⊗ (ℂ^1 ⊕ ℂ^2))) with 8 stored entries:
[1,1,1] = TensorMap(ℂ^1 ← (ℂ^1 ⊗ ℂ^1))
Expand All @@ -33,10 +33,10 @@
[1,1,2] = TensorMap(ℂ^1 ← (ℂ^1 ⊗ ℂ^2))
[2,1,2] = TensorMap(ℂ^2 ← (ℂ^1 ⊗ ℂ^2))
[1,2,2] = TensorMap(ℂ^1 ← (ℂ^2 ⊗ ℂ^2))
[2,2,2] = TensorMap(ℂ^2 ← (ℂ^2 ⊗ ℂ^2))</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; inner(t1, t2)</code><code class="nohighlight hljs ansi" style="display:block;">8.698879650960198</code></pre><p>For further in-place and possibly-in-place methods, see <a href="https://github.com/Jutho/VectorInterface.jl"><code>VectorInterface.jl</code></a></p><h3 id="TensorOperations.jl"><a class="docs-heading-anchor" href="#TensorOperations.jl">TensorOperations.jl</a><a id="TensorOperations.jl-1"></a><a class="docs-heading-anchor-permalink" href="#TensorOperations.jl" title="Permalink"></a></h3><p>The <code>TensorOperations.jl</code> interface is also implemented for <code>AbstractBlockTensorMap</code>. In particular, the <code>AbstractBlockTensorMap</code> can be contracted with other <code>AbstractBlockTensorMap</code> objects, as well as with <code>AbstractTensorMap</code> objects. In order for that mix to work, the <code>AbstractTensorMap</code> objects are automatically converted to <code>AbstractBlockTensorMap</code> objects with a single tensor, i.e. the sum spaces will be a sum of one space. As a consequence, as soon as one of the input tensors is blocked, the output tensor will also be blocked, even though its size might be trivial. In these cases, <code>only</code> can be used to retrieve the single element in the <code>BlockTensorMap</code>.</p><pre><code class="language-julia-repl hljs" style="display:block;">julia&gt; @tensor t3[a; b] := t[a; c d] * conj(t[b; c d])</code><code class="nohighlight hljs ansi" style="display:block;">2×2 BlockTensorMap{TensorKit.TensorMap{Float64, TensorKit.ComplexSpace, 1, 1, Vector{Float64}}}((ℂ^1 ⊕ ℂ^2) ← (ℂ^1 ⊕ ℂ^2)) with 4 stored entries:
[2,2,2] = TensorMap(ℂ^2 ← (ℂ^2 ⊗ ℂ^2))</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; inner(t1, t2)</code><code class="nohighlight hljs ansi" style="display:block;">6.054557041711357</code></pre><p>For further in-place and possibly-in-place methods, see <a href="https://github.com/Jutho/VectorInterface.jl"><code>VectorInterface.jl</code></a></p><h3 id="TensorOperations.jl"><a class="docs-heading-anchor" href="#TensorOperations.jl">TensorOperations.jl</a><a id="TensorOperations.jl-1"></a><a class="docs-heading-anchor-permalink" href="#TensorOperations.jl" title="Permalink"></a></h3><p>The <code>TensorOperations.jl</code> interface is also implemented for <code>AbstractBlockTensorMap</code>. In particular, the <code>AbstractBlockTensorMap</code> can be contracted with other <code>AbstractBlockTensorMap</code> objects, as well as with <code>AbstractTensorMap</code> objects. In order for that mix to work, the <code>AbstractTensorMap</code> objects are automatically converted to <code>AbstractBlockTensorMap</code> objects with a single tensor, i.e. the sum spaces will be a sum of one space. As a consequence, as soon as one of the input tensors is blocked, the output tensor will also be blocked, even though its size might be trivial. In these cases, <code>only</code> can be used to retrieve the single element in the <code>BlockTensorMap</code>.</p><pre><code class="language-julia-repl hljs" style="display:block;">julia&gt; @tensor t3[a; b] := t[a; c d] * conj(t[b; c d])</code><code class="nohighlight hljs ansi" style="display:block;">2×2 BlockTensorMap{TensorKit.TensorMap{Float64, TensorKit.ComplexSpace, 1, 1, Vector{Float64}}}((ℂ^1 ⊕ ℂ^2) ← (ℂ^1 ⊕ ℂ^2)) with 4 stored entries:
[1,1] = TensorMap(ℂ^1 ← ℂ^1)
[2,1] = TensorMap(ℂ^2 ← ℂ^1)
[1,2] = TensorMap(ℂ^1 ← ℂ^2)
[2,2] = TensorMap(ℂ^2 ← ℂ^2)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; @tensor t4[a; b] := t[1, :, :][a; c d] * conj(t[1, :, :][b; c d]) # blocktensor * blocktensor = blocktensor</code><code class="nohighlight hljs ansi" style="display:block;">1×1 BlockTensorMap{TensorKit.TensorMap{Float64, TensorKit.ComplexSpace, 1, 1, Vector{Float64}}}(⊕(ℂ^1) ← ⊕(ℂ^1)) with 1 stored entry:
[1,1] = TensorMap(ℂ^1 ← ℂ^1)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; t4 isa AbstractBlockTensorMap</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; only(t4) isa eltype(t4)</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; @tensor t5[a; b] := t[1][a; c d] * conj(t[1:1, 1:1, 1:1][b; c d]) # tensor * blocktensor = blocktensor</code><code class="nohighlight hljs ansi" style="display:block;">1×1 BlockTensorMap{TensorKit.TensorMap{Float64, TensorKit.ComplexSpace, 1, 1, Vector{Float64}}}(⊕(ℂ^1) ← ⊕(ℂ^1)) with 1 stored entry:
[1,1] = TensorMap(ℂ^1 ← ℂ^1)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; t5 isa AbstractBlockTensorMap</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; only(t5) isa eltype(t5)</code><code class="nohighlight hljs ansi" style="display:block;">true</code></pre><h3 id="Factorizations"><a class="docs-heading-anchor" href="#Factorizations">Factorizations</a><a id="Factorizations-1"></a><a class="docs-heading-anchor-permalink" href="#Factorizations" title="Permalink"></a></h3><p>Currently, there is only rudimentary support for factorizations of <code>AbstractBlockTensorMap</code> objects. In particular, the implementations are not yet optimized for performance, and the factorizations are typically carried out by mapping to a dense tensor, and then performing the factorization on that tensor.</p><div class="admonition is-info"><header class="admonition-header">Note</header><div class="admonition-body"><p>Most factorizations do not retain the additional imposed block structure. In particular, constructions of orthogonal bases will typically mix up the subspaces, and as such the resulting vector spaces will be <code>SumSpace</code>s of a single term.</p></div></div></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../sumspaces/">« SumSpace</a><a class="docs-footer-nextpage" href="../lib/">Library »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.8.0 on <span class="colophon-date" title="Tuesday 3 December 2024 22:58">Tuesday 3 December 2024</span>. Using Julia version 1.11.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
[1,1] = TensorMap(ℂ^1 ← ℂ^1)</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; t5 isa AbstractBlockTensorMap</code><code class="nohighlight hljs ansi" style="display:block;">true</code><br/><code class="language-julia-repl hljs" style="display:block;">julia&gt; only(t5) isa eltype(t5)</code><code class="nohighlight hljs ansi" style="display:block;">true</code></pre><h3 id="Factorizations"><a class="docs-heading-anchor" href="#Factorizations">Factorizations</a><a id="Factorizations-1"></a><a class="docs-heading-anchor-permalink" href="#Factorizations" title="Permalink"></a></h3><p>Currently, there is only rudimentary support for factorizations of <code>AbstractBlockTensorMap</code> objects. In particular, the implementations are not yet optimized for performance, and the factorizations are typically carried out by mapping to a dense tensor, and then performing the factorization on that tensor.</p><div class="admonition is-info"><header class="admonition-header">Note</header><div class="admonition-body"><p>Most factorizations do not retain the additional imposed block structure. In particular, constructions of orthogonal bases will typically mix up the subspaces, and as such the resulting vector spaces will be <code>SumSpace</code>s of a single term.</p></div></div></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../sumspaces/">« SumSpace</a><a class="docs-footer-nextpage" href="../lib/">Library »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.8.0 on <span class="colophon-date" title="Monday 9 December 2024 01:57">Monday 9 December 2024</span>. Using Julia version 1.11.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit f1f0c47

Please sign in to comment.