<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237007</link>
    <title>MATLAB Central Newsreader - RQ decomposition</title>
    <description>Feed for thread: RQ decomposition</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sat, 04 Oct 2008 15:40:36 -0400</pubDate>
      <title>RQ decomposition</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237007#603696</link>
      <author>David Doria</author>
      <description>Is there an easy way to get an RQ decomposition from the included qr() function? This seems like a useful thing to include for the next release! Its very helpful in camera calibration, because to get the intrinsic parameters from a camera projection matrix, you can simply use the RQ factorization of the projection matrix.&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
Dave</description>
    </item>
    <item>
      <pubDate>Sat, 04 Oct 2008 19:16:01 -0400</pubDate>
      <title>Re: RQ decomposition</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237007#603707</link>
      <author>John D'Errico</author>
      <description>&quot;David Doria&quot; &amp;lt;daviddoria@gmail.com&amp;gt; wrote in message &amp;lt;gc82pk$e87$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Is there an easy way to get an RQ decomposition from the included qr() function? This seems like a useful thing to include for the next release! Its very helpful in camera calibration, because to get the intrinsic parameters from a camera projection matrix, you can simply use the RQ factorization of the projection matrix.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Have you looked on the internet?&lt;br&gt;
&lt;br&gt;
Google easily found matlab code for an&lt;br&gt;
RQ decomposition.&lt;br&gt;
&lt;br&gt;
So then I looked on the file exchange.&lt;br&gt;
An RQ decomposition is on the FEX. It&lt;br&gt;
is mex code, but still useful.&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Sat, 04 Oct 2008 19:57:02 -0400</pubDate>
      <title>Re: RQ decomposition</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237007#603714</link>
      <author>Bruno Luong</author>
      <description>&quot;David Doria&quot; &amp;lt;daviddoria@gmail.com&amp;gt; wrote in message &amp;lt;gc82pk$e87$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Is there an easy way to get an RQ decomposition from the included qr() function?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
function [R Q]=rq(A)&lt;br&gt;
% function [R Q]=rq(A)&lt;br&gt;
% A [m x n] with m&amp;lt;=n&lt;br&gt;
% return R [m x n] triangular and&lt;br&gt;
% Q [n x n] unitary (i.e., Q'*Q=I)&lt;br&gt;
% such that A=R*Q&lt;br&gt;
% Author: Bruno Luong&lt;br&gt;
% Last Update: 04/Oct/2008&lt;br&gt;
&lt;br&gt;
[m n]=size(A);&lt;br&gt;
if m&amp;gt;n&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;error('RQ: Number of rows must be smaller than column');&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
[Q R]=qr(flipud(A).');&lt;br&gt;
R=flipud(R.');&lt;br&gt;
R(:,1:m)=R(:,m:-1:1);&lt;br&gt;
Q=Q.';&lt;br&gt;
Q(1:m,:)=Q(m:-1:1,:);&lt;br&gt;
&lt;br&gt;
end&lt;br&gt;
% Bruno</description>
    </item>
    <item>
      <pubDate>Sat, 04 Oct 2008 23:38:01 -0400</pubDate>
      <title>Re: RQ decomposition</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237007#603734</link>
      <author>David Doria</author>
      <description>Bruno,&lt;br&gt;
&lt;br&gt;
Could you explain in a couple of sentences what that is doing in a little bit &quot;mathy&quot; terms? ie. I've never seen a &quot;flip upside down&quot; step in a linear algebra kind of definition- can you explain why that is done?&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
Dave</description>
    </item>
    <item>
      <pubDate>Sun, 05 Oct 2008 02:23:02 -0400</pubDate>
      <title>Re: RQ decomposition</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237007#603752</link>
      <author>Bruno Luong</author>
      <description>&quot;David Doria&quot; &amp;lt;daviddoria@gmail.com&amp;gt; wrote in message &amp;lt;gc8uop$2nh$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Bruno,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Could you explain in a couple of sentences what that is doing in a little bit &quot;mathy&quot; terms? ie. I've never seen a &quot;flip upside down&quot; step in a linear algebra kind of definition- can you explain why that is done?&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
Hi,&lt;br&gt;
&lt;br&gt;
Flipping upside down is multiplying a permutation matrix on the left side. Flipping rows (also in the above but only m rows, not n), is multiplying a permutation matrix on the right side.&lt;br&gt;
&lt;br&gt;
I use permutation matrices for the purpose to transform a lower triangular matrix to upper one.&lt;br&gt;
&lt;br&gt;
Bruno</description>
    </item>
    <item>
      <pubDate>Sun, 05 Oct 2008 13:32:01 -0400</pubDate>
      <title>Re: RQ decomposition</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237007#603774</link>
      <author>Bruno Luong</author>
      <description>I have extended my rq with more options:&lt;br&gt;
&lt;br&gt;
function [R Q]=rq(A, varargin)&lt;br&gt;
% function [R Q]=rq(A)&lt;br&gt;
%&lt;br&gt;
% Perform RQ factorization&lt;br&gt;
%   A [m x n]&lt;br&gt;
%   returns R [m x n] triangular superior and&lt;br&gt;
%           Q [n x n] unitary (i.e., Q'*Q=I)&lt;br&gt;
%   such that A = R*Q&lt;br&gt;
%&lt;br&gt;
% Note: Standard RQ requires m&amp;lt;=n.&lt;br&gt;
%&lt;br&gt;
% For n ~=m, default output R has non-zero elements populate&lt;br&gt;
%   at the m-first rows&lt;br&gt;
% Use [R Q] = rq(A, 'last') to populate non-sero R-rows at other end.&lt;br&gt;
%&lt;br&gt;
% For &quot;non standard&quot; RQ, i.e. for A with m &amp;gt; n, zero are padded in the&lt;br&gt;
%    outputs R and Q. However Q is no longer unitary. More precisely&lt;br&gt;
%    Q'*Q = eye(n) but Q*Q' is&lt;br&gt;
%      diag([zeros(1,m-n) ones(1,n)]) without 'last' option, and&lt;br&gt;
%      diag([ones(1,n) zeros(1,m-n)]) with 'last' and R becomes triangular.&lt;br&gt;
%&lt;br&gt;
% Author: Bruno Luong&lt;br&gt;
% last Update: 05/Oct/2008&lt;br&gt;
&lt;br&gt;
[m n]=size(A);&lt;br&gt;
&lt;br&gt;
[Q R]=qr(flipud(A).');&lt;br&gt;
R=flipud(R.'); % m x n&lt;br&gt;
Q=Q.'; % n x n&lt;br&gt;
if m&amp;gt;n&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;warning('RQ:DimensionBizarre',...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'RQ: number of rows is larger the number of columns'); &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;% Padding zeros&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;R(end,m)=0; % m x m&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Q(m,end)=0; % m x n&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
R(:,1:m)=R(:,m:-1:1);&lt;br&gt;
Q(1:m,:)=Q(m:-1:1,:);&lt;br&gt;
&lt;br&gt;
last=strcmpi(getoption('',varargin{:}),'last');&lt;br&gt;
% Populate R at last rows&lt;br&gt;
if xor(m&amp;gt;n,last)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;R=circshift(R,[0 n-m]);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Q=circshift(Q,[n-m 0]);&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
% Get option if provided&lt;br&gt;
function res=getoption(default, option)&lt;br&gt;
&amp;nbsp;&amp;nbsp;if nargin&amp;lt;2 || isempty(option)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;res=default;&lt;br&gt;
&amp;nbsp;&amp;nbsp;else&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;res=option;&lt;br&gt;
&amp;nbsp;&amp;nbsp;end&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
% Bruno</description>
    </item>
    <item>
      <pubDate>Sun, 05 Oct 2008 13:36:02 -0400</pubDate>
      <title>Re: RQ decomposition</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237007#603775</link>
      <author>David Doria</author>
      <description>Hmm I guess what I am wondering is the following question:&lt;br&gt;
&lt;br&gt;
Q and R in the QR decomposition of A are the same Q and R in the RQ decomposition of which matrix?&lt;br&gt;
&lt;br&gt;
For square 3x3 matices, I got it down to this:&lt;br&gt;
&lt;br&gt;
ReverseRows = [0 0 1; 0 1 0 ; 1 0 0]; %right multiply by ReverseRows reverses columns&lt;br&gt;
[Q R] = qr((ReverseRows * A)');&lt;br&gt;
R = ReverseRows * R' * ReverseRows;&lt;br&gt;
Q = ReverseRows * Q';&lt;br&gt;
&lt;br&gt;
but I don't know how to put the last two lines INSIDE the rq operator? I guess I'm completely missing the intuition?&lt;br&gt;
&lt;br&gt;
Dave</description>
    </item>
    <item>
      <pubDate>Sun, 05 Oct 2008 13:59:02 -0400</pubDate>
      <title>Re: RQ decomposition</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237007#603777</link>
      <author>Bruno Luong</author>
      <description>This &quot;translation&quot; might help you:&lt;br&gt;
&lt;br&gt;
QR is Gram-Schmidt orthoganilization of columns of A, started from the first.&lt;br&gt;
&lt;br&gt;
RQ is Gram-Schmidt orthoganilization of rows of A, started from the last.&lt;br&gt;
&lt;br&gt;
Bruno</description>
    </item>
    <item>
      <pubDate>Sun, 05 Oct 2008 14:52:02 -0400</pubDate>
      <title>Re: RQ decomposition</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237007#603781</link>
      <author>David Doria</author>
      <description>ah excellent! exactly what i was looking for.&lt;br&gt;
&lt;br&gt;
Dave</description>
    </item>
  </channel>
</rss>

