On 19.01.2023 18:28, Cottrell, Allin wrote:
On Thu, Jan 19, 2023 at 10:55 AM Sven Schreiber
<sven.schrei...@fu-berlin.de> wrote:
Am 19.01.2023 um 14:47 schrieb Cottrell, Allin:

Or more efficiently:

outfile null
# do stuff silently
end outfile

Ah, thanks, Allin, I was looking only for double-dash options in the doc and so 
I overlooked this one.

Actually, for Marcin's case something like "outfile stderr" might also be 
interesting.
I agree. That way you can stop the regular output stream from being
"spammed" by warnings, but also check for any warnings that might need
attention.

Allin
_______________________________________________
Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it
To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it
Website: 
https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/

Hi,

the solution was simpler that I thought: the problem was that print_NR_status() did verify 'set messages on/off' , but did not checked for 'set warnings on/off'. The patch in attachment.

Marcin

--
Marcin Błażejowski
diff --git a/lib/src/gretl_bfgs.c b/lib/src/gretl_bfgs.c
index 7d7f86313..ca1839b2f 100644
--- a/lib/src/gretl_bfgs.c
+++ b/lib/src/gretl_bfgs.c
@@ -2512,23 +2512,26 @@ static void print_NR_status (int status, double crittol, double gradtol,
 			     double sumgrad, PRN *prn)
 {
     int msgs = gretl_messages_on();
+    int wrns = gretl_warnings_on();
 
     if (status == GRADTOL_MET) {
-	if (msgs) {
-	    pprintf(prn, _("Gradient within tolerance (%g)\n"), gradtol);
-	}
+        if (msgs) {
+            pprintf(prn, _("Gradient within tolerance (%g)\n"), gradtol);
+        }
     } else if (status == CRITTOL_MET) {
-	if (msgs) {
-	    pprintf(prn, _("Successive criterion values within tolerance (%g)\n"),
-		    crittol);
-	}
+        if (msgs) {
+            pprintf(prn, _("Successive criterion values within tolerance (%g)\n"),
+                    crittol);
+        }
     } else if (status == STEPMIN_MET) {
-	if (sumgrad > 0) {
-	    pprintf(prn, _("Warning: couldn't improve criterion (gradient = %g)\n"),
-		    sumgrad);
-	} else {
-	    pprintf(prn, _("Warning: couldn't improve criterion\n"));
-	}
+        if (wrns) {
+            if (sumgrad > 0) {
+                pprintf(prn, _("Warning: couldn't improve criterion (gradient = %g)\n"),
+                        sumgrad);
+		    } else {
+		        pprintf(prn, _("Warning: couldn't improve criterion\n"));
+            }
+        }
     }
 }
 
_______________________________________________
Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it
To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it
Website: 
https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/

Reply via email to