Finding full QR decomposition from reduced QR - math

What's the best way to find additional orthonormal columns of Q? I have computed the reduced QR decomposition already, but need the full QR decomposition.
I assume there is a standard approach to this, but I've been having trouble finding it.
You might wonder why I need the full Q matrix. I'm using it to apply a constraint matrix for "natural" splines to a truncated power series basis expansion. I'm doing this in Java, but am looking for a language-independent answer.

Successively add columns to Q in the following way:
Pick a vector not already in the span of Q
Orthogonalize it with respect to the columns of Q
Add the orthogonalized vector as a new column of Q.
Add a row of zeros to the bottom of R
For reference, see these illustrative albeit mathematical lecture notes
Just in case, the process of "orthogonalization" of a new vector is an old technique called the Gram-Schmidt process, and there is a variant which is numerically stable.

Related

Migration Matrix in a Two-Dimensional Torus-Like Space: create a migration matrix in R

I'm working on a standard problem in random walk in two dimension.
In particular, I'm trying to generate a migration matrix for a toroidal model (Toroidal Transition Matrix) in R.
I have previously posted the same problem here: Transition matrix for a two-dimensional random walk in a torus: compute matrix in R
However, I did not get any feedback.
Similarly to what I mentioned in that post, I decided to assume independent movement along each dimension. Therefore, instead of calculating a Toroidal migration matrix and retrieve transition probabilities, I have multiplied independent probabilities from two separate 'one-dimensional circular model'.
I'm not sure whether this is formally correct and I would like to have some opinion on this regard.
Yes, to walk within the torus with each dimension being independent you do just multiply the transition probabilities. If there are n states in your circular graph, then there would be n^2 states in your torus and so you should expect a n^2 x n^2 transition matrix.
To give any more detail you'll have to specify exactly what you need to know.

Forming a query vector in LSA

After performing the SVD of a term-document matrix, and getting a reduced rank matrix, various sources have stated the following reduced query vector formula. It seems easy to see how its derived.
However, in this link, the query vector is calculated as centroid of the corresponding reduced term vectors. I tried to see if the two were the same, but the results were different.
What is the difference between the two and what are the pros/cons of using either?

Laplace expansion for determinants with r

I have a 21*21 matrix. I would like to use R in order to apply laplace extension along the first row so to display only the last step for the calculation of the determinant (2x2 matrix).
Unluckily, despite my best efforts, I can't figure out how this could be done.
To be clearer I provide an example with a 3x3 matrix
e.g. r <- matrix(c(1:9),3,3)
My aim is to find an expansion along the first row, so to obtain the three cofactors. These cofactors should be visualized so to distinguish the three minor matrices, the multiplying corresponding element of the matrix, and the signs of the permutation.
TO have a visual you can take a look to the first example in (http://en.wikipedia.org/wiki/Laplace_expansion)
Any suggestions? Thank you

Solving a system of unknowns in terms of unknowns

I am trying to solve a 5x5 Cholesky decomposition (for a variance-covariance matrix) all in terms of unknowns (no constants).
A simplified version, for the sake of giving an example, would be a 2x2 decomposition:
[[a,0],[b,c]]*[[a,b],[0,c]]=[[U1,U2],[U2,U3]]
Is there a software (I'm proficient in R, so if R can do it that would be great) that could solve the above to yield an answer of the left-hand variables in terms of the right-hand variables? i.e. this would be the final answer:
a = sqrt(U1)
b = U2/sqrt(U1)
c = sqrt(U3+U2/U1)
Take a look at this Wikipedia section.
The symbolic definition of the (i,j)th entry of the decomposition is defined recursively in terms of the entries above and to the left. You could implement these recursions using Matlab's Symbolic Math Toolbox and then apply them (symbolically) to obtain your formulas for the 5x5 case. Be warned that you'll probably end up with extremely complicated formulas for some of the unknowns, and - excepting unusual circumstances - it will be fine to implement the decomposition iteratively even for a fixed size 5x5 matrix.

How do I generate data from a similarity matrix?

Suppose there are 14 objects, each of which have or do not have 1000 binary features. I have a 14x14 similarity matrix, but not the raw 14x1000 data. Is there a way to reconstruct or generate something similar to the raw data, given the similarity matrix?
I tried Monte Carlo simulations, but unconstrained they would take way too much time to achieve even a low level of consistency with the original similarity matrix.
I saw this relevant question: Similarity matrix -> feature vectors algorithm?. However, they wanted to reduce not increase dimensionality. Also, I am not sure (1) which matrix or matrices to use, and (2) how to convert into a binary matrix.
It's impossible to say for sure unless you describe how the similarity scores were computed.
In general, for the usual kind of similarity scoring this is not possible: information has been lost in the transformation from individual features to aggregate statistics. The best you can hope to do is to arrive at a set of features that are consistent with the similarity scores.
I think that is what you are talking about when you say "similar to" the original. That problem is pretty interesting. Suppose similarity was computed as the dot-product of two feature vectors (ie the count of features for a pair of objects that both have value = 1/true). This is not the only choice: it is consistent with value of 0 (false) meaning no information. But it may generalize to other similarity measures.
In such a case, the problem is really a linear programming problem: a naive approach is to exhaustively search the space of possible objects - not randomly, but guided by the constraints. For example, suppose SIM(A,B) := similarity of object A and object B. Define an order on these vectors.
If SIM(A,B) = N, then choose A=B minimal (like (1,....,1 (N times), 0, .... 0 (1000-N times)), and then choose the minimum C s.t. (A,C), (B,C) have the given values. Once you find an inconsistency, backtrack, and increment.
This will find a consistent answer, although the complexity is very high (but probably better than monte carlo).
Finding a better algorithm is an interesting problem, but more than this I can't say in a SO post - that's probably a topic for a CS thesis!

Resources