Skip to content

Instantly share code, notes, and snippets.

View stevenrouk's full-sized avatar

Steven Rouk stevenrouk

View GitHub Profile
@stevenrouk
stevenrouk / next-task.md
Last active August 14, 2025 04:57
Claude Code commands for starting project documentation (/start-project), executing next tasks (/next-task), and updating documentation when task is complete (/update-task-documentation). Current working version -- last updated 2025-08-02.

Complete the next task from the plan in docs/start-here.md

Please look at docs/start-here.md and follow the instructions. Your job is to get the next task done. Ultimately, you are the one guiding the work and making sure it meets what it's supposed to do. Chunk the work into small pieces, when it's helpful.

First, review the necessary files, think carefully, review more, and then create a plan to create the next chunk of work. Output your plan for approval by me (the user) before proceeding. Pause after outputting the plan to wait for my input.

Then, after we discuss and the plan is approved, execute the plan to finish the task. Use subagents when helpful. Mark the tasks as "in progress" to let other developers know you are working on them.

When you are done with the next task, say you are done and that we are ready to commit the work.

import numpy as np
def list_comp_matrix_multiplication(A, B):
"""Third and final version of the list comprehension matrix multiplication."""
return [[sum([x*y for (x, y) in zip(row, col)]) for col in zip(*B)] for row in A]
if __name__ == '__main__':
A = [[1, 2, 3], [4, 5, 6]]
B = [[7, 8], [9, 10], [11, 12]]
import numpy as np
def list_comp_matrix_multiplication2(A, B):
"""Second version of the list comprehension matrix multiplication.
In this version, we create a list comprehension out of our outer for loop.
"""
# The following line is no longer needed:
# new_matrix = []
import numpy as np
def list_comp_matrix_multiplication1(A, B):
"""First version of the list comprehension matrix multiplication.
In this version, we create a list comprehension out of our inner for loop.
"""
new_matrix = []
for row in A:
import numpy as np
def for_loop_matrix_multiplication(A, B):
"""Fifth and final version of a for loop matrix multiplication."""
new_matrix = []
for row in A:
new_row = []
for col in zip(*B):
new_row.append(sum([x*y for (x, y) in zip(row, col)]))
import numpy as np
def for_loop_matrix_multiplication4(A, B):
"""Fourth version of a for loop matrix multiplication.
In this version, we replace B.T with zip(*B) in order to
transpose B without needing to convert it to a NumPy array first.
This means we can remove the opening np.array conversion lines too.
"""
new_matrix = []
import numpy as np
def for_loop_matrix_multiplication3(A, B):
"""Third version of a for loop matrix multiplication.
In this version, we replace the NumPy arrays with lists
and figure out how to store the resulting dot product values
in the correct places for the new matrix."""
# We're going to leave these as NumPy arrays for now because we're
# still transposing B using the "B.T" functionality of np.array.
import numpy as np
def for_loop_matrix_multiplication2(A, B):
"""Second version of a for loop matrix multiplication.
In this version, we remove the np.dot() function."""
A = np.array(A)
B = np.array(B)
new_matrix = np.zeros((A.shape[0], B.shape[1]))
import numpy as np
def for_loop_matrix_multiplication(A, B):
# A and B might come in as lists. We'll figure out
# how to deal with this eventually, but for now let's
# convert them to NumPy arrays so that we can transpose
# matrix B. (This is so we can iterate through the columns
# of B, rather than the rows.)
A = np.array(A)
B = np.array(B)
@stevenrouk
stevenrouk / list_comp_matrix_multiplication_template.py
Created August 25, 2019 21:55
A skeleton of a function that returns the result of the matrix multiplication of two matrices using a list comprehension.
def list_comp_matrix_multiplication(A, B):
# First, we could check to make sure the matrices can be multiplied together.
#
# (code here)
# Then, we could return the matrix multiplication using a list comprehension.
#
return [ # some list comprehension here ]