bugGNU Octave - Bugs: bug #55570, quiver3 input validation should be...

 
 

bug #55570: quiver3 input validation should be tighter

Submitter:  Doug Stewart <dastew>
Submitted:  Fri 25 Jan 2019 02:24:36 PM UTC
 
Category:  Octave Function Severity:  3 - Normal
Priority:  3 - Low Item Group:  Feature Request
Status:  In Progress Assigned to:  None
Originator Name:  doug Stewart Open/Closed:  * Open
Release:  * dev Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Sun 03 Mar 2019 11:12:16 PM UTC, comment #7: 

I changed the documentation and the input validation for the 4-input form of the function to work (https://hg.savannah.gnu.org/hgweb/octave/rev/677764865056).  The input validation needs to be improved because it is simple to confuse the _quiver_.m function right now.  The following code uses a 3-input form which is invalid, but the message is obtuse.

z = peaks (25);
[u, v, w] = surfnorm (z / 10);
h = quiver3 (u, v, w);
error: varargin(6): out of bound 5
error: called from
    __quiver__ at line 52 column 9
    quiver3 at line 86 column 10

Rik <rik5>
Project Administrator
Tue 05 Feb 2019 05:57:35 PM UTC, comment #6: 

Priority 1: Update documentation to refer to the 4-argument input form, and remove the 3-input form.  Update the text to more accurately describe what is going on.

Priority 2: Update input validation to handle 4-argument input form.  Test code which must pass.

z = peaks (25);
surf (z);
hold on;
[u, v, w] = surfnorm (z / 10);
h = quiver3 (z, u, v, w);

Currently this fails with

error: __quiver__: operator +: nonconformant arguments (op1 is 15625x1, op2 is 625x1)
error: called from
    __quiver__ at line 197 column 10
    quiver3 at line 87 column 10

Changed the Release to refer to the development branch.  Although, as a documentation and bug fix it can be backported to stable.

Rik <rik5>
Project Administrator
Sat 26 Jan 2019 07:34:19 PM UTC, comment #5: 

Doug - as I mentioned, the Z argument should be required, refer to the Matlab documentation.

Mike Miller <mtmiller>
Project Administrator
Sat 26 Jan 2019 03:49:00 AM UTC, comment #4: 

I have a version that now works, but!
Because it has to make up the x,y and z numbers,
the x and y are easy but what to do with the z?
at the moment my version draws the 3d arrows on a flat surface in the z. the arrows can point at any direction in 3d but are all starting on a flat surface in z. I don't know of any other way to make this work.

withe the 4th input being the z height then it would not be on a flat surface.

This could never have worked in the past ( and we had no complaints !)
Any Thoughts?

Doug Stewart <dastew>
Fri 25 Jan 2019 11:10:08 PM UTC, comment #3: 

the doc says that
 If X, Y, and Z are not given they are assumed to be '(1:M, 1:N,
     1:P)' where '[M, N] = size (U)' and 'P = max (size (W))'.

and when I was single stepping through, I saw it create the x,y,z
with integer numbers. so I still thing it will work.

I will keep looking, but it is not very important for this release

Doug Stewart <dastew>
Fri 25 Jan 2019 08:39:32 PM UTC, comment #2: 

I don't think the 3-argument form is Matlab compatible, however, after looking at https://www.mathworks.com/help/matlab/ref/quiver3.html.

The Octave documentation seems like it is simply describing the interface incorrectly. There is no 3-argument form, and the 6-argument form requires x,y,z to have the same dimensions as u,v,w, so they cannot be the output of a 3-nargout call to meshgrid.

There is a 4-argument form that is not documented in Octave's doc string at all, where X and Y are implied and Z defines the surface on which the vector field is plotted.

So going back to the example in Octave's doc string, this should not be expected to work:

[x, y, z] = peaks (25);
[u, v, w] = surfnorm (x, y, z / 10);
quiver3 (u, v, w);

But this should work, and currently fails in Octave:

quiver3 (z, u, v, w);

Mike Miller <mtmiller>
Project Administrator
Fri 25 Jan 2019 06:26:54 PM UTC, comment #1: 

Confirmed with 5.0.90, and this does not seem to be a regression, just a bug that is never exercised. All of the help and demo examples for quiver3 use the 6-argument form.

This error occurs with both the 3-argument form, when passing in x,y,z as vectors, or as a meshgrid.

>> u = rand (25);
>> v = rand (25);
>> w = rand (25);
>> quiver3 (u, v, w)
error: __quiver__: operator +: nonconformant arguments (op1 is 15625x1, op2 is 625x1)
error: called from
    __quiver__ at line 197 column 10
    quiver3 at line 87 column 10

>> x = 1:25; y = 1:25; z = 1:25;
>> quiver3 (x, y, z, u, v, w)
error: __quiver__: operator +: nonconformant arguments (op1 is 15625x1, op2 is 625x1)
error: called from
    __quiver__ at line 197 column 10
    quiver3 at line 87 column 10

>> [x, y, z] = meshgrid (1:25, 1:25, 1:25);
>> quiver3 (x, y, z, u, v, w)
error: __quiver__: operator +: nonconformant arguments (op1 is 15625x1, op2 is 625x1)
error: called from
    __quiver__ at line 197 column 10
    quiver3 at line 87 column 10

Mike Miller <mtmiller>
Project Administrator
Fri 25 Jan 2019 02:24:36 PM UTC, original submission:  

The help screen says that it can take 3 inputs
: quiver3 (u, v, w)

but it does not work.
If we take the example from the help documentation


1[x, y, z] = peaks (25);
surf (x, y, z);
hold on;
[u, v, w] = surfnorm (x, y, z / 10);
h = quiver3 (x, y, z, u, v, w);
set (h, "maxheadsize", 0.33);

it works. But now to test the three input mode try:
h = quiver3 (u, v, w);

this errors with a very unusual error message:

stopped in /usr/local/share/octave/5.0.1/m/plot/draw/quiver3.m at line 81
81:   oldfig = [];
debug>
error: _quiver_: operator +: nonconformant arguments (op1 is 15625x1, op2 is 625x1)
error: called from
    _quiver_ at line 197 column 10
    quiver3 at line 87 column 10
    testquiver3 at line 5 column 3

Doug Stewart <dastew>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dastew (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

     

     

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-12 rik5 Priority5 - Normal 3 - Low
        Item GroupUnexpected Error or Warning Feature Request
        Summaryquiver3 gives error for 4-input form of function quiver3 input validation should be tighter
    2019-03-03 rik5 StatusConfirmed In Progress
    2019-02-05 rik5 Release5.0.90 dev
        Summaryquiver3 gives error for 3 inputs quiver3 gives error for 4-input form of function
    2019-01-25 mtmiller StatusNone Confirmed
        Release5.0.1 5.0.90

    Back to the top


    Powered by Savane 3.9