﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-angchen</title><link>http://www.cppblog.com/angchen/</link><description>angchen</description><language>zh-cn</language><lastBuildDate>Thu, 16 Apr 2026 05:43:35 GMT</lastBuildDate><pubDate>Thu, 16 Apr 2026 05:43:35 GMT</pubDate><ttl>60</ttl><item><title>解线性方程组的头文件</title><link>http://www.cppblog.com/angchen/archive/2009/04/14/79872.html</link><dc:creator>陈安</dc:creator><author>陈安</author><pubDate>Tue, 14 Apr 2009 04:24:00 GMT</pubDate><guid>http://www.cppblog.com/angchen/archive/2009/04/14/79872.html</guid><wfw:comment>http://www.cppblog.com/angchen/comments/79872.html</wfw:comment><comments>http://www.cppblog.com/angchen/archive/2009/04/14/79872.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/angchen/comments/commentRss/79872.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/angchen/services/trackbacks/79872.html</trackback:ping><description><![CDATA[<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">&nbsp;1</span><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">#ifndef&nbsp;LINEARFUN_H<br></span><span style="COLOR: #008080">&nbsp;2</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000">&nbsp;LINEARFUN_H</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">&nbsp;3</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br></span><span style="COLOR: #008080">&nbsp;4</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>#include</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">&nbsp;5</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>#include</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">cstdlib</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">&nbsp;6</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>#include</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Matrix.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">&nbsp;7</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000">&nbsp;std;<br></span><span style="COLOR: #008080">&nbsp;8</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br></span><span style="COLOR: #008080">&nbsp;9</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;LinearFun<br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img id=Codehighlighter1_135_990_Open_Image onclick="this.style.display='none'; Codehighlighter1_135_990_Open_Text.style.display='none'; Codehighlighter1_135_990_Closed_Image.style.display='inline'; Codehighlighter1_135_990_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_135_990_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_135_990_Closed_Text.style.display='none'; Codehighlighter1_135_990_Open_Image.style.display='inline'; Codehighlighter1_135_990_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_135_990_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_135_990_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">:<br></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;LinearFun();<br></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;LinearFun(Matrix&nbsp;ma,&nbsp;Matrix&nbsp;vb);<br></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;LinearFun(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;LinearFun</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;lf);<br></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">~</span><span style="COLOR: #000000">LinearFun();<br></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;LinearFun</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;LinearFun</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;lf);<br></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;Lx_b(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;L,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;b,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;flag);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">if&nbsp;flag==1&nbsp;for&nbsp;the&nbsp;LU&nbsp;Method,else&nbsp;for&nbsp;others.&nbsp;</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">20</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;Ux_b(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;U,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;b);<br></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">need&nbsp;to&nbsp;remember&nbsp;that&nbsp;J-I&nbsp;and&nbsp;G-S&nbsp;'s&nbsp;x0&nbsp;will&nbsp;change&nbsp;as&nbsp;routine&nbsp;over.So&nbsp;they&nbsp;can&nbsp;not&nbsp;use&nbsp;&nbsp;simultaneously.</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">22</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;JacobiIteration(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;A1,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;b,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;x0,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;tol);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;GaussSeidelIteration(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;A1,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;b,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;x0,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;tol);<br></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;SOR(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;A1,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;b,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;x0,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;weight,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;tol);<br></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;CG(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;A1,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;b,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;x0,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;tol);<br></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;QROrth(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;A1,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;b);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">using&nbsp;the&nbsp;QR&nbsp;orthogonalization&nbsp;to&nbsp;solve&nbsp;the&nbsp;LS&nbsp;problem.</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">27</span><span style="COLOR: #008000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000">:<br></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;A;<br></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;B;<br></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#endif</span></div>
<img src ="http://www.cppblog.com/angchen/aggbug/79872.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/angchen/" target="_blank">陈安</a> 2009-04-14 12:24 <a href="http://www.cppblog.com/angchen/archive/2009/04/14/79872.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Matrix 头文件</title><link>http://www.cppblog.com/angchen/archive/2009/04/14/79871.html</link><dc:creator>陈安</dc:creator><author>陈安</author><pubDate>Tue, 14 Apr 2009 04:19:00 GMT</pubDate><guid>http://www.cppblog.com/angchen/archive/2009/04/14/79871.html</guid><wfw:comment>http://www.cppblog.com/angchen/comments/79871.html</wfw:comment><comments>http://www.cppblog.com/angchen/archive/2009/04/14/79871.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/angchen/comments/commentRss/79871.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/angchen/services/trackbacks/79871.html</trackback:ping><description><![CDATA[<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">#ifndef&nbsp;MATRIX_H<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000">&nbsp;MATRIX_H</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>#include</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>#include</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">cstdlib</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000">&nbsp;std;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;Matrix;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>ostream</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">(ostream</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;output,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;m);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>istream</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">(istream</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;input&nbsp;,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;m);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">bool</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M2);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M2);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M2);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>Matrix&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M2);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>Matrix&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;k,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">~</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">the&nbsp;transpose&nbsp;of&nbsp;the&nbsp;matrix</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">Matrix&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;k);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;Matrix<br><img id=Codehighlighter1_639_3794_Open_Image onclick="this.style.display='none'; Codehighlighter1_639_3794_Open_Text.style.display='none'; Codehighlighter1_639_3794_Closed_Image.style.display='inline'; Codehighlighter1_639_3794_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_639_3794_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_639_3794_Closed_Text.style.display='none'; Codehighlighter1_639_3794_Open_Image.style.display='inline'; Codehighlighter1_639_3794_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_639_3794_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_639_3794_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">:<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;n);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;row,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;col);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;row,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;col,&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">a);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;other);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">~</span><span style="COLOR: #000000">Matrix();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;GetRow()&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;GetCol()&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;GetData(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;j)&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;other);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;friend&nbsp;ostream</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">(ostream</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;output,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;m);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;friend&nbsp;istream</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">(istream</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;input&nbsp;,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;m);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;friend&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">bool</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M2);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;friend&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M2);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;friend&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M2);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;friend&nbsp;Matrix&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M2);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;friend&nbsp;Matrix&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;k,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M2);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;friend&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">~</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);</span><span style="COLOR: #008000">//<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;friend&nbsp;Matrix&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;k);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">overload&nbsp;the&nbsp;/&nbsp;for&nbsp;matrix's&nbsp;divide.<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">i.e.each&nbsp;component&nbsp;of&nbsp;matrix&nbsp;divide&nbsp;by&nbsp;k.</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">operator</span><span style="COLOR: #000000">&nbsp;()(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;j);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">we&nbsp;set&nbsp;()quote&nbsp;in&nbsp;ordor&nbsp;to&nbsp;use&nbsp;()&nbsp;as&nbsp;a&nbsp;left-hand&nbsp;value.<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">return&nbsp;a&nbsp;vector&nbsp;which&nbsp;from&nbsp;M1(rcBegin:rcEnd,&nbsp;rc2)&nbsp;or&nbsp;M1(rc1,&nbsp;rcBegin:rcEnd)</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;GetColVectorOfMatrix(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;c,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;rBegin,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;v);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">int&nbsp;rBegin,&nbsp;int&nbsp;rEnd,&nbsp;</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;Get2DataOfCol(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;c,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;r1,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;r2,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;v);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">get&nbsp;two&nbsp;entries&nbsp;of&nbsp;a&nbsp;certain&nbsp;column&nbsp;i.e.&nbsp;(r1,c),(r2,c).</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;GetSubMatrix(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;r1,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;r2,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;c1,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;c2,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;m);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;SetSubMatrix(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;r1,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;r2,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;c1,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;c2,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;m);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;SwapRow(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;j,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">exchange&nbsp;the&nbsp;two&nbsp;rows&nbsp;which&nbsp;are&nbsp;select.</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;SwapCol(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;j,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">exchange&nbsp;the&nbsp;two&nbsp;columns&nbsp;which&nbsp;are&nbsp;select.</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;MaxRowCol(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;RCn[</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">],&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;flag);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">RCn&nbsp;for&nbsp;the&nbsp;Row&nbsp;and&nbsp;column&nbsp;number.<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">flag=1&nbsp;representive&nbsp;for&nbsp;do&nbsp;not&nbsp;consider&nbsp;the&nbsp;diagonal&nbsp;entries.</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;Norm1(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">solve&nbsp;the&nbsp;norm1.</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;NormInfinite(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">solve&nbsp;the&nbsp;infinite-norm&nbsp;</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;Norm2Frobenius(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">solve&nbsp;the&nbsp;Frobenius-norm&nbsp;for&nbsp;matrix&nbsp;and&nbsp;2-norm&nbsp;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">for&nbsp;vector.</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;ConditionNum1(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">solve&nbsp;the&nbsp;condition&nbsp;of&nbsp;matrix&nbsp;with&nbsp;norm1.</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;ConditionNumInf(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">solve&nbsp;the&nbsp;condition&nbsp;of&nbsp;matrix&nbsp;with&nbsp;infinite-norm.</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;DotVector(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M2);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;inverse(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">by&nbsp;the&nbsp;Gauss-Jordon&nbsp;Emlimination&nbsp;Method&nbsp;with&nbsp;the&nbsp;all-big-povit.</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;LU(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">by&nbsp;the&nbsp;Gauss&nbsp;Emlimination&nbsp;Method.</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;HouseholderTranf(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;x);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">return&nbsp;v&nbsp;,and&nbsp;the&nbsp;householder&nbsp;matrix&nbsp;equal&nbsp;to&nbsp;I-2*w*w'&nbsp;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">which&nbsp;w=v/norm2(v).</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;GivensTranf(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;v);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">return&nbsp;a&nbsp;vector&nbsp;which&nbsp;c=vr(0,0)&nbsp;and&nbsp;s=vr(1,0).</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;QRHouseholder(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Matrix</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;QRHouseholderReturnQR(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;Matrix&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">qr);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">return&nbsp;Q&nbsp;and&nbsp;R.</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;PowerMethod(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;x0,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;tol);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">power&nbsp;method&nbsp;return&nbsp;a&nbsp;biggest&nbsp;eigenvalue</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;InversePower(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;x0,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;tol);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">InversePower&nbsp;method&nbsp;return&nbsp;a&nbsp;smallest&nbsp;eigenvalue</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;Matrix&nbsp;JacobiSolInv(Matrix</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">&nbsp;M1,&nbsp;</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;tol);</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">return&nbsp;all&nbsp;of&nbsp;the&nbsp;eigenvalue&nbsp;of&nbsp;matrix.<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">the&nbsp;matrix&nbsp;need&nbsp;to&nbsp;be&nbsp;square&nbsp;and&nbsp;symmetry.</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000">:<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;row;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;col;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">M;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#endif</span></div>
<img src ="http://www.cppblog.com/angchen/aggbug/79871.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/angchen/" target="_blank">陈安</a> 2009-04-14 12:19 <a href="http://www.cppblog.com/angchen/archive/2009/04/14/79871.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>