How to use the libceed.Basis.qr_factorization function in libceed

To help you get started, we’ve selected a few libceed examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CEED / libCEED / tests / python / test-3-ceed-basis.py View on Github external
def test_301(ceed_resource, capsys):
  ceed = libceed.Ceed(ceed_resource)

  qr = np.array([1, -1, 4, 1, 4, -2, 1, 4, 2, 1, -1, 0], dtype="float64")
  tau = np.empty(3, dtype="float64")

  qr, tau = libceed.Basis.qr_factorization(ceed, qr, tau, 4, 3)

  for i in range(len(qr)):
    if qr[i] <= 1E-14  and qr[i] >= -1E-14:
      qr[i] = 0
    print("%12.8f"%qr[i])

  for i in range(len(tau)):
    if tau[i] <= 1E-14  and tau[i] >= -1E-14:
      tau[i] = 0
    print("%12.8f"%tau[i])

  stdout, stderr = capsys.readouterr()
  with open(os.path.abspath("./output/test_301.out")) as output_file:
    true_output = output_file.read()

  assert stdout == true_output