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

2
Contributors
1
Reply
10
Views
4 Years
Discussion Span
Last Post by 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 ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.