Hello everyone,

Is there a reliable way to get the natural logarithm of a symmetric 
positive definite tensor in deal.ii? I'm trying 
`LAPACKFullMatrix.compute_eigenvalues_symmetric`, taking the `std::log` of 
the eigenvalues and then multiplying by the eigenvectors appropriately:

const SymmetricTensor<2, dim, Number> symmetric_positive_definite_t;
LAPACKFullMatrix<Number> lapack_full_matrix(dim, dim);
for(unsigned int i=0; i<dim; ++i)
  for(unsigned int j=0; j<dim; ++j)
    lapack_full_matrix.set(i, j, symmetric_positive_definite_t[i][j]);
Vector<Number> eigenvalues(dim);
FullMatrix<Number> eigenvectors(dim, dim);
lapack_full_matrix.compute_eigenvalues_symmetric(
  -symmetric_positive_definite_t.norm(), symmetric_positive_definite_t.norm
(), 0, eigenvalues, eigenvectors);
FullMatrix<Number> diag_log_eigenvalues(dim, dim);
for(unsigned int i=0; i<dim; ++i) {
  diag_log_eigenvalues(i, i) = std::log(eigenvalues(i));
}
FullMatrix<Number> Q_log_lambda(dim, dim);
eigenvectors.mmult(Q_log_lambda, diag_log_eigenvalues);
FullMatrix<Number> Q_log_lambda_Qt(dim, dim);
Q_log_lambda.mTmult(Q_log_lambda_Qt, eigenvectors);
SymmetricTensor<2, dim, Number> log_symmetric_positive_definite_t;
for(unsigned int i=0; i<dim; ++i)
  for(unsigned int j=0; j<dim; ++j) {
    log_symmetric_positive_definite_t[i][j] = Q_log_lambda_Qt(i, j);
  }

But this is not reliable, as I've run into situations where the returned 
eigenvalues are fewer than `dim` (I'm not sure how 
`compute_eigenvalues_symmetric` treats repeated eigenvalues). I've looked 
at using `compute_svd`, but it seems to me that I could only access the 
`singular_value`s that way, but not the `svd_u` and `svd_vt` matrices.

Thanks,

Maien

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/35cfe23b-54ab-417c-bc8c-8291d1c3946e%40googlegroups.com.

Reply via email to