<commit_before># -*- coding: utf-8 -*-

"""Copyright 2018 <NAME>.

FilterPy library.
http://github.com/rlabbe/filterpy

Documentation at:
https://filterpy.readthedocs.org

Supporting book at:
https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python

This is licensed under an MIT license. See the readme.MD file
for more information.
"""

import math
import numpy as np
import scipy as sp
from filterpy.kalman import KalmanFilter


def kinematic_state_transition(order, dt):
    """ create a state transition matrix of a given order for a given time
    step `dt`.
    """
    assert order >= 0 and int(order) == order, "order must be an int >= 0"

    # hard code common cases for computational efficiency
    if order == 0:
        return np.array([[1.]])
    if order == 1:
        return np.array([[1., dt],
                         [0., 1.]])
    if order == 2:
        return np.array([[1., dt, 0.5*dt*dt],
                         [0., 1., dt],
                         [0., 1., dt]])

    # grind it out computationally....
    N = order + 1<commit_msg>Corrected result for kinematic_state_transition() when order=2<commit_after># -*- coding: utf-8 -*-

"""Copyright 2018 <NAME>.

FilterPy library.
http://github.com/rlabbe/filterpy

Documentation at:
https://filterpy.readthedocs.org

Supporting book at:
https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python

This is licensed under an MIT license. See the readme.MD file
for more information.
"""

import math
import numpy as np
import scipy as sp
from filterpy.kalman import KalmanFilter


def kinematic_state_transition(order, dt):
    """ create a state transition matrix of a given order for a given time
    step `dt`.
    """
    assert order >= 0 and int(order) == order, "order must be an int >= 0"

    # hard code common cases for computational efficiency
    if order == 0:
        return np.array([[1.]])
    if order == 1:
        return np.array([[1., dt],
                         [0., 1.]])
    if order == 2:
        return np.array([[1., dt, 0.5*dt*dt],
                         [0., 1., dt],
                         [0., 0., 1.]])

    # grind it out computationally....
    N = order + 1
{'fraction_non_alphanumeric': 0.1308924485125858, 'fraction_numerical': 0.021052631578947368, 'mean_word_length': 2.3272450532724505, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1435661', 'n_tokens_mistral': 713, 'n_tokens_neox': 653, 'n_words': 232}