-
Notifications
You must be signed in to change notification settings - Fork 0
/
docs.html
16511 lines (15798 loc) · 473 KB
/
docs.html
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
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--
Copyright (C) 2008-2016 National ICT Australia (NICTA)
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
===================================================================
Written by Conrad Sanderson - http://conradsanderson.id.au
-->
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title>Armadillo: API Documentation</title>
<link rel="icon" href="armadillo_icon.png" type="image/png">
<style type="text/css">
<!--
body
{
font-family: "Trebuchet MS", "Droid Sans", sans-serif;
color: #000000;
background-color: #FFFFFF;
/* font-size: 10pt; */
/* line-height: 120%; */
height: 110%;
}
pre
{
font-family: "DejaVu Sans Mono", "Liberation Mono", "Andale Mono", "Bitstream Vera Sans Mono", "Luxi Mono", monospace;
font-size: smaller;
color: #666666;
}
a
{
text-decoration: none;
color: #498c05;
}
a:hover
{
text-decoration: underline;
color: #498c05;
}
a.menu
{
text-decoration: none;
color: #CCCCCC;
}
a.menu:hover
{
text-decoration: none;
color: #498c05;
}
a.hidden, a.hidden:hover, a.hidden:active, a.hidden:link, a.hidden:visited
{
text-decoration: none;
border-bottom: 0px
}
table
{
/* border: 1px solid #000; */
/* display: block; */
border-collapse: collapse;
}
td.line
{
border-left: 2px solid rgb(204, 204, 204);
}
.footertext
{
position: relative;
bottom: 0px;
}
hr.greyline
{
color: rgb(204, 204, 204);
/* background-color: rgb(204, 204, 204); */
}
#nobreak
{
white-space: nowrap;
}
.noindent
{
text-indent: 0px;
margin-left: 1ex;
margin-right: 0ex;
margin-top: 0ex;
margin-bottom: 0ex;
padding-left: 1ex;
padding-right: 0ex;
padding-top: 0ex;
padding-bottom: 0ex;
list-style: disc;
}
-->
</style>
</head>
<body>
<center>
<table style="text-align: left; width: 80%; margin-left: auto; margin-right: auto;" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top;">
<!-- BEGIN CONTENT -->
<style type="text/css">
<!--
@media all
{
.pagebreak { }
.noprint { }
}
@media print
{
.pagebreak { page-break-before: always; }
.noprint { display: none !important; }
}
-->
</style>
<a name="top"></a>
<!-- -->
<a class="noprint" style="display:scroll; position:fixed; bottom:5px; right:5px;" href="#top"><font size=-1>[top]</font></a>
<big><b>API Documentation for Armadillo 7.500</b></big>
<br>
<br>
<br>
<b>Preamble</b>
<br>
<br>
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: left; vertical-align: top; width: 45%;">
<ul>
<li>
For converting Matlab/Octave programs,
see the <a href="#syntax">syntax conversion table</a>
</li>
<br>
<li>
First time users: please see the short <a href="#example_prog">example program</a>
</li>
<br>
<li>
If you discover any bugs or regressions, please <a href="http://arma.sourceforge.net/support.html">report them</a>
</li>
<br>
<li>
History of <a href="#api_additions">API additions</a>
</li>
</ul>
</td>
<td>
</td>
<td class="line" style="vertical-align: top;">
<br>
</td>
<td style="text-align: left; vertical-align: top; width: 50%;">
<ul>
<li>
Please cite the following article if you use Armadillo in your research and/or software.
Citations are useful for the continued development and maintenance of the library.
<br>
<br>
<font size=-1>
Conrad Sanderson and Ryan Curtin.
<br><i><a href="armadillo_joss_2016.pdf">Armadillo: a template-based C++ library for linear algebra</a></i>.
<br>Journal of Open Source Software, Vol. 1, pp. 26, 2016.
</font>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
<br>
<br>
<b>Overview</b>
<ul>
<li><a href="#part_classes">matrix, vector, cube and field classes</a></li>
<li><a href="#part_membfns">member functions & variables</a></li>
<br>
<li><a href="#part_gen">generated vectors / matrices / cubes</a></li>
<li><a href="#part_fns">functions of vectors / matrices / cubes</a></li>
<br>
<li><a href="#part_decompdense">decompositions, factorisations, inverses and equation solvers (dense matrices)</a></li>
<li><a href="#part_decompsparse">decompositions, factorisations, and equation solvers (sparse matrices)</a></li>
<br>
<li><a href="#part_sigproc">signal & image processing</a></li>
<li><a href="#part_stats">statistics and clustering</a></li>
<li><a href="#part_misc">miscellaneous (constants, configuration)</a></li>
</ul>
<br>
<a name="part_classes"></a>
<b>Matrix, Vector, Cube and Field Classes</b>
<ul>
<table>
<tbody>
<tr><td><a href="#Mat">Mat<<i>type</i>>, mat, cx_mat</a></td><td> </td><td>dense matrix class</td></tr>
<tr><td><a href="#Col">Col<<i>type</i>>, colvec, vec</a></td><td> </td><td>dense column vector class</td></tr>
<tr><td><a href="#Row">Row<<i>type</i>>, rowvec</a></td><td> </td><td>dense row vector class</td></tr>
<tr><td> </td><td> </td><td> </td></tr>
<tr><td><a href="#Cube">Cube<<i>type</i>>, cube, cx_cube</a></td><td> </td><td>dense cube class ("3D matrix")</td></tr>
<tr><td><a href="#field">field<<i>object type</i>></a></td><td> </td><td>class for storing arbitrary objects in matrix-like or cube-like layouts</td></tr>
<tr><td><a href="#SpMat">SpMat<<i>type</i>>, sp_mat, sp_cx_mat</a></td><td> </td><td>sparse matrix class</td></tr>
<tr><td> </td><td> </td><td> </td></tr>
<tr><td><a href="#operators">operators</a></td><td> </td><td><code><big>+</big> <big>-</big> <big>*</big> / % == != <= >= < ></code></td></tr>
</tbody>
</table>
</ul>
<br>
<a name="part_membfns"></a>
<b>Member Functions & Variables</b>
<ul>
<table>
<tbody>
<tr><td><a href="#attributes">attributes</a></td><td> </td><td>.n_rows, .n_cols, .n_elem, .n_slices, ...</td></tr>
<tr><td><a href="#element_access">element access</a></td><td> </td><td>element/object access via (), [] and .at()</td></tr>
<tr><td><a href="#element_initialisation">element initialisation</a></td><td> </td><td>set elements via << operator or initialiser list</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#zeros_member">.zeros</a></td><td> </td><td>set all elements to zero</td></tr>
<tr><td><a href="#ones_member">.ones</a></td><td> </td><td>set all elements to one</td></tr>
<tr><td><a href="#eye_member">.eye</a></td><td> </td><td>set elements along main diagonal to one and off-diagonal elements to zero</td></tr>
<tr><td><a href="#randu_randn_member">.randu / .randn</a></td><td> </td><td>set all elements to random values</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#fill">.fill</a></td><td> </td><td>set all elements to specified value</td></tr>
<tr><td><a href="#imbue">.imbue</a></td><td> </td><td>imbue (fill) with values provided by functor or lambda function</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#replace">.replace</a></td><td> </td><td>replace specific elements with a new value</td></tr>
<tr><td><a href="#transform">.transform</a></td><td> </td><td>transform each element via functor or lambda function</td></tr>
<tr><td><a href="#for_each">.for_each</a></td><td> </td><td>apply a functor or lambda function to each element</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#set_size">.set_size</a></td><td> </td><td>change size without keeping elements (fast)</td></tr>
<tr><td><a href="#reshape_member">.reshape</a></td><td> </td><td>change size while keeping elements</td></tr>
<tr><td><a href="#resize_member">.resize</a></td><td> </td><td>change size while keeping elements and preserving layout</td></tr>
<tr><td><a href="#copy_size">.copy_size</a></td><td> </td><td>change size to be same as given object</td></tr>
<tr><td><a href="#reset">.reset</a></td><td> </td><td>change size to empty</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#submat">submatrix views</a></td><td> </td><td>read/write access to contiguous and non-contiguous submatrices</td></tr>
<tr><td><a href="#subcube">subcube views</a></td><td> </td><td>read/write access to contiguous and non-contiguous subcubes</td></tr>
<tr><td><a href="#subfield">subfield views</a></td><td> </td><td>read/write access to contiguous subfields</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#diag">.diag</a></td><td> </td><td>read/write access to matrix diagonals</td></tr>
<tr><td><a href="#each_colrow">.each_col / .each_row</a></td><td> </td><td>repeated operations on each column or row of matrix</td></tr>
<tr><td><a href="#each_slice">.each_slice</a></td><td> </td><td>repeated operations on each slice of cube</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#set_imag">.set_imag / .set_real</a></td><td> </td><td>set imaginary/real part</td></tr>
<tr><td><a href="#insert">.insert_rows/cols/slices</a></td><td> </td><td>insert vector/matrix/cube at specified row/column/slice</td></tr>
<tr><td><a href="#shed">.shed_rows/cols/slices</a></td><td> </td><td>remove specified rows/columns/slices</td></tr>
<tr><td><a href="#swap_rows">.swap_rows/cols</a></td><td> </td><td>swap specified rows or columns</td></tr>
<tr><td><a href="#swap">.swap</a></td><td> </td><td>swap contents with given object</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#memptr">.memptr</a></td><td> </td><td>raw pointer to memory</td></tr>
<tr><td><a href="#colptr">.colptr</a></td><td> </td><td>raw pointer to memory used by specified column</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#iterators_mat">iterators (matrices)</a></td><td> </td><td>STL-style iterators and associated member functions for matrices and vectors</td></tr>
<tr><td><a href="#iterators_cube">iterators (cubes)</a></td><td> </td><td>STL-style iterators and associated member functions for cubes</td></tr>
<tr><td><a href="#stl_container_fns">STL container functions</a></td><td> </td><td>STL-style container functions</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#t_st_members">.t / .st </a></td><td> </td><td>return matrix transpose</td></tr>
<tr><td><a href="#i_member">.i </a></td><td> </td><td>return inverse of square matrix</td></tr>
<tr><td><a href="#min_and_max_member">.min / .max</a></td><td> </td><td>return extremum value</td></tr>
<tr><td><a href="#index_min_and_index_max_member">.index_min / .index_max</a></td><td> </td><td>return index of extremum value</td></tr>
<tr><td><a href="#eval_member">.eval</a></td><td> </td><td>force evaluation of delayed expression</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#in_range">.in_range</a></td><td> </td><td>check whether given location or span is valid</td></tr>
<tr><td><a href="#is_empty">.is_empty</a></td><td> </td><td>check whether object is empty</td></tr>
<tr><td><a href="#is_square">.is_square</a></td><td> </td><td>check whether matrix is square sized</td></tr>
<tr><td><a href="#is_vec">.is_vec</a></td><td> </td><td>check whether matrix is a vector</td></tr>
<tr><td><a href="#is_sorted">.is_sorted</a></td><td> </td><td>check whether vector or matrix is sorted</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#is_finite_member">.is_finite</a></td><td> </td><td>check whether all elements are finite</td></tr>
<tr><td><a href="#has_inf">.has_inf</a></td><td> </td><td>check whether any element is +-Inf</td></tr>
<tr><td><a href="#has_nan">.has_nan</a></td><td> </td><td>check whether any element is NaN</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#print">.print</a></td><td> </td><td>print object to <i>std::cout</i> or user specified stream</td></tr>
<tr><td><a href="#raw_print">.raw_print</a></td><td> </td><td>print object without formatting</td></tr>
<tr><td><small><small> </small></small></td><td><small><small> </small></small></td><td><small><small> </small></small></td></tr>
<tr><td><a href="#save_load_mat">.save/.load (matrices & cubes)</a></td><td> </td><td>save/load matrices and cubes in files or streams</td></tr>
<tr><td><a href="#save_load_field">.save/.load (fields)</a></td><td> </td><td>save/load fields in files or streams</td></tr>
</tbody>
</table>
</ul>
<br>
<a name="part_gen"></a>
<b>Generated Vectors/Matrices/Cubes</b>
<ul>
<table>
<tbody>
<tr style="background-color: #F5F5F5;"><td><a href="#eye_standalone">eye</a></td><td> </td><td>generate identity matrix</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#linspace">linspace</a></td><td> </td><td>generate vector with linearly spaced elements</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#logspace">logspace</a></td><td> </td><td>generate vector with logarithmically spaced elements</td></tr>
<tr><td><a href="#ones_standalone">ones</a></td><td> </td><td>generate object filled with ones</td></tr>
<tr><td><a href="#randi">randi</a></td><td> </td><td>generate object with random integer values in specified interval</td></tr>
<tr><td><a href="#randu_randn_standalone">randu / randn</a></td><td> </td><td>generate object with random values (uniform and normal distributions)</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#randg">randg</a></td><td> </td><td>generate object with random values (gamma distribution)</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#regspace">regspace</a></td><td> </td><td>generate vector with regularly spaced elements</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#speye">speye</a></td><td> </td><td>generate sparse identity matrix</td></tr>
<tr><td><a href="#spones">spones</a></td><td> </td><td>generate sparse matrix with non-zero elements set to one</td></tr>
<tr><td><a href="#sprandu_sprandn">sprandu / sprandn</a></td><td> </td><td>generate sparse matrix with non-zero elements set to random values</td></tr>
<tr><td><a href="#toeplitz">toeplitz</a></td><td> </td><td>generate Toeplitz matrix</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#zeros_standalone">zeros</a></td><td> </td><td>generate object filled with zeros</td></tr>
</tbody>
</table>
</ul>
<br>
<a name="part_fns"></a>
<b>Functions of Vectors/Matrices/Cubes</b>
<ul>
<table>
<tbody>
<tr style="background-color: #F5F5F5;"><td><a href="#abs">abs</a></td><td> </td><td>obtain magnitude of each element</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#accu">accu</a></td><td> </td><td>accumulate (sum) all elements</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#all">all</a></td><td> </td><td>check whether all elements are non-zero, or satisfy a relational condition</td></tr>
<tr><td><a href="#any">any</a></td><td> </td><td>check whether any element is non-zero, or satisfies a relational condition</td></tr>
<tr><td><a href="#approx_equal">approx_equal</a></td><td> </td><td>approximate equality</td></tr>
<tr><td><a href="#as_scalar">as_scalar</a></td><td> </td><td>convert 1x1 matrix to pure scalar</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#clamp">clamp</a></td><td> </td><td>obtain clamped elements according to given limits</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#cond">cond</a></td><td> </td><td>condition number of matrix</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#conj">conj</a></td><td> </td><td>obtain complex conjugate of each element</td></tr>
<tr><td><a href="#conv_to">conv_to</a></td><td> </td><td>convert between matrix types</td></tr>
<tr><td><a href="#cross">cross</a></td><td> </td><td>cross product</td></tr>
<tr><td><a href="#cumsum">cumsum</a></td><td> </td><td>cumulative sum</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#cumprod">cumprod</a></td><td> </td><td>cumulative product</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#det">det / log_det</a></td><td> </td><td>determinant</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#diagmat">diagmat</a></td><td> </td><td>generate diagonal matrix from given matrix or vector</td></tr>
<tr><td><a href="#diagvec">diagvec</a></td><td> </td><td>extract specified diagonal</td></tr>
<tr><td><a href="#diff">diff</a></td><td> </td><td>differences between adjacent elements</td></tr>
<tr><td><a href="#dot">dot/cdot/norm_dot</a></td><td> </td><td>dot product</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#eps">eps</a></td><td> </td><td>obtain distance of each element to next largest floating point representation</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#expmat">expmat</a></td><td> </td><td>matrix exponential</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#expmat_sym">expmat_sym</a></td><td> </td><td>matrix exponential (symmetric)</td></tr>
<tr><td><a href="#find">find</a></td><td> </td><td>find indices of non-zero elements, or elements satisfying a relational condition</td></tr>
<tr><td><a href="#find_finite">find_finite</a></td><td> </td><td>find indices of finite elements</td></tr>
<tr><td><a href="#find_nonfinite">find_nonfinite</a></td><td> </td><td>find indices of non-finite elements</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#find_unique">find_unique</a></td><td> </td><td>find indices of unique elements</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#flip">fliplr / flipud</a></td><td> </td><td>reverse order of columns or rows</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#imag_real">imag / real</a></td><td> </td><td>extract imaginary/real part</td></tr>
<tr><td><a href="#ind2sub">ind2sub</a></td><td> </td><td>convert linear index to subscripts</td></tr>
<tr><td><a href="#index_min_and_index_max_standalone">index_min / index_max</a></td><td> </td><td>indices of extremum values</td></tr>
<tr><td><a href="#inplace_trans">inplace_trans</a></td><td> </td><td>in-place transpose</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#is_finite">is_finite</a></td><td> </td><td>check whether all elements are finite</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#join">join_rows / join_cols</a></td><td> </td><td>concatenation of matrices</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#join_slices">join_slices</a></td><td> </td><td>concatenation of cubes</td></tr>
<tr><td><a href="#kron">kron</a></td><td> </td><td>Kronecker tensor product</td></tr>
<tr><td><a href="#logmat">logmat</a></td><td> </td><td>matrix logarithm</td></tr>
<tr><td><a href="#logmat_sympd">logmat_sympd</a></td><td> </td><td>matrix logarithm (symmetric)</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#min_and_max">min / max</a></td><td> </td><td>return extremum values</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#nonzeros">nonzeros</a></td><td> </td><td>return non-zero values</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#norm">norm</a></td><td> </td><td>various norms of vectors and matrices</td></tr>
<tr><td><a href="#normalise">normalise</a></td><td> </td><td>normalise vectors to unit <i>p</i>-norm</td></tr>
<tr><td><a href="#prod">prod</a></td><td> </td><td>product of elements</td></tr>
<tr><td><a href="#rank">rank</a></td><td> </td><td>rank of matrix</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#rcond">rcond</a></td><td> </td><td>reciprocal of condition number</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#repmat">repmat</a></td><td> </td><td>replicate matrix in block-like fashion</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#reshape">reshape</a></td><td> </td><td>change size while keeping elements</td></tr>
<tr><td><a href="#resize">resize</a></td><td> </td><td>change size while keeping elements and preserving layout</td></tr>
<tr><td><a href="#shift">shift</a></td><td> </td><td>shift elements</td></tr>
<tr><td><a href="#shuffle">shuffle</a></td><td> </td><td>randomly shuffle elements</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#size">size</a></td><td> </td><td>obtain dimensions of given object</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#sort">sort</a></td><td> </td><td>sort elements</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#sort_index">sort_index</a></td><td> </td><td>vector describing sorted order of elements</td></tr>
<tr><td><a href="#sqrtmat">sqrtmat</a></td><td> </td><td>square root of matrix</td></tr>
<tr><td><a href="#sqrtmat_sympd">sqrtmat_sympd</a></td><td> </td><td>square root of matrix (symmetric)</td></tr>
<tr><td><a href="#sum">sum</a></td><td> </td><td>sum of elements</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#sub2ind">sub2ind</a></td><td> </td><td>convert subscripts to linear index</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#symmat">symmatu / symmatl</a></td><td> </td><td>generate symmetric matrix from given matrix</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#trace">trace</a></td><td> </td><td>sum of diagonal elements</td></tr>
<tr><td><a href="#trans">trans</a></td><td> </td><td>transpose of matrix</td></tr>
<tr><td><a href="#trapz">trapz</a></td><td> </td><td>trapezoidal numerical integration</td></tr>
<tr><td><a href="#trimat">trimatu / trimatl</a></td><td> </td><td>generate triangular matrix from given matrix</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#unique">unique</a></td><td> </td><td>return unique elements</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#vectorise">vectorise</a></td><td> </td><td>convert matrix to vector</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#misc_fns">misc functions</a></td><td> </td><td>miscellaneous element-wise functions: exp, log, pow, sqrt, round, sign, ...</td></tr>
<tr><td><a href="#trig_fns">trig functions</a></td><td> </td><td>trigonometric element-wise functions: cos, sin, ...</td></tr>
</tbody>
</table>
</ul>
<br>
<a name="part_decompdense"></a>
<b>Decompositions, Factorisations, Inverses and Equation Solvers (Dense Matrices)</b>
<ul>
<table>
<tbody>
<tr style="background-color: #F5F5F5;"><td><a href="#chol">chol</a></td><td> </td><td>Cholesky decomposition</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#eig_sym">eig_sym</a></td><td> </td><td>eigen decomposition of dense symmetric/hermitian matrix</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#eig_gen">eig_gen</a></td><td> </td><td>eigen decomposition of dense general square matrix</td></tr>
<tr><td><a href="#eig_pair">eig_pair</a></td><td> </td><td>eigen decomposition for pair of general dense square matrices</td></tr>
<tr><td><a href="#inv">inv</a></td><td> </td><td>inverse of general square matrix</td></tr>
<tr><td><a href="#inv_sympd">inv_sympd</a></td><td> </td><td>inverse of symmetric positive definite matrix</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#lu">lu </a></td><td> </td><td>lower-upper decomposition</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#null">null</a></td><td> </td><td>orthonormal basis of null space</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#orth">orth</a></td><td> </td><td>orthonormal basis of range space</td></tr>
<tr><td><a href="#pinv">pinv</a></td><td> </td><td>pseudo-inverse</td></tr>
<tr><td><a href="#qr">qr </a></td><td> </td><td>QR decomposition</td></tr>
<tr><td><a href="#qr_econ">qr_econ</a></td><td> </td><td>economical QR decomposition</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#qz">qz </a></td><td> </td><td>generalised Schur decomposition</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#schur">schur</a></td><td> </td><td>Schur decomposition</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#solve">solve</a></td><td> </td><td>solve systems of linear equations</td></tr>
<tr><td><a href="#svd">svd</a></td><td> </td><td>singular value decomposition</td></tr>
<tr><td><a href="#svd_econ">svd_econ</a></td><td> </td><td>economical singular value decomposition</td></tr>
<tr><td><a href="#syl">syl</a></td><td> </td><td>Sylvester equation solver</td></tr>
</tbody>
</table>
</ul>
<br>
<a name="part_decompsparse"></a>
<b>Decompositions, Factorisations and Equation Solvers (Sparse Matrices)</b>
<ul>
<table>
<tbody>
<tr style="background-color: #F5F5F5;"><td><a href="#eigs_sym">eigs_sym</a></td><td> </td><td>limited number of eigenvalues & eigenvectors of sparse symmetric real matrix</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#eigs_gen">eigs_gen</a></td><td> </td><td>limited number of eigenvalues & eigenvectors of sparse general square matrix</td></tr>
<tr><td><a href="#spsolve">spsolve</a></td><td> </td><td>solve sparse systems of linear equations</td></tr>
<tr><td><a href="#svds">svds</a></td><td> </td><td>limited number of singular values & singular vectors of sparse matrix</td></tr>
</tbody>
</table>
</ul>
<br>
<a name="part_sigproc"></a>
<b>Signal & Image Processing</b>
<ul>
<table>
<tbody>
<tr style="background-color: #F5F5F5;"><td><a href="#conv">conv</a></td><td> </td><td>1D convolution</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#conv2">conv2</a></td><td> </td><td>2D convolution</td></tr>
<tr><td><a href="#fft">fft / ifft</a></td><td> </td><td>1D fast Fourier transform and its inverse</td></tr>
<tr><td><a href="#fft2">fft2 / ifft2</a></td><td> </td><td>2D fast Fourier transform and its inverse</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#interp1">interp1</a></td><td> </td><td>1D interpolation</td></tr>
</tbody>
</table>
</ul>
<br>
<a name="part_stats"></a>
<b>Statistics & Clustering</b>
<ul>
<table>
<tbody>
<tr style="background-color: #F5F5F5;"><td><a href="#stats_fns">stats functions</a></td><td> </td><td>mean, median, standard deviation, variance</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#cov">cov</a></td><td> </td><td>covariance</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#cor">cor</a></td><td> </td><td>correlation</td></tr>
<tr><td><a href="#hist">hist</a></td><td> </td><td>histogram of counts</td></tr>
<tr><td><a href="#histc">histc</a></td><td> </td><td>histogram of counts with user specified edges</td></tr>
<tr><td><a href="#princomp">princomp</a></td><td> </td><td>principal component analysis</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#running_stat">running_stat</a></td><td> </td><td>running statistics of one dimensional process/signal</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#running_stat_vec">running_stat_vec</a></td><td> </td><td>running statistics of multi-dimensional process/signal</td></tr>
<tr><td><a href="#kmeans">kmeans</a></td><td> </td><td>cluster data into disjoint sets</td></tr>
<tr><td><a href="#gmm_diag">gmm_diag</a></td><td> </td><td>model data as a Gaussian Mixture Model (GMM)</td></tr>
</tbody>
</table>
</ul>
<br>
<a name="part_misc"></a>
<b>Miscellaneous</b>
<ul>
<table>
<tbody>
<tr style="background-color: #F5F5F5;"><td><a href="#constants">constants</a></td><td> </td><td>pi, inf, NaN, speed of light, ...</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#wall_clock">wall_clock</a></td><td> </td><td>timer for measuring number of elapsed seconds</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#logging">logging of errors/warnings</a></td><td> </td><td>how to change the streams for displaying warnings and errors</td></tr>
<tr><td><a href="#uword">uword / sword</a></td><td> </td><td>shorthand for unsigned and signed integers</td></tr>
<tr><td><a href="#cx_double">cx_double / cx_float</a></td><td> </td><td>shorthand for std::complex<double> and std::complex<float></td></tr>
<tr><td><a href="#syntax">Matlab/Armadillo syntax differences</a></td><td> </td><td>examples of Matlab syntax and conceptually corresponding Armadillo syntax</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#example_prog">example program</a></td><td> </td><td>short example program</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#config_hpp">config.hpp</a></td><td> </td><td>configuration options</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#api_additions">API additions</a></td><td> </td><td>API version policy and list of API additions</td></tr>
<!--<tr><td><a href="#log_add">log_add</a></td><td> </td><td>TODO</td></tr>-->
<!--<tr><td><a href="#catching_exceptions">catching exceptions</a></td><td> </td><td>TODO</td></tr>-->
</tbody>
</table>
</ul>
<br>
<div class="pagebreak"></div>
<hr class="greyline">
<hr class="greyline">
<br>
<br>
<font size=+1><b>Matrix, Vector, Cube and Field Classes</b></font>
<br>
<br>
<div class="pagebreak"></div><div class="noprint"><hr class="greyline"><br></div>
<a name="Mat"></a><b>Mat<</b><i>type</i><b>></b>
<br><b>mat</b>
<br><b>cx_mat</b>
<ul>
<li>
The root matrix class is <b>Mat<</b><i>type</i><b>></b>, where <i>type</i> is one of:
<ul>
<li>
<i>float</i>, <i>double</i>, <i>std::complex<float></i>, <i>std::complex<double></i>,
<i>short</i>, <i>int</i>, <i>long</i>, and unsigned versions of <i>short</i>, <i>int</i>, <i>long</i>
</li>
</ul>
</li>
<br>
<li>
For convenience the following typedefs have been defined:
<ul>
<table style="text-align: left;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<code>mat</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Mat<double></code>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<code>fmat</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Mat<float></code>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<code>cx_mat</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Mat<<a href="#cx_double">cx_double</a>></code>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<code>cx_fmat</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Mat<<a href="#cx_double">cx_float</a>></code>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<code>umat</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Mat<<a href="#uword">uword</a>></code>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<code>imat</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Mat<<a href="#uword">sword</a>></code>
</td>
</tr>
</tbody>
</table>
</ul>
</li>
<br>
<li>
In this documentation the <i>mat</i> type is used for convenience;
it is possible to use other types instead, eg. <i>fmat</i>
</li>
<br>
<li>
Functions which use LAPACK or ATLAS (generally matrix decompositions) are only valid for the following types:
<i>mat</i>, <i>fmat</i>, <i>cx_mat</i>, <i>cx_fmat</i>
</li>
<br>
<li>
Elements are stored with <a href="https://en.wikipedia.org/wiki/Column_major">column-major ordering</a> (ie. column by column)
</li>
<br>
<a name="constructors_mat"></a>
<li>
Constructors:
<ul>
<code>mat()</code>
<br><code>mat(<i>n_rows</i>, <i>n_cols</i>)</code>
<br><code>mat(<i>n_rows</i>, <i>n_cols</i>, <i>fill_type</i>)</code>
<br><code>mat(size(<i>X</i>))</code>
<br><code>mat(size(<i>X</i>), <i>fill_type</i>)</code>
<br><code>mat(mat)</code>
<br><code>mat(sp_mat)</code>
<br><code>mat(vec)</code>
<br><code>mat(rowvec)</code>
<br><code>mat(initializer_list)</code>
<br><code>mat(string)</code>
<br><code>mat(std::vector)</code> (treated as a column vector)
<br><code>cx_mat(mat,mat)</code> (for constructing a complex matrix out of two real matrices)
</ul>
</li>
<br>
<li>
When specifying the size with <i>n_rows</i> and <i>n_cols</i>, by default the memory is uninitialised;
memory can be initialised by specifying the <i>fill_type</i>,
which is one of:
<i>fill::zeros</i>,
<i>fill::ones</i>,
<i>fill::eye</i>,
<i>fill::randu</i>,
<i>fill::randn</i>,
<i>fill::none</i>,
with the following meanings:
<ul>
<table>
<tbody>
<tr><td><code>fill::zeros</code></td><td> = </td><td>set all elements to 0</td></tr>
<tr><td><code>fill::ones</code></td><td> = </td><td>set all elements to 1</td></tr>
<tr><td><code>fill::eye</code></td><td> = </td><td>set the elements along the main diagonal to 1 and off-diagonal elements to 0</td></tr>
<tr><td><code>fill::randu</code></td><td> = </td><td>set each element to a random value from a uniform distribution in the [0,1] interval</td></tr>
<tr><td><code>fill::randn</code></td><td> = </td><td>set each element to a random value from a normal/Gaussian distribution with zero mean and unit variance</td></tr>
<tr><td><code>fill::none</code></td><td> = </td><td>do not modify the elements</td></tr>
</tbody>
</table>
</ul>
</li>
<br>
<li>
The string format for the constructor is elements separated by spaces, and rows denoted by semicolons.
For example, the 2x2 identity matrix can be created using <code>"1 0; 0 1"</code>.
<br>
<b>Caveat:</b> string based initialisation is slower than directly <a href="#element_access">setting the elements</a> or using <a href="#element_initialisation">element initialisation</a>.
</li>
<br>
<a name="adv_constructors_mat"></a>
<li>
Advanced constructors:
<br>
<br>
<ul>
<code>mat(ptr_aux_mem, n_rows, n_cols, copy_aux_mem = true, strict = false)</code>
<br>
<br>
<ul>
Create a matrix using data from writable auxiliary (external) memory, where <i>ptr_aux_mem</i> is a pointer to the memory.
By default the matrix allocates its own memory and copies data from the auxiliary memory (for safety).
However, if <i>copy_aux_mem</i> is set to <i>false</i>,
the matrix will instead directly use the auxiliary memory (ie. no copying);
this is faster, but can be dangerous unless you know what you are doing!
<br>
<br>
The <i>strict</i> parameter comes into effect only when <i>copy_aux_mem</i> is set to <i>false</i>
(ie. the matrix is directly using auxiliary memory)
<ul>
<li>
when <i>strict</i> is set to <i>false</i>, the matrix will use the auxiliary memory until a size change
</li>
<li>
when <i>strict</i> is set to <i>true</i>, the matrix will be bound to the auxiliary memory for its lifetime;
the number of elements in the matrix can't be changed
</li>
<li>the default setting of <i>strict</i> in versions 6.000+ is <i>false</i></li>
<li>the default setting of <i>strict</i> in versions 5.600 and earlier is <i>true</i></li>
</ul>
</ul>
<br>
<code>mat(const ptr_aux_mem, n_rows, n_cols)</code>
<br>
<br>
<ul>
Create a matrix by copying data from read-only auxiliary memory,
where <i>ptr_aux_mem</i> is a pointer to the memory
</ul>
<a name="adv_constructors_mat_fixed"></a>
<br>
<code>mat::fixed<n_rows, n_cols></code>
<br>
<br>
<ul>
Create a fixed size matrix, with the size specified via template arguments.
Memory for the matrix is allocated at compile time.
This is generally faster than dynamic memory allocation, but the size of the matrix can't be changed afterwards (directly or indirectly).
<br>
<br>
For convenience, there are several pre-defined typedefs for each matrix type
(where the types are: <i>umat</i>, <i>imat</i>, <i>fmat</i>, <i>mat</i>, <i>cx_fmat</i>, <i>cx_mat</i>).
The typedefs specify a square matrix size, ranging from 2x2 to 9x9.
The typedefs were defined by simply appending a two digit form of the size to the matrix type
-- for example, <i>mat33</i> is equivalent to <i>mat::fixed<3,3></i>,
while <i>cx_mat44</i> is equivalent to <i>cx_mat::fixed<4,4></i>.
</ul>
<br>
<code>mat::fixed<n_rows, n_cols>(const ptr_aux_mem)</code>
<br>
<br>
<ul>
Create a fixed size matrix, with the size specified via template arguments;
data is copied from auxiliary memory, where <i>ptr_aux_mem</i> is a pointer to the memory
</ul>
</ul>
</li>
<br>
<br>
<li>
Examples:
<ul>
<pre>
mat A(5, 5, fill::randu);
double x = A(1,2);
mat B = A + A;
mat C = A * B;
mat D = A % B;
cx_mat X(A,B);
B.zeros();
B.set_size(10,10);
B.ones(5,6);
B.print("B:");
mat::fixed<5,6> F;
double aux_mem[24];
mat H(&aux_mem[0], 4, 6, false); // use auxiliary memory
</pre>
</ul>
</li>
<br>
<li><b>Caveat:</b>
For mathematical correctness, scalars are treated as 1x1 matrices during initialisation.
As such, the code below <b>will not</b> generate a 5x5 matrix with every element equal to 123.0:
<ul>
<pre>
mat A(5,5); A = 123.0;
</pre>
</ul>
Use the following code instead:
<ul>
<pre>
mat A(5,5); A.fill(123.0);
</pre>
</ul>
<br>
<li>
See also:
<ul>
<li><a href="#attributes">matrix attributes</a></li>
<li><a href="#element_access">accessing elements</a></li>
<li><a href="#element_initialisation">initialising elements</a></li>
<li><a href="#operators">math & relational operators</a></li>
<li><a href="#submat">submatrix views</a></li>
<li><a href="#save_load_mat">saving & loading matrices</a></li>
<li><a href="#print">printing matrices</a></li>
<li><a href="#iterators_mat">STL-style element iterators</a></li>
<li><a href="#eval_member">.eval()</a></li>
<li><a href="#conv_to">conv_to()</a> (convert between matrix types)</li>
<li><a href="http://www.cplusplus.com/doc/tutorial/other_data_types/">explanation of <i>typedef</i></a> (cplusplus.com)
<li><a href="#Col">Col class</a></li>
<li><a href="#Row">Row class</a></li>
<li><a href="#Cube">Cube class</a></li>
<li><a href="#SpMat">SpMat class</a> (sparse matrix)</li>
<li><a href="#config_hpp">config.hpp</a></li>
</ul>
</li>
<br>
</ul>
<div class="pagebreak"></div><div class="noprint"><hr class="greyline"><br></div>
<a name="Col"></a><b>Col<</b><i>type</i><b>></b>
<br><b>vec</b>
<br><b>cx_vec</b>
<ul>
<li>
Classes for column vectors (matrices with one column)
</li>
<br>
<li>The <b>Col<</b><i>type</i><b>></b> class is derived from the <b>Mat<</b><i>type</i><b>></b> class
and inherits most of the member functions
</li>
<br>
<li>
For convenience the following typedefs have been defined:
<ul>
<table style="text-align: left;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<code>vec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>colvec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Col<double></code>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<code>fvec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>fcolvec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Col<float></code>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<code>cx_vec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>cx_colvec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Col<<a href="#cx_double">cx_double</a>></code>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<code>cx_fvec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>cx_fcolvec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Col<<a href="#cx_double">cx_float</a>></code>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<code>uvec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>ucolvec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Col<<a href="#uword">uword</a>></code>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<code>ivec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>icolvec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Col<<a href="#uword">sword</a>></code>
</td>
</tr>
</tbody>
</table>
</ul>
</li>
<br>
<li>
In this documentation, the <b><i>vec</i></b> and <b><i>colvec</i></b> types have the <b>same meaning</b> and are used <b>interchangeably</b>
</li>
<br>
<li>
In this documentation, the types <i>vec</i> or <i>colvec</i> are used for convenience; it is possible to use other types instead, eg. <i>fvec</i>, <i>fcolvec</i>
</li>
<br>
<li>
Functions which take <i>Mat</i> as input can generally also take <i>Col</i> as input.
Main exceptions are functions which require square matrices
</li>
<br>
<li>
Constructors
<ul>
<code>vec()</code>
<br><code>vec(<i>n_elem</i>)</code>
<br><code>vec(<i>n_elem</i>, <i>fill_type</i>)</code>
<br><code>vec(size(<i>X</i>))</code>
<br><code>vec(size(<i>X</i>), <i>fill_type</i>)</code>
<br><code>vec(vec)</code>
<br><code>vec(mat)</code> (a <i>std::logic_error</i> exception is thrown if the given matrix has more than one column)
<br><code>vec(initializer_list)</code>
<br><code>vec(string)</code> (elements separated by spaces)
<br><code>vec(std::vector)</code>
<br><code>cx_vec(vec,vec)</code> (for constructing a complex vector out of two real vectors)
</ul>
</li>
<br>
<li>
When specifying the size with <i>n_elem</i>, by default the memory is uninitialised;
memory can be initialised by specifying the <i>fill_type</i>,
as per the <a href="#Mat">Mat class</a>
</li>
<br>
<a name="adv_constructors_col"></a>
<li>
Advanced constructors:
<br>
<br>
<ul>
<code>vec(ptr_aux_mem, number_of_elements, copy_aux_mem = true, strict = false)</code>
<br>
<br>
<ul>
Create a column vector using data from writable auxiliary (external) memory, where <i>ptr_aux_mem</i> is a pointer to the memory.
By default the vector allocates its own memory and copies data from the auxiliary memory (for safety).
However, if <i>copy_aux_mem</i> is set to <i>false</i>,
the vector will instead directly use the auxiliary memory (ie. no copying);
this is faster, but can be dangerous unless you know what you are doing!
<br>
<br>
The <i>strict</i> parameter comes into effect only when <i>copy_aux_mem</i> is set to <i>false</i>
(ie. the vector is directly using auxiliary memory)
<ul>
<li>
when <i>strict</i> is set to <i>false</i>, the vector will use the auxiliary memory until a size change
</li>