Cody

Problem 44504. Get a new matrix by mapping each element of an arbitrary-sized input matrix using lookup table

  • Created by PE

A is a matrix of any size and dimension. Each element of matrix A belongs to the set S of natural numbers up to N. B is a vector of N-length, defining output value for each of the elements of set S. Function takes each element of A, looks up table B and finds corresponding output value to return output matrix C having same size as that of A, made of output elements.

e.g. A = [ 8 9 5 9; 7 8 13 19; 15 12 13 6; 15 14 3 11; 3 15 2 4] and

B = [20 18 16 14 12 10 8 6 4 2 0 -2 -4 -6 -8 -10 -12 -14 -16 -18 -20]

expected output is,

C = [ 6 4 12 4; 8 6 -4 -16; -8 -2 -4 10; -8 -6 16 0; 16 -8 18 14]

Solution Stats

80.0% Correct | 20.0% Incorrect
Last Solution submitted on Feb 08, 2019

Problem Comments

Problem Recent Solvers13

Suggested Problems

More from this Author2

Problem Tags