|
1 | 1 | <!DOCTYPE html> |
2 | | -<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Home · SparseArraysBase.jl</title><meta name="title" content="Home · SparseArraysBase.jl"/><meta property="og:title" content="Home · SparseArraysBase.jl"/><meta property="twitter:title" content="Home · SparseArraysBase.jl"/><meta name="description" content="Documentation for SparseArraysBase.jl."/><meta property="og:description" content="Documentation for SparseArraysBase.jl."/><meta property="twitter:description" content="Documentation for SparseArraysBase.jl."/><meta property="og:url" content="https://ITensor.github.io/SparseArraysBase.jl/"/><meta property="twitter:url" content="https://ITensor.github.io/SparseArraysBase.jl/"/><link rel="canonical" href="https://ITensor.github.io/SparseArraysBase.jl/"/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href>SparseArraysBase.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li class="is-active"><a class="tocitem" href>Home</a><ul class="internal"><li><a class="tocitem" href="#Installation-instructions"><span>Installation instructions</span></a></li><li><a class="tocitem" href="#Examples"><span>Examples</span></a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Home</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Home</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/ITensor/SparseArraysBase.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/ITensor/SparseArraysBase.jl/blob/main/examples/README.jl" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="SparseArraysBase.jl"><a class="docs-heading-anchor" href="#SparseArraysBase.jl">SparseArraysBase.jl</a><a id="SparseArraysBase.jl-1"></a><a class="docs-heading-anchor-permalink" href="#SparseArraysBase.jl" title="Permalink"></a></h1><p><a href="https://ITensor.github.io/SparseArraysBase.jl/stable/"><img src="https://img.shields.io/badge/docs-stable-blue.svg" alt="Stable"/></a> <a href="https://ITensor.github.io/SparseArraysBase.jl/dev/"><img src="https://img.shields.io/badge/docs-dev-blue.svg" alt="Dev"/></a> <a href="https://github.com/ITensor/SparseArraysBase.jl/actions/workflows/Tests.yml?query=branch%3Amain"><img src="https://github.com/ITensor/SparseArraysBase.jl/actions/workflows/Tests.yml/badge.svg?branch=main" alt="Build Status"/></a> <a href="https://codecov.io/gh/ITensor/SparseArraysBase.jl"><img src="https://codecov.io/gh/ITensor/SparseArraysBase.jl/branch/main/graph/badge.svg" alt="Coverage"/></a> <a href="https://github.com/invenia/BlueStyle"><img src="https://img.shields.io/badge/code%20style-blue-4495d1.svg" alt="Code Style: Blue"/></a> <a href="https://github.com/JuliaTesting/Aqua.jl"><img src="https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg" alt="Aqua"/></a></p><h2 id="Installation-instructions"><a class="docs-heading-anchor" href="#Installation-instructions">Installation instructions</a><a id="Installation-instructions-1"></a><a class="docs-heading-anchor-permalink" href="#Installation-instructions" title="Permalink"></a></h2><p>This package resides in the <code>ITensor/ITensorRegistry</code> local registry. In order to install, simply add that registry through your package manager. This step is only required once.</p><pre><code class="language-julia hljs">julia> using Pkg: Pkg |
| 2 | +<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Home · SparseArraysBase.jl</title><meta name="title" content="Home · SparseArraysBase.jl"/><meta property="og:title" content="Home · SparseArraysBase.jl"/><meta property="twitter:title" content="Home · SparseArraysBase.jl"/><meta name="description" content="Documentation for SparseArraysBase.jl."/><meta property="og:description" content="Documentation for SparseArraysBase.jl."/><meta property="twitter:description" content="Documentation for SparseArraysBase.jl."/><meta property="og:url" content="https://ITensor.github.io/SparseArraysBase.jl/"/><meta property="twitter:url" content="https://ITensor.github.io/SparseArraysBase.jl/"/><link rel="canonical" href="https://ITensor.github.io/SparseArraysBase.jl/"/><script data-outdated-warner src="assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="search_index.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-mocha.css" data-theme-name="catppuccin-mocha"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-macchiato.css" data-theme-name="catppuccin-macchiato"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-frappe.css" data-theme-name="catppuccin-frappe"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/catppuccin-latte.css" data-theme-name="catppuccin-latte"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href>SparseArraysBase.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li class="is-active"><a class="tocitem" href>Home</a><ul class="internal"><li><a class="tocitem" href="#Installation-instructions"><span>Installation instructions</span></a></li><li><a class="tocitem" href="#Examples"><span>Examples</span></a></li></ul></li><li><a class="tocitem" href="reference/">Reference</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>Home</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Home</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/ITensor/SparseArraysBase.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/ITensor/SparseArraysBase.jl/blob/main/examples/README.jl" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="SparseArraysBase.jl"><a class="docs-heading-anchor" href="#SparseArraysBase.jl">SparseArraysBase.jl</a><a id="SparseArraysBase.jl-1"></a><a class="docs-heading-anchor-permalink" href="#SparseArraysBase.jl" title="Permalink"></a></h1><p><a href="https://ITensor.github.io/SparseArraysBase.jl/stable/"><img src="https://img.shields.io/badge/docs-stable-blue.svg" alt="Stable"/></a> <a href="https://ITensor.github.io/SparseArraysBase.jl/dev/"><img src="https://img.shields.io/badge/docs-dev-blue.svg" alt="Dev"/></a> <a href="https://github.com/ITensor/SparseArraysBase.jl/actions/workflows/Tests.yml?query=branch%3Amain"><img src="https://github.com/ITensor/SparseArraysBase.jl/actions/workflows/Tests.yml/badge.svg?branch=main" alt="Build Status"/></a> <a href="https://codecov.io/gh/ITensor/SparseArraysBase.jl"><img src="https://codecov.io/gh/ITensor/SparseArraysBase.jl/branch/main/graph/badge.svg" alt="Coverage"/></a> <a href="https://github.com/invenia/BlueStyle"><img src="https://img.shields.io/badge/code%20style-blue-4495d1.svg" alt="Code Style: Blue"/></a> <a href="https://github.com/JuliaTesting/Aqua.jl"><img src="https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg" alt="Aqua"/></a></p><h2 id="Installation-instructions"><a class="docs-heading-anchor" href="#Installation-instructions">Installation instructions</a><a id="Installation-instructions-1"></a><a class="docs-heading-anchor-permalink" href="#Installation-instructions" title="Permalink"></a></h2><p>This package resides in the <code>ITensor/ITensorRegistry</code> local registry. In order to install, simply add that registry through your package manager. This step is only required once.</p><pre><code class="language-julia hljs">julia> using Pkg: Pkg |
3 | 3 |
|
4 | 4 | julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry") </code></pre><p>or: </p><pre><code class=" language-julia hljs" >julia> Pkg.Registry.add(url=" [email protected]:ITensor/ITensorRegistry.git") </code></pre><p>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. </p><p>Then, the package can be added as usual through the package manager: </p><pre><code class=" language-julia hljs" >julia> Pkg.add("SparseArraysBase") </code></pre><h2 id=" Examples" ><a class=" docs-heading-anchor" href=" #Examples" >Examples </a><a id=" Examples-1" ></a><a class=" docs-heading-anchor-permalink" href=" #Examples" title=" Permalink" ></a></h2><pre><code class=" language-julia hljs" >using SparseArraysBase: |
5 | 5 | SparseArrayDOK, |
|
17 | 17 | zero! |
18 | 18 | using Test: @test, @test_throws |
19 | 19 |
|
20 | | -a = SparseArrayDOK{Float64}(2, 2)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">2×2 SparseArraysBase.SparseMatrixDOK{Float64, typeof(SparseArraysBase.default_getunstoredindex)}: |
| 20 | +a = SparseArrayDOK{Float64}(undef, 2, 2)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">2×2 SparseArraysBase.SparseMatrixDOK{Float64, typeof(SparseArraysBase.default_getunstoredindex)}: |
21 | 21 | ⋅ ⋅ |
22 | 22 | ⋅ ⋅</code></pre><p>AbstractArray interface:</p><pre><code class="language-julia hljs">@test iszero(a) |
23 | 23 | @test iszero(sum(a)) |
|
69 | 69 | @test b == [12, 0] |
70 | 70 | @test storedlength(b) == 1 |
71 | 71 |
|
72 | | -a = SparseArrayDOK{Float64}(2, 2) |
| 72 | +a = SparseArrayDOK{Float64}(undef, 2, 2) |
73 | 73 | a .= 2 |
74 | 74 | for I in eachindex(a) |
75 | 75 | @test a[I] == 2 |
76 | 76 | end |
77 | 77 | @test storedlength(a) == length(a) |
78 | 78 |
|
79 | | -a = SparseArrayDOK{Float64}(2, 2) |
| 79 | +a = SparseArrayDOK{Float64}(undef, 2, 2) |
80 | 80 | fill!(a, 2) |
81 | 81 | for I in eachindex(a) |
82 | 82 | @test a[I] == 2 |
83 | 83 | end |
84 | 84 | @test storedlength(a) == length(a) |
85 | 85 |
|
86 | | -a = SparseArrayDOK{Float64}(2, 2) |
| 86 | +a = SparseArrayDOK{Float64}(undef, 2, 2) |
87 | 87 | fill!(a, 0) |
88 | 88 | @test iszero(a) |
89 | 89 | @test iszero(storedlength(a)) |
90 | 90 |
|
91 | | -a = SparseArrayDOK{Float64}(2, 2) |
| 91 | +a = SparseArrayDOK{Float64}(undef, 2, 2) |
92 | 92 | a[1, 2] = 12 |
93 | 93 | zero!(a) |
94 | 94 | @test iszero(a) |
95 | 95 | @test iszero(storedlength(a)) |
96 | 96 |
|
97 | | -a = SparseArrayDOK{Float64}(2, 2) |
| 97 | +a = SparseArrayDOK{Float64}(undef, 2, 2) |
98 | 98 | a[1, 2] = 12 |
99 | 99 | b = zero(a) |
100 | 100 | @test iszero(b) |
101 | | -@test iszero(storedlength(b))</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi"><span class="sgr32"><span class="sgr1">Test Passed</span></span></code></pre><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><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.1 on <span class="colophon-date" title="Thursday 27 February 2025 04:28">Thursday 27 February 2025</span>. Using Julia version 1.11.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
| 101 | +@test iszero(storedlength(b))</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi"><span class="sgr32"><span class="sgr1">Test Passed</span></span></code></pre><hr/><p><em>This page was generated using <a href="https://github.com/fredrikekre/Literate.jl">Literate.jl</a>.</em></p></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="reference/">Reference »</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.1 on <span class="colophon-date" title="Friday 28 February 2025 14:06">Friday 28 February 2025</span>. Using Julia version 1.11.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html> |
0 commit comments