简体   繁体   English

如何使用Jama声明矩阵

[英]how to declare matrix using jama

I am new to Java Programming.I was doing a scientific simulation within which a system of linear equations has to be solved. 我是Java编程的新手,当时我在做科学模拟,其中必须解决线性方程组。

I work in Eclipse.I downloaded the jama jar file and added to JRE System Library.The problem is when I create a new Matrix object by passing a 2D double array as constructor argument,the IDE is mentioning that "The constructor Matrix(double[][]) is undefined". 我在Eclipse中工作。我下载了jama jar文件并添加到JRE系统库中。问题是,当我通过传递2D双精度数组作为构造函数参数来创建新的Matrix对象时,IDE提到“构造函数Matrix(double [ ] [])未定义”。

I googled a lot,but got nothing :( 我在Google上搜索了很多,但一无所获:(

Have someone came accross it? 有人来过吗? How shall I deal with this? 我该如何处理?

Documentation of jama suggests there actually is such a constructor. jama的文档表明实际上存在这样的构造函数。 A quick test with jama 1.0.3 in netbeans IDE confirms that the constructor is there and can be used accordingly. 在netbeans IDE中使用jama 1.0.3进行的快速测试可以确认构造函数已经存在并且可以相应地使用。

I suspect the lib is not properly loaded. 我怀疑lib未正确加载。 Another possibility might be that you made your own Matrix class, and this is being used instead of the Jama.Matrix class. 另一种可能是您创建了自己的Matrix类,而不是Jama.Matrix类被使用。 Does the error also occur when you use Jama.Matrix instead of Matrix? 当您使用Jama.Matrix而不是Matrix时,是否还会发生错误?

Get the matrix jar file. 获取矩阵jar文件。 Add the jar to your class path (in net beans, I just add it to the libraries for the project; I believe you should add the Matrix jar file to the "java build path" in eclipse). 将jar添加到您的类路径中(在net bean中,我只是将其添加到项目的库中;我相信您应该将Matrix jar文件添加到eclipse中的“ java构建路径”中)。

Once you do the above, Matrix(double[][]) is available. 完成上述操作后,即可使用Matrix(double [] [])。

I think you need more about JAMA. 我认为您需要更多有关JAMA的信息。 So, please have a look: http://math.nist.gov/javanumerics/jama/doc/ 因此,请看一下: http : //math.nist.gov/javanumerics/jama/doc/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM