File: GF2XVec.cpp.html

package info (click to toggle)
ntl 9.9.1-3~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 6,348 kB
  • sloc: ansic: 78,019; cpp: 10,441; makefile: 350; sh: 14
file content (73 lines) | stat: -rw-r--r-- 4,560 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>/Volumes/unix-files/u/ntl-new/ntl-9.9.0dev/doc/GF2XVec.cpp.html</title>
<meta name="Generator" content="Vim/7.1">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff" text="#000000"><font face="monospace">
<br>
<font color="#0000ed"><i>/*</i></font><font color="#0000ed"><i>*************************************************************************\</i></font><br>
<br>
<font color="#0000ed"><i>MODULE: GF2XVec</i></font><br>
<br>
<font color="#0000ed"><i>SUMMARY:</i></font><br>
<br>
<font color="#0000ed"><i>The class GF2XVec implements vectors of fixed-length GF2X's.&nbsp;&nbsp;You can</i></font><br>
<font color="#0000ed"><i>allocate a vector of GF2X's of a specified length, where the maximum</i></font><br>
<font color="#0000ed"><i>size of each GF2X is also specified.&nbsp;&nbsp;These parameters can be specified</i></font><br>
<font color="#0000ed"><i>either with a constructor, or with SetSize.&nbsp;&nbsp;It is an error to</i></font><br>
<font color="#0000ed"><i>try to re-size a vector of non-xero , or store a GF2X that doesn't fit.&nbsp;&nbsp;</i></font><br>
<font color="#0000ed"><i>The space can be released with &quot;kill&quot;, and then you are free to call SetSize</i></font><br>
<font color="#0000ed"><i>again.&nbsp;&nbsp;If you want more flexible---but less efficient---vectors, use</i></font><br>
<font color="#0000ed"><i>vec_GF2X.</i></font><br>
<br>
<font color="#0000ed"><i>\*************************************************************************</i></font><font color="#0000ed"><i>*/</i></font><br>
<br>
<font color="#1773cc">#include </font><font color="#4a6f8b">&lt;NTL/GF2X.h&gt;</font><br>
<br>
<br>
<font color="#008b00"><b>class</b></font>&nbsp;GF2XVec {<br>
<font color="#b02f60"><b>public</b></font>:<br>
&nbsp;&nbsp; GF2XVec();<br>
<br>
&nbsp;&nbsp; GF2XVec&amp; <font color="#b02f60"><b>operator</b></font>=(<font color="#008b00"><b>const</b></font>&nbsp;GF2XVec&amp;); <br>
&nbsp;&nbsp; <font color="#0000ed"><i>// first kill()'s destination (unless source and destination are</i></font><br>
&nbsp;&nbsp; <font color="#0000ed"><i>// identical)</i></font><br>
<br>
&nbsp;&nbsp; GF2XVec(<font color="#008b00"><b>const</b></font>&nbsp;GF2XVec&amp;); <br>
&nbsp;&nbsp; ~GF2XVec();<br>
<br>
&nbsp;&nbsp; GF2XVec(<font color="#008b00"><b>long</b></font>&nbsp;n, <font color="#008b00"><b>long</b></font>&nbsp;d);<br>
&nbsp;&nbsp; <font color="#0000ed"><i>// sets length to n and max size of each element to d,</i></font><br>
&nbsp;&nbsp; <font color="#0000ed"><i>// where the size d measures the number of words </i></font><br>
<br>
&nbsp;&nbsp; <font color="#008b00"><b>void</b></font>&nbsp;SetSize(<font color="#008b00"><b>long</b></font>&nbsp;n, <font color="#008b00"><b>long</b></font>&nbsp;d);<br>
&nbsp;&nbsp; <font color="#0000ed"><i>// sets length to n and max size of each element to d,</i></font><br>
&nbsp;&nbsp; <font color="#0000ed"><i>// where the size d measures the number of words </i></font><br>
<br>
&nbsp;&nbsp; <font color="#008b00"><b>long</b></font>&nbsp;length() <font color="#008b00"><b>const</b></font>;<br>
&nbsp;&nbsp; <font color="#0000ed"><i>// length of vector</i></font><br>
<br>
&nbsp;&nbsp; <font color="#008b00"><b>long</b></font>&nbsp;BaseSize() <font color="#008b00"><b>const</b></font>;<br>
&nbsp;&nbsp; <font color="#0000ed"><i>// max size of each element</i></font><br>
<br>
&nbsp;&nbsp; <font color="#008b00"><b>void</b></font>&nbsp;kill();<br>
&nbsp;&nbsp; <font color="#0000ed"><i>// release space</i></font><br>
<br>
<br>
&nbsp;&nbsp; GF2X* elts();<br>
&nbsp;&nbsp; <font color="#008b00"><b>const</b></font>&nbsp;GF2X* elts() <font color="#008b00"><b>const</b></font>;<br>
&nbsp;&nbsp; <font color="#0000ed"><i>// pointer to first element</i></font><br>
<br>
&nbsp;&nbsp; GF2X&amp; <font color="#b02f60"><b>operator</b></font>[](<font color="#008b00"><b>long</b></font>&nbsp;i);<br>
&nbsp;&nbsp; <font color="#008b00"><b>const</b></font>&nbsp;GF2X&amp; <font color="#b02f60"><b>operator</b></font>[](<font color="#008b00"><b>long</b></font>&nbsp;i) <font color="#008b00"><b>const</b></font>;<br>
&nbsp;&nbsp; <font color="#0000ed"><i>// indexing operator; starts at 0; no range checking</i></font><br>
};<br>
<br>
<br>
<font color="#008b00"><b>void</b></font>&nbsp;swap(GF2XVec&amp; x, GF2XVec&amp; y);<br>
<font color="#0000ed"><i>// swaps x and y by swapping pointers</i></font><br>
<br>
</font></body>
</html>