+<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>The AbstractVectorOfArray and AbstractDiffEqArray Interfaces · RecursiveArrayTools.jl</title><meta name="title" content="The AbstractVectorOfArray and AbstractDiffEqArray Interfaces · RecursiveArrayTools.jl"/><meta property="og:title" content="The AbstractVectorOfArray and AbstractDiffEqArray Interfaces · RecursiveArrayTools.jl"/><meta property="twitter:title" content="The AbstractVectorOfArray and AbstractDiffEqArray Interfaces · RecursiveArrayTools.jl"/><meta name="description" content="Documentation for RecursiveArrayTools.jl."/><meta property="og:description" content="Documentation for RecursiveArrayTools.jl."/><meta property="twitter:description" content="Documentation for RecursiveArrayTools.jl."/><meta property="og:url" content="https://docs.sciml.ai/RecursiveArrayTools/stable/AbstractVectorOfArrayInterface/"/><meta property="twitter:url" content="https://docs.sciml.ai/RecursiveArrayTools/stable/AbstractVectorOfArrayInterface/"/><link rel="canonical" href="https://docs.sciml.ai/RecursiveArrayTools/stable/AbstractVectorOfArrayInterface/"/><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><link href="../assets/favicon.ico" rel="icon" type="image/x-icon"/></head><body><div id="documenter"><nav class="docs-sidebar"><a class="docs-logo" href="../"><img src="../assets/logo.png" alt="RecursiveArrayTools.jl logo"/></a><div class="docs-package-name"><span class="docs-autofit"><a href="../">RecursiveArrayTools.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><a class="tocitem" href="../">Home</a></li><li class="is-active"><a class="tocitem" href>The AbstractVectorOfArray and AbstractDiffEqArray Interfaces</a></li><li><a class="tocitem" href="../array_types/">Recursive Array Types</a></li><li><a class="tocitem" href="../recursive_array_functions/">Recursive Array Functions</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>The AbstractVectorOfArray and AbstractDiffEqArray Interfaces</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>The AbstractVectorOfArray and AbstractDiffEqArray Interfaces</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/SciML/RecursiveArrayTools.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/SciML/RecursiveArrayTools.jl/blob/master/docs/src/AbstractVectorOfArrayInterface.md" 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="The-AbstractVectorOfArray-and-AbstractDiffEqArray-Interfaces"><a class="docs-heading-anchor" href="#The-AbstractVectorOfArray-and-AbstractDiffEqArray-Interfaces">The AbstractVectorOfArray and AbstractDiffEqArray Interfaces</a><a id="The-AbstractVectorOfArray-and-AbstractDiffEqArray-Interfaces-1"></a><a class="docs-heading-anchor-permalink" href="#The-AbstractVectorOfArray-and-AbstractDiffEqArray-Interfaces" title="Permalink"></a></h1><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="RecursiveArrayTools.AbstractVectorOfArray" href="#RecursiveArrayTools.AbstractVectorOfArray"><code>RecursiveArrayTools.AbstractVectorOfArray</code></a> — <span class="docstring-category">Type</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">AbstractVectorOfArray{T, N, A}</code></pre><p>An AbstractVectorOfArray is an object which represents arrays of arrays, and arbitrary recursive nesting of arrays, as a single array-like object. Thus a canonical example of an AbstractVectorOfArray is something of the form <code>VectorOfArray([[1,2],[3,4]])</code>, which "acts" like the matrix [1 3; 2 4] where the data is stored and accessed in a column-ordered fashion (as is typical in Julia), but the actual matrix is never constructed and instead lazily represented through the type.</p><p>An AbstractVectorOfArray subtype should match the following behaviors.</p><div class="admonition is-info" id="Note-63cf71d977e5f159"><header class="admonition-header">Note<a class="admonition-anchor" href="#Note-63cf71d977e5f159" title="Permalink"></a></header><div class="admonition-body"><p>In 2023 the linear indexing <code>A[i]</code><code>was deprecated. It previously had the behavior that</code>A[i] = A.u[i]<code>. However, this is incompatible with standard</code>AbstractArray<code>interfaces, Since if</code>A = VectorOfArray([[1,2],[3,4]])<code>and</code>A<code>is supposed to act like</code>[1 3; 2 4]<code>, then there is a difference</code>A[1] = [1,2]<code>for the VectorOfArray while</code>A[1] = 1<code>for the matrix. This causes many issues if</code>AbstractVectorOfArray <: AbstractArray<code>. Thus we plan in 2026 to complete the deprecation and thus have a breaking update where</code>A[i]<code>matches the linear indexing of an</code>AbstractArray<code>, and then making</code>AbstractVectorOfArray <: AbstractArray<code>. Until then,</code>AbstractVectorOfArray` due to this interface break but manaully implements an AbstractArray-like interface for future compatability.</p></div></div><p><strong>Fields</strong></p><p>An AbstractVectorOfArray has the following fields:</p><ul><li><code>u</code> which holds the Vector of values at each timestep</li></ul><p><strong>Array Interface</strong></p><p>The general operations are as follows. Use</p><pre><code class="language-julia hljs">A.u[j]</code></pre><p>to access the <code>j</code>th array. For multidimensional systems, this will address first by component and lastly by time, and thus</p><pre><code class="language-julia hljs">A[i, j]</code></pre><p>will be the <code>i</code>th component at array <code>j</code>. Hence, <code>A[j][i] == A[i, j]</code>. This is done because Julia is column-major, so the leading dimension should be contiguous in memory. If the independent variables had shape (for example, was a matrix), then <code>i</code> is the linear index. We can also access solutions with shape:</p><pre><code class="language-julia hljs">A[i, k, j]</code></pre><p>gives the <code>[i,k]</code> component of the system at array <code>j</code>. The colon operator is supported, meaning that</p><pre><code class="language-julia hljs">A[i, :]</code></pre><p>gives the timeseries for the <code>i</code>th component.</p><p><strong>Using the AbstractArray Interface</strong></p><p>The <code>AbstractArray</code> interface can be directly used. For example, for a vector system of variables <code>A[i,j]</code> is a matrix with rows being the variables and columns being the timepoints. Operations like <code>A'</code> will transpose the solution type. Functionality written for <code>AbstractArray</code>s can directly use this. For example, the Base <code>cov</code> function computes correlations amongst columns, and thus:</p><pre><code class="language-julia hljs">cov(A)</code></pre><p>computes the correlation of the system state in time, whereas</p><pre><code class="language-julia hljs">cov(A, 2)</code></pre><p>computes the correlation between the variables. Similarly, <code>mean(A,2)</code> is the mean of the variable in time, and <code>var(A,2)</code> is the variance. Other statistical functions and packages which work on <code>AbstractArray</code> types will work on the solution type.</p><p><strong>Conversions</strong></p><p>At anytime, a true <code>Array</code> can be created using <code>Array(A)</code>, or more generally <code>stack(A)</code> to make the array type match the internal array type (for example, if <code>A</code> is an array of GPU arrays, <code>stack(A)</code> will be a GPU array).</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/RecursiveArrayTools.jl/blob/51549ffd3e7c6b80fae483f8e2ab805171b2237c/src/RecursiveArrayTools.jl#L16-L110">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="RecursiveArrayTools.AbstractDiffEqArray" href="#RecursiveArrayTools.AbstractDiffEqArray"><code>RecursiveArrayTools.AbstractDiffEqArray</code></a> — <span class="docstring-category">Type</span><span class="is-flex-grow-1 docstring-article-toggle-button" title="Collapse docstring"></span></header><section><div><pre><code class="language-julia hljs">AbstractDiffEqArray{T, N, A} <: AbstractVectorOfArray{T, N, A}</code></pre><p>An AbstractVectorOfArray object which has extra information of a time array <code>A.t</code> in order to specify a time series. A canonical AbstractDiffEqArray is for example the pairing <code>DiffEqArray([[1,2],[3,4]],[1.0,2.0])</code> which means that at time 1.0 the values were <code>[1,2]</code> and at time 2.0 the values were <code>[3,4]</code>.</p><p>An AbstractDiffEqArray has all of the same behaviors as an AbstractVectorOfArray with the additional properties:</p><p><strong>Fields</strong></p><p>An AbstractDiffEqArray adds the following fields:</p><ul><li><code>t</code> which holds the times of each timestep.</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://github.com/SciML/RecursiveArrayTools.jl/blob/51549ffd3e7c6b80fae483f8e2ab805171b2237c/src/RecursiveArrayTools.jl#L113-L129">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« Home</a><a class="docs-footer-nextpage" href="../array_types/">Recursive Array Types »</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.13.0 on <span class="colophon-date" title="Thursday 3 July 2025 14:43">Thursday 3 July 2025</span>. Using Julia version 1.11.5.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
0 commit comments