@staticmethod<EOL><INDENT>def _check_SS_matrix(p_M, state_dim, measurement_dim, which='<STR_LIT:A>'):<DEDENT>
old_M_shape = None<EOL>if len(p_M.shape) < <NUM_LIT:3>: <EOL><INDENT>old_M_shape = p_M.shape <EOL>if len(p_M.shape) == <NUM_LIT:2>: <EOL><INDENT>p_M.shape = (p_M.shape[<NUM_LIT:0>],p_M.shape[<NUM_LIT:1>],<NUM_LIT:1>)<EOL><DEDENT>elif len(p_M.shape) == <NUM_LIT:1>: <EOL><INDENT>if (p_M.shape[<NUM_LIT:0>] != <NUM_LIT:1>):<EOL><INDENT>raise ValueError("<STR_LIT>", which)<EOL><DEDENT>else:<EOL><INDENT>p_M.shape = (<NUM_LIT:1>,<NUM_LIT:1>,<NUM_LIT:1>)<EOL><DEDENT><DEDENT><DEDENT>if (which == '<STR_LIT:A>') or (which == '<STR_LIT>'):<EOL><INDENT>if (p_M.shape[<NUM_LIT:0>] != state_dim) or (p_M.shape[<NUM_LIT:1>] != state_dim):<EOL><INDENT>raise ValueError("<STR_LIT>" % (which, state_dim, state_dim))<EOL><DEDENT><DEDENT>if (which == '<STR_LIT:H>'):<EOL><INDENT>if (p_M.shape[<NUM_LIT:0>] != measurement_dim) or (p_M.shape[<NUM_LIT:1>] != state_dim):<EOL><INDENT>raise ValueError("<STR_LIT>" % (measurement_dim, state_dim))<EOL><DEDENT><DEDENT>if (which == '<STR_LIT:R>'):<EOL><INDENT>if (p_M.shape[<NUM_LIT:0>] != measurement_dim) or (p_M.shape[<NUM_LIT:1>] != measurement_dim):<EOL><INDENT>raise ValueError("<STR_LIT>" % (measurement_dim, measurement_dim))<EOL><DEDENT><DEDENT>return (p_M,old_M_shape)<EOL>
Veryfy that on exit the matrix has appropriate shape for the KF algorithm.

Input:
    p_M: matrix
        As it is given for the user
    state_dim: int
        State dimensioanlity
    measurement_dim: int
        Measurement dimensionality
    which: string
        One of: 'A', 'Q', 'H', 'R'
Output:
---------------
    p_M: matrix of the right shape

    old_M_shape: tuple
        Old Shape