Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8128871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:04:28+00:00 2026-06-06T08:04:28+00:00

i have this array double a[][] = {{1,1,1}, {0,1,1} , { 1,0,0} ,{0,1,0},{1,0,0},{1,0,1},{1,1,1},{1,1,1},{1,0,1},{0,2,0},{0,1,1}}; and

  • 0

i have this array

double a[][] = {{1,1,1}, {0,1,1} , { 1,0,0}
        ,{0,1,0},{1,0,0},{1,0,1},{1,1,1},{1,1,1},{1,0,1},{0,2,0},{0,1,1}};

and i want to get SVD (singular value decomprestion) ,
this is the code

Matrix A = new Matrix(a);
        SingularValueDecomposition s = A.svd();
        Matrix U = s.getU();
        Matrix S = s.getS();
        Matrix V = s.getV();

        Matrix K = U.times(S.times(V.inverse()));
        System.out.println("A=\n" + A);
        System.out.println("U=\n" + U);
        System.out.println("S=\n" + S);
        System.out.println("V=\n" + V);
        System.out.println("K=\n" + K);

i used JAMA library and i got these results

U=
0.42012156898152025   -0.07479925424066838   -0.04597243910578701   
0.29948675880470416   0.20009225506128975   0.4078276625537902   
0.12063481017681585   -0.27489150930195816   -0.4538001016595771   
0.15756100229407313   0.3046476172068067   -0.2006466962808193   
0.12063481017681585   -0.27489150930195816   -0.4538001016595771   
0.2625605666874469   -0.379446871447475   0.15467425717503247   
0.42012156898152014   -0.0747992542406683   -0.04597243910578692   
0.42012156898152014   -0.0747992542406683   -0.04597243910578692   
0.2625605666874469   -0.379446871447475   0.15467425717503247   
0.31512200458814627   0.6092952344136134   -0.4012933925616386   
0.29948675880470416   0.20009225506128975   0.4078276625537902   

S=
4.098871971532176   0.0   0.0   
0.0   2.361570801317849   0.0   
0.0   0.0   1.2736686819384786   

V=
0.49446664222485476   -0.6491757618976977   -0.5779909773443018   
0.6458223761096932   0.7194469174866516   -0.2555574131873014   
0.581735505399926   -0.24691489036406603   0.7749947346102383 

but V is wrong , it should be like this

V=
-0.49446664222485476 0.6491757618976977 -0.5779909773443018
-0.6458223761096932 0.7194469174866516 -0.2555574131873014
-0.581735505399926 0.24691489036406603 0.7749947346102383

and really this is a hug mistake , because after multibluein USV i got this matirx , just see the E-16

K=
1.0000000000000013   1.0000000000000004   1.000000000000001   
4.996003610813204E-16   1.0   0.9999999999999998   
1.0000000000000002   -3.885780586188048E-16   8.881784197001252E-16   
-1.1102230246251565E-16   1.0000000000000002   1.3877787807814457E-16   
1.0000000000000002   -3.885780586188048E-16   8.881784197001252E-16   
1.0000000000000004   -5.551115123125783E-16   1.0000000000000004   
1.0000000000000009   1.0000000000000002   1.0000000000000007   
1.0000000000000009   1.0000000000000002   1.0000000000000007   
1.0000000000000004   -5.551115123125783E-16   1.0000000000000004   
-2.220446049250313E-16   2.0000000000000004   2.7755575615628914E-16   
4.996003610813204E-16   1.0   0.9999999999999998   

please help me , what should i do , where is the wrong, is JAMA wrong ?!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T08:04:30+00:00Added an answer on June 6, 2026 at 8:04 am

    The results look correct. In matrix K, values like 1.0000000000000013 and 4.996003610813204E-16 are [very close to] 1 and 0, respectively. There is floating point error happening here, which is why the numbers are slightly off. Matlab does the same thing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array and I want to get the max value and its
I have a double[][] array, and I want to get one row into a
I have this 2D array (say double[10][10]) which contain some 1.0 and 10.0, rest
I have this array: string[,] productData = new string[5,7]; I bind it to a
I have a Matrix class and I want to pass an array to the
I have a problem with this bit of code: #include <boost/multi_array.hpp> #include <boost/array.hpp> #include
I have a double[] of huge size. (Ex : Eg. double[] array = new
I have this array property in my model and would like to see it
I have this array that I am needing to insert into the database. My
I have this array {$man_data} which is structured like 10 > 'Text 8' 14

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.