matlab cholcov,Cholesky-like covariance decomposition

cholcov

Cholesky-like covariance decomposition

Syntax

T = cholcov(SIGMA)

[T,num] = cholcov(SIGMA)

[T,num] = cholcov(SIGMA,0)

Description

T = cholcov(SIGMA) computes T such

that SIGMA = T'*T. SIGMA must

be square, symmetric, and positive semi-definite. If SIGMA is

positive definite, then T is the square, upper

triangular Cholesky factor. If SIGMA is not positive

definite, T is computed from an eigenvalue decomposition

of SIGMA. T is not necessarily

triangular or square in this case. Any eigenvectors whose corresponding

eigenvalue is close to zero (within a small tolerance) are omitted.

If any remaining eigenvalues are negative, T is

empty.

[T,num] = cholcov(SIGMA) returns

the number num of negative eigenvalues of SIGMA,

and T is empty if num is positive.

If num is zero, SIGMA is positive

semi-definite. If SIGMA is not square and symmetric, num is NaN and T is

empty.

[T,num] = cholcov(SIGMA,0) returns num equal

to zero if SIGMA is positive definite, and T is

the Cholesky factor. If SIGMA is not positive definite, num is

a positive integer and T is empty. [...]

= cholcov(SIGMA,1) is equivalent to [...] = cholcov(SIGMA).

Examples

The following 4-by-4 covariance matrix is rank-deficient:

C1 = [2 1 1 2;1 2 1 2;1 1 2 2;2 2 2 3]

C1 =

2 1 1 2

1 2 1 2

1 1 2 2

2 2 2 3

rank(C1)

ans =

3

Use cholcov to factor C1:

T = cholcov(C1)

T =

-0.2113 0.7887 -0.5774 0

0.7887 -0.2113 -0.5774 0

1.1547 1.1547 1.1547 1.7321

C2 = T'*T

C2 =

2.0000 1.0000 1.0000 2.0000

1.0000 2.0000 1.0000 2.0000

1.0000 1.0000 2.0000 2.0000

2.0000 2.0000 2.0000 3.0000

Use T to generate random data with the specified

covariance:

C3 = cov(randn(1e6,3)*T)

C3 =

1.9973 0.9982 0.9995 1.9975

0.9982 1.9962 0.9969 1.9956

0.9995 0.9969 1.9980 1.9972

1.9975 1.9956 1.9972 2.9951

Extended Capabilities

GPU Arrays

Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.

This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU(Parallel Computing Toolbox).

See Also

Introduced in R2007a

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值