生成尺寸為 8x8 的正定矩陣 (Generating Positive definite matrix of dimensions 8x8)


問題描述

生成尺寸為 8x8 的正定矩陣 (Generating Positive definite matrix of dimensions 8x8)

I am trying to generate a positive definite matrix (A'*A) of dimensions 8x8. where A is 1x8.

I tried it for many randomly generated matrix A but not able to generate it.

octave‑3.6.1.exe:166> A= (rand(1,8)+rand(1,8)*1i);
octave‑3.6.1.exe:167> chol(A'*A);
error: chol: input matrix must be positive definite

Can anyone please tell me what is going wrong here. Thanks for the help in advance.


參考解法

方法 1:

It's not possible to do that, since no matrix of that form is positive definite.

Claim: Given a 1xn (real, n>1) matrix A, the symmetric matrix M = A'A is not positive definite:

Proof: By definition, M is positive definite iff x'Mx > 0 for all non zero x. That is, iff x'A'Ax = (Ax)'Ax = (Ax)^2 = (A_1 x_1 + ... + A_n x_n) > 0 for all non zero x.

Since the real values A_i are linearly dependent, there exists x_i, not all zero, such that A_1 x_1 + ... + A_n x_n = 0. We found a non zero vector x such that x'Mx = 0, so M is not positive definite.

A different proof, that can be applied directly to the complex case is this: Let A be an 1xn (complex, n>1) matrix. Positive definiteness implies invertibility, so M = A*A must have full rank to be positive definite. It clearly has rank 1, so it's not invertible and thus not positive definite.

方法 2:

Here is how I routinelly create SPD matrix

1) Create a random Symetric Matrix 2) Make sure that all the diagonal values are greater than the sum of any row or column they appear in.

Usually for (1) I use random number between 0 and 1. Its then easy to figure out a number to use for each diagonal entries.

Cheers,

(by complex22jorgecauser3047595)

參考文件

  1. Generating Positive definite matrix of dimensions 8x8 (CC BY‑SA 3.0/4.0)

#matrix #linear-algebra #decomposition #math






相關問題

BLAS 子程序 dgemm、dgemv 和 ddot 不適用於標量? (BLAS subroutines dgemm, dgemv and ddot doesn't work with scalars?)

為什麼我們需要維護自己的矩陣來轉換遊戲對象? (Why we need to maintain our own matrices to transform Game objects?)

R 高斯消除和 qr 分解 (R Gaussian Elimination and qr factorization)

生成尺寸為 8x8 的正定矩陣 (Generating Positive definite matrix of dimensions 8x8)

替代在此 Ruby 代碼中使用基於時間間隔分配標籤的巨型 if/else (Alternative to using a giant if/else in this Ruby code that assigns labels based on the time interval)

如何創建一個行矩陣,其元素是我的 while 循環的迭代 (How to create a row matrix whose elements are the iterations of my while loop)

在Matlab中找到矩陣中相同元素的開始索引和結束索引 (Find the Start Index and End Index of the same Element in a Matrix in Matlab)

用 Matlab 寫一個方程(矩陣大小) (writing an equation with Matlab (Matrix size))

使用 numpy 或 pandas 從元組列表中為二元組創建頻率矩陣 (Create a frequency matrix for bigrams from a list of tuples, using numpy or pandas)

如何在循環和 if 語句中使用遞歸公式 (How to use recursive formula in loop and if statement)

如何從 p 值矩陣中獲得緊湊的字母顯示? (How to get a compact letter display from a matrix of p-values?)

刺激基質上的液體流動 (Stimulating Liquid Flow on Matrix)







留言討論