-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added solver results to NR multi demensional. Created Jacobian calcul…
…ation strategy
- Loading branch information
1 parent
8f2c703
commit c17f9a4
Showing
5 changed files
with
61 additions
and
36 deletions.
There are no files selected for viewing
26 changes: 0 additions & 26 deletions
26
src/main/java/com/wildbitsfoundry/etk4j/math/calculus/CalculusUtil.java
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...ava/com/wildbitsfoundry/etk4j/math/calculus/JacobianCalculation5PointStencilStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.wildbitsfoundry.etk4j.math.calculus; | ||
|
||
import com.wildbitsfoundry.etk4j.math.functions.MultivariateFunction; | ||
|
||
public class JacobianCalculation5PointStencilStrategy implements JacobianCalculationStrategy { | ||
|
||
@Override | ||
public double[][] calculateJacobian(MultivariateFunction[] functions, double[] x, Object... params) { | ||
int n = x.length; // Number of variables | ||
int m = functions.length; // Number of equations | ||
double[][] jacobian = new double[m][n]; | ||
for(int i = 0; i < m; i++) { | ||
for(int j = 0; j < n; j++) { | ||
jacobian[i] = PartialDerivatives.centeredDifference5Points(functions[i], x, (double) params[0]); | ||
} | ||
} | ||
return jacobian; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/wildbitsfoundry/etk4j/math/calculus/JacobianCalculationStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.wildbitsfoundry.etk4j.math.calculus; | ||
|
||
import com.wildbitsfoundry.etk4j.math.functions.MultivariateFunction; | ||
|
||
public interface JacobianCalculationStrategy { | ||
double[][] calculateJacobian(MultivariateFunction[] functions, double[] x, Object... params); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters