if (na == nb) {
if (na > 1) {
return arit.opComplexImplEqualSize(ast, (ComplexImpl) a.materialize(), (ComplexImpl) b.materialize(), na, dim, names, attributes);
} else {
// scalars
Complex acomp = a.getComplex(0);
Complex bcomp = b.getComplex(0);
Complex res = arit.opComplexCheckingNA(ast, acomp.realValue(), acomp.imagValue(), bcomp.realValue(), bcomp.imagValue());
// FIXME: it may really be worth having Complex == ScalarComplexImpl
return RComplex.RComplexFactory.getScalar(res.realValue(), res.imagValue(), dim, names, attributes);
}
} else if (nb == 1) {
Complex bcomp = b.getComplex(0);
return arit.opComplexImplScalarCheckingNA(ast, (ComplexImpl) a.materialize(), bcomp.realValue(), bcomp.imagValue(), na, dim, names, attributes);
} else if (na == 1) {
Complex acomp = a.getComplex(0);
return arit.opScalarComplexImplCheckingNA(ast, acomp.realValue(), acomp.imagValue(), (ComplexImpl) b.materialize(), nb, dim, names, attributes);
} else {
int n = resultSize(ast, na, nb);
if (n == na) {
return arit.opComplexImplASized(ast, (ComplexImpl) a.materialize(), (ComplexImpl) b.materialize(), n, nb, dim, names, attributes);
} else {