solve_chol.m

来自「高斯过程在回归和分类问题中的应用」· M 代码 · 共 26 行

M
26
字号
% solve_chol - solve linear equations from the Cholesky factorization.% Solve A*X = B for X, where A is square, symmetric, positive definite. The% input to the function is R the Cholesky decomposition of A and the matrix B.% Example: X = solve_chol(chol(A),B);%% NOTE: The program code is written in the C language for efficiency and is% contained in the file solve_chol.c, and should be compiled using matlabs mex% facility. However, this file also contains a (less efficient) matlab% implementation, supplied only as a help to people unfamiliar with mex. If% the C code has been properly compiled and is avaiable, it automatically% takes precendence over the matlab code in this file.%% Copyright (c) 2004, 2005, 2006 by Carl Edward Rasmussen. 2006-02-08.function x = solve_chol(A, B);if nargin ~= 2 | nargout > 1  error('Wrong number of arguments.');endif size(A,1) ~= size(A,2) | size(A,1) ~= size(B,1)  error('Wrong sizes of matrix arguments.');endx = A\(A'\B);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?