Re: Vector or Matrix Object
Re: Vector or Matrix Object
- Subject: Re: Vector or Matrix Object
- From: Ed Baskerville <email@hidden>
- Date: Tue, 22 Feb 2005 18:01:08 -0800
Objective-C isn't quite as suited to vector/matrix math as C or C++.
There's no way to overload operators to get [row][column] syntax on
your objects, for example. And pursuing the course you suggested with
NSNumbers and NSMutableArrays would probably result in very poor
performance.
Option 1: use straight C. Simple, straightforward.
Option 2: C++, as described in a message that arrived while I was
writing this...
Option 3 (recommended for performance): check out
/System/Library/Frameworks/vecLib.framework for AltiVec ("Velocity
Engine")-optimized vector and matrix libraries (LAPACK, BLAS, etc.)
There's no reason you couldn't wrap some of the vecLib stuff in
Objective-C. But there's also probably no real reason you'd need to.
--Ed
On Feb 22, 2005, at 5:35 PM, Richard Patterson wrote:
If I want to create objects to do vector and matrix math, does anyone
have any pointers as to how I should do it. I am assuming I should
subclass NSMutableArray and let a vector be an array of NSNumbers and
a Matriix be an array of Vectors, but I am unsure about how I set it
up so that I can access elements with [row][column] syntax or
whatever. Any suggestions or sample code would be greatly
appreciated.
Or is the consensus that this is a waste of time and energy and I
should just use C structures and handles to do the job?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden