Re: NSConfused... matrices and NSData
On Sun, Mar 29, 2009 at 12:43 PM, James Maxwell
> Sorry for the long post, but I'm trying to wrap my head around NSData,
> NSMutableData and matrices.
> So I made an example to test my (mis)conception of how this all should work.
There are two ways to store two-dimensional data in a one-dimensional
array. The standard way is row-major order, in which the rows of the
data are contiguous. To compute the index for this method, you use
The other way is column-major order, which is just the opposite. The
columns are contiguous. Here you compute the index as
You're computing the index as row*rowCount+column, which doesn't work.
As a consequence, you're repeating indexes in your 1D array, which
leads to funny results. Log your computed indexes as well as the
values you find, and I believe the problem will be apparent.
Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to maillists@xxxxxxxxx