This file is indexed.

/usr/share/gap/doc/ref/chap23.html is in gap-doc 4r8p6-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>GAP (ref) - Chapter 23: Row Vectors</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="generator" content="GAPDoc2HTML" />
<link rel="stylesheet" type="text/css" href="manual.css" />
<script src="manual.js" type="text/javascript"></script>
<script type="text/javascript">overwriteStyle();</script>
</head>
<body class="chap23"  onload="jscontent()">


<div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a>  <a href="chap1.html">1</a>  <a href="chap2.html">2</a>  <a href="chap3.html">3</a>  <a href="chap4.html">4</a>  <a href="chap5.html">5</a>  <a href="chap6.html">6</a>  <a href="chap7.html">7</a>  <a href="chap8.html">8</a>  <a href="chap9.html">9</a>  <a href="chap10.html">10</a>  <a href="chap11.html">11</a>  <a href="chap12.html">12</a>  <a href="chap13.html">13</a>  <a href="chap14.html">14</a>  <a href="chap15.html">15</a>  <a href="chap16.html">16</a>  <a href="chap17.html">17</a>  <a href="chap18.html">18</a>  <a href="chap19.html">19</a>  <a href="chap20.html">20</a>  <a href="chap21.html">21</a>  <a href="chap22.html">22</a>  <a href="chap23.html">23</a>  <a href="chap24.html">24</a>  <a href="chap25.html">25</a>  <a href="chap26.html">26</a>  <a href="chap27.html">27</a>  <a href="chap28.html">28</a>  <a href="chap29.html">29</a>  <a href="chap30.html">30</a>  <a href="chap31.html">31</a>  <a href="chap32.html">32</a>  <a href="chap33.html">33</a>  <a href="chap34.html">34</a>  <a href="chap35.html">35</a>  <a href="chap36.html">36</a>  <a href="chap37.html">37</a>  <a href="chap38.html">38</a>  <a href="chap39.html">39</a>  <a href="chap40.html">40</a>  <a href="chap41.html">41</a>  <a href="chap42.html">42</a>  <a href="chap43.html">43</a>  <a href="chap44.html">44</a>  <a href="chap45.html">45</a>  <a href="chap46.html">46</a>  <a href="chap47.html">47</a>  <a href="chap48.html">48</a>  <a href="chap49.html">49</a>  <a href="chap50.html">50</a>  <a href="chap51.html">51</a>  <a href="chap52.html">52</a>  <a href="chap53.html">53</a>  <a href="chap54.html">54</a>  <a href="chap55.html">55</a>  <a href="chap56.html">56</a>  <a href="chap57.html">57</a>  <a href="chap58.html">58</a>  <a href="chap59.html">59</a>  <a href="chap60.html">60</a>  <a href="chap61.html">61</a>  <a href="chap62.html">62</a>  <a href="chap63.html">63</a>  <a href="chap64.html">64</a>  <a href="chap65.html">65</a>  <a href="chap66.html">66</a>  <a href="chap67.html">67</a>  <a href="chap68.html">68</a>  <a href="chap69.html">69</a>  <a href="chap70.html">70</a>  <a href="chap71.html">71</a>  <a href="chap72.html">72</a>  <a href="chap73.html">73</a>  <a href="chap74.html">74</a>  <a href="chap75.html">75</a>  <a href="chap76.html">76</a>  <a href="chap77.html">77</a>  <a href="chap78.html">78</a>  <a href="chap79.html">79</a>  <a href="chap80.html">80</a>  <a href="chap81.html">81</a>  <a href="chap82.html">82</a>  <a href="chap83.html">83</a>  <a href="chap84.html">84</a>  <a href="chap85.html">85</a>  <a href="chap86.html">86</a>  <a href="chap87.html">87</a>  <a href="chapBib.html">Bib</a>  <a href="chapInd.html">Ind</a>  </div>

<div class="chlinkprevnexttop">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp;  <a href="chap0.html#contents">[Contents]</a>&nbsp;  &nbsp;<a href="chap22.html">[Previous Chapter]</a>&nbsp;  &nbsp;<a href="chap24.html">[Next Chapter]</a>&nbsp;  </div>

<p id="mathjaxlink" class="pcenter"><a href="chap23_mj.html">[MathJax on]</a></p>
<p><a id="X82C7E6CF7BA03391" name="X82C7E6CF7BA03391"></a></p>
<div class="ChapSects"><a href="chap23.html#X82C7E6CF7BA03391">23 <span class="Heading">Row Vectors</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap23.html#X7E383689817D2371">23.1 <span class="Heading">IsRowVector (Filter)</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X7DFB22A07836A7A9">23.1-1 IsRowVector</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap23.html#X85516C3179C229DB">23.2 <span class="Heading">Operators for Row Vectors</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X785DC60D8482695D">23.2-1 NormedRowVector</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap23.html#X8679F7DD7DFCBD9C">23.3 <span class="Heading">Row Vectors over Finite Fields</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X810E46927F9E8F75">23.3-1 <span class="Heading">ConvertToVectorRep</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X872E17FF829DB50F">23.3-2 NumberFFVector</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap23.html#X85C68AED805E4B9C">23.4 <span class="Heading">Coefficient List Arithmetic</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X78E6897186F482F6">23.4-1 AddRowVector</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X7854B2B67E3FE2CA">23.4-2 AddCoeffs</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X78CFE0A879773B45">23.4-3 MultRowVector</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X8264B3EE7D56EEDD">23.4-4 CoeffsMod</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap23.html#X7D287281781E16A2">23.5 <span class="Heading">Shifting and Trimming Coefficient Lists</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X80465E9B7A38C176">23.5-1 LeftShiftRowVector</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X822CCA4781D5C5EC">23.5-2 RightShiftRowVector</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X78951C0E86D857B5">23.5-3 ShrinkRowVector</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X85796B6079581023">23.5-4 RemoveOuterCoeffs</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap23.html#X7B63F1EB83FA0CF6">23.6 <span class="Heading">Functions for Coding Theory</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X7C9F4D657F9BA5A1">23.6-1 WeightVecFFE</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X85AA5C6587559C1C">23.6-2 DistanceVecFFE</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X7F2F630984A9D3D6">23.6-3 DistancesDistributionVecFFEsVecFFE</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X85135CEB86E61D49">23.6-4 DistancesDistributionMatFFEVecFFE</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X82E5987E81487D18">23.6-5 AClosestVectorCombinationsMatFFEVecFFE</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X7C88671678A2BEB4">23.6-6 CosetLeadersMatFFE</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap23.html#X87FEC1927B3A63C8">23.7 <span class="Heading">Vectors as coefficients of polynomials</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X84DE99D57C29D47F">23.7-1 ValuePol</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X8328088C807AFFAF">23.7-2 ProductCoeffs</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X87248AA27F05BDCC">23.7-3 ReduceCoeffs</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X7F74B1637CB13B7B">23.7-4 ReduceCoeffsMod</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X825F8F357FB1BF56">23.7-5 PowerModCoeffs</a></span>
<span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap23.html#X833EF7AE80CE8B3C">23.7-6 ShiftedCoeffs</a></span>
</div></div>
</div>

<h3>23 <span class="Heading">Row Vectors</span></h3>

<p>Just as in mathematics, a vector in <strong class="pkg">GAP</strong> is any object which supports appropriate addition and scalar multiplication operations (see Chapter <a href="chap61.html#X7DAD6700787EC845"><span class="RefLink">61</span></a>). As in mathematics, an especially important class of vectors are those represented by a list of coefficients with respect to some basis. These correspond roughly to the <strong class="pkg">GAP</strong> concept of <em>row vectors</em>.</p>

<p><a id="X7E383689817D2371" name="X7E383689817D2371"></a></p>

<h4>23.1 <span class="Heading">IsRowVector (Filter)</span></h4>

<p><a id="X7DFB22A07836A7A9" name="X7DFB22A07836A7A9"></a></p>

<h5>23.1-1 IsRowVector</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsRowVector</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>A <em>row vector</em> is a vector (see <code class="func">IsVector</code> (<a href="chap31.html#X802F34F280B29DF4"><span class="RefLink">31.14-14</span></a>)) that is also a homogeneous list of odd additive nesting depth (see <a href="chap21.html#X84D642967B8546B7"><span class="RefLink">21.12</span></a>). Typical examples are lists of integers and rationals, lists of finite field elements of the same characteristic, and lists of polynomials from a common polynomial ring. Note that matrices are <em>not</em> regarded as row vectors, because they have even additive nesting depth.</p>

<p>The additive operations of the vector must thus be compatible with that for lists, implying that the list entries are the coefficients of the vector with respect to some basis.</p>

<p>Note that not all row vectors admit a multiplication via <code class="code">*</code> (which is to be understood as a scalar product); for example, class functions are row vectors but the product of two class functions is defined in a different way. For the installation of a scalar product of row vectors, the entries of the vector must be ring elements; note that the default method expects the row vectors to lie in <code class="code">IsRingElementList</code>, and this category may not be implied by <code class="func">IsRingElement</code> (<a href="chap31.html#X84BF40CA86C07361"><span class="RefLink">31.14-16</span></a>) for all entries of the row vector (see the comment in <code class="func">IsVector</code> (<a href="chap31.html#X802F34F280B29DF4"><span class="RefLink">31.14-14</span></a>)).</p>

<p>Note that methods for special types of row vectors really must be installed with the requirement <code class="func">IsRowVector</code>, since <code class="func">IsVector</code> (<a href="chap31.html#X802F34F280B29DF4"><span class="RefLink">31.14-14</span></a>) may lead to a rank of the method below that of the default method for row vectors (see file <code class="file">lib/vecmat.gi</code>).</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsRowVector([1,2,3]);</span>
true
</pre></div>

<p>Because row vectors are just a special case of lists, all operations and functions for lists are applicable to row vectors as well (see Chapter <a href="chap21.html#X7B256AE5780F140A"><span class="RefLink">21</span></a>). This especially includes accessing elements of a row vector (see <a href="chap21.html#X7921047F83F5FA28"><span class="RefLink">21.3</span></a>), changing elements of a mutable row vector (see <a href="chap21.html#X8611EF768210625B"><span class="RefLink">21.4</span></a>), and comparing row vectors (see <a href="chap21.html#X8016D50F85147A77"><span class="RefLink">21.10</span></a>).</p>

<p>Note that, unless your algorithms specifically require you to be able to change entries of your vectors, it is generally better and faster to work with immutable row vectors. See Section <a href="chap12.html#X7F0C119682196D65"><span class="RefLink">12.6</span></a> for more details.</p>

<p><a id="X85516C3179C229DB" name="X85516C3179C229DB"></a></p>

<h4>23.2 <span class="Heading">Operators for Row Vectors</span></h4>

<p>The rules for arithmetic operations involving row vectors are in fact special cases of those for the arithmetic of lists, as given in Section <a href="chap21.html#X845EEAF083D43CCE"><span class="RefLink">21.11</span></a> and the following sections, here we reiterate that definition, in the language of vectors.</p>

<p>Note that the additive behaviour sketched below is defined only for lists in the category <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>), and the multiplicative behaviour is defined only for lists in the category <code class="func">IsMultiplicativeGeneralizedRowVector</code> (<a href="chap21.html#X7FBCA5B58308C158"><span class="RefLink">21.12-2</span></a>).</p>

<p><code class="code"><var class="Arg">vec1</var> + <var class="Arg">vec2</var></code></p>

<p>returns the sum of the two row vectors <var class="Arg">vec1</var> and <var class="Arg">vec2</var>. Probably the most usual situation is that <var class="Arg">vec1</var> and <var class="Arg">vec2</var> have the same length and are defined over a common field; in this case the sum is a new row vector over the same field where each entry is the sum of the corresponding entries of the vectors.</p>

<p>In more general situations, the sum of two row vectors need not be a row vector, for example adding an integer vector <var class="Arg">vec1</var> and a vector <var class="Arg">vec2</var> over a finite field yields the list of pointwise sums, which will be a mixture of finite field elements and integers if <var class="Arg">vec1</var> is longer than <var class="Arg">vec2</var>.</p>

<p><code class="code"><var class="Arg">scalar</var> + <var class="Arg">vec</var></code></p>

<p><code class="code"><var class="Arg">vec</var> + <var class="Arg">scalar</var></code></p>

<p>returns the sum of the scalar <var class="Arg">scalar</var> and the row vector <var class="Arg">vec</var>. Probably the most usual situation is that the elements of <var class="Arg">vec</var> lie in a common field with <var class="Arg">scalar</var>; in this case the sum is a new row vector over the same field where each entry is the sum of the scalar and the corresponding entry of the vector.</p>

<p>More general situations are for example the sum of an integer scalar and a vector over a finite field, or the sum of a finite field element and an integer vector.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">[ 1, 2, 3 ] + [ 1/2, 1/3, 1/4 ];</span>
[ 3/2, 7/3, 13/4 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput"> [ 1/2, 3/2, 1/2 ] + 1/2;</span>
[ 1, 2, 1 ]
</pre></div>

<p><code class="code"><var class="Arg">vec1</var> - <var class="Arg">vec2</var></code></p>

<p><code class="code"><var class="Arg">scalar</var> - <var class="Arg">vec</var></code></p>

<p><code class="code"><var class="Arg">vec</var> - <var class="Arg">scalar</var></code></p>

<p>Subtracting a vector or scalar is defined as adding its additive inverse, so the statements for the addition hold likewise.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">[ 1, 2, 3 ] - [ 1/2, 1/3, 1/4 ];</span>
[ 1/2, 5/3, 11/4 ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">[ 1/2, 3/2, 1/2 ] - 1/2;</span>
[ 0, 1, 0 ]
</pre></div>

<p><code class="code"><var class="Arg">scalar</var> * <var class="Arg">vec</var></code></p>

<p><code class="code"><var class="Arg">vec</var> * <var class="Arg">scalar</var></code></p>

<p>returns the product of the scalar <var class="Arg">scalar</var> and the row vector <var class="Arg">vec</var>. Probably the most usual situation is that the elements of <var class="Arg">vec</var> lie in a common field with <var class="Arg">scalar</var>; in this case the product is a new row vector over the same field where each entry is the product of the scalar and the corresponding entry of the vector.</p>

<p>More general situations are for example the product of an integer scalar and a vector over a finite field, or the product of a finite field element and an integer vector.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">[ 1/2, 3/2, 1/2 ] * 2;</span>
[ 1, 3, 1 ]
</pre></div>

<p><code class="code"><var class="Arg">vec1</var> * <var class="Arg">vec2</var></code></p>

<p>returns the standard scalar product of <var class="Arg">vec1</var> and <var class="Arg">vec2</var>, i.e., the sum of the products of the corresponding entries of the vectors. Probably the most usual situation is that <var class="Arg">vec1</var> and <var class="Arg">vec2</var> have the same length and are defined over a common field; in this case the sum is an element of this field.</p>

<p>More general situations are for example the inner product of an integer vector and a vector over a finite field, or the inner product of two row vectors of different lengths.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">[ 1, 2, 3 ] * [ 1/2, 1/3, 1/4 ];</span>
23/12
</pre></div>

<p>For the mutability of results of arithmetic operations, see <a href="chap12.html#X7F0C119682196D65"><span class="RefLink">12.6</span></a>.</p>

<p>Further operations with vectors as operands are defined by the matrix operations, see <a href="chap24.html#X7899335779A39A95"><span class="RefLink">24.3</span></a>.</p>

<p><a id="X785DC60D8482695D" name="X785DC60D8482695D"></a></p>

<h5>23.2-1 NormedRowVector</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NormedRowVector</code>( <var class="Arg">v</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns a scalar multiple <code class="code"><var class="Arg">w</var> = <var class="Arg">c</var> * <var class="Arg">v</var></code> of the row vector <var class="Arg">v</var> with the property that the first nonzero entry of <var class="Arg">w</var> is an identity element in the sense of <code class="func">IsOne</code> (<a href="chap31.html#X814D78347858EC13"><span class="RefLink">31.10-5</span></a>).</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NormedRowVector( [ 5, 2, 3 ] );</span>
[ 1, 2/5, 3/5 ]
</pre></div>

<p><a id="X8679F7DD7DFCBD9C" name="X8679F7DD7DFCBD9C"></a></p>

<h4>23.3 <span class="Heading">Row Vectors over Finite Fields</span></h4>

<p><strong class="pkg">GAP</strong> can use compact formats to store row vectors over fields of order at most 256, based on those used by the Meat-Axe <a href="chapBib.html#biBRin93">[Rin93]</a>. This format also permits extremely efficient vector arithmetic. On the other hand element access and assignment is significantly slower than for plain lists.</p>

<p>The function <code class="func">ConvertToVectorRep</code> (<a href="chap23.html#X810E46927F9E8F75"><span class="RefLink">23.3-1</span></a>) is used to convert a list into a compressed vector, or to rewrite a compressed vector over another field. Note that this function is <em>much</em> faster when it is given a field (or field size) as an argument, rather than having to scan the vector and try to decide the field. Supplying the field can also avoid errors and/or loss of performance, when one vector from some collection happens to have all of its entries over a smaller field than the "natural" field of the problem.</p>

<p><a id="X810E46927F9E8F75" name="X810E46927F9E8F75"></a></p>

<h5>23.3-1 <span class="Heading">ConvertToVectorRep</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ConvertToVectorRep</code>( <var class="Arg">list</var>[, <var class="Arg">field</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ConvertToVectorRep</code>( <var class="Arg">list</var>[, <var class="Arg">fieldsize</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ConvertToVectorRepNC</code>( <var class="Arg">list</var>[, <var class="Arg">field</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ConvertToVectorRepNC</code>( <var class="Arg">list</var>[, <var class="Arg">fieldsize</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>Called with one argument <var class="Arg">list</var>, <code class="func">ConvertToVectorRep</code> converts <var class="Arg">list</var> to an internal row vector representation if possible.</p>

<p>Called with a list <var class="Arg">list</var> and a finite field <var class="Arg">field</var>, <code class="func">ConvertToVectorRep</code> converts <var class="Arg">list</var> to an internal row vector representation appropriate for a row vector over <var class="Arg">field</var>.</p>

<p>Instead of a <var class="Arg">field</var> also its size <var class="Arg">fieldsize</var> may be given.</p>

<p>It is forbidden to call this function unless <var class="Arg">list</var> is a plain list or a row vector, <var class="Arg">field</var> is a field, and all elements of <var class="Arg">list</var> lie in <var class="Arg">field</var>. Violation of this condition can lead to unpredictable behaviour or a system crash. (Setting the assertion level to at least 2 might catch some violations before a crash, see <code class="func">SetAssertionLevel</code> (<a href="chap7.html#X7C7596418423660B"><span class="RefLink">7.5-1</span></a>).)</p>

<p><var class="Arg">list</var> may already be a compressed vector. In this case, if no <var class="Arg">field</var> or <var class="Arg">fieldsize</var> is given, then nothing happens. If one is given then the vector is rewritten as a compressed vector over the given <var class="Arg">field</var> unless it has the filter <code class="code">IsLockedRepresentationVector</code>, in which case it is not changed.</p>

<p>The return value is the size of the field over which the vector ends up written, if it is written in a compressed representation.</p>

<p>In this example, we first create a row vector and then ask <strong class="pkg">GAP</strong> to rewrite it, first over <code class="code">GF(2)</code> and then over <code class="code">GF(4)</code>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">v := [Z(2)^0,Z(2),Z(2),0*Z(2)];</span>
[ Z(2)^0, Z(2)^0, Z(2)^0, 0*Z(2) ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">RepresentationsOfObject(v);</span>
[ "IsPlistRep", "IsInternalRep" ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ConvertToVectorRep(v);</span>
2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">v;</span>
&lt;a GF2 vector of length 4&gt;
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ConvertToVectorRep(v,4);</span>
4
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">v;</span>
[ Z(2)^0, Z(2)^0, Z(2)^0, 0*Z(2) ]
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">RepresentationsOfObject(v);</span>
[ "IsDataObjectRep", "Is8BitVectorRep" ]
</pre></div>

<p>A vector in the special representation over <code class="code">GF(2)</code> is always viewed as <code class="code">&lt;a GF2 vector of length ...&gt;</code>. Over fields of orders 3 to 256, a vector of length 10 or less is viewed as the list of its coefficients, but a longer one is abbreviated.</p>

<p>Arithmetic operations (see <a href="chap21.html#X845EEAF083D43CCE"><span class="RefLink">21.11</span></a> and the following sections) preserve the compression status of row vectors in the sense that if all arguments are compressed row vectors written over the same field and the result is a row vector then also the result is a compressed row vector written over this field.</p>

<p><a id="X872E17FF829DB50F" name="X872E17FF829DB50F"></a></p>

<h5>23.3-2 NumberFFVector</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NumberFFVector</code>( <var class="Arg">vec</var>, <var class="Arg">sz</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns an integer that gives the position of the finite field row vector <var class="Arg">vec</var> in the sorted list of all row vectors over the field with <var class="Arg">sz</var> elements in the same dimension as <var class="Arg">vec</var>. <code class="func">NumberFFVector</code> returns <code class="keyw">fail</code> if the vector cannot be represented over the field with <var class="Arg">sz</var> elements.</p>

<p><a id="X85C68AED805E4B9C" name="X85C68AED805E4B9C"></a></p>

<h4>23.4 <span class="Heading">Coefficient List Arithmetic</span></h4>

<p>The following operations all perform arithmetic on row vectors. given as homogeneous lists of the same length, containing elements of a commutative ring.</p>

<p>There are two reasons for using <code class="func">AddRowVector</code> (<a href="chap23.html#X78E6897186F482F6"><span class="RefLink">23.4-1</span></a>) in preference to arithmetic operators. Firstly, the three argument form has no single-step equivalent. Secondly <code class="func">AddRowVector</code> (<a href="chap23.html#X78E6897186F482F6"><span class="RefLink">23.4-1</span></a>) changes its first argument in-place, rather than allocating a new vector to hold the result, and may thus produce less garbage.</p>

<p><a id="X78E6897186F482F6" name="X78E6897186F482F6"></a></p>

<h5>23.4-1 AddRowVector</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AddRowVector</code>( <var class="Arg">dst</var>, <var class="Arg">src</var>[, <var class="Arg">mul</var>[, <var class="Arg">from</var>, <var class="Arg">to</var>]] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Adds the product of <var class="Arg">src</var> and <var class="Arg">mul</var> to <var class="Arg">dst</var>, changing <var class="Arg">dst</var>. If <var class="Arg">from</var> and <var class="Arg">to</var> are given then only the index range <code class="code">[ <var class="Arg">from</var> .. <var class="Arg">to</var> ]</code> is guaranteed to be affected. Other indices <em>may</em> be affected, if it is more convenient to do so. Even when <var class="Arg">from</var> and <var class="Arg">to</var> are given, <var class="Arg">dst</var> and <var class="Arg">src</var> must be row vectors of the <em>same</em> length.</p>

<p>If <var class="Arg">mul</var> is not given either then this operation simply adds <var class="Arg">src</var> to <var class="Arg">dst</var>.</p>

<p><a id="X7854B2B67E3FE2CA" name="X7854B2B67E3FE2CA"></a></p>

<h5>23.4-2 AddCoeffs</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AddCoeffs</code>( <var class="Arg">list1</var>[, <var class="Arg">poss1</var>], <var class="Arg">list2</var>[, <var class="Arg">poss2</var>[, <var class="Arg">mul</var>]] )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">AddCoeffs</code> adds the entries of <var class="Arg">list2</var><code class="code">{</code><var class="Arg">poss2</var><code class="code">}</code>, multiplied by the scalar <var class="Arg">mul</var>, to <var class="Arg">list1</var><code class="code">{</code><var class="Arg">poss1</var><code class="code">}</code>. Unbound entries in <var class="Arg">list1</var> are assumed to be zero. The position of the right-most non-zero element is returned.</p>

<p>If the ranges <var class="Arg">poss1</var> and <var class="Arg">poss2</var> are not given, they are assumed to span the whole vectors. If the scalar <var class="Arg">mul</var> is omitted, one is used as a default.</p>

<p>Note that it is the responsibility of the caller to ensure that <var class="Arg">list2</var> has elements at position <var class="Arg">poss2</var> and that the result (in <var class="Arg">list1</var>) will be a dense list.</p>

<p>The function is free to remove trailing (right-most) zeros.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l:=[1,2,3,4];;m:=[5,6,7];;AddCoeffs(l,m);</span>
4
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l;</span>
[ 6, 8, 10, 4 ]
</pre></div>

<p><a id="X78CFE0A879773B45" name="X78CFE0A879773B45"></a></p>

<h5>23.4-3 MultRowVector</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MultRowVector</code>( <var class="Arg">list1</var>[, <var class="Arg">poss1</var>, <var class="Arg">list2</var>, <var class="Arg">poss2</var>], <var class="Arg">mul</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>The five argument version of this operation replaces <var class="Arg">list1</var><code class="code">[</code><var class="Arg">poss1</var><code class="code">[</code><span class="SimpleMath">i</span><code class="code">]]</code> by <code class="code"><var class="Arg">mul</var>*<var class="Arg">list2</var>[<var class="Arg">poss2</var>[</code><span class="SimpleMath">i</span><code class="code">]]</code> for <span class="SimpleMath">i</span> between <span class="SimpleMath">1</span> and <code class="code">Length( <var class="Arg">poss1</var> )</code>.</p>

<p>The two-argument version simply multiplies each element of <var class="Arg">list1</var>, in-place, by <var class="Arg">mul</var>.</p>

<p><a id="X8264B3EE7D56EEDD" name="X8264B3EE7D56EEDD"></a></p>

<h5>23.4-4 CoeffsMod</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CoeffsMod</code>( <var class="Arg">list1</var>[, <var class="Arg">len1</var>], <var class="Arg">modulus</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns the coefficient list obtained by reducing the entries in <var class="Arg">list1</var> modulo <var class="Arg">modulus</var>. After reducing it shrinks the list to remove trailing zeroes. If the optional argument <var class="Arg">len1</var> is used, it reduces only first <var class="Arg">len1</var> elements of the list.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l:=[1,2,3,4];;CoeffsMod(l,2);</span>
[ 1, 0, 1 ]
</pre></div>

<p><a id="X7D287281781E16A2" name="X7D287281781E16A2"></a></p>

<h4>23.5 <span class="Heading">Shifting and Trimming Coefficient Lists</span></h4>

<p>The following functions change coefficient lists by shifting or trimming.</p>

<p><a id="X80465E9B7A38C176" name="X80465E9B7A38C176"></a></p>

<h5>23.5-1 LeftShiftRowVector</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LeftShiftRowVector</code>( <var class="Arg">list</var>, <var class="Arg">shift</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>changes <var class="Arg">list</var> by assigning <var class="Arg">list</var><span class="SimpleMath">[i]</span><code class="code">:= </code><var class="Arg">list</var><span class="SimpleMath">[i+<var class="Arg">shift</var>]</span> and removing the last <var class="Arg">shift</var> entries of the result.</p>

<p><a id="X822CCA4781D5C5EC" name="X822CCA4781D5C5EC"></a></p>

<h5>23.5-2 RightShiftRowVector</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RightShiftRowVector</code>( <var class="Arg">list</var>, <var class="Arg">shift</var>, <var class="Arg">fill</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>changes <var class="Arg">list</var> by assigning <var class="Arg">list</var><span class="SimpleMath">[i+<var class="Arg">shift</var>]</span><code class="code">:= </code><var class="Arg">list</var><span class="SimpleMath">[i]</span> and filling each of the <var class="Arg">shift</var> first entries with <var class="Arg">fill</var>.</p>

<p><a id="X78951C0E86D857B5" name="X78951C0E86D857B5"></a></p>

<h5>23.5-3 ShrinkRowVector</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ShrinkRowVector</code>( <var class="Arg">list</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>removes trailing zeroes from the list <var class="Arg">list</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l:=[1,0,0];;ShrinkRowVector(l);l;</span>
[ 1 ]
</pre></div>

<p><a id="X85796B6079581023" name="X85796B6079581023"></a></p>

<h5>23.5-4 RemoveOuterCoeffs</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RemoveOuterCoeffs</code>( <var class="Arg">list</var>, <var class="Arg">coef</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>removes <var class="Arg">coef</var> at the beginning and at the end of <var class="Arg">list</var> and returns the number of elements removed at the beginning.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l:=[1,1,2,1,2,1,1,2,1];; RemoveOuterCoeffs(l,1);</span>
2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l;</span>
[ 2, 1, 2, 1, 1, 2 ]
</pre></div>

<p><a id="X7B63F1EB83FA0CF6" name="X7B63F1EB83FA0CF6"></a></p>

<h4>23.6 <span class="Heading">Functions for Coding Theory</span></h4>

<p>The following functions perform operations on finite fields vectors considered as code words in a linear code.</p>

<p><a id="X7C9F4D657F9BA5A1" name="X7C9F4D657F9BA5A1"></a></p>

<h5>23.6-1 WeightVecFFE</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; WeightVecFFE</code>( <var class="Arg">vec</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns the weight of the finite field vector <var class="Arg">vec</var>, i.e. the number of nonzero entries.</p>

<p><a id="X85AA5C6587559C1C" name="X85AA5C6587559C1C"></a></p>

<h5>23.6-2 DistanceVecFFE</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DistanceVecFFE</code>( <var class="Arg">vec1</var>, <var class="Arg">vec2</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns the distance between the two vectors <var class="Arg">vec1</var> and <var class="Arg">vec2</var>, which must have the same length and whose elements must lie in a common field. The distance is the number of places where <var class="Arg">vec1</var> and <var class="Arg">vec2</var> differ.</p>

<p><a id="X7F2F630984A9D3D6" name="X7F2F630984A9D3D6"></a></p>

<h5>23.6-3 DistancesDistributionVecFFEsVecFFE</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DistancesDistributionVecFFEsVecFFE</code>( <var class="Arg">vecs</var>, <var class="Arg">vec</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns the distances distribution of the vector <var class="Arg">vec</var> to the vectors in the list <var class="Arg">vecs</var>. All vectors must have the same length, and all elements must lie in a common field. The distances distribution is a list <span class="SimpleMath">d</span> of length <code class="code">Length(<var class="Arg">vec</var>)+1</code>, such that the value <span class="SimpleMath">d[i]</span> is the number of vectors in <var class="Arg">vecs</var> that have distance <span class="SimpleMath">i+1</span> to <var class="Arg">vec</var>.</p>

<p><a id="X85135CEB86E61D49" name="X85135CEB86E61D49"></a></p>

<h5>23.6-4 DistancesDistributionMatFFEVecFFE</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DistancesDistributionMatFFEVecFFE</code>( <var class="Arg">mat</var>, <var class="Arg">F</var>, <var class="Arg">vec</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns the distances distribution of the vector <var class="Arg">vec</var> to the vectors in the vector space generated by the rows of the matrix <var class="Arg">mat</var> over the finite field <var class="Arg">F</var>. The length of the rows of <var class="Arg">mat</var> and the length of <var class="Arg">vec</var> must be equal, and all entries must lie in <var class="Arg">F</var>. The rows of <var class="Arg">mat</var> must be linearly independent. The distances distribution is a list <span class="SimpleMath">d</span> of length <code class="code">Length(<var class="Arg">vec</var>)+1</code>, such that the value <span class="SimpleMath">d[i]</span> is the number of vectors in the vector space generated by the rows of <var class="Arg">mat</var> that have distance <span class="SimpleMath">i+1</span> to <var class="Arg">vec</var>.</p>

<p><a id="X82E5987E81487D18" name="X82E5987E81487D18"></a></p>

<h5>23.6-5 AClosestVectorCombinationsMatFFEVecFFE</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AClosestVectorCombinationsMatFFEVecFFE</code>( <var class="Arg">mat</var>, <var class="Arg">f</var>, <var class="Arg">vec</var>, <var class="Arg">l</var>, <var class="Arg">stop</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AClosestVectorCombinationsMatFFEVecFFECoords</code>( <var class="Arg">mat</var>, <var class="Arg">f</var>, <var class="Arg">vec</var>, <var class="Arg">l</var>, <var class="Arg">stop</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>These functions run through the <var class="Arg">f</var>-linear combinations of the vectors in the rows of the matrix <var class="Arg">mat</var> that can be written as linear combinations of exactly <var class="Arg">l</var> rows (that is without using zero as a coefficient). The length of the rows of <var class="Arg">mat</var> and the length of <var class="Arg">vec</var> must be equal, and all elements must lie in the field <var class="Arg">f</var>. The rows of <var class="Arg">mat</var> must be linearly independent. <code class="func">AClosestVectorCombinationsMatFFEVecFFE</code> returns a vector from these that is closest to the vector <var class="Arg">vec</var>. If it finds a vector of distance at most <var class="Arg">stop</var>, which must be a nonnegative integer, then it stops immediately and returns this vector.</p>

<p><code class="func">AClosestVectorCombinationsMatFFEVecFFECoords</code> returns a length 2 list containing the same closest vector and also a vector <var class="Arg">v</var> with exactly <var class="Arg">l</var> non-zero entries, such that <var class="Arg">v</var> times <var class="Arg">mat</var> is the closest vector.</p>

<p><a id="X7C88671678A2BEB4" name="X7C88671678A2BEB4"></a></p>

<h5>23.6-6 CosetLeadersMatFFE</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CosetLeadersMatFFE</code>( <var class="Arg">mat</var>, <var class="Arg">f</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns a list of representatives of minimal weight for the cosets of a code. <var class="Arg">mat</var> must be a <em>check matrix</em> for the code, the code is defined over the finite field <var class="Arg">f</var>. All rows of <var class="Arg">mat</var> must have the same length, and all elements must lie in the field <var class="Arg">f</var>. The rows of <var class="Arg">mat</var> must be linearly independent.</p>

<p><a id="X87FEC1927B3A63C8" name="X87FEC1927B3A63C8"></a></p>

<h4>23.7 <span class="Heading">Vectors as coefficients of polynomials</span></h4>

<p>A list of ring elements can be interpreted as a row vector or the list of coefficients of a polynomial. There are a couple of functions that implement arithmetic operations based on these interpretations. <strong class="pkg">GAP</strong> contains proper support for polynomials (see <a href="chap66.html#X7A14A6588268810A"><span class="RefLink">66</span></a>), the operations described in this section are on a lower level.</p>

<p>The following operations all perform arithmetic on univariate polynomials given by their coefficient lists. These lists can have different lengths but must be dense homogeneous lists containing elements of a commutative ring. Not all input lists may be empty.</p>

<p>In the following descriptions we will always assume that <var class="Arg">list1</var> is the coefficient list of the polynomial <var class="Arg">pol1</var> and so forth. If length parameter <var class="Arg">leni</var> is not given, it is set to the length of <var class="Arg">listi</var> by default.</p>

<p><a id="X84DE99D57C29D47F" name="X84DE99D57C29D47F"></a></p>

<h5>23.7-1 ValuePol</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ValuePol</code>( <var class="Arg">coeff</var>, <var class="Arg">x</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Let <var class="Arg">coeff</var> be the coefficients list of a univariate polynomial <span class="SimpleMath">f</span>, and <var class="Arg">x</var> a ring element. Then <code class="func">ValuePol</code> returns the value <span class="SimpleMath">f(<var class="Arg">x</var>)</span>.</p>

<p>The coefficient of <span class="SimpleMath"><var class="Arg">x</var>^i</span> is assumed to be stored at position <span class="SimpleMath">i+1</span> in the coefficients list.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ValuePol([1,2,3],4);</span>
57
</pre></div>

<p><a id="X8328088C807AFFAF" name="X8328088C807AFFAF"></a></p>

<h5>23.7-2 ProductCoeffs</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ProductCoeffs</code>( <var class="Arg">list1</var>[, <var class="Arg">len1</var>], <var class="Arg">list2</var>[, <var class="Arg">len2</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Let <span class="SimpleMath">p1</span> (and <span class="SimpleMath">p2</span>) be polynomials given by the first <var class="Arg">len1</var> (<var class="Arg">len2</var>) entries of the coefficient list <var class="Arg">list2</var> (<var class="Arg">list2</var>). If <var class="Arg">len1</var> and <var class="Arg">len2</var> are omitted, they default to the lengths of <var class="Arg">list1</var> and <var class="Arg">list2</var>. This operation returns the coefficient list of the product of <span class="SimpleMath">p1</span> and <span class="SimpleMath">p2</span>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l:=[1,2,3,4];;m:=[5,6,7];;ProductCoeffs(l,m);</span>
[ 5, 16, 34, 52, 45, 28 ]
</pre></div>

<p><a id="X87248AA27F05BDCC" name="X87248AA27F05BDCC"></a></p>

<h5>23.7-3 ReduceCoeffs</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ReduceCoeffs</code>( <var class="Arg">list1</var>[, <var class="Arg">len1</var>], <var class="Arg">list2</var>[, <var class="Arg">len2</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Let <span class="SimpleMath">p1</span> (and <span class="SimpleMath">p2</span>) be polynomials given by the first <var class="Arg">len1</var> (<var class="Arg">len2</var>) entries of the coefficient list <var class="Arg">list1</var> (<var class="Arg">list2</var>). If <var class="Arg">len1</var> and <var class="Arg">len2</var> are omitted, they default to the lengths of <var class="Arg">list1</var> and <var class="Arg">list2</var>. <code class="func">ReduceCoeffs</code> changes <var class="Arg">list1</var> to the coefficient list of the remainder when dividing <var class="Arg">p1</var> by <var class="Arg">p2</var>. This operation changes <var class="Arg">list1</var> which therefore must be a mutable list. The operation returns the position of the last non-zero entry of the result but is not guaranteed to remove trailing zeroes.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l:=[1,2,3,4];;m:=[5,6,7];;ReduceCoeffs(l,m);</span>
2
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l;</span>
[ 64/49, -24/49, 0, 0 ]
</pre></div>

<p><a id="X7F74B1637CB13B7B" name="X7F74B1637CB13B7B"></a></p>

<h5>23.7-4 ReduceCoeffsMod</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ReduceCoeffsMod</code>( <var class="Arg">list1</var>[, <var class="Arg">len1</var>], <var class="Arg">list2</var>[, <var class="Arg">len2</var>], <var class="Arg">modulus</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Let <span class="SimpleMath">p1</span> (and <span class="SimpleMath">p2</span>) be polynomials given by the first <var class="Arg">len1</var> (<var class="Arg">len2</var>) entries of the coefficient list <var class="Arg">list1</var> (<var class="Arg">list2</var>). If <var class="Arg">len1</var> and <var class="Arg">len2</var> are omitted, they default to the lengths of <var class="Arg">list1</var> and <var class="Arg">list2</var>. <code class="func">ReduceCoeffsMod</code> changes <var class="Arg">list1</var> to the coefficient list of the remainder when dividing <var class="Arg">p1</var> by <var class="Arg">p2</var> modulo <var class="Arg">modulus</var>, which must be a positive integer. This operation changes <var class="Arg">list1</var> which therefore must be a mutable list. The operations returns the position of the last non-zero entry of the result but is not guaranteed to remove trailing zeroes.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l:=[1,2,3,4];;m:=[5,6,7];;ReduceCoeffsMod(l,m,3);</span>
1
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l;</span>
[ 1, 0, 0, 0 ]
</pre></div>

<p><a id="X825F8F357FB1BF56" name="X825F8F357FB1BF56"></a></p>

<h5>23.7-5 PowerModCoeffs</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PowerModCoeffs</code>( <var class="Arg">list1</var>[, <var class="Arg">len1</var>], <var class="Arg">exp</var>, <var class="Arg">list2</var>[, <var class="Arg">len2</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Let <span class="SimpleMath">p1</span> and <span class="SimpleMath">p2</span> be polynomials whose coefficients are given by the first <var class="Arg">len1</var> resp. <var class="Arg">len2</var> entries of the lists <var class="Arg">list1</var> and <var class="Arg">list2</var>, respectively. If <var class="Arg">len1</var> and <var class="Arg">len2</var> are omitted, they default to the lengths of <var class="Arg">list1</var> and <var class="Arg">list2</var>. Let <var class="Arg">exp</var> be a positive integer. <code class="func">PowerModCoeffs</code> returns the coefficient list of the remainder when dividing the <var class="Arg">exp</var>-th power of <span class="SimpleMath">p1</span> by <span class="SimpleMath">p2</span>. The coefficients are reduced already while powers are computed, therefore avoiding an explosion in list length.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l:=[1,2,3,4];;m:=[5,6,7];;PowerModCoeffs(l,5,m);</span>
[ -839462813696/678223072849, -7807439437824/678223072849 ]
</pre></div>

<p><a id="X833EF7AE80CE8B3C" name="X833EF7AE80CE8B3C"></a></p>

<h5>23.7-6 ShiftedCoeffs</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ShiftedCoeffs</code>( <var class="Arg">list</var>, <var class="Arg">shift</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>produces a new coefficient list <code class="code">new</code> obtained by the rule <code class="code">new[i+<var class="Arg">shift</var>]:= <var class="Arg">list</var>[i]</code> and filling initial holes by the appropriate zero.</p>


<div class="example"><pre>
<span class="GAPprompt">gap&gt;</span> <span class="GAPinput">l:=[1,2,3];;ShiftedCoeffs(l,2);ShiftedCoeffs(l,-2);</span>
[ 0, 0, 1, 2, 3 ]
[ 3 ]
</pre></div>


<div class="chlinkprevnextbot">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp;  <a href="chap0.html#contents">[Contents]</a>&nbsp;  &nbsp;<a href="chap22.html">[Previous Chapter]</a>&nbsp;  &nbsp;<a href="chap24.html">[Next Chapter]</a>&nbsp;  </div>


<div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a>  <a href="chap1.html">1</a>  <a href="chap2.html">2</a>  <a href="chap3.html">3</a>  <a href="chap4.html">4</a>  <a href="chap5.html">5</a>  <a href="chap6.html">6</a>  <a href="chap7.html">7</a>  <a href="chap8.html">8</a>  <a href="chap9.html">9</a>  <a href="chap10.html">10</a>  <a href="chap11.html">11</a>  <a href="chap12.html">12</a>  <a href="chap13.html">13</a>  <a href="chap14.html">14</a>  <a href="chap15.html">15</a>  <a href="chap16.html">16</a>  <a href="chap17.html">17</a>  <a href="chap18.html">18</a>  <a href="chap19.html">19</a>  <a href="chap20.html">20</a>  <a href="chap21.html">21</a>  <a href="chap22.html">22</a>  <a href="chap23.html">23</a>  <a href="chap24.html">24</a>  <a href="chap25.html">25</a>  <a href="chap26.html">26</a>  <a href="chap27.html">27</a>  <a href="chap28.html">28</a>  <a href="chap29.html">29</a>  <a href="chap30.html">30</a>  <a href="chap31.html">31</a>  <a href="chap32.html">32</a>  <a href="chap33.html">33</a>  <a href="chap34.html">34</a>  <a href="chap35.html">35</a>  <a href="chap36.html">36</a>  <a href="chap37.html">37</a>  <a href="chap38.html">38</a>  <a href="chap39.html">39</a>  <a href="chap40.html">40</a>  <a href="chap41.html">41</a>  <a href="chap42.html">42</a>  <a href="chap43.html">43</a>  <a href="chap44.html">44</a>  <a href="chap45.html">45</a>  <a href="chap46.html">46</a>  <a href="chap47.html">47</a>  <a href="chap48.html">48</a>  <a href="chap49.html">49</a>  <a href="chap50.html">50</a>  <a href="chap51.html">51</a>  <a href="chap52.html">52</a>  <a href="chap53.html">53</a>  <a href="chap54.html">54</a>  <a href="chap55.html">55</a>  <a href="chap56.html">56</a>  <a href="chap57.html">57</a>  <a href="chap58.html">58</a>  <a href="chap59.html">59</a>  <a href="chap60.html">60</a>  <a href="chap61.html">61</a>  <a href="chap62.html">62</a>  <a href="chap63.html">63</a>  <a href="chap64.html">64</a>  <a href="chap65.html">65</a>  <a href="chap66.html">66</a>  <a href="chap67.html">67</a>  <a href="chap68.html">68</a>  <a href="chap69.html">69</a>  <a href="chap70.html">70</a>  <a href="chap71.html">71</a>  <a href="chap72.html">72</a>  <a href="chap73.html">73</a>  <a href="chap74.html">74</a>  <a href="chap75.html">75</a>  <a href="chap76.html">76</a>  <a href="chap77.html">77</a>  <a href="chap78.html">78</a>  <a href="chap79.html">79</a>  <a href="chap80.html">80</a>  <a href="chap81.html">81</a>  <a href="chap82.html">82</a>  <a href="chap83.html">83</a>  <a href="chap84.html">84</a>  <a href="chap85.html">85</a>  <a href="chap86.html">86</a>  <a href="chap87.html">87</a>  <a href="chapBib.html">Bib</a>  <a href="chapInd.html">Ind</a>  </div>

<hr />
<p class="foot">generated by <a href="http://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
</body>
</html>