Prev: ANN
Next: Choosing elements from returned array
From: Me on 9 Jul 2010 02:15 Given a column vector v is it possible to express, using "traditional" linear algebra operators/notation, the matrix which contains the elements of v along the diagonal, and all other elements zero? I essentially want what Matlab would produce with "diag(v)" but expressed as a matrix/vector equation. Thanks, Dave
From: Rune Allnor on 9 Jul 2010 05:46 On 9 Jul, 08:15, Me <The...(a)Ours.CC> wrote: > Given a column vector v is it possible to express, using "traditional" > linear algebra operators/notation, the matrix which contains the > elements of v along the diagonal, and all other elements zero? > > I essentially want what Matlab would produce with "diag(v)" but > expressed as a matrix/vector equation. Don't think it can be done. Assume v is N x 1 with all non-zero coefficients. The only way to produce a N x N matrix X from v is to right multiply with a 1 x N vector u: X = vu [1] As far as I can tell, X will have a non-zero column everywhere u has a non-zero coeffcient. Which means the vector product [1] can not produce a diagonal matrix. Which in turn means that what you ask can not be done. Rune
From: Bruno Luong on 9 Jul 2010 06:58 Me <Theirs(a)Ours.CC> wrote in message <i16epf$c0b$1(a)news.eternal-september.org>... > Given a column vector v is it possible to express, using "traditional" > linear algebra operators/notation, the matrix which contains the > elements of v along the diagonal, and all other elements zero? > > I essentially want what Matlab would produce with "diag(v)" but > expressed as a matrix/vector equation. > > Thanks, Dave M = diag(v) can be defined as the matrix (in canonic basic) of the linear operator x -> v \centerdot x for all x in R^n, Where \centerdot is the big centered bullet used for Schur's product (or called alternatively by Hadamard's or pointwise): http://www.ee.ic.ac.uk/hp/staff/dmb/matrix/relation.html Bruno
From: TCL on 9 Jul 2010 09:16 On Jul 9, 2:15 am, Me <The...(a)Ours.CC> wrote: > Given a column vector v is it possible to express, using "traditional" > linear algebra operators/notation, the matrix which contains the > elements of v along the diagonal, and all other elements zero? > > I essentially want what Matlab would produce with "diag(v)" but > expressed as a matrix/vector equation. > > Thanks, Dave Say your vector v is nx1 vector. Let e_i be the i-th unit column vector. Then the matrix you want is Sum ( (v^t e_i)e_i e_i^t, i=1,..,n ) -TCL
From: Matt J on 9 Jul 2010 10:34 Me <Theirs(a)Ours.CC> wrote in message <i16epf$c0b$1(a)news.eternal-september.org>... > Given a column vector v is it possible to express, using "traditional" > linear algebra operators/notation, the matrix which contains the > elements of v along the diagonal, and all other elements zero? > > I essentially want what Matlab would produce with "diag(v)" but > expressed as a matrix/vector equation. ============ I don't know if this is precisely what you're looking for, but you can define your own customized linear operator using http://www.mathworks.com/matlabcentral/fileexchange/26611-on-the-fly-definition-of-custom-matrix-objects For you, this would be something like the following, >> A=MatrixObj; A.Ops.mtimes=@(A,v) diag(v); >> A*[1;2;3] ans = 1 0 0 0 2 0 0 0 3
|
Pages: 1 Prev: ANN Next: Choosing elements from returned array |