Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 3e60ff9d4d6f58c8fbd17208f14089fa > files > 182

octave-doc-3.2.3-3mdv2010.0.i586.rpm

<html lang="en">
<head>
<title>Expressions Involving Diagonal Matrices - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Matrix-Algebra.html#Matrix-Algebra" title="Matrix Algebra">
<link rel="next" href="Expressions-Involving-Permutation-Matrices.html#Expressions-Involving-Permutation-Matrices" title="Expressions Involving Permutation Matrices">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Expressions-Involving-Diagonal-Matrices"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Expressions-Involving-Permutation-Matrices.html#Expressions-Involving-Permutation-Matrices">Expressions Involving Permutation Matrices</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Matrix-Algebra.html#Matrix-Algebra">Matrix Algebra</a>
<hr>
</div>

<h4 class="subsection">20.2.1 Expressions Involving Diagonal Matrices</h4>

<p>Assume <var>D</var> is a diagonal matrix.  If <var>M</var> is a full matrix,
then <code>D*M</code> will scale the rows of <var>M</var>.  That means,
if <code>S = D*M</code>, then for each pair of indices
i,j it holds
<pre class="example">     S(i,j) = D(i,i) * M(i,j).
</pre>
   <p>Similarly, <code>M*D</code> will do a column scaling.

   <p>The matrix <var>D</var> may also be rectangular, m-by-n where <code>m != n</code>. 
If <code>m &lt; n</code>, then the expression <code>D*M</code> is equivalent to
<pre class="example">     D(:,1:m) * M(1:m,:),
</pre>
   <p>i.e., trailing <code>n-m</code> rows of <var>M</var> are ignored.  If <code>m &gt; n</code>,
then <code>D*M</code> is equivalent to
<pre class="example">     [D(1:n,n) * M; zeros(m-n, columns (M))],
</pre>
   <p>i.e., null rows are appended to the result. 
The situation for right-multiplication <code>M*D</code> is analogous.

   <p>The expressions <code>D \ M</code> and <code>M / D</code> perform inverse scaling. 
They are equivalent to solving a diagonal (or rectangular diagonal)
in a least-squares minimum-norm sense.  In exact arithmetics, this is
equivalent to multiplying by a pseudoinverse.  The pseudoinverse of
a rectangular diagonal matrix is again a rectangular diagonal matrix
with swapped dimensions, where each nonzero diagonal element is replaced
by its reciprocal. 
The matrix division algorithms do, in fact, use division rather than
multiplication by reciprocals for better numerical accuracy; otherwise, they
honor the above definition.  Note that a diagonal matrix is never truncated due
to ill-conditioning; otherwise, it would not be much useful for scaling.  This
is typically consistent with linear algebra needs.  A full matrix that only
happens to be diagonal (an is thus not a special object) is of course treated
normally.

   <p>Multiplication and division by diagonal matrices works efficiently also when
combined with sparse matrices, i.e., <code>D*S</code>, where <var>D</var> is a diagonal
matrix and <var>S</var> is a sparse matrix scales the rows of the sparse matrix and
returns a sparse matrix.  The expressions <code>S*D</code>, <code>D\S</code>, <code>S/D</code> work
analogically.

   <p>If <var>D1</var> and <var>D2</var> are both diagonal matrices, then the expressions
<pre class="example">     D1 + D2
     D1 - D2
     D1 * D2
     D1 / D2
     D1 \ D2
</pre>
   <p>again produce diagonal matrices, provided that normal
dimension matching rules are obeyed.  The relations used are same as described above.

   <p>Also, a diagonal matrix <var>D</var> can be multiplied or divided by a scalar, or raised
to a scalar power if it is square, producing diagonal matrix result in all cases.

   <p>A diagonal matrix can also be transposed or conjugate-transposed, giving the expected
result.  Extracting a leading submatrix of a diagonal matrix, i.e., <code>D(1:m,1:n)</code>,
will produce a diagonal matrix, other indexing expressions will implicitly convert to
full matrix.

   <p>Adding a diagonal matrix to a full matrix only operates on the diagonal elements.  Thus,
<pre class="example">     A = A + eps * eye (n)
</pre>
   <p>is an efficient method of augmenting the diagonal of a matrix.  Subtraction works
analogically.

   <p>When involved in expressions with other element-by-element operators, <code>.*</code>,
<code>./</code>, <code>.\</code> or <code>.^</code>, an implicit conversion to full matrix will
take place.  This is not always strictly necessary but chosen to facilitate
better consistency with <span class="sc">matlab</span>.

   </body></html>