You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Iman Mohtashemi <im...@gmail.com> on 2017/10/12 17:26:16 UTC

TallSkinnyQR errors

We are using QR decomposition to solve the linear system Ax = b. Below is
the Matlab results showing the steps and the solution. When using Spark
RDDs the resulting Q is missing the columns of the data.





A is a zero-filled dense matrix and b is simply the 3rd column of the matrix



The least squares solution can now be applied using the inverse method
which results in the correct output where the matching x = the third column
of the matrix



The same data was used to apply the Spark API using the python language

We start with a coordinate matrix and read in the same matrix and vector
data



We start with the Coordinate matrix example:

A =

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



b =

0,0,.89

1,0,.42

3,0,.88

4,0,.97



For a sanity check I print out the dense matrix as well as the inner
product. Here is the matlab result of the inner product and so far in the
python solution everything matches







However, now when we compute the QR decomposition we only get 3 columns out?



This is NOT correct! Here is the matlab Q again

Note that the results are identicaly but the python/spark results are
missing the last two columns? Also, there are no other functions to extract
the Q and R data from the RDD??



Here is the rest of the python script to solve the problem