comparison armadillo-2.4.4/include/armadillo_bits/Col_meat.hpp @ 0:8b6102e2a9b0

Armadillo Library
author maxzanoni76 <max.zanoni@eecs.qmul.ac.uk>
date Wed, 11 Apr 2012 09:27:06 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:8b6102e2a9b0
1 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
2 // Copyright (C) 2008-2011 Conrad Sanderson
3 //
4 // This file is part of the Armadillo C++ library.
5 // It is provided without any warranty of fitness
6 // for any purpose. You can redistribute this file
7 // and/or modify it under the terms of the GNU
8 // Lesser General Public License (LGPL) as published
9 // by the Free Software Foundation, either version 3
10 // of the License or (at your option) any later version.
11 // (see http://www.opensource.org/licenses for more info)
12
13
14 //! \addtogroup Col
15 //! @{
16
17
18 //! construct an empty column vector
19 template<typename eT>
20 inline
21 Col<eT>::Col()
22 : Mat<eT>(0, 1)
23 {
24 arma_extra_debug_sigprint();
25
26 access::rw(Mat<eT>::vec_state) = 1;
27 }
28
29
30
31 template<typename eT>
32 inline
33 Col<eT>::Col(const Col<eT>& X)
34 : Mat<eT>(X.n_elem, 1)
35 {
36 arma_extra_debug_sigprint();
37
38 access::rw(Mat<eT>::vec_state) = 1;
39
40 arrayops::copy((*this).memptr(), X.memptr(), X.n_elem);
41 }
42
43
44
45 //! construct a column vector with the specified number of n_elem
46 template<typename eT>
47 inline
48 Col<eT>::Col(const uword in_n_elem)
49 : Mat<eT>(in_n_elem, 1)
50 {
51 arma_extra_debug_sigprint();
52
53 access::rw(Mat<eT>::vec_state) = 1;
54 }
55
56
57
58 template<typename eT>
59 inline
60 Col<eT>::Col(const uword in_n_rows, const uword in_n_cols)
61 {
62 arma_extra_debug_sigprint();
63
64 access::rw(Mat<eT>::vec_state) = 1;
65
66 Mat<eT>::init_warm(in_n_rows, in_n_cols);
67 }
68
69
70
71 //! construct a column vector from specified text
72 template<typename eT>
73 inline
74 Col<eT>::Col(const char* text)
75 {
76 arma_extra_debug_sigprint();
77
78 access::rw(Mat<eT>::vec_state) = 2;
79
80 Mat<eT>::operator=(text);
81
82 std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
83
84 access::rw(Mat<eT>::vec_state) = 1;
85 }
86
87
88
89 //! construct a column vector from specified text
90 template<typename eT>
91 inline
92 const Col<eT>&
93 Col<eT>::operator=(const char* text)
94 {
95 arma_extra_debug_sigprint();
96
97 access::rw(Mat<eT>::vec_state) = 2;
98
99 Mat<eT>::operator=(text);
100
101 std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
102
103 access::rw(Mat<eT>::vec_state) = 1;
104
105 return *this;
106 }
107
108
109
110 //! construct a column vector from specified text
111 template<typename eT>
112 inline
113 Col<eT>::Col(const std::string& text)
114 {
115 arma_extra_debug_sigprint();
116
117 access::rw(Mat<eT>::vec_state) = 2;
118
119 Mat<eT>::operator=(text);
120
121 std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
122
123 access::rw(Mat<eT>::vec_state) = 1;
124 }
125
126
127
128 //! construct a column vector from specified text
129 template<typename eT>
130 inline
131 const Col<eT>&
132 Col<eT>::operator=(const std::string& text)
133 {
134 arma_extra_debug_sigprint();
135
136 access::rw(Mat<eT>::vec_state) = 2;
137
138 Mat<eT>::operator=(text);
139
140 std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
141
142 access::rw(Mat<eT>::vec_state) = 1;
143
144 return *this;
145 }
146
147
148
149 #if defined(ARMA_USE_CXX11)
150
151 template<typename eT>
152 inline
153 Col<eT>::Col(const std::initializer_list<eT>& list)
154 {
155 arma_extra_debug_sigprint();
156
157 access::rw(Mat<eT>::vec_state) = 2;
158
159 Mat<eT>::operator=(list);
160
161 std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
162
163 access::rw(Mat<eT>::vec_state) = 1;
164 }
165
166
167
168 template<typename eT>
169 inline
170 const Col<eT>&
171 Col<eT>::operator=(const std::initializer_list<eT>& list)
172 {
173 arma_extra_debug_sigprint();
174
175 access::rw(Mat<eT>::vec_state) = 2;
176
177 Mat<eT>::operator=(list);
178
179 std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
180
181 access::rw(Mat<eT>::vec_state) = 1;
182
183 return *this;
184 }
185
186 #endif
187
188
189
190 template<typename eT>
191 inline
192 const Col<eT>&
193 Col<eT>::operator=(const eT val)
194 {
195 arma_extra_debug_sigprint();
196
197 Mat<eT>::operator=(val);
198
199 return *this;
200 }
201
202
203
204 template<typename eT>
205 template<typename T1>
206 inline
207 Col<eT>::Col(const Base<eT,T1>& X)
208 {
209 arma_extra_debug_sigprint();
210
211 access::rw(Mat<eT>::vec_state) = 1;
212
213 Mat<eT>::operator=(X.get_ref());
214 }
215
216
217
218 template<typename eT>
219 template<typename T1>
220 inline
221 const Col<eT>&
222 Col<eT>::operator=(const Base<eT,T1>& X)
223 {
224 arma_extra_debug_sigprint();
225
226 Mat<eT>::operator=(X.get_ref());
227
228 return *this;
229 }
230
231
232
233 //! construct a column vector from a given auxiliary array of eTs
234 template<typename eT>
235 inline
236 Col<eT>::Col(eT* aux_mem, const uword aux_length, const bool copy_aux_mem, const bool strict)
237 : Mat<eT>(aux_mem, aux_length, 1, copy_aux_mem, strict)
238 {
239 arma_extra_debug_sigprint();
240
241 access::rw(Mat<eT>::vec_state) = 1;
242 }
243
244
245
246 //! construct a column vector from a given auxiliary array of eTs
247 template<typename eT>
248 inline
249 Col<eT>::Col(const eT* aux_mem, const uword aux_length)
250 : Mat<eT>(aux_mem, aux_length, 1)
251 {
252 arma_extra_debug_sigprint();
253
254 access::rw(Mat<eT>::vec_state) = 1;
255 }
256
257
258
259 template<typename eT>
260 template<typename T1, typename T2>
261 inline
262 Col<eT>::Col
263 (
264 const Base<typename Col<eT>::pod_type, T1>& A,
265 const Base<typename Col<eT>::pod_type, T2>& B
266 )
267 {
268 arma_extra_debug_sigprint();
269
270 access::rw(Mat<eT>::vec_state) = 1;
271
272 Mat<eT>::init(A,B);
273 }
274
275
276
277 template<typename eT>
278 template<typename T1>
279 inline
280 Col<eT>::Col(const BaseCube<eT,T1>& X)
281 {
282 arma_extra_debug_sigprint();
283
284 access::rw(Mat<eT>::vec_state) = 1;
285
286 Mat<eT>::operator=(X);
287 }
288
289
290
291 template<typename eT>
292 template<typename T1>
293 inline
294 const Col<eT>&
295 Col<eT>::operator=(const BaseCube<eT,T1>& X)
296 {
297 arma_extra_debug_sigprint();
298
299 Mat<eT>::operator=(X);
300
301 return *this;
302 }
303
304
305
306 template<typename eT>
307 inline
308 Col<eT>::Col(const subview_cube<eT>& X)
309 {
310 arma_extra_debug_sigprint();
311
312 access::rw(Mat<eT>::vec_state) = 1;
313
314 Mat<eT>::operator=(X);
315 }
316
317
318
319 template<typename eT>
320 inline
321 const Col<eT>&
322 Col<eT>::operator=(const subview_cube<eT>& X)
323 {
324 arma_extra_debug_sigprint();
325
326 Mat<eT>::operator=(X);
327
328 return *this;
329 }
330
331
332
333 template<typename eT>
334 inline
335 mat_injector< Col<eT> >
336 Col<eT>::operator<<(const eT val)
337 {
338 return mat_injector< Col<eT> >(*this, val);
339 }
340
341
342
343 template<typename eT>
344 arma_inline
345 eT&
346 Col<eT>::row(const uword row_num)
347 {
348 arma_debug_check( (row_num >= Mat<eT>::n_rows), "Col::row(): out of bounds" );
349
350 return access::rw(Mat<eT>::mem[row_num]);
351 }
352
353
354
355 template<typename eT>
356 arma_inline
357 eT
358 Col<eT>::row(const uword row_num) const
359 {
360 arma_debug_check( (row_num >= Mat<eT>::n_rows), "Col::row(): out of bounds" );
361
362 return Mat<eT>::mem[row_num];
363 }
364
365
366
367 template<typename eT>
368 arma_inline
369 subview_col<eT>
370 Col<eT>::rows(const uword in_row1, const uword in_row2)
371 {
372 arma_extra_debug_sigprint();
373
374 arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used");
375
376 const uword subview_n_rows = in_row2 - in_row1 + 1;
377
378 return subview_col<eT>(*this, 0, in_row1, subview_n_rows);
379 }
380
381
382
383 template<typename eT>
384 arma_inline
385 const subview_col<eT>
386 Col<eT>::rows(const uword in_row1, const uword in_row2) const
387 {
388 arma_extra_debug_sigprint();
389
390 arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used");
391
392 const uword subview_n_rows = in_row2 - in_row1 + 1;
393
394 return subview_col<eT>(*this, 0, in_row1, subview_n_rows);
395 }
396
397
398
399 template<typename eT>
400 arma_inline
401 subview_col<eT>
402 Col<eT>::subvec(const uword in_row1, const uword in_row2)
403 {
404 arma_extra_debug_sigprint();
405
406 arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used");
407
408 const uword subview_n_rows = in_row2 - in_row1 + 1;
409
410 return subview_col<eT>(*this, 0, in_row1, subview_n_rows);
411 }
412
413
414
415 template<typename eT>
416 arma_inline
417 const subview_col<eT>
418 Col<eT>::subvec(const uword in_row1, const uword in_row2) const
419 {
420 arma_extra_debug_sigprint();
421
422 arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used");
423
424 const uword subview_n_rows = in_row2 - in_row1 + 1;
425
426 return subview_col<eT>(*this, 0, in_row1, subview_n_rows);
427 }
428
429
430
431 template<typename eT>
432 arma_inline
433 subview_col<eT>
434 Col<eT>::subvec(const span& row_span)
435 {
436 arma_extra_debug_sigprint();
437
438 const bool row_all = row_span.whole;
439
440 const uword local_n_rows = Mat<eT>::n_rows;
441
442 const uword in_row1 = row_all ? 0 : row_span.a;
443 const uword in_row2 = row_span.b;
444 const uword subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
445
446 arma_debug_check( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly used");
447
448 return subview_col<eT>(*this, 0, in_row1, subvec_n_rows);
449 }
450
451
452
453 template<typename eT>
454 arma_inline
455 const subview_col<eT>
456 Col<eT>::subvec(const span& row_span) const
457 {
458 arma_extra_debug_sigprint();
459
460 const bool row_all = row_span.whole;
461
462 const uword local_n_rows = Mat<eT>::n_rows;
463
464 const uword in_row1 = row_all ? 0 : row_span.a;
465 const uword in_row2 = row_span.b;
466 const uword subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
467
468 arma_debug_check( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly used");
469
470 return subview_col<eT>(*this, 0, in_row1, subvec_n_rows);
471 }
472
473
474
475 // template<typename eT>
476 // arma_inline
477 // subview_col<eT>
478 // Col<eT>::operator()(const span& row_span)
479 // {
480 // arma_extra_debug_sigprint();
481 //
482 // return subvec(row_span);
483 // }
484 //
485 //
486 //
487 // template<typename eT>
488 // arma_inline
489 // const subview_col<eT>
490 // Col<eT>::operator()(const span& row_span) const
491 // {
492 // arma_extra_debug_sigprint();
493 //
494 // return subvec(row_span);
495 // }
496
497
498
499 //! remove specified row
500 template<typename eT>
501 inline
502 void
503 Col<eT>::shed_row(const uword row_num)
504 {
505 arma_extra_debug_sigprint();
506
507 arma_debug_check( row_num >= Mat<eT>::n_rows, "Col::shed_row(): out of bounds");
508
509 shed_rows(row_num, row_num);
510 }
511
512
513
514 //! remove specified rows
515 template<typename eT>
516 inline
517 void
518 Col<eT>::shed_rows(const uword in_row1, const uword in_row2)
519 {
520 arma_extra_debug_sigprint();
521
522 arma_debug_check
523 (
524 (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows),
525 "Col::shed_rows(): indices out of bounds or incorrectly used"
526 );
527
528 const uword n_keep_front = in_row1;
529 const uword n_keep_back = Mat<eT>::n_rows - (in_row2 + 1);
530
531 Col<eT> X(n_keep_front + n_keep_back);
532
533 eT* X_mem = X.memptr();
534 const eT* t_mem = (*this).memptr();
535
536 if(n_keep_front > 0)
537 {
538 arrayops::copy( X_mem, t_mem, n_keep_front );
539 }
540
541 if(n_keep_back > 0)
542 {
543 arrayops::copy( &(X_mem[n_keep_front]), &(t_mem[in_row2+1]), n_keep_back);
544 }
545
546 Mat<eT>::steal_mem(X);
547 }
548
549
550
551 //! insert N rows at the specified row position,
552 //! optionally setting the elements of the inserted rows to zero
553 template<typename eT>
554 inline
555 void
556 Col<eT>::insert_rows(const uword row_num, const uword N, const bool set_to_zero)
557 {
558 arma_extra_debug_sigprint();
559
560 const uword t_n_rows = Mat<eT>::n_rows;
561
562 const uword A_n_rows = row_num;
563 const uword B_n_rows = t_n_rows - row_num;
564
565 // insertion at row_num == n_rows is in effect an append operation
566 arma_debug_check( (row_num > t_n_rows), "Col::insert_rows(): out of bounds");
567
568 if(N > 0)
569 {
570 Col<eT> out(t_n_rows + N);
571
572 eT* out_mem = out.memptr();
573 const eT* t_mem = (*this).memptr();
574
575 if(A_n_rows > 0)
576 {
577 arrayops::copy( out_mem, t_mem, A_n_rows );
578 }
579
580 if(B_n_rows > 0)
581 {
582 arrayops::copy( &(out_mem[row_num + N]), &(t_mem[row_num]), B_n_rows );
583 }
584
585 if(set_to_zero == true)
586 {
587 arrayops::inplace_set( &(out_mem[row_num]), eT(0), N );
588 }
589
590 Mat<eT>::steal_mem(out);
591 }
592 }
593
594
595
596 //! insert the given object at the specified row position;
597 //! the given object must have one column
598 template<typename eT>
599 template<typename T1>
600 inline
601 void
602 Col<eT>::insert_rows(const uword row_num, const Base<eT,T1>& X)
603 {
604 arma_extra_debug_sigprint();
605
606 Mat<eT>::insert_rows(row_num, X);
607 }
608
609
610
611 template<typename eT>
612 inline
613 typename Col<eT>::row_iterator
614 Col<eT>::begin_row(const uword row_num)
615 {
616 arma_extra_debug_sigprint();
617
618 arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out of bounds");
619
620 return Mat<eT>::memptr() + row_num;
621 }
622
623
624
625 template<typename eT>
626 inline
627 typename Col<eT>::const_row_iterator
628 Col<eT>::begin_row(const uword row_num) const
629 {
630 arma_extra_debug_sigprint();
631
632 arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out of bounds");
633
634 return Mat<eT>::memptr() + row_num;
635 }
636
637
638
639 template<typename eT>
640 inline
641 typename Col<eT>::row_iterator
642 Col<eT>::end_row(const uword row_num)
643 {
644 arma_extra_debug_sigprint();
645
646 arma_debug_check( (row_num >= Mat<eT>::n_rows), "end_row(): index out of bounds");
647
648 return Mat<eT>::memptr() + row_num + 1;
649 }
650
651
652
653 template<typename eT>
654 inline
655 typename Col<eT>::const_row_iterator
656 Col<eT>::end_row(const uword row_num) const
657 {
658 arma_extra_debug_sigprint();
659
660 arma_debug_check( (row_num >= Mat<eT>::n_rows), "end_row(): index out of bounds");
661
662 return Mat<eT>::memptr() + row_num + 1;
663 }
664
665
666
667 template<typename eT>
668 template<uword fixed_n_elem>
669 arma_inline
670 void
671 Col<eT>::fixed<fixed_n_elem>::mem_setup()
672 {
673 arma_extra_debug_sigprint();
674
675 access::rw(Mat<eT>::n_rows) = fixed_n_elem;
676 access::rw(Mat<eT>::n_cols) = 1;
677 access::rw(Mat<eT>::n_elem) = fixed_n_elem;
678 access::rw(Mat<eT>::vec_state) = 1;
679 access::rw(Mat<eT>::mem_state) = 3;
680 access::rw(Mat<eT>::mem) = (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
681 }
682
683
684
685 template<typename eT>
686 template<uword fixed_n_elem>
687 arma_inline
688 void
689 Col<eT>::fixed<fixed_n_elem>::change_to_row()
690 {
691 arma_extra_debug_sigprint();
692
693 access::rw(Mat<eT>::n_cols) = fixed_n_elem;
694 access::rw(Mat<eT>::n_rows) = 1;
695 }
696
697
698
699 template<typename eT>
700 template<uword fixed_n_elem>
701 arma_inline
702 Col<eT>::fixed<fixed_n_elem>::fixed()
703 {
704 arma_extra_debug_sigprint_this(this);
705
706 mem_setup();
707 }
708
709
710
711 template<typename eT>
712 template<uword fixed_n_elem>
713 arma_inline
714 Col<eT>::fixed<fixed_n_elem>::fixed(const fixed<fixed_n_elem>& X)
715 {
716 arma_extra_debug_sigprint_this(this);
717
718 mem_setup();
719
720 eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
721
722 arrayops::copy( dest, X.mem, fixed_n_elem );
723 }
724
725
726
727 template<typename eT>
728 template<uword fixed_n_elem>
729 inline
730 Col<eT>::fixed<fixed_n_elem>::fixed(const subview_cube<eT>& X)
731 {
732 arma_extra_debug_sigprint_this(this);
733
734 mem_setup();
735
736 Col<eT>::operator=(X);
737 }
738
739
740
741 template<typename eT>
742 template<uword fixed_n_elem>
743 template<typename T1>
744 inline
745 Col<eT>::fixed<fixed_n_elem>::fixed(const Base<eT,T1>& A)
746 {
747 arma_extra_debug_sigprint_this(this);
748
749 mem_setup();
750
751 Col<eT>::operator=(A.get_ref());
752 }
753
754
755
756 template<typename eT>
757 template<uword fixed_n_elem>
758 template<typename T1, typename T2>
759 inline
760 Col<eT>::fixed<fixed_n_elem>::fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B)
761 {
762 arma_extra_debug_sigprint_this(this);
763
764 mem_setup();
765
766 Col<eT>::init(A,B);
767 }
768
769
770
771 template<typename eT>
772 template<uword fixed_n_elem>
773 inline
774 Col<eT>::fixed<fixed_n_elem>::fixed(eT* aux_mem, const bool copy_aux_mem)
775 {
776 arma_extra_debug_sigprint_this(this);
777
778 access::rw(Mat<eT>::n_rows) = fixed_n_elem;
779 access::rw(Mat<eT>::n_cols) = 1;
780 access::rw(Mat<eT>::n_elem) = fixed_n_elem;
781 access::rw(Mat<eT>::vec_state) = 1;
782 access::rw(Mat<eT>::mem_state) = 3;
783
784 if(copy_aux_mem == true)
785 {
786 eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
787
788 access::rw(Mat<eT>::mem) = dest;
789
790 arrayops::copy( dest, aux_mem, fixed_n_elem );
791 }
792 else
793 {
794 access::rw(Mat<eT>::mem) = aux_mem;
795 }
796 }
797
798
799
800 template<typename eT>
801 template<uword fixed_n_elem>
802 inline
803 Col<eT>::fixed<fixed_n_elem>::fixed(const eT* aux_mem)
804 {
805 arma_extra_debug_sigprint_this(this);
806
807 mem_setup();
808
809 arrayops::copy( const_cast<eT*>(Mat<eT>::mem), aux_mem, fixed_n_elem );
810 }
811
812
813
814 //! NOTE: this function relies on
815 //! Col::operator=(text), to change vec_state as well as swapping n_rows and n_cols,
816 //! and Mat::init(), to check that the given vector will not have a different size than fixed_n_elem.
817 template<typename eT>
818 template<uword fixed_n_elem>
819 inline
820 Col<eT>::fixed<fixed_n_elem>::fixed(const char* text)
821 {
822 arma_extra_debug_sigprint_this(this);
823
824 mem_setup();
825
826 change_to_row();
827
828 Col<eT>::operator=(text);
829 }
830
831
832
833 //! NOTE: this function relies on
834 //! Col::operator=(text), to change vec_state as well as swapping n_rows and n_cols,
835 //! and Mat::init(), to check that the given vector will not have a different size than fixed_n_elem.
836 template<typename eT>
837 template<uword fixed_n_elem>
838 inline
839 Col<eT>::fixed<fixed_n_elem>::fixed(const std::string& text)
840 {
841 arma_extra_debug_sigprint_this(this);
842
843 mem_setup();
844
845 change_to_row();
846
847 Col<eT>::operator=(text);
848 }
849
850
851
852 template<typename eT>
853 template<uword fixed_n_elem>
854 template<typename T1>
855 const Col<eT>&
856 Col<eT>::fixed<fixed_n_elem>::operator=(const Base<eT,T1>& A)
857 {
858 arma_extra_debug_sigprint();
859
860 Col<eT>::operator=(A.get_ref());
861
862 return *this;
863 }
864
865
866
867 template<typename eT>
868 template<uword fixed_n_elem>
869 const Col<eT>&
870 Col<eT>::fixed<fixed_n_elem>::operator=(const eT val)
871 {
872 arma_extra_debug_sigprint();
873
874 Col<eT>::operator=(val);
875
876 return *this;
877 }
878
879
880
881 template<typename eT>
882 template<uword fixed_n_elem>
883 const Col<eT>&
884 Col<eT>::fixed<fixed_n_elem>::operator=(const char* text)
885 {
886 arma_extra_debug_sigprint();
887
888 change_to_row();
889
890 Col<eT>::operator=(text);
891
892 return *this;
893 }
894
895
896
897 template<typename eT>
898 template<uword fixed_n_elem>
899 const Col<eT>&
900 Col<eT>::fixed<fixed_n_elem>::operator=(const std::string& text)
901 {
902 arma_extra_debug_sigprint();
903
904 change_to_row();
905
906 Col<eT>::operator=(text);
907
908 return *this;
909 }
910
911
912
913 template<typename eT>
914 template<uword fixed_n_elem>
915 const Col<eT>&
916 Col<eT>::fixed<fixed_n_elem>::operator=(const subview_cube<eT>& X)
917 {
918 arma_extra_debug_sigprint();
919
920 Col<eT>::operator=(X);
921
922 return *this;
923 }
924
925
926
927 template<typename eT>
928 template<uword fixed_n_elem>
929 inline
930 subview_row<eT>
931 Col<eT>::fixed<fixed_n_elem>::operator()(const uword row_num, const span& col_span)
932 {
933 arma_extra_debug_sigprint();
934
935 return Mat<eT>::operator()(row_num, col_span);
936 }
937
938
939
940 template<typename eT>
941 template<uword fixed_n_elem>
942 inline
943 const subview_row<eT>
944 Col<eT>::fixed<fixed_n_elem>::operator()(const uword row_num, const span& col_span) const
945 {
946 arma_extra_debug_sigprint();
947
948 return Mat<eT>::operator()(row_num, col_span);
949 }
950
951
952
953 template<typename eT>
954 template<uword fixed_n_elem>
955 inline
956 subview_col<eT>
957 Col<eT>::fixed<fixed_n_elem>::operator()(const span& row_span, const uword col_num)
958 {
959 arma_extra_debug_sigprint();
960
961 return Mat<eT>::operator()(row_span, col_num);
962 }
963
964
965
966 template<typename eT>
967 template<uword fixed_n_elem>
968 inline
969 const subview_col<eT>
970 Col<eT>::fixed<fixed_n_elem>::operator()(const span& row_span, const uword col_num) const
971 {
972 arma_extra_debug_sigprint();
973
974 return Mat<eT>::operator()(row_span, col_num);
975 }
976
977
978
979 template<typename eT>
980 template<uword fixed_n_elem>
981 inline
982 subview<eT>
983 Col<eT>::fixed<fixed_n_elem>::operator()(const span& row_span, const span& col_span)
984 {
985 arma_extra_debug_sigprint();
986
987 return Mat<eT>::operator()(row_span, col_span);
988 }
989
990
991
992 template<typename eT>
993 template<uword fixed_n_elem>
994 inline
995 const subview<eT>
996 Col<eT>::fixed<fixed_n_elem>::operator()(const span& row_span, const span& col_span) const
997 {
998 arma_extra_debug_sigprint();
999
1000 return Mat<eT>::operator()(row_span, col_span);
1001 }
1002
1003
1004
1005 template<typename eT>
1006 template<uword fixed_n_elem>
1007 arma_inline
1008 arma_warn_unused
1009 eT&
1010 Col<eT>::fixed<fixed_n_elem>::operator[] (const uword i)
1011 {
1012 return access::rw( Mat<eT>::mem[i] );
1013 }
1014
1015
1016
1017 template<typename eT>
1018 template<uword fixed_n_elem>
1019 arma_inline
1020 arma_warn_unused
1021 eT
1022 Col<eT>::fixed<fixed_n_elem>::operator[] (const uword i) const
1023 {
1024 return ( Mat<eT>::mem[i] );
1025 }
1026
1027
1028
1029 template<typename eT>
1030 template<uword fixed_n_elem>
1031 arma_inline
1032 arma_warn_unused
1033 eT&
1034 Col<eT>::fixed<fixed_n_elem>::at(const uword i)
1035 {
1036 return access::rw( Mat<eT>::mem[i] );
1037 }
1038
1039
1040
1041 template<typename eT>
1042 template<uword fixed_n_elem>
1043 arma_inline
1044 arma_warn_unused
1045 eT
1046 Col<eT>::fixed<fixed_n_elem>::at(const uword i) const
1047 {
1048 return ( Mat<eT>::mem[i] );
1049 }
1050
1051
1052
1053 template<typename eT>
1054 template<uword fixed_n_elem>
1055 arma_inline
1056 arma_warn_unused
1057 eT&
1058 Col<eT>::fixed<fixed_n_elem>::operator() (const uword i)
1059 {
1060 arma_debug_check( (i >= fixed_n_elem), "Col::fixed::operator(): out of bounds");
1061
1062 return access::rw( Mat<eT>::mem[i] );
1063 }
1064
1065
1066
1067 template<typename eT>
1068 template<uword fixed_n_elem>
1069 arma_inline
1070 arma_warn_unused
1071 eT
1072 Col<eT>::fixed<fixed_n_elem>::operator() (const uword i) const
1073 {
1074 arma_debug_check( (i >= fixed_n_elem), "Col::fixed::operator(): out of bounds");
1075
1076 return ( Mat<eT>::mem[i] );
1077 }
1078
1079
1080
1081 template<typename eT>
1082 template<uword fixed_n_elem>
1083 arma_inline
1084 arma_warn_unused
1085 eT&
1086 Col<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword in_col)
1087 {
1088 return access::rw( Mat<eT>::mem[in_row] );
1089 }
1090
1091
1092
1093 template<typename eT>
1094 template<uword fixed_n_elem>
1095 arma_inline
1096 arma_warn_unused
1097 eT
1098 Col<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword in_col) const
1099 {
1100 return ( Mat<eT>::mem[in_row] );
1101 }
1102
1103
1104
1105 template<typename eT>
1106 template<uword fixed_n_elem>
1107 arma_inline
1108 arma_warn_unused
1109 eT&
1110 Col<eT>::fixed<fixed_n_elem>::operator() (const uword in_row, const uword in_col)
1111 {
1112 arma_debug_check( ((in_row >= fixed_n_elem) || (in_col >= 1)), "Col::fixed::operator(): out of bounds" );
1113
1114 return access::rw( Mat<eT>::mem[in_row] );
1115 }
1116
1117
1118
1119 template<typename eT>
1120 template<uword fixed_n_elem>
1121 arma_inline
1122 arma_warn_unused
1123 eT
1124 Col<eT>::fixed<fixed_n_elem>::operator() (const uword in_row, const uword in_col) const
1125 {
1126 arma_debug_check( ((in_row >= fixed_n_elem) || (in_col >= 1)), "Col::fixed::operator(): out of bounds" );
1127
1128 return ( Mat<eT>::mem[in_row] );
1129 }
1130
1131
1132
1133 template<typename eT>
1134 template<uword fixed_n_elem>
1135 arma_hot
1136 inline
1137 const Col<eT>&
1138 Col<eT>::fixed<fixed_n_elem>::fill(const eT val)
1139 {
1140 arma_extra_debug_sigprint();
1141
1142 arrayops::inplace_set( const_cast<eT*>(Mat<eT>::mem), val, fixed_n_elem );
1143
1144 return *this;
1145 }
1146
1147
1148
1149 template<typename eT>
1150 template<uword fixed_n_elem>
1151 arma_hot
1152 inline
1153 const Col<eT>&
1154 Col<eT>::fixed<fixed_n_elem>::zeros()
1155 {
1156 arma_extra_debug_sigprint();
1157
1158 arrayops::inplace_set( const_cast<eT*>(Mat<eT>::mem), eT(0), fixed_n_elem );
1159
1160 return *this;
1161 }
1162
1163
1164
1165 template<typename eT>
1166 template<uword fixed_n_elem>
1167 arma_hot
1168 inline
1169 const Col<eT>&
1170 Col<eT>::fixed<fixed_n_elem>::ones()
1171 {
1172 arma_extra_debug_sigprint();
1173
1174 arrayops::inplace_set( const_cast<eT*>(Mat<eT>::mem), eT(1), fixed_n_elem );
1175
1176 return *this;
1177 }
1178
1179
1180
1181 #ifdef ARMA_EXTRA_COL_MEAT
1182 #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_MEAT)
1183 #endif
1184
1185
1186
1187 //! @}