<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://programmingexamples.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2FEigen%2FSimplicialLDLT</id>
		<title>CPP/Eigen/SimplicialLDLT - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2FEigen%2FSimplicialLDLT"/>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=CPP/Eigen/SimplicialLDLT&amp;action=history"/>
		<updated>2026-11-03T10:51:05Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.5</generator>

	<entry>
		<id>http://programmingexamples.net/w/index.php?title=CPP/Eigen/SimplicialLDLT&amp;diff=5219&amp;oldid=prev</id>
		<title>Daviddoria: Created page with &quot;==SimplicialLDLT.cpp== &lt;source lang=&quot;cpp&quot;&gt; #include &lt;iostream&gt;  #include &lt;Eigen/Sparse&gt;  int main(int, char *[]) {   // Create matrix   typedef Eigen::SparseMatrix&lt;double&gt; Spa...&quot;</title>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=CPP/Eigen/SimplicialLDLT&amp;diff=5219&amp;oldid=prev"/>
				<updated>2015-05-15T10:20:17Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;==SimplicialLDLT.cpp== &amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt; #include &amp;lt;iostream&amp;gt;  #include &amp;lt;Eigen/Sparse&amp;gt;  int main(int, char *[]) {   // Create matrix   typedef Eigen::SparseMatrix&amp;lt;double&amp;gt; Spa...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==SimplicialLDLT.cpp==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;Eigen/Sparse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main(int, char *[])&lt;br /&gt;
{&lt;br /&gt;
  // Create matrix&lt;br /&gt;
  typedef Eigen::SparseMatrix&amp;lt;double&amp;gt; SparseMatrixType;&lt;br /&gt;
  SparseMatrixType A(2, 2);&lt;br /&gt;
&lt;br /&gt;
  // Create the right-hand-side vector&lt;br /&gt;
  Eigen::VectorXd b(2);&lt;br /&gt;
&lt;br /&gt;
  // Fill matrix&lt;br /&gt;
  A.coeffRef(0, 0) += 1;&lt;br /&gt;
  A.coeffRef(1, 1) += 3;&lt;br /&gt;
&lt;br /&gt;
  // Fill vector&lt;br /&gt;
  b[0] = 1;&lt;br /&gt;
  b[1] = 2;&lt;br /&gt;
&lt;br /&gt;
  // Solve the (symmetric) system&lt;br /&gt;
  Eigen::SimplicialLDLT&amp;lt;SparseMatrixType&amp;gt; sparseSolver(A);&lt;br /&gt;
  Eigen::VectorXd x = sparseSolver.solve(b);&lt;br /&gt;
  if(sparseSolver.info() != Eigen::Success)&lt;br /&gt;
  {&lt;br /&gt;
    throw std::runtime_error(&amp;quot;Decomposition failed!&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;Result: &amp;quot; &amp;lt;&amp;lt; x &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
  return EXIT_SUCCESS;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==CMakeLists.txt==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
cmake_minimum_required(VERSION 2.6)&lt;br /&gt;
&lt;br /&gt;
PROJECT(SimplicialLDLT)&lt;br /&gt;
&lt;br /&gt;
# Set the CMake variable to the value of the environment variable.&lt;br /&gt;
# If the build is absolutely fresh, this will be the case if the CMake variable EIGEN3_INCLUDE_DIR is not set.&lt;br /&gt;
if(NOT EIGEN3_INCLUDE_DIR)&lt;br /&gt;
  set(EIGEN3_INCLUDE_DIR $ENV{EIGEN3_INCLUDE_DIR})&lt;br /&gt;
  message(&amp;quot;Set EIGEN3_INCLUDE_DIR to ${EIGEN3_INCLUDE_DIR} from environment variable of the same name.&amp;quot;)&lt;br /&gt;
else()&lt;br /&gt;
  message(&amp;quot;EIGEN3_INCLUDE_DIR is ${EIGEN3_INCLUDE_DIR}&amp;quot;)&lt;br /&gt;
endif()&lt;br /&gt;
&lt;br /&gt;
if(NOT EIGEN3_FOUND)&lt;br /&gt;
  FIND_PACKAGE(Eigen3 REQUIRED) #requires FindEigen3.cmake to be in the source directory&lt;br /&gt;
  include_directories(${EIGEN3_INCLUDE_DIR})&lt;br /&gt;
endif()&lt;br /&gt;
&lt;br /&gt;
ADD_EXECUTABLE(SimplicialLDLT SimplicialLDLT.cpp )&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	</feed>