Package gov.nih.mipav.model.algorithms
Class CeresSolver2
java.lang.Object
gov.nih.mipav.model.algorithms.CeresSolver
gov.nih.mipav.model.algorithms.CeresSolver2
This is a port of the C++ files in ceres-solver-1.14.0 under the BSD license:
Ceres Solver - A fast non-linear least squares minimizer Copyright 2015
Google Inc. All rights reserved. http://ceres-solver.org/
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. Redistributions in binary
form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided
with the distribution. Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Ceres Solver is an open source C++ library for modeling and solving large,
complicated optimization problems. It is a feature rich, mature and
performant library which has been used in production at Google since 2010.
Ceres Solver can solve two kinds of problems.
1. Non-linear Least Squares problems with bounds constraints. 2. General
unconstrained optimization problems.
Please see [ceres-solver.org](http://ceres-solver.org/) for more information.
- Author:
- aailb
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclass(package private) classclassclassclass(package private) class(package private) classclassclassclassclassprivate classprivate classprivate classprivate class(package private) class(package private) classprivate classclass(package private) classstatic enumclass(package private) class(package private) class(package private) classNested classes/interfaces inherited from class gov.nih.mipav.model.algorithms.CeresSolver
CeresSolver.ArctanLoss, CeresSolver.ArmijoLineSearch, CeresSolver.AutoDiffCostFunction<CostFunctor>, CeresSolver.BadTestTerm, CeresSolver.BFGS, CeresSolver.Block, CeresSolver.BlockEvaluatePreparer, CeresSolver.BlockJacobianWriter, CeresSolver.BlockJacobiPreconditioner, CeresSolver.BlockRandomAccessDenseMatrix, CeresSolver.BlockRandomAccessDiagonalMatrix, CeresSolver.BlockRandomAccessMatrix, CeresSolver.BlockSparseMatrix, CeresSolver.BlockSparseMatrixRandomMatrixOptions, CeresSolver.CallbackReturnType, CeresSolver.CallStatistics, CeresSolver.CauchyLoss, CeresSolver.Cell, CeresSolver.CellInfo, CeresSolver.CellLessThan, CeresSolver.CgnrLinearOperator, CeresSolver.CgnrSolver, CeresSolver.Chunk, CeresSolver.ComposedLoss, CeresSolver.CompressedList, CeresSolver.CompressedRowBlockStructure, CeresSolver.CompressedRowJacobianWriter, CeresSolver.CompressedRowSparseMatrix, CeresSolver.ConjugateGradientsSolver, CeresSolver.Context, CeresSolver.CoordinateDescentMinimizer, CeresSolver.Corrector, CeresSolver.CostFunction, CeresSolver.CostFunctorExample, CeresSolver.CovarianceAlgorithmType, CeresSolver.CRSMatrix, CeresSolver.CurveFittingFunctorExample, CeresSolver.DenseJacobianWriter, CeresSolver.DenseLinearAlgebraLibraryType, CeresSolver.DenseNormalCholeskySolver, CeresSolver.DenseQRSolver, CeresSolver.DenseSchurComplementSolver, CeresSolver.DenseSparseMatrix, CeresSolver.DoglegStrategy, CeresSolver.DoglegType, CeresSolver.DumpFormatType, CeresSolver.DynamicCompressedRowJacobianFinalizer, CeresSolver.DynamicCompressedRowJacobianWriter, CeresSolver.DynamicCostFunction, CeresSolver.DynamicNumericDiffCostFunction<T>, CeresSolver.EasyCostFunction, CeresSolver.EasyFunctor, CeresSolver.EigenQuaternionParameterization, CeresSolver.EvaluateOptions, CeresSolver.EvaluateScratch, CeresSolver.EvaluationCallback, CeresSolver.Evaluator, CeresSolver.EvaluatorOptions, CeresSolver.EventLogger, CeresSolver.ExecutionSummary, CeresSolver.ExponentialCostFunction, CeresSolver.ExponentialFunctor, CeresSolver.FirstOrderFunction, CeresSolver.FunctionSample, CeresSolver.GoodTestTerm, CeresSolver.GradientChecker, CeresSolver.GradientCheckingCostFunction, CeresSolver.GradientCheckingIterationCallback, CeresSolver.GradientProblem, CeresSolver.GradientProblemEvaluator, CeresSolver.GradientProblemSolver, CeresSolver.GradientProblemSolverOptions, CeresSolver.GradientProblemSolverStateUpdatingCallback, CeresSolver.GradientProblemSolverSummary, CeresSolver.Graph<Vertex>, CeresSolver.HomogeneousVectorParameterization, CeresSolver.HuberLoss, CeresSolver.IdentityParameterization, CeresSolver.ImplicitSchurComplement, CeresSolver.indexValueItem<Vertex>, CeresSolver.IterationCallback, CeresSolver.IterationSummary, CeresSolver.IterativeSchurComplementSolver, CeresSolver.LBFGS, CeresSolver.LevenbergMarquardtStrategy, CeresSolver.LinearCostFunction, CeresSolver.LinearLeastSquaresProblem, CeresSolver.LinearOperator, CeresSolver.LinearSolver, CeresSolver.LinearSolverOptions, CeresSolver.LinearSolverPerSolveOptions, CeresSolver.LinearSolverSummary, CeresSolver.LinearSolverTerminationType, CeresSolver.LinearSolverType, CeresSolver.LineSearch, CeresSolver.LineSearchDirection, CeresSolver.LineSearchDirectionOptions, CeresSolver.LineSearchDirectionType, CeresSolver.LineSearchFunction, CeresSolver.LineSearchInterpolationType, CeresSolver.LineSearchMinimizer, CeresSolver.LineSearchOptions, CeresSolver.LineSearchPreprocessor, CeresSolver.LineSearchSummary, CeresSolver.LineSearchType, CeresSolver.LocalParameterization, CeresSolver.LoggingCallback, CeresSolver.LoggingType, CeresSolver.LossFunction, CeresSolver.LossFunctionWrapper, CeresSolver.LowRankInverseHessian, CeresSolver.Minimizer, CeresSolver.MinimizerOptions, CeresSolver.MinimizerType, CeresSolver.MyCostFunctor, CeresSolver.MyThreeParameterCostFunctor, CeresSolver.NonlinearConjugateGradient, CeresSolver.NonlinearConjugateGradientType, CeresSolver.NormalPrior, CeresSolver.NullJacobianFinalizer, CeresSolver.NumericDiffCostFunction<CostFunctor>, CeresSolver.NumericDiffMethodType, CeresSolver.NumericDiffOptions, CeresSolver.OnlyFillsOneOutputFunctor, CeresSolver.OrderedGroups<T>, CeresSolver.Ownership, CeresSolver.Pair<T,U>, CeresSolver.ParameterBlock, CeresSolver.PartitionedMatrixView, CeresSolver.Preconditioner, CeresSolver.PreconditionerOptions, CeresSolver.PreconditionerType, CeresSolver.PreprocessedProblem, CeresSolver.Preprocessor, CeresSolver.ProbeResults, CeresSolver.ProblemImpl, CeresSolver.ProblemOptions, CeresSolver.ProductParameterization, CeresSolver.Program, CeresSolver.ProgramEvaluator<EvaluatePreparer, JacobianWriter, JacobianFinalizer>, CeresSolver.QuaternionParameterization, CeresSolver.RandomizedCostFunction, CeresSolver.RandomizedFunctor, CeresSolver.ResidualBlock, CeresSolver.ScaledLoss, CeresSolver.SchurComplementSolver, CeresSolver.SchurEliminator, CeresSolver.SchurEliminatorBase, CeresSolver.SchurJacobiPreconditioner, CeresSolver.ScopedExecutionTimer, CeresSolver.ScratchEvaluatePreparer, CeresSolver.SizedCostFunction, CeresSolver.SizeTestingCostFunction, CeresSolver.SoftLOneLoss, CeresSolver.Solver, CeresSolver.SolverOptions, CeresSolver.SolverSummary, CeresSolver.SparseLinearAlgebraLibraryType, CeresSolver.SparseMatrix, CeresSolver.SparseMatrixPreconditionerWrapper, CeresSolver.StateUpdatingCallback, CeresSolver.SteepestDescent, CeresSolver.SubsetParameterization, CeresSolver.TerminationType, CeresSolver.TestTerm, CeresSolver.TolerantLoss, CeresSolver.TranscendentalCostFunction, CeresSolver.TranscendentalFunctor, CeresSolver.TripletSparseMatrix, CeresSolver.TripletSparseMatrixRandomMatrixOptions, CeresSolver.TrivialLoss, CeresSolver.TrustRegionMinimizer, CeresSolver.TrustRegionPreprocessor, CeresSolver.TrustRegionStepEvaluator, CeresSolver.TrustRegionStrategy, CeresSolver.TrustRegionStrategyOptions, CeresSolver.TrustRegionStrategyPerSolveOptions, CeresSolver.TrustRegionStrategySummary, CeresSolver.TrustRegionStrategyType, CeresSolver.TukeyLoss, CeresSolver.TypedLinearSolver<MatrixType>, CeresSolver.TypedPreconditioner<MatrixType>, CeresSolver.VertexDegreeLessThan<Vertex>, CeresSolver.VertexTotalOrdering<Vertex>, CeresSolver.VisibilityClusteringType, CeresSolver.WeightedGraph<Vertex>, CeresSolver.WolfeLineSearch -
Field Summary
Fields inherited from class gov.nih.mipav.model.algorithms.CeresSolver
BAD_TEST_TERM_EXAMPLE, COST_FUNCTOR_EXAMPLE, CURVE_FITTING_EXAMPLE, curveFittingData, curveFittingObservations, default_relstep, DYNAMIC, EASY_COST_FUNCTION, EASY_FUNCTOR_EXAMPLE, epsilon, ERROR, EXPONENTIAL_COST_FUNCTION, EXPONENTIAL_FUNCTOR, FATAL, GOOD_TEST_TERM_EXAMPLE, INFO, LINEAR_COST_FUNCTION_EXAMPLE, m, MAX_LOG_LEVEL, MY_COST_FUNCTOR, MY_THREE_PARAMETER_COST_FUNCTOR, N0, ONLY_FILLS_ONE_OUTPUT_FUNCTOR, optionsValid, RANDOMIZED_COST_FUNCTION, RANDOMIZED_FUNCTOR, SIZE_TESTING_COST_FUNCTION, svd, TEST_TERM_EXAMPLE, testCase, testMode, TRANSCENDENTAL_COST_FUNCTION, TRANSCENDENTAL_FUNCTOR, WARNING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAddRandomBlock(int num_rows, int num_cols, int row_block_begin, int col_block_begin, Vector<Integer> rows, Vector<Integer> cols, Vector<Double> values) voidAngleAxisRotatePoint(double[] angle_axis, double[] pt, double[] result) voidAngleAxisToQuaternion(double[] angle_axis, double[] quaternion) voidAngleAxisToRotationMatrix(double[] angle_axis, double[] R) voidBlockOrderingToScalarOrdering(Vector<Integer> blocks, Vector<Integer> block_ordering, Vector<Integer> scalar_ordering) voidCompressedColumnScalarMatrixToBlockMatrix(int[] scalar_rows, int[] scalar_cols, Vector<Integer> row_blocks, Vector<Integer> col_blocks, Vector<Integer> block_rows, Vector<Integer> block_cols) voidComputeCanonicalViewsClustering(CeresSolver2.CanonicalViewsClusteringOptions options, CeresSolver.WeightedGraph<Integer> graph, Vector<Integer> centers, HashMap<Integer, Integer> membership) intComputeSingleLinkageClustering(CeresSolver2.SingleLinkageClusteringOptions options, CeresSolver.WeightedGraph<Integer> graph, HashMap<Integer, Integer> membership) voidComputeVisibility(CeresSolver.CompressedRowBlockStructure block_structure, int num_eliminate_blocks, Vector<HashSet<Integer>> visibility) CreateBlockDiagonalMatrix(double[] diagonal, Vector<Integer> blocks) (package private) CeresSolver.WeightedGraph<Integer> CreateSchurComplementGraph(Vector<HashSet<Integer>> visibility) voidCubicHermiteSpline(int kDataDimension, double[] p0, double[] p1, double[] p2, double[] p3, double x, double[] f, double[] dfdx) doubleDotProduct(double[] a, double[] b) voidEulerAnglesToRotationMatrix(double[] euler, double[] R) <Vertex> VertexFindConnectedComponent(Vertex vertex, HashMap<Vertex, Vertex> union_find) booleanfitToExternalFunction(double[] x, double[] residuals, double[][] jacobian) FromTripletSparseMatrix(CeresSolver.TripletSparseMatrix input, boolean transpose) voidMapValuesToContiguousRange(int[] array) doublenorm(double[] arg) voidQuaternionToAngleAxis(double[] quaternion, double[] angle_axis) voidQuaternionToRotation(double[] q, double[] R) voidQuaternionToScaledRotation(double[] q, double[] R) voidRotationMatrixToAngleAxis(double[] R, double[] angle_axis) voidRotationMatrixToQuaternion(double[] R, double[] quaternion) voidSolveRTRWithSparseRHS(int num_cols, int[] rows, int[] cols, double[] values, int rhs_nonzero_index, double[] solution) voidSolveUpperTriangularInPlace(int num_cols, int[] rows, int[] cols, double[] values, double[] rhs_and_solution) voidSolveUpperTriangularTransposeInPlace(int num_cols, int[] rows, int[] cols, double[] values, double[] rhs_and_solution) voidToDegrees(double[] euler_angles) voidTranspose3x3(double[] m) voidUnitQuaternionRotatePoint(double[] q, double[] pt, double[] result) Methods inherited from class gov.nih.mipav.model.algorithms.CeresSolver
AppendArrayToString, ApplyOrdering, BuildResidualLayout, ComputeHouseholderVector, ComputeRecursiveIndependentSetOrdering, ComputeSchurOrdering, ComputeStableSchurOrdering, copyFunctionSample, Create, Create, Create, Create, Create, Create, Create, CreateDiagonalMatrix, CreateEvaluatorScratch, CreateGradientCheckingCostFunction, CreateGradientCheckingProblemImpl, CreateHessianGraph, CreateLinearLeastSquaresProblemFromId, CreateOrdering, createPartitionedMatrixView, CreatePreprocessor, CreateRandomMatrix, CreateRandomMatrix, createSchurEliminatorBase, CreateSparseDiagonalMatrix, DetectStructure, DifferentiatePolynomial, DumpLinearLeastSquaresProblem, DumpLinearLeastSquaresProblemToConsole, DumpLinearLeastSquaresProblemToTextFile, EigenQuaternionProduct, EvaluateCostFunction, EvaluateJacobianColumn, EvaluateJacobianForParameterBlock, EvaluateJacobianForParameterBlock, EvaluatePolynomial, EvaluateRiddersJacobianColumn, ExpectClose, FindInterpolatingPolynomial, FindInvalidValue, FindLinearPolynomialRoots, FindPolynomialRoots, FindQuadraticPolynomialRoots, FindWithDefault, FindWithDefault, GetBestSchurTemplateSpecialization, GradientProblemSolverOptionsToSolverOptions, IndependentSetOrdering, InvalidateArray, InvalidateArray, InvalidateArray, InvalidateArray, InvertPSDMatrix, IsArrayValid, IsArrayValid, IsArrayValid, IsArrayValid, IsClose, IsOrderingValid, IsSchurType, IsSolutionUsable, IsSolutionUsable, LexicographicallyOrderResidualBlocks, LinearLeastSquaresProblem0, LinearLeastSquaresProblem1, LinearLeastSquaresProblem2, LinearLeastSquaresProblem3, LinearLeastSquaresProblem4, LinearSolverForZeroEBlocks, LinearSolverTypeToString, LineSearchDirectionTypeToString, LineSearchInterpolationTypeToString, LineSearchTypeToString, MatrixMatrixMultiply, MatrixMatrixMultiply, MatrixMatrixMultiply, MatrixMatrixMultiply, MatrixTransposeMatrixMultiply, MatrixTransposeVectorMultiply, MatrixVectorMultiply, MaybeReorderSchurComplementColumnsUsingEigen, MaybeReorderSchurComplementColumnsUsingSuiteSparse, Minimize, MinimizeInterpolatingPolynomial, MinimizePolynomial, MinParameterBlock, NonlinearConjugateGradientTypeToString, operator, PostSolveSummarize, PreconditionerForZeroEBlocks, PreconditionerTypeToString, QuaternionProduct, RandDouble, RandDouble, RandNormal, RemoveLeadingZeros, ReorderProgramForSchurTypeLinearSolver, RunCallbacks, SchurStructureToString, SetSummaryFinalCost, SetSummaryFinalCost, SetupCommonMinimizerOptions, Solve, Solve, StableIndependentSetOrdering, SummarizeReducedProgram, swap, TerminationTypeToString, TransposeForCompressedRowSparseStructure, Uniform, WriteArrayToFileOrDie, WriteStringToFileOrDie
-
Constructor Details
-
CeresSolver2
public CeresSolver2()
-
-
Method Details
-
fitToExternalFunction
public boolean fitToExternalFunction(double[] x, double[] residuals, double[][] jacobian) - Specified by:
fitToExternalFunctionin classCeresSolver
-
MapValuesToContiguousRange
public void MapValuesToContiguousRange(int[] array) -
norm
public double norm(double[] arg) -
AngleAxisToQuaternion
public void AngleAxisToQuaternion(double[] angle_axis, double[] quaternion) -
QuaternionToAngleAxis
public void QuaternionToAngleAxis(double[] quaternion, double[] angle_axis) -
DotProduct
public double DotProduct(double[] a, double[] b) -
AngleAxisToRotationMatrix
public void AngleAxisToRotationMatrix(double[] angle_axis, double[] R) -
RotationMatrixToQuaternion
public void RotationMatrixToQuaternion(double[] R, double[] quaternion) -
RotationMatrixToAngleAxis
public void RotationMatrixToAngleAxis(double[] R, double[] angle_axis) -
Transpose3x3
public void Transpose3x3(double[] m) -
ToDegrees
public void ToDegrees(double[] euler_angles) -
EulerAnglesToRotationMatrix
public void EulerAnglesToRotationMatrix(double[] euler, double[] R) -
QuaternionToScaledRotation
public void QuaternionToScaledRotation(double[] q, double[] R) -
QuaternionToRotation
public void QuaternionToRotation(double[] q, double[] R) -
UnitQuaternionRotatePoint
public void UnitQuaternionRotatePoint(double[] q, double[] pt, double[] result) -
AngleAxisRotatePoint
public void AngleAxisRotatePoint(double[] angle_axis, double[] pt, double[] result) -
ComputeVisibility
public void ComputeVisibility(CeresSolver.CompressedRowBlockStructure block_structure, int num_eliminate_blocks, Vector<HashSet<Integer>> visibility) -
CreateSchurComplementGraph
-
CubicHermiteSpline
public void CubicHermiteSpline(int kDataDimension, double[] p0, double[] p1, double[] p2, double[] p3, double x, double[] f, double[] dfdx) -
ComputeCanonicalViewsClustering
public void ComputeCanonicalViewsClustering(CeresSolver2.CanonicalViewsClusteringOptions options, CeresSolver.WeightedGraph<Integer> graph, Vector<Integer> centers, HashMap<Integer, Integer> membership) -
CompressedColumnScalarMatrixToBlockMatrix
-
BlockOrderingToScalarOrdering
-
SolveUpperTriangularInPlace
public void SolveUpperTriangularInPlace(int num_cols, int[] rows, int[] cols, double[] values, double[] rhs_and_solution) -
SolveUpperTriangularTransposeInPlace
public void SolveUpperTriangularTransposeInPlace(int num_cols, int[] rows, int[] cols, double[] values, double[] rhs_and_solution) -
SolveRTRWithSparseRHS
public void SolveRTRWithSparseRHS(int num_cols, int[] rows, int[] cols, double[] values, int rhs_nonzero_index, double[] solution) -
AddRandomBlock
-
FromTripletSparseMatrix
public CeresSolver.CompressedRowSparseMatrix FromTripletSparseMatrix(CeresSolver.TripletSparseMatrix input) -
FromTripletSparseMatrixTransposed
public CeresSolver.CompressedRowSparseMatrix FromTripletSparseMatrixTransposed(CeresSolver.TripletSparseMatrix input) -
FromTripletSparseMatrix
public CeresSolver.CompressedRowSparseMatrix FromTripletSparseMatrix(CeresSolver.TripletSparseMatrix input, boolean transpose) -
CreateBlockDiagonalMatrix
public CeresSolver.CompressedRowSparseMatrix CreateBlockDiagonalMatrix(double[] diagonal, Vector<Integer> blocks) -
CreateRandomMatrix
public CeresSolver.CompressedRowSparseMatrix CreateRandomMatrix(CeresSolver2.CompressedRowSparseMatrixRandomMatrixOptions options) -
FindConnectedComponent
-
ComputeSingleLinkageClustering
public int ComputeSingleLinkageClustering(CeresSolver2.SingleLinkageClusteringOptions options, CeresSolver.WeightedGraph<Integer> graph, HashMap<Integer, Integer> membership) -
Degree2MaximumSpanningForest
public CeresSolver.WeightedGraph<Integer> Degree2MaximumSpanningForest(CeresSolver.WeightedGraph<Integer> graph)
-