networksns.centrality_measures.exponential_symmetric_quadrature

networksns.centrality_measures.exponential_symmetric_quadrature(A, u, tol=1e-07, maxit=50)

Computes \(q=u^Te^Au\). The computation is done by means of Lanczos method according to [1].

Parameters:
  • A (array_like) – sparse/dense symmetric matrix.

  • u (array) – vector.

  • tol (float,optional) – tolerance for convergence, relative accuracy, default: 1e-7.

  • maxit (integer, optional) – maximum number of Lanczos iterations, default: 50.

Returns:

q: (float) value of the quadratic form \(u^Te^Au\).

Examples

>>>  from networksns import centrality_measures as cm
>>>  import numpy as np

Create symmetric matrix \(A\)

>>>    A = np.arange(0, 9, 1)
>>>    A = A.reshape(3, 3)
>>>    A = A + A.transpose()
       array([[ 0,  4,  8],
              [ 4,  8, 12],
              [ 8, 12, 16]])

Create vector \(u\)

>>>     u = np.arange(0, 3)
        array([0, 1, 2])

Compute \(q=u^T e^A u\).

>>>    q = cm.exponential_symmetric_quadrature(A, u)

References