Re: Creating Matrix from vectors specific issue.
- To: mathgroup at smc.vnet.net
- Subject: [mg100755] Re: [mg100745] Creating Matrix from vectors specific issue.
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Sat, 13 Jun 2009 06:01:58 -0400 (EDT)
- References: <200906120946.FAA27906@smc.vnet.net>
On Jun 12, 2009, at 5:46 AM, Kinu wrote: > Thanks to all who replied before > My exact problem is as follows.. > I am getting vectors from my program which is of the form > v1 = {{1},{2},{3}}; > v2 = {{4},{5},{6}}; > BUT NOT v1 = {1,2,3} and v2 = {4,5,6} > > Now if i use A = {v1,v2} and then Transpose[A] i am getting the > required matrix only in the 2nd case i.e when v1 = {1,2,3} and > similarly v2. > However when i use the same A = {v1,v2} in the 1st case and then > Transpose[] i.e when v1 = > {{1},{2},{3}} and similarly v2, i am not getting the required matrix. > If anyone would help me with this specific point it will be helpful. > > I have also seen that the dimension in case 1 is {3,1} while that in > case 2 is {3}. If there is any way to interchange the two .. that also > will suffice. i.e if i can change {{1},{2},{3}} to {1,2,3} that will > also suffice. A = Transpose[{Flatten[v1],Flatten[v2]}] Mathematica makes a distinction between a matrix (tensor of rank 2) which has two dimensions, and a vector (tensor of rank 1), the function ArrayDepth can be used to determine the rank of a structure. Flatten can be used to modify rank. Regards, Ssezi
- References:
- Creating Matrix from vectors specific issue.
- From: Kinu <basukinjal@gmail.com>
- Creating Matrix from vectors specific issue.