org.lsmp.djep.vectorJep.function.ElementMultiply Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jep Show documentation
Show all versions of jep Show documentation
JEP is a Java library for parsing and evaluating mathematical expressions.
The newest version!
/* @author rich
* Created on 10-Dec-2004
*/
package org.lsmp.djep.vectorJep.function;
import org.lsmp.djep.vectorJep.*;
import org.lsmp.djep.vectorJep.values.*;
import org.nfunk.jep.*;
import org.nfunk.jep.function.*;
/**
* Multiplies any number of Vectors or Matricies element by element.
* TODO could be much more efficient when called through run.
*
* @author Rich Morris
* Created on 10-Dec-2004
*/
public class ElementMultiply extends Multiply implements NaryOperatorI {
public Dimensions calcDim(Dimensions[] dims) throws ParseException {
int len = dims.length;
if(len==0) throw new ParseException("ElementMultiply called with 0 arguments");
if(len==1) return dims[0];
Dimensions firstDim = dims[0];
for(int i=1;i