Questions tagged [qr-decomposition]

QR factorization is an important type of matrix factorization in scientific computing. It is commonly used for generating orthonormal basis and solving least squares problem.

The standard scientific library supports Householder QR factorization with or without pivoting via dgeqrf and dgeqp3.

The scientific software for statistical computing and graphics has a built-in function qr(, LAPACK = TRUE) that interfaces dgeqp3. Note that if LAPACK = FALSE (default), the factorization is implemented with a modified LINPACK routine that can detect numerical rank. This is used for lm and glm functions that fits linear models and generalized linear models.

69 questions
0
votes
1 answer

QR decomposition

Is there a way to implement a QR decomposition like in Matlab? In particular, I am interested in the following command: [C,R,P] = qr(S,B) According to the description it "returns a permutation matrix P that is chosen to reduce fill-in in R. You can…
NC520
  • 346
  • 3
  • 13
0
votes
1 answer

Python Linear regression using QR decomposition (correlated features)

I need to apply a Python linear regression on a dataset in which some features are correlated. Scikit's linear regression uses the singular value decomposition in order to minimize the squared error. However, this method doesn't take into account…
0
votes
1 answer

Why doesn't QR decomposition work correctly? (Lapacke, complex case)

I use Lapacke. I am trying to do QR decomposition in C for complex data. For this I write the function (based on Haatschii code How to get the Q from the QR factorization output?): // Q - input: matrix that we expand / output: Q matrix // R -…
0
votes
0 answers

what does row oriented and column oriented mean in matrix

I am reading the paper "Numerics of Gram Schmidt orthogonal", Then I noticed there are some terminologies that I can't understand which are "row-oriented" and "column-oriented" located at P299 in the paper. the original sentence is "In row-oriented…
C Lei
  • 428
  • 4
  • 6
0
votes
0 answers

QR decomposition Eigen vs Matlab

I was porting code from Matlab to C++ using Eigen and I have found some problems. Im need to compute the QR decomposition, code matlab : [Q,R] = qr(Xtilde, 0); code Eigen : HouseholderQR qr(X_TILDE.rows(), X_TILDE.cols()); …
AAUDI
  • 1
  • 2
0
votes
1 answer

QuiRk in numpy - All normalized elements get assigned to 0 in QR decomposition using reflectors

All the normalized elements in the array get set to 0. I am attempting to create a reflector for an array. When I normalize all the elements in the array by the first element (x[1:] /= x[0], x[0] = 1) in Python, I just get all zeros and a 1 in the…
0
votes
1 answer

House-Holder Reflection for QR Decomposition

I am trying to implement the QR decomposition via householder reflectors. While attempting this on a very simple array, I am getting weird numbers. Anyone who can tell me, also, why using the @ vs * operator between vec and vec.T on the last line of…
0
votes
1 answer

Optimized projection of a matrix orthogonaly to a vector with Numpy

I need to make all other columns of a matrix A orthogonal to one of its column j. I use the following algorithm : # Orthogonalize with selected column for i in remaining_cols: A[:,i] = A[:,i] - A[:,j] * np.dot(A[:,i], A[:,j]) /…
Matthias Beaupère
  • 1,731
  • 2
  • 17
  • 44
0
votes
3 answers

Solve overdetermined system with QR decomposition in Python

I'm trying to solve an overdetermined system with QR decomposition and linalg.solve but the error I get is LinAlgError: Last 2 dimensions of the array must be square. This happens when the R array is not square, right? The code looks like…
0
votes
0 answers

How to Find center of circle from QR decomposition

I have to find the center of a circle represented by a 512x2 matrix using QR Decomposition instead of using least-square in matlab and I am confused on how to go from A=QR to finding a point in the middle of a circle. They call finding the…
0
votes
1 answer

GMRES method with given rotations in MATLAB

I have the following implementation of algorithm function[x,error,iter,flag,vetnorm_r]=gmres_givens(A,x,b,restart,maxit,tol) % input A REAL nonsymmetric positive definite matrix % x REAL initial guess vector % b …
0
votes
0 answers

Retrieving X from QR decomposition of X

Just puzzled by that : I'm computing the QR decomposition of the following matrix X and I expected to get back to X by calculating the product QR. Well, the product gives "almost" X, but with columns 1 and 2 inverted... How can it be ? > X [,1]…
Andrew
  • 926
  • 2
  • 17
  • 24
0
votes
1 answer

Does cuSolverDN or another CUDA library have a batched-version of QR decomposition for dense matrices to solve A*x = b?

I'm trying to solve A*x = b where A has complex values and is dense. I used cusolverDnCgeqrf() method from cuSolverDN library to do the QR decomposition for one linear set of equations. However, I want to do this several times to speed up the…
David K
  • 124
  • 4
0
votes
1 answer

Unable to get Linear Regression Cofficients in R after Successfully finding Q & R via Householder

I am manually trying to calculate the regression coefficients rather than using any default for data http://people.sc.fsu.edu/~jburkardt/datasets/regression/x31.txt Here is my code, which properly produces Q&R satisfying A=QR. But I am not able to…
0
votes
1 answer

Eigen QR decomposition results differs from two methods

I try to use QR decomposition using Eigen, but the results get from the following tow methods is different, please help me to find out the error! Thanks. // Initialize the sparse matrix A.setFromTriplets(triplets.begin(),…
zhaolewen
  • 1
  • 1