*/
const double mat2[2][2] = {{1., -1.}, {1., 1.}};
+/*
+ * Eigenvalues and -vectors of this system are
+ * lambda = 1 v = (1, 0, 0)
+ * lambda = 1 v = (0, 1, 0)
+ * lambda = 1 v = (-1, 0, 0)
+ */
+const double mat3[3][3] = {{1., 0, 2.}, {0., 1., 0.}, {0., 0., 1.}};
+
void
-check_matrix(const double *matrix_pointer)
+check_matrix(const double *matrix_pointer, const unsigned int size)
{
- FullMatrix<double> A(2, 2, matrix_pointer);
- LAPACKFullMatrix<double> LA(2, 2);
+ FullMatrix<double> A(size, size, matrix_pointer);
+ LAPACKFullMatrix<double> LA(size, size);
LA = A;
deallog << "Checking matrix " << std::endl;
}
deallog << std::endl;
deallog << "Right eigenvectors" << std::endl;
- LA.get_right_eigenvectors().print_formatted(deallog.get_file_stream());
+ LA.get_right_eigenvectors().print(deallog.get_file_stream());
deallog << "Left eigenvectors" << std::endl;
- LA.get_left_eigenvectors().print_formatted(deallog.get_file_stream());
+ LA.get_left_eigenvectors().print(deallog.get_file_stream());
deallog << std::endl;
}
initlog();
// Test symmetric system
- check_matrix(&mat1[0][0]);
+ check_matrix(&mat1[0][0], 2);
// Test non-symmetric system with complex eigenvalues/eigenvectors
- check_matrix(&mat2[0][0]);
+ check_matrix(&mat2[0][0], 2);
+
+ // Test case of one eigenvalue with two associated eigenvectors
+ check_matrix(&mat3[0][0], 3);
}
-1.000e+00 4.000e+00
DEAL::Eigenvalues: (5.00000,0.00000) (3.00000,0.00000)
DEAL::Right eigenvectors
-(7.071e-01,0.000e+00) (7.071e-01,0.000e+00)
-(-7.071e-01,0.000e+00) (7.071e-01,0.000e+00)
+(0.71,0.0)(0.71,0.0)
+(-0.71,0.0)(0.71,0.0)
DEAL::Left eigenvectors
-(7.071e-01,0.000e+00) (7.071e-01,0.000e+00)
-(-7.071e-01,0.000e+00) (7.071e-01,0.000e+00)
+(0.71,0.0)(0.71,0.0)
+(-0.71,0.0)(0.71,0.0)
DEAL::
DEAL::Checking matrix
1.000e+00 -1.000e+00
1.000e+00 1.000e+00
DEAL::Eigenvalues: (1.00000,1.00000) (1.00000,-1.00000)
DEAL::Right eigenvectors
-(7.071e-01,0.000e+00) (7.071e-01,0.000e+00)
-(0.000e+00,-7.071e-01) (0.000e+00,7.071e-01)
+(0.71,0.0)(0.71,0.0)
+(0.0,-0.71)(0.0,0.71)
DEAL::Left eigenvectors
-(-7.071e-01,0.000e+00) (-7.071e-01,0.000e+00)
-(0.000e+00,7.071e-01) (0.000e+00,-7.071e-01)
+(-0.71,0.0)(-0.71,0.0)
+(0.0,0.71)(0.0,-0.71)
+DEAL::
+DEAL::Checking matrix
+1.000e+00 2.000e+00
+ 1.000e+00
+ 1.000e+00
+DEAL::Eigenvalues: (1.00000,0.00000) (1.00000,0.00000) (1.00000,0.00000)
+DEAL::Right eigenvectors
+(1.0,0.0)(0.0,0.0)(-1.0,0.0)
+(0.0,0.0)(1.0,0.0)(0.0,0.0)
+(0.0,0.0)(0.0,0.0)(1.1e-16,0.0)
+DEAL::Left eigenvectors
+(1.1e-16,0.0)(0.0,0.0)(0.0,0.0)
+(0.0,0.0)(1.0,0.0)(0.0,0.0)
+(-1.0,0.0)(0.0,0.0)(1.0,0.0)
DEAL::