Prepping for the 2027 recruiting cycle? Use code 2027RC for 10% off, valid until July 31st! Oh, and check out our members-only recruitment services.

Logo

Sparse Matrix-Vector Multiply (CSR)

What this preview is

Sparse Matrix-Vector Multiply (CSR) is a medium quant coding problem on computer architecture in Python, asked at Nvidia.

Difficulty
Medium
Topic
Computer Architecture
Discipline
Quant development
Language
Python

Implementing sparse matrix-vector multiply with CSR format

This medium-difficulty coding problem tests whether you understand compressed sparse row (CSR) format and can implement an efficient, correct matrix-vector product. Firms like Nvidia care about this because sparse operations power GPU workloads in graph algorithms, physics simulations, and machine learning — and CSR is the industry standard for storing sparse matrices compactly.

The core challenge is correctly navigating the three-array CSR representation: reading the row boundaries from row_ptr, fetching the corresponding nonzero values and their column indices, then accumulating dot products. The solution is straightforward once you understand how row_ptr acts as a pointer into the values array, but off-by-one errors and edge cases (empty matrices, single-element rows) are common trip-ups under time pressure.

  • Array indexing and pointer arithmetic
  • Dense versus sparse data layout and memory efficiency
  • Boundary conditions and loop invariants

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.