Skip to content
DeepForgeby svx
All problems
EasyLinear Algebrala-190

Jacobian of Matrix-Vector Product

Problem

The linear map x -> A*x has a constant Jacobian equal to A itself.

Return A as the Jacobian matrix of the product with respect to x.

Hint

Every component of A*x is linear in x, with coefficients taken from the corresponding row of A.

Test cases

case 1
in: [[[1,2],[3,4]]]
expected: [[1,2],[3,4]]
case 2
in: [[[1,0,0]]]
expected: [[1,0,0]]
case 3
in: [[[0],[1]]]
expected: [[0],[1]]
case 4
in: [[[1,0],[0,1]]]
expected: [[1,0],[0,1]]
Starter codePython
def jacobian_matvec(A):
    # Your code here
    pass

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