comparison armadillo-2.4.4/include/armadillo_bits/field_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 // Copyright (C) 2009-2010 Ian Cullinan
4 //
5 // This file is part of the Armadillo C++ library.
6 // It is provided without any warranty of fitness
7 // for any purpose. You can redistribute this file
8 // and/or modify it under the terms of the GNU
9 // Lesser General Public License (LGPL) as published
10 // by the Free Software Foundation, either version 3
11 // of the License or (at your option) any later version.
12 // (see http://www.opensource.org/licenses for more info)
13
14
15 //! \addtogroup field
16 //! @{
17
18
19 template<typename oT>
20 inline
21 field<oT>::~field()
22 {
23 arma_extra_debug_sigprint_this(this);
24
25 delete_objects();
26
27 if(n_elem > sizeof(mem_local)/sizeof(oT*) )
28 {
29 delete [] mem;
30 }
31
32 if(arma_config::debug == true)
33 {
34 // try to expose buggy user code that accesses deleted objects
35 access::rw(n_rows) = 0;
36 access::rw(n_cols) = 0;
37 access::rw(n_elem) = 0;
38 mem = 0;
39 }
40 }
41
42
43
44 template<typename oT>
45 inline
46 field<oT>::field()
47 : n_rows(0)
48 , n_cols(0)
49 , n_elem(0)
50 , mem(0)
51 {
52 arma_extra_debug_sigprint_this(this);
53 }
54
55
56
57 //! construct a field from a given field
58 template<typename oT>
59 inline
60 field<oT>::field(const field& x)
61 : n_rows(0)
62 , n_cols(0)
63 , n_elem(0)
64 , mem(0)
65 {
66 arma_extra_debug_sigprint(arma_boost::format("this = %x x = %x") % this % &x);
67
68 init(x);
69 }
70
71
72
73 //! construct a field from a given field
74 template<typename oT>
75 inline
76 const field<oT>&
77 field<oT>::operator=(const field& x)
78 {
79 arma_extra_debug_sigprint();
80
81 init(x);
82 return *this;
83 }
84
85
86
87 //! construct a field from subview_field (e.g. construct a field from a delayed subfield operation)
88 template<typename oT>
89 inline
90 field<oT>::field(const subview_field<oT>& X)
91 : n_rows(0)
92 , n_cols(0)
93 , n_elem(0)
94 , mem(0)
95 {
96 arma_extra_debug_sigprint_this(this);
97
98 this->operator=(X);
99 }
100
101
102
103 //! construct a field from subview_field (e.g. construct a field from a delayed subfield operation)
104 template<typename oT>
105 inline
106 const field<oT>&
107 field<oT>::operator=(const subview_field<oT>& X)
108 {
109 arma_extra_debug_sigprint();
110
111 subview_field<oT>::extract(*this, X);
112 return *this;
113 }
114
115
116
117 //! construct the field with the specified number of elements,
118 //! assuming a column-major layout
119 template<typename oT>
120 inline
121 field<oT>::field(const uword n_elem_in)
122 : n_rows(0)
123 , n_cols(0)
124 , n_elem(0)
125 , mem(0)
126 {
127 arma_extra_debug_sigprint_this(this);
128
129 init(n_elem_in, 1);
130 }
131
132
133
134 //! construct the field with the specified dimensions
135 template<typename oT>
136 inline
137 field<oT>::field(const uword n_rows_in, const uword n_cols_in)
138 : n_rows(0)
139 , n_cols(0)
140 , n_elem(0)
141 , mem(0)
142 {
143 arma_extra_debug_sigprint_this(this);
144
145 init(n_rows_in, n_cols_in);
146 }
147
148
149
150 //! change the field to have the specified number of elements,
151 //! assuming a column-major layout (data is not preserved)
152 template<typename oT>
153 inline
154 void
155 field<oT>::set_size(const uword n_elem_in)
156 {
157 arma_extra_debug_sigprint(arma_boost::format("n_elem_in = %d") % n_elem_in);
158
159 init(n_elem_in, 1);
160 }
161
162
163
164 //! change the field to have the specified dimensions (data is not preserved)
165 template<typename oT>
166 inline
167 void
168 field<oT>::set_size(const uword n_rows_in, const uword n_cols_in)
169 {
170 arma_extra_debug_sigprint(arma_boost::format("n_rows_in = %d, n_cols_in = %d") % n_rows_in % n_cols_in);
171
172 init(n_rows_in, n_cols_in);
173 }
174
175
176
177 //! change the field to have the specified dimensions (data is not preserved)
178 template<typename oT>
179 template<typename oT2>
180 inline
181 void
182 field<oT>::copy_size(const field<oT2>& x)
183 {
184 arma_extra_debug_sigprint();
185
186 init(x.n_rows, x.n_cols);
187 }
188
189
190
191 //! linear element accessor (treats the field as a vector); no bounds check
192 template<typename oT>
193 arma_inline
194 oT&
195 field<oT>::operator[] (const uword i)
196 {
197 return (*mem[i]);
198 }
199
200
201
202 //! linear element accessor (treats the field as a vector); no bounds check
203 template<typename oT>
204 arma_inline
205 const oT&
206 field<oT>::operator[] (const uword i) const
207 {
208 return (*mem[i]);
209 }
210
211
212
213 //! linear element accessor (treats the field as a vector); no bounds check
214 template<typename oT>
215 arma_inline
216 oT&
217 field<oT>::at(const uword i)
218 {
219 return (*mem[i]);
220 }
221
222
223
224 //! linear element accessor (treats the field as a vector); no bounds check
225 template<typename oT>
226 arma_inline
227 const oT&
228 field<oT>::at(const uword i) const
229 {
230 return (*mem[i]);
231 }
232
233
234
235 //! linear element accessor (treats the field as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
236 template<typename oT>
237 arma_inline
238 oT&
239 field<oT>::operator() (const uword i)
240 {
241 arma_debug_check( (i >= n_elem), "field::operator(): index out of bounds");
242 return (*mem[i]);
243 }
244
245
246
247 //! linear element accessor (treats the field as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
248 template<typename oT>
249 arma_inline
250 const oT&
251 field<oT>::operator() (const uword i) const
252 {
253 arma_debug_check( (i >= n_elem), "field::operator(): index out of bounds");
254 return (*mem[i]);
255 }
256
257
258
259 //! element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
260 template<typename oT>
261 arma_inline
262 oT&
263 field<oT>::operator() (const uword in_row, const uword in_col)
264 {
265 arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "field::operator(): index out of bounds");
266 return (*mem[in_row + in_col*n_rows]);
267 }
268
269
270
271 //! element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
272 template<typename oT>
273 arma_inline
274 const oT&
275 field<oT>::operator() (const uword in_row, const uword in_col) const
276 {
277 arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "field::operator(): index out of bounds");
278 return (*mem[in_row + in_col*n_rows]);
279 }
280
281
282
283 //! element accessor; no bounds check
284 template<typename oT>
285 arma_inline
286 oT&
287 field<oT>::at(const uword in_row, const uword in_col)
288 {
289 return (*mem[in_row + in_col*n_rows]);
290 }
291
292
293
294 //! element accessor; no bounds check
295 template<typename oT>
296 arma_inline
297 const oT&
298 field<oT>::at(const uword in_row, const uword in_col) const
299 {
300 return (*mem[in_row + in_col*n_rows]);
301 }
302
303
304
305 template<typename oT>
306 inline
307 field_injector< field<oT> >
308 field<oT>::operator<<(const oT& val)
309 {
310 return field_injector< field<oT> >(*this, val);
311 }
312
313
314
315 template<typename oT>
316 inline
317 field_injector< field<oT> >
318 field<oT>::operator<<(const injector_end_of_row& x)
319 {
320 return field_injector< field<oT> >(*this, x);
321 }
322
323
324
325 //! creation of subview_field (row of a field)
326 template<typename oT>
327 inline
328 subview_field<oT>
329 field<oT>::row(const uword row_num)
330 {
331 arma_extra_debug_sigprint();
332
333 arma_debug_check( (row_num >= n_rows), "field::row(): row out of bounds" );
334
335 return subview_field<oT>(*this, row_num, 0, 1, n_cols);
336 }
337
338
339
340 //! creation of subview_field (row of a field)
341 template<typename oT>
342 inline
343 const subview_field<oT>
344 field<oT>::row(const uword row_num) const
345 {
346 arma_extra_debug_sigprint();
347
348 arma_debug_check( (row_num >= n_rows), "field::row(): row out of bounds" );
349
350 return subview_field<oT>(*this, row_num, 0, 1, n_cols);
351 }
352
353
354
355 //! creation of subview_field (column of a field)
356 template<typename oT>
357 inline
358 subview_field<oT>
359 field<oT>::col(const uword col_num)
360 {
361 arma_extra_debug_sigprint();
362
363 arma_debug_check( (col_num >= n_cols), "field::col(): out of bounds");
364
365 return subview_field<oT>(*this, 0, col_num, n_rows, 1);
366 }
367
368
369
370 //! creation of subview_field (column of a field)
371 template<typename oT>
372 inline
373 const subview_field<oT>
374 field<oT>::col(const uword col_num) const
375 {
376 arma_extra_debug_sigprint();
377
378 arma_debug_check( (col_num >= n_cols), "field::col(): out of bounds");
379
380 return subview_field<oT>(*this, 0, col_num, n_rows, 1);
381 }
382
383
384
385 //! creation of subview_field (subfield comprised of specified rows)
386 template<typename oT>
387 inline
388 subview_field<oT>
389 field<oT>::rows(const uword in_row1, const uword in_row2)
390 {
391 arma_extra_debug_sigprint();
392
393 arma_debug_check
394 (
395 ( (in_row1 > in_row2) || (in_row2 >= n_rows) ),
396 "field::rows(): indicies out of bounds or incorrectly used"
397 );
398
399 const uword sub_n_rows = in_row2 - in_row1 + 1;
400
401 return subview_field<oT>(*this, in_row1, 0, sub_n_rows, n_cols);
402 }
403
404
405
406 //! creation of subview_field (subfield comprised of specified rows)
407 template<typename oT>
408 inline
409 const subview_field<oT>
410 field<oT>::rows(const uword in_row1, const uword in_row2) const
411 {
412 arma_extra_debug_sigprint();
413
414 arma_debug_check
415 (
416 ( (in_row1 > in_row2) || (in_row2 >= n_rows) ),
417 "field::rows(): indicies out of bounds or incorrectly used"
418 );
419
420 const uword sub_n_rows = in_row2 - in_row1 + 1;
421
422 return subview_field<oT>(*this, in_row1, 0, sub_n_rows, n_cols);
423 }
424
425
426
427 //! creation of subview_field (subfield comprised of specified columns)
428 template<typename oT>
429 inline
430 subview_field<oT>
431 field<oT>::cols(const uword in_col1, const uword in_col2)
432 {
433 arma_extra_debug_sigprint();
434
435 arma_debug_check
436 (
437 ( (in_col1 > in_col2) || (in_col2 >= n_cols) ),
438 "field::cols(): indicies out of bounds or incorrectly used"
439 );
440
441 const uword sub_n_cols = in_col2 - in_col1 + 1;
442
443 return subview_field<oT>(*this, 0, in_col1, n_rows, sub_n_cols);
444 }
445
446
447
448 //! creation of subview_field (subfield comprised of specified columns)
449 template<typename oT>
450 inline
451 const subview_field<oT>
452 field<oT>::cols(const uword in_col1, const uword in_col2) const
453 {
454 arma_extra_debug_sigprint();
455
456 arma_debug_check
457 (
458 ( (in_col1 > in_col2) || (in_col2 >= n_cols) ),
459 "field::cols(): indicies out of bounds or incorrectly used"
460 );
461
462 const uword sub_n_cols = in_col2 - in_col1 + 1;
463
464 return subview_field<oT>(*this, 0, in_col1, n_rows, sub_n_cols);
465 }
466
467
468
469 //! creation of subview_field (subfield with arbitrary dimensions)
470 template<typename oT>
471 inline
472 subview_field<oT>
473 field<oT>::subfield(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2)
474 {
475 arma_extra_debug_sigprint();
476
477 arma_debug_check
478 (
479 (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols),
480 "field::subfield(): indices out of bounds or incorrectly used"
481 );
482
483 const uword sub_n_rows = in_row2 - in_row1 + 1;
484 const uword sub_n_cols = in_col2 - in_col1 + 1;
485
486 return subview_field<oT>(*this, in_row1, in_col1, sub_n_rows, sub_n_cols);
487 }
488
489
490
491 //! creation of subview_field (subfield with arbitrary dimensions)
492 template<typename oT>
493 inline
494 const subview_field<oT>
495 field<oT>::subfield(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const
496 {
497 arma_extra_debug_sigprint();
498
499 arma_debug_check
500 (
501 (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols),
502 "field::subfield(): indices out of bounds or incorrectly used"
503 );
504
505 const uword sub_n_rows = in_row2 - in_row1 + 1;
506 const uword sub_n_cols = in_col2 - in_col1 + 1;
507
508 return subview_field<oT>(*this, in_row1, in_col1, sub_n_rows, sub_n_cols);
509 }
510
511
512
513 //! creation of subview_field (subfield with arbitrary dimensions)
514 template<typename oT>
515 inline
516 subview_field<oT>
517 field<oT>::subfield(const span& row_span, const span& col_span)
518 {
519 arma_extra_debug_sigprint();
520
521 const bool row_all = row_span.whole;
522 const bool col_all = col_span.whole;
523
524 const uword local_n_rows = n_rows;
525 const uword local_n_cols = n_cols;
526
527 const uword in_row1 = row_all ? 0 : row_span.a;
528 const uword in_row2 = row_span.b;
529 const uword sub_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
530
531 const uword in_col1 = col_all ? 0 : col_span.a;
532 const uword in_col2 = col_span.b;
533 const uword sub_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1;
534
535 arma_debug_check
536 (
537 ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) )
538 ||
539 ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) )
540 ,
541 "field::subfield(): indices out of bounds or incorrectly used"
542 );
543
544 return subview_field<oT>(*this, in_row1, in_col1, sub_n_rows, sub_n_cols);
545 }
546
547
548
549 //! creation of subview_field (subfield with arbitrary dimensions)
550 template<typename oT>
551 inline
552 const subview_field<oT>
553 field<oT>::subfield(const span& row_span, const span& col_span) const
554 {
555 arma_extra_debug_sigprint();
556
557 const bool row_all = row_span.whole;
558 const bool col_all = col_span.whole;
559
560 const uword local_n_rows = n_rows;
561 const uword local_n_cols = n_cols;
562
563 const uword in_row1 = row_all ? 0 : row_span.a;
564 const uword in_row2 = row_span.b;
565 const uword sub_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
566
567 const uword in_col1 = col_all ? 0 : col_span.a;
568 const uword in_col2 = col_span.b;
569 const uword sub_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1;
570
571 arma_debug_check
572 (
573 ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) )
574 ||
575 ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) )
576 ,
577 "field::subfield(): indices out of bounds or incorrectly used"
578 );
579
580 return subview_field<oT>(*this, in_row1, in_col1, sub_n_rows, sub_n_cols);
581 }
582
583
584
585 template<typename oT>
586 inline
587 subview_field<oT>
588 field<oT>::operator()(const span& row_span, const span& col_span)
589 {
590 arma_extra_debug_sigprint();
591
592 return (*this).subfield(row_span, col_span);
593 }
594
595
596
597 template<typename oT>
598 inline
599 const subview_field<oT>
600 field<oT>::operator()(const span& row_span, const span& col_span) const
601 {
602 arma_extra_debug_sigprint();
603
604 return (*this).subfield(row_span, col_span);
605 }
606
607
608
609 //! print contents of the field (to the cout stream),
610 //! optionally preceding with a user specified line of text.
611 //! the field class preserves the stream's flags
612 //! but the associated operator<< function for type oT
613 //! may still modify the stream's parameters.
614 //! NOTE: this function assumes that type oT can be printed,
615 //! i.e. the function "std::ostream& operator<< (std::ostream&, const oT&)"
616 //! has been defined.
617
618 template<typename oT>
619 inline
620 void
621 field<oT>::print(const std::string extra_text) const
622 {
623 arma_extra_debug_sigprint();
624
625 if(extra_text.length() != 0)
626 {
627 const std::streamsize orig_width = ARMA_DEFAULT_OSTREAM.width();
628
629 ARMA_DEFAULT_OSTREAM << extra_text << '\n';
630
631 ARMA_DEFAULT_OSTREAM.width(orig_width);
632 }
633
634 arma_ostream::print(ARMA_DEFAULT_OSTREAM, *this);
635 }
636
637
638
639 //! print contents of the field to a user specified stream,
640 //! optionally preceding with a user specified line of text.
641 //! the field class preserves the stream's flags
642 //! but the associated operator<< function for type oT
643 //! may still modify the stream's parameters.
644 //! NOTE: this function assumes that type oT can be printed,
645 //! i.e. the function "std::ostream& operator<< (std::ostream&, const oT&)"
646 //! has been defined.
647
648 template<typename oT>
649 inline
650 void
651 field<oT>::print(std::ostream& user_stream, const std::string extra_text) const
652 {
653 arma_extra_debug_sigprint();
654
655 if(extra_text.length() != 0)
656 {
657 const std::streamsize orig_width = user_stream.width();
658
659 user_stream << extra_text << '\n';
660
661 user_stream.width(orig_width);
662 }
663
664 arma_ostream::print(user_stream, *this);
665 }
666
667
668
669 //! fill the field with an object
670 template<typename oT>
671 inline
672 void
673 field<oT>::fill(const oT& x)
674 {
675 arma_extra_debug_sigprint();
676
677 field<oT>& t = *this;
678
679 for(uword i=0; i<n_elem; ++i)
680 {
681 t[i] = x;
682 }
683 }
684
685
686
687 //! reset the field to an empty state (i.e. the field will have no objects)
688 template<typename oT>
689 inline
690 void
691 field<oT>::reset()
692 {
693 arma_extra_debug_sigprint();
694
695 init(0,0);
696 }
697
698
699
700 //! reset each object
701 template<typename oT>
702 inline
703 void
704 field<oT>::reset_objects()
705 {
706 arma_extra_debug_sigprint();
707
708 field_aux::reset_objects(*this);
709 }
710
711
712
713 //! returns true if the field has no objects
714 template<typename oT>
715 arma_inline
716 bool
717 field<oT>::is_empty() const
718 {
719 return (n_elem == 0);
720 }
721
722
723
724 //! returns true if the given index is currently in range
725 template<typename oT>
726 arma_inline
727 arma_warn_unused
728 bool
729 field<oT>::in_range(const uword i) const
730 {
731 return (i < n_elem);
732 }
733
734
735
736 //! returns true if the given start and end indices are currently in range
737 template<typename oT>
738 arma_inline
739 arma_warn_unused
740 bool
741 field<oT>::in_range(const span& x) const
742 {
743 arma_extra_debug_sigprint();
744
745 if(x.whole == true)
746 {
747 return true;
748 }
749 else
750 {
751 const uword a = x.a;
752 const uword b = x.b;
753
754 return ( (a <= b) && (b < n_elem) );
755 }
756 }
757
758
759
760 //! returns true if the given location is currently in range
761 template<typename oT>
762 arma_inline
763 arma_warn_unused
764 bool
765 field<oT>::in_range(const uword in_row, const uword in_col) const
766 {
767 return ( (in_row < n_rows) && (in_col < n_cols) );
768 }
769
770
771
772 template<typename oT>
773 arma_inline
774 arma_warn_unused
775 bool
776 field<oT>::in_range(const span& row_span, const uword in_col) const
777 {
778 arma_extra_debug_sigprint();
779
780 if(row_span.whole == true)
781 {
782 return (in_col < n_cols);
783 }
784 else
785 {
786 const uword in_row1 = row_span.a;
787 const uword in_row2 = row_span.b;
788
789 return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (in_col < n_cols) );
790 }
791 }
792
793
794
795 template<typename oT>
796 arma_inline
797 arma_warn_unused
798 bool
799 field<oT>::in_range(const uword in_row, const span& col_span) const
800 {
801 arma_extra_debug_sigprint();
802
803 if(col_span.whole == true)
804 {
805 return (in_row < n_rows);
806 }
807 else
808 {
809 const uword in_col1 = col_span.a;
810 const uword in_col2 = col_span.b;
811
812 return ( (in_row < n_rows) && (in_col1 <= in_col2) && (in_col2 < n_cols) );
813 }
814 }
815
816
817
818 template<typename oT>
819 arma_inline
820 arma_warn_unused
821 bool
822 field<oT>::in_range(const span& row_span, const span& col_span) const
823 {
824 arma_extra_debug_sigprint();
825
826 const uword in_row1 = row_span.a;
827 const uword in_row2 = row_span.b;
828
829 const uword in_col1 = col_span.a;
830 const uword in_col2 = col_span.b;
831
832 const bool rows_ok = row_span.whole ? true : ( (in_row1 <= in_row2) && (in_row2 < n_rows) );
833 const bool cols_ok = col_span.whole ? true : ( (in_col1 <= in_col2) && (in_col2 < n_cols) );
834
835 return ( (rows_ok == true) && (cols_ok == true) );
836 }
837
838
839
840 template<typename oT>
841 inline
842 bool
843 field<oT>::save(const std::string name, const file_type type, const bool print_status) const
844 {
845 arma_extra_debug_sigprint();
846
847 std::string err_msg;
848 const bool save_okay = field_aux::save(*this, name, type, err_msg);
849
850 if( (print_status == true) && (save_okay == false) )
851 {
852 if(err_msg.length() > 0)
853 {
854 arma_warn(true, "field::save(): ", err_msg, name);
855 }
856 else
857 {
858 arma_warn(true, "field::save(): couldn't write to ", name);
859 }
860 }
861
862 return save_okay;
863 }
864
865
866
867 template<typename oT>
868 inline
869 bool
870 field<oT>::save(std::ostream& os, const file_type type, const bool print_status) const
871 {
872 arma_extra_debug_sigprint();
873
874 std::string err_msg;
875 const bool save_okay = field_aux::save(*this, os, type, err_msg);
876
877 if( (print_status == true) && (save_okay == false) )
878 {
879 if(err_msg.length() > 0)
880 {
881 arma_warn(true, "field::save(): ", err_msg, "[ostream]");
882 }
883 else
884 {
885 arma_warn(true, "field::save(): couldn't write to [ostream]");
886 }
887 }
888
889 return save_okay;
890 }
891
892
893
894 template<typename oT>
895 inline
896 bool
897 field<oT>::load(const std::string name, const file_type type, const bool print_status)
898 {
899 arma_extra_debug_sigprint();
900
901 std::string err_msg;
902 const bool load_okay = field_aux::load(*this, name, type, err_msg);
903
904 if( (print_status == true) && (load_okay == false) )
905 {
906 if(err_msg.length() > 0)
907 {
908 arma_warn(true, "field::load(): ", err_msg, name);
909 }
910 else
911 {
912 arma_warn(true, "field::load(): couldn't read from ", name);
913 }
914 }
915
916 if(load_okay == false)
917 {
918 (*this).reset();
919 }
920
921 return load_okay;
922 }
923
924
925
926 template<typename oT>
927 inline
928 bool
929 field<oT>::load(std::istream& is, const file_type type, const bool print_status)
930 {
931 arma_extra_debug_sigprint();
932
933 std::string err_msg;
934 const bool load_okay = field_aux::load(*this, is, type, err_msg);
935
936 if( (print_status == true) && (load_okay == false) )
937 {
938 if(err_msg.length() > 0)
939 {
940 arma_warn(true, "field::load(): ", err_msg, "[istream]");
941 }
942 else
943 {
944 arma_warn(true, "field::load(): couldn't read from [istream]");
945 }
946 }
947
948 if(load_okay == false)
949 {
950 (*this).reset();
951 }
952
953 return load_okay;
954 }
955
956
957
958 template<typename oT>
959 inline
960 bool
961 field<oT>::quiet_save(const std::string name, const file_type type) const
962 {
963 arma_extra_debug_sigprint();
964
965 return (*this).save(name, type, false);
966 }
967
968
969
970 template<typename oT>
971 inline
972 bool
973 field<oT>::quiet_save(std::ostream& os, const file_type type) const
974 {
975 arma_extra_debug_sigprint();
976
977 return (*this).save(os, type, false);
978 }
979
980
981
982 template<typename oT>
983 inline
984 bool
985 field<oT>::quiet_load(const std::string name, const file_type type)
986 {
987 arma_extra_debug_sigprint();
988
989 return (*this).load(name, type, false);
990 }
991
992
993
994 template<typename oT>
995 inline
996 bool
997 field<oT>::quiet_load(std::istream& is, const file_type type)
998 {
999 arma_extra_debug_sigprint();
1000
1001 return (*this).load(is, type, false);
1002 }
1003
1004
1005
1006 //! construct a field from a given field
1007 template<typename oT>
1008 inline
1009 void
1010 field<oT>::init(const field<oT>& x)
1011 {
1012 arma_extra_debug_sigprint();
1013
1014 if(this != &x)
1015 {
1016 init(x.n_rows, x.n_cols);
1017
1018 field& t = *this;
1019
1020 for(uword col=0; col<x.n_cols; ++col)
1021 for(uword row=0; row<x.n_rows; ++row)
1022 {
1023 t.at(row,col) = x.at(row,col);
1024 }
1025 }
1026
1027 }
1028
1029
1030
1031 //! internal field construction; if the requested size is small enough, memory from the stack is used. otherwise memory is allocated via 'new'
1032 template<typename oT>
1033 inline
1034 void
1035 field<oT>::init(const uword n_rows_in, const uword n_cols_in)
1036 {
1037 arma_extra_debug_sigprint( arma_boost::format("n_rows_in = %d, n_cols_in = %d") % n_rows_in % n_cols_in );
1038
1039 const uword n_elem_new = n_rows_in * n_cols_in;
1040
1041 if(n_elem == n_elem_new)
1042 {
1043 // delete_objects();
1044 // create_objects();
1045 access::rw(n_rows) = n_rows_in;
1046 access::rw(n_cols) = n_cols_in;
1047 }
1048 else
1049 {
1050 delete_objects();
1051
1052 if(n_elem > sizeof(mem_local)/sizeof(oT*) )
1053 {
1054 delete [] mem;
1055 }
1056
1057 if(n_elem_new <= sizeof(mem_local)/sizeof(oT*) )
1058 {
1059 mem = mem_local;
1060 }
1061 else
1062 {
1063 mem = new(std::nothrow) oT* [n_elem_new];
1064 arma_check_bad_alloc( (mem == 0), "field::init(): out of memory" );
1065 }
1066
1067 access::rw(n_elem) = n_elem_new;
1068
1069 if(n_elem_new == 0)
1070 {
1071 access::rw(n_rows) = 0;
1072 access::rw(n_cols) = 0;
1073 }
1074 else
1075 {
1076 access::rw(n_rows) = n_rows_in;
1077 access::rw(n_cols) = n_cols_in;
1078 }
1079
1080 create_objects();
1081
1082 }
1083
1084 }
1085
1086
1087
1088 template<typename oT>
1089 inline
1090 void
1091 field<oT>::delete_objects()
1092 {
1093 arma_extra_debug_sigprint( arma_boost::format("n_elem = %d") % n_elem );
1094
1095 for(uword i=0; i<n_elem; ++i)
1096 {
1097 if(mem[i] != 0)
1098 {
1099 delete mem[i];
1100 mem[i] = 0;
1101 }
1102 }
1103
1104 }
1105
1106
1107
1108 template<typename oT>
1109 inline
1110 void
1111 field<oT>::create_objects()
1112 {
1113 arma_extra_debug_sigprint( arma_boost::format("n_elem = %d") % n_elem );
1114
1115 for(uword i=0; i<n_elem; ++i)
1116 {
1117 mem[i] = new oT;
1118 }
1119
1120 }
1121
1122
1123
1124 template<typename oT>
1125 inline
1126 field<oT>::iterator::iterator(field<oT>& in_M, const bool at_end)
1127 : M(in_M)
1128 , i( (at_end == false) ? 0 : in_M.n_elem )
1129 {
1130 arma_extra_debug_sigprint();
1131 }
1132
1133
1134
1135 template<typename oT>
1136 inline
1137 oT&
1138 field<oT>::iterator::operator*()
1139 {
1140 return M[i];
1141 }
1142
1143
1144
1145 template<typename oT>
1146 inline
1147 typename field<oT>::iterator&
1148 field<oT>::iterator::operator++()
1149 {
1150 ++i;
1151
1152 return *this;
1153 }
1154
1155
1156
1157 template<typename oT>
1158 inline
1159 void
1160 field<oT>::iterator::operator++(int)
1161 {
1162 operator++();
1163 }
1164
1165
1166
1167 template<typename oT>
1168 inline
1169 typename field<oT>::iterator&
1170 field<oT>::iterator::operator--()
1171 {
1172 if(i > 0)
1173 {
1174 --i;
1175 }
1176
1177 return *this;
1178 }
1179
1180
1181
1182 template<typename oT>
1183 inline
1184 void
1185 field<oT>::iterator::operator--(int)
1186 {
1187 operator--();
1188 }
1189
1190
1191
1192 template<typename oT>
1193 inline
1194 bool
1195 field<oT>::iterator::operator!=(const typename field<oT>::iterator& X) const
1196 {
1197 return (i != X.i);
1198 }
1199
1200
1201
1202 template<typename oT>
1203 inline
1204 bool
1205 field<oT>::iterator::operator==(const typename field<oT>::iterator& X) const
1206 {
1207 return (i == X.i);
1208 }
1209
1210
1211
1212 template<typename oT>
1213 inline
1214 field<oT>::const_iterator::const_iterator(const field<oT>& in_M, const bool at_end)
1215 : M(in_M)
1216 , i( (at_end == false) ? 0 : in_M.n_elem )
1217 {
1218 arma_extra_debug_sigprint();
1219 }
1220
1221
1222
1223 template<typename oT>
1224 inline
1225 field<oT>::const_iterator::const_iterator(const typename field<oT>::iterator& X)
1226 : M(X.M)
1227 , i(X.i)
1228 {
1229 arma_extra_debug_sigprint();
1230 }
1231
1232
1233
1234 template<typename oT>
1235 inline
1236 const oT&
1237 field<oT>::const_iterator::operator*() const
1238 {
1239 return M[i];
1240 }
1241
1242
1243
1244 template<typename oT>
1245 inline
1246 typename field<oT>::const_iterator&
1247 field<oT>::const_iterator::operator++()
1248 {
1249 ++i;
1250
1251 return *this;
1252 }
1253
1254
1255
1256 template<typename oT>
1257 inline
1258 void
1259 field<oT>::const_iterator::operator++(int)
1260 {
1261 operator++();
1262 }
1263
1264
1265
1266 template<typename oT>
1267 inline
1268 typename field<oT>::const_iterator&
1269 field<oT>::const_iterator::operator--()
1270 {
1271 if(i > 0)
1272 {
1273 --i;
1274 }
1275
1276 return *this;
1277 }
1278
1279
1280
1281 template<typename oT>
1282 inline
1283 void
1284 field<oT>::const_iterator::operator--(int)
1285 {
1286 operator--();
1287 }
1288
1289
1290
1291 template<typename oT>
1292 inline
1293 bool
1294 field<oT>::const_iterator::operator!=(const typename field<oT>::const_iterator& X) const
1295 {
1296 return (i != X.i);
1297 }
1298
1299
1300
1301 template<typename oT>
1302 inline
1303 bool
1304 field<oT>::const_iterator::operator==(const typename field<oT>::const_iterator& X) const
1305 {
1306 return (i == X.i);
1307 }
1308
1309
1310
1311 template<typename oT>
1312 inline
1313 typename field<oT>::iterator
1314 field<oT>::begin()
1315 {
1316 arma_extra_debug_sigprint();
1317
1318 return field<oT>::iterator(*this);
1319 }
1320
1321
1322
1323 template<typename oT>
1324 inline
1325 typename field<oT>::const_iterator
1326 field<oT>::begin() const
1327 {
1328 arma_extra_debug_sigprint();
1329
1330 return field<oT>::const_iterator(*this);
1331 }
1332
1333
1334
1335 template<typename oT>
1336 inline
1337 typename field<oT>::iterator
1338 field<oT>::end()
1339 {
1340 arma_extra_debug_sigprint();
1341
1342 return field<oT>::iterator(*this, true);
1343 }
1344
1345
1346
1347 template<typename oT>
1348 inline
1349 typename field<oT>::const_iterator
1350 field<oT>::end() const
1351 {
1352 arma_extra_debug_sigprint();
1353
1354 return field<oT>::const_iterator(*this, true);
1355 }
1356
1357
1358
1359 //
1360 //
1361 //
1362
1363
1364
1365 template<typename oT>
1366 inline
1367 void
1368 field_aux::reset_objects(field<oT>& x)
1369 {
1370 arma_extra_debug_sigprint();
1371
1372 x.delete_objects();
1373 x.create_objects();
1374 }
1375
1376
1377
1378 template<typename eT>
1379 inline
1380 void
1381 field_aux::reset_objects(field< Mat<eT> >& x)
1382 {
1383 arma_extra_debug_sigprint();
1384
1385 for(uword i=0; i<x.n_elem; ++i)
1386 {
1387 (*(x.mem[i])).reset();
1388 }
1389 }
1390
1391
1392
1393 template<typename eT>
1394 inline
1395 void
1396 field_aux::reset_objects(field< Col<eT> >& x)
1397 {
1398 arma_extra_debug_sigprint();
1399
1400 for(uword i=0; i<x.n_elem; ++i)
1401 {
1402 (*(x.mem[i])).reset();
1403 }
1404 }
1405
1406
1407
1408 template<typename eT>
1409 inline
1410 void
1411 field_aux::reset_objects(field< Row<eT> >& x)
1412 {
1413 arma_extra_debug_sigprint();
1414
1415 for(uword i=0; i<x.n_elem; ++i)
1416 {
1417 (*(x.mem[i])).reset();
1418 }
1419 }
1420
1421
1422
1423 template<typename eT>
1424 inline
1425 void
1426 field_aux::reset_objects(field< Cube<eT> >& x)
1427 {
1428 arma_extra_debug_sigprint();
1429
1430 for(uword i=0; i<x.n_elem; ++i)
1431 {
1432 (*(x.mem[i])).reset();
1433 }
1434 }
1435
1436
1437
1438 inline
1439 void
1440 field_aux::reset_objects(field< std::string >& x)
1441 {
1442 arma_extra_debug_sigprint();
1443
1444 for(uword i=0; i<x.n_elem; ++i)
1445 {
1446 (*(x.mem[i])).clear();
1447 }
1448 }
1449
1450
1451
1452 //
1453 //
1454 //
1455
1456
1457
1458 template<typename oT>
1459 inline
1460 bool
1461 field_aux::save(const field<oT>& x, const std::string& name, const file_type type, std::string& err_msg)
1462 {
1463 arma_extra_debug_sigprint();
1464
1465 err_msg = " [sorry, saving/loading this type of field is currently not supported] filename = ";
1466
1467 return false;
1468 }
1469
1470
1471
1472 template<typename oT>
1473 inline
1474 bool
1475 field_aux::save(const field<oT>& x, std::ostream& os, const file_type type, std::string& err_msg)
1476 {
1477 arma_extra_debug_sigprint();
1478
1479 err_msg = " [sorry, saving/loading this type of field is currently not supported] filename = ";
1480
1481 return false;
1482 }
1483
1484
1485
1486 template<typename oT>
1487 inline
1488 bool
1489 field_aux::load(field<oT>& x, const std::string& name, const file_type type, std::string& err_msg)
1490 {
1491 arma_extra_debug_sigprint();
1492
1493 err_msg = " [sorry, saving/loading this type of field is currently not supported] filename = ";
1494
1495 return false;
1496 }
1497
1498
1499
1500 template<typename oT>
1501 inline
1502 bool
1503 field_aux::load(field<oT>& x, std::istream& is, const file_type type, std::string& err_msg)
1504 {
1505 arma_extra_debug_sigprint();
1506
1507 err_msg = " [sorry, saving/loading this type of field is currently not supported] filename = ";
1508
1509 return false;
1510 }
1511
1512
1513
1514 template<typename eT>
1515 inline
1516 bool
1517 field_aux::save(const field< Mat<eT> >& x, const std::string& name, const file_type type, std::string& err_msg)
1518 {
1519 arma_extra_debug_sigprint();
1520
1521 switch(type)
1522 {
1523 case arma_binary:
1524 return diskio::save_arma_binary(x, name);
1525 break;
1526
1527 case ppm_binary:
1528 return diskio::save_ppm_binary(x, name);
1529 break;
1530
1531 default:
1532 err_msg = " [unsupported type] filename = ";
1533 return false;
1534 }
1535 }
1536
1537
1538
1539 template<typename eT>
1540 inline
1541 bool
1542 field_aux::save(const field< Mat<eT> >& x, std::ostream& os, const file_type type, std::string& err_msg)
1543 {
1544 arma_extra_debug_sigprint();
1545
1546 switch(type)
1547 {
1548 case arma_binary:
1549 return diskio::save_arma_binary(x, os);
1550 break;
1551
1552 case ppm_binary:
1553 return diskio::save_ppm_binary(x, os);
1554 break;
1555
1556 default:
1557 err_msg = " [unsupported type] filename = ";
1558 return false;
1559 }
1560 }
1561
1562
1563
1564 template<typename eT>
1565 inline
1566 bool
1567 field_aux::load(field< Mat<eT> >& x, const std::string& name, const file_type type, std::string& err_msg)
1568 {
1569 arma_extra_debug_sigprint();
1570
1571 switch(type)
1572 {
1573 case auto_detect:
1574 return diskio::load_auto_detect(x, name, err_msg);
1575 break;
1576
1577 case arma_binary:
1578 return diskio::load_arma_binary(x, name, err_msg);
1579 break;
1580
1581 case ppm_binary:
1582 return diskio::load_ppm_binary(x, name, err_msg);
1583 break;
1584
1585 default:
1586 err_msg = " [unsupported type] filename = ";
1587 return false;
1588 }
1589 }
1590
1591
1592
1593 template<typename eT>
1594 inline
1595 bool
1596 field_aux::load(field< Mat<eT> >& x, std::istream& is, const file_type type, std::string& err_msg)
1597 {
1598 arma_extra_debug_sigprint();
1599
1600 switch(type)
1601 {
1602 case auto_detect:
1603 return diskio::load_auto_detect(x, is, err_msg);
1604 break;
1605
1606 case arma_binary:
1607 return diskio::load_arma_binary(x, is, err_msg);
1608 break;
1609
1610 case ppm_binary:
1611 return diskio::load_ppm_binary(x, is, err_msg);
1612 break;
1613
1614 default:
1615 err_msg = " [unsupported type] filename = ";
1616 return false;
1617 }
1618 }
1619
1620
1621
1622 template<typename eT>
1623 inline
1624 bool
1625 field_aux::save(const field< Col<eT> >& x, const std::string& name, const file_type type, std::string& err_msg)
1626 {
1627 arma_extra_debug_sigprint();
1628
1629 switch(type)
1630 {
1631 case arma_binary:
1632 return diskio::save_arma_binary(x, name);
1633 break;
1634
1635 case ppm_binary:
1636 return diskio::save_ppm_binary(x, name);
1637 break;
1638
1639 default:
1640 err_msg = " [unsupported type] filename = ";
1641 return false;
1642 }
1643 }
1644
1645
1646
1647 template<typename eT>
1648 inline
1649 bool
1650 field_aux::save(const field< Col<eT> >& x, std::ostream& os, const file_type type, std::string& err_msg)
1651 {
1652 arma_extra_debug_sigprint();
1653
1654 switch(type)
1655 {
1656 case arma_binary:
1657 return diskio::save_arma_binary(x, os);
1658 break;
1659
1660 case ppm_binary:
1661 return diskio::save_ppm_binary(x, os);
1662 break;
1663
1664 default:
1665 err_msg = " [unsupported type] filename = ";
1666 return false;
1667 }
1668 }
1669
1670
1671
1672 template<typename eT>
1673 inline
1674 bool
1675 field_aux::load(field< Col<eT> >& x, const std::string& name, const file_type type, std::string& err_msg)
1676 {
1677 arma_extra_debug_sigprint();
1678
1679 switch(type)
1680 {
1681 case auto_detect:
1682 return diskio::load_auto_detect(x, name, err_msg);
1683 break;
1684
1685 case arma_binary:
1686 return diskio::load_arma_binary(x, name, err_msg);
1687 break;
1688
1689 case ppm_binary:
1690 return diskio::load_ppm_binary(x, name, err_msg);
1691 break;
1692
1693 default:
1694 err_msg = " [unsupported type] filename = ";
1695 return false;
1696 }
1697 }
1698
1699
1700
1701 template<typename eT>
1702 inline
1703 bool
1704 field_aux::load(field< Col<eT> >& x, std::istream& is, const file_type type, std::string& err_msg)
1705 {
1706 arma_extra_debug_sigprint();
1707
1708 switch(type)
1709 {
1710 case auto_detect:
1711 return diskio::load_auto_detect(x, is, err_msg);
1712 break;
1713
1714 case arma_binary:
1715 return diskio::load_arma_binary(x, is, err_msg);
1716 break;
1717
1718 case ppm_binary:
1719 return diskio::load_ppm_binary(x, is, err_msg);
1720 break;
1721
1722 default:
1723 err_msg = " [unsupported type] filename = ";
1724 return false;
1725 }
1726 }
1727
1728
1729
1730 template<typename eT>
1731 inline
1732 bool
1733 field_aux::save(const field< Row<eT> >& x, const std::string& name, const file_type type, std::string& err_msg)
1734 {
1735 arma_extra_debug_sigprint();
1736
1737 switch(type)
1738 {
1739 case arma_binary:
1740 return diskio::save_arma_binary(x, name, err_msg);
1741 break;
1742
1743 case ppm_binary:
1744 return diskio::save_ppm_binary(x, name, err_msg);
1745 break;
1746
1747 default:
1748 err_msg = " [unsupported type] filename = ";
1749 return false;
1750 }
1751 }
1752
1753
1754
1755 template<typename eT>
1756 inline
1757 bool
1758 field_aux::save(const field< Row<eT> >& x, std::ostream& os, const file_type type, std::string& err_msg)
1759 {
1760 arma_extra_debug_sigprint();
1761
1762 switch(type)
1763 {
1764 case arma_binary:
1765 return diskio::save_arma_binary(x, os, err_msg);
1766 break;
1767
1768 case ppm_binary:
1769 return diskio::save_ppm_binary(x, os, err_msg);
1770 break;
1771
1772 default:
1773 err_msg = " [unsupported type] filename = ";
1774 return false;
1775 }
1776 }
1777
1778
1779
1780 template<typename eT>
1781 inline
1782 bool
1783 field_aux::load(field< Row<eT> >& x, const std::string& name, const file_type type, std::string& err_msg)
1784 {
1785 arma_extra_debug_sigprint();
1786
1787 switch(type)
1788 {
1789 case auto_detect:
1790 return diskio::load_auto_detect(x, name, err_msg);
1791 break;
1792
1793 case arma_binary:
1794 return diskio::load_arma_binary(x, name, err_msg);
1795 break;
1796
1797 case ppm_binary:
1798 return diskio::load_ppm_binary(x, name, err_msg);
1799 break;
1800
1801 default:
1802 err_msg = " [unsupported type] filename = ";
1803 return false;
1804 }
1805 }
1806
1807
1808
1809 template<typename eT>
1810 inline
1811 bool
1812 field_aux::load(field< Row<eT> >& x, std::istream& is, const file_type type, std::string& err_msg)
1813 {
1814 arma_extra_debug_sigprint();
1815
1816 switch(type)
1817 {
1818 case auto_detect:
1819 return diskio::load_auto_detect(x, is, err_msg);
1820 break;
1821
1822 case arma_binary:
1823 return diskio::load_arma_binary(x, is, err_msg);
1824 break;
1825
1826 case ppm_binary:
1827 return diskio::load_ppm_binary(x, is, err_msg);
1828 break;
1829
1830 default:
1831 err_msg = " [unsupported type] filename = ";
1832 return false;
1833 }
1834 }
1835
1836
1837
1838 template<typename eT>
1839 inline
1840 bool
1841 field_aux::save(const field< Cube<eT> >& x, const std::string& name, const file_type type, std::string& err_msg)
1842 {
1843 arma_extra_debug_sigprint();
1844
1845 switch(type)
1846 {
1847 case arma_binary:
1848 return diskio::save_arma_binary(x, name, err_msg);
1849 break;
1850
1851 case ppm_binary:
1852 return diskio::save_ppm_binary(x, name, err_msg);
1853 break;
1854
1855 default:
1856 err_msg = " [unsupported type] filename = ";
1857 return false;
1858 }
1859 }
1860
1861
1862
1863 template<typename eT>
1864 inline
1865 bool
1866 field_aux::save(const field< Cube<eT> >& x, std::ostream& os, const file_type type, std::string& err_msg)
1867 {
1868 arma_extra_debug_sigprint();
1869
1870 switch(type)
1871 {
1872 case arma_binary:
1873 return diskio::save_arma_binary(x, os, err_msg);
1874 break;
1875
1876 case ppm_binary:
1877 return diskio::save_ppm_binary(x, os, err_msg);
1878 break;
1879
1880 default:
1881 err_msg = " [unsupported type] filename = ";
1882 return false;
1883 }
1884 }
1885
1886
1887
1888 template<typename eT>
1889 inline
1890 bool
1891 field_aux::load(field< Cube<eT> >& x, const std::string& name, const file_type type, std::string& err_msg)
1892 {
1893 arma_extra_debug_sigprint();
1894
1895 switch(type)
1896 {
1897 case auto_detect:
1898 return diskio::load_auto_detect(x, name, err_msg);
1899 break;
1900
1901 case arma_binary:
1902 return diskio::load_arma_binary(x, name, err_msg);
1903 break;
1904
1905 case ppm_binary:
1906 return diskio::load_ppm_binary(x, name, err_msg);
1907 break;
1908
1909 default:
1910 err_msg = " [unsupported type] filename = ";
1911 return false;
1912 }
1913 }
1914
1915
1916
1917 template<typename eT>
1918 inline
1919 bool
1920 field_aux::load(field< Cube<eT> >& x, std::istream& is, const file_type type, std::string& err_msg)
1921 {
1922 arma_extra_debug_sigprint();
1923
1924 switch(type)
1925 {
1926 case auto_detect:
1927 return diskio::load_auto_detect(x, is, err_msg);
1928 break;
1929
1930 case arma_binary:
1931 return diskio::load_arma_binary(x, is, err_msg);
1932 break;
1933
1934 case ppm_binary:
1935 return diskio::load_ppm_binary(x, is, err_msg);
1936 break;
1937
1938 default:
1939 err_msg = " [unsupported type] filename = ";
1940 return false;
1941 }
1942 }
1943
1944
1945
1946 inline
1947 bool
1948 field_aux::save(const field< std::string >& x, const std::string& name, const file_type type, std::string& err_msg)
1949 {
1950 arma_extra_debug_sigprint();
1951
1952 arma_ignore(type);
1953
1954 err_msg.clear();
1955
1956 return diskio::save_std_string(x, name);
1957 }
1958
1959
1960
1961 inline
1962 bool
1963 field_aux::save(const field< std::string >& x, std::ostream& os, const file_type type, std::string& err_msg)
1964 {
1965 arma_extra_debug_sigprint();
1966
1967 arma_ignore(type);
1968
1969 err_msg.clear();
1970
1971 return diskio::save_std_string(x, os);
1972 }
1973
1974
1975
1976 inline
1977 bool
1978 field_aux::load(field< std::string >& x, const std::string& name, const file_type type, std::string& err_msg)
1979 {
1980 arma_extra_debug_sigprint();
1981
1982 arma_ignore(type);
1983
1984 return diskio::load_std_string(x, name, err_msg);
1985 }
1986
1987
1988
1989 inline
1990 bool
1991 field_aux::load(field< std::string >& x, std::istream& is, const file_type type, std::string& err_msg)
1992 {
1993 arma_extra_debug_sigprint();
1994
1995 arma_ignore(type);
1996
1997 return diskio::load_std_string(x, is, err_msg);
1998 }
1999
2000
2001
2002 #ifdef ARMA_EXTRA_FIELD_MEAT
2003 #include ARMA_INCFILE_WRAP(ARMA_EXTRA_FIELD_MEAT)
2004 #endif
2005
2006
2007
2008 //! @}