hi all, how to do multiplication matrix with iteration and stop iteration if value >= 5?

$data = array(
array(1,-0.52836),
array(-0.52836,1,),

);
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]));
}
}


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

result:
1.279164732 -1.056721269
-1.056721269 1.318545629

how to do nested loop from process above until the result:
iteration 1:
$data * $data =
1.279164732 -1.056721269
-1.056721269 1.318545629

iteration 2:
$R2 * $R2 =
2.752922251 -2.703440873
-2.703440873 2.752921564

iteration 3:
result($R2 * $R2) * $R2=
6.378224523 -6.367216988
-6.367216988 6.378222905

loop break because value array >= 5
please help me :3

Member Avatar for LastMitch

hi all, how to do multiplication matrix with iteration and stop iteration if value >= 5?

@cussel

It has something to do with your calculation.

line 10 ?

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.