克-施密特正交化 [英] Gram-Schmidt orthogonalization

查看:99
本文介绍了克-施密特正交化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑到具有独立列的矩阵A(不一定是正方形),我能够使用Matlab函数qr <来应用Gram-Schmidt迭代并为其列空间(以正交矩阵Q的形式)生成正交基础. /p>

Given a matrix A (not neccessarily square) with independent columns, I was able to apply Gram-Schmidt iteration and produce an orthonormal basis for its columnspace (in the form of an orthogonal matrix Q) using Matlab's function qr

A=[1,1;1,0;1,2]

[Q,R] = qr(A)

然后

>> Q(:,1:size(A,2))
ans =
  -0.577350269189626  -0.000000000000000
  -0.577350269189626  -0.707106781186547
  -0.577350269189626   0.707106781186547

您可以验证列是否为正交

You can verify that the columns are orthonormal

Q(:,1)'*Q(:,2) equals zero and

norm(Q(:,1)) equals norm(Q(:,2)) equals 1

给定一个具有独立列的矩阵(如A),R中是否有一个函数产生(Gram-Schmidt)正交矩阵Q?. R的qr函数不会产生正交Q.

Given a matrix that has independent columns (like A), is there a function in R that produces the (Gram-Schmidt) orthogonal matrix Q ?. R's qr function doesn't produce an orthogonal Q.

推荐答案

qr可以工作,但是它使用唯一的约定并生成qr对象,您可以进一步使用qr.Qqr.R进行操作:

qr works, but it uses a unique convention and produces a qr object that you further operate on with qr.Q and qr.R:

> A
     [,1] [,2]
[1,]    1    1
[2,]    1    0
[3,]    1    2
> A.qr <- qr(A)
> qr.Q(A.qr)
           [,1]          [,2]
[1,] -0.5773503 -5.551115e-17
[2,] -0.5773503 -7.071068e-01
[3,] -0.5773503  7.071068e-01
> qr.R(A.qr)
          [,1]      [,2]
[1,] -1.732051 -1.732051
[2,]  0.000000  1.414214

这是您想要的输出吗?

这篇关于克-施密特正交化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆