# name of this normalisation

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

1. ### vanericGuest

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

2. ### vanericGuest

On Jul 23, 5:58 pm, Eric Sosman <> wrote:

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