这些是我在项目中进行矩阵计算的一些代码.
它们是两个类方法和一个实例方法,用于创建矩阵并执行矩阵乘法运算.
matrics multiplication的方法效果不好,其结果是错误的.
+ (NSMutableArray *)arrayOfWidth:(NSInteger)width andHeight:(NSInteger)height {
return [[self alloc] initWithWidth:width andHeight:height];
}
- (id)initWithWidth:(NSInteger)width andHeight:(NSInteger)height {
if((self = [self initWithCapacity:height])) {
for(int i = 0; i < height; i++) {
NSMutableArray *inner = [[NSMutableArray alloc] initWithCapacity:width];
[self addObject:inner];
}
}
return self;
}
+ (NSMutableArray *)matrixA:(NSMutableArray *)matrixA multiplyMatrixB:(NSMutableArray *)matrixB {
int aRow = [matrixA count];
int aColumn = [[matrixA objectAtIndex:0] count];
int bRow = [matrixB count];
int bColumn = [[matrixB objectAtIndex:0] count];
NSMutableArray *newArray = [NSMutableArray arrayOfWidth:aRow …Run Code Online (Sandbox Code Playgroud) 就我而言,我提出了containerViewController几个UIViewControllers.
其中一个控制器A将每10秒向服务器发送一次请求以获取数据.我用a RACSignal来做:
[[[RACSignal interval:10 onScheduler:[RACScheduler mainThreadScheduler]] takeUntil:self.rac_willDeallocSignal] subscribeNext:DoSomeThing];
但是,当containerViewController从RootViewController的驳回,信号发射仍然每10秒,手段rac_willDeallocSignal的控制器A不叫.怎么修好?????
谢谢!!!