|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orbital.logic.functor.Functionals orbital.math.functional.Functionals
public class Functionals
Provides important compositional functionals for mathematical functions. For that, this module class contains several static methods that work like Functionals, i.e. high-order functions that have a Function in their signature.
The Functionals class comes in two versions:
Evolves: This class might under some circumstances be renamed or unified with the orbital.logic.functor.Functionals, which is not very likely to happen, since both classes address fairly different levels of composition.
Functionals
,
Function
,
BinaryFunction
,
Collection
,
Iterator
,
Facade PatternNested Class Summary |
---|
Nested classes/interfaces inherited from class orbital.logic.functor.Functionals |
---|
Functionals.Anamorphism, Functionals.Catamorphism, Functionals.Hylomorphism, Functionals.Paramorphism |
Field Summary | |
---|---|
static Functionals |
functionals
Class alias object. |
Fields inherited from class orbital.logic.functor.Functionals |
---|
apply, compose |
Constructor Summary | |
---|---|
protected |
Functionals()
prevent instantiation - module class |
Method Summary | |
---|---|
static Function |
bind(BinaryFunction f)
Binds both arguments of a BinaryFunction together. |
static Function |
bindFirst(BinaryFunction f,
java.lang.Object x)
Binds the first argument of a BinaryFunction to a fixed value. |
static Function |
bindSecond(BinaryFunction f,
java.lang.Object y)
Binds the second argument of a BinaryFunction to a fixed value. |
static BinaryFunction |
compose(BinaryFunction f,
BinaryFunction g,
BinaryFunction h)
compose: (f,g,h) ↦ f ∘ (g × h) := f(g,h) . |
static Function |
compose(BinaryFunction f,
Function g,
Function h)
compose: (f,g,h) ↦ f ∘ (g × h) := f(g,h) . |
static Function |
compose(Function f,
Function g)
compose: (f,g) ↦ f ∘ g := f(g). |
static double |
foldRight(BinaryFunction f,
double c,
double[] a)
|
static MathFunctor |
genericCompose(BinaryFunction f,
java.lang.Object g,
java.lang.Object h)
generic compose calls the compose function appropriate for the type of g and h. |
static MathFunctor |
genericCompose(Function f,
java.lang.Object g)
generic compose calls the compose function appropriate for the type of g. |
static MathFunctor.Composite |
genericCompose(java.lang.Object f)
generic compose uses component compose function appropriate for the type of g. |
static double[] |
map(BinaryFunction f,
double[] x,
double[] y)
|
static float[] |
map(BinaryFunction f,
float[] x,
float[] y)
|
static int[] |
map(BinaryFunction f,
int[] x,
int[] y)
|
static long[] |
map(BinaryFunction f,
long[] x,
long[] y)
|
static Matrix |
map(BinaryFunction f,
Matrix x,
Matrix y)
|
static Tensor |
map(BinaryFunction f,
Tensor x,
Tensor y)
Maps two lists of arguments with a binary function. |
static Vector |
map(BinaryFunction f,
Vector x,
Vector y)
|
static double[] |
map(Function f,
double[] a)
|
static float[] |
map(Function f,
float[] a)
|
static int[] |
map(Function f,
int[] a)
|
static long[] |
map(Function f,
long[] a)
|
static Matrix |
map(Function f,
Matrix a)
|
static Tensor |
map(Function f,
Tensor a)
Maps a list of arguments with a function. |
static Vector |
map(Function f,
Vector a)
|
static Function |
nest(Function f,
int n)
Nests a function n times within itself. |
static Predicate |
not(Predicate p)
Negates predicates |
static BinaryFunction |
onFirst(Function f)
Applies a function on the first argument, ignoring the second. |
static BinaryFunction |
onSecond(Function f)
Applies a function on the second argument, ignoring the first. |
static BinaryFunction |
pointwise(BinaryFunction elemental)
A BinaryFunction that performs an operation pointwise. |
static Function |
pointwise(Function elemental)
A function that performs an operation pointwise. |
static BinaryFunction |
swap(BinaryFunction f)
Swaps the two arguments of a BinaryFunction. |
Methods inherited from class orbital.logic.functor.Functionals |
---|
asFunction, asFunction, asFunction, banana, barbedwire, barbedwire, bind, bind, bind, bindFirst, bindSecond, compose, compose, compose, compose, compose, compose, compose, cross, curry, envelope, fixedPoint, fixedPoint, foldLeft, foldLeft, foldLeft, foldRight, foldRight, foldRight, foldRight, genericCompose, lense, listable, listable, map, map, map, map, map, map, map, map, map, map, map, map, map, map, map, mapInto, mapInto, onFirst, onSecond, onVoid, onVoid, paramorphism, swap, uncurry |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Functionals functionals
Constructor Detail |
---|
protected Functionals()
Method Detail |
---|
public static Function compose(Function f, Function g)
Function.Composite
public static BinaryFunction compose(BinaryFunction f, BinaryFunction g, BinaryFunction h)
BinaryFunction.Composite
public static Function compose(BinaryFunction f, Function g, Function h)
BinaryCompositeFunction
public static MathFunctor genericCompose(Function f, java.lang.Object g)
g
- having one of the types Function
, Function[]
, Function[][]
, and Arithmetic
.
In the latter case, composition is done using a constant function.public static MathFunctor.Composite genericCompose(java.lang.Object f)
f
- an object having one of the types Function[]
, Function[][]
,
BinaryFunction[]
, BinaryFunction[][]
.public static MathFunctor genericCompose(BinaryFunction f, java.lang.Object g, java.lang.Object h)
g
- having one of the types listed for h.h
- having one of the types Function
, BinaryFunction
and Arithmetic
.
In the latter case, composition is done using a constant function.public static Function bindFirst(BinaryFunction f, java.lang.Object x)
bindFirst: Map(A1×A2,B)→Map(A2,B); f↦f(x,·). The unary left-adjoint.
public static Function bindSecond(BinaryFunction f, java.lang.Object y)
bindSecond: Map(A1×A2,B)→Map(A1,B); f↦f(·,y). The unary right-adjoint.
public static Function bind(BinaryFunction f)
bind: Map(A×A,B)→Map(A,B); f↦g. The unitary adjoint function.
derive: bind' = ∂f/∂x (x,x) + ∂f/∂y (x,x).
If, for example, f is a bilinear form β:V×V→K this method will return its square form Q:V→K;x↦Q(x):=β(x,x).
public static BinaryFunction onFirst(Function f)
onFirst: f→g; (x,y) ↦ g(x,y) := f(x).
Evolves: might be renamed.
public static BinaryFunction onSecond(Function f)
onSecond: f→g; (x,y) ↦ g(x,y) := f(y).
Evolves: might be renamed.
public static BinaryFunction swap(BinaryFunction f)
swap: Map(A1×A2,B)→Map(A2×A1,B); f↦f↔.
derive: swap' = (fy(y,x), fx(y,x)).
public static Tensor map(Function f, Tensor a)
Functionals.listable(orbital.logic.functor.Function)
public static Vector map(Function f, Vector a)
public static Matrix map(Function f, Matrix a)
public static Tensor map(BinaryFunction f, Tensor x, Tensor y)
Functionals.listable(orbital.logic.functor.BinaryFunction)
public static Vector map(BinaryFunction f, Vector x, Vector y)
public static Matrix map(BinaryFunction f, Matrix x, Matrix y)
public static double foldRight(BinaryFunction f, double c, double[] a)
Functionals.foldRight(orbital.logic.functor.BinaryFunction, Object, Object[])
public static double[] map(Function f, double[] a)
Functionals.map(orbital.logic.functor.Function, Object[])
public static int[] map(Function f, int[] a)
public static long[] map(Function f, long[] a)
public static float[] map(Function f, float[] a)
public static double[] map(BinaryFunction f, double[] x, double[] y)
Functionals.map(orbital.logic.functor.BinaryFunction, Object[], Object[])
public static int[] map(BinaryFunction f, int[] x, int[] y)
public static long[] map(BinaryFunction f, long[] x, long[] y)
public static float[] map(BinaryFunction f, float[] x, float[] y)
public static Function nest(Function f, int n)
nest: (f,n) ↦ fn = f ∘ f ∘ ... ∘ f (n times).
nest(f,n).apply(A) gives an expression with f applied n times to A.
f
- the function to be nested.n
- the number of times the f should be composed.public static Function pointwise(Function elemental)
For Arithmetic objects this will be the elemental function applied on x. For Function objects this will be a composition of this pointwise operation with x.
elemental
- the elemental function f to perform on Arithmetic x.
public static BinaryFunction pointwise(BinaryFunction elemental)
For Arithmetic objects this will be the elemental function applied on x and y. For functor objects this will be a composition of this pointwise operation with x and y.
elemental
- the elemental function to perform on Arithmetic x.
public static Predicate not(Predicate p)
p
-
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |