mf;
mf.initialize(mf_data);
mf.compute_diagonal();
- const LinearAlgebra::distributed::Vector<double> &diagonal =
+ const LinearAlgebra::distributed::Vector<double> &inverse_diagonal =
mf.get_matrix_diagonal_inverse()->get_vector();
LinearAlgebra::distributed::Vector<number> in, out, ref;
}
in.update_ghost_values();
- out = diagonal;
+ out = inverse_diagonal;
// assemble trilinos sparse matrix with
// (v, u) for reference
}
sparse_matrix.compress(VectorOperation::add);
- sparse_matrix.vmult(ref, in);
-
for (unsigned int i = 0; i < ref.local_size(); ++i)
{
- const unsigned int glob_index = owned_set.nth_index_in_set(i);
+ const auto glob_index = owned_set.nth_index_in_set(i);
if (constraints.is_constrained(glob_index))
ref.local_element(i) = 1.;
else
- ref.local_element(i) = 1. / ref.local_element(i);
+ ref.local_element(i) = 1. / sparse_matrix(glob_index, glob_index);
}
ref.compress(VectorOperation::insert);
const double diff_norm = out.linfty_norm();
deallog << "Norm of difference: " << diff_norm << std::endl;
- deallog << "l2_norm: " << diagonal.l2_norm() << std::endl;
- deallog << "l1_norm: " << diagonal.l1_norm() << std::endl;
- deallog << "linfty_norm: " << diagonal.linfty_norm() << std::endl
+ deallog << "l2_norm: " << inverse_diagonal.l2_norm() << std::endl;
+ deallog << "l1_norm: " << inverse_diagonal.l1_norm() << std::endl;
+ deallog << "linfty_norm: " << inverse_diagonal.linfty_norm() << std::endl
<< std::endl;
}
DEAL:2d::Testing FE_Q<2>(1)
-DEAL:2d::Norm of difference: 4.26326e-14
-DEAL:2d::l2_norm: 504.352
-DEAL:2d::l1_norm: 3536.64
-DEAL:2d::linfty_norm: 92.1600
+DEAL:2d::Norm of difference: 0.00000
+DEAL:2d::l2_norm: 1008.02
+DEAL:2d::l1_norm: 7088.00
+DEAL:2d::linfty_norm: 144.000
DEAL:2d::
DEAL:2d::Testing FE_Q<2>(2)
-DEAL:2d::Norm of difference: 4.54747e-13
-DEAL:2d::l2_norm: 5051.63
-DEAL:2d::l1_norm: 68866.9
-DEAL:2d::linfty_norm: 576.000
+DEAL:2d::Norm of difference: 3.41061e-13
+DEAL:2d::l2_norm: 8100.00
+DEAL:2d::l1_norm: 108964.
+DEAL:2d::linfty_norm: 900.000
DEAL:2d::
DEAL:3d::Testing FE_Q<3>(1)
-DEAL:3d::Norm of difference: 5.68434e-13
-DEAL:3d::l2_norm: 11325.6
-DEAL:3d::l1_norm: 207861.
-DEAL:3d::linfty_norm: 884.736
+DEAL:3d::Norm of difference: 2.27374e-13
+DEAL:3d::l2_norm: 32003.0
+DEAL:3d::l1_norm: 593090.
+DEAL:3d::linfty_norm: 1728.00
DEAL:3d::
DEAL:3d::Testing FE_Q<3>(2)
-DEAL:3d::Norm of difference: 2.18279e-11
-DEAL:3d::l2_norm: 359043.
-DEAL:3d::l1_norm: 1.80487e+07
-DEAL:3d::linfty_norm: 13824.0
+DEAL:3d::Norm of difference: 2.54659e-11
+DEAL:3d::l2_norm: 729000.
+DEAL:3d::l1_norm: 3.59385e+07
+DEAL:3d::linfty_norm: 27000.0
DEAL:3d::
DEAL:2d::Testing FE_Q<2>(1)
-DEAL:2d::Norm of difference: 4.26326e-14
-DEAL:2d::l2_norm: 504.352
-DEAL:2d::l1_norm: 3536.64
-DEAL:2d::linfty_norm: 92.1600
+DEAL:2d::Norm of difference: 8.52651e-14
+DEAL:2d::l2_norm: 1008.02
+DEAL:2d::l1_norm: 7088.00
+DEAL:2d::linfty_norm: 144.000
DEAL:2d::
DEAL:2d::Testing FE_Q<2>(2)
-DEAL:2d::Norm of difference: 4.54747e-13
-DEAL:2d::l2_norm: 5051.63
-DEAL:2d::l1_norm: 68866.9
-DEAL:2d::linfty_norm: 576.000
+DEAL:2d::Norm of difference: 7.95808e-13
+DEAL:2d::l2_norm: 8100.00
+DEAL:2d::l1_norm: 108964.
+DEAL:2d::linfty_norm: 900.000
DEAL:2d::
DEAL:3d::Testing FE_Q<3>(1)
-DEAL:3d::Norm of difference: 5.68434e-13
-DEAL:3d::l2_norm: 11325.6
-DEAL:3d::l1_norm: 207861.
-DEAL:3d::linfty_norm: 884.736
+DEAL:3d::Norm of difference: 6.82121e-13
+DEAL:3d::l2_norm: 32003.0
+DEAL:3d::l1_norm: 593090.
+DEAL:3d::linfty_norm: 1728.00
DEAL:3d::
DEAL:3d::Testing FE_Q<3>(2)
-DEAL:3d::Norm of difference: 2.18279e-11
-DEAL:3d::l2_norm: 359043.
-DEAL:3d::l1_norm: 1.80487e+07
-DEAL:3d::linfty_norm: 13824.0
+DEAL:3d::Norm of difference: 4.00178e-11
+DEAL:3d::l2_norm: 729000.
+DEAL:3d::l1_norm: 3.59385e+07
+DEAL:3d::linfty_norm: 27000.0
DEAL:3d::
}
sparse_matrix.compress(VectorOperation::add);
- sparse_matrix.vmult(ref, in);
-
for (unsigned int i = 0; i < ref.local_size(); ++i)
{
- const unsigned int glob_index = owned_set.nth_index_in_set(i);
+ const auto glob_index = owned_set.nth_index_in_set(i);
if (constraints.is_constrained(glob_index))
ref.local_element(i) = 1.;
else
- ref.local_element(i) = 1. / ref.local_element(i);
+ ref.local_element(i) = 1. / sparse_matrix(glob_index, glob_index);
}
ref.compress(VectorOperation::insert);
DEAL:2d::Testing FE_Q_Hierarchical<2>(1)
DEAL:2d::Norm of difference: 1.13687e-13
-DEAL:2d::l2_norm: 960.000
-DEAL:2d::l1_norm: 7744.00
-DEAL:2d::linfty_norm: 256.000
+DEAL:2d::l2_norm: 2160.00
+DEAL:2d::l1_norm: 17424.0
+DEAL:2d::linfty_norm: 576.000
DEAL:2d::
DEAL:2d::Testing FE_Q_Hierarchical<2>(2)
-DEAL:2d::Norm of difference: 3.22871e-11
-DEAL:2d::l2_norm: 37440.0
-DEAL:2d::l1_norm: 553536.
-DEAL:2d::linfty_norm: 3600.00
+DEAL:2d::Norm of difference: 2.27374e-13
+DEAL:2d::l2_norm: 3960.00
+DEAL:2d::l1_norm: 63504.0
+DEAL:2d::linfty_norm: 576.000
DEAL:2d::
DEAL:3d::Testing FE_Q_Hierarchical<3>(1)
-DEAL:3d::Norm of difference: 1.81899e-12
-DEAL:3d::l2_norm: 29744.5
-DEAL:3d::l1_norm: 681472.
-DEAL:3d::linfty_norm: 4096.00
+DEAL:3d::Norm of difference: 3.63798e-12
+DEAL:3d::l2_norm: 100388.
+DEAL:3d::l1_norm: 2.29997e+06
+DEAL:3d::linfty_norm: 13824.0
DEAL:3d::
DEAL:3d::Testing FE_Q_Hierarchical<3>(2)
-DEAL:3d::Norm of difference: 1.39116e-08
-DEAL:3d::l2_norm: 7.24442e+06
-DEAL:3d::l1_norm: 4.11831e+08
-DEAL:3d::linfty_norm: 216000.
+DEAL:3d::Norm of difference: 1.63709e-11
+DEAL:3d::l2_norm: 249197.
+DEAL:3d::l1_norm: 1.60030e+07
+DEAL:3d::linfty_norm: 13824.0
DEAL:3d::
DEAL:2d::Testing FE_Q_Hierarchical<2>(1)
-DEAL:2d::Norm of difference: 1.13687e-13
-DEAL:2d::l2_norm: 960.000
-DEAL:2d::l1_norm: 7744.00
-DEAL:2d::linfty_norm: 256.000
+DEAL:2d::Norm of difference: 3.41061e-13
+DEAL:2d::l2_norm: 2160.00
+DEAL:2d::l1_norm: 17424.0
+DEAL:2d::linfty_norm: 576.000
DEAL:2d::
DEAL:2d::Testing FE_Q_Hierarchical<2>(2)
-DEAL:2d::Norm of difference: 3.22871e-11
-DEAL:2d::l2_norm: 37440.0
-DEAL:2d::l1_norm: 553536.
-DEAL:2d::linfty_norm: 3600.00
+DEAL:2d::Norm of difference: 5.68434e-13
+DEAL:2d::l2_norm: 3960.00
+DEAL:2d::l1_norm: 63504.0
+DEAL:2d::linfty_norm: 576.000
DEAL:2d::
DEAL:3d::Testing FE_Q_Hierarchical<3>(1)
-DEAL:3d::Norm of difference: 1.81899e-12
-DEAL:3d::l2_norm: 29744.5
-DEAL:3d::l1_norm: 681472.
-DEAL:3d::linfty_norm: 4096.00
+DEAL:3d::Norm of difference: 5.45697e-12
+DEAL:3d::l2_norm: 100388.
+DEAL:3d::l1_norm: 2.29997e+06
+DEAL:3d::linfty_norm: 13824.0
DEAL:3d::
DEAL:3d::Testing FE_Q_Hierarchical<3>(2)
-DEAL:3d::Norm of difference: 1.39116e-08
-DEAL:3d::l2_norm: 7.24442e+06
-DEAL:3d::l1_norm: 4.11831e+08
-DEAL:3d::linfty_norm: 216000.
+DEAL:3d::Norm of difference: 3.63798e-11
+DEAL:3d::l2_norm: 249197.
+DEAL:3d::l1_norm: 1.60030e+07
+DEAL:3d::linfty_norm: 13824.0
DEAL:3d::