簡體   English   中英

帶有犰狳庫的復矩陣指數

[英]Complex matrix exponential with Armadillo library

我正在使用犰狳在 C++ 中進行一些物理模擬。 我需要計算一個看起來像這樣的產品:

Q = R * exp(neg_i*Lambda*t) * R.t() * Q

Where Q,R are cx_mat class of the same size, Lambda is a mat class of the same size as Q,R and is diagonal, neg_i is -i the complex number and t is a double. 我應該得到一個酉矩陣作為解決方案,但我得到的是非酉矩陣。 我想知道指數 function 是否適用於復雜矩陣? 或者如果不是,我應該用什么替換它?

您需要將expmat() function 用於矩陣指數, exp()計算元素指數。

例如,我目前用於物理模擬的一些代碼:

arma::cx_mat f;  // A hermitian matrix
double delta_t ;  // A time step
std::complex<double> i_imag(0.0,1.0) ;  // i, the imaginary number

std::vector<arma::cx_mat> U; // A vector of complex unitary matrices.

U.push_back(arma::expmat(-i_imag * delta_t * f));

已測試此代碼,采用反厄米矩陣的矩陣指數來獲得酉變換並且工作正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM