GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Cell.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1999-2017 John W. Eaton
4 Copyright (C) 2009-2010 VZLU Prague
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if ! defined (octave_Cell_h)
25 #define octave_Cell_h 1
26 
27 #include "octave-config.h"
28 
29 #include <string>
30 
31 #include "Array.h"
32 #include "str-vec.h"
33 #include "ov.h"
34 
35 class octave_value_list;
36 
37 class
40 {
41 public:
42 
43  Cell (void)
44  : Array<octave_value> (dim_vector (0, 0)) { }
45 
47  : Array<octave_value> (dim_vector (1, 1), val) { }
48 
49  Cell (const octave_value_list& ovl);
50 
52  const octave_value& val = Matrix ())
53  : Array<octave_value> (dim_vector (n, m), val) { }
54 
55  Cell (const dim_vector& dv, const octave_value& val = Matrix ())
56  : Array<octave_value> (dv, val) { }
57 
59  : Array<octave_value> (c) { }
60 
62  : Array<octave_value> (c, dim_vector (nr, nc)) { }
63 
64  Cell (const string_vector& sv, bool trim = false);
65 
66  Cell (const std::list<std::string>& lst);
67 
68  Cell (const Array<std::string>& sa);
69 
70  Cell (const dim_vector& dv, const string_vector& sv, bool trim = false);
71 
72  Cell (const Cell& c)
73  : Array<octave_value> (c) { }
74 
75  bool is_cellstr (void) const;
76 
77  Array<std::string> cellstr_value (void) const;
78 
80 
81  Cell index (const octave_value_list& idx, bool resize_ok = false) const;
82 
84 
85  void delete_elements (const octave_value_list& idx);
86 
88 
89  void assign (const octave_value_list& idx, const Cell& rhs,
90  const octave_value& fill_val = Matrix ());
91 
92  Cell reshape (const dim_vector& new_dims) const
93  { return Array<octave_value>::reshape (new_dims); }
94 
95  octave_idx_type nnz (void) const;
96 
97  Cell column (octave_idx_type i) const;
98 
99  // FIXME
100  boolMatrix all (int /* dim */ = 0) const { return boolMatrix (); }
101 
102  // FIXME
103  boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); }
104 
105  Cell concat (const Cell& rb, const Array<octave_idx_type>& ra_idx);
106 
107  Cell& insert (const Cell& a, octave_idx_type r, octave_idx_type c);
108  Cell& insert (const Cell& a, const Array<octave_idx_type>& ra_idx);
109 
110  // FIXME
111  bool any_element_is_nan (void) const { return false; }
112  bool is_true (void) const { return false; }
113 
114  octave_value resize_fill_value (void) const;
115 
116  Cell diag (octave_idx_type k = 0) const;
117 
118  Cell diag (octave_idx_type m, octave_idx_type n) const;
119 
120  Cell xisalnum (void) const { return map (&octave_value::xisalnum); }
121  Cell xisalpha (void) const { return map (&octave_value::xisalpha); }
122  Cell xisascii (void) const { return map (&octave_value::xisascii); }
123  Cell xiscntrl (void) const { return map (&octave_value::xiscntrl); }
124  Cell xisdigit (void) const { return map (&octave_value::xisdigit); }
125  Cell xisgraph (void) const { return map (&octave_value::xisgraph); }
126  Cell xislower (void) const { return map (&octave_value::xislower); }
127  Cell xisprint (void) const { return map (&octave_value::xisprint); }
128  Cell xispunct (void) const { return map (&octave_value::xispunct); }
129  Cell xisspace (void) const { return map (&octave_value::xisspace); }
130  Cell xisupper (void) const { return map (&octave_value::xisupper); }
131  Cell xisxdigit (void) const { return map (&octave_value::xisxdigit); }
132  Cell xtoascii (void) const { return map (&octave_value::xtoascii); }
133  Cell xtolower (void) const { return map (&octave_value::xtolower); }
134  Cell xtoupper (void) const { return map (&octave_value::xtoupper); }
135 
136 private:
137 
138  typedef octave_value (octave_value::*ctype_mapper) (void) const;
139 
140  Cell map (ctype_mapper) const;
141 };
142 
143 template <>
145 { return v.cell_value (); }
146 
147 #endif
boolMatrix all(int=0) const
Definition: Cell.h:100
Cell xtolower(void) const
Definition: Cell.h:133
OCTAVE_EXPORT octave_value_list column
Definition: sparse.cc:123
Definition: Cell.h:37
Cell xispunct(void) const
Definition: Cell.h:128
Cell xisxdigit(void) const
Definition: Cell.h:131
Cell xisupper(void) const
Definition: Cell.h:130
const octave_base_value const Array< octave_idx_type > & ra_idx
Cell reshape(const dim_vector &new_dims) const
Definition: Cell.h:92
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).is_integer_type())
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
octave_value xisalpha(void) const
Definition: ov.h:1395
Cell(const dim_vector &dv, const octave_value &val=Matrix())
Definition: Cell.h:55
Cell xisgraph(void) const
Definition: Cell.h:125
Cell xisspace(void) const
Definition: Cell.h:129
for large enough k
Definition: lu.cc:606
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:655
octave_value xisprint(void) const
Definition: ov.h:1401
octave_value xtoascii(void) const
Definition: ov.h:1407
octave_value xisxdigit(void) const
Definition: ov.h:1405
boolMatrix any(int=0) const
Definition: Cell.h:103
Cell xisprint(void) const
Definition: Cell.h:127
Cell(const Cell &c)
Definition: Cell.h:72
Cell(const Array< octave_value > &c)
Definition: Cell.h:58
octave_value xispunct(void) const
Definition: ov.h:1402
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
octave_value xtolower(void) const
Definition: ov.h:1408
bool is_true(void) const
Definition: Cell.h:112
#define OCTINTERP_API
Definition: mexproto.h:69
nd deftypefn *octave_map m
Definition: ov-struct.cc:2058
octave_value xisalnum(void) const
Definition: ov.h:1394
Cell(octave_idx_type n, octave_idx_type m, const octave_value &val=Matrix())
Definition: Cell.h:51
octave_value xisupper(void) const
Definition: ov.h:1404
octave_value xisspace(void) const
Definition: ov.h:1403
Definition: dMatrix.h:37
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
bool any_element_is_nan(void) const
Definition: Cell.h:111
Cell(const Array< octave_value > &c, octave_idx_type nr, octave_idx_type nc)
Definition: Cell.h:61
octave_value xiscntrl(void) const
Definition: ov.h:1397
Cell xisalnum(void) const
Definition: Cell.h:120
Cell octave_value_extract< Cell >(const octave_value &v)
Definition: Cell.h:144
Cell xtoupper(void) const
Definition: Cell.h:134
octave_value xtoupper(void) const
Definition: ov.h:1409
Cell xiscntrl(void) const
Definition: Cell.h:123
octave_value xisascii(void) const
Definition: ov.h:1396
Cell xisascii(void) const
Definition: Cell.h:122
=val(i)}if ode{val(i)}occurs in table i
Definition: lookup.cc:239
octave_map map(dims)
Cell(void)
Definition: Cell.h:43
octave_value xisgraph(void) const
Definition: ov.h:1399
Cell xisalpha(void) const
Definition: Cell.h:121
Array< T > reshape(octave_idx_type nr, octave_idx_type nc) const
Definition: Array.h:563
Cell xisdigit(void) const
Definition: Cell.h:124
Cell(const octave_value &val)
Definition: Cell.h:46
octave_value xisdigit(void) const
Definition: ov.h:1398
Cell xislower(void) const
Definition: Cell.h:126
octave_value xislower(void) const
Definition: ov.h:1400
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
dim_vector dv
Definition: sub2ind.cc:263
Cell xtoascii(void) const
Definition: Cell.h:132
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))