-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help with puzzles 4 and 5 #9
Comments
Everything you are currently doing with list comprehensions, you can do faster and simpler with the For example if one does |
After some experimentation, I came up with the following: def eye(j: int) -> TT["j", "j"]:
return where(arange(j) - arange(j)[:, None] == 0, 1, 0) Wonder if there's even a better way... |
That's great! There are a couple ways to do it, but this is the way I did it. The other thing I saw was to multiply to force type changes something like:
|
I really loved, the way you thought about it, it's out of the box thinking :P. |
|
Only after looking at your guys solutions did I realize how inelegant I am 🥹 |
I'm trying to solve puzzles 4 and 5 by using the predefined
where(q, a, b)
function, which expectsq
to be a boolean tensor. To arrive at a boolean tensor, I create a boolean list and usetensor
on it. I suppose this is not allowed? How else could I implement this?This is my current implementation for puzzle 5 (identity matrix of dimension j)
The text was updated successfully, but these errors were encountered: