1. A method for operating a compiler, the method comprising: utilizing a computer to perform: scanning program code to identify an algebraic expression specified by the program code, wherein the algebraic expression includes two or more mutually-compatible binary operations and three or more operands, wherein the three or more operands include two or more scalar operands and one or more array operands; and operating on the algebraic expression to obtain a final expression by performing transformations on selected subexpressions of the algebraic expression, wherein the transformations include commute transformations and associate transformations, wherein the final expression specifies an order of execution for the binary operations such that the two or more scalar operands are combined before the one or more array operands are combined in the final expression.