def power_rank ( x, T ): #*****************************************************************************80 # ## power_rank() takes one step of the power method. # # Licensing: # # This code is distributed under the MIT license. # # Modified: # # 07 August 2022 # # Author: # # John Burkardt # # Input: # # real x(N): the current vector. # # real T(N,N): the transition matrix. # # Output: # # real Tx(N): the product T*x # import numpy as np n = T.shape[0] index = np.arange ( 0, n ) Tx = np.matmul ( T, x ) Output = np.column_stack ( [ index, x, Tx ] ) print ( '' ) print ( ' x -> T*x' ) print ( Output ) return Tx