source: mmcs/armadillo_bits/SizeCube_meat.hpp @ 8daa049

matrices
Last change on this file since 8daa049 was 9dd61b1, checked in by rboet <rboet@…>, 9 years ago

Avance del proyecto 60%

  • Property mode set to 100644
File size: 2.4 KB
Line 
1// Copyright (C) 2013-2014 Conrad Sanderson
2// Copyright (C) 2013-2014 NICTA (www.nicta.com.au)
3//
4// This Source Code Form is subject to the terms of the Mozilla Public
5// License, v. 2.0. If a copy of the MPL was not distributed with this
6// file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8
9//! \addtogroup SizeCube
10//! @{
11
12
13
14inline
15SizeCube::SizeCube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices)
16  : n_rows  (in_n_rows  )
17  , n_cols  (in_n_cols  )
18  , n_slices(in_n_slices)
19  {
20  arma_extra_debug_sigprint();
21  }
22
23
24
25// inline
26// SizeCube::operator SizeMat () const
27//   {
28//   arma_debug_check( (n_slices != 1), "SizeCube: n_slices != 1, hence cube size cannot be interpreted as matrix size" );
29//   
30//   return SizeMat(n_rows, n_cols);
31//   }
32
33
34
35inline
36bool
37SizeCube::operator==(const SizeCube& s) const
38  {
39  if(n_rows   != s.n_rows  )  { return false; }
40 
41  if(n_cols   != s.n_cols  )  { return false; }
42 
43  if(n_slices != s.n_slices)  { return false; }
44 
45  return true;
46  }
47
48
49
50inline
51bool
52SizeCube::operator!=(const SizeCube& s) const
53  {
54  if(n_rows   != s.n_rows  )  { return true; }
55 
56  if(n_cols   != s.n_cols  )  { return true; }
57 
58  if(n_slices != s.n_slices)  { return true; }
59 
60  return false;
61  }
62
63
64
65inline
66bool
67SizeCube::operator==(const SizeMat& s) const
68  {
69  if(n_rows   != s.n_rows)  { return false; }
70 
71  if(n_cols   != s.n_cols)  { return false; }
72 
73  if(n_slices != uword(1))  { return false; }
74 
75  return true;
76  }
77
78
79
80inline
81bool
82SizeCube::operator!=(const SizeMat& s) const
83  {
84  if(n_rows   != s.n_rows)  { return true; }
85 
86  if(n_cols   != s.n_cols)  { return true; }
87 
88  if(n_slices != uword(1))  { return true; }
89 
90  return false;
91  }
92
93
94
95inline
96void
97SizeCube::print(const std::string extra_text) const
98  {
99  arma_extra_debug_sigprint();
100 
101  if(extra_text.length() != 0)
102    {
103    const std::streamsize orig_width = ARMA_DEFAULT_OSTREAM.width();
104   
105    ARMA_DEFAULT_OSTREAM << extra_text << ' ';
106 
107    ARMA_DEFAULT_OSTREAM.width(orig_width);
108    }
109 
110  arma_ostream::print(ARMA_DEFAULT_OSTREAM, *this);
111  }
112
113
114
115inline
116void
117SizeCube::print(std::ostream& user_stream, const std::string extra_text) const
118  {
119  arma_extra_debug_sigprint();
120 
121  if(extra_text.length() != 0)
122    {
123    const std::streamsize orig_width = user_stream.width();
124   
125    user_stream << extra_text << ' ';
126   
127    user_stream.width(orig_width);
128    }
129 
130  arma_ostream::print(user_stream, *this);
131  }
132
133
134
135//! @}
Note: See TracBrowser for help on using the repository browser.