name of this normalisation

V

vaneric

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
 
V

vaneric

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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top