I am a student working on project'indexing image' using the LSA modele in JAVA. Please, I want to ask you about how to show the result of the distance between the images of the base and the images of the test. I tried all methods but it did not work. Is there any help?



 this.Appliquer_LSA();
 
 
    }
 
    public double euclid(double [] req, double [] im)
        {
        double dist=0.0;
        for (int i=0;i<req.length;i++)
        dist=dist+((im[i]-req[i])*(im[i]-req[i]));
        dist=Math.sqrt(dist);
        return dist;
        }
 
 
    public void Appliquer_LSA()
        {
 
            int [][] resultats=new int [20][140];
            double [][] distances=new double[20][140];
 
             Matrix train=new Matrix(this.term_doc);
             Matrix test=new Matrix(this.term_doc_test);
             Matrix s=train.transpose();
             Matrix t=test.transpose();
 
 
 
             SingularValueDecomposition svd=new SingularValueDecomposition(s);
 
             Matrix U=svd.getU();//docs
             Matrix S=svd.getS();
             Matrix V=svd.getV();//mots
           System.out.println("Affichage des distances");
            int j=0;//nombre de requetes
            while (j<20)
            {
                System.out.println("Req N°: "+j);
             double [][] requ=new double [20][1];
 
            for (int i=0;i<20;i++) requ[i][0]=this.term_doc_test[i][j];
             Matrix req=new Matrix(requ);
 
             Matrix r=req.transpose().times(V.times(S));//
            //  System.out.println("r:  "+r.getRowDimension());
             double [] requet=new double[20];
             for (int k=0;k<20;k++) requet[k]=r.get(0, k);
 
             for (int x=0;x<140;x++)
             {
              double [] image=new double[20];
              for (int k=0;k<20;k++) image[k]=U.get(x, k);
              distances[j][x]=this.euclid(requet, image);
                         //tri des distances
 
            }
      //       int [] res=Arrays.sort(distances[j]); 
             int [] res=this.tri_1(distances[j]);
               for (int g=0;g<res.length;g++)
         //          System.out.println(g+"***lguit*****************"+res[g]);
               for (int f=0;f<res.length;f++)
                 resultats[j][f]=res[f];
            // for (int y=0;y<distances.length;y++) System.out.println("Distances: "+distances[y]);
            j++;
            }
            String text="";
            for (int f=0;f<distances.length;f++)
                for (int g=0;g<distances[0].length;g++)
                    text=text+distances[f][g]+"\n";
            ReadFile rf=new ReadFile();rf.writefile("d:/mender/1.txt",text);
 
            System.out.println("Affichage de la 1ère image de réponse:");
 //   for (int y=0;y<resultats[0].length;y++) System.out.println(y+"::Résultats: "+resultats[1][y]);
 
 
    // for (int f=0;f<resultats.length;f++)
                for (int g=0;g<resultats[0].length;g++);
                    //System.out.println(g+"***lguit*****************"+resultats[0][g]);
    this.evaluationMAP(resultats);