📄 compressed.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 compressed</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>compressed</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 = "selectors.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,selectors</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> <h4> TwoD Storage Type Selectors</h4> This storage type is the traditional <A HREF="compressed.html" >compressed</A> row or <A HREF="compressed.html" >compressed</A> column format. The storage consists of three arrays, one <A HREF="array.html" >array</A> for all of the elements, one <A HREF="array.html" >array</A> consisting of the row or column index (row for column-major and column for row-major matrices), and one <A HREF="array.html" >array</A> consisting of pointers to the start of each row/column. The following is an example sparse <A HREF="matrix.html" >matrix</A> in <A HREF="compressed.html" >compressed</A> for format, with the stored indices specified as <tt>index_from_one</tt>. Note that the MTL interface is still indexed from zero whether or not the underlying stored indices are from one. <pre> [ 1 2 3 ] [ 4 5 ] [ 6 7 8 ] [ 9 10 ] [ 11 12 ] row pointer <A HREF="array.html" >array</A> [ 1 4 6 9 11 13 ] element value <A HREF="array.html" >array</A> [ 1 2 3 4 5 6 7 8 9 10 11 12 ] element column index <A HREF="array.html" >array</A> [ 1 3 4 2 5 1 3 4 1 4 3 5 ] </pre> Of course, the user of the MTL sparse <A HREF="matrix.html" >matrix</A> does not need to concern his or herself with the implementation details of this <A HREF="matrix.html" >matrix</A> storage format. The interface to an MTL <A HREF="compressed.html" >compressed</A> row <A HREF="matrix.html" >matrix</A> is the same as that of any MTL <A HREF="matrix.html" >matrix</A>, as described in <A HREF="Matrix.html" >Matrix</A>. <h4> OneD Storage Type Selectors</h4> This is a OneD type used to construct <A HREF="array.html" >array</A> matrices. The <A HREF="compressed.html" >compressed</A> OneD format uses two arrays, one to hold the elements of the vector, and the other to hold the indices that coorespond to each element (either their row or column number).</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>In <A HREF=../../contrib/examples/sparse_matrix.cc>sparse_matrix.cc</A>:<PRE> // [1,0,2] // [0,3,0] // [0,4,5] const int m = 3, n = 3, nnz = 5; double values[] = { 1, 2, 3, 4, 5 }; int indices[] = { 1, 3, 2, 2, 3 }; int row_ptr[] = { 1, 3, 4, 6 }; // Create from pre-existing arrays typedef matrix<double, rectangle<>, compressed<int, external, index_from_one>, row_major>::type MatA; MatA A(m, n, nnz, values, row_ptr, indices); // Create from scratch typedef matrix<double, rectangle<>, compressed<>, row_major >::type MatB; MatB B(m, n); B(0,0) = 1; B(0,2) = 2; B(1,1) = 3; B(2,1) = 4; B(2,2) = 5;</PRE></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>SizeType</TT></TD><TD>The type used in the index and pointer <A HREF="array.html" >array</A> </TD><TD><TT> int</TT></TD></TR><TR><TD><TT>MemLoc</TT></TD><TD>Specify whether the memory used is "owned" by the <A HREF="matrix.html" >matrix</A> or if it was provided to the <A HREF="matrix.html" >matrix</A> from some external source (with a pointer to some data) </TD><TD><TT> internal</TT></TD></TR><TR><TD><TT>IndexStyle</TT></TD><TD>Specify whether the underlying index <A HREF="array.html" >array</A> stores indices starting from one (fortan style) or from zero (c-style) - index_from_zero</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>size_type </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>enum { id = COMPRESSED, oned_id, ext=MemLoc, issparse=1, index=IndexStyle } </TT></TD> <TD><FONT FACE=Times SIZE=3> </FONT></TD> <TD><FONT FACE=Times SIZE=3> </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 + -