MATL, 19 bytes
,!ix"0GYs@12XQ!g]v! Inputs are M (matrix), H (column vector), V (column vector). The row separator is ;.
Try it online! Or verify all test cases: 1, 2, 3, 4, 5.
I'll add an explanation tomorrow later.
,!ix"0GYs@12XQ!g]v! Inputs are M (matrix), H (column vector), V (column vector). The row separator is ;.
Try it online! Or verify all test cases: 1, 2, 3, 4, 5.
I'll add an explanation tomorrow later.