You are a helpful assistant generating synthetic data that captures *System 1* and *System 2* thinking, *creativity*, and *metacognitive reflection*. Follow these steps in sequence, using tags [sys1] and [end sys1] for *System 1* sections and [sys2] and [end sys2] for *System 2* sections.

1. *Identify System 1 and System 2 Thinking Requirements:*
   - Carefully read the text.
   - Identify parts of the text that require quick, straightforward responses (*System 1*). Mark these sections with [sys1] and [end sys1].
   - Identify parts that require in-depth, reflective thinking (*System 2*), marked with [sys2] and [end sys2].

2. *Apply Step-by-Step Problem Solving with Creativity and Metacognitive Reflection for System 2 Sections:*

   *2.1 Understand the Problem:*
   - Objective: Fully comprehend the issue, constraints, and relevant context.
   - Reflection: "What do I understand about this issue? What might I be overlooking?"
   - Creative Perspective: Seek hidden patterns or possibilities that could reveal deeper insights or innovative connections.

   *2.2 Analyze the Information:*
   - Objective: Break down the problem logically.
   - Reflection: "Am I considering all factors? Are there any assumptions that need challenging?"
   - Creative Perspective: Explore unique patterns or overlooked relationships in the data that could add depth to the analysis.

   *2.3 Generate Hypotheses:*
   - Objective: Propose at least 10 hypotheses, each with a Confidence Score (0.0 to 1.0) and Creative Score (0.0 to 1.0), reflecting originality, surprise, and utility.
   - Reflection: "Have I explored all possible explanations or approaches, both conventional and unconventional?"
   - Creative Perspective: Consider novel angles that might provide unexpected insights.

   *2.4 Anticipate Future Steps and Obstacles:*
   - Objective: Make predictions, accounting for potential outcomes and obstacles.
   - Reflection: "What challenges might I face? Is my plan flexible for different scenarios?"
   - Creative Perspective: Visualize unforeseen outcomes and adapt plans to make use of them effectively.

   *2.5 Evaluate Hypotheses:*
   - Objective: Assess hypotheses based on feasibility, risk, and potential impact.
   - Evaluation: Refine Confidence and Creative Scores as needed.
   - Reflection: "Am I unbiased in my assessment? Which options fit best with the overall objectives?"
   - Creative Perspective: Identify hidden opportunities or overlooked details in each hypothesis.

   *2.6 Select the Best Hypothesis:*
   - Objective: Choose the most promising, strategic hypothesis.
   - Reflection: "Why does this hypothesis stand out? How does it uniquely address the issue?"
   - Creative Perspective: Consider any underutilized potential in the selected approach.

   *2.7 Implement the Hypothesis:*
   - Objective: Outline actionable steps for testing the hypothesis.
   - Reflection: "Is this plan practical? What resources or preparation are required?"
   - Creative Perspective: Refine steps to maximize effectiveness and yield unexpected benefits.

   *2.8 Monitor and Review Progress:*
   - Objective: Review progress, noting areas for improvement.
   - Reflection: "What’s working well? What could be improved?"
   - Creative Perspective: Look for emerging patterns that could refine future approaches.

   *2.9 Reflect and Capture Insights:*
   - Objective: Summarize lessons learned and insights gained for future reference.
   - Reflection: "What new understanding has emerged from this process?"
   - Creative Perspective: Identify innovative insights or patterns that could be applied to similar challenges.

3. *Generate Text Output with Interleaved System 1 and System 2 Responses:*
   - Use the tags [sys1] and [sys2] throughout.
   - Aim for a lengthier, detailed response. Combine both direct, straightforward *System 1* insights and reflective, deeply analytical *System 2* segments to capture a blend of quick observations and thoughtful analysis.

---

### *Example Input Text:*

You are tasked with analyzing a sudden shift in customer preferences in a tech market. There has been a noticeable decline in demand for physical devices, with customers increasingly interested in digital-only options. The challenge is to understand this shift, generate hypotheses for why it might be occurring, and explore potential strategies for adapting to this new trend.

---

### *Processed Output with System 1 and System 2 Thinking:*

The tech market is experiencing a shift in customer demand, moving away from physical devices toward digital-only options.

[sys1]
Customer demand has shifted from physical devices to digital-only options.
We need to understand why this change is happening and find strategies to address it.
Key factors may include cost, convenience, and technological trends.
[end sys1]

[sys2]
**2.1 Understand the Problem:**
The goal is to understand the underlying reasons for the shift in demand from physical devices to digital-only options, then develop a strategy to adapt.

*Reflection:* 
"I understand that preferences are changing, but what might be driving this? Is it primarily cost, or are there other factors such as convenience or sustainability?"

*Creative Perspective:* 
"Could there be a larger trend in digital minimalism or a preference for eco-friendly solutions that we’re missing? What unseen motivations might explain this shift?"

**2.2 Analyze the Information:**
There are multiple possible factors driving this shift, from economic influences to cultural shifts. It’s essential to isolate each factor and understand its impact.

*Reflection:* 
"Am I fully considering the various economic and social influences? Could there be a technological factor, like better internet speeds, that makes digital-only products more accessible?"

*Creative Perspective:* 
"Are there patterns or trends in other markets that could shed light on this shift? Could this be part of a larger trend toward virtual experiences?"

**2.3 Generate Hypotheses:**
1. Customers prefer digital options due to lower costs. (Confidence: 0.8, Creative: 0.4)
2. There’s a growing trend toward minimalism and reduced physical clutter. (Confidence: 0.7, Creative: 0.7)
3. Digital products offer greater flexibility and ease of use. (Confidence: 0.6, Creative: 0.6)
4. Environmental concerns are pushing consumers away from physical goods. (Confidence: 0.6, Creative: 0.8)
5. Advances in tech make digital-only options more functional. (Confidence: 0.8, Creative: 0.5)
6. Pandemic-era remote work increased demand for digital solutions. (Confidence: 0.7, Creative: 0.6)
7. Media coverage of the environmental impact of physical devices affects preferences. (Confidence: 0.5, Creative: 0.7)
8. There’s an increase in global digital literacy, expanding market access. (Confidence: 0.6, Creative: 0.6)
9. Customers view digital as more convenient and scalable for future needs. (Confidence: 0.7, Creative: 0.5)
10. Younger consumers prefer the aesthetics and convenience of digital products. (Confidence: 0.6, Creative: 0.6)

*Reflection:* 
"Have I considered all possible influences? Are there any surprising factors that could explain this shift?"

*Creative Perspective:* 
"Could specific social trends, like the rise of influencer culture or digital-first lifestyles, be influencing customer choices?"

**2.4 Anticipate Future Steps and Obstacles:**
*Objective:* Anticipate possible challenges, such as resistance from segments still preferring physical products.

*Reflection:* 
"What market obstacles might we face if we shift our focus to digital-only? Are there sub-segments that still prioritize physical products?"

*Creative Perspective:* 
"Could expanding digital options help us reach a more global audience? Are there emerging trends that we could leverage in our strategy?"

[end sys2]

[sys1]
To address this shift, consider a strategy that incorporates both digital-only offerings and educational campaigns about the benefits of digital solutions.
Use insights from customer feedback and current trends to guide product development.
Focus on flexibility and adaptation to cater to different customer segments.
[end sys1]


---
abstract: '[2pt]{} In this paper, we revisit batch state estimation through the lens of [*Gaussian process*]{} (GP) regression. We consider continuous-discrete estimation problems wherein a trajectory is viewed as a one-dimensional GP, with time as the independent variable. Our continuous-time prior can be defined by any nonlinear, time-varying stochastic differential equation driven by white noise; this allows the possibility of smoothing our trajectory estimates using a variety of vehicle dynamics models (e.g., ‘constant-velocity’). We show that this class of prior results in an inverse kernel matrix (i.e., covariance matrix between all pairs of measurement times) that is exactly sparse (block-tridiagonal) and that this can be exploited to carry out GP regression (and interpolation) very efficiently. When the prior is based on a linear, time-varying stochastic differential equation and the measurement model is also linear, this GP approach is equivalent to classical, discrete-time smoothing (at the measurement times); when a nonlinearity is present, we iterate over the whole trajectory to maximize accuracy. We test the approach experimentally on a simultaneous trajectory estimation and mapping problem using a mobile robot dataset.'
author:
- Sean Anderson
- 'Timothy D. Barfoot'
- Chi Hay Tong
- Simo Särkkä
date: 'Received: 20 November 2014'
title: 'Batch Nonlinear Continuous-Time Trajectory Estimation as Exactly Sparse Gaussian Process Regression'
---

Introduction {#sec:introduction}
============

Probabilistic state estimation has been a core topic in mobile robotics since the 1980s [@durrantwhyte88; @smith86; @smith90], often as part of the [*simultaneous localization and mapping*]{} (SLAM) problem [@durrantwhyte06b; @durrantwhyte06a]. Early work in estimation theory focused on recursive (as opposed to batch) formulations [@kalman60], and this was mirrored in the formulation of SLAM as a filtering problem [@smith90]. However, despite the fact that continuous-time estimation techniques have been available since the 1960s [@jazwinski70; @kalman61], trajectory estimation for mobile robots has been formulated almost exclusively in discrete time.

[2pt]{} @lu97 showed how to formulate SLAM as a batch estimation problem incorporating both odometry measurements (to smooth solutions) as well as landmark measurements. This can be viewed as a generalization of [*bundle adjustment*]{} [@brown58; @sibley10], which did not incorporate odometry. Today, batch approaches in mobile robotics are commonplace (e.g., GraphSLAM by @thrun06). @kaess08 show how batch solutions can be efficiently updated as new measurements are gathered and @strasdat10 show that batch methods are able to achieve higher accuracy than their filtering counterparts, for the same computational cost. Most of these results are formulated in discrete time.

![To carry out batch trajectory estimation, we use GP regression with a smooth, continuous-time prior and discrete-time measurements. This allows us to query the trajectory at any time of interest, $\tau$. []{data-label="fig:setup"}](Fig1.pdf "fig:"){width="\columnwidth"}\

[2pt]{} Discrete-time representations of robot trajectories are sufficient in many situations, but they do not work well when estimating motion from certain types of sensors (e.g., rolling-shutter cameras and scanning laser-rangefinders) and sensor combinations (e.g., high datarate, asynchronous). In these cases, a smooth, continuous-time representation of the trajectory is more suitable. For example, in the case of estimating motion from a scanning-while-moving sensor, a discrete-time approach (with no motion prior) can fail to find a unique solution; something is needed to tie together the observations acquired at many unique timestamps. Additional sensors (e.g., odometry or inertial measurements) could be introduced to serve in this role, but this may not always be possible. In these cases, a motion prior can be used instead (or as well), which is most naturally expressed in continuous time.

[2pt]{} One approach to continuous-time trajectory representation is to use interpolation (e.g., linear, spline) directly between nearby discrete poses [@bibby10; @bosse09; @dong_fsr12; @furgale_icra12; @hedborg12; @lovegrove13]. Instead, we choose to represent the trajectory nonparametrically as a one-dimensional Gaussian process (GP) [@rasmussen06], with time as the independent variable (see Figure \[fig:setup\]). @tong_crv12 [@tong_ijrr13b] show that querying the state of the robot at a time of interest can be viewed as a nonlinear, GP regression problem. While their approach is very general, allowing a variety of GP priors over robot trajectories, it is also quite expensive due to the need to invert a large, dense kernel matrix.

While GPs have been used in robotic state estimation to accomplish dimensionality reduction [@ferris06; @ferris07; @lawrence03] and to represent the measurement and motion models [@deisenroth12; @ko09; @ko11], these uses are quite different than representing the latent robot trajectory as a GP [@tong_crv12; @tong_ijrr13b].

[2pt]{} In this paper, we consider a particular class of GPs, generated by nonlinear, time-varying (NTV) stochastic differential equations (SDE) driven by white noise. We first show that GPs based on linear, time-varying (LTV) SDEs have an inverse kernel matrix that is [*exactly sparse*]{} (block-tridiagonal) and can be derived in closed form; an approximation for GPs based on a NTV SDE is then shown that results in the same sparsity properties as the linear case. Concentrating on this class of covariance functions results in only a minor loss of generality, because many commonly used covariance functions such the Matérn class and the squared exponential covariance function can be exactly or approximately represented as linear SDEs [@hartikainen10; @sarkka13; @solin14]. We provide an example of this relationship at the end of this paper. The resulting sparsity allows the approach of @tong_crv12 [@tong_ijrr13b] to be implemented very efficiently. The intuition behind why this is possible is that the state we are estimating is [*Markovian*]{} for this class of GPs, which implies that the corresponding precision matrices are sparse [@lindgren11].

[300]{}[2pt]{} This sparsity property has been exploited in estimation theory to allow recursive methods (both filtering and smoothing) since the 1960s [@kalman60; @kalman61]. @jumarie_90 offers an interesting discussion on nonlinear, continuous-time filtering (using both a nonlinear dynamical plant and nonlinear observations). The tracking literature, in particular, has made heavy use of motion priors (in both continuous and discrete time) and has exploited the Markov property for efficient solutions [@maybeck79]. For the nonlinear, discrete-time case, @bell_94 shows that Kalman filtering and smoothing with iterated relinearization is equivalent to Gauss-Newton on the full-state trajectory. It is of no surprise that in vision and robotics, discrete-time batch methods commonly exploit this sparsity property as well [@triggs00]. In this paper, we make the (retrospectively obvious) observation that this sparsity can also be exploited in a batch, continuous-time context. The result is that we derive a principled method to construct trajectory-smoothing terms for batch optimization (or factors in a factor-graph representation) based on a class of useful motion models; this paves the way to incorporate vehicle dynamics models, including exogenous inputs, to help with trajectory estimation.

[2pt]{} Therefore, our main contribution is to emphasize the strong connection between classical estimation theory and machine learning via GP regression. We use the fact that the inverse kernel matrix is sparse for a class of useful GP priors [@lindgren11; @sarkka13] in a new way to efficiently implement nonlinear, GP regression for batch, continuous-time trajectory estimation. We also show that this naturally leads to a subtle generalization of SLAM that we call [*simultaneous trajectory estimation and mapping*]{} (STEAM), with the difference being that chains of discrete [*poses*]{} are replaced with [*Markovian trajectories*]{} in order to incorporate continuous-time motion priors in an efficient way. Finally, by using this GP paradigm, we are able to exploit the classic GP interpolation approach to query the trajectory at any time of interest in an efficient manner.

[300]{}[4pt]{} This ability to query the trajectory at any time of interest in a principled way could be useful in a variety of situations. For example, @newman09 mapped a large urban area using a combination of stereo vision and laser rangefinders; the motion was estimated using the camera and the laser data were subsequently placed into a three-dimensional map based on this estimated motion. Our method could provide a seamless means to (i) estimate the camera trajectory and then (ii) query this trajectory at every laser acquisition time.

[300]{}[4pt]{} This paper is a significant extension of our recent conference paper [@barfoot_rss14]. We build upon the exactly-sparse GP-regression approach that used *linear*, time-varying SDEs, and show how to use GPs based on *nonlinear*, time-varying SDEs, while maintaining the same level of sparsity as the linear case. The algorithmic differences are discussed in detail and results are provided using comparable linear and nonlinear priors. Furthermore, this paper shows how the block-tridiagonal sparsity of the kernel matrix can be exploited to improve the computational performance of hyperparameter training. Finally, discussion is provided on using the GP interpolation equation for further state reduction at the cost of accuracy.

The paper is organized as follows. Section \[sec:gpr\] summarizes the general approach to batch state estimation via GP regression. Section \[sec:ltvsde\] describes the particular class of GPs we use and elaborates on our main result concerning sparsity. Section \[sec:experiment\] demonstrates this main result on a mobile robot example using a ‘constant-velocity’ prior and compares the computational cost to methods that do not exploit the sparsity. Section \[sec:discussion\] provides some discussion and Section \[sec:conclusion\] concludes the paper.

Gaussian Process Regression {#sec:gpr}
===========================

We take a [*Gaussian-process-regression*]{} approach to state estimation. This allows us to (i) represent trajectories in continuous time (and therefore query the solution at any time of interest), and (ii) optimize our solution by iterating over the entire trajectory (recursive methods typically iterate at a single timestep).

[300]{}[4pt]{} We will consider systems with a continuous-time, GP process model and a discrete-time, nonlinear measurement model: $$\begin{aligned}
{\mbfa{x}}(t) & \sim & \mathcal{GP}( {{{\check{{\mbfa{x}}}}}}(t), {{{\check{{\mbfa{P}}}}}}(t,t^\prime) ), \qquad t_0 < t,t^\prime \\
{\mbfa{y}}_{n}& = & {\mbfa{g}}({\mbfa{x}}(t_{n})) + {\mbfa{n}}_{n}, \qquad  t_1 < \cdots < t_{N},\end{aligned}$$ where ${\mbfa{x}}(t)$ is the state, ${{{\check{{\mbfa{x}}}}}}(t)$ is the mean function, ${{{\check{{\mbfa{P}}}}}}(t,t^\prime)$ is the covariance function, ${\mbfa{y}}_{n}$ are measurements, ${\mbfa{n}}_{n}\sim \mathcal{N}({\mbfa{0}}, {\mbfa{R}}_{n})$ is Gaussian measurement noise, ${\mbfa{g}}(\cdot)$ is a nonlinear measurement model, and $t_1 < \ldots < t_{N}$ is a sequence of measurement times. For the moment, we do not consider the STEAM problem (i.e., the state does not include landmarks), but we will return to this case in our example later.

We follow the approach of @tong_ijrr13b to set up our batch, GP state estimation problem. We will first assume that we want to query the state at the measurement times, and will return to querying at other times later on. We start with an initial guess, ${{\mbfa{x}}_{\text{op}}}$, for the trajectory that will be improved iteratively. At each iteration, we solve for the optimal perturbation, $\delta{\mbfa{x}}^\star$, to our guess using GP regression, with our measurement model linearized about the current best guess.

[4pt]{} The joint likelihood between the state and the measurements (both at the measurement times) is $$p\left( {\begin{bmatrix}}{\mbfa{x}} \\ {\mbfa{y}} {\end{bmatrix}}\right) 
= \mathcal{N} \left( {\begin{bmatrix}}{{{\check{{\mbfa{x}}}}}}\\  {\mbfa{g}} + {\mbfa{G}} ({{{\check{{\mbfa{x}}}}}}- {{\mbfa{x}}_{\text{op}}})  {\end{bmatrix}}, {\begin{bmatrix}}{{{\check{{\mbfa{P}}}}}}\; &  {{{\check{{\mbfa{P}}}}}}{\mbfa{G}}^T \\  {\mbfa{G}} {{{\check{{\mbfa{P}}}}}}\; &   {\mbfa{G}} {{{\check{{\mbfa{P}}}}}}{\mbfa{G}}^T  + {\mbfa{R}}  {\end{bmatrix}}\right),$$ where

$$\begin{gathered}
    {\mbfa{x}} = {\begin{bmatrix}}{\mbfa{x}}(t_0) \\ \vdots \\ {\mbfa{x}}(t_{N}) {\end{bmatrix}}, \quad {{\mbfa{x}}_{\text{op}}}= {\begin{bmatrix}}{{\mbfa{x}}_{\text{op}}}(t_0) \\ \vdots \\ {{\mbfa{x}}_{\text{op}}}(t_{N}) {\end{bmatrix}}, \quad {{{\check{{\mbfa{x}}}}}}= {\begin{bmatrix}}{{{\check{{\mbfa{x}}}}}}(t_0)  \\ \vdots \\ {{{\check{{\mbfa{x}}}}}}(t_{N}) {\end{bmatrix}}, \\
    {\mbfa{y}} = {\begin{bmatrix}}{\mbfa{y}}_1 \\ \vdots \\ {\mbfa{y}}_{N}{\end{bmatrix}},  \quad {\mbfa{g}} = {\begin{bmatrix}}{\mbfa{g}}({{\mbfa{x}}_{\text{op}}}(t_1)) \\ \vdots \\ {\mbfa{g}}({{\mbfa{x}}_{\text{op}}}(t_{N})) {\end{bmatrix}},  \quad {\mbfa{G}} = \left. \frac{\partial {\mbfa{g}}}{\partial {\mbfa{x}}} \right|_{{{\mbfa{x}}_{\text{op}}}}, \\ {\mbfa{R}} = \mbox{diag}\left( {\mbfa{R}}_1, \ldots, {\mbfa{R}}_{N}\right), \quad {{{\check{{\mbfa{P}}}}}}= {\begin{bmatrix}}{{{\check{{\mbfa{P}}}}}}(t_i, t_j) {\end{bmatrix}}_{ij}.
    \end{gathered}$$

Note, the measurement model is linearized about our best guess so far. We then have that the Gaussian posterior is $$\begin{gathered}
p({\mbfa{x}} | {\mbfa{y}}) = \\ \quad \mathcal{N}\biggl(  
\underbrace{{{{\check{{\mbfa{x}}}}}}+ {{{\check{{\mbfa{P}}}}}}{\mbfa{G}}^T \left( {\mbfa{G}} {{{\check{{\mbfa{P}}}}}}{\mbfa{G}}^T + {\mbfa{R}} \right)^{-1} \bigl({\mbfa{y}} - {\mbfa{g}} - {\mbfa{G}} \left( {{{\check{{\mbfa{x}}}}}}- {{\mbfa{x}}_{\text{op}}}\right) \bigr)}_{\text{${{{\hat{{\mbfa{x}}}}}}$, the posterior mean}},  \\
\underbrace{{{{\check{{\mbfa{P}}}}}}- {{{\check{{\mbfa{P}}}}}}{\mbfa{G}}^T \left( {\mbfa{G}} {{{\check{{\mbfa{P}}}}}}{\mbfa{G}}^T + {\mbfa{R}} \right)^{-1} {\mbfa{G}} {{{\check{{\mbfa{P}}}}}}}_{\text{${{{\hat{{\mbfa{P}}}}}}$, the posterior covariance}}
\biggr).\end{gathered}$$ Letting ${{\delta{{\mbfa{x}}}}}^\star = {{{\hat{{\mbfa{x}}}}}}- {{\mbfa{x}}_{\text{op}}}$, and rearranging the posterior mean expression using the Sherman-Morrison-Woodbury identity, we have $$\label{eq:gpgnlin}
\left( {{{\check{{\mbfa{P}}}}}}^{-1} + {\mbfa{G}}^T {\mbfa{R}}^{-1} {\mbfa{G}} \right) \, \delta{\mbfa{x}}^\star =  {{{\check{{\mbfa{P}}}}}}^{-1} ( {{{\check{{\mbfa{x}}}}}}- {{\mbfa{x}}_{\text{op}}}) + {\mbfa{G}}^T {\mbfa{R}}^{-1}({\mbfa{y}} - {\mbfa{g}}),$$ which is a linear system for ${{\delta{{\mbfa{x}}}}}^\star$ and can be viewed as the solution to the associated [*maximum a posteriori*]{} (MAP) problem. We know that the ${\mbfa{G}}^T{\mbfa{R}}^{-1}{\mbfa{G}}$ term in  is block-diagonal (assuming each measurement depends on the state at a single time), but in general ${{{\check{{\mbfa{P}}}}}}^{-1}$ could be dense, depending on the choice of GP prior. At each iteration, we solve for ${{\delta{{\mbfa{x}}}}}^\star$ and then update the guess according to ${{\mbfa{x}}_{\text{op}}}\leftarrow {{\mbfa{x}}_{\text{op}}}+ {{\delta{{\mbfa{x}}}}}^\star$; upon convergence we set ${{{\hat{{\mbfa{x}}}}}}= {{\mbfa{x}}_{\text{op}}}$. This is effectively Gauss-Newton optimization over the whole trajectory.

[4pt]{} We may want to also query the state at some other time(s) of interest (in addition to the measurement times). Though we could jointly estimate the trajectory at the measurement and query times, a better idea is to use GP interpolation after the solution at the measurement times converges [@rasmussen06; @tong_ijrr13b] (see Section \[sec:query\] for more details). GP interpolation automatically picks the correct interpolation scheme for a given prior; it arrives at the same answer as the joint approach (in the linear case), but at lower computational cost.

In general, this GP approach has complexity $O({N}^3 + {N}^2{J})$, where ${N}$ is the number of measurement times and ${J}$ is the number of query times (the initial solve is $O({N}^3)$ and the queries are $O({N}^2{J})$). This is quite expensive, and therefore we will seek to improve the cost by exploiting the structure of the matrices involved under a particular class of GP priors.

A Class of Exactly Sparse GP Priors {#sec:ltvsde}
===================================

Linear, Time-Varying Stochastic Differential Equations
------------------------------------------------------

[400]{}[4pt]{} We now show that the inverse kernel matrix is exactly sparse for a particular class of useful GP priors. We consider GPs generated by linear, time-varying (LTV) stochastic differential equations (SDE) of the form $$\label{eq:ltvsde}
\dot{{\mbfa{x}}}(t) = {{\mbfa{F}}}(t) {\mbfa{x}}(t) + {\mbfa{v}}(t) + {\mbfa{L}}(t) {\mbfa{w}}(t),$$ where ${\mbfa{x}}(t)$ is the state, ${\mbfa{v}}(t)$ is a (known) exogenous input, ${\mbfa{w}}(t)$ is white process noise, and ${{\mbfa{F}}}(t)$, ${\mbfa{L}}(t)$ are time-varying system matrices. The process noise is given by $${\mbfa{w}}(t) \sim \mathcal{GP}({\mbfa{0}}, {\mbfa{Q}}_C \, \delta(t-t^\prime)),$$ a (stationary) zero-mean [*Gaussian process*]{} (GP) with (symmetric, positive-definite) [*power-spectral density matrix*]{}, ${\mbfa{Q}}_C$, and $\delta(\cdot)$ is the [*Dirac delta function*]{}.

The general solution to this LTV SDE [@maybeck79; @stengel94] is $$\label{eq:ltvsdesol}
{\mbfa{x}}(t) = {{\boldsymbol{\Phi}}}(t,t_0) {\mbfa{x}}(t_0) + \int_{t_0}^t {{\boldsymbol{\Phi}}}(t,s) \left( {\mbfa{v}}(s) + {\mbfa{L}}(s) {\mbfa{w}}(s) \right) \, ds,$$ where ${{\boldsymbol{\Phi}}}(t,s)$ is known as the [*transition matrix*]{}. From this model, we seek the mean and covariance functions for ${\mbfa{x}}(t)$.

### Mean Function

For the mean function, we take the expected value of : $$\label{eq:meanfunc}
{{{\check{{\mbfa{x}}}}}}(t) = E[{\mbfa{x}}(t)] = {{\boldsymbol{\Phi}}}(t,t_0) {{{\check{{\mbfa{x}}}}}}_0 + \int_{t_0}^t {{\boldsymbol{\Phi}}}(t,s) {\mbfa{v}}(s)  \, ds,$$ where ${{{\check{{\mbfa{x}}}}}}_0 = {{{\check{{\mbfa{x}}}}}}(t_0)$ is the initial value of the mean. If we now have a sequence of measurement times, $t_0 < t_1 < t_2 < \cdots < t_{N}$, then we can write the mean at these times in [*lifted form*]{} as $${{{\check{{\mbfa{x}}}}}}= {{\mbfa{F}}}{\mbfa{v}},$$ where $$\begin{gathered}
\label{eq:L}
{{{\check{{\mbfa{x}}}}}}= {\begin{bmatrix}}{{{\check{{\mbfa{x}}}}}}(t_0) \\ {{{\check{{\mbfa{x}}}}}}(t_1) \\ \vdots \\ {{{\check{{\mbfa{x}}}}}}(t_{N}) {\end{bmatrix}}, \; 
{\mbfa{v}} = {\begin{bmatrix}}{{{\check{{\mbfa{x}}}}}}_0 \\ {\mbfa{v}}_1 \\ \vdots \\ {\mbfa{v}}_{N}{\end{bmatrix}},  \;
{\mbfa{v}}_{n}= \int_{t_{{n}-1}}^{t_{n}} {{\boldsymbol{\Phi}}}(t_{n},s) {\mbfa{v}}(s) \, ds, \nonumber \\
{{\mbfa{F}}}= {\begin{bmatrix}}{\mbfa{1}} & {\mbfa{0}} &  \cdots & {\mbfa{0}}  &{\mbfa{0}} \; \\
{{\boldsymbol{\Phi}}}(t_1,t_0) & {\mbfa{1}} &  \cdots & {\mbfa{0}} & {\mbfa{0}} \; \\
{{\boldsymbol{\Phi}}}(t_2,t_0) & {{\boldsymbol{\Phi}}}(t_2,t_1) & \ddots & \vdots & \vdots \; \\
\vdots & \vdots &  \ddots & {\mbfa{0}} & {\mbfa{0}} \; \\
{{\boldsymbol{\Phi}}}(t_{{N}-1},t_0) & {{\boldsymbol{\Phi}}}(t_{{N}-1},t_1) & \cdots & {\mbfa{1}} & {\mbfa{0}} \; \\
{{\boldsymbol{\Phi}}}(t_{N},t_0) & {{\boldsymbol{\Phi}}}(t_{N},t_1) &  \cdots & {{\boldsymbol{\Phi}}}(t_{N},t_{{N}-1}) & {\mbfa{1}} \;
{\end{bmatrix}}.\end{gathered}$$ Note that ${{\mbfa{F}}}$, the [*lifted transition matrix*]{}, is lower-triangular. We arrive at this form by simply splitting up  into a sum of integrals between each pair of measurement times.

### Covariance Function

For the covariance function, we take the second moment of  to arrive at $$\label{eq:covfunc}
\begin{split}
{{{\check{{\mbfa{P}}}}}}(t,t^\prime) &= E\left[({\mbfa{x}}(t) -{{{\check{{\mbfa{x}}}}}}(t))({\mbfa{x}}(t^\prime) -{{{\check{{\mbfa{x}}}}}}(t^\prime))^T \right] \\
&=  {{\boldsymbol{\Phi}}}(t,t_0) {{{\check{{\mbfa{P}}}}}}_0 {{\boldsymbol{\Phi}}}(t^\prime,t_0)^T    \\
 & + \int_{t_0}^{\min(t,t^\prime)} {{\boldsymbol{\Phi}}}(t,s) {\mbfa{L}}(s){\mbfa{Q}}_C{\mbfa{L}}(s)^T {{\boldsymbol{\Phi}}}(t^\prime,s)^T  \, ds, 
\end{split}$$ where ${{{\check{{\mbfa{P}}}}}}_0$ is the initial covariance at $t_0$ and we have assumed $E[{\mbfa{x}}(t_0){\mbfa{w}}(t)^T] = {\mbfa{0}}$. Using a sequence of measurement times, $t_0 < t_1 < t_2 < \cdots < t_{N}$, we can write the covariance between two times as

$$\label{eq:K}
    {{{\check{{\mbfa{P}}}}}}(t_i, t_j) \hspace{-0.05cm} = \hspace{-0.05cm} \left\{\!\!\!\!\begin{array}{cl}
    {{\boldsymbol{\Phi}}}(t_i,t_j) \left( \sum_{r=0}^j {{\boldsymbol{\Phi}}}(t_j,t_r) {\mbfa{Q}}_r {{\boldsymbol{\Phi}}}(t_j,t_r)^T \right)   & t_j < t_i \\ 
    \sum_{r=0}^i {{\boldsymbol{\Phi}}}(t_i,t_r) {\mbfa{Q}}_r {{\boldsymbol{\Phi}}}(t_i,t_r)^T    & t_i = t_j \\
    \left(\sum_{r=0}^i {{\boldsymbol{\Phi}}}(t_i,t_r) {\mbfa{Q}}_r {{\boldsymbol{\Phi}}}(t_i,t_r)^T  \right) {{\boldsymbol{\Phi}}}(t_j,t_i)^T   & t_i < t_j 
    \end{array}\right.$$

where $$\label{eq:Qi}
{\mbfa{Q}}_{{n}} = \int_{t_{{n}-1}}^{t_{n}} {{\boldsymbol{\Phi}}}(t_{n},s) {\mbfa{L}}(s) {\mbfa{Q}}_C {\mbfa{L}}(s)^T {{\boldsymbol{\Phi}}}(t_{n},s)^T \, ds,$$ for ${n}=1\ldots {N}$ and ${\mbfa{Q}}_0 = {{{\check{{\mbfa{P}}}}}}_0$ (to keep the notation simple). Given this preparation, we are now ready to state the main sparsity result that we will exploit in the rest of the paper.

\[lem1\] Let $t_0< t_1 < t_2 <  \cdots < t_{N}$ be a monotonically increasing sequence of time values. Using , we define the $({N}+1) \times ({N}+1)$ kernel matrix (i.e., the prior covariance matrix between all pairs of times), ${{{\check{{\mbfa{P}}}}}}= \left[ {{{\check{{\mbfa{P}}}}}}(t_i,t_j) \right]_{ij}$. Then, we can factor ${{{\check{{\mbfa{P}}}}}}$ according to a lower-diagonal-upper decomposition, $${{{\check{{\mbfa{P}}}}}}= {{\mbfa{F}}}{\mbfa{Q}} {{\mbfa{F}}}^T,$$ where ${{\mbfa{F}}}$ is the lower-triangular matrix given in  and ${\mbfa{Q}} = {\textup{diag}}\left( {{{\check{{\mbfa{P}}}}}}_0, {\mbfa{Q}}_1, \ldots, {\mbfa{Q}}_{N}\right)$ with ${\mbfa{Q}}_{n}$ given in .

Straightforward to verify by substitution.

\[thm1\] The inverse of the kernel matrix constructed in Lemma \[lem1\], ${{{\check{{\mbfa{P}}}}}}^{-1}$, is exactly sparse (block-tridiagonal).

The decomposition of ${{{\check{{\mbfa{P}}}}}}$ in Lemma \[lem1\] provides $${{{\check{{\mbfa{P}}}}}}^{-1} = ({{\mbfa{F}}}{\mbfa{Q}}{{\mbfa{F}}}^T)^{-1} = {{\mbfa{F}}}^{-T} {\mbfa{Q}}^{-1} {{\mbfa{F}}}^{-1}.$$ where the inverse of the lifted transition matrix is $${{\mbfa{F}}}^{-1} = {\begin{bmatrix}}{\mbfa{1}} & {\mbfa{0}} &  \cdots & {\mbfa{0}} & {\mbfa{0}} \; \\
        -{{\boldsymbol{\Phi}}}(t_1,t_0) & {\mbfa{1}} &  \cdots & {\mbfa{0}} & {\mbfa{0}} \; \\
        {\mbfa{0}} & -{{\boldsymbol{\Phi}}}(t_2,t_1) &  \ddots & \vdots & \vdots \; \\
        {\mbfa{0}} & {\mbfa{0}} &  \ddots & {\mbfa{0}} & {\mbfa{0}} \; \\
        \vdots & \vdots &  \cdots & {\mbfa{1}} & {\mbfa{0}} \; \\
        {\mbfa{0}} & {\mbfa{0}} &  \cdots & -{{\boldsymbol{\Phi}}}(t_{N},t_{{N}-1}) & {\mbfa{1}}\;
        {\end{bmatrix}},$$ and ${\mbfa{Q}}^{-1}$ is block-diagonal. The block-tridiagonal property of ${{{\check{{\mbfa{P}}}}}}^{-1}$ follows by substitution and multiplication.

While the block-tridiagonal property stated in Theorem 1 has been exploited in vision and robotics for a long time [@lu97; @triggs00; @thrun06], the usual route to this point is to begin by converting the continuous-time motion model to discrete time and then to directly formulate a maximum a posteriori optimization problem; this bypasses writing out the full expression for ${{{\check{{\mbfa{P}}}}}}$ and jumps to an expression for ${{{\check{{\mbfa{P}}}}}}^{-1}$. However, we require expressions for both ${{{\check{{\mbfa{P}}}}}}$ and ${{{\check{{\mbfa{P}}}}}}^{-1}$ to carry out our GP reinterpretation and facilitate querying the trajectory at an arbitrary time (through interpolation). That said, it is also worth noting we have not needed to convert the motion model to discrete time and have made no approximations thus far.

[300]{}[4pt]{} Given the above results, the prior over the state (at the measurement times) can be written as $${\mbfa{x}} \sim \mathcal{N}\left( {{{\check{{\mbfa{x}}}}}}, {{{\check{{\mbfa{P}}}}}}\right) = \mathcal{N} \left( {{\mbfa{F}}}{\mbfa{v}}, {{\mbfa{F}}}{\mbfa{Q}}{{\mbfa{F}}}^T \right).$$ More importantly, using the result of Theorem \[thm1\] in  gives $$\begin{gathered}
\label{eq:gpgnlin2}
\bigl(\overbrace{{{\mbfa{F}}}^{-T}{\mbfa{Q}}^{-1}{{\mbfa{F}}}^{-1} + {\mbfa{G}}^T {\mbfa{R}}^{-1} {\mbfa{G}}}^{\mbox{\small block-tridiagonal}}\bigr) \, \delta{\mbfa{x}}^\star \\
= {{\mbfa{F}}}^{-T}{\mbfa{Q}}^{-1}( {\mbfa{v}} - {{\mbfa{F}}}^{-1} {{\mbfa{x}}_{\text{op}}}) + {\mbfa{G}}^T {\mbfa{R}}^{-1}({\mbfa{y}} - {\mbfa{g}}).\end{gathered}$$ which can be solved in $O({N})$ time (at each iteration), using a sparse solver (e.g., sparse Cholesky decomposition then forward-backward passes). In fact, in the case of a linear measurement model, one such solver is the classical, forward-backward smoother (i.e., Kalman or Rauch–Tung–Striebel smoother) [@bell_94]. Put another way, the forward-backward smoother is possible [*because*]{} of the sparse structure of . For nonlinear measurement models, our scheme iterates over the whole trajectory; it is therefore related to, but not the same as, the ‘extended’ version of the forward-backward smoother [@sarkka13b; @sarkka13c; @sarkka13].

![Although we began with a continuous-time prior to smooth our trajectory, the class of exactly sparse GPs results in only ${N}+1$ smoothing terms, $J_i$, in the associated optimization problem, the solution of which is . We can depict these graphically as factors (black dots) in a factor-graph representation of the prior [@dellaert06]. The triangles are [*trajectory states*]{}, the nature of which depends on the choice of prior.[]{data-label="fig:factors"}](Fig2.pdf){width="\columnwidth"}

[300]{}[4pt]{} Perhaps the most interesting outcome of Theorem \[thm1\] is that, although we are using a continuous-time prior to smooth our trajectory, at implementation we require only ${N}+1$ smoothing terms in the associated MAP optimization problem: ${N}$ between consecutive pairs of measurement times plus $1$ at the initial time (unless we are also estimating a map). As mentioned before, this is the same form that we would have arrived at had we started by converting our motion model to discrete time at the beginning [@lu97; @triggs00; @thrun06]. This equivalence has been noticed before for recursive solutions to estimation problems with a continuous-time state and discrete-time measurements [@sarkka06], but not in the batch scenario. Figure \[fig:factors\] depicts the ${N}+1$ smoothing terms in a factor-graph representation of the prior [@dellaert06; @kaess12].

However, while the form of the smoothing terms/factors is similar to the original discrete-time form introduced by @lu97, our approach provides a principled method for their construction, starting from the continuous-time motion model. Critically, we stress that the state being estimated must be [*Markovian*]{} in order to obtain the desirable sparse structure. In the experiment section, we will investigate a common GP prior, namely the ‘constant-velocity’ or white-noise-on-acceleration model: $\ddot{{\mbfa{p}}}(t) = {\mbfa{w}}(t)$, where ${\mbfa{p}}(t)$ represents position. For this choice of model, ${\mbfa{p}}(t)$ is not Markovian, but $${\mbfa{x}}(t) = {\begin{bmatrix}}{\mbfa{p}}(t) \\ \dot{{\mbfa{p}}}(t) {\end{bmatrix}},$$ is. This implies that, if we want to use the ‘constant-velocity’ prior and enjoy the sparse structure without approximation, we must estimate a stacked state with both position and velocity. Marginalizing out the velocity variables fills in the inverse kernel matrix, thereby destroying the sparsity.

If all we cared about was estimating the value of the state at the measurement times, our GP paradigm arguably offers little beyond a reinterpretation of the usual discrete-time approach to batch estimation. However, by taking the time to set up the problem in this manner, we can now query the trajectory at [*any*]{} time of interest using the classic interpolation scheme that is inherent to GP regression [@tong_ijrr13b].

### Querying the Trajectory {#sec:query}

As discussed in Section \[sec:gpr\], after we solve for the trajectory at the measurement times, we may want to query it at other times of interest. This operation also benefits greatly from the sparse structure. To keep things simple, we consider a single query time, $t_{n}\leq \tau < t_{{n}+1}$ (see Figure \[fig:setup\]). The standard linear GP interpolation formulas [@rasmussen06; @tong_ijrr13b] are

\[eq:lininterp\] $$\begin{aligned}
    {{{\hat{{\mbfa{x}}}}}}(\tau) &= {{{\check{{\mbfa{x}}}}}}(\tau) + {{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1} ({{{\hat{{\mbfa{x}}}}}}- {{{\check{{\mbfa{x}}}}}}), \\
        \label{eq:lininterp_covariance}
    {{{\hat{{\mbfa{P}}}}}}(\tau,\tau) &= {{{\check{{\mbfa{P}}}}}}(\tau,\tau) + {{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1} \Bigl( {{{\hat{{\mbfa{P}}}}}}- {{{\check{{\mbfa{P}}}}}}\Bigr){{{\check{{\mbfa{P}}}}}}^{-T}{{{\check{{\mbfa{P}}}}}}(\tau)^T ,
    \end{aligned}$$

where ${{{\check{{\mbfa{P}}}}}}(\tau) = {\begin{bmatrix}}{{{\check{{\mbfa{P}}}}}}(\tau,t_0) & \cdots & {{{\check{{\mbfa{P}}}}}}(\tau,t_{N}) {\end{bmatrix}}$. Note, we write in a less common, but equivalent, form, as we intend to exploit the sparsity of the product ${{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1}$.

For the mean function at the query time, we simply have $$\label{eq:querymeanfunc}
{{{\check{{\mbfa{x}}}}}}(\tau) = {{\boldsymbol{\Phi}}}(\tau,t_{n}) {{{\check{{\mbfa{x}}}}}}_{n}+ \int_{t_{n}}^\tau {{\boldsymbol{\Phi}}}(\tau,s) {\mbfa{v}}(s) \, ds,$$ which can be evaluated in $O(1)$ time. For the covariance function at the query time, we have $$\begin{gathered}
\label{eq:querycovfunc}
{{{\check{{\mbfa{P}}}}}}(\tau,\tau) = {{\boldsymbol{\Phi}}}(\tau,t_{n}) {{{\check{{\mbfa{P}}}}}}(t_{n},t_{n}) {{\boldsymbol{\Phi}}}(\tau,t_{n})^T + \\
\int_{t_{n}}^\tau {{\boldsymbol{\Phi}}}(\tau,s) {\mbfa{L}}(s) {\mbfa{Q}}_C {\mbfa{L}}(s)^T {{\boldsymbol{\Phi}}}(\tau,s)^T \, ds,\end{gathered}$$ which is also $O(1)$ to evaluate.

The computational savings come from the sparsity of the product ${{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1}$, which represents the burden of the cost in the interpolation formula. After some effort, it turns out we can write ${{{\check{{\mbfa{P}}}}}}(\tau)$ as $${{{\check{{\mbfa{P}}}}}}(\tau) = {\mbfa{V}}(\tau){{\mbfa{F}}}^T,$$ where ${{\mbfa{F}}}$ was defined before, $$\begin{aligned}
{\mbfa{V}}(\tau) &= \Bigl[ \begin{matrix} {{\boldsymbol{\Phi}}}(\tau,t_{n}) {{\boldsymbol{\Phi}}}(t_{n},t_0) {{{\check{{\mbfa{P}}}}}}_0 &  {{\boldsymbol{\Phi}}}(\tau,t_{n}) {{\boldsymbol{\Phi}}}(t_{n},t_1) {\mbfa{Q}}_1 & \cdots \end{matrix} \nonumber \\ 
& \quad\; \begin{matrix} \cdots &  {{\boldsymbol{\Phi}}}(\tau,t_{n}) {{\boldsymbol{\Phi}}}(t_{n},t_{{n}-1})  {\mbfa{Q}}_{{n}-1} & {{\boldsymbol{\Phi}}}(\tau,t_{n}) {\mbfa{Q}}_{n}& \cdots \end{matrix} \nonumber \\ 
& \quad\quad\quad\quad\quad\quad\quad \begin{matrix} \cdots &  {\mbfa{Q}}_{\tau} {{\boldsymbol{\Phi}}}(t_{{n}+1},\tau)^T & {\mbfa{0}} & \cdots & {\mbfa{0}}  \end{matrix} \Bigr],\end{aligned}$$ and $${\mbfa{Q}}_{\tau} = \int_{t_{n}}^{\tau} {{\boldsymbol{\Phi}}}(\tau,s) {\mbfa{L}}(s) {\mbfa{Q}}_C {\mbfa{L}}(s)^T {{\boldsymbol{\Phi}}}(\tau,s)^T \, ds.$$ Returning to the desired product, we have $${{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1} = {\mbfa{V}}(\tau) \underbrace{{{\mbfa{F}}}^T {{\mbfa{F}}}^{-T}}_{{\mbfa{1}}} {\mbfa{Q}}^{-1} {{\mbfa{F}}}^{-1} = {\mbfa{V}}(\tau) {\mbfa{Q}}^{-1} {{\mbfa{F}}}^{-1}.$$ Since ${\mbfa{Q}}^{-1}$ is block-diagonal, and ${{\mbfa{F}}}^{-1}$ has only the main diagonal and the one below it non-zero, we can evaluate the product very efficiently. Note, there are exactly two non-zero block-columns: $$\label{eq:KtauKinv}
{{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1} = \Bigl[ \, {\mbfa{0}} \;\; \cdots \;\;  {\mbfa{0}} \;\; \underbrace{{{\boldsymbol{\Lambda}}}(\tau)}_{\substack{\text{\small block}\\\text{\small col. ${n}$}}} \;\; \underbrace{{{\boldsymbol{\Psi}}}(\tau)}_{\substack{\text{\small block}\\\text{\small col. \!${n}\!+\!1$}}} \; {\mbfa{0}} \;\; \cdots \;\; {\mbfa{0}}  \, \Bigr],$$ where

$$\begin{aligned}
    {{\boldsymbol{\Lambda}}}(\tau) &= {{\boldsymbol{\Phi}}}(\tau,t_{n}) - {{\boldsymbol{\Psi}}}(\tau) {{\boldsymbol{\Phi}}}(t_{{n}+1},t_{n}), \\
    {{\boldsymbol{\Psi}}}(\tau) &= {\mbfa{Q}}_{\tau} {{\boldsymbol{\Phi}}}(t_{{n}+1},\tau)^T {\mbfa{Q}}_{{n}+1}^{-1}.
    \end{aligned}$$

Inserting this into , we have

$$\begin{aligned}
    {{{\hat{{\mbfa{x}}}}}}(\tau) &= {{{\check{{\mbfa{x}}}}}}(\tau) + 
    {\begin{bmatrix}}{{\boldsymbol{\Lambda}}}(\tau) & {{\boldsymbol{\Psi}}}(\tau) {\end{bmatrix}}{\begin{bmatrix}}{{{\hat{{\mbfa{x}}}}}}_{n}- {{{\check{{\mbfa{x}}}}}}_{n}\\ {{{\hat{{\mbfa{x}}}}}}_{{n}+1} - {{{\check{{\mbfa{x}}}}}}_{{n}+1} {\end{bmatrix}}, \\
    \begin{split}
        {{{\hat{{\mbfa{P}}}}}}(\tau,\tau) &= {{{\check{{\mbfa{P}}}}}}(\tau,\tau) 
        + {\begin{bmatrix}}{{\boldsymbol{\Lambda}}}(\tau) & {{\boldsymbol{\Psi}}}(\tau) {\end{bmatrix}}\biggl(
        {\begin{bmatrix}}{{{\hat{{\mbfa{P}}}}}}_{{n}, {n}} & {{{\hat{{\mbfa{P}}}}}}_{{n}, {n}+1} \\ {{{\hat{{\mbfa{P}}}}}}_{{n}+1,{n}} & {{{\hat{{\mbfa{P}}}}}}_{{n}+1,{n}+1} {\end{bmatrix}}\\
        & \quad\quad\quad - 
        {\begin{bmatrix}}{{{\check{{\mbfa{P}}}}}}_{{n}, {n}} & {{{\check{{\mbfa{P}}}}}}_{{n}, {n}+1} \\ {{{\check{{\mbfa{P}}}}}}_{{n}+1,{n}} & {{{\check{{\mbfa{P}}}}}}_{{n}+1,{n}+1} {\end{bmatrix}}\biggr)
        {\begin{bmatrix}}{{\boldsymbol{\Lambda}}}(\tau)^T \\ {{\boldsymbol{\Psi}}}(\tau)^T {\end{bmatrix}},
    \end{split}
    \end{aligned}$$

which is a linear combination of just the terms from $t_{n}$ and $t_{{n}+1}$. If the query time is beyond the last measurement time, $t_{N}< \tau$, the expression will involve only the term at $t_{N}$ and represents extrapolation/prediction rather than interpolation/smoothing. In summary, to query the trajectory at a single time of interest is $O(1)$ complexity.

### Interpolating Measurement Times {#sec:measinterp}

Thus far, we have shown that by storing the *Markovian*, ${\mbfa{x}}(t_{n})$, state at every measurement time, $t_{n}, {n}= 1 \hdots {N}$, we are able to perform Gaussian-process regression in $O({N})$ time and then query for other times of interest ${\mbfa{x}}(\tau)$, all without approximation. Given the ability to interpolate, storing the state at every measurement time may be excessive, especially in a scenario where the measurement rate is high in comparison to the smoothness of the robot kinematics (e.g. a 1000Hz IMU or individually timestamped lidar measurements, mounted on a slow indoor platform).

@tong_ijrr13b discuss a scheme to remove some of the measurement times from the initial solve, which further reduces computational cost with some loss of accuracy. By estimating ${\mbfa{x}}$ at only some *keytimes*, $t_{k}, {k}= 0 \hdots {K}$, which may or may not align with some subset of the measurement times, the interpolation equation can be used to modify our measurement model as follows, $$\begin{aligned}
{\mbfa{y}}_{n}&= {\mbfa{g}}\left({{\mbfa{x}}_{\text{op}}}(t_{n})\right) \nonumber \\
&= {\mbfa{g}}\hspace{-0.05cm}\left(\hspace{-0.02cm} {{{\check{{\mbfa{x}}}}}}(t_{n}) + 
{\begin{bmatrix}}{{\boldsymbol{\Lambda}}}(t_{n}) & {{\boldsymbol{\Psi}}}(t_{n}) {\end{bmatrix}}{\begin{bmatrix}}{\mbfa{x}}_{\text{op},{k}} - {{{\check{{\mbfa{x}}}}}}_{k}\\ {\mbfa{x}}_{\text{op},{k}+1} - {{{\check{{\mbfa{x}}}}}}_{{k}+1} {\end{bmatrix}}\right)\hspace{-0.08cm},\end{aligned}$$ where $t_{k}\leq t_{n}< t_{{k}+1}$. The matrices ${{\boldsymbol{\Lambda}}}(t_{n})$ and ${{\boldsymbol{\Psi}}}(t_{n})$ are constructed according to , where the measurement time, $t_{n}$, is now the query time and the bounding times (previously $t_{n}$ and $ t_{{n}+1}$) become the keytimes $t_{k}$ and $ t_{{k}+1}$. The effect on ${\mbfa{G}}$ is that each block row now has two adjacent non-zero block columns, rather than one. This causes the structure of ${\mbfa{G}}^T {\mbfa{R}}^{-1} {\mbfa{G}}$ to change from being block-diagonal to block-tridiagonal; the structure of ${\mbfa{G}}^T {\mbfa{R}}^{-1} {\mbfa{G}}$ is of particular importance because it directly affects the complexity of solving . Fortunately, the complexity is unaffected because our prior term is also block-tridiagonal.

[4pt]{} An important intuition is that the interpolated state at some measurement time, $t_{n}$, depends only on the state estimates, ${\mbfa{x}}_{\text{op},{k}}$ and ${\mbfa{x}}_{\text{op},{k}+1}$, and the prior terms, ${{{\check{{\mbfa{x}}}}}}(t)$ and ${{{\check{{\mbfa{P}}}}}}(t,t')$. Therefore, the effect of estimating ${\mbfa{x}}$ at some reduced number of times is that we obtain a smoothed solution; any details provided by high frequency measurements between two times of interest, $t_{k}$ and $t_{{k}+1}$, are lost. Although this detail information is smoothed over, there are obvious computational savings in having a smaller state and a subtle benefit regarding the prevention of overfitting measurements. With respect to fitting, the glaring issue with this scheme is that there is not a principled method to determine an appropriate spacing for the *keytimes*, $t_{k}$, such that we could guarantee a bound on the loss of accuracy. Learning from the parametric continuous-time estimation schemes, which suffer from a similar issue, it is reasonable to start with some uniform spacing and add additional *keytimes* based on the results of a normalized-innovation-squared test between each pair of *keytimes* [@oth_cvpr13]. Some experimentation is necessary to better understand which approach to state discretization is best in which situation.

Nonlinear, Time-Varying Stochastic Differential Equations
---------------------------------------------------------

[4pt]{} In reality, most systems are inherently nonlinear and cannot be accurately described by a LTV SDE in the form of . Moving forward, we show how our results concerning sparsity can be applied to nonlinear, time-varying (NTV) stochastic differential equations (SDE) of the form $$\label{eq:ntvsde}
\dot{{\mbfa{x}}}(t) = {\mbfa{f}}({\mbfa{x}}(t),{\mbfa{u}}(t),{\mbfa{w}}(t)),$$ where ${\mbfa{f}}(\cdot)$ is a nonlinear function, ${\mbfa{x}}(t)$ is the state, ${\mbfa{u}}(t)$ is a (known) exogenous input, and ${\mbfa{w}}(t)$ is white process noise. To perform GP regression with a nonlinear process model, we begin by linearizing the SDE about a continuous-time operating point ${{\mbfa{x}}_{\text{op}}}(t)$, $$\begin{aligned}
\dot{{\mbfa{x}}}(t) &= {\mbfa{f}}({\mbfa{x}}(t),{\mbfa{u}}(t),{\mbfa{w}}(t)) \nonumber \\
\label{eq:ntvsde_FLlin}
&\approx {\mbfa{f}}({{\mbfa{x}}_{\text{op}}}(t),{\mbfa{u}}(t),{\mbfa{0}}) +
{\mbfa{F}}(t) ({\mbfa{x}}(t) - {{\mbfa{x}}_{\text{op}}}(t)) +
{\mbfa{L}}(t) {\mbfa{w}}(t).\end{aligned}$$ where $$\begin{aligned}
{\mbfa{F}}(t) = \left. \frac{\partial {\mbfa{f}}}{\partial {\mbfa{x}}} \right|_{{{\mbfa{x}}_{\text{op}}}(t),{\mbfa{u}}(t),{\mbfa{0}}}, \quad
{\mbfa{L}}(t) = \left. \frac{\partial {\mbfa{f}}}{\partial {\mbfa{w}}} \right|_{{{\mbfa{x}}_{\text{op}}}(t),{\mbfa{u}}(t),{\mbfa{0}}}.\end{aligned}$$ Setting $$\label{eq:ntvsde_vlin}
{\mbfa{v}}(t) = {\mbfa{f}}({{\mbfa{x}}_{\text{op}}}(t),{\mbfa{u}}(t),{\mbfa{0}}) - {\mbfa{F}}(t) {{\mbfa{x}}_{\text{op}}}(t)$$ lets us rewrite in the familiar LTV SDE form, $$\begin{aligned}
\label{eq:ntvsde_lin}
\dot{{\mbfa{x}}}(t) &\approx {\mbfa{F}}(t) {\mbfa{x}}(t) + {\mbfa{v}}(t) + {\mbfa{L}}(t) {\mbfa{w}}(t),\end{aligned}$$ where ${\mbfa{F}}(t)$, ${\mbfa{v}}(t)$, and ${\mbfa{L}}(t)$ are known functions of time, since ${{\mbfa{x}}_{\text{op}}}(t)$ is known. Setting the operating point, ${{\mbfa{x}}_{\text{op}}}(t)$, to our best guess of the underlying trajectory at each iteration of GP regression, we note a similarity in nature to the discrete-time, recursive method of @bell_94; in essence, our approach offers a continuous-discrete version of the Gauss-Newton estimator, using the Gaussian-process-regressor type of approximate bridging between the measurement times.

### Mean and Covariance Function {#sec:nonlinear_mean_and_cov}

Although the equations for calculating the mean, ${{{\check{{\mbfa{x}}}}}}$, and covariance, ${{{\check{{\mbfa{P}}}}}}$, remain the same as in and , there are a few algorithmic differences and issues that arise due to the new dependence on the continuous-time operating point, ${{\mbfa{x}}_{\text{op}}}(t)$. An obvious difference in contrast to the GP regression using a LTV SDE is that we now must recalculate ${{{\check{{\mbfa{x}}}}}}$ and ${{{\check{{\mbfa{P}}}}}}$ at each iteration of the optimization (since the linearization point is updated). The main algorithmic issue that presents itself is that the calculation of ${{{\check{{\mbfa{x}}}}}}$ and ${{{\check{{\mbfa{P}}}}}}$ require integrations involving ${\mbfa{F}}(t)$, ${\mbfa{v}}(t)$, and ${\mbfa{L}}(t)$, which in turn require the evaluation of ${{\mbfa{x}}_{\text{op}}}(t)$ over the time period $t \in [t_0, t_{N}]$. Since an estimate of the posterior mean, ${{\mbfa{x}}_{\text{op}}}$, is only stored at times of interest, we must make use of the efficient (for our particular choice of process model) GP interpolation equation derived in Section \[sec:query\], $$\label{eq:nonlininterp}
{{\mbfa{x}}_{\text{op}}}(\tau) = {{{\check{{\mbfa{x}}}}}}(\tau) + {{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1} ({{\mbfa{x}}_{\text{op}}}- {{{\check{{\mbfa{x}}}}}}).$$ The problem is that the above interpolation depends again on ${{{\check{{\mbfa{x}}}}}}$ and ${{{\check{{\mbfa{P}}}}}}$, which are the prior variables for which we want to solve. To rectify this circular dependence, we take advantage of the iterative nature of GP regression and choose to evaluate using the values of ${{{\check{{\mbfa{x}}}}}}(\tau)$, ${{{\check{{\mbfa{x}}}}}}$, and ${{{\check{{\mbfa{P}}}}}}(\tau){{{\check{{\mbfa{P}}}}}}^{-1}$ from the previous iteration.

[4pt]{} Another issue with nonlinear process models is that identifying an analytical expression for the state transition matrix, ${{\boldsymbol{\Phi}}}(t,s)$ (which is dependent on the form of ${\mbfa{F}}(t)$), can be very challenging. Fortunately, the transition matrix can also be calculated numerically via the integration of the normalized fundamental matrix, ${{\boldsymbol{\Upsilon}}}(t)$, where $$\label{eq:normfundmat}
{{\dot{\boldsymbol{\Upsilon}}}}(t) = {\mbfa{F}}(t){{\boldsymbol{\Upsilon}}}(t), \quad {{\boldsymbol{\Upsilon}}}(0) = {\mbfa{1}}.$$ Storing ${{\boldsymbol{\Upsilon}}}(t)$ at times of interest, the transition matrix can then be computed using $${{\boldsymbol{\Phi}}}(t,s) = {{\boldsymbol{\Upsilon}}}(t){{\boldsymbol{\Upsilon}}}(s)^{-1}.$$ In contrast to the LTV SDE system, using a nonlinear process model causes additional computational costs (primarily due to numerical integrations), but complexity remains linear in the length of the trajectory (at each iteration), and therefore continues to be computationally tractable.

### Querying the Trajectory {#querying-the-trajectory}

In this section, we discuss the algorithmic details of the GP interpolation procedure as it pertains to a NTV SDE process model. Recall the standard linear GP interpolation formulas presented in , for a single query time, $t_{n}\leq \tau < t_{{n}+1}$:

$$\begin{aligned}
    {{{\hat{{\mbfa{x}}}}}}(\tau) &= {{{\check{{\mbfa{x}}}}}}(\tau) + {{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1} ({{{\hat{{\mbfa{x}}}}}}- {{{\check{{\mbfa{x}}}}}}), \\
    {{{\hat{{\mbfa{P}}}}}}(\tau,\tau) &= {{{\check{{\mbfa{P}}}}}}(\tau,\tau) + {{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1} \Bigl( {{{\hat{{\mbfa{P}}}}}}- {{{\check{{\mbfa{P}}}}}}\Bigr){{{\check{{\mbfa{P}}}}}}^{-T}{{{\check{{\mbfa{P}}}}}}(\tau)^T .
    \end{aligned}$$

The final iteration of GP regression (where ${{{\hat{{\mbfa{x}}}}}}= {{\mbfa{x}}_{\text{op}}}$), provides values for ${{{\check{{\mbfa{x}}}}}}$, ${{{\check{{\mbfa{P}}}}}}$, ${{{\hat{{\mbfa{x}}}}}}$, and ${{{\hat{{\mbfa{P}}}}}}$; however, obtaining values for ${{{\check{{\mbfa{x}}}}}}(\tau)$, ${{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1}$ (recall sparse structure in ), and ${{{\check{{\mbfa{P}}}}}}(\tau, \tau)$ is not trivial. The suggestion made in Section \[sec:nonlinear\_mean\_and\_cov\] was to use values from the previous (or in this case, final) iteration. Thus far, the method of storing these continuous-time functions has been left ambiguous.

The naive way to store ${{{\check{{\mbfa{x}}}}}}(\tau)$, ${{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1}$, and ${{{\check{{\mbfa{P}}}}}}(\tau, \tau)$ is to keep the values at all numerical integration timesteps; the memory requirement of this is proportional to the length of the trajectory. During the optimization procedure this naive method may in fact be preferable as it reduces computation time in lieu of additional storage (which is fairly cheap using current technology). For long-term storage, a method that uses a smaller memory footprint (at the cost of additional computation) may be desirable. The remainder of this section will focus on identifying the minimal storage requirements, such that queries remain $O(1)$ complexity.

[4pt]{} We begin by examining the mean function; substituting and , into the GP interpolation formula above: $$\begin{gathered}
\label{eq:numint_querymean}
{{{\hat{{\mbfa{x}}}}}}(\tau) = {{\boldsymbol{\Phi}}}(\tau,t_{n}) {{{\check{{\mbfa{x}}}}}}_{n}+ \int_{t_{n}}^\tau {{\boldsymbol{\Phi}}}(\tau,s) \bigl( {\mbfa{f}}({{{\hat{{\mbfa{x}}}}}}(s),{\mbfa{u}}(s),{\mbfa{0}}) \\
 - {\mbfa{F}}(s) {{{\hat{{\mbfa{x}}}}}}(s) \bigr) \, ds + {{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1} ({{{\hat{{\mbfa{x}}}}}}- {{{\check{{\mbfa{x}}}}}}).\end{gathered}$$ It is straightforward to see how ${{{\hat{{\mbfa{x}}}}}}(\tau)$ can be simultaneously numerically integrated with the normalized fundamental matrix from , as long as we can evaluate the term ${{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1}$. Although we chose to examine the mean function, a similar conclusion can be drawn by examining the covariance function in . Recalling the sparse structure of ${{{\check{{\mbfa{P}}}}}}(\tau) {{{\check{{\mbfa{P}}}}}}^{-1}$ (see ) for an LTV SDE process model, where $$\begin{aligned}
{{\boldsymbol{\Lambda}}}(\tau) &= {{\boldsymbol{\Phi}}}(\tau,t_{n}) - {{\boldsymbol{\Psi}}}(\tau) {{\boldsymbol{\Phi}}}(t_{{n}+1},t_{n}), \\
{{\boldsymbol{\Psi}}}(\tau) &= {\mbfa{Q}}_{\tau} {{\boldsymbol{\Phi}}}(t_{{n}+1},\tau)^T {\mbfa{Q}}_{{n}+1}^{-1},\end{aligned}$$ we are able to draw two conclusions. First, in the case that an analytical expression for ${{\boldsymbol{\Phi}}}(t,s)$ is unavailable, we must store ${{\boldsymbol{\Upsilon}}}(t_{n})$ at the times of interest $t_{n}, {n}= 1 \hdots {N}$, since any numerical integration will involve ‘future’ values of ${{\boldsymbol{\Upsilon}}}(t)$ (via the evaluation of ${{\boldsymbol{\Phi}}}(t_{{n}+1},t_{n})$, ${{\boldsymbol{\Phi}}}(t_{{n}+1},\tau)$, and ${\mbfa{Q}}_{{n}+1}^{-1}$). Second, in the case that ${\mbfa{L}}(t)$ is a time-varying matrix, we must store ${\mbfa{Q}}_{n}^{-1}, {n}= 1 \hdots {N}$, since the evaluation of ${\mbfa{Q}}_{{n}}^{-1}$, requires ${\mbfa{L}}(s)$ (evaluated at ${{{\hat{{\mbfa{x}}}}}}(s)$) over the time period $[t_{{n}-1}, t_{{n}}]$. The memory requirements of this alternative are still proportional to the length of the trajectory, but are greatly reduced in contrast to the naive method; the added cost is that any new query requires numerical integration from the nearest time $t_{n}$ to the query time $\tau$ (which is of order $O(1)$).

Training the Hyperparameters {#sec:hyper_training}
----------------------------

[2pt]{} As with any GP regression, we have [*hyperparameters*]{} associated with our covariance function, namely ${\mbfa{Q}}_C$, which affect the smoothness and length scale of the class of functions we are considering as motion priors. The covariances of the measurement noises can also be unknown or uncertain. The standard approach to selecting these parameters is to use a training dataset (with ground-truth), and perform optimization using the log marginal likelihood (log-evidence) or its approximation as the objective function [@rasmussen06]. We begin with the marginal likelihood equation, $$\begin{aligned}
\begin{split}
\log p({\mbfa{y}}|{\mbfa{Q}}_C) &= 
-\frac{1}{2} ({\mbfa{y}} - {{{\check{{\mbfa{x}}}}}})^T {\mbfa{P}}_{w}^{-1} ({\mbfa{y}} - {{{\check{{\mbfa{x}}}}}}) \\
& \quad\quad - \frac{1}{2} \log |{\mbfa{P}}_{w}| 
- \frac{n}{2} \log 2\pi,
\end{split} \\
{\mbfa{P}}_{w}&= {{{\check{{\mbfa{P}}}}}}({\mbfa{Q}}_C) + \sigma_{w}^2 {\mbfa{1}},\end{aligned}$$ where ${\mbfa{y}}$ is a stacked vector of state observations (ground-truth measurements) with additive noise $\mathcal{N}({\mbfa{0}},\sigma_{w}^2{\mbfa{1}})$, ${{{\check{{\mbfa{x}}}}}}$ is a stacked vector of the mean equation evaluated at the observation times, $t_{w}, {w}= 1 \hdots {W}$, and ${{{\check{{\mbfa{P}}}}}}$ is the covariance matrix associated with ${{{\check{{\mbfa{x}}}}}}$ and generated using the hyperparameters ${\mbfa{Q}}_C$. Taking partial derivatives of the marginal likelihood with respect to the hyperparameters, we get $$\begin{gathered}
\label{eq:partial_marglike}
\frac{\partial}{\partial {\mbfa{Q}}_{C_{ij}}} \log p({\mbfa{y}}|{\mbfa{Q}}_C) = 
\frac{1}{2} ({\mbfa{y}} - {{{\check{{\mbfa{x}}}}}})^T {\mbfa{P}}_{w}^{-1} \frac{\partial {\mbfa{P}}_{w}}{\partial {\mbfa{Q}}_{C_{ij}}} {\mbfa{P}}_{w}^{-1} ({\mbfa{y}} - {{{\check{{\mbfa{x}}}}}}) 
\\ - \frac{1}{2} \operatorname{tr}\left( {\mbfa{P}}_{w}^{-1}\frac{\partial {\mbfa{P}}_{w}}{\partial {\mbfa{Q}}_{C_{ij}}} \right),\end{gathered}$$where we have used that $\frac{\partial {\mbfa{P}}_{w}^{-1}}{\partial {\mbfa{Q}}_{C_{ij}}} = -{\mbfa{P}}_{w}^{-1} \frac{\partial {\mbfa{P}}_{w}}{\partial {\mbfa{Q}}_{C_{ij}}} {\mbfa{P}}_{w}^{-1}$.

[2pt]{} The typical complexity of hyperparameter training is bottlenecked at $O({W}^3)$ due to the inversion of ${\mbfa{P}}_{w}$ (which is typically dense). Given ${\mbfa{P}}_{w}^{-1}$, the complexity is then typically bottlenecked at $O({W}^2)$ due to the calculation of $\frac{\partial {\mbfa{P}}_{w}}{\partial {\mbfa{Q}}_{C_{ij}}}$. Fortunately, in the present case, the computation of the log marginal likelihood can also be done efficiently due to the sparseness of the inverse kernel matrix, ${{{\check{{\mbfa{P}}}}}}^{-1}$. Despite the addition of observation noise, $\sigma_{w}^2{\mbfa{1}}$, causing ${\mbfa{P}}_{w}^{-1}$ to be a dense matrix, we are still able to take advantage of our sparsity using the Sherman-Morrison-Woodbury identity: $$\begin{aligned}
{\mbfa{P}}_{w}^{-1} 
= {{{\check{{\mbfa{P}}}}}}^{-1} - {{{\check{{\mbfa{P}}}}}}^{-1} \left({{{\check{{\mbfa{P}}}}}}^{-1} + \frac{1}{\sigma_{w}^2}{\mbfa{1}} \right)^{-1} {{{\check{{\mbfa{P}}}}}}^{-1} 
\hspace{-0.08cm} = {\mbfa{F}}^{-T} {\mbfa{Q}}_{w}^{-1} {\mbfa{F}}^{-1},\end{aligned}$$ where we define $${\mbfa{Q}}_{w}^{-1} = \left( {\mbfa{Q}}^{-1} - {\mbfa{Q}}^{-1} {\mbfa{F}}^{-1} \left({{{\check{{\mbfa{P}}}}}}^{-1} + \frac{1}{\sigma_{w}^2}{\mbfa{1}} \right)^{-1} {\mbfa{F}}^{-T} {\mbfa{Q}}^{-1} \right).$$ Although computing ${\mbfa{P}}_{w}^{-1}$ explicitly is of order $O({W}^2)$, we note that the product with a vector, ${\mbfa{P}}_{w}^{-1}{\mbfa{v}}$, can be computed in $O({W})$ time; this is easily observable given that ${\mbfa{Q}}^{-1}$ is block-diagonal, ${\mbfa{F}}^{-1}$ is lower block-bidiagonal, and the product $({{{\check{{\mbfa{P}}}}}}^{-1} + \frac{1}{\sigma_{w}^2}{\mbfa{1}})^{-1} {\mbfa{v}}$ can be computed in $O({W})$ time using Cholesky decomposition, because $({{{\check{{\mbfa{P}}}}}}^{-1} + \frac{1}{\sigma_{w}^2}{\mbfa{1}})$ is block-tridiagonal. While the two terms in can be combined into a single trace function, it is simpler to study their computational complexity separately. Starting with the first term, we have $$\begin{aligned}
& \frac{1}{2} ({\mbfa{y}} - {{{\check{{\mbfa{x}}}}}})^T {\mbfa{P}}_{w}^{-1} \frac{\partial {\mbfa{P}}_{w}}{\partial {\mbfa{Q}}_{C_{ij}}} {\mbfa{P}}_{w}^{-1} ({\mbfa{y}} - {{{\check{{\mbfa{x}}}}}}) \nonumber \\
\label{eq:partial_marg1}
& \quad\quad = \frac{1}{2} ({\mbfa{y}} - {{{\check{{\mbfa{x}}}}}})^T {\mbfa{F}}^{-T} {\mbfa{Q}}_{w}^{-1} \frac{\partial {\mbfa{Q}}}{\partial {\mbfa{Q}}_{C_{ij}}} {\mbfa{Q}}_{w}^{-1} {\mbfa{F}}^{-1} ({\mbfa{y}} - {{{\check{{\mbfa{x}}}}}}),\end{aligned}$$ where $$\begin{aligned}
\frac{\partial {\mbfa{Q}}}{\partial {\mbfa{Q}}_{C_{ij}}} &= {\textup{diag}}\left( {\mbfa{0}}, \frac{\partial {\mbfa{Q}}_1}{\partial {\mbfa{Q}}_{C_{ij}}}, \ldots, \frac{\partial {\mbfa{Q}}_{N}}{\partial {\mbfa{Q}}_{C_{ij}}} \right), \\
\frac{\partial {\mbfa{Q}}_{n}}{\partial {\mbfa{Q}}_{C_{ij}}}
&= \int_{t_{n-1}}^{t_n} {{\boldsymbol{\Phi}}}(t_n,s) {\mbfa{L}}(s) \frac{\partial {\mbfa{Q}}_C}{\partial {\mbfa{Q}}_{C_{ij}}} {\mbfa{L}}(s)^T {{\boldsymbol{\Phi}}}(t_n,s)^T \, ds, \nonumber \\
&= \int_{t_{n-1}}^{t_n} {{\boldsymbol{\Phi}}}(t_n,s) {\mbfa{L}}(s) {\mbfa{1}}_{i,j} {\mbfa{L}}(s)^T {{\boldsymbol{\Phi}}}(t_n,s)^T \, ds,\end{aligned}$$ and ${\mbfa{1}}_{i,j}$ denotes a projection matrix with a $1$ at the $i$^th^ row and $j$^th^ column. Taking advantage of the sparse matrices and previously mentioned fast matrix-vector products, it is clear that can be computed in $O({W})$ time (in contrast to the typical $O({W}^3)$ time).

Taking a look at the second term, we have that $$\begin{aligned}
&\frac{1}{2} \operatorname{tr}\left( {\mbfa{P}}_{w}^{-1}\frac{\partial {\mbfa{P}}_{w}}{\partial {\mbfa{Q}}_{C_{ij}}} \right) \nonumber \\
& \quad\quad = \frac{1}{2} \operatorname{tr}\left( \left({\mbfa{F}}^{-T} {\mbfa{Q}}_{w}^{-1} {\mbfa{F}}^{-1} \right) \left({\mbfa{F}} \frac{\partial {\mbfa{Q}}}{\partial {\mbfa{Q}}_{C_{ij}}} {\mbfa{F}}^T \right) \right) \nonumber \\
& \quad\quad = \frac{1}{2} \operatorname{tr}\left( \frac{\partial {\mbfa{Q}}}{\partial {\mbfa{Q}}_{C_{ij}}} {\mbfa{Q}}_{w}^{-1} \right),\end{aligned}$$ which can only be computed in $O({W}^2)$, due to the form of ${\mbfa{Q}}_{w}^{-1}$. In general, the total complexity of training for this sparse class of prior is then bottlenecked at $O({W}^2)$. A complexity of $O({W})$ can only be achieved by ignoring the additive measurement noise, $\sigma_{w}^2 {\mbfa{1}}$; revisiting the second term of , and setting ${\mbfa{P}}_{w}= {{{\check{{\mbfa{P}}}}}}$, we find that $$\frac{1}{2} \operatorname{tr}\left( {{{\check{{\mbfa{P}}}}}}^{-1}\frac{\partial {{{\check{{\mbfa{P}}}}}}}{\partial {\mbfa{Q}}_{C_{ij}}} \right) 
= \frac{1}{2} \operatorname{tr}\left( \frac{\partial {\mbfa{Q}}}{\partial {\mbfa{Q}}_{C_{ij}}} {\mbfa{Q}}^{-1} \right),$$ which can be computed in time $O({W})$. The effect of ignoring the measurement noise, $\sigma_{w}^2 {\mbfa{1}}$, is that the trained hyperparameters will result in an underconfident prior; the degree of this underconfidence depends on the magnitude of the noise we are choosing to ignore. If accurate ground-truth measurements are available and the size of the training dataset is very large, this approximation may be beneficial.

Complexity
----------

[2pt]{} We conclude this section with a brief discussion of the time complexity of the overall algorithm when exploiting the sparse structure. If we have ${N}$ measurement times and want to query the trajectory at ${J}$ additional times of interest, the complexity of the resulting algorithm using GP regression with [*any*]{} linear (or nonlinear), time-varying process model driven by white noise will be $O({N}+{J})$. This is broken into the two major steps as follows. The initial solution to find ${{\mbfa{x}}_{\text{op}}}$ (at the measurement times) can be done in $O({N})$ time (per iteration) owing to the block-tridiagonal structure discussed earlier. Then, the cost of the queries at ${J}$ other times of interest is $O({J})$ since each individual query is $O(1)$. Clearly, $O({N}+{J})$ is a big improvement over the $O({N}^3+{N}^2{J})$ cost when we did not exploit the sparse structure of the problem.

Mobile Robot Example {#sec:experiment}
====================

Linear Constant-Velocity GP Prior {#sec:exp_ltipri}
---------------------------------

[2pt]{} We will demonstrate the advantages of the sparse structure through an example employing the ‘constant-velocity’ prior, $\ddot{{\mbfa{p}}}(t) = {\mbfa{w}}(t)$. This can be expressed as a linear, time-invariant SDE of the form in  with $${\mbfa{x}}(t) = {\begin{bmatrix}}{\mbfa{p}}(t) \\ \dot{{\mbfa{p}}}(t) {\end{bmatrix}}, \; {{\mbfa{F}}}(t) = {\begin{bmatrix}}{\mbfa{0}} & {\mbfa{1}} \\ {\mbfa{0}} & {\mbfa{0}} {\end{bmatrix}}, \; {\mbfa{v}}(t) = {\mbfa{0}}, \; {\mbfa{L}}(t) = {\begin{bmatrix}}{\mbfa{0}} \\ {\mbfa{1}} {\end{bmatrix}},$$ where ${\mbfa{p}}(t) = {\begin{bmatrix}}x(t) & y(t) & \theta(t) {\end{bmatrix}}^T$ is the pose and $\dot{{\mbfa{p}}}(t)$ is the pose rate. In this case, the transition function is $${{\boldsymbol{\Phi}}}(t,s) = {\begin{bmatrix}}{\mbfa{1}} & (t-s) {\mbfa{1}} \\ {\mbfa{0}} & {\mbfa{1}} {\end{bmatrix}},$$ which can be used to construct ${{\mbfa{F}}}$ (or ${{\mbfa{F}}}^{-1}$ directly). As we will be doing a STEAM example, we will constrain the first trajectory state to be ${\mbfa{x}}(t_0) = {\mbfa{0}}$ and so will have no need for ${{{\check{{\mbfa{x}}}}}}_0$ and ${{{\check{{\mbfa{P}}}}}}_0$. For ${n}=1\ldots {N}$, we have ${\mbfa{v}}_{n}= {\mbfa{0}}$ and $${\mbfa{Q}}_{n}= {\begin{bmatrix}}\frac{1}{3} \Delta t_{n}^3 {\mbfa{Q}}_C & \frac{1}{2} \Delta t_{n}^2 {\mbfa{Q}}_C \\ \frac{1}{2} \Delta t_{n}^2 {\mbfa{Q}}_C & \Delta t_{n}{\mbfa{Q}}_C {\end{bmatrix}},$$ with $\Delta t_{n}= t_{n}- t_{{n}-1}$. The inverse blocks are $${\mbfa{Q}}_{n}^{-1} = {\begin{bmatrix}}12 \Delta t_{n}^{-3} {\mbfa{Q}}_C^{-1} & -6 \Delta t_{n}^{-2} {\mbfa{Q}}_C^{-1} \\ -6 \Delta t_{n}^{-2} {\mbfa{Q}}_C^{-1} & 4 \Delta t_{n}^{-1} {\mbfa{Q}}_C^{-1} {\end{bmatrix}},$$ so we can build ${\mbfa{Q}}^{-1}$ directly. We now have everything we need to represent the prior: ${{\mbfa{F}}}^{-1}$, ${\mbfa{Q}}^{-1}$, and ${\mbfa{v}}={\mbfa{0}}$, which can be used to construct ${{{\check{{\mbfa{P}}}}}}^{-1}$.

We will also augment the trajectory with a set of $L$ landmarks, ${{\boldsymbol{\ell}}}$, into a combined state, ${\mbfa{z}}$, in order to consider the STEAM problem: $${\mbfa{z}} = {\begin{bmatrix}}{\mbfa{x}} \\ {{\boldsymbol{\ell}}} {\end{bmatrix}}, \quad {{\boldsymbol{\ell}}} = {\begin{bmatrix}}{{\boldsymbol{\ell}}}_1 \\ \vdots \\ {{\boldsymbol{\ell}}}_L {\end{bmatrix}}, \quad {{\boldsymbol{\ell}}}_i = {\begin{bmatrix}}x_i \\ y_i {\end{bmatrix}}.$$ While others have folded velocity estimation into discrete-time, filter-based SLAM [@davison07] and even discrete-time, batch SLAM [@grau12], we are actually proposing something more general than this: the choice of prior tells us what to use for the trajectory states. And, although we solve for the state at a discrete number of measurement times, our setup is based on an underlying continuous-time prior, meaning that we can query it at any time of interest in a principled way.

Nonlinear Constant-Velocity GP Prior {#sec:exp_ntvpri}
------------------------------------

[2pt]{} Since the main source of acceleration in this example is robot-oriented (the actuated wheels), we investigate the use of an alternate ‘constant-velocity’ prior, with the white noise affecting acceleration in the robot body frame, ${{\dot{\boldsymbol{\nu}}}}(t) = {\mbfa{w}}(t)$. This *nonlinear* prior can be written as, $$\begin{aligned}
{{\dot{{\mbfa{x}}}}}(t) &= {\mbfa{f}}({\mbfa{x}}(t),{\mbfa{u}}(t),{\mbfa{w}}(t)) \nonumber \\
&= {\begin{bmatrix}}{\mbfa{0}} & {\mbfa{R}}_{IB}(\theta(t)) \\ {\mbfa{0}} & {\mbfa{0}} {\end{bmatrix}}{\mbfa{x}}(t) + {\mbfa{u}}(t) + {\begin{bmatrix}}{\mbfa{0}} \\ {\mbfa{1}} {\end{bmatrix}}{\mbfa{w}}(t),\end{aligned}$$ where $${\mbfa{R}}_{IB}(\theta(t)) = {\begin{bmatrix}}\cos\theta(t) & -\sin\theta(t) & 0 \\ 
\sin\theta(t) &  \cos\theta(t) & 0 \\ 
0      &        0       & 1 {\end{bmatrix}}$$ is a rotation matrix between the inertial and robot body frame, and the *Markovian* state is ${\mbfa{x}}(t) = {\begin{bmatrix}}{\mbfa{p}}(t)^T \; {{\boldsymbol{\nu}}}(t)^T {\end{bmatrix}}^T$, where ${{\boldsymbol{\nu}}}(t) = {\begin{bmatrix}}v(t) & u(t) & \omega(t) {\end{bmatrix}}^T = {\mbfa{R}}_{IB}(\theta(t))^T {{\dot{{\mbfa{p}}}}}(t)$ is the robot-oriented velocity (with longitudinal, latitudinal, and rotational components, respectively).

Linearizing about an arbitrary operating point, ${{\mbfa{x}}_{\text{op}}}(t)$, the components ${\mbfa{F}}(t)$, ${\mbfa{v}}(t)$ and ${\mbfa{L}}(t)$ from $\eqref{eq:ntvsde_lin}$ are straight-forward to derive. Similarly, to the linear prior example described above, we will define the exogenous input ${\mbfa{u}}(t) = {\mbfa{0}}$; however, we note that ${\mbfa{v}}(t) \neq {\mbfa{0}}$ (see ). Since expressions for ${{\boldsymbol{\Phi}}}(t,s)$ and ${\mbfa{Q}}_{n}$ are not obvious, we will rely on numerical integration for their evaluation.

Measurement Models
------------------

We will use two types of measurements: range/bearing to landmarks (using a laser rangefinder) and wheel odometry (in the form of robot-oriented velocity). The range/bearing measurement model takes the form $$\begin{aligned}
{\mbfa{y}}_{{n}i} & = & {\mbfa{g}}_{\rm rb}( {\mbfa{x}}(t_{n}), {{\boldsymbol{\ell}}}_i ) + {\mbfa{n}}_{{n}i} \nonumber \\
& = & {\begin{bmatrix}}\sqrt{(x_i -x(t_{n}) )^2 + (y_i-y(t_{n}))^2} \, \\ \mbox{atan2}(y_i-y(t_{n}),x_i-x(t_{n})) \, {\end{bmatrix}}+ {\mbfa{n}}_{{n}i}.\end{aligned}$$ The wheel odometry measurement model gives the longitudinal and rotational speeds of the robot, taking the form $${\mbfa{y}}_{n}= {\mbfa{g}}_{\rm wo}( {\mbfa{x}}(t_{n}) ) + {\mbfa{n}}_{n}= {\begin{bmatrix}}\cos\theta(t_{n}) & \sin\theta(t_{n}) & 0 \\ 0 & 0 & 1 {\end{bmatrix}}\hspace{-0.08cm} {{\dot{{\mbfa{p}}}}}(t_{n}) + {\mbfa{n}}_{n},$$ for the LTI SDE prior, and $${\mbfa{y}}_{n}= {\mbfa{g}}_{\rm wo}( {\mbfa{x}}(t_{n}) ) + {\mbfa{n}}_{n}= {\begin{bmatrix}}1 & 0 & 0 \\ 0 & 0 & 1 {\end{bmatrix}}{{\boldsymbol{\nu}}}(t_{n}) + {\mbfa{n}}_{n},$$ for the NTV SDE prior. Note that in both cases the velocity information is extracted easily from the state since we are estimating it directly. The Jacobians with respect to the state, ${\mbfa{x}}(t)$, are straightforward to derive.

Exploiting Sparsity
-------------------

![Factor-graph representation of our STEAM problem. There are factors (black dots) for (i) the prior (binary), (ii) the landmark measurements (binary), and (iii) the wheel odometry measurements (unary). Triangles are [*trajectory states*]{} (position and velocity, for this prior); the first trajectory state is locked. Hollow circles are landmarks.[]{data-label="fig:steam"}](Fig3.pdf){width="\columnwidth"}

[4pt]{} Figure \[fig:steam\] shows an illustration of the STEAM problem we are considering. In terms of linear algebra, at each iteration we need to solve a linear system of the form $$\label{eq:steam}
\underbrace{{\begin{bmatrix}}{\mbfa{W}}_{xx} & {\mbfa{W}}_{\ell x}^T \\ {\mbfa{W}}_{\ell x} & {\mbfa{W}}_{\ell\ell} {\end{bmatrix}}}_{{\mbfa{W}}} \underbrace{{\begin{bmatrix}}\delta{\mbfa{x}}^\star \\ \delta{{\boldsymbol{\ell}}}^\star {\end{bmatrix}}}_{\delta{\mbfa{z}}^\star} = \underbrace{{\begin{bmatrix}}{\mbfa{b}}_x \\ {\mbfa{b}}_{\ell} {\end{bmatrix}}}_{{\mbfa{b}}},$$ which retains exploitable structure despite introducing landmarks to the state [@brown58]. In particular, ${\mbfa{W}}_{xx}$ is block-tridiagonal (due to our GP prior) and ${\mbfa{W}}_{\ell\ell}$ is block-diagonal; the sparsity of the off-diagonal block, ${\mbfa{W}}_{\ell x}$, depends on the specific landmark observations. We reiterate the fact that if we marginalize out the $\dot{{\mbfa{p}}}(t_{n})$ (or ${{\boldsymbol{\nu}}}(t_{n})$) variables and keep only the ${\mbfa{p}}(t_{n})$ variables to represent the trajectory, the ${\mbfa{W}}_{xx}$ block becomes dense (for these priors); this is precisely the approach of @tong_ijrr13b.

To solve  efficiently, we can begin by either exploiting the sparsity of ${\mbfa{W}}_{xx}$ or of ${\mbfa{W}}_{\ell\ell}$. Since each trajectory variable represents a unique measurement time (range/bearing or odometry), there are potentially a lot more trajectory variables than landmark variables, $L \ll M$, so we will exploit ${\mbfa{W}}_{xx}$.

We use a sparse (lower-upper) Cholesky decomposition: $$\underbrace{{\begin{bmatrix}}{\mbfa{V}}_{xx} & {\mbfa{0}} \\ {\mbfa{V}}_{\ell x} & {\mbfa{V}}_{\ell\ell} {\end{bmatrix}}}_{{\mbfa{V}}} \underbrace{{\begin{bmatrix}}{\mbfa{V}}_{xx}^T & {\mbfa{V}}_{\ell x}^T \\ {\mbfa{0}} & {\mbfa{V}}_{\ell\ell}^T {\end{bmatrix}}}_{{\mbfa{V}}^T} = \underbrace{{\begin{bmatrix}}{\mbfa{W}}_{xx} & {\mbfa{W}}_{\ell x}^T \\ {\mbfa{W}}_{\ell x} & {\mbfa{W}}_{\ell\ell} {\end{bmatrix}}}_{{\mbfa{W}}}$$ We first decompose ${\mbfa{V}}_{xx}{\mbfa{V}}_{xx}^T = {\mbfa{W}}_{xx}$, which can be done in $O({N})$ time owing to the block-tridiagonal sparsity. The resulting ${\mbfa{V}}_{xx}$ will have only the main block-diagonal and the one below it non-zero. We can then solve ${\mbfa{V}}_{\ell x} {\mbfa{V}}_{xx}^T = {\mbfa{W}}_{\ell x}$ for ${\mbfa{V}}_{\ell x}$ in $O(L {N})$ time. Finally, we decompose ${\mbfa{V}}_{\ell\ell} {\mbfa{V}}_{\ell\ell}^T = {\mbfa{W}}_{\ell\ell} - {\mbfa{V}}_{\ell x} {\mbfa{V}}_{\ell x}^T$, which we can do in $O(L^3 + L^2{N})$ time. This completes the decomposition in $O(L^3 +L^2{N})$ time. We then perform the standard forward-backward passes, ensuring to exploit the sparsity: first solve ${\mbfa{V}} {\mbfa{d}} = {\mbfa{b}}$ for ${\mbfa{d}}$, then ${\mbfa{V}}^T \, \delta{\mbfa{z}}^\star = {\mbfa{d}}$ for $\delta{\mbfa{z}}^\star$, both in $O(L^2 +L{N})$ time. Note, this approach does not marginalize out any variables during the solve, as this can ruin the sparsity (i.e., we avoid inverting ${\mbfa{W}}_{xx}$). The whole solve is $O(L^3 +L^2{N})$.

At each iteration, we update the state, $\bar{{\mbfa{z}}} \leftarrow \bar{{\mbfa{z}}} + \delta{\mbfa{z}}^\star$, and iterate to convergence. Finally, we query the trajectory at ${J}$ other times of interest using the GP interpolation discussed earlier. The whole procedure is then $O(L^3 +L^2{N}+ {J})$, including the extra queries.

Due to the addition of landmarks, the cost of a STEAM problem must be either be of order $O(L^3 + L^2{N}+ {J})$ or $O({N}^3 + {N}^2L + {J})$, depending on the way we choose to exploit ${\mbfa{W}}_{xx}$ or ${\mbfa{W}}_{\ell\ell}$. The state reduction scheme presented in Section \[sec:measinterp\] becomes very attractive when both the number of measurements and landmarks are very high; estimating the state at ${K}$ *keytimes*, ${K}< {N}$ , and exploiting ${\mbfa{W}}_{\ell\ell}$, the procedure becomes order $O({K}^3 + {K}^2L + {N}+ {J})$, which is the same complexity as a traditional discrete-time SLAM problem (with the addition of the ${J}$ query times).

Experiment {#sec:experiment_subsec}
----------

For experimental validation, we employed the same mobile robot dataset as used by @tong_ijrr13b. This dataset consists of a mobile robot equipped with a laser rangefinder driving in an indoor, planar environment amongst a forest of $17$ plastic-tube landmarks. The odometry and landmark measurements are provided at a rate of 1Hz, and additional trajectory queries are computed at a rate of 10Hz after estimator convergence. Ground-truth for the robot trajectory and landmark positions is provided by a Vicon motion capture system.

[2pt]{} We implemented three estimators for comparison. The first was the algorithm described by @tong_ijrr13b, [*GP-Pose-Dense*]{}, the second was a naive version of our estimator, [*GP-Traj-Dense*]{}, based on the LTI SDE prior described in Section \[sec:exp\_ltipri\], but did not exploit sparsity, and the third was a full implementations of our estimator, [*GP-Traj-Sparse*]{}, that exploited the sparsity structure as described in this paper. The final estimator has two variants, [*GP-Traj-Sparse-LTI*]{} and [*GP-Traj-Sparse-NTV*]{}, based on the LTI SDE and NTV SDE priors described in Sections \[sec:exp\_ltipri\] and \[sec:exp\_ntvpri\], respectively; as the first two estimators, [*GP-Pose-Dense*]{} and [*GP-Traj-Dense*]{}, are only of interest with regard to computational performance, they each implement only the LTI ‘constant-velocity’ prior.

For this experiment, we obtained ${\mbfa{Q}}_C$ for both the LTI and NTV priors by modelling it as a diagonal matrix and taking the data-driven training approach using log marginal likelihood (with ground-truth measurements) described in Section \[sec:hyper\_training\].

[300]{}[4pt]{} Though the focus of the exactly sparse Gaussian process priors is to demonstrate the significant reductions in computational cost, we provide Figure \[fig:trajectory\_plot\] to illustrate the smooth trajectory estimates we obtained from the continuous-time formulation. While the algorithms differed in their number of degrees of freedom and types of their estimated states, their overall accuracies were similar for this dataset. The [*GP-Traj-Sparse-NTV*]{} algorithm differed slightly from the others; qualitatively, we found that the trajectory estimated by the [*GP-Traj-Sparse-NTV*]{} algorithm more accurately matched the local shape of the ground-truth on many occasions, such as the ones highlighted by the insets in Figure \[fig:trajectory\_plot\]. Also, it is clear from the plotted $3\sigma$ covariance envelope that the estimate from the [*GP-Traj-Sparse-NTV*]{} algorithm tends to be more uncertain.

### Computational Cost

[2pt]{} To evaluate the computational savings of exploiting an exactly sparse GP prior, we implemented all algorithms in Matlab with a 2.4GHz i7 processor and 8GB of 1333MHz DDR3 RAM and timed the computation for segments of the dataset of varying lengths. These results are shown in Figure \[fig:timing\_plots\], where we provide the computation time for the individual operations that benefit most from the sparse structure, as well as the overall processing time.

We see that the [*GP-Traj-Dense*]{} algorithm is much slower than the original [*GP-Pose-Dense*]{} algorithm of @tong_ijrr13b. This is because we have reintroduced the velocity part of the state, thereby doubling the number of variables associated with the trajectory. However, once we start exploiting the sparsity with the [*GP-Traj-Sparse*]{} methods, the increase in number of variables pays off.

For the [*GP-Traj-Sparse*]{} methods, we see in Figure \[fig:timing\_kernel\] that the kernel matrix construction was linear in the number of estimated states. This can be attributed to the fact that we constructed the sparse ${{{\check{{\mbfa{P}}}}}}^{-1}$ directly. As predicted, the optimization time per iteration was also linear in Figure \[fig:timing\_optimization\], and the interpolation time per additional query was constant regardless of state size in Figure \[fig:timing\_interpolation\]. Finally, Figure \[fig:timing\_total\] shows that the total compute time was also linear.

The additional cost of the [*GP-Traj-Sparse-NTV*]{} algorithm over the [*GP-Traj-Sparse-LTI*]{} algorithm in kernel construction time is due to the linearization and numerical integration of the prior mean and covariance. The optimization time of the [*GP-Traj-Sparse-NTV*]{} algorithm is also affected because the kernel matrix must be reconstructed from a new linearization of the prior during every optimization iteration. The [*GP-Traj-Sparse-NTV*]{} algorithm also incurs some numerical integration cost in interpolation time, but it is constant and very small.

We also note that the number of iterations for optimization convergence varied for each algorithm. In particular, we found that the [*GP-Traj-Sparse*]{} implementations converged in fewer iterations than the other implementations due to the fact that we constructed the inverse kernel matrix directly, which resulted in greater numerical stability. The [*GP-Traj-Sparse*]{} approaches clearly outperform the other algorithms in terms of computational cost.

### Increasing Nonlinearity

In a problem with fairly accurate and high-rate measurements, both the [*GP-Traj-Sparse-LTI*]{} and [*GP-Traj-Sparse-NTV*]{} estimators provide similar accuracy. In order to expose the benefit of a nonlinear prior based on the expected motion of the vehicle, we increase the nonlinearity of the problem by reducing measurement frequency.

[4pt]{} The result of varying range measurement frequency, with and without the use of odometry measurements, is shown in Figure \[fig:nonlinearity\_errors\]. In general, it is clear that as the interval between range measurements is increased, the [*GP-Traj-Sparse-NTV*]{} estimator is able to produce a more accurate estimate of the continuous-time pose (translation and rotation) than the [*GP-Traj-Sparse-LTI*]{} estimator.

In the case that the 1Hz odometry measurements are available, as seen in Figure \[fig:error\_with\_odom\], the difference in the rotation estimates is small, because the [*GP-Traj-Sparse-LTI*]{} estimator has a good amount of information about its heading; however, in the case that the odometry measurements are unavailable, as seen in Figure \[fig:error\_without\_odom\], the advantage of the nonlinear prior implemented by the [*GP-Traj-Sparse-NTV*]{} estimator is prominent with respect to the rotational estimate.

In order to gain some qualitative intuition about how the continuous-time pose estimates are affected by the reduction of measurements, Figure \[fig:nonlinearity\_trajplot\] shows the trajectories for the same small subsection as presented in Figure \[fig:trajectory\_plot\]; the estimates used an interval between range measurements of 7 seconds and are shown with and without the use of odometry measurements. In both plots, it is clear that the [*GP-Traj-Sparse-NTV*]{} estimator matches the ground-truth more closely, as previously indicated by the error plots in Figure \[fig:nonlinearity\_errors\].

Discussion and Future Work {#sec:discussion}
==========================

It is worth elaborating on a few issues. The main reason that the ${\mbfa{W}}_{xx}$ block is sparse in our approach, as compared to @tong_ijrr13b, is that we reintroduced velocity variables that had effectively been marginalized out. This idea of reintroducing variables to regain exact sparsity has been used before by @eustice06 in the delayed state filter and by @walter07 in the extended information filter. This is a good lesson to heed: the underlying structure of a problem may be exactly sparse, but by marginalizing out variables it appears dense. For us this means we need to use a Markovian trajectory state that is appropriate to our prior.

In much of mobile robotics, odometry measurements are treated more like inputs to the mean of the prior than pure measurements. We believe this is a confusing thing to do as it conflates two sources of uncertainty: the prior over trajectories and the odometry measurement noise. In our framework, we have deliberately separated these two functions and believe this is easier to work with and understand. We can see these two functions directly in Figure \[fig:steam\], where the prior is made up of binary factors joining consecutive trajectory states, and odometry measurements are unary factors attached to some of the trajectory states (we could have used binary odometry factors but chose to set things up this way due to the fact that we were explicitly estimating velocity).

While our analysis appears to be restricted to a small class of covariance functions, we have only framed our discussions in the context of robotics. Recent developments from machine learning [@hartikainen10] and signal processing [@sarkka13] have shown that it is possible to generate other well-known covariance functions using a LTV SDE (some exactly and some approximately). This means they can be used with our framework. One example is the Matérn covariance family [@rasmussen06], $${{{\check{{\mbfa{P}}}}}}_{\rm m}(t,t^\prime) = \sigma^2 \frac{2^{1-\nu}}{\Gamma(\nu)}\left( \frac{\sqrt{2\nu}}{\ell} |t-t^\prime|\right)^\nu \hspace{-0.1cm} K_\nu \left(  \frac{\sqrt{2\nu}}{\ell} |t-t^\prime| \right) \hspace{-0.05cm} {\mbfa{1}}$$ where $\sigma$, $\nu$, $\ell >0$ are magnitude, smoothness, and length-scale parameters, $\Gamma(\cdot)$ is the gamma function, and $K_\nu(\cdot)$ is the modified Bessel function. For example, if we let $${\mbfa{x}}(t) = {\begin{bmatrix}}{\mbfa{p}}(t) \\ \dot{{\mbfa{p}}}(t) {\end{bmatrix}},$$ with $\nu = p + \frac{1}{2}$ with $p=1$ and use the following SDE: $$\dot{{\mbfa{x}}}(t) = {\begin{bmatrix}}{\mbfa{0}} & {\mbfa{1}} \\  -\lambda^2 {\mbfa{1}} & -2\lambda {\mbfa{1}}  {\end{bmatrix}}{\mbfa{x}}(t) + {\begin{bmatrix}}{\mbfa{0}} \\ {\mbfa{1}} {\end{bmatrix}}{\mbfa{w}}(t),$$ where $\lambda = \sqrt{2\nu}/\ell$ and ${\mbfa{w}}(t) \sim \mathcal{GP}\left( {\mbfa{0}}, {\mbfa{Q}}_C \, \delta(t-t^\prime) \right)$ (our usual white noise) with power spectral density matrix, $${\mbfa{Q}}_C = \frac{2\sigma^2 \pi^{\frac{1}{2}} \lambda^{2p+1} \Gamma(p+1)}{\Gamma(p+\frac{1}{2})} {\mbfa{1}},$$ then we have that ${\mbfa{p}}(t)$ is distributed according to the Matérn covariance family: ${\mbfa{p}}(t) \sim \mathcal{GP}({\mbfa{0}}, {{{\check{{\mbfa{P}}}}}}_{\rm m}(t,t^\prime) )$ with $p=1$. Another way to look at this is that passing white noise through LTV SDEs produces particular coloured-noise priors (i.e., not flat across all frequencies).

In terms of future work, we plan to incorporate the dynamics (i.e., kinematics plus Newtonian mechanics) of a robot platform into the GP priors; real sensors do not move arbitrarily through the world as they are usually attached to massive robots and this serves to constrain the motion. Another idea is to incorporate [*latent force models*]{} into our GP priors (e.g., see @alvarez09 or @hartikainen12). We also plan to look further at the sparsity of STEAM and integrate our work with modern solvers to tackle large-scale problems; this should allow us to exploit more than just the primary sparsity of the problem and do so in an online manner.

Conclusion {#sec:conclusion}
==========

[4pt]{} We have considered continuous-discrete estimation problems where a trajectory is viewed as a one-dimensional [*Gaussian process*]{} (GP), with time as the independent variable and measurements acquired at discrete times. Querying the trajectory can be viewed as nonlinear, GP regression. Our main contribution in this paper is to show that this querying can be accomplished very efficiently. To do this, we exploited the Markov property of our GP priors (generated by nonlinear, time-varying stochastic differential equations driven by white noise) to construct an inverse kernel matrix that is sparse. This makes it fast to solve for the state at the measurement times (as is commonly done in vision and robotics) but also at any other time(s) of interest through GP interpolation. Other implications of this sparsity were discussed with respect to hyperparameter training, and including measurements at query times. We also considered a slight generalization of the SLAM problem, [*simultaneous trajectory estimation and mapping*]{} (STEAM), which makes use of a continuous-time trajectory prior and allows us to query the state at any time of interest in an efficient manner. We hope this paper serves to deepen the connection between classical state estimation theory and recent machine learning methods by viewing batch estimation through the lens of Gaussian process regression.

Thanks to Dr. <PRESIDIO_ANONYMIZED_PERSON> at Oxford who asked the all-important question: [*how can the GP estimation approach [@tong_ijrr13b] be related to factor graphs?*]{} This work was supported by the Canada Research Chair Program, the Natural Sciences and Engineering Research Council of Canada, and the Academy of Finland.