Skip to content

Sign Function

william-dawson edited this page Feb 20, 2018 · 2 revisions

Overview

This matrix sign module allows you to compute the sign of a matrix.

Sign(A) = A(A^2)^{-\frac{1}{2}}

Method

This functionality is based on Newton-Schultz iteration.

def Compute(InputMatrix):
  matrix_dimension = InputMatrix.shape[0]
  identity_matrix = identity(matrix_dimension)

  min_val, max_val = Helper.EigenCircle(InputMatrix)

  MatXk = (1.0/max_val)*InputMatrix
  xk = min_val/max_val
  coeff = [-0.5,0,1.5,-0.1]
  roots = roots(coeff)
  alpha = 0.0

  for r in roots:
    if r > 1.0 and r < math.sqrt(3):
      alpha = r

  for i in range(0,100):
    ak = min(sqrt(3.0/(1.0+xk+xk**2)),alpha)
    MatXkplus1 = 0.5*ak*MatXk.dot(3.0*identity_matrix-(ak**2)*MatXk.dot(MatXk))
    xk = 0.5*ak*xk*(3.0-(ak**2)*xk**2)
    check_value = norm(MatXkplus1-MatXk)
    MatXk = MatXkplus1
    if check_value < 1e-8:
      break
  return MatXk

How to Cite

Please cite the book of Higham if you use this module.

@misc{nicholas2008functions,
  title={Functions of matrices: theory and computation},
  author={Nicholas, J Higham},
  year={2008},
  publisher={SIAM}
}

If you use this module for electronic structure calculations, you should also give credit to the following sources:

@article{nemeth2000linear,
  title={Linear scaling density matrix search based on sign matrices},
  author={N{\'e}meth, K{\'a}roly and Scuseria, Gustavo E},
  journal={The Journal of Chemical Physics},
  volume={113},
  number={15},
  pages={6035--6041},
  year={2000},
  publisher={AIP}
}
@article{vandevondele2012linear,
  title={Linear scaling self-consistent field calculations with millions of atoms in the condensed phase},
  author={VandeVondele, Joost and Borstnik, Urban and Hutter, Jürg},
  journal={Journal of chemical theory and computation},
  volume={8},
  number={10},
  pages={3565--3573},
  year={2012},
  publisher={ACS Publications}
}