// Path: src/main/java/com/asher_stern/crf/function/DerivableFunction.java
// public abstract class DerivableFunction extends Function
// {
// 	/**
// 	 * Returns the gradient of the function in the given point.
// 	 * For example, if the function is f(x_1,x_2) = (x_1)^2 + x_1*x_2, then for [3,5] the returned gradient is [11 , 3].
// 	 * @param point the point is "x", the input for the function, for which the user needs the gradient.
// 	 * @return the gradient of the function in the given point.
// 	 */
// 	public abstract BigDecimal[] gradient(BigDecimal[] point);
// }
// 
// Path: src/main/java/com/asher_stern/crf/function/Function.java
// public abstract class Function
// {
// 	/**
// 	 * Returns the f(x) -- the value of the function in the given x.
// 	 * @param point the "point" is x -- the input for the function.
// 	 * @return the value of f(x)
// 	 */
// 	public abstract BigDecimal value(BigDecimal[] point);
// 	
// 	/**
// 	 * The size (dimension) of the input vector (x).
// 	 * @return the size (dimension) of the input vector (x).
// 	 */
// 	public abstract int size();
// }
// 
// Path: src/main/java/com/asher_stern/crf/function/TwiceDerivableFunction.java
// public abstract class TwiceDerivableFunction extends DerivableFunction
// {
// 	/**
// 	 * Returns the Hessian matrix for the given function in the given point (point is "x" -- the function input).
// 	 * @param point "point" is "x" -- the input for the function.
// 	 * @return the Hessian matrix -- the matrix of partial second derivations.
// 	 */
// 	public abstract BigDecimal[][] hessian(BigDecimal[] point);
// }
// 
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java
// public class CrfException extends RuntimeException
// {
// 	private static final long serialVersionUID = 5414394233000815286L;
// 
// 	public CrfException()
// 	{
// 		super();
// 	}
// 
// 	public CrfException(String message, Throwable cause,
// 			boolean enableSuppression, boolean writableStackTrace)
// 	{
// 		super(message, cause, enableSuppression, writableStackTrace);
// 	}
// 
// 	public CrfException(String message, Throwable cause)
// 	{
// 		super(message, cause);
// 	}
// 
// 	public CrfException(String message)
// 	{
// 		super(message);
// 	}
// 
// 	public CrfException(Throwable cause)
// 	{
// 		super(cause);
// 	}
// 	
// 
// }


import java.math.BigDecimal;
import com.asher_stern.crf.function.DerivableFunction;
import com.asher_stern.crf.function.Function;
import com.asher_stern.crf.function.TwiceDerivableFunction;
import com.asher_stern.crf.utilities.CrfException;
	}
	
	private NegatedFunction(Function function,
			DerivableFunction derivableFunction,
			TwiceDerivableFunction twiceDerivableFunction)
	{
		super();
		this.function = function;
		this.derivableFunction = derivableFunction;
		this.twiceDerivableFunction = twiceDerivableFunction;
		if (function!=null){this.theSize = function.size();}
		else if (derivableFunction!=null){this.theSize = derivableFunction.size();}
		else if (twiceDerivableFunction!=null){this.theSize = twiceDerivableFunction.size();}
		else throw new CrfException("BUG");
	}
	
	private BigDecimal[] negate(BigDecimal[] array)
	{
		BigDecimal[] ret = new BigDecimal[array.length];
		for (int i=0;i<array.length;++i)
		{
			ret[i] = array[i].negate();
		}
		return ret;
	}
	



	private final Function function;
// Path: src/main/java/com/asher_stern/crf/function/DerivableFunction.java
// public abstract class DerivableFunction extends Function
// {
// 	/**
// 	 * Returns the gradient of the function in the given point.
// 	 * For example, if the function is f(x_1,x_2) = (x_1)^2 + x_1*x_2, then for [3,5] the returned gradient is [11 , 3].
// 	 * @param point the point is "x", the input for the function, for which the user needs the gradient.
// 	 * @return the gradient of the function in the given point.
// 	 */
// 	public abstract BigDecimal[] gradient(BigDecimal[] point);
// }
// 
// Path: src/main/java/com/asher_stern/crf/function/Function.java
// public abstract class Function
// {
// 	/**
// 	 * Returns the f(x) -- the value of the function in the given x.
// 	 * @param point the "point" is x -- the input for the function.
// 	 * @return the value of f(x)
// 	 */
// 	public abstract BigDecimal value(BigDecimal[] point);
// 	
// 	/**
// 	 * The size (dimension) of the input vector (x).
// 	 * @return the size (dimension) of the input vector (x).
// 	 */
// 	public abstract int size();
// }
// 
// Path: src/main/java/com/asher_stern/crf/function/TwiceDerivableFunction.java
// public abstract class TwiceDerivableFunction extends DerivableFunction
// {
// 	/**
// 	 * Returns the Hessian matrix for the given function in the given point (point is "x" -- the function input).
// 	 * @param point "point" is "x" -- the input for the function.
// 	 * @return the Hessian matrix -- the matrix of partial second derivations.
// 	 */
// 	public abstract BigDecimal[][] hessian(BigDecimal[] point);
// }
// 
// Path: src/main/java/com/asher_stern/crf/utilities/CrfException.java
// public class CrfException extends RuntimeException
// {
// 	private static final long serialVersionUID = 5414394233000815286L;
// 
// 	public CrfException()
// 	{
// 		super();
// 	}
// 
// 	public CrfException(String message, Throwable cause,
// 			boolean enableSuppression, boolean writableStackTrace)
// 	{
// 		super(message, cause, enableSuppression, writableStackTrace);
// 	}
// 
// 	public CrfException(String message, Throwable cause)
// 	{
// 		super(message, cause);
// 	}
// 
// 	public CrfException(String message)
// 	{
// 		super(message);
// 	}
// 
// 	public CrfException(Throwable cause)
// 	{
// 		super(cause);
// 	}
// 	
// 
// }


// Path: src/main/java/com/asher_stern/crf/function/optimization/NegatedFunction.java
import java.math.BigDecimal;
import com.asher_stern.crf.function.DerivableFunction;
import com.asher_stern.crf.function.Function;
import com.asher_stern.crf.function.TwiceDerivableFunction;
import com.asher_stern.crf.utilities.CrfException;

	}
	
	private NegatedFunction(Function function,
			DerivableFunction derivableFunction,
			TwiceDerivableFunction twiceDerivableFunction)
	{
		super();
		this.function = function;
		this.derivableFunction = derivableFunction;
		this.twiceDerivableFunction = twiceDerivableFunction;
		if (function!=null){this.theSize = function.size();}
		else if (derivableFunction!=null){this.theSize = derivableFunction.size();}
		else if (twiceDerivableFunction!=null){this.theSize = twiceDerivableFunction.size();}
		else throw new CrfException("BUG");
	}
	
	private BigDecimal[] negate(BigDecimal[] array)
	{
		BigDecimal[] ret = new BigDecimal[array.length];
		for (int i=0;i<array.length;++i)
		{
			ret[i] = array[i].negate();
		}
		return ret;
	}
	



	private final Function function;
	private final DerivableFunction derivableFunction;