Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3x3 Identity matrix returns erroneous results #3

Open
sarahcohen520 opened this issue Apr 8, 2019 · 12 comments
Open

3x3 Identity matrix returns erroneous results #3

sarahcohen520 opened this issue Apr 8, 2019 · 12 comments

Comments

@sarahcohen520
Copy link

hi !

we ran the code over 3x3 identity matrix.
the results do not multiply back to identity..

do you maybe know why ?

tnx,
sarah

@lucasmaystre
Copy link
Owner

Hi Sarah, can you share the files & the exact command invocation that you are using?

@sarahcohen520
Copy link
Author

Sure,
the file I use is :
cat THE_MATRIX_sparse1
3 3 3
1
0 1.0
1
1 1.0
1
2 1.0

and the cmd line :

./svd -o result -v 200 ./THE_MATRIX_sparse1

@sarahcohen520
Copy link
Author

and the results output:
Verbosity = 200
Loading the matrix...
Computing the SVD...
SOLVING THE [A^TA] EIGENPROBLEM
NO. OF ROWS = 3
NO. OF COLUMNS = 3
NO. OF NON-ZERO VALUES = 3
MATRIX DENSITY = 33.33%
MAX. NO. OF LANCZOS STEPS = 3
MAX. NO. OF EIGENPAIRS = 3
LEFT END OF THE INTERVAL = -1.00E-30
RIGHT END OF THE INTERVAL = 1.00E-30
KAPPA = 1.00E-06

NUMBER OF LANCZOS STEPS = 3
RITZ VALUES STABILIZED = 3

COMPUTED RITZ VALUES (ERROR BNDS)
1 9.99999985841008E-01 ( 0.00E+00)
2 1.00000000000000E+00 ( 0.00E+00)
3 1.00000000000000E+00 ( 0.00E+00)

SINGULAR VALUES: 3
1
1
1

LEFT SINGULAR VECTORS (transpose of U): 3 3
0.000271442 0.868467 -0.495747
-0.000308055 -0.868467 0.495747
3.43207e-05 0.495747 0.868467

RIGHT SINGULAR VECTORS (transpose of V): 3 3
0.000271442 0.868467 -0.495747
-0.000308055 -0.868467 0.495747
3.43207e-05 0.495747 0.868467
SINGULAR VALUES FOUND = 3; nsig=3

ELAPSED CPU TIME = 0 sec.
MULTIPLICATIONS BY A = 11

@lucasmaystre
Copy link
Owner

Hi Sarah,
thanks. I could indeed reproduce the bug (both with sparse and dense text input). The result of U^T dot V gives something close to

 1 -1 0
-1  1 0
 0  0 1

I don't know where the problem is coming from. Let me know if you make any progress on this issue.

@sarahcohen520
Copy link
Author

Hi Lucas,
First, thanks for your responses.
Second, I am compiling with gcc 6.3 in 64 bit.
while I am compiling with gcc 4.2 in 32 bit, I have different results, but still, not the good ones:

./bin/svd -r st -v 4 THE_MATRIX_sparse1
Verbosity = 4
Loading the matrix...
Computing the SVD...
SOLVING THE [A^TA] EIGENPROBLEM
NO. OF ROWS = 3
NO. OF COLUMNS = 3
NO. OF NON-ZERO VALUES = 3
MATRIX DENSITY = 33.33%
MAX. NO. OF LANCZOS STEPS = 3
MAX. NO. OF EIGENPAIRS = 3
LEFT END OF THE INTERVAL = -1.00E-30
RIGHT END OF THE INTERVAL = 1.00E-30
KAPPA = 1.00E-06

NUMBER OF LANCZOS STEPS = 1
RITZ VALUES STABILIZED = -1208451084

COMPUTED RITZ VALUES (ERROR BNDS)
1 0.00000000000000E+00 ( 1.38E+306)

SINGULAR VALUES: 0

LEFT SINGULAR VECTORS (transpose of U): 3 3
0 0 0
0 0 0
0 0 0

RIGHT SINGULAR VECTORS (transpose of V): 3 3
1 0 0
0 0 0
0 0 0
SINGULAR VALUES FOUND = 0; nsig=0

ELAPSED CPU TIME = 0 sec.
MULTIPLICATIONS BY A = 2
MULTIPLICATIONS BY A^T = 2

Can you please send me which gcc are you using and on which platform (32/64 bit)?
Thanks,
Sarah

@lucasmaystre
Copy link
Owner

Hi Sarah,
I am on a 64 bit platform. My GCC is in fact symlinked to clang (Apple LLVM version 10.0.1 (clang-1001.0.46.3)).

I get the exact same results you posted 3 days ago, on April 8.

If I use a matrix whose singular values are not all the same, e.g. the following dense text matrix:

3 3
1.0 0.0 0.0
0.0 2.0 0.0
0.0 0.0 3.0

then the results seem to be correct. Therefore, I wonder if SVDLIBC is not struggling with singular values of multiplicity > 1?

@sarahcohen520
Copy link
Author

this one is working for you:
3 3
1 0 0
0 1 0
0 0 1

@sarahcohen520
Copy link
Author

it is the dense matrix of the sparse that I sent you 3 days ago.

@sarahcohen520
Copy link
Author

this one is working for me also:
3 3
1.0 0.0 0.0
0.0 2.0 0.0
0.0 0.0 3.0,

@lucasmaystre
Copy link
Owner

The dense identity matrix does not work for me - it produces the same result as the one you sent 3 days ago (whether the format is dense or sparse).

@sarahcohen520
Copy link
Author

ok, also all the matrices that have values very closed to the identity matrix are not working.

Do you have an idea why?

@lucasmaystre
Copy link
Owner

No, unfortunately I don't have an idea where this might be coming from...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants