2017-03-27 25 views
0

我有一個可逆的埃爾米特矩陣M\in \mathbb{C}^{K\times K}2^K平方子矩陣M快速路,${M_S}_{S\subseteq {1,\dots,K}}$定義:計算所有未成年人的決定(和未成年人的未成年人)

\begin{equation}M_S = (\text{submatrix consisting only of rows and columns $S$ from $M$}) \in \mathbb{C}^{|S|\times |S|}\end{equation}

我需要知道行列式每$M_S$

有沒有在MATLAB中計算這個快速方法?


這裏是糟糕的方式做到這一點:

  • 遍歷[1:2^K]
  • 轉換回路指數二元矢量vSubset
  • 計算det(mtxM(vSubset,vSubset))

該走慢了,看起來很浪費,因爲你可以建立一個決定因素父母矩陣來自未成年人的決定因素。

+0

K是order〜3-7,但整個事情必須潛在地運行數十萬次。 – enthdegree

+0

對於一般矩陣,這需要遞歸運行拉普拉斯公式。所以需要O(K!) – enthdegree

+0

你的矩陣是正定的嗎? – dmuir

回答

1

一種方法是使用Cholesky因式分解。我使用下面的上三角形,以便

M = U'*U 

其中'是伴隨的而U是上三角形。 注意det(M)= square(| det(U)|)並且U的行列式是它的對角元素的乘積。

我們可以通過附加這樣的行和列計算從M個得到的矩陣的因子:

M~ = (M n) 
    (n' p) 
U~ = (U x) 
    (0 y) 

其中

U'*x = n 
y = sqrt(p - x'*x) 

等DET(M - )= DET(M )*(p - x'* x)

我不確定使用此的最佳方法。有一個非常簡潔的遞歸方式:僞C代碼

void det_step(double* U, double det, int high_ix) 
{ 
int ix; 
    for(ix=high_ix+1; ix<dim; ++ix) 
    { // notionally add row, col ix 
    // augment U, update det (and store in the output) 
    det_step(U, det, ix); 
    } 
} 
void dets(double* M, int dim) 
{ 
int ix; 
    for(ix=0; ix<dim; ++ix) 
    { // compute U and det for matrix consisting of just row/col ix 
    // store det in the output 
    det_step(U, det, ix); 
    } 
} 
+0

謝謝,這與循環所有按大小排列的子矩陣(Gosper's hack)一起完成。 – enthdegree