-
Notifications
You must be signed in to change notification settings - Fork 0
/
armadillo-ref.html
13451 lines (12958 loc) · 376 KB
/
armadillo-ref.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">
<html><head>
<meta content="text/html; charset=windows-1252" http-equiv="Content-Type">
<link rel="icon" href="http://arma.sourceforge.net/img/armadillo_icon.png" type="image/png">
<link type="text/css" rel="stylesheet" href="Armadillo:%20C++%20linear%20algebra%20library_files/style.css">
<title>Armadillo: C++ linear algebra library</title>
<script src="Armadillo:%20C++%20linear%20algebra%20library_files/ga.js" async="" type="text/javascript"></script><script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20358374-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div style="height: 110%;">
<center>
<table style="text-align: left; width: 70%; margin-left: auto; margin-right: auto;" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top;">
<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: middle; width: 250px;">
<img style="width: 248px; height: 86px;" alt="armadillo" src="Armadillo:%20C++%20linear%20algebra%20library_files/armadillo_logo.png" align="middle"><br>
</td>
<td style="vertical-align: middle; width: 50%;">
<big><big>
<big>
<span style="font-weight: bold;">Armadillo</span>
</big>
<br>
C++ linear algebra library
</big></big>
<br>
</td>
<td>
</td>
<td style="vertical-align: top;"><br>
</td>
<td style="text-align: right;">
<table style="text-align: right;" align="right" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
</td>
<td style="vertical-align: middle;">
<a href="http://nicta.com.au/about"><img src="Armadillo:%20C++%20linear%20algebra%20library_files/NICTA_logo_small_quant.png" width="62" height="74" border="0"></a>
</td>
<!--
<td>
</td>
<td style="vertical-align: middle;">
<a href="http://www.qut.edu.au/about/the-university"><img src="img/QUT_scaled_72x72.png" border="0" height="72" width="72"></a>
</td>
-->
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table style="text-align: left; width: 100%; border-top: 2px solid rgb(204, 204, 204); border-bottom: 2px solid rgb(204, 204, 204);" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top; width: 70%;">
<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="vertical-align: top;">
<table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="0">
<tbody>
<tr>
<td style="width: 14%; text-align: center; font-weight: bold; color: rgb(204, 204, 204);"><a href="http://arma.sourceforge.net/" class="menu">About</a><br>
</td>
<td style="width: 14%; text-align: center; font-weight: bold; color: rgb(204, 204, 204);"><a href="http://arma.sourceforge.net/license.html" class="menu">License</a><br>
</td>
<td style="width: 14%; text-align: center; font-weight: bold; color: rgb(204, 204, 204);"><a href="http://arma.sourceforge.net/faq.html" class="menu">Questions</a><br>
</td>
<td style="width: 14%; text-align: center; font-weight: bold; background-color: rgb(204, 204, 204);">API Docs<br>
</td>
<td style="width: 14%; text-align: center; font-weight: bold; color: rgb(204, 204, 204);"><a href="http://arma.sourceforge.net/speed.html" class="menu">Speed</a><br>
</td>
<td style="width: 14%; text-align: center; font-weight: bold; color: rgb(204, 204, 204);"><a href="http://arma.sourceforge.net/contact.html" class="menu">Authors</a><br>
</td>
<td style="width: 14%; text-align: center; font-weight: bold; color: rgb(204, 204, 204);"><a href="http://arma.sourceforge.net/download.html" class="menu">Download</a><br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top;">
<br>
<a name="top"></a>
<!-- -->
<a style="display:scroll; position:fixed; bottom:5px; right:5px;" href="#top"><font size="-1">[top]</font></a>
<br>
<center><font size="+1"><b>API Reference for Armadillo 4.600</b></font></center>
<br>
<!-- BEGIN CONTENT -->
<b>Preamble</b>
<br>
<br>
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="text-align: left; vertical-align: top; width: 50%;">
<ul>
<li>
To aid the conversion of Matlab/Octave programs,
see the <a href="#syntax">syntax conversion table</a>
</li>
<br>
<li>
First time users may want to have a look at a 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/faq.html">report them</a>
</li>
<br>
<li>
Notes on <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: 45%;">
<ul>
<li>
Please cite the following tech report 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.
<br>
<i><a href="http://arma.sourceforge.net/armadillo_nicta_2010.pdf">Armadillo: An Open Source C++ Linear Algebra Library for Fast Prototyping and Computationally Intensive Experiments</a></i>.
<br>
Technical Report, NICTA, 2010.
</font>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
<br>
<br>
<b>Overview</b>
<ul>
<li><a href="#part_a">matrix, vector, cube and field classes</a></li>
<li><a href="#part_b">member functions & variables</a></li>
<br>
<li><a href="#part_c">generated vectors / matrices / cubes</a></li>
<li><a href="#part_d">functions of vectors / matrices / cubes</a></li>
<li><a href="#part_e">decompositions, factorisations, inverses and equation solvers</a></li>
<br>
<li><a href="#part_f">gaussian mixture model and running statistics</a></li>
<li><a href="#part_g">miscellaneous (constants, configuration)</a></li>
</ul>
<br>
<a name="part_a"></a>
<b>Matrix, Vector, Cube and Field Classes</b>
<ul>
<table>
<tbody>
<tr><td><a href="#Mat">Mat<<i>type</i>>, mat and cx_mat</a></td><td> </td><td>dense matrix class</td></tr>
<tr><td><a href="#Col">Col<<i>type</i>>, colvec and 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</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 and sp_cx_mat</a></td><td> </td><td>sparse matrix class</td></tr>
</tbody>
</table>
</ul>
<br>
<a name="part_b"></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="#operators">operators</a></td><td> </td><td><code><big>+</big> <big>-</big> <big>*</big> / % == != <= >= < ></code></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><a href="#transform">.transform</a></td><td> </td><td>transform each element via 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="#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</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, and optionally its location</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_finite_member">.is_finite</a></td><td> </td><td>check whether all elements are finite</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><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_c"></a>
<b>Generated Vectors/Matrices/Cubes</b>
<ul>
<table>
<tbody>
<tr style="background-color: #EEEEEE;"><td><a href="#eye_standalone">eye</a></td><td> </td><td>generate identity matrix</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#linspace">linspace</a></td><td> </td><td>generate vector with linearly increasing elements</td></tr>
<tr style="background-color: #EEEEEE;"><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><td><a href="#speye">speye</a></td><td> </td><td>generate sparse identity matrix</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#spones">spones</a></td><td> </td><td>generate sparse matrix with non-zero elements set to one</td></tr>
<tr style="background-color: #EEEEEE;"><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 style="background-color: #EEEEEE;"><td><a href="#toeplitz">toeplitz</a></td><td> </td><td>generate Toeplitz matrix</td></tr>
<tr><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_d"></a>
<b>Functions of Vectors/Matrices/Cubes</b>
<ul>
<table>
<tbody>
<tr style="background-color: #EEEEEE;"><td><a href="#abs">abs</a></td><td> </td><td>obtain magnitude of each element</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#accu">accu</a></td><td> </td><td>accumulate (sum) all elements</td></tr>
<tr style="background-color: #EEEEEE;"><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 statisfies a relational condition</td></tr>
<tr><td><a href="#as_scalar">as_scalar</a></td><td> </td><td>convert 1x1 matrix to pure scalar</td></tr>
<tr><td><a href="#clamp">clamp</a></td><td> </td><td>obtain clamped elements according to given limits</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#cond">cond</a></td><td> </td><td>condition number of matrix</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#conj">conj</a></td><td> </td><td>obtain complex conjugate of each element</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#conv">conv</a></td><td> </td><td>convolution of vectors</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="#cor">cor</a></td><td> </td><td>correlation</td></tr>
<tr><td><a href="#cov">cov</a></td><td> </td><td>covariance</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#cross">cross</a></td><td> </td><td>cross product</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#cumsum">cumsum</a></td><td> </td><td>cumulative sum</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#det">det / log_det</a></td><td> </td><td>determinant</td></tr>
<tr><td><a href="#diagmat">diagmat</a></td><td> </td><td>interpret matrix as diagonal</td></tr>
<tr><td><a href="#diagvec">diagvec</a></td><td> </td><td>extract specified diagonal</td></tr>
<tr><td><a href="#dot">dot/cdot/norm_dot</a></td><td> </td><td>dot product</td></tr>
<tr style="background-color: #EEEEEE;"><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: #EEEEEE;"><td><a href="#expmat">expmat</a></td><td> </td><td>matrix exponential</td></tr>
<tr style="background-color: #EEEEEE;"><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><td><a href="#flip">fliplr / flipud</a></td><td> </td><td>reverse order of columns or rows</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#hist">hist</a></td><td> </td><td>histogram of counts</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#histc">histc</a></td><td> </td><td>histogram of counts with user specified edges</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#imag_real">imag / real</a></td><td> </td><td>extract imaginary/real part</td></tr>
<tr><td><a href="#inplace_trans">inplace_trans</a></td><td> </td><td>in-place transpose</td></tr>
<tr><td><a href="#is_finite">is_finite</a></td><td> </td><td>check whether all elements are finite</td></tr>
<tr><td><a href="#join">join_rows/cols/slices</a></td><td> </td><td>concatenation of matrices or cubes</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#kron">kron</a></td><td> </td><td>Kronecker tensor product</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#min_and_max">min / max</a></td><td> </td><td>return extremum values</td></tr>
<tr style="background-color: #EEEEEE;"><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: #EEEEEE;"><td><a href="#repmat">repmat</a></td><td> </td><td>replicate matrix in block-like fashion</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#reshape">reshape</a></td><td> </td><td>change size while keeping elements</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#resize">resize</a></td><td> </td><td>change size while keeping elements and preserving layout</td></tr>
<tr><td><a href="#shuffle">shuffle</a></td><td> </td><td>randomly shuffle elements</td></tr>
<tr><td><a href="#sort">sort</a></td><td> </td><td>sort elements</td></tr>
<tr><td><a href="#sort_index">sort_index</a></td><td> </td><td>vector describing sorted order of elements</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#sum">sum</a></td><td> </td><td>sum of elements</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#symmat">symmatu / symmatl</a></td><td> </td><td>interpret matrix as symmetric</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#trace">trace</a></td><td> </td><td>sum of diagonal elements of square matrix</td></tr>
<tr><td><a href="#trans">trans</a></td><td> </td><td>transpose of matrix</td></tr>
<tr><td><a href="#trimat">trimatu / trimatl</a></td><td> </td><td>interpret matrix as triangular</td></tr>
<tr><td><a href="#unique">unique</a></td><td> </td><td>return unique elements</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#vectorise">vectorise</a></td><td> </td><td>convert matrix to vector</td></tr>
<tr style="background-color: #EEEEEE;"><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 style="background-color: #EEEEEE;"><td><a href="#trig_fns">trig functions</a></td><td> </td><td>trigonometric element-wise functions: cos, sin, ...</td></tr>
<tr><td><a href="#stats_fns">stats functions</a></td><td> </td><td>statistics functions: mean, median, standard deviation, variance</td></tr>
</tbody>
</table>
</ul>
<br>
<a name="part_e"></a>
<b>Decompositions, Factorisations, Inverses and Equation Solvers</b>
<ul>
<table>
<tbody>
<tr style="background-color: #EEEEEE;"><td><a href="#chol">chol</a></td><td> </td><td>Cholesky decomposition</td></tr>
<tr style="background-color: #EEEEEE;"><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: #EEEEEE;"><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="#eigs_sym">eigs_sym</a></td><td> </td><td>limited number of eigenvalues & eigenvectors of sparse symmetric real matrix</td></tr>
<tr><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 style="background-color: #EEEEEE;"><td><a href="#fft">fft / ifft</a></td><td> </td><td>1D fast Fourier transform and its inverse</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#fft2">fft2 / ifft2</a></td><td> </td><td>2D fast Fourier transform and its inverse</td></tr>
<tr style="background-color: #EEEEEE;"><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><td><a href="#lu">lu </a></td><td> </td><td>lower-upper decomposition</td></tr>
<tr><td><a href="#pinv">pinv</a></td><td> </td><td>pseudo-inverse</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#princomp">princomp</a></td><td> </td><td>principal component analysis</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#qr">qr </a></td><td> </td><td>QR decomposition</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#qr_econ">qr_econ</a></td><td> </td><td>economical QR decomposition</td></tr>
<tr><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 style="background-color: #EEEEEE;"><td><a href="#syl">syl</a></td><td> </td><td>Sylvester equation solver</td></tr>
</tbody>
</table>
</ul>
<br>
<a name="part_f"></a>
<b>Statistical Modelling</b>
<ul>
<table>
<tbody>
<tr><td><a href="#gmm_diag">gmm_diag</a></td><td> </td><td>model data as a Gaussian Mixture Model (GMM) with diagonal covariance matrices</td></tr>
<tr><td><a href="#running_stat">running_stat</a></td><td> </td><td>running statistics of a continuously sampled one dimensional process/signal</td></tr>
<tr><td><a href="#running_stat_vec">running_stat_vec</a></td><td> </td><td>running statistics of a continuously sampled multi-dimensional process/signal</td></tr>
</tbody>
</table>
</ul>
<br>
<a name="part_g"></a>
<b>Miscellaneous</b>
<ul>
<table>
<tbody>
<tr style="background-color: #EEEEEE;"><td><a href="#constants">constants</a></td><td> </td><td>pi, inf, NaN, speed of light, ...</td></tr>
<tr style="background-color: #EEEEEE;"><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: #EEEEEE;"><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: #EEEEEE;"><td><a href="#example_prog">example program</a></td><td> </td><td>short example program</td></tr>
<tr style="background-color: #EEEEEE;"><td><a href="#config_hpp">config.hpp</a></td><td> </td><td>configuration options</td></tr>
<tr style="background-color: #EEEEEE;"><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>
<hr class="greyline">
<hr class="greyline">
<br>
<br>
<font size="+1"><b>Matrix, Vector, Cube and Field Classes</b></font>
<br>
<br>
<hr class="greyline">
<br>
<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(n_rows, n_cols)</code>
<br><code>mat(n_rows, n_cols, fill_type)</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(string)</code>
<br><code>mat(std::vector)</code> (treated as a column vector)
<br><code>mat(initialiser_list)</code> (C++11 only)
<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 the format string <code>"1 0; 0 1"</code>.
While string based initialisation is compact,
it is considerably faster to directly <a href="#element_access">set the elements</a>,
use <a href="#element_initialisation">element initialisation</a>,
or use C++11 initialiser lists.
</li>
<br>
<a name="adv_constructors_mat"></a>
<li>
Advanced constructors:
<br>
<br>
<ul>
<code>mat(*aux_mem, n_rows, n_cols, copy_aux_mem = true, strict = true)</code>
<br>
<br>
<ul>
Create a matrix using data from writable auxiliary (external) 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're doing!
<br>
<br>
The <i>strict</i> variable comes into effect only if <i>copy_aux_mem</i> is set to <i>false</i>
(ie. the matrix is directly using auxiliary memory).
If <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 (directly or indirectly).
If <i>strict</i> is set to <i>false</i>, the matrix will not be bound to the auxiliary memory for its lifetime,
ie., the size of the matrix can be changed.
If the requested number of elements is different to the size of the auxiliary memory,
new memory will be allocated and the auxiliary memory will no longer be used.
</ul>
<br>
<code>mat(const *aux_mem, n_rows, n_cols)</code>
<br>
<br>
<ul>
Create a matrix by copying data from read-only auxiliary 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 *aux_mem)</code>
<br>
<br>
<ul>
Create a fixed size matrix, with the size specified via template arguments,
and copying data from auxiliary memory.
</ul>
</ul>
</li>
<br>
<br>
<li>
Examples:
<ul>
<pre>mat A = randu<mat>(5,5);
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 E(4,5, fill::zeros);
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><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><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>
<hr class="greyline"><br>
<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(n_elem)</code>
<br><code>vec(n_elem, fill_type)</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(string)</code> (elements separated by spaces)
<br><code>vec(std::vector)</code>
<br><code>vec(initialiser_list)</code> (C++11 only)
</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(*aux_mem, number_of_elements, copy_aux_mem = true, strict = true)</code>
<br>
<br>
<ul>
Create a column vector using data from writable auxiliary (external) 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're doing!
<br>
<br>
The <i>strict</i> variable comes into effect only if <i>copy_aux_mem</i> is set to <i>false</i>
(ie. the vector is directly using auxiliary memory).
If <i>strict</i> is set to <i>true</i>,
the vector will be bound to the auxiliary memory for its lifetime;
the number of elements in the vector can't be changed (directly or indirectly).
If <i>strict</i> is set to <i>false</i>, the vector will not be bound to the auxiliary memory for its lifetime,
ie., the vector's size can be changed.
If the requested number of elements is different to the size of the auxiliary memory,
new memory will be allocated and the auxiliary memory will no longer be used.
</ul>
<br>
<code>vec(const *aux_mem, number_of_elements)</code>
<br>
<br>
<ul>
Create a column vector by copying data from read-only auxiliary memory.
</ul>
<a name="adv_constructors_col_fixed"></a>
<br>
<code>vec::fixed<number_of_elements></code>
<br>
<br>
<ul>
Create a fixed size column vector, with the size specified via the
template argument.
Memory for the vector is allocated at compile time.
This is generally faster than dynamic memory allocation, but the size of
the vector can't be changed afterwards (directly or indirectly).
<br>
<br>
For convenience, there are several pre-defined typedefs for each vector type
(where the types are: <i>uvec</i>, <i>ivec</i>, <i>fvec</i>, <i>vec</i>, <i>cx_fvec</i>, <i>cx_vec</i> as well as the corresponding <i>colvec</i> versions).
The pre-defined typedefs specify vector sizes ranging from 2 to 9.
The typedefs were defined by simply appending a single digit form of the size to the vector type
-- for example, <i>vec3</i> is equivalent to <i>vec::fixed<3></i>,
while <i>cx_vec4</i> is equivalent to <i>cx_vec::fixed<4></i>.
</ul>
<br>
<code>vec::fixed<number_of_elements>(const *aux_mem)</code>
<br>
<br>
<ul>
Create a fixed size column vector, with the size specified via the template argument,
and copying data from auxiliary memory.
</ul>
</ul>
</li>
<br>
<br>
<li>
Examples:
<ul>
<pre>vec x(10);
vec y = zeros<vec>(10);
mat A = randu<mat>(10,10);
vec z = A.col(5); // extract a column vector
</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 column vector with every element equal to 123.0:
<ul>
<pre>vec a(5); a = 123.0;
</pre>
</ul>
Use the following code instead:
<ul>
<pre>vec a(5); a.fill(123.0);
</pre>
</ul>
</li>
<br>
<li>See also:
<ul>
<li><a href="#element_initialisation">element initialisation</a></li>
<li><a href="#Mat">Mat class</a></li>
<li><a href="#Row">Row class</a></li>
</ul>
</li>
<br>
</ul>
<hr class="greyline"><br>
<a name="Row"></a>
<b>Row<</b><i>type</i><b>></b>
<br><b>rowvec</b>
<br><b>cx_rowvec</b>
<ul>
<li>
Classes for row vectors (matrices with one row)
</li>
<br>
<li>The template <b>Row<</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>rowvec</code>
</td>
<td style="vertical-align: top;">
=
</td>
<td style="vertical-align: top;">
<code>Row<double></code>