class_docstr: This is a multi-point Kalman Filter implementation of
  https://github.com/rlabbe/filterpy/blob/master/filterpy/kalman/kalman_filter.py,
  with a subset of functionality.
  
  All Kalman Filter matrices are stack on the X axis. This is to allow
  for optimal global accesses on the GPU.
  
  Parameters
  ----------
  dim_x : int
      Number of state variables for the Kalman filter. For example, if
      you are tracking the position and velocity of an object in two
      dimensions, dim_x would be 4.
      This is used to set the default size of P, Q, and u
  
  dim_z : int
      Number of of measurement inputs. For example, if the sensor
      provides you with position in (x,y), dim_z would be 2.
  
  dim_u : int (optional)
      Size of the control input, if it is being used.
      Default value of 0 indicates it is not used.
  
  points : int (optional)
      Number of Kalman Filter points to track.
  
  dtype : dtype (optional)
      Data type of compute.
  
  Attributes
  ----------
  x : array(points, dim_x, 1)
      Current state estimate. Any call to update() or predict() updates
      this variable.
  
  P : array(points, dim_x, dim_x)
      Current state covariance matrix. Any call to update() or predict()
      updates this variable.
  
  z : array(points, dim_z, 1)
      Last measurement used in update(). Read only.
  
  R : array(points, dim_z, dim_z)
      Measurement noise matrix
  
  Q : array(points, dim_x, dim_x)
      Process noise matrix
  
  F : array(points, dim_x, dim_x)
      State Transition matrix
  
  H : array(points, dim_z, dim_x)
      Measurement function
  
  _alpha_sq : float (points, 1, 1)
      Fading memory setting. 1.0 gives the normal Kalman filter, and
      values slightly larger than 1.0 (such as 1.02) give a fading
      memory effect - previous measurements have less influence on the
      filter's estimates. This formulation of the Fading memory filter
      (there are many) is due to Dan Simon [1]_.
  
  Examples
  --------
  Here is a filter that tracks position and velocity using a sensor that only
  reads position.
  
  First construct the object with the required dimensionality,
  number of points, and data type.
  
  .. code::
  
      import cupy as cp
      import numpy as np
  
      from cusignal import KalmanFilter
  
      points = 1024
      kf = KalmanFilter(dim_x=4, dim_z=2, points=points, dtype=cp.float64)
  
  Assign the initial value for the state (position and velocity)
  for all Kalman Filter points.
  
  .. code::
  
      initial_location = np.array(
          [[10.0, 10.0, 0.0, 0.0]], dtype=dt
      ).T  # x, y, v_x, v_y
      kf.x = cp.repeat(
          cp.asarray(initial_location[cp.newaxis, :, :]), points, axis=0
      )
  
  Define the state transition matrix for all Kalman Filter points:
  
      .. code::
  
          F = np.array(
              [
                  [1.0, 0.0, 1.0, 0.0],  # x = x0 + v_x*dt
                  [0.0, 1.0, 0.0, 1.0],  # y = y0 + v_y*dt
                  [0.0, 0.0, 1.0, 0.0],  # dx = v_x
                  [1.0, 0.0, 0.0, 1.0],
              ],  # dy = v_y
              dtype=dt,
          )
          kf.F = cp.repeat(cp.asarray(F[cp.newaxis, :, :]), points, axis=0)
  
  Define the measurement function for all Kalman Filter points:
  
      .. code::
  
          H = np.array(
              [[1.0, 0.0, 1.0, 0.0], [0.0, 1.0, 0.0, 1.0]],
              dtype=dt,  # x_0  # y_0
          )
          kf.H = cp.repeat(cp.asarray(H[cp.newaxis, :, :]), points, axis=0)
  
  Define the covariance matrix for all Kalman Filter points:
  
      .. code::
  
          initial_estimate_error = np.eye(dim_x, dtype=dt) * np.array(
              [1.0, 1.0, 2.0, 2.0], dtype=dt
          )
          kf.P = cp.repeat(
              cp.asarray(initial_estimate_error[cp.newaxis, :, :]),
              points,
              axis=0,
          )
  
  Define the measurement noise  for all Kalman Filter points:
  
      .. code::
  
          measurement_noise = np.eye(dim_z, dtype=dt) * 0.01
          kf.R = cp.repeat(
              cp.asarray(measurement_noise[cp.newaxis, :, :]), points, axis=0
          )
  
  Define the process noise  for all Kalman Filter points:
  
      .. code::
          motion_noise = np.eye(dim_x, dtype=dt) * np.array(
              [10.0, 10.0, 10.0, 10.0], dtype=dt
          )
          kf.Q = cp.repeat(
              cp.asarray(motion_noise[cp.newaxis, :, :]), points, axis=0
          )
  
  Now just perform the standard predict/update loop:
  Note: This example just uses the same sensor reading for all points
  
      .. code::
  
          kf.predict()
          z = get_sensor_reading() (dim_z, 1)
          kf.z = cp.repeat(z[cp.newaxis, :, :], points, axis=0)
          kf.update()
  
  Results are in:
  
      .. code::
          kf.x[:, :, :]
  
  References
  ----------
  
  .. [1] Dan Simon. "Optimal State Estimation." John Wiley & Sons.
     p. 208-212. (2006)
  
  .. [2] Roger Labbe. "Kalman and Bayesian Filters in Python"
     https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python
code: def __init__(
      self,
      dim_x,
      dim_z,
      dim_u=0,
      points=1,
      dtype=cp.float32,
  ):
      self.points = points
  
      if dim_x < 1:
          raise ValueError("dim_x must be 1 or greater")
      if dim_z < 1:
          raise ValueError("dim_z must be 1 or greater")
      if dim_u < 0:
          raise ValueError("dim_u must be 0 or greater")
  
      self.dim_x = dim_x
      self.dim_z = dim_z
      self.dim_u = dim_u
  
      # Create data arrays
      self.x = cp.zeros(
          (
              self.points,
              dim_x,
              1,
          ),
          dtype=dtype,
      )  # state
  
      self.P = cp.repeat(
          cp.identity(dim_x, dtype=dtype)[cp.newaxis, :, :],
          self.points,
          axis=0,
      )  # uncertainty covariance
  
      self.Q = cp.repeat(
          cp.identity(dim_x, dtype=dtype)[cp.newaxis, :, :],
          self.points,
          axis=0,
      )  # process uncertainty
  
      self.B = None  # control transition matrix
  
      self.F = cp.repeat(
          cp.identity(dim_x, dtype=dtype)[cp.newaxis, :, :],
          self.points,
          axis=0,
      )  # state transition matrix
  
      self.H = cp.zeros(
          (
              self.points,
              dim_z,
              dim_z,
          ),
          dtype=dtype,
      )  # Measurement function
  
      self.R = cp.repeat(
          cp.identity(dim_z, dtype=dtype)[cp.newaxis, :, :],
          self.points,
          axis=0,
      )  # process uncertainty
  
      self._alpha_sq = cp.ones(
          (
              self.points,
              1,
              1,
          ),
          dtype=dtype,
      )  # fading memory control
  
      self.z = cp.empty(
          (
              self.points,
              dim_z,
              1,
          ),
          dtype=dtype,
      )
  
      # Allocate GPU resources
      numSM = _get_numSM()
      threads_z_axis = 16
      threadsperblock = (self.dim_x, self.dim_x, threads_z_axis)
      blockspergrid = (1, 1, numSM * 20)
  
      max_threads_per_block = self.dim_x * self.dim_x * threads_z_axis
  
      # Only need to populate cache once
      # At class initialization
      _filters_cuda._populate_kernel_cache(
          self.x.dtype,
          threads_z_axis,
          self.dim_x,
          self.dim_z,
          self.dim_u,
          max_threads_per_block,
      )
  
      # Retrieve kernel from cache
      self.predict_kernel = _filters_cuda._get_backend_kernel(
          self.x.dtype,
          blockspergrid,
          threadsperblock,
          "predict",
      )
  
      self.update_kernel = _filters_cuda._get_backend_kernel(
          self.x.dtype,
          blockspergrid,
          threadsperblock,
          "update",
      )
  
      _print_atts(self.predict_kernel)
      _print_atts(self.update_kernel)
  
imports: import cupy
  from ..utils.helper_tools import _get_numSM, _print_atts
  from .None import _filters_cuda
label_desc: Use image node_id 1 to create a new KalmanFilter object from inherited base classes: object with example: obj = KalmanFilter(dim_x, dim_z, dim_u, points, dtype)