pyntbci.utilities.inner
- pyntbci.utilities.inner(A: NDArray, B: NDArray, sum_old: NDArray = None, running: bool = False) NDArray[source]
Compute the inner product. Computed between two sets of variables.
- Parameters:
A (NDArray) – The first set of variables of shape (n_A, n_samples).
B (NDArray) – The second set of variables of shape (n_B, n_samples).
sum_old (NDArray (default: None)) – Already observed inner product of shape (n_A, n_B). Only used if running=True.
running (bool (default: False)) – Whether to use a running inner product, adding samples to a previously accumulated sum rather than recomputing from scratch. If True, A and B are taken to be only the newly observed samples (not the full history), and sum_old the sum accumulated so far (as returned by a previous call); omit it (default None) for the first call in a sequence. Since the inner product is exactly its own running sum, the returned array is both the current score matrix and the state to pass as sum_old on the next call.
- Returns:
scores – The inner product matrix of shape (n_A, n_B). If running=True, this is the cumulative inner product over all samples observed so far (i.e., also the state to pass as sum_old next call), not just the new ones.
- Return type:
NDArray