Recall & Review
beginner
What does CSC stand for in sparse matrix storage?
CSC stands for Compressed Sparse Column. It is a way to store sparse matrices efficiently by compressing data column-wise.
Click to reveal answer
intermediate
How does CSC format store the matrix data?
CSC stores three arrays: one for non-zero values, one for row indices of those values, and one for column pointers that mark where each column starts in the values array.
Click to reveal answer
beginner
Why is CSC format useful in data science?
CSC format saves memory and speeds up column-based operations like matrix-vector multiplication, which is common in data science tasks.
Click to reveal answer
beginner
Show a simple example of creating a CSC matrix using scipy.
You can create a CSC matrix with scipy.sparse.csc_matrix. For example:<br><pre>from scipy.sparse import csc_matrix
import numpy as np
# Create a dense matrix
dense = np.array([[0, 0, 1], [1, 0, 0], [0, 2, 0]])
# Convert to CSC format
csc = csc_matrix(dense)
print(csc)</pre>Click to reveal answer
intermediate
What is the difference between CSC and CSR formats?
CSC compresses columns and is efficient for column slicing and operations. CSR (Compressed Sparse Row) compresses rows and is better for row slicing and row-based operations.
Click to reveal answer
What does the 'indptr' array in CSC format represent?
✗ Incorrect
The 'indptr' array in CSC format shows where each column starts in the data array.
Which operation is CSC format especially efficient for?
✗ Incorrect
CSC format is designed to speed up column slicing and column-based operations.
In scipy, which function creates a CSC sparse matrix?
✗ Incorrect
The function scipy.sparse.csc_matrix() creates a CSC format sparse matrix.
What is stored in the 'data' array of a CSC matrix?
✗ Incorrect
The 'data' array holds the actual non-zero values of the sparse matrix.
Which format is better for fast row slicing?
✗ Incorrect
CSR format compresses rows and is optimized for fast row slicing.
Explain how the CSC format stores a sparse matrix and why it is useful.
Think about how columns are compressed and what arrays are needed.
You got /6 concepts.
Describe the difference between CSC and CSR formats and when to use each.
Focus on which dimension is compressed and the typical operations.
You got /5 concepts.