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

org.lsmp.djep.vectorJep.function.MDot 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
/*****************************************************************************

JEP - Java Math Expression Parser 2.24
	  December 30 2002
	  (c) Copyright 2002, Nathan Funk
	  See LICENSE.txt for license information.

*****************************************************************************/
package org.lsmp.djep.vectorJep.function;

import java.util.*;

import org.lsmp.djep.vectorJep.*;
import org.lsmp.djep.vectorJep.values.*;

import org.nfunk.jep.*;

/**
 * The MDot operator. 
 * @author Rich Morris
 * Created on 23-Feb-2004
 */
public class MDot extends MMultiply implements BinaryOperatorI
{
	public MDot() {
		numberOfParameters = 2;
	}
	public Dimensions calcDim(Dimensions l,Dimensions r) {
		if(l.equals(r) && l.is1D()) return Dimensions.ONE;
		return null;
	}
	
	/** calculates the value.
	 * @param res - results will be stored in this object
	 * @param lhs - lhs value
	 * @param rhs - rhs value
	 * @return res
	 */
	public MatrixValueI calcValue(MatrixValueI res,MatrixValueI lhs,MatrixValueI rhs) throws ParseException
	{
		return calcValue((Scaler) res,(MVector) lhs,(MVector) rhs);
	}

	public Scaler calcValue(Scaler res,MVector lhs,MVector rhs) throws ParseException
	{
		int len = lhs.getNumEles();
		Object val = mul(lhs.getEle(0),rhs.getEle(0));
		for(int i=1;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy