## max value between many matrix

## max value between many matrix

(OP)

Hello, i have a problem to find the maximum value between many array.

I do a "cicle do", and i found 2718 array. I would like to find the maximum value between this 2718 array.

This is one part of the code:

do i=2, 5436, 2

y = Matmul (Om,y) + Matmul (g0, Vm)*H(2,i)+Matmul(g0, Vm)*H(2,i+2)

end do

obviously y assumed 2718 different values in the arrays.

Sorry for my english.

Thx in advance.

I do a "cicle do", and i found 2718 array. I would like to find the maximum value between this 2718 array.

This is one part of the code:

do i=2, 5436, 2

y = Matmul (Om,y) + Matmul (g0, Vm)*H(2,i)+Matmul(g0, Vm)*H(2,i+2)

end do

obviously y assumed 2718 different values in the arrays.

Sorry for my english.

Thx in advance.

## RE: max value between many matrix

Sorry, but I didn't understand what you want to find:

1. a maximum array of all the computed arrays, i.e. one array of the 2718 arrays with the maximum norm ||y||

or

2. one maximum element y(k) of all the 2718 arrays computed

?

## RE: max value between many matrix

2. one maximum element y(k) of all the 2718 arrays computed

The matrix have this dimension (2,1). I want to find the maximum element y(1,1) of all the 2718 arrays computed between all the 2718 arrays computed.

## RE: max value between many matrix

If you need the maximum of all values y(1,1) computed in 2718 steps you can enhance the loop with a simple maximum computation like this:

## CODE

or if you think that you will need all the values of y(1,1) after the loop for other research you can rather store them first in a separate array and then find the maximum of this array - for example like this:

## CODE

## RE: max value between many matrix

But if instead, always from the following expression:

do i=2, 5436, 2

y = Matmul (Om,y) + Matmul (g0, Vm)*H(2,i)+Matmul(g0, Vm)*H(2,i+2)

I would like that in the matrix product "Om * y", the "y" was the one obtained in the previous calculation. I'll explain better, I give the initial conditions of "y", ie y (1,1) = 0 and y (2,1) = 0 and calculate the value of "y" with the previously written expression. In practice I would like to calculate the first value of "y" with those boundary conditions, the second value of "y" according to the value obtained from the first value of "y" and so on.

## RE: max value between many matrix

Before the loop you have y=y0

the in the first iteration for i = 2 you will get from the computation y = Matmul (Om,y) + ...

the new value i.e. y1 = Matmul (Om,y0) + ...

in the second iteration for i = 4 you will get from the computation y = Matmul (Om,y) + ...

then new value y2 = Matmul (Om,y1) + ..

... etc ...

If you are unsure prove it, printing the value of the array y in some iterations or inspect it in the debugger.

## RE: max value between many matrix