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

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

[Octave-bug-tracker] [bug #29475] new incompatibility of MEX function in


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #29475] new incompatibility of MEX function in Octave 3.2.x
Date: Fri, 09 Apr 2010 12:23:27 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100308 Iceweasel/3.5.8 (like Firefox/3.5.8)

Update of bug #29475 (project octave):

                  Status:                    None => Need Info              
             Assigned to:                    None => jwe                    

    _______________________________________________________

Follow-up Comment #4:

I couldn't remember why I made this change, but I'm fairly certain it was in
response to some problem and not some arbitrary change.  So I started looking
for some bug report or email exchange about it and found the following:

Subject: mxGetPr and diag or perm arrays
From: "John W. Eaton" <address@hidden>
To: Jaroslav Hajek <address@hidden>
Cc: "John W. Eaton" <address@hidden>
Date: Wed, 17 Jun 2009 21:14:38 -0400
Message-ID: <address@hidden>

The following patch should also be applied to the 3.2.x branch.  It
fixes a problem with mxGetPr not being able to extract a pointer to
the data (in a Matlab compatible way) for diagonal or permutation
(and possibly other) matrices.

  http://hg.savannah.gnu.org/hgweb/octave/rev/d4b1314a7c31

Thanks,

jwe


So I think the reason for the change was that the previous check

-    if (is_char ()
-       || (is_numeric () && is_real_type () && ! is_range ()))

no longer worked when diagonal and permutation matrices were introduced
because they are numeric and real, but will not give the expected data result
for mxGetPr, so that must be generated rather than simply returned as a
pointer to internal Octave data.

You are right that before this change, we clearly allowed a pointer to
internal data to be returned for character data, but I did not add a method in
the character array class.  I've attached a proposed patch to "fix" the
problem.  If you verify that it works for you, I will commit it.

However, I would like to echo Jaroslav's comments.  Things that work in
Matlab are not guaranteed to work in Octave, and can likely fail in mysterious
ways.  For example, it seems that
you would be able to use mxGetPr and modify the data of a matrix in Matlab
and that would apparently work in Octave for full matrices, but fail for
diagonal or permutation matrices.  So your program would appear to work
correctly in Octave, but then fail if you pass eye(2) instead of [1,0;0;1].


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29475>

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





reply via email to

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