hy all, how to compute eigenvector from array bellow?
I am confused in make nested loop and temporary for compute eigenvector

please help me!!!

$data = array(
            array(1,-0.52836,0),
            array(-0.52836,1,-0.19845), 
            array(0,-0.19845,1)
            );
$data2 = array(
array(1),
array(1),
array(1)
);

echo "<pre>";
//print_r($data2);
echo "</pre>";



for ($i=0;$i<count($data);$i++)
        {
            for ($j=0;$j<count($data[$i]);$j++)
             {
                 $R2[$i][$j] = (($data[$i][0]*$data[0][$j])+($data[$i][1]*$data[1][$j])+($data[$i][2]*$data[2][$j]));
             }
        }


echo "<pre>";
print_r($R2);
echo "</pre>";



$aR = array();
for ($i=0;$i<count($R2);$i++)
        {
            for ($j=0;$j<count($R2[$i]);$j++)
             {
             if (isset($data2[$i][$j])){
             $aR[]  = (($R2[$i][0]*$data2[$i][$j])+($R2[$i][1]*$data2[$i][$j])+($R2[$i][2]*$data2[$i][$j]));
             }
    }
}
echo "<pre>";
//print_r($aR);
echo "</pre>";

$max = $aR;
$max = (max($max)); 

for ($i=0;$i<count($aR);$i++)
        {
  $iteration[] = round($max/$aR[$i],5);
}       

echo "<pre>";
//print_r($iteration);
echo "</pre>";
Member Avatar for diafol

is this homework?

I haven't gone through your code in detail, but perhaps you could give a rough outline of what the inputs are and what the program does.

The reason I ask is because usually when eigenvectors are computed, they are computed for corresponding eigenvalues.

i.e. - Solve [A] - [I]lambda = 0

where lambda is a specific eigenvalue.

Then the process is repeated for each eigenvalue.

I don't see where an eigenvalue is input so that the corresponding eigenvector can be computed. Does the data in the array already represent [A] - [I]lambda? Otherwise, it looks like you are going straight to the computation of the eigenvectors.

this my thesis use PCA method in one of step there is compute eigenvector
can you help me?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.