org.lsmp.djep.vectorJep.function.ElementDivide 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 Matrices element by element.
* TODO could be much more efficient when called through run.
*
* @author Rich Morris
* Created on 10-Dec-2004
*/
public class ElementDivide extends Divide implements BinaryOperatorI {
public Dimensions calcDim(Dimensions ldim,Dimensions rdim)
{
if(ldim.equals(rdim)) return ldim;
return null;
}
/**
* Multiply the inputs element by element putting the results in res.
*/
public MatrixValueI calcValue(MatrixValueI res, MatrixValueI lhs,MatrixValueI rhs)
throws ParseException {
int len = res.getNumEles();
for(int i=0;i