Skip to content
DeepForgeby svx
All problems
MediumTime Seriests-292

Observation Matrix Apply

Problem

Apply a state-space observation equation. For each row of matrix h_matrix, compute the dot product with state and add the scalar offset.

Return the list of observations; an empty matrix yields an empty list.

Hint

Each matrix row produces one observed series from the same latent state.

Test cases

case 1
in: [[[1,0],[0,2]],[3,4],0.5]
expected: [3.5,8.5]
case 2
in: [[[0.5,0.5]],[2,4],1]
expected: [4]
case 3
in: [[[1,1,1]],[1,2,3],-2]
expected: [4]
case 4
in: [[],[1,2],0]
expected: []
Starter codePython
def observation_matrix_apply(h_matrix, state, offset):
    # Your code here
    pass

4 test cases · run your code against them in the editor