SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.analysis.function.rn2r1
Class RealScalarFunctionFixedVariables

java.lang.Object
  extended by com.numericalmethod.suanshu.analysis.function.rn2r1.RealScalarFunctionFixedVariables
All Implemented Interfaces:
Function, RealScalarFunction

public class RealScalarFunctionFixedVariables
extends java.lang.Object
implements RealScalarFunction

This creates a a RealScalarFunction from another RealScalarFunction by fixing the values of a subset of variables.


Nested Class Summary
static class RealScalarFunctionFixedVariables.Value
           
 
Nested classes/interfaces inherited from interface com.numericalmethod.suanshu.analysis.function.Function
Function.EvaluationException
 
Constructor Summary
RealScalarFunctionFixedVariables(RealScalarFunction f, java.util.Collection<RealScalarFunctionFixedVariables.Value> values)
           
RealScalarFunctionFixedVariables(RealScalarFunction f, RealScalarFunctionFixedVariables.Value... values)
           
 
Method Summary
 int dimension4Domain()
          Get the number of variables of the function.
 int dimension4Range()
          Get the dimension of the range space the function.
 double evaluate(double... x)
          A real function, f, takes a double array double[], {x0, x1, ..., xn} and maps it to a double, f(x0, x1, ..., xn)
 boolean isIntegerIndex(int idx)
          Check whether a particular index corresponds an integral variable.
static double[] pack(double[] reals, java.util.Collection<RealScalarFunctionFixedVariables.Value> integers)
          Combine the real and integer parts to form a vector input to the original function.
 double[] realPart(double[] z)
          Given a vector input to the original function, this extracts the real parts (excluding the fixed integer values).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RealScalarFunctionFixedVariables

public RealScalarFunctionFixedVariables(RealScalarFunction f,
                                        java.util.Collection<RealScalarFunctionFixedVariables.Value> values)

RealScalarFunctionFixedVariables

public RealScalarFunctionFixedVariables(RealScalarFunction f,
                                        RealScalarFunctionFixedVariables.Value... values)
Method Detail

evaluate

public double evaluate(double... x)
Description copied from interface: RealScalarFunction
A real function, f, takes a double array double[],
{x0, x1, ..., xn}
and maps it to a double,
f(x0, x1, ..., xn)

Specified by:
evaluate in interface RealScalarFunction
Parameters:
x - {x} = {x0, x1, ... xn}
Returns:
f({x}) as output

dimension4Domain

public int dimension4Domain()
Description copied from interface: Function
Get the number of variables of the function.

For example, for a univariate function, the domain dimension is 1. For a bivariate function, the domain dimension is 2.

Specified by:
dimension4Domain in interface Function
Returns:
the number of variables

dimension4Range

public int dimension4Range()
Description copied from interface: Function
Get the dimension of the range space the function.

For example, for a Rn->Rm function, the dimension of the range is m.

Specified by:
dimension4Range in interface Function
Returns:
the dimension of the range

isIntegerIndex

public boolean isIntegerIndex(int idx)
Check whether a particular index corresponds an integral variable.

Parameters:
idx - an index
Returns:
true iff x[idx] is an integer

realPart

public double[] realPart(double[] z)
Given a vector input to the original function, this extracts the real parts (excluding the fixed integer values).

Parameters:
z - an input to the original function
Returns:
the real sub-part of z

pack

public static double[] pack(double[] reals,
                            java.util.Collection<RealScalarFunctionFixedVariables.Value> integers)
Combine the real and integer parts to form a vector input to the original function.

Parameters:
reals - the real values to the non-integral variables
integers - the integer values to the integral variables
Returns:
a vector input to the original function

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.