Reputation: 10865
I need to obtain a matrix vvT
formed by a column vector v
. i.e. the column vector v
matrix times its transpose.
I found Mathematica doesn't support column vector. Please help.
Upvotes: 3
Views: 3394
Reputation: 24336
Does this do what you want?
v = List /@ Range@5;
vT = Transpose[v];
vvT = v.vT;
v // MatrixForm
vT // MatrixForm
vvT // MatrixForm
To get {1, 2, 3, 4, 5}
into {{1}, {2}, {3}, {4}, {5}}
you can use any of:
List /@ {1, 2, 3, 4, 5}
{ {1, 2, 3, 4, 5} }\[Transpose]
Partition[{1, 2, 3, 4, 5}, 1]
You may find one of these more convenient than the others. Usually on long lists you will find Partition
to be the fastest.
Also, your specific operation can be done in different ways:
x = {1, 2, 3, 4, 5};
Outer[Times, x, x]
Syntactically shortest:
Upvotes: 7