Tensara Logo

tensara

Diagonal Matrix Multiplication

EASY

Perform matrix multiplication of a diagonal matrix with another matrix:

C[i][j]=A[i]B[i][j]C[i][j] = A[i] \cdot B[i][j]

Input

  • Diagonal AA of size NN
  • Matrix BB of size N×MN \times M

Output

  • Matrix CC of size N×MN \times M

Notes:

  • The diagonal matrix is represented by a 1D tensor AA
  • All matrices B\text{B} and C\text{C} are stored in row-major order
  • This problem is adapted from KernelBench

GPU Type

Language

Data Type

Loading...

Loading editor...

CUDA C++ environment

Desktop Required for Code Submission

For the best coding experience, please switch to a desktop device to write and submit your solution.