Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ using LinearAlgebra
A_sparse = sprand(Float64, 100, 80, 0.1)

# Convert to DeviceSparseMatrixCSC (CPU by default)
A_device = DeviceSparseMatrixCSC(A_sparse);
A_device = DeviceSparseMatrixCSC(A_sparse)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 It's good practice to omit the semicolon in Julia examples unless output suppression is explicitly desired for clarity or brevity in an interactive session. Removing it makes the example more idiomatic.

Suggested change
A_device = DeviceSparseMatrixCSC(A_sparse)
A_device = DeviceSparseMatrixCSC(A_sparse)


# Create a vector for matrix-vector multiplication
b = rand(Float64, 80)
Expand All @@ -49,7 +49,7 @@ b = rand(Float64, 80)
c = A_device * b

# You can also use the in-place mul! function
c_result = similar(b)
c_result = similar(b, 100)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 The similar(b, 100) modification correctly addresses a dimension mismatch. The result of A_device * b will be a vector with 100 elements, so c_result must be initialized to that size for mul! to work correctly. Great catch and fix!

Suggested change
c_result = similar(b, 100)
c_result = similar(b, 100)

mul!(c_result, A_device, b)
```

Expand Down