• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MultivariateMatrixFunction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.math3.analysis.MultivariateMatrixFunction的典型用法代码示例。如果您正苦于以下问题:Java MultivariateMatrixFunction类的具体用法?Java MultivariateMatrixFunction怎么用?Java MultivariateMatrixFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MultivariateMatrixFunction类属于org.apache.commons.math3.analysis包,在下文中一共展示了MultivariateMatrixFunction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getNumericJacobianFunction

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
public MultivariateMatrixFunction getNumericJacobianFunction(final double[] xgrid, final double[] ygrid) {
    final MultivariateVectorFunction valueFunction = getValueFunction(xgrid, ygrid);
    return new MultivariateMatrixFunction() {
        static final double step = 0.01;

        @Override
        public double[][] value(double[] point) throws IllegalArgumentException {
            double[][] retVal = new double[xgrid.length][point.length];

            for(int i = 0; i < point.length; i++) {
                double[] newPoint = point.clone();
                newPoint[i] = newPoint[i] + step;
                double[] f1 = valueFunction.value(newPoint);
                double[] f2 = valueFunction.value(point);
                for(int j = 0; j < f1.length; j++) {
                    retVal[j][i] = (f1[j] - f2[j]) / step;
                }
            }
            return retVal;
        }
    };
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:23,代码来源:PSFModel.java


示例2: getNumericJacobianFunction

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
private MultivariateMatrixFunction getNumericJacobianFunction(final double[] xgrid1, final double[] ygrid1, final double[] xgrid2, final double[] ygrid2) {
    final MultivariateVectorFunction valueFunction = getValueFunction(xgrid1, ygrid1, xgrid2, ygrid2);
    return new MultivariateMatrixFunction() {
        static final double step = 0.01;

        @Override
        public double[][] value(double[] point) throws IllegalArgumentException {
            double[][] retVal = new double[xgrid1.length + xgrid2.length][point.length];

            for(int i = 0; i < point.length; i++) {
                double[] newPoint = point.clone();
                newPoint[i] = newPoint[i] + step;
                double[] f1 = valueFunction.value(newPoint);
                double[] f2 = valueFunction.value(point);
                for(int j = 0; j < f1.length; j++) {
                    retVal[j][i] = (f1[j] - f2[j]) / step;
                }
            }
            return retVal;
        }
    };
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:23,代码来源:BiplaneEllipticGaussianPSF.java


示例3: getJacobianFunction

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
@Override
public MultivariateMatrixFunction getJacobianFunction(final double[] xgrid, final double[] ygrid) {
    return new MultivariateMatrixFunction() {
        @Override
        public double[][] value(double[] point) throws IllegalArgumentException {
            fixParams(point);
            //
            double[][] retVal = new double[xgrid.length][point.length];
            for(int i = 0; i < nmol; i++) {
                double [] tmp = Arrays.copyOfRange(point, i*Params.PARAMS_LENGTH, (i+1)*Params.PARAMS_LENGTH);
                double [][] J = psf.getNumericJacobianFunction(xgrid, ygrid).value(tmp);
                for(int j = 0; j < J.length; j++) {
                    for(int k = 0, l = i*Params.PARAMS_LENGTH; k < J[j].length; k++, l++) {
                        retVal[j][l] = J[j][k];
                    }
                }
            }
            return retVal;
        }
    };
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:22,代码来源:MultiPSF.java


示例4: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
public MultivariateMatrixFunction getModelFunctionJacobian() {
    return new MultivariateMatrixFunction() {
        public double[][] value(double[] params) {
            double[][] jacobian = new double[time.size()][5];

            for (int i = 0; i < jacobian.length; ++i) {
                final double t = time.get(i);
                jacobian[i][0] = 1;

                final double p3 =  params[3];
                final double p4 =  params[4];
                final double tOp3 = t / p3;
                final double tOp4 = t / p4;
                jacobian[i][1] = FastMath.exp(-tOp3);
                jacobian[i][2] = FastMath.exp(-tOp4);
                jacobian[i][3] = params[1] * FastMath.exp(-tOp3) * tOp3 / p3;
                jacobian[i][4] = params[2] * FastMath.exp(-tOp4) * tOp4 / p4;
            }
            return jacobian;
        }
    };
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:23,代码来源:LevenbergMarquardtOptimizerTest.java


示例5: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
public ModelFunctionJacobian getModelFunctionJacobian() {
    return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
            public double[][] value(double[] params) {
                double[][] jacobian = new double[time.size()][5];

                for (int i = 0; i < jacobian.length; ++i) {
                    final double t = time.get(i);
                    jacobian[i][0] = 1;

                    final double p3 =  params[3];
                    final double p4 =  params[4];
                    final double tOp3 = t / p3;
                    final double tOp4 = t / p4;
                    jacobian[i][1] = FastMath.exp(-tOp3);
                    jacobian[i][2] = FastMath.exp(-tOp4);
                    jacobian[i][3] = params[1] * FastMath.exp(-tOp3) * tOp3 / p3;
                    jacobian[i][4] = params[2] * FastMath.exp(-tOp4) * tOp4 / p4;
                }
                return jacobian;
            }
        });
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:23,代码来源:LevenbergMarquardtOptimizerTest.java


示例6: refine

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
/**
 * Perform Levenburg-Marquardt non-linear optimisation to get better
 * estimates of the parameters
 */
private void refine()
{
	final LevenbergMarquardtOptimizer lm = new LevenbergMarquardtOptimizer();
	final RealVector start = buildInitialVector();
	final RealVector observed = buildObservedVector();
	final int maxEvaluations = 1000;
	final int maxIterations = 1000;

	final MultivariateVectorFunction value = new Value();
	final MultivariateMatrixFunction jacobian = new Jacobian();
	final MultivariateJacobianFunction model = LeastSquaresFactory.model(value, jacobian);

	final Optimum result = lm.optimize(LeastSquaresFactory.create(model,
			observed, start, null, maxEvaluations, maxIterations));

	updateEstimates(result.getPoint());
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:22,代码来源:CameraCalibrationZhang.java


示例7: createJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
@Override
public MultivariateMatrixFunction createJacobian() {
	List<MultiVectorDiffFunction> diffFunctions = new ArrayList<>();

	for (int i = 0; i < parameters.size(); i++) {
		try {
			diffFunctions.add(new MultiVectorDiffFunction(formulas, dependentVariables, initValues, initParameters,
					parameters, variableValues, timeValues, dependentVariable, timeVariable, integrator,
					interpolator));
		} catch (ParseException e) {
		}
	}

	return point -> MathUtils.aproxJacobianParallel(diffFunctions, point,
			timeValues.stream().mapToInt(t -> t.size()).sum());
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:17,代码来源:MultiVectorDiffFunction.java


示例8: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
public MultivariateMatrixFunction getModelFunctionJacobian() {
    return new MultivariateMatrixFunction() {
        public double[][] value(double[] params) {
            double[][] jacobian = new double[time.size()][5];

            for (int i = 0; i < jacobian.length; ++i) {
                final double t = time.get(i);
                jacobian[i][0] = 1;

                final double p3 =  params[3];
                final double p4 =  params[4];
                final double tOp3 = t / p3;
                final double tOp4 = t / p4;
                jacobian[i][1] = Math.exp(-tOp3);
                jacobian[i][2] = Math.exp(-tOp4);
                jacobian[i][3] = params[1] * Math.exp(-tOp3) * tOp3 / p3;
                jacobian[i][4] = params[2] * Math.exp(-tOp4) * tOp4 / p4;
            }
            return jacobian;
        }
    };
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:23,代码来源:LevenbergMarquardtOptimizerTest.java


示例9: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
public ModelFunctionJacobian getModelFunctionJacobian() {
    return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
            public double[][] value(double[] params) {
                double[][] jacobian = new double[time.size()][5];

                for (int i = 0; i < jacobian.length; ++i) {
                    final double t = time.get(i);
                    jacobian[i][0] = 1;

                    final double p3 =  params[3];
                    final double p4 =  params[4];
                    final double tOp3 = t / p3;
                    final double tOp4 = t / p4;
                    jacobian[i][1] = Math.exp(-tOp3);
                    jacobian[i][2] = Math.exp(-tOp4);
                    jacobian[i][3] = params[1] * Math.exp(-tOp3) * tOp3 / p3;
                    jacobian[i][4] = params[2] * Math.exp(-tOp4) * tOp4 / p4;
                }
                return jacobian;
            }
        });
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:23,代码来源:LevenbergMarquardtOptimizerTest.java


示例10: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
/**
 * 雅克比矩阵
 *
 * @return the model function jacobian
 */
public MultivariateMatrixFunction getModelFunctionJacobian() {
    return new MultivariateMatrixFunction() {
        @Override
        public double[][] value(double[] point) {
            return jacobian(point);
        }
    };
}
 
开发者ID:BPL-Gear,项目名称:bpl-gear,代码行数:14,代码来源:CircleProblem.java


示例11: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
/**
 * @return the model function Jacobian.
 */
public ModelFunctionJacobian getModelFunctionJacobian() {
    return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
            /** {@inheritDoc} */
            public double[][] value(double[] point) {
                final double[][] jacobian = new double[observations.size()][];
                int i = 0;
                for (WeightedObservedPoint observed : observations) {
                    jacobian[i++] = f.gradient(observed.getX(), point);
                }
                return jacobian;
            }
        });
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:17,代码来源:CurveFitter.java


示例12: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
/**
 * @return the model function Jacobian.
 */
public MultivariateMatrixFunction getModelFunctionJacobian() {
    return new MultivariateMatrixFunction() {
        /** {@inheritDoc} */
        public double[][] value(double[] p) {
            final int len = points.length;
            final double[][] jacobian = new double[len][];
            for (int i = 0; i < len; i++) {
                jacobian[i] = f.gradient(points[i], p);
            }
            return jacobian;
        }
    };
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:17,代码来源:AbstractCurveFitter.java


示例13: getJacobianFunction

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
@Override
public MultivariateMatrixFunction getJacobianFunction(final double[] xgrid, final double[] ygrid) {
    return new MultivariateMatrixFunction() {
        @Override
        //derivations by wolfram alpha:
        //d(b^2 + ((J*J)/2/PI/(s*s)/(s*s)) * e^( -( ((x0-x)^2)/(2*s*s*s*s) + (((y0-y)^2)/(2*s*s*s*s)))))/dx
        public double[][] value(double[] point) throws IllegalArgumentException {
            double[] transformedPoint = transformParameters(point);
            double sigma = transformedPoint[Params.SIGMA];
            double sigmaSquared = sigma * sigma;
            double[][] retVal = new double[xgrid.length][transformedPoint.length];

            for (int i = 0; i < xgrid.length; i++) {
                //d()/dIntensity
                double xd = (xgrid[i] - transformedPoint[Params.X]);
                double yd = (ygrid[i] - transformedPoint[Params.Y]);
                double upper = -(xd * xd + yd * yd) / (2 * sigmaSquared);
                double expVal = exp(upper);
                double expValDivPISigmaSquared = expVal / (sigmaSquared * PI);
                double expValDivPISigmaPowEight = expValDivPISigmaSquared / sigmaSquared;
                retVal[i][Params.INTENSITY] = point[Params.INTENSITY] * expValDivPISigmaSquared;
                //d()/dx
                retVal[i][Params.X] = transformedPoint[Params.INTENSITY] * xd * expValDivPISigmaPowEight * 0.5;
                //d()/dy
                retVal[i][Params.Y] = transformedPoint[Params.INTENSITY] * yd * expValDivPISigmaPowEight * 0.5;
                //d()/dsigma
                retVal[i][Params.SIGMA] = transformedPoint[Params.INTENSITY] * expValDivPISigmaPowEight / point[Params.SIGMA] * (xd * xd + yd * yd - 2 * sigmaSquared);
                //d()/dbkg
                retVal[i][Params.OFFSET] = 2 * point[Params.OFFSET];
            }
            //IJ.log("numeric jacobian: " + Arrays.deepToString(SymmetricGaussianPSF.super.getJacobianFunction(xgrid, ygrid).value(point)));
            //IJ.log("analytic jacobian: " + Arrays.deepToString(retVal));
            return retVal;
        }
    };
}
 
开发者ID:zitmen,项目名称:thunderstorm,代码行数:37,代码来源:SymmetricGaussianPSF.java


示例14: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
/**
 * @return the model function Jacobian.
 */
public ModelFunctionJacobian getModelFunctionJacobian() {
    return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
            public double[][] value(double[] point) {
                final double[][] jacobian = new double[observations.size()][];
                int i = 0;
                for (WeightedObservedPoint observed : observations) {
                    jacobian[i++] = f.gradient(observed.getX(), point);
                }
                return jacobian;
            }
        });
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:16,代码来源:CurveFitter.java


示例15: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
/**
 * @return the model function Jacobian.
 */
public MultivariateMatrixFunction getModelFunctionJacobian() {
    return new MultivariateMatrixFunction() {
        public double[][] value(double[] p) {
            final int len = points.length;
            final double[][] jacobian = new double[len][];
            for (int i = 0; i < len; i++) {
                jacobian[i] = f.gradient(points[i], p);
            }
            return jacobian;
        }
    };
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:16,代码来源:AbstractCurveFitter.java


示例16: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
public MultivariateMatrixFunction getModelFunctionJacobian() {
    return new MultivariateMatrixFunction() {
        public double[][] value(double[] params) {
            return factors.getData();
        }
    };
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:8,代码来源:AbstractLeastSquaresOptimizerAbstractTest.java


示例17: dummyJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
/** Used for testing direct vs lazy evaluation. */
private MultivariateMatrixFunction dummyJacobian() {
    return new MultivariateMatrixFunction() {
        public double[][] value(double[] p) {
            throw new RuntimeException("dummyJacobian");
        }
    };
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:9,代码来源:EvaluationTest.java


示例18: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
public MultivariateMatrixFunction getModelFunctionJacobian() {
    return new MultivariateMatrixFunction() {
        public double[][] value(double[] params) {
            final int n = points.size();
            final Vector2D center = new Vector2D(params[0], params[1]);

            double dRdX = 0;
            double dRdY = 0;
            for (Vector2D pk : points) {
                double dk = pk.distance(center);
                dRdX += (center.getX() - pk.getX()) / dk;
                dRdY += (center.getY() - pk.getY()) / dk;
            }
            dRdX /= n;
            dRdY /= n;

            // Jacobian of the radius residuals.
            double[][] jacobian = new double[n][2];
            for (int i = 0; i < n; i++) {
                final Vector2D pi = points.get(i);
                final double di = pi.distance(center);
                jacobian[i][0] = (center.getX() - pi.getX()) / di - dRdX;
                jacobian[i][1] = (center.getY() - pi.getY()) / di - dRdY;
            }

            return jacobian;
        }
    };
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:30,代码来源:CircleVectorial.java


示例19: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
public MultivariateMatrixFunction getModelFunctionJacobian() {
    return new MultivariateMatrixFunction() {
        public double[][] value(double[] point) {
            return jacobian(point);
        }
    };
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:8,代码来源:StraightLineProblem.java


示例20: getModelFunctionJacobian

import org.apache.commons.math3.analysis.MultivariateMatrixFunction; //导入依赖的package包/类
public MultivariateMatrixFunction getModelFunctionJacobian() {
    return new MultivariateMatrixFunction() {
        public double[][] value(double[] point) {
            return computeJacobian(point);
        }
    };
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:8,代码来源:MinpackTest.java



注:本文中的org.apache.commons.math3.analysis.MultivariateMatrixFunction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Constants类代码示例发布时间:2022-05-21
下一篇:
Java SidedInvWrapper类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap