7 views (last 30 days)

Hi,

I am looking for a way to compute SVD of each row of a matrix without using a loop.

thanks

Christine Tobler
on 1 Sep 2020

The SVD of a row vector has the singular value equal to its norm, and the singular vectors 1 and the normalized vector.

If this is really what you are looking for, you can compute the singular values using

S = vecnorm(A);

and the singular vectors using

V = A ./ S;

(you might need to transpose these)

John D'Errico
on 1 Sep 2020

John D'Errico
on 1 Sep 2020

Edited: John D'Errico
on 1 Sep 2020

Sorry, but this seems to make little sense, since most of that set of singular value decompositions will be trivial. Or, perhaps, let me ask what it is that you are looking to do here? Computing the SVD of each row of a matrix just means you want to find the SVD of a sequence of row vectors.

That is, if X is ANY row vector, then what is the svd(X)? The SVD returns three arrays, thus U,S,V. If X is a row vector, then we will always have U == 1.

Likewise, for any row vector X, S will be a row vector of the same size as X, with all identical zeros except for the first element, which will be norm(X).

Finally, V will be an nxn array, which n is the length of X. The first column of V will be X'/norm(X), so X scaled to have unit norm. The remaining columns of V will be the null space of X, thus a basis for the n-1 dimensional subspaces that is orthogonal to the vector X.

For example...

X = 1:3

X =

1 2 3

[U,S,V] = svd(X)

U =

1

S =

3.74165738677394 0 0

V =

0.267261241912424 -0.534522483824849 -0.801783725737273

0.534522483824849 0.774541920588438 -0.338187119117343

0.801783725737273 -0.338187119117343 0.492719321323986

Since it is trivial to compute U and S for any set of row vectors, and it is trivial to compute the 2-norm of any set of row vectors, AND it is trivial to scale a vector to unit length by dividing by the 2-norm, then you must be asking how to compute the nullspaces of each of a set of vectors?

Note that those nullspaces are not unique.

The point is, depending on what you really wanted from this, it can arguably be far easier to compute if we know what it is that you are looking to find. We also would need to know the length of your vectors, since there are easy ways to do this computation without any need for the SVD at all, if the dimension of the problem is low.

Jayant chouragade
on 2 Sep 2020

Bruno Luong
on 2 Sep 2020

As I read the paper suggests to compute D(theta) where theta is the vector of length p (number of sensor?), which is a matrix that has p rows (and (p*M) columns).

Then you have to search the best theta vector in the "hypothesized DOA θ" (whatever that mean, possibly the set of vector angles when a specific obstacle is somewhere inside the measurement volume) by maximizing the the inverse of the smallest singular value of this matrix.

Are we suppose to read the paper at your place?

Opportunities for recent engineering grads.

Apply TodayFind the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
## 0 Comments

Sign in to comment.