I hereby claim:
- I am mcarlisle on github.
- I am mcarlisle (https://keybase.io/mcarlisle) on keybase.
- I have a public key ASB1Anz1qLZfRJpa9vAHI-CvQYQBMK1SalGNwzG1dWeuDgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| Tract,B,Location | |
| 3534,0.351,Cambridge | |
| 3535,0.32,Cambridge | |
| 3393,0.364,Medford | |
| 0105,0.267,Boston | |
| 0704,0.294,Boston | |
| 0707,0.654,Boston | |
| 0708,0.837,Boston | |
| 0709,0.78,Boston | |
| 0712,0.486,Boston |
| def rotate_clockwise_inplace(matrix): | |
| """ Input: a list of n lists of n objects each. | |
| Output: the same shape, with entries rotated 90 deg. | |
| """ | |
| m = matrix | |
| n = len(m) | |
| halfway_x = n//2 | |
| halfway_y = (n+1)//2 if n % 2 else n//2 | |
| for i in range(0,halfway_x): | |
| for j in range(0,halfway_y): |
| def rotate_clockwise_recursive(matrix): | |
| """ Input: a list of n lists of n objects each. | |
| Output: the same shape, with entries rotated 90 deg. Done recursively. | |
| """ | |
| # Base case: n = 0 or 1: nothing to do! | |
| m = matrix # for ease of typing | |
| n = len(m) | |
| if n in {0,1}: | |
| return m | |
| else: |
| def rotate_clockwise_numpy(matrix): | |
| """ Input: a list of lists of shape (n,n). | |
| Output: the same object, with entries rotated 90 deg. | |
| """ | |
| import numpy as np | |
| m = np.matrix(matrix) | |
| temp = np.matrix(matrix) # same shape! we're writing over all of it. | |
| n = len(matrix) |
| def HowFunIsThis(n): | |
| return "TH" + n*"I" + "IS much fun!" | |