Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
96129 views
�
�g�Uc@s�dZddlmZmZmZmZmZddlmZd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�ZdS(s4Copyright 2015 Roger R Labbe Jr.

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.
i����(tarraytasarraytisscalarteyetdot(treducecCst|t||��S(s+ Returns the matrix multiplication of A*B*C(R(tAtBtC((s./filterpy/common/helpers.pytdot3scCst|t|t||���S(s- Returns the matrix multiplication of A*B*C*D(R(RRRtD((s./filterpy/common/helpers.pytdot4scGs
tt|�S(s8 Returns the matrix multiplication of 2 or more matrices(RR(targs((s./filterpy/common/helpers.pytdotn scCs�||||�}|||d||d|�}|||d||d|�}||||||�}||d|d||dS(s^computes 4th order Runge-Kutta for dy/dx.

    **Parameters**

    y : scalar
        Initial/current value for y
    x : scalar
        Initial/current value for x
    dx : scalar
        difference in x (e.g. the time step)
    f : ufunc(y,x)
        Callable function (y, x) that you supply to compute dy/dx for
        the specified values.

    g�?ig@((tytxtdxtftk1tk2tk3tk4((s./filterpy/common/helpers.pytrunge_kutta4%s
##cCsFt|dt�}|j||fkrBtdj||���n|S(s� Returns a copy of 'value' as an numpy.array with dtype=float. Throws
    exception if the array is not dimensioned correctly. Value may be any
    type which converts to numpy.array (list, np.array, np.matrix, etc)
    tdtypesmust have shape ({},{})(Rtfloattshapet	Exceptiontformat(tvaluetdim_xtdim_ytv((s./filterpy/common/helpers.pytsetter>scCs{t|dt�}|j}|d|ksY|jdksY|jdkrw|ddkrwtdj||d���n|S(s� Returns a copy of 'value' as an numpy.array with dtype=float. Throws
    exception if the array is not dimensioned correctly. Value may be any
    type which converts to numpy.array (list, np.array, np.matrix, etc)
    Riiis%has shape {}, must have shape ({},{})(RRRtndimRR(RRRR((s./filterpy/common/helpers.pyt	setter_1dHs
	>cCs�t|�rt|�|}nt|dt�}||krL|j�}n|j||fkr|tdj||���n|S(sA Returns a copy of 'value' as an numpy.array with dtype=float. Throws
    exception if the array is not dimensioned correctly. Value may be any
    type which converts to numpy.array (list, np.array, np.matrix, etc),
    or a scalar, in which case we create a diagonal matrix with each
    diagonal element == value.
    Rsmust have shape ({},{})(RRRRtcopyRRR(RRR((s./filterpy/common/helpers.pyt
setter_scalarUsN(t__doc__tnumpyRRRRRt	functoolsRR	RR
RR R"R$(((s./filterpy/common/helpers.pyt<module>s(