Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What's the difference between

projection= Table[Conjugate[autoVett[[k]].someVector1], {k, 1, r}]

that gave me as results {12} which is ok.

startState = 
  KroneckerProduct[baseComp, Transpose[{baseVector}]] ;
scompoStartState = 
  Table[Conjugate[CCNOTHvec[[k]].startState], {k, 1, 

What's the difference between a {12} vector and a {96,1} vector? I need to have just 96-dimensional vector.

share|improve this question
What's the difference between autoVett[[k]], someVector1, baseComp[[4]], and someVector2? – bill s Jun 17 '13 at 10:15
they are both {n} dimensional vector.. – asdf Jun 17 '13 at 10:54
up vote 2 down vote accepted

The Kronecker product of two vectors of sizes $n$ and $m$ always gives a matrix of size $n$ by $m$. For example:

a = RandomReal[{-1, 1}, 4];
b = RandomReal[{-1, 1}, 5]; 
Dimensions[KroneckerProduct[a, b]]

In fact, the KroneckerProduct is just a rewriting of

Outer[Times, a, b]

and this same calculation can also be done with Table

Table[a[[i]] b[[j]], {i, 1, Length[a]}, {j, 1, Length[b]}]

all of which give the same $n=4$ by $m=5$ matrix. You can turn any of the above into a vector using Flatten. Hence


is a vector of size $4\times 5=20$ containing the same elements as the 4 by 5 matrix.

share|improve this answer
I know, but I want to have a 5*4 vector, not a matrix. eg: Command[{a,b},{c,d}] = {ac, ad, bc, bd} – asdf Jun 17 '13 at 11:44
See change... Flatten[Outer[Times, {a, b}, {c, d}]] gives what you ask for (make sure to Clear a,b,c,d so the values don't conflict.) – bill s Jun 17 '13 at 11:58
THANKS!!!! It works! :D – asdf Jun 17 '13 at 12:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.