Skip to content

Matrix Square Root

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

Overview

The Square Root module allows you to compute either a matrix square root, or the inverse square root of a matrix.

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

Method

This functionality is based on a coupled Newton-Schultz iteration. Here is an example of how it might be implemented.

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

  min_val, max_val = Helper.EigenCircle(InputMatrix)
  lamda = 2.0/(max_val+min_val)

  Yk = InputMatrix.copy()
  Zk = identity_matrix.copy()

  for i in range(0,1000):
    Xk = lamda*Yk.dot(Zk)
    Tk = 0.5*(3.0*identity_matrix - Xk)
    Ykplusone = Tk.dot(Yk)
    norm_value = norm(Yk - Ykplusone)
    Zk = Zk.dot(Tk)
    Yk = Ykplusone.copy()

    if (norm_value < 1e-10):
      break

  return_mat = sqrt(lamda)*Yk
  inverse_return_mat = sqrt(lamda)*Zk

How to Cite

Please cite the paper of Jansik if you use this module.

@article{jansik2007linear,
title={Linear-scaling symmetric square-root decomposition of the overlap matrix},
author={Jans{\'\i}k, Branislav and H{\o}st, Stinne and J{\o}rgensen, Poul and Olsen, Jeppe and Helgaker, Trygve},
journal={The Journal of chemical physics},
volume={126},
number={12},
pages={124104},
year={2007},
publisher={AIP}
}