与给定向量形成正交基的矩阵
一道线性代数题;
给定一个 k 变量标准化向量 u (即 u : ||u||_2=1) 如何构造 \Gamma_u,任意 k*(k-1) 单位向量矩阵,使得 (u,\Gamma_u) 形成 正交基 ?
我的意思是:从计算的角度来看: 你用什么算法来构造这样的矩阵?
提前致谢,
A linear algebra question;
Given a k-variate normed vector u (i.e. u : ||u||_2=1)
how do you construct \Gamma_u, any arbitrary k*(k-1)
matrix of unit vectors such that (u,\Gamma_u) forms an
orthogonal basis ?
I mean: from a computationnal stand point of view:
what algorithm do you use to construct such matrices ?
Thanks in advance,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的方法是应用 u_0 和 k-1 随机生成向量的 Gram Schmidt 正交化。如果在某个时刻 GS 算法生成零向量,则存在线性相关性,在这种情况下再次随机选择向量。
然而,这种方法不稳定,矢量表示中的微小数值误差会被放大。然而,该算法存在一个稳定的修改:
让
a_1 = u, a_2,...a_k
为随机选择的向量,所得向量
v1,...vk
将是矩阵的列,其中v1 = u
。如果在某个时刻vj
变为零,请选择一个新的向量aj
并重新开始。请注意,如果随机选择向量 a2,...,ak,发生这种情况的概率可以忽略不计。The naive approach would be to apply Gram Schmidt orthogonalisation of u_0, and k-1 randomly generated vectors. If at some point the GS algorithm generates a zero vector, then you have a linear dependency in which case choose the vector randomly again.
However this method is unstable, small numerical errors in the representation of the vectors gets magnified. However there exists a stable modification of this algorithm:
Let
a_1 = u, a_2,...a_k
be randomly chosen vectorsThe resulting vectors
v1,...vk
will be the columns of your matrix, withv1 = u
. If at some pointvj
becomes zero choose a new vectoraj
and start again. Note that the probability of this happening is negligible if the vectors a2,..,ak are chosen randomly.您可以使用 Householder 矩阵来执行此操作。参见
示例 http://en.wikipedia.org/wiki/Householder_reflection
和 http://en.wikipedia.org/wiki/QR_decomposition
人们可以找到一个 Householder 矩阵
Q
使得Q*u = e_1
(其中
e_k
是除了第 k 个位置上的 1 之外全为 0 的向量)那么如果
f_k = Q*e_k
,则f_k
形成正交基并且f_1 = u
。(因为
Q*Q = I
,并且 Q 是正交的。)所有这些关于矩阵的讨论可能会让例程看起来像是
会很昂贵,但事实并非如此。例如这个 C 函数,
给定长度为 1 的向量,返回具有所需基数的数组
按列顺序,即第 i 个向量的第 j 个分量保存在 b[j+dim*i] 中
You can use Householder matrices to do this. See for
example http://en.wikipedia.org/wiki/Householder_reflection
and http://en.wikipedia.org/wiki/QR_decomposition
One can find a Householder matrix
Q
so thatQ*u = e_1
(where
e_k
is the vector that's all 0s apart from a 1 in the k-th place)Then if
f_k = Q*e_k
, thef_k
form an orthogonal basis andf_1 = u
.(Since
Q*Q = I
, and Q is orthogonal.)All this talk of matrices might make it seem that the routine
would be expensive, but this is not so. For example this C function,
given a vector of length 1 returns an array with the required basis
in column order, ie the j'th component of the i'th vector is held in b[j+dim*i]