Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Mata logical operators

From   "U.A.QU.AP" <>
Subject   st: Mata logical operators
Date   Wed, 25 Oct 2006 21:18:09 +0200 (CEST)

Dear all,
I've written a loop that maximize a given function. In order to
control convergence i use 3 critereon
iteration number and 2 scalars for tolerance
My statement is :
while ((critb > eps) || (crita > eps^2) || (iter <= 31)) {
I expect that Mata must stop the loop when at least one of the three critereon is reached. But the problem is:  Mata goes untill iteration 112 (for example) and it doesn't stop the loop at iteration 31 as expected.
My output portion is given below:
End iteration    112.00
Stepsize:      0.02
Criterion:      1.35
Percent variation:      0.00
Even when i replace (||) by (|) I get the same results
any ideas to resolve this problem? Waht is the logic of mata to evaluate 3 or more condition in the while loop?
Thank you
AbdelRahmen El Lahga

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index