📄 matrix.html
字号:
<HTML><!-- -- Copyright (c) 1998,1999 -- University of Notre Dame -- -- Permission to use, copy, modify, distribute and sell this software -- and its documentation for any purpose is hereby granted without fee, -- provided that the above copyright notice appears in all copies and -- that both that copyright notice and this permission notice appear -- in supporting documentation. The University of Notre Dame makes no -- representations about the suitability of this software for any -- purpose. It is provided "as is" without express or implied warranty. -- --><HEAD><TITLE>Description of matrix</TITLE></HEAD><BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" ALINK="#ff0000"> <FONT FACE=Helvetica><!--end header--><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 WIDTH=100%><TR><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=100%><TR><TD Align=left valign=middle width=440 rowspan=2><FONT FACE=verdana,arial,helvetica SIZE=+3 COLOR=#110088><B>matrix< T, Shape = <A HREF="rectangle.html" >rectangle</A><>, Storage = <A HREF="dense.html" >dense</A><>, Orientation = <A HREF="row_major.html" >row_major</A> ></B></FONT></TD><TD valign=middle Align=right width=128 rowspan=2><A HREF="http://lsc.nd.edu/research/mtl"><IMG BORDER=0 SRC="./glossy-mtl-logo.jpg" height=48 ALT="[MTL Home]"></A></TD><TD Align=center width=280 nowrap><Font face=verdana,arial,helvetica size=+3><b>Programmers Guide</b></font></TD></TR><TR BGCOLOR='#2020b0'><TD HEIGHT=20 VALIGN='MIDDLE' NOWRAP align=center STYLE="font-family:verdana,arial,helvetica;font-weight:bold;"> <A STYLE="text-decoration:none;color:white;font-family:verdana,arial,helvetica;font-weight:bold;" HREF="./table_of_contents.html">Contents</A> | <A STYLE="text-decoration:none;color:white;font-family:verdana,arial,helvetica;font-weight:bold;" HREF="./mtl_index.html">Index</A> | <A STYLE="text-decoration:none;color:white;font-family:verdana,arial,helvetica;font-weight:bold;" HREF="http://lsc.nd.edu/research/mtl/search.html">Search</A> </TD></TR></TABLE></TD></TR><TR><TD><Table Border=0 CellPadding=0 CellSpacing=0 width=100% cols=2><TR><TD Align=left><BR><TABLE BORDER=0 CellSpacing=0 CellPadding=0><TR><TD><Img src = "containers.gif" Alt="" WIDTH = "194" HEIGHT = "38" ></TD></TR><TR><TD><Img src = "generators.gif" Alt="" WIDTH = "194" HEIGHT = "38" ></TD></TR></TABLE></TD><TD Align=right><BR><TABLE BORDER=0 CellSpacing=0 CellPadding=0><TR><TD><Img src = "type.gif" Alt="" WIDTH = "194" HEIGHT = "38" ></TD></TR></TABLE></TD></TR><TR><TD Align=left VAlign=top><b>Category</b>:containers,generators</TD><TD Align=right VAlign=top><b>Component type</b>:type</TD></TR></Table></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="10" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Description</B></FONT></TD></TR><TR><TD> Matrices that occur in real engineering and scientific applications often have special structure, especially in terms of how many zeros are in the <A HREF="matrix.html" >matrix</A>, and where the non-zeros are located in the <A HREF="matrix.html" >matrix</A>. This means that space and time saving can be acheived by using various types of <A HREF="compressed.html" >compressed</A> storage. There are a multitude of <A HREF="matrix.html" >matrix</A> storage formats in use today, and the MTL tries to support many of the more common storage formats. The following discussion will describe how the user of MTL can select the type of <A HREF="matrix.html" >matrix</A> he or she wishes to use. To create a MTL <A HREF="matrix.html" >matrix</A>, one first needs to construct the appropriate <A HREF="matrix.html" >matrix</A> type. This is done using the <tt><A HREF="matrix.html" >matrix</A></tt> type generation class, which is easier to think of as a function. It takes as input the characteristics of the <A HREF="matrix.html" >matrix</A> type that you want and then returns the appropriate MTL <A HREF="matrix.html" >matrix</A>. The <tt><A HREF="matrix.html" >matrix</A></tt> type generators ``function'' has defaults defined, so in order to create a normal rectangular <A HREF="matrix.html" >matrix</A> type, one merely does the following: <pre> typedef <A HREF="matrix.html" >matrix</A>< double >::type MyMatrix; MyMatrix A(M, N); </pre> The <A HREF="matrix.html" >matrix</A> type generators can take up to four arguments, the element type, the <A HREF="matrix.html" >matrix</A> shape, the storage format, and the orientation. The following is the ``prototype'' for the <tt><A HREF="matrix.html" >matrix</A></tt> type generators. <pre> <A HREF="matrix.html" >matrix</A>< EltType, Shape, Storage, Orientation >::type </pre> This type of "generative" interface technique was developed by by <a href="http://nero.prakinf.tu-ilmenau.de:80/~czarn/">Krzysztof Czarnecki</a> and <a href="http://home.t-online.de/home/Ulrich.Eisenecker/">Ulrich Eisenecker</a> in their work on the <a href="http://nero.prakinf.tu-ilmenau.de:80/~czarn/gmcl/">Generative <A HREF="Matrix.html" >Matrix</A> Computation Library</a>. <p> *Storage can be made external by specifying such in the storage parameter. eg. <A HREF="dense.html" >dense</A><external>, <A HREF="packed.html" >packed</A><external>. </TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Example</B></FONT></TD></TR><TR><TD></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Definition</B></FONT></TD></TR><TR><TD><A HREF="../../mtl/matrix.h">matrix.h</A></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Template Parameters</B></FONT></TD></TR><TR><TD><BR><TABLE BORDER><TR><TH>Parameter</TH><TH>Description</TH><TH>Default</TH></TR><TR><TD><TT>EltType</TT></TD><TD>Valid choices for this argument include <tt>double</tt>, <tt>complex<float></tt>, and <tt>bool</tt>. In essence, any builtin or user defined type can be used for the <tt>EltType</tt>, however, if one uses the <A HREF="matrix.html" >matrix</A> with a particular algorithm, the <tt>EltType</tt> must support the operations required by the algorithm. For MTL algorithms these typically include the usual numerical operators such as addition and multiplication. The <tt>std::complex</tt> class is a good example of what is required in a numerical type. The documentation for each algorithm will include the requirements on the element type.</TD><TD><TT> </TT></TD></TR><TR><TD><TT>Shape</TT></TD><TD>This argument specifies the general positioning of the non zero elements in the <A HREF="matrix.html" >matrix</A>, but does not specify the actual storage format. In addition it specifies certain properties such as symmetry. The choices for this argument include <tt><A HREF="rectangle.html" >rectangle</A></tt>, <tt><A HREF="banded.html" >banded</A></tt>, <tt><A HREF="diagonal.html" >diagonal</A></tt>, <tt><A HREF="triangle.html" >triangle</A></tt>, and <tt><A HREF="symmetric.html" >symmetric</A></tt>. Hermitian is not yet implemented.</TD><TD><TT> </TT></TD></TR><TR><TD><TT>Storage</TT></TD><TD>The argument specifies the storage scheme used to lay out the <A HREF="matrix.html" >matrix</A> elements (and sometimes the element indices) in memory. The storage formats include <tt><A HREF="dense.html" >dense</A></tt> , <tt><A HREF="banded.html" >banded</A></tt>, <tt><A HREF="packed.html" >packed</A></tt> , <tt><A HREF="banded_view.html" >banded_view</A></tt>, <tt><A HREF="compressed.html" >compressed</A></tt>, <tt><A HREF="envelope.html" >envelope</A></tt>, and <tt><A HREF="array.html" >array</A></tt>.</TD><TD><TT> </TT></TD></TR><TR><TD><TT>Orientation</TT></TD><TD>The storage order for an MTL <A HREF="matrix.html" >matrix</A> can either be <tt><A HREF="row_major.html" >row_major</A></tt> or <tt><A HREF="column_major.html" >column_major</A></tt>.</TD><TD><TT> </TT></TD></TR></TABLE></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Model of</B></FONT></TD></TR><TR><TD></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Members</B></FONT></TD></TR><TR><TD><TABLE BORDER><TR><TH>Member</TH><TH>Where defined</TH><TH>Description</TH></TR> <TR><TD VALIGN="TOP"><TT> <TT>enum { Shape_id = Shape::id, Shape_M = Shape::M, Shape_N = Shape::N } </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> </TR> <TR><TD VALIGN="TOP"><TT> <TT>type </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> The generated type </FONT></TD> </TR></TABLE></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>New members</B></FONT></TD></TR><TR><TD></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>Notes</B></FONT></TD></TR><TR><TD></TD></TR><TR><TD><IMG SRC="whitespace.gif" Alt="" WIDTH="32" HEIGHT="15" ALIGN="TOP"></TD></TR><TR BGCOLOR=#e0e0e0><TD VALIGN=BOTTOM><FONT FACE=arial,helvetica SIZE=+1><B>See also</B></FONT></TD></TR><TR><TD></TD></TR></TABLE><!--start footer--> <P><CENTER><CENTER><IMG SRC="./blue-bar.jpg" width=640></CENTER></CENTER><P><A HREF="http://www.nd.edu"><IMG BORDER=0 SRC="./ndtoclogo.gif" ALT="[MTL Home]" ALIGN=absmiddle></A></A><FONT SIZE="-2"><A HREF="../LICENSE.htm">Copyright ©1998,1999 University of Notre Dame. All Rights Reserved.</FONT></FONT></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -