GNU Octave
4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
|
#include "chNDArray.h"
Public Types | |
typedef bool(* | compare_fcn_type )(typename ref_param< char >::type, typename ref_param< char >::type) |
typedef ref_param< char >::type | crefT |
typedef char | element_type |
typedef charMatrix | matrix_type |
typedef octave_idx_type | size_type |
Used for operator(), and returned by numel() and size() (beware: signed integer) More... | |
typedef char | value_type |
Public Member Functions | |
charNDArray (void) | |
charNDArray (const dim_vector &dv) | |
charNDArray (const dim_vector &dv, char val) | |
charNDArray (const charNDArray &a) | |
charNDArray (const Array< char > &a) | |
charNDArray (char c) | |
charNDArray (const char *s) | |
charNDArray (const std::string &s) | |
charNDArray (const string_vector &s, char fill_value= '\0') | |
boolNDArray | all (int dim=-1) const |
boolNDArray | any (int dim=-1) const |
bool | any_element_is_nan (void) const |
Array< char > | as_column (void) const |
Return the array as a column vector. More... | |
Array< char > | as_matrix (void) const |
Return the array as a matrix. More... | |
Array< char > | as_row (void) const |
Return the array as a row vector. More... | |
size_t | byte_size (void) const |
char & | checkelem (octave_idx_type n) |
char & | checkelem (octave_idx_type i, octave_idx_type j) |
char & | checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) |
char & | checkelem (const Array< octave_idx_type > &ra_idx) |
crefT | checkelem (octave_idx_type n) const |
crefT | checkelem (octave_idx_type i, octave_idx_type j) const |
crefT | checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const |
crefT | checkelem (const Array< octave_idx_type > &ra_idx) const |
void | clear (void) |
void | clear (const dim_vector &dv) |
void | clear (octave_idx_type r, octave_idx_type c) |
Array< char > | column (octave_idx_type k) const |
Extract column: A(:,k+1). More... | |
octave_idx_type | compute_index (octave_idx_type i, octave_idx_type j) const |
octave_idx_type | compute_index (octave_idx_type i, octave_idx_type j, octave_idx_type k) const |
octave_idx_type | compute_index (const Array< octave_idx_type > &ra_idx) const |
octave_idx_type | compute_index_unchecked (const Array< octave_idx_type > &ra_idx) const |
charNDArray | concat (const charNDArray &rb, const Array< octave_idx_type > &ra_idx) |
charNDArray | concat (const NDArray &rb, const Array< octave_idx_type > &ra_idx) |
const char * | data (void) const |
charNDArray | diag (octave_idx_type k=0) const |
charNDArray | diag (octave_idx_type m, octave_idx_type n) const |
const dim_vector & | dims (void) const |
Return a const-reference so that dims ()(i) works efficiently. More... | |
char & | elem (octave_idx_type n) |
char & | elem (octave_idx_type i, octave_idx_type j) |
char & | elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) |
char & | elem (const Array< octave_idx_type > &ra_idx) |
crefT | elem (octave_idx_type n) const |
crefT | elem (octave_idx_type i, octave_idx_type j) const |
crefT | elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const |
crefT | elem (const Array< octave_idx_type > &ra_idx) const |
void | fill (const char &val) |
Array< octave_idx_type > | find (octave_idx_type n=-1, bool backward=false) const |
Find indices of (at most n) nonzero elements. More... | |
const char * | fortran_vec (void) const |
char * | fortran_vec (void) |
Array< char > | hermitian (char(*fcn)(const char &)=0) const |
charNDArray & | insert (const charNDArray &a, octave_idx_type r, octave_idx_type c) |
charNDArray & | insert (const charNDArray &a, const Array< octave_idx_type > &ra_idx) |
Array< char > & | insert (const Array< char > &a, const Array< octave_idx_type > &idx) |
Insert an array into another at a specified position. More... | |
Array< char > & | insert (const Array< char > &a, octave_idx_type r, octave_idx_type c) |
This is just a special case for idx = [r c 0 ...]. More... | |
Array< char > | ipermute (const Array< octave_idx_type > &vec) const |
bool | is_empty (void) const |
bool | is_shared (void) |
sortmode | is_sorted (sortmode mode=UNSORTED) const |
Ordering is auto-detected or can be specified. More... | |
sortmode | is_sorted_rows (sortmode mode=UNSORTED) const |
Ordering is auto-detected or can be specified. More... | |
bool | is_square (void) const |
bool | is_vector (void) const |
Array< char > | linear_slice (octave_idx_type lo, octave_idx_type up) const |
Extract a slice from this array as a column vector: A(:)(lo+1:up). More... | |
octave_idx_type | lookup (const char &value, sortmode mode=UNSORTED) const |
Do a binary lookup in a sorted array. More... | |
Array< octave_idx_type > | lookup (const Array< char > &values, sortmode mode=UNSORTED) const |
Ditto, but for an array of values, specializing on the case when values are sorted. More... | |
void | make_unique (void) |
Array< U > | map (F fcn) const |
Apply function fcn to each element of the Array<T>. More... | |
charNDArray | max (int dim=-1) const |
charNDArray | max (Array< octave_idx_type > &index, int dim=-1) const |
void | maybe_economize (void) |
void * | mex_get_data (void) const |
Give a pointer to the data in mex format. More... | |
charNDArray | min (int dim=-1) const |
charNDArray | min (Array< octave_idx_type > &index, int dim=-1) const |
int | ndims (void) const |
octave_idx_type | nnz (void) const |
Count nonzero elements. More... | |
Array< char > | nth_element (const idx_vector &n, int dim=0) const |
Returns the n-th element in increasing order, using the same ordering as used for sort. More... | |
char & | operator() (octave_idx_type n) |
char & | operator() (octave_idx_type i, octave_idx_type j) |
char & | operator() (octave_idx_type i, octave_idx_type j, octave_idx_type k) |
char & | operator() (const Array< octave_idx_type > &ra_idx) |
crefT | operator() (octave_idx_type n) const |
crefT | operator() (octave_idx_type i, octave_idx_type j) const |
crefT | operator() (octave_idx_type i, octave_idx_type j, octave_idx_type k) const |
crefT | operator() (const Array< octave_idx_type > &ra_idx) const |
charNDArray & | operator= (const charNDArray &a) |
bool | optimize_dimensions (const dim_vector &dv) |
Returns true if this->dims () == dv, and if so, replaces this->dimensions by a shallow copy of dv. More... | |
Array< char > | page (octave_idx_type k) const |
Extract page: A(:,:,k+1). More... | |
Array< char > | permute (const Array< octave_idx_type > &vec, bool inv=false) const |
void | print_info (std::ostream &os, const std::string &prefix) const |
Array< char > | reshape (octave_idx_type nr, octave_idx_type nc) const |
Array< char > | reshape (const dim_vector &new_dims) const |
virtual char | resize_fill_value (void) const |
size_type | size (const size_type d) const |
Size of the specified dimension. More... | |
Array< char > | sort (int dim=0, sortmode mode=ASCENDING) const |
Array< char > | sort (Array< octave_idx_type > &sidx, int dim=0, sortmode mode=ASCENDING) const |
Array< octave_idx_type > | sort_rows_idx (sortmode mode=ASCENDING) const |
Sort by rows returns only indices. More... | |
charNDArray | squeeze (void) const |
bool | test (F fcn) const |
Generic any/all test functionality with arbitrary predicate. More... | |
Array< char > | transpose (void) const |
char & | xelem (octave_idx_type n) |
crefT | xelem (octave_idx_type n) const |
char & | xelem (octave_idx_type i, octave_idx_type j) |
crefT | xelem (octave_idx_type i, octave_idx_type j) const |
char & | xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) |
crefT | xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const |
char & | xelem (const Array< octave_idx_type > &ra_idx) |
crefT | xelem (const Array< octave_idx_type > &ra_idx) const |
octave_idx_type | capacity (void) const |
Number of elements in the array. More... | |
octave_idx_type | length (void) const |
Number of elements in the array. More... | |
octave_idx_type | nelem (void) const |
Number of elements in the array. More... | |
octave_idx_type | numel (void) const |
Number of elements in the array. More... | |
First dimension | |
Get the first dimension of the array (number of rows) | |
octave_idx_type | dim1 (void) const |
octave_idx_type | rows (void) const |
Second dimension | |
Get the second dimension of the array (number of columns) | |
octave_idx_type | dim2 (void) const |
octave_idx_type | cols (void) const |
octave_idx_type | columns (void) const |
Third dimension | |
Get the third dimension of the array (number of pages) | |
octave_idx_type | dim3 (void) const |
octave_idx_type | pages (void) const |
Array< char > | index (const idx_vector &i) const |
Indexing without resizing. More... | |
Array< char > | index (const idx_vector &i, const idx_vector &j) const |
Array< char > | index (const Array< idx_vector > &ia) const |
Array< char > | index (const idx_vector &i, bool resize_ok, const char &rfv) const |
Indexing with possible resizing and fill. More... | |
Array< char > | index (const idx_vector &i, bool resize_ok) const |
Array< char > | index (const idx_vector &i, const idx_vector &j, bool resize_ok, const char &rfv) const |
Array< char > | index (const idx_vector &i, const idx_vector &j, bool resize_ok) const |
Array< char > | index (const Array< idx_vector > &ia, bool resize_ok, const char &rfv) const |
Array< char > | index (const Array< idx_vector > &ia, bool resize_ok) const |
void | resize2 (octave_idx_type nr, octave_idx_type nc, const char &rfv) |
Resizing (with fill). More... | |
void | resize2 (octave_idx_type nr, octave_idx_type nc) |
void | resize1 (octave_idx_type n, const char &rfv) |
void | resize1 (octave_idx_type n) |
void | resize (const dim_vector &dv, const char &rfv) |
void | resize (const dim_vector &dv) |
void | assign (const idx_vector &i, const Array< char > &rhs, const char &rfv) |
Indexed assignment (always with resize & fill). More... | |
void | assign (const idx_vector &i, const Array< char > &rhs) |
void | assign (const idx_vector &i, const idx_vector &j, const Array< char > &rhs, const char &rfv) |
void | assign (const idx_vector &i, const idx_vector &j, const Array< char > &rhs) |
void | assign (const Array< idx_vector > &ia, const Array< char > &rhs, const char &rfv) |
void | assign (const Array< idx_vector > &ia, const Array< char > &rhs) |
void | delete_elements (const idx_vector &i) |
Deleting elements. More... | |
void | delete_elements (int dim, const idx_vector &i) |
A(:,...,I,...,:) = [] (>= 2 subscripts, one of them is non-colon) More... | |
void | delete_elements (const Array< idx_vector > &ia) |
Dispatcher to the above two. More... | |
Array< U > | map (U(&fcn)(char)) const |
Overloads for function references. More... | |
Array< U > | map (U(&fcn)(const char &)) const |
bool | test_any (F fcn) const |
Simpler calls. More... | |
bool | test_all (F fcn) const |
bool | test_any (bool(&fcn)(char)) const |
Overloads for function references. More... | |
bool | test_any (bool(&fcn)(const char &)) const |
bool | test_all (bool(&fcn)(char)) const |
bool | test_all (bool(&fcn)(const char &)) const |
int * | jit_ref_count (void) |
WARNING: Only call these functions from jit. More... | |
char * | jit_slice_data (void) const |
octave_idx_type * | jit_dimensions (void) const |
void * | jit_array_rep (void) const |
Static Public Member Functions | |
static Array< char > | cat (int dim, octave_idx_type n, const Array< char > *array_list) |
Concatenation along a specified (0-based) dimension, equivalent to cat(). More... | |
static octave_idx_type | compute_index (Array< octave_idx_type > &ra_idx, const dim_vector &dimensions) |
static void | increment_index (Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension=0) |
Protected Attributes | |
dim_vector | dimensions |
Array< char >::ArrayRep * | rep |
char * | slice_data |
octave_idx_type | slice_len |
Definition at line 37 of file chNDArray.h.
|
inherited |
typedef charMatrix charNDArray::matrix_type |
Definition at line 43 of file chNDArray.h.
|
inherited |
|
inherited |
|
inline |
Definition at line 45 of file chNDArray.h.
|
inline |
Definition at line 47 of file chNDArray.h.
|
inline |
Definition at line 49 of file chNDArray.h.
|
inline |
Definition at line 51 of file chNDArray.h.
|
inline |
Definition at line 53 of file chNDArray.h.
charNDArray::charNDArray | ( | char | c | ) |
Definition at line 40 of file chNDArray.cc.
References c, Array< char >::elem(), and Array< char >::resize1().
charNDArray::charNDArray | ( | const char * | s | ) |
Definition at line 50 of file chNDArray.cc.
References Array< char >::elem(), Array< char >::resize1(), and strlen().
charNDArray::charNDArray | ( | const std::string & | s | ) |
Definition at line 61 of file chNDArray.cc.
References Array< char >::elem(), and Array< char >::resize1().
charNDArray::charNDArray | ( | const string_vector & | s, |
char | fill_value = '\0' |
||
) |
Definition at line 72 of file chNDArray.cc.
References Array< char >::elem(), Array< char >::rows(), s, and string.
boolNDArray charNDArray::all | ( | int | dim = -1 | ) | const |
Definition at line 89 of file chNDArray.cc.
References mx_inline_all().
boolNDArray charNDArray::any | ( | int | dim = -1 | ) | const |
Definition at line 95 of file chNDArray.cc.
References mx_inline_any().
|
inline |
Definition at line 69 of file chNDArray.h.
|
inherited |
Indexed assignment (always with resize & fill).
|
inlineinherited |
|
inherited |
|
inlineinherited |
|
inherited |
|
inlineinherited |
|
inlineinherited |
|
staticinherited |
Concatenation along a specified (0-based) dimension, equivalent to cat().
dim = -1 corresponds to dim = 0 and dim = -2 corresponds to dim = 1, but apply the looser matching rules of vertcat/horzcat.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inlineinherited |
|
inlineinherited |
Definition at line 409 of file Array.h.
Referenced by charMatrix::insert(), charMatrix::operator==(), and charMatrix::row_as_string().
|
inherited |
Extract column: A(:,k+1).
|
inlineinherited |
|
static |
Definition at line 186 of file chNDArray.cc.
References compute_index().
|
inherited |
|
inherited |
|
inherited |
|
inlineinherited |
charNDArray charNDArray::concat | ( | const charNDArray & | rb, |
const Array< octave_idx_type > & | ra_idx | ||
) |
Definition at line 101 of file chNDArray.cc.
References insert(), and Array< T >::numel().
charNDArray charNDArray::concat | ( | const NDArray & | rb, |
const Array< octave_idx_type > & | ra_idx | ||
) |
Definition at line 110 of file chNDArray.cc.
References d, Array< T >::dims(), Array< T >::elem(), insert(), Array< T >::is_empty(), octave::math::isnan(), max(), octave::math::nint_big(), Array< T >::numel(), and tmp.
|
inlineinherited |
Definition at line 582 of file Array.h.
Referenced by charMatrix::operator==().
|
inherited |
Deleting elements.
A(I) = [] (with a single subscript)
|
inherited |
A(:,...,I,...,:) = [] (>= 2 subscripts, one of them is non-colon)
|
inherited |
Dispatcher to the above two.
charNDArray charNDArray::diag | ( | octave_idx_type | k = 0 | ) | const |
Definition at line 193 of file chNDArray.cc.
References Array< T >::diag().
charNDArray charNDArray::diag | ( | octave_idx_type | m, |
octave_idx_type | n | ||
) | const |
Definition at line 199 of file chNDArray.cc.
References Array< T >::diag().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Definition at line 482 of file Array.h.
Referenced by charNDArray(), charMatrix::extract(), charMatrix::insert(), and charMatrix::row_as_string().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
|
inherited |
Find indices of (at most n) nonzero elements.
If n is specified, backward specifies search from backward.
|
inlineinherited |
|
inherited |
|
static |
Definition at line 178 of file chNDArray.cc.
|
inherited |
Indexing without resizing.
|
inherited |
|
inherited |
|
inherited |
Indexing with possible resizing and fill.
|
inlineinherited |
|
inherited |
|
inlineinherited |
|
inherited |
|
inlineinherited |
charNDArray & charNDArray::insert | ( | const charNDArray & | a, |
octave_idx_type | r, | ||
octave_idx_type | c | ||
) |
Definition at line 164 of file chNDArray.cc.
References Array< T >::insert().
Referenced by concat(), FloatNDArray::concat(), and NDArray::concat().
charNDArray & charNDArray::insert | ( | const charNDArray & | a, |
const Array< octave_idx_type > & | ra_idx | ||
) |
Definition at line 171 of file chNDArray.cc.
References Array< T >::insert().
|
inherited |
Insert an array into another at a specified position.
If size (a) is [d1 d2 ... dN] and idx is [i1 i2 ... iN], this method is equivalent to x(i1:i1+d1-1, i2:i2+d2-1, ... , iN:iN+dN-1) = a.
|
inherited |
This is just a special case for idx = [r c 0 ...].
|
inlineinherited |
Ordering is auto-detected or can be specified.
Ordering is auto-detected or can be specified.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Number of elements in the array.
Synonymous with numel().
length
() at the Octave interpreter. At the Octave interpreter, the function length
() returns the length of the greatest dimension. This method returns the total number of elements.
|
inherited |
Extract a slice from this array as a column vector: A(:)(lo+1:up).
Must be 0 <= lo && up <= numel. May be up < lo.
|
inherited |
Do a binary lookup in a sorted array.
Must not contain NaNs. Mode can be specified or is auto-detected by comparing 1st and last element.
|
inherited |
Ditto, but for an array of values, specializing on the case when values are sorted.
NaNs get the value N.
charNDArray charNDArray::max | ( | int | dim = -1 | ) | const |
Definition at line 140 of file chNDArray.cc.
References mx_inline_max().
Referenced by do_minmax_red_op< charNDArray >().
charNDArray charNDArray::max | ( | Array< octave_idx_type > & | index, |
int | dim = -1 |
||
) | const |
Definition at line 146 of file chNDArray.cc.
References mx_inline_max().
|
inlineinherited |
|
inlineinherited |
charNDArray charNDArray::min | ( | int | dim = -1 | ) | const |
Definition at line 152 of file chNDArray.cc.
References mx_inline_min().
Referenced by do_minmax_red_op< charNDArray >().
charNDArray charNDArray::min | ( | Array< octave_idx_type > & | index, |
int | dim = -1 |
||
) | const |
Definition at line 158 of file chNDArray.cc.
References mx_inline_min().
|
inlineinherited |
|
inherited |
Count nonzero elements.
|
inherited |
Returns the n-th element in increasing order, using the same ordering as used for sort.
n can either be a scalar index or a contiguous range.
|
inlineinherited |
Number of elements in the array.
Definition at line 363 of file Array.h.
Referenced by charMatrix::operator==().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inline |
Definition at line 63 of file chNDArray.h.
References Array< T >::operator=().
|
inherited |
Returns true if this->dims () == dv, and if so, replaces this->dimensions by a shallow copy of dv.
This is useful for maintaining several arrays with supposedly equal dimensions (e.g. structs in the interpreter).
|
inherited |
Extract page: A(:,:,k+1).
|
inlineinherited |
|
inherited |
|
inherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
|
inlineinherited |
|
inherited |
Referenced by charNDArray().
|
inlineinherited |
|
inherited |
Resizing (with fill).
|
inlineinherited |
|
virtualinherited |
|
inlineinherited |
Definition at line 401 of file Array.h.
Referenced by charNDArray(), charMatrix::insert(), charMatrix::operator==(), and charMatrix::row_as_string().
|
inherited |
|
inherited |
Sort by rows returns only indices.
|
inline |
Definition at line 89 of file chNDArray.h.
References Array< T >::squeeze().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
protectedinherited |
|
protectedinherited |