I feel like linear algebra should have a common operation, like transpose, that basically takes a Nx1 or 1xN vector and diagonalizes it (turns it into a NxN vector with the values across the diagonal)

Follow

@freemo I had the same thought recently. I usu just use the hadamard product though. Or define an op if I need it a lot

@2ck Hadamard produce isnt really sufficient if what you are multiplying against isnt the same dimensions as the matrix you want to diagonalize. So that still isnt sufficient for me. In my case I had a Nx1 I needed to multiple against a 3x2. I attached the example.

@freemo @2ck That's diag(). You just multiply by the appropriately-shaped unity before Hadamard, i.e. for a column vector x and matrix A, diag(x)⋅A = (x⋅1ᵀ)∘A

@khird
Ahh cool, never saw diag universally defined before. I usually just wind up defining it myself.
@2ck

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.