Thu 04 Nov 2010 12:39:45 AM UTC, comment #5:
Fixed in this changeset from Ben (http://hg.savannah.gnu.org/hgweb/octave/rev/0a8e554494c9). Closing bug.
|
Wed 03 Nov 2010 09:26:03 PM UTC, comment #4:
Ok, I missed the significance of the second argument to the find function.. My objection is withdrawn
D.
|
Wed 03 Nov 2010 09:07:00 PM UTC, comment #3:
Oh no, I hope I'm not abusing the poor defenseless comma-separated lists. :)
Actually, I might not understand the example well enough and I did look only briefly, but I think I avoid cs-lists altogether.
What looks potentially weak to me is that if there are no matches then find returns the empty matrix and there is the reliance on '[] + 1 == []'
|
Wed 03 Nov 2010 08:28:02 PM UTC, comment #2:
Opps, I was trying the address the code like
patch(..., "cdata", c1, ...., "cdata", c2, ....)
where cdata should be taken to be c2. I didn't treat the case where its not at all defined. I like Rik proposal, but it (and Ben's proposal for tht matter) abuses cs-lists to get the right functionally. Consider a code snippet like
c = {[1,2,3],[4,5,6]}
c{[2,1]}
cdata = c{[2,1]}
The line c{[2,1]} returns a two element cs-list, whereas cdata=c{[1,2]} only has a single argument on the LHS and so the second element of the cs-list is ignored. Its a bit of a nasty trick in my opinion to get the right behavior, but without making the code much more complex I don't see a way of getting the right behavior and avoiding indexing into null arrays. I'd say push a changeset based on Rik's suggestion
D.
|
Wed 03 Nov 2010 07:31:15 PM UTC, comment #1:
Using 'hg bisect' I find the problem was introduced in this changeset:
changeset: 11160:131d56b6d9a3
user: David Bateman <dbateman@free.fr>
date: Thu Oct 28 01:56:14 2010 +0200
summary: Set cdata from facevertexcdata and visa versa for patch at all times
I've only briefly glanced at your patch. We should definitely avoid indexing into null arrays, which is what your patch does. However it does it for only 2 of the 4 occurrences of this code construct. Would it be better to do it for all 4? Also, the strcmp functions now work perfectly well on cell arrays so I think the code could eliminate the anonymous function call for legibility. Sample below:
Otherwise, the patch works for me.
|
Wed 03 Nov 2010 02:39:32 PM UTC, original submission:
The 3rd and 4th patch demos, and the isosurface demo, are failing.
This may be due to the recent changeset below (I'm just guessing).
http://hg.savannah.gnu.org/hgweb/octave/rev/c0a95a5c6d25
I've attached a chageset which fixes the problem, but as I'm not sure this is the proper solution I won't push it until someone takes a closer look.
|