|From:||Juan Pablo Carbajal|
|Date:||Sat, 1 Aug 2015 19:38:17 +0200|
On 07/31/2015 03:03 PM, address@hidden wrote:
Subject:Re: patch for union.m From:"John W. Eaton" <address@hidden> Date:07/31/2015 01:35 PM
List-Post:<mailto:address@hidden> Precedence:list MIME-Version:1.0 References:<address@hidden> <address@hidden> <address@hidden> <address@hidden> <address@hidden> In-Reply-To:<address@hidden> Message-ID:<address@hidden> Content-Type:multipart/mixed; boundary="------------000500000100050402000208" Message:1
On 07/31/2015 03:31 PM, Juan Pablo Carbajal wrote:
could you test that indeed this increases compatibility with matlab?
Also, the docs state that if the "rows" argument is not specified, the result should be a column vector unless both arguments are row vectors. So I think union (, [1,2]) should produce a column vector since  is not a row vector.
But I guess that behavior changed recently, so the result depends on the version of Matlab. See the description of "legacy" behavior here: http://www.mathworks.com/help/matlab/ref/union.html.
It seems that Rik already made the behavior compatible with current Matlab with this changeset:
I believe that the change that is under consideration would make the behavior compatible with older versions of Matlab but not newer versions.
I have no desire to start supporting "legacy" options to functions so we can track multiple versions and differing levels of incompatibility. Gah. But then what should we do?
People who want their code to work with Multiple versions of Matlab will already have to cope with this change themselves. So I propose that we only attempt to track the behavior of the latest version of Matlab.
Perhaps we should make the attached change, however, to add tests and remove the redundant calls to isvector.
Apparently my memory is failing and I forgot that I had changed this once already for Matlab compatibility. I agree that you should revert the behavior while cleaning up the duplication of using isvector and isrow. 'grep isvector *.m' in scripts/set shows that the same construction is used in the other functions. Bonus points for cleaning up those entries as well!
intersect.m: isrowvec = isvector (a) && isvector (b) && isrow (a) && isrow (b);
setdiff.m: isrowvec = isvector (a) && isrow (a);
setxor.m: isrowvec = isvector (a) && isvector (b) && isrow (a) && isrow (b);
|[Prev in Thread]||Current Thread||[Next in Thread]|