From 76e8646b953dd23a4cea2a64edbd744c09db619c Mon Sep 17 00:00:00 2001
From: Luc Maisonobe
Date: Tue, 11 Sep 2012 15:33:10 +0000
Subject: [PATCH] Added interfaces for differentiable multidimensional
functions.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1383450 13f79535-47bb-0310-9956-ffa450edef68
---
.../MultivariateDifferentiableFunction.java | 49 +++++++++++++++++++
...tivariateDifferentiableVectorFunction.java | 42 ++++++++++++++++
...UnivariateDiferentiableMatrixFunction.java | 37 ++++++++++++++
...nivariateDifferentiableVectorFunction.java | 37 ++++++++++++++
.../differentiation/package-info.java | 4 ++
5 files changed, 169 insertions(+)
create mode 100644 src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableFunction.java
create mode 100644 src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableVectorFunction.java
create mode 100644 src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDiferentiableMatrixFunction.java
create mode 100644 src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableVectorFunction.java
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableFunction.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableFunction.java
new file mode 100644
index 000000000..29a50aff8
--- /dev/null
+++ b/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableFunction.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math3.analysis.differentiation;
+
+import org.apache.commons.math3.analysis.MultivariateFunction;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MathIllegalArgumentException;
+
+/**
+ * Extension of {@link MultivariateFunction} representing a
+ * multivariate differentiable real function.
+ * @version $Id$
+ * @since 3.1
+ */
+public interface MultivariateDifferentiableFunction extends MultivariateFunction {
+
+ /**
+ * Compute the value for the function at the given point.
+ *
+ * @param point Point at which the function must be evaluated.
+ * @return the function value for the given point.
+ * @throws org.apache.commons.math3.exception.DimensionMismatchException
+ * if the parameter's dimension is wrong for the function being evaluated.
+ * @throws org.apache.commons.math3.exception.MathIllegalArgumentException
+ * when the activated method itself can ascertain that preconditions,
+ * specified in the API expressed at the level of the activated method,
+ * have been violated. In the vast majority of cases where Commons Math
+ * throws this exception, it is the result of argument checking of actual
+ * parameters immediately passed to a method.
+ */
+ DerivativeStructure value(DerivativeStructure[] point)
+ throws DimensionMismatchException, MathIllegalArgumentException;
+
+}
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableVectorFunction.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableVectorFunction.java
new file mode 100644
index 000000000..377581b4c
--- /dev/null
+++ b/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableVectorFunction.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math3.analysis.differentiation;
+
+import org.apache.commons.math3.analysis.MultivariateVectorFunction;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+
+
+/**
+ * Extension of {@link MultivariateVectorFunction} representing a
+ * multivariate differentiable vectorial function.
+ * @version $Id$
+ * @since 3.1
+ */
+public interface MultivariateDifferentiableVectorFunction
+ extends MultivariateVectorFunction {
+
+ /**
+ * Compute the value for the function at the given point.
+ * @param point point at which the function must be evaluated
+ * @return function value for the given point
+ * @exception DimensionMismatchException if points dimension is wrong
+ */
+ DerivativeStructure[] value(DerivativeStructure[] point)
+ throws DimensionMismatchException;
+
+}
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDiferentiableMatrixFunction.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDiferentiableMatrixFunction.java
new file mode 100644
index 000000000..df58427e5
--- /dev/null
+++ b/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDiferentiableMatrixFunction.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math3.analysis.differentiation;
+
+import org.apache.commons.math3.analysis.UnivariateMatrixFunction;
+
+/**
+ * Extension of {@link UnivariateMatrixFunction} representing a univariate differentiable matrix function.
+ *
+ * @version $Id$
+ * @since 3.1
+ */
+public interface UnivariateDiferentiableMatrixFunction
+ extends UnivariateMatrixFunction {
+
+ /**
+ * Compute the value for the function.
+ * @param x the point for which the function value should be computed
+ * @return the value
+ */
+ DerivativeStructure[][] value(DerivativeStructure x);
+
+}
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableVectorFunction.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableVectorFunction.java
new file mode 100644
index 000000000..8593364d0
--- /dev/null
+++ b/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableVectorFunction.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math3.analysis.differentiation;
+
+import org.apache.commons.math3.analysis.UnivariateVectorFunction;
+
+/**
+ * Extension of {@link UnivariateVectorFunction} representing a univariate differentiable vectorial function.
+ *
+ * @version $Id$
+ * @since 3.1
+ */
+public interface UnivariateDifferentiableVectorFunction
+ extends UnivariateVectorFunction {
+
+ /**
+ * Compute the value for the function.
+ * @param x the point for which the function value should be computed
+ * @return the value
+ */
+ DerivativeStructure[] value(DerivativeStructure x);
+
+}
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/package-info.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/package-info.java
index e4964cb94..7fe5ccfe5 100644
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/package-info.java
+++ b/src/main/java/org/apache/commons/math3/analysis/differentiation/package-info.java
@@ -26,6 +26,10 @@
* interface. Any differentiable function should implement this interface.
*
*
+ * Similar interfaces also exist for multivariate functions and for vector or
+ * matrix valued functions.
+ *
+ *
* The {@link UnivariateDifferentiator} interface defines a way to differentiation
* a simple {@link org.apache.commons.math3.analysis.UnivariateFunction
* univariate function} and get a {@link differential function}.