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