name of this normalisation

Discussion in 'Java' started by vaneric, Jul 23, 2008.

  1. vaneric

    vaneric Guest

    hi
    i am studying linear algebra and was reading thru some code processing
    image data.i came across a piece of code that does some normalising as
    below

    public demoNorm(double[][] eigenfacesArray){
    for(int i=0;i<eigenfacesArray.length;i++){
    double norm=norm(eigenfacesArray);
    for(int x=0;x<eigenfacesArray.length;x++){
    double v=eigenfacesArray[x];
    eigenfacesArray[x]=v/norm;

    }

    }

    }

    private double norm(double[][] x){
    int nr= x.length;
    int nc= x[0].length;
    double val=0.0;
    for(int r= 0; r< nr; r++){
    for(int c= 0; c< nc; c++){
    val+= (x[r][c])* (x[r][c]) ;
    }
    }
    return val;
    }


    when i tried this for a sample double[][] as below
    double[][]=new double[][]{
    {2.4,6.4,1.2,7.6,4.3},
    {1.5,3.1,6.4,5.7,2.5},
    {7.8,6.8,4.6,3.5,4.3},
    {9.8,7.8,6.5,1.2,3.3}
    };

    i found that norm() yields a value equal to square of Frobenius norm
    ( ie ,norm()==> 586.410 while Frob norm=24.2159)

    I am no expert in linear algebra,so i want to know if this norm has
    any particular name.Also,is the above way of normalisation valid? or
    do i have to find the sq.root of norm before i divide the elements of
    the double[][]? can some experts help me with this?

    thanks
    eric
     
    vaneric, Jul 23, 2008
    #1
    1. Advertising

  2. vaneric

    vaneric Guest

    On Jul 23, 5:58 pm, Eric Sosman <> wrote:
    > How can I help you understand code you haven't shown?


    sorry,
    my mistake in copying the methods
    there were 2 versions of norm(), one that takes in a double[][] and
    another that takes in a double[]

    for the demoNorm() above,the following method was used
    private double norm(double[] x){
    double val=0.0;
    for(int i=0;i<x.length;i++){
    val+=(x*x);
    }
    return val;
    }


    for my sample double[][] i used the other version (which takes in a
    double[][])

    sorry again for the silly mistake of a beginner
    eric
    p.s: great reply..really enjoyed it!
     
    vaneric, Jul 23, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?iso-8859-1?B?bW9vcJk=?=
    Replies:
    7
    Views:
    830
    Roedy Green
    Jan 2, 2006
  2. ding feng
    Replies:
    2
    Views:
    2,822
    ding feng
    Jun 25, 2003
  3. Bobby Chamness
    Replies:
    2
    Views:
    2,401
    Joe Smith
    Apr 22, 2007
  4. Jack-2
    Replies:
    3
    Views:
    273
    Jack-2
    Dec 24, 2003
  5. Java  script  Dude

    IE name="name" & form.name property bug

    Java script Dude, Jun 29, 2004, in forum: Javascript
    Replies:
    5
    Views:
    248
    Java script Dude
    Jun 30, 2004
Loading...

Share This Page