0
$\begingroup$

I have a vector

$$[10000, 1000, 800, 700, 500, 100, 12, 12, 12, 11, 8 , 7,6,4,3,1,0]$$

And I want to find out how many large numbers there are in my vector, which I call my population. In this case, there are 6 large numbers. The population is always sorted from largest to smallest. Sometimes there is only one large number.

Is there I way to compute this if we know that there is always at least one large number and the largest number is to the left? Then it comes the second largest number and so on.

I'm trying to reduct the size of the $S$ matrix from the SVD algorithm.

$$[U,S,V] = svd(A)$$

$\endgroup$
  • $\begingroup$ Looking for an exact answer or an estimation? What do you call large? $\endgroup$ – LinAlg Dec 25 '18 at 20:30
  • $\begingroup$ @LinAlg I don't know what large is. It can be 10 or 100000. But I kow that the first number is the largest, then it will decrease very fast. If the first number is 10000, then the second could be like 500 and then the rest could be under 10. $\endgroup$ – Daniel Mårtensson Dec 25 '18 at 20:32
  • $\begingroup$ I think the point is you have to define "large" if you want to go any further in this problem. Since you are dealing with some kind of "population", might I suggest that you compute the outliers of your population using a Tukey Fence and interquartile ranges? $\endgroup$ – ImNotTheGuy Dec 25 '18 at 20:37
  • $\begingroup$ @ImNotTheGuy Hmm..I don't think that is the correct tool to use. How about AIC? $\endgroup$ – Daniel Mårtensson Dec 25 '18 at 20:40
  • $\begingroup$ @DanielMårtensson You would then need some kind of statistical model. Are your matrices random in some way? The basic point still stands; until you specify more of your problem, this is basically too subjective to comment on beyond some really general ideas. $\endgroup$ – ImNotTheGuy Dec 25 '18 at 20:43
0
$\begingroup$

I found the answer now!

Just do:

>> rank(S) % or the vector I posted above

In MATLAB/Octave. Then we get our solution.

Prof:

[U,S,V] = svd(magic(12),'econ')
rank(S) 

We should get how many large numbers there are.

$\endgroup$
  • $\begingroup$ If $S$ is the diagonal matrix from your SVD decomposition, then the rank of $S$ is just the number of non-zero entries. You have just declared that all non-zero numbers should be called "large". I hope that this is what you are really looking for. $\endgroup$ – ImNotTheGuy Dec 25 '18 at 22:05
  • $\begingroup$ @ImNotTheGuy Singular values is allways positive. When I run the command above, I get the rank 3 because there is 3 large numbers, the rest is very close to 0, but still positive. $\endgroup$ – Daniel Mårtensson Dec 25 '18 at 22:10
  • $\begingroup$ The operation $\text{rank(S)}$ computes the number of linearly independent columns of your matrix, which for a diagonal matrix is just the number of non-zero entries. It could be the case that whatever program you are using is designed to account for rounding error for the "very small" values in your example code, but at least for the example vector posted in you question the rank will be $16$, not the $6$ you want it to be. You are welcome to code it up yourself to verify that computing the rank is not what you want for this problem. $\endgroup$ – ImNotTheGuy Dec 25 '18 at 22:14
  • $\begingroup$ @ImNotTheGuy Have you tried the code [U,S,V] = svd(magic(12),'econ'), rank(S) ? $\endgroup$ – Daniel Mårtensson Dec 25 '18 at 22:16
  • $\begingroup$ I have neither Matlab nor Octave, but I don't need them to know what the rank function does. I promise you that whatever is happening is due to round-off error, and not some magical function that decides what "large" means. Here is a sample computation showing you that the rank of a $4\times4$ matrix with the properties you are looking for has full rank, rather than the $1$ or $2$ you would probably say are actually "large". $\endgroup$ – ImNotTheGuy Dec 25 '18 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.