简体   繁体   English

使用 Ojalgo 解决 Java 中的线性系统

[英]Using Ojalgo to solve linear systems in Java

I'm trying to solve M (NxN) linear systems (Ax = B, B = [b1,b2,...bM]) using Ojalgo.我正在尝试使用 Ojalgo 求解 M (NxN) 个线性系统(Ax = B, B = [b1,b2,...bM])。 What is the most efficient way to do this?执行此操作的最有效方法是什么? I'd also like to know if A is singular (A, B are objects of type PrimitiveMatrix).我还想知道 A 是否是单数(A、B 是 PrimitiveMatrix 类型的对象)。

Any help would be greatly appreciated.任何帮助将不胜感激。 Thank you!谢谢!

PrimitiveMatrix has a fixed/limited feature set, and you cannot control how things are done either. PrimitiveMatrix 具有固定/有限的功能集,您也无法控制事情的完成方式。 If you want options and control switch to using PrimitiveDenseStore (or any of the MatrixStore implementations).如果您希望选项和控制切换到使用 PrimitiveDenseStore(或任何 MatrixStore 实现)。 Then all you need to do is:那么你需要做的就是:

    final LU<Double> tmpLU = LU.PRIMITIVE.make();
    tmpLU.decompose(A);
    if (tmpLU.isSquareAndNotSingular()) {
        x = tmpLU.solve(b);
    } else {
        // Do something else...
    }

Did you look at the ojAlgo wiki?你看过ojAlgo wiki吗?

https://github.com/optimatika/ojAlgo/wiki https://github.com/optimatika/ojAlgo/wiki

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

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