-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMisc.html
13 lines (9 loc) · 9.34 KB
/
Misc.html
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Linear Algebra · LibCEED.jl Docs</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/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="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-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">LibCEED.jl Docs</span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Home</a></li><li><span class="tocitem">Ceed Objects</span><ul><li><a class="tocitem" href="Ceed.html">Ceed</a></li><li><a class="tocitem" href="CeedVector.html">CeedVector</a></li><li><a class="tocitem" href="ElemRestriction.html">ElemRestriction</a></li><li><a class="tocitem" href="Basis.html">Basis</a></li><li><a class="tocitem" href="QFunction.html">QFunction</a></li><li><a class="tocitem" href="Operator.html">Operator</a></li></ul></li><li><span class="tocitem">Utilities</span><ul><li class="is-active"><a class="tocitem" href="Misc.html">Linear Algebra</a></li><li><a class="tocitem" href="Globals.html">Constants and Enumerations</a></li><li><a class="tocitem" href="Quadrature.html">Quadrature</a></li></ul></li><li><a class="tocitem" href="LibCEED.html">Library configuration</a></li><li><a class="tocitem" href="C.html">Low-level C interface</a></li><li><a class="tocitem" href="UserQFunctions.html">Defining User Q-Functions</a></li><li><a class="tocitem" href="Examples.html">Examples</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"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li><a class="is-disabled">Utilities</a></li><li class="is-active"><a href="Misc.html">Linear Algebra</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="Misc.html">Linear Algebra</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://github.com/CEED/libCEED/blob/master/julia/LibCEED.jl/docs/src/Misc.md" title="Edit on GitHub"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitHub</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="Linear-Algebra"><a class="docs-heading-anchor" href="#Linear-Algebra">Linear Algebra</a><a id="Linear-Algebra-1"></a><a class="docs-heading-anchor-permalink" href="#Linear-Algebra" title="Permalink"></a></h1><p>User Q-functions often perform small (1x1, 2x2, or 3x3) linear algebra operations (determinant, matrix-vector product, etc.) at every Q-point. For good performance, it is important to use specialized versions of these operations for the given size.</p><p>If the matrix or vector is given in a statically sized container (e.g. using <a href="https://github.com/JuliaArrays/StaticArrays.jl/">StaticArrays.jl</a>) then this happens automatically. However, if the matrix is not statically sized, and instead is given as, for example, a view into a larger array, then LibCEED.jl provides some convenient specialized functions.</p><p>In order to allow for generic code, the <a href="Misc.html#LibCEED.CeedDim"><code>CeedDim</code></a> struct is used for dispatch. An object <code>D = CeedDim(dim)</code> can be created, and passed as a second argument to functions like <code>det</code> to choose the specialized implementations. In this case, <code>dim</code> should be known as a compile-time constant, otherwise it will result in a type instability, and give poor performance.</p><p>For example:</p><pre><code class="language-julia-repl">julia> using LibCEED, LinearAlgebra
julia> dim = 3;
julia> J = rand(dim, dim);
julia> det(J) # Slow!
-0.33338234570468905
julia> det(J, CeedDim(dim)) # Fast!
-0.33338234570468905</code></pre><article class="docstring"><header><a class="docstring-binding" id="LibCEED.CeedDim" href="#LibCEED.CeedDim"><code>LibCEED.CeedDim</code></a> — <span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia">CeedDim(dim)</code></pre><p>The singleton object of type <code>CeedDim{dim}</code>, used for dispatch to linear algebra operations specialized for small matrices (1, 2, or 3 dimensions).</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/CEED/libCEED/blob/4018a20a98d451fac24765d3ddb936861647ce8d/julia/LibCEED.jl/src/Misc.jl#L3-L8">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="LinearAlgebra.det-Tuple{Any, CeedDim{1}}" href="#LinearAlgebra.det-Tuple{Any, CeedDim{1}}"><code>LinearAlgebra.det</code></a> — <span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia">det(J, ::CeedDim{dim})</code></pre><p>Specialized determinant calculations for matrices of size 1, 2, or 3.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/CEED/libCEED/blob/4018a20a98d451fac24765d3ddb936861647ce8d/julia/LibCEED.jl/src/Misc.jl#L12-L16">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="LibCEED.setvoigt" href="#LibCEED.setvoigt"><code>LibCEED.setvoigt</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">setvoigt(J::StaticArray{Tuple{D,D},T,2})
setvoigt(J, ::CeedDim{dim})</code></pre><p>Given a symmetric matrix <code>J</code>, return a <code>SVector</code> that encodes <code>J</code> using the <a href="https://en.wikipedia.org/wiki/Voigt_notation">Voigt convention</a>.</p><p>The size of the symmetric matrix <code>J</code> must be known statically, either specified using <a href="Misc.html#LibCEED.CeedDim"><code>CeedDim</code></a> or <code>StaticArray</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/CEED/libCEED/blob/4018a20a98d451fac24765d3ddb936861647ce8d/julia/LibCEED.jl/src/Misc.jl#L27-L36">source</a></section></article><article class="docstring"><header><a class="docstring-binding" id="LibCEED.getvoigt" href="#LibCEED.getvoigt"><code>LibCEED.getvoigt</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia">getvoigt(V, ::CeedDim{dim})</code></pre><p>Given a vector <code>V</code> that encodes a symmetric matrix using the <a href="https://en.wikipedia.org/wiki/Voigt_notation">Voigt convention</a>, return the corresponding <code>SMatrix</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/CEED/libCEED/blob/4018a20a98d451fac24765d3ddb936861647ce8d/julia/LibCEED.jl/src/Misc.jl#L65-L71">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="Operator.html">« Operator</a><a class="docs-footer-nextpage" href="Globals.html">Constants and Enumerations »</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="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Wednesday 1 November 2023 06:18">Wednesday 1 November 2023</span>. Using Julia version 1.9.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>