Make sure you are clear about what you are trying to do. Objective-C was designed mainly to enable developers to write good applications efficiently. It is an API: you use it primarily to create applications.
C, on the other hand, was designed to write operating systems, so is very low level and as a result also is very good for writing efficient maths code.
So, if you want to do some maths in objective-C, you may want to try creating a custom object that is a wrapper for a double array. I've got ten minutes, here's an example:
@interface DoubleArray : NSObject
{
double *array;
NSUInteger length;
}
-(DoubleArray *)initWithSize: (NSUInteger)size;
-(void)dealloc;
-(NSInteger)getValue: (double *)value_dst fromIndex: (NSUInteger)index;
-(NSInteger)setValue: (double)value toIndex: (NSUInteger)index;
@end
@implementation DoubleArray
-(DoubleArray *)initWithSize: (NSUInteger)size{
[super init];
if (size == 0) {[super dealloc]; return nil;}
array = malloc(sizeof(double) * size) ;
length = size;
return self;
}
-(void)dealloc{
free(array) ;
[super dealloc];
}
-(NSInteger)getValue: (double *)value_dst fromIndex: (NSUInteger) index{
if ( index >= length) return 1;
*value_dst = array[index];
return 0;
}
-(NSInteger)setValue: (double)value toIndex: (NSUInteger)index{
if ( index >= length) return 1;
array[index] = value;
return 0;
}
@end
This, of course, is very basic and you would almost certainly want methods to get the size of the array and maybe change its size as well. This code at least shouldn't cause you to read from or write to unallocated memory!
Now you've got this you can use NSArrays to store several instances of arrays, even 10, if you feel like it!