Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/MySQL/doc/examples/   (MySQL Server Version 8.1-8.4©)  Datei vom 12.11.2025 mit Größe 1 kB image not shown  

Quelle  TutorialInplaceLU.cpp

  Sprache: C
 

#include <iostream>
struct init {
  init() { std::cout << "[" << "init" << "]" << std::endl; }
};
init init_obj;
// [init]
#include <iostream>
#include <Eigen/Dense>

using namespace std;
using namespace Eigen;

int main()
{
  MatrixXd A(2,2);
  A << 2, -113;
  cout << "Here is the input matrix A before decomposition:\n" << A << endl;
cout << "[init]" << endl;

cout << "[declaration]" << endl;
  PartialPivLU<Ref<MatrixXd> > lu(A);
  cout << "Here is the input matrix A after decomposition:\n" << A << endl;
cout << "[declaration]" << endl;

cout << "[matrixLU]" << endl;
  cout << "Here is the matrix storing the L and U factors:\n" << lu.matrixLU() << endl;
cout << "[matrixLU]" << endl;

cout << "[solve]" << endl;
  MatrixXd A0(2,2); A0 << 2, -113;
  VectorXd b(2);    b << 12;
  VectorXd x = lu.solve(b);
  cout << "Residual: " << (A0 * x - b).norm() << endl;
cout << "[solve]" << endl;

cout << "[modifyA]" << endl;
  A << 34, -21;
  x = lu.solve(b);
  cout << "Residual: " << (A0 * x - b).norm() << endl;
cout << "[modifyA]" << endl;

cout << "[recompute]" << endl;
  A0 = A; // save A
  lu.compute(A);
  x = lu.solve(b);
  cout << "Residual: " << (A0 * x - b).norm() << endl;
cout << "[recompute]" << endl;

cout << "[recompute_bis0]" << endl;
  MatrixXd A1(2,2);
  A1 << 5,-2,3,4;
  lu.compute(A1);
  cout << "Here is the input matrix A1 after decomposition:\n" << A1 << endl;
cout << "[recompute_bis0]" << endl;

cout << "[recompute_bis1]" << endl;
  x = lu.solve(b);
  cout << "Residual: " << (A1 * x - b).norm() << endl;
cout << "[recompute_bis1]" << endl;

}

Messung V0.5 in Prozent
C=97 H=100 G=98

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet am  2026-06-06) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.