if (arg instanceof ExprNumber) {
return Math.pow(((ExprNumber) arg).doubleValue(), 2);
} else if (arg instanceof ExprArray) {
ExprArray a = (ExprArray) arg;
int rows = a.rows();
int cols = a.columns();
double res = 0;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
res += sumsq(a.get(i, j));
}