Revision 97ee6ec7-041d-4d32-ad90-10d3b979bde3 - Code Golf Stack Exchange
# [Jelly], 9 bytes
,ZfJṁ=ⱮJƲ
[Try it online!][TIO-kq0dpq0b]
[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-kq0dpq0b]: https://tio.run/##y0rNyan8/18nKs3r4c5G20cb13kd2/T/4e4tto8a5hoebn@4sw2INCP/G8AAF3VYhjDAxYUkwIWkDEpyGYJlUQkuA0MQ4kIzDScfnQZqRrITzEYmwRRQ1gAiCSG4ILaDDYVwYBjsGogY2EyIPVzozgdiQwjBlfpfPSZPXS8rPzNPI7MktUgjM6@gtERHPVVdUzPaStcwVq@4ICezRAOoCqhOEwA "Jelly – Try It Online"
[Idea stolen from Razetime in TNB](https://chat.stackexchange.com/transcript/message/58362379#58362379)
```
, Pair the input with
Z its transpose.
f Ʋ Filter the pair to elements contained in:
Jṁ Mold [1 .. len(input)] to the shape of the input.
ⱮJ For each 1 .. len(input),
= is each element equal to it?
Jṁ=ⱮJƲ This computes every matrix of the same dimensions with a single column of 1s.