grandes-ecoles 2020 Q34

grandes-ecoles · France · centrale-maths1__psi Matrices Matrix Power Computation and Application
Explain what the Python function \texttt{maxSp} defined by: \begin{verbatim} def maxSp(Q:np.ndarray, k:int, t:float) -> float: n = Q.shape[1] E = np.exp(t * np.array(range(n))) A = Q * E B = puiss2k(A, k) C = np.dot(A, B) return C.trace() / B.trace() \end{verbatim} does.
Explain what the Python function \texttt{maxSp} defined by:
\begin{verbatim}
def maxSp(Q:np.ndarray, k:int, t:float) -> float:
    n = Q.shape[1]
    E = np.exp(t * np.array(range(n)))
    A = Q * E
    B = puiss2k(A, k)
    C = np.dot(A, B)
    return C.trace() / B.trace()
\end{verbatim}
does.