mgs.m
来自「一个基于matlab的数据降维工具箱,包括MDS,LEE等方法」· M 代码 · 共 36 行
M
36 行
function [Q, R] = mgs(A)%MGS Performs a modified Gram-Schmidt orthogonalization%% [Q, R] = mgs(A)%% Performs a modified Gram-Schmidt orthogonalization. This is a more stable% way to compute a QR-factorization.%%% This file is part of the Matlab Toolbox for Dimensionality Reduction v0.3b.% The toolbox can be obtained from http://www.cs.unimaas.nl/l.vandermaaten% You are free to use, change, or redistribute this code in any way you% want for non-commercial purposes. However, it is appreciated if you % maintain the name of the original author.%% (C) Laurens van der Maaten% Maastricht University, 2007 % Perform Gram-Schmidt orthogonalization [m, n] = size(A); V = A; R = zeros(n, n); for i=1:n R(i,i) = norm(V(:,i)); V(:,i) = V(:,i) / R(i, i); if (i < n) for j = i+1:n R(i,j) = V(:,i)' * V(:,j); V(:,j) = V(:,j) - R(i, j) * V(:,i); end end end Q = V;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?