Hello readers of bug-list,
I've recently run into a problem where a user-defined subsref is called
with Nx1 index structs. This makes it difficult to use for-loops
(without transposing).
The natural size of structs are row vectors (1xN). I think subsref
should be called with 1xN structs, which is what Matlab do too. (The
Matlab documentation has very misleading examples where they say the
structs are 3-by-1, but nevermind that)
Attaching a changeset with parent 9747:7bda650b691a.
David
# HG changeset patch
# User David Grundberg <
davidg@...>
# Date 1257234720 -3600
# Node ID d00f7a8c17770b67657f62f8385df1d480885b01
# Parent 7bda650b691a21434cddb2452a0fbc77c558a9ca
Call user-defined subsref/subsasgn with 1xN structs instead of Nx1
diff -r 7bda650b691a -r d00f7a8c1777 src/ChangeLog
--- a/src/ChangeLog Tue Oct 20 15:45:09 2009 +0200
+++ b/src/ChangeLog Tue Nov 03 08:52:00 2009 +0100
@@ -1,3 +1,8 @@
+2009-11-03 David Grundberg <
davidg@...>
+
+ * ov-class.cc (make_idx_args): Call user-defined subsref/subsasgn
+ with 1xN structs instead of Nx1.
+
2009-10-20 Jaroslav Hajek <
highegg@...>
* ov-base.h (builtin_type_t): Declare also btyp_num_types.
diff -r 7bda650b691a -r d00f7a8c1777 src/ov-class.cc
--- a/src/ov-class.cc Tue Oct 20 15:45:09 2009 +0200
+++ b/src/ov-class.cc Tue Nov 03 08:52:00 2009 +0100
@@ -178,8 +178,8 @@
if (len == idx.size ())
{
- Cell type_field (len, 1);
- Cell subs_field (len, 1);
+ Cell type_field (1, len);
+ Cell subs_field (1, len);
std::list<octave_value_list>::const_iterator p = idx.begin ();
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave