首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >没有为org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer找到库

没有为org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer找到库
EN

Stack Overflow用户
提问于 2017-11-18 23:37:13
回答 2查看 892关注 0票数 0

在处理过程中,我将Apache和作为外部jar库导入。我遵循了这样的指示:

如何在处理过程中添加外部库

处理草图似乎工作良好,但每次运行草图时,我都会得到下面的错误,以便输出控制台。

代码语言:javascript
复制
No library found for org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer

这是处理PDE草图:

代码语言:javascript
复制
import org.apache.commons.math3.fitting.leastsquares.*;
import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
import org.apache.commons.math3.linear.RealMatrix;
import org.apache.commons.math3.linear.RealVector;

import com.lemmingapex.trilateration.*;

void setup() {
  size(1024, 768);

  double[][] positions = new double[][] { { 8.0, 12.0 }, { 15.0, 40.0 }, { 40.0, 20.0 }, { 22, 40 } };
  double[] distances = new double[] { 10.06, 13.97, 23.32, 10.31 };

  NonLinearLeastSquaresSolver solver = new NonLinearLeastSquaresSolver(new TrilaterationFunction(positions, distances), new LevenbergMarquardtOptimizer());
  Optimum optimum = solver.solve();

  // the answer
  double[] centroid = optimum.getPoint().toArray();
  printArray(centroid);

  // error and geometry information; may throw SingularMatrixException depending the threshold argument provided
  RealVector standardDeviation = optimum.getSigma(0);
  RealMatrix covarianceMatrix = optimum.getCovariances(0);

  printArray(standardDeviation);
  printArray(covarianceMatrix);

  background(37);
  ellipse((float) centroid[0], (float) centroid[1], 20, 20);
}

void draw() {
}

我哪里出问题了?有什么指示吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-01-08 19:21:42

我能够使用以下的导入来使它工作。

代码语言:javascript
复制
import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
import org.apache.commons.math3.fitting.leastsquares.LevenbergMarquardtOptimizer;
import com.lemmingapex.trilateration.NonLinearLeastSquaresSolver;
import com.lemmingapex.trilateration.TrilaterationFunction;
import com.lemmingapex.trilateration.*;

谢谢凯文。希望这能帮到其他人。

票数 0
EN

Stack Overflow用户

发布于 2017-11-21 04:46:55

你在你链接到的答案上看到我的意见了吗?

在处理过程中使用库的最简单方法是将库的.jar文件拖到处理编辑器中。只需对您需要的所有.jar文件执行此操作即可。(您可能必须删除已经创建的库目录。)

无耻的自我推销:我写了一篇关于在处理可用这里时使用库的教程。

另见:https://stackoverflow.com/a/35674067/873165

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47372241

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档