0

I have a script to compute eigenvalues and vectors without balancing, which I used almost daily for years, that requires nag4py. The code is in this blog: http://www.walkingrandomly.com/?p=5303 for which there is an associated SO post (How to use eig with the nobalance option as in MATLAB?).

Yesterday I upgraded nag4py and now I run into the following error when running the same script that has been working for years:

from nag4py.util import Nag_RowMajor,Nag_NoBalancing,Nag_NotLeftVecs,Nag_RightVecs,Nag_RCondEigVecs,Integer,NagError,INIT_FAIL

ImportError: cannot import name INIT_FAIL

In the meantime I have solved the problem by importing octave which uses the no balancing option by default. But I would like to resolve the issue with nag4py.

I have tested the NAG licence and it is valid.

Community
  • 1
  • 1
Isopycnal Oscillation
  • 3,234
  • 6
  • 21
  • 37

1 Answers1

0

The release version of the nag4py package uses 'quiet_fail' and 'noisy_fail', which are documented in the embedded doc:

Error or warning cases detected by the NAG C Library are handled in nag4py using a similar NagError mechanism as in the Library itself. The nag4py util module provides two convenience functions ('quiet_fail' and 'noisy_fail') to create a NagError instance with printing of messages disabled or enabled, respectively.

Here's the change:

Index: nag4py/util.py
===================================================================
--- nag4py/util.py  (revision 104707)
+++ nag4py/util.py  (revision 104708)
@@ -4736,14 +4736,20 @@
     return _arg


-def INIT_FAIL(fail):
+def quiet_fail():
+    "Returns a NagError instance with printing disabled."
+    fail = NagError()
     fail.eprint = Nag_FALSE
+    return fail

-def SET_FAIL(fail):
+def noisy_fail():
+    "Returns a NagError instance with printing enabled."
+    fail = NagError()
     fail.eprint = Nag_TRUE
+    return fail

-__all__.append("INIT_FAIL")
-__all__.append("SET_FAIL")
+__all__.append("quiet_fail")
+__all__.append("noisy_fail")

 def get_input_func():
     from sys import version_info
MatCross
  • 389
  • 1
  • 5