From: Me on
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: George Jefferson on


"Me" <Theirs(a)Ours.CC> wrote in message
news:i16fhj$g5q$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

Huh?

I*v?

[1 0 0] [a]
[0 1 0] [b]
[0 0 1] [c]

=

[a 0 0]
[0 b 0]
[0 0 c]

You didn't really think about it did you?


From: Rob Johnson on
In article <i16hph$mig$1(a)news.eternal-september.org>,
"George Jefferson" <phreon111(a)gmail.com> wrote:
>"Me" <Theirs(a)Ours.CC> wrote in message
>news:i16fhj$g5q$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

What you need is a 3x3x3 tensor constructed as follows

[ 1 0 0 ] [ 0 0 0 ] [ 0 0 0 ]
[ 0 0 0 ] [ 1 0 0 ] + [ 0 1 0 ] [ 0 1 0 ] + [ 0 0 0 ] [ 0 0 1 ]
[ 0 0 0 ] [ 0 0 0 ] [ 0 0 1 ]

>Huh?
>
>I*v?
>
>[1 0 0] [a]
>[0 1 0] [b]
>[0 0 1] [c]
>
>=
>
>[a 0 0]
>[0 b 0]
>[0 0 c]

Actually, the identity matrix is called that since it leaves vectors
unchanged. That is,

[ 1 0 0 ] [ a ] [ a ]
[ 0 1 0 ] [ b ] = [ b ]
[ 0 0 1 ] [ c ] [ c ]

A 3x3 matrix times a 3x1 vector yields a 3x1 vector, and not a 3x3
matrix. See <http://en.wikipedia.org/wiki/Matrix_multiplication>.

>You didn't really think about it did you?

Throwing stones from the balcony of your glass house?

Rob Johnson <rob(a)trash.whim.org>
take out the trash before replying
to view any ASCII art, display article in a monospaced font
From: TCL on
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