So
=C2=A0b =3D=C2=A0
0.89 =C2=A0
0.= 42 =C2=A0
0.0 =C2=A0=C2=A0
0.88 =C2=A0
0.97= =C2=A0
The solution at the bottom is the solution to Ax =3D= b solved using Gaussian elimination. I guess another question is, is there= another way to solve this problem? I'm trying to solve the least squar= es fit with a huge A (5MM x 1MM)=C2=A0

x =3D= inverse(A-transpose*A)*A-transose*b

but I didn= 9;t see any functions for matrix inversion

I suppo= se I can use an iterative solver but I didn't see that either which is = why I chose the QR decomposition , solve for Q and then Q-transpose*b =3D d= and the solve Lx =3D d which would give the solution. But I don't thin= k this would work either since the matrices are local copies and not RDD da= ta structures. Any advice would be appreciated...
Iman
=
P.S. I also looked in the linear regression class in the mli= b but I haven't seen any examples with sparse matrix and sparse vectors= as the input just 'Dataset' If you have a code example of this thi= s would work??

On Tue, Nov 8, 2016 at 6:41 AM Iman Mohtashemi <iman.mohtashemi@gmail.com> wrote:=
Hi Sean,
Here you go:

sparsematrix.txt= =3D=C2=A0

row, col ,val
0,0,.42
0,1,.28
0,2,.89
1,0,.83
1,1,.34
1,2,.42
2,0,.23
3,0,.42
3,1,.98
3,2,.88
4,0,.23
4,1,.36
4,2,.97

The vector is just the third = column of the matrix which should give the trivial solution of [0,0,1]

This translates to this which is correct
There are zeros in the matrix (Not really sparse but just an example)
0.42 =C2=A00.28 =C2=A00= .89 =C2=A0
0.83 =C2=A00.34 =C2=A00.42 =C2=A0<= /div>
0.23 =C2=A00.0 =C2=A0 0.0 =C2=A0=C2=A0
<= div class=3D"gmail_msg">0.42 =C2=A00.98 =C2=A00.88 =C2=A0
0.23 =C2=A00.36 =C2=A00.97 =C2=A0

Here is what I get for =C2=A0= the Q and R

Q: -0.21470961288429483 =C2= =A00.23590615093828807 =C2=A0 0.6784910613691661 =C2=A0 =C2=A0
-0.3920784235278427 =C2=A0 -0.06171221388256143 =C2=A00.5= 847874866876442 =C2=A0 =C2=A0
-0.774821646495= 4987 =C2=A0 -0.4003560542230838 =C2=A0 -0.29392323671555354 =C2=A0
-0.3920784235278427 =C2=A0 0.8517909521421976 =C2=A0 = =C2=A0-0.31435038559403217 =C2=A0
-0.21470961= 288429483 =C2=A0-0.23389547730301666 =C2=A0-0.11165321782745863 =C2=A0
R: -1.0712142642814275 =C2=A0-0.8347536340918976 = =C2=A0-1.227672225670157 =C2=A0
0.0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00.7662808691141717 = =C2=A0 0.7553315911660984 =C2=A0
0.0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00.0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A00.7785210939368136 =C2=A0

When running this in matlab the numbers are the same but row= 1 is the last row and the last row is interchanged with row 3

On Mon, Nov 7, 201= 6 at 11:35 PM Sean Owen <sowen@cloudera.com> wrote:
Rather than post a large section of code, please post a= small example of the input matrix and its decomposition, to illustrate wha= t you're saying is out of order.

On Tue, Nov 8, 2016 at 3:50 AM im281 <iman.mohtashemi@gm= ail.com> wrote:
I am getting the correct rows but they are out of order. = Is this a bug or am
I doing something wrong?

--001a1143f2bca756f80540cb3fef--