octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #8119] Allow variable tolerance and improv


From: Dan Sebald
Subject: [Octave-patch-tracker] [patch #8119] Allow variable tolerance and improve error messages for assert.m script
Date: Sun, 11 Aug 2013 22:03:41 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 SeaMonkey/2.15

Follow-up Comment #18, patch #8119 (project octave):

OK, this has become, "I can code that program in two loops".

I've incorporated your most recent index construction proposal along with some
code changes to remove loops in the other err structure cells.  Perhaps it is
too verbose this new way, but I'm fine with it.  I didn't really test
performance, but I think it probably can't get too much better than this. 
There is some duplication within the if-statements--maybe you can see a way to
put that into a function format, but that is tricky because we're adding to
err, not assigning err.

I've added some tests for multidimensional matrices, which really is not a
separate condition just checking the general behavior of the index
construction.

I've changed the other non-numerical tests to have the same indexing scheme as
the numerical tests.  (Previous to this change it was the linear index that
was reported...now it is the tuple index.)

I've changed the common prose to:

Abs err %g exceeds tol %gn"
Max rel err %g exceeds tol %g"

I also noticed that the test associated with:

## Try to avoid problems comparing strange values like Inf+NaNi.

was incomplete in the sense that it really didn't test all the scenarios that
could arise, so I made changes.  Rather than try to incorporate a "isnan" test
in that stage, I thought that if the NA and NaN tests were thorough, then
really there is no need to check/rule out any isnan within the Inf test.  By
checking the real() and the imag() for all three of these exception values,
everything is covered I think.  (The "Inf" test needs to check the sign of
"Inf" as well.)

For the dimensions, I placed the (D1xD2x...) alongside the matrix symbol in
the "Observed" and "Expected" columns, similar to what one sees with


>> zeros(3,0)
ans = [](3x0)


i.e.,


>> assert (zeros (2,0,2), zeros (2,0))
error: ASSERT errors for:  assert (zeros (2, 0, 2),zeros (2, 0))

  Location  |  Observed  |  Expected  |  Reason
     .         O(2x0x2)      E(2x0)      Dimensions don't match


How do you like that?

I think we are now getting to the point of tweaking things.  For example, I
would sort of prefer the leftmost tuple value be monotonic as opposed to the
rightmost tuple value:


>> assert (A.*(A!=2),A)
error: ASSERT errors for:  assert (A .* (A != 2),A)

  Location  |  Observed  |  Expected  |  Reason
   (2,1)          0            2         Abs err 2 exceeds tol 0
   (1,2)          0            2         Abs err 2 exceeds tol 0


but for now I'm fine with it.  And there is still the question of how to be
more explicit about the recursive tests:


>> assert (x, y)
error: ASSERT errors for:  assert (cond {i},expected {i},tol)

  Location  |  Observed  |  Expected  |  Reason
     []          dog          cat        Strings don't match


other than "fine as is".

(file #28813)
    _______________________________________________________

Additional Item Attachment:

File name: octave-assert_vector_tolerance-2013aug11.patch Size:16 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8119>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]