All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lsmp.djep.vectorJep.function.ElementMultiply Maven / Gradle / Ivy

Go to download

JEP is a Java library for parsing and evaluating mathematical expressions.

There is a newer version: 2.4.2
Show 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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy