Array-util.h | Array-util.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2000-2012 John W. Eaton | Copyright (C) 2000-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 32 | skipping to change at line 32 | |||
#if !defined (octave_Array_util_h) | #if !defined (octave_Array_util_h) | |||
#define octave_Array_util_h 1 | #define octave_Array_util_h 1 | |||
#include "Array.h" | #include "Array.h" | |||
#include "dim-vector.h" | #include "dim-vector.h" | |||
#include "idx-vector.h" | #include "idx-vector.h" | |||
#include "lo-array-gripes.h" | #include "lo-array-gripes.h" | |||
extern OCTAVE_API bool index_in_bounds (const Array<octave_idx_type>& ra_id x, | extern OCTAVE_API bool index_in_bounds (const Array<octave_idx_type>& ra_id x, | |||
const dim_vector& dimensions); | const dim_vector& dimensions); | |||
extern OCTAVE_API void increment_index (Array<octave_idx_type>& ra_idx, | extern OCTAVE_API void increment_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions, | const dim_vector& dimensions, | |||
int start_dimension = 0); | int start_dimension = 0); | |||
extern OCTAVE_API octave_idx_type get_scalar_idx (Array<octave_idx_type>& i | extern OCTAVE_API octave_idx_type get_scalar_idx (Array<octave_idx_type>& i | |||
dx, dim_vector& dims); | dx, | |||
dim_vector& dims); | ||||
extern OCTAVE_API octave_idx_type num_ones (const Array<octave_idx_type>& r | extern OCTAVE_API octave_idx_type num_ones (const Array<octave_idx_type>& | |||
a_idx); | ra_idx); | |||
extern OCTAVE_API bool is_scalar (const dim_vector& dim); | extern OCTAVE_API bool is_scalar (const dim_vector& dim); | |||
extern OCTAVE_API bool is_vector (const dim_vector& dim); | extern OCTAVE_API bool is_vector (const dim_vector& dim); | |||
extern OCTAVE_API bool any_ones (const Array<octave_idx_type>& arr); | extern OCTAVE_API bool any_ones (const Array<octave_idx_type>& arr); | |||
// These four compute a linear index for given dimensions, throwing | // These four compute a linear index for given dimensions, throwing | |||
// exceptions on invalid indices. | // exceptions on invalid indices. | |||
extern OCTAVE_API octave_idx_type | extern OCTAVE_API octave_idx_type | |||
skipping to change at line 63 | skipping to change at line 65 | |||
extern OCTAVE_API octave_idx_type | extern OCTAVE_API octave_idx_type | |||
compute_index (octave_idx_type i, octave_idx_type j, const dim_vector& dims ); | compute_index (octave_idx_type i, octave_idx_type j, const dim_vector& dims ); | |||
extern OCTAVE_API octave_idx_type | extern OCTAVE_API octave_idx_type | |||
compute_index (octave_idx_type i, octave_idx_type j, octave_idx_type k, | compute_index (octave_idx_type i, octave_idx_type j, octave_idx_type k, | |||
const dim_vector& dims); | const dim_vector& dims); | |||
extern OCTAVE_API octave_idx_type | extern OCTAVE_API octave_idx_type | |||
compute_index (const Array<octave_idx_type>& ra_idx, const dim_vector& dims ); | compute_index (const Array<octave_idx_type>& ra_idx, const dim_vector& dims ); | |||
extern OCTAVE_API Array<octave_idx_type> conv_to_int_array (const Array<idx | extern OCTAVE_API Array<octave_idx_type> | |||
_vector>& a); | conv_to_int_array (const Array<idx_vector>& a); | |||
extern OCTAVE_API Array<idx_vector> conv_to_array (const idx_vector *tmp, c | extern OCTAVE_API Array<idx_vector> conv_to_array (const idx_vector *tmp, | |||
onst octave_idx_type len); | const octave_idx_type le | |||
n); | ||||
extern OCTAVE_API dim_vector freeze (Array<idx_vector>& ra_idx, | extern OCTAVE_API dim_vector freeze (Array<idx_vector>& ra_idx, | |||
const dim_vector& dimensions, int resize_ok); | const dim_vector& dimensions, | |||
int resize_ok); | ||||
extern OCTAVE_API bool vector_equivalent (const dim_vector& dv); | extern OCTAVE_API bool vector_equivalent (const dim_vector& dv); | |||
extern OCTAVE_API bool all_ok (const Array<idx_vector>& ra_idx); | extern OCTAVE_API bool all_ok (const Array<idx_vector>& ra_idx); | |||
extern OCTAVE_API bool any_orig_empty (const Array<idx_vector>& ra_idx); | extern OCTAVE_API bool any_orig_empty (const Array<idx_vector>& ra_idx); | |||
extern OCTAVE_API bool all_colon_equiv (const Array<idx_vector>& ra_idx, | extern OCTAVE_API bool all_colon_equiv (const Array<idx_vector>& ra_idx, | |||
const dim_vector& frozen_lengths); | const dim_vector& frozen_lengths); | |||
extern OCTAVE_API bool all_ones (const Array<octave_idx_type>& arr); | extern OCTAVE_API bool all_ones (const Array<octave_idx_type>& arr); | |||
extern OCTAVE_API Array<octave_idx_type> get_elt_idx (const Array<idx_vecto | extern OCTAVE_API Array<octave_idx_type> | |||
r>& ra_idx, | get_elt_idx (const Array<idx_vector>& ra_idx, | |||
const Array<octave_idx_type>& result_idx); | const Array<octave_idx_type>& result_idx); | |||
extern OCTAVE_API Array<octave_idx_type> get_ra_idx (octave_idx_type idx, c | extern OCTAVE_API Array<octave_idx_type> get_ra_idx (octave_idx_type idx, | |||
onst dim_vector& dims); | const dim_vector& dims | |||
); | ||||
extern OCTAVE_API dim_vector zero_dims_inquire (const Array<idx_vector>& ia , | extern OCTAVE_API dim_vector zero_dims_inquire (const Array<idx_vector>& ia , | |||
const dim_vector& rhdv); | const dim_vector& rhdv); | |||
extern OCTAVE_API dim_vector zero_dims_inquire (const idx_vector& i, const | extern OCTAVE_API dim_vector zero_dims_inquire (const idx_vector& i, | |||
idx_vector& j, | const idx_vector& j, | |||
const dim_vector& rhdv); | const dim_vector& rhdv); | |||
extern OCTAVE_API idx_vector sub2ind (const dim_vector& dv, const Array<idx | extern OCTAVE_API idx_vector sub2ind (const dim_vector& dv, | |||
_vector>& idxa); | const Array<idx_vector>& idxa); | |||
extern OCTAVE_API Array<idx_vector> ind2sub (const dim_vector& dv, const id | extern OCTAVE_API Array<idx_vector> ind2sub (const dim_vector& dv, | |||
x_vector& idx); | const idx_vector& idx); | |||
struct | struct | |||
permute_vector | permute_vector | |||
{ | { | |||
octave_idx_type pidx; | octave_idx_type pidx; | |||
octave_idx_type iidx; | octave_idx_type iidx; | |||
}; | }; | |||
extern int OCTAVE_API permute_vector_compare (const void *a, const void *b) ; | extern int OCTAVE_API permute_vector_compare (const void *a, const void *b) ; | |||
End of changes. 14 change blocks. | ||||
25 lines changed or deleted | 29 lines changed or added | |||
Array.cc | Array.cc | |||
---|---|---|---|---|
// Template array classes | // Template array classes | |||
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
skipping to change at line 31 | skipping to change at line 31 | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#ifdef HAVE_CONFIG_H | #ifdef HAVE_CONFIG_H | |||
#include <config.h> | #include <config.h> | |||
#endif | #endif | |||
#include <cassert> | #include <cassert> | |||
#include <climits> | ||||
#include <iostream> | #include <iostream> | |||
#include <sstream> | #include <sstream> | |||
#include <vector> | #include <vector> | |||
#include <algorithm> | #include <algorithm> | |||
#include <new> | #include <new> | |||
#include "Array.h" | #include "Array.h" | |||
#include "Array-util.h" | #include "Array-util.h" | |||
#include "idx-vector.h" | #include "idx-vector.h" | |||
skipping to change at line 175 | skipping to change at line 174 | |||
template <class T> | template <class T> | |||
octave_idx_type | octave_idx_type | |||
Array<T>::compute_index (octave_idx_type i, octave_idx_type j) const | Array<T>::compute_index (octave_idx_type i, octave_idx_type j) const | |||
{ | { | |||
return ::compute_index (i, j, dimensions); | return ::compute_index (i, j, dimensions); | |||
} | } | |||
template <class T> | template <class T> | |||
octave_idx_type | octave_idx_type | |||
Array<T>::compute_index (octave_idx_type i, octave_idx_type j, octave_idx_t | Array<T>::compute_index (octave_idx_type i, octave_idx_type j, | |||
ype k) const | octave_idx_type k) const | |||
{ | { | |||
return ::compute_index (i, j, k, dimensions); | return ::compute_index (i, j, k, dimensions); | |||
} | } | |||
template <class T> | template <class T> | |||
octave_idx_type | octave_idx_type | |||
Array<T>::compute_index (const Array<octave_idx_type>& ra_idx) const | Array<T>::compute_index (const Array<octave_idx_type>& ra_idx) const | |||
{ | { | |||
return ::compute_index (ra_idx, dimensions); | return ::compute_index (ra_idx, dimensions); | |||
} | } | |||
skipping to change at line 243 | skipping to change at line 243 | |||
template <class T> | template <class T> | |||
typename Array<T>::crefT | typename Array<T>::crefT | |||
Array<T>::checkelem (octave_idx_type i, octave_idx_type j) const | Array<T>::checkelem (octave_idx_type i, octave_idx_type j) const | |||
{ | { | |||
return elem (compute_index (i, j)); | return elem (compute_index (i, j)); | |||
} | } | |||
template <class T> | template <class T> | |||
typename Array<T>::crefT | typename Array<T>::crefT | |||
Array<T>::checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type | Array<T>::checkelem (octave_idx_type i, octave_idx_type j, | |||
k) const | octave_idx_type k) const | |||
{ | { | |||
return elem (compute_index (i, j, k)); | return elem (compute_index (i, j, k)); | |||
} | } | |||
template <class T> | template <class T> | |||
typename Array<T>::crefT | typename Array<T>::crefT | |||
Array<T>::checkelem (const Array<octave_idx_type>& ra_idx) const | Array<T>::checkelem (const Array<octave_idx_type>& ra_idx) const | |||
{ | { | |||
return elem (compute_index (ra_idx)); | return elem (compute_index (ra_idx)); | |||
} | } | |||
skipping to change at line 312 | skipping to change at line 313 | |||
int top; | int top; | |||
octave_idx_type *dim; | octave_idx_type *dim; | |||
octave_idx_type *stride; | octave_idx_type *stride; | |||
bool use_blk; | bool use_blk; | |||
public: | public: | |||
rec_permute_helper (const dim_vector& dv, const Array<octave_idx_type>& p erm) | rec_permute_helper (const dim_vector& dv, const Array<octave_idx_type>& p erm) | |||
: n (dv.length ()), top (0), dim (new octave_idx_type [2*n]), | : n (dv.length ()), top (0), dim (new octave_idx_type [2*n]), | |||
stride (dim + n), use_blk (false) | stride (dim + n), use_blk (false) | |||
{ | { | |||
assert (n == perm.length ()); | assert (n == perm.length ()); | |||
// Get cumulative dimensions. | // Get cumulative dimensions. | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, cdim, n+1); | OCTAVE_LOCAL_BUFFER (octave_idx_type, cdim, n+1); | |||
cdim[0] = 1; | cdim[0] = 1; | |||
for (int i = 1; i < n+1; i++) cdim[i] = cdim[i-1] * dv(i-1); | for (int i = 1; i < n+1; i++) cdim[i] = cdim[i-1] * dv(i-1); | |||
// Setup the permuted strides. | // Setup the permuted strides. | |||
for (int k = 0; k < n; k++) | for (int k = 0; k < n; k++) | |||
{ | { | |||
int kk = perm(k); | int kk = perm(k); | |||
dim[k] = dv(kk); | dim[k] = dv(kk); | |||
stride[k] = cdim[kk]; | stride[k] = cdim[kk]; | |||
} | } | |||
// Reduce contiguous runs. | // Reduce contiguous runs. | |||
for (int k = 1; k < n; k++) | for (int k = 1; k < n; k++) | |||
{ | { | |||
if (stride[k] == stride[top]*dim[top]) | if (stride[k] == stride[top]*dim[top]) | |||
dim[top] *= dim[k]; | dim[top] *= dim[k]; | |||
else | else | |||
{ | { | |||
top++; | top++; | |||
dim[top] = dim[k]; | dim[top] = dim[k]; | |||
stride[top] = stride[k]; | stride[top] = stride[k]; | |||
} | } | |||
} | } | |||
// Determine whether we can use block transposes. | // Determine whether we can use block transposes. | |||
use_blk = top >= 1 && stride[1] == 1 && stride[0] == dim[1]; | use_blk = top >= 1 && stride[1] == 1 && stride[0] == dim[1]; | |||
} | } | |||
~rec_permute_helper (void) { delete [] dim; } | ~rec_permute_helper (void) { delete [] dim; } | |||
// Helper method for fast blocked transpose. | // Helper method for fast blocked transpose. | |||
template <class T> | template <class T> | |||
static T * | static T * | |||
blk_trans (const T *src, T *dest, octave_idx_type nr, octave_idx_type nc) | blk_trans (const T *src, T *dest, octave_idx_type nr, octave_idx_type nc) | |||
{ | { | |||
static const octave_idx_type m = 8; | static const octave_idx_type m = 8; | |||
OCTAVE_LOCAL_BUFFER (T, blk, m*m); | OCTAVE_LOCAL_BUFFER (T, blk, m*m); | |||
for (octave_idx_type kr = 0; kr < nr; kr += m) | for (octave_idx_type kr = 0; kr < nr; kr += m) | |||
for (octave_idx_type kc = 0; kc < nc; kc += m) | for (octave_idx_type kc = 0; kc < nc; kc += m) | |||
{ | { | |||
octave_idx_type lr = std::min (m, nr - kr); | octave_idx_type lr = std::min (m, nr - kr); | |||
octave_idx_type lc = std::min (m, nc - kc); | octave_idx_type lc = std::min (m, nc - kc); | |||
if (lr == m && lc == m) | if (lr == m && lc == m) | |||
{ | { | |||
const T *ss = src + kc * nr + kr; | const T *ss = src + kc * nr + kr; | |||
for (octave_idx_type j = 0; j < m; j++) | for (octave_idx_type j = 0; j < m; j++) | |||
for (octave_idx_type i = 0; i < m; i++) | for (octave_idx_type i = 0; i < m; i++) | |||
blk[j*m+i] = ss[j*nr + i]; | blk[j*m+i] = ss[j*nr + i]; | |||
T *dd = dest + kr * nc + kc; | T *dd = dest + kr * nc + kc; | |||
for (octave_idx_type j = 0; j < m; j++) | for (octave_idx_type j = 0; j < m; j++) | |||
for (octave_idx_type i = 0; i < m; i++) | for (octave_idx_type i = 0; i < m; i++) | |||
dd[j*nc+i] = blk[i*m+j]; | dd[j*nc+i] = blk[i*m+j]; | |||
} | } | |||
else | else | |||
{ | { | |||
const T *ss = src + kc * nr + kr; | const T *ss = src + kc * nr + kr; | |||
for (octave_idx_type j = 0; j < lc; j++) | for (octave_idx_type j = 0; j < lc; j++) | |||
for (octave_idx_type i = 0; i < lr; i++) | for (octave_idx_type i = 0; i < lr; i++) | |||
blk[j*m+i] = ss[j*nr + i]; | blk[j*m+i] = ss[j*nr + i]; | |||
T *dd = dest + kr * nc + kc; | T *dd = dest + kr * nc + kc; | |||
for (octave_idx_type j = 0; j < lr; j++) | for (octave_idx_type j = 0; j < lr; j++) | |||
for (octave_idx_type i = 0; i < lc; i++) | for (octave_idx_type i = 0; i < lc; i++) | |||
dd[j*nc+i] = blk[i*m+j]; | dd[j*nc+i] = blk[i*m+j]; | |||
} | } | |||
} | } | |||
return dest + nr*nc; | return dest + nr*nc; | |||
} | } | |||
private: | private: | |||
// Recursive N-d generalized transpose | // Recursive N-d generalized transpose | |||
template <class T> | template <class T> | |||
T *do_permute (const T *src, T *dest, int lev) const | T *do_permute (const T *src, T *dest, int lev) const | |||
{ | { | |||
if (lev == 0) | if (lev == 0) | |||
{ | { | |||
octave_idx_type step = stride[0], len = dim[0]; | octave_idx_type step = stride[0], len = dim[0]; | |||
if (step == 1) | if (step == 1) | |||
{ | { | |||
copy_or_memcpy (len, src, dest); | copy_or_memcpy (len, src, dest); | |||
dest += len; | dest += len; | |||
} | } | |||
else | else | |||
{ | { | |||
for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) | for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) | |||
dest[i] = src[j]; | dest[i] = src[j]; | |||
dest += len; | dest += len; | |||
} | } | |||
} | } | |||
else if (use_blk && lev == 1) | else if (use_blk && lev == 1) | |||
dest = blk_trans (src, dest, dim[1], dim[0]); | dest = blk_trans (src, dest, dim[1], dim[0]); | |||
else | else | |||
{ | { | |||
octave_idx_type step = stride[lev], len = dim[lev]; | octave_idx_type step = stride[lev], len = dim[lev]; | |||
for (octave_idx_type i = 0, j = 0; i < len; i++, j+= step) | for (octave_idx_type i = 0, j = 0; i < len; i++, j+= step) | |||
dest = do_permute (src + i * step, dest, lev-1); | dest = do_permute (src + i * step, dest, lev-1); | |||
} | } | |||
return dest; | return dest; | |||
} | } | |||
// No copying! | // No copying! | |||
rec_permute_helper (const rec_permute_helper&); | rec_permute_helper (const rec_permute_helper&); | |||
rec_permute_helper& operator = (const rec_permute_helper&); | rec_permute_helper& operator = (const rec_permute_helper&); | |||
public: | public: | |||
template <class T> | template <class T> | |||
skipping to change at line 531 | skipping to change at line 532 | |||
int n; | int n; | |||
int top; | int top; | |||
octave_idx_type *dim; | octave_idx_type *dim; | |||
octave_idx_type *cdim; | octave_idx_type *cdim; | |||
idx_vector *idx; | idx_vector *idx; | |||
public: | public: | |||
rec_index_helper (const dim_vector& dv, const Array<idx_vector>& ia) | rec_index_helper (const dim_vector& dv, const Array<idx_vector>& ia) | |||
: n (ia.length ()), top (0), dim (new octave_idx_type [2*n]), | : n (ia.length ()), top (0), dim (new octave_idx_type [2*n]), | |||
cdim (dim + n), idx (new idx_vector [n]) | cdim (dim + n), idx (new idx_vector [n]) | |||
{ | { | |||
assert (n > 0 && (dv.length () == std::max (n, 2))); | assert (n > 0 && (dv.length () == std::max (n, 2))); | |||
dim[0] = dv(0); | dim[0] = dv(0); | |||
cdim[0] = 1; | cdim[0] = 1; | |||
idx[0] = ia(0); | idx[0] = ia(0); | |||
for (int i = 1; i < n; i++) | for (int i = 1; i < n; i++) | |||
{ | { | |||
// Try reduction... | // Try reduction... | |||
if (idx[top].maybe_reduce (dim[top], ia(i), dv(i))) | if (idx[top].maybe_reduce (dim[top], ia(i), dv(i))) | |||
{ | { | |||
// Reduction successful, fold dimensions. | // Reduction successful, fold dimensions. | |||
dim[top] *= dv(i); | dim[top] *= dv(i); | |||
} | } | |||
else | else | |||
{ | { | |||
// Unsuccessful, store index & cumulative dim. | // Unsuccessful, store index & cumulative dim. | |||
top++; | top++; | |||
idx[top] = ia(i); | idx[top] = ia(i); | |||
dim[top] = dv(i); | dim[top] = dv(i); | |||
cdim[top] = cdim[top-1] * dim[top-1]; | cdim[top] = cdim[top-1] * dim[top-1]; | |||
} | } | |||
} | } | |||
} | } | |||
~rec_index_helper (void) { delete [] idx; delete [] dim; } | ~rec_index_helper (void) { delete [] idx; delete [] dim; } | |||
private: | private: | |||
// Recursive N-d indexing | // Recursive N-d indexing | |||
template <class T> | template <class T> | |||
T *do_index (const T *src, T *dest, int lev) const | T *do_index (const T *src, T *dest, int lev) const | |||
{ | { | |||
if (lev == 0) | if (lev == 0) | |||
dest += idx[0].index (src, dim[0], dest); | dest += idx[0].index (src, dim[0], dest); | |||
else | else | |||
{ | { | |||
octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; | octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; | |||
for (octave_idx_type i = 0; i < nn; i++) | for (octave_idx_type i = 0; i < nn; i++) | |||
dest = do_index (src + d*idx[lev].xelem (i), dest, lev-1); | dest = do_index (src + d*idx[lev].xelem (i), dest, lev-1); | |||
} | } | |||
return dest; | return dest; | |||
} | } | |||
// Recursive N-d indexed assignment | // Recursive N-d indexed assignment | |||
template <class T> | template <class T> | |||
const T *do_assign (const T *src, T *dest, int lev) const | const T *do_assign (const T *src, T *dest, int lev) const | |||
{ | { | |||
if (lev == 0) | if (lev == 0) | |||
src += idx[0].assign (src, dim[0], dest); | src += idx[0].assign (src, dim[0], dest); | |||
else | else | |||
{ | { | |||
octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; | octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; | |||
for (octave_idx_type i = 0; i < nn; i++) | for (octave_idx_type i = 0; i < nn; i++) | |||
src = do_assign (src, dest + d*idx[lev].xelem (i), lev-1); | src = do_assign (src, dest + d*idx[lev].xelem (i), lev-1); | |||
} | } | |||
return src; | return src; | |||
} | } | |||
// Recursive N-d indexed assignment | // Recursive N-d indexed assignment | |||
template <class T> | template <class T> | |||
void do_fill (const T& val, T *dest, int lev) const | void do_fill (const T& val, T *dest, int lev) const | |||
{ | { | |||
if (lev == 0) | if (lev == 0) | |||
idx[0].fill (val, dim[0], dest); | idx[0].fill (val, dim[0], dest); | |||
else | else | |||
{ | { | |||
octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; | octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; | |||
for (octave_idx_type i = 0; i < nn; i++) | for (octave_idx_type i = 0; i < nn; i++) | |||
do_fill (val, dest + d*idx[lev].xelem (i), lev-1); | do_fill (val, dest + d*idx[lev].xelem (i), lev-1); | |||
} | } | |||
} | } | |||
// No copying! | // No copying! | |||
rec_index_helper (const rec_index_helper&); | rec_index_helper (const rec_index_helper&); | |||
rec_index_helper& operator = (const rec_index_helper&); | rec_index_helper& operator = (const rec_index_helper&); | |||
public: | public: | |||
template <class T> | template <class T> | |||
void index (const T *src, T *dest) const { do_index (src, dest, top); } | void index (const T *src, T *dest) const { do_index (src, dest, top); } | |||
template <class T> | template <class T> | |||
void assign (const T *src, T *dest) const { do_assign (src, dest, top); } | void assign (const T *src, T *dest) const { do_assign (src, dest, top); } | |||
template <class T> | template <class T> | |||
void fill (const T& val, T *dest) const { do_fill (val, dest, top); } | void fill (const T& val, T *dest) const { do_fill (val, dest, top); } | |||
bool is_cont_range (octave_idx_type& l, | bool is_cont_range (octave_idx_type& l, | |||
octave_idx_type& u) const | octave_idx_type& u) const | |||
{ | { | |||
return top == 0 && idx[0].is_cont_range (dim[0], l, u); | return top == 0 && idx[0].is_cont_range (dim[0], l, u); | |||
} | } | |||
}; | }; | |||
// Helper class for multi-d recursive resizing | // Helper class for multi-d recursive resizing | |||
// This handles resize () in an efficient manner, touching memory only | // This handles resize () in an efficient manner, touching memory only | |||
// once (apart from reinitialization) | // once (apart from reinitialization) | |||
class rec_resize_helper | class rec_resize_helper | |||
{ | { | |||
octave_idx_type *cext; | octave_idx_type *cext; | |||
octave_idx_type *sext; | octave_idx_type *sext; | |||
octave_idx_type *dext; | octave_idx_type *dext; | |||
int n; | int n; | |||
public: | public: | |||
rec_resize_helper (const dim_vector& ndv, const dim_vector& odv) | rec_resize_helper (const dim_vector& ndv, const dim_vector& odv) | |||
: cext (0), sext (0), dext (0), n (0) | : cext (0), sext (0), dext (0), n (0) | |||
{ | { | |||
int l = ndv.length (); | int l = ndv.length (); | |||
assert (odv.length () == l); | assert (odv.length () == l); | |||
octave_idx_type ld = 1; | octave_idx_type ld = 1; | |||
int i = 0; | int i = 0; | |||
for (; i < l-1 && ndv(i) == odv(i); i++) ld *= ndv(i); | for (; i < l-1 && ndv(i) == odv(i); i++) ld *= ndv(i); | |||
n = l - i; | n = l - i; | |||
cext = new octave_idx_type[3*n]; | cext = new octave_idx_type [3*n]; | |||
// Trick to avoid three allocations | // Trick to avoid three allocations | |||
sext = cext + n; | sext = cext + n; | |||
dext = sext + n; | dext = sext + n; | |||
octave_idx_type sld = ld, dld = ld; | octave_idx_type sld = ld, dld = ld; | |||
for (int j = 0; j < n; j++) | for (int j = 0; j < n; j++) | |||
{ | { | |||
cext[j] = std::min (ndv(i+j), odv(i+j)); | cext[j] = std::min (ndv(i+j), odv(i+j)); | |||
sext[j] = sld *= odv(i+j); | sext[j] = sld *= odv(i+j); | |||
dext[j] = dld *= ndv(i+j); | dext[j] = dld *= ndv(i+j); | |||
} | } | |||
cext[0] *= ld; | cext[0] *= ld; | |||
} | } | |||
~rec_resize_helper (void) { delete [] cext; } | ~rec_resize_helper (void) { delete [] cext; } | |||
private: | private: | |||
// recursive resizing | // recursive resizing | |||
template <class T> | template <class T> | |||
void do_resize_fill (const T* src, T *dest, const T& rfv, int lev) const | void do_resize_fill (const T* src, T *dest, const T& rfv, int lev) const | |||
{ | { | |||
if (lev == 0) | if (lev == 0) | |||
{ | { | |||
copy_or_memcpy (cext[0], src, dest); | copy_or_memcpy (cext[0], src, dest); | |||
fill_or_memset (dext[0] - cext[0], rfv, dest + cext[0]); | fill_or_memset (dext[0] - cext[0], rfv, dest + cext[0]); | |||
} | } | |||
else | else | |||
{ | { | |||
octave_idx_type sd = sext[lev-1], dd = dext[lev-1], k; | octave_idx_type sd = sext[lev-1], dd = dext[lev-1], k; | |||
for (k = 0; k < cext[lev]; k++) | for (k = 0; k < cext[lev]; k++) | |||
do_resize_fill (src + k * sd, dest + k * dd, rfv, lev - 1); | do_resize_fill (src + k * sd, dest + k * dd, rfv, lev - 1); | |||
fill_or_memset (dext[lev] - k * dd, rfv, dest + k * dd); | fill_or_memset (dext[lev] - k * dd, rfv, dest + k * dd); | |||
} | } | |||
} | } | |||
// No copying! | // No copying! | |||
rec_resize_helper (const rec_resize_helper&); | rec_resize_helper (const rec_resize_helper&); | |||
rec_resize_helper& operator = (const rec_resize_helper&); | rec_resize_helper& operator = (const rec_resize_helper&); | |||
public: | public: | |||
template <class T> | template <class T> | |||
void resize_fill (const T* src, T *dest, const T& rfv) const | void resize_fill (const T* src, T *dest, const T& rfv) const | |||
{ do_resize_fill (src, dest, rfv, n-1); } | { do_resize_fill (src, dest, rfv, n-1); } | |||
}; | }; | |||
template <class T> | template <class T> | |||
Array<T> | Array<T> | |||
Array<T>::index (const idx_vector& i) const | Array<T>::index (const idx_vector& i) const | |||
{ | { | |||
octave_idx_type n = numel (); | octave_idx_type n = numel (); | |||
Array<T> retval; | Array<T> retval; | |||
if (i.is_colon ()) | if (i.is_colon ()) | |||
{ | { | |||
// A(:) produces a shallow copy as a column vector. | // A(:) produces a shallow copy as a column vector. | |||
retval = Array<T> (*this, dim_vector (n, 1)); | retval = Array<T> (*this, dim_vector (n, 1)); | |||
} | } | |||
else | else | |||
{ | { | |||
if (i.extent (n) != n) | if (i.extent (n) != n) | |||
gripe_index_out_of_range (1, 1, i.extent (n), n); // throws | gripe_index_out_of_range (1, 1, i.extent (n), n); // throws | |||
// FIXME -- this is the only place where orig_dimensions are used. | // FIXME: this is the only place where orig_dimensions are used. | |||
dim_vector rd = i.orig_dimensions (); | dim_vector rd = i.orig_dimensions (); | |||
octave_idx_type il = i.length (n); | octave_idx_type il = i.length (n); | |||
// FIXME -- this is for Matlab compatibility. Matlab 2007 given | // FIXME: this is for Matlab compatibility. Matlab 2007 given | |||
// | // | |||
// b = ones(3,1) | // b = ones (3,1) | |||
// | // | |||
// yields the following: | // yields the following: | |||
// | // | |||
// b(zeros(0,0)) gives [] | // b(zeros (0,0)) gives [] | |||
// b(zeros(1,0)) gives zeros(0,1) | // b(zeros (1,0)) gives zeros (0,1) | |||
// b(zeros(0,1)) gives zeros(0,1) | // b(zeros (0,1)) gives zeros (0,1) | |||
// b(zeros(0,m)) gives zeros(0,m) | // b(zeros (0,m)) gives zeros (0,m) | |||
// b(zeros(m,0)) gives zeros(m,0) | // b(zeros (m,0)) gives zeros (m,0) | |||
// b(1:2) gives ones(2,1) | // b(1:2) gives ones (2,1) | |||
// b(ones(2)) gives ones(2) etc. | // b(ones (2)) gives ones (2) etc. | |||
// | // | |||
// As you can see, the behaviour is weird, but the tests end up prett y | // As you can see, the behaviour is weird, but the tests end up prett y | |||
// simple. Nah, I don't want to suggest that this is ad hoc :) | // simple. Nah, I don't want to suggest that this is ad hoc :) | |||
if (ndims () == 2 && n != 1 && rd.is_vector ()) | if (ndims () == 2 && n != 1 && rd.is_vector ()) | |||
{ | { | |||
if (columns () == 1) | if (columns () == 1) | |||
rd = dim_vector (il, 1); | rd = dim_vector (il, 1); | |||
else if (rows () == 1) | else if (rows () == 1) | |||
rd = dim_vector (1, il); | rd = dim_vector (1, il); | |||
skipping to change at line 799 | skipping to change at line 800 | |||
idx_vector ii (i); | idx_vector ii (i); | |||
if (ii.maybe_reduce (r, j, c)) | if (ii.maybe_reduce (r, j, c)) | |||
{ | { | |||
octave_idx_type l, u; | octave_idx_type l, u; | |||
if (ii.length () > 0 && ii.is_cont_range (n, l, u)) | if (ii.length () > 0 && ii.is_cont_range (n, l, u)) | |||
// If suitable, produce a shallow slice. | // If suitable, produce a shallow slice. | |||
retval = Array<T> (*this, dim_vector (il, jl), l, u); | retval = Array<T> (*this, dim_vector (il, jl), l, u); | |||
else | else | |||
{ | { | |||
// Don't use resize here to avoid useless initialization for POD types. | // Don't use resize to avoid useless initialization for POD t ypes. | |||
retval = Array<T> (dim_vector (il, jl)); | retval = Array<T> (dim_vector (il, jl)); | |||
ii.index (data (), n, retval.fortran_vec ()); | ii.index (data (), n, retval.fortran_vec ()); | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
// Don't use resize here to avoid useless initialization for POD types. | // Don't use resize to avoid useless initialization for POD types . | |||
retval = Array<T> (dim_vector (il, jl)); | retval = Array<T> (dim_vector (il, jl)); | |||
const T* src = data (); | const T* src = data (); | |||
T *dest = retval.fortran_vec (); | T *dest = retval.fortran_vec (); | |||
for (octave_idx_type k = 0; k < jl; k++) | for (octave_idx_type k = 0; k < jl; k++) | |||
dest += i.index (src + r * j.xelem (k), r, dest); | dest += i.index (src + r * j.xelem (k), r, dest); | |||
} | } | |||
} | } | |||
skipping to change at line 870 | skipping to change at line 871 | |||
// Prepare for recursive indexing | // Prepare for recursive indexing | |||
rec_index_helper rh (dv, ia); | rec_index_helper rh (dv, ia); | |||
octave_idx_type l, u; | octave_idx_type l, u; | |||
if (rh.is_cont_range (l, u)) | if (rh.is_cont_range (l, u)) | |||
// If suitable, produce a shallow slice. | // If suitable, produce a shallow slice. | |||
retval = Array<T> (*this, rdv, l, u); | retval = Array<T> (*this, rdv, l, u); | |||
else | else | |||
{ | { | |||
// Don't use resize here to avoid useless initialization for POD types. | // Don't use resize to avoid useless initialization for POD t ypes. | |||
retval = Array<T> (rdv); | retval = Array<T> (rdv); | |||
// Do it. | // Do it. | |||
rh.index (data (), retval.fortran_vec ()); | rh.index (data (), retval.fortran_vec ()); | |||
} | } | |||
} | } | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
// The default fill value. Override if you want a different one. | // The default fill value. Override if you want a different one. | |||
template <class T> | template <class T> | |||
const T& Array<T>::resize_fill_value () | T | |||
Array<T>::resize_fill_value (void) const | ||||
{ | { | |||
static T zero = T (); | static T zero = T (); | |||
return zero; | return zero; | |||
} | } | |||
// Yes, we could do resize using index & assign. However, that would | // Yes, we could do resize using index & assign. However, that would | |||
// possibly involve a lot more memory traffic than we actually need. | // possibly involve a lot more memory traffic than we actually need. | |||
template <class T> | template <class T> | |||
void | void | |||
skipping to change at line 914 | skipping to change at line 916 | |||
// 1x1, 0xN, and gives a row vector in all cases (yes, even the | // 1x1, 0xN, and gives a row vector in all cases (yes, even the | |||
// last one, search me why). Giving a column vector would make | // last one, search me why). Giving a column vector would make | |||
// much more sense (given the way trailing singleton dims are | // much more sense (given the way trailing singleton dims are | |||
// treated). | // treated). | |||
bool invalid = false; | bool invalid = false; | |||
if (rows () == 0 || rows () == 1) | if (rows () == 0 || rows () == 1) | |||
dv = dim_vector (1, n); | dv = dim_vector (1, n); | |||
else if (columns () == 1) | else if (columns () == 1) | |||
dv = dim_vector (n, 1); | dv = dim_vector (n, 1); | |||
else | else | |||
invalid = true; | invalid = true; | |||
if (invalid) | if (invalid) | |||
gripe_invalid_resize (); | gripe_invalid_resize (); | |||
else | else | |||
{ | { | |||
octave_idx_type nx = numel (); | octave_idx_type nx = numel (); | |||
if (n == nx - 1 && n > 0) | if (n == nx - 1 && n > 0) | |||
{ | { | |||
// Stack "pop" operation. | // Stack "pop" operation. | |||
if (rep->count == 1) | if (rep->count == 1) | |||
slice_data[slice_len-1] = T (); | slice_data[slice_len-1] = T (); | |||
slice_len--; | slice_len--; | |||
dimensions = dv; | dimensions = dv; | |||
} | } | |||
else if (n == nx + 1 && nx > 0) | else if (n == nx + 1 && nx > 0) | |||
{ | { | |||
// Stack "push" operation. | // Stack "push" operation. | |||
if (rep->count == 1 && slice_data + slice_len < rep->data + r | if (rep->count == 1 | |||
ep->len) | && slice_data + slice_len < rep->data + rep->len) | |||
{ | { | |||
slice_data[slice_len++] = rfv; | slice_data[slice_len++] = rfv; | |||
dimensions = dv; | dimensions = dv; | |||
} | } | |||
else | else | |||
{ | { | |||
static const octave_idx_type max_stack_chunk = 1024; | static const octave_idx_type max_stack_chunk = 1024; | |||
octave_idx_type nn = n + std::min (nx, max_stack_chunk); | octave_idx_type nn = n + std::min (nx, max_stack_chunk); | |||
Array<T> tmp (Array<T> (dim_vector (nn, 1)), dv, 0, n); | Array<T> tmp (Array<T> (dim_vector (nn, 1)), dv, 0, n); | |||
T *dest = tmp.fortran_vec (); | T *dest = tmp.fortran_vec (); | |||
skipping to change at line 1460 | skipping to change at line 1463 | |||
ia (dim) = i.complement (n); | ia (dim) = i.complement (n); | |||
*this = index (ia); | *this = index (ia); | |||
} | } | |||
} | } | |||
} | } | |||
template <class T> | template <class T> | |||
void | void | |||
Array<T>::delete_elements (const Array<idx_vector>& ia) | Array<T>::delete_elements (const Array<idx_vector>& ia) | |||
{ | { | |||
if (ia.length () == 1) | int ial = ia.length (); | |||
if (ial == 1) | ||||
delete_elements (ia(0)); | delete_elements (ia(0)); | |||
else | else | |||
{ | { | |||
int len = ia.length (), k, dim = -1; | int k, dim = -1; | |||
for (k = 0; k < len; k++) | for (k = 0; k < ial; k++) | |||
{ | { | |||
if (! ia(k).is_colon ()) | if (! ia(k).is_colon ()) | |||
{ | { | |||
if (dim < 0) | if (dim < 0) | |||
dim = k; | dim = k; | |||
else | else | |||
break; | break; | |||
} | } | |||
} | } | |||
if (dim < 0) | if (dim < 0) | |||
{ | { | |||
dim_vector dv = dimensions; | dim_vector dv = dimensions; | |||
dv(0) = 0; | dv(0) = 0; | |||
*this = Array<T> (dv); | *this = Array<T> (dv); | |||
} | } | |||
else if (k == len) | else if (k == ial) | |||
{ | { | |||
delete_elements (dim, ia(dim)); | delete_elements (dim, ia(dim)); | |||
} | } | |||
else | else | |||
{ | { | |||
(*current_liboctave_error_handler) | // Allow the null assignment to succeed if it won't change | |||
("a null assignment can only have one non-colon index"); | // anything because the indices reference an empty slice, | |||
// provided that there is at most one non-colon (or | ||||
// equivalent) index. So, we still have the requirement of | ||||
// deleting a slice, but it is OK if the slice is empty. | ||||
// For compatibility with Matlab, stop checking once we see | ||||
// more than one non-colon index or an empty index. Matlab | ||||
// considers "[]" to be an empty index but not "false". We | ||||
// accept both. | ||||
bool empty_assignment = false; | ||||
int num_non_colon_indices = 0; | ||||
int nd = ndims (); | ||||
for (int i = 0; i < ial; i++) | ||||
{ | ||||
octave_idx_type dim_len = i >= nd ? 1 : dimensions(i); | ||||
if (ia(i).length (dim_len) == 0) | ||||
{ | ||||
empty_assignment = true; | ||||
break; | ||||
} | ||||
if (! ia(i).is_colon_equiv (dim_len)) | ||||
{ | ||||
num_non_colon_indices++; | ||||
if (num_non_colon_indices == 2) | ||||
break; | ||||
} | ||||
} | ||||
if (! empty_assignment) | ||||
(*current_liboctave_error_handler) | ||||
("a null assignment can only have one non-colon index"); | ||||
} | } | |||
} | } | |||
} | } | |||
template <class T> | template <class T> | |||
Array<T>& | Array<T>& | |||
Array<T>::insert (const Array<T>& a, octave_idx_type r, octave_idx_type c) | Array<T>::insert (const Array<T>& a, octave_idx_type r, octave_idx_type c) | |||
{ | { | |||
idx_vector i (r, r + a.rows ()); | idx_vector i (r, r + a.rows ()); | |||
skipping to change at line 1651 | skipping to change at line 1693 | |||
%% and with four tiles. | %% and with four tiles. | |||
%!shared m7, mt7, m8, mt8, m9, mt9 | %!shared m7, mt7, m8, mt8, m9, mt9 | |||
%! m7 = reshape (1 : 7*8, 8, 7); | %! m7 = reshape (1 : 7*8, 8, 7); | |||
%! mt7 = [1:8; 9:16; 17:24; 25:32; 33:40; 41:48; 49:56]; | %! mt7 = [1:8; 9:16; 17:24; 25:32; 33:40; 41:48; 49:56]; | |||
%! m8 = reshape (1 : 8*8, 8, 8); | %! m8 = reshape (1 : 8*8, 8, 8); | |||
%! mt8 = mt8 = [mt7; 57:64]; | %! mt8 = mt8 = [mt7; 57:64]; | |||
%! m9 = reshape (1 : 9*8, 8, 9); | %! m9 = reshape (1 : 9*8, 8, 9); | |||
%! mt9 = [mt8; 65:72]; | %! mt9 = [mt8; 65:72]; | |||
%!assert(m7', mt7) | %!assert (m7', mt7) | |||
%!assert((1i*m7).', 1i * mt7) | %!assert ((1i*m7).', 1i * mt7) | |||
%!assert((1i*m7)', conj (1i * mt7)) | %!assert ((1i*m7)', conj (1i * mt7)) | |||
%!assert(m8', mt8) | %!assert (m8', mt8) | |||
%!assert((1i*m8).', 1i * mt8) | %!assert ((1i*m8).', 1i * mt8) | |||
%!assert((1i*m8)', conj (1i * mt8)) | %!assert ((1i*m8)', conj (1i * mt8)) | |||
%!assert(m9', mt9) | %!assert (m9', mt9) | |||
%!assert((1i*m9).', 1i * mt9) | %!assert ((1i*m9).', 1i * mt9) | |||
%!assert((1i*m9)', conj (1i * mt9)) | %!assert ((1i*m9)', conj (1i * mt9)) | |||
%!assert([m7, m8; m7, m8]', [mt7, mt7; mt8, mt8]) | %!assert ([m7, m8; m7, m8]', [mt7, mt7; mt8, mt8]) | |||
%!assert((1i*[m7, m8; m7, m8]).', 1i * [mt7, mt7; mt8, mt8]) | %!assert ((1i*[m7, m8; m7, m8]).', 1i * [mt7, mt7; mt8, mt8]) | |||
%!assert((1i*[m7, m8; m7, m8])', conj (1i * [mt7, mt7; mt8, mt8])) | %!assert ((1i*[m7, m8; m7, m8])', conj (1i * [mt7, mt7; mt8, mt8])) | |||
%!assert([m8, m8; m8, m8]', [mt8, mt8; mt8, mt8]) | %!assert ([m8, m8; m8, m8]', [mt8, mt8; mt8, mt8]) | |||
%!assert((1i*[m8, m8; m8, m8]).', 1i * [mt8, mt8; mt8, mt8]) | %!assert ((1i*[m8, m8; m8, m8]).', 1i * [mt8, mt8; mt8, mt8]) | |||
%!assert((1i*[m8, m8; m8, m8])', conj (1i * [mt8, mt8; mt8, mt8])) | %!assert ((1i*[m8, m8; m8, m8])', conj (1i * [mt8, mt8; mt8, mt8])) | |||
%!assert([m9, m8; m9, m8]', [mt9, mt9; mt8, mt8]) | %!assert ([m9, m8; m9, m8]', [mt9, mt9; mt8, mt8]) | |||
%!assert((1i*[m9, m8; m9, m8]).', 1i * [mt9, mt9; mt8, mt8]) | %!assert ((1i*[m9, m8; m9, m8]).', 1i * [mt9, mt9; mt8, mt8]) | |||
%!assert((1i*[m9, m8; m9, m8])', conj (1i * [mt9, mt9; mt8, mt8])) | %!assert ((1i*[m9, m8; m9, m8])', conj (1i * [mt9, mt9; mt8, mt8])) | |||
*/ | */ | |||
template <class T> | template <class T> | |||
T * | T * | |||
Array<T>::fortran_vec (void) | Array<T>::fortran_vec (void) | |||
{ | { | |||
make_unique (); | make_unique (); | |||
return slice_data; | return slice_data; | |||
skipping to change at line 2121 | skipping to change at line 2163 | |||
{ | { | |||
// auto-detect mode | // auto-detect mode | |||
if (n > 1 && lsort.descending_compare (elem (0), elem (n-1))) | if (n > 1 && lsort.descending_compare (elem (0), elem (n-1))) | |||
mode = DESCENDING; | mode = DESCENDING; | |||
else | else | |||
mode = ASCENDING; | mode = ASCENDING; | |||
} | } | |||
lsort.set_compare (mode); | lsort.set_compare (mode); | |||
// This determines the split ratio between the O(M*log2(N)) and O(M+N) al | // This determines the split ratio between the O(M*log2(N)) and O(M+N) | |||
gorithms. | // algorithms. | |||
static const double ratio = 1.0; | static const double ratio = 1.0; | |||
sortmode vmode = UNSORTED; | sortmode vmode = UNSORTED; | |||
// Attempt the O(M+N) algorithm if M is large enough. | // Attempt the O(M+N) algorithm if M is large enough. | |||
if (nval > ratio * n / xlog2 (n + 1.0)) | if (nval > ratio * n / xlog2 (n + 1.0)) | |||
{ | { | |||
vmode = values.is_sorted (); | vmode = values.is_sorted (); | |||
// The table must not contain a NaN. | // The table must not contain a NaN. | |||
if ((vmode == ASCENDING && sort_isnan<T> (values(nval-1))) | if ((vmode == ASCENDING && sort_isnan<T> (values(nval-1))) | |||
|| (vmode == DESCENDING && sort_isnan<T> (values(0)))) | || (vmode == DESCENDING && sort_isnan<T> (values(0)))) | |||
skipping to change at line 2191 | skipping to change at line 2234 | |||
// We want a fixed max number of elements, usually small. So be | // We want a fixed max number of elements, usually small. So be | |||
// optimistic, alloc the array in advance, and then resize if | // optimistic, alloc the array in advance, and then resize if | |||
// needed. | // needed. | |||
retval.clear (n, 1); | retval.clear (n, 1); | |||
if (backward) | if (backward) | |||
{ | { | |||
// Do the search as a series of successive single-element searche s. | // Do the search as a series of successive single-element searche s. | |||
octave_idx_type k = 0, l = nel - 1; | octave_idx_type k = 0, l = nel - 1; | |||
for (; k < n; k++) | for (; k < n; k++) | |||
{ | { | |||
for (;l >= 0 && src[l] == zero; l--) ; | for (; l >= 0 && src[l] == zero; l--) ; | |||
if (l >= 0) | if (l >= 0) | |||
retval(k) = l--; | retval(k) = l--; | |||
else | else | |||
break; | break; | |||
} | } | |||
if (k < n) | if (k < n) | |||
retval.resize2 (k, 1); | retval.resize2 (k, 1); | |||
octave_idx_type *rdata = retval.fortran_vec (); | octave_idx_type *rdata = retval.fortran_vec (); | |||
std::reverse (rdata, rdata + k); | std::reverse (rdata, rdata + k); | |||
} | } | |||
else | else | |||
{ | { | |||
// Do the search as a series of successive single-element searche s. | // Do the search as a series of successive single-element searche s. | |||
octave_idx_type k = 0, l = 0; | octave_idx_type k = 0, l = 0; | |||
for (; k < n; k++) | for (; k < n; k++) | |||
{ | { | |||
for (;l != nel && src[l] == zero; l++) ; | for (; l != nel && src[l] == zero; l++) ; | |||
if (l != nel) | if (l != nel) | |||
retval(k) = l++; | retval(k) = l++; | |||
else | else | |||
break; | break; | |||
} | } | |||
if (k < n) | if (k < n) | |||
retval.resize2 (k, 1); | retval.resize2 (k, 1); | |||
} | } | |||
} | } | |||
// Fixup return dimensions, for Matlab compatibility. | // Fixup return dimensions, for Matlab compatibility. | |||
// find(zeros(0,0)) -> zeros(0,0) | // find (zeros (0,0)) -> zeros (0,0) | |||
// find(zeros(1,0)) -> zeros(1,0) | // find (zeros (1,0)) -> zeros (1,0) | |||
// find(zeros(0,1)) -> zeros(0,1) | // find (zeros (0,1)) -> zeros (0,1) | |||
// find(zeros(0,X)) -> zeros(0,1) | // find (zeros (0,X)) -> zeros (0,1) | |||
// find(zeros(1,1)) -> zeros(0,0) !!!! WHY? | // find (zeros (1,1)) -> zeros (0,0) !!!! WHY? | |||
// find(zeros(0,1,0)) -> zeros(0,0) | // find (zeros (0,1,0)) -> zeros (0,0) | |||
// find(zeros(0,1,0,1)) -> zeros(0,0) etc | // find (zeros (0,1,0,1)) -> zeros (0,0) etc | |||
if ((numel () == 1 && retval.is_empty ()) | if ((numel () == 1 && retval.is_empty ()) | |||
|| (rows () == 0 && dims ().numel (1) == 0)) | || (rows () == 0 && dims ().numel (1) == 0)) | |||
retval.dimensions = dim_vector (); | retval.dimensions = dim_vector (); | |||
else if (rows () == 1 && ndims () == 2) | else if (rows () == 1 && ndims () == 2) | |||
retval.dimensions = dim_vector (1, retval.length ()); | retval.dimensions = dim_vector (1, retval.length ()); | |||
return retval; | return retval; | |||
} | } | |||
skipping to change at line 2360 | skipping to change at line 2403 | |||
buf[--ku] = tmp; | buf[--ku] = tmp; | |||
else | else | |||
buf[kl++] = tmp; | buf[kl++] = tmp; | |||
} | } | |||
if (offset == stride-1) | if (offset == stride-1) | |||
ov += ns*stride; | ov += ns*stride; | |||
} | } | |||
if (ku == ns) | if (ku == ns) | |||
lsort.nth_element (buf, ns, lo, up); | lsort.nth_element (buf, ns, lo, up); | |||
else if (mode == ASCENDING) | else if (mode == ASCENDING) | |||
lsort.nth_element (buf, ku, lo, std::min (ku, up)); | lsort.nth_element (buf, ku, lo, std::min (ku, up)); | |||
else | else | |||
{ | { | |||
octave_idx_type nnan = ns - ku; | octave_idx_type nnan = ns - ku; | |||
octave_idx_type zero = 0; | octave_idx_type zero = 0; | |||
lsort.nth_element (buf, ku, std::max (lo - nnan, zero), | lsort.nth_element (buf, ku, std::max (lo - nnan, zero), | |||
std::max (up - nnan, zero)); | std::max (up - nnan, zero)); | |||
std::rotate (buf, buf + ku, buf + ns); | std::rotate (buf, buf + ku, buf + ns); | |||
} | } | |||
skipping to change at line 2527 | skipping to change at line 2570 | |||
d.xelem (i+roff, i+coff) = elem (i, 0); | d.xelem (i+roff, i+coff) = elem (i, 0); | |||
} | } | |||
} | } | |||
} | } | |||
return d; | return d; | |||
} | } | |||
template <class T> | template <class T> | |||
Array<T> | Array<T> | |||
Array<T>::diag (octave_idx_type m, octave_idx_type n) const | ||||
{ | ||||
Array<T> retval; | ||||
if (ndims () == 2 && (rows () == 1 || cols () == 1)) | ||||
{ | ||||
retval.resize (dim_vector (m, n), resize_fill_value ()); | ||||
for (octave_idx_type i = 0; i < numel (); i++) | ||||
retval.xelem (i, i) = xelem (i); | ||||
} | ||||
else | ||||
(*current_liboctave_error_handler) | ||||
("cat: invalid dimension"); | ||||
return retval; | ||||
} | ||||
template <class T> | ||||
Array<T> | ||||
Array<T>::cat (int dim, octave_idx_type n, const Array<T> *array_list) | Array<T>::cat (int dim, octave_idx_type n, const Array<T> *array_list) | |||
{ | { | |||
// Default concatenation. | // Default concatenation. | |||
bool (dim_vector::*concat_rule) (const dim_vector&, int) = &dim_vector::c oncat; | bool (dim_vector::*concat_rule) (const dim_vector&, int) = &dim_vector::c oncat; | |||
if (dim == -1 || dim == -2) | if (dim == -1 || dim == -2) | |||
{ | { | |||
concat_rule = &dim_vector::hvcat; | concat_rule = &dim_vector::hvcat; | |||
dim = -dim - 1; | dim = -dim - 1; | |||
} | } | |||
skipping to change at line 2663 | skipping to change at line 2726 | |||
dimensions = dv; | dimensions = dv; | |||
return retval; | return retval; | |||
} | } | |||
template <class T> | template <class T> | |||
void Array<T>::instantiation_guard () | void Array<T>::instantiation_guard () | |||
{ | { | |||
// This guards against accidental implicit instantiations. | // This guards against accidental implicit instantiations. | |||
// Array<T> instances should always be explicit and use INSTANTIATE_ARRAY . | // Array<T> instances should always be explicit and use INSTANTIATE_ARRAY . | |||
T::__xXxXx__(); | T::__xXxXx__ (); | |||
} | } | |||
#define INSTANTIATE_ARRAY(T, API) \ | #define INSTANTIATE_ARRAY(T, API) \ | |||
template <> void Array<T>::instantiation_guard () { } \ | template <> void Array<T>::instantiation_guard () { } \ | |||
template class API Array<T> | template class API Array<T> | |||
// FIXME: is this used? | // FIXME: is this used? | |||
template <class T> | template <class T> | |||
std::ostream& | std::ostream& | |||
skipping to change at line 2716 | skipping to change at line 2779 | |||
case 2: | case 2: | |||
rows = a_dims(0); | rows = a_dims(0); | |||
cols = a_dims(1); | cols = a_dims(1); | |||
for (octave_idx_type j = 0; j < rows; j++) | for (octave_idx_type j = 0; j < rows; j++) | |||
{ | { | |||
ra_idx(0) = j; | ra_idx(0) = j; | |||
for (octave_idx_type k = 0; k < cols; k++) | for (octave_idx_type k = 0; k < cols; k++) | |||
{ | { | |||
ra_idx(1) = k; | ra_idx(1) = k; | |||
os << " " << a.elem(ra_idx); | os << " " << a.elem (ra_idx); | |||
} | } | |||
os << "\n"; | os << "\n"; | |||
} | } | |||
break; | break; | |||
default: | default: | |||
rows = a_dims(0); | rows = a_dims(0); | |||
for (octave_idx_type k = 0; k < rows; k++) | for (octave_idx_type k = 0; k < rows; k++) | |||
{ | { | |||
ra_idx(0) = k; | ra_idx(0) = k; | |||
os << " " << a.elem(ra_idx); | os << " " << a.elem (ra_idx); | |||
} | } | |||
break; | break; | |||
} | } | |||
os << "\n"; | os << "\n"; | |||
} | } | |||
else | else | |||
{ | { | |||
octave_idx_type rows = a_dims(0); | octave_idx_type rows = a_dims(0); | |||
octave_idx_type cols = a_dims(1); | octave_idx_type cols = a_dims(1); | |||
skipping to change at line 2756 | skipping to change at line 2819 | |||
os << ra_idx(n_dims - 1) + 1 << ") = \n"; | os << ra_idx(n_dims - 1) + 1 << ") = \n"; | |||
for (octave_idx_type j = 0; j < rows; j++) | for (octave_idx_type j = 0; j < rows; j++) | |||
{ | { | |||
ra_idx(0) = j; | ra_idx(0) = j; | |||
for (octave_idx_type k = 0; k < cols; k++) | for (octave_idx_type k = 0; k < cols; k++) | |||
{ | { | |||
ra_idx(1) = k; | ra_idx(1) = k; | |||
os << " " << a.elem(ra_idx); | os << " " << a.elem (ra_idx); | |||
} | } | |||
os << "\n"; | os << "\n"; | |||
} | } | |||
os << "\n"; | os << "\n"; | |||
if (i != m - 1) | if (i != m - 1) | |||
increment_index (ra_idx, a_dims, 2); | increment_index (ra_idx, a_dims, 2); | |||
} | } | |||
End of changes. 53 change blocks. | ||||
245 lines changed or deleted | 304 lines changed or added | |||
Array.h | Array.h | |||
---|---|---|---|---|
// Template array classes | // Template array classes | |||
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
skipping to change at line 67 | skipping to change at line 67 | |||
class ArrayRep | class ArrayRep | |||
{ | { | |||
public: | public: | |||
T *data; | T *data; | |||
octave_idx_type len; | octave_idx_type len; | |||
octave_refcount<int> count; | octave_refcount<int> count; | |||
ArrayRep (T *d, octave_idx_type l) | ArrayRep (T *d, octave_idx_type l) | |||
: data (no_ctor_new<T> (l)), len (l), count (1) | : data (no_ctor_new<T> (l)), len (l), count (1) | |||
{ | { | |||
copy_or_memcpy (l, d, data); | copy_or_memcpy (l, d, data); | |||
} | } | |||
template <class U> | template <class U> | |||
ArrayRep (U *d, octave_idx_type l) | ArrayRep (U *d, octave_idx_type l) | |||
: data (no_ctor_new<T> (l)), len (l), count (1) | : data (no_ctor_new<T> (l)), len (l), count (1) | |||
{ | { | |||
std::copy (d, d+l, data); | std::copy (d, d+l, data); | |||
} | } | |||
ArrayRep (void) : data (0), len (0), count (1) { } | ArrayRep (void) : data (0), len (0), count (1) { } | |||
explicit ArrayRep (octave_idx_type n) : data (no_ctor_new<T> (n)), len | explicit ArrayRep (octave_idx_type n) | |||
(n), count (1) { } | : data (no_ctor_new<T> (n)), len (n), count (1) { } | |||
explicit ArrayRep (octave_idx_type n, const T& val) | explicit ArrayRep (octave_idx_type n, const T& val) | |||
: data (no_ctor_new<T> (n)), len (n), count (1) | : data (no_ctor_new<T> (n)), len (n), count (1) | |||
{ | { | |||
fill_or_memset (n, val, data); | fill_or_memset (n, val, data); | |||
} | } | |||
ArrayRep (const ArrayRep& a) | ArrayRep (const ArrayRep& a) | |||
: data (no_ctor_new<T> (a.len)), len (a.len), count (1) | : data (no_ctor_new<T> (a.len)), len (a.len), count (1) | |||
{ | { | |||
copy_or_memcpy (a.len, a.data, data); | copy_or_memcpy (a.len, a.data, data); | |||
} | } | |||
~ArrayRep (void) { no_ctor_delete<T> (data); } | ~ArrayRep (void) { no_ctor_delete<T> (data); } | |||
octave_idx_type length (void) const { return len; } | octave_idx_type length (void) const { return len; } | |||
private: | private: | |||
// No assignment! | // No assignment! | |||
ArrayRep& operator = (const ArrayRep& a); | ArrayRep& operator = (const ArrayRep& a); | |||
}; | }; | |||
//-------------------------------------------------------------------- | //-------------------------------------------------------------------- | |||
public: | public: | |||
void make_unique (void) | void make_unique (void) | |||
{ | { | |||
if (rep->count > 1) | if (rep->count > 1) | |||
{ | { | |||
ArrayRep *r = new ArrayRep (slice_data, slice_len); | ArrayRep *r = new ArrayRep (slice_data, slice_len); | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = r; | rep = r; | |||
slice_data = rep->data; | slice_data = rep->data; | |||
} | } | |||
} | } | |||
typedef T element_type; | typedef T element_type; | |||
typedef typename ref_param<T>::type crefT; | typedef typename ref_param<T>::type crefT; | |||
typedef bool (*compare_fcn_type) (typename ref_param<T>::type, | typedef bool (*compare_fcn_type) (typename ref_param<T>::type, | |||
typename ref_param<T>::type); | typename ref_param<T>::type); | |||
protected: | protected: | |||
skipping to change at line 150 | skipping to change at line 151 | |||
// subranges. Every time rep is directly manipulated, slice_data and slic e_len | // subranges. Every time rep is directly manipulated, slice_data and slic e_len | |||
// need to be properly updated. | // need to be properly updated. | |||
T* slice_data; | T* slice_data; | |||
octave_idx_type slice_len; | octave_idx_type slice_len; | |||
// slice constructor | // slice constructor | |||
Array (const Array<T>& a, const dim_vector& dv, | Array (const Array<T>& a, const dim_vector& dv, | |||
octave_idx_type l, octave_idx_type u) | octave_idx_type l, octave_idx_type u) | |||
: dimensions (dv), rep(a.rep), slice_data (a.slice_data+l), slice_len ( u-l) | : dimensions (dv), rep(a.rep), slice_data (a.slice_data+l), slice_len ( u-l) | |||
{ | { | |||
rep->count++; | rep->count++; | |||
dimensions.chop_trailing_singletons (); | dimensions.chop_trailing_singletons (); | |||
} | } | |||
private: | private: | |||
typename Array<T>::ArrayRep *nil_rep (void) const | typename Array<T>::ArrayRep *nil_rep (void) const | |||
{ | { | |||
// NR was originally allocated with new, but that does not seem | // NR was originally allocated with new, but that does not seem | |||
// to be necessary since it will never be deleted. So just use | // to be necessary since it will never be deleted. So just use | |||
// a static object instead. | // a static object instead. | |||
static typename Array<T>::ArrayRep nr; | static typename Array<T>::ArrayRep nr; | |||
return &nr; | return &nr; | |||
} | } | |||
protected: | ||||
// For jit support | ||||
Array (T *sdata, octave_idx_type slen, octave_idx_type *adims, void *arep | ||||
) | ||||
: dimensions (adims), | ||||
rep (reinterpret_cast<typename Array<T>::ArrayRep *> (arep)), | ||||
slice_data (sdata), slice_len (slen) { } | ||||
public: | public: | |||
// Empty ctor (0x0). | // Empty ctor (0x0). | |||
Array (void) | Array (void) | |||
: dimensions (), rep (nil_rep ()), slice_data (rep->data), | : dimensions (), rep (nil_rep ()), slice_data (rep->data), | |||
slice_len (rep->len) | slice_len (rep->len) | |||
{ | { | |||
rep->count++; | rep->count++; | |||
} | } | |||
// Obsolete 1D ctor (there are no 1D arrays). | // Obsolete 1D ctor (there are no 1D arrays). | |||
explicit Array (octave_idx_type n) GCC_ATTR_DEPRECATED | explicit Array (octave_idx_type n) GCC_ATTR_DEPRECATED | |||
: dimensions (n, 1), rep (new typename Array<T>::ArrayRep (n)), | : dimensions (n, 1), rep (new typename Array<T>::ArrayRep (n)), | |||
slice_data (rep->data), slice_len (rep->len) | slice_data (rep->data), slice_len (rep->len) | |||
{ } | { } | |||
// Obsolete initialized 1D ctor (there are no 1D arrays). | // Obsolete initialized 1D ctor (there are no 1D arrays). | |||
explicit Array (octave_idx_type n, const T& val) GCC_ATTR_DEPRECATED | explicit Array (octave_idx_type n, const T& val) GCC_ATTR_DEPRECATED | |||
: dimensions (n, 1), rep (new typename Array<T>::ArrayRep (n)), | : dimensions (n, 1), rep (new typename Array<T>::ArrayRep (n)), | |||
slice_data (rep->data), slice_len (rep->len) | slice_data (rep->data), slice_len (rep->len) | |||
{ | { | |||
fill (val); | fill (val); | |||
} | } | |||
// nD uninitialized ctor. | // nD uninitialized ctor. | |||
explicit Array (const dim_vector& dv) | explicit Array (const dim_vector& dv) | |||
: dimensions (dv), | : dimensions (dv), | |||
rep (new typename Array<T>::ArrayRep (dv.safe_numel ())), | rep (new typename Array<T>::ArrayRep (dv.safe_numel ())), | |||
slice_data (rep->data), slice_len (rep->len) | slice_data (rep->data), slice_len (rep->len) | |||
{ | { | |||
dimensions.chop_trailing_singletons (); | dimensions.chop_trailing_singletons (); | |||
} | } | |||
// nD initialized ctor. | // nD initialized ctor. | |||
explicit Array (const dim_vector& dv, const T& val) | explicit Array (const dim_vector& dv, const T& val) | |||
: dimensions (dv), | : dimensions (dv), | |||
rep (new typename Array<T>::ArrayRep (dv.safe_numel ())), | rep (new typename Array<T>::ArrayRep (dv.safe_numel ())), | |||
slice_data (rep->data), slice_len (rep->len) | slice_data (rep->data), slice_len (rep->len) | |||
{ | { | |||
fill (val); | fill (val); | |||
dimensions.chop_trailing_singletons (); | dimensions.chop_trailing_singletons (); | |||
} | } | |||
// Reshape constructor. | // Reshape constructor. | |||
Array (const Array<T>& a, const dim_vector& dv); | Array (const Array<T>& a, const dim_vector& dv); | |||
// Type conversion case. | // Type conversion case. | |||
template <class U> | template <class U> | |||
Array (const Array<U>& a) | Array (const Array<U>& a) | |||
: dimensions (a.dims ()), | : dimensions (a.dims ()), | |||
rep (new typename Array<T>::ArrayRep (a.data (), a.length ())), | rep (new typename Array<T>::ArrayRep (a.data (), a.length ())), | |||
slice_data (rep->data), slice_len (rep->len) | slice_data (rep->data), slice_len (rep->len) | |||
{ } | { } | |||
// No type conversion case. | // No type conversion case. | |||
Array (const Array<T>& a) | Array (const Array<T>& a) | |||
: dimensions (a.dimensions), rep (a.rep), slice_data (a.slice_data), | : dimensions (a.dimensions), rep (a.rep), slice_data (a.slice_data), | |||
slice_len (a.slice_len) | slice_len (a.slice_len) | |||
{ | { | |||
rep->count++; | rep->count++; | |||
} | } | |||
public: | public: | |||
~Array (void) | virtual ~Array (void) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
} | } | |||
Array<T>& operator = (const Array<T>& a) | Array<T>& operator = (const Array<T>& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = a.rep; | ||||
rep->count++; | ||||
dimensions = a.dimensions; | ||||
slice_data = a.slice_data; | ||||
slice_len = a.slice_len; | ||||
} | ||||
return *this; | rep = a.rep; | |||
} | rep->count++; | |||
dimensions = a.dimensions; | ||||
slice_data = a.slice_data; | ||||
slice_len = a.slice_len; | ||||
} | ||||
return *this; | ||||
} | ||||
void fill (const T& val); | void fill (const T& val); | |||
void clear (void); | void clear (void); | |||
void clear (const dim_vector& dv); | void clear (const dim_vector& dv); | |||
void clear (octave_idx_type r, octave_idx_type c) | void clear (octave_idx_type r, octave_idx_type c) | |||
{ clear (dim_vector (r, c)); } | { clear (dim_vector (r, c)); } | |||
octave_idx_type capacity (void) const { return slice_len; } | octave_idx_type capacity (void) const { return slice_len; } | |||
octave_idx_type length (void) const { return capacity (); } | octave_idx_type length (void) const { return capacity (); } | |||
octave_idx_type nelem (void) const { return capacity (); } | octave_idx_type nelem (void) const { return capacity (); } | |||
octave_idx_type numel (void) const { return nelem (); } | octave_idx_type numel (void) const { return nelem (); } | |||
octave_idx_type dim1 (void) const { return dimensions(0); } | octave_idx_type dim1 (void) const { return dimensions(0); } | |||
octave_idx_type dim2 (void) const { return dimensions(1); } | octave_idx_type dim2 (void) const { return dimensions(1); } | |||
octave_idx_type dim3 (void) const { return dimensions(2); } | octave_idx_type dim3 (void) const { return dimensions(2); } | |||
// Return the array as a column vector. | // Return the array as a column vector. | |||
Array<T> as_column (void) const | Array<T> as_column (void) const | |||
{ | { | |||
Array<T> retval (*this); | Array<T> retval (*this); | |||
if (dimensions.length () != 2 || dimensions(1) != 1) | if (dimensions.length () != 2 || dimensions(1) != 1) | |||
retval.dimensions = dim_vector (numel (), 1); | retval.dimensions = dim_vector (numel (), 1); | |||
return retval; | return retval; | |||
} | } | |||
// Return the array as a row vector. | // Return the array as a row vector. | |||
Array<T> as_row (void) const | Array<T> as_row (void) const | |||
{ | { | |||
Array<T> retval (*this); | Array<T> retval (*this); | |||
if (dimensions.length () != 2 || dimensions(0) != 1) | if (dimensions.length () != 2 || dimensions(0) != 1) | |||
retval.dimensions = dim_vector (1, numel ()); | retval.dimensions = dim_vector (1, numel ()); | |||
return retval; | return retval; | |||
} | } | |||
// Return the array as a matrix. | // Return the array as a matrix. | |||
Array<T> as_matrix (void) const | Array<T> as_matrix (void) const | |||
{ | { | |||
Array<T> retval (*this); | Array<T> retval (*this); | |||
if (dimensions.length () != 2) | if (dimensions.length () != 2) | |||
retval.dimensions = dimensions.redim (2); | retval.dimensions = dimensions.redim (2); | |||
return retval; | return retval; | |||
} | } | |||
octave_idx_type rows (void) const { return dim1 (); } | octave_idx_type rows (void) const { return dim1 (); } | |||
octave_idx_type cols (void) const { return dim2 (); } | octave_idx_type cols (void) const { return dim2 (); } | |||
octave_idx_type columns (void) const { return dim2 (); } | octave_idx_type columns (void) const { return dim2 (); } | |||
octave_idx_type pages (void) const { return dim3 (); } | octave_idx_type pages (void) const { return dim3 (); } | |||
size_t byte_size (void) const { return static_cast<size_t> (numel ()) * s | size_t byte_size (void) const | |||
izeof (T); } | { return static_cast<size_t> (numel ()) * sizeof (T); } | |||
// Return a const-reference so that dims ()(i) works efficiently. | // Return a const-reference so that dims ()(i) works efficiently. | |||
const dim_vector& dims (void) const { return dimensions; } | const dim_vector& dims (void) const { return dimensions; } | |||
Array<T> squeeze (void) const; | Array<T> squeeze (void) const; | |||
void chop_trailing_singletons (void) GCC_ATTR_DEPRECATED | void chop_trailing_singletons (void) GCC_ATTR_DEPRECATED | |||
{ dimensions.chop_trailing_singletons (); } | { dimensions.chop_trailing_singletons (); } | |||
octave_idx_type compute_index (octave_idx_type i, octave_idx_type j) cons t; | octave_idx_type compute_index (octave_idx_type i, octave_idx_type j) cons t; | |||
octave_idx_type compute_index (octave_idx_type i, octave_idx_type j, octa | octave_idx_type compute_index (octave_idx_type i, octave_idx_type j, | |||
ve_idx_type k) const; | octave_idx_type k) const; | |||
octave_idx_type compute_index (const Array<octave_idx_type>& ra_idx) cons t; | octave_idx_type compute_index (const Array<octave_idx_type>& ra_idx) cons t; | |||
octave_idx_type compute_index_unchecked (const Array<octave_idx_type>& ra | octave_idx_type compute_index_unchecked (const Array<octave_idx_type>& ra | |||
_idx) const | _idx) | |||
{ return dimensions.compute_index (ra_idx.data (), ra_idx.length ()); } | const | |||
{ return dimensions.compute_index (ra_idx.data (), ra_idx.length ()); } | ||||
// No checking, even for multiple references, ever. | // No checking, even for multiple references, ever. | |||
T& xelem (octave_idx_type n) { return slice_data [n]; } | T& xelem (octave_idx_type n) { return slice_data[n]; } | |||
crefT xelem (octave_idx_type n) const { return slice_data [n]; } | crefT xelem (octave_idx_type n) const { return slice_data[n]; } | |||
T& xelem (octave_idx_type i, octave_idx_type j) { return xelem (dim1()*j+ | T& xelem (octave_idx_type i, octave_idx_type j) | |||
i); } | { return xelem (dim1 ()*j+i); } | |||
crefT xelem (octave_idx_type i, octave_idx_type j) const { return xelem ( | crefT xelem (octave_idx_type i, octave_idx_type j) const | |||
dim1()*j+i); } | { return xelem (dim1 ()*j+i); } | |||
T& xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) | T& xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) | |||
{ return xelem (i, dim2()*k+j); } | { return xelem (i, dim2 ()*k+j); } | |||
crefT xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) con st | crefT xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) con st | |||
{ return xelem (i, dim2()*k+j); } | { return xelem (i, dim2 ()*k+j); } | |||
T& xelem (const Array<octave_idx_type>& ra_idx) | T& xelem (const Array<octave_idx_type>& ra_idx) | |||
{ return xelem (compute_index_unchecked (ra_idx)); } | { return xelem (compute_index_unchecked (ra_idx)); } | |||
crefT xelem (const Array<octave_idx_type>& ra_idx) const | crefT xelem (const Array<octave_idx_type>& ra_idx) const | |||
{ return xelem (compute_index_unchecked (ra_idx)); } | { return xelem (compute_index_unchecked (ra_idx)); } | |||
// FIXME -- would be nice to fix this so that we don't | // FIXME: would be nice to fix this so that we don't unnecessarily force | |||
// unnecessarily force a copy, but that is not so easy, and I see no | // a copy, but that is not so easy, and I see no clean way to do i | |||
// clean way to do it. | t. | |||
T& checkelem (octave_idx_type n); | T& checkelem (octave_idx_type n); | |||
T& checkelem (octave_idx_type i, octave_idx_type j); | T& checkelem (octave_idx_type i, octave_idx_type j); | |||
T& checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type k); | T& checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type k); | |||
T& checkelem (const Array<octave_idx_type>& ra_idx); | T& checkelem (const Array<octave_idx_type>& ra_idx); | |||
T& elem (octave_idx_type n) | T& elem (octave_idx_type n) | |||
{ | { | |||
make_unique (); | make_unique (); | |||
return xelem (n); | return xelem (n); | |||
} | } | |||
T& elem (octave_idx_type i, octave_idx_type j) { return elem (dim1()*j+i) ; } | T& elem (octave_idx_type i, octave_idx_type j) { return elem (dim1 ()*j+i ); } | |||
T& elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) { retur | T& elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) | |||
n elem (i, dim2()*k+j); } | { return elem (i, dim2 ()*k+j); } | |||
T& elem (const Array<octave_idx_type>& ra_idx) | T& elem (const Array<octave_idx_type>& ra_idx) | |||
{ return Array<T>::elem (compute_index_unchecked (ra_idx)); } | { return Array<T>::elem (compute_index_unchecked (ra_idx)); } | |||
#if defined (BOUNDS_CHECKING) | #if defined (BOUNDS_CHECKING) | |||
T& operator () (octave_idx_type n) { return checkelem (n); } | T& operator () (octave_idx_type n) { return checkelem (n); } | |||
T& operator () (octave_idx_type i, octave_idx_type j) { return checkelem | T& operator () (octave_idx_type i, octave_idx_type j) | |||
(i, j); } | { return checkelem (i, j); } | |||
T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) | T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) | |||
{ return checkelem (i, j, k); } | { return checkelem (i, j, k); } | |||
T& operator () (const Array<octave_idx_type>& ra_idx) { return checkelem | T& operator () (const Array<octave_idx_type>& ra_idx) | |||
(ra_idx); } | { return checkelem (ra_idx); } | |||
#else | #else | |||
T& operator () (octave_idx_type n) { return elem (n); } | T& operator () (octave_idx_type n) { return elem (n); } | |||
T& operator () (octave_idx_type i, octave_idx_type j) { return elem (i, j ); } | T& operator () (octave_idx_type i, octave_idx_type j) { return elem (i, j ); } | |||
T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) | T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) | |||
{ return elem (i, j, k); } | { return elem (i, j, k); } | |||
T& operator () (const Array<octave_idx_type>& ra_idx) { return elem (ra_i | T& operator () (const Array<octave_idx_type>& ra_idx) | |||
dx); } | { return elem (ra_idx); } | |||
#endif | #endif | |||
crefT checkelem (octave_idx_type n) const; | 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) const; | |||
crefT checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) | crefT checkelem (octave_idx_type i, octave_idx_type j, | |||
const; | octave_idx_type k) const; | |||
crefT checkelem (const Array<octave_idx_type>& ra_idx) const; | crefT checkelem (const Array<octave_idx_type>& ra_idx) const; | |||
crefT elem (octave_idx_type n) const { return xelem (n); } | crefT elem (octave_idx_type n) const { return xelem (n); } | |||
crefT elem (octave_idx_type i, octave_idx_type j) const { return xelem (i | crefT elem (octave_idx_type i, octave_idx_type j) const | |||
, j); } | { return xelem (i, j); } | |||
crefT elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) cons | crefT elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) cons | |||
t { return xelem (i, j, k); } | t | |||
{ return xelem (i, j, k); } | ||||
crefT elem (const Array<octave_idx_type>& ra_idx) const | crefT elem (const Array<octave_idx_type>& ra_idx) const | |||
{ return Array<T>::xelem (compute_index_unchecked (ra_idx)); } | { return Array<T>::xelem (compute_index_unchecked (ra_idx)); } | |||
#if defined (BOUNDS_CHECKING) | #if defined (BOUNDS_CHECKING) | |||
crefT operator () (octave_idx_type n) const { return checkelem (n); } | crefT operator () (octave_idx_type n) const { return checkelem (n); } | |||
crefT operator () (octave_idx_type i, octave_idx_type j) const { return c | crefT operator () (octave_idx_type i, octave_idx_type j) const | |||
heckelem (i, j); } | { return checkelem (i, j); } | |||
crefT operator () (octave_idx_type i, octave_idx_type j, octave_idx_type | crefT operator () (octave_idx_type i, octave_idx_type j, | |||
k) const { return checkelem (i, j, k); } | octave_idx_type k) const | |||
crefT operator () (const Array<octave_idx_type>& ra_idx) const { return c | { return checkelem (i, j, k); } | |||
heckelem (ra_idx); } | crefT operator () (const Array<octave_idx_type>& ra_idx) const | |||
{ return checkelem (ra_idx); } | ||||
#else | #else | |||
crefT operator () (octave_idx_type n) const { return elem (n); } | crefT operator () (octave_idx_type n) const { return elem (n); } | |||
crefT operator () (octave_idx_type i, octave_idx_type j) const { return e | crefT operator () (octave_idx_type i, octave_idx_type j) const | |||
lem (i, j); } | { return elem (i, j); } | |||
crefT operator () (octave_idx_type i, octave_idx_type j, octave_idx_type | crefT operator () (octave_idx_type i, octave_idx_type j, | |||
k) const { return elem (i, j, k); } | octave_idx_type k) const | |||
crefT operator () (const Array<octave_idx_type>& ra_idx) const { return e | { return elem (i, j, k); } | |||
lem (ra_idx); } | crefT operator () (const Array<octave_idx_type>& ra_idx) const | |||
{ return elem (ra_idx); } | ||||
#endif | #endif | |||
// Fast extractors. All of these produce shallow copies. | // Fast extractors. All of these produce shallow copies. | |||
// Warning: none of these do check bounds, unless BOUNDS_CHECKING is on! | // Warning: none of these do check bounds, unless BOUNDS_CHECKING is on! | |||
// Extract column: A(:,k+1). | // Extract column: A(:,k+1). | |||
Array<T> column (octave_idx_type k) const; | Array<T> column (octave_idx_type k) const; | |||
// Extract page: A(:,:,k+1). | // Extract page: A(:,:,k+1). | |||
Array<T> page (octave_idx_type k) const; | Array<T> page (octave_idx_type k) const; | |||
// Extract a slice from this array as a column vector: A(:)(lo+1:up). | // Extract a slice from this array as a column vector: A(:)(lo+1:up). | |||
// Must be 0 <= lo && up <= numel. May be up < lo. | // Must be 0 <= lo && up <= numel. May be up < lo. | |||
Array<T> linear_slice (octave_idx_type lo, octave_idx_type up) const; | Array<T> linear_slice (octave_idx_type lo, octave_idx_type up) const; | |||
Array<T> reshape (octave_idx_type nr, octave_idx_type nc) const | Array<T> reshape (octave_idx_type nr, octave_idx_type nc) const | |||
{ return Array<T> (*this, dim_vector (nr, nc)); } | { return Array<T> (*this, dim_vector (nr, nc)); } | |||
Array<T> reshape (const dim_vector& new_dims) const | Array<T> reshape (const dim_vector& new_dims) const | |||
{ return Array<T> (*this, new_dims); } | { return Array<T> (*this, new_dims); } | |||
Array<T> permute (const Array<octave_idx_type>& vec, bool inv = false) co nst; | Array<T> permute (const Array<octave_idx_type>& vec, bool inv = false) co nst; | |||
Array<T> ipermute (const Array<octave_idx_type>& vec) const | Array<T> ipermute (const Array<octave_idx_type>& vec) const | |||
{ return permute (vec, true); } | { return permute (vec, true); } | |||
bool is_square (void) const { return (dim1 () == dim2 ()); } | bool is_square (void) const { return (dim1 () == dim2 ()); } | |||
bool is_empty (void) const { return numel () == 0; } | bool is_empty (void) const { return numel () == 0; } | |||
bool is_vector (void) const { return dimensions.is_vector (); } | bool is_vector (void) const { return dimensions.is_vector (); } | |||
Array<T> transpose (void) const; | Array<T> transpose (void) const; | |||
Array<T> hermitian (T (*fcn) (const T&) = 0) const; | Array<T> hermitian (T (*fcn) (const T&) = 0) const; | |||
skipping to change at line 453 | skipping to change at line 483 | |||
int ndims (void) const { return dimensions.length (); } | int ndims (void) const { return dimensions.length (); } | |||
// Indexing without resizing. | // Indexing without resizing. | |||
Array<T> index (const idx_vector& i) const; | Array<T> index (const idx_vector& i) const; | |||
Array<T> index (const idx_vector& i, const idx_vector& j) const; | Array<T> index (const idx_vector& i, const idx_vector& j) const; | |||
Array<T> index (const Array<idx_vector>& ia) const; | Array<T> index (const Array<idx_vector>& ia) const; | |||
static const T& resize_fill_value (); | virtual T resize_fill_value (void) const; | |||
// Resizing (with fill). | // Resizing (with fill). | |||
void resize1 (octave_idx_type n, const T& rfv = resize_fill_value ()); | void resize1 (octave_idx_type n, const T& rfv); | |||
void resize1 (octave_idx_type n) { resize1 (n, resize_fill_value ()); } | ||||
void resize (octave_idx_type n) GCC_ATTR_DEPRECATED | void resize (octave_idx_type n) GCC_ATTR_DEPRECATED { resize1 (n); } | |||
{ resize1 (n); } | ||||
void resize (octave_idx_type nr, octave_idx_type nc, | void resize (octave_idx_type nr, octave_idx_type nc, | |||
const T& rfv = resize_fill_value ()) GCC_ATTR_DEPRECATED | const T& rfv) GCC_ATTR_DEPRECATED | |||
{ | { | |||
resize2 (nr, nc, rfv); | resize2 (nr, nc, rfv); | |||
} | } | |||
void resize (const dim_vector& dv, const T& rfv = resize_fill_value ()); | void resize (octave_idx_type nr, octave_idx_type nc) GCC_ATTR_DEPRECATED | |||
{ | ||||
resize2 (nr, nc, resize_fill_value ()); | ||||
} | ||||
void resize (const dim_vector& dv, const T& rfv); | ||||
void resize (const dim_vector& dv) { resize (dv, resize_fill_value ()); } | ||||
// Indexing with possible resizing and fill | // Indexing with possible resizing and fill | |||
// FIXME -- this is really a corner case, that should better be | // FIXME: this is really a corner case, that should better be | |||
// handled directly in liboctinterp. | // handled directly in liboctinterp. | |||
Array<T> index (const idx_vector& i, bool resize_ok, | Array<T> index (const idx_vector& i, bool resize_ok, const T& rfv) const; | |||
const T& rfv = resize_fill_value ()) const; | Array<T> index (const idx_vector& i, bool resize_ok) const | |||
{ | ||||
return index (i, resize_ok, resize_fill_value ()); | ||||
} | ||||
Array<T> index (const idx_vector& i, const idx_vector& j, bool resize_ok, | ||||
const T& rfv) const; | ||||
Array<T> index (const idx_vector& i, const idx_vector& j, | Array<T> index (const idx_vector& i, const idx_vector& j, | |||
bool resize_ok, const T& rfv = resize_fill_value ()) cons | bool resize_ok) const | |||
t; | { | |||
return index (i, j, resize_ok, resize_fill_value ()); | ||||
} | ||||
Array<T> index (const Array<idx_vector>& ia, | Array<T> index (const Array<idx_vector>& ia, bool resize_ok, | |||
bool resize_ok, const T& rfv = resize_fill_value ()) cons | const T& rfv) const; | |||
t; | Array<T> index (const Array<idx_vector>& ia, bool resize_ok) const | |||
{ | ||||
return index (ia, resize_ok, resize_fill_value ()); | ||||
} | ||||
// Indexed assignment (always with resize & fill). | // Indexed assignment (always with resize & fill). | |||
void assign (const idx_vector& i, const Array<T>& rhs, | void assign (const idx_vector& i, const Array<T>& rhs, const T& rfv); | |||
const T& rfv = resize_fill_value ()); | void assign (const idx_vector& i, const Array<T>& rhs) | |||
{ | ||||
assign (i, rhs, resize_fill_value ()); | ||||
} | ||||
void assign (const idx_vector& i, const idx_vector& j, const Array<T>& rh s, | void assign (const idx_vector& i, const idx_vector& j, const Array<T>& rh s, | |||
const T& rfv = resize_fill_value ()); | const T& rfv); | |||
void assign (const idx_vector& i, const idx_vector& j, const Array<T>& rh | ||||
s) | ||||
{ | ||||
assign (i, j, rhs, resize_fill_value ()); | ||||
} | ||||
void assign (const Array<idx_vector>& ia, const Array<T>& rhs, | void assign (const Array<idx_vector>& ia, const Array<T>& rhs, const T& r | |||
const T& rfv = resize_fill_value ()); | fv); | |||
void assign (const Array<idx_vector>& ia, const Array<T>& rhs) | ||||
{ | ||||
assign (ia, rhs, resize_fill_value ()); | ||||
} | ||||
// Deleting elements. | // Deleting elements. | |||
// A(I) = [] (with a single subscript) | // A(I) = [] (with a single subscript) | |||
void delete_elements (const idx_vector& i); | void delete_elements (const idx_vector& i); | |||
// A(:,...,I,...,:) = [] (>= 2 subscripts, one of them is non-colon) | // A(:,...,I,...,:) = [] (>= 2 subscripts, one of them is non-colon) | |||
void delete_elements (int dim, const idx_vector& i); | void delete_elements (int dim, const idx_vector& i); | |||
// Dispatcher to the above two. | // Dispatcher to the above two. | |||
skipping to change at line 515 | skipping to change at line 573 | |||
// Insert an array into another at a specified position. | // Insert an array into another at a specified position. | |||
// If size (a) is [d1 d2 ... dN] and idx is [i1 i2 ... iN], | // If size (a) is [d1 d2 ... dN] and idx is [i1 i2 ... iN], | |||
// this method is equivalent to | // this method is equivalent to | |||
// x(i1:i1+d1-1, i2:i2+d2-1, ... , iN:iN+dN-1) = a. | // x(i1:i1+d1-1, i2:i2+d2-1, ... , iN:iN+dN-1) = a. | |||
Array<T>& insert (const Array<T>& a, const Array<octave_idx_type>& idx); | Array<T>& insert (const Array<T>& a, const Array<octave_idx_type>& idx); | |||
// This is just a special case for idx = [r c 0 ...] | // This is just a special case for idx = [r c 0 ...] | |||
Array<T>& insert (const Array<T>& a, octave_idx_type r, octave_idx_type c ); | Array<T>& insert (const Array<T>& a, octave_idx_type r, octave_idx_type c ); | |||
void maybe_economize (void) | void maybe_economize (void) | |||
{ | { | |||
if (rep->count == 1 && slice_len != rep->len) | if (rep->count == 1 && slice_len != rep->len) | |||
{ | { | |||
ArrayRep *new_rep = new ArrayRep (slice_data, slice_len); | ArrayRep *new_rep = new ArrayRep (slice_data, slice_len); | |||
delete rep; | delete rep; | |||
rep = new_rep; | rep = new_rep; | |||
slice_data = rep->data; | slice_data = rep->data; | |||
} | } | |||
} | } | |||
void print_info (std::ostream& os, const std::string& prefix) const; | void print_info (std::ostream& os, const std::string& prefix) const; | |||
// Unsafe. This function exists to support the MEX interface. | // Unsafe. This function exists to support the MEX interface. | |||
// You should not use it anywhere else. | // You should not use it anywhere else. | |||
void *mex_get_data (void) const { return const_cast<T *> (data ()); } | void *mex_get_data (void) const { return const_cast<T *> (data ()); } | |||
Array<T> sort (int dim = 0, sortmode mode = ASCENDING) const; | Array<T> sort (int dim = 0, sortmode mode = ASCENDING) const; | |||
Array<T> sort (Array<octave_idx_type> &sidx, int dim = 0, | Array<T> sort (Array<octave_idx_type> &sidx, int dim = 0, | |||
sortmode mode = ASCENDING) const; | sortmode mode = ASCENDING) const; | |||
skipping to change at line 550 | skipping to change at line 608 | |||
// Ordering is auto-detected or can be specified. | // Ordering is auto-detected or can be specified. | |||
sortmode is_sorted_rows (sortmode mode = UNSORTED) const; | sortmode is_sorted_rows (sortmode mode = UNSORTED) const; | |||
// Do a binary lookup in a sorted array. Must not contain NaNs. | // 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 el ement. | // Mode can be specified or is auto-detected by comparing 1st and last el ement. | |||
octave_idx_type lookup (const T& value, sortmode mode = UNSORTED) const; | octave_idx_type lookup (const T& value, sortmode mode = UNSORTED) const; | |||
// Ditto, but for an array of values, specializing on the case when value s | // Ditto, but for an array of values, specializing on the case when value s | |||
// are sorted. NaNs get the value N. | // are sorted. NaNs get the value N. | |||
Array<octave_idx_type> lookup (const Array<T>& values, sortmode mode = UN | Array<octave_idx_type> lookup (const Array<T>& values, | |||
SORTED) const; | sortmode mode = UNSORTED) const; | |||
// Count nonzero elements. | // Count nonzero elements. | |||
octave_idx_type nnz (void) const; | octave_idx_type nnz (void) const; | |||
// Find indices of (at most n) nonzero elements. If n is specified, backw ard | // Find indices of (at most n) nonzero elements. If n is specified, backw ard | |||
// specifies search from backward. | // specifies search from backward. | |||
Array<octave_idx_type> find (octave_idx_type n = -1, bool backward = fals | Array<octave_idx_type> find (octave_idx_type n = -1, | |||
e) const; | bool backward = false) const; | |||
// Returns the n-th element in increasing order, using the same ordering as | // 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. | // used for sort. n can either be a scalar index or a contiguous range. | |||
Array<T> nth_element (const idx_vector& n, int dim = 0) const; | Array<T> nth_element (const idx_vector& n, int dim = 0) const; | |||
Array<T> diag (octave_idx_type k = 0) const; | Array<T> diag (octave_idx_type k = 0) const; | |||
Array<T> diag (octave_idx_type m, octave_idx_type n) const; | ||||
// Concatenation along a specified (0-based) dimension, equivalent to cat (). | // Concatenation along a specified (0-based) dimension, equivalent to cat (). | |||
// dim = -1 corresponds to dim = 0 and dim = -2 corresponds to dim = 1, | // dim = -1 corresponds to dim = 0 and dim = -2 corresponds to dim = 1, | |||
// but apply the looser matching rules of vertcat/horzcat. | // but apply the looser matching rules of vertcat/horzcat. | |||
static Array<T> | static Array<T> | |||
cat (int dim, octave_idx_type n, const Array<T> *array_list); | cat (int dim, octave_idx_type n, const Array<T> *array_list); | |||
template <class U, class F> | template <class U, class F> | |||
Array<U> | Array<U> | |||
map (F fcn) const | map (F fcn) const | |||
{ | { | |||
skipping to change at line 616 | skipping to change at line 678 | |||
template <class U> | template <class U> | |||
Array<U> | Array<U> | |||
map (U (&fcn) (const T&)) const | map (U (&fcn) (const T&)) const | |||
{ return map<U, U (&) (const T&)> (fcn); } | { return map<U, U (&) (const T&)> (fcn); } | |||
// Generic any/all test functionality with arbitrary predicate. | // Generic any/all test functionality with arbitrary predicate. | |||
template <class F, bool zero> | template <class F, bool zero> | |||
bool test (F fcn) const | bool test (F fcn) const | |||
{ | { | |||
octave_idx_type len = length (); | return any_all_test<F, T, zero> (fcn, data (), length ()); | |||
const T *m = data (); | ||||
octave_idx_type i; | ||||
for (i = 0; i < len - 3; i += 4) | ||||
{ | ||||
octave_quit (); | ||||
if (fcn (m[i]) != zero | ||||
|| fcn (m[i+1]) != zero | ||||
|| fcn (m[i+2]) != zero | ||||
|| fcn (m[i+3]) != zero) | ||||
return ! zero; | ||||
} | ||||
octave_quit (); | ||||
for (; i < len; i++) | ||||
if (fcn (m[i]) != zero) | ||||
return ! zero; | ||||
return zero; | ||||
} | } | |||
// Simpler calls. | // Simpler calls. | |||
template <class F> | template <class F> | |||
bool test_any (F fcn) const | bool test_any (F fcn) const | |||
{ return test<F, false> (fcn); } | { return test<F, false> (fcn); } | |||
template <class F> | template <class F> | |||
bool test_all (F fcn) const | bool test_all (F fcn) const | |||
{ return test<F, true> (fcn); } | { return test<F, true> (fcn); } | |||
skipping to change at line 671 | skipping to change at line 710 | |||
bool test_all (bool (&fcn) (const T&)) const | bool test_all (bool (&fcn) (const T&)) const | |||
{ return test<bool (&) (const T&), true> (fcn); } | { return test<bool (&) (const T&), true> (fcn); } | |||
template <class U> friend class Array; | template <class U> friend class Array; | |||
// Returns true if this->dims () == dv, and if so, replaces this->dimensi ons | // Returns true if this->dims () == dv, and if so, replaces this->dimensi ons | |||
// by a shallow copy of dv. This is useful for maintaining several arrays with | // by a shallow copy of dv. This is useful for maintaining several arrays with | |||
// supposedly equal dimensions (e.g. structs in the interpreter). | // supposedly equal dimensions (e.g. structs in the interpreter). | |||
bool optimize_dimensions (const dim_vector& dv); | bool optimize_dimensions (const dim_vector& dv); | |||
// WARNING: Only call these functions from jit | ||||
int *jit_ref_count (void) { return rep->count.get (); } | ||||
T *jit_slice_data (void) const { return slice_data; } | ||||
octave_idx_type *jit_dimensions (void) const { return dimensions.to_jit ( | ||||
); } | ||||
void *jit_array_rep (void) const { return rep; } | ||||
private: | private: | |||
void resize2 (octave_idx_type nr, octave_idx_type nc, | void resize2 (octave_idx_type nr, octave_idx_type nc, const T& rfv); | |||
const T& rfv = resize_fill_value ()); | void resize2 (octave_idx_type nr, octave_idx_type nc) | |||
{ | ||||
resize2 (nr, nc, resize_fill_value ()); | ||||
} | ||||
static void instantiation_guard (); | static void instantiation_guard (); | |||
}; | }; | |||
// This is a simple wrapper template that will subclass an Array<T> type or any | // This is a simple wrapper template that will subclass an Array<T> type or any | |||
// later type derived from it and override the default non-const operator() to | // later type derived from it and override the default non-const operator() to | |||
// not check for the array's uniqueness. It is, however, the user's | // not check for the array's uniqueness. It is, however, the user's | |||
// responsibility to ensure the array is actually unaliased whenever elemen ts | // responsibility to ensure the array is actually unaliased whenever elemen ts | |||
// are accessed. | // are accessed. | |||
skipping to change at line 703 | skipping to change at line 755 | |||
template <class X> | template <class X> | |||
explicit NoAlias (X x) : ArrayClass (x) { } | explicit NoAlias (X x) : ArrayClass (x) { } | |||
template <class X, class Y> | template <class X, class Y> | |||
explicit NoAlias (X x, Y y) : ArrayClass (x, y) { } | explicit NoAlias (X x, Y y) : ArrayClass (x, y) { } | |||
template <class X, class Y, class Z> | template <class X, class Y, class Z> | |||
explicit NoAlias (X x, Y y, Z z) : ArrayClass (x, y, z) { } | explicit NoAlias (X x, Y y, Z z) : ArrayClass (x, y, z) { } | |||
T& operator () (octave_idx_type n) | T& operator () (octave_idx_type n) | |||
{ return ArrayClass::xelem (n); } | { return ArrayClass::xelem (n); } | |||
T& operator () (octave_idx_type i, octave_idx_type j) | T& operator () (octave_idx_type i, octave_idx_type j) | |||
{ return ArrayClass::xelem (i, j); } | { return ArrayClass::xelem (i, j); } | |||
T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) | T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) | |||
{ return ArrayClass::xelem (i, j, k); } | { return ArrayClass::xelem (i, j, k); } | |||
T& operator () (const Array<octave_idx_type>& ra_idx) | T& operator () (const Array<octave_idx_type>& ra_idx) | |||
{ return ArrayClass::xelem (ra_idx); } | { return ArrayClass::xelem (ra_idx); } | |||
}; | }; | |||
template <class T> | template <class T> | |||
std::ostream& | std::ostream& | |||
operator << (std::ostream& os, const Array<T>& a); | operator << (std::ostream& os, const Array<T>& a); | |||
#endif | #endif | |||
End of changes. 76 change blocks. | ||||
217 lines changed or deleted | 251 lines changed or added | |||
Array2.h | Array2.h | |||
---|---|---|---|---|
// Template array classes | // Template array classes | |||
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
Array3.h | Array3.h | |||
---|---|---|---|---|
// Template array classes | // Template array classes | |||
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 45 | skipping to change at line 45 | |||
// Three dimensional array class. | // Three dimensional array class. | |||
template <class T> | template <class T> | |||
class | class | |||
Array3 : public Array<T> | Array3 : public Array<T> | |||
{ | { | |||
public: | public: | |||
Array3 (void) : Array<T> (dim_vector (0, 0, 0)) { } | Array3 (void) : Array<T> (dim_vector (0, 0, 0)) { } | |||
Array3 (octave_idx_type r, octave_idx_type c, octave_idx_type p) : Array< | Array3 (octave_idx_type r, octave_idx_type c, | |||
T> (dim_vector (r, c, p)) { } | octave_idx_type p) : Array<T> (dim_vector (r, c, p)) { } | |||
Array3 (octave_idx_type r, octave_idx_type c, octave_idx_type p, const T& val) | Array3 (octave_idx_type r, octave_idx_type c, octave_idx_type p, const T& val) | |||
: Array<T> (dim_vector (r, c, p), val) { } | : Array<T> (dim_vector (r, c, p), val) { } | |||
Array3 (const Array3<T>& a) | Array3 (const Array3<T>& a) | |||
: Array<T> (a, a.dims ()) { } | : Array<T> (a, a.dims ()) { } | |||
Array3 (const Array<T>& a, octave_idx_type r, octave_idx_type c, octave_i | Array3 (const Array<T>& a, octave_idx_type r, octave_idx_type c, | |||
dx_type p) | octave_idx_type p) | |||
: Array<T> (a, dim_vector (r, c, p)) { } | : Array<T> (a, dim_vector (r, c, p)) { } | |||
~Array3 (void) { } | ~Array3 (void) { } | |||
Array3<T>& operator = (const Array3<T>& a) | Array3<T>& operator = (const Array3<T>& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
Array<T>::operator = (a); | Array<T>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p) | void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p) | |||
{ Array<T>::resize (dim_vector (r, c, p)); } | { Array<T>::resize (dim_vector (r, c, p)); } | |||
void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p, con | void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p, | |||
st T& val) | const T& val) | |||
{ Array<T>::resize (dim_vector (r, c, p), val); } | { Array<T>::resize (dim_vector (r, c, p), val); } | |||
Array3<T> sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const | Array3<T> sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const | |||
{ | { | |||
Array<T> tmp = Array<T>::sort (dim, mode); | Array<T> tmp = Array<T>::sort (dim, mode); | |||
return Array3<T> (tmp, tmp.rows (), tmp.columns (), tmp.pages ()); | return Array3<T> (tmp, tmp.rows (), tmp.columns (), tmp.pages ()); | |||
} | } | |||
Array3<T> sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | Array3<T> sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const | sortmode mode = ASCENDING) const | |||
{ | { | |||
Array<T> tmp = Array<T>::sort (sidx, dim, mode); | Array<T> tmp = Array<T>::sort (sidx, dim, mode); | |||
return Array3<T> (tmp, tmp.rows (), tmp.columns (), tmp.pages ()); | return Array3<T> (tmp, tmp.rows (), tmp.columns (), tmp.pages ()); | |||
} | } | |||
}; | }; | |||
// If we're with GNU C++, issue a warning. | // If we're with GNU C++, issue a warning. | |||
#ifdef __GNUC__ | #ifdef __GNUC__ | |||
#warning Using Array3<T> is deprecated. Use Array<T> directly. | #warning Using Array3<T> is deprecated. Use Array<T> directly. | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 9 change blocks. | ||||
23 lines changed or deleted | 23 lines changed or added | |||
ArrayN.h | ArrayN.h | |||
---|---|---|---|---|
// Template array classes | // Template array classes | |||
/* | /* | |||
Copyright (C) 2000-2012 John W. Eaton | Copyright (C) 2000-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
CColVector.h | CColVector.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexColumnVector_h) | #if !defined (octave_CColVector_h) | |||
#define octave_ComplexColumnVector_h 1 | #define octave_CColVector_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
ComplexColumnVector : public MArray<Complex> | ComplexColumnVector : public MArray<Complex> | |||
{ | { | |||
friend class ComplexMatrix; | friend class ComplexMatrix; | |||
friend class ComplexRowVector; | friend class ComplexRowVector; | |||
public: | public: | |||
ComplexColumnVector (void) : MArray<Complex> (dim_vector (0, 1)) { } | ComplexColumnVector (void) : MArray<Complex> (dim_vector (0, 1)) { } | |||
explicit ComplexColumnVector (octave_idx_type n) | explicit ComplexColumnVector (octave_idx_type n) | |||
: MArray<Complex> (dim_vector (n, 1)) { } | : MArray<Complex> (dim_vector (n, 1)) { } | |||
explicit ComplexColumnVector (const dim_vector& dv) | explicit ComplexColumnVector (const dim_vector& dv) | |||
: MArray<Complex> (dv.as_column ()) { } | : MArray<Complex> (dv.as_column ()) { } | |||
skipping to change at line 62 | skipping to change at line 62 | |||
ComplexColumnVector (const MArray<Complex>& a) | ComplexColumnVector (const MArray<Complex>& a) | |||
: MArray<Complex> (a.as_column ()) { } | : MArray<Complex> (a.as_column ()) { } | |||
ComplexColumnVector (const Array<Complex>& a) | ComplexColumnVector (const Array<Complex>& a) | |||
: MArray<Complex> (a.as_column ()) { } | : MArray<Complex> (a.as_column ()) { } | |||
explicit ComplexColumnVector (const ColumnVector& a); | explicit ComplexColumnVector (const ColumnVector& a); | |||
ComplexColumnVector& operator = (const ComplexColumnVector& a) | ComplexColumnVector& operator = (const ComplexColumnVector& a) | |||
{ | { | |||
MArray<Complex>::operator = (a); | MArray<Complex>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const ComplexColumnVector& a) const; | bool operator == (const ComplexColumnVector& a) const; | |||
bool operator != (const ComplexColumnVector& a) const; | bool operator != (const ComplexColumnVector& a) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
ComplexColumnVector& insert (const ColumnVector& a, octave_idx_type r); | ComplexColumnVector& insert (const ColumnVector& a, octave_idx_type r); | |||
ComplexColumnVector& insert (const ComplexColumnVector& a, octave_idx_typ e r); | ComplexColumnVector& insert (const ComplexColumnVector& a, octave_idx_typ e r); | |||
ComplexColumnVector& fill (double val); | ComplexColumnVector& fill (double val); | |||
ComplexColumnVector& fill (const Complex& val); | ComplexColumnVector& fill (const Complex& val); | |||
ComplexColumnVector& fill (double val, octave_idx_type r1, octave_idx_typ | ComplexColumnVector& fill (double val, | |||
e r2); | octave_idx_type r1, octave_idx_type r2); | |||
ComplexColumnVector& fill (const Complex& val, octave_idx_type r1, octave | ComplexColumnVector& fill (const Complex& val, | |||
_idx_type r2); | octave_idx_type r1, octave_idx_type r2); | |||
ComplexColumnVector stack (const ColumnVector& a) const; | ComplexColumnVector stack (const ColumnVector& a) const; | |||
ComplexColumnVector stack (const ComplexColumnVector& a) const; | ComplexColumnVector stack (const ComplexColumnVector& a) const; | |||
ComplexRowVector hermitian (void) const; | ComplexRowVector hermitian (void) const; | |||
ComplexRowVector transpose (void) const; | ComplexRowVector transpose (void) const; | |||
friend OCTAVE_API ComplexColumnVector conj (const ComplexColumnVector& a) ; | friend OCTAVE_API ComplexColumnVector conj (const ComplexColumnVector& a) ; | |||
// resize is the destructive equivalent for this one | // resize is the destructive equivalent for this one | |||
skipping to change at line 102 | skipping to change at line 104 | |||
ComplexColumnVector extract_n (octave_idx_type r1, octave_idx_type n) con st; | ComplexColumnVector extract_n (octave_idx_type r1, octave_idx_type n) con st; | |||
// column vector by column vector -> column vector operations | // column vector by column vector -> column vector operations | |||
ComplexColumnVector& operator += (const ColumnVector& a); | ComplexColumnVector& operator += (const ColumnVector& a); | |||
ComplexColumnVector& operator -= (const ColumnVector& a); | ComplexColumnVector& operator -= (const ColumnVector& a); | |||
// matrix by column vector -> column vector operations | // matrix by column vector -> column vector operations | |||
friend OCTAVE_API ComplexColumnVector operator * (const ComplexMatrix& a, | friend OCTAVE_API ComplexColumnVector operator * (const ComplexMatrix& a, | |||
const ColumnVector& b); | const ColumnVector& b); | |||
friend OCTAVE_API ComplexColumnVector operator * (const ComplexMatrix& a, | friend OCTAVE_API ComplexColumnVector operator * (const ComplexMatrix& a, | |||
const ComplexColumnVector& b); | const ComplexColumnVect or& b); | |||
// matrix by column vector -> column vector operations | // matrix by column vector -> column vector operations | |||
friend OCTAVE_API ComplexColumnVector operator * (const Matrix& a, | friend OCTAVE_API ComplexColumnVector operator * (const Matrix& a, | |||
const ComplexColumnVector& b); | const ComplexColumnVect or& b); | |||
// diagonal matrix by column vector -> column vector operations | // diagonal matrix by column vector -> column vector operations | |||
friend OCTAVE_API ComplexColumnVector operator * (const DiagMatrix& a, | friend OCTAVE_API ComplexColumnVector operator * (const DiagMatrix& a, | |||
const ComplexColumnVector& b); | const ComplexColumnVect or& b); | |||
friend OCTAVE_API ComplexColumnVector operator * (const ComplexDiagMatrix & a, | friend OCTAVE_API ComplexColumnVector operator * (const ComplexDiagMatrix & a, | |||
const ColumnVector& b); | const ColumnVector& b); | |||
friend OCTAVE_API ComplexColumnVector operator * (const ComplexDiagMatrix & a, | friend OCTAVE_API ComplexColumnVector operator * (const ComplexDiagMatrix & a, | |||
const ComplexColumnVector& b); | const ComplexColumnVect or& b); | |||
// other operations | // other operations | |||
Complex min (void) const; | Complex min (void) const; | |||
Complex max (void) const; | Complex max (void) const; | |||
ColumnVector abs (void) const; | ColumnVector abs (void) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Comp | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
lexColumnVector& a); | const ComplexColumnVector& a | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, ComplexCol | ); | |||
umnVector& a); | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
ComplexColumnVector& a); | ||||
void resize (octave_idx_type n, | void resize (octave_idx_type n, const Complex& rfv = Complex (0)) | |||
const Complex& rfv = Array<Complex>::resize_fill_value ()) | ||||
{ | { | |||
Array<Complex>::resize (dim_vector (n, 1), rfv); | Array<Complex>::resize (dim_vector (n, 1), rfv); | |||
} | } | |||
void clear (octave_idx_type n) | void clear (octave_idx_type n) | |||
{ Array<Complex>::clear (n, 1); } | { Array<Complex>::clear (n, 1); } | |||
}; | }; | |||
MARRAY_FORWARD_DEFS (MArray, ComplexColumnVector, Complex) | MARRAY_FORWARD_DEFS (MArray, ComplexColumnVector, Complex) | |||
#endif | #endif | |||
End of changes. 14 change blocks. | ||||
26 lines changed or deleted | 26 lines changed or added | |||
CDiagMatrix.h | CDiagMatrix.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexDiagMatrix_h) | #if !defined (octave_CDiagMatrix_h) | |||
#define octave_ComplexDiagMatrix_h 1 | #define octave_CDiagMatrix_h 1 | |||
#include "MDiagArray2.h" | #include "MDiagArray2.h" | |||
#include "dRowVector.h" | #include "dRowVector.h" | |||
#include "CRowVector.h" | #include "CRowVector.h" | |||
#include "dColVector.h" | #include "dColVector.h" | |||
#include "CColVector.h" | #include "CColVector.h" | |||
#include "DET.h" | #include "DET.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
ComplexDiagMatrix : public MDiagArray2<Complex> | ComplexDiagMatrix : public MDiagArray2<Complex> | |||
{ | { | |||
public: | public: | |||
ComplexDiagMatrix (void) : MDiagArray2<Complex> () { } | ComplexDiagMatrix (void) : MDiagArray2<Complex> () { } | |||
ComplexDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<Co | ComplexDiagMatrix (octave_idx_type r, octave_idx_type c) | |||
mplex> (r, c) { } | : MDiagArray2<Complex> (r, c) { } | |||
ComplexDiagMatrix (octave_idx_type r, octave_idx_type c, const Complex& v al) | ComplexDiagMatrix (octave_idx_type r, octave_idx_type c, const Complex& v al) | |||
: MDiagArray2<Complex> (r, c, val) { } | : MDiagArray2<Complex> (r, c, val) { } | |||
explicit ComplexDiagMatrix (const Array<Complex>& a) | explicit ComplexDiagMatrix (const Array<Complex>& a) | |||
: MDiagArray2<Complex> (a) { } | : MDiagArray2<Complex> (a) { } | |||
explicit ComplexDiagMatrix (const Array<double>& a) | explicit ComplexDiagMatrix (const Array<double>& a) | |||
: MDiagArray2<Complex> (Array<Complex> (a)) { } | : MDiagArray2<Complex> (Array<Complex> (a)) { } | |||
ComplexDiagMatrix (const Array<Complex>& a, octave_idx_type r, octave_idx | ComplexDiagMatrix (const Array<Complex>& a, octave_idx_type r, | |||
_type c) | octave_idx_type c) | |||
: MDiagArray2<Complex> (a, r, c) { } | : MDiagArray2<Complex> (a, r, c) { } | |||
explicit ComplexDiagMatrix (const DiagMatrix& a); | explicit ComplexDiagMatrix (const DiagMatrix& a); | |||
ComplexDiagMatrix (const MDiagArray2<Complex>& a) | ComplexDiagMatrix (const MDiagArray2<Complex>& a) | |||
: MDiagArray2<Complex> (a) { } | : MDiagArray2<Complex> (a) { } | |||
ComplexDiagMatrix (const ComplexDiagMatrix& a) | ComplexDiagMatrix (const ComplexDiagMatrix& a) | |||
: MDiagArray2<Complex> (a) { } | : MDiagArray2<Complex> (a) { } | |||
template <class U> | template <class U> | |||
ComplexDiagMatrix (const DiagArray2<U>& a) | ComplexDiagMatrix (const DiagArray2<U>& a) | |||
: MDiagArray2<Complex> (a) { } | : MDiagArray2<Complex> (a) { } | |||
ComplexDiagMatrix& operator = (const ComplexDiagMatrix& a) | ComplexDiagMatrix& operator = (const ComplexDiagMatrix& a) | |||
{ | { | |||
MDiagArray2<Complex>::operator = (a); | MDiagArray2<Complex>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const ComplexDiagMatrix& a) const; | bool operator == (const ComplexDiagMatrix& a) const; | |||
bool operator != (const ComplexDiagMatrix& a) const; | bool operator != (const ComplexDiagMatrix& a) const; | |||
ComplexDiagMatrix& fill (double val); | ComplexDiagMatrix& fill (double val); | |||
ComplexDiagMatrix& fill (const Complex& val); | ComplexDiagMatrix& fill (const Complex& val); | |||
ComplexDiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type | ComplexDiagMatrix& fill (double val, | |||
end); | octave_idx_type beg, octave_idx_type end); | |||
ComplexDiagMatrix& fill (const Complex& val, octave_idx_type beg, octave_ | ComplexDiagMatrix& fill (const Complex& val, | |||
idx_type end); | octave_idx_type beg, octave_idx_type end); | |||
ComplexDiagMatrix& fill (const ColumnVector& a); | ComplexDiagMatrix& fill (const ColumnVector& a); | |||
ComplexDiagMatrix& fill (const ComplexColumnVector& a); | ComplexDiagMatrix& fill (const ComplexColumnVector& a); | |||
ComplexDiagMatrix& fill (const RowVector& a); | ComplexDiagMatrix& fill (const RowVector& a); | |||
ComplexDiagMatrix& fill (const ComplexRowVector& a); | ComplexDiagMatrix& fill (const ComplexRowVector& a); | |||
ComplexDiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); | ComplexDiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); | |||
ComplexDiagMatrix& fill (const ComplexColumnVector& a, octave_idx_type be g); | ComplexDiagMatrix& fill (const ComplexColumnVector& a, octave_idx_type be g); | |||
ComplexDiagMatrix& fill (const RowVector& a, octave_idx_type beg); | ComplexDiagMatrix& fill (const RowVector& a, octave_idx_type beg); | |||
ComplexDiagMatrix& fill (const ComplexRowVector& a, octave_idx_type beg); | ComplexDiagMatrix& fill (const ComplexRowVector& a, octave_idx_type beg); | |||
ComplexDiagMatrix hermitian (void) const { return MDiagArray2<Complex>::h | ComplexDiagMatrix hermitian (void) const | |||
ermitian (std::conj); } | { return MDiagArray2<Complex>::hermitian (std::conj); } | |||
ComplexDiagMatrix transpose (void) const { return MDiagArray2<Complex>::t | ComplexDiagMatrix transpose (void) const | |||
ranspose(); } | { return MDiagArray2<Complex>::transpose (); } | |||
DiagMatrix abs (void) const; | DiagMatrix abs (void) const; | |||
friend OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a); | friend OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a); | |||
// resize is the destructive analog for this one | // resize is the destructive analog for this one | |||
ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx | ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, | |||
_type r2, octave_idx_type c2) const; | octave_idx_type r2, octave_idx_type c2) const; | |||
// extract row or column i | // extract row or column i | |||
ComplexRowVector row (octave_idx_type i) const; | ComplexRowVector row (octave_idx_type i) const; | |||
ComplexRowVector row (char *s) const; | ComplexRowVector row (char *s) const; | |||
ComplexColumnVector column (octave_idx_type i) const; | ComplexColumnVector column (octave_idx_type i) const; | |||
ComplexColumnVector column (char *s) const; | ComplexColumnVector column (char *s) const; | |||
ComplexDiagMatrix inverse (octave_idx_type& info) const; | ComplexDiagMatrix inverse (octave_idx_type& info) const; | |||
skipping to change at line 123 | skipping to change at line 130 | |||
bool all_elements_are_real (void) const; | bool all_elements_are_real (void) const; | |||
// diagonal matrix by diagonal matrix -> diagonal matrix operations | // diagonal matrix by diagonal matrix -> diagonal matrix operations | |||
ComplexDiagMatrix& operator += (const DiagMatrix& a); | ComplexDiagMatrix& operator += (const DiagMatrix& a); | |||
ComplexDiagMatrix& operator -= (const DiagMatrix& a); | ComplexDiagMatrix& operator -= (const DiagMatrix& a); | |||
// other operations | // other operations | |||
ComplexColumnVector diag (octave_idx_type k = 0) const | ComplexColumnVector extract_diag (octave_idx_type k = 0) const | |||
{ return MDiagArray2<Complex>::diag (k); } | { return MDiagArray2<Complex>::extract_diag (k); } | |||
ComplexDET determinant (void) const; | ComplexDET determinant (void) const; | |||
double rcond (void) const; | double rcond (void) const; | |||
// i/o | // i/o | |||
friend std::ostream& operator << (std::ostream& os, const ComplexDiagMatr | friend std::ostream& operator << (std::ostream& os, | |||
ix& a); | const ComplexDiagMatrix& a); | |||
}; | }; | |||
OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a); | OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a); | |||
// diagonal matrix by diagonal matrix -> diagonal matrix operations | // diagonal matrix by diagonal matrix -> diagonal matrix operations | |||
OCTAVE_API ComplexDiagMatrix | OCTAVE_API ComplexDiagMatrix | |||
operator * (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b); | operator * (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b); | |||
End of changes. 10 change blocks. | ||||
25 lines changed or deleted | 25 lines changed or added | |||
CMatrix.h | CMatrix.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexMatrix_h) | #if !defined (octave_CMatrix_h) | |||
#define octave_ComplexMatrix_h 1 | #define octave_CMatrix_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "MDiagArray2.h" | #include "MDiagArray2.h" | |||
#include "MatrixType.h" | #include "MatrixType.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
#include "mx-op-decl.h" | #include "mx-op-decl.h" | |||
#include "oct-cmplx.h" | #include "oct-cmplx.h" | |||
#include "DET.h" | #include "DET.h" | |||
skipping to change at line 88 | skipping to change at line 88 | |||
explicit ComplexMatrix (const ComplexColumnVector& cv); | explicit ComplexMatrix (const ComplexColumnVector& cv); | |||
explicit ComplexMatrix (const ComplexDiagMatrix& a); | explicit ComplexMatrix (const ComplexDiagMatrix& a); | |||
explicit ComplexMatrix (const boolMatrix& a); | explicit ComplexMatrix (const boolMatrix& a); | |||
explicit ComplexMatrix (const charMatrix& a); | explicit ComplexMatrix (const charMatrix& a); | |||
ComplexMatrix& operator = (const ComplexMatrix& a) | ComplexMatrix& operator = (const ComplexMatrix& a) | |||
{ | { | |||
MArray<Complex>::operator = (a); | MArray<Complex>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const ComplexMatrix& a) const; | bool operator == (const ComplexMatrix& a) const; | |||
bool operator != (const ComplexMatrix& a) const; | bool operator != (const ComplexMatrix& a) const; | |||
bool is_hermitian (void) const; | bool is_hermitian (void) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
ComplexMatrix& insert (const Matrix& a, octave_idx_type r, octave_idx_typ e c); | ComplexMatrix& insert (const Matrix& a, octave_idx_type r, octave_idx_typ e c); | |||
ComplexMatrix& insert (const RowVector& a, octave_idx_type r, octave_idx_ | ComplexMatrix& insert (const RowVector& a, | |||
type c); | octave_idx_type r, octave_idx_type c); | |||
ComplexMatrix& insert (const ColumnVector& a, octave_idx_type r, octave_i | ComplexMatrix& insert (const ColumnVector& a, | |||
dx_type c); | octave_idx_type r, octave_idx_type c); | |||
ComplexMatrix& insert (const DiagMatrix& a, octave_idx_type r, octave_idx | ComplexMatrix& insert (const DiagMatrix& a, | |||
_type c); | octave_idx_type r, octave_idx_type c); | |||
ComplexMatrix& insert (const ComplexMatrix& a, octave_idx_type r, octave_ | ComplexMatrix& insert (const ComplexMatrix& a, | |||
idx_type c); | octave_idx_type r, octave_idx_type c); | |||
ComplexMatrix& insert (const ComplexRowVector& a, octave_idx_type r, octa | ComplexMatrix& insert (const ComplexRowVector& a, | |||
ve_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
ComplexMatrix& insert (const ComplexColumnVector& a, octave_idx_type r, o | ComplexMatrix& insert (const ComplexColumnVector& a, | |||
ctave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
ComplexMatrix& insert (const ComplexDiagMatrix& a, octave_idx_type r, oct | ComplexMatrix& insert (const ComplexDiagMatrix& a, | |||
ave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
ComplexMatrix& fill (double val); | ComplexMatrix& fill (double val); | |||
ComplexMatrix& fill (const Complex& val); | ComplexMatrix& fill (const Complex& val); | |||
ComplexMatrix& fill (double val, octave_idx_type r1, octave_idx_type c1, | ComplexMatrix& fill (double val, | |||
octave_idx_type r2, octave_idx_type c2); | octave_idx_type r1, octave_idx_type c1, | |||
ComplexMatrix& fill (const Complex& val, octave_idx_type r1, octave_idx_t | octave_idx_type r2, octave_idx_type c2); | |||
ype c1, octave_idx_type r2, octave_idx_type c2); | ComplexMatrix& fill (const Complex& val, | |||
octave_idx_type r1, octave_idx_type c1, | ||||
octave_idx_type r2, octave_idx_type c2); | ||||
ComplexMatrix append (const Matrix& a) const; | ComplexMatrix append (const Matrix& a) const; | |||
ComplexMatrix append (const RowVector& a) const; | ComplexMatrix append (const RowVector& a) const; | |||
ComplexMatrix append (const ColumnVector& a) const; | ComplexMatrix append (const ColumnVector& a) const; | |||
ComplexMatrix append (const DiagMatrix& a) const; | ComplexMatrix append (const DiagMatrix& a) const; | |||
ComplexMatrix append (const ComplexMatrix& a) const; | ComplexMatrix append (const ComplexMatrix& a) const; | |||
ComplexMatrix append (const ComplexRowVector& a) const; | ComplexMatrix append (const ComplexRowVector& a) const; | |||
ComplexMatrix append (const ComplexColumnVector& a) const; | ComplexMatrix append (const ComplexColumnVector& a) const; | |||
ComplexMatrix append (const ComplexDiagMatrix& a) const; | ComplexMatrix append (const ComplexDiagMatrix& a) const; | |||
skipping to change at line 136 | skipping to change at line 147 | |||
ComplexMatrix stack (const RowVector& a) const; | ComplexMatrix stack (const RowVector& a) const; | |||
ComplexMatrix stack (const ColumnVector& a) const; | ComplexMatrix stack (const ColumnVector& a) const; | |||
ComplexMatrix stack (const DiagMatrix& a) const; | ComplexMatrix stack (const DiagMatrix& a) const; | |||
ComplexMatrix stack (const ComplexMatrix& a) const; | ComplexMatrix stack (const ComplexMatrix& a) const; | |||
ComplexMatrix stack (const ComplexRowVector& a) const; | ComplexMatrix stack (const ComplexRowVector& a) const; | |||
ComplexMatrix stack (const ComplexColumnVector& a) const; | ComplexMatrix stack (const ComplexColumnVector& a) const; | |||
ComplexMatrix stack (const ComplexDiagMatrix& a) const; | ComplexMatrix stack (const ComplexDiagMatrix& a) const; | |||
ComplexMatrix hermitian (void) const | ComplexMatrix hermitian (void) const | |||
{ return MArray<Complex>::hermitian (std::conj); } | { return MArray<Complex>::hermitian (std::conj); } | |||
ComplexMatrix transpose (void) const | ComplexMatrix transpose (void) const | |||
{ return MArray<Complex>::transpose (); } | { return MArray<Complex>::transpose (); } | |||
friend OCTAVE_API ComplexMatrix conj (const ComplexMatrix& a); | friend OCTAVE_API ComplexMatrix conj (const ComplexMatrix& a); | |||
// resize is the destructive equivalent for this one | // resize is the destructive equivalent for this one | |||
ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx | ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, | |||
_type r2, octave_idx_type c2) const; | octave_idx_type r2, octave_idx_type c2) const; | |||
ComplexMatrix extract_n (octave_idx_type r1, octave_idx_type c1, octave_i | ComplexMatrix extract_n (octave_idx_type r1, octave_idx_type c1, | |||
dx_type nr, octave_idx_type nc) const; | octave_idx_type nr, octave_idx_type nc) const; | |||
// extract row or column i. | // extract row or column i. | |||
ComplexRowVector row (octave_idx_type i) const; | ComplexRowVector row (octave_idx_type i) const; | |||
ComplexColumnVector column (octave_idx_type i) const; | ComplexColumnVector column (octave_idx_type i) const; | |||
void resize (octave_idx_type nr, octave_idx_type nc, | void resize (octave_idx_type nr, octave_idx_type nc, | |||
const Complex& rfv = resize_fill_value ()) | const Complex& rfv = Complex (0)) | |||
{ | { | |||
MArray<Complex>::resize (dim_vector (nr, nc), rfv); | MArray<Complex>::resize (dim_vector (nr, nc), rfv); | |||
} | } | |||
private: | private: | |||
ComplexMatrix tinverse (MatrixType &mattype, octave_idx_type& info, | ComplexMatrix tinverse (MatrixType &mattype, octave_idx_type& info, | |||
double& rcon, int force, int calc_cond) const; | double& rcon, int force, int calc_cond) const; | |||
ComplexMatrix finverse (MatrixType &mattype, octave_idx_type& info, | ComplexMatrix finverse (MatrixType &mattype, octave_idx_type& info, | |||
double& rcon, int force, int calc_cond) const; | double& rcon, int force, int calc_cond) const; | |||
skipping to change at line 189 | skipping to change at line 202 | |||
ComplexMatrix pseudo_inverse (double tol = 0.0) const; | ComplexMatrix pseudo_inverse (double tol = 0.0) const; | |||
ComplexMatrix fourier (void) const; | ComplexMatrix fourier (void) const; | |||
ComplexMatrix ifourier (void) const; | ComplexMatrix ifourier (void) const; | |||
ComplexMatrix fourier2d (void) const; | ComplexMatrix fourier2d (void) const; | |||
ComplexMatrix ifourier2d (void) const; | ComplexMatrix ifourier2d (void) const; | |||
ComplexDET determinant (void) const; | ComplexDET determinant (void) const; | |||
ComplexDET determinant (octave_idx_type& info) const; | ComplexDET determinant (octave_idx_type& info) const; | |||
ComplexDET determinant (octave_idx_type& info, double& rcon, int calc_con | ComplexDET determinant (octave_idx_type& info, double& rcon, | |||
d = 1) const; | int calc_cond = 1) const; | |||
ComplexDET determinant (MatrixType &mattype, octave_idx_type& info, | ComplexDET determinant (MatrixType &mattype, octave_idx_type& info, | |||
double& rcon, int calc_cond = 1) const; | double& rcon, int calc_cond = 1) const; | |||
double rcond (void) const; | double rcond (void) const; | |||
double rcond (MatrixType &mattype) const; | double rcond (MatrixType &mattype) const; | |||
private: | private: | |||
// Upper triangular matrix solvers | // Upper triangular matrix solvers | |||
ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcon, | octave_idx_type& info, double& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false, | bool calc_cond = false, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
// Lower triangular matrix solvers | // Lower triangular matrix solvers | |||
ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcon, | octave_idx_type& info, double& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false, blas_trans_type transt = blas_no_ | bool calc_cond = false, | |||
trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
// Full matrix solvers (umfpack/cholesky) | // Full matrix solvers (umfpack/cholesky) | |||
ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcon, | octave_idx_type& info, double& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
public: | public: | |||
// Generic interface to solver with no probing of type | // Generic interface to solver with no probing of type | |||
ComplexMatrix solve (MatrixType &typ, const Matrix& b) const; | ComplexMatrix solve (MatrixType &typ, const Matrix& b) const; | |||
ComplexMatrix solve (MatrixType &typ, const Matrix& b, | ComplexMatrix solve (MatrixType &typ, const Matrix& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
ComplexMatrix solve (MatrixType &typ, const Matrix& b, | ComplexMatrix solve (MatrixType &typ, const Matrix& b, | |||
octave_idx_type& info, double& rcon) const; | octave_idx_type& info, double& rcon) const; | |||
ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& i nfo, | ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& i nfo, | |||
double& rcon, solve_singularity_handler sing_handler , | double& rcon, solve_singularity_handler sing_handler , | |||
skipping to change at line 263 | skipping to change at line 278 | |||
ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, | ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, | |||
octave_idx_type& info, double& rcon) const; | octave_idx_type& info, double& rcon) const; | |||
ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, | ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, | |||
octave_idx_type& info, double& rcon, | octave_idx_type& info, double& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
// Generic interface to solver with probing of type | // Generic interface to solver with probing of type | |||
ComplexMatrix solve (const Matrix& b) const; | ComplexMatrix solve (const Matrix& b) const; | |||
ComplexMatrix solve (const Matrix& b, octave_idx_type& info) const; | ComplexMatrix solve (const Matrix& b, octave_idx_type& info) const; | |||
ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon | ComplexMatrix solve (const Matrix& b, octave_idx_type& info, | |||
) const; | double& rcon) const; | |||
ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon , | ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon , | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
ComplexMatrix solve (const ComplexMatrix& b) const; | ComplexMatrix solve (const ComplexMatrix& b) const; | |||
ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const ; | ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const ; | |||
ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, doubl | ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | |||
e& rcon) const; | double& rcon) const; | |||
ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, doubl | ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | |||
e& rcon, | double& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
ComplexColumnVector solve (const ColumnVector& b) const; | ComplexColumnVector solve (const ColumnVector& b) const; | |||
ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; | ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; | |||
ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, | ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, | |||
double& rcon) const; | double& rcon) const; | |||
ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, | ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, | |||
double& rcon, | double& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b) const; | ComplexColumnVector solve (const ComplexColumnVector& b) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& | ComplexColumnVector solve (const ComplexColumnVector& b, | |||
info) const; | octave_idx_type& info) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& | ComplexColumnVector solve (const ComplexColumnVector& b, | |||
info, | octave_idx_type& info, | |||
double& rcon) const; | double& rcon) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& | ComplexColumnVector solve (const ComplexColumnVector& b, | |||
info, | octave_idx_type& info, | |||
double& rcon, solve_singularity_handler sing_h | double& rcon, | |||
andler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
ComplexMatrix lssolve (const Matrix& b) const; | ComplexMatrix lssolve (const Matrix& b) const; | |||
ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info) const; | ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info) const; | |||
ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, | ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, | |||
octave_idx_type& rank) const; | octave_idx_type& rank) const; | |||
ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, | ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, | |||
octave_idx_type& rank, double& rcon) const; | octave_idx_type& rank, double& rcon) const; | |||
ComplexMatrix lssolve (const ComplexMatrix& b) const; | ComplexMatrix lssolve (const ComplexMatrix& b) const; | |||
skipping to change at line 360 | skipping to change at line 383 | |||
ComplexMatrix cumprod (int dim = -1) const; | ComplexMatrix cumprod (int dim = -1) const; | |||
ComplexMatrix cumsum (int dim = -1) const; | ComplexMatrix cumsum (int dim = -1) const; | |||
ComplexMatrix prod (int dim = -1) const; | ComplexMatrix prod (int dim = -1) const; | |||
ComplexMatrix sum (int dim = -1) const; | ComplexMatrix sum (int dim = -1) const; | |||
ComplexMatrix sumsq (int dim = -1) const; | ComplexMatrix sumsq (int dim = -1) const; | |||
Matrix abs (void) const; | Matrix abs (void) const; | |||
ComplexMatrix diag (octave_idx_type k = 0) const; | ComplexMatrix diag (octave_idx_type k = 0) const; | |||
ComplexDiagMatrix diag (octave_idx_type m, octave_idx_type n) const; | ||||
bool row_is_real_only (octave_idx_type) const; | bool row_is_real_only (octave_idx_type) const; | |||
bool column_is_real_only (octave_idx_type) const; | bool column_is_real_only (octave_idx_type) const; | |||
ComplexColumnVector row_min (void) const; | ComplexColumnVector row_min (void) const; | |||
ComplexColumnVector row_max (void) const; | ComplexColumnVector row_max (void) const; | |||
ComplexColumnVector row_min (Array<octave_idx_type>& index) const; | ComplexColumnVector row_min (Array<octave_idx_type>& index) const; | |||
ComplexColumnVector row_max (Array<octave_idx_type>& index) const; | ComplexColumnVector row_max (Array<octave_idx_type>& index) const; | |||
ComplexRowVector column_min (void) const; | ComplexRowVector column_min (void) const; | |||
ComplexRowVector column_max (void) const; | ComplexRowVector column_max (void) const; | |||
ComplexRowVector column_min (Array<octave_idx_type>& index) const; | ComplexRowVector column_min (Array<octave_idx_type>& index) const; | |||
ComplexRowVector column_max (Array<octave_idx_type>& index) const; | ComplexRowVector column_max (Array<octave_idx_type>& index) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Comp | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
lexMatrix& a); | const ComplexMatrix& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, ComplexMat | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
rix& a); | ComplexMatrix& a); | |||
static Complex resize_fill_value (void) { return Complex (0.0, 0.0); } | ||||
}; | }; | |||
extern OCTAVE_API ComplexMatrix conj (const ComplexMatrix& a); | extern OCTAVE_API ComplexMatrix conj (const ComplexMatrix& a); | |||
// column vector by row vector -> matrix operations | // column vector by row vector -> matrix operations | |||
extern OCTAVE_API ComplexMatrix | extern OCTAVE_API ComplexMatrix | |||
operator * (const ColumnVector& a, const ComplexRowVector& b); | operator * (const ColumnVector& a, const ComplexRowVector& b); | |||
extern OCTAVE_API ComplexMatrix | extern OCTAVE_API ComplexMatrix | |||
skipping to change at line 408 | skipping to change at line 432 | |||
Givens (const Complex&, const Complex&); | Givens (const Complex&, const Complex&); | |||
extern OCTAVE_API ComplexMatrix | extern OCTAVE_API ComplexMatrix | |||
Sylvester (const ComplexMatrix&, const ComplexMatrix&, const ComplexMatrix& ); | Sylvester (const ComplexMatrix&, const ComplexMatrix&, const ComplexMatrix& ); | |||
extern OCTAVE_API ComplexMatrix | extern OCTAVE_API ComplexMatrix | |||
xgemm (const ComplexMatrix& a, const ComplexMatrix& b, | xgemm (const ComplexMatrix& a, const ComplexMatrix& b, | |||
blas_trans_type transa = blas_no_trans, | blas_trans_type transa = blas_no_trans, | |||
blas_trans_type transb = blas_no_trans); | blas_trans_type transb = blas_no_trans); | |||
extern OCTAVE_API ComplexMatrix operator * (const Matrix&, const Com | extern OCTAVE_API ComplexMatrix operator * (const Matrix&, | |||
plexMatrix&); | const ComplexMatrix&); | |||
extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, const Mat | extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, | |||
rix&); | const Matrix&); | |||
extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, const Com | extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, | |||
plexMatrix&); | const ComplexMatrix&); | |||
extern OCTAVE_API ComplexMatrix min (const Complex& c, const ComplexMatrix& m); | extern OCTAVE_API ComplexMatrix min (const Complex& c, const ComplexMatrix& m); | |||
extern OCTAVE_API ComplexMatrix min (const ComplexMatrix& m, const Complex& c); | extern OCTAVE_API ComplexMatrix min (const ComplexMatrix& m, const Complex& c); | |||
extern OCTAVE_API ComplexMatrix min (const ComplexMatrix& a, const ComplexM | extern OCTAVE_API ComplexMatrix min (const ComplexMatrix& a, | |||
atrix& b); | const ComplexMatrix& b); | |||
extern OCTAVE_API ComplexMatrix max (const Complex& c, const ComplexMatrix& m); | extern OCTAVE_API ComplexMatrix max (const Complex& c, const ComplexMatrix& m); | |||
extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& m, const Complex& c); | extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& m, const Complex& c); | |||
extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& a, const ComplexM | extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& a, | |||
atrix& b); | const ComplexMatrix& b); | |||
extern OCTAVE_API ComplexMatrix linspace (const ComplexColumnVector& x1, | extern OCTAVE_API ComplexMatrix linspace (const ComplexColumnVector& x1, | |||
const ComplexColumnVector& x2, | const ComplexColumnVector& x2, | |||
octave_idx_type n); | octave_idx_type n); | |||
MS_CMP_OP_DECLS (ComplexMatrix, Complex, OCTAVE_API) | MS_CMP_OP_DECLS (ComplexMatrix, Complex, OCTAVE_API) | |||
MS_BOOL_OP_DECLS (ComplexMatrix, Complex, OCTAVE_API) | MS_BOOL_OP_DECLS (ComplexMatrix, Complex, OCTAVE_API) | |||
SM_CMP_OP_DECLS (Complex, ComplexMatrix, OCTAVE_API) | SM_CMP_OP_DECLS (Complex, ComplexMatrix, OCTAVE_API) | |||
SM_BOOL_OP_DECLS (Complex, ComplexMatrix, OCTAVE_API) | SM_BOOL_OP_DECLS (Complex, ComplexMatrix, OCTAVE_API) | |||
End of changes. 24 change blocks. | ||||
79 lines changed or deleted | 80 lines changed or added | |||
CNDArray.h | CNDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexNDArray_h) | #if !defined (octave_CNDArray_h) | |||
#define octave_ComplexNDArray_h 1 | #define octave_CNDArray_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
#include "mx-op-decl.h" | #include "mx-op-decl.h" | |||
#include "bsxfun-decl.h" | #include "bsxfun-decl.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
skipping to change at line 61 | skipping to change at line 61 | |||
template <class U> | template <class U> | |||
ComplexNDArray (const MArray<U>& a) : MArray<Complex> (a) { } | ComplexNDArray (const MArray<U>& a) : MArray<Complex> (a) { } | |||
template <class U> | template <class U> | |||
ComplexNDArray (const Array<U>& a) : MArray<Complex> (a) { } | ComplexNDArray (const Array<U>& a) : MArray<Complex> (a) { } | |||
ComplexNDArray (const charNDArray&); | ComplexNDArray (const charNDArray&); | |||
ComplexNDArray& operator = (const ComplexNDArray& a) | ComplexNDArray& operator = (const ComplexNDArray& a) | |||
{ | { | |||
MArray<Complex>::operator = (a); | MArray<Complex>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
// unary operations | // unary operations | |||
boolNDArray operator ! (void) const; | boolNDArray operator ! (void) const; | |||
// FIXME -- this is not quite the right thing. | // FIXME: this is not quite the right thing. | |||
bool any_element_is_nan (void) const; | bool any_element_is_nan (void) const; | |||
bool any_element_is_inf_or_nan (void) const; | bool any_element_is_inf_or_nan (void) const; | |||
bool all_elements_are_real (void) const; | bool all_elements_are_real (void) const; | |||
bool all_integers (double& max_val, double& min_val) const; | bool all_integers (double& max_val, double& min_val) const; | |||
bool too_large_for_float (void) const; | bool too_large_for_float (void) const; | |||
boolNDArray all (int dim = -1) const; | boolNDArray all (int dim = -1) const; | |||
boolNDArray any (int dim = -1) const; | boolNDArray any (int dim = -1) const; | |||
ComplexNDArray cumprod (int dim = -1) const; | ComplexNDArray cumprod (int dim = -1) const; | |||
ComplexNDArray cumsum (int dim = -1) const; | ComplexNDArray cumsum (int dim = -1) const; | |||
ComplexNDArray prod (int dim = -1) const; | ComplexNDArray prod (int dim = -1) const; | |||
ComplexNDArray sum (int dim = -1) const; | ComplexNDArray sum (int dim = -1) const; | |||
ComplexNDArray xsum (int dim = -1) const; | ComplexNDArray xsum (int dim = -1) const; | |||
ComplexNDArray sumsq (int dim = -1) const; | ComplexNDArray sumsq (int dim = -1) const; | |||
ComplexNDArray concat (const ComplexNDArray& rb, const Array<octave_idx_t | ComplexNDArray concat (const ComplexNDArray& rb, | |||
ype>& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
ComplexNDArray concat (const NDArray& rb, const Array<octave_idx_type>& r | ComplexNDArray concat (const NDArray& rb, | |||
a_idx); | const Array<octave_idx_type>& ra_idx); | |||
ComplexNDArray max (int dim = -1) const; | ComplexNDArray max (int dim = -1) const; | |||
ComplexNDArray max (Array<octave_idx_type>& index, int dim = -1) const; | ComplexNDArray max (Array<octave_idx_type>& index, int dim = -1) const; | |||
ComplexNDArray min (int dim = -1) const; | ComplexNDArray min (int dim = -1) const; | |||
ComplexNDArray min (Array<octave_idx_type>& index, int dim = -1) const; | ComplexNDArray min (Array<octave_idx_type>& index, int dim = -1) const; | |||
ComplexNDArray cummax (int dim = -1) const; | ComplexNDArray cummax (int dim = -1) const; | |||
ComplexNDArray cummax (Array<octave_idx_type>& index, int dim = -1) const ; | ComplexNDArray cummax (Array<octave_idx_type>& index, int dim = -1) const ; | |||
ComplexNDArray cummin (int dim = -1) const; | ComplexNDArray cummin (int dim = -1) const; | |||
ComplexNDArray cummin (Array<octave_idx_type>& index, int dim = -1) const ; | ComplexNDArray cummin (Array<octave_idx_type>& index, int dim = -1) const ; | |||
ComplexNDArray diff (octave_idx_type order = 1, int dim = -1) const; | ComplexNDArray diff (octave_idx_type order = 1, int dim = -1) const; | |||
ComplexNDArray& insert (const NDArray& a, octave_idx_type r, octave_idx_t | ComplexNDArray& insert (const NDArray& a, | |||
ype c); | octave_idx_type r, octave_idx_type c); | |||
ComplexNDArray& insert (const ComplexNDArray& a, octave_idx_type r, octav | ComplexNDArray& insert (const ComplexNDArray& a, | |||
e_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
ComplexNDArray& insert (const ComplexNDArray& a, const Array<octave_idx_t | ComplexNDArray& insert (const ComplexNDArray& a, | |||
ype>& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
NDArray abs (void) const; | NDArray abs (void) const; | |||
boolNDArray isnan (void) const; | boolNDArray isnan (void) const; | |||
boolNDArray isinf (void) const; | boolNDArray isinf (void) const; | |||
boolNDArray isfinite (void) const; | boolNDArray isfinite (void) const; | |||
friend OCTAVE_API ComplexNDArray conj (const ComplexNDArray& a); | friend OCTAVE_API ComplexNDArray conj (const ComplexNDArray& a); | |||
ComplexNDArray fourier (int dim = 1) const; | ComplexNDArray fourier (int dim = 1) const; | |||
ComplexNDArray ifourier (int dim = 1) const; | ComplexNDArray ifourier (int dim = 1) const; | |||
skipping to change at line 131 | skipping to change at line 136 | |||
ComplexMatrix matrix_value (void) const; | ComplexMatrix matrix_value (void) const; | |||
ComplexNDArray squeeze (void) const { return MArray<Complex>::squeeze (); } | ComplexNDArray squeeze (void) const { return MArray<Complex>::squeeze (); } | |||
static void increment_index (Array<octave_idx_type>& ra_idx, | static void increment_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions, | const dim_vector& dimensions, | |||
int start_dimension = 0); | int start_dimension = 0); | |||
static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions); | const dim_vector& dimensions); | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Comp | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
lexNDArray& a); | const ComplexNDArray& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, ComplexNDA | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
rray& a); | ComplexNDArray& a); | |||
static Complex resize_fill_value (void) { return Complex (0.0, 0.0); } | ||||
// bool all_elements_are_real (void) const; | // bool all_elements_are_real (void) const; | |||
// bool all_integers (double& max_val, double& min_val) const; | // bool all_integers (double& max_val, double& min_val) const; | |||
ComplexNDArray diag (octave_idx_type k = 0) const; | ComplexNDArray diag (octave_idx_type k = 0) const; | |||
ComplexNDArray diag (octave_idx_type m, octave_idx_type n) const; | ||||
ComplexNDArray& changesign (void) | ComplexNDArray& changesign (void) | |||
{ | { | |||
MArray<Complex>::changesign (); | MArray<Complex>::changesign (); | |||
return *this; | return *this; | |||
} | } | |||
}; | }; | |||
extern OCTAVE_API ComplexNDArray conj (const ComplexNDArray& a); | extern OCTAVE_API ComplexNDArray conj (const ComplexNDArray& a); | |||
MINMAX_DECLS (ComplexNDArray, Complex, OCTAVE_API) | MINMAX_DECLS (ComplexNDArray, Complex, OCTAVE_API) | |||
NDS_CMP_OP_DECLS (ComplexNDArray, Complex, OCTAVE_API) | NDS_CMP_OP_DECLS (ComplexNDArray, Complex, OCTAVE_API) | |||
NDS_BOOL_OP_DECLS (ComplexNDArray, Complex, OCTAVE_API) | NDS_BOOL_OP_DECLS (ComplexNDArray, Complex, OCTAVE_API) | |||
End of changes. 10 change blocks. | ||||
29 lines changed or deleted | 29 lines changed or added | |||
CRowVector.h | CRowVector.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexRowVector_h) | #if !defined (octave_CRowVector_h) | |||
#define octave_ComplexRowVector_h 1 | #define octave_CRowVector_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "dRowVector.h" | #include "dRowVector.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
ComplexRowVector : public MArray<Complex> | ComplexRowVector : public MArray<Complex> | |||
{ | { | |||
friend class ComplexColumnVector; | friend class ComplexColumnVector; | |||
public: | public: | |||
ComplexRowVector (void) : MArray<Complex> (dim_vector (1, 0)) { } | ComplexRowVector (void) : MArray<Complex> (dim_vector (1, 0)) { } | |||
explicit ComplexRowVector (octave_idx_type n) | explicit ComplexRowVector (octave_idx_type n) | |||
: MArray<Complex> (dim_vector (1, n)) { } | : MArray<Complex> (dim_vector (1, n)) { } | |||
explicit ComplexRowVector (const dim_vector& dv) : MArray<Complex> (dv) { } | explicit ComplexRowVector (const dim_vector& dv) : MArray<Complex> (dv) { } | |||
ComplexRowVector (octave_idx_type n, const Complex& val) | ComplexRowVector (octave_idx_type n, const Complex& val) | |||
: MArray<Complex> (dim_vector (1, n), val) { } | : MArray<Complex> (dim_vector (1, n), val) { } | |||
ComplexRowVector (const ComplexRowVector& a) : MArray<Complex> (a) { } | ComplexRowVector (const ComplexRowVector& a) : MArray<Complex> (a) { } | |||
ComplexRowVector (const MArray<Complex>& a) | ComplexRowVector (const MArray<Complex>& a) | |||
: MArray<Complex> (a.as_row ()) { } | : MArray<Complex> (a.as_row ()) { } | |||
ComplexRowVector (const Array<Complex>& a) | ComplexRowVector (const Array<Complex>& a) | |||
: MArray<Complex> (a.as_row ()) { } | : MArray<Complex> (a.as_row ()) { } | |||
explicit ComplexRowVector (const RowVector& a) : MArray<Complex> (a) { } | explicit ComplexRowVector (const RowVector& a) : MArray<Complex> (a) { } | |||
ComplexRowVector& operator = (const ComplexRowVector& a) | ComplexRowVector& operator = (const ComplexRowVector& a) | |||
{ | { | |||
MArray<Complex>::operator = (a); | MArray<Complex>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const ComplexRowVector& a) const; | bool operator == (const ComplexRowVector& a) const; | |||
bool operator != (const ComplexRowVector& a) const; | bool operator != (const ComplexRowVector& a) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
ComplexRowVector& insert (const RowVector& a, octave_idx_type c); | ComplexRowVector& insert (const RowVector& a, octave_idx_type c); | |||
ComplexRowVector& insert (const ComplexRowVector& a, octave_idx_type c); | ComplexRowVector& insert (const ComplexRowVector& a, octave_idx_type c); | |||
ComplexRowVector& fill (double val); | ComplexRowVector& fill (double val); | |||
ComplexRowVector& fill (const Complex& val); | ComplexRowVector& fill (const Complex& val); | |||
ComplexRowVector& fill (double val, octave_idx_type c1, octave_idx_type c 2); | ComplexRowVector& fill (double val, octave_idx_type c1, octave_idx_type c 2); | |||
ComplexRowVector& fill (const Complex& val, octave_idx_type c1, octave_id | ComplexRowVector& fill (const Complex& val, | |||
x_type c2); | octave_idx_type c1, octave_idx_type c2); | |||
ComplexRowVector append (const RowVector& a) const; | ComplexRowVector append (const RowVector& a) const; | |||
ComplexRowVector append (const ComplexRowVector& a) const; | ComplexRowVector append (const ComplexRowVector& a) const; | |||
ComplexColumnVector hermitian (void) const; | ComplexColumnVector hermitian (void) const; | |||
ComplexColumnVector transpose (void) const; | ComplexColumnVector transpose (void) const; | |||
friend ComplexRowVector conj (const ComplexRowVector& a); | friend ComplexRowVector conj (const ComplexRowVector& a); | |||
// resize is the destructive equivalent for this one | // resize is the destructive equivalent for this one | |||
skipping to change at line 112 | skipping to change at line 113 | |||
friend ComplexRowVector operator * (const RowVector& a, | friend ComplexRowVector operator * (const RowVector& a, | |||
const ComplexMatrix& b); | const ComplexMatrix& b); | |||
// other operations | // other operations | |||
Complex min (void) const; | Complex min (void) const; | |||
Complex max (void) const; | Complex max (void) const; | |||
// i/o | // i/o | |||
friend std::ostream& operator << (std::ostream& os, const ComplexRowVecto | friend std::ostream& operator << (std::ostream& os, | |||
r& a); | const ComplexRowVector& a); | |||
friend std::istream& operator >> (std::istream& is, ComplexRowVector& a); | friend std::istream& operator >> (std::istream& is, ComplexRowVector& a); | |||
void resize (octave_idx_type n, | void resize (octave_idx_type n, const Complex& rfv = Complex (0)) | |||
const Complex& rfv = Array<Complex>::resize_fill_value ()) | ||||
{ | { | |||
Array<Complex>::resize (dim_vector (1, n), rfv); | Array<Complex>::resize (dim_vector (1, n), rfv); | |||
} | } | |||
void clear (octave_idx_type n) | void clear (octave_idx_type n) | |||
{ Array<Complex>::clear (1, n); } | { Array<Complex>::clear (1, n); } | |||
}; | }; | |||
// row vector by column vector -> scalar | // row vector by column vector -> scalar | |||
Complex OCTAVE_API operator * (const ComplexRowVector& a, const ColumnVecto | Complex OCTAVE_API operator * (const ComplexRowVector& a, | |||
r& b); | const ColumnVector& b); | |||
Complex OCTAVE_API operator * (const ComplexRowVector& a, const ComplexColu | Complex OCTAVE_API operator * (const ComplexRowVector& a, | |||
mnVector& b); | const ComplexColumnVector& b); | |||
// other operations | // other operations | |||
OCTAVE_API ComplexRowVector linspace (const Complex& x1, const Complex& x2, | OCTAVE_API ComplexRowVector linspace (const Complex& x1, const Complex& x2, | |||
octave_idx_type n); | octave_idx_type n); | |||
MARRAY_FORWARD_DEFS (MArray, ComplexRowVector, Complex) | MARRAY_FORWARD_DEFS (MArray, ComplexRowVector, Complex) | |||
#endif | #endif | |||
End of changes. 12 change blocks. | ||||
22 lines changed or deleted | 21 lines changed or added | |||
CSparse.h | CSparse.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 56 | skipping to change at line 56 | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
SparseComplexMatrix : public MSparse<Complex> | SparseComplexMatrix : public MSparse<Complex> | |||
{ | { | |||
public: | public: | |||
typedef void (*solve_singularity_handler) (double rcond); | typedef void (*solve_singularity_handler) (double rcond); | |||
SparseComplexMatrix (void) : MSparse<Complex> () { } | SparseComplexMatrix (void) : MSparse<Complex> () { } | |||
SparseComplexMatrix (octave_idx_type r, octave_idx_type c) : MSparse<Comp | SparseComplexMatrix (octave_idx_type r, | |||
lex> (r, c) { } | octave_idx_type c) : MSparse<Complex> (r, c) { } | |||
SparseComplexMatrix (const dim_vector& dv, octave_idx_type nz = 0) : | SparseComplexMatrix (const dim_vector& dv, octave_idx_type nz = 0) | |||
MSparse<Complex> (dv, nz) { } | : MSparse<Complex> (dv, nz) { } | |||
explicit SparseComplexMatrix (octave_idx_type r, octave_idx_type c, Compl | explicit SparseComplexMatrix (octave_idx_type r, octave_idx_type c, | |||
ex val) | Complex val) | |||
: MSparse<Complex> (r, c, val) { } | : MSparse<Complex> (r, c, val) { } | |||
SparseComplexMatrix (octave_idx_type r, octave_idx_type c, double val) | SparseComplexMatrix (octave_idx_type r, octave_idx_type c, double val) | |||
: MSparse<Complex> (r, c, Complex (val)) { } | : MSparse<Complex> (r, c, Complex (val)) { } | |||
SparseComplexMatrix (const SparseComplexMatrix& a) | SparseComplexMatrix (const SparseComplexMatrix& a) | |||
: MSparse<Complex> (a) { } | : MSparse<Complex> (a) { } | |||
SparseComplexMatrix (const SparseComplexMatrix& a, const dim_vector& dv) | SparseComplexMatrix (const SparseComplexMatrix& a, const dim_vector& dv) | |||
: MSparse<Complex> (a, dv) { } | : MSparse<Complex> (a, dv) { } | |||
skipping to change at line 95 | skipping to change at line 97 | |||
octave_idx_type nc = -1, bool sum_terms = true, | octave_idx_type nc = -1, bool sum_terms = true, | |||
octave_idx_type nzm = -1) | octave_idx_type nzm = -1) | |||
: MSparse<Complex> (a, r, c, nr, nc, sum_terms, nzm) { } | : MSparse<Complex> (a, r, c, nr, nc, sum_terms, nzm) { } | |||
explicit SparseComplexMatrix (const SparseMatrix& a); | explicit SparseComplexMatrix (const SparseMatrix& a); | |||
explicit SparseComplexMatrix (const SparseBoolMatrix& a); | explicit SparseComplexMatrix (const SparseBoolMatrix& a); | |||
explicit SparseComplexMatrix (const ComplexDiagMatrix& a); | explicit SparseComplexMatrix (const ComplexDiagMatrix& a); | |||
SparseComplexMatrix (octave_idx_type r, octave_idx_type c, octave_idx_typ | SparseComplexMatrix (octave_idx_type r, octave_idx_type c, | |||
e num_nz) | octave_idx_type num_nz) | |||
: MSparse<Complex> (r, c, num_nz) { } | : MSparse<Complex> (r, c, num_nz) { } | |||
SparseComplexMatrix& operator = (const SparseComplexMatrix& a) | SparseComplexMatrix& operator = (const SparseComplexMatrix& a) | |||
{ | { | |||
MSparse<Complex>::operator = (a); | MSparse<Complex>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const SparseComplexMatrix& a) const; | bool operator == (const SparseComplexMatrix& a) const; | |||
bool operator != (const SparseComplexMatrix& a) const; | bool operator != (const SparseComplexMatrix& a) const; | |||
bool is_hermitian (void) const; | bool is_hermitian (void) const; | |||
SparseComplexMatrix max (int dim = -1) const; | SparseComplexMatrix max (int dim = -1) const; | |||
SparseComplexMatrix max (Array<octave_idx_type>& index, int dim = -1) con st; | SparseComplexMatrix max (Array<octave_idx_type>& index, int dim = -1) con st; | |||
SparseComplexMatrix min (int dim = -1) const; | SparseComplexMatrix min (int dim = -1) const; | |||
SparseComplexMatrix min (Array<octave_idx_type>& index, int dim = -1) con st; | SparseComplexMatrix min (Array<octave_idx_type>& index, int dim = -1) con st; | |||
SparseComplexMatrix& insert (const SparseComplexMatrix& a, octave_idx_typ | SparseComplexMatrix& insert (const SparseComplexMatrix& a, | |||
e r, octave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
SparseComplexMatrix& insert (const SparseMatrix& a, octave_idx_type r, oc | SparseComplexMatrix& insert (const SparseMatrix& a, | |||
tave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
SparseComplexMatrix& insert (const SparseComplexMatrix& a, const Array<oc | SparseComplexMatrix& insert (const SparseComplexMatrix& a, | |||
tave_idx_type>& indx); | const Array<octave_idx_type>& indx); | |||
SparseComplexMatrix& insert (const SparseMatrix& a, const Array<octave_id | SparseComplexMatrix& insert (const SparseMatrix& a, | |||
x_type>& indx); | const Array<octave_idx_type>& indx); | |||
SparseComplexMatrix concat (const SparseComplexMatrix& rb, | SparseComplexMatrix concat (const SparseComplexMatrix& rb, | |||
const Array<octave_idx_type>& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
SparseComplexMatrix concat (const SparseMatrix& rb, | SparseComplexMatrix concat (const SparseMatrix& rb, | |||
const Array<octave_idx_type>& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
ComplexMatrix matrix_value (void) const; | ComplexMatrix matrix_value (void) const; | |||
SparseComplexMatrix hermitian (void) const; // complex conjugate transpo se | SparseComplexMatrix hermitian (void) const; // complex conjugate transpo se | |||
SparseComplexMatrix transpose (void) const | SparseComplexMatrix transpose (void) const | |||
{ return MSparse<Complex>::transpose (); } | { return MSparse<Complex>::transpose (); } | |||
friend SparseComplexMatrix conj (const SparseComplexMatrix& a); | friend SparseComplexMatrix conj (const SparseComplexMatrix& a); | |||
// extract row or column i. | // extract row or column i. | |||
ComplexRowVector row (octave_idx_type i) const; | ComplexRowVector row (octave_idx_type i) const; | |||
ComplexColumnVector column (octave_idx_type i) const; | ComplexColumnVector column (octave_idx_type i) const; | |||
private: | private: | |||
skipping to change at line 159 | skipping to change at line 166 | |||
SparseComplexMatrix inverse (MatrixType& mattype) const; | SparseComplexMatrix inverse (MatrixType& mattype) const; | |||
SparseComplexMatrix inverse (MatrixType& mattype, | SparseComplexMatrix inverse (MatrixType& mattype, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
SparseComplexMatrix inverse (MatrixType& mattype, octave_idx_type& info, | SparseComplexMatrix inverse (MatrixType& mattype, octave_idx_type& info, | |||
double& rcond, int force = 0, | double& rcond, int force = 0, | |||
int calc_cond = 1) const; | int calc_cond = 1) const; | |||
ComplexDET determinant (void) const; | ComplexDET determinant (void) const; | |||
ComplexDET determinant (octave_idx_type& info) const; | ComplexDET determinant (octave_idx_type& info) const; | |||
ComplexDET determinant (octave_idx_type& info, double& rcond, | ComplexDET determinant (octave_idx_type& info, double& rcond, | |||
int calc_cond = 1) const; | int calc_cond = 1) const; | |||
private: | private: | |||
// Diagonal matrix solvers | // Diagonal matrix solvers | |||
ComplexMatrix dsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | ComplexMatrix dsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcond, solve_singularity_handler sing_handler, | double& rcond, solve_singularity_handler sing_handl | |||
bool calc_cond = false) const; | er, | |||
bool calc_cond = false) const; | ||||
ComplexMatrix dsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix dsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix dsolve (MatrixType &typ, const SparseMatrix& b, | SparseComplexMatrix dsolve (MatrixType &typ, const SparseMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix dsolve (MatrixType &typ, const SparseComplexMatrix& b , | SparseComplexMatrix dsolve (MatrixType &typ, const SparseComplexMatrix& b , | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
// Upper triangular matrix solvers | // Upper triangular matrix solvers | |||
ComplexMatrix utsolve (MatrixType &typ, const Matrix& b, octave_idx_type& | ComplexMatrix utsolve (MatrixType &typ, const Matrix& b, | |||
info, | octave_idx_type& info, double& rcond, | |||
double& rcond, solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix utsolve (MatrixType &typ, const SparseMatrix& b, | SparseComplexMatrix utsolve (MatrixType &typ, const SparseMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix utsolve (MatrixType &typ, const SparseComplexMatrix& b, | SparseComplexMatrix utsolve (MatrixType &typ, const SparseComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
// Lower triangular matrix solvers | // Lower triangular matrix solvers | |||
ComplexMatrix ltsolve (MatrixType &typ, const Matrix& b, | ComplexMatrix ltsolve (MatrixType &typ, const Matrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix ltsolve (MatrixType &typ, const SparseMatrix& b, | SparseComplexMatrix ltsolve (MatrixType &typ, const SparseMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix ltsolve (MatrixType &typ, const SparseComplexMatrix& b, | SparseComplexMatrix ltsolve (MatrixType &typ, const SparseComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
// Tridiagonal matrix solvers | // Tridiagonal matrix solvers | |||
ComplexMatrix trisolve (MatrixType &typ, const Matrix& b, | ComplexMatrix trisolve (MatrixType &typ, const Matrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
ComplexMatrix trisolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix trisolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix trisolve (MatrixType &typ, const SparseMatrix& b, | SparseComplexMatrix trisolve (MatrixType &typ, const SparseMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix trisolve (MatrixType &typ, const SparseComplexMatrix& b, | SparseComplexMatrix trisolve (MatrixType &typ, const SparseComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
// Banded matrix solvers (umfpack/cholesky) | // Banded matrix solvers (umfpack/cholesky) | |||
ComplexMatrix bsolve (MatrixType &typ, const Matrix& b, octave_idx_type& | ComplexMatrix bsolve (MatrixType &typ, const Matrix& b, | |||
info, | octave_idx_type& info, double& rcond, | |||
double& rcond, solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
ComplexMatrix bsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix bsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix bsolve (MatrixType &typ, const SparseMatrix& b, | SparseComplexMatrix bsolve (MatrixType &typ, const SparseMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix bsolve (MatrixType &typ, const SparseComplexMatrix& b , | SparseComplexMatrix bsolve (MatrixType &typ, const SparseComplexMatrix& b , | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
// Full matrix solvers (umfpack/cholesky) | // Full matrix solvers (umfpack/cholesky) | |||
void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, | void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, | |||
Matrix &Info, solve_singularity_handler sing_handler, | Matrix &Info, solve_singularity_handler sing_handler, | |||
bool calc_cond) const; | bool calc_cond) const; | |||
ComplexMatrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& | ComplexMatrix fsolve (MatrixType &typ, const Matrix& b, | |||
info, | octave_idx_type& info, double& rcond, | |||
double& rcond, solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix fsolve (MatrixType &typ, const SparseMatrix& b, | SparseComplexMatrix fsolve (MatrixType &typ, const SparseMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix fsolve (MatrixType &typ, const SparseComplexMatrix& b , | SparseComplexMatrix fsolve (MatrixType &typ, const SparseComplexMatrix& b , | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
public: | public: | |||
// Generic interface to solver with no probing of type | // Generic interface to solver with no probing of type | |||
ComplexMatrix solve (MatrixType &typ, const Matrix& b) const; | ComplexMatrix solve (MatrixType &typ, const Matrix& b) const; | |||
ComplexMatrix solve (MatrixType &typ, const Matrix& b, | ComplexMatrix solve (MatrixType &typ, const Matrix& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& i nfo, | ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& i nfo, | |||
double& rcond) const; | double& rcond) const; | |||
ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& i nfo, | ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& i nfo, | |||
double& rcond, solve_singularity_handler sing_handle r, | double& rcond, solve_singularity_handler sing_handle r, | |||
skipping to change at line 362 | skipping to change at line 372 | |||
ComplexMatrix solve (const Matrix& b, octave_idx_type& info, | ComplexMatrix solve (const Matrix& b, octave_idx_type& info, | |||
double& rcond) const; | double& rcond) const; | |||
ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon d, | ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon d, | |||
solve_singularity_handler sing_handler) const; | solve_singularity_handler sing_handler) const; | |||
ComplexMatrix solve (const ComplexMatrix& b) const; | ComplexMatrix solve (const ComplexMatrix& b) const; | |||
ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const ; | ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const ; | |||
ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | |||
double& rcond) const; | double& rcond) const; | |||
ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | |||
double& rcond, solve_singularity_handler sing_handle | double& rcond, | |||
r) const; | solve_singularity_handler sing_handler) const; | |||
SparseComplexMatrix solve (const SparseMatrix& b) const; | SparseComplexMatrix solve (const SparseMatrix& b) const; | |||
SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info) | SparseComplexMatrix solve (const SparseMatrix& b, | |||
const; | octave_idx_type& info) const; | |||
SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, | SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, | |||
double& rcond) const; | double& rcond) const; | |||
SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, | SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, | |||
double& rcond, | double& rcond, | |||
solve_singularity_handler sing_handler) const; | solve_singularity_handler sing_handler) const; | |||
SparseComplexMatrix solve (const SparseComplexMatrix& b) const; | SparseComplexMatrix solve (const SparseComplexMatrix& b) const; | |||
SparseComplexMatrix solve (const SparseComplexMatrix& b, | SparseComplexMatrix solve (const SparseComplexMatrix& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
SparseComplexMatrix solve (const SparseComplexMatrix& b, | SparseComplexMatrix solve (const SparseComplexMatrix& b, | |||
octave_idx_type& info, double& rcond) const; | octave_idx_type& info, double& rcond) const; | |||
SparseComplexMatrix solve (const SparseComplexMatrix& b, | SparseComplexMatrix solve (const SparseComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler) const; | solve_singularity_handler sing_handler) const; | |||
ComplexColumnVector solve (const ColumnVector& b) const; | ComplexColumnVector solve (const ColumnVector& b) const; | |||
ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info) | ComplexColumnVector solve (const ColumnVector& b, | |||
const; | octave_idx_type& info) const; | |||
ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, | ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, | |||
double& rcond) const; | double& rcond) const; | |||
ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, | ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, | |||
double& rcond, | double& rcond, | |||
solve_singularity_handler sing_handler) const; | solve_singularity_handler sing_handler) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b) const; | ComplexColumnVector solve (const ComplexColumnVector& b) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b, | ComplexColumnVector solve (const ComplexColumnVector& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& | ComplexColumnVector solve (const ComplexColumnVector& b, | |||
info, | octave_idx_type& info, double& rcond) const; | |||
double& rcond) const; | ComplexColumnVector solve (const ComplexColumnVector& b, | |||
ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& | octave_idx_type& info, double& rcond, | |||
info, | ||||
double& rcond, | ||||
solve_singularity_handler sing_handler) const; | solve_singularity_handler sing_handler) const; | |||
SparseComplexMatrix squeeze (void) const; | SparseComplexMatrix squeeze (void) const; | |||
SparseComplexMatrix reshape (const dim_vector& new_dims) const; | SparseComplexMatrix reshape (const dim_vector& new_dims) const; | |||
SparseComplexMatrix permute (const Array<octave_idx_type>& vec, | SparseComplexMatrix permute (const Array<octave_idx_type>& vec, | |||
bool inv = false) const; | bool inv = false) const; | |||
SparseComplexMatrix ipermute (const Array<octave_idx_type>& vec) const; | SparseComplexMatrix ipermute (const Array<octave_idx_type>& vec) const; | |||
skipping to change at line 429 | skipping to change at line 442 | |||
SparseComplexMatrix cumsum (int dim = -1) const; | SparseComplexMatrix cumsum (int dim = -1) const; | |||
SparseComplexMatrix prod (int dim = -1) const; | SparseComplexMatrix prod (int dim = -1) const; | |||
SparseComplexMatrix sum (int dim = -1) const; | SparseComplexMatrix sum (int dim = -1) const; | |||
SparseComplexMatrix sumsq (int dim = -1) const; | SparseComplexMatrix sumsq (int dim = -1) const; | |||
SparseMatrix abs (void) const; | SparseMatrix abs (void) const; | |||
SparseComplexMatrix diag (octave_idx_type k = 0) const; | SparseComplexMatrix diag (octave_idx_type k = 0) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
const SparseComplexMatrix& a); | const SparseComplexMatrix& a ); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
SparseComplexMatrix& a); | SparseComplexMatrix& a); | |||
}; | }; | |||
extern OCTAVE_API SparseComplexMatrix operator * (const SparseMatrix&, | extern OCTAVE_API SparseComplexMatrix operator * (const SparseMatrix&, | |||
const SparseComplexMatrix&); | const SparseComplexMatrix &); | |||
extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix &, | extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix &, | |||
const SparseMatrix&); | const SparseMatrix&); | |||
extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix &, | extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix &, | |||
const SparseComplexMatrix&); | const SparseComplexMatrix &); | |||
extern OCTAVE_API ComplexMatrix operator * (const Matrix&, | extern OCTAVE_API ComplexMatrix operator * (const Matrix&, | |||
const SparseComplexMatrix&); | const SparseComplexMatrix&); | |||
extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, | extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, | |||
const SparseMatrix&); | const SparseMatrix&); | |||
extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, | extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, | |||
const SparseComplexMatrix&); | const SparseComplexMatrix&); | |||
extern OCTAVE_API ComplexMatrix mul_trans (const ComplexMatrix&, | extern OCTAVE_API ComplexMatrix mul_trans (const ComplexMatrix&, | |||
const SparseComplexMatrix&); | const SparseComplexMatrix&); | |||
extern OCTAVE_API ComplexMatrix mul_herm (const ComplexMatrix&, | extern OCTAVE_API ComplexMatrix mul_herm (const ComplexMatrix&, | |||
const SparseComplexMatrix&); | const SparseComplexMatrix&); | |||
extern OCTAVE_API ComplexMatrix operator * (const SparseMatrix&, | extern OCTAVE_API ComplexMatrix operator * (const SparseMatrix&, | |||
const ComplexMatrix&); | const ComplexMatrix&); | |||
extern OCTAVE_API ComplexMatrix operator * (const SparseComplexMatrix&, | extern OCTAVE_API ComplexMatrix operator * (const SparseComplexMatrix&, | |||
const Matrix&); | const Matrix&); | |||
extern OCTAVE_API ComplexMatrix operator * (const SparseComplexMatrix&, | extern OCTAVE_API ComplexMatrix operator * (const SparseComplexMatrix&, | |||
const ComplexMatrix&); | const ComplexMatrix&); | |||
extern OCTAVE_API ComplexMatrix trans_mul (const SparseComplexMatrix&, | extern OCTAVE_API ComplexMatrix trans_mul (const SparseComplexMatrix&, | |||
const ComplexMatrix&); | const ComplexMatrix&); | |||
extern OCTAVE_API ComplexMatrix herm_mul (const SparseComplexMatrix&, | extern OCTAVE_API ComplexMatrix herm_mul (const SparseComplexMatrix&, | |||
const ComplexMatrix&); | const ComplexMatrix&); | |||
extern OCTAVE_API SparseComplexMatrix operator * (const DiagMatrix&, const | extern OCTAVE_API SparseComplexMatrix operator * (const DiagMatrix&, | |||
SparseComplexMatrix&); | const SparseComplexMatrix | |||
extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix | &); | |||
&, const DiagMatrix&); | extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix | |||
&, | ||||
const DiagMatrix&); | ||||
extern OCTAVE_API SparseComplexMatrix operator * (const ComplexDiagMatrix&, | extern OCTAVE_API SparseComplexMatrix operator * (const ComplexDiagMatrix&, | |||
const SparseMatrix&); | const SparseMatrix&); | |||
extern OCTAVE_API SparseComplexMatrix operator * (const SparseMatrix&, cons | extern OCTAVE_API SparseComplexMatrix operator * (const SparseMatrix&, | |||
t ComplexDiagMatrix&); | const ComplexDiagMatrix&) | |||
; | ||||
extern OCTAVE_API SparseComplexMatrix operator * (const ComplexDiagMatrix&, | ||||
const SparseComplexMatrix | ||||
&); | ||||
extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix | ||||
&, | ||||
const ComplexDiagMatrix&) | ||||
; | ||||
extern OCTAVE_API SparseComplexMatrix operator * (const ComplexDiagMatrix&, | extern OCTAVE_API SparseComplexMatrix operator + (const ComplexDiagMatrix&, | |||
const SparseComplexMatrix&); | const SparseMatrix&); | |||
extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix | extern OCTAVE_API SparseComplexMatrix operator + (const DiagMatrix&, | |||
&, const ComplexDiagMatrix&); | const SparseComplexMatrix | |||
&); | ||||
extern OCTAVE_API SparseComplexMatrix operator + (const ComplexDiagMatrix&, | extern OCTAVE_API SparseComplexMatrix operator + (const ComplexDiagMatrix&, | |||
const SparseMatrix&); | const SparseComplexMatrix | |||
extern OCTAVE_API SparseComplexMatrix operator + (const DiagMatrix&, const | &); | |||
SparseComplexMatrix&); | extern OCTAVE_API SparseComplexMatrix operator + (const SparseMatrix&, | |||
extern OCTAVE_API SparseComplexMatrix operator + (const ComplexDiagMatrix&, | const ComplexDiagMatrix&) | |||
const SparseComplexMatrix&); | ; | |||
extern OCTAVE_API SparseComplexMatrix operator + (const SparseMatrix&, cons | extern OCTAVE_API SparseComplexMatrix operator + (const SparseComplexMatrix | |||
t ComplexDiagMatrix&); | &, | |||
extern OCTAVE_API SparseComplexMatrix operator + (const SparseComplexMatrix | const DiagMatrix&); | |||
&, const DiagMatrix&); | extern OCTAVE_API SparseComplexMatrix operator + (const SparseComplexMatrix | |||
extern OCTAVE_API SparseComplexMatrix operator + (const SparseComplexMatrix | &, | |||
&, const ComplexDiagMatrix&); | const ComplexDiagMatrix&) | |||
; | ||||
extern OCTAVE_API SparseComplexMatrix operator - (const ComplexDiagMatrix&, | ||||
const SparseMatrix&); | extern OCTAVE_API SparseComplexMatrix operator - (const ComplexDiagMatrix&, | |||
extern OCTAVE_API SparseComplexMatrix operator - (const DiagMatrix&, const | const SparseMatrix&); | |||
SparseComplexMatrix&); | extern OCTAVE_API SparseComplexMatrix operator - (const DiagMatrix&, | |||
extern OCTAVE_API SparseComplexMatrix operator - (const ComplexDiagMatrix&, | const SparseComplexMatrix | |||
const SparseComplexMatrix&); | &); | |||
extern OCTAVE_API SparseComplexMatrix operator - (const SparseMatrix&, cons | extern OCTAVE_API SparseComplexMatrix operator - (const ComplexDiagMatrix&, | |||
t ComplexDiagMatrix&); | const SparseComplexMatrix | |||
extern OCTAVE_API SparseComplexMatrix operator - (const SparseComplexMatrix | &); | |||
&, const DiagMatrix&); | extern OCTAVE_API SparseComplexMatrix operator - (const SparseMatrix&, | |||
extern OCTAVE_API SparseComplexMatrix operator - (const SparseComplexMatrix | const ComplexDiagMatrix&) | |||
&, const ComplexDiagMatrix&); | ; | |||
extern OCTAVE_API SparseComplexMatrix operator - (const SparseComplexMatrix | ||||
&, | ||||
const DiagMatrix&); | ||||
extern OCTAVE_API SparseComplexMatrix operator - (const SparseComplexMatrix | ||||
&, | ||||
const ComplexDiagMatrix&) | ||||
; | ||||
extern OCTAVE_API SparseComplexMatrix operator * (const PermMatrix&, | extern OCTAVE_API SparseComplexMatrix operator * (const PermMatrix&, | |||
const SparseComplexMatrix &); | const SparseComplexMatrix &); | |||
extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix &, | extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix &, | |||
const PermMatrix&); | const PermMatrix&); | |||
extern OCTAVE_API SparseComplexMatrix min (const Complex& c, | extern OCTAVE_API SparseComplexMatrix min (const Complex& c, | |||
const SparseComplexMatrix& m); | const SparseComplexMatrix& m); | |||
extern OCTAVE_API SparseComplexMatrix min (const SparseComplexMatrix& m, | extern OCTAVE_API SparseComplexMatrix min (const SparseComplexMatrix& m, | |||
const Complex& c); | const Complex& c); | |||
extern OCTAVE_API SparseComplexMatrix min (const SparseComplexMatrix& a, | extern OCTAVE_API SparseComplexMatrix min (const SparseComplexMatrix& a, | |||
const SparseComplexMatrix& b); | const SparseComplexMatrix& b); | |||
extern OCTAVE_API SparseComplexMatrix max (const Complex& c, | extern OCTAVE_API SparseComplexMatrix max (const Complex& c, | |||
const SparseComplexMatrix& m); | const SparseComplexMatrix& m); | |||
extern OCTAVE_API SparseComplexMatrix max (const SparseComplexMatrix& m, | extern OCTAVE_API SparseComplexMatrix max (const SparseComplexMatrix& m, | |||
const Complex& c); | const Complex& c); | |||
extern OCTAVE_API SparseComplexMatrix max (const SparseComplexMatrix& a, | extern OCTAVE_API SparseComplexMatrix max (const SparseComplexMatrix& a, | |||
const SparseComplexMatrix& b); | const SparseComplexMatrix& b); | |||
SPARSE_SMS_CMP_OP_DECLS (SparseComplexMatrix, Complex, OCTAVE_API) | SPARSE_SMS_CMP_OP_DECLS (SparseComplexMatrix, Complex, OCTAVE_API) | |||
SPARSE_SMS_BOOL_OP_DECLS (SparseComplexMatrix, Complex, OCTAVE_API) | SPARSE_SMS_BOOL_OP_DECLS (SparseComplexMatrix, Complex, OCTAVE_API) | |||
SPARSE_SSM_CMP_OP_DECLS (Complex, SparseComplexMatrix, OCTAVE_API) | SPARSE_SSM_CMP_OP_DECLS (Complex, SparseComplexMatrix, OCTAVE_API) | |||
SPARSE_SSM_BOOL_OP_DECLS (Complex, SparseComplexMatrix, OCTAVE_API) | SPARSE_SSM_BOOL_OP_DECLS (Complex, SparseComplexMatrix, OCTAVE_API) | |||
SPARSE_SMSM_CMP_OP_DECLS (SparseComplexMatrix, SparseComplexMatrix, OCTAVE_ API) | SPARSE_SMSM_CMP_OP_DECLS (SparseComplexMatrix, SparseComplexMatrix, OCTAVE_ API) | |||
SPARSE_SMSM_BOOL_OP_DECLS (SparseComplexMatrix, SparseComplexMatrix, OCTAVE _API) | SPARSE_SMSM_BOOL_OP_DECLS (SparseComplexMatrix, SparseComplexMatrix, OCTAVE _API) | |||
SPARSE_FORWARD_DEFS (MSparse, SparseComplexMatrix, ComplexMatrix, Complex) | SPARSE_FORWARD_DEFS (MSparse, SparseComplexMatrix, ComplexMatrix, Complex) | |||
#ifdef IDX_TYPE_LONG | #ifdef USE_64_BIT_IDX_T | |||
#define UMFPACK_ZNAME(name) umfpack_zl_ ## name | #define UMFPACK_ZNAME(name) umfpack_zl_ ## name | |||
#else | #else | |||
#define UMFPACK_ZNAME(name) umfpack_zi_ ## name | #define UMFPACK_ZNAME(name) umfpack_zi_ ## name | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 63 change blocks. | ||||
171 lines changed or deleted | 188 lines changed or added | |||
Cell.h | Cell.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1999-2012 John W. Eaton | Copyright (C) 1999-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (Cell_h) | #if !defined (octave_Cell_h) | |||
#define Cell_h 1 | #define octave_Cell_h 1 | |||
#include <string> | #include <string> | |||
#include "Array.h" | #include "Array.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "ov.h" | #include "ov.h" | |||
class octave_value_list; | class octave_value_list; | |||
skipping to change at line 51 | skipping to change at line 51 | |||
Cell (void) | Cell (void) | |||
: Array<octave_value> (dim_vector (0, 0)) { } | : Array<octave_value> (dim_vector (0, 0)) { } | |||
Cell (const octave_value& val) | Cell (const octave_value& val) | |||
: Array<octave_value> (dim_vector (1, 1), val) { } | : Array<octave_value> (dim_vector (1, 1), val) { } | |||
Cell (const octave_value_list& ovl); | Cell (const octave_value_list& ovl); | |||
Cell (octave_idx_type n, octave_idx_type m, | Cell (octave_idx_type n, octave_idx_type m, | |||
const octave_value& val = resize_fill_value ()) | const octave_value& val = Matrix ()) | |||
: Array<octave_value> (dim_vector (n, m), val) { } | : Array<octave_value> (dim_vector (n, m), val) { } | |||
Cell (const dim_vector& dv, const octave_value& val = resize_fill_value ( )) | Cell (const dim_vector& dv, const octave_value& val = Matrix ()) | |||
: Array<octave_value> (dv, val) { } | : Array<octave_value> (dv, val) { } | |||
Cell (const Array<octave_value>& c) | Cell (const Array<octave_value>& c) | |||
: Array<octave_value> (c) { } | : Array<octave_value> (c) { } | |||
Cell (const Array<octave_value>& c, octave_idx_type nr, octave_idx_type n c) | Cell (const Array<octave_value>& c, octave_idx_type nr, octave_idx_type n c) | |||
: Array<octave_value> (c, dim_vector (nr, nc)) { } | : Array<octave_value> (c, dim_vector (nr, nc)) { } | |||
Cell (const string_vector& sv, bool trim = false); | Cell (const string_vector& sv, bool trim = false); | |||
skipping to change at line 89 | skipping to change at line 89 | |||
Cell index (const octave_value_list& idx, bool resize_ok = false) const; | Cell index (const octave_value_list& idx, bool resize_ok = false) const; | |||
using Array<octave_value>::delete_elements; | using Array<octave_value>::delete_elements; | |||
void delete_elements (const octave_value_list& idx); | void delete_elements (const octave_value_list& idx); | |||
using Array<octave_value>::assign; | using Array<octave_value>::assign; | |||
void assign (const octave_value_list& idx, const Cell& rhs, | void assign (const octave_value_list& idx, const Cell& rhs, | |||
const octave_value& fill_val = resize_fill_value ()); | const octave_value& fill_val = Matrix ()); | |||
Cell reshape (const dim_vector& new_dims) const | Cell reshape (const dim_vector& new_dims) const | |||
{ return Array<octave_value>::reshape (new_dims); } | { return Array<octave_value>::reshape (new_dims); } | |||
octave_idx_type nnz (void) const; | octave_idx_type nnz (void) const; | |||
Cell column (octave_idx_type i) const; | Cell column (octave_idx_type i) const; | |||
// FIXME | // FIXME | |||
boolMatrix all (int /* dim */ = 0) const { return boolMatrix (); } | boolMatrix all (int /* dim */ = 0) const { return boolMatrix (); } | |||
// FIXME | // FIXME | |||
boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); } | boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); } | |||
Cell concat (const Cell& rb, const Array<octave_idx_type>& ra_idx); | Cell concat (const Cell& rb, const Array<octave_idx_type>& ra_idx); | |||
Cell& insert (const Cell& a, octave_idx_type r, octave_idx_type c); | Cell& insert (const Cell& a, octave_idx_type r, octave_idx_type c); | |||
Cell& insert (const Cell& a, const Array<octave_idx_type>& ra_idx); | Cell& insert (const Cell& a, const Array<octave_idx_type>& ra_idx); | |||
// FIXME | // FIXME | |||
bool any_element_is_nan (void) const { return false; } | bool any_element_is_nan (void) const { return false; } | |||
bool is_true (void) const { return false; } | bool is_true (void) const { return false; } | |||
static octave_value resize_fill_value (void) { return Matrix (); } | octave_value resize_fill_value (void) const | |||
{ | ||||
static Matrix rfv; | ||||
return rfv; | ||||
} | ||||
Cell diag (octave_idx_type k = 0) const; | Cell diag (octave_idx_type k = 0) const; | |||
Cell diag (octave_idx_type m, octave_idx_type n) const; | ||||
Cell xisalnum (void) const { return map (&octave_value::xisalnum); } | Cell xisalnum (void) const { return map (&octave_value::xisalnum); } | |||
Cell xisalpha (void) const { return map (&octave_value::xisalpha); } | Cell xisalpha (void) const { return map (&octave_value::xisalpha); } | |||
Cell xisascii (void) const { return map (&octave_value::xisascii); } | Cell xisascii (void) const { return map (&octave_value::xisascii); } | |||
Cell xiscntrl (void) const { return map (&octave_value::xiscntrl); } | Cell xiscntrl (void) const { return map (&octave_value::xiscntrl); } | |||
Cell xisdigit (void) const { return map (&octave_value::xisdigit); } | Cell xisdigit (void) const { return map (&octave_value::xisdigit); } | |||
Cell xisgraph (void) const { return map (&octave_value::xisgraph); } | Cell xisgraph (void) const { return map (&octave_value::xisgraph); } | |||
Cell xislower (void) const { return map (&octave_value::xislower); } | Cell xislower (void) const { return map (&octave_value::xislower); } | |||
Cell xisprint (void) const { return map (&octave_value::xisprint); } | Cell xisprint (void) const { return map (&octave_value::xisprint); } | |||
Cell xispunct (void) const { return map (&octave_value::xispunct); } | Cell xispunct (void) const { return map (&octave_value::xispunct); } | |||
Cell xisspace (void) const { return map (&octave_value::xisspace); } | Cell xisspace (void) const { return map (&octave_value::xisspace); } | |||
skipping to change at line 142 | skipping to change at line 148 | |||
private: | private: | |||
typedef octave_value (octave_value::*ctype_mapper) (void) const; | typedef octave_value (octave_value::*ctype_mapper) (void) const; | |||
Cell map (ctype_mapper) const; | Cell map (ctype_mapper) const; | |||
}; | }; | |||
template<> | template<> | |||
inline Cell octave_value_extract<Cell> (const octave_value& v) | inline Cell octave_value_extract<Cell> (const octave_value& v) | |||
{ return v.cell_value (); } | { return v.cell_value (); } | |||
#endif | #endif | |||
End of changes. 9 change blocks. | ||||
9 lines changed or deleted | 15 lines changed or added | |||
CmplxAEPBAL.h | CmplxAEPBAL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexAEPBALANCE_h) | #if !defined (octave_CmplxAEPBAL_h) | |||
#define octave_ComplexAEPBALANCE_h 1 | #define octave_CmplxAEPBAL_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "base-aepbal.h" | #include "base-aepbal.h" | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
#include "dColVector.h" | #include "dColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
CmplxCHOL.h | CmplxCHOL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexCHOL_h) | #if !defined (octave_CmplxCHOL_h) | |||
#define octave_ComplexCHOL_h 1 | #define octave_CmplxCHOL_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
#include "CColVector.h" | #include "CColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
ComplexCHOL | ComplexCHOL | |||
{ | { | |||
public: | public: | |||
ComplexCHOL (void) : chol_mat (), xrcond (0) { } | ComplexCHOL (void) : chol_mat (), xrcond (0) { } | |||
ComplexCHOL (const ComplexMatrix& a, bool calc_cond = false) | ComplexCHOL (const ComplexMatrix& a, bool calc_cond = false) | |||
: chol_mat (), xrcond (0) | : chol_mat (), xrcond (0) | |||
{ | { | |||
init (a, calc_cond); | init (a, calc_cond); | |||
} | } | |||
ComplexCHOL (const ComplexMatrix& a, octave_idx_type& info, | ComplexCHOL (const ComplexMatrix& a, octave_idx_type& info, | |||
bool calc_cond = false) | bool calc_cond = false) | |||
: chol_mat (), xrcond (0) | : chol_mat (), xrcond (0) | |||
{ | { | |||
info = init (a, calc_cond); | info = init (a, calc_cond); | |||
} | } | |||
ComplexCHOL (const ComplexCHOL& a) | ComplexCHOL (const ComplexCHOL& a) | |||
: chol_mat (a.chol_mat), xrcond (a.xrcond) { } | : chol_mat (a.chol_mat), xrcond (a.xrcond) { } | |||
ComplexCHOL& operator = (const ComplexCHOL& a) | ComplexCHOL& operator = (const ComplexCHOL& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
chol_mat = a.chol_mat; | chol_mat = a.chol_mat; | |||
xrcond = a.xrcond; | xrcond = a.xrcond; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
ComplexMatrix chol_matrix (void) const { return chol_mat; } | ComplexMatrix chol_matrix (void) const { return chol_mat; } | |||
double rcond (void) const { return xrcond; } | double rcond (void) const { return xrcond; } | |||
ComplexMatrix inverse (void) const; | ComplexMatrix inverse (void) const; | |||
void set (const ComplexMatrix& R); | void set (const ComplexMatrix& R); | |||
void update (const ComplexColumnVector& u); | void update (const ComplexColumnVector& u); | |||
octave_idx_type downdate (const ComplexColumnVector& u); | octave_idx_type downdate (const ComplexColumnVector& u); | |||
octave_idx_type insert_sym (const ComplexColumnVector& u, octave_idx_type j); | octave_idx_type insert_sym (const ComplexColumnVector& u, octave_idx_type j); | |||
void delete_sym (octave_idx_type j); | void delete_sym (octave_idx_type j); | |||
void shift_sym (octave_idx_type i, octave_idx_type j); | void shift_sym (octave_idx_type i, octave_idx_type j); | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Comp | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
lexCHOL& a); | const ComplexCHOL& a); | |||
private: | private: | |||
ComplexMatrix chol_mat; | ComplexMatrix chol_mat; | |||
double xrcond; | double xrcond; | |||
octave_idx_type init (const ComplexMatrix& a, bool calc_cond); | octave_idx_type init (const ComplexMatrix& a, bool calc_cond); | |||
}; | }; | |||
End of changes. 7 change blocks. | ||||
19 lines changed or deleted | 19 lines changed or added | |||
CmplxGEPBAL.h | CmplxGEPBAL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexGEPBALANCE_h) | #if !defined (octave_CmplxGEPBAL_h) | |||
#define octave_ComplexGEPBALANCE_h 1 | #define octave_CmplxGEPBAL_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
ComplexGEPBALANCE | ComplexGEPBALANCE | |||
{ | { | |||
public: | public: | |||
ComplexGEPBALANCE (void) | ComplexGEPBALANCE (void) | |||
: balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | |||
{ } | { } | |||
ComplexGEPBALANCE (const ComplexMatrix& a, const ComplexMatrix& b, | ComplexGEPBALANCE (const ComplexMatrix& a, const ComplexMatrix& b, | |||
const std::string& balance_job) | const std::string& balance_job) | |||
: balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | |||
{ | { | |||
init (a, b, balance_job); | init (a, b, balance_job); | |||
} | } | |||
ComplexGEPBALANCE (const ComplexGEPBALANCE& a) | ComplexGEPBALANCE (const ComplexGEPBALANCE& a) | |||
: balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2), | : balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2), | |||
balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2) { } | balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2) { } | |||
ComplexGEPBALANCE& operator = (const ComplexGEPBALANCE& a) | ComplexGEPBALANCE& operator = (const ComplexGEPBALANCE& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
balanced_mat = a.balanced_mat; | balanced_mat = a.balanced_mat; | |||
balanced_mat2 = a.balanced_mat2; | balanced_mat2 = a.balanced_mat2; | |||
balancing_mat = a.balancing_mat; | balancing_mat = a.balancing_mat; | |||
balancing_mat2 = a.balancing_mat2; | balancing_mat2 = a.balancing_mat2; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~ComplexGEPBALANCE (void) { } | ~ComplexGEPBALANCE (void) { } | |||
ComplexMatrix balanced_matrix (void) const { return balanced_mat; } | ComplexMatrix balanced_matrix (void) const { return balanced_mat; } | |||
ComplexMatrix balanced_matrix2 (void) const { return balanced_mat2; } | ComplexMatrix balanced_matrix2 (void) const { return balanced_mat2; } | |||
Matrix balancing_matrix (void) const { return balancing_mat; } | Matrix balancing_matrix (void) const { return balancing_mat; } | |||
Matrix balancing_matrix2 (void) const { return balancing_mat2; } | Matrix balancing_matrix2 (void) const { return balancing_mat2; } | |||
friend std::ostream& operator << (std::ostream& os, const ComplexGEPBALAN | friend std::ostream& operator << (std::ostream& os, | |||
CE& a); | const ComplexGEPBALANCE& a); | |||
private: | private: | |||
ComplexMatrix balanced_mat; | ComplexMatrix balanced_mat; | |||
ComplexMatrix balanced_mat2; | ComplexMatrix balanced_mat2; | |||
Matrix balancing_mat; | Matrix balancing_mat; | |||
Matrix balancing_mat2; | Matrix balancing_mat2; | |||
octave_idx_type init (const ComplexMatrix& a, const ComplexMatrix& b, | octave_idx_type init (const ComplexMatrix& a, const ComplexMatrix& b, | |||
const std::string& balance_job); | const std::string& balance_job); | |||
End of changes. 6 change blocks. | ||||
19 lines changed or deleted | 19 lines changed or added | |||
CmplxHESS.h | CmplxHESS.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexHESS_h) | #if !defined (octave_CmplxHESS_h) | |||
#define octave_ComplexHESS_h 1 | #define octave_CmplxHESS_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
ComplexHESS | ComplexHESS | |||
{ | { | |||
public: | public: | |||
ComplexHESS (void) : hess_mat (), unitary_hess_mat () { } | ComplexHESS (void) : hess_mat (), unitary_hess_mat () { } | |||
ComplexHESS (const ComplexMatrix& a) | ComplexHESS (const ComplexMatrix& a) | |||
: hess_mat (), unitary_hess_mat () | : hess_mat (), unitary_hess_mat () | |||
{ | { | |||
init (a); | init (a); | |||
} | } | |||
ComplexHESS (const ComplexMatrix& a, octave_idx_type& info) | ComplexHESS (const ComplexMatrix& a, octave_idx_type& info) | |||
: hess_mat (), unitary_hess_mat () | : hess_mat (), unitary_hess_mat () | |||
{ | { | |||
info = init (a); | info = init (a); | |||
} | } | |||
ComplexHESS (const ComplexHESS& a) | ComplexHESS (const ComplexHESS& a) | |||
: hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } | : hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } | |||
ComplexHESS& operator = (const ComplexHESS& a) | ComplexHESS& operator = (const ComplexHESS& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
hess_mat = a.hess_mat; | hess_mat = a.hess_mat; | |||
unitary_hess_mat = a.unitary_hess_mat; | unitary_hess_mat = a.unitary_hess_mat; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~ComplexHESS (void) { } | ~ComplexHESS (void) { } | |||
ComplexMatrix hess_matrix (void) const { return hess_mat; } | ComplexMatrix hess_matrix (void) const { return hess_mat; } | |||
ComplexMatrix unitary_hess_matrix (void) const | ComplexMatrix unitary_hess_matrix (void) const | |||
{ | { | |||
return unitary_hess_mat; | return unitary_hess_mat; | |||
} | } | |||
friend std::ostream& operator << (std::ostream& os, const ComplexHESS& a) ; | friend std::ostream& operator << (std::ostream& os, const ComplexHESS& a) ; | |||
private: | private: | |||
ComplexMatrix hess_mat; | ComplexMatrix hess_mat; | |||
ComplexMatrix unitary_hess_mat; | ComplexMatrix unitary_hess_mat; | |||
octave_idx_type init (const ComplexMatrix& a); | octave_idx_type init (const ComplexMatrix& a); | |||
}; | }; | |||
End of changes. 6 change blocks. | ||||
20 lines changed or deleted | 20 lines changed or added | |||
CmplxLU.h | CmplxLU.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexLU_h) | #if !defined (octave_CmplxLU_h) | |||
#define octave_ComplexLU_h 1 | #define octave_CmplxLU_h 1 | |||
#include "base-lu.h" | #include "base-lu.h" | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
ComplexLU : public base_lu <ComplexMatrix> | ComplexLU : public base_lu <ComplexMatrix> | |||
{ | { | |||
public: | public: | |||
skipping to change at line 49 | skipping to change at line 49 | |||
ComplexLU (const ComplexMatrix& a); | ComplexLU (const ComplexMatrix& a); | |||
ComplexLU (const ComplexLU& a) | ComplexLU (const ComplexLU& a) | |||
: base_lu <ComplexMatrix> (a) { } | : base_lu <ComplexMatrix> (a) { } | |||
ComplexLU (const ComplexMatrix& l, const ComplexMatrix& u, | ComplexLU (const ComplexMatrix& l, const ComplexMatrix& u, | |||
const PermMatrix& p) | const PermMatrix& p) | |||
: base_lu <ComplexMatrix> (l, u, p) { } | : base_lu <ComplexMatrix> (l, u, p) { } | |||
ComplexLU& operator = (const ComplexLU& a) | ComplexLU& operator = (const ComplexLU& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
base_lu <ComplexMatrix> :: operator = (a); | base_lu <ComplexMatrix> :: operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
~ComplexLU (void) { } | ~ComplexLU (void) { } | |||
void update (const ComplexColumnVector& u, const ComplexColumnVector& v); | void update (const ComplexColumnVector& u, const ComplexColumnVector& v); | |||
void update (const ComplexMatrix& u, const ComplexMatrix& v); | void update (const ComplexMatrix& u, const ComplexMatrix& v); | |||
void update_piv (const ComplexColumnVector& u, const ComplexColumnVector& v); | void update_piv (const ComplexColumnVector& u, const ComplexColumnVector& v); | |||
void update_piv (const ComplexMatrix& u, const ComplexMatrix& v); | void update_piv (const ComplexMatrix& u, const ComplexMatrix& v); | |||
End of changes. 4 change blocks. | ||||
8 lines changed or deleted | 8 lines changed or added | |||
CmplxQR.h | CmplxQR.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexQR_h) | #if !defined (octave_CmplxQR_h) | |||
#define octave_ComplexQR_h 1 | #define octave_CmplxQR_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
#include "CColVector.h" | #include "CColVector.h" | |||
#include "CRowVector.h" | #include "CRowVector.h" | |||
#include "base-qr.h" | #include "base-qr.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
CmplxQRP.h | CmplxQRP.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexQRP_h) | #if !defined (octave_CmplxQRP_h) | |||
#define octave_ComplexQRP_h 1 | #define octave_CmplxQRP_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "CmplxQR.h" | #include "CmplxQR.h" | |||
#include "PermMatrix.h" | #include "PermMatrix.h" | |||
#include "dColVector.h" | #include "dColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
ComplexQRP : public ComplexQR | ComplexQRP : public ComplexQR | |||
{ | { | |||
public: | public: | |||
ComplexQRP (void) : ComplexQR (), p () { } | ComplexQRP (void) : ComplexQR (), p () { } | |||
ComplexQRP (const ComplexMatrix&, qr_type_t = qr_type_std); | ComplexQRP (const ComplexMatrix&, qr_type_t = qr_type_std); | |||
ComplexQRP (const ComplexQRP& a) : ComplexQR (a), p (a.p) { } | ComplexQRP (const ComplexQRP& a) : ComplexQR (a), p (a.p) { } | |||
ComplexQRP& operator = (const ComplexQRP& a) | ComplexQRP& operator = (const ComplexQRP& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
ComplexQR::operator = (a); | ComplexQR::operator = (a); | |||
p = a.p; | p = a.p; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~ComplexQRP (void) { } | ~ComplexQRP (void) { } | |||
void init (const ComplexMatrix&, qr_type_t = qr_type_std); | void init (const ComplexMatrix&, qr_type_t = qr_type_std); | |||
PermMatrix P (void) const { return p; } | PermMatrix P (void) const { return p; } | |||
RowVector Pvec (void) const; | RowVector Pvec (void) const; | |||
friend std::ostream& operator << (std::ostream&, const ComplexQRP&); | friend std::ostream& operator << (std::ostream&, const ComplexQRP&); | |||
End of changes. 3 change blocks. | ||||
11 lines changed or deleted | 11 lines changed or added | |||
CmplxSCHUR.h | CmplxSCHUR.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexSCHUR_h) | #if !defined (octave_CmplxSCHUR_h) | |||
#define octave_ComplexSCHUR_h 1 | #define octave_CmplxSCHUR_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
#include "dbleSCHUR.h" | #include "dbleSCHUR.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
ComplexSCHUR | ComplexSCHUR | |||
{ | { | |||
public: | public: | |||
ComplexSCHUR (void) : schur_mat (), unitary_mat (), selector (0) { } | ComplexSCHUR (void) : schur_mat (), unitary_mat (), selector (0) { } | |||
ComplexSCHUR (const ComplexMatrix& a, const std::string& ord, | ComplexSCHUR (const ComplexMatrix& a, const std::string& ord, | |||
bool calc_unitary = true) | bool calc_unitary = true) | |||
: schur_mat (), unitary_mat (), selector (0) | : schur_mat (), unitary_mat (), selector (0) | |||
{ | { | |||
init (a, ord, calc_unitary); | init (a, ord, calc_unitary); | |||
} | } | |||
ComplexSCHUR (const ComplexMatrix& a, const std::string& ord, | ComplexSCHUR (const ComplexMatrix& a, const std::string& ord, | |||
octave_idx_type& info, | octave_idx_type& info, | |||
bool calc_unitary = true) | bool calc_unitary = true) | |||
: schur_mat (), unitary_mat (), selector (0) | : schur_mat (), unitary_mat (), selector (0) | |||
{ | { | |||
info = init (a, ord, calc_unitary); | info = init (a, ord, calc_unitary); | |||
} | } | |||
ComplexSCHUR (const ComplexSCHUR& a) | ComplexSCHUR (const ComplexSCHUR& a) | |||
: schur_mat (a.schur_mat), unitary_mat (a.unitary_mat), selector (0) | : schur_mat (a.schur_mat), unitary_mat (a.unitary_mat), selector (0) | |||
{ } | { } | |||
ComplexSCHUR (const ComplexMatrix& s, const ComplexMatrix& u); | ComplexSCHUR (const ComplexMatrix& s, const ComplexMatrix& u); | |||
ComplexSCHUR (const SCHUR& s); | ComplexSCHUR (const SCHUR& s); | |||
ComplexSCHUR& operator = (const ComplexSCHUR& a) | ComplexSCHUR& operator = (const ComplexSCHUR& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
schur_mat = a.schur_mat; | schur_mat = a.schur_mat; | |||
unitary_mat = a.unitary_mat; | unitary_mat = a.unitary_mat; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~ComplexSCHUR (void) { } | ~ComplexSCHUR (void) { } | |||
ComplexMatrix schur_matrix (void) const { return schur_mat; } | ComplexMatrix schur_matrix (void) const { return schur_mat; } | |||
ComplexMatrix unitary_matrix (void) const { return unitary_mat; } | ComplexMatrix unitary_matrix (void) const { return unitary_mat; } | |||
friend std::ostream& operator << (std::ostream& os, const ComplexSCHUR& a ); | friend std::ostream& operator << (std::ostream& os, const ComplexSCHUR& a ); | |||
typedef octave_idx_type (*select_function) (const Complex&); | typedef octave_idx_type (*select_function) (const Complex&); | |||
private: | private: | |||
ComplexMatrix schur_mat; | ComplexMatrix schur_mat; | |||
ComplexMatrix unitary_mat; | ComplexMatrix unitary_mat; | |||
select_function selector; | select_function selector; | |||
octave_idx_type init (const ComplexMatrix& a, const std::string& ord, boo | octave_idx_type init (const ComplexMatrix& a, const std::string& ord, | |||
l calc_unitary); | bool calc_unitary); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
20 lines changed or deleted | 20 lines changed or added | |||
CmplxSVD.h | CmplxSVD.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ComplexSVD_h) | #if !defined (octave_CmplxSVD_h) | |||
#define octave_ComplexSVD_h 1 | #define octave_CmplxSVD_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "dDiagMatrix.h" | #include "dDiagMatrix.h" | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
#include "dbleSVD.h" | #include "dbleSVD.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
ComplexSVD | ComplexSVD | |||
{ | { | |||
public: | public: | |||
ComplexSVD (void) | ComplexSVD (void) | |||
: type_computed (), sigma (), left_sm (), right_sm () | : type_computed (), sigma (), left_sm (), right_sm () | |||
{ } | { } | |||
ComplexSVD (const ComplexMatrix& a, SVD::type svd_type = SVD::std, | ComplexSVD (const ComplexMatrix& a, SVD::type svd_type = SVD::std, | |||
SVD::driver svd_driver = SVD::GESVD) | SVD::driver svd_driver = SVD::GESVD) | |||
: type_computed (), sigma (), left_sm (), right_sm () | : type_computed (), sigma (), left_sm (), right_sm () | |||
{ | { | |||
init (a, svd_type, svd_driver); | init (a, svd_type, svd_driver); | |||
} | } | |||
ComplexSVD (const ComplexMatrix& a, octave_idx_type& info, | ComplexSVD (const ComplexMatrix& a, octave_idx_type& info, | |||
SVD::type svd_type = SVD::std, | SVD::type svd_type = SVD::std, | |||
SVD::driver svd_driver = SVD::GESVD) | SVD::driver svd_driver = SVD::GESVD) | |||
: type_computed (), sigma (), left_sm (), right_sm () | : type_computed (), sigma (), left_sm (), right_sm () | |||
{ | { | |||
info = init (a, svd_type, svd_driver); | info = init (a, svd_type, svd_driver); | |||
} | } | |||
ComplexSVD (const ComplexSVD& a) | ComplexSVD (const ComplexSVD& a) | |||
: type_computed (a.type_computed), sigma (a.sigma), | : type_computed (a.type_computed), sigma (a.sigma), | |||
left_sm (a.left_sm), right_sm (a.right_sm) | left_sm (a.left_sm), right_sm (a.right_sm) | |||
{ } | { } | |||
ComplexSVD& operator = (const ComplexSVD& a) | ComplexSVD& operator = (const ComplexSVD& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
type_computed = a.type_computed; | type_computed = a.type_computed; | |||
sigma = a.sigma; | sigma = a.sigma; | |||
left_sm = a.left_sm; | left_sm = a.left_sm; | |||
right_sm = a.right_sm; | right_sm = a.right_sm; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~ComplexSVD (void) { } | ~ComplexSVD (void) { } | |||
DiagMatrix singular_values (void) const { return sigma; } | DiagMatrix singular_values (void) const { return sigma; } | |||
ComplexMatrix left_singular_matrix (void) const; | ComplexMatrix left_singular_matrix (void) const; | |||
ComplexMatrix right_singular_matrix (void) const; | ComplexMatrix right_singular_matrix (void) const; | |||
friend std::ostream& operator << (std::ostream& os, const ComplexSVD& a) ; | friend std::ostream& operator << (std::ostream& os, const ComplexSVD& a) ; | |||
End of changes. 7 change blocks. | ||||
21 lines changed or deleted | 21 lines changed or added | |||
CollocWt.h | CollocWt.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 57 | skipping to change at line 57 | |||
: n (nc), inc_left (il), inc_right (ir), lb (l), rb (rr), | : n (nc), inc_left (il), inc_right (ir), lb (l), rb (rr), | |||
Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { } | Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (false) { } | |||
CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il, | CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il, | |||
octave_idx_type ir) | octave_idx_type ir) | |||
: n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0), | : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0), | |||
Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { } | Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { } | |||
CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il, | CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il, | |||
octave_idx_type ir, | octave_idx_type ir, | |||
double ll, double rr) | double ll, double rr) | |||
: n (nc), inc_left (il), inc_right (ir), lb (ll), rb (rr), | : n (nc), inc_left (il), inc_right (ir), lb (ll), rb (rr), | |||
Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { } | Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { } | |||
CollocWt (const CollocWt& a) | CollocWt (const CollocWt& a) | |||
: n (a.n), inc_left (a.inc_left), inc_right (a.inc_right), | : n (a.n), inc_left (a.inc_left), inc_right (a.inc_right), | |||
lb (a.lb), rb (a.rb), Alpha (a.Alpha), Beta (a.Beta), | lb (a.lb), rb (a.rb), Alpha (a.Alpha), Beta (a.Beta), | |||
r (a.r), q (a.q), A (a.A), B (a.B), | r (a.r), q (a.q), A (a.A), B (a.B), | |||
initialized (a.initialized) { } | initialized (a.initialized) { } | |||
CollocWt& operator = (const CollocWt& a) | CollocWt& operator = (const CollocWt& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
n = a.n; | n = a.n; | |||
inc_left = a.inc_left; | inc_left = a.inc_left; | |||
inc_right = a.inc_right; | inc_right = a.inc_right; | |||
lb = a.lb; | lb = a.lb; | |||
rb = a.rb; | rb = a.rb; | |||
r = a.r; | r = a.r; | |||
q = a.q; | q = a.q; | |||
A = a.A; | A = a.A; | |||
B = a.B; | B = a.B; | |||
initialized = a.initialized; | initialized = a.initialized; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~CollocWt (void) { } | ~CollocWt (void) { } | |||
CollocWt& resize (octave_idx_type nc) | CollocWt& resize (octave_idx_type nc) | |||
{ | { | |||
n = nc; | n = nc; | |||
initialized = false; | initialized = false; | |||
return *this; | return *this; | |||
} | } | |||
CollocWt& add_left (void) | CollocWt& add_left (void) | |||
{ | { | |||
inc_left = 1; | inc_left = 1; | |||
initialized = false; | initialized = false; | |||
return *this; | return *this; | |||
} | } | |||
CollocWt& delete_left (void) | CollocWt& delete_left (void) | |||
{ | { | |||
inc_left = 0; | inc_left = 0; | |||
initialized = false; | initialized = false; | |||
return *this; | return *this; | |||
} | } | |||
CollocWt& set_left (double val); | CollocWt& set_left (double val); | |||
CollocWt& add_right (void) | CollocWt& add_right (void) | |||
{ | { | |||
inc_right = 1; | inc_right = 1; | |||
initialized = false; | initialized = false; | |||
return *this; | return *this; | |||
} | } | |||
CollocWt& delete_right (void) | CollocWt& delete_right (void) | |||
{ | { | |||
inc_right = 0; | inc_right = 0; | |||
initialized = false; | initialized = false; | |||
return *this; | return *this; | |||
} | } | |||
CollocWt& set_right (double val); | CollocWt& set_right (double val); | |||
CollocWt& set_alpha (double val) | CollocWt& set_alpha (double val) | |||
{ | { | |||
Alpha = val; | Alpha = val; | |||
initialized = false; | initialized = false; | |||
return *this; | return *this; | |||
} | } | |||
CollocWt& set_beta (double val) | CollocWt& set_beta (double val) | |||
{ | { | |||
Beta = val; | Beta = val; | |||
initialized = false; | initialized = false; | |||
return *this; | return *this; | |||
} | } | |||
octave_idx_type ncol (void) const { return n; } | octave_idx_type ncol (void) const { return n; } | |||
octave_idx_type left_included (void) const { return inc_left; } | octave_idx_type left_included (void) const { return inc_left; } | |||
octave_idx_type right_included (void) const { return inc_right; } | octave_idx_type right_included (void) const { return inc_right; } | |||
double left (void) const { return lb; } | double left (void) const { return lb; } | |||
double right (void) const { return rb; } | double right (void) const { return rb; } | |||
double width (void) const { return rb - lb; } | double width (void) const { return rb - lb; } | |||
End of changes. 10 change blocks. | ||||
53 lines changed or deleted | 53 lines changed or added | |||
DAE.h | DAE.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 46 | skipping to change at line 46 | |||
: base_diff_alg_eqn (), DAEFunc () { } | : base_diff_alg_eqn (), DAEFunc () { } | |||
DAE (const ColumnVector& xx, double tt, DAEFunc& f) | DAE (const ColumnVector& xx, double tt, DAEFunc& f) | |||
: base_diff_alg_eqn (xx, tt), DAEFunc (f) { } | : base_diff_alg_eqn (xx, tt), DAEFunc (f) { } | |||
DAE (const ColumnVector& xx, const ColumnVector& xxdot, | DAE (const ColumnVector& xx, const ColumnVector& xxdot, | |||
double tt, DAEFunc& f) | double tt, DAEFunc& f) | |||
: base_diff_alg_eqn (xx, xxdot, tt), DAEFunc (f) { } | : base_diff_alg_eqn (xx, xxdot, tt), DAEFunc (f) { } | |||
DAE (const DAE& a) | DAE (const DAE& a) | |||
: base_diff_alg_eqn (a), DAEFunc (a){ } | : base_diff_alg_eqn (a), DAEFunc (a) { } | |||
DAE& operator = (const DAE& a) | DAE& operator = (const DAE& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
base_diff_alg_eqn::operator = (a); | base_diff_alg_eqn::operator = (a); | |||
DAEFunc::operator = (a); | DAEFunc::operator = (a); | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
virtual ~DAE (void) { } | virtual ~DAE (void) { } | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
10 lines changed or deleted | 10 lines changed or added | |||
DAEFunc.h | DAEFunc.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 59 | skipping to change at line 59 | |||
DAEFunc (DAERHSFunc f) | DAEFunc (DAERHSFunc f) | |||
: fun (f), jac (0), reset (true) { } | : fun (f), jac (0), reset (true) { } | |||
DAEFunc (DAERHSFunc f, DAEJacFunc j) | DAEFunc (DAERHSFunc f, DAEJacFunc j) | |||
: fun (f), jac (j), reset (true) { } | : fun (f), jac (j), reset (true) { } | |||
DAEFunc (const DAEFunc& a) | DAEFunc (const DAEFunc& a) | |||
: fun (a.fun), jac (a.jac), reset (a.reset) { } | : fun (a.fun), jac (a.jac), reset (a.reset) { } | |||
DAEFunc& operator = (const DAEFunc& a) | DAEFunc& operator = (const DAEFunc& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
fun = a.fun; | fun = a.fun; | |||
jac = a.jac; | jac = a.jac; | |||
reset = a.reset; | reset = a.reset; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
virtual ~DAEFunc (void) { } | virtual ~DAEFunc (void) { } | |||
DAERHSFunc function (void) const { return fun; } | DAERHSFunc function (void) const { return fun; } | |||
DAEFunc& set_function (DAERHSFunc f) | DAEFunc& set_function (DAERHSFunc f) | |||
{ | { | |||
fun = f; | fun = f; | |||
reset = true; | reset = true; | |||
return *this; | return *this; | |||
} | } | |||
DAEJacFunc jacobian_function (void) const { return jac; } | DAEJacFunc jacobian_function (void) const { return jac; } | |||
DAEFunc& set_jacobian_function (DAEJacFunc j) | DAEFunc& set_jacobian_function (DAEJacFunc j) | |||
{ | { | |||
jac = j; | jac = j; | |||
reset = true; | reset = true; | |||
return *this; | return *this; | |||
} | } | |||
protected: | protected: | |||
DAERHSFunc fun; | DAERHSFunc fun; | |||
DAEJacFunc jac; | DAEJacFunc jac; | |||
// This variable is TRUE when this object is constructed, and also | // This variable is TRUE when this object is constructed, and also | |||
// after any internal data has changed. Derived classes may use | // after any internal data has changed. Derived classes may use | |||
// this information (and change it) to know when to (re)initialize | // this information (and change it) to know when to (re)initialize | |||
// their own internal data related to this object. | // their own internal data related to this object. | |||
End of changes. 4 change blocks. | ||||
20 lines changed or deleted | 20 lines changed or added | |||
DAERT.h | DAERT.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2002-2012 John W. Eaton | Copyright (C) 2002-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 42 | skipping to change at line 42 | |||
{ | { | |||
public: | public: | |||
DAERT (void) | DAERT (void) | |||
: base_diff_alg_eqn (), DAERTFunc () { } | : base_diff_alg_eqn (), DAERTFunc () { } | |||
DAERT (const ColumnVector& xx, double tt, DAERTFunc& f) | DAERT (const ColumnVector& xx, double tt, DAERTFunc& f) | |||
: base_diff_alg_eqn (xx, tt), DAERTFunc (f) { } | : base_diff_alg_eqn (xx, tt), DAERTFunc (f) { } | |||
DAERT (const ColumnVector& xx, const ColumnVector& xxdot, double tt, | DAERT (const ColumnVector& xx, const ColumnVector& xxdot, double tt, | |||
DAERTFunc& f) | DAERTFunc& f) | |||
: base_diff_alg_eqn (xx, xxdot, tt), DAERTFunc (f) { } | : base_diff_alg_eqn (xx, xxdot, tt), DAERTFunc (f) { } | |||
DAERT (const DAERT& a) | DAERT (const DAERT& a) | |||
: base_diff_alg_eqn (a), DAERTFunc (a) { } | : base_diff_alg_eqn (a), DAERTFunc (a) { } | |||
DAERT& operator = (const DAERT& a) | DAERT& operator = (const DAERT& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
base_diff_alg_eqn::operator = (a); | base_diff_alg_eqn::operator = (a); | |||
DAERTFunc::operator = (a); | DAERTFunc::operator = (a); | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
virtual ~DAERT (void) { } | virtual ~DAERT (void) { } | |||
void initialize (const ColumnVector& xx, const ColumnVector& xxdot, | void initialize (const ColumnVector& xx, const ColumnVector& xxdot, | |||
double tt) | double tt) | |||
{ | { | |||
base_diff_alg_eqn::initialize (xx, xxdot, tt); | base_diff_alg_eqn::initialize (xx, xxdot, tt); | |||
} | } | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
14 lines changed or deleted | 14 lines changed or added | |||
DAERTFunc.h | DAERTFunc.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2002-2012 John W. Eaton | Copyright (C) 2002-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 54 | skipping to change at line 54 | |||
DAERTFunc (DAERHSFunc f, DAERTConstrFunc cf) | DAERTFunc (DAERHSFunc f, DAERTConstrFunc cf) | |||
: DAEFunc (f), constr (cf), reset (true) { } | : DAEFunc (f), constr (cf), reset (true) { } | |||
DAERTFunc (DAERHSFunc f, DAERTConstrFunc cf, DAEJacFunc j) | DAERTFunc (DAERHSFunc f, DAERTConstrFunc cf, DAEJacFunc j) | |||
: DAEFunc (f, j), constr (cf), reset (true) { } | : DAEFunc (f, j), constr (cf), reset (true) { } | |||
DAERTFunc (const DAERTFunc& a) | DAERTFunc (const DAERTFunc& a) | |||
: DAEFunc (a), constr (a.constr), reset (a.reset) { } | : DAEFunc (a), constr (a.constr), reset (a.reset) { } | |||
DAERTFunc& operator = (const DAERTFunc& a) | DAERTFunc& operator = (const DAERTFunc& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
DAEFunc::operator = (a); | DAEFunc::operator = (a); | |||
constr = a.constr; | constr = a.constr; | |||
reset = a.reset; | reset = a.reset; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
virtual ~DAERTFunc (void) { } | virtual ~DAERTFunc (void) { } | |||
DAERTConstrFunc constraint_function (void) const { return constr; } | DAERTConstrFunc constraint_function (void) const { return constr; } | |||
DAERTFunc& set_constraint_function (DAERTConstrFunc cf) | DAERTFunc& set_constraint_function (DAERTConstrFunc cf) | |||
{ | { | |||
constr = cf; | constr = cf; | |||
reset = true; | reset = true; | |||
return *this; | return *this; | |||
} | } | |||
protected: | protected: | |||
DAERTConstrFunc constr; | DAERTConstrFunc constr; | |||
// This variable is TRUE when this object is constructed, and also | // This variable is TRUE when this object is constructed, and also | |||
// after any internal data has changed. Derived classes may use | // after any internal data has changed. Derived classes may use | |||
// this information (and change it) to know when to (re)initialize | // this information (and change it) to know when to (re)initialize | |||
// their own internal data related to this object. | // their own internal data related to this object. | |||
End of changes. 3 change blocks. | ||||
15 lines changed or deleted | 15 lines changed or added | |||
DASPK-opts.h | DASPK-opts.h | |||
---|---|---|---|---|
// DO NOT EDIT! | // DO NOT EDIT! | |||
// Generated automatically from DASPK-opts.in. | // Generated automatically from numeric/DASPK-opts.in. | |||
#if !defined (octave_DASPK_options_h) | #if !defined (octave_DASPK_options_h) | |||
#define octave_DASPK_options_h 1 | #define octave_DASPK_options_h 1 | |||
#include <cfloat> | #include <cfloat> | |||
#include <cmath> | #include <cmath> | |||
#include <DAE.h> | #include <DAE.h> | |||
class | class | |||
skipping to change at line 81 | skipping to change at line 81 | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~DASPK_options (void) { } | ~DASPK_options (void) { } | |||
void init (void) | void init (void) | |||
{ | { | |||
x_absolute_tolerance.resize (dim_vector (1, 1)); | x_absolute_tolerance.resize (dim_vector (1, 1)); | |||
x_absolute_tolerance(0) = ::sqrt (DBL_EPSILON); | x_absolute_tolerance(0) = ::sqrt (std::numeric_limits<double>::epsilo n ()); | |||
x_relative_tolerance.resize (dim_vector (1, 1)); | x_relative_tolerance.resize (dim_vector (1, 1)); | |||
x_relative_tolerance(0) = ::sqrt (DBL_EPSILON); | x_relative_tolerance(0) = ::sqrt (std::numeric_limits<double>::epsilo n ()); | |||
x_initial_condition_heuristics.resize (dim_vector (6, 1)); | x_initial_condition_heuristics.resize (dim_vector (6, 1)); | |||
x_initial_condition_heuristics(0) = 5.0; | x_initial_condition_heuristics(0) = 5.0; | |||
x_initial_condition_heuristics(1) = 6.0; | x_initial_condition_heuristics(1) = 6.0; | |||
x_initial_condition_heuristics(2) = 5.0; | x_initial_condition_heuristics(2) = 5.0; | |||
x_initial_condition_heuristics(3) = 0.0; | x_initial_condition_heuristics(3) = 0.0; | |||
x_initial_condition_heuristics(4) = ::pow (DBL_EPSILON, 2.0/3.0); | x_initial_condition_heuristics(4) = ::pow (std::numeric_limits<double >::epsilon (), 2.0/3.0); | |||
x_initial_condition_heuristics(5) = 0.01; | x_initial_condition_heuristics(5) = 0.01; | |||
x_algebraic_variables.resize (dim_vector (1, 1)); | x_algebraic_variables.resize (dim_vector (1, 1)); | |||
x_algebraic_variables(0) = 0; | x_algebraic_variables(0) = 0; | |||
x_inequality_constraint_types.resize (dim_vector (1, 1)); | x_inequality_constraint_types.resize (dim_vector (1, 1)); | |||
x_inequality_constraint_types(0) = 0; | x_inequality_constraint_types(0) = 0; | |||
x_initial_step_size = -1.0; | x_initial_step_size = -1.0; | |||
x_maximum_order = 5; | x_maximum_order = 5; | |||
x_maximum_step_size = -1.0; | x_maximum_step_size = -1.0; | |||
reset = true; | reset = true; | |||
} | } | |||
skipping to change at line 124 | skipping to change at line 124 | |||
x_maximum_order = opt.x_maximum_order; | x_maximum_order = opt.x_maximum_order; | |||
x_maximum_step_size = opt.x_maximum_step_size; | x_maximum_step_size = opt.x_maximum_step_size; | |||
reset = opt.reset; | reset = opt.reset; | |||
} | } | |||
void set_default_options (void) { init (); } | void set_default_options (void) { init (); } | |||
void set_absolute_tolerance (double val) | void set_absolute_tolerance (double val) | |||
{ | { | |||
x_absolute_tolerance.resize (dim_vector (1, 1)); | x_absolute_tolerance.resize (dim_vector (1, 1)); | |||
x_absolute_tolerance(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); | x_absolute_tolerance(0) = (val > 0.0) ? val : ::sqrt (std::numeric_li mits<double>::epsilon ()); | |||
reset = true; | reset = true; | |||
} | } | |||
void set_absolute_tolerance (const Array<double>& val) | void set_absolute_tolerance (const Array<double>& val) | |||
{ x_absolute_tolerance = val; reset = true; } | { x_absolute_tolerance = val; reset = true; } | |||
void set_relative_tolerance (double val) | void set_relative_tolerance (double val) | |||
{ | { | |||
x_relative_tolerance.resize (dim_vector (1, 1)); | x_relative_tolerance.resize (dim_vector (1, 1)); | |||
x_relative_tolerance(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); | x_relative_tolerance(0) = (val > 0.0) ? val : ::sqrt (std::numeric_li mits<double>::epsilon ()); | |||
reset = true; | reset = true; | |||
} | } | |||
void set_relative_tolerance (const Array<double>& val) | void set_relative_tolerance (const Array<double>& val) | |||
{ x_relative_tolerance = val; reset = true; } | { x_relative_tolerance = val; reset = true; } | |||
void set_compute_consistent_initial_condition (octave_idx_type val) | void set_compute_consistent_initial_condition (octave_idx_type val) | |||
{ x_compute_consistent_initial_condition = val; reset = true; } | { x_compute_consistent_initial_condition = val; reset = true; } | |||
void set_use_initial_condition_heuristics (octave_idx_type val) | void set_use_initial_condition_heuristics (octave_idx_type val) | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
DASPK.h | DASPK.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
DASRT-opts.h | DASRT-opts.h | |||
---|---|---|---|---|
// DO NOT EDIT! | // DO NOT EDIT! | |||
// Generated automatically from DASRT-opts.in. | // Generated automatically from numeric/DASRT-opts.in. | |||
#if !defined (octave_DASRT_options_h) | #if !defined (octave_DASRT_options_h) | |||
#define octave_DASRT_options_h 1 | #define octave_DASRT_options_h 1 | |||
#include <cfloat> | #include <cfloat> | |||
#include <cmath> | #include <cmath> | |||
#include <DAERT.h> | #include <DAERT.h> | |||
class | class | |||
skipping to change at line 60 | skipping to change at line 60 | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~DASRT_options (void) { } | ~DASRT_options (void) { } | |||
void init (void) | void init (void) | |||
{ | { | |||
x_absolute_tolerance.resize (dim_vector (1, 1)); | x_absolute_tolerance.resize (dim_vector (1, 1)); | |||
x_absolute_tolerance(0) = ::sqrt (DBL_EPSILON); | x_absolute_tolerance(0) = ::sqrt (std::numeric_limits<double>::epsilo n ()); | |||
x_relative_tolerance.resize (dim_vector (1, 1)); | x_relative_tolerance.resize (dim_vector (1, 1)); | |||
x_relative_tolerance(0) = ::sqrt (DBL_EPSILON); | x_relative_tolerance(0) = ::sqrt (std::numeric_limits<double>::epsilo n ()); | |||
x_initial_step_size = -1.0; | x_initial_step_size = -1.0; | |||
x_maximum_order = -1; | x_maximum_order = -1; | |||
x_maximum_step_size = -1.0; | x_maximum_step_size = -1.0; | |||
x_step_limit = -1; | x_step_limit = -1; | |||
reset = true; | reset = true; | |||
} | } | |||
void set_options (const DASRT_options& opt) | void set_options (const DASRT_options& opt) | |||
{ | { | |||
x_absolute_tolerance = opt.x_absolute_tolerance; | x_absolute_tolerance = opt.x_absolute_tolerance; | |||
skipping to change at line 86 | skipping to change at line 86 | |||
x_maximum_step_size = opt.x_maximum_step_size; | x_maximum_step_size = opt.x_maximum_step_size; | |||
x_step_limit = opt.x_step_limit; | x_step_limit = opt.x_step_limit; | |||
reset = opt.reset; | reset = opt.reset; | |||
} | } | |||
void set_default_options (void) { init (); } | void set_default_options (void) { init (); } | |||
void set_absolute_tolerance (double val) | void set_absolute_tolerance (double val) | |||
{ | { | |||
x_absolute_tolerance.resize (dim_vector (1, 1)); | x_absolute_tolerance.resize (dim_vector (1, 1)); | |||
x_absolute_tolerance(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); | x_absolute_tolerance(0) = (val > 0.0) ? val : ::sqrt (std::numeric_li mits<double>::epsilon ()); | |||
reset = true; | reset = true; | |||
} | } | |||
void set_absolute_tolerance (const Array<double>& val) | void set_absolute_tolerance (const Array<double>& val) | |||
{ x_absolute_tolerance = val; reset = true; } | { x_absolute_tolerance = val; reset = true; } | |||
void set_relative_tolerance (double val) | void set_relative_tolerance (double val) | |||
{ | { | |||
x_relative_tolerance.resize (dim_vector (1, 1)); | x_relative_tolerance.resize (dim_vector (1, 1)); | |||
x_relative_tolerance(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); | x_relative_tolerance(0) = (val > 0.0) ? val : ::sqrt (std::numeric_li mits<double>::epsilon ()); | |||
reset = true; | reset = true; | |||
} | } | |||
void set_relative_tolerance (const Array<double>& val) | void set_relative_tolerance (const Array<double>& val) | |||
{ x_relative_tolerance = val; reset = true; } | { x_relative_tolerance = val; reset = true; } | |||
void set_initial_step_size (double val) | void set_initial_step_size (double val) | |||
{ x_initial_step_size = (val >= 0.0) ? val : -1.0; reset = true; } | { x_initial_step_size = (val >= 0.0) ? val : -1.0; reset = true; } | |||
void set_maximum_order (octave_idx_type val) | void set_maximum_order (octave_idx_type val) | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
DASRT.h | DASRT.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2002-2012 John W. Eaton | Copyright (C) 2002-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 46 | skipping to change at line 46 | |||
DASRT_result (void) | DASRT_result (void) | |||
: x (), xdot (), t () { } | : x (), xdot (), t () { } | |||
DASRT_result (const Matrix& xx, const Matrix& xxdot, const ColumnVector& tt) | DASRT_result (const Matrix& xx, const Matrix& xxdot, const ColumnVector& tt) | |||
: x (xx), xdot (xxdot), t (tt) { } | : x (xx), xdot (xxdot), t (tt) { } | |||
DASRT_result (const DASRT_result& r) | DASRT_result (const DASRT_result& r) | |||
: x (r.x), xdot (r.xdot), t (r.t) { } | : x (r.x), xdot (r.xdot), t (r.t) { } | |||
DASRT_result& operator = (const DASRT_result& r) | DASRT_result& operator = (const DASRT_result& r) | |||
{ | { | |||
if (this != &r) | if (this != &r) | |||
{ | { | |||
x = r.x; | x = r.x; | |||
xdot = r.xdot; | xdot = r.xdot; | |||
t = r.t; | t = r.t; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~DASRT_result (void) { } | ~DASRT_result (void) { } | |||
Matrix state (void) const { return x; } | Matrix state (void) const { return x; } | |||
Matrix deriv (void) const { return xdot; } | Matrix deriv (void) const { return xdot; } | |||
ColumnVector times (void) const { return t; } | ColumnVector times (void) const { return t; } | |||
private: | private: | |||
Matrix x; | Matrix x; | |||
skipping to change at line 79 | skipping to change at line 79 | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
DASRT : public DAERT, public DASRT_options | DASRT : public DAERT, public DASRT_options | |||
{ | { | |||
public: | public: | |||
DASRT (void) | DASRT (void) | |||
: DAERT (), DASRT_options (), initialized (false), | : DAERT (), DASRT_options (), initialized (false), | |||
liw (0), lrw (0), ng (0), info (), iwork (), jroot (), rwork (), | liw (0), lrw (0), ng (0), info (), iwork (), jroot (), rwork (), | |||
abs_tol (), rel_tol () | abs_tol (), rel_tol () | |||
{ } | { } | |||
DASRT (const ColumnVector& s, double tm, DAERTFunc& f) | DASRT (const ColumnVector& s, double tm, DAERTFunc& f) | |||
: DAERT (s, tm, f), DASRT_options (), initialized (false), | : DAERT (s, tm, f), DASRT_options (), initialized (false), | |||
liw (0), lrw (0), ng (0), info (), iwork (), jroot (), rwork (), | liw (0), lrw (0), ng (0), info (), iwork (), jroot (), rwork (), | |||
abs_tol (), rel_tol () | abs_tol (), rel_tol () | |||
{ } | { } | |||
DASRT (const ColumnVector& s, const ColumnVector& deriv, | DASRT (const ColumnVector& s, const ColumnVector& deriv, | |||
double tm, DAERTFunc& f) | double tm, DAERTFunc& f) | |||
: DAERT (s, deriv, tm, f), DASRT_options (), initialized (false), | : DAERT (s, deriv, tm, f), DASRT_options (), initialized (false), | |||
liw (0), lrw (0), ng (0), info (), iwork (), jroot (), rwork (), | liw (0), lrw (0), ng (0), info (), iwork (), jroot (), rwork (), | |||
abs_tol (), rel_tol () | abs_tol (), rel_tol () | |||
{ } | { } | |||
~DASRT (void) { } | ~DASRT (void) { } | |||
DASRT_result integrate (const ColumnVector& tout); | DASRT_result integrate (const ColumnVector& tout); | |||
DASRT_result integrate (const ColumnVector& tout, | DASRT_result integrate (const ColumnVector& tout, | |||
const ColumnVector& tcrit); | const ColumnVector& tcrit); | |||
std::string error_message (void) const; | std::string error_message (void) const; | |||
End of changes. 5 change blocks. | ||||
13 lines changed or deleted | 13 lines changed or added | |||
DASSL-opts.h | DASSL-opts.h | |||
---|---|---|---|---|
// DO NOT EDIT! | // DO NOT EDIT! | |||
// Generated automatically from DASSL-opts.in. | // Generated automatically from numeric/DASSL-opts.in. | |||
#if !defined (octave_DASSL_options_h) | #if !defined (octave_DASSL_options_h) | |||
#define octave_DASSL_options_h 1 | #define octave_DASSL_options_h 1 | |||
#include <cfloat> | #include <cfloat> | |||
#include <cmath> | #include <cmath> | |||
#include <DAE.h> | #include <DAE.h> | |||
class | class | |||
skipping to change at line 66 | skipping to change at line 66 | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~DASSL_options (void) { } | ~DASSL_options (void) { } | |||
void init (void) | void init (void) | |||
{ | { | |||
x_absolute_tolerance.resize (dim_vector (1, 1)); | x_absolute_tolerance.resize (dim_vector (1, 1)); | |||
x_absolute_tolerance(0) = ::sqrt (DBL_EPSILON); | x_absolute_tolerance(0) = ::sqrt (std::numeric_limits<double>::epsilo n ()); | |||
x_relative_tolerance.resize (dim_vector (1, 1)); | x_relative_tolerance.resize (dim_vector (1, 1)); | |||
x_relative_tolerance(0) = ::sqrt (DBL_EPSILON); | x_relative_tolerance(0) = ::sqrt (std::numeric_limits<double>::epsilo n ()); | |||
x_initial_step_size = -1.0; | x_initial_step_size = -1.0; | |||
x_maximum_order = -1; | x_maximum_order = -1; | |||
x_maximum_step_size = -1.0; | x_maximum_step_size = -1.0; | |||
x_step_limit = -1; | x_step_limit = -1; | |||
reset = true; | reset = true; | |||
} | } | |||
void set_options (const DASSL_options& opt) | void set_options (const DASSL_options& opt) | |||
{ | { | |||
x_absolute_tolerance = opt.x_absolute_tolerance; | x_absolute_tolerance = opt.x_absolute_tolerance; | |||
skipping to change at line 94 | skipping to change at line 94 | |||
x_maximum_step_size = opt.x_maximum_step_size; | x_maximum_step_size = opt.x_maximum_step_size; | |||
x_step_limit = opt.x_step_limit; | x_step_limit = opt.x_step_limit; | |||
reset = opt.reset; | reset = opt.reset; | |||
} | } | |||
void set_default_options (void) { init (); } | void set_default_options (void) { init (); } | |||
void set_absolute_tolerance (double val) | void set_absolute_tolerance (double val) | |||
{ | { | |||
x_absolute_tolerance.resize (dim_vector (1, 1)); | x_absolute_tolerance.resize (dim_vector (1, 1)); | |||
x_absolute_tolerance(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); | x_absolute_tolerance(0) = (val > 0.0) ? val : ::sqrt (std::numeric_li mits<double>::epsilon ()); | |||
reset = true; | reset = true; | |||
} | } | |||
void set_absolute_tolerance (const Array<double>& val) | void set_absolute_tolerance (const Array<double>& val) | |||
{ x_absolute_tolerance = val; reset = true; } | { x_absolute_tolerance = val; reset = true; } | |||
void set_relative_tolerance (double val) | void set_relative_tolerance (double val) | |||
{ | { | |||
x_relative_tolerance.resize (dim_vector (1, 1)); | x_relative_tolerance.resize (dim_vector (1, 1)); | |||
x_relative_tolerance(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); | x_relative_tolerance(0) = (val > 0.0) ? val : ::sqrt (std::numeric_li mits<double>::epsilon ()); | |||
reset = true; | reset = true; | |||
} | } | |||
void set_relative_tolerance (const Array<double>& val) | void set_relative_tolerance (const Array<double>& val) | |||
{ x_relative_tolerance = val; reset = true; } | { x_relative_tolerance = val; reset = true; } | |||
void set_compute_consistent_initial_condition (octave_idx_type val) | void set_compute_consistent_initial_condition (octave_idx_type val) | |||
{ x_compute_consistent_initial_condition = val; reset = true; } | { x_compute_consistent_initial_condition = val; reset = true; } | |||
void set_enforce_nonnegativity_constraints (octave_idx_type val) | void set_enforce_nonnegativity_constraints (octave_idx_type val) | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
DASSL.h | DASSL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
DET.h | DET.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 38 | skipping to change at line 38 | |||
#include "lo-mappers.h" | #include "lo-mappers.h" | |||
template <class T> | template <class T> | |||
class | class | |||
base_det | base_det | |||
{ | { | |||
public: | public: | |||
base_det (T c = 1, int e = 0) | base_det (T c = 1, int e = 0) | |||
: c2 (), e2 () | : c2 (), e2 () | |||
{ | { | |||
c2 = xlog2 (c, e2); | c2 = xlog2 (c, e2); | |||
e2 += e; | e2 += e; | |||
} | } | |||
base_det (T c, double e, double b) | base_det (T c, double e, double b) | |||
: c2 (), e2 () | : c2 (), e2 () | |||
{ | { | |||
e *= xlog2 (b); | e *= xlog2 (b); | |||
e2 = e; | e2 = e; | |||
c *= xexp2 (e - e2); | c *= xexp2 (e - e2); | |||
int f; | int f; | |||
c2 = xlog2 (c, f); | c2 = xlog2 (c, f); | |||
e2 += f; | e2 += f; | |||
} | } | |||
base_det (const base_det& a) : c2 (a.c2), e2 (a.e2) { } | base_det (const base_det& a) : c2 (a.c2), e2 (a.e2) { } | |||
base_det& operator = (const base_det& a) | base_det& operator = (const base_det& a) | |||
{ | { | |||
c2 = a.c2; | c2 = a.c2; | |||
e2 = a.e2; | e2 = a.e2; | |||
return *this; | return *this; | |||
} | } | |||
T coef (void) const { return c2; } | T coef (void) const { return c2; } | |||
int exp (void) const { return e2; } | int exp (void) const { return e2; } | |||
T value () const { return c2 * static_cast<T> (std::ldexp (1.0, e2)); } | T value () const { return c2 * static_cast<T> (std::ldexp (1.0, e2)); } | |||
operator T () const { return value (); } | operator T () const { return value (); } | |||
base_det square () const { return base_det (c2*c2, e2+e2); } | base_det square () const { return base_det (c2*c2, e2+e2); } | |||
void operator *= (T t) | void operator *= (T t) | |||
{ | { | |||
int e; | int e; | |||
c2 *= xlog2 (t, e); | c2 *= xlog2 (t, e); | |||
e2 += e; | e2 += e; | |||
} | } | |||
private: | private: | |||
T c2; | T c2; | |||
int e2; | int e2; | |||
}; | }; | |||
// Provide the old types by typedefs. | // Provide the old types by typedefs. | |||
typedef base_det<double> DET; | typedef base_det<double> DET; | |||
typedef base_det<float> FloatDET; | typedef base_det<float> FloatDET; | |||
End of changes. 5 change blocks. | ||||
23 lines changed or deleted | 23 lines changed or added | |||
DiagArray2.cc | DiagArray2.cc | |||
---|---|---|---|---|
// Template array classes | // Template array classes | |||
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 51 | skipping to change at line 51 | |||
octave_idx_type c) | octave_idx_type c) | |||
: Array<T> (a.as_column ()), d1 (r), d2 (c) | : Array<T> (a.as_column ()), d1 (r), d2 (c) | |||
{ | { | |||
octave_idx_type rcmin = std::min (r, c); | octave_idx_type rcmin = std::min (r, c); | |||
if (rcmin != a.length ()) | if (rcmin != a.length ()) | |||
Array<T>::resize (dim_vector (rcmin, 1)); | Array<T>::resize (dim_vector (rcmin, 1)); | |||
} | } | |||
template <class T> | template <class T> | |||
Array<T> | Array<T> | |||
DiagArray2<T>::extract_diag (octave_idx_type k) const | DiagArray2<T>::diag (octave_idx_type k) const | |||
{ | { | |||
return diag (k); | return extract_diag (k); | |||
} | } | |||
template <class T> | template <class T> | |||
Array<T> | Array<T> | |||
DiagArray2<T>::diag (octave_idx_type k) const | DiagArray2<T>::extract_diag (octave_idx_type k) const | |||
{ | { | |||
Array<T> d; | Array<T> d; | |||
if (k == 0) | if (k == 0) | |||
// The main diagonal is shallow-copied. | // The main diagonal is shallow-copied. | |||
d = *this; | d = *this; | |||
else if (k > 0 && k < cols ()) | else if (k > 0 && k < cols ()) | |||
d = Array<T> (dim_vector (std::min (cols () - k, rows ()), 1), T ()); | d = Array<T> (dim_vector (std::min (cols () - k, rows ()), 1), T ()); | |||
else if (k < 0 && -k < rows ()) | else if (k < 0 && -k < rows ()) | |||
d = Array<T> (dim_vector (std::min (rows () + k, cols ()), 1), T ()); | d = Array<T> (dim_vector (std::min (rows () + k, cols ()), 1), T ()); | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
DiagArray2.h | DiagArray2.h | |||
---|---|---|---|---|
// Template array classes | // Template array classes | |||
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
skipping to change at line 72 | skipping to change at line 72 | |||
DiagArray2 (const DiagArray2<T>& a) | DiagArray2 (const DiagArray2<T>& a) | |||
: Array<T> (a), d1 (a.d1), d2 (a.d2) { } | : Array<T> (a), d1 (a.d1), d2 (a.d2) { } | |||
template <class U> | template <class U> | |||
DiagArray2 (const DiagArray2<U>& a) | DiagArray2 (const DiagArray2<U>& a) | |||
: Array<T> (a.extract_diag ()), d1 (a.dim1 ()), d2 (a.dim2 ()) { } | : Array<T> (a.extract_diag ()), d1 (a.dim1 ()), d2 (a.dim2 ()) { } | |||
~DiagArray2 (void) { } | ~DiagArray2 (void) { } | |||
DiagArray2<T>& operator = (const DiagArray2<T>& a) | DiagArray2<T>& operator = (const DiagArray2<T>& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
Array<T>::operator = (a); | Array<T>::operator = (a); | |||
d1 = a.d1; | d1 = a.d1; | |||
d2 = a.d2; | d2 = a.d2; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
octave_idx_type dim1 (void) const { return d1; } | octave_idx_type dim1 (void) const { return d1; } | |||
octave_idx_type dim2 (void) const { return d2; } | octave_idx_type dim2 (void) const { return d2; } | |||
octave_idx_type rows (void) const { return dim1 (); } | octave_idx_type rows (void) const { return dim1 (); } | |||
octave_idx_type cols (void) const { return dim2 (); } | octave_idx_type cols (void) const { return dim2 (); } | |||
octave_idx_type columns (void) const { return dim2 (); } | octave_idx_type columns (void) const { return dim2 (); } | |||
octave_idx_type diag_length (void) const { return Array<T>::length (); } | octave_idx_type diag_length (void) const { return Array<T>::length (); } | |||
// FIXME: a dangerous ambiguity? | // FIXME: a dangerous ambiguity? | |||
octave_idx_type length (void) const { return Array<T>::length (); } | octave_idx_type length (void) const { return Array<T>::length (); } | |||
octave_idx_type nelem (void) const { return dim1 () * dim2 (); } | octave_idx_type nelem (void) const { return dim1 () * dim2 (); } | |||
octave_idx_type numel (void) const { return nelem (); } | octave_idx_type numel (void) const { return nelem (); } | |||
size_t byte_size (void) const { return Array<T>::byte_size (); } | size_t byte_size (void) const { return Array<T>::byte_size (); } | |||
dim_vector dims (void) const { return dim_vector (d1, d2); } | dim_vector dims (void) const { return dim_vector (d1, d2); } | |||
Array<T> diag (octave_idx_type k = 0) const; | Array<T> diag (octave_idx_type k = 0) const GCC_ATTR_DEPRECATED; | |||
Array<T> extract_diag (octave_idx_type k = 0) const; | Array<T> extract_diag (octave_idx_type k = 0) const; | |||
DiagArray2<T> build_diag_matrix () const | DiagArray2<T> build_diag_matrix () const | |||
{ | { | |||
return DiagArray2<T> (array_value ()); | return DiagArray2<T> (array_value ()); | |||
} | } | |||
// Warning: the non-const two-index versions will silently ignore assignm ents | // Warning: the non-const two-index versions will silently ignore assignm ents | |||
// to off-diagonal elements. | // to off-diagonal elements. | |||
T elem (octave_idx_type r, octave_idx_type c) const | T elem (octave_idx_type r, octave_idx_type c) const | |||
{ | { | |||
return (r == c) ? Array<T>::elem (r) : T (0); | return (r == c) ? Array<T>::elem (r) : T (0); | |||
} | } | |||
T& elem (octave_idx_type r, octave_idx_type c) | T& elem (octave_idx_type r, octave_idx_type c) | |||
{ | { | |||
static T zero (0); | static T zero (0); | |||
return (r == c) ? Array<T>::elem (r) : zero; | return (r == c) ? Array<T>::elem (r) : zero; | |||
} | } | |||
T dgelem (octave_idx_type i) const | T dgelem (octave_idx_type i) const | |||
{ return Array<T>::elem (i); } | { return Array<T>::elem (i); } | |||
T& dgelem (octave_idx_type i) | T& dgelem (octave_idx_type i) | |||
{ return Array<T>::elem (i); } | { return Array<T>::elem (i); } | |||
T checkelem (octave_idx_type r, octave_idx_type c) const | T checkelem (octave_idx_type r, octave_idx_type c) const | |||
{ | { | |||
return check_idx (r, c) ? elem (r, c) : T (0); | return check_idx (r, c) ? elem (r, c) : T (0); | |||
} | } | |||
T operator () (octave_idx_type r, octave_idx_type c) const | T operator () (octave_idx_type r, octave_idx_type c) const | |||
{ | { | |||
#if defined (BOUNDS_CHECKING) | #if defined (BOUNDS_CHECKING) | |||
checkelem (r, c); | return checkelem (r, c); | |||
#else | #else | |||
return elem (r, c); | return elem (r, c); | |||
#endif | #endif | |||
} | } | |||
T& checkelem (octave_idx_type r, octave_idx_type c) | T& checkelem (octave_idx_type r, octave_idx_type c) | |||
{ | { | |||
static T zero (0); | static T zero (0); | |||
return check_idx (r, c) ? elem (r, c) : zero; | return check_idx (r, c) ? elem (r, c) : zero; | |||
} | } | |||
T& operator () (octave_idx_type r, octave_idx_type c) | T& operator () (octave_idx_type r, octave_idx_type c) | |||
{ | { | |||
#if defined (BOUNDS_CHECKING) | #if defined (BOUNDS_CHECKING) | |||
return checkelem (r, c); | return checkelem (r, c); | |||
#else | #else | |||
return elem (r, c); | return elem (r, c); | |||
#endif | #endif | |||
} | } | |||
// No checking. | // No checking. | |||
T xelem (octave_idx_type r, octave_idx_type c) const | T xelem (octave_idx_type r, octave_idx_type c) const | |||
{ | { | |||
return (r == c) ? Array<T>::xelem (r) : T (0); | return (r == c) ? Array<T>::xelem (r) : T (0); | |||
} | } | |||
T& dgxelem (octave_idx_type i) | T& dgxelem (octave_idx_type i) | |||
{ return Array<T>::xelem (i); } | { return Array<T>::xelem (i); } | |||
T dgxelem (octave_idx_type i) const | T dgxelem (octave_idx_type i) const | |||
{ return Array<T>::xelem (i); } | { return Array<T>::xelem (i); } | |||
void resize (octave_idx_type n, octave_idx_type m, | void resize (octave_idx_type n, octave_idx_type m, const T& rfv); | |||
const T& rfv = Array<T>::resize_fill_value ()); | void resize (octave_idx_type n, octave_idx_type m) | |||
{ | ||||
resize (n, m, Array<T>::resize_fill_value ()); | ||||
} | ||||
DiagArray2<T> transpose (void) const; | DiagArray2<T> transpose (void) const; | |||
DiagArray2<T> hermitian (T (*fcn) (const T&) = 0) const; | DiagArray2<T> hermitian (T (*fcn) (const T&) = 0) const; | |||
Array<T> array_value (void) const; | Array<T> array_value (void) const; | |||
const T *data (void) const { return Array<T>::data (); } | const T *data (void) const { return Array<T>::data (); } | |||
const T *fortran_vec (void) const { return Array<T>::fortran_vec (); } | const T *fortran_vec (void) const { return Array<T>::fortran_vec (); } | |||
T *fortran_vec (void) { return Array<T>::fortran_vec (); } | T *fortran_vec (void) { return Array<T>::fortran_vec (); } | |||
void print_info (std::ostream& os, const std::string& prefix) const | void print_info (std::ostream& os, const std::string& prefix) const | |||
{ Array<T>::print_info (os, prefix); } | { Array<T>::print_info (os, prefix); } | |||
private: | private: | |||
bool check_idx (octave_idx_type r, octave_idx_type c) const; | bool check_idx (octave_idx_type r, octave_idx_type c) const; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 23 change blocks. | ||||
43 lines changed or deleted | 46 lines changed or added | |||
EIG.h | EIG.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 36 | skipping to change at line 36 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
#include "CColVector.h" | #include "CColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
EIG | EIG | |||
{ | { | |||
friend class Matrix; | friend class Matrix; | |||
friend class ComplexMatrix; | friend class ComplexMatrix; | |||
public: | public: | |||
EIG (void) : lambda (), v () { } | EIG (void) : lambda (), v () { } | |||
EIG (const Matrix& a, bool calc_eigenvectors = true) | EIG (const Matrix& a, bool calc_eigenvectors = true) | |||
: lambda (), v () | : lambda (), v () | |||
{ | { | |||
init (a, calc_eigenvectors); | init (a, calc_eigenvectors); | |||
} | } | |||
skipping to change at line 99 | skipping to change at line 99 | |||
octave_idx_type& info, bool calc_eigenvectors = true) | octave_idx_type& info, bool calc_eigenvectors = true) | |||
: lambda (), v () | : lambda (), v () | |||
{ | { | |||
info = init (a, b, calc_eigenvectors); | info = init (a, b, calc_eigenvectors); | |||
} | } | |||
EIG (const EIG& a) | EIG (const EIG& a) | |||
: lambda (a.lambda), v (a.v) { } | : lambda (a.lambda), v (a.v) { } | |||
EIG& operator = (const EIG& a) | EIG& operator = (const EIG& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
lambda = a.lambda; | lambda = a.lambda; | |||
v = a.v; | v = a.v; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~EIG (void) { } | ~EIG (void) { } | |||
ComplexColumnVector eigenvalues (void) const { return lambda; } | ComplexColumnVector eigenvalues (void) const { return lambda; } | |||
ComplexMatrix eigenvectors (void) const { return v; } | ComplexMatrix eigenvectors (void) const { return v; } | |||
friend std::ostream& operator << (std::ostream& os, const EIG& a); | friend std::ostream& operator << (std::ostream& os, const EIG& a); | |||
private: | private: | |||
End of changes. 3 change blocks. | ||||
11 lines changed or deleted | 11 lines changed or added | |||
LSODE-opts.h | LSODE-opts.h | |||
---|---|---|---|---|
// DO NOT EDIT! | // DO NOT EDIT! | |||
// Generated automatically from LSODE-opts.in. | // Generated automatically from numeric/LSODE-opts.in. | |||
#if !defined (octave_LSODE_options_h) | #if !defined (octave_LSODE_options_h) | |||
#define octave_LSODE_options_h 1 | #define octave_LSODE_options_h 1 | |||
#include <cfloat> | #include <cfloat> | |||
#include <cmath> | #include <cmath> | |||
#include <ODE.h> | #include <ODE.h> | |||
class | class | |||
skipping to change at line 66 | skipping to change at line 66 | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~LSODE_options (void) { } | ~LSODE_options (void) { } | |||
void init (void) | void init (void) | |||
{ | { | |||
x_absolute_tolerance.resize (dim_vector (1, 1)); | x_absolute_tolerance.resize (dim_vector (1, 1)); | |||
x_absolute_tolerance(0) = ::sqrt (DBL_EPSILON); | x_absolute_tolerance(0) = ::sqrt (std::numeric_limits<double>::epsilo | |||
x_relative_tolerance = ::sqrt (DBL_EPSILON); | n ()); | |||
x_relative_tolerance = ::sqrt (std::numeric_limits<double>::epsilon ( | ||||
)); | ||||
x_integration_method = "stiff"; | x_integration_method = "stiff"; | |||
x_initial_step_size = -1.0; | x_initial_step_size = -1.0; | |||
x_maximum_order = -1; | x_maximum_order = -1; | |||
x_maximum_step_size = -1.0; | x_maximum_step_size = -1.0; | |||
x_minimum_step_size = 0.0; | x_minimum_step_size = 0.0; | |||
x_step_limit = 100000; | x_step_limit = 100000; | |||
reset = true; | reset = true; | |||
} | } | |||
void set_options (const LSODE_options& opt) | void set_options (const LSODE_options& opt) | |||
skipping to change at line 95 | skipping to change at line 95 | |||
x_minimum_step_size = opt.x_minimum_step_size; | x_minimum_step_size = opt.x_minimum_step_size; | |||
x_step_limit = opt.x_step_limit; | x_step_limit = opt.x_step_limit; | |||
reset = opt.reset; | reset = opt.reset; | |||
} | } | |||
void set_default_options (void) { init (); } | void set_default_options (void) { init (); } | |||
void set_absolute_tolerance (double val) | void set_absolute_tolerance (double val) | |||
{ | { | |||
x_absolute_tolerance.resize (dim_vector (1, 1)); | x_absolute_tolerance.resize (dim_vector (1, 1)); | |||
x_absolute_tolerance(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); | x_absolute_tolerance(0) = (val > 0.0) ? val : ::sqrt (std::numeric_li mits<double>::epsilon ()); | |||
reset = true; | reset = true; | |||
} | } | |||
void set_absolute_tolerance (const Array<double>& val) | void set_absolute_tolerance (const Array<double>& val) | |||
{ x_absolute_tolerance = val; reset = true; } | { x_absolute_tolerance = val; reset = true; } | |||
void set_relative_tolerance (double val) | void set_relative_tolerance (double val) | |||
{ x_relative_tolerance = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); rese t = true; } | { x_relative_tolerance = (val > 0.0) ? val : ::sqrt (std::numeric_limit s<double>::epsilon ()); reset = true; } | |||
void set_integration_method (const std::string& val) | void set_integration_method (const std::string& val) | |||
{ | { | |||
if (val == "stiff" || val == "bdf") | if (val == "stiff" || val == "bdf") | |||
x_integration_method = "stiff"; | x_integration_method = "stiff"; | |||
else if (val == "non-stiff" || val == "adams") | else if (val == "non-stiff" || val == "adams") | |||
x_integration_method = "non-stiff"; | x_integration_method = "non-stiff"; | |||
else | else | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("lsode_options: method must be \"stiff\", \"bdf\", \"non-stiff\" , or \"adams\""); | ("lsode_options: method must be \"stiff\", \"bdf\", \"non-stiff\" , or \"adams\""); | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 7 lines changed or added | |||
LSODE.h | LSODE.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
MArray-decl.h | MArray-decl.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
MArray-defs.h | MArray-defs.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009 VZLU Prague, a.s. | Copyright (C) 2009 VZLU Prague, a.s. | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
MArray.cc | MArray.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 42 | skipping to change at line 42 | |||
#include "MArray-defs.h" | #include "MArray-defs.h" | |||
#include "mx-inlines.cc" | #include "mx-inlines.cc" | |||
template <class T> | template <class T> | |||
struct _idxadds_helper | struct _idxadds_helper | |||
{ | { | |||
T *array; | T *array; | |||
T val; | T val; | |||
_idxadds_helper (T *a, T v) : array (a), val (v) { } | _idxadds_helper (T *a, T v) : array (a), val (v) { } | |||
void operator () (octave_idx_type i) | void operator () (octave_idx_type i) | |||
{ array[i] += val; } | { array[i] += val; } | |||
}; | }; | |||
template <class T> | template <class T> | |||
struct _idxadda_helper | struct _idxadda_helper | |||
{ | { | |||
T *array; | T *array; | |||
const T *vals; | const T *vals; | |||
_idxadda_helper (T *a, const T *v) : array (a), vals (v) { } | _idxadda_helper (T *a, const T *v) : array (a), vals (v) { } | |||
void operator () (octave_idx_type i) | void operator () (octave_idx_type i) | |||
{ array[i] += *vals++; } | { array[i] += *vals++; } | |||
}; | }; | |||
template <class T> | template <class T> | |||
void | void | |||
MArray<T>::idx_add (const idx_vector& idx, T val) | MArray<T>::idx_add (const idx_vector& idx, T val) | |||
{ | { | |||
octave_idx_type n = this->length (); | octave_idx_type n = this->length (); | |||
octave_idx_type ext = idx.extent (n); | octave_idx_type ext = idx.extent (n); | |||
if (ext > n) | if (ext > n) | |||
{ | { | |||
skipping to change at line 91 | skipping to change at line 91 | |||
this->resize1 (ext); | this->resize1 (ext); | |||
n = ext; | n = ext; | |||
} | } | |||
octave_quit (); | octave_quit (); | |||
octave_idx_type len = std::min (idx.length (n), vals.length ()); | octave_idx_type len = std::min (idx.length (n), vals.length ()); | |||
idx.loop (len, _idxadda_helper<T> (this->fortran_vec (), vals.data ())); | idx.loop (len, _idxadda_helper<T> (this->fortran_vec (), vals.data ())); | |||
} | } | |||
template <class T, T op (typename ref_param<T>::type, typename ref_param<T> | template <class T, T op (typename ref_param<T>::type, | |||
::type)> | typename ref_param<T>::type)> | |||
struct _idxbinop_helper | struct _idxbinop_helper | |||
{ | { | |||
T *array; | T *array; | |||
const T *vals; | const T *vals; | |||
_idxbinop_helper (T *a, const T *v) : array (a), vals (v) { } | _idxbinop_helper (T *a, const T *v) : array (a), vals (v) { } | |||
void operator () (octave_idx_type i) | void operator () (octave_idx_type i) | |||
{ array[i] = op (array[i], *vals++); } | { array[i] = op (array[i], *vals++); } | |||
}; | }; | |||
template <class T> | template <class T> | |||
void | void | |||
MArray<T>::idx_min (const idx_vector& idx, const MArray<T>& vals) | MArray<T>::idx_min (const idx_vector& idx, const MArray<T>& vals) | |||
{ | { | |||
octave_idx_type n = this->length (); | octave_idx_type n = this->length (); | |||
octave_idx_type ext = idx.extent (n); | octave_idx_type ext = idx.extent (n); | |||
if (ext > n) | if (ext > n) | |||
{ | { | |||
this->resize1 (ext); | this->resize1 (ext); | |||
n = ext; | n = ext; | |||
} | } | |||
octave_quit (); | octave_quit (); | |||
octave_idx_type len = std::min (idx.length (n), vals.length ()); | octave_idx_type len = std::min (idx.length (n), vals.length ()); | |||
idx.loop (len, _idxbinop_helper<T, xmin> (this->fortran_vec (), vals.data | idx.loop (len, _idxbinop_helper<T, xmin> (this->fortran_vec (), | |||
())); | vals.data ())); | |||
} | } | |||
template <class T> | template <class T> | |||
void | void | |||
MArray<T>::idx_max (const idx_vector& idx, const MArray<T>& vals) | MArray<T>::idx_max (const idx_vector& idx, const MArray<T>& vals) | |||
{ | { | |||
octave_idx_type n = this->length (); | octave_idx_type n = this->length (); | |||
octave_idx_type ext = idx.extent (n); | octave_idx_type ext = idx.extent (n); | |||
if (ext > n) | if (ext > n) | |||
{ | { | |||
this->resize1 (ext); | this->resize1 (ext); | |||
n = ext; | n = ext; | |||
} | } | |||
octave_quit (); | octave_quit (); | |||
octave_idx_type len = std::min (idx.length (n), vals.length ()); | octave_idx_type len = std::min (idx.length (n), vals.length ()); | |||
idx.loop (len, _idxbinop_helper<T, xmax> (this->fortran_vec (), vals.data | idx.loop (len, _idxbinop_helper<T, xmax> (this->fortran_vec (), | |||
())); | vals.data ())); | |||
} | } | |||
#include <iostream> | #include <iostream> | |||
template <class T> | template <class T> | |||
void MArray<T>::idx_add_nd (const idx_vector& idx, const MArray<T>& vals, i | void MArray<T>::idx_add_nd (const idx_vector& idx, const MArray<T>& vals, | |||
nt dim) | int dim) | |||
{ | { | |||
int nd = std::max (this->ndims (), vals.ndims ()); | int nd = std::max (this->ndims (), vals.ndims ()); | |||
if (dim < 0) | if (dim < 0) | |||
dim = vals.dims ().first_non_singleton (); | dim = vals.dims ().first_non_singleton (); | |||
else if (dim > nd) | else if (dim > nd) | |||
nd = dim; | nd = dim; | |||
// Check dimensions. | // Check dimensions. | |||
dim_vector ddv = Array<T>::dims ().redim (nd); | dim_vector ddv = Array<T>::dims ().redim (nd); | |||
dim_vector sdv = vals.dims ().redim (nd); | dim_vector sdv = vals.dims ().redim (nd); | |||
End of changes. 8 change blocks. | ||||
12 lines changed or deleted | 12 lines changed or added | |||
MArray.h | MArray.h | |||
---|---|---|---|---|
// Template array classes with like-type math ops | // Template array classes with like-type math ops | |||
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 42 | skipping to change at line 42 | |||
// But first, some preprocessor abuse... | // But first, some preprocessor abuse... | |||
#include "MArray-decl.h" | #include "MArray-decl.h" | |||
MARRAY_OPS_FORWARD_DECLS (MArray, ) | MARRAY_OPS_FORWARD_DECLS (MArray, ) | |||
template <class T> | template <class T> | |||
class | class | |||
MArray : public Array<T> | MArray : public Array<T> | |||
{ | { | |||
protected: | ||||
// For jit support | ||||
MArray (T *sdata, octave_idx_type slen, octave_idx_type *adims, void *are | ||||
p) | ||||
: Array<T> (sdata, slen, adims, arep) { } | ||||
public: | public: | |||
MArray (void) : Array<T> () {} | MArray (void) : Array<T> () { } | |||
explicit MArray (octave_idx_type n) GCC_ATTR_DEPRECATED | explicit MArray (octave_idx_type n) GCC_ATTR_DEPRECATED | |||
: Array<T> (dim_vector (n, 1)) { } | : Array<T> (dim_vector (n, 1)) { } | |||
MArray (octave_idx_type n, const T& val) GCC_ATTR_DEPRECATED | MArray (octave_idx_type n, const T& val) GCC_ATTR_DEPRECATED | |||
: Array<T> (dim_vector (n, 1), val) { } | : Array<T> (dim_vector (n, 1), val) { } | |||
explicit MArray (const dim_vector& dv) | explicit MArray (const dim_vector& dv) | |||
: Array<T> (dv) { } | : Array<T> (dv) { } | |||
skipping to change at line 66 | skipping to change at line 72 | |||
: Array<T> (dv, val) { } | : Array<T> (dv, val) { } | |||
MArray (const MArray<T>& a) : Array<T> (a) { } | MArray (const MArray<T>& a) : Array<T> (a) { } | |||
template <class U> | template <class U> | |||
MArray (const Array<U>& a) : Array<T> (a) { } | MArray (const Array<U>& a) : Array<T> (a) { } | |||
~MArray (void) { } | ~MArray (void) { } | |||
MArray<T>& operator = (const MArray<T>& a) | MArray<T>& operator = (const MArray<T>& a) | |||
{ | { | |||
Array<T>::operator = (a); | Array<T>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
MArray<T> reshape (const dim_vector& new_dims) const | MArray<T> reshape (const dim_vector& new_dims) const | |||
{ return Array<T>::reshape (new_dims); } | { return Array<T>::reshape (new_dims); } | |||
MArray<T> permute (const Array<octave_idx_type>& vec, | MArray<T> permute (const Array<octave_idx_type>& vec, | |||
bool inv = false) const | bool inv = false) const | |||
{ return Array<T>::permute (vec, inv); } | { return Array<T>::permute (vec, inv); } | |||
MArray<T> ipermute (const Array<octave_idx_type>& vec) const | MArray<T> ipermute (const Array<octave_idx_type>& vec) const | |||
{ return Array<T>::ipermute (vec); } | { return Array<T>::ipermute (vec); } | |||
MArray squeeze (void) const { return Array<T>::squeeze (); } | MArray squeeze (void) const { return Array<T>::squeeze (); } | |||
MArray<T> transpose (void) const | MArray<T> transpose (void) const | |||
{ return Array<T>::transpose (); } | { return Array<T>::transpose (); } | |||
MArray<T> hermitian (T (*fcn) (const T&) = 0) const | MArray<T> hermitian (T (*fcn) (const T&) = 0) const | |||
{ return Array<T>::hermitian (fcn); } | { return Array<T>::hermitian (fcn); } | |||
// Performs indexed accumulative addition. | // Performs indexed accumulative addition. | |||
void idx_add (const idx_vector& idx, T val); | void idx_add (const idx_vector& idx, T val); | |||
void idx_add (const idx_vector& idx, const MArray<T>& vals); | void idx_add (const idx_vector& idx, const MArray<T>& vals); | |||
void idx_min (const idx_vector& idx, const MArray<T>& vals); | void idx_min (const idx_vector& idx, const MArray<T>& vals); | |||
void idx_max (const idx_vector& idx, const MArray<T>& vals); | void idx_max (const idx_vector& idx, const MArray<T>& vals); | |||
End of changes. 9 change blocks. | ||||
12 lines changed or deleted | 19 lines changed or added | |||
MArray2.h | MArray2.h | |||
---|---|---|---|---|
// Template array classes with like-type math ops | // Template array classes with like-type math ops | |||
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
MArrayN.h | MArrayN.h | |||
---|---|---|---|---|
// Template array classes with like-type math ops | // Template array classes with like-type math ops | |||
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
MDiagArray2.cc | MDiagArray2.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 42 | skipping to change at line 42 | |||
#include "MArray-defs.h" | #include "MArray-defs.h" | |||
template <class T> | template <class T> | |||
bool | bool | |||
MDiagArray2<T>::is_multiple_of_identity (T val) const | MDiagArray2<T>::is_multiple_of_identity (T val) const | |||
{ | { | |||
bool retval = this->rows () == this->cols (); | bool retval = this->rows () == this->cols (); | |||
if (retval) | if (retval) | |||
{ | { | |||
octave_idx_type len = this->length (), i = 0; | octave_idx_type len = this->length (), i = 0; | |||
for (;i < len; i++) | for (; i < len; i++) | |||
if (DiagArray2<T>::elem (i, i) != val) break; | if (DiagArray2<T>::elem (i, i) != val) break; | |||
retval = i == len; | retval = i == len; | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
// Two dimensional diagonal array with math ops. | // Two dimensional diagonal array with math ops. | |||
// Element by element MDiagArray2 by MDiagArray2 ops. | // Element by element MDiagArray2 by MDiagArray2 ops. | |||
skipping to change at line 73 | skipping to change at line 73 | |||
MARRAY_DAS_OP (*, mx_inline_mul) | MARRAY_DAS_OP (*, mx_inline_mul) | |||
MARRAY_DAS_OP (/, mx_inline_div) | MARRAY_DAS_OP (/, mx_inline_div) | |||
// Element by element scalar by MDiagArray2 ops. | // Element by element scalar by MDiagArray2 ops. | |||
template <class T> | template <class T> | |||
MDiagArray2<T> | MDiagArray2<T> | |||
operator * (const T& s, const MDiagArray2<T>& a) | operator * (const T& s, const MDiagArray2<T>& a) | |||
{ | { | |||
return MDiagArray2<T> (do_sm_binary_op<T, T, T> (s, a, mx_inline_mul), a. | return MDiagArray2<T> (do_sm_binary_op<T, T, T> (s, a, mx_inline_mul), | |||
d1, a.d2); | a.d1, a.d2); | |||
} | } | |||
// Element by element MDiagArray2 by MDiagArray2 ops. | // Element by element MDiagArray2 by MDiagArray2 ops. | |||
#define MARRAY_DADA_OP(FCN, OP, FN) \ | #define MARRAY_DADA_OP(FCN, OP, FN) \ | |||
template <class T> \ | template <class T> \ | |||
MDiagArray2<T> \ | MDiagArray2<T> \ | |||
FCN (const MDiagArray2<T>& a, const MDiagArray2<T>& b) \ | FCN (const MDiagArray2<T>& a, const MDiagArray2<T>& b) \ | |||
{ \ | { \ | |||
if (a.d1 != b.d1 || a.d2 != b.d2) \ | if (a.d1 != b.d1 || a.d2 != b.d2) \ | |||
skipping to change at line 105 | skipping to change at line 106 | |||
MDiagArray2<T> | MDiagArray2<T> | |||
operator + (const MDiagArray2<T>& a) | operator + (const MDiagArray2<T>& a) | |||
{ | { | |||
return a; | return a; | |||
} | } | |||
template <class T> | template <class T> | |||
MDiagArray2<T> | MDiagArray2<T> | |||
operator - (const MDiagArray2<T>& a) | operator - (const MDiagArray2<T>& a) | |||
{ | { | |||
return MDiagArray2<T> (do_mx_unary_op<T, T> (a, mx_inline_uminus), a.d1, | return MDiagArray2<T> (do_mx_unary_op<T, T> (a, mx_inline_uminus), | |||
a.d2); | a.d1, a.d2); | |||
} | } | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
MDiagArray2.h | MDiagArray2.h | |||
---|---|---|---|---|
// Template array classes with like-type math ops | // Template array classes with like-type math ops | |||
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 49 | skipping to change at line 49 | |||
template <class T> | template <class T> | |||
class | class | |||
MDiagArray2 : public DiagArray2<T> | MDiagArray2 : public DiagArray2<T> | |||
{ | { | |||
public: | public: | |||
MDiagArray2 (void) : DiagArray2<T> () { } | MDiagArray2 (void) : DiagArray2<T> () { } | |||
MDiagArray2 (octave_idx_type r, octave_idx_type c) : DiagArray2<T> (r, c) { } | MDiagArray2 (octave_idx_type r, octave_idx_type c) : DiagArray2<T> (r, c) { } | |||
MDiagArray2 (octave_idx_type r, octave_idx_type c, const T& val) : DiagAr | MDiagArray2 (octave_idx_type r, octave_idx_type c, const T& val) | |||
ray2<T> (r, c, val) { } | : DiagArray2<T> (r, c, val) { } | |||
MDiagArray2 (const MDiagArray2<T>& a) : DiagArray2<T> (a) { } | MDiagArray2 (const MDiagArray2<T>& a) : DiagArray2<T> (a) { } | |||
MDiagArray2 (const DiagArray2<T>& a) : DiagArray2<T> (a) { } | MDiagArray2 (const DiagArray2<T>& a) : DiagArray2<T> (a) { } | |||
template <class U> | template <class U> | |||
MDiagArray2 (const DiagArray2<U>& a) : DiagArray2<T> (a) { } | MDiagArray2 (const DiagArray2<U>& a) : DiagArray2<T> (a) { } | |||
explicit MDiagArray2 (const Array<T>& a) : DiagArray2<T> (a) { } | explicit MDiagArray2 (const Array<T>& a) : DiagArray2<T> (a) { } | |||
MDiagArray2 (const Array<T>& a, octave_idx_type r, octave_idx_type c) | MDiagArray2 (const Array<T>& a, octave_idx_type r, octave_idx_type c) | |||
: DiagArray2<T> (a, r, c) { } | : DiagArray2<T> (a, r, c) { } | |||
~MDiagArray2 (void) { } | ~MDiagArray2 (void) { } | |||
MDiagArray2<T>& operator = (const MDiagArray2<T>& a) | MDiagArray2<T>& operator = (const MDiagArray2<T>& a) | |||
{ | { | |||
DiagArray2<T>::operator = (a); | DiagArray2<T>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
MArray<T> array_value () const | MArray<T> array_value () const | |||
{ | { | |||
return DiagArray2<T>::array_value (); | return DiagArray2<T>::array_value (); | |||
} | } | |||
octave_idx_type nnz (void) const | octave_idx_type nnz (void) const | |||
{ | { | |||
octave_idx_type retval = 0; | octave_idx_type retval = 0; | |||
const T *d = this->data (); | const T *d = this->data (); | |||
octave_idx_type nel = this->length (); | octave_idx_type nel = this->length (); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
{ | { | |||
if (d[i] != T ()) | if (d[i] != T ()) | |||
retval++; | retval++; | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
MArray<T> diag (octave_idx_type k = 0) const | MArray<T> diag (octave_idx_type k = 0) const | |||
{ return DiagArray2<T>::diag (k); } | { return DiagArray2<T>::extract_diag (k); } | |||
MDiagArray2<T> transpose (void) const { return DiagArray2<T>::transpose ( ); } | MDiagArray2<T> transpose (void) const { return DiagArray2<T>::transpose ( ); } | |||
MDiagArray2<T> hermitian (T (*fcn) (const T&) = 0) const { return DiagArr | MDiagArray2<T> hermitian (T (*fcn) (const T&) = 0) const | |||
ay2<T>::hermitian (fcn); } | { return DiagArray2<T>::hermitian (fcn); } | |||
bool is_multiple_of_identity (T val) const; | bool is_multiple_of_identity (T val) const; | |||
// Currently, the OPS functions don't need to be friends, but that | // Currently, the OPS functions don't need to be friends, but that | |||
// may change. | // may change. | |||
MDIAGARRAY2_OPS_FRIEND_DECLS (MDiagArray2, ) | MDIAGARRAY2_OPS_FRIEND_DECLS (MDiagArray2, ) | |||
}; | }; | |||
End of changes. 11 change blocks. | ||||
24 lines changed or deleted | 24 lines changed or added | |||
MSparse-defs.h | MSparse-defs.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
MSparse.h | MSparse.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 49 | skipping to change at line 49 | |||
template <class T> | template <class T> | |||
class | class | |||
MSparse : public Sparse<T> | MSparse : public Sparse<T> | |||
{ | { | |||
public: | public: | |||
MSparse (void) : Sparse<T> () { } | MSparse (void) : Sparse<T> () { } | |||
MSparse (octave_idx_type n, octave_idx_type m) : Sparse<T> (n, m) { } | MSparse (octave_idx_type n, octave_idx_type m) : Sparse<T> (n, m) { } | |||
MSparse (const dim_vector& dv, octave_idx_type nz = 0) : | MSparse (const dim_vector& dv, octave_idx_type nz = 0) | |||
Sparse<T> (dv, nz) { } | : Sparse<T> (dv, nz) { } | |||
MSparse (const MSparse<T>& a) : Sparse<T> (a) { } | MSparse (const MSparse<T>& a) : Sparse<T> (a) { } | |||
MSparse (const MSparse<T>& a, const dim_vector& dv) : Sparse<T> (a, dv) { } | MSparse (const MSparse<T>& a, const dim_vector& dv) : Sparse<T> (a, dv) { } | |||
MSparse (const Sparse<T>& a) : Sparse<T> (a) { } | MSparse (const Sparse<T>& a) : Sparse<T> (a) { } | |||
template <class U> | template <class U> | |||
MSparse (const Sparse<U>& a) : Sparse<T> (a) { } | MSparse (const Sparse<U>& a) : Sparse<T> (a) { } | |||
MSparse (const Array<T>& a, const idx_vector& r, const idx_vector& c, | MSparse (const Array<T>& a, const idx_vector& r, const idx_vector& c, | |||
octave_idx_type nr = -1, octave_idx_type nc = -1, | octave_idx_type nr = -1, octave_idx_type nc = -1, | |||
bool sum_terms = true, octave_idx_type nzm = -1) | bool sum_terms = true, octave_idx_type nzm = -1) | |||
: Sparse<T> (a, r, c, nr, nc, sum_terms, nzm) { } | : Sparse<T> (a, r, c, nr, nc, sum_terms, nzm) { } | |||
explicit MSparse (octave_idx_type r, octave_idx_type c, T val) : Sparse<T | explicit MSparse (octave_idx_type r, octave_idx_type c, T val) | |||
> (r, c, val) { } | : Sparse<T> (r, c, val) { } | |||
explicit MSparse (const PermMatrix& a) : Sparse<T>(a) { } | explicit MSparse (const PermMatrix& a) : Sparse<T>(a) { } | |||
MSparse (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) : | MSparse (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) | |||
Sparse<T> (r, c, num_nz) { } | : Sparse<T> (r, c, num_nz) { } | |||
~MSparse (void) { } | ~MSparse (void) { } | |||
MSparse<T>& operator = (const MSparse<T>& a) | MSparse<T>& operator = (const MSparse<T>& a) | |||
{ | { | |||
Sparse<T>::operator = (a); | Sparse<T>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
MSparse<T>& insert (const Sparse<T>& a, octave_idx_type r, octave_idx_typ e c) | MSparse<T>& insert (const Sparse<T>& a, octave_idx_type r, octave_idx_typ e c) | |||
{ | { | |||
Sparse<T>::insert (a, r, c); | Sparse<T>::insert (a, r, c); | |||
return *this; | return *this; | |||
} | } | |||
MSparse<T>& insert (const Sparse<T>& a, const Array<octave_idx_type>& ind x) | MSparse<T>& insert (const Sparse<T>& a, const Array<octave_idx_type>& ind x) | |||
{ | { | |||
Sparse<T>::insert (a, indx); | Sparse<T>::insert (a, indx); | |||
return *this; | return *this; | |||
} | } | |||
MSparse<T> transpose (void) const { return Sparse<T>::transpose (); } | MSparse<T> transpose (void) const { return Sparse<T>::transpose (); } | |||
MSparse<T> squeeze (void) const { return Sparse<T>::squeeze (); } | MSparse<T> squeeze (void) const { return Sparse<T>::squeeze (); } | |||
MSparse<T> reshape (const dim_vector& new_dims) const | MSparse<T> reshape (const dim_vector& new_dims) const | |||
{ return Sparse<T>::reshape (new_dims); } | { return Sparse<T>::reshape (new_dims); } | |||
MSparse<T> permute (const Array<octave_idx_type>& vec, bool inv = false) const | MSparse<T> permute (const Array<octave_idx_type>& vec, bool inv = false) const | |||
{ return Sparse<T>::permute (vec, inv); } | { return Sparse<T>::permute (vec, inv); } | |||
MSparse<T> ipermute (const Array<octave_idx_type>& vec) const | MSparse<T> ipermute (const Array<octave_idx_type>& vec) const | |||
{ return Sparse<T>::ipermute (vec); } | { return Sparse<T>::ipermute (vec); } | |||
MSparse<T> diag (octave_idx_type k = 0) const | MSparse<T> diag (octave_idx_type k = 0) const | |||
{ | { | |||
return Sparse<T>::diag (k); | return Sparse<T>::diag (k); | |||
} | } | |||
// FIXME: should go away. | // FIXME: should go away. | |||
template <class U> | template <class U> | |||
MSparse<U> | MSparse<U> | |||
map (U (&fcn) (T)) const | map (U (&fcn) (T)) const | |||
End of changes. 8 change blocks. | ||||
14 lines changed or deleted | 14 lines changed or added | |||
Matrix.h | Matrix.h | |||
---|---|---|---|---|
// Matrix manipulations. | // Matrix manipulations. | |||
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
MatrixType.h | MatrixType.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2006-2012 David Bateman | Copyright (C) 2006-2013 David Bateman | |||
Copyright (C) 2006 Andy Adler | Copyright (C) 2006 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 39 | skipping to change at line 39 | |||
class FloatMatrix; | class FloatMatrix; | |||
class FloatComplexMatrix; | class FloatComplexMatrix; | |||
class SparseMatrix; | class SparseMatrix; | |||
class SparseComplexMatrix; | class SparseComplexMatrix; | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
MatrixType | MatrixType | |||
{ | { | |||
public: | public: | |||
enum matrix_type { | enum matrix_type | |||
{ | ||||
Unknown = 0, | Unknown = 0, | |||
Full, | Full, | |||
Diagonal, | Diagonal, | |||
Permuted_Diagonal, | Permuted_Diagonal, | |||
Upper, | Upper, | |||
Lower, | Lower, | |||
Permuted_Upper, | Permuted_Upper, | |||
Permuted_Lower, | Permuted_Lower, | |||
Banded, | Banded, | |||
Hermitian, | Hermitian, | |||
skipping to change at line 107 | skipping to change at line 108 | |||
double band_density (void) const { return bandden; } | double band_density (void) const { return bandden; } | |||
int nupper (void) const { return upper_band; } | int nupper (void) const { return upper_band; } | |||
int nlower (void) const { return lower_band; } | int nlower (void) const { return lower_band; } | |||
bool is_dense (void) const { return dense; } | bool is_dense (void) const { return dense; } | |||
bool is_diagonal (void) const | bool is_diagonal (void) const | |||
{ return (typ == Diagonal || typ == Permuted_Diagonal); } | { return (typ == Diagonal || typ == Permuted_Diagonal); } | |||
bool is_upper_triangular (void) const | bool is_upper_triangular (void) const | |||
{ return (typ == Upper || typ == Permuted_Upper); } | { return (typ == Upper || typ == Permuted_Upper); } | |||
bool is_lower_triangular (void) const | bool is_lower_triangular (void) const | |||
{ return (typ == Lower || typ == Permuted_Lower); } | { return (typ == Lower || typ == Permuted_Lower); } | |||
bool is_banded (void) | bool is_banded (void) | |||
{ return (typ == Banded || typ == Banded_Hermitian); } | { return (typ == Banded || typ == Banded_Hermitian); } | |||
bool is_tridiagonal (void) const | bool is_tridiagonal (void) const | |||
{ return (typ == Tridiagonal || typ == Tridiagonal_Hermitian); } | { return (typ == Tridiagonal || typ == Tridiagonal_Hermitian); } | |||
bool is_hermitian (void) const | bool is_hermitian (void) const | |||
{ return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian || | { | |||
typ == Hermitian); } | return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian || | |||
typ == Hermitian); | ||||
} | ||||
bool is_rectangular (void) const { return (typ == Rectangular); } | bool is_rectangular (void) const { return (typ == Rectangular); } | |||
bool is_known (void) const { return (typ != Unknown); } | bool is_known (void) const { return (typ != Unknown); } | |||
bool is_unknown (void) const { return (typ == Unknown); } | bool is_unknown (void) const { return (typ == Unknown); } | |||
void info (void) const; | void info (void) const; | |||
octave_idx_type * triangular_perm (void) const { return perm; } | octave_idx_type * triangular_perm (void) const { return perm; } | |||
skipping to change at line 148 | skipping to change at line 151 | |||
void mark_as_permuted_diagonal (void) { typ = Permuted_Diagonal; } | void mark_as_permuted_diagonal (void) { typ = Permuted_Diagonal; } | |||
void mark_as_upper_triangular (void) { typ = Upper; } | void mark_as_upper_triangular (void) { typ = Upper; } | |||
void mark_as_lower_triangular (void) { typ = Lower; } | void mark_as_lower_triangular (void) { typ = Lower; } | |||
void mark_as_tridiagonal (void) {typ = Tridiagonal; } | void mark_as_tridiagonal (void) {typ = Tridiagonal; } | |||
void mark_as_banded (const octave_idx_type ku, const octave_idx_type kl) | void mark_as_banded (const octave_idx_type ku, const octave_idx_type kl) | |||
{ typ = Banded; upper_band = ku; lower_band = kl; } | { typ = Banded; upper_band = ku; lower_band = kl; } | |||
void mark_as_full (void) { typ = Full; } | void mark_as_full (void) { typ = Full; } | |||
void mark_as_rectangular (void) { typ = Rectangular; } | void mark_as_rectangular (void) { typ = Rectangular; } | |||
void mark_as_dense (void) { dense = true; } | void mark_as_dense (void) { dense = true; } | |||
void mark_as_not_dense (void) { dense = false; } | void mark_as_not_dense (void) { dense = false; } | |||
void mark_as_symmetric (void); | void mark_as_symmetric (void); | |||
End of changes. 9 change blocks. | ||||
11 lines changed or deleted | 14 lines changed or added | |||
ODE.h | ODE.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 44 | skipping to change at line 44 | |||
ODE (void) | ODE (void) | |||
: base_diff_eqn (), ODEFunc () { } | : base_diff_eqn (), ODEFunc () { } | |||
ODE (const ColumnVector& s, double tm, const ODEFunc& f) | ODE (const ColumnVector& s, double tm, const ODEFunc& f) | |||
: base_diff_eqn (s, tm), ODEFunc (f) { } | : base_diff_eqn (s, tm), ODEFunc (f) { } | |||
ODE (const ODE& a) | ODE (const ODE& a) | |||
: base_diff_eqn (a), ODEFunc (a) { } | : base_diff_eqn (a), ODEFunc (a) { } | |||
ODE& operator = (const ODE& a) | ODE& operator = (const ODE& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
base_diff_eqn::operator = (a); | base_diff_eqn::operator = (a); | |||
ODEFunc::operator = (a); | ODEFunc::operator = (a); | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
virtual ~ODE (void) { } | virtual ~ODE (void) { } | |||
// Derived classes must provide functions to actually do the | // Derived classes must provide functions to actually do the | |||
// integration. | // integration. | |||
// Return the vector of states at output time t. | // Return the vector of states at output time t. | |||
virtual ColumnVector do_integrate (double tt) = 0; | virtual ColumnVector do_integrate (double tt) = 0; | |||
// Return a matrix of states at each output time specified by t. | // Return a matrix of states at each output time specified by t. | |||
skipping to change at line 74 | skipping to change at line 74 | |||
virtual Matrix do_integrate (const ColumnVector& tt) = 0; | virtual Matrix do_integrate (const ColumnVector& tt) = 0; | |||
virtual Matrix do_integrate (const ColumnVector& tt, | virtual Matrix do_integrate (const ColumnVector& tt, | |||
const ColumnVector& ttcrit) = 0; | const ColumnVector& ttcrit) = 0; | |||
// Lots of ways to call the single function and optionally set and | // Lots of ways to call the single function and optionally set and | |||
// get additional information. | // get additional information. | |||
// Integrate to t from current point. | // Integrate to t from current point. | |||
virtual ColumnVector integrate (double tt) | virtual ColumnVector integrate (double tt) | |||
{ return do_integrate (tt); } | { return do_integrate (tt); } | |||
// Set new x0, t0 and integrate to t. | // Set new x0, t0 and integrate to t. | |||
virtual ColumnVector integrate (const ColumnVector& x0, double t0, double tt) | virtual ColumnVector integrate (const ColumnVector& x0, double t0, double tt) | |||
{ | { | |||
initialize (x0, t0); | initialize (x0, t0); | |||
return do_integrate (tt); | return do_integrate (tt); | |||
} | } | |||
// Integrate from current point and return output at all points | // Integrate from current point and return output at all points | |||
// specified by t. | // specified by t. | |||
virtual Matrix integrate (const ColumnVector& tt) | virtual Matrix integrate (const ColumnVector& tt) | |||
{ return do_integrate (tt); } | { return do_integrate (tt); } | |||
// Set new x0, t0 and integrate to return output at all points | // Set new x0, t0 and integrate to return output at all points | |||
// specified by t. | // specified by t. | |||
virtual Matrix integrate (const ColumnVector& x0, double t0, | virtual Matrix integrate (const ColumnVector& x0, double t0, | |||
const ColumnVector& tt) | const ColumnVector& tt) | |||
{ | { | |||
initialize (x0, t0); | initialize (x0, t0); | |||
return do_integrate (tt); | return do_integrate (tt); | |||
} | } | |||
// Integrate from current point and return output at all points | // Integrate from current point and return output at all points | |||
// specified by t. | // specified by t. | |||
virtual Matrix integrate (const ColumnVector& tt, | virtual Matrix integrate (const ColumnVector& tt, | |||
const ColumnVector& ttcrit) | const ColumnVector& ttcrit) | |||
{ return do_integrate (tt, ttcrit); } | { return do_integrate (tt, ttcrit); } | |||
// Set new x0, t0 and integrate to return output at all points | // Set new x0, t0 and integrate to return output at all points | |||
// specified by t. | // specified by t. | |||
virtual Matrix integrate (const ColumnVector& x0, double t0, | virtual Matrix integrate (const ColumnVector& x0, double t0, | |||
const ColumnVector& tt, | const ColumnVector& tt, | |||
const ColumnVector& ttcrit) | const ColumnVector& ttcrit) | |||
{ | { | |||
initialize (x0, t0); | initialize (x0, t0); | |||
return do_integrate (tt, ttcrit); | return do_integrate (tt, ttcrit); | |||
} | } | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
24 lines changed or deleted | 24 lines changed or added | |||
ODEFunc.h | ODEFunc.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 50 | skipping to change at line 50 | |||
ODEFunc (ODERHSFunc f) | ODEFunc (ODERHSFunc f) | |||
: fun (f), jac (0), reset (true) { } | : fun (f), jac (0), reset (true) { } | |||
ODEFunc (ODERHSFunc f, ODEJacFunc j) | ODEFunc (ODERHSFunc f, ODEJacFunc j) | |||
: fun (f), jac (j), reset (true) { } | : fun (f), jac (j), reset (true) { } | |||
ODEFunc (const ODEFunc& a) | ODEFunc (const ODEFunc& a) | |||
: fun (a.fun), jac (a.jac), reset (true) { } | : fun (a.fun), jac (a.jac), reset (true) { } | |||
ODEFunc& operator = (const ODEFunc& a) | ODEFunc& operator = (const ODEFunc& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
fun = a.fun; | fun = a.fun; | |||
jac = a.jac; | jac = a.jac; | |||
reset = a.reset; | reset = a.reset; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
virtual ~ODEFunc (void) { } | virtual ~ODEFunc (void) { } | |||
ODERHSFunc function (void) const { return fun; } | ODERHSFunc function (void) const { return fun; } | |||
ODEFunc& set_function (ODERHSFunc f) | ODEFunc& set_function (ODERHSFunc f) | |||
{ | { | |||
fun = f; | fun = f; | |||
reset = true; | reset = true; | |||
return *this; | return *this; | |||
} | } | |||
ODEJacFunc jacobian_function (void) const { return jac; } | ODEJacFunc jacobian_function (void) const { return jac; } | |||
ODEFunc& set_jacobian_function (ODEJacFunc j) | ODEFunc& set_jacobian_function (ODEJacFunc j) | |||
{ | { | |||
jac = j; | jac = j; | |||
reset = true; | reset = true; | |||
return *this; | return *this; | |||
} | } | |||
protected: | protected: | |||
ODERHSFunc fun; | ODERHSFunc fun; | |||
ODEJacFunc jac; | ODEJacFunc jac; | |||
// This variable is TRUE when this object is constructed, and also | // This variable is TRUE when this object is constructed, and also | |||
// after any internal data has changed. Derived classes may use | // after any internal data has changed. Derived classes may use | |||
// this information (and change it) to know when to (re)initialize | // this information (and change it) to know when to (re)initialize | |||
// their own internal data related to this object. | // their own internal data related to this object. | |||
End of changes. 4 change blocks. | ||||
20 lines changed or deleted | 20 lines changed or added | |||
ODES.h | ODES.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2002-2012 John W. Eaton | Copyright (C) 2002-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 49 | skipping to change at line 49 | |||
ODES (const ColumnVector& s, const ColumnVector& xtheta, double tm, | ODES (const ColumnVector& s, const ColumnVector& xtheta, double tm, | |||
ODESFunc& f) | ODESFunc& f) | |||
: base_diff_eqn (s, tm), ODESFunc (f), xdot (s.length (), 0.0), | : base_diff_eqn (s, tm), ODESFunc (f), xdot (s.length (), 0.0), | |||
theta (xtheta) { } | theta (xtheta) { } | |||
ODES (const ODES& a) | ODES (const ODES& a) | |||
: base_diff_eqn (a), ODESFunc (a), xdot (a.xdot), theta (a.theta) { } | : base_diff_eqn (a), ODESFunc (a), xdot (a.xdot), theta (a.theta) { } | |||
ODES& operator = (const ODES& a) | ODES& operator = (const ODES& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
base_diff_eqn::operator = (a); | base_diff_eqn::operator = (a); | |||
ODESFunc::operator = (a); | ODESFunc::operator = (a); | |||
xdot = a.xdot; | xdot = a.xdot; | |||
theta = a.theta; | theta = a.theta; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~ODES (void) { } | ~ODES (void) { } | |||
ColumnVector parameter_vector (void) { return theta; } | ColumnVector parameter_vector (void) { return theta; } | |||
void initialize (const ColumnVector& x, double t); | void initialize (const ColumnVector& x, double t); | |||
void initialize (const ColumnVector& x, double t, | void initialize (const ColumnVector& x, double t, | |||
const ColumnVector& theta); | const ColumnVector& theta); | |||
End of changes. 2 change blocks. | ||||
12 lines changed or deleted | 12 lines changed or added | |||
ODESFunc.h | ODESFunc.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2002-2012 John W. Eaton | Copyright (C) 2002-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 34 | skipping to change at line 34 | |||
#define octave_ODESFunc_h 1 | #define octave_ODESFunc_h 1 | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
class | class | |||
ODESFunc | ODESFunc | |||
{ | { | |||
public: | public: | |||
struct DAEJac | struct DAEJac | |||
{ | { | |||
Matrix *dfdxdot; | Matrix *dfdxdot; | |||
Matrix *dfdx; | Matrix *dfdx; | |||
}; | }; | |||
typedef ColumnVector (*ODES_fsub) (const ColumnVector& x, double, | typedef ColumnVector (*ODES_fsub) (const ColumnVector& x, double, | |||
const ColumnVector& theta); | const ColumnVector& theta); | |||
typedef ColumnVector (*ODES_bsub) (const ColumnVector& x, double, | typedef ColumnVector (*ODES_bsub) (const ColumnVector& x, double, | |||
const ColumnVector& theta, int column) ; | const ColumnVector& theta, int column) ; | |||
typedef Matrix (*ODES_jsub) (const ColumnVector& x, double, | typedef Matrix (*ODES_jsub) (const ColumnVector& x, double, | |||
const ColumnVector& theta); | const ColumnVector& theta); | |||
skipping to change at line 64 | skipping to change at line 64 | |||
ODESFunc (ODES_fsub f, ODES_bsub b) | ODESFunc (ODES_fsub f, ODES_bsub b) | |||
: fsub (f), bsub (b), jsub (0) { } | : fsub (f), bsub (b), jsub (0) { } | |||
ODESFunc (ODES_fsub f, ODES_bsub b, ODES_jsub j) | ODESFunc (ODES_fsub f, ODES_bsub b, ODES_jsub j) | |||
: fsub (f), bsub (b), jsub (j) { } | : fsub (f), bsub (b), jsub (j) { } | |||
ODESFunc (const ODESFunc& a) | ODESFunc (const ODESFunc& a) | |||
: fsub (a.fsub), bsub (a.bsub), jsub (a.jsub) { } | : fsub (a.fsub), bsub (a.bsub), jsub (a.jsub) { } | |||
ODESFunc& operator = (const ODESFunc& a) | ODESFunc& operator = (const ODESFunc& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
fsub = a.fsub; | fsub = a.fsub; | |||
bsub = a.bsub; | bsub = a.bsub; | |||
jsub = a.jsub; | jsub = a.jsub; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
virtual ~ODESFunc (void) { } | virtual ~ODESFunc (void) { } | |||
ODES_fsub fsub_function (void) const { return fsub; } | ODES_fsub fsub_function (void) const { return fsub; } | |||
ODESFunc& set_fsub_function (ODES_fsub f) | ODESFunc& set_fsub_function (ODES_fsub f) | |||
{ | { | |||
fsub = f; | fsub = f; | |||
return *this; | return *this; | |||
} | } | |||
ODES_bsub bsub_function (void) const { return bsub; } | ODES_bsub bsub_function (void) const { return bsub; } | |||
ODESFunc& set_bsub_function (ODES_bsub b) | ODESFunc& set_bsub_function (ODES_bsub b) | |||
{ | { | |||
bsub = b; | bsub = b; | |||
return *this; | return *this; | |||
} | } | |||
ODES_jsub jsub_function (void) const { return jsub; } | ODES_jsub jsub_function (void) const { return jsub; } | |||
ODESFunc& set_jsub_function (ODES_jsub j) | ODESFunc& set_jsub_function (ODES_jsub j) | |||
{ | { | |||
jsub = j; | jsub = j; | |||
return *this; | return *this; | |||
} | } | |||
protected: | protected: | |||
ODES_fsub fsub; | ODES_fsub fsub; | |||
ODES_bsub bsub; | ODES_bsub bsub; | |||
ODES_jsub jsub; | ODES_jsub jsub; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
26 lines changed or deleted | 26 lines changed or added | |||
PermMatrix.h | PermMatrix.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 50 | skipping to change at line 50 | |||
PermMatrix (const Array<octave_idx_type>& p, bool colp = false, | PermMatrix (const Array<octave_idx_type>& p, bool colp = false, | |||
bool check = true); | bool check = true); | |||
PermMatrix (const PermMatrix& m) | PermMatrix (const PermMatrix& m) | |||
: Array<octave_idx_type> (m), _colp(m._colp) { } | : Array<octave_idx_type> (m), _colp(m._colp) { } | |||
PermMatrix (const idx_vector& idx, bool colp = false, octave_idx_type n = 0); | PermMatrix (const idx_vector& idx, bool colp = false, octave_idx_type n = 0); | |||
octave_idx_type dim1 (void) const | octave_idx_type dim1 (void) const | |||
{ return Array<octave_idx_type>::length (); } | { return Array<octave_idx_type>::length (); } | |||
octave_idx_type dim2 (void) const | octave_idx_type dim2 (void) const | |||
{ return Array<octave_idx_type>::length (); } | { return Array<octave_idx_type>::length (); } | |||
octave_idx_type rows (void) const { return dim1 (); } | octave_idx_type rows (void) const { return dim1 (); } | |||
octave_idx_type cols (void) const { return dim2 (); } | octave_idx_type cols (void) const { return dim2 (); } | |||
octave_idx_type columns (void) const { return dim2 (); } | octave_idx_type columns (void) const { return dim2 (); } | |||
octave_idx_type perm_length (void) const | octave_idx_type perm_length (void) const | |||
{ return Array<octave_idx_type>::length (); } | { return Array<octave_idx_type>::length (); } | |||
// FIXME: a dangerous ambiguity? | // FIXME: a dangerous ambiguity? | |||
octave_idx_type length (void) const | octave_idx_type length (void) const | |||
{ return perm_length (); } | { return perm_length (); } | |||
octave_idx_type nelem (void) const { return dim1 () * dim2 (); } | octave_idx_type nelem (void) const { return dim1 () * dim2 (); } | |||
octave_idx_type numel (void) const { return nelem (); } | octave_idx_type numel (void) const { return nelem (); } | |||
size_t byte_size (void) const | size_t byte_size (void) const | |||
{ return Array<octave_idx_type>::byte_size (); } | { return Array<octave_idx_type>::byte_size (); } | |||
dim_vector dims (void) const { return dim_vector (dim1 (), dim2 ()); } | dim_vector dims (void) const { return dim_vector (dim1 (), dim2 ()); } | |||
Array<octave_idx_type> pvec (void) const | Array<octave_idx_type> pvec (void) const | |||
{ return *this; } | { return *this; } | |||
octave_idx_type | octave_idx_type | |||
elem (octave_idx_type i, octave_idx_type j) const | elem (octave_idx_type i, octave_idx_type j) const | |||
{ | { | |||
return (_colp | return (_colp | |||
? ((Array<octave_idx_type>::elem (j) == i) ? 1 : 0) | ? ((Array<octave_idx_type>::elem (j) == i) ? 1 : 0) | |||
: ((Array<octave_idx_type>::elem (i) == j) ? 1 : 0)); | : ((Array<octave_idx_type>::elem (i) == j) ? 1 : 0)); | |||
} | } | |||
octave_idx_type | octave_idx_type | |||
checkelem (octave_idx_type i, octave_idx_type j) const; | checkelem (octave_idx_type i, octave_idx_type j) const; | |||
octave_idx_type | octave_idx_type | |||
operator () (octave_idx_type i, octave_idx_type j) const | operator () (octave_idx_type i, octave_idx_type j) const | |||
{ | { | |||
#if defined (BOUNDS_CHECKING) | #if defined (BOUNDS_CHECKING) | |||
return checkelem (i, j); | return checkelem (i, j); | |||
#else | #else | |||
return elem (i, j); | return elem (i, j); | |||
#endif | #endif | |||
} | } | |||
// These are, in fact, super-fast. | // These are, in fact, super-fast. | |||
PermMatrix transpose (void) const; | PermMatrix transpose (void) const; | |||
PermMatrix inverse (void) const; | PermMatrix inverse (void) const; | |||
// Determinant, i.e. the sign of permutation. | // Determinant, i.e. the sign of permutation. | |||
octave_idx_type determinant (void) const; | octave_idx_type determinant (void) const; | |||
// Efficient integer power of a permutation. | // Efficient integer power of a permutation. | |||
PermMatrix power (octave_idx_type n) const; | PermMatrix power (octave_idx_type n) const; | |||
bool is_col_perm (void) const { return _colp; } | bool is_col_perm (void) const { return _colp; } | |||
bool is_row_perm (void) const { return !_colp; } | bool is_row_perm (void) const { return !_colp; } | |||
friend OCTAVE_API PermMatrix operator *(const PermMatrix& a, const PermMa | friend OCTAVE_API PermMatrix operator *(const PermMatrix& a, | |||
trix& b); | const PermMatrix& b); | |||
const octave_idx_type *data (void) const | const octave_idx_type *data (void) const | |||
{ return Array<octave_idx_type>::data (); } | { return Array<octave_idx_type>::data (); } | |||
const octave_idx_type *fortran_vec (void) const | const octave_idx_type *fortran_vec (void) const | |||
{ return Array<octave_idx_type>::fortran_vec (); } | { return Array<octave_idx_type>::fortran_vec (); } | |||
octave_idx_type *fortran_vec (void) | octave_idx_type *fortran_vec (void) | |||
{ return Array<octave_idx_type>::fortran_vec (); } | { return Array<octave_idx_type>::fortran_vec (); } | |||
void print_info (std::ostream& os, const std::string& prefix) const | void print_info (std::ostream& os, const std::string& prefix) const | |||
{ Array<octave_idx_type>::print_info (os, prefix); } | { Array<octave_idx_type>::print_info (os, prefix); } | |||
static PermMatrix eye (octave_idx_type n); | static PermMatrix eye (octave_idx_type n); | |||
private: | private: | |||
bool _colp; | bool _colp; | |||
}; | }; | |||
// Multiplying permutations together. | // Multiplying permutations together. | |||
PermMatrix | PermMatrix | |||
OCTAVE_API | OCTAVE_API | |||
End of changes. 18 change blocks. | ||||
21 lines changed or deleted | 21 lines changed or added | |||
Quad-opts.h | Quad-opts.h | |||
---|---|---|---|---|
// DO NOT EDIT! | // DO NOT EDIT! | |||
// Generated automatically from Quad-opts.in. | // Generated automatically from numeric/Quad-opts.in. | |||
#if !defined (octave_Quad_options_h) | #if !defined (octave_Quad_options_h) | |||
#define octave_Quad_options_h 1 | #define octave_Quad_options_h 1 | |||
#include <cfloat> | #include <cfloat> | |||
#include <cmath> | #include <cmath> | |||
class | class | |||
Quad_options | Quad_options | |||
{ | { | |||
skipping to change at line 51 | skipping to change at line 51 | |||
reset = opt.reset; | reset = opt.reset; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~Quad_options (void) { } | ~Quad_options (void) { } | |||
void init (void) | void init (void) | |||
{ | { | |||
x_absolute_tolerance = ::sqrt (DBL_EPSILON); | x_absolute_tolerance = ::sqrt (std::numeric_limits<double>::epsilon ( | |||
x_relative_tolerance = ::sqrt (DBL_EPSILON); | )); | |||
x_single_precision_absolute_tolerance = ::sqrt (FLT_EPSILON); | x_relative_tolerance = ::sqrt (std::numeric_limits<double>::epsilon ( | |||
x_single_precision_relative_tolerance = ::sqrt (FLT_EPSILON); | )); | |||
x_single_precision_absolute_tolerance = ::sqrt (std::numeric_limits<f | ||||
loat>::epsilon ()); | ||||
x_single_precision_relative_tolerance = ::sqrt (std::numeric_limits<f | ||||
loat>::epsilon ()); | ||||
reset = true; | reset = true; | |||
} | } | |||
void set_options (const Quad_options& opt) | void set_options (const Quad_options& opt) | |||
{ | { | |||
x_absolute_tolerance = opt.x_absolute_tolerance; | x_absolute_tolerance = opt.x_absolute_tolerance; | |||
x_relative_tolerance = opt.x_relative_tolerance; | x_relative_tolerance = opt.x_relative_tolerance; | |||
x_single_precision_absolute_tolerance = opt.x_single_precision_absolu te_tolerance; | x_single_precision_absolute_tolerance = opt.x_single_precision_absolu te_tolerance; | |||
x_single_precision_relative_tolerance = opt.x_single_precision_relati ve_tolerance; | x_single_precision_relative_tolerance = opt.x_single_precision_relati ve_tolerance; | |||
reset = opt.reset; | reset = opt.reset; | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 9 lines changed or added | |||
Quad.h | Quad.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 32 | skipping to change at line 32 | |||
#if !defined (octave_Quad_h) | #if !defined (octave_Quad_h) | |||
#define octave_Quad_h 1 | #define octave_Quad_h 1 | |||
#include <cfloat> | #include <cfloat> | |||
#include "dColVector.h" | #include "dColVector.h" | |||
#include "fColVector.h" | #include "fColVector.h" | |||
#include "lo-math.h" | #include "lo-math.h" | |||
#if !defined (octave_Quad_typedefs) | ||||
#define octave_Quad_typedefs 1 | ||||
typedef double (*integrand_fcn) (double x); | typedef double (*integrand_fcn) (double x); | |||
typedef float (*float_integrand_fcn) (float x); | typedef float (*float_integrand_fcn) (float x); | |||
#endif | // FIXME: would be nice to not have to have this global variable. | |||
// FIXME -- would be nice to not have to have this global | ||||
// variable. | ||||
// Nonzero means an error occurred in the calculation of the integrand | // Nonzero means an error occurred in the calculation of the integrand | |||
// function, and the user wants us to quit. | // function, and the user wants us to quit. | |||
extern OCTAVE_API int quad_integration_error; | extern OCTAVE_API int quad_integration_error; | |||
#include "Quad-opts.h" | #include "Quad-opts.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
Quad : public Quad_options | Quad : public Quad_options | |||
{ | { | |||
public: | public: | |||
Quad (integrand_fcn fcn) | Quad (integrand_fcn fcn) | |||
: Quad_options (), f (fcn), ff () { } | : Quad_options (), f (fcn), ff () { } | |||
Quad (float_integrand_fcn fcn) | Quad (float_integrand_fcn fcn) | |||
: Quad_options (), f (), ff (fcn) { } | : Quad_options (), f (), ff (fcn) { } | |||
virtual ~Quad (void) { } | virtual ~Quad (void) { } | |||
virtual double integrate (void) | virtual double integrate (void) | |||
{ | { | |||
octave_idx_type ier, neval; | octave_idx_type ier, neval; | |||
double abserr; | double abserr; | |||
return do_integrate (ier, neval, abserr); | return do_integrate (ier, neval, abserr); | |||
} | } | |||
virtual float float_integrate (void) | virtual float float_integrate (void) | |||
{ | { | |||
octave_idx_type ier, neval; | octave_idx_type ier, neval; | |||
float abserr; | float abserr; | |||
return do_integrate (ier, neval, abserr); | return do_integrate (ier, neval, abserr); | |||
} | } | |||
virtual double integrate (octave_idx_type& ier) | virtual double integrate (octave_idx_type& ier) | |||
{ | { | |||
octave_idx_type neval; | octave_idx_type neval; | |||
double abserr; | double abserr; | |||
return do_integrate (ier, neval, abserr); | return do_integrate (ier, neval, abserr); | |||
} | } | |||
virtual float float_integrate (octave_idx_type& ier) | virtual float float_integrate (octave_idx_type& ier) | |||
{ | { | |||
octave_idx_type neval; | octave_idx_type neval; | |||
float abserr; | float abserr; | |||
return do_integrate (ier, neval, abserr); | return do_integrate (ier, neval, abserr); | |||
} | } | |||
virtual double integrate (octave_idx_type& ier, octave_idx_type& neval) | virtual double integrate (octave_idx_type& ier, octave_idx_type& neval) | |||
{ | { | |||
double abserr; | double abserr; | |||
return do_integrate (ier, neval, abserr); | return do_integrate (ier, neval, abserr); | |||
} | } | |||
virtual float float_integrate (octave_idx_type& ier, octave_idx_type& nev al) | virtual float float_integrate (octave_idx_type& ier, octave_idx_type& nev al) | |||
{ | { | |||
float abserr; | float abserr; | |||
return do_integrate (ier, neval, abserr); | return do_integrate (ier, neval, abserr); | |||
} | } | |||
virtual double integrate (octave_idx_type& ier, octave_idx_type& neval, d | virtual double integrate (octave_idx_type& ier, octave_idx_type& neval, | |||
ouble& abserr) | double& abserr) | |||
{ | { | |||
return do_integrate (ier, neval, abserr); | return do_integrate (ier, neval, abserr); | |||
} | } | |||
virtual float float_integrate (octave_idx_type& ier, octave_idx_type& nev | virtual float float_integrate (octave_idx_type& ier, octave_idx_type& nev | |||
al, float& abserr) | al, | |||
{ | float& abserr) | |||
return do_integrate (ier, neval, abserr); | { | |||
} | return do_integrate (ier, neval, abserr); | |||
} | ||||
virtual double do_integrate (octave_idx_type& ier, octave_idx_type& neval | virtual double do_integrate (octave_idx_type& ier, octave_idx_type& neval | |||
, double& abserr) = 0; | , | |||
double& abserr) = 0; | ||||
virtual float do_integrate (octave_idx_type& ier, octave_idx_type& neval, | virtual float do_integrate (octave_idx_type& ier, octave_idx_type& neval, | |||
float& abserr) = 0; | float& abserr) = 0; | |||
protected: | protected: | |||
integrand_fcn f; | integrand_fcn f; | |||
float_integrand_fcn ff; | float_integrand_fcn ff; | |||
}; | }; | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
DefQuad : public Quad | DefQuad : public Quad | |||
{ | { | |||
public: | public: | |||
DefQuad (integrand_fcn fcn) | DefQuad (integrand_fcn fcn) | |||
: Quad (fcn), lower_limit (0.0), upper_limit (1.0), singularities () { } | : Quad (fcn), lower_limit (0.0), upper_limit (1.0), singularities () { } | |||
DefQuad (integrand_fcn fcn, double ll, double ul) | DefQuad (integrand_fcn fcn, double ll, double ul) | |||
: Quad (fcn), lower_limit (ll), upper_limit (ul), singularities () { } | : Quad (fcn), lower_limit (ll), upper_limit (ul), singularities () { } | |||
DefQuad (integrand_fcn fcn, double ll, double ul, | DefQuad (integrand_fcn fcn, double ll, double ul, | |||
const ColumnVector& sing) | const ColumnVector& sing) | |||
: Quad (fcn), lower_limit (ll), upper_limit (ul), | : Quad (fcn), lower_limit (ll), upper_limit (ul), | |||
singularities (sing) { } | singularities (sing) { } | |||
DefQuad (integrand_fcn fcn, const ColumnVector& sing) | DefQuad (integrand_fcn fcn, const ColumnVector& sing) | |||
: Quad (fcn), lower_limit (0.0), upper_limit (1.0), | : Quad (fcn), lower_limit (0.0), upper_limit (1.0), | |||
singularities (sing) { } | singularities (sing) { } | |||
~DefQuad (void) { } | ~DefQuad (void) { } | |||
double do_integrate (octave_idx_type& ier, octave_idx_type& neval, double | double do_integrate (octave_idx_type& ier, octave_idx_type& neval, | |||
& abserr); | double& abserr); | |||
float do_integrate (octave_idx_type& ier, octave_idx_type& neval, float& | float do_integrate (octave_idx_type& ier, octave_idx_type& neval, | |||
abserr); | float& abserr); | |||
private: | private: | |||
double lower_limit; | double lower_limit; | |||
double upper_limit; | double upper_limit; | |||
ColumnVector singularities; | ColumnVector singularities; | |||
}; | }; | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
IndefQuad : public Quad | IndefQuad : public Quad | |||
{ | { | |||
public: | public: | |||
enum IntegralType { bound_to_inf, neg_inf_to_bound, doubly_infinite }; | enum IntegralType { bound_to_inf, neg_inf_to_bound, doubly_infinite }; | |||
IndefQuad (integrand_fcn fcn) | IndefQuad (integrand_fcn fcn) | |||
: Quad (fcn), bound (0.0), type (bound_to_inf), integration_error (0) { } | : Quad (fcn), bound (0.0), type (bound_to_inf), integration_error (0) { } | |||
IndefQuad (integrand_fcn fcn, double b, IntegralType t) | IndefQuad (integrand_fcn fcn, double b, IntegralType t) | |||
: Quad (fcn), bound (b), type (t), integration_error (0) { } | : Quad (fcn), bound (b), type (t), integration_error (0) { } | |||
~IndefQuad (void) { } | ~IndefQuad (void) { } | |||
double do_integrate (octave_idx_type& ier, octave_idx_type& neval, double | double do_integrate (octave_idx_type& ier, octave_idx_type& neval, | |||
& abserr); | double& abserr); | |||
float do_integrate (octave_idx_type& ier, octave_idx_type& neval, float& | float do_integrate (octave_idx_type& ier, octave_idx_type& neval, | |||
abserr); | float& abserr); | |||
private: | private: | |||
double bound; | double bound; | |||
IntegralType type; | IntegralType type; | |||
int integration_error; | int integration_error; | |||
}; | }; | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatDefQuad : public Quad | FloatDefQuad : public Quad | |||
{ | { | |||
public: | public: | |||
FloatDefQuad (float_integrand_fcn fcn) | FloatDefQuad (float_integrand_fcn fcn) | |||
: Quad (fcn), lower_limit (0.0), upper_limit (1.0), singularities () { } | : Quad (fcn), lower_limit (0.0), upper_limit (1.0), singularities () { } | |||
FloatDefQuad (float_integrand_fcn fcn, float ll, float ul) | FloatDefQuad (float_integrand_fcn fcn, float ll, float ul) | |||
: Quad (fcn), lower_limit (ll), upper_limit (ul), singularities () { } | : Quad (fcn), lower_limit (ll), upper_limit (ul), singularities () { } | |||
FloatDefQuad (float_integrand_fcn fcn, float ll, float ul, | FloatDefQuad (float_integrand_fcn fcn, float ll, float ul, | |||
const FloatColumnVector& sing) | const FloatColumnVector& sing) | |||
: Quad (fcn), lower_limit (ll), upper_limit (ul), | : Quad (fcn), lower_limit (ll), upper_limit (ul), | |||
singularities (sing) { } | singularities (sing) { } | |||
FloatDefQuad (float_integrand_fcn fcn, const FloatColumnVector& sing) | FloatDefQuad (float_integrand_fcn fcn, const FloatColumnVector& sing) | |||
: Quad (fcn), lower_limit (0.0), upper_limit (1.0), | : Quad (fcn), lower_limit (0.0), upper_limit (1.0), | |||
singularities (sing) { } | singularities (sing) { } | |||
~FloatDefQuad (void) { } | ~FloatDefQuad (void) { } | |||
double do_integrate (octave_idx_type& ier, octave_idx_type& neval, double | double do_integrate (octave_idx_type& ier, octave_idx_type& neval, | |||
& abserr); | double& abserr); | |||
float do_integrate (octave_idx_type& ier, octave_idx_type& neval, float& | float do_integrate (octave_idx_type& ier, octave_idx_type& neval, | |||
abserr); | float& abserr); | |||
private: | private: | |||
float lower_limit; | float lower_limit; | |||
float upper_limit; | float upper_limit; | |||
FloatColumnVector singularities; | FloatColumnVector singularities; | |||
}; | }; | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatIndefQuad : public Quad | FloatIndefQuad : public Quad | |||
{ | { | |||
public: | public: | |||
enum IntegralType { bound_to_inf, neg_inf_to_bound, doubly_infinite }; | enum IntegralType { bound_to_inf, neg_inf_to_bound, doubly_infinite }; | |||
FloatIndefQuad (float_integrand_fcn fcn) | FloatIndefQuad (float_integrand_fcn fcn) | |||
: Quad (fcn), bound (0.0), type (bound_to_inf), integration_error (0) { } | : Quad (fcn), bound (0.0), type (bound_to_inf), integration_error (0) { } | |||
FloatIndefQuad (float_integrand_fcn fcn, double b, IntegralType t) | FloatIndefQuad (float_integrand_fcn fcn, double b, IntegralType t) | |||
: Quad (fcn), bound (b), type (t), integration_error (0) { } | : Quad (fcn), bound (b), type (t), integration_error (0) { } | |||
~FloatIndefQuad (void) { } | ~FloatIndefQuad (void) { } | |||
double do_integrate (octave_idx_type& ier, octave_idx_type& neval, double | double do_integrate (octave_idx_type& ier, octave_idx_type& neval, | |||
& abserr); | double& abserr); | |||
float do_integrate (octave_idx_type& ier, octave_idx_type& neval, float& | float do_integrate (octave_idx_type& ier, octave_idx_type& neval, | |||
abserr); | float& abserr); | |||
private: | private: | |||
float bound; | float bound; | |||
IntegralType type; | IntegralType type; | |||
int integration_error; | int integration_error; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 30 change blocks. | ||||
79 lines changed or deleted | 75 lines changed or added | |||
Range.h | Range.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 35 | skipping to change at line 35 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
#include "oct-sort.h" | #include "oct-sort.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
Range | Range | |||
{ | { | |||
public: | public: | |||
Range (void) | Range (void) | |||
: rng_base (0), rng_limit (0), rng_inc (0), rng_nelem (0), cache (1, 0) { } | : rng_base (0), rng_limit (0), rng_inc (0), rng_nelem (0), cache (1, 0) { } | |||
Range (const Range& r) | Range (const Range& r) | |||
: rng_base (r.rng_base), rng_limit (r.rng_limit), rng_inc (r.rng_inc), | : rng_base (r.rng_base), rng_limit (r.rng_limit), rng_inc (r.rng_inc), | |||
rng_nelem (r.rng_nelem), cache (r.cache) { } | rng_nelem (r.rng_nelem), cache (r.cache) { } | |||
Range (double b, double l) | Range (double b, double l) | |||
: rng_base (b), rng_limit (l), rng_inc (1), | : rng_base (b), rng_limit (l), rng_inc (1), | |||
rng_nelem (nelem_internal ()), cache () { } | rng_nelem (nelem_internal ()), cache () { } | |||
Range (double b, double l, double i) | Range (double b, double l, double i) | |||
: rng_base (b), rng_limit (l), rng_inc (i), | : rng_base (b), rng_limit (l), rng_inc (i), | |||
rng_nelem (nelem_internal ()), cache () { } | rng_nelem (nelem_internal ()), cache () { } | |||
// For operators' usage (to preserve element count). | // For operators' usage (to preserve element count). | |||
Range (double b, double i, octave_idx_type n); | Range (double b, double i, octave_idx_type n) | |||
: rng_base (b), rng_limit (b + (n-1) * i), rng_inc (i), | ||||
rng_nelem (n), cache () | ||||
{ | ||||
if (! xfinite (b) || ! xfinite (i)) | ||||
rng_nelem = -2; | ||||
} | ||||
double base (void) const { return rng_base; } | double base (void) const { return rng_base; } | |||
double limit (void) const { return rng_limit; } | double limit (void) const { return rng_limit; } | |||
double inc (void) const { return rng_inc; } | double inc (void) const { return rng_inc; } | |||
octave_idx_type nelem (void) const { return rng_nelem; } | octave_idx_type nelem (void) const { return rng_nelem; } | |||
bool all_elements_are_ints (void) const; | bool all_elements_are_ints (void) const; | |||
Matrix matrix_value (void) const; | Matrix matrix_value (void) const; | |||
skipping to change at line 83 | skipping to change at line 89 | |||
Range sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0, | Range sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const; | sortmode mode = ASCENDING) const; | |||
sortmode is_sorted (sortmode mode = ASCENDING) const; | sortmode is_sorted (sortmode mode = ASCENDING) const; | |||
// Support for single-index subscripting, without generating matrix cache . | // Support for single-index subscripting, without generating matrix cache . | |||
double checkelem (octave_idx_type i) const; | double checkelem (octave_idx_type i) const; | |||
double elem (octave_idx_type i) const | double elem (octave_idx_type i) const; | |||
{ | ||||
#if defined (BOUNDS_CHECKING) | ||||
return checkelem (i); | ||||
#else | ||||
return rng_base + rng_inc * i; | ||||
#endif | ||||
} | ||||
Array<double> index (const idx_vector& i) const; | Array<double> index (const idx_vector& i) const; | |||
void set_base (double b) | void set_base (double b) | |||
{ | { | |||
if (rng_base != b) | if (rng_base != b) | |||
{ | { | |||
rng_base = b; | rng_base = b; | |||
clear_cache (); | clear_cache (); | |||
} | } | |||
skipping to change at line 121 | skipping to change at line 120 | |||
void set_inc (double i) | void set_inc (double i) | |||
{ | { | |||
if (rng_inc != i) | if (rng_inc != i) | |||
{ | { | |||
rng_inc = i; | rng_inc = i; | |||
clear_cache (); | clear_cache (); | |||
} | } | |||
} | } | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Rang | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
e& r); | const Range& r); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, Range& r); | friend OCTAVE_API std::istream& operator >> (std::istream& is, Range& r); | |||
friend OCTAVE_API Range operator - (const Range& r); | friend OCTAVE_API Range operator - (const Range& r); | |||
friend OCTAVE_API Range operator + (double x, const Range& r); | friend OCTAVE_API Range operator + (double x, const Range& r); | |||
friend OCTAVE_API Range operator + (const Range& r, double x); | friend OCTAVE_API Range operator + (const Range& r, double x); | |||
friend OCTAVE_API Range operator - (double x, const Range& r); | friend OCTAVE_API Range operator - (double x, const Range& r); | |||
friend OCTAVE_API Range operator - (const Range& r, double x); | friend OCTAVE_API Range operator - (const Range& r, double x); | |||
friend OCTAVE_API Range operator * (double x, const Range& r); | friend OCTAVE_API Range operator * (double x, const Range& r); | |||
friend OCTAVE_API Range operator * (const Range& r, double x); | friend OCTAVE_API Range operator * (const Range& r, double x); | |||
void print_range (void); | void print_range (void); | |||
private: | private: | |||
double rng_base; | double rng_base; | |||
double rng_limit; | double rng_limit; | |||
double rng_inc; | double rng_inc; | |||
octave_idx_type rng_nelem; | octave_idx_type rng_nelem; | |||
mutable Matrix cache; | mutable Matrix cache; | |||
octave_idx_type nelem_internal (void) const; | octave_idx_type nelem_internal (void) const; | |||
End of changes. 6 change blocks. | ||||
14 lines changed or deleted | 13 lines changed or added | |||
Sparse-diag-op-defs.h | Sparse-diag-op-defs.h | |||
---|---|---|---|---|
/* -*- C++ -*- | /* -*- C++ -*- | |||
Copyright (C) 2009-2012 Jason Riedy, Jaroslav Hajek | Copyright (C) 2009-2013 Jason Riedy, Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_sparse_diag_op_defs_h) | #if !defined (octave_Sparse_diag_op_defs_h) | |||
#define octave_sparse_diag_op_defs_h 1 | #define octave_Sparse_diag_op_defs_h 1 | |||
// Matrix multiplication | // Matrix multiplication | |||
template <typename RT, typename DM, typename SM> | template <typename RT, typename DM, typename SM> | |||
RT do_mul_dm_sm (const DM& d, const SM& a) | RT do_mul_dm_sm (const DM& d, const SM& a) | |||
{ | { | |||
const octave_idx_type nr = d.rows (); | const octave_idx_type nr = d.rows (); | |||
const octave_idx_type nc = d.cols (); | const octave_idx_type nc = d.cols (); | |||
const octave_idx_type a_nr = a.rows (); | const octave_idx_type a_nr = a.rows (); | |||
const octave_idx_type a_nc = a.cols (); | const octave_idx_type a_nc = a.cols (); | |||
if (nc != a_nr) | if (nc != a_nr) | |||
{ | { | |||
gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); | gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); | |||
return RT (); | return RT (); | |||
} | } | |||
else | else | |||
{ | { | |||
RT r (nr, a_nc, a.nnz ()); | RT r (nr, a_nc, a.nnz ()); | |||
octave_idx_type l = 0; | ||||
for (octave_idx_type j = 0; j < a_nc; j++) | ||||
{ | ||||
r.xcidx (j) = l; | ||||
const octave_idx_type colend = a.cidx (j+1); | ||||
for (octave_idx_type k = a.cidx (j); k < colend; k++) | ||||
{ | ||||
const octave_idx_type i = a.ridx (k); | ||||
if (i >= nr) break; | ||||
r.xdata (l) = d.dgelem (i) * a.data (k); | ||||
r.xridx (l) = i; | ||||
l++; | ||||
} | ||||
} | ||||
octave_idx_type l = 0; | r.xcidx (a_nc) = l; | |||
for (octave_idx_type j = 0; j < a_nc; j++) | r.maybe_compress (true); | |||
{ | return r; | |||
r.xcidx (j) = l; | } | |||
const octave_idx_type colend = a.cidx (j+1); | ||||
for (octave_idx_type k = a.cidx (j); k < colend; k++) | ||||
{ | ||||
const octave_idx_type i = a.ridx (k); | ||||
if (i >= nr) break; | ||||
r.xdata (l) = d.dgelem (i) * a.data (k); | ||||
r.xridx (l) = i; | ||||
l++; | ||||
} | ||||
} | ||||
r.xcidx (a_nc) = l; | ||||
r.maybe_compress (true); | ||||
return r; | ||||
} | ||||
} | } | |||
template <typename RT, typename SM, typename DM> | template <typename RT, typename SM, typename DM> | |||
RT do_mul_sm_dm (const SM& a, const DM& d) | RT do_mul_sm_dm (const SM& a, const DM& d) | |||
{ | { | |||
const octave_idx_type nr = d.rows (); | const octave_idx_type nr = d.rows (); | |||
const octave_idx_type nc = d.cols (); | const octave_idx_type nc = d.cols (); | |||
const octave_idx_type a_nr = a.rows (); | const octave_idx_type a_nr = a.rows (); | |||
const octave_idx_type a_nc = a.cols (); | const octave_idx_type a_nc = a.cols (); | |||
if (nr != a_nc) | if (nr != a_nc) | |||
{ | { | |||
gripe_nonconformant ("operator *", a_nr, a_nc, nr, nc); | gripe_nonconformant ("operator *", a_nr, a_nc, nr, nc); | |||
return RT (); | return RT (); | |||
} | } | |||
else | else | |||
{ | { | |||
const octave_idx_type mnc = nc < a_nc ? nc: a_nc; | const octave_idx_type mnc = nc < a_nc ? nc: a_nc; | |||
RT r (a_nr, nc, a.cidx (mnc)); | RT r (a_nr, nc, a.cidx (mnc)); | |||
for (octave_idx_type j = 0; j < mnc; ++j) | for (octave_idx_type j = 0; j < mnc; ++j) | |||
{ | { | |||
const typename DM::element_type s = d.dgelem (j); | const typename DM::element_type s = d.dgelem (j); | |||
const octave_idx_type colend = a.cidx (j+1); | const octave_idx_type colend = a.cidx (j+1); | |||
r.xcidx (j) = a.cidx (j); | r.xcidx (j) = a.cidx (j); | |||
for (octave_idx_type k = a.cidx (j); k < colend; ++k) | for (octave_idx_type k = a.cidx (j); k < colend; ++k) | |||
{ | { | |||
r.xdata (k) = s * a.data (k); | r.xdata (k) = s * a.data (k); | |||
r.xridx (k) = a.ridx (k); | r.xridx (k) = a.ridx (k); | |||
} | } | |||
} | } | |||
for (octave_idx_type j = mnc; j <= nc; ++j) | for (octave_idx_type j = mnc; j <= nc; ++j) | |||
r.xcidx (j) = a.cidx (mnc); | r.xcidx (j) = a.cidx (mnc); | |||
r.maybe_compress (true); | r.maybe_compress (true); | |||
return r; | return r; | |||
} | } | |||
} | } | |||
// FIXME: functors such as this should be gathered somewhere | // FIXME: functors such as this should be gathered somewhere | |||
template <typename T> | template <typename T> | |||
struct identity_val | struct identity_val | |||
: public std::unary_function <T, T> | : public std::unary_function <T, T> | |||
{ | { | |||
T operator () (const T x) { return x; } | T operator () (const T x) { return x; } | |||
}; | }; | |||
skipping to change at line 236 | skipping to change at line 236 | |||
{ | { | |||
gripe_nonconformant ("operator -", a.rows (), a.cols (), d.rows (), d .cols ()); | gripe_nonconformant ("operator -", a.rows (), a.cols (), d.rows (), d .cols ()); | |||
return RT (); | return RT (); | |||
} | } | |||
else | else | |||
return inner_do_add_sm_dm<RT> (a, d, | return inner_do_add_sm_dm<RT> (a, d, | |||
identity_val<typename SM::element_type> (), | identity_val<typename SM::element_type> (), | |||
std::negate<typename DM::element_type> ( )); | std::negate<typename DM::element_type> ( )); | |||
} | } | |||
#endif // octave_sparse_diag_op_defs_h | #endif // octave_Sparse_diag_op_defs_h | |||
End of changes. 9 change blocks. | ||||
45 lines changed or deleted | 45 lines changed or added | |||
Sparse-op-defs.h | Sparse-op-defs.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
Copyright (C) 2008 Jaroslav Hajek | Copyright (C) 2008 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
skipping to change at line 25 | skipping to change at line 25 | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_sparse_op_defs_h) | #if !defined (octave_Sparse_op_defs_h) | |||
#define octave_sparse_op_defs_h 1 | #define octave_Sparse_op_defs_h 1 | |||
#include "Array-util.h" | #include "Array-util.h" | |||
#include "mx-ops.h" | #include "mx-ops.h" | |||
#include "oct-locbuf.h" | #include "oct-locbuf.h" | |||
#include "mx-inlines.cc" | #include "mx-inlines.cc" | |||
#define SPARSE_BIN_OP_DECL(R, OP, X, Y, API) \ | #define SPARSE_BIN_OP_DECL(R, OP, X, Y, API) \ | |||
extern API R OP (const X&, const Y&) | extern API R OP (const X&, const Y&) | |||
#define SPARSE_CMP_OP_DECL(OP, X, Y, API) \ | #define SPARSE_CMP_OP_DECL(OP, X, Y, API) \ | |||
skipping to change at line 77 | skipping to change at line 77 | |||
F (const M& m, const S& s) \ | F (const M& m, const S& s) \ | |||
{ \ | { \ | |||
octave_idx_type nr = m.rows (); \ | octave_idx_type nr = m.rows (); \ | |||
octave_idx_type nc = m.cols (); \ | octave_idx_type nc = m.cols (); \ | |||
octave_idx_type nz = m.nnz (); \ | octave_idx_type nz = m.nnz (); \ | |||
\ | \ | |||
R r (nr, nc, nz); \ | R r (nr, nc, nz); \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < nz; i++) \ | for (octave_idx_type i = 0; i < nz; i++) \ | |||
{ \ | { \ | |||
r.xdata(i) = m.data(i) OP s; \ | r.xdata (i) = m.data (i) OP s; \ | |||
r.xridx(i) = m.ridx(i); \ | r.xridx (i) = m.ridx (i); \ | |||
} \ | } \ | |||
for (octave_idx_type i = 0; i < nc + 1; i++) \ | for (octave_idx_type i = 0; i < nc + 1; i++) \ | |||
r.xcidx(i) = m.cidx(i); \ | r.xcidx (i) = m.cidx (i); \ | |||
\ | \ | |||
r.maybe_compress (true); \ | r.maybe_compress (true); \ | |||
return r; \ | return r; \ | |||
} | } | |||
#define SPARSE_SMS_BIN_OPS(R1, R2, M, S) \ | #define SPARSE_SMS_BIN_OPS(R1, R2, M, S) \ | |||
SPARSE_SMS_BIN_OP_1 (R1, operator +, +, M, S) \ | SPARSE_SMS_BIN_OP_1 (R1, operator +, +, M, S) \ | |||
SPARSE_SMS_BIN_OP_1 (R1, operator -, -, M, S) \ | SPARSE_SMS_BIN_OP_1 (R1, operator -, -, M, S) \ | |||
SPARSE_SMS_BIN_OP_2 (R2, operator *, *, M, S) \ | SPARSE_SMS_BIN_OP_2 (R2, operator *, *, M, S) \ | |||
SPARSE_SMS_BIN_OP_2 (R2, operator /, /, M, S) | SPARSE_SMS_BIN_OP_2 (R2, operator /, /, M, S) | |||
skipping to change at line 117 | skipping to change at line 117 | |||
F (const M& m, const S& s) \ | F (const M& m, const S& s) \ | |||
{ \ | { \ | |||
octave_idx_type nr = m.rows (); \ | octave_idx_type nr = m.rows (); \ | |||
octave_idx_type nc = m.cols (); \ | octave_idx_type nc = m.cols (); \ | |||
SparseBoolMatrix r; \ | SparseBoolMatrix r; \ | |||
\ | \ | |||
if (MC (MZ) OP SC (s)) \ | if (MC (MZ) OP SC (s)) \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (nr, nc, true); \ | r = SparseBoolMatrix (nr, nc, true); \ | |||
for (octave_idx_type j = 0; j < nc; j++) \ | for (octave_idx_type j = 0; j < nc; j++) \ | |||
for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \ | for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \ | |||
if (! (MC (m.data (i)) OP SC (s))) \ | if (! (MC (m.data (i)) OP SC (s))) \ | |||
r.data (m.ridx (i) + j * nr) = false; \ | r.data (m.ridx (i) + j * nr) = false; \ | |||
r.maybe_compress (true); \ | r.maybe_compress (true); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (nr, nc, m.nnz ()); \ | r = SparseBoolMatrix (nr, nc, m.nnz ()); \ | |||
r.cidx (0) = static_cast<octave_idx_type> (0); \ | r.cidx (0) = static_cast<octave_idx_type> (0); \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < nc; j++) \ | for (octave_idx_type j = 0; j < nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \ | for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \ | |||
if (MC (m.data (i)) OP SC (s)) \ | if (MC (m.data (i)) OP SC (s)) \ | |||
{ \ | { \ | |||
r.ridx (nel) = m.ridx (i); \ | r.ridx (nel) = m.ridx (i); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
r.cidx (j + 1) = nel; \ | r.cidx (j + 1) = nel; \ | |||
} \ | } \ | |||
r.maybe_compress (false); \ | r.maybe_compress (false); \ | |||
} \ | } \ | |||
return r; \ | return r; \ | |||
skipping to change at line 172 | skipping to change at line 172 | |||
octave_idx_type nr = m.rows (); \ | octave_idx_type nr = m.rows (); \ | |||
octave_idx_type nc = m.cols (); \ | octave_idx_type nc = m.cols (); \ | |||
SparseBoolMatrix r; \ | SparseBoolMatrix r; \ | |||
\ | \ | |||
if (nr > 0 && nc > 0) \ | if (nr > 0 && nc > 0) \ | |||
{ \ | { \ | |||
if (LHS_ZERO OP (s != RHS_ZERO)) \ | if (LHS_ZERO OP (s != RHS_ZERO)) \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (nr, nc, true); \ | r = SparseBoolMatrix (nr, nc, true); \ | |||
for (octave_idx_type j = 0; j < nc; j++) \ | for (octave_idx_type j = 0; j < nc; j++) \ | |||
for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \ | for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \ | |||
if (! ((m.data(i) != LHS_ZERO) OP (s != RHS_ZERO))) \ | if (! ((m.data (i) != LHS_ZERO) OP (s != RHS_ZERO))) \ | |||
r.data (m.ridx (i) + j * nr) = false; \ | r.data (m.ridx (i) + j * nr) = false; \ | |||
r.maybe_compress (true); \ | r.maybe_compress (true); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (nr, nc, m.nnz ()); \ | r = SparseBoolMatrix (nr, nc, m.nnz ()); \ | |||
r.cidx (0) = static_cast<octave_idx_type> (0); \ | r.cidx (0) = static_cast<octave_idx_type> (0); \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < nc; j++) \ | for (octave_idx_type j = 0; j < nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \ | for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) | |||
if ((m.data(i) != LHS_ZERO) OP (s != RHS_ZERO)) \ | \ | |||
if ((m.data (i) != LHS_ZERO) OP (s != RHS_ZERO)) \ | ||||
{ \ | { \ | |||
r.ridx (nel) = m.ridx (i); \ | r.ridx (nel) = m.ridx (i); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
r.cidx (j + 1) = nel; \ | r.cidx (j + 1) = nel; \ | |||
} \ | } \ | |||
r.maybe_compress (false); \ | r.maybe_compress (false); \ | |||
} \ | } \ | |||
} \ | } \ | |||
return r; \ | return r; \ | |||
skipping to change at line 246 | skipping to change at line 246 | |||
F (const S& s, const M& m) \ | F (const S& s, const M& m) \ | |||
{ \ | { \ | |||
octave_idx_type nr = m.rows (); \ | octave_idx_type nr = m.rows (); \ | |||
octave_idx_type nc = m.cols (); \ | octave_idx_type nc = m.cols (); \ | |||
octave_idx_type nz = m.nnz (); \ | octave_idx_type nz = m.nnz (); \ | |||
\ | \ | |||
R r (nr, nc, nz); \ | R r (nr, nc, nz); \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < nz; i++) \ | for (octave_idx_type i = 0; i < nz; i++) \ | |||
{ \ | { \ | |||
r.xdata(i) = s OP m.data(i); \ | r.xdata (i) = s OP m.data (i); \ | |||
r.xridx(i) = m.ridx(i); \ | r.xridx (i) = m.ridx (i); \ | |||
} \ | } \ | |||
for (octave_idx_type i = 0; i < nc + 1; i++) \ | for (octave_idx_type i = 0; i < nc + 1; i++) \ | |||
r.xcidx(i) = m.cidx(i); \ | r.xcidx (i) = m.cidx (i); \ | |||
\ | \ | |||
r.maybe_compress(true); \ | r.maybe_compress(true); \ | |||
return r; \ | return r; \ | |||
} | } | |||
#define SPARSE_SSM_BIN_OPS(R1, R2, S, M) \ | #define SPARSE_SSM_BIN_OPS(R1, R2, S, M) \ | |||
SPARSE_SSM_BIN_OP_1 (R1, operator +, +, S, M) \ | SPARSE_SSM_BIN_OP_1 (R1, operator +, +, S, M) \ | |||
SPARSE_SSM_BIN_OP_1 (R1, operator -, -, S, M) \ | SPARSE_SSM_BIN_OP_1 (R1, operator -, -, S, M) \ | |||
SPARSE_SSM_BIN_OP_2 (R2, operator *, *, S, M) \ | SPARSE_SSM_BIN_OP_2 (R2, operator *, *, S, M) \ | |||
SPARSE_SSM_BIN_OP_2 (R2, operator /, /, S, M) | SPARSE_SSM_BIN_OP_2 (R2, operator /, /, S, M) | |||
skipping to change at line 286 | skipping to change at line 286 | |||
F (const S& s, const M& m) \ | F (const S& s, const M& m) \ | |||
{ \ | { \ | |||
octave_idx_type nr = m.rows (); \ | octave_idx_type nr = m.rows (); \ | |||
octave_idx_type nc = m.cols (); \ | octave_idx_type nc = m.cols (); \ | |||
SparseBoolMatrix r; \ | SparseBoolMatrix r; \ | |||
\ | \ | |||
if (SC (s) OP SC (MZ)) \ | if (SC (s) OP SC (MZ)) \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (nr, nc, true); \ | r = SparseBoolMatrix (nr, nc, true); \ | |||
for (octave_idx_type j = 0; j < nc; j++) \ | for (octave_idx_type j = 0; j < nc; j++) \ | |||
for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \ | for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \ | |||
if (! (SC (s) OP MC (m.data (i)))) \ | if (! (SC (s) OP MC (m.data (i)))) \ | |||
r.data (m.ridx (i) + j * nr) = false; \ | r.data (m.ridx (i) + j * nr) = false; \ | |||
r.maybe_compress (true); \ | r.maybe_compress (true); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (nr, nc, m.nnz ()); \ | r = SparseBoolMatrix (nr, nc, m.nnz ()); \ | |||
r.cidx (0) = static_cast<octave_idx_type> (0); \ | r.cidx (0) = static_cast<octave_idx_type> (0); \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < nc; j++) \ | for (octave_idx_type j = 0; j < nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \ | for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \ | |||
if (SC (s) OP MC (m.data (i))) \ | if (SC (s) OP MC (m.data (i))) \ | |||
{ \ | { \ | |||
r.ridx (nel) = m.ridx (i); \ | r.ridx (nel) = m.ridx (i); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
r.cidx (j + 1) = nel; \ | r.cidx (j + 1) = nel; \ | |||
} \ | } \ | |||
r.maybe_compress (false); \ | r.maybe_compress (false); \ | |||
} \ | } \ | |||
return r; \ | return r; \ | |||
skipping to change at line 341 | skipping to change at line 341 | |||
octave_idx_type nr = m.rows (); \ | octave_idx_type nr = m.rows (); \ | |||
octave_idx_type nc = m.cols (); \ | octave_idx_type nc = m.cols (); \ | |||
SparseBoolMatrix r; \ | SparseBoolMatrix r; \ | |||
\ | \ | |||
if (nr > 0 && nc > 0) \ | if (nr > 0 && nc > 0) \ | |||
{ \ | { \ | |||
if ((s != LHS_ZERO) OP RHS_ZERO) \ | if ((s != LHS_ZERO) OP RHS_ZERO) \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (nr, nc, true); \ | r = SparseBoolMatrix (nr, nc, true); \ | |||
for (octave_idx_type j = 0; j < nc; j++) \ | for (octave_idx_type j = 0; j < nc; j++) \ | |||
for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \ | for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \ | |||
if (! ((s != LHS_ZERO) OP (m.data(i) != RHS_ZERO))) \ | if (! ((s != LHS_ZERO) OP (m.data (i) != RHS_ZERO))) \ | |||
r.data (m.ridx (i) + j * nr) = false; \ | r.data (m.ridx (i) + j * nr) = false; \ | |||
r.maybe_compress (true); \ | r.maybe_compress (true); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (nr, nc, m.nnz ()); \ | r = SparseBoolMatrix (nr, nc, m.nnz ()); \ | |||
r.cidx (0) = static_cast<octave_idx_type> (0); \ | r.cidx (0) = static_cast<octave_idx_type> (0); \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < nc; j++) \ | for (octave_idx_type j = 0; j < nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \ | for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) | |||
if ((s != LHS_ZERO) OP (m.data(i) != RHS_ZERO)) \ | \ | |||
if ((s != LHS_ZERO) OP (m.data (i) != RHS_ZERO)) \ | ||||
{ \ | { \ | |||
r.ridx (nel) = m.ridx (i); \ | r.ridx (nel) = m.ridx (i); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
r.cidx (j + 1) = nel; \ | r.cidx (j + 1) = nel; \ | |||
} \ | } \ | |||
r.maybe_compress (false); \ | r.maybe_compress (false); \ | |||
} \ | } \ | |||
} \ | } \ | |||
return r; \ | return r; \ | |||
skipping to change at line 401 | skipping to change at line 401 | |||
R r; \ | R r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m1_nr == 1 && m1_nc == 1) \ | if (m1_nr == 1 && m1_nc == 1) \ | |||
{ \ | { \ | |||
if (m1.elem(0,0) == 0.) \ | if (m1.elem (0,0) == 0.) \ | |||
r = OP R (m2); \ | r = OP R (m2); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = R (m2_nr, m2_nc, m1.data(0) OP 0.); \ | r = R (m2_nr, m2_nc, m1.data (0) OP 0.); \ | |||
\ | \ | |||
for (octave_idx_type j = 0 ; j < m2_nc ; j++) \ | for (octave_idx_type j = 0 ; j < m2_nc ; j++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
octave_idx_type idxj = j * m2_nr; \ | octave_idx_type idxj = j * m2_nr; \ | |||
for (octave_idx_type i = m2.cidx(j) ; i < m2.cidx(j+1) ; i+ +) \ | for (octave_idx_type i = m2.cidx (j) ; i < m2.cidx (j+1) ; i++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
r.data(idxj + m2.ridx(i)) = m1.data(0) OP m2.data(i); \ | r.data (idxj + m2.ridx (i)) = m1.data (0) OP m2.data (i ); \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.maybe_compress (); \ | r.maybe_compress (); \ | |||
} \ | } \ | |||
} \ | } \ | |||
else if (m2_nr == 1 && m2_nc == 1) \ | else if (m2_nr == 1 && m2_nc == 1) \ | |||
{ \ | { \ | |||
if (m2.elem(0,0) == 0.) \ | if (m2.elem (0,0) == 0.) \ | |||
r = R (m1); \ | r = R (m1); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = R (m1_nr, m1_nc, 0. OP m2.data(0)); \ | r = R (m1_nr, m1_nc, 0. OP m2.data (0)); \ | |||
\ | \ | |||
for (octave_idx_type j = 0 ; j < m1_nc ; j++) \ | for (octave_idx_type j = 0 ; j < m1_nc ; j++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
octave_idx_type idxj = j * m1_nr; \ | octave_idx_type idxj = j * m1_nr; \ | |||
for (octave_idx_type i = m1.cidx(j) ; i < m1.cidx(j+1) ; i+ +) \ | for (octave_idx_type i = m1.cidx (j) ; i < m1.cidx (j+1) ; i++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
r.data(idxj + m1.ridx(i)) = m1.data(i) OP m2.data(0); \ | r.data (idxj + m1.ridx (i)) = m1.data (i) OP m2.data (0 ); \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.maybe_compress (); \ | r.maybe_compress (); \ | |||
} \ | } \ | |||
} \ | } \ | |||
else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | |||
gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = R (m1_nr, m1_nc, (m1.nnz () + m2.nnz ())); \ | r = R (m1_nr, m1_nc, (m1.nnz () + m2.nnz ())); \ | |||
\ | \ | |||
octave_idx_type jx = 0; \ | octave_idx_type jx = 0; \ | |||
r.cidx (0) = 0; \ | r.cidx (0) = 0; \ | |||
for (octave_idx_type i = 0 ; i < m1_nc ; i++) \ | for (octave_idx_type i = 0 ; i < m1_nc ; i++) \ | |||
{ \ | { \ | |||
octave_idx_type ja = m1.cidx(i); \ | octave_idx_type ja = m1.cidx (i); \ | |||
octave_idx_type ja_max = m1.cidx(i+1); \ | octave_idx_type ja_max = m1.cidx (i+1); \ | |||
bool ja_lt_max= ja < ja_max; \ | bool ja_lt_max= ja < ja_max; \ | |||
\ | \ | |||
octave_idx_type jb = m2.cidx(i); \ | octave_idx_type jb = m2.cidx (i); \ | |||
octave_idx_type jb_max = m2.cidx(i+1); \ | octave_idx_type jb_max = m2.cidx (i+1); \ | |||
bool jb_lt_max = jb < jb_max; \ | bool jb_lt_max = jb < jb_max; \ | |||
\ | \ | |||
while (ja_lt_max || jb_lt_max ) \ | while (ja_lt_max || jb_lt_max ) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
if ((! jb_lt_max) || \ | if ((! jb_lt_max) || \ | |||
(ja_lt_max && (m1.ridx(ja) < m2.ridx(jb)))) \ | (ja_lt_max && (m1.ridx (ja) < m2.ridx (jb)))) \ | |||
{ \ | { \ | |||
r.ridx(jx) = m1.ridx(ja); \ | r.ridx (jx) = m1.ridx (ja); \ | |||
r.data(jx) = m1.data(ja) OP 0.; \ | r.data (jx) = m1.data (ja) OP 0.; \ | |||
jx++; \ | jx++; \ | |||
ja++; \ | ja++; \ | |||
ja_lt_max= ja < ja_max; \ | ja_lt_max= ja < ja_max; \ | |||
} \ | } \ | |||
else if (( !ja_lt_max ) || \ | else if (( !ja_lt_max ) || \ | |||
(jb_lt_max && (m2.ridx(jb) < m1.ridx(ja)) ) ) \ | (jb_lt_max && (m2.ridx (jb) < m1.ridx (ja)) ) ) \ | |||
{ \ | { \ | |||
r.ridx(jx) = m2.ridx(jb); \ | r.ridx (jx) = m2.ridx (jb); \ | |||
r.data(jx) = 0. OP m2.data(jb); \ | r.data (jx) = 0. OP m2.data (jb); \ | |||
jx++; \ | jx++; \ | |||
jb++; \ | jb++; \ | |||
jb_lt_max= jb < jb_max; \ | jb_lt_max= jb < jb_max; \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
if ((m1.data(ja) OP m2.data(jb)) != 0.) \ | if ((m1.data (ja) OP m2.data (jb)) != 0.) \ | |||
{ \ | { \ | |||
r.data(jx) = m1.data(ja) OP m2.data(jb); \ | r.data (jx) = m1.data (ja) OP m2.data (jb); \ | |||
r.ridx(jx) = m1.ridx(ja); \ | r.ridx (jx) = m1.ridx (ja); \ | |||
jx++; \ | jx++; \ | |||
} \ | } \ | |||
ja++; \ | ja++; \ | |||
ja_lt_max= ja < ja_max; \ | ja_lt_max= ja < ja_max; \ | |||
jb++; \ | jb++; \ | |||
jb_lt_max= jb < jb_max; \ | jb_lt_max= jb < jb_max; \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.cidx(i+1) = jx; \ | r.cidx (i+1) = jx; \ | |||
} \ | } \ | |||
\ | \ | |||
r.maybe_compress (); \ | r.maybe_compress (); \ | |||
} \ | } \ | |||
\ | \ | |||
return r; \ | return r; \ | |||
} | } | |||
#define SPARSE_SMSM_BIN_OP_2(R, F, OP, M1, M2) \ | #define SPARSE_SMSM_BIN_OP_2(R, F, OP, M1, M2) \ | |||
R \ | R \ | |||
skipping to change at line 517 | skipping to change at line 517 | |||
R r; \ | R r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m1_nr == 1 && m1_nc == 1) \ | if (m1_nr == 1 && m1_nc == 1) \ | |||
{ \ | { \ | |||
if (m1.elem(0,0) == 0.) \ | if (m1.elem (0,0) == 0.) \ | |||
r = R (m2_nr, m2_nc); \ | r = R (m2_nr, m2_nc); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = R (m2); \ | r = R (m2); \ | |||
octave_idx_type m2_nnz = m2.nnz(); \ | octave_idx_type m2_nnz = m2.nnz (); \ | |||
\ | \ | |||
for (octave_idx_type i = 0 ; i < m2_nnz ; i++) \ | for (octave_idx_type i = 0 ; i < m2_nnz ; i++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
r.data (i) = m1.data(0) OP r.data(i); \ | r.data (i) = m1.data (0) OP r.data (i); \ | |||
} \ | } \ | |||
r.maybe_compress (); \ | r.maybe_compress (); \ | |||
} \ | } \ | |||
} \ | } \ | |||
else if (m2_nr == 1 && m2_nc == 1) \ | else if (m2_nr == 1 && m2_nc == 1) \ | |||
{ \ | { \ | |||
if (m2.elem(0,0) == 0.) \ | if (m2.elem (0,0) == 0.) \ | |||
r = R (m1_nr, m1_nc); \ | r = R (m1_nr, m1_nc); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = R (m1); \ | r = R (m1); \ | |||
octave_idx_type m1_nnz = m1.nnz(); \ | octave_idx_type m1_nnz = m1.nnz (); \ | |||
\ | \ | |||
for (octave_idx_type i = 0 ; i < m1_nnz ; i++) \ | for (octave_idx_type i = 0 ; i < m1_nnz ; i++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
r.data (i) = r.data(i) OP m2.data(0); \ | r.data (i) = r.data (i) OP m2.data (0); \ | |||
} \ | } \ | |||
r.maybe_compress (); \ | r.maybe_compress (); \ | |||
} \ | } \ | |||
} \ | } \ | |||
else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | |||
gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = R (m1_nr, m1_nc, (m1.nnz () > m2.nnz () ? m1.nnz () : m2.nnz () )); \ | r = R (m1_nr, m1_nc, (m1.nnz () > m2.nnz () ? m1.nnz () : m2.nnz () )); \ | |||
\ | \ | |||
octave_idx_type jx = 0; \ | octave_idx_type jx = 0; \ | |||
r.cidx (0) = 0; \ | r.cidx (0) = 0; \ | |||
for (octave_idx_type i = 0 ; i < m1_nc ; i++) \ | for (octave_idx_type i = 0 ; i < m1_nc ; i++) \ | |||
{ \ | { \ | |||
octave_idx_type ja = m1.cidx(i); \ | octave_idx_type ja = m1.cidx (i); \ | |||
octave_idx_type ja_max = m1.cidx(i+1); \ | octave_idx_type ja_max = m1.cidx (i+1); \ | |||
bool ja_lt_max= ja < ja_max; \ | bool ja_lt_max= ja < ja_max; \ | |||
\ | \ | |||
octave_idx_type jb = m2.cidx(i); \ | octave_idx_type jb = m2.cidx (i); \ | |||
octave_idx_type jb_max = m2.cidx(i+1); \ | octave_idx_type jb_max = m2.cidx (i+1); \ | |||
bool jb_lt_max = jb < jb_max; \ | bool jb_lt_max = jb < jb_max; \ | |||
\ | \ | |||
while (ja_lt_max || jb_lt_max ) \ | while (ja_lt_max || jb_lt_max ) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
if ((! jb_lt_max) || \ | if ((! jb_lt_max) || \ | |||
(ja_lt_max && (m1.ridx(ja) < m2.ridx(jb)))) \ | (ja_lt_max && (m1.ridx (ja) < m2.ridx (jb)))) \ | |||
{ \ | { \ | |||
ja++; ja_lt_max= ja < ja_max; \ | ja++; ja_lt_max= ja < ja_max; \ | |||
} \ | } \ | |||
else if (( !ja_lt_max ) || \ | else if (( !ja_lt_max ) || \ | |||
(jb_lt_max && (m2.ridx(jb) < m1.ridx(ja)) ) ) \ | (jb_lt_max && (m2.ridx (jb) < m1.ridx (ja)) ) ) \ | |||
{ \ | { \ | |||
jb++; jb_lt_max= jb < jb_max; \ | jb++; jb_lt_max= jb < jb_max; \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
if ((m1.data(ja) OP m2.data(jb)) != 0.) \ | if ((m1.data (ja) OP m2.data (jb)) != 0.) \ | |||
{ \ | { \ | |||
r.data(jx) = m1.data(ja) OP m2.data(jb); \ | r.data (jx) = m1.data (ja) OP m2.data (jb); \ | |||
r.ridx(jx) = m1.ridx(ja); \ | r.ridx (jx) = m1.ridx (ja); \ | |||
jx++; \ | jx++; \ | |||
} \ | } \ | |||
ja++; ja_lt_max= ja < ja_max; \ | ja++; ja_lt_max= ja < ja_max; \ | |||
jb++; jb_lt_max= jb < jb_max; \ | jb++; jb_lt_max= jb < jb_max; \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.cidx(i+1) = jx; \ | r.cidx (i+1) = jx; \ | |||
} \ | } \ | |||
\ | \ | |||
r.maybe_compress (); \ | r.maybe_compress (); \ | |||
} \ | } \ | |||
\ | \ | |||
return r; \ | return r; \ | |||
} | } | |||
#define SPARSE_SMSM_BIN_OP_3(R, F, OP, M1, M2) \ | #define SPARSE_SMSM_BIN_OP_3(R, F, OP, M1, M2) \ | |||
R \ | R \ | |||
skipping to change at line 615 | skipping to change at line 615 | |||
R r; \ | R r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m1_nr == 1 && m1_nc == 1) \ | if (m1_nr == 1 && m1_nc == 1) \ | |||
{ \ | { \ | |||
if ((m1.elem (0,0) OP Complex()) == Complex()) \ | if ((m1.elem (0,0) OP Complex ()) == Complex ()) \ | |||
{ \ | { \ | |||
octave_idx_type m2_nnz = m2.nnz(); \ | octave_idx_type m2_nnz = m2.nnz (); \ | |||
r = R (m2); \ | r = R (m2); \ | |||
for (octave_idx_type i = 0 ; i < m2_nnz ; i++) \ | for (octave_idx_type i = 0 ; i < m2_nnz ; i++) \ | |||
r.data (i) = m1.elem(0,0) OP r.data(i); \ | r.data (i) = m1.elem (0,0) OP r.data (i); \ | |||
r.maybe_compress (); \ | r.maybe_compress (); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = R (m2_nr, m2_nc, m1.elem(0,0) OP Complex ()); \ | r = R (m2_nr, m2_nc, m1.elem (0,0) OP Complex ()); \ | |||
for (octave_idx_type j = 0 ; j < m2_nc ; j++) \ | for (octave_idx_type j = 0 ; j < m2_nc ; j++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
octave_idx_type idxj = j * m2_nr; \ | octave_idx_type idxj = j * m2_nr; \ | |||
for (octave_idx_type i = m2.cidx(j) ; i < m2.cidx(j+1) ; i+ +) \ | for (octave_idx_type i = m2.cidx (j) ; i < m2.cidx (j+1) ; i++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
r.data(idxj + m2.ridx(i)) = m1.elem(0,0) OP m2.data(i); \ | r.data (idxj + m2.ridx (i)) = m1.elem (0,0) OP m2.data (i); \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.maybe_compress (); \ | r.maybe_compress (); \ | |||
} \ | } \ | |||
} \ | } \ | |||
else if (m2_nr == 1 && m2_nc == 1) \ | else if (m2_nr == 1 && m2_nc == 1) \ | |||
{ \ | { \ | |||
if ((Complex() OP m1.elem (0,0)) == Complex()) \ | if ((Complex () OP m1.elem (0,0)) == Complex ()) \ | |||
{ \ | { \ | |||
octave_idx_type m1_nnz = m1.nnz(); \ | octave_idx_type m1_nnz = m1.nnz (); \ | |||
r = R (m1); \ | r = R (m1); \ | |||
for (octave_idx_type i = 0 ; i < m1_nnz ; i++) \ | for (octave_idx_type i = 0 ; i < m1_nnz ; i++) \ | |||
r.data (i) = r.data(i) OP m2.elem(0,0); \ | r.data (i) = r.data (i) OP m2.elem (0,0); \ | |||
r.maybe_compress (); \ | r.maybe_compress (); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = R (m1_nr, m1_nc, Complex() OP m2.elem(0,0)); \ | r = R (m1_nr, m1_nc, Complex () OP m2.elem (0,0)); \ | |||
for (octave_idx_type j = 0 ; j < m1_nc ; j++) \ | for (octave_idx_type j = 0 ; j < m1_nc ; j++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
octave_idx_type idxj = j * m1_nr; \ | octave_idx_type idxj = j * m1_nr; \ | |||
for (octave_idx_type i = m1.cidx(j) ; i < m1.cidx(j+1) ; i+ +) \ | for (octave_idx_type i = m1.cidx (j) ; i < m1.cidx (j+1) ; i++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
r.data(idxj + m1.ridx(i)) = m1.data(i) OP m2.elem(0,0); \ | r.data (idxj + m1.ridx (i)) = m1.data (i) OP m2.elem (0 ,0); \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.maybe_compress (); \ | r.maybe_compress (); \ | |||
} \ | } \ | |||
} \ | } \ | |||
else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | |||
gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
\ | \ | |||
/* FIXME Kludge... Always double/Complex, so Complex () */ \ | /* FIXME: Kludge... Always double/Complex, so Complex () */ \ | |||
r = R (m1_nr, m1_nc, (Complex () OP Complex ())); \ | r = R (m1_nr, m1_nc, (Complex () OP Complex ())); \ | |||
\ | \ | |||
for (octave_idx_type i = 0 ; i < m1_nc ; i++) \ | for (octave_idx_type i = 0 ; i < m1_nc ; i++) \ | |||
{ \ | { \ | |||
octave_idx_type ja = m1.cidx(i); \ | octave_idx_type ja = m1.cidx (i); \ | |||
octave_idx_type ja_max = m1.cidx(i+1); \ | octave_idx_type ja_max = m1.cidx (i+1); \ | |||
bool ja_lt_max= ja < ja_max; \ | bool ja_lt_max= ja < ja_max; \ | |||
\ | \ | |||
octave_idx_type jb = m2.cidx(i); \ | octave_idx_type jb = m2.cidx (i); \ | |||
octave_idx_type jb_max = m2.cidx(i+1); \ | octave_idx_type jb_max = m2.cidx (i+1); \ | |||
bool jb_lt_max = jb < jb_max; \ | bool jb_lt_max = jb < jb_max; \ | |||
\ | \ | |||
while (ja_lt_max || jb_lt_max ) \ | while (ja_lt_max || jb_lt_max ) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
if ((! jb_lt_max) || \ | if ((! jb_lt_max) || \ | |||
(ja_lt_max && (m1.ridx(ja) < m2.ridx(jb)))) \ | (ja_lt_max && (m1.ridx (ja) < m2.ridx (jb)))) \ | |||
{ \ | { \ | |||
/* keep those kludges coming */ \ | /* keep those kludges coming */ \ | |||
r.elem(m1.ridx(ja),i) = m1.data(ja) OP Complex (); \ | r.elem (m1.ridx (ja),i) = m1.data (ja) OP Complex (); \ | |||
ja++; \ | ja++; \ | |||
ja_lt_max= ja < ja_max; \ | ja_lt_max= ja < ja_max; \ | |||
} \ | } \ | |||
else if (( !ja_lt_max ) || \ | else if (( !ja_lt_max ) || \ | |||
(jb_lt_max && (m2.ridx(jb) < m1.ridx(ja)) ) ) \ | (jb_lt_max && (m2.ridx (jb) < m1.ridx (ja)) ) ) \ | |||
{ \ | { \ | |||
/* keep those kludges coming */ \ | /* keep those kludges coming */ \ | |||
r.elem(m2.ridx(jb),i) = Complex () OP m2.data(jb); \ | r.elem (m2.ridx (jb),i) = Complex () OP m2.data (jb); \ | |||
jb++; \ | jb++; \ | |||
jb_lt_max= jb < jb_max; \ | jb_lt_max= jb < jb_max; \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r.elem(m1.ridx(ja),i) = m1.data(ja) OP m2.data(jb); \ | r.elem (m1.ridx (ja),i) = m1.data (ja) OP m2.data (jb); \ | |||
ja++; \ | ja++; \ | |||
ja_lt_max= ja < ja_max; \ | ja_lt_max= ja < ja_max; \ | |||
jb++; \ | jb++; \ | |||
jb_lt_max= jb < jb_max; \ | jb_lt_max= jb < jb_max; \ | |||
} \ | } \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.maybe_compress (true); \ | r.maybe_compress (true); \ | |||
} \ | } \ | |||
\ | \ | |||
return r; \ | return r; \ | |||
} | } | |||
// Note that SM ./ SM needs to take into account the NaN and Inf values | // Note that SM ./ SM needs to take into account the NaN and Inf values | |||
// implied by the division by zero. | // implied by the division by zero. | |||
// FIXME Are the NaNs double(NaN) or Complex(NaN,Nan) in the complex | // FIXME: Are the NaNs double(NaN) or Complex(NaN,Nan) in the complex case? | |||
// case? | ||||
#define SPARSE_SMSM_BIN_OPS(R1, R2, M1, M2) \ | #define SPARSE_SMSM_BIN_OPS(R1, R2, M1, M2) \ | |||
SPARSE_SMSM_BIN_OP_1 (R1, operator +, +, M1, M2) \ | SPARSE_SMSM_BIN_OP_1 (R1, operator +, +, M1, M2) \ | |||
SPARSE_SMSM_BIN_OP_1 (R1, operator -, -, M1, M2) \ | SPARSE_SMSM_BIN_OP_1 (R1, operator -, -, M1, M2) \ | |||
SPARSE_SMSM_BIN_OP_2 (R2, product, *, M1, M2) \ | SPARSE_SMSM_BIN_OP_2 (R2, product, *, M1, M2) \ | |||
SPARSE_SMSM_BIN_OP_3 (R2, quotient, /, M1, M2) | SPARSE_SMSM_BIN_OP_3 (R2, quotient, /, M1, M2) | |||
#define SPARSE_SMSM_CMP_OP_DECLS(M1, M2, API) \ | #define SPARSE_SMSM_CMP_OP_DECLS(M1, M2, API) \ | |||
SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \ | SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \ | |||
SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \ | SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \ | |||
SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \ | SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \ | |||
SPARSE_CMP_OP_DECL (mx_el_gt, M1, M2, API); \ | SPARSE_CMP_OP_DECL (mx_el_gt, M1, M2, API); \ | |||
SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \ | SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \ | |||
SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API); | SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API); | |||
#define SPARSE_SMSM_EQNE_OP_DECLS(M1, M2, API) \ | #define SPARSE_SMSM_EQNE_OP_DECLS(M1, M2, API) \ | |||
SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \ | SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \ | |||
SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API); | SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API); | |||
// FIXME -- this macro duplicatest the bodies of the template | // FIXME: this macro duplicates the bodies of the template functions | |||
// functions defined in the SPARSE_SSM_CMP_OP and SPARSE_SMS_CMP_OP | // defined in the SPARSE_SSM_CMP_OP and SPARSE_SMS_CMP_OP macros. | |||
// macros. | ||||
#define SPARSE_SMSM_CMP_OP(F, OP, M1, Z1, C1, M2, Z2, C2) \ | #define SPARSE_SMSM_CMP_OP(F, OP, M1, Z1, C1, M2, Z2, C2) \ | |||
SparseBoolMatrix \ | SparseBoolMatrix \ | |||
F (const M1& m1, const M2& m2) \ | F (const M1& m1, const M2& m2) \ | |||
{ \ | { \ | |||
SparseBoolMatrix r; \ | SparseBoolMatrix r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m1_nr == 1 && m1_nc == 1) \ | if (m1_nr == 1 && m1_nc == 1) \ | |||
{ \ | { \ | |||
if (C1 (m1.elem(0,0)) OP C2 (Z2)) \ | if (C1 (m1.elem (0,0)) OP C2 (Z2)) \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (m2_nr, m2_nc, true); \ | r = SparseBoolMatrix (m2_nr, m2_nc, true); \ | |||
for (octave_idx_type j = 0; j < m2_nc; j++) \ | for (octave_idx_type j = 0; j < m2_nc; j++) \ | |||
for (octave_idx_type i = m2.cidx(j); i < m2.cidx(j+1); i++) \ | for (octave_idx_type i = m2.cidx (j); i < m2.cidx (j+1); i++) | |||
if (! (C1 (m1.elem (0,0)) OP C2 (m2.data(i)))) \ | \ | |||
if (! (C1 (m1.elem (0,0)) OP C2 (m2.data (i)))) \ | ||||
r.data (m2.ridx (i) + j * m2_nr) = false; \ | r.data (m2.ridx (i) + j * m2_nr) = false; \ | |||
r.maybe_compress (true); \ | r.maybe_compress (true); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (m2_nr, m2_nc, m2.nnz ()); \ | r = SparseBoolMatrix (m2_nr, m2_nc, m2.nnz ()); \ | |||
r.cidx (0) = static_cast<octave_idx_type> (0); \ | r.cidx (0) = static_cast<octave_idx_type> (0); \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < m2_nc; j++) \ | for (octave_idx_type j = 0; j < m2_nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = m2.cidx(j); i < m2.cidx(j+1); i++) | for (octave_idx_type i = m2.cidx (j); i < m2.cidx (j+1); i+ | |||
\ | +) \ | |||
if (C1 (m1.elem (0,0)) OP C2 (m2.data(i))) \ | if (C1 (m1.elem (0,0)) OP C2 (m2.data (i))) \ | |||
{ \ | { \ | |||
r.ridx (nel) = m2.ridx (i); \ | r.ridx (nel) = m2.ridx (i); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
r.cidx (j + 1) = nel; \ | r.cidx (j + 1) = nel; \ | |||
} \ | } \ | |||
r.maybe_compress (false); \ | r.maybe_compress (false); \ | |||
} \ | } \ | |||
} \ | } \ | |||
else if (m2_nr == 1 && m2_nc == 1) \ | else if (m2_nr == 1 && m2_nc == 1) \ | |||
{ \ | { \ | |||
if (C1 (Z1) OP C2 (m2.elem (0,0))) \ | if (C1 (Z1) OP C2 (m2.elem (0,0))) \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (m1_nr, m1_nc, true); \ | r = SparseBoolMatrix (m1_nr, m1_nc, true); \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
for (octave_idx_type i = m1.cidx(j); i < m1.cidx(j+1); i++) \ | for (octave_idx_type i = m1.cidx (j); i < m1.cidx (j+1); i++) | |||
if (! (C1 (m1.data (i)) OP C2 (m2.elem(0,0)))) \ | \ | |||
if (! (C1 (m1.data (i)) OP C2 (m2.elem (0,0)))) \ | ||||
r.data (m1.ridx (i) + j * m1_nr) = false; \ | r.data (m1.ridx (i) + j * m1_nr) = false; \ | |||
r.maybe_compress (true); \ | r.maybe_compress (true); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (m1_nr, m1_nc, m1.nnz ()); \ | r = SparseBoolMatrix (m1_nr, m1_nc, m1.nnz ()); \ | |||
r.cidx (0) = static_cast<octave_idx_type> (0); \ | r.cidx (0) = static_cast<octave_idx_type> (0); \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = m1.cidx(j); i < m1.cidx(j+1); i++) | for (octave_idx_type i = m1.cidx (j); i < m1.cidx (j+1); i+ | |||
\ | +) \ | |||
if (C1 (m1.data (i)) OP C2 (m2.elem(0,0))) \ | if (C1 (m1.data (i)) OP C2 (m2.elem (0,0))) \ | |||
{ \ | { \ | |||
r.ridx (nel) = m1.ridx (i); \ | r.ridx (nel) = m1.ridx (i); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
r.cidx (j + 1) = nel; \ | r.cidx (j + 1) = nel; \ | |||
} \ | } \ | |||
r.maybe_compress (false); \ | r.maybe_compress (false); \ | |||
} \ | } \ | |||
} \ | } \ | |||
else if (m1_nr == m2_nr && m1_nc == m2_nc) \ | else if (m1_nr == m2_nr && m1_nc == m2_nc) \ | |||
skipping to change at line 829 | skipping to change at line 827 | |||
{ \ | { \ | |||
r = SparseBoolMatrix (m1_nr, m1_nc, true); \ | r = SparseBoolMatrix (m1_nr, m1_nc, true); \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
{ \ | { \ | |||
octave_idx_type i1 = m1.cidx (j); \ | octave_idx_type i1 = m1.cidx (j); \ | |||
octave_idx_type e1 = m1.cidx (j+1); \ | octave_idx_type e1 = m1.cidx (j+1); \ | |||
octave_idx_type i2 = m2.cidx (j); \ | octave_idx_type i2 = m2.cidx (j); \ | |||
octave_idx_type e2 = m2.cidx (j+1); \ | octave_idx_type e2 = m2.cidx (j+1); \ | |||
while (i1 < e1 || i2 < e2) \ | while (i1 < e1 || i2 < e2) \ | |||
{ \ | { \ | |||
if (i1 == e1 || (i2 < e2 && m1.ridx(i1) > m2.ridx( i2))) \ | if (i1 == e1 || (i2 < e2 && m1.ridx (i1) > m2.ridx (i2))) \ | |||
{ \ | { \ | |||
if (! (C1 (Z1) OP C2 (m2.data (i2)))) \ | if (! (C1 (Z1) OP C2 (m2.data (i2)))) \ | |||
r.data (m2.ridx (i2) + j * m1_nr) = false; \ | r.data (m2.ridx (i2) + j * m1_nr) = false; \ | |||
i2++; \ | i2++; \ | |||
} \ | } \ | |||
else if (i2 == e2 || m1.ridx(i1) < m2.ridx(i2)) \ | else if (i2 == e2 || m1.ridx (i1) < m2.ridx (i2)) \ | |||
{ \ | { \ | |||
if (! (C1 (m1.data (i1)) OP C2 (Z2))) \ | if (! (C1 (m1.data (i1)) OP C2 (Z2))) \ | |||
r.data (m1.ridx (i1) + j * m1_nr) = false; \ | r.data (m1.ridx (i1) + j * m1_nr) = false; \ | |||
i1++; \ | i1++; \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
if (! (C1 (m1.data (i1)) OP C2 (m2.data (i2))) ) \ | if (! (C1 (m1.data (i1)) OP C2 (m2.data (i2))) ) \ | |||
r.data (m1.ridx (i1) + j * m1_nr) = false; \ | r.data (m1.ridx (i1) + j * m1_nr) = false; \ | |||
i1++; \ | i1++; \ | |||
skipping to change at line 865 | skipping to change at line 863 | |||
r.cidx (0) = static_cast<octave_idx_type> (0); \ | r.cidx (0) = static_cast<octave_idx_type> (0); \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
{ \ | { \ | |||
octave_idx_type i1 = m1.cidx (j); \ | octave_idx_type i1 = m1.cidx (j); \ | |||
octave_idx_type e1 = m1.cidx (j+1); \ | octave_idx_type e1 = m1.cidx (j+1); \ | |||
octave_idx_type i2 = m2.cidx (j); \ | octave_idx_type i2 = m2.cidx (j); \ | |||
octave_idx_type e2 = m2.cidx (j+1); \ | octave_idx_type e2 = m2.cidx (j+1); \ | |||
while (i1 < e1 || i2 < e2) \ | while (i1 < e1 || i2 < e2) \ | |||
{ \ | { \ | |||
if (i1 == e1 || (i2 < e2 && m1.ridx(i1) > m2.ridx( i2))) \ | if (i1 == e1 || (i2 < e2 && m1.ridx (i1) > m2.ridx (i2))) \ | |||
{ \ | { \ | |||
if (C1 (Z1) OP C2 (m2.data (i2))) \ | if (C1 (Z1) OP C2 (m2.data (i2))) \ | |||
{ \ | { \ | |||
r.ridx (nel) = m2.ridx (i2); \ | r.ridx (nel) = m2.ridx (i2); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
i2++; \ | i2++; \ | |||
} \ | } \ | |||
else if (i2 == e2 || m1.ridx(i1) < m2.ridx(i2)) \ | else if (i2 == e2 || m1.ridx (i1) < m2.ridx (i2)) \ | |||
{ \ | { \ | |||
if (C1 (m1.data (i1)) OP C2 (Z2)) \ | if (C1 (m1.data (i1)) OP C2 (Z2)) \ | |||
{ \ | { \ | |||
r.ridx (nel) = m1.ridx (i1); \ | r.ridx (nel) = m1.ridx (i1); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
i1++; \ | i1++; \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
skipping to change at line 924 | skipping to change at line 922 | |||
SPARSE_SMSM_CMP_OP (mx_el_ne, !=, M1, Z1, , M2, Z2, ) | SPARSE_SMSM_CMP_OP (mx_el_ne, !=, M1, Z1, , M2, Z2, ) | |||
#define SPARSE_SMSM_EQNE_OPS(M1, Z1, C1, M2, Z2, C2) \ | #define SPARSE_SMSM_EQNE_OPS(M1, Z1, C1, M2, Z2, C2) \ | |||
SPARSE_SMSM_CMP_OP (mx_el_eq, ==, M1, Z1, , M2, Z2, ) \ | SPARSE_SMSM_CMP_OP (mx_el_eq, ==, M1, Z1, , M2, Z2, ) \ | |||
SPARSE_SMSM_CMP_OP (mx_el_ne, !=, M1, Z1, , M2, Z2, ) | SPARSE_SMSM_CMP_OP (mx_el_ne, !=, M1, Z1, , M2, Z2, ) | |||
#define SPARSE_SMSM_BOOL_OP_DECLS(M1, M2, API) \ | #define SPARSE_SMSM_BOOL_OP_DECLS(M1, M2, API) \ | |||
SPARSE_BOOL_OP_DECL (mx_el_and, M1, M2, API); \ | SPARSE_BOOL_OP_DECL (mx_el_and, M1, M2, API); \ | |||
SPARSE_BOOL_OP_DECL (mx_el_or, M1, M2, API); | SPARSE_BOOL_OP_DECL (mx_el_or, M1, M2, API); | |||
// FIXME -- this macro duplicatest the bodies of the template | // FIXME: this macro duplicates the bodies of the template functions | |||
// functions defined in the SPARSE_SSM_BOOL_OP and SPARSE_SMS_BOOL_OP | // defined in the SPARSE_SSM_BOOL_OP and SPARSE_SMS_BOOL_OP macros. | |||
// macros. | ||||
#define SPARSE_SMSM_BOOL_OP(F, OP, M1, M2, LHS_ZERO, RHS_ZERO) \ | #define SPARSE_SMSM_BOOL_OP(F, OP, M1, M2, LHS_ZERO, RHS_ZERO) \ | |||
SparseBoolMatrix \ | SparseBoolMatrix \ | |||
F (const M1& m1, const M2& m2) \ | F (const M1& m1, const M2& m2) \ | |||
{ \ | { \ | |||
SparseBoolMatrix r; \ | SparseBoolMatrix r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m1_nr == 1 && m1_nc == 1) \ | if (m1_nr == 1 && m1_nc == 1) \ | |||
{ \ | { \ | |||
if (m2_nr > 0 && m2_nc > 0) \ | if (m2_nr > 0 && m2_nc > 0) \ | |||
{ \ | { \ | |||
if ((m1.elem(0,0) != LHS_ZERO) OP RHS_ZERO) \ | if ((m1.elem (0,0) != LHS_ZERO) OP RHS_ZERO) \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (m2_nr, m2_nc, true); \ | r = SparseBoolMatrix (m2_nr, m2_nc, true); \ | |||
for (octave_idx_type j = 0; j < m2_nc; j++) \ | for (octave_idx_type j = 0; j < m2_nc; j++) \ | |||
for (octave_idx_type i = m2.cidx(j); i < m2.cidx(j+1); i+ | for (octave_idx_type i = m2.cidx (j); i < m2.cidx (j+1); | |||
+) \ | i++) \ | |||
if (! ((m1.elem(0,0) != LHS_ZERO) OP (m2.data(i) != RHS | if (! ((m1.elem (0,0) != LHS_ZERO) OP (m2.data (i) != R | |||
_ZERO))) \ | HS_ZERO))) \ | |||
r.data (m2.ridx (i) + j * m2_nr) = false; \ | r.data (m2.ridx (i) + j * m2_nr) = false; \ | |||
r.maybe_compress (true); \ | r.maybe_compress (true); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (m2_nr, m2_nc, m2.nnz ()); \ | r = SparseBoolMatrix (m2_nr, m2_nc, m2.nnz ()); \ | |||
r.cidx (0) = static_cast<octave_idx_type> (0); \ | r.cidx (0) = static_cast<octave_idx_type> (0); \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < m2_nc; j++) \ | for (octave_idx_type j = 0; j < m2_nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = m2.cidx(j); i < m2.cidx(j+1); | for (octave_idx_type i = m2.cidx (j); i < m2.cidx (j+1) | |||
i++) \ | ; i++) \ | |||
if ((m1.elem(0,0) != LHS_ZERO) OP (m2.data(i) != RHS_ | if ((m1.elem (0,0) != LHS_ZERO) OP (m2.data (i) != RH | |||
ZERO)) \ | S_ZERO)) \ | |||
{ \ | { \ | |||
r.ridx (nel) = m2.ridx (i); \ | r.ridx (nel) = m2.ridx (i); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
r.cidx (j + 1) = nel; \ | r.cidx (j + 1) = nel; \ | |||
} \ | } \ | |||
r.maybe_compress (false); \ | r.maybe_compress (false); \ | |||
} \ | } \ | |||
} \ | } \ | |||
} \ | } \ | |||
else if (m2_nr == 1 && m2_nc == 1) \ | else if (m2_nr == 1 && m2_nc == 1) \ | |||
{ \ | { \ | |||
if (m1_nr > 0 && m1_nc > 0) \ | if (m1_nr > 0 && m1_nc > 0) \ | |||
{ \ | { \ | |||
if (LHS_ZERO OP (m2.elem(0,0) != RHS_ZERO)) \ | if (LHS_ZERO OP (m2.elem (0,0) != RHS_ZERO)) \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (m1_nr, m1_nc, true); \ | r = SparseBoolMatrix (m1_nr, m1_nc, true); \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
for (octave_idx_type i = m1.cidx(j); i < m1.cidx(j+1); i+ | for (octave_idx_type i = m1.cidx (j); i < m1.cidx (j+1); | |||
+) \ | i++) \ | |||
if (! ((m1.data(i) != LHS_ZERO) OP (m2.elem(0,0) != RHS | if (! ((m1.data (i) != LHS_ZERO) OP (m2.elem (0,0) != R | |||
_ZERO))) \ | HS_ZERO))) \ | |||
r.data (m1.ridx (i) + j * m1_nr) = false; \ | r.data (m1.ridx (i) + j * m1_nr) = false; \ | |||
r.maybe_compress (true); \ | r.maybe_compress (true); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = SparseBoolMatrix (m1_nr, m1_nc, m1.nnz ()); \ | r = SparseBoolMatrix (m1_nr, m1_nc, m1.nnz ()); \ | |||
r.cidx (0) = static_cast<octave_idx_type> (0); \ | r.cidx (0) = static_cast<octave_idx_type> (0); \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = m1.cidx(j); i < m1.cidx(j+1); | for (octave_idx_type i = m1.cidx (j); i < m1.cidx (j+1) | |||
i++) \ | ; i++) \ | |||
if ((m1.data(i) != LHS_ZERO) OP (m2.elem(0,0) != RHS_ | if ((m1.data (i) != LHS_ZERO) OP (m2.elem (0,0) != RH | |||
ZERO)) \ | S_ZERO)) \ | |||
{ \ | { \ | |||
r.ridx (nel) = m1.ridx (i); \ | r.ridx (nel) = m1.ridx (i); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
r.cidx (j + 1) = nel; \ | r.cidx (j + 1) = nel; \ | |||
} \ | } \ | |||
r.maybe_compress (false); \ | r.maybe_compress (false); \ | |||
} \ | } \ | |||
} \ | } \ | |||
} \ | } \ | |||
skipping to change at line 1019 | skipping to change at line 1016 | |||
r.cidx (0) = static_cast<octave_idx_type> (0); \ | r.cidx (0) = static_cast<octave_idx_type> (0); \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
{ \ | { \ | |||
octave_idx_type i1 = m1.cidx (j); \ | octave_idx_type i1 = m1.cidx (j); \ | |||
octave_idx_type e1 = m1.cidx (j+1); \ | octave_idx_type e1 = m1.cidx (j+1); \ | |||
octave_idx_type i2 = m2.cidx (j); \ | octave_idx_type i2 = m2.cidx (j); \ | |||
octave_idx_type e2 = m2.cidx (j+1); \ | octave_idx_type e2 = m2.cidx (j+1); \ | |||
while (i1 < e1 || i2 < e2) \ | while (i1 < e1 || i2 < e2) \ | |||
{ \ | { \ | |||
if (i1 == e1 || (i2 < e2 && m1.ridx(i1) > m2.ridx(i2))) \ | if (i1 == e1 || (i2 < e2 && m1.ridx (i1) > m2.ridx (i2) )) \ | |||
{ \ | { \ | |||
if (LHS_ZERO OP m2.data (i2) != RHS_ZERO) \ | if (LHS_ZERO OP m2.data (i2) != RHS_ZERO) \ | |||
{ \ | { \ | |||
r.ridx (nel) = m2.ridx (i2); \ | r.ridx (nel) = m2.ridx (i2); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
i2++; \ | i2++; \ | |||
} \ | } \ | |||
else if (i2 == e2 || m1.ridx(i1) < m2.ridx(i2)) \ | else if (i2 == e2 || m1.ridx (i1) < m2.ridx (i2)) \ | |||
{ \ | { \ | |||
if (m1.data (i1) != LHS_ZERO OP RHS_ZERO) \ | if (m1.data (i1) != LHS_ZERO OP RHS_ZERO) \ | |||
{ \ | { \ | |||
r.ridx (nel) = m1.ridx (i1); \ | r.ridx (nel) = m1.ridx (i1); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
i1++; \ | i1++; \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
if (m1.data (i1) != LHS_ZERO OP m2.data(i2) != RHS_ ZERO) \ | if (m1.data (i1) != LHS_ZERO OP m2.data (i2) != RHS _ZERO) \ | |||
{ \ | { \ | |||
r.ridx (nel) = m1.ridx (i1); \ | r.ridx (nel) = m1.ridx (i1); \ | |||
r.data (nel++) = true; \ | r.data (nel++) = true; \ | |||
} \ | } \ | |||
i1++; \ | i1++; \ | |||
i2++; \ | i2++; \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.cidx (j + 1) = nel; \ | r.cidx (j + 1) = nel; \ | |||
} \ | } \ | |||
skipping to change at line 1094 | skipping to change at line 1091 | |||
{ \ | { \ | |||
R r; \ | R r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m2_nr == 1 && m2_nc == 1) \ | if (m2_nr == 1 && m2_nc == 1) \ | |||
r = R (m1 OP m2.elem(0,0)); \ | r = R (m1 OP m2.elem (0,0)); \ | |||
else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | |||
gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = R (F (m1, m2.matrix_value ())); \ | r = R (F (m1, m2.matrix_value ())); \ | |||
} \ | } \ | |||
return r; \ | return r; \ | |||
} | } | |||
#define SPARSE_MSM_BIN_OP_2(R, F, OP, M1, M2) \ | #define SPARSE_MSM_BIN_OP_2(R, F, OP, M1, M2) \ | |||
skipping to change at line 1117 | skipping to change at line 1114 | |||
{ \ | { \ | |||
R r; \ | R r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m2_nr == 1 && m2_nc == 1) \ | if (m2_nr == 1 && m2_nc == 1) \ | |||
r = R (m1 OP m2.elem(0,0)); \ | r = R (m1 OP m2.elem (0,0)); \ | |||
else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | |||
gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
if (do_mx_check (m1, mx_inline_all_finite<M1::element_type>)) \ | if (do_mx_check (m1, mx_inline_all_finite<M1::element_type>)) \ | |||
{ \ | { \ | |||
/* Sparsity pattern is preserved. */ \ | /* Sparsity pattern is preserved. */ \ | |||
octave_idx_type m2_nz = m2.nnz (); \ | octave_idx_type m2_nz = m2.nnz (); \ | |||
r = R (m2_nr, m2_nc, m2_nz); \ | r = R (m2_nr, m2_nc, m2_nz); \ | |||
for (octave_idx_type j = 0, k = 0; j < m2_nc; j++) \ | for (octave_idx_type j = 0, k = 0; j < m2_nc; j++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
for (octave_idx_type i = m2.cidx(j); i < m2.cidx(j+1); i++) \ | for (octave_idx_type i = m2.cidx (j); i < m2.cidx (j+1); i+ +) \ | |||
{ \ | { \ | |||
octave_idx_type mri = m2.ridx(i); \ | octave_idx_type mri = m2.ridx (i); \ | |||
R::element_type x = m1(mri, j) OP m2.data(i); \ | R::element_type x = m1(mri, j) OP m2.data (i); \ | |||
if (x != 0.0) \ | if (x != 0.0) \ | |||
{ \ | { \ | |||
r.xdata(k) = x; \ | r.xdata (k) = x; \ | |||
r.xridx(k) = m2.ridx(i); \ | r.xridx (k) = m2.ridx (i); \ | |||
k++; \ | k++; \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.xcidx(j+1) = k; \ | r.xcidx (j+1) = k; \ | |||
} \ | } \ | |||
r.maybe_compress (false); \ | r.maybe_compress (false); \ | |||
return r; \ | return r; \ | |||
} \ | } \ | |||
else \ | else \ | |||
r = R (F (m1, m2.matrix_value ())); \ | r = R (F (m1, m2.matrix_value ())); \ | |||
} \ | } \ | |||
\ | \ | |||
return r; \ | return r; \ | |||
} | } | |||
// FIXME Pass a specific ZERO value | // FIXME: Pass a specific ZERO value | |||
#define SPARSE_MSM_BIN_OPS(R1, R2, M1, M2) \ | #define SPARSE_MSM_BIN_OPS(R1, R2, M1, M2) \ | |||
SPARSE_MSM_BIN_OP_1 (R1, operator +, +, M1, M2) \ | SPARSE_MSM_BIN_OP_1 (R1, operator +, +, M1, M2) \ | |||
SPARSE_MSM_BIN_OP_1 (R1, operator -, -, M1, M2) \ | SPARSE_MSM_BIN_OP_1 (R1, operator -, -, M1, M2) \ | |||
SPARSE_MSM_BIN_OP_2 (R2, product, *, M1, M2) \ | SPARSE_MSM_BIN_OP_2 (R2, product, *, M1, M2) \ | |||
SPARSE_MSM_BIN_OP_1 (R2, quotient, /, M1, M2) | SPARSE_MSM_BIN_OP_1 (R2, quotient, /, M1, M2) | |||
#define SPARSE_MSM_CMP_OP_DECLS(M1, M2, API) \ | #define SPARSE_MSM_CMP_OP_DECLS(M1, M2, API) \ | |||
SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \ | SPARSE_CMP_OP_DECL (mx_el_lt, M1, M2, API); \ | |||
SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \ | SPARSE_CMP_OP_DECL (mx_el_le, M1, M2, API); \ | |||
SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \ | SPARSE_CMP_OP_DECL (mx_el_ge, M1, M2, API); \ | |||
skipping to change at line 1185 | skipping to change at line 1182 | |||
{ \ | { \ | |||
SparseBoolMatrix r; \ | SparseBoolMatrix r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m2_nr == 1 && m2_nc == 1) \ | if (m2_nr == 1 && m2_nc == 1) \ | |||
r = SparseBoolMatrix (F (m1, m2.elem(0,0))); \ | r = SparseBoolMatrix (F (m1, m2.elem (0,0))); \ | |||
else if (m1_nr == m2_nr && m1_nc == m2_nc) \ | else if (m1_nr == m2_nr && m1_nc == m2_nc) \ | |||
{ \ | { \ | |||
if (m1_nr != 0 || m1_nc != 0) \ | if (m1_nr != 0 || m1_nc != 0) \ | |||
{ \ | { \ | |||
/* Count num of non-zero elements */ \ | /* Count num of non-zero elements */ \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
for (octave_idx_type i = 0; i < m1_nr; i++) \ | for (octave_idx_type i = 0; i < m1_nr; i++) \ | |||
if (C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j))) \ | if (C1 (m1.elem (i, j)) OP C2 (m2.elem (i, j))) \ | |||
nel++; \ | nel++; \ | |||
\ | \ | |||
r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ | r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ | |||
\ | \ | |||
octave_idx_type ii = 0; \ | octave_idx_type ii = 0; \ | |||
r.cidx (0) = 0; \ | r.cidx (0) = 0; \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = 0; i < m1_nr; i++) \ | for (octave_idx_type i = 0; i < m1_nr; i++) \ | |||
{ \ | { \ | |||
bool el = C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j)); \ | bool el = C1 (m1.elem (i, j)) OP C2 (m2.elem (i, j)); \ | |||
if (el) \ | if (el) \ | |||
{ \ | { \ | |||
r.data(ii) = el; \ | r.data (ii) = el; \ | |||
r.ridx(ii++) = i; \ | r.ridx (ii++) = i; \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.cidx(j+1) = ii; \ | r.cidx (j+1) = ii; \ | |||
} \ | } \ | |||
} \ | } \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
if ((m1_nr != 0 || m1_nc != 0) && (m2_nr != 0 || m2_nc != 0)) \ | if ((m1_nr != 0 || m1_nc != 0) && (m2_nr != 0 || m2_nc != 0)) \ | |||
gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | |||
} \ | } \ | |||
return r; \ | return r; \ | |||
} | } | |||
skipping to change at line 1253 | skipping to change at line 1250 | |||
{ \ | { \ | |||
SparseBoolMatrix r; \ | SparseBoolMatrix r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m2_nr == 1 && m2_nc == 1) \ | if (m2_nr == 1 && m2_nc == 1) \ | |||
r = SparseBoolMatrix (F (m1, m2.elem(0,0))); \ | r = SparseBoolMatrix (F (m1, m2.elem (0,0))); \ | |||
else if (m1_nr == m2_nr && m1_nc == m2_nc) \ | else if (m1_nr == m2_nr && m1_nc == m2_nc) \ | |||
{ \ | { \ | |||
if (m1_nr != 0 || m1_nc != 0) \ | if (m1_nr != 0 || m1_nc != 0) \ | |||
{ \ | { \ | |||
/* Count num of non-zero elements */ \ | /* Count num of non-zero elements */ \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
for (octave_idx_type i = 0; i < m1_nr; i++) \ | for (octave_idx_type i = 0; i < m1_nr; i++) \ | |||
if ((m1.elem(i, j) != LHS_ZERO) \ | if ((m1.elem (i, j) != LHS_ZERO) \ | |||
OP (m2.elem(i, j) != RHS_ZERO)) \ | OP (m2.elem (i, j) != RHS_ZERO)) \ | |||
nel++; \ | nel++; \ | |||
\ | \ | |||
r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ | r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ | |||
\ | \ | |||
octave_idx_type ii = 0; \ | octave_idx_type ii = 0; \ | |||
r.cidx (0) = 0; \ | r.cidx (0) = 0; \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = 0; i < m1_nr; i++) \ | for (octave_idx_type i = 0; i < m1_nr; i++) \ | |||
{ \ | { \ | |||
bool el = (m1.elem(i, j) != LHS_ZERO) \ | bool el = (m1.elem (i, j) != LHS_ZERO) \ | |||
OP (m2.elem(i, j) != RHS_ZERO); \ | OP (m2.elem (i, j) != RHS_ZERO); \ | |||
if (el) \ | if (el) \ | |||
{ \ | { \ | |||
r.data(ii) = el; \ | r.data (ii) = el; \ | |||
r.ridx(ii++) = i; \ | r.ridx (ii++) = i; \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.cidx(j+1) = ii; \ | r.cidx (j+1) = ii; \ | |||
} \ | } \ | |||
} \ | } \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
if ((m1_nr != 0 || m1_nc != 0) && (m2_nr != 0 || m2_nc != 0)) \ | if ((m1_nr != 0 || m1_nc != 0) && (m2_nr != 0 || m2_nc != 0)) \ | |||
gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | |||
} \ | } \ | |||
return r; \ | return r; \ | |||
} | } | |||
skipping to change at line 1327 | skipping to change at line 1324 | |||
{ \ | { \ | |||
R r; \ | R r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m1_nr == 1 && m1_nc == 1) \ | if (m1_nr == 1 && m1_nc == 1) \ | |||
r = R (m1.elem(0,0) OP m2); \ | r = R (m1.elem (0,0) OP m2); \ | |||
else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | |||
gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
r = R (m1.matrix_value () OP m2); \ | r = R (m1.matrix_value () OP m2); \ | |||
} \ | } \ | |||
return r; \ | return r; \ | |||
} | } | |||
// sm .* m preserves sparsity if m contains no Infs nor Nans. | // sm .* m preserves sparsity if m contains no Infs nor Nans. | |||
skipping to change at line 1358 | skipping to change at line 1355 | |||
{ \ | { \ | |||
R r; \ | R r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m1_nr == 1 && m1_nc == 1) \ | if (m1_nr == 1 && m1_nc == 1) \ | |||
r = R (m1.elem(0,0) OP m2); \ | r = R (m1.elem (0,0) OP m2); \ | |||
else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | else if (m1_nr != m2_nr || m1_nc != m2_nc) \ | |||
gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
if (SPARSE_SMM_BIN_OP_2_CHECK_ ## F(M2::element_type)) \ | if (SPARSE_SMM_BIN_OP_2_CHECK_ ## F(M2::element_type)) \ | |||
{ \ | { \ | |||
/* Sparsity pattern is preserved. */ \ | /* Sparsity pattern is preserved. */ \ | |||
octave_idx_type m1_nz = m1.nnz (); \ | octave_idx_type m1_nz = m1.nnz (); \ | |||
r = R (m1_nr, m1_nc, m1_nz); \ | r = R (m1_nr, m1_nc, m1_nz); \ | |||
for (octave_idx_type j = 0, k = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0, k = 0; j < m1_nc; j++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
for (octave_idx_type i = m1.cidx(j); i < m1.cidx(j+1); i++) \ | for (octave_idx_type i = m1.cidx (j); i < m1.cidx (j+1); i+ +) \ | |||
{ \ | { \ | |||
octave_idx_type mri = m1.ridx(i); \ | octave_idx_type mri = m1.ridx (i); \ | |||
R::element_type x = m1.data(i) OP m2(mri, j); \ | R::element_type x = m1.data (i) OP m2 (mri, j); \ | |||
if (x != 0.0) \ | if (x != 0.0) \ | |||
{ \ | { \ | |||
r.xdata(k) = x; \ | r.xdata (k) = x; \ | |||
r.xridx(k) = m1.ridx(i); \ | r.xridx (k) = m1.ridx (i); \ | |||
k++; \ | k++; \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.xcidx(j+1) = k; \ | r.xcidx (j+1) = k; \ | |||
} \ | } \ | |||
r.maybe_compress (false); \ | r.maybe_compress (false); \ | |||
return r; \ | return r; \ | |||
} \ | } \ | |||
else \ | else \ | |||
r = R (F (m1.matrix_value (), m2)); \ | r = R (F (m1.matrix_value (), m2)); \ | |||
} \ | } \ | |||
\ | \ | |||
return r; \ | return r; \ | |||
} | } | |||
skipping to change at line 1425 | skipping to change at line 1422 | |||
{ \ | { \ | |||
SparseBoolMatrix r; \ | SparseBoolMatrix r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m1_nr == 1 && m1_nc == 1) \ | if (m1_nr == 1 && m1_nc == 1) \ | |||
r = SparseBoolMatrix (F (m1.elem(0,0), m2)); \ | r = SparseBoolMatrix (F (m1.elem (0,0), m2)); \ | |||
else if (m1_nr == m2_nr && m1_nc == m2_nc) \ | else if (m1_nr == m2_nr && m1_nc == m2_nc) \ | |||
{ \ | { \ | |||
if (m1_nr != 0 || m1_nc != 0) \ | if (m1_nr != 0 || m1_nc != 0) \ | |||
{ \ | { \ | |||
/* Count num of non-zero elements */ \ | /* Count num of non-zero elements */ \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
for (octave_idx_type i = 0; i < m1_nr; i++) \ | for (octave_idx_type i = 0; i < m1_nr; i++) \ | |||
if (C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j))) \ | if (C1 (m1.elem (i, j)) OP C2 (m2.elem (i, j))) \ | |||
nel++; \ | nel++; \ | |||
\ | \ | |||
r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ | r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ | |||
\ | \ | |||
octave_idx_type ii = 0; \ | octave_idx_type ii = 0; \ | |||
r.cidx (0) = 0; \ | r.cidx (0) = 0; \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = 0; i < m1_nr; i++) \ | for (octave_idx_type i = 0; i < m1_nr; i++) \ | |||
{ \ | { \ | |||
bool el = C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j)); \ | bool el = C1 (m1.elem (i, j)) OP C2 (m2.elem (i, j)); \ | |||
if (el) \ | if (el) \ | |||
{ \ | { \ | |||
r.data(ii) = el; \ | r.data (ii) = el; \ | |||
r.ridx(ii++) = i; \ | r.ridx (ii++) = i; \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.cidx(j+1) = ii; \ | r.cidx (j+1) = ii; \ | |||
} \ | } \ | |||
} \ | } \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
if ((m1_nr != 0 || m1_nc != 0) && (m2_nr != 0 || m2_nc != 0)) \ | if ((m1_nr != 0 || m1_nc != 0) && (m2_nr != 0 || m2_nc != 0)) \ | |||
gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | |||
} \ | } \ | |||
return r; \ | return r; \ | |||
} | } | |||
skipping to change at line 1493 | skipping to change at line 1490 | |||
{ \ | { \ | |||
SparseBoolMatrix r; \ | SparseBoolMatrix r; \ | |||
\ | \ | |||
octave_idx_type m1_nr = m1.rows (); \ | octave_idx_type m1_nr = m1.rows (); \ | |||
octave_idx_type m1_nc = m1.cols (); \ | octave_idx_type m1_nc = m1.cols (); \ | |||
\ | \ | |||
octave_idx_type m2_nr = m2.rows (); \ | octave_idx_type m2_nr = m2.rows (); \ | |||
octave_idx_type m2_nc = m2.cols (); \ | octave_idx_type m2_nc = m2.cols (); \ | |||
\ | \ | |||
if (m1_nr == 1 && m1_nc == 1) \ | if (m1_nr == 1 && m1_nc == 1) \ | |||
r = SparseBoolMatrix (F (m1.elem(0,0), m2)); \ | r = SparseBoolMatrix (F (m1.elem (0,0), m2)); \ | |||
else if (m1_nr == m2_nr && m1_nc == m2_nc) \ | else if (m1_nr == m2_nr && m1_nc == m2_nc) \ | |||
{ \ | { \ | |||
if (m1_nr != 0 || m1_nc != 0) \ | if (m1_nr != 0 || m1_nc != 0) \ | |||
{ \ | { \ | |||
/* Count num of non-zero elements */ \ | /* Count num of non-zero elements */ \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
for (octave_idx_type i = 0; i < m1_nr; i++) \ | for (octave_idx_type i = 0; i < m1_nr; i++) \ | |||
if ((m1.elem(i, j) != LHS_ZERO) \ | if ((m1.elem (i, j) != LHS_ZERO) \ | |||
OP (m2.elem(i, j) != RHS_ZERO)) \ | OP (m2.elem (i, j) != RHS_ZERO)) \ | |||
nel++; \ | nel++; \ | |||
\ | \ | |||
r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ | r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ | |||
\ | \ | |||
octave_idx_type ii = 0; \ | octave_idx_type ii = 0; \ | |||
r.cidx (0) = 0; \ | r.cidx (0) = 0; \ | |||
for (octave_idx_type j = 0; j < m1_nc; j++) \ | for (octave_idx_type j = 0; j < m1_nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = 0; i < m1_nr; i++) \ | for (octave_idx_type i = 0; i < m1_nr; i++) \ | |||
{ \ | { \ | |||
bool el = (m1.elem(i, j) != LHS_ZERO) \ | bool el = (m1.elem (i, j) != LHS_ZERO) \ | |||
OP (m2.elem(i, j) != RHS_ZERO); \ | OP (m2.elem (i, j) != RHS_ZERO); \ | |||
if (el) \ | if (el) \ | |||
{ \ | { \ | |||
r.data(ii) = el; \ | r.data (ii) = el; \ | |||
r.ridx(ii++) = i; \ | r.ridx (ii++) = i; \ | |||
} \ | } \ | |||
} \ | } \ | |||
r.cidx(j+1) = ii; \ | r.cidx (j+1) = ii; \ | |||
} \ | } \ | |||
} \ | } \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
if ((m1_nr != 0 || m1_nc != 0) && (m2_nr != 0 || m2_nc != 0)) \ | if ((m1_nr != 0 || m1_nc != 0) && (m2_nr != 0 || m2_nc != 0)) \ | |||
gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ | |||
} \ | } \ | |||
return r; \ | return r; \ | |||
} | } | |||
skipping to change at line 1568 | skipping to change at line 1565 | |||
/* Ugly!! Is there a better way? */ \ | /* Ugly!! Is there a better way? */ \ | |||
retval = transpose (). FCN (0) .transpose (); \ | retval = transpose (). FCN (0) .transpose (); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type i = 0; i < nc; i++) \ | for (octave_idx_type i = 0; i < nc; i++) \ | |||
{ \ | { \ | |||
ELT_TYPE t = ELT_TYPE (); \ | ELT_TYPE t = ELT_TYPE (); \ | |||
for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \ | for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \ | |||
{ \ | { \ | |||
t += data(j); \ | t += data (j); \ | |||
if (t != ELT_TYPE ()) \ | if (t != ELT_TYPE ()) \ | |||
{ \ | { \ | |||
if (j == cidx(i+1) - 1) \ | if (j == cidx (i+1) - 1) \ | |||
nel += nr - ridx(j); \ | nel += nr - ridx (j); \ | |||
else \ | else \ | |||
nel += ridx(j+1) - ridx(j); \ | nel += ridx (j+1) - ridx (j); \ | |||
} \ | } \ | |||
} \ | } \ | |||
} \ | } \ | |||
retval = RET_TYPE (nr, nc, nel); \ | retval = RET_TYPE (nr, nc, nel); \ | |||
retval.cidx(0) = 0; \ | retval.cidx (0) = 0; \ | |||
octave_idx_type ii = 0; \ | octave_idx_type ii = 0; \ | |||
for (octave_idx_type i = 0; i < nc; i++) \ | for (octave_idx_type i = 0; i < nc; i++) \ | |||
{ \ | { \ | |||
ELT_TYPE t = ELT_TYPE (); \ | ELT_TYPE t = ELT_TYPE (); \ | |||
for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \ | for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \ | |||
{ \ | { \ | |||
t += data(j); \ | t += data (j); \ | |||
if (t != ELT_TYPE ()) \ | if (t != ELT_TYPE ()) \ | |||
{ \ | { \ | |||
if (j == cidx(i+1) - 1) \ | if (j == cidx (i+1) - 1) \ | |||
{ \ | { \ | |||
for (octave_idx_type k = ridx(j); k < nr; k++) \ | for (octave_idx_type k = ridx (j); k < nr; k++) \ | |||
{ \ | { \ | |||
retval.data (ii) = t; \ | retval.data (ii) = t; \ | |||
retval.ridx (ii++) = k; \ | retval.ridx (ii++) = k; \ | |||
} \ | } \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
for (octave_idx_type k = ridx(j); k < ridx(j+1); k++) \ | for (octave_idx_type k = ridx (j); k < ridx (j+1) ; k++) \ | |||
{ \ | { \ | |||
retval.data (ii) = t; \ | retval.data (ii) = t; \ | |||
retval.ridx (ii++) = k; \ | retval.ridx (ii++) = k; \ | |||
} \ | } \ | |||
} \ | } \ | |||
} \ | } \ | |||
} \ | } \ | |||
retval.cidx(i+1) = ii; \ | retval.cidx (i+1) = ii; \ | |||
} \ | } \ | |||
} \ | } \ | |||
} \ | } \ | |||
else \ | else \ | |||
retval = RET_TYPE (nr,nc); \ | retval = RET_TYPE (nr,nc); \ | |||
\ | \ | |||
return retval | return retval | |||
#define SPARSE_CUMPROD(RET_TYPE, ELT_TYPE, FCN) \ | #define SPARSE_CUMPROD(RET_TYPE, ELT_TYPE, FCN) \ | |||
\ | \ | |||
skipping to change at line 1636 | skipping to change at line 1633 | |||
/* Ugly!! Is there a better way? */ \ | /* Ugly!! Is there a better way? */ \ | |||
retval = transpose (). FCN (0) .transpose (); \ | retval = transpose (). FCN (0) .transpose (); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type i = 0; i < nc; i++) \ | for (octave_idx_type i = 0; i < nc; i++) \ | |||
{ \ | { \ | |||
octave_idx_type jj = 0; \ | octave_idx_type jj = 0; \ | |||
for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \ | for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \ | |||
{ \ | { \ | |||
if (jj == ridx(j)) \ | if (jj == ridx (j)) \ | |||
{ \ | { \ | |||
nel++; \ | nel++; \ | |||
jj++; \ | jj++; \ | |||
} \ | } \ | |||
else \ | else \ | |||
break; \ | break; \ | |||
} \ | } \ | |||
} \ | } \ | |||
retval = RET_TYPE (nr, nc, nel); \ | retval = RET_TYPE (nr, nc, nel); \ | |||
retval.cidx(0) = 0; \ | retval.cidx (0) = 0; \ | |||
octave_idx_type ii = 0; \ | octave_idx_type ii = 0; \ | |||
for (octave_idx_type i = 0; i < nc; i++) \ | for (octave_idx_type i = 0; i < nc; i++) \ | |||
{ \ | { \ | |||
ELT_TYPE t = ELT_TYPE (1.); \ | ELT_TYPE t = ELT_TYPE (1.); \ | |||
octave_idx_type jj = 0; \ | octave_idx_type jj = 0; \ | |||
for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \ | for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \ | |||
{ \ | { \ | |||
if (jj == ridx(j)) \ | if (jj == ridx (j)) \ | |||
{ \ | { \ | |||
t *= data(j); \ | t *= data (j); \ | |||
retval.data(ii) = t; \ | retval.data (ii) = t; \ | |||
retval.ridx(ii++) = jj++; \ | retval.ridx (ii++) = jj++; \ | |||
} \ | } \ | |||
else \ | else \ | |||
break; \ | break; \ | |||
} \ | } \ | |||
retval.cidx(i+1) = ii; \ | retval.cidx (i+1) = ii; \ | |||
} \ | } \ | |||
} \ | } \ | |||
} \ | } \ | |||
else \ | else \ | |||
retval = RET_TYPE (nr,nc); \ | retval = RET_TYPE (nr,nc); \ | |||
\ | \ | |||
return retval | return retval | |||
#define SPARSE_BASE_REDUCTION_OP(RET_TYPE, EL_TYPE, ROW_EXPR, COL_EXPR, \ | #define SPARSE_BASE_REDUCTION_OP(RET_TYPE, EL_TYPE, ROW_EXPR, COL_EXPR, \ | |||
INIT_VAL, MT_RESULT) \ | INIT_VAL, MT_RESULT) \ | |||
skipping to change at line 1692 | skipping to change at line 1689 | |||
if ((nr == 1 && dim == -1) || dim == 1) \ | if ((nr == 1 && dim == -1) || dim == 1) \ | |||
{ \ | { \ | |||
/* Define j here to allow fancy definition for prod method */ \ | /* Define j here to allow fancy definition for prod method */ \ | |||
octave_idx_type j = 0; \ | octave_idx_type j = 0; \ | |||
OCTAVE_LOCAL_BUFFER (EL_TYPE, tmp, nr); \ | OCTAVE_LOCAL_BUFFER (EL_TYPE, tmp, nr); \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < nr; i++) \ | for (octave_idx_type i = 0; i < nr; i++) \ | |||
tmp[i] = INIT_VAL; \ | tmp[i] = INIT_VAL; \ | |||
for (j = 0; j < nc; j++) \ | for (j = 0; j < nc; j++) \ | |||
{ \ | { \ | |||
for (octave_idx_type i = cidx(j); i < cidx(j + 1); i++) \ | for (octave_idx_type i = cidx (j); i < cidx (j + 1); i++) \ | |||
{ \ | { \ | |||
ROW_EXPR; \ | ROW_EXPR; \ | |||
} \ | } \ | |||
} \ | } \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type i = 0; i < nr; i++) \ | for (octave_idx_type i = 0; i < nr; i++) \ | |||
if (tmp[i] != EL_TYPE ()) \ | if (tmp[i] != EL_TYPE ()) \ | |||
nel++ ; \ | nel++ ; \ | |||
retval = RET_TYPE (nr, static_cast<octave_idx_type> (1), nel); \ | retval = RET_TYPE (nr, static_cast<octave_idx_type> (1), nel); \ | |||
retval.cidx(0) = 0; \ | retval.cidx (0) = 0; \ | |||
retval.cidx(1) = nel; \ | retval.cidx (1) = nel; \ | |||
nel = 0; \ | nel = 0; \ | |||
for (octave_idx_type i = 0; i < nr; i++) \ | for (octave_idx_type i = 0; i < nr; i++) \ | |||
if (tmp[i] != EL_TYPE ()) \ | if (tmp[i] != EL_TYPE ()) \ | |||
{ \ | { \ | |||
retval.data(nel) = tmp[i]; \ | retval.data (nel) = tmp[i]; \ | |||
retval.ridx(nel++) = i; \ | retval.ridx (nel++) = i; \ | |||
} \ | } \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
OCTAVE_LOCAL_BUFFER (EL_TYPE, tmp, nc); \ | OCTAVE_LOCAL_BUFFER (EL_TYPE, tmp, nc); \ | |||
\ | \ | |||
for (octave_idx_type j = 0; j < nc; j++) \ | for (octave_idx_type j = 0; j < nc; j++) \ | |||
{ \ | { \ | |||
tmp[j] = INIT_VAL; \ | tmp[j] = INIT_VAL; \ | |||
for (octave_idx_type i = cidx(j); i < cidx(j + 1); i++) \ | for (octave_idx_type i = cidx (j); i < cidx (j + 1); i++) \ | |||
{ \ | { \ | |||
COL_EXPR; \ | COL_EXPR; \ | |||
} \ | } \ | |||
} \ | } \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
for (octave_idx_type i = 0; i < nc; i++) \ | for (octave_idx_type i = 0; i < nc; i++) \ | |||
if (tmp[i] != EL_TYPE ()) \ | if (tmp[i] != EL_TYPE ()) \ | |||
nel++ ; \ | nel++ ; \ | |||
retval = RET_TYPE (static_cast<octave_idx_type> (1), nc, nel); \ | retval = RET_TYPE (static_cast<octave_idx_type> (1), nc, nel); \ | |||
retval.cidx(0) = 0; \ | retval.cidx (0) = 0; \ | |||
nel = 0; \ | nel = 0; \ | |||
for (octave_idx_type i = 0; i < nc; i++) \ | for (octave_idx_type i = 0; i < nc; i++) \ | |||
if (tmp[i] != EL_TYPE ()) \ | if (tmp[i] != EL_TYPE ()) \ | |||
{ \ | { \ | |||
retval.data(nel) = tmp[i]; \ | retval.data (nel) = tmp[i]; \ | |||
retval.ridx(nel++) = 0; \ | retval.ridx (nel++) = 0; \ | |||
retval.cidx(i+1) = retval.cidx(i) + 1; \ | retval.cidx (i+1) = retval.cidx (i) + 1; \ | |||
} \ | } \ | |||
else \ | else \ | |||
retval.cidx(i+1) = retval.cidx(i); \ | retval.cidx (i+1) = retval.cidx (i); \ | |||
} \ | } \ | |||
} \ | } \ | |||
else if (nc == 0 && (nr == 0 || (nr == 1 && dim == -1))) \ | else if (nc == 0 && (nr == 0 || (nr == 1 && dim == -1))) \ | |||
{ \ | { \ | |||
if (MT_RESULT) \ | if (MT_RESULT) \ | |||
{ \ | { \ | |||
retval = RET_TYPE (static_cast<octave_idx_type> (1), \ | retval = RET_TYPE (static_cast<octave_idx_type> (1), \ | |||
static_cast<octave_idx_type> (1), \ | static_cast<octave_idx_type> (1), \ | |||
static_cast<octave_idx_type> (1)); \ | static_cast<octave_idx_type> (1)); \ | |||
retval.cidx(0) = 0; \ | retval.cidx (0) = 0; \ | |||
retval.cidx(1) = 1; \ | retval.cidx (1) = 1; \ | |||
retval.ridx(0) = 0; \ | retval.ridx (0) = 0; \ | |||
retval.data(0) = MT_RESULT; \ | retval.data (0) = MT_RESULT; \ | |||
} \ | } \ | |||
else \ | else \ | |||
retval = RET_TYPE (static_cast<octave_idx_type> (1), \ | retval = RET_TYPE (static_cast<octave_idx_type> (1), \ | |||
static_cast<octave_idx_type> (1), \ | static_cast<octave_idx_type> (1), \ | |||
static_cast<octave_idx_type> (0)); \ | static_cast<octave_idx_type> (0)); \ | |||
} \ | } \ | |||
else if (nr == 0 && (dim == 0 || dim == -1)) \ | else if (nr == 0 && (dim == 0 || dim == -1)) \ | |||
{ \ | { \ | |||
if (MT_RESULT) \ | if (MT_RESULT) \ | |||
{ \ | { \ | |||
retval = RET_TYPE (static_cast<octave_idx_type> (1), nc, nc); \ | retval = RET_TYPE (static_cast<octave_idx_type> (1), nc, nc); \ | |||
retval.cidx (0) = 0; \ | retval.cidx (0) = 0; \ | |||
for (octave_idx_type i = 0; i < nc ; i++) \ | for (octave_idx_type i = 0; i < nc ; i++) \ | |||
{ \ | { \ | |||
retval.ridx (i) = 0; \ | retval.ridx (i) = 0; \ | |||
retval.cidx (i+1) = i; \ | retval.cidx (i+1) = i+1; \ | |||
retval.data (i) = MT_RESULT; \ | retval.data (i) = MT_RESULT; \ | |||
} \ | } \ | |||
} \ | } \ | |||
else \ | else \ | |||
retval = RET_TYPE (static_cast<octave_idx_type> (1), nc, \ | retval = RET_TYPE (static_cast<octave_idx_type> (1), nc, \ | |||
static_cast<octave_idx_type> (0)); \ | static_cast<octave_idx_type> (0)); \ | |||
} \ | } \ | |||
else if (nc == 0 && dim == 1) \ | else if (nc == 0 && dim == 1) \ | |||
{ \ | { \ | |||
if (MT_RESULT) \ | if (MT_RESULT) \ | |||
{ \ | { \ | |||
retval = RET_TYPE (nr, static_cast<octave_idx_type> (1), nr); \ | retval = RET_TYPE (nr, static_cast<octave_idx_type> (1), nr); \ | |||
retval.cidx(0) = 0; \ | retval.cidx (0) = 0; \ | |||
retval.cidx(1) = nr; \ | retval.cidx (1) = nr; \ | |||
for (octave_idx_type i = 0; i < nr; i++) \ | for (octave_idx_type i = 0; i < nr; i++) \ | |||
{ \ | { \ | |||
retval.ridx(i) = i; \ | retval.ridx (i) = i; \ | |||
retval.data(i) = MT_RESULT; \ | retval.data (i) = MT_RESULT; \ | |||
} \ | } \ | |||
} \ | } \ | |||
else \ | else \ | |||
retval = RET_TYPE (nr, static_cast<octave_idx_type> (1), \ | retval = RET_TYPE (nr, static_cast<octave_idx_type> (1), \ | |||
static_cast<octave_idx_type> (0)); \ | static_cast<octave_idx_type> (0)); \ | |||
} \ | } \ | |||
else \ | else \ | |||
retval.resize (nr > 0, nc > 0); \ | retval.resize (nr > 0, nc > 0); \ | |||
\ | \ | |||
return retval | return retval | |||
#define SPARSE_REDUCTION_OP_ROW_EXPR(OP) \ | #define SPARSE_REDUCTION_OP_ROW_EXPR(OP) \ | |||
tmp[ridx(i)] OP data (i) | tmp[ridx (i)] OP data (i) | |||
#define SPARSE_REDUCTION_OP_COL_EXPR(OP) \ | #define SPARSE_REDUCTION_OP_COL_EXPR(OP) \ | |||
tmp[j] OP data (i) | tmp[j] OP data (i) | |||
#define SPARSE_REDUCTION_OP(RET_TYPE, EL_TYPE, OP, INIT_VAL, MT_RESULT) \ | #define SPARSE_REDUCTION_OP(RET_TYPE, EL_TYPE, OP, INIT_VAL, MT_RESULT) \ | |||
SPARSE_BASE_REDUCTION_OP (RET_TYPE, EL_TYPE, \ | SPARSE_BASE_REDUCTION_OP (RET_TYPE, EL_TYPE, \ | |||
SPARSE_REDUCTION_OP_ROW_EXPR (OP), \ | SPARSE_REDUCTION_OP_ROW_EXPR (OP), \ | |||
SPARSE_REDUCTION_OP_COL_EXPR (OP), \ | SPARSE_REDUCTION_OP_COL_EXPR (OP), \ | |||
INIT_VAL, MT_RESULT) | INIT_VAL, MT_RESULT) | |||
// Don't break from this loop if the test succeeds because | // Don't break from this loop if the test succeeds because | |||
// we are looping over the rows and not the columns in the inner | // we are looping over the rows and not the columns in the inner loop. | |||
// loop. | ||||
#define SPARSE_ANY_ALL_OP_ROW_CODE(TEST_OP, TEST_TRUE_VAL) \ | #define SPARSE_ANY_ALL_OP_ROW_CODE(TEST_OP, TEST_TRUE_VAL) \ | |||
if (data (i) TEST_OP 0.0) \ | if (data (i) TEST_OP 0.0) \ | |||
tmp[ridx(i)] = TEST_TRUE_VAL; \ | tmp[ridx (i)] = TEST_TRUE_VAL; \ | |||
#define SPARSE_ANY_ALL_OP_COL_CODE(TEST_OP, TEST_TRUE_VAL) \ | #define SPARSE_ANY_ALL_OP_COL_CODE(TEST_OP, TEST_TRUE_VAL) \ | |||
if (data (i) TEST_OP 0.0) \ | if (data (i) TEST_OP 0.0) \ | |||
{ \ | { \ | |||
tmp[j] = TEST_TRUE_VAL; \ | tmp[j] = TEST_TRUE_VAL; \ | |||
break; \ | break; \ | |||
} | } | |||
#define SPARSE_ANY_ALL_OP(DIM, INIT_VAL, MT_RESULT, TEST_OP, TEST_TRUE_VAL) \ | #define SPARSE_ANY_ALL_OP(DIM, INIT_VAL, MT_RESULT, TEST_OP, TEST_TRUE_VAL) \ | |||
SPARSE_BASE_REDUCTION_OP (SparseBoolMatrix, char, \ | SPARSE_BASE_REDUCTION_OP (SparseBoolMatrix, char, \ | |||
SPARSE_ANY_ALL_OP_ROW_CODE (TEST_OP, TEST_TRUE_VAL) , \ | SPARSE_ANY_ALL_OP_ROW_CODE (TEST_OP, TEST_TRUE_VAL) , \ | |||
SPARSE_ANY_ALL_OP_COL_CODE (TEST_OP, TEST_TRUE_VAL) , \ | SPARSE_ANY_ALL_OP_COL_CODE (TEST_OP, TEST_TRUE_VAL) , \ | |||
INIT_VAL, MT_RESULT) | INIT_VAL, MT_RESULT) | |||
#define SPARSE_ALL_OP(DIM) \ | #define SPARSE_ALL_OP(DIM) \ | |||
if ((rows() == 1 && dim == -1) || dim == 1) \ | if ((rows () == 1 && dim == -1) || dim == 1) \ | |||
return transpose (). all (0). transpose(); \ | return transpose (). all (0). transpose (); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
SPARSE_ANY_ALL_OP (DIM, (cidx(j+1) - cidx(j) < nr ? false : true), \ | SPARSE_ANY_ALL_OP (DIM, (cidx (j+1) - cidx (j) < nr ? false : true), \ | |||
true, ==, false); \ | true, ==, false); \ | |||
} | } | |||
#define SPARSE_ANY_OP(DIM) SPARSE_ANY_ALL_OP (DIM, false, false, !=, true) | #define SPARSE_ANY_OP(DIM) SPARSE_ANY_ALL_OP (DIM, false, false, !=, true) | |||
#define SPARSE_SPARSE_MUL( RET_TYPE, RET_EL_TYPE, EL_TYPE ) \ | #define SPARSE_SPARSE_MUL( RET_TYPE, RET_EL_TYPE, EL_TYPE ) \ | |||
octave_idx_type nr = m.rows (); \ | octave_idx_type nr = m.rows (); \ | |||
octave_idx_type nc = m.cols (); \ | octave_idx_type nc = m.cols (); \ | |||
\ | \ | |||
octave_idx_type a_nr = a.rows (); \ | octave_idx_type a_nr = a.rows (); \ | |||
octave_idx_type a_nc = a.cols (); \ | octave_idx_type a_nc = a.cols (); \ | |||
\ | \ | |||
if (nr == 1 && nc == 1) \ | if (nr == 1 && nc == 1) \ | |||
{ \ | { \ | |||
RET_EL_TYPE s = m.elem(0,0); \ | RET_EL_TYPE s = m.elem (0,0); \ | |||
octave_idx_type nz = a.nnz(); \ | octave_idx_type nz = a.nnz (); \ | |||
RET_TYPE r (a_nr, a_nc, nz); \ | RET_TYPE r (a_nr, a_nc, nz); \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < nz; i++) \ | for (octave_idx_type i = 0; i < nz; i++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
r.data(i) = s * a.data(i); \ | r.data (i) = s * a.data (i); \ | |||
r.ridx(i) = a.ridx(i); \ | r.ridx (i) = a.ridx (i); \ | |||
} \ | } \ | |||
for (octave_idx_type i = 0; i < a_nc + 1; i++) \ | for (octave_idx_type i = 0; i < a_nc + 1; i++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
r.cidx(i) = a.cidx(i); \ | r.cidx (i) = a.cidx (i); \ | |||
} \ | } \ | |||
\ | \ | |||
r.maybe_compress (true); \ | r.maybe_compress (true); \ | |||
return r; \ | return r; \ | |||
} \ | } \ | |||
else if (a_nr == 1 && a_nc == 1) \ | else if (a_nr == 1 && a_nc == 1) \ | |||
{ \ | { \ | |||
RET_EL_TYPE s = a.elem(0,0); \ | RET_EL_TYPE s = a.elem (0,0); \ | |||
octave_idx_type nz = m.nnz(); \ | octave_idx_type nz = m.nnz (); \ | |||
RET_TYPE r (nr, nc, nz); \ | RET_TYPE r (nr, nc, nz); \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < nz; i++) \ | for (octave_idx_type i = 0; i < nz; i++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
r.data(i) = m.data(i) * s; \ | r.data (i) = m.data (i) * s; \ | |||
r.ridx(i) = m.ridx(i); \ | r.ridx (i) = m.ridx (i); \ | |||
} \ | } \ | |||
for (octave_idx_type i = 0; i < nc + 1; i++) \ | for (octave_idx_type i = 0; i < nc + 1; i++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
r.cidx(i) = m.cidx(i); \ | r.cidx (i) = m.cidx (i); \ | |||
} \ | } \ | |||
\ | \ | |||
r.maybe_compress (true); \ | r.maybe_compress (true); \ | |||
return r; \ | return r; \ | |||
} \ | } \ | |||
else if (nc != a_nr) \ | else if (nc != a_nr) \ | |||
{ \ | { \ | |||
gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); \ | gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); \ | |||
return RET_TYPE (); \ | return RET_TYPE (); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, w, nr); \ | OCTAVE_LOCAL_BUFFER (octave_idx_type, w, nr); \ | |||
RET_TYPE retval (nr, a_nc, static_cast<octave_idx_type> (0)); \ | RET_TYPE retval (nr, a_nc, static_cast<octave_idx_type> (0)); \ | |||
for (octave_idx_type i = 0; i < nr; i++) \ | for (octave_idx_type i = 0; i < nr; i++) \ | |||
w[i] = 0; \ | w[i] = 0; \ | |||
retval.xcidx(0) = 0; \ | retval.xcidx (0) = 0; \ | |||
\ | \ | |||
octave_idx_type nel = 0; \ | octave_idx_type nel = 0; \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < a_nc; i++) \ | for (octave_idx_type i = 0; i < a_nc; i++) \ | |||
{ \ | { \ | |||
for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) \ | for (octave_idx_type j = a.cidx (i); j < a.cidx (i+1); j++) \ | |||
{ \ | { \ | |||
octave_idx_type col = a.ridx(j); \ | octave_idx_type col = a.ridx (j); \ | |||
for (octave_idx_type k = m.cidx(col) ; k < m.cidx(col+1); k++ | for (octave_idx_type k = m.cidx (col) ; k < m.cidx (col+1); k | |||
) \ | ++) \ | |||
{ \ | { \ | |||
if (w[m.ridx(k)] < i + 1) \ | if (w[m.ridx (k)] < i + 1) \ | |||
{ \ | { \ | |||
w[m.ridx(k)] = i + 1; \ | w[m.ridx (k)] = i + 1; \ | |||
nel++; \ | nel++; \ | |||
} \ | } \ | |||
octave_quit (); \ | octave_quit (); \ | |||
} \ | } \ | |||
} \ | } \ | |||
retval.xcidx(i+1) = nel; \ | retval.xcidx (i+1) = nel; \ | |||
} \ | } \ | |||
\ | \ | |||
if (nel == 0) \ | if (nel == 0) \ | |||
return RET_TYPE (nr, a_nc); \ | return RET_TYPE (nr, a_nc); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
for (octave_idx_type i = 0; i < nr; i++) \ | for (octave_idx_type i = 0; i < nr; i++) \ | |||
w[i] = 0; \ | w[i] = 0; \ | |||
\ | \ | |||
OCTAVE_LOCAL_BUFFER (RET_EL_TYPE, Xcol, nr); \ | OCTAVE_LOCAL_BUFFER (RET_EL_TYPE, Xcol, nr); \ | |||
skipping to change at line 1947 | skipping to change at line 1943 | |||
/* simulation with random square matrices and the observation */ \ | /* simulation with random square matrices and the observation */ \ | |||
/* of the number of non-zero elements in the output matrix */ \ | /* of the number of non-zero elements in the output matrix */ \ | |||
/* it was found that the breakpoints were */ \ | /* it was found that the breakpoints were */ \ | |||
/* nr: 500 1000 2000 5000 10000 */ \ | /* nr: 500 1000 2000 5000 10000 */ \ | |||
/* nz: 6 25 97 585 2202 */ \ | /* nz: 6 25 97 585 2202 */ \ | |||
/* The below is a simplication of the 'polyfit'-ed parameters */ \ | /* The below is a simplication of the 'polyfit'-ed parameters */ \ | |||
/* to these breakpoints */ \ | /* to these breakpoints */ \ | |||
octave_idx_type n_per_col = (a_nc > 43000 ? 43000 : \ | octave_idx_type n_per_col = (a_nc > 43000 ? 43000 : \ | |||
(a_nc * a_nc) / 43000); \ | (a_nc * a_nc) / 43000); \ | |||
octave_idx_type ii = 0; \ | octave_idx_type ii = 0; \ | |||
octave_idx_type *ri = retval.xridx(); \ | octave_idx_type *ri = retval.xridx (); \ | |||
octave_sort<octave_idx_type> sort; \ | octave_sort<octave_idx_type> sort; \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < a_nc ; i++) \ | for (octave_idx_type i = 0; i < a_nc ; i++) \ | |||
{ \ | { \ | |||
if (retval.xcidx(i+1) - retval.xcidx(i) > n_per_col) \ | if (retval.xcidx (i+1) - retval.xcidx (i) > n_per_col) \ | |||
{ \ | { \ | |||
for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) \ | for (octave_idx_type j = a.cidx (i); j < a.cidx (i+1); j+ +) \ | |||
{ \ | { \ | |||
octave_idx_type col = a.ridx(j); \ | octave_idx_type col = a.ridx (j); \ | |||
EL_TYPE tmpval = a.data(j); \ | EL_TYPE tmpval = a.data (j); \ | |||
for (octave_idx_type k = m.cidx(col) ; \ | for (octave_idx_type k = m.cidx (col) ; \ | |||
k < m.cidx(col+1); k++) \ | k < m.cidx (col+1); k++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
octave_idx_type row = m.ridx(k); \ | octave_idx_type row = m.ridx (k); \ | |||
if (w[row] < i + 1) \ | if (w[row] < i + 1) \ | |||
{ \ | { \ | |||
w[row] = i + 1; \ | w[row] = i + 1; \ | |||
Xcol[row] = tmpval * m.data(k); \ | Xcol[row] = tmpval * m.data (k); \ | |||
} \ | } \ | |||
else \ | else \ | |||
Xcol[row] += tmpval * m.data(k); \ | Xcol[row] += tmpval * m.data (k); \ | |||
} \ | } \ | |||
} \ | } \ | |||
for (octave_idx_type k = 0; k < nr; k++) \ | for (octave_idx_type k = 0; k < nr; k++) \ | |||
if (w[k] == i + 1) \ | if (w[k] == i + 1) \ | |||
{ \ | { \ | |||
retval.xdata(ii) = Xcol[k]; \ | retval.xdata (ii) = Xcol[k]; \ | |||
retval.xridx(ii++) = k; \ | retval.xridx (ii++) = k; \ | |||
} \ | } \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) \ | for (octave_idx_type j = a.cidx (i); j < a.cidx (i+1); j+ +) \ | |||
{ \ | { \ | |||
octave_idx_type col = a.ridx(j); \ | octave_idx_type col = a.ridx (j); \ | |||
EL_TYPE tmpval = a.data(j); \ | EL_TYPE tmpval = a.data (j); \ | |||
for (octave_idx_type k = m.cidx(col) ; \ | for (octave_idx_type k = m.cidx (col) ; \ | |||
k < m.cidx(col+1); k++) \ | k < m.cidx (col+1); k++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
octave_idx_type row = m.ridx(k); \ | octave_idx_type row = m.ridx (k); \ | |||
if (w[row] < i + 1) \ | if (w[row] < i + 1) \ | |||
{ \ | { \ | |||
w[row] = i + 1; \ | w[row] = i + 1; \ | |||
retval.xridx(ii++) = row;\ | retval.xridx (ii++) = row;\ | |||
Xcol[row] = tmpval * m.data(k); \ | Xcol[row] = tmpval * m.data (k); \ | |||
} \ | } \ | |||
else \ | else \ | |||
Xcol[row] += tmpval * m.data(k); \ | Xcol[row] += tmpval * m.data (k); \ | |||
} \ | } \ | |||
} \ | } \ | |||
sort.sort (ri + retval.xcidx(i), ii - retval.xcidx(i)); \ | sort.sort (ri + retval.xcidx (i), ii - retval.xcidx (i)); | |||
for (octave_idx_type k = retval.xcidx(i); k < ii; k++) \ | \ | |||
retval.xdata(k) = Xcol[retval.xridx(k)]; \ | for (octave_idx_type k = retval.xcidx (i); k < ii; k++) \ | |||
retval.xdata (k) = Xcol[retval.xridx (k)]; \ | ||||
} \ | } \ | |||
} \ | } \ | |||
retval.maybe_compress (true);\ | retval.maybe_compress (true);\ | |||
return retval; \ | return retval; \ | |||
} \ | } \ | |||
} | } | |||
#define SPARSE_FULL_MUL( RET_TYPE, EL_TYPE, ZERO ) \ | #define SPARSE_FULL_MUL( RET_TYPE, EL_TYPE, ZERO ) \ | |||
octave_idx_type nr = m.rows (); \ | octave_idx_type nr = m.rows (); \ | |||
octave_idx_type nc = m.cols (); \ | octave_idx_type nc = m.cols (); \ | |||
skipping to change at line 2037 | skipping to change at line 2033 | |||
else \ | else \ | |||
{ \ | { \ | |||
RET_TYPE retval (nr, a_nc, ZERO); \ | RET_TYPE retval (nr, a_nc, ZERO); \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < a_nc ; i++) \ | for (octave_idx_type i = 0; i < a_nc ; i++) \ | |||
{ \ | { \ | |||
for (octave_idx_type j = 0; j < a_nr; j++) \ | for (octave_idx_type j = 0; j < a_nr; j++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
\ | \ | |||
EL_TYPE tmpval = a.elem(j,i); \ | EL_TYPE tmpval = a.elem (j,i); \ | |||
for (octave_idx_type k = m.cidx(j) ; k < m.cidx(j+1); k++) \ | for (octave_idx_type k = m.cidx (j) ; k < m.cidx (j+1); k++) | |||
retval.elem (m.ridx(k),i) += tmpval * m.data(k); \ | \ | |||
retval.elem (m.ridx (k),i) += tmpval * m.data (k); \ | ||||
} \ | } \ | |||
} \ | } \ | |||
return retval; \ | return retval; \ | |||
} | } | |||
#define SPARSE_FULL_TRANS_MUL( RET_TYPE, EL_TYPE, ZERO, CONJ_OP ) \ | #define SPARSE_FULL_TRANS_MUL( RET_TYPE, EL_TYPE, ZERO, CONJ_OP ) \ | |||
octave_idx_type nr = m.rows (); \ | octave_idx_type nr = m.rows (); \ | |||
octave_idx_type nc = m.cols (); \ | octave_idx_type nc = m.cols (); \ | |||
\ | \ | |||
octave_idx_type a_nr = a.rows (); \ | octave_idx_type a_nr = a.rows (); \ | |||
octave_idx_type a_nc = a.cols (); \ | octave_idx_type a_nc = a.cols (); \ | |||
\ | \ | |||
if (nr == 1 && nc == 1) \ | if (nr == 1 && nc == 1) \ | |||
{ \ | { \ | |||
RET_TYPE retval = CONJ_OP (m.elem(0,0)) * a; \ | RET_TYPE retval = CONJ_OP (m.elem (0,0)) * a; \ | |||
return retval; \ | return retval; \ | |||
} \ | } \ | |||
else if (nr != a_nr) \ | else if (nr != a_nr) \ | |||
{ \ | { \ | |||
gripe_nonconformant ("operator *", nc, nr, a_nr, a_nc); \ | gripe_nonconformant ("operator *", nc, nr, a_nr, a_nc); \ | |||
return RET_TYPE (); \ | return RET_TYPE (); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
RET_TYPE retval (nc, a_nc); \ | RET_TYPE retval (nc, a_nc); \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < a_nc ; i++) \ | for (octave_idx_type i = 0; i < a_nc ; i++) \ | |||
{ \ | { \ | |||
for (octave_idx_type j = 0; j < nc; j++) \ | for (octave_idx_type j = 0; j < nc; j++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
\ | \ | |||
EL_TYPE acc = ZERO; \ | EL_TYPE acc = ZERO; \ | |||
for (octave_idx_type k = m.cidx(j) ; k < m.cidx(j+1); k++) \ | for (octave_idx_type k = m.cidx (j) ; k < m.cidx (j+1); k++) | |||
acc += a.elem (m.ridx(k),i) * CONJ_OP (m.data(k)); \ | \ | |||
acc += a.elem (m.ridx (k),i) * CONJ_OP (m.data (k)); \ | ||||
retval.xelem (j,i) = acc; \ | retval.xelem (j,i) = acc; \ | |||
} \ | } \ | |||
} \ | } \ | |||
return retval; \ | return retval; \ | |||
} | } | |||
#define FULL_SPARSE_MUL( RET_TYPE, EL_TYPE, ZERO ) \ | #define FULL_SPARSE_MUL( RET_TYPE, EL_TYPE, ZERO ) \ | |||
octave_idx_type nr = m.rows (); \ | octave_idx_type nr = m.rows (); \ | |||
octave_idx_type nc = m.cols (); \ | octave_idx_type nc = m.cols (); \ | |||
\ | \ | |||
skipping to change at line 2105 | skipping to change at line 2101 | |||
gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); \ | gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); \ | |||
return RET_TYPE (); \ | return RET_TYPE (); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
RET_TYPE retval (nr, a_nc, ZERO); \ | RET_TYPE retval (nr, a_nc, ZERO); \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < a_nc ; i++) \ | for (octave_idx_type i = 0; i < a_nc ; i++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) \ | for (octave_idx_type j = a.cidx (i); j < a.cidx (i+1); j++) \ | |||
{ \ | { \ | |||
octave_idx_type col = a.ridx(j); \ | octave_idx_type col = a.ridx (j); \ | |||
EL_TYPE tmpval = a.data(j); \ | EL_TYPE tmpval = a.data (j); \ | |||
\ | \ | |||
for (octave_idx_type k = 0 ; k < nr; k++) \ | for (octave_idx_type k = 0 ; k < nr; k++) \ | |||
retval.xelem (k,i) += tmpval * m.elem(k,col); \ | retval.xelem (k,i) += tmpval * m.elem (k,col); \ | |||
} \ | } \ | |||
} \ | } \ | |||
return retval; \ | return retval; \ | |||
} | } | |||
#define FULL_SPARSE_MUL_TRANS( RET_TYPE, EL_TYPE, ZERO, CONJ_OP ) \ | #define FULL_SPARSE_MUL_TRANS( RET_TYPE, EL_TYPE, ZERO, CONJ_OP ) \ | |||
octave_idx_type nr = m.rows (); \ | octave_idx_type nr = m.rows (); \ | |||
octave_idx_type nc = m.cols (); \ | octave_idx_type nc = m.cols (); \ | |||
\ | \ | |||
octave_idx_type a_nr = a.rows (); \ | octave_idx_type a_nr = a.rows (); \ | |||
octave_idx_type a_nc = a.cols (); \ | octave_idx_type a_nc = a.cols (); \ | |||
\ | \ | |||
if (a_nr == 1 && a_nc == 1) \ | if (a_nr == 1 && a_nc == 1) \ | |||
{ \ | { \ | |||
RET_TYPE retval = m * CONJ_OP (a.elem(0,0)); \ | RET_TYPE retval = m * CONJ_OP (a.elem (0,0)); \ | |||
return retval; \ | return retval; \ | |||
} \ | } \ | |||
else if (nc != a_nc) \ | else if (nc != a_nc) \ | |||
{ \ | { \ | |||
gripe_nonconformant ("operator *", nr, nc, a_nc, a_nr); \ | gripe_nonconformant ("operator *", nr, nc, a_nc, a_nr); \ | |||
return RET_TYPE (); \ | return RET_TYPE (); \ | |||
} \ | } \ | |||
else \ | else \ | |||
{ \ | { \ | |||
RET_TYPE retval (nr, a_nr, ZERO); \ | RET_TYPE retval (nr, a_nr, ZERO); \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < a_nc ; i++) \ | for (octave_idx_type i = 0; i < a_nc ; i++) \ | |||
{ \ | { \ | |||
octave_quit (); \ | octave_quit (); \ | |||
for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) \ | for (octave_idx_type j = a.cidx (i); j < a.cidx (i+1); j++) \ | |||
{ \ | { \ | |||
octave_idx_type col = a.ridx(j); \ | octave_idx_type col = a.ridx (j); \ | |||
EL_TYPE tmpval = CONJ_OP (a.data(j)); \ | EL_TYPE tmpval = CONJ_OP (a.data (j)); \ | |||
for (octave_idx_type k = 0 ; k < nr; k++) \ | for (octave_idx_type k = 0 ; k < nr; k++) \ | |||
retval.xelem (k,col) += tmpval * m.elem(k,i); \ | retval.xelem (k,col) += tmpval * m.elem (k,i); \ | |||
} \ | } \ | |||
} \ | } \ | |||
return retval; \ | return retval; \ | |||
} | } | |||
#endif | #endif | |||
End of changes. 184 change blocks. | ||||
271 lines changed or deleted | 274 lines changed or added | |||
Sparse-perm-op-defs.h | Sparse-perm-op-defs.h | |||
---|---|---|---|---|
/* -*- C++ -*- | /* -*- C++ -*- | |||
Copyright (C) 2009-2012 Jason Riedy | Copyright (C) 2009-2013 Jason Riedy | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_sparse_perm_op_defs_h) | #if !defined (octave_Sparse_perm_op_defs_h) | |||
#define octave_sparse_perm_op_defs_h 1 | #define octave_Sparse_perm_op_defs_h 1 | |||
// Matrix multiplication | // Matrix multiplication | |||
template <typename SM> | template <typename SM> | |||
SM octinternal_do_mul_colpm_sm (const octave_idx_type *pcol, const SM& a) | SM octinternal_do_mul_colpm_sm (const octave_idx_type *pcol, const SM& a) | |||
// Relabel the rows according to pcol. | // Relabel the rows according to pcol. | |||
{ | { | |||
const octave_idx_type nr = a.rows (); | const octave_idx_type nr = a.rows (); | |||
const octave_idx_type nc = a.cols (); | const octave_idx_type nc = a.cols (); | |||
const octave_idx_type nent = a.nnz (); | const octave_idx_type nent = a.nnz (); | |||
skipping to change at line 46 | skipping to change at line 46 | |||
octave_sort<octave_idx_type> sort; | octave_sort<octave_idx_type> sort; | |||
for (octave_idx_type j = 0; j <= nc; ++j) | for (octave_idx_type j = 0; j <= nc; ++j) | |||
r.xcidx (j) = a.cidx (j); | r.xcidx (j) = a.cidx (j); | |||
for (octave_idx_type j = 0; j < nc; j++) | for (octave_idx_type j = 0; j < nc; j++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, sidx, r.xcidx(j+1) - r.xcidx(j) | OCTAVE_LOCAL_BUFFER (octave_idx_type, sidx, r.xcidx (j+1) - r.xcidx ( | |||
); | j)); | |||
for (octave_idx_type i = r.xcidx(j), ii = 0; i < r.xcidx(j+1); i++) | for (octave_idx_type i = r.xcidx (j), ii = 0; i < r.xcidx (j+1); i++) | |||
{ | { | |||
sidx[ii++]=i; | sidx[ii++]=i; | |||
r.xridx (i) = pcol[a.ridx (i)]; | r.xridx (i) = pcol[a.ridx (i)]; | |||
} | } | |||
sort.sort (r.xridx() + r.xcidx(j), sidx, r.xcidx(j+1) - r.xcidx(j)); | sort.sort (r.xridx () + r.xcidx (j), sidx, r.xcidx (j+1) - r.xcidx (j | |||
for (octave_idx_type i = r.xcidx(j), ii = 0; i < r.xcidx(j+1); i++) | )); | |||
r.xdata(i) = a.data (sidx[ii++]); | for (octave_idx_type i = r.xcidx (j), ii = 0; i < r.xcidx (j+1); i++) | |||
r.xdata (i) = a.data (sidx[ii++]); | ||||
} | } | |||
return r; | return r; | |||
} | } | |||
template <typename SM> | template <typename SM> | |||
SM octinternal_do_mul_pm_sm (const PermMatrix& p, const SM& a) | SM octinternal_do_mul_pm_sm (const PermMatrix& p, const SM& a) | |||
{ | { | |||
const octave_idx_type nr = a.rows (); | const octave_idx_type nr = a.rows (); | |||
if (p.cols () != nr) | if (p.cols () != nr) | |||
{ | { | |||
gripe_nonconformant ("operator *", p.rows (), p.cols (), a.rows (), a .cols ()); | gripe_nonconformant ("operator *", p.rows (), p.cols (), a.rows (), a .cols ()); | |||
return SM (); | return SM (); | |||
} | } | |||
if (p.is_row_perm ()) | if (p.is_row_perm ()) | |||
{ | { | |||
// Form the column permutation and then call the colpm_sm routine. | // Form the column permutation and then call the colpm_sm routine. | |||
const octave_idx_type *prow = p.pvec ().data (); | const octave_idx_type *prow = p.pvec ().data (); | |||
OCTAVE_LOCAL_BUFFER(octave_idx_type, pcol, nr); | OCTAVE_LOCAL_BUFFER (octave_idx_type, pcol, nr); | |||
for (octave_idx_type i = 0; i < nr; ++i) | for (octave_idx_type i = 0; i < nr; ++i) | |||
pcol[prow[i]] = i; | pcol[prow[i]] = i; | |||
return octinternal_do_mul_colpm_sm (pcol, a); | return octinternal_do_mul_colpm_sm (pcol, a); | |||
} | } | |||
else | else | |||
return octinternal_do_mul_colpm_sm (p.pvec ().data (), a); | return octinternal_do_mul_colpm_sm (p.pvec ().data (), a); | |||
} | } | |||
template <typename SM> | template <typename SM> | |||
SM octinternal_do_mul_sm_rowpm (const SM& a, const octave_idx_type *prow) | SM octinternal_do_mul_sm_rowpm (const SM& a, const octave_idx_type *prow) | |||
skipping to change at line 172 | skipping to change at line 172 | |||
gripe_nonconformant ("operator *", a.rows (), a.cols (), p.rows (), p .cols ()); | gripe_nonconformant ("operator *", a.rows (), a.cols (), p.rows (), p .cols ()); | |||
return SM (); | return SM (); | |||
} | } | |||
if (p.is_row_perm ()) | if (p.is_row_perm ()) | |||
return octinternal_do_mul_sm_rowpm (a, p.pvec ().data ()); | return octinternal_do_mul_sm_rowpm (a, p.pvec ().data ()); | |||
else | else | |||
return octinternal_do_mul_sm_colpm (a, p.pvec ().data ()); | return octinternal_do_mul_sm_colpm (a, p.pvec ().data ()); | |||
} | } | |||
#endif // octave_sparse_perm_op_defs_h | #endif // octave_Sparse_perm_op_defs_h | |||
End of changes. 6 change blocks. | ||||
10 lines changed or deleted | 11 lines changed or added | |||
Sparse.h | Sparse.h | |||
---|---|---|---|---|
// Template sparse classes | // Template sparse classes | |||
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
skipping to change at line 74 | skipping to change at line 74 | |||
public: | public: | |||
T *d; | T *d; | |||
octave_idx_type *r; | octave_idx_type *r; | |||
octave_idx_type *c; | octave_idx_type *c; | |||
octave_idx_type nzmx; | octave_idx_type nzmx; | |||
octave_idx_type nrows; | octave_idx_type nrows; | |||
octave_idx_type ncols; | octave_idx_type ncols; | |||
octave_refcount<int> count; | octave_refcount<int> count; | |||
SparseRep (void) : d (0), r (0), c (new octave_idx_type [1]), nzmx (0), | SparseRep (void) | |||
nrows (0), | : d (0), r (0), c (new octave_idx_type [1]), nzmx (0), nrows (0), | |||
ncols (0), count (1) { c[0] = 0; } | ncols (0), count (1) | |||
{ | ||||
SparseRep (octave_idx_type n) : d (0), r (0), c (new octave_idx_type [n | c[0] = 0; | |||
+1]), nzmx (0), nrows (n), | } | |||
ncols (n), count (1) | ||||
{ | ||||
for (octave_idx_type i = 0; i < n + 1; i++) | ||||
c[i] = 0; | ||||
} | ||||
SparseRep (octave_idx_type nr, octave_idx_type nc) : d (0), r (0), c (n | SparseRep (octave_idx_type n) | |||
ew octave_idx_type [nc+1]), nzmx (0), | : d (0), r (0), c (new octave_idx_type [n+1]), nzmx (0), nrows (n), | |||
nrows (nr), ncols (nc), count (1) | ncols (n), count (1) | |||
{ | { | |||
for (octave_idx_type i = 0; i < nc + 1; i++) | for (octave_idx_type i = 0; i < n + 1; i++) | |||
c[i] = 0; | c[i] = 0; | |||
} | } | |||
SparseRep (octave_idx_type nr, octave_idx_type nc, octave_idx_type nz) | SparseRep (octave_idx_type nr, octave_idx_type nc, octave_idx_type nz = | |||
: d (new T [nz]), | 0) | |||
r (new octave_idx_type [nz]), c (new octave_idx_type [nc+1]), nzmx (n | : d (nz > 0 ? new T [nz] : 0), | |||
z), nrows (nr), | r (nz > 0 ? new octave_idx_type [nz] : 0), | |||
ncols (nc), count (1) | c (new octave_idx_type [nc+1]), nzmx (nz), nrows (nr), | |||
{ | ncols (nc), count (1) | |||
for (octave_idx_type i = 0; i < nc + 1; i++) | { | |||
c[i] = 0; | for (octave_idx_type i = 0; i < nc + 1; i++) | |||
} | c[i] = 0; | |||
} | ||||
SparseRep (const SparseRep& a) | SparseRep (const SparseRep& a) | |||
: d (new T [a.nzmx]), r (new octave_idx_type [a.nzmx]), c (new octave | : d (new T [a.nzmx]), r (new octave_idx_type [a.nzmx]), | |||
_idx_type [a.ncols + 1]), | c (new octave_idx_type [a.ncols + 1]), | |||
nzmx (a.nzmx), nrows (a.nrows), ncols (a.ncols), count (1) | nzmx (a.nzmx), nrows (a.nrows), ncols (a.ncols), count (1) | |||
{ | { | |||
octave_idx_type nz = a.nnz (); | octave_idx_type nz = a.nnz (); | |||
copy_or_memcpy (nz, a.d, d); | copy_or_memcpy (nz, a.d, d); | |||
copy_or_memcpy (nz, a.r, r); | copy_or_memcpy (nz, a.r, r); | |||
copy_or_memcpy (ncols + 1, a.c, c); | copy_or_memcpy (ncols + 1, a.c, c); | |||
} | } | |||
~SparseRep (void) { delete [] d; delete [] r; delete [] c; } | ~SparseRep (void) { delete [] d; delete [] r; delete [] c; } | |||
octave_idx_type length (void) const { return nzmx; } | octave_idx_type length (void) const { return nzmx; } | |||
octave_idx_type nnz (void) const { return c [ncols]; } | octave_idx_type nnz (void) const { return c[ncols]; } | |||
T& elem (octave_idx_type _r, octave_idx_type _c); | T& elem (octave_idx_type _r, octave_idx_type _c); | |||
T celem (octave_idx_type _r, octave_idx_type _c) const; | T celem (octave_idx_type _r, octave_idx_type _c) const; | |||
T& data (octave_idx_type i) { return d[i]; } | T& data (octave_idx_type i) { return d[i]; } | |||
T cdata (octave_idx_type i) const { return d[i]; } | T cdata (octave_idx_type i) const { return d[i]; } | |||
octave_idx_type& ridx (octave_idx_type i) { return r[i]; } | octave_idx_type& ridx (octave_idx_type i) { return r[i]; } | |||
skipping to change at line 147 | skipping to change at line 148 | |||
private: | private: | |||
// No assignment! | // No assignment! | |||
SparseRep& operator = (const SparseRep& a); | SparseRep& operator = (const SparseRep& a); | |||
}; | }; | |||
//-------------------------------------------------------------------- | //-------------------------------------------------------------------- | |||
void make_unique (void) | void make_unique (void) | |||
{ | { | |||
if (rep->count > 1) | if (rep->count > 1) | |||
{ | { | |||
SparseRep *r = new SparseRep (*rep); | SparseRep *r = new SparseRep (*rep); | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = r; | rep = r; | |||
} | } | |||
} | } | |||
public: | public: | |||
// !!! WARNING !!! -- these should be protected, not public. You | // !!! WARNING !!! -- these should be protected, not public. You | |||
// should not access these data members directly! | // should not access these data members directly! | |||
typename Sparse<T>::SparseRep *rep; | typename Sparse<T>::SparseRep *rep; | |||
dim_vector dimensions; | dim_vector dimensions; | |||
private: | private: | |||
typename Sparse<T>::SparseRep *nil_rep (void) const | typename Sparse<T>::SparseRep *nil_rep (void) const | |||
{ | { | |||
static typename Sparse<T>::SparseRep nr; | static typename Sparse<T>::SparseRep nr; | |||
return &nr; | return &nr; | |||
} | } | |||
public: | public: | |||
Sparse (void) | Sparse (void) | |||
: rep (nil_rep ()), dimensions (dim_vector(0,0)) | : rep (nil_rep ()), dimensions (dim_vector(0,0)) | |||
{ | { | |||
rep->count++; | rep->count++; | |||
} | } | |||
explicit Sparse (octave_idx_type n) | explicit Sparse (octave_idx_type n) | |||
: rep (new typename Sparse<T>::SparseRep (n)), | : rep (new typename Sparse<T>::SparseRep (n)), | |||
dimensions (dim_vector (n, n)) { } | dimensions (dim_vector (n, n)) { } | |||
explicit Sparse (octave_idx_type nr, octave_idx_type nc) | explicit Sparse (octave_idx_type nr, octave_idx_type nc) | |||
: rep (new typename Sparse<T>::SparseRep (nr, nc)), | : rep (new typename Sparse<T>::SparseRep (nr, nc)), | |||
dimensions (dim_vector (nr, nc)) { } | dimensions (dim_vector (nr, nc)) { } | |||
explicit Sparse (octave_idx_type nr, octave_idx_type nc, T val); | explicit Sparse (octave_idx_type nr, octave_idx_type nc, T val); | |||
Sparse (const dim_vector& dv, octave_idx_type nz) | Sparse (const dim_vector& dv, octave_idx_type nz) | |||
: rep (new typename Sparse<T>::SparseRep (dv(0), dv(1), nz)), | : rep (new typename Sparse<T>::SparseRep (dv(0), dv(1), nz)), | |||
dimensions (dv) { } | dimensions (dv) { } | |||
Sparse (octave_idx_type nr, octave_idx_type nc, octave_idx_type nz) | Sparse (octave_idx_type nr, octave_idx_type nc, octave_idx_type nz) | |||
: rep (new typename Sparse<T>::SparseRep (nr, nc, nz)), | : rep (new typename Sparse<T>::SparseRep (nr, nc, nz)), | |||
dimensions (dim_vector (nr, nc)) { } | dimensions (dim_vector (nr, nc)) { } | |||
// Both SparseMatrix and SparseBoolMatrix need this ctor, and this | // Both SparseMatrix and SparseBoolMatrix need this ctor, and this | |||
// is their only common ancestor. | // is their only common ancestor. | |||
explicit Sparse (const PermMatrix& a); | explicit Sparse (const PermMatrix& a); | |||
// Type conversion case. Preserves capacity (). | // Type conversion case. Preserves capacity (). | |||
template <class U> | template <class U> | |||
Sparse (const Sparse<U>& a) | Sparse (const Sparse<U>& a) | |||
: rep (new typename Sparse<T>::SparseRep (a.rep->nrows, a.rep->ncols, a | : rep (new typename Sparse<T>::SparseRep (a.rep->nrows, a.rep->ncols, | |||
.rep->nzmx)), | a.rep->nzmx)), | |||
dimensions (a.dimensions) | dimensions (a.dimensions) | |||
{ | { | |||
octave_idx_type nz = a.nnz (); | octave_idx_type nz = a.nnz (); | |||
std::copy (a.rep->d, a.rep->d + nz, rep->d); | std::copy (a.rep->d, a.rep->d + nz, rep->d); | |||
copy_or_memcpy (nz, a.rep->r, rep->r); | copy_or_memcpy (nz, a.rep->r, rep->r); | |||
copy_or_memcpy (rep->ncols + 1, a.rep->c, rep->c); | copy_or_memcpy (rep->ncols + 1, a.rep->c, rep->c); | |||
} | } | |||
// No type conversion case. | // No type conversion case. | |||
Sparse (const Sparse<T>& a) | Sparse (const Sparse<T>& a) | |||
: rep (a.rep), dimensions (a.dimensions) | : rep (a.rep), dimensions (a.dimensions) | |||
{ | { | |||
rep->count++; | rep->count++; | |||
} | } | |||
public: | public: | |||
Sparse (const dim_vector& dv); | Sparse (const dim_vector& dv); | |||
Sparse (const Sparse<T>& a, const dim_vector& dv); | Sparse (const Sparse<T>& a, const dim_vector& dv); | |||
Sparse (const Array<T>& a, const idx_vector& r, const idx_vector& c, | Sparse (const Array<T>& a, const idx_vector& r, const idx_vector& c, | |||
octave_idx_type nr = -1, octave_idx_type nc = -1, | octave_idx_type nr = -1, octave_idx_type nc = -1, | |||
bool sum_terms = true, octave_idx_type nzm = -1); | bool sum_terms = true, octave_idx_type nzm = -1); | |||
skipping to change at line 252 | skipping to change at line 254 | |||
// Note that nzmax and capacity are the amount of storage for | // Note that nzmax and capacity are the amount of storage for | |||
// non-zero elements, while nnz is the actual number of non-zero | // non-zero elements, while nnz is the actual number of non-zero | |||
// terms. | // terms. | |||
octave_idx_type nzmax (void) const { return rep->length (); } | octave_idx_type nzmax (void) const { return rep->length (); } | |||
octave_idx_type capacity (void) const { return nzmax (); } | octave_idx_type capacity (void) const { return nzmax (); } | |||
octave_idx_type nnz (void) const { return rep->nnz (); } | octave_idx_type nnz (void) const { return rep->nnz (); } | |||
// Querying the number of elements (incl. zeros) may overflow the index t ype, | // Querying the number of elements (incl. zeros) may overflow the index t ype, | |||
// so don't do it unless you really need it. | // so don't do it unless you really need it. | |||
octave_idx_type numel (void) const | octave_idx_type numel (void) const | |||
{ | { | |||
return dimensions.safe_numel (); | return dimensions.safe_numel (); | |||
} | } | |||
octave_idx_type nelem (void) const { return capacity (); } | octave_idx_type nelem (void) const { return capacity (); } | |||
octave_idx_type length (void) const { return numel (); } | octave_idx_type length (void) const { return numel (); } | |||
octave_idx_type dim1 (void) const { return dimensions(0); } | octave_idx_type dim1 (void) const { return dimensions(0); } | |||
octave_idx_type dim2 (void) const { return dimensions(1); } | octave_idx_type dim2 (void) const { return dimensions(1); } | |||
octave_idx_type rows (void) const { return dim1 (); } | octave_idx_type rows (void) const { return dim1 (); } | |||
octave_idx_type cols (void) const { return dim2 (); } | octave_idx_type cols (void) const { return dim2 (); } | |||
octave_idx_type columns (void) const { return dim2 (); } | octave_idx_type columns (void) const { return dim2 (); } | |||
octave_idx_type get_row_index (octave_idx_type k) { return ridx (k); } | octave_idx_type get_row_index (octave_idx_type k) { return ridx (k); } | |||
octave_idx_type get_col_index (octave_idx_type k) | octave_idx_type get_col_index (octave_idx_type k) | |||
{ | { | |||
octave_idx_type ret = 0; | octave_idx_type ret = 0; | |||
while (cidx(ret+1) < k) | while (cidx (ret+1) < k) | |||
ret++; | ret++; | |||
return ret; | return ret; | |||
} | } | |||
size_t byte_size (void) const | size_t byte_size (void) const | |||
{ | { | |||
return (static_cast<size_t>(cols () + 1) * sizeof (octave_idx_type) | return (static_cast<size_t>(cols () + 1) * sizeof (octave_idx_type) | |||
+ static_cast<size_t> (capacity ()) * (sizeof (T) + sizeof (o | + static_cast<size_t> (capacity ()) | |||
ctave_idx_type))); | * (sizeof (T) + sizeof (octave_idx_type))); | |||
} | } | |||
dim_vector dims (void) const { return dimensions; } | dim_vector dims (void) const { return dimensions; } | |||
Sparse<T> squeeze (void) const { return *this; } | Sparse<T> squeeze (void) const { return *this; } | |||
octave_idx_type compute_index (const Array<octave_idx_type>& ra_idx) cons t; | octave_idx_type compute_index (const Array<octave_idx_type>& ra_idx) cons t; | |||
T range_error (const char *fcn, octave_idx_type n) const; | T range_error (const char *fcn, octave_idx_type n) const; | |||
T& range_error (const char *fcn, octave_idx_type n); | T& range_error (const char *fcn, octave_idx_type n); | |||
T range_error (const char *fcn, octave_idx_type i, octave_idx_type j) con st; | T range_error (const char *fcn, octave_idx_type i, octave_idx_type j) con st; | |||
T& range_error (const char *fcn, octave_idx_type i, octave_idx_type j); | T& range_error (const char *fcn, octave_idx_type i, octave_idx_type j); | |||
T range_error (const char *fcn, const Array<octave_idx_type>& ra_idx) con st; | T range_error (const char *fcn, const Array<octave_idx_type>& ra_idx) con st; | |||
T& range_error (const char *fcn, const Array<octave_idx_type>& ra_idx); | T& range_error (const char *fcn, const Array<octave_idx_type>& ra_idx); | |||
// No checking, even for multiple references, ever. | // No checking, even for multiple references, ever. | |||
T& xelem (octave_idx_type n) | T& xelem (octave_idx_type n) | |||
{ | { | |||
octave_idx_type i = n % rows (), j = n / rows(); | octave_idx_type i = n % rows (), j = n / rows (); | |||
return xelem (i, j); | return xelem (i, j); | |||
} | } | |||
T xelem (octave_idx_type n) const | T xelem (octave_idx_type n) const | |||
{ | { | |||
octave_idx_type i = n % rows (), j = n / rows(); | octave_idx_type i = n % rows (), j = n / rows (); | |||
return xelem (i, j); | return xelem (i, j); | |||
} | } | |||
T& xelem (octave_idx_type i, octave_idx_type j) { return rep->elem (i, j) ; } | T& xelem (octave_idx_type i, octave_idx_type j) { return rep->elem (i, j) ; } | |||
T xelem (octave_idx_type i, octave_idx_type j) const { return rep->celem | T xelem (octave_idx_type i, octave_idx_type j) const | |||
(i, j); } | { | |||
return rep->celem (i, j); | ||||
} | ||||
T& xelem (const Array<octave_idx_type>& ra_idx) | T& xelem (const Array<octave_idx_type>& ra_idx) | |||
{ return xelem (compute_index (ra_idx)); } | { return xelem (compute_index (ra_idx)); } | |||
T xelem (const Array<octave_idx_type>& ra_idx) const | T xelem (const Array<octave_idx_type>& ra_idx) const | |||
{ return xelem (compute_index (ra_idx)); } | { return xelem (compute_index (ra_idx)); } | |||
// FIXME -- would be nice to fix this so that we don't | // FIXME: would be nice to fix this so that we don't | |||
// unnecessarily force a copy, but that is not so easy, and I see no | // unnecessarily force a copy, but that is not so easy, and I see no | |||
// clean way to do it. | // clean way to do it. | |||
T& checkelem (octave_idx_type n) | T& checkelem (octave_idx_type n) | |||
{ | { | |||
if (n < 0 || n >= numel ()) | if (n < 0 || n >= numel ()) | |||
return range_error ("T& Sparse<T>::checkelem", n); | return range_error ("T& Sparse<T>::checkelem", n); | |||
else | else | |||
{ | { | |||
make_unique (); | make_unique (); | |||
return xelem (n); | return xelem (n); | |||
} | } | |||
} | } | |||
T& checkelem (octave_idx_type i, octave_idx_type j) | T& checkelem (octave_idx_type i, octave_idx_type j) | |||
{ | { | |||
if (i < 0 || j < 0 || i >= dim1 () || j >= dim2 ()) | if (i < 0 || j < 0 || i >= dim1 () || j >= dim2 ()) | |||
return range_error ("T& Sparse<T>::checkelem", i, j); | return range_error ("T& Sparse<T>::checkelem", i, j); | |||
else | else | |||
{ | { | |||
make_unique (); | make_unique (); | |||
return xelem (i, j); | return xelem (i, j); | |||
} | } | |||
} | } | |||
T& checkelem (const Array<octave_idx_type>& ra_idx) | T& checkelem (const Array<octave_idx_type>& ra_idx) | |||
{ | { | |||
octave_idx_type i = compute_index (ra_idx); | octave_idx_type i = compute_index (ra_idx); | |||
if (i < 0) | if (i < 0) | |||
return range_error ("T& Sparse<T>::checkelem", ra_idx); | return range_error ("T& Sparse<T>::checkelem", ra_idx); | |||
else | else | |||
return elem (i); | return elem (i); | |||
} | } | |||
T& elem (octave_idx_type n) | T& elem (octave_idx_type n) | |||
{ | { | |||
make_unique (); | make_unique (); | |||
return xelem (n); | return xelem (n); | |||
} | } | |||
T& elem (octave_idx_type i, octave_idx_type j) | T& elem (octave_idx_type i, octave_idx_type j) | |||
{ | { | |||
make_unique (); | make_unique (); | |||
return xelem (i, j); | return xelem (i, j); | |||
} | } | |||
T& elem (const Array<octave_idx_type>& ra_idx) | T& elem (const Array<octave_idx_type>& ra_idx) | |||
{ return Sparse<T>::elem (compute_index (ra_idx)); } | { return Sparse<T>::elem (compute_index (ra_idx)); } | |||
#if defined (BOUNDS_CHECKING) | #if defined (BOUNDS_CHECKING) | |||
T& operator () (octave_idx_type n) { return checkelem (n); } | T& operator () (octave_idx_type n) | |||
T& operator () (octave_idx_type i, octave_idx_type j) { return checkelem | { | |||
(i, j); } | return checkelem (n); | |||
T& operator () (const Array<octave_idx_type>& ra_idx) { return checkelem | } | |||
(ra_idx); } | ||||
T& operator () (octave_idx_type i, octave_idx_type j) | ||||
{ | ||||
return checkelem (i, j); | ||||
} | ||||
T& operator () (const Array<octave_idx_type>& ra_idx) | ||||
{ | ||||
return checkelem (ra_idx); | ||||
} | ||||
#else | #else | |||
T& operator () (octave_idx_type n) { return elem (n); } | T& operator () (octave_idx_type n) | |||
T& operator () (octave_idx_type i, octave_idx_type j) { return elem (i, j | { | |||
); } | return elem (n); | |||
T& operator () (const Array<octave_idx_type>& ra_idx) { return elem (ra_i | } | |||
dx); } | ||||
T& operator () (octave_idx_type i, octave_idx_type j) | ||||
{ | ||||
return elem (i, j); | ||||
} | ||||
T& operator () (const Array<octave_idx_type>& ra_idx) | ||||
{ | ||||
return elem (ra_idx); | ||||
} | ||||
#endif | #endif | |||
T checkelem (octave_idx_type n) const | T checkelem (octave_idx_type n) const | |||
{ | { | |||
if (n < 0 || n >= numel ()) | if (n < 0 || n >= numel ()) | |||
return range_error ("T Sparse<T>::checkelem", n); | return range_error ("T Sparse<T>::checkelem", n); | |||
else | else | |||
return xelem (n); | return xelem (n); | |||
} | } | |||
T checkelem (octave_idx_type i, octave_idx_type j) const | T checkelem (octave_idx_type i, octave_idx_type j) const | |||
{ | { | |||
if (i < 0 || j < 0 || i >= dim1 () || j >= dim2 ()) | if (i < 0 || j < 0 || i >= dim1 () || j >= dim2 ()) | |||
return range_error ("T Sparse<T>::checkelem", i, j); | return range_error ("T Sparse<T>::checkelem", i, j); | |||
else | else | |||
return xelem (i, j); | return xelem (i, j); | |||
} | } | |||
T checkelem (const Array<octave_idx_type>& ra_idx) const | T checkelem (const Array<octave_idx_type>& ra_idx) const | |||
{ | { | |||
octave_idx_type i = compute_index (ra_idx); | octave_idx_type i = compute_index (ra_idx); | |||
if (i < 0) | if (i < 0) | |||
return range_error ("T Sparse<T>::checkelem", ra_idx); | return range_error ("T Sparse<T>::checkelem", ra_idx); | |||
else | else | |||
return Sparse<T>::elem (i); | return Sparse<T>::elem (i); | |||
} | } | |||
T elem (octave_idx_type n) const { return xelem (n); } | T elem (octave_idx_type n) const { return xelem (n); } | |||
T elem (octave_idx_type i, octave_idx_type j) const { return xelem (i, j) ; } | T elem (octave_idx_type i, octave_idx_type j) const { return xelem (i, j) ; } | |||
T elem (const Array<octave_idx_type>& ra_idx) const | T elem (const Array<octave_idx_type>& ra_idx) const | |||
{ return Sparse<T>::elem (compute_index (ra_idx)); } | { return Sparse<T>::elem (compute_index (ra_idx)); } | |||
#if defined (BOUNDS_CHECKING) | #if defined (BOUNDS_CHECKING) | |||
T operator () (octave_idx_type n) const { return checkelem (n); } | T operator () (octave_idx_type n) const { return checkelem (n); } | |||
T operator () (octave_idx_type i, octave_idx_type j) const { return check | T operator () (octave_idx_type i, octave_idx_type j) const | |||
elem (i, j); } | { | |||
T operator () (const Array<octave_idx_type>& ra_idx) const { return check | return checkelem (i, j); | |||
elem (ra_idx); } | } | |||
T operator () (const Array<octave_idx_type>& ra_idx) const | ||||
{ | ||||
return checkelem (ra_idx); | ||||
} | ||||
#else | #else | |||
T operator () (octave_idx_type n) const { return elem (n); } | T operator () (octave_idx_type n) const { return elem (n); } | |||
T operator () (octave_idx_type i, octave_idx_type j) const { return elem | T operator () (octave_idx_type i, octave_idx_type j) const | |||
(i, j); } | { | |||
T operator () (const Array<octave_idx_type>& ra_idx) const { return elem | return elem (i, j); | |||
(ra_idx); } | } | |||
T operator () (const Array<octave_idx_type>& ra_idx) const | ||||
{ | ||||
return elem (ra_idx); | ||||
} | ||||
#endif | #endif | |||
Sparse<T> maybe_compress (bool remove_zeros = false) | Sparse<T> maybe_compress (bool remove_zeros = false) | |||
{ | { | |||
if (remove_zeros) | if (remove_zeros) | |||
make_unique (); // Needs to unshare because elements are removed. | make_unique (); // Needs to unshare because elements are removed. | |||
rep->maybe_compress (remove_zeros); | rep->maybe_compress (remove_zeros); | |||
return (*this); | return (*this); | |||
} | } | |||
Sparse<T> reshape (const dim_vector& new_dims) const; | Sparse<T> reshape (const dim_vector& new_dims) const; | |||
Sparse<T> permute (const Array<octave_idx_type>& vec, bool inv = false) c onst; | Sparse<T> permute (const Array<octave_idx_type>& vec, bool inv = false) c onst; | |||
Sparse<T> ipermute (const Array<octave_idx_type>& vec) const | Sparse<T> ipermute (const Array<octave_idx_type>& vec) const | |||
{ return permute (vec, true); } | { | |||
return permute (vec, true); | ||||
} | ||||
void resize1 (octave_idx_type n); | void resize1 (octave_idx_type n); | |||
void resize (octave_idx_type r, octave_idx_type c); | void resize (octave_idx_type r, octave_idx_type c); | |||
void resize (const dim_vector& dv); | void resize (const dim_vector& dv); | |||
void change_capacity (octave_idx_type nz) | void change_capacity (octave_idx_type nz) | |||
{ | { | |||
if (nz < nnz ()) | if (nz < nnz ()) | |||
make_unique (); // Unshare now because elements will be truncated. | make_unique (); // Unshare now because elements will be truncated. | |||
rep->change_length (nz); | rep->change_length (nz); | |||
} | } | |||
Sparse<T>& insert (const Sparse<T>& a, octave_idx_type r, octave_idx_type c); | Sparse<T>& insert (const Sparse<T>& a, octave_idx_type r, octave_idx_type c); | |||
Sparse<T>& insert (const Sparse<T>& a, const Array<octave_idx_type>& idx) ; | Sparse<T>& insert (const Sparse<T>& a, const Array<octave_idx_type>& idx) ; | |||
bool is_square (void) const { return (dim1 () == dim2 ()); } | bool is_square (void) const { return (dim1 () == dim2 ()); } | |||
bool is_empty (void) const { return (rows () < 1 && cols () < 1); } | bool is_empty (void) const { return (rows () < 1 && cols () < 1); } | |||
Sparse<T> transpose (void) const; | Sparse<T> transpose (void) const; | |||
T* data (void) { make_unique (); return rep->d; } | T* data (void) { make_unique (); return rep->d; } | |||
T& data (octave_idx_type i) { make_unique (); return rep->data (i); } | T& data (octave_idx_type i) { make_unique (); return rep->data (i); } | |||
T* xdata (void) { return rep->d; } | T* xdata (void) { return rep->d; } | |||
T& xdata (octave_idx_type i) { return rep->data (i); } | T& xdata (octave_idx_type i) { return rep->data (i); } | |||
T data (octave_idx_type i) const { return rep->data (i); } | T data (octave_idx_type i) const { return rep->data (i); } | |||
// FIXME -- shouldn't this be returning const T*? | // FIXME: shouldn't this be returning const T*? | |||
T* data (void) const { return rep->d; } | T* data (void) const { return rep->d; } | |||
octave_idx_type* ridx (void) { make_unique (); return rep->r; } | octave_idx_type* ridx (void) { make_unique (); return rep->r; } | |||
octave_idx_type& ridx (octave_idx_type i) { make_unique (); return rep->r | octave_idx_type& ridx (octave_idx_type i) | |||
idx (i); } | { | |||
make_unique (); return rep->ridx (i); | ||||
} | ||||
octave_idx_type* xridx (void) { return rep->r; } | octave_idx_type* xridx (void) { return rep->r; } | |||
octave_idx_type& xridx (octave_idx_type i) { return rep->ridx (i); } | octave_idx_type& xridx (octave_idx_type i) { return rep->ridx (i); } | |||
octave_idx_type ridx (octave_idx_type i) const { return rep->cridx (i); } | octave_idx_type ridx (octave_idx_type i) const { return rep->cridx (i); } | |||
// FIXME -- shouldn't this be returning const octave_idx_type*? | // FIXME: shouldn't this be returning const octave_idx_type*? | |||
octave_idx_type* ridx (void) const { return rep->r; } | octave_idx_type* ridx (void) const { return rep->r; } | |||
octave_idx_type* cidx (void) { make_unique (); return rep->c; } | octave_idx_type* cidx (void) { make_unique (); return rep->c; } | |||
octave_idx_type& cidx (octave_idx_type i) { make_unique (); return rep->c | octave_idx_type& cidx (octave_idx_type i) | |||
idx (i); } | { | |||
make_unique (); return rep->cidx (i); | ||||
} | ||||
octave_idx_type* xcidx (void) { return rep->c; } | octave_idx_type* xcidx (void) { return rep->c; } | |||
octave_idx_type& xcidx (octave_idx_type i) { return rep->cidx (i); } | octave_idx_type& xcidx (octave_idx_type i) { return rep->cidx (i); } | |||
octave_idx_type cidx (octave_idx_type i) const { return rep->ccidx (i); } | octave_idx_type cidx (octave_idx_type i) const { return rep->ccidx (i); } | |||
// FIXME -- shouldn't this be returning const octave_idx_type*? | // FIXME: shouldn't this be returning const octave_idx_type*? | |||
octave_idx_type* cidx (void) const { return rep->c; } | octave_idx_type* cidx (void) const { return rep->c; } | |||
octave_idx_type ndims (void) const { return dimensions.length (); } | octave_idx_type ndims (void) const { return dimensions.length (); } | |||
void delete_elements (const idx_vector& i); | void delete_elements (const idx_vector& i); | |||
void delete_elements (int dim, const idx_vector& i); | void delete_elements (int dim, const idx_vector& i); | |||
void delete_elements (const idx_vector& i, const idx_vector& j); | void delete_elements (const idx_vector& i, const idx_vector& j); | |||
Sparse<T> index (const idx_vector& i, bool resize_ok = false) const; | Sparse<T> index (const idx_vector& i, bool resize_ok = false) const; | |||
Sparse<T> index (const idx_vector& i, const idx_vector& j, bool resize_ok | Sparse<T> index (const idx_vector& i, const idx_vector& j, | |||
= false) const; | bool resize_ok = false) const; | |||
void assign (const idx_vector& i, const Sparse<T>& rhs); | void assign (const idx_vector& i, const Sparse<T>& rhs); | |||
void assign (const idx_vector& i, const idx_vector& j, const Sparse<T>& r hs); | void assign (const idx_vector& i, const idx_vector& j, const Sparse<T>& r hs); | |||
void print_info (std::ostream& os, const std::string& prefix) const; | void print_info (std::ostream& os, const std::string& prefix) const; | |||
// Unsafe. These functions exist to support the MEX interface. | // Unsafe. These functions exist to support the MEX interface. | |||
// You should not use them anywhere else. | // You should not use them anywhere else. | |||
void *mex_get_data (void) const { return const_cast<T *> (data ()); } | void *mex_get_data (void) const { return const_cast<T *> (data ()); } | |||
octave_idx_type *mex_get_ir (void) const { return const_cast<octave_idx_t | octave_idx_type *mex_get_ir (void) const | |||
ype *> (ridx ()); } | { | |||
return const_cast<octave_idx_type *> (ridx ()); | ||||
} | ||||
octave_idx_type *mex_get_jc (void) const { return const_cast<octave_idx_t | octave_idx_type *mex_get_jc (void) const | |||
ype *> (cidx ()); } | { | |||
return const_cast<octave_idx_type *> (cidx ()); | ||||
} | ||||
Sparse<T> sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const ; | Sparse<T> sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const ; | |||
Sparse<T> sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | Sparse<T> sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const; | sortmode mode = ASCENDING) const; | |||
Sparse<T> diag (octave_idx_type k = 0) const; | Sparse<T> diag (octave_idx_type k = 0) const; | |||
// dim = -1 and dim = -2 are special; see Array<T>::cat description. | // dim = -1 and dim = -2 are special; see Array<T>::cat description. | |||
static Sparse<T> | static Sparse<T> | |||
cat (int dim, octave_idx_type n, const Sparse<T> *sparse_list); | cat (int dim, octave_idx_type n, const Sparse<T> *sparse_list); | |||
Array<T> array_value (void) const; | Array<T> array_value (void) const; | |||
// Generic any/all test functionality with arbitrary predicate. | ||||
template <class F, bool zero> | ||||
bool test (F fcn) const | ||||
{ | ||||
return any_all_test<F, T, zero> (fcn, data (), nnz ()); | ||||
} | ||||
// Simpler calls. | ||||
template <class F> | ||||
bool test_any (F fcn) const | ||||
{ return test<F, false> (fcn); } | ||||
template <class F> | ||||
bool test_all (F fcn) const | ||||
{ return test<F, true> (fcn); } | ||||
// Overloads for function references. | ||||
bool test_any (bool (&fcn) (T)) const | ||||
{ return test<bool (&) (T), false> (fcn); } | ||||
bool test_any (bool (&fcn) (const T&)) const | ||||
{ return test<bool (&) (const T&), false> (fcn); } | ||||
bool test_all (bool (&fcn) (T)) const | ||||
{ return test<bool (&) (T), true> (fcn); } | ||||
bool test_all (bool (&fcn) (const T&)) const | ||||
{ return test<bool (&) (const T&), true> (fcn); } | ||||
template <class U, class F> | template <class U, class F> | |||
Sparse<U> | Sparse<U> | |||
map (F fcn) const | map (F fcn) const | |||
{ | { | |||
Sparse<U> result; | Sparse<U> result; | |||
U f_zero = fcn (0.); | U f_zero = fcn (0.); | |||
if (f_zero != 0.) | if (f_zero != 0.) | |||
{ | { | |||
octave_idx_type nr = rows (); | octave_idx_type nr = rows (); | |||
octave_idx_type nc = cols (); | octave_idx_type nc = cols (); | |||
result = Sparse<U> (nr, nc, f_zero); | result = Sparse<U> (nr, nc, f_zero); | |||
for (octave_idx_type j = 0; j < nc; j++) | for (octave_idx_type j = 0; j < nc; j++) | |||
for (octave_idx_type i = cidx(j); i < cidx (j+1); i++) | for (octave_idx_type i = cidx (j); i < cidx (j+1); i++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
/* Use data instead of elem for better performance. */ | /* Use data instead of elem for better performance. */ | |||
result.data (ridx (i) + j * nr) = fcn (data(i)); | result.data (ridx (i) + j * nr) = fcn (data (i)); | |||
} | } | |||
result.maybe_compress (true); | result.maybe_compress (true); | |||
} | } | |||
else | else | |||
{ | { | |||
octave_idx_type nz = nnz (); | octave_idx_type nz = nnz (); | |||
octave_idx_type nr = rows (); | octave_idx_type nr = rows (); | |||
octave_idx_type nc = cols (); | octave_idx_type nc = cols (); | |||
result = Sparse<U> (nr, nc, nz); | result = Sparse<U> (nr, nc, nz); | |||
octave_idx_type ii = 0; | octave_idx_type ii = 0; | |||
result.cidx (ii) = 0; | result.cidx (ii) = 0; | |||
for (octave_idx_type j = 0; j < nc; j++) | for (octave_idx_type j = 0; j < nc; j++) | |||
{ | { | |||
for (octave_idx_type i = cidx(j); i < cidx (j+1); i++) | for (octave_idx_type i = cidx (j); i < cidx (j+1); i++) | |||
{ | { | |||
U val = fcn (data (i)); | U val = fcn (data (i)); | |||
if (val != 0.0) | if (val != 0.0) | |||
{ | { | |||
result.data (ii) = val; | result.data (ii) = val; | |||
result.ridx (ii++) = ridx (i); | result.ridx (ii++) = ridx (i); | |||
} | } | |||
octave_quit (); | octave_quit (); | |||
} | } | |||
result.cidx (j+1) = ii; | result.cidx (j+1) = ii; | |||
skipping to change at line 651 | skipping to change at line 742 | |||
if (jtmp < jold) | if (jtmp < jold) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("invalid sparse matrix: column indices must appear in asce nding order"); | ("invalid sparse matrix: column indices must appear in asce nding order"); | |||
is.setstate (std::ios::failbit); | is.setstate (std::ios::failbit); | |||
goto done; | goto done; | |||
} | } | |||
else if (jtmp > jold) | else if (jtmp > jold) | |||
{ | { | |||
for (octave_idx_type j = jold; j < jtmp; j++) | for (octave_idx_type j = jold; j < jtmp; j++) | |||
a.cidx(j+1) = ii; | a.cidx (j+1) = ii; | |||
} | } | |||
else if (itmp < iold) | else if (itmp < iold) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("invalid sparse matrix: row indices must appear in ascendi ng order in each column"); | ("invalid sparse matrix: row indices must appear in ascendi ng order in each column"); | |||
is.setstate (std::ios::failbit); | is.setstate (std::ios::failbit); | |||
goto done; | goto done; | |||
} | } | |||
iold = itmp; | iold = itmp; | |||
skipping to change at line 676 | skipping to change at line 767 | |||
if (is) | if (is) | |||
{ | { | |||
a.data (ii) = tmp; | a.data (ii) = tmp; | |||
a.ridx (ii++) = itmp; | a.ridx (ii++) = itmp; | |||
} | } | |||
else | else | |||
goto done; | goto done; | |||
} | } | |||
for (octave_idx_type j = jold; j < nc; j++) | for (octave_idx_type j = jold; j < nc; j++) | |||
a.cidx(j+1) = ii; | a.cidx (j+1) = ii; | |||
} | } | |||
done: | done: | |||
return is; | return is; | |||
} | } | |||
#endif | #endif | |||
End of changes. 60 change blocks. | ||||
198 lines changed or deleted | 268 lines changed or added | |||
SparseCmplxCHOL.h | SparseCmplxCHOL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2005-2012 David Bateman | Copyright (C) 2005-2013 David Bateman | |||
Copyright (C) 1998-2005 Andy Adler | Copyright (C) 1998-2005 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_sparse_complex_CHOL_h) | #if !defined (octave_SparseCmplxCHOL_h) | |||
#define octave_sparse_complex_CHOL_h 1 | #define octave_SparseCmplxCHOL_h 1 | |||
#include "sparse-base-chol.h" | #include "sparse-base-chol.h" | |||
#include "dSparse.h" | #include "dSparse.h" | |||
#include "CSparse.h" | #include "CSparse.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
SparseComplexCHOL : | SparseComplexCHOL | |||
public sparse_base_chol <SparseComplexMatrix, Complex, SparseMatrix> | : public sparse_base_chol <SparseComplexMatrix, Complex, SparseMatrix> | |||
{ | { | |||
public: | public: | |||
SparseComplexCHOL (void) : | SparseComplexCHOL (void) | |||
sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> () { } | : sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> () { } | |||
SparseComplexCHOL (const SparseComplexMatrix& a, bool natural = true) : | SparseComplexCHOL (const SparseComplexMatrix& a, bool natural = true, | |||
sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> | bool force = false) | |||
(a, natural) { } | : sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> | |||
(a, natural, force) { } | ||||
SparseComplexCHOL (const SparseComplexMatrix& a, octave_idx_type& info, | SparseComplexCHOL (const SparseComplexMatrix& a, octave_idx_type& info, | |||
bool natural = true) : | bool natural = true, bool force = false) | |||
sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> | : sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> | |||
(a, info, natural) { } | (a, info, natural, force) { } | |||
SparseComplexCHOL (const SparseComplexCHOL& a) : | SparseComplexCHOL (const SparseComplexCHOL& a) | |||
sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> (a) { } | : sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> (a) { } | |||
~SparseComplexCHOL (void) { } | ~SparseComplexCHOL (void) { } | |||
SparseComplexCHOL& operator = (const SparseComplexCHOL& a) | SparseComplexCHOL& operator = (const SparseComplexCHOL& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
sparse_base_chol <SparseComplexMatrix, Complex, SparseMatrix> :: | sparse_base_chol <SparseComplexMatrix, Complex, SparseMatrix> :: | |||
operator = (a); | operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
SparseComplexMatrix chol_matrix (void) const { return R(); } | SparseComplexMatrix chol_matrix (void) const { return R (); } | |||
SparseComplexMatrix L (void) const | SparseComplexMatrix L (void) const | |||
{ return sparse_base_chol<SparseComplexMatrix, Complex, | { | |||
SparseMatrix>:: L (); } | return sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix>:: L | |||
(); | ||||
} | ||||
SparseComplexMatrix R (void) const | SparseComplexMatrix R (void) const | |||
{ return sparse_base_chol<SparseComplexMatrix, Complex, | { | |||
SparseMatrix>:: R (); } | return sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix>:: R | |||
(); | ||||
} | ||||
octave_idx_type P (void) const | octave_idx_type P (void) const | |||
{ return sparse_base_chol<SparseComplexMatrix, Complex, | { | |||
SparseMatrix>:: P (); } | return sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix>:: P | |||
(); | ||||
} | ||||
ColumnVector perm (void) const | ColumnVector perm (void) const | |||
{ return sparse_base_chol<SparseComplexMatrix, Complex, | { | |||
SparseMatrix>:: perm (); } | return sparse_base_chol<SparseComplexMatrix, Complex, | |||
SparseMatrix>:: perm (); | ||||
} | ||||
SparseMatrix Q (void) const | SparseMatrix Q (void) const | |||
{ return sparse_base_chol<SparseComplexMatrix, Complex, | { | |||
SparseMatrix>:: Q (); } | return sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix>:: Q | |||
(); | ||||
} | ||||
double rcond (void) const | double rcond (void) const | |||
{ return sparse_base_chol<SparseComplexMatrix, Complex, | { | |||
SparseMatrix>:: rcond (); } | return sparse_base_chol<SparseComplexMatrix, Complex, | |||
SparseMatrix>:: rcond (); | ||||
} | ||||
// Compute the inverse of a matrix using the Cholesky factorization. | // Compute the inverse of a matrix using the Cholesky factorization. | |||
SparseComplexMatrix inverse (void) const | SparseComplexMatrix inverse (void) const | |||
{ return sparse_base_chol<SparseComplexMatrix, Complex, | { | |||
SparseMatrix>:: inverse (); } | return sparse_base_chol<SparseComplexMatrix, Complex, | |||
SparseMatrix>:: inverse (); | ||||
} | ||||
}; | }; | |||
SparseComplexMatrix OCTAVE_API chol2inv (const SparseComplexMatrix& r); | SparseComplexMatrix OCTAVE_API chol2inv (const SparseComplexMatrix& r); | |||
#endif | #endif | |||
End of changes. 17 change blocks. | ||||
36 lines changed or deleted | 51 lines changed or added | |||
SparseCmplxLU.h | SparseCmplxLU.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_sparse_complex_LU_h) | #if !defined (octave_SparseCmplxLU_h) | |||
#define octave_sparse_complex_LU_h 1 | #define octave_SparseCmplxLU_h 1 | |||
#include "sparse-base-lu.h" | #include "sparse-base-lu.h" | |||
#include "dSparse.h" | #include "dSparse.h" | |||
#include "CSparse.h" | #include "CSparse.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
SparseComplexLU | SparseComplexLU | |||
: public sparse_base_lu <SparseComplexMatrix, Complex, SparseMatrix, doub le> | : public sparse_base_lu <SparseComplexMatrix, Complex, SparseMatrix, doub le> | |||
{ | { | |||
skipping to change at line 52 | skipping to change at line 52 | |||
const Matrix& piv_thres = Matrix (), | const Matrix& piv_thres = Matrix (), | |||
bool scale = false); | bool scale = false); | |||
SparseComplexLU (const SparseComplexMatrix& a, const ColumnVector& Qinit, | SparseComplexLU (const SparseComplexMatrix& a, const ColumnVector& Qinit, | |||
const Matrix& piv_thres = Matrix (), | const Matrix& piv_thres = Matrix (), | |||
bool scale = false, bool FixedQ = false, | bool scale = false, bool FixedQ = false, | |||
double droptol = -1., bool milu = false, | double droptol = -1., bool milu = false, | |||
bool udiag = false); | bool udiag = false); | |||
SparseComplexLU (const SparseComplexLU& a) | SparseComplexLU (const SparseComplexLU& a) | |||
: sparse_base_lu <SparseComplexMatrix, Complex, SparseMatrix, double> ( | : sparse_base_lu <SparseComplexMatrix, Complex, SparseMatrix, double> ( | |||
a) { } | a) | |||
{ } | ||||
SparseComplexLU& operator = (const SparseComplexLU& a) | SparseComplexLU& operator = (const SparseComplexLU& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
sparse_base_lu <SparseComplexMatrix, Complex, SparseMatrix, double> | sparse_base_lu <SparseComplexMatrix, Complex, SparseMatrix, double> | |||
:: operator = (a); | :: operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
~SparseComplexLU (void) { } | ~SparseComplexLU (void) { } | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 5 change blocks. | ||||
11 lines changed or deleted | 12 lines changed or added | |||
SparseCmplxQR.h | SparseCmplxQR.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2005-2012 David Bateman | Copyright (C) 2005-2013 David Bateman | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (sparse_cmplx_QR_h) | #if !defined (octave_SparseCmplxQR_h) | |||
#define sparse_cmplx_QR_h 1 | #define octave_SparseCmplxQR_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
#include "dSparse.h" | #include "dSparse.h" | |||
#include "CSparse.h" | #include "CSparse.h" | |||
#include "oct-sparse.h" | #include "oct-sparse.h" | |||
#ifdef IDX_TYPE_LONG | #ifdef USE_64_BIT_IDX_T | |||
#define CXSPARSE_ZNAME(name) cs_cl ## name | #define CXSPARSE_ZNAME(name) cs_cl ## name | |||
#else | #else | |||
#define CXSPARSE_ZNAME(name) cs_ci ## name | #define CXSPARSE_ZNAME(name) cs_ci ## name | |||
#endif | #endif | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
SparseComplexQR | SparseComplexQR | |||
{ | { | |||
protected: | protected: | |||
skipping to change at line 90 | skipping to change at line 90 | |||
SparseComplexQR_rep (const SparseComplexQR_rep&); | SparseComplexQR_rep (const SparseComplexQR_rep&); | |||
SparseComplexQR_rep operator = (const SparseComplexQR_rep&); | SparseComplexQR_rep operator = (const SparseComplexQR_rep&); | |||
}; | }; | |||
private: | private: | |||
SparseComplexQR_rep *rep; | SparseComplexQR_rep *rep; | |||
public: | public: | |||
SparseComplexQR (void) : | SparseComplexQR (void) : | |||
rep (new SparseComplexQR_rep (SparseComplexMatrix(), 0)) { } | rep (new SparseComplexQR_rep (SparseComplexMatrix (), 0)) { } | |||
SparseComplexQR (const SparseComplexMatrix& a, int order = 0) : | SparseComplexQR (const SparseComplexMatrix& a, int order = 0) : | |||
rep (new SparseComplexQR_rep (a, order)) { } | rep (new SparseComplexQR_rep (a, order)) { } | |||
SparseComplexQR (const SparseComplexQR& a) : rep (a.rep) { rep->count++; } | SparseComplexQR (const SparseComplexQR& a) : rep (a.rep) { rep->count++; } | |||
~SparseComplexQR (void) | ~SparseComplexQR (void) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
} | } | |||
SparseComplexQR& operator = (const SparseComplexQR& a) | SparseComplexQR& operator = (const SparseComplexQR& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = a.rep; | rep = a.rep; | |||
rep->count++; | rep->count++; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
bool ok (void) const { return rep->ok(); } | bool ok (void) const { return rep->ok (); } | |||
SparseComplexMatrix V (void) const { return rep->V(); } | SparseComplexMatrix V (void) const { return rep->V (); } | |||
ColumnVector Pinv (void) const { return rep->P(); } | ColumnVector Pinv (void) const { return rep->P (); } | |||
ColumnVector P (void) const { return rep->P(); } | ColumnVector P (void) const { return rep->P (); } | |||
SparseComplexMatrix R (const bool econ = false) const | SparseComplexMatrix R (const bool econ = false) const | |||
{ return rep->R(econ); } | { return rep->R(econ); } | |||
ComplexMatrix C (const ComplexMatrix &b) const { return rep->C(b); } | ComplexMatrix C (const ComplexMatrix &b) const { return rep->C(b); } | |||
ComplexMatrix Q (void) const { return rep->Q(); } | ComplexMatrix Q (void) const { return rep->Q (); } | |||
friend ComplexMatrix qrsolve (const SparseComplexMatrix &a, const Matrix &b, | friend ComplexMatrix qrsolve (const SparseComplexMatrix &a, const Matrix &b, | |||
octave_idx_type &info); | octave_idx_type &info); | |||
friend SparseComplexMatrix qrsolve (const SparseComplexMatrix &a, | friend SparseComplexMatrix qrsolve (const SparseComplexMatrix &a, | |||
const SparseMatrix &b, | const SparseMatrix &b, | |||
octave_idx_type &info); | octave_idx_type &info); | |||
friend ComplexMatrix qrsolve (const SparseComplexMatrix &a, | friend ComplexMatrix qrsolve (const SparseComplexMatrix &a, | |||
const ComplexMatrix &b, | const ComplexMatrix &b, | |||
End of changes. 13 change blocks. | ||||
25 lines changed or deleted | 25 lines changed or added | |||
SparseQR.h | SparseQR.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2005-2012 David Bateman | Copyright (C) 2005-2013 David Bateman | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (sparse_QR_h) | #if !defined (octave_SparseQR_h) | |||
#define sparse_QR_h 1 | #define octave_SparseQR_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
#include "dSparse.h" | #include "dSparse.h" | |||
#include "CSparse.h" | #include "CSparse.h" | |||
#include "oct-sparse.h" | #include "oct-sparse.h" | |||
#ifdef IDX_TYPE_LONG | #ifdef USE_64_BIT_IDX_T | |||
#define CXSPARSE_DNAME(name) cs_dl ## name | #define CXSPARSE_DNAME(name) cs_dl ## name | |||
#else | #else | |||
#define CXSPARSE_DNAME(name) cs_di ## name | #define CXSPARSE_DNAME(name) cs_di ## name | |||
#endif | #endif | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
SparseQR | SparseQR | |||
{ | { | |||
protected: | protected: | |||
skipping to change at line 92 | skipping to change at line 92 | |||
SparseQR_rep& operator = (const SparseQR_rep&); | SparseQR_rep& operator = (const SparseQR_rep&); | |||
}; | }; | |||
private: | private: | |||
SparseQR_rep *rep; | SparseQR_rep *rep; | |||
public: | public: | |||
SparseQR (void) : rep (new SparseQR_rep (SparseMatrix(), 0)) { } | SparseQR (void) : rep (new SparseQR_rep (SparseMatrix (), 0)) { } | |||
SparseQR (const SparseMatrix& a, int order = 0) : | SparseQR (const SparseMatrix& a, int order = 0) : | |||
rep (new SparseQR_rep (a, order)) { } | rep (new SparseQR_rep (a, order)) { } | |||
SparseQR (const SparseQR& a) : rep (a.rep) { rep->count++; } | SparseQR (const SparseQR& a) : rep (a.rep) { rep->count++; } | |||
~SparseQR (void) | ~SparseQR (void) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
} | } | |||
SparseQR& operator = (const SparseQR& a) | SparseQR& operator = (const SparseQR& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = a.rep; | rep = a.rep; | |||
rep->count++; | rep->count++; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
bool ok (void) const { return rep->ok(); } | bool ok (void) const { return rep->ok (); } | |||
SparseMatrix V (void) const { return rep->V(); } | SparseMatrix V (void) const { return rep->V (); } | |||
ColumnVector Pinv (void) const { return rep->P(); } | ColumnVector Pinv (void) const { return rep->P (); } | |||
ColumnVector P (void) const { return rep->P(); } | ColumnVector P (void) const { return rep->P (); } | |||
SparseMatrix R (const bool econ = false) const { return rep->R(econ); } | SparseMatrix R (const bool econ = false) const { return rep->R(econ); } | |||
Matrix C (const Matrix &b) const { return rep->C(b); } | Matrix C (const Matrix &b) const { return rep->C(b); } | |||
Matrix Q (void) const { return rep->Q(); } | Matrix Q (void) const { return rep->Q (); } | |||
friend Matrix qrsolve (const SparseMatrix &a, const Matrix &b, | friend Matrix qrsolve (const SparseMatrix &a, const Matrix &b, | |||
octave_idx_type &info); | octave_idx_type &info); | |||
friend SparseMatrix qrsolve (const SparseMatrix &a, const SparseMatrix &b , | friend SparseMatrix qrsolve (const SparseMatrix &a, const SparseMatrix &b , | |||
octave_idx_type &info); | octave_idx_type &info); | |||
friend ComplexMatrix qrsolve (const SparseMatrix &a, const ComplexMatrix &b, | friend ComplexMatrix qrsolve (const SparseMatrix &a, const ComplexMatrix &b, | |||
octave_idx_type &info); | octave_idx_type &info); | |||
friend SparseComplexMatrix qrsolve (const SparseMatrix &a, | friend SparseComplexMatrix qrsolve (const SparseMatrix &a, | |||
const SparseComplexMatrix &b, | const SparseComplexMatrix &b, | |||
octave_idx_type &info); | octave_idx_type &info); | |||
protected: | protected: | |||
#ifdef HAVE_CXSPARSE | #ifdef HAVE_CXSPARSE | |||
End of changes. 13 change blocks. | ||||
25 lines changed or deleted | 25 lines changed or added | |||
SparsedbleCHOL.h | SparsedbleCHOL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2005-2012 David Bateman | Copyright (C) 2005-2013 David Bateman | |||
Copyright (C) 1998-2005 Andy Adler | Copyright (C) 1998-2005 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_sparse_CHOL_h) | #if !defined (octave_SparsedbleCHOL_h) | |||
#define octave_sparse_CHOL_h 1 | #define octave_SparsedbleCHOL_h 1 | |||
#include "sparse-base-chol.h" | #include "sparse-base-chol.h" | |||
#include "dSparse.h" | #include "dSparse.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
SparseCHOL : public sparse_base_chol <SparseMatrix, double, SparseMatrix> | SparseCHOL : public sparse_base_chol <SparseMatrix, double, SparseMatrix> | |||
{ | { | |||
public: | public: | |||
SparseCHOL (void) : sparse_base_chol<SparseMatrix, double, SparseMatrix> | SparseCHOL (void) : sparse_base_chol<SparseMatrix, double, SparseMatrix> | |||
() { } | () | |||
{ } | ||||
SparseCHOL (const SparseMatrix& a, bool natural = true) : | SparseCHOL (const SparseMatrix& a, bool natural = true, bool force = fals | |||
sparse_base_chol<SparseMatrix, double, SparseMatrix> (a, natural) { } | e) | |||
: sparse_base_chol<SparseMatrix, double, SparseMatrix> (a, natural, for | ||||
ce) | ||||
{ } | ||||
SparseCHOL (const SparseMatrix& a, octave_idx_type& info, | SparseCHOL (const SparseMatrix& a, octave_idx_type& info, | |||
bool natural = true) : | bool natural = false, bool force = false) | |||
sparse_base_chol<SparseMatrix, double, SparseMatrix> (a, info, natural) | : sparse_base_chol<SparseMatrix, double, SparseMatrix> (a, info, natura | |||
{ } | l, | |||
force) | ||||
{ } | ||||
SparseCHOL (const SparseCHOL& a) : | SparseCHOL (const SparseCHOL& a) : | |||
sparse_base_chol<SparseMatrix, double, SparseMatrix> (a) { } | sparse_base_chol<SparseMatrix, double, SparseMatrix> (a) { } | |||
~SparseCHOL (void) { } | ~SparseCHOL (void) { } | |||
SparseCHOL& operator = (const SparseCHOL& a) | SparseCHOL& operator = (const SparseCHOL& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
sparse_base_chol <SparseMatrix, double, SparseMatrix> :: operator = | sparse_base_chol <SparseMatrix, double, SparseMatrix> :: operator = ( | |||
(a); | a); | |||
return *this; | return *this; | |||
} | } | |||
SparseMatrix chol_matrix (void) const { return R(); } | SparseMatrix chol_matrix (void) const { return R (); } | |||
SparseMatrix L (void) const | SparseMatrix L (void) const | |||
{ return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: L (); } | { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: L (); } | |||
SparseMatrix R (void) const | SparseMatrix R (void) const | |||
{ return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: R (); } | { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: R (); } | |||
octave_idx_type P (void) const | octave_idx_type P (void) const | |||
{ return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: P (); } | { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: P (); } | |||
ColumnVector perm (void) const | ColumnVector perm (void) const | |||
{ return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: perm () ; } | { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: perm (); } | |||
SparseMatrix Q (void) const | SparseMatrix Q (void) const | |||
{ return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: Q (); } | { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: Q (); } | |||
double rcond (void) const | double rcond (void) const | |||
{ return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: rcond ( ); } | { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: rcond (); } | |||
// Compute the inverse of a matrix using the Cholesky factorization. | // Compute the inverse of a matrix using the Cholesky factorization. | |||
SparseMatrix inverse (void) const | SparseMatrix inverse (void) const | |||
{ return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: | { | |||
inverse (); } | return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: inverse ( | |||
); | ||||
} | ||||
}; | }; | |||
SparseMatrix OCTAVE_API chol2inv (const SparseMatrix& r); | SparseMatrix OCTAVE_API chol2inv (const SparseMatrix& r); | |||
#endif | #endif | |||
End of changes. 14 change blocks. | ||||
24 lines changed or deleted | 32 lines changed or added | |||
SparsedbleLU.h | SparsedbleLU.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_sparse_LU_h) | #if !defined (octave_SparsedbleLU_h) | |||
#define octave_sparse_LU_h 1 | #define octave_SparsedbleLU_h 1 | |||
#include "sparse-base-lu.h" | #include "sparse-base-lu.h" | |||
#include "dSparse.h" | #include "dSparse.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
SparseLU : public sparse_base_lu <SparseMatrix, double, SparseMatrix, doubl e> | SparseLU : public sparse_base_lu <SparseMatrix, double, SparseMatrix, doubl e> | |||
{ | { | |||
public: | public: | |||
SparseLU (void) | SparseLU (void) | |||
: sparse_base_lu <SparseMatrix, double, SparseMatrix, double> () { } | : sparse_base_lu <SparseMatrix, double, SparseMatrix, double> () { } | |||
SparseLU (const SparseMatrix& a, const Matrix& piv_thres = Matrix(), | SparseLU (const SparseMatrix& a, const Matrix& piv_thres = Matrix (), | |||
bool scale = false); | bool scale = false); | |||
SparseLU (const SparseMatrix& a, const ColumnVector& Qinit, | SparseLU (const SparseMatrix& a, const ColumnVector& Qinit, | |||
const Matrix& piv_thres = Matrix(), bool scale = false, | const Matrix& piv_thres = Matrix (), bool scale = false, | |||
bool FixedQ = false, double droptol = -1., | bool FixedQ = false, double droptol = -1., | |||
bool milu = false, bool udiag = false); | bool milu = false, bool udiag = false); | |||
SparseLU (const SparseLU& a) | SparseLU (const SparseLU& a) | |||
: sparse_base_lu <SparseMatrix, double, SparseMatrix, double> (a) { } | : sparse_base_lu <SparseMatrix, double, SparseMatrix, double> (a) { } | |||
SparseLU& operator = (const SparseLU& a) | SparseLU& operator = (const SparseLU& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
sparse_base_lu <SparseMatrix, double, SparseMatrix, double> | sparse_base_lu <SparseMatrix, double, SparseMatrix, double> | |||
:: operator = (a); | :: operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
~SparseLU (void) { } | ~SparseLU (void) { } | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
11 lines changed or deleted | 11 lines changed or added | |||
base-aepbal.h | base-aepbal.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 46 | skipping to change at line 46 | |||
public: | public: | |||
base_aepbal (const base_aepbal& a) | base_aepbal (const base_aepbal& a) | |||
: balanced_mat (a.balanced_mat), scale (a.scale), | : balanced_mat (a.balanced_mat), scale (a.scale), | |||
ilo(a.ilo), ihi(a.ihi), job(a.job) | ilo(a.ilo), ihi(a.ihi), job(a.job) | |||
{ | { | |||
} | } | |||
base_aepbal& operator = (const base_aepbal& a) | base_aepbal& operator = (const base_aepbal& a) | |||
{ | { | |||
balanced_mat = a.balanced_mat; | balanced_mat = a.balanced_mat; | |||
scale = a.scale; | scale = a.scale; | |||
ilo = a.ilo; | ilo = a.ilo; | |||
ihi = a.ihi; | ihi = a.ihi; | |||
job = a.job; | job = a.job; | |||
return *this; | return *this; | |||
} | } | |||
virtual ~base_aepbal (void) { } | virtual ~base_aepbal (void) { } | |||
MatrixT balanced_matrix (void) const { return balanced_mat; } | MatrixT balanced_matrix (void) const { return balanced_mat; } | |||
VectorT permuting_vector (void) const | VectorT permuting_vector (void) const | |||
{ | { | |||
octave_idx_type n = balanced_mat.rows (); | octave_idx_type n = balanced_mat.rows (); | |||
VectorT pv (n); | VectorT pv (n); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
pv(i) = i+1; | pv(i) = i+1; | |||
for (octave_idx_type i = n-1; i >= ihi; i--) | for (octave_idx_type i = n-1; i >= ihi; i--) | |||
{ | { | |||
octave_idx_type j = scale(i) - 1; | octave_idx_type j = scale(i) - 1; | |||
std::swap (pv(i), pv(j)); | std::swap (pv(i), pv(j)); | |||
} | } | |||
for (octave_idx_type i = 0; i < ilo-1; i++) | for (octave_idx_type i = 0; i < ilo-1; i++) | |||
{ | { | |||
octave_idx_type j = scale(i) - 1; | octave_idx_type j = scale(i) - 1; | |||
std::swap (pv(i), pv(j)); | std::swap (pv(i), pv(j)); | |||
} | } | |||
return pv; | return pv; | |||
} | } | |||
VectorT scaling_vector (void) const | VectorT scaling_vector (void) const | |||
{ | { | |||
octave_idx_type n = balanced_mat.rows (); | octave_idx_type n = balanced_mat.rows (); | |||
VectorT scv (n); | VectorT scv (n); | |||
for (octave_idx_type i = 0; i < ilo-1; i++) | for (octave_idx_type i = 0; i < ilo-1; i++) | |||
scv(i) = 1; | scv(i) = 1; | |||
for (octave_idx_type i = ilo-1; i < ihi; i++) | for (octave_idx_type i = ilo-1; i < ihi; i++) | |||
scv(i) = scale(i); | scv(i) = scale(i); | |||
for (octave_idx_type i = ihi; i < n; i++) | for (octave_idx_type i = ihi; i < n; i++) | |||
scv(i) = 1; | scv(i) = 1; | |||
return scv; | return scv; | |||
} | } | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
37 lines changed or deleted | 37 lines changed or added | |||
base-dae.h | base-dae.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2002-2012 John W. Eaton | Copyright (C) 2002-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 49 | skipping to change at line 49 | |||
base_diff_alg_eqn (const ColumnVector& xx, const ColumnVector& xxdot, | base_diff_alg_eqn (const ColumnVector& xx, const ColumnVector& xxdot, | |||
double tt) | double tt) | |||
: base_diff_eqn (xx, tt), xdot (xxdot) { } | : base_diff_eqn (xx, tt), xdot (xxdot) { } | |||
base_diff_alg_eqn (const base_diff_alg_eqn& a) | base_diff_alg_eqn (const base_diff_alg_eqn& a) | |||
: base_diff_eqn (a), xdot (a.xdot) { } | : base_diff_eqn (a), xdot (a.xdot) { } | |||
virtual ~base_diff_alg_eqn (void) { } | virtual ~base_diff_alg_eqn (void) { } | |||
base_diff_alg_eqn& operator = (const base_diff_alg_eqn& a) | base_diff_alg_eqn& operator = (const base_diff_alg_eqn& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
base_diff_eqn::operator = (a); | base_diff_eqn::operator = (a); | |||
xdot = a.xdot; | xdot = a.xdot; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
void initialize (const ColumnVector& x0, double t0) | void initialize (const ColumnVector& x0, double t0) | |||
{ | { | |||
base_diff_eqn::initialize (x0, t0); | base_diff_eqn::initialize (x0, t0); | |||
xdot = ColumnVector (x0.length (), 0.0); | xdot = ColumnVector (x0.length (), 0.0); | |||
} | } | |||
void initialize (const ColumnVector& x0, const ColumnVector& xdot0, | void initialize (const ColumnVector& x0, const ColumnVector& xdot0, | |||
double t0) | double t0) | |||
{ | { | |||
base_diff_eqn::initialize (x0, t0); | base_diff_eqn::initialize (x0, t0); | |||
xdot = xdot0; | xdot = xdot0; | |||
} | } | |||
ColumnVector state_derivative (void) { return xdot; } | ColumnVector state_derivative (void) { return xdot; } | |||
protected: | protected: | |||
ColumnVector xdot; | ColumnVector xdot; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
17 lines changed or deleted | 17 lines changed or added | |||
base-de.h | base-de.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 51 | skipping to change at line 51 | |||
: x (xx), t (tt), stop_time (0.0), stop_time_set (false), | : x (xx), t (tt), stop_time (0.0), stop_time_set (false), | |||
restart (true), integration_error (false), istate (0) { } | restart (true), integration_error (false), istate (0) { } | |||
base_diff_eqn (const base_diff_eqn& a) | base_diff_eqn (const base_diff_eqn& a) | |||
: x (a.x), t (a.t), stop_time (0.0), stop_time_set (false), | : x (a.x), t (a.t), stop_time (0.0), stop_time_set (false), | |||
restart (true), integration_error (false), istate (0) { } | restart (true), integration_error (false), istate (0) { } | |||
virtual ~base_diff_eqn (void) { } | virtual ~base_diff_eqn (void) { } | |||
base_diff_eqn& operator = (const base_diff_eqn& a) | base_diff_eqn& operator = (const base_diff_eqn& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
x = a.x; | x = a.x; | |||
t = a.t; | t = a.t; | |||
stop_time = a.stop_time; | stop_time = a.stop_time; | |||
stop_time_set = a.stop_time_set; | stop_time_set = a.stop_time_set; | |||
restart = a.restart; | restart = a.restart; | |||
integration_error = a.integration_error; | integration_error = a.integration_error; | |||
istate = a.istate; | istate = a.istate; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
void initialize (const ColumnVector& x0, double t0) | void initialize (const ColumnVector& x0, double t0) | |||
{ | { | |||
x = x0; | x = x0; | |||
t = t0; | t = t0; | |||
integration_error = false; | integration_error = false; | |||
istate = 0; | istate = 0; | |||
force_restart (); | force_restart (); | |||
} | } | |||
octave_idx_type size (void) const { return x.capacity (); } | octave_idx_type size (void) const { return x.capacity (); } | |||
ColumnVector state (void) const { return x; } | ColumnVector state (void) const { return x; } | |||
double time (void) const { return t; } | double time (void) const { return t; } | |||
void set_stop_time (double tt) | void set_stop_time (double tt) | |||
{ | { | |||
stop_time_set = true; | stop_time_set = true; | |||
stop_time = tt; | stop_time = tt; | |||
force_restart (); | force_restart (); | |||
} | } | |||
void clear_stop_time (void) | void clear_stop_time (void) | |||
{ | { | |||
stop_time_set = false; | stop_time_set = false; | |||
force_restart (); | force_restart (); | |||
} | } | |||
virtual void force_restart (void) { restart = true; } | virtual void force_restart (void) { restart = true; } | |||
bool integration_ok (void) const { return ! integration_error; } | bool integration_ok (void) const { return ! integration_error; } | |||
octave_idx_type integration_state (void) const { return istate; } | octave_idx_type integration_state (void) const { return istate; } | |||
virtual std::string error_message (void) const = 0; | virtual std::string error_message (void) const = 0; | |||
protected: | protected: | |||
End of changes. 6 change blocks. | ||||
30 lines changed or deleted | 30 lines changed or added | |||
base-list.h | base-list.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2002-2012 John W. Eaton | Copyright (C) 2002-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 26 | skipping to change at line 26 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_base_list_h) | #if !defined (octave_base_list_h) | |||
#define octave_base_list_h 1 | #define octave_base_list_h 1 | |||
#include <cstdlib> | ||||
#include <list> | #include <list> | |||
template <typename elt_type> | template <typename elt_type> | |||
class | class | |||
octave_base_list | octave_base_list | |||
{ | { | |||
public: | public: | |||
typedef typename std::list<elt_type>::iterator iterator; | typedef typename std::list<elt_type>::iterator iterator; | |||
typedef typename std::list<elt_type>::const_iterator const_iterator; | typedef typename std::list<elt_type>::const_iterator const_iterator; | |||
typedef typename std::list<elt_type>::reverse_iterator reverse_iterator; | ||||
typedef typename std::list<elt_type>::const_reverse_iterator const_revers | ||||
e_iterator; | ||||
bool empty (void) const { return lst.empty (); } | bool empty (void) const { return lst.empty (); } | |||
size_t size (void) const { return lst.size (); } | size_t size (void) const { return lst.size (); } | |||
size_t length (void) const { return size (); } | size_t length (void) const { return size (); } | |||
iterator erase (iterator pos) { return lst.erase (pos); } | iterator erase (iterator pos) { return lst.erase (pos); } | |||
template <class P> | template <class P> | |||
void remove_if (P pred) | void remove_if (P pred) | |||
{ | { | |||
lst.remove_if (pred); | ||||
// FIXME: kluge removed 8/7/13. Eventually this commented | ||||
// code should be deleted. | ||||
// | ||||
// FIXME: this kluge should be removed at some point. | ||||
// We would like to simply call | // We would like to simply call | |||
// | // | |||
// lst.remove_if (pred); | // lst.remove_if (pred); | |||
// | // | |||
// but the Sun Studio compiler chokes on that. | // but the Sun Studio compiler chokes on that. | |||
// | // | |||
// FIXME -- this kluge should be removed at some point. | // iterator b = lst.begin (); | |||
// iterator e = lst.end (); | ||||
iterator b = lst.begin (); | // while (b != e) | |||
iterator e = lst.end (); | // { | |||
while (b != e) | // iterator n = b; | |||
{ | // n++; | |||
iterator n = b; | // if (pred (*b)) | |||
n++; | // lst.erase (b); | |||
if (pred (*b)) | // b = n; | |||
lst.erase (b); | // } | |||
b = n; | ||||
} | ||||
} | } | |||
void clear (void) { lst.clear (); } | void clear (void) { lst.clear (); } | |||
iterator begin (void) { return iterator (lst.begin ()); } | iterator begin (void) { return iterator (lst.begin ()); } | |||
const_iterator begin (void) const { return const_iterator (lst.begin ()); } | const_iterator begin (void) const { return const_iterator (lst.begin ()); } | |||
iterator end (void) { return iterator (lst.end ()); } | iterator end (void) { return iterator (lst.end ()); } | |||
const_iterator end (void) const { return const_iterator (lst.end ()); } | const_iterator end (void) const { return const_iterator (lst.end ()); } | |||
reverse_iterator rbegin (void) { return reverse_iterator (lst.rbegin ()); | ||||
} | ||||
const_reverse_iterator rbegin (void) const | ||||
{ return const_reverse_iterator (lst.rbegin ()); } | ||||
reverse_iterator rend (void) { return reverse_iterator (lst.rend ()); } | ||||
const_reverse_iterator rend (void) const | ||||
{ return const_reverse_iterator (lst.rend ()); } | ||||
elt_type& front (void) { return lst.front (); } | elt_type& front (void) { return lst.front (); } | |||
elt_type& back (void) { return lst.back (); } | elt_type& back (void) { return lst.back (); } | |||
const elt_type& front (void) const { return lst.front (); } | const elt_type& front (void) const { return lst.front (); } | |||
const elt_type& back (void) const { return lst.back (); } | const elt_type& back (void) const { return lst.back (); } | |||
void push_front (const elt_type& s) { lst.push_front (s); } | void push_front (const elt_type& s) { lst.push_front (s); } | |||
void push_back (const elt_type& s) { lst.push_back (s); } | void push_back (const elt_type& s) { lst.push_back (s); } | |||
void pop_front (void) { lst.pop_front (); } | void pop_front (void) { lst.pop_front (); } | |||
skipping to change at line 99 | skipping to change at line 116 | |||
protected: | protected: | |||
octave_base_list (void) : lst () { } | octave_base_list (void) : lst () { } | |||
octave_base_list (const std::list<elt_type>& l) : lst (l) { } | octave_base_list (const std::list<elt_type>& l) : lst (l) { } | |||
octave_base_list (const octave_base_list& bl) : lst (bl.lst) { } | octave_base_list (const octave_base_list& bl) : lst (bl.lst) { } | |||
octave_base_list& operator = (const octave_base_list& bl) | octave_base_list& operator = (const octave_base_list& bl) | |||
{ | { | |||
if (this != &bl) | if (this != &bl) | |||
{ | { | |||
lst = bl.lst; | lst = bl.lst; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~octave_base_list (void) { } | ~octave_base_list (void) { } | |||
private: | private: | |||
std::list<elt_type> lst; | std::list<elt_type> lst; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
20 lines changed or deleted | 39 lines changed or added | |||
base-lu.cc | base-lu.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 114 | skipping to change at line 114 | |||
} | } | |||
else | else | |||
return a_fact; | return a_fact; | |||
} | } | |||
template <class lu_type> | template <class lu_type> | |||
lu_type | lu_type | |||
base_lu <lu_type> :: Y (void) const | base_lu <lu_type> :: Y (void) const | |||
{ | { | |||
if (! packed ()) | if (! packed ()) | |||
(*current_liboctave_error_handler) ("lu: Y() not implemented for unpack | (*current_liboctave_error_handler) | |||
ed form"); | ("lu: Y () not implemented for unpacked form"); | |||
return a_fact; | return a_fact; | |||
} | } | |||
template <class lu_type> | template <class lu_type> | |||
Array<octave_idx_type> | Array<octave_idx_type> | |||
base_lu <lu_type> :: getp (void) const | base_lu <lu_type> :: getp (void) const | |||
{ | { | |||
if (packed ()) | if (packed ()) | |||
{ | { | |||
octave_idx_type a_nr = a_fact.rows (); | octave_idx_type a_nr = a_fact.rows (); | |||
Array<octave_idx_type> pvt (dim_vector (a_nr, 1)); | Array<octave_idx_type> pvt (dim_vector (a_nr, 1)); | |||
for (octave_idx_type i = 0; i < a_nr; i++) | for (octave_idx_type i = 0; i < a_nr; i++) | |||
pvt.xelem (i) = i; | pvt.xelem (i) = i; | |||
for (octave_idx_type i = 0; i < ipvt.length(); i++) | for (octave_idx_type i = 0; i < ipvt.length (); i++) | |||
{ | { | |||
octave_idx_type k = ipvt.xelem (i); | octave_idx_type k = ipvt.xelem (i); | |||
if (k != i) | if (k != i) | |||
{ | { | |||
octave_idx_type tmp = pvt.xelem (k); | octave_idx_type tmp = pvt.xelem (k); | |||
pvt.xelem (k) = pvt.xelem (i); | pvt.xelem (k) = pvt.xelem (i); | |||
pvt.xelem (i) = tmp; | pvt.xelem (i) = tmp; | |||
} | } | |||
} | } | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
base-lu.h | base-lu.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 49 | skipping to change at line 49 | |||
base_lu (void) | base_lu (void) | |||
: a_fact (), l_fact (), ipvt () { } | : a_fact (), l_fact (), ipvt () { } | |||
base_lu (const base_lu& a) | base_lu (const base_lu& a) | |||
: a_fact (a.a_fact), l_fact (a.l_fact), ipvt (a.ipvt) { } | : a_fact (a.a_fact), l_fact (a.l_fact), ipvt (a.ipvt) { } | |||
base_lu (const lu_type& l, const lu_type& u, | base_lu (const lu_type& l, const lu_type& u, | |||
const PermMatrix& p); | const PermMatrix& p); | |||
base_lu& operator = (const base_lu& a) | base_lu& operator = (const base_lu& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
a_fact = a.a_fact; | a_fact = a.a_fact; | |||
l_fact = a.l_fact; | l_fact = a.l_fact; | |||
ipvt = a.ipvt; | ipvt = a.ipvt; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
virtual ~base_lu (void) { } | virtual ~base_lu (void) { } | |||
bool packed (void) const; | bool packed (void) const; | |||
void unpack (void); | void unpack (void); | |||
lu_type L (void) const; | lu_type L (void) const; | |||
lu_type U (void) const; | lu_type U (void) const; | |||
End of changes. 2 change blocks. | ||||
10 lines changed or deleted | 10 lines changed or added | |||
base-min.h | base-min.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1995-2012 John W. Eaton | Copyright (C) 1995-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 42 | skipping to change at line 42 | |||
base_minimizer (void) : x () { } | base_minimizer (void) : x () { } | |||
base_minimizer (const ColumnVector& xx) : x (xx) { } | base_minimizer (const ColumnVector& xx) : x (xx) { } | |||
base_minimizer (const base_minimizer& a) : x (a.x) { } | base_minimizer (const base_minimizer& a) : x (a.x) { } | |||
virtual ~base_minimizer (void) { } | virtual ~base_minimizer (void) { } | |||
base_minimizer& operator = (const base_minimizer& a) | base_minimizer& operator = (const base_minimizer& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
x = a.x; | x = a.x; | |||
return *this; | return *this; | |||
} | } | |||
// Derived classes must provide a function to actually do the | // Derived classes must provide a function to actually do the | |||
// minimization. | // minimization. | |||
virtual ColumnVector do_minimize (double& objf, octave_idx_type& inform, | virtual ColumnVector do_minimize (double& objf, octave_idx_type& inform, | |||
ColumnVector& lambda) = 0; | ColumnVector& lambda) = 0; | |||
// Lots of ways to call the single function and optionally set and | // Lots of ways to call the single function and optionally set and | |||
// get additional information. | // get additional information. | |||
virtual ColumnVector minimize (void) | virtual ColumnVector minimize (void) | |||
{ | { | |||
double objf; | double objf; | |||
octave_idx_type inform; | octave_idx_type inform; | |||
ColumnVector lambda; | ColumnVector lambda; | |||
return do_minimize (objf, inform, lambda); | return do_minimize (objf, inform, lambda); | |||
} | } | |||
virtual ColumnVector minimize (double& objf) | virtual ColumnVector minimize (double& objf) | |||
{ | { | |||
octave_idx_type inform; | octave_idx_type inform; | |||
ColumnVector lambda; | ColumnVector lambda; | |||
return do_minimize (objf, inform, lambda); | return do_minimize (objf, inform, lambda); | |||
} | } | |||
virtual ColumnVector minimize (double& objf, octave_idx_type& inform) | virtual ColumnVector minimize (double& objf, octave_idx_type& inform) | |||
{ | { | |||
ColumnVector lambda; | ColumnVector lambda; | |||
return do_minimize (objf, inform, lambda); | return do_minimize (objf, inform, lambda); | |||
} | } | |||
virtual ColumnVector minimize (double& objf, octave_idx_type& inform, | virtual ColumnVector minimize (double& objf, octave_idx_type& inform, | |||
ColumnVector& lambda) | ColumnVector& lambda) | |||
{ | { | |||
return do_minimize (objf, inform, lambda); | return do_minimize (objf, inform, lambda); | |||
} | } | |||
virtual ColumnVector minimize (const ColumnVector& x0) | virtual ColumnVector minimize (const ColumnVector& x0) | |||
{ | { | |||
x = x0; | x = x0; | |||
double objf; | double objf; | |||
octave_idx_type inform; | octave_idx_type inform; | |||
ColumnVector lambda; | ColumnVector lambda; | |||
return do_minimize (objf, inform, lambda); | return do_minimize (objf, inform, lambda); | |||
} | } | |||
virtual ColumnVector minimize (const ColumnVector& x0, double& objf) | virtual ColumnVector minimize (const ColumnVector& x0, double& objf) | |||
{ | { | |||
x = x0; | x = x0; | |||
octave_idx_type inform; | octave_idx_type inform; | |||
ColumnVector lambda; | ColumnVector lambda; | |||
return do_minimize (objf, inform, lambda); | return do_minimize (objf, inform, lambda); | |||
} | } | |||
virtual ColumnVector minimize (const ColumnVector& x0, double& objf, | virtual ColumnVector minimize (const ColumnVector& x0, double& objf, | |||
octave_idx_type& inform) | octave_idx_type& inform) | |||
{ | { | |||
x = x0; | x = x0; | |||
ColumnVector lambda; | ColumnVector lambda; | |||
return do_minimize (objf, inform, lambda); | return do_minimize (objf, inform, lambda); | |||
} | } | |||
virtual ColumnVector minimize (const ColumnVector& x0, double& objf, | virtual ColumnVector minimize (const ColumnVector& x0, double& objf, | |||
octave_idx_type& inform, ColumnVector& lam bda) | octave_idx_type& inform, ColumnVector& lam bda) | |||
{ | { | |||
x = x0; | x = x0; | |||
return do_minimize (objf, inform, lambda); | return do_minimize (objf, inform, lambda); | |||
} | } | |||
octave_idx_type size (void) const { return x.capacity (); } | octave_idx_type size (void) const { return x.capacity (); } | |||
protected: | protected: | |||
ColumnVector x; | ColumnVector x; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
46 lines changed or deleted | 46 lines changed or added | |||
base-qr.cc | base-qr.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 Jaroslav Hajek | Copyright (C) 2009-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
base-qr.h | base-qr.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 Jaroslav Hajek | Copyright (C) 2009-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 52 | skipping to change at line 52 | |||
typedef typename qr_type::element_type qr_elt_type; | typedef typename qr_type::element_type qr_elt_type; | |||
base_qr (void) : q (), r () { } | base_qr (void) : q (), r () { } | |||
base_qr (const qr_type& q, const qr_type& r); | base_qr (const qr_type& q, const qr_type& r); | |||
base_qr (const base_qr& a) : q (a.q), r (a.r) { } | base_qr (const base_qr& a) : q (a.q), r (a.r) { } | |||
base_qr& operator = (const base_qr& a) | base_qr& operator = (const base_qr& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
q = a.q; | q = a.q; | |||
r = a.r; | r = a.r; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
virtual ~base_qr (void) { } | virtual ~base_qr (void) { } | |||
qr_type Q (void) const { return q; } | qr_type Q (void) const { return q; } | |||
qr_type R (void) const { return r; } | qr_type R (void) const { return r; } | |||
qr_type_t get_type (void) const; | qr_type_t get_type (void) const; | |||
bool regular (void) const; | bool regular (void) const; | |||
End of changes. 2 change blocks. | ||||
9 lines changed or deleted | 9 lines changed or added | |||
boolMatrix.h | boolMatrix.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_boolMatrix_int_h) | #if !defined (octave_boolMatrix_h) | |||
#define octave_boolMatrix_int_h 1 | #define octave_boolMatrix_h 1 | |||
#include "Array.h" | #include "Array.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
#include "mx-op-decl.h" | #include "mx-op-decl.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
boolMatrix : public Array<bool> | boolMatrix : public Array<bool> | |||
{ | { | |||
skipping to change at line 55 | skipping to change at line 55 | |||
boolMatrix (const dim_vector& dv) : Array<bool> (dv) { } | boolMatrix (const dim_vector& dv) : Array<bool> (dv) { } | |||
boolMatrix (const dim_vector& dv, bool val) : Array<bool> (dv, val) { } | boolMatrix (const dim_vector& dv, bool val) : Array<bool> (dv, val) { } | |||
boolMatrix (const Array<bool>& a) : Array<bool> (a.as_matrix ()) { } | boolMatrix (const Array<bool>& a) : Array<bool> (a.as_matrix ()) { } | |||
boolMatrix (const boolMatrix& a) : Array<bool> (a) { } | boolMatrix (const boolMatrix& a) : Array<bool> (a) { } | |||
boolMatrix& operator = (const boolMatrix& a) | boolMatrix& operator = (const boolMatrix& a) | |||
{ | { | |||
Array<bool>::operator = (a); | Array<bool>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const boolMatrix& a) const; | bool operator == (const boolMatrix& a) const; | |||
bool operator != (const boolMatrix& a) const; | bool operator != (const boolMatrix& a) const; | |||
boolMatrix transpose (void) const { return Array<bool>::transpose (); } | boolMatrix transpose (void) const { return Array<bool>::transpose (); } | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
boolMatrix& insert (const boolMatrix& a, octave_idx_type r, octave_idx_ty | boolMatrix& insert (const boolMatrix& a, | |||
pe c); | octave_idx_type r, octave_idx_type c); | |||
// unary operations | // unary operations | |||
boolMatrix operator ! (void) const; | boolMatrix operator ! (void) const; | |||
// other operations | // other operations | |||
boolMatrix diag (octave_idx_type k = 0) const; | boolMatrix diag (octave_idx_type k = 0) const; | |||
boolMatrix all (int dim = -1) const; | boolMatrix all (int dim = -1) const; | |||
boolMatrix any (int dim = -1) const; | boolMatrix any (int dim = -1) const; | |||
#if 0 | #if 0 | |||
// i/o | // i/o | |||
friend std::ostream& operator << (std::ostream& os, const Matrix& a); | friend std::ostream& operator << (std::ostream& os, const Matrix& a); | |||
friend std::istream& operator >> (std::istream& is, Matrix& a); | friend std::istream& operator >> (std::istream& is, Matrix& a); | |||
#endif | #endif | |||
void resize (octave_idx_type nr, octave_idx_type nc, | void resize (octave_idx_type nr, octave_idx_type nc, bool rfv = false) | |||
bool rfv = resize_fill_value ()) | ||||
{ | { | |||
Array<bool>::resize (dim_vector (nr, nc), rfv); | Array<bool>::resize (dim_vector (nr, nc), rfv); | |||
} | } | |||
static bool resize_fill_value (void) { return false; } | ||||
}; | }; | |||
MM_BOOL_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API) | MM_BOOL_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API) | |||
MS_BOOL_OP_DECLS (boolMatrix, bool, OCTAVE_API) | MS_BOOL_OP_DECLS (boolMatrix, bool, OCTAVE_API) | |||
SM_BOOL_OP_DECLS (bool, boolMatrix, OCTAVE_API) | SM_BOOL_OP_DECLS (bool, boolMatrix, OCTAVE_API) | |||
MM_CMP_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API) | MM_CMP_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API) | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
14 lines changed or deleted | 10 lines changed or added | |||
boolNDArray.h | boolNDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 56 | skipping to change at line 56 | |||
boolNDArray (const dim_vector& dv, const bool& val) | boolNDArray (const dim_vector& dv, const bool& val) | |||
: Array<bool> (dv, val) { } | : Array<bool> (dv, val) { } | |||
boolNDArray (const boolNDArray& a) : Array<bool> (a) { } | boolNDArray (const boolNDArray& a) : Array<bool> (a) { } | |||
boolNDArray (const boolMatrix& a) : Array<bool> (a) { } | boolNDArray (const boolMatrix& a) : Array<bool> (a) { } | |||
boolNDArray (const Array<bool>& a) : Array<bool> (a) { } | boolNDArray (const Array<bool>& a) : Array<bool> (a) { } | |||
boolNDArray& operator = (const boolNDArray& a) | boolNDArray& operator = (const boolNDArray& a) | |||
{ | { | |||
Array<bool>::operator = (a); | Array<bool>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
// unary operations | // unary operations | |||
boolNDArray operator ! (void) const; | boolNDArray operator ! (void) const; | |||
boolNDArray& invert (void); | boolNDArray& invert (void); | |||
bool any_element_is_nan (void) const { return false; } | bool any_element_is_nan (void) const { return false; } | |||
// FIXME -- this is not quite the right thing. | // FIXME: this is not quite the right thing. | |||
boolNDArray all (int dim = -1) const; | boolNDArray all (int dim = -1) const; | |||
boolNDArray any (int dim = -1) const; | boolNDArray any (int dim = -1) const; | |||
NDArray sum (int dim = -1) const; | NDArray sum (int dim = -1) const; | |||
NDArray cumsum (int dim = -1) const; | NDArray cumsum (int dim = -1) const; | |||
boolNDArray concat (const boolNDArray& rb, const Array<octave_idx_type>& | boolNDArray concat (const boolNDArray& rb, | |||
ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
boolNDArray& insert (const boolNDArray& a, octave_idx_type r, octave_idx_ | boolNDArray& insert (const boolNDArray& a, octave_idx_type r, | |||
type c); | octave_idx_type c); | |||
boolNDArray& insert (const boolNDArray& a, const Array<octave_idx_type>& | boolNDArray& insert (const boolNDArray& a, | |||
ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
boolMatrix matrix_value (void) const; | boolMatrix matrix_value (void) const; | |||
boolNDArray squeeze (void) const { return Array<bool>::squeeze (); } | boolNDArray squeeze (void) const { return Array<bool>::squeeze (); } | |||
static void increment_index (Array<octave_idx_type>& ra_idx, | static void increment_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions, | const dim_vector& dimensions, | |||
int start_dimension = 0); | int start_dimension = 0); | |||
static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions); | const dim_vector& dimensions); | |||
// i/o | // i/o | |||
// friend std::ostream& operator << (std::ostream& os, const NDArray& a); | // friend std::ostream& operator << (std::ostream& os, const NDArray& a); | |||
// friend std::istream& operator >> (std::istream& is, NDArray& a); | // friend std::istream& operator >> (std::istream& is, NDArray& a); | |||
static bool resize_fill_value (void) { return false; } | ||||
// bool all_elements_are_real (void) const; | // bool all_elements_are_real (void) const; | |||
// bool all_integers (double& max_val, double& min_val) const; | // bool all_integers (double& max_val, double& min_val) const; | |||
boolNDArray diag (octave_idx_type k = 0) const; | boolNDArray diag (octave_idx_type k = 0) const; | |||
boolNDArray diag (octave_idx_type m, octave_idx_type n) const; | ||||
}; | }; | |||
NDND_BOOL_OP_DECLS (boolNDArray, boolNDArray, OCTAVE_API) | NDND_BOOL_OP_DECLS (boolNDArray, boolNDArray, OCTAVE_API) | |||
NDND_CMP_OP_DECLS (boolNDArray, boolNDArray, OCTAVE_API) | NDND_CMP_OP_DECLS (boolNDArray, boolNDArray, OCTAVE_API) | |||
NDS_BOOL_OP_DECLS (boolNDArray, bool, OCTAVE_API) | NDS_BOOL_OP_DECLS (boolNDArray, bool, OCTAVE_API) | |||
NDS_CMP_OP_DECLS (boolNDArray, bool, OCTAVE_API) | NDS_CMP_OP_DECLS (boolNDArray, bool, OCTAVE_API) | |||
SND_BOOL_OP_DECLS (bool, boolNDArray, OCTAVE_API) | SND_BOOL_OP_DECLS (bool, boolNDArray, OCTAVE_API) | |||
SND_CMP_OP_DECLS (bool, boolNDArray, OCTAVE_API) | SND_CMP_OP_DECLS (bool, boolNDArray, OCTAVE_API) | |||
End of changes. 8 change blocks. | ||||
15 lines changed or deleted | 14 lines changed or added | |||
boolSparse.h | boolSparse.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 41 | skipping to change at line 41 | |||
class SparseMatrix; | class SparseMatrix; | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
SparseBoolMatrix : public Sparse<bool> | SparseBoolMatrix : public Sparse<bool> | |||
{ | { | |||
public: | public: | |||
SparseBoolMatrix (void) : Sparse<bool> () { } | SparseBoolMatrix (void) : Sparse<bool> () { } | |||
SparseBoolMatrix (octave_idx_type r, octave_idx_type c) : Sparse<bool> (r | SparseBoolMatrix (octave_idx_type r, octave_idx_type c) | |||
, c) { } | : Sparse<bool> (r, c) { } | |||
explicit SparseBoolMatrix (octave_idx_type r, octave_idx_type c, bool val ) | explicit SparseBoolMatrix (octave_idx_type r, octave_idx_type c, bool val ) | |||
: Sparse<bool> (r, c, val) { } | : Sparse<bool> (r, c, val) { } | |||
SparseBoolMatrix (const dim_vector& dv, octave_idx_type nz = 0) : | SparseBoolMatrix (const dim_vector& dv, octave_idx_type nz = 0) | |||
Sparse<bool> (dv, nz) { } | : Sparse<bool> (dv, nz) { } | |||
SparseBoolMatrix (const Sparse<bool>& a) : Sparse<bool> (a) { } | SparseBoolMatrix (const Sparse<bool>& a) : Sparse<bool> (a) { } | |||
SparseBoolMatrix (const SparseBoolMatrix& a) : Sparse<bool> (a) { } | SparseBoolMatrix (const SparseBoolMatrix& a) : Sparse<bool> (a) { } | |||
SparseBoolMatrix (const SparseBoolMatrix& a, const dim_vector& dv) | SparseBoolMatrix (const SparseBoolMatrix& a, const dim_vector& dv) | |||
: Sparse<bool> (a, dv) { } | : Sparse<bool> (a, dv) { } | |||
explicit SparseBoolMatrix (const boolMatrix& a) : Sparse<bool> (a) { } | explicit SparseBoolMatrix (const boolMatrix& a) : Sparse<bool> (a) { } | |||
explicit SparseBoolMatrix (const boolNDArray& a) : Sparse<bool> (a) { } | explicit SparseBoolMatrix (const boolNDArray& a) : Sparse<bool> (a) { } | |||
explicit SparseBoolMatrix (const PermMatrix& a) : Sparse<bool> (a) { }; | explicit SparseBoolMatrix (const PermMatrix& a) : Sparse<bool> (a) { }; | |||
SparseBoolMatrix (const Array<bool>& a, const idx_vector& r, | SparseBoolMatrix (const Array<bool>& a, const idx_vector& r, | |||
const idx_vector& c, octave_idx_type nr = -1, | const idx_vector& c, octave_idx_type nr = -1, | |||
octave_idx_type nc = -1, bool sum_terms = true, | octave_idx_type nc = -1, bool sum_terms = true, | |||
octave_idx_type nzm = -1) | octave_idx_type nzm = -1) | |||
: Sparse<bool> (a, r, c, nr, nc, sum_terms, nzm) { } | : Sparse<bool> (a, r, c, nr, nc, sum_terms, nzm) { } | |||
SparseBoolMatrix (octave_idx_type r, octave_idx_type c, octave_idx_type n | SparseBoolMatrix (octave_idx_type r, octave_idx_type c, | |||
um_nz) : Sparse<bool> (r, c, num_nz) { } | octave_idx_type num_nz) : Sparse<bool> (r, c, num_nz) { | |||
} | ||||
SparseBoolMatrix& operator = (const SparseBoolMatrix& a) | SparseBoolMatrix& operator = (const SparseBoolMatrix& a) | |||
{ | { | |||
Sparse<bool>::operator = (a); | Sparse<bool>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const SparseBoolMatrix& a) const; | bool operator == (const SparseBoolMatrix& a) const; | |||
bool operator != (const SparseBoolMatrix& a) const; | bool operator != (const SparseBoolMatrix& a) const; | |||
SparseBoolMatrix transpose (void) const | SparseBoolMatrix transpose (void) const | |||
{ return Sparse<bool>::transpose (); } | { return Sparse<bool>::transpose (); } | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
SparseBoolMatrix& insert (const SparseBoolMatrix& a, octave_idx_type r, o | SparseBoolMatrix& insert (const SparseBoolMatrix& a, | |||
ctave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
SparseBoolMatrix& insert (const SparseBoolMatrix& a, const Array<octave_i | SparseBoolMatrix& insert (const SparseBoolMatrix& a, | |||
dx_type>& indx); | const Array<octave_idx_type>& indx); | |||
SparseBoolMatrix concat (const SparseBoolMatrix& rb, | SparseBoolMatrix concat (const SparseBoolMatrix& rb, | |||
const Array<octave_idx_type>& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
SparseBoolMatrix diag (octave_idx_type k = 0) const; | SparseBoolMatrix diag (octave_idx_type k = 0) const; | |||
boolMatrix matrix_value (void) const; | boolMatrix matrix_value (void) const; | |||
SparseBoolMatrix squeeze (void) const; | SparseBoolMatrix squeeze (void) const; | |||
SparseBoolMatrix index (const idx_vector& i, bool resize_ok) const; | SparseBoolMatrix index (const idx_vector& i, bool resize_ok) const; | |||
SparseBoolMatrix index (const idx_vector& i, const idx_vector& j, bool re | SparseBoolMatrix index (const idx_vector& i, const idx_vector& j, | |||
size_ok) const; | bool resize_ok) const; | |||
SparseBoolMatrix reshape (const dim_vector& new_dims) const; | SparseBoolMatrix reshape (const dim_vector& new_dims) const; | |||
SparseBoolMatrix permute (const Array<octave_idx_type>& vec, bool inv = f | SparseBoolMatrix permute (const Array<octave_idx_type>& vec, | |||
alse) const; | bool inv = false) const; | |||
SparseBoolMatrix ipermute (const Array<octave_idx_type>& vec) const; | SparseBoolMatrix ipermute (const Array<octave_idx_type>& vec) const; | |||
// unary operations | // unary operations | |||
SparseBoolMatrix operator ! (void) const; | SparseBoolMatrix operator ! (void) const; | |||
// other operations | // other operations | |||
SparseBoolMatrix all (int dim = -1) const; | SparseBoolMatrix all (int dim = -1) const; | |||
SparseBoolMatrix any (int dim = -1) const; | SparseBoolMatrix any (int dim = -1) const; | |||
SparseMatrix sum (int dim = -1) const; | SparseMatrix sum (int dim = -1) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Spar | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
seBoolMatrix& a); | const SparseBoolMatrix& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, SparseBool | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
Matrix& a); | SparseBoolMatrix& a); | |||
}; | }; | |||
SPARSE_SMS_EQNE_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API) | SPARSE_SMS_EQNE_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API) | |||
SPARSE_SMS_BOOL_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API) | SPARSE_SMS_BOOL_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API) | |||
SPARSE_SSM_EQNE_OP_DECLS (bool, SparseBoolMatrix, OCTAVE_API) | SPARSE_SSM_EQNE_OP_DECLS (bool, SparseBoolMatrix, OCTAVE_API) | |||
SPARSE_SSM_BOOL_OP_DECLS (bool, SparseBoolMatrix, OCTAVE_API) | SPARSE_SSM_BOOL_OP_DECLS (bool, SparseBoolMatrix, OCTAVE_API) | |||
SPARSE_SMSM_EQNE_OP_DECLS (SparseBoolMatrix, SparseBoolMatrix, OCTAVE_API) | SPARSE_SMSM_EQNE_OP_DECLS (SparseBoolMatrix, SparseBoolMatrix, OCTAVE_API) | |||
SPARSE_SMSM_BOOL_OP_DECLS (SparseBoolMatrix, SparseBoolMatrix, OCTAVE_API) | SPARSE_SMSM_BOOL_OP_DECLS (SparseBoolMatrix, SparseBoolMatrix, OCTAVE_API) | |||
End of changes. 11 change blocks. | ||||
24 lines changed or deleted | 25 lines changed or added | |||
bsxfun-decl.h | bsxfun-decl.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 Jaroslav Hajek | Copyright (C) 2009-2013 Jaroslav Hajek | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
bsxfun-defs.cc | bsxfun-defs.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 Jaroslav Hajek | Copyright (C) 2009-2013 Jaroslav Hajek | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
bsxfun.h | bsxfun.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2012 Jordi Gutiérrez Hermoso <jordigh@octave.org> | Copyright (C) 2012-2013 Jordi Gutiérrez Hermoso | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (bsxfun_h) | ||||
#define bsxfun_h 1 | // Author: Jordi Gutiérrez Hermoso <jordigh@octave.org> | |||
#if !defined (octave_bsxfun_h) | ||||
#define octave_bsxfun_h 1 | ||||
#include <algorithm> | #include <algorithm> | |||
#include "Array.h" | #include "Array.h" | |||
#include "dim-vector.h" | #include "dim-vector.h" | |||
#include "lo-error.h" | #include "lo-error.h" | |||
inline | inline | |||
bool | bool | |||
is_valid_bsxfun (const std::string& name, const dim_vector& dx, | is_valid_bsxfun (const std::string& name, const dim_vector& dx, | |||
skipping to change at line 45 | skipping to change at line 48 | |||
{ | { | |||
for (int i = 0; i < std::min (dx.length (), dy.length ()); i++) | for (int i = 0; i < std::min (dx.length (), dy.length ()); i++) | |||
{ | { | |||
octave_idx_type xk = dx(i), yk = dy(i); | octave_idx_type xk = dx(i), yk = dy(i); | |||
// Check the three conditions for valid bsxfun dims | // Check the three conditions for valid bsxfun dims | |||
if (! ( (xk == yk) || (xk == 1 && yk > 1) || (xk > 1 && yk == 1))) | if (! ( (xk == yk) || (xk == 1 && yk > 1) || (xk > 1 && yk == 1))) | |||
return false; | return false; | |||
} | } | |||
(*current_liboctave_warning_with_id_handler) | (*current_liboctave_warning_with_id_handler) | |||
("Octave:broadcast", "%s: automatic broadcasting operation applied", na | ("Octave:broadcast", "%s: automatic broadcasting operation applied", | |||
me.c_str ()); | name.c_str ()); | |||
return true; | return true; | |||
} | } | |||
// since we can't change the size of the assigned-to matrix, we cannot | // since we can't change the size of the assigned-to matrix, we cannot | |||
// apply singleton expansion to it, so the conditions to check are | // apply singleton expansion to it, so the conditions to check are | |||
// different here. | // different here. | |||
inline | inline | |||
bool | bool | |||
is_valid_inplace_bsxfun (const std::string& name, const dim_vector& dr, | is_valid_inplace_bsxfun (const std::string& name, const dim_vector& dr, | |||
skipping to change at line 72 | skipping to change at line 76 | |||
for (int i = 0; i < drl; i++) | for (int i = 0; i < drl; i++) | |||
{ | { | |||
octave_idx_type rk = dr(i), xk = dx(i); | octave_idx_type rk = dr(i), xk = dx(i); | |||
// Only two valid canditions to check; can't stretch rk | // Only two valid canditions to check; can't stretch rk | |||
if (! ( (rk == xk) || (rk > 1 && xk == 1))) | if (! ( (rk == xk) || (rk > 1 && xk == 1))) | |||
return false; | return false; | |||
} | } | |||
(*current_liboctave_warning_with_id_handler) | (*current_liboctave_warning_with_id_handler) | |||
("Octave:broadcast", "%s: automatic broadcasting operation applied", na | ("Octave:broadcast", "%s: automatic broadcasting operation applied", | |||
me.c_str ()); | name.c_str ()); | |||
return true; | return true; | |||
} | } | |||
#include "bsxfun-defs.cc" | #include "bsxfun-defs.cc" | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
7 lines changed or deleted | 10 lines changed or added | |||
builtins.h | builtins.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 26 | skipping to change at line 26 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_builtins_h) | #if !defined (octave_builtins_h) | |||
#define octave_builtins_h 1 | #define octave_builtins_h 1 | |||
#if !defined (MAKE_BUILTINS) | ||||
#include "builtin-defun-decls.h" | ||||
#endif | ||||
extern OCTINTERP_API void install_builtins (void); | extern OCTINTERP_API void install_builtins (void); | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
byte-swap.h | byte-swap.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 26 | skipping to change at line 26 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_byte_swap_h) | #if !defined (octave_byte_swap_h) | |||
#define octave_byte_swap_h 1 | #define octave_byte_swap_h 1 | |||
// FIXME -- not sure these volatile qualifiers are really | ||||
// needed or appropriate here. | ||||
static inline void | static inline void | |||
swap_bytes (volatile void *ptr, unsigned int i, unsigned int j) | swap_bytes (void *ptr, unsigned int i, unsigned int j) | |||
{ | { | |||
volatile char *t = static_cast<volatile char *> (ptr); | char *t = static_cast<char *> (ptr); | |||
char tmp = t[i]; | char tmp = t[i]; | |||
t[i] = t[j]; | t[i] = t[j]; | |||
t[j] = tmp; | t[j] = tmp; | |||
} | } | |||
template <int n> | template <int n> | |||
void | void | |||
swap_bytes (volatile void *ptr) | swap_bytes (void *ptr) | |||
{ | { | |||
for (int i = 0; i < n/2; i++) | for (int i = 0; i < n/2; i++) | |||
swap_bytes (ptr, i, n-1-i); | swap_bytes (ptr, i, n-1-i); | |||
} | } | |||
template <> | template <> | |||
inline void | inline void | |||
swap_bytes <1> (volatile void *) | swap_bytes<1> (void *) | |||
{ | { | |||
} | } | |||
template <> | template <> | |||
inline void | inline void | |||
swap_bytes <2> (volatile void *ptr) | swap_bytes<2> (void *ptr) | |||
{ | { | |||
swap_bytes (ptr, 0, 1); | swap_bytes (ptr, 0, 1); | |||
} | } | |||
template <> | template <> | |||
inline void | inline void | |||
swap_bytes <4> (volatile void *ptr) | swap_bytes<4> (void *ptr) | |||
{ | { | |||
swap_bytes (ptr, 0, 3); | swap_bytes (ptr, 0, 3); | |||
swap_bytes (ptr, 1, 2); | swap_bytes (ptr, 1, 2); | |||
} | } | |||
template <> | template <> | |||
inline void | inline void | |||
swap_bytes <8> (volatile void *ptr) | swap_bytes<8> (void *ptr) | |||
{ | { | |||
swap_bytes (ptr, 0, 7); | swap_bytes (ptr, 0, 7); | |||
swap_bytes (ptr, 1, 6); | swap_bytes (ptr, 1, 6); | |||
swap_bytes (ptr, 2, 5); | swap_bytes (ptr, 2, 5); | |||
swap_bytes (ptr, 3, 4); | swap_bytes (ptr, 3, 4); | |||
} | } | |||
template <int n> | template <int n> | |||
void | void | |||
swap_bytes (volatile void *ptr, int len) | swap_bytes (void *ptr, int len) | |||
{ | { | |||
volatile char *t = static_cast<volatile char *> (ptr); | char *t = static_cast<char *> (ptr); | |||
for (int i = 0; i < len; i++) | for (int i = 0; i < len; i++) | |||
{ | { | |||
swap_bytes<n> (t); | swap_bytes<n> (t); | |||
t += n; | t += n; | |||
} | } | |||
} | } | |||
template <> | template <> | |||
inline void | inline void | |||
swap_bytes<1> (volatile void *, int) | swap_bytes<1> (void *, int) | |||
{ | { | |||
} | } | |||
#endif | #endif | |||
End of changes. 12 change blocks. | ||||
14 lines changed or deleted | 11 lines changed or added | |||
c-file-ptr-stream.h | c-file-ptr-stream.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2000-2012 John W. Eaton | Copyright (C) 2000-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 47 | skipping to change at line 47 | |||
#else | #else | |||
typedef std::streambuf::int_type int_type; | typedef std::streambuf::int_type int_type; | |||
#endif | #endif | |||
typedef int (*close_fcn) (FILE *); | typedef int (*close_fcn) (FILE *); | |||
FILE* stdiofile (void) { return f; } | FILE* stdiofile (void) { return f; } | |||
c_file_ptr_buf (FILE *f_arg, close_fcn cf_arg = file_close) | c_file_ptr_buf (FILE *f_arg, close_fcn cf_arg = file_close) | |||
: std::streambuf (), f (f_arg), cf (cf_arg) | : std::streambuf (), f (f_arg), cf (cf_arg) | |||
{ } | { } | |||
~c_file_ptr_buf (void); | ~c_file_ptr_buf (void); | |||
int_type overflow (int_type); | int_type overflow (int_type); | |||
int_type underflow (void) { return underflow_common (false); } | int_type underflow (void) { return underflow_common (false); } | |||
int_type uflow (void) { return underflow_common (true); } | int_type uflow (void) { return underflow_common (true); } | |||
int_type pbackfail (int_type); | int_type pbackfail (int_type); | |||
skipping to change at line 77 | skipping to change at line 77 | |||
std::ios::openmode = std::ios::in | std::ios::out ); | std::ios::openmode = std::ios::in | std::ios::out ); | |||
int sync (void); | int sync (void); | |||
int flush (void); | int flush (void); | |||
int buf_close (void); | int buf_close (void); | |||
int file_number () const { return f ? fileno (f) : -1; } | int file_number () const { return f ? fileno (f) : -1; } | |||
int seek (long offset, int origin); | int seek (off_t offset, int origin); | |||
long tell (void); | off_t tell (void); | |||
void clear (void) { if (f) clearerr (f); } | void clear (void) { if (f) clearerr (f); } | |||
static int file_close (FILE *f); | static int file_close (FILE *f); | |||
protected: | protected: | |||
FILE *f; | FILE *f; | |||
close_fcn cf; | close_fcn cf; | |||
skipping to change at line 102 | skipping to change at line 102 | |||
int_type underflow_common (bool); | int_type underflow_common (bool); | |||
// No copying! | // No copying! | |||
c_file_ptr_buf (const c_file_ptr_buf&); | c_file_ptr_buf (const c_file_ptr_buf&); | |||
c_file_ptr_buf& operator = (const c_file_ptr_buf&); | c_file_ptr_buf& operator = (const c_file_ptr_buf&); | |||
}; | }; | |||
// FIXME -- the following three classes could probably share | // FIXME: the following three classes could probably share some code... | |||
// some code... | ||||
template <typename STREAM_T, typename FILE_T, typename BUF_T> | template <typename STREAM_T, typename FILE_T, typename BUF_T> | |||
class | class | |||
c_file_ptr_stream : public STREAM_T | c_file_ptr_stream : public STREAM_T | |||
{ | { | |||
public: | public: | |||
c_file_ptr_stream (FILE_T f, typename BUF_T::close_fcn cf = BUF_T::file_c lose) | c_file_ptr_stream (FILE_T f, typename BUF_T::close_fcn cf = BUF_T::file_c lose) | |||
: STREAM_T (0), buf (new BUF_T (f, cf)) { STREAM_T::init (buf); } | : STREAM_T (0), buf (new BUF_T (f, cf)) { STREAM_T::init (buf); } | |||
~c_file_ptr_stream (void) { delete buf; buf = 0; } | ~c_file_ptr_stream (void) { delete buf; buf = 0; } | |||
BUF_T *rdbuf (void) { return buf; } | BUF_T *rdbuf (void) { return buf; } | |||
void stream_close (void) { if (buf) buf->buf_close (); } | void stream_close (void) { if (buf) buf->buf_close (); } | |||
int seek (long offset, int origin) | int seek (off_t offset, int origin) | |||
{ return buf ? buf->seek (offset, origin) : -1; } | { return buf ? buf->seek (offset, origin) : -1; } | |||
long tell (void) { return buf ? buf->tell () : -1; } | off_t tell (void) { return buf ? buf->tell () : -1; } | |||
void clear (void) { if (buf) buf->clear (); STREAM_T::clear (); } | void clear (void) { if (buf) buf->clear (); STREAM_T::clear (); } | |||
private: | private: | |||
BUF_T *buf; | BUF_T *buf; | |||
// No copying! | // No copying! | |||
c_file_ptr_stream (const c_file_ptr_stream&); | c_file_ptr_stream (const c_file_ptr_stream&); | |||
c_file_ptr_stream& operator = (const c_file_ptr_stream&); | c_file_ptr_stream& operator = (const c_file_ptr_stream&); | |||
}; | }; | |||
typedef c_file_ptr_stream<std::istream, FILE *, c_file_ptr_buf> i_c_file_pt | typedef c_file_ptr_stream<std::istream, FILE *, c_file_ptr_buf> | |||
r_stream; | i_c_file_ptr_stream; | |||
typedef c_file_ptr_stream<std::ostream, FILE *, c_file_ptr_buf> o_c_file_pt | typedef c_file_ptr_stream<std::ostream, FILE *, c_file_ptr_buf> | |||
r_stream; | o_c_file_ptr_stream; | |||
typedef c_file_ptr_stream<std::iostream, FILE *, c_file_ptr_buf> io_c_file_ | typedef c_file_ptr_stream<std::iostream, FILE *, c_file_ptr_buf> | |||
ptr_stream; | io_c_file_ptr_stream; | |||
#ifdef HAVE_ZLIB | #ifdef HAVE_ZLIB | |||
#ifdef HAVE_ZLIB_H | #ifdef HAVE_ZLIB_H | |||
#include <zlib.h> | #include <zlib.h> | |||
#endif | #endif | |||
class | class | |||
c_zfile_ptr_buf : public std::streambuf | c_zfile_ptr_buf : public std::streambuf | |||
{ | { | |||
skipping to change at line 165 | skipping to change at line 167 | |||
#else | #else | |||
typedef std::streambuf::int_type int_type; | typedef std::streambuf::int_type int_type; | |||
#endif | #endif | |||
typedef int (*close_fcn) (gzFile); | typedef int (*close_fcn) (gzFile); | |||
gzFile stdiofile (void) { return f; } | gzFile stdiofile (void) { return f; } | |||
c_zfile_ptr_buf (gzFile f_arg, close_fcn cf_arg = file_close) | c_zfile_ptr_buf (gzFile f_arg, close_fcn cf_arg = file_close) | |||
: std::streambuf (), f (f_arg), cf (cf_arg) | : std::streambuf (), f (f_arg), cf (cf_arg) | |||
{ } | { } | |||
~c_zfile_ptr_buf (void); | ~c_zfile_ptr_buf (void); | |||
int_type overflow (int_type); | int_type overflow (int_type); | |||
int_type underflow (void) { return underflow_common (false); } | int_type underflow (void) { return underflow_common (false); } | |||
int_type uflow (void) { return underflow_common (true); } | int_type uflow (void) { return underflow_common (true); } | |||
int_type pbackfail (int_type); | int_type pbackfail (int_type); | |||
skipping to change at line 195 | skipping to change at line 197 | |||
std::ios::openmode = std::ios::in | std::ios::out ); | std::ios::openmode = std::ios::in | std::ios::out ); | |||
int sync (void); | int sync (void); | |||
int flush (void); | int flush (void); | |||
int buf_close (void); | int buf_close (void); | |||
int file_number () const { return -1; } | int file_number () const { return -1; } | |||
int seek (long offset, int origin) | int seek (off_t offset, int origin) | |||
{ return f ? gzseek (f, offset, origin) : -1; } | { return f ? gzseek (f, offset, origin) >= 0 : -1; } | |||
long tell (void) { return f ? gztell (f) : -1; } | off_t tell (void) { return f ? gztell (f) : -1; } | |||
void clear (void) { if (f) gzclearerr (f); } | void clear (void) { if (f) gzclearerr (f); } | |||
static int file_close (gzFile f) { return ::gzclose (f); } | static int file_close (gzFile f) { return ::gzclose (f); } | |||
protected: | protected: | |||
gzFile f; | gzFile f; | |||
close_fcn cf; | close_fcn cf; | |||
skipping to change at line 221 | skipping to change at line 223 | |||
int_type underflow_common (bool); | int_type underflow_common (bool); | |||
// No copying! | // No copying! | |||
c_zfile_ptr_buf (const c_zfile_ptr_buf&); | c_zfile_ptr_buf (const c_zfile_ptr_buf&); | |||
c_zfile_ptr_buf& operator = (const c_zfile_ptr_buf&); | c_zfile_ptr_buf& operator = (const c_zfile_ptr_buf&); | |||
}; | }; | |||
typedef c_file_ptr_stream<std::istream, gzFile, c_zfile_ptr_buf> i_c_zfile_ | typedef c_file_ptr_stream<std::istream, gzFile, c_zfile_ptr_buf> | |||
ptr_stream; | i_c_zfile_ptr_stream; | |||
typedef c_file_ptr_stream<std::ostream, gzFile, c_zfile_ptr_buf> o_c_zfile_ | typedef c_file_ptr_stream<std::ostream, gzFile, c_zfile_ptr_buf> | |||
ptr_stream; | o_c_zfile_ptr_stream; | |||
typedef c_file_ptr_stream<std::iostream, gzFile, c_zfile_ptr_buf> io_c_zfil | typedef c_file_ptr_stream<std::iostream, gzFile, c_zfile_ptr_buf> | |||
e_ptr_stream; | io_c_zfile_ptr_stream; | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 12 change blocks. | ||||
25 lines changed or deleted | 24 lines changed or added | |||
caseless-str.h | caseless-str.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2007-2012 Shai Ayal | Copyright (C) 2007-2013 Shai Ayal | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 26 | skipping to change at line 26 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_caseless_str_h) | #if !defined (octave_caseless_str_h) | |||
#define octave_caseless_str_h 1 | #define octave_caseless_str_h 1 | |||
#include <cctype> | ||||
#include <string> | #include <string> | |||
class caseless_str : public std::string | class caseless_str : public std::string | |||
{ | { | |||
public: | public: | |||
typedef std::string::iterator iterator; | typedef std::string::iterator iterator; | |||
typedef std::string::const_iterator const_iterator; | typedef std::string::const_iterator const_iterator; | |||
caseless_str (void) : std::string () { } | caseless_str (void) : std::string () { } | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
chMatrix.h | chMatrix.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1995-2012 John W. Eaton | Copyright (C) 1995-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_chMatrix_int_h) | #if !defined (octave_chMatrix_h) | |||
#define octave_chMatrix_int_h 1 | #define octave_chMatrix_h 1 | |||
#include <string> | #include <string> | |||
#include "Array.h" | #include "Array.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
#include "mx-op-decl.h" | #include "mx-op-decl.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
charMatrix : public Array<char> | charMatrix : public Array<char> | |||
{ | { | |||
friend class ComplexMatrix; | friend class ComplexMatrix; | |||
public: | public: | |||
charMatrix (void) : Array<char> () { } | charMatrix (void) : Array<char> () { } | |||
charMatrix (octave_idx_type r, octave_idx_type c) | charMatrix (octave_idx_type r, octave_idx_type c) | |||
: Array<char> (dim_vector (r, c)) { } | : Array<char> (dim_vector (r, c)) { } | |||
charMatrix (octave_idx_type r, octave_idx_type c, char val) | charMatrix (octave_idx_type r, octave_idx_type c, char val) | |||
: Array<char> (dim_vector (r, c), val) { } | : Array<char> (dim_vector (r, c), val) { } | |||
skipping to change at line 68 | skipping to change at line 68 | |||
charMatrix (char c); | charMatrix (char c); | |||
charMatrix (const char *s); | charMatrix (const char *s); | |||
charMatrix (const std::string& s); | charMatrix (const std::string& s); | |||
charMatrix (const string_vector& s, char fill_value = '\0'); | charMatrix (const string_vector& s, char fill_value = '\0'); | |||
charMatrix& operator = (const charMatrix& a) | charMatrix& operator = (const charMatrix& a) | |||
{ | { | |||
Array<char>::operator = (a); | Array<char>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const charMatrix& a) const; | bool operator == (const charMatrix& a) const; | |||
bool operator != (const charMatrix& a) const; | bool operator != (const charMatrix& a) const; | |||
charMatrix transpose (void) const { return Array<char>::transpose (); } | charMatrix transpose (void) const { return Array<char>::transpose (); } | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
charMatrix& insert (const char *s, octave_idx_type r, octave_idx_type c); | charMatrix& insert (const char *s, octave_idx_type r, octave_idx_type c); | |||
charMatrix& insert (const charMatrix& a, octave_idx_type r, octave_idx_ty | charMatrix& insert (const charMatrix& a, | |||
pe c); | octave_idx_type r, octave_idx_type c); | |||
std::string row_as_string (octave_idx_type, bool strip_ws = false) const; | std::string row_as_string (octave_idx_type, bool strip_ws = false) const; | |||
// resize is the destructive equivalent for this one | // resize is the destructive equivalent for this one | |||
charMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_ty | charMatrix extract (octave_idx_type r1, octave_idx_type c1, | |||
pe r2, octave_idx_type c2) const; | octave_idx_type r2, octave_idx_type c2) const; | |||
void resize (octave_idx_type nr, octave_idx_type nc, | void resize (octave_idx_type nr, octave_idx_type nc, char rfv = 0) | |||
char rfv = resize_fill_value ()) | ||||
{ | { | |||
Array<char>::resize (dim_vector (nr, nc), rfv); | Array<char>::resize (dim_vector (nr, nc), rfv); | |||
} | } | |||
charMatrix diag (octave_idx_type k = 0) const; | charMatrix diag (octave_idx_type k = 0) const; | |||
boolMatrix all (int dim = -1) const; | boolMatrix all (int dim = -1) const; | |||
boolMatrix any (int dim = -1) const; | boolMatrix any (int dim = -1) const; | |||
#if 0 | #if 0 | |||
// i/o | // i/o | |||
friend std::ostream& operator << (std::ostream& os, const Matrix& a); | friend std::ostream& operator << (std::ostream& os, const Matrix& a); | |||
friend std::istream& operator >> (std::istream& is, Matrix& a); | friend std::istream& operator >> (std::istream& is, Matrix& a); | |||
#endif | #endif | |||
static char resize_fill_value (void) { return '\0'; } | ||||
}; | }; | |||
MS_CMP_OP_DECLS (charMatrix, char, OCTAVE_API) | MS_CMP_OP_DECLS (charMatrix, char, OCTAVE_API) | |||
MS_BOOL_OP_DECLS (charMatrix, char, OCTAVE_API) | MS_BOOL_OP_DECLS (charMatrix, char, OCTAVE_API) | |||
SM_CMP_OP_DECLS (char, charMatrix, OCTAVE_API) | SM_CMP_OP_DECLS (char, charMatrix, OCTAVE_API) | |||
SM_BOOL_OP_DECLS (char, charMatrix, OCTAVE_API) | SM_BOOL_OP_DECLS (char, charMatrix, OCTAVE_API) | |||
MM_CMP_OP_DECLS (charMatrix, charMatrix, OCTAVE_API) | MM_CMP_OP_DECLS (charMatrix, charMatrix, OCTAVE_API) | |||
MM_BOOL_OP_DECLS (charMatrix, charMatrix, OCTAVE_API) | MM_BOOL_OP_DECLS (charMatrix, charMatrix, OCTAVE_API) | |||
End of changes. 8 change blocks. | ||||
17 lines changed or deleted | 13 lines changed or added | |||
chNDArray.h | chNDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_charNDArray_h) | #if !defined (octave_chNDArray_h) | |||
#define octave_charNDArray_h 1 | #define octave_chNDArray_h 1 | |||
#include "Array.h" | #include "Array.h" | |||
#include "chMatrix.h" | #include "chMatrix.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
#include "mx-op-decl.h" | #include "mx-op-decl.h" | |||
#include "bsxfun-decl.h" | #include "bsxfun-decl.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
skipping to change at line 62 | skipping to change at line 62 | |||
charNDArray (const char *s) : Array<char> (charMatrix (s)) { } | charNDArray (const char *s) : Array<char> (charMatrix (s)) { } | |||
charNDArray (const std::string& s) : Array<char> (charMatrix (s)) { } | charNDArray (const std::string& s) : Array<char> (charMatrix (s)) { } | |||
charNDArray (const string_vector& s) : Array<char> (charMatrix (s)) { } | charNDArray (const string_vector& s) : Array<char> (charMatrix (s)) { } | |||
charNDArray (const Array<char>& a) : Array<char> (a) { } | charNDArray (const Array<char>& a) : Array<char> (a) { } | |||
charNDArray& operator = (const charNDArray& a) | charNDArray& operator = (const charNDArray& a) | |||
{ | { | |||
Array<char>::operator = (a); | Array<char>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool any_element_is_nan (void) const { return false; } | bool any_element_is_nan (void) const { return false; } | |||
// FIXME -- this is not quite the right thing. | // FIXME: this is not quite the right thing. | |||
boolNDArray all (int dim = -1) const; | boolNDArray all (int dim = -1) const; | |||
boolNDArray any (int dim = -1) const; | boolNDArray any (int dim = -1) const; | |||
charNDArray concat (const charNDArray& rb, const Array<octave_idx_type>& | charNDArray concat (const charNDArray& rb, | |||
ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
charNDArray concat (const NDArray& rb, const Array<octave_idx_type>& ra_i dx); | charNDArray concat (const NDArray& rb, const Array<octave_idx_type>& ra_i dx); | |||
charNDArray& insert (const charNDArray& a, octave_idx_type r, octave_idx_ | charNDArray max (int dim = -1) const; | |||
type c); | charNDArray max (Array<octave_idx_type>& index, int dim = -1) const; | |||
charNDArray& insert (const charNDArray& a, const Array<octave_idx_type>& | charNDArray min (int dim = -1) const; | |||
ra_idx); | charNDArray min (Array<octave_idx_type>& index, int dim = -1) 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); | ||||
charMatrix matrix_value (void) const; | charMatrix matrix_value (void) const; | |||
charNDArray squeeze (void) const { return Array<char>::squeeze (); } | charNDArray squeeze (void) const { return Array<char>::squeeze (); } | |||
static void increment_index (Array<octave_idx_type>& ra_idx, | static void increment_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions, | const dim_vector& dimensions, | |||
int start_dimension = 0); | int start_dimension = 0); | |||
static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions); | const dim_vector& dimensions); | |||
// i/o | // i/o | |||
// friend std::ostream& operator << (std::ostream& os, const charNDArray& a); | // friend std::ostream& operator << (std::ostream& os, const charNDArray& a); | |||
// friend std::istream& operator >> (std::istream& is, charNDArray& a); | // friend std::istream& operator >> (std::istream& is, charNDArray& a); | |||
static char resize_fill_value (void) { return '\0'; } | ||||
charNDArray diag (octave_idx_type k = 0) const; | charNDArray diag (octave_idx_type k = 0) const; | |||
charNDArray diag (octave_idx_type m, octave_idx_type n) const; | ||||
}; | }; | |||
extern OCTAVE_API charNDArray min (char d, const charNDArray& m); | ||||
extern OCTAVE_API charNDArray min (const charNDArray& m, char d); | ||||
extern OCTAVE_API charNDArray min (const charNDArray& a, const charNDArray& | ||||
b); | ||||
extern OCTAVE_API charNDArray max (char d, const charNDArray& m); | ||||
extern OCTAVE_API charNDArray max (const charNDArray& m, char d); | ||||
extern OCTAVE_API charNDArray max (const charNDArray& a, const charNDArray& | ||||
b); | ||||
NDS_CMP_OP_DECLS (charNDArray, char, OCTAVE_API) | NDS_CMP_OP_DECLS (charNDArray, char, OCTAVE_API) | |||
NDS_BOOL_OP_DECLS (charNDArray, char, OCTAVE_API) | NDS_BOOL_OP_DECLS (charNDArray, char, OCTAVE_API) | |||
SND_CMP_OP_DECLS (char, charNDArray, OCTAVE_API) | SND_CMP_OP_DECLS (char, charNDArray, OCTAVE_API) | |||
SND_BOOL_OP_DECLS (char, charNDArray, OCTAVE_API) | SND_BOOL_OP_DECLS (char, charNDArray, OCTAVE_API) | |||
NDND_CMP_OP_DECLS (charNDArray, charNDArray, OCTAVE_API) | NDND_CMP_OP_DECLS (charNDArray, charNDArray, OCTAVE_API) | |||
NDND_BOOL_OP_DECLS (charNDArray, charNDArray, OCTAVE_API) | NDND_BOOL_OP_DECLS (charNDArray, charNDArray, OCTAVE_API) | |||
BSXFUN_STDREL_DECLS (charNDArray, OCTAVE_API) | BSXFUN_STDREL_DECLS (charNDArray, OCTAVE_API) | |||
End of changes. 10 change blocks. | ||||
17 lines changed or deleted | 30 lines changed or added | |||
cmd-edit.h | cmd-edit.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 40 | skipping to change at line 40 | |||
#include "str-vec.h" | #include "str-vec.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
command_editor | command_editor | |||
{ | { | |||
protected: | protected: | |||
command_editor (void) | command_editor (void) | |||
: command_number (0) { } | : command_number (0), interrupted (false), initial_input () { } | |||
public: | public: | |||
typedef int (*startup_hook_fcn) (void); | typedef int (*startup_hook_fcn) (void); | |||
typedef int (*pre_input_hook_fcn) (void); | ||||
typedef int (*event_hook_fcn) (void); | typedef int (*event_hook_fcn) (void); | |||
typedef std::string (*completion_fcn) (const std::string&, int); | typedef std::string (*completion_fcn) (const std::string&, int); | |||
typedef std::string (*quoting_fcn) (const std::string&, int, char); | typedef std::string (*quoting_fcn) (const std::string&, int, char); | |||
typedef std::string (*dequoting_fcn) (const std::string&, int); | typedef std::string (*dequoting_fcn) (const std::string&, int); | |||
typedef int (*char_is_quoted_fcn) (const std::string&, int); | typedef int (*char_is_quoted_fcn) (const std::string&, int); | |||
skipping to change at line 74 | skipping to change at line 76 | |||
static std::string readline (const std::string& prompt, bool& eof); | static std::string readline (const std::string& prompt, bool& eof); | |||
static void set_input_stream (FILE *f); | static void set_input_stream (FILE *f); | |||
static FILE *get_input_stream (void); | static FILE *get_input_stream (void); | |||
static void set_output_stream (FILE *f); | static void set_output_stream (FILE *f); | |||
static FILE *get_output_stream (void); | static FILE *get_output_stream (void); | |||
static void redisplay (void); | ||||
static int terminal_rows (void); | static int terminal_rows (void); | |||
static int terminal_cols (void); | static int terminal_cols (void); | |||
static void clear_screen (void); | static void clear_screen (bool skip_redisplay = false); | |||
static void resize_terminal (void); | static void resize_terminal (void); | |||
static std::string decode_prompt_string (const std::string& s); | static std::string decode_prompt_string (const std::string& s); | |||
static void restore_terminal_state (void); | static void restore_terminal_state (void); | |||
static void blink_matching_paren (bool flag); | static void blink_matching_paren (bool flag); | |||
static void set_basic_word_break_characters (const std::string& s); | static void set_basic_word_break_characters (const std::string& s); | |||
skipping to change at line 124 | skipping to change at line 128 | |||
static dequoting_fcn get_dequoting_function (void); | static dequoting_fcn get_dequoting_function (void); | |||
static char_is_quoted_fcn get_char_is_quoted_function (void); | static char_is_quoted_fcn get_char_is_quoted_function (void); | |||
static user_accept_line_fcn get_user_accept_line_function (void); | static user_accept_line_fcn get_user_accept_line_function (void); | |||
static string_vector generate_filename_completions (const std::string& te xt); | static string_vector generate_filename_completions (const std::string& te xt); | |||
static std::string get_line_buffer (void); | static std::string get_line_buffer (void); | |||
static std::string get_current_line (void); | ||||
static void replace_line (const std::string& text, bool clear_undo = true | ||||
); | ||||
static void insert_text (const std::string& text); | static void insert_text (const std::string& text); | |||
static void newline (void); | static void newline (void); | |||
static void accept_line (void); | static void accept_line (void); | |||
static bool undo (void); | ||||
static void clear_undo_list (void); | static void clear_undo_list (void); | |||
static void add_startup_hook (startup_hook_fcn f); | static void add_startup_hook (startup_hook_fcn f); | |||
static void remove_startup_hook (startup_hook_fcn f); | static void remove_startup_hook (startup_hook_fcn f); | |||
static void add_pre_input_hook (pre_input_hook_fcn f); | ||||
static void remove_pre_input_hook (pre_input_hook_fcn f); | ||||
static void add_event_hook (event_hook_fcn f); | static void add_event_hook (event_hook_fcn f); | |||
static void remove_event_hook (event_hook_fcn f); | static void remove_event_hook (event_hook_fcn f); | |||
static void run_event_hooks (void); | static void run_event_hooks (void); | |||
static void read_init_file (const std::string& file = std::string ()); | static void read_init_file (const std::string& file = std::string ()); | |||
static void re_read_init_file (void); | static void re_read_init_file (void); | |||
static bool filename_completion_desired (bool); | static bool filename_completion_desired (bool); | |||
static bool filename_quoting_desired (bool); | static bool filename_quoting_desired (bool); | |||
static bool interrupt (bool = true); | ||||
static int current_command_number (void); | static int current_command_number (void); | |||
static void reset_current_command_number (int n); | static void reset_current_command_number (int n); | |||
static void increment_current_command_number (void); | static void increment_current_command_number (void); | |||
static void force_default_editor (void); | static void force_default_editor (void); | |||
static void set_initial_input (const std::string& text); | ||||
static int insert_initial_input (void); | ||||
private: | private: | |||
// No copying! | // No copying! | |||
command_editor (const command_editor&); | command_editor (const command_editor&); | |||
command_editor& operator = (const command_editor&); | command_editor& operator = (const command_editor&); | |||
static bool instance_ok (void); | static bool instance_ok (void); | |||
static void make_command_editor (void); | static void make_command_editor (void); | |||
static int startup_handler (void); | static int startup_handler (void); | |||
static int pre_input_handler (void); | ||||
static int event_handler (void); | static int event_handler (void); | |||
static std::set<startup_hook_fcn> startup_hook_set; | static std::set<startup_hook_fcn> startup_hook_set; | |||
static std::set<pre_input_hook_fcn> pre_input_hook_set; | ||||
static std::set<event_hook_fcn> event_hook_set; | static std::set<event_hook_fcn> event_hook_set; | |||
typedef std::set<startup_hook_fcn>::iterator startup_hook_set_iterator; | typedef std::set<startup_hook_fcn>::iterator startup_hook_set_iterator; | |||
typedef std::set<startup_hook_fcn>::const_iterator startup_hook_set_const _iterator; | typedef std::set<startup_hook_fcn>::const_iterator startup_hook_set_const _iterator; | |||
typedef std::set<pre_input_hook_fcn>::iterator pre_input_hook_set_iterato | ||||
r; | ||||
typedef std::set<pre_input_hook_fcn>::const_iterator pre_input_hook_set_c | ||||
onst_iterator; | ||||
typedef std::set<event_hook_fcn>::iterator event_hook_set_iterator; | typedef std::set<event_hook_fcn>::iterator event_hook_set_iterator; | |||
typedef std::set<event_hook_fcn>::const_iterator event_hook_set_const_ite rator; | typedef std::set<event_hook_fcn>::const_iterator event_hook_set_const_ite rator; | |||
// The real thing. | // The real thing. | |||
static command_editor *instance; | static command_editor *instance; | |||
static void cleanup_instance (void) { delete instance; instance = 0; } | static void cleanup_instance (void) { delete instance; instance = 0; } | |||
protected: | protected: | |||
// To use something other than the GNU readline library, derive a new | // To use something other than the GNU readline library, derive a new | |||
// class from command_editor, overload these functions as | // class from command_editor, overload these functions as | |||
// necessary, and make instance point to the new class. | // necessary, and make instance point to the new class. | |||
virtual void do_set_name (const std::string&) { } | virtual void do_set_name (const std::string&) { } | |||
std::string do_readline (const std::string& prompt) | std::string do_readline (const std::string& prompt) | |||
{ | { | |||
bool eof; | bool eof; | |||
return do_readline (prompt, eof); | return do_readline (prompt, eof); | |||
} | } | |||
virtual std::string do_readline (const std::string&, bool&) = 0; | virtual std::string do_readline (const std::string&, bool&) = 0; | |||
virtual void do_set_input_stream (FILE *) = 0; | virtual void do_set_input_stream (FILE *) = 0; | |||
virtual FILE *do_get_input_stream (void) = 0; | virtual FILE *do_get_input_stream (void) = 0; | |||
virtual void do_set_output_stream (FILE *) = 0; | virtual void do_set_output_stream (FILE *) = 0; | |||
virtual FILE *do_get_output_stream (void) = 0; | virtual FILE *do_get_output_stream (void) = 0; | |||
virtual void do_redisplay (void) { } | ||||
virtual int do_terminal_rows (void) { return 24; } | virtual int do_terminal_rows (void) { return 24; } | |||
virtual int do_terminal_cols (void) { return 80; } | virtual int do_terminal_cols (void) { return 80; } | |||
virtual void do_clear_screen (void) { } | virtual void do_clear_screen (bool) { } | |||
virtual void do_resize_terminal (void) { } | virtual void do_resize_terminal (void) { } | |||
virtual std::string do_decode_prompt_string (const std::string&); | virtual std::string do_decode_prompt_string (const std::string&); | |||
virtual std::string newline_chars (void) { return "\n"; } | virtual std::string newline_chars (void) { return "\n"; } | |||
virtual void do_restore_terminal_state (void) { } | virtual void do_restore_terminal_state (void) { } | |||
virtual void do_blink_matching_paren (bool) { } | virtual void do_blink_matching_paren (bool) { } | |||
skipping to change at line 258 | skipping to change at line 287 | |||
virtual void do_set_char_is_quoted_function (char_is_quoted_fcn) { } | virtual void do_set_char_is_quoted_function (char_is_quoted_fcn) { } | |||
virtual void do_set_user_accept_line_function (user_accept_line_fcn) { } | virtual void do_set_user_accept_line_function (user_accept_line_fcn) { } | |||
virtual completion_fcn do_get_completion_function (void) const { return 0 ; } | virtual completion_fcn do_get_completion_function (void) const { return 0 ; } | |||
virtual quoting_fcn do_get_quoting_function (void) const { return 0; } | virtual quoting_fcn do_get_quoting_function (void) const { return 0; } | |||
virtual dequoting_fcn do_get_dequoting_function (void) const { return 0; } | virtual dequoting_fcn do_get_dequoting_function (void) const { return 0; } | |||
virtual char_is_quoted_fcn do_get_char_is_quoted_function (void) const { | virtual char_is_quoted_fcn do_get_char_is_quoted_function (void) const | |||
return 0; } | { return 0; } | |||
virtual user_accept_line_fcn do_get_user_accept_line_function (void) cons | virtual user_accept_line_fcn do_get_user_accept_line_function (void) cons | |||
t { return 0; } | t | |||
{ return 0; } | ||||
virtual string_vector do_generate_filename_completions (const std::string | virtual string_vector | |||
& text) = 0; | do_generate_filename_completions (const std::string& text) = 0; | |||
virtual std::string do_get_line_buffer (void) const = 0; | virtual std::string do_get_line_buffer (void) const = 0; | |||
virtual void do_insert_text (const std::string&) = 0; | virtual std::string do_get_current_line (void) const = 0; | |||
virtual void do_replace_line (const std::string& text, bool clear_undo) = | ||||
0; | ||||
virtual void do_insert_text (const std::string& text) = 0; | ||||
virtual void do_newline (void) = 0; | virtual void do_newline (void) = 0; | |||
virtual void do_accept_line (void) = 0; | virtual void do_accept_line (void) = 0; | |||
virtual bool do_undo (void) { return false; } | ||||
virtual void do_clear_undo_list (void) { } | virtual void do_clear_undo_list (void) { } | |||
virtual void set_startup_hook (startup_hook_fcn) { } | virtual void set_startup_hook (startup_hook_fcn) { } | |||
virtual void restore_startup_hook (void) { } | virtual void restore_startup_hook (void) { } | |||
virtual void set_event_hook (startup_hook_fcn) { } | virtual void set_pre_input_hook (pre_input_hook_fcn) { } | |||
virtual void restore_pre_input_hook (void) { } | ||||
virtual void set_event_hook (event_hook_fcn) { } | ||||
virtual void restore_event_hook (void) { } | virtual void restore_event_hook (void) { } | |||
virtual void do_read_init_file (const std::string&) { } | virtual void do_read_init_file (const std::string&) { } | |||
virtual void do_re_read_init_file (void) { } | virtual void do_re_read_init_file (void) { } | |||
virtual bool do_filename_completion_desired (bool) { return false; } | virtual bool do_filename_completion_desired (bool) { return false; } | |||
virtual bool do_filename_quoting_desired (bool) { return false; } | virtual bool do_filename_quoting_desired (bool) { return false; } | |||
virtual void do_interrupt (bool) { } | ||||
int do_insert_initial_input (void); | ||||
int read_octal (const std::string& s); | int read_octal (const std::string& s); | |||
void error (int); | void error (int); | |||
void error (const std::string&); | void error (const std::string&); | |||
// The current command number. | // The current command number. | |||
int command_number; | int command_number; | |||
bool interrupted; | ||||
std::string initial_input; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 25 change blocks. | ||||
16 lines changed or deleted | 68 lines changed or added | |||
cmd-hist.h | cmd-hist.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 64 | skipping to change at line 64 | |||
static std::string histcontrol (void); | static std::string histcontrol (void); | |||
static void set_size (int); | static void set_size (int); | |||
static int size (void); | static int size (void); | |||
static void ignore_entries (bool = true); | static void ignore_entries (bool = true); | |||
static bool ignoring_entries (void); | static bool ignoring_entries (void); | |||
static void add (const std::string&); | static bool add (const std::string&); | |||
static void remove (int); | static void remove (int); | |||
static void clear (void); | ||||
static int where (void); | static int where (void); | |||
static int length (void); | static int length (void); | |||
static int max_input_history (void); | static int max_input_history (void); | |||
static int base (void); | static int base (void); | |||
static int current_number (void); | static int current_number (void); | |||
skipping to change at line 145 | skipping to change at line 147 | |||
// necessary, and make instance point to the new class. | // necessary, and make instance point to the new class. | |||
virtual void do_set_file (const std::string&); | virtual void do_set_file (const std::string&); | |||
virtual std::string do_file (void); | virtual std::string do_file (void); | |||
virtual void do_process_histcontrol (const std::string&); | virtual void do_process_histcontrol (const std::string&); | |||
virtual std::string do_histcontrol (void) const { return std::string (); } | virtual std::string do_histcontrol (void) const { return std::string (); } | |||
virtual void do_initialize (bool, const std::string&, int, const std::str | virtual void do_initialize (bool, const std::string&, int, | |||
ing&); | const std::string&); | |||
virtual bool do_is_initialized (void) const; | virtual bool do_is_initialized (void) const; | |||
virtual void do_set_size (int); | virtual void do_set_size (int); | |||
virtual int do_size (void) const; | virtual int do_size (void) const; | |||
virtual void do_ignore_entries (bool); | virtual void do_ignore_entries (bool); | |||
virtual bool do_ignoring_entries (void) const; | virtual bool do_ignoring_entries (void) const; | |||
virtual void do_add (const std::string&); | virtual bool do_add (const std::string&); | |||
virtual void do_remove (int); | virtual void do_remove (int); | |||
virtual void do_clear (void); | ||||
virtual int do_where (void) const; | virtual int do_where (void) const; | |||
virtual int do_length (void) const; | virtual int do_length (void) const; | |||
virtual int do_max_input_history (void) const; | virtual int do_max_input_history (void) const; | |||
virtual int do_base (void) const; | virtual int do_base (void) const; | |||
virtual int do_current_number (void) const; | virtual int do_current_number (void) const; | |||
skipping to change at line 199 | skipping to change at line 204 | |||
virtual void do_truncate_file (const std::string&, int) const; | virtual void do_truncate_file (const std::string&, int) const; | |||
virtual string_vector do_list (int, bool) const; | virtual string_vector do_list (int, bool) const; | |||
virtual std::string do_get_entry (int) const; | virtual std::string do_get_entry (int) const; | |||
virtual void do_replace_entry (int, const std::string&); | virtual void do_replace_entry (int, const std::string&); | |||
virtual void do_clean_up_and_save (const std::string&, int); | virtual void do_clean_up_and_save (const std::string&, int); | |||
void error (int) const; | void error (int, const std::string& msg = "") const; | |||
void error (const std::string&) const; | void error (const std::string&) const; | |||
// TRUE means we have initialized the history file name and number of | // TRUE means we have initialized the history file name and number of | |||
// lines to save. | // lines to save. | |||
bool initialized; | bool initialized; | |||
// TRUE means we are ignoring new additions. | // TRUE means we are ignoring new additions. | |||
bool ignoring_additions; | bool ignoring_additions; | |||
End of changes. 7 change blocks. | ||||
6 lines changed or deleted | 10 lines changed or added | |||
comment-list.h | comment-list.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2000-2012 John W. Eaton | Copyright (C) 2000-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 45 | skipping to change at line 45 | |||
class | class | |||
octave_comment_elt | octave_comment_elt | |||
{ | { | |||
public: | public: | |||
enum comment_type | enum comment_type | |||
{ | { | |||
unknown, | unknown, | |||
block, | block, | |||
full_line, | ||||
end_of_line, | end_of_line, | |||
doc_string, | doc_string, | |||
copyright | copyright | |||
}; | }; | |||
octave_comment_elt (const std::string& s = std::string (), | octave_comment_elt (const std::string& s = std::string (), | |||
comment_type t = unknown) | comment_type t = unknown) | |||
: txt (s), typ (t) { } | : txt (s), typ (t) { } | |||
octave_comment_elt (const octave_comment_elt& oc) | octave_comment_elt (const octave_comment_elt& oc) | |||
: txt (oc.txt), typ (oc.typ) { } | : txt (oc.txt), typ (oc.typ) { } | |||
octave_comment_elt& operator = (const octave_comment_elt& oc) | octave_comment_elt& operator = (const octave_comment_elt& oc) | |||
{ | { | |||
if (this != &oc) | if (this != &oc) | |||
{ | { | |||
txt = oc.txt; | txt = oc.txt; | |||
typ = oc.typ; | typ = oc.typ; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
std::string text (void) const { return txt; } | std::string text (void) const { return txt; } | |||
comment_type type (void) const { return typ; } | comment_type type (void) const { return typ; } | |||
~octave_comment_elt (void) { } | ~octave_comment_elt (void) { } | |||
private: | private: | |||
// The text of the comment. | // The text of the comment. | |||
skipping to change at line 91 | skipping to change at line 92 | |||
}; | }; | |||
class | class | |||
octave_comment_list : public octave_base_list<octave_comment_elt> | octave_comment_list : public octave_base_list<octave_comment_elt> | |||
{ | { | |||
public: | public: | |||
octave_comment_list (void) { } | octave_comment_list (void) { } | |||
void append (const octave_comment_elt& elt) | void append (const octave_comment_elt& elt) | |||
{ octave_base_list<octave_comment_elt>::append (elt); } | { octave_base_list<octave_comment_elt>::append (elt); } | |||
void append (const std::string& s, | void append (const std::string& s, | |||
octave_comment_elt::comment_type t = octave_comment_elt::unk nown) | octave_comment_elt::comment_type t = octave_comment_elt::unk nown) | |||
{ append (octave_comment_elt (s, t)); } | { append (octave_comment_elt (s, t)); } | |||
octave_comment_list *dup (void) const; | octave_comment_list *dup (void) const; | |||
}; | }; | |||
class | ||||
octave_comment_buffer | ||||
{ | ||||
public: | ||||
octave_comment_buffer (void) | ||||
: comment_list (new octave_comment_list ()) { } | ||||
~octave_comment_buffer (void) { delete comment_list; } | ||||
static bool instance_ok (void); | ||||
static void append | ||||
(const std::string& s, | ||||
octave_comment_elt::comment_type t = octave_comment_elt::unknown); | ||||
static octave_comment_list *get_comment (void); | ||||
private: | ||||
void do_append (const std::string& s, octave_comment_elt::comment_type t) | ||||
; | ||||
octave_comment_list *do_get_comment (void); | ||||
octave_comment_list *comment_list; | ||||
static octave_comment_buffer *instance; | ||||
static void cleanup_instance (void) { delete instance; instance = 0; } | ||||
}; | ||||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
43 lines changed or deleted | 12 lines changed or added | |||
config.h | config.h | |||
---|---|---|---|---|
/* config.h. Generated from config.h.in by configure. */ | /* config.h. Generated from config.in.h by configure. */ | |||
/* config.h.in. Generated from configure.ac by autoheader. */ | /* config.in.h. Generated from configure.ac by autoheader. */ | |||
/* Define if building universal (internal helper macro) */ | /* Define if building universal (internal helper macro) */ | |||
/* #undef AC_APPLE_UNIVERSAL_BUILD */ | /* #undef AC_APPLE_UNIVERSAL_BUILD */ | |||
/* Define to the number of bits in type 'ptrdiff_t'. */ | /* Define to the number of bits in type 'ptrdiff_t'. */ | |||
/* #undef BITSIZEOF_PTRDIFF_T */ | /* #undef BITSIZEOF_PTRDIFF_T */ | |||
/* Define to the number of bits in type 'sig_atomic_t'. */ | /* Define to the number of bits in type 'sig_atomic_t'. */ | |||
/* #undef BITSIZEOF_SIG_ATOMIC_T */ | /* #undef BITSIZEOF_SIG_ATOMIC_T */ | |||
/* Define to the number of bits in type 'size_t'. */ | /* Define to the number of bits in type 'size_t'. */ | |||
/* #undef BITSIZEOF_SIZE_T */ | /* #undef BITSIZEOF_SIZE_T */ | |||
/* Define to the number of bits in type 'wchar_t'. */ | /* Define to the number of bits in type 'wchar_t'. */ | |||
/* #undef BITSIZEOF_WCHAR_T */ | /* #undef BITSIZEOF_WCHAR_T */ | |||
/* Define to the number of bits in type 'wint_t'. */ | /* Define to the number of bits in type 'wint_t'. */ | |||
/* #undef BITSIZEOF_WINT_T */ | /* #undef BITSIZEOF_WINT_T */ | |||
/* Define to use internal bounds checking. */ | /* Define to 1 to use internal bounds checking. */ | |||
/* #undef BOUNDS_CHECKING */ | /* #undef BOUNDS_CHECKING */ | |||
/* Define to 1 if llvm::CallInst:addAttribute arg type is llvm::Attributes. | ||||
*/ | ||||
/* #undef CALLINST_ADDATTRIBUTE_ARG_IS_ATTRIBUTES */ | ||||
/* Define to 1 if the `closedir' function returns void instead of `int'. */ | /* Define to 1 if the `closedir' function returns void instead of `int'. */ | |||
/* #undef CLOSEDIR_VOID */ | /* #undef CLOSEDIR_VOID */ | |||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP | /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP | |||
systems. This function is required for `alloca.c' support on those syste ms. | systems. This function is required for `alloca.c' support on those syste ms. | |||
*/ | */ | |||
/* #undef CRAY_STACKSEG_END */ | /* #undef CRAY_STACKSEG_END */ | |||
/* Define if C++ reinterpret_cast fails for function pointers. */ | /* Define to the legacy option name if using an older version of cURL. */ | |||
/* #undef CURLOPT_DIRLISTONLY */ | ||||
/* Define to 1 if C++ reinterpret_cast fails for function pointers. */ | ||||
/* #undef CXX_BROKEN_REINTERPRET_CAST */ | /* #undef CXX_BROKEN_REINTERPRET_CAST */ | |||
/* Define if your C++ runtime library is ISO compliant. */ | /* Define to 1 if your C++ runtime library is ISO compliant. */ | |||
#define CXX_ISO_COMPLIANT_LIBRARY 1 | #define CXX_ISO_COMPLIANT_LIBRARY 1 | |||
/* Define if your compiler supports `<>' stuff for template friends. */ | /* Define to 1 if your compiler supports `<>' stuff for template friends. * / | |||
#define CXX_NEW_FRIEND_TEMPLATE_DECL 1 | #define CXX_NEW_FRIEND_TEMPLATE_DECL 1 | |||
/* Define to 1 if using `alloca.c'. */ | /* Define to 1 if using `alloca.c'. */ | |||
/* #undef C_ALLOCA */ | /* #undef C_ALLOCA */ | |||
/* Define as the bit index in the word where to find bit 0 of the exponent of | /* Define as the bit index in the word where to find bit 0 of the exponent of | |||
'double'. */ | 'double'. */ | |||
#define DBL_EXPBIT0_BIT 20 | #define DBL_EXPBIT0_BIT 20 | |||
/* Define as the word index where to find the exponent of 'double'. */ | /* Define as the word index where to find the exponent of 'double'. */ | |||
skipping to change at line 73 | skipping to change at line 79 | |||
#else | #else | |||
# define DIR_TO_FD(Dir_p) -1 | # define DIR_TO_FD(Dir_p) -1 | |||
#endif | #endif | |||
/* Define to 1 if // is a file system root distinct from /. */ | /* Define to 1 if // is a file system root distinct from /. */ | |||
/* #undef DOUBLE_SLASH_IS_DISTINCT_ROOT */ | /* #undef DOUBLE_SLASH_IS_DISTINCT_ROOT */ | |||
/* Define if struct dirent has a member d_ino that actually works. */ | /* Define if struct dirent has a member d_ino that actually works. */ | |||
#define D_INO_IN_DIRENT 1 | #define D_INO_IN_DIRENT 1 | |||
/* Define if using dynamic linking */ | /* Define to 1 if using dynamic linking. */ | |||
#define ENABLE_DYNAMIC_LINKING 1 | #define ENABLE_DYNAMIC_LINKING 1 | |||
/* Define if your math.h declares struct exception for matherr(). */ | /* Define to 1 if math.h declares struct exception for matherr(). */ | |||
#define EXCEPTION_IN_MATH 1 | #define EXCEPTION_IN_MATH 1 | |||
/* Define to dummy `main' function (if any) required to link to the Fortran | /* Define to dummy `main' function (if any) required to link to the Fortran | |||
libraries. */ | libraries. */ | |||
/* #undef F77_DUMMY_MAIN */ | /* #undef F77_DUMMY_MAIN */ | |||
/* Define to a macro mangling the given C identifier (in lower and upper | /* Define to a macro mangling the given C identifier (in lower and upper | |||
case), which must not contain underscores, for linking with Fortran. */ | case), which must not contain underscores, for linking with Fortran. */ | |||
#define F77_FUNC(name,NAME) name ## _ | #define F77_FUNC(name,NAME) name ## _ | |||
/* As F77_FUNC, but for C identifiers containing underscores. */ | /* As F77_FUNC, but for C identifiers containing underscores. */ | |||
#define F77_FUNC_(name,NAME) name ## _ | #define F77_FUNC_(name,NAME) name ## _ | |||
/* Define this to 1 if F_DUPFD behavior does not match POSIX */ | /* Define this to 1 if F_DUPFD behavior does not match POSIX */ | |||
/* #undef FCNTL_DUPFD_BUGGY */ | /* #undef FCNTL_DUPFD_BUGGY */ | |||
/* Define if F77 and FC dummy `main' functions are identical. */ | /* Define if F77 and FC dummy `main' functions are identical. */ | |||
/* #undef FC_DUMMY_MAIN_EQ_F77 */ | /* #undef FC_DUMMY_MAIN_EQ_F77 */ | |||
/* Define to volatile if you need truncating intermediate FP results */ | /* Define to volatile if you need to truncate intermediate FP results. */ | |||
#define FLOAT_TRUNCATE | #define FLOAT_TRUNCATE | |||
/* Define as the bit index in the word where to find bit 0 of the exponent of | /* Define as the bit index in the word where to find bit 0 of the exponent of | |||
'float'. */ | 'float'. */ | |||
#define FLT_EXPBIT0_BIT 23 | #define FLT_EXPBIT0_BIT 23 | |||
/* Define as the word index where to find the exponent of 'float'. */ | /* Define as the word index where to find the exponent of 'float'. */ | |||
#define FLT_EXPBIT0_WORD 0 | #define FLT_EXPBIT0_WORD 0 | |||
/* Define as the bit index in the word where to find the sign of 'float'. * / | /* Define as the bit index in the word where to find the sign of 'float'. * / | |||
skipping to change at line 118 | skipping to change at line 124 | |||
/* Define as the word index where to find the sign of 'float'. */ | /* Define as the word index where to find the sign of 'float'. */ | |||
/* #undef FLT_SIGNBIT_WORD */ | /* #undef FLT_SIGNBIT_WORD */ | |||
/* Define to 1 if fopen() fails to recognize a trailing slash. */ | /* Define to 1 if fopen() fails to recognize a trailing slash. */ | |||
/* #undef FOPEN_TRAILING_SLASH_BUG */ | /* #undef FOPEN_TRAILING_SLASH_BUG */ | |||
/* Define to 1 if the system's ftello function has the Solaris bug. */ | /* Define to 1 if the system's ftello function has the Solaris bug. */ | |||
/* #undef FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE */ | /* #undef FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE */ | |||
/* Define to 1 if llvm::Function:addAttribute arg type is llvm::Attributes. | ||||
*/ | ||||
/* #undef FUNCTION_ADDATTRIBUTE_ARG_IS_ATTRIBUTES */ | ||||
/* Define to 1 if llvm::Function:addFnAttr arg type is llvm::Attributes. */ | ||||
/* #undef FUNCTION_ADDFNATTR_ARG_IS_ATTRIBUTES */ | ||||
/* Define to 1 if fflush is known to work on stdin as per POSIX.1-2008, 0 i | ||||
f | ||||
fflush is known to not work, -1 if unknown. */ | ||||
#define FUNC_FFLUSH_STDIN 0 | ||||
/* Define to 1 if mkdir mistakenly creates a directory given with a trailin g | /* Define to 1 if mkdir mistakenly creates a directory given with a trailin g | |||
dot component. */ | dot component. */ | |||
/* #undef FUNC_MKDIR_DOT_BUG */ | /* #undef FUNC_MKDIR_DOT_BUG */ | |||
/* Define to 1 if realpath() can malloc memory, always gives an absolute pa th, | /* Define to 1 if realpath() can malloc memory, always gives an absolute pa th, | |||
and handles trailing slash correctly. */ | and handles trailing slash correctly. */ | |||
#define FUNC_REALPATH_WORKS 1 | #define FUNC_REALPATH_WORKS 1 | |||
/* Define if gettimeofday clobbers the localtime buffer. */ | /* Define if gettimeofday clobbers the localtime buffer. */ | |||
/* #undef GETTIMEOFDAY_CLOBBERS_LOCALTIME */ | /* #undef GETTIMEOFDAY_CLOBBERS_LOCALTIME */ | |||
/* Define this to 'void' or 'struct timezone' to match the system's | /* Define this to 'void' or 'struct timezone' to match the system's | |||
declaration of the second argument to gettimeofday. */ | declaration of the second argument to gettimeofday. */ | |||
#define GETTIMEOFDAY_TIMEZONE struct timezone | #define GETTIMEOFDAY_TIMEZONE struct timezone | |||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | /* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | |||
whether the gnulib module canonicalize shall be considered present. */ | ||||
#define GNULIB_CANONICALIZE 1 | ||||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin | ||||
g | ||||
whether the gnulib module canonicalize-lgpl shall be considered present. */ | whether the gnulib module canonicalize-lgpl shall be considered present. */ | |||
#define GNULIB_CANONICALIZE_LGPL 1 | #define GNULIB_CANONICALIZE_LGPL 1 | |||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | /* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | |||
whether the gnulib module dirname shall be considered present. */ | ||||
#define GNULIB_DIRNAME 1 | ||||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin | ||||
g | ||||
whether the gnulib module fdopendir shall be considered present. */ | whether the gnulib module fdopendir shall be considered present. */ | |||
#define GNULIB_FDOPENDIR 1 | #define GNULIB_FDOPENDIR 1 | |||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | /* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | |||
whether the gnulib module fflush shall be considered present. */ | whether the gnulib module fflush shall be considered present. */ | |||
#define GNULIB_FFLUSH 1 | #define GNULIB_FFLUSH 1 | |||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | /* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | |||
whether the gnulib module fstatat shall be considered present. */ | whether the gnulib module fscanf shall be considered present. */ | |||
#define GNULIB_FSTATAT 1 | #define GNULIB_FSCANF 1 | |||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | /* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | |||
whether the gnulib module getcwd shall be considered present. */ | whether the gnulib module getcwd shall be considered present. */ | |||
#define GNULIB_GETCWD 1 | #define GNULIB_GETCWD 1 | |||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | /* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | |||
whether the gnulib module malloc-gnu shall be considered present. */ | ||||
#define GNULIB_MALLOC_GNU 1 | ||||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin | ||||
g | ||||
whether the gnulib module mkostemp shall be considered present. */ | whether the gnulib module mkostemp shall be considered present. */ | |||
#define GNULIB_MKOSTEMP 1 | #define GNULIB_MKOSTEMP 1 | |||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | /* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | |||
whether the gnulib module openat shall be considered present. */ | whether the gnulib module openat shall be considered present. */ | |||
#define GNULIB_OPENAT 1 | #define GNULIB_OPENAT 1 | |||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | /* Define to a C preprocessor expression that evaluates to 1 or 0, dependin g | |||
whether the gnulib module realloc-gnu shall be considered present. */ | ||||
#define GNULIB_REALLOC_GNU 1 | ||||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin | ||||
g | ||||
whether the gnulib module scanf shall be considered present. */ | ||||
#define GNULIB_SCANF 1 | ||||
/* Define to a C preprocessor expression that evaluates to 1 or 0, dependin | ||||
g | ||||
whether the gnulib module strerror shall be considered present. */ | whether the gnulib module strerror shall be considered present. */ | |||
#define GNULIB_STRERROR 1 | #define GNULIB_STRERROR 1 | |||
/* Define to 1 when the gnulib module canonicalize should be tested. */ | ||||
#define GNULIB_TEST_CANONICALIZE 1 | ||||
/* Define to 1 when the gnulib module canonicalize_file_name should be test ed. | /* Define to 1 when the gnulib module canonicalize_file_name should be test ed. | |||
*/ | */ | |||
#define GNULIB_TEST_CANONICALIZE_FILE_NAME 1 | #define GNULIB_TEST_CANONICALIZE_FILE_NAME 1 | |||
/* Define to 1 when the gnulib module chdir should be tested. */ | /* Define to 1 when the gnulib module chdir should be tested. */ | |||
#define GNULIB_TEST_CHDIR 1 | #define GNULIB_TEST_CHDIR 1 | |||
/* Define to 1 when the gnulib module cloexec should be tested. */ | /* Define to 1 when the gnulib module cloexec should be tested. */ | |||
#define GNULIB_TEST_CLOEXEC 1 | #define GNULIB_TEST_CLOEXEC 1 | |||
skipping to change at line 196 | skipping to change at line 235 | |||
/* Define to 1 when the gnulib module dirfd should be tested. */ | /* Define to 1 when the gnulib module dirfd should be tested. */ | |||
#define GNULIB_TEST_DIRFD 1 | #define GNULIB_TEST_DIRFD 1 | |||
/* Define to 1 when the gnulib module dup should be tested. */ | /* Define to 1 when the gnulib module dup should be tested. */ | |||
#define GNULIB_TEST_DUP 1 | #define GNULIB_TEST_DUP 1 | |||
/* Define to 1 when the gnulib module dup2 should be tested. */ | /* Define to 1 when the gnulib module dup2 should be tested. */ | |||
#define GNULIB_TEST_DUP2 1 | #define GNULIB_TEST_DUP2 1 | |||
/* Define to 1 when the gnulib module environ should be tested. */ | ||||
#define GNULIB_TEST_ENVIRON 1 | ||||
/* Define to 1 when the gnulib module fchdir should be tested. */ | /* Define to 1 when the gnulib module fchdir should be tested. */ | |||
#define GNULIB_TEST_FCHDIR 1 | #define GNULIB_TEST_FCHDIR 1 | |||
/* Define to 1 when the gnulib module fclose should be tested. */ | /* Define to 1 when the gnulib module fclose should be tested. */ | |||
#define GNULIB_TEST_FCLOSE 1 | #define GNULIB_TEST_FCLOSE 1 | |||
/* Define to 1 when the gnulib module fcntl should be tested. */ | /* Define to 1 when the gnulib module fcntl should be tested. */ | |||
#define GNULIB_TEST_FCNTL 1 | #define GNULIB_TEST_FCNTL 1 | |||
/* Define to 1 when the gnulib module fdopendir should be tested. */ | /* Define to 1 when the gnulib module fdopendir should be tested. */ | |||
#define GNULIB_TEST_FDOPENDIR 1 | #define GNULIB_TEST_FDOPENDIR 1 | |||
/* Define to 1 when the gnulib module fflush should be tested. */ | /* Define to 1 when the gnulib module fflush should be tested. */ | |||
#define GNULIB_TEST_FFLUSH 1 | #define GNULIB_TEST_FFLUSH 1 | |||
/* Define to 1 when the gnulib module floor should be tested. */ | /* Define to 1 when the gnulib module floor should be tested. */ | |||
#define GNULIB_TEST_FLOOR 1 | #define GNULIB_TEST_FLOOR 1 | |||
/* Define to 1 when the gnulib module floorf should be tested. */ | ||||
#define GNULIB_TEST_FLOORF 1 | ||||
/* Define to 1 when the gnulib module fopen should be tested. */ | /* Define to 1 when the gnulib module fopen should be tested. */ | |||
#define GNULIB_TEST_FOPEN 1 | #define GNULIB_TEST_FOPEN 1 | |||
/* Define to 1 when the gnulib module fpurge should be tested. */ | /* Define to 1 when the gnulib module fpurge should be tested. */ | |||
#define GNULIB_TEST_FPURGE 1 | #define GNULIB_TEST_FPURGE 1 | |||
/* Define to 1 when the gnulib module frexp should be tested. */ | ||||
#define GNULIB_TEST_FREXP 1 | ||||
/* Define to 1 when the gnulib module frexpf should be tested. */ | ||||
#define GNULIB_TEST_FREXPF 1 | ||||
/* Define to 1 when the gnulib module fseek should be tested. */ | /* Define to 1 when the gnulib module fseek should be tested. */ | |||
#define GNULIB_TEST_FSEEK 1 | #define GNULIB_TEST_FSEEK 1 | |||
/* Define to 1 when the gnulib module fseeko should be tested. */ | /* Define to 1 when the gnulib module fseeko should be tested. */ | |||
#define GNULIB_TEST_FSEEKO 1 | #define GNULIB_TEST_FSEEKO 1 | |||
/* Define to 1 when the gnulib module fstat should be tested. */ | /* Define to 1 when the gnulib module fstat should be tested. */ | |||
#define GNULIB_TEST_FSTAT 1 | #define GNULIB_TEST_FSTAT 1 | |||
/* Define to 1 when the gnulib module fstatat should be tested. */ | /* Define to 1 when the gnulib module fstatat should be tested. */ | |||
skipping to change at line 295 | skipping to change at line 346 | |||
/* Define to 1 when the gnulib module memrchr should be tested. */ | /* Define to 1 when the gnulib module memrchr should be tested. */ | |||
#define GNULIB_TEST_MEMRCHR 1 | #define GNULIB_TEST_MEMRCHR 1 | |||
/* Define to 1 when the gnulib module mkfifo should be tested. */ | /* Define to 1 when the gnulib module mkfifo should be tested. */ | |||
#define GNULIB_TEST_MKFIFO 1 | #define GNULIB_TEST_MKFIFO 1 | |||
/* Define to 1 when the gnulib module mkostemp should be tested. */ | /* Define to 1 when the gnulib module mkostemp should be tested. */ | |||
#define GNULIB_TEST_MKOSTEMP 1 | #define GNULIB_TEST_MKOSTEMP 1 | |||
/* Define to 1 when the gnulib module mkstemp should be tested. */ | ||||
#define GNULIB_TEST_MKSTEMP 1 | ||||
/* Define to 1 when the gnulib module mktime should be tested. */ | /* Define to 1 when the gnulib module mktime should be tested. */ | |||
#define GNULIB_TEST_MKTIME 1 | #define GNULIB_TEST_MKTIME 1 | |||
/* Define to 1 when the gnulib module nanosleep should be tested. */ | /* Define to 1 when the gnulib module nanosleep should be tested. */ | |||
#define GNULIB_TEST_NANOSLEEP 1 | #define GNULIB_TEST_NANOSLEEP 1 | |||
/* Define to 1 when the gnulib module open should be tested. */ | /* Define to 1 when the gnulib module open should be tested. */ | |||
#define GNULIB_TEST_OPEN 1 | #define GNULIB_TEST_OPEN 1 | |||
/* Define to 1 when the gnulib module openat should be tested. */ | /* Define to 1 when the gnulib module openat should be tested. */ | |||
#define GNULIB_TEST_OPENAT 1 | #define GNULIB_TEST_OPENAT 1 | |||
/* Define to 1 when the gnulib module opendir should be tested. */ | /* Define to 1 when the gnulib module opendir should be tested. */ | |||
#define GNULIB_TEST_OPENDIR 1 | #define GNULIB_TEST_OPENDIR 1 | |||
/* Define to 1 when the gnulib module putenv should be tested. */ | ||||
#define GNULIB_TEST_PUTENV 1 | ||||
/* Define to 1 when the gnulib module raise should be tested. */ | /* Define to 1 when the gnulib module raise should be tested. */ | |||
#define GNULIB_TEST_RAISE 1 | #define GNULIB_TEST_RAISE 1 | |||
/* Define to 1 when the gnulib module readdir should be tested. */ | /* Define to 1 when the gnulib module readdir should be tested. */ | |||
#define GNULIB_TEST_READDIR 1 | #define GNULIB_TEST_READDIR 1 | |||
/* Define to 1 when the gnulib module readlink should be tested. */ | /* Define to 1 when the gnulib module readlink should be tested. */ | |||
#define GNULIB_TEST_READLINK 1 | #define GNULIB_TEST_READLINK 1 | |||
/* Define to 1 when the gnulib module realloc-posix should be tested. */ | /* Define to 1 when the gnulib module realloc-posix should be tested. */ | |||
skipping to change at line 343 | skipping to change at line 394 | |||
/* Define to 1 when the gnulib module rmdir should be tested. */ | /* Define to 1 when the gnulib module rmdir should be tested. */ | |||
#define GNULIB_TEST_RMDIR 1 | #define GNULIB_TEST_RMDIR 1 | |||
/* Define to 1 when the gnulib module round should be tested. */ | /* Define to 1 when the gnulib module round should be tested. */ | |||
#define GNULIB_TEST_ROUND 1 | #define GNULIB_TEST_ROUND 1 | |||
/* Define to 1 when the gnulib module roundf should be tested. */ | /* Define to 1 when the gnulib module roundf should be tested. */ | |||
#define GNULIB_TEST_ROUNDF 1 | #define GNULIB_TEST_ROUNDF 1 | |||
/* Define to 1 when the gnulib module secure_getenv should be tested. */ | ||||
#define GNULIB_TEST_SECURE_GETENV 1 | ||||
/* Define to 1 when the gnulib module select should be tested. */ | /* Define to 1 when the gnulib module select should be tested. */ | |||
#define GNULIB_TEST_SELECT 1 | #define GNULIB_TEST_SELECT 1 | |||
/* Define to 1 when the gnulib module sigaction should be tested. */ | /* Define to 1 when the gnulib module sigaction should be tested. */ | |||
#define GNULIB_TEST_SIGACTION 1 | #define GNULIB_TEST_SIGACTION 1 | |||
/* Define to 1 when the gnulib module signbit should be tested. */ | /* Define to 1 when the gnulib module signbit should be tested. */ | |||
#define GNULIB_TEST_SIGNBIT 1 | #define GNULIB_TEST_SIGNBIT 1 | |||
/* Define to 1 when the gnulib module sigprocmask should be tested. */ | /* Define to 1 when the gnulib module sigprocmask should be tested. */ | |||
skipping to change at line 367 | skipping to change at line 421 | |||
/* Define to 1 when the gnulib module stat should be tested. */ | /* Define to 1 when the gnulib module stat should be tested. */ | |||
#define GNULIB_TEST_STAT 1 | #define GNULIB_TEST_STAT 1 | |||
/* Define to 1 when the gnulib module strdup should be tested. */ | /* Define to 1 when the gnulib module strdup should be tested. */ | |||
#define GNULIB_TEST_STRDUP 1 | #define GNULIB_TEST_STRDUP 1 | |||
/* Define to 1 when the gnulib module strerror should be tested. */ | /* Define to 1 when the gnulib module strerror should be tested. */ | |||
#define GNULIB_TEST_STRERROR 1 | #define GNULIB_TEST_STRERROR 1 | |||
/* Define to 1 when the gnulib module strndup should be tested. */ | ||||
#define GNULIB_TEST_STRNDUP 1 | ||||
/* Define to 1 when the gnulib module strnlen should be tested. */ | ||||
#define GNULIB_TEST_STRNLEN 1 | ||||
/* Define to 1 when the gnulib module strptime should be tested. */ | /* Define to 1 when the gnulib module strptime should be tested. */ | |||
#define GNULIB_TEST_STRPTIME 1 | #define GNULIB_TEST_STRPTIME 1 | |||
/* Define to 1 when the gnulib module symlink should be tested. */ | /* Define to 1 when the gnulib module symlink should be tested. */ | |||
#define GNULIB_TEST_SYMLINK 1 | #define GNULIB_TEST_SYMLINK 1 | |||
/* Define to 1 when the gnulib module time_r should be tested. */ | /* Define to 1 when the gnulib module time_r should be tested. */ | |||
#define GNULIB_TEST_TIME_R 1 | #define GNULIB_TEST_TIME_R 1 | |||
/* Define to 1 when the gnulib module tmpfile should be tested. */ | /* Define to 1 when the gnulib module tmpfile should be tested. */ | |||
skipping to change at line 397 | skipping to change at line 457 | |||
/* Define to 1 when the gnulib module vasprintf should be tested. */ | /* Define to 1 when the gnulib module vasprintf should be tested. */ | |||
#define GNULIB_TEST_VASPRINTF 1 | #define GNULIB_TEST_VASPRINTF 1 | |||
/* Define to 1 if you have the `acosh' function. */ | /* Define to 1 if you have the `acosh' function. */ | |||
#define HAVE_ACOSH 1 | #define HAVE_ACOSH 1 | |||
/* Define to 1 if you have the `acoshf' function. */ | /* Define to 1 if you have the `acoshf' function. */ | |||
#define HAVE_ACOSHF 1 | #define HAVE_ACOSHF 1 | |||
/* Define to 1 if you have the `alarm' function. */ | /* Define to 1 if you have 'alloca' after including <alloca.h>, a header th | |||
#define HAVE_ALARM 1 | at | |||
may be supplied by this distribution. */ | ||||
/* Define to 1 if you have `alloca', as a function or macro. */ | ||||
#define HAVE_ALLOCA 1 | #define HAVE_ALLOCA 1 | |||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix) . | /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix) . | |||
*/ | */ | |||
#define HAVE_ALLOCA_H 1 | #define HAVE_ALLOCA_H 1 | |||
/* Define if AMD is available. */ | /* Define to 1 if AMD is available. */ | |||
#define HAVE_AMD 1 | #define HAVE_AMD 1 | |||
/* Define to 1 if you have the <amd/amd.h> header file. */ | /* Define to 1 if you have the <amd/amd.h> header file. */ | |||
/* #undef HAVE_AMD_AMD_H */ | /* #undef HAVE_AMD_AMD_H */ | |||
/* Define to 1 if you have the <amd.h> header file. */ | /* Define to 1 if you have the <amd.h> header file. */ | |||
/* #undef HAVE_AMD_H */ | /* #undef HAVE_AMD_H */ | |||
/* Define if ARPACK is available. */ | /* Define to 1 if ARPACK is available. */ | |||
/* #undef HAVE_ARPACK */ | /* #undef HAVE_ARPACK */ | |||
/* Define to 1 if you have the `asinh' function. */ | /* Define to 1 if you have the `asinh' function. */ | |||
#define HAVE_ASINH 1 | #define HAVE_ASINH 1 | |||
/* Define to 1 if you have the `asinhf' function. */ | /* Define to 1 if you have the `asinhf' function. */ | |||
#define HAVE_ASINHF 1 | #define HAVE_ASINHF 1 | |||
/* Define to 1 if you have the `atanh' function. */ | /* Define to 1 if you have the `atanh' function. */ | |||
#define HAVE_ATANH 1 | #define HAVE_ATANH 1 | |||
/* Define to 1 if you have the `atanhf' function. */ | /* Define to 1 if you have the `atanhf' function. */ | |||
#define HAVE_ATANHF 1 | #define HAVE_ATANHF 1 | |||
/* Define to 1 if you have the `basename' function. */ | ||||
#define HAVE_BASENAME 1 | ||||
/* Define if you have a BLAS library. */ | /* Define if you have a BLAS library. */ | |||
/* #undef HAVE_BLAS */ | /* #undef HAVE_BLAS */ | |||
/* Define to 1 if you have the <bp-sym.h> header file. */ | /* Define to 1 if you have the <bp-sym.h> header file. */ | |||
/* #undef HAVE_BP_SYM_H */ | /* #undef HAVE_BP_SYM_H */ | |||
/* Define to 1 if you have the `btowc' function. */ | /* Define to 1 if you have the `btowc' function. */ | |||
#define HAVE_BTOWC 1 | #define HAVE_BTOWC 1 | |||
/* Define to 1 if nanosleep mishandles large arguments. */ | /* Define to 1 if nanosleep mishandles large arguments. */ | |||
/* #undef HAVE_BUG_BIG_NANOSLEEP */ | /* #undef HAVE_BUG_BIG_NANOSLEEP */ | |||
/* Define if CAMD is available. */ | /* Define to 1 if CAMD is available. */ | |||
#define HAVE_CAMD 1 | #define HAVE_CAMD 1 | |||
/* Define to 1 if you have the <camd/camd.h> header file. */ | /* Define to 1 if you have the <camd/camd.h> header file. */ | |||
/* #undef HAVE_CAMD_CAMD_H */ | /* #undef HAVE_CAMD_CAMD_H */ | |||
/* Define to 1 if you have the <camd.h> header file. */ | /* Define to 1 if you have the <camd.h> header file. */ | |||
/* #undef HAVE_CAMD_H */ | /* #undef HAVE_CAMD_H */ | |||
/* Define to 1 if you have the `canonicalize_file_name' function. */ | /* Define to 1 if you have the `canonicalize_file_name' function. */ | |||
#define HAVE_CANONICALIZE_FILE_NAME 1 | #define HAVE_CANONICALIZE_FILE_NAME 1 | |||
/* Define to 1 if Carbon Framework has CGDisplayBitsPerPixel. */ | ||||
/* #undef HAVE_CARBON_CGDISPLAYBITSPERPIXEL */ | ||||
/* Define to 1 if you have the `cbrt' function. */ | /* Define to 1 if you have the `cbrt' function. */ | |||
#define HAVE_CBRT 1 | #define HAVE_CBRT 1 | |||
/* Define to 1 if you have the `cbrtf' function. */ | /* Define to 1 if you have the `cbrtf' function. */ | |||
#define HAVE_CBRTF 1 | #define HAVE_CBRTF 1 | |||
/* Define if CCOLAMD is available. */ | /* Define to 1 if CCOLAMD is available. */ | |||
#define HAVE_CCOLAMD 1 | #define HAVE_CCOLAMD 1 | |||
/* Define to 1 if you have the <ccolamd/ccolamd.h> header file. */ | /* Define to 1 if you have the <ccolamd/ccolamd.h> header file. */ | |||
/* #undef HAVE_CCOLAMD_CCOLAMD_H */ | /* #undef HAVE_CCOLAMD_CCOLAMD_H */ | |||
/* Define to 1 if you have the <ccolamd.h> header file. */ | /* Define to 1 if you have the <ccolamd.h> header file. */ | |||
/* #undef HAVE_CCOLAMD_H */ | /* #undef HAVE_CCOLAMD_H */ | |||
/* Define to 1 if you have the `chmod' function. */ | /* Define to 1 if you have the `chmod' function. */ | |||
#define HAVE_CHMOD 1 | #define HAVE_CHMOD 1 | |||
/* Define if CHOLMOD is available. */ | /* Define to 1 if CHOLMOD is available. */ | |||
#define HAVE_CHOLMOD 1 | #define HAVE_CHOLMOD 1 | |||
/* Define to 1 if you have the <cholmod/cholmod.h> header file. */ | /* Define to 1 if you have the <cholmod/cholmod.h> header file. */ | |||
/* #undef HAVE_CHOLMOD_CHOLMOD_H */ | /* #undef HAVE_CHOLMOD_CHOLMOD_H */ | |||
/* Define to 1 if you have the <cholmod.h> header file. */ | /* Define to 1 if you have the <cholmod.h> header file. */ | |||
/* #undef HAVE_CHOLMOD_H */ | /* #undef HAVE_CHOLMOD_H */ | |||
/* Define to 1 if you have the `chown' function. */ | ||||
#define HAVE_CHOWN 1 | ||||
/* Define to 1 if you have the `closedir' function. */ | /* Define to 1 if you have the `closedir' function. */ | |||
#define HAVE_CLOSEDIR 1 | #define HAVE_CLOSEDIR 1 | |||
/* Define if <cmath> provides isfinite */ | /* Define to 1 if <cmath> provides isfinite. */ | |||
#define HAVE_CMATH_ISFINITE 1 | #define HAVE_CMATH_ISFINITE 1 | |||
/* Define if <cmath> provides float variant of isfinite */ | /* Define to 1 if <cmath> provides float variant of isfinite. */ | |||
#define HAVE_CMATH_ISFINITEF 1 | #define HAVE_CMATH_ISFINITEF 1 | |||
/* Define if <cmath> provides isinf */ | /* Define to 1 if <cmath> provides isinf. */ | |||
#define HAVE_CMATH_ISINF 1 | #define HAVE_CMATH_ISINF 1 | |||
/* Define if <cmath> provides float variant of isinf */ | /* Define to 1 if <cmath> provides float variant of isinf. */ | |||
#define HAVE_CMATH_ISINFF 1 | #define HAVE_CMATH_ISINFF 1 | |||
/* Define if <cmath> provides isnan */ | /* Define to 1 if <cmath> provides isnan. */ | |||
#define HAVE_CMATH_ISNAN 1 | #define HAVE_CMATH_ISNAN 1 | |||
/* Define if <cmath> provides float variant of isnan */ | /* Define to 1 if <cmath> provides float variant of isnan. */ | |||
#define HAVE_CMATH_ISNANF 1 | #define HAVE_CMATH_ISNANF 1 | |||
/* Define if COLAMD is available. */ | /* Define to 1 if COLAMD is available. */ | |||
#define HAVE_COLAMD 1 | #define HAVE_COLAMD 1 | |||
/* Define to 1 if you have the <colamd/colamd.h> header file. */ | /* Define to 1 if you have the <colamd/colamd.h> header file. */ | |||
/* #undef HAVE_COLAMD_COLAMD_H */ | /* #undef HAVE_COLAMD_COLAMD_H */ | |||
/* Define to 1 if you have the <colamd.h> header file. */ | /* Define to 1 if you have the <colamd.h> header file. */ | |||
/* #undef HAVE_COLAMD_H */ | /* #undef HAVE_COLAMD_H */ | |||
/* Define to 1 if you have the <conio.h> header file. */ | /* Define to 1 if you have the <conio.h> header file. */ | |||
/* #undef HAVE_CONIO_H */ | /* #undef HAVE_CONIO_H */ | |||
skipping to change at line 533 | skipping to change at line 594 | |||
libc. */ | libc. */ | |||
/* #undef HAVE_COPYSIGNL_IN_LIBC */ | /* #undef HAVE_COPYSIGNL_IN_LIBC */ | |||
/* Define if the copysign function is declared in <math.h> and available in | /* Define if the copysign function is declared in <math.h> and available in | |||
libc. */ | libc. */ | |||
/* #undef HAVE_COPYSIGN_IN_LIBC */ | /* #undef HAVE_COPYSIGN_IN_LIBC */ | |||
/* Define to 1 if you have the <cs.h> header file. */ | /* Define to 1 if you have the <cs.h> header file. */ | |||
/* #undef HAVE_CS_H */ | /* #undef HAVE_CS_H */ | |||
/* Define if cURL is available. */ | /* Define to 1 if you have the `ctermid' function. */ | |||
#define HAVE_CTERMID 1 | ||||
/* Define to 1 if cURL is available. */ | ||||
#define HAVE_CURL 1 | #define HAVE_CURL 1 | |||
/* Define to 1 if you have the <curl/curl.h> header file. */ | /* Define to 1 if you have the <curl/curl.h> header file. */ | |||
#define HAVE_CURL_CURL_H 1 | #define HAVE_CURL_CURL_H 1 | |||
/* Define to 1 if you have the <curses.h> header file. */ | /* Define to 1 if you have the <curses.h> header file. */ | |||
#define HAVE_CURSES_H 1 | #define HAVE_CURSES_H 1 | |||
/* Define if CXSparse is available. */ | /* Define to 1 if CXSparse is available. */ | |||
#define HAVE_CXSPARSE 1 | #define HAVE_CXSPARSE 1 | |||
/* Define to 1 if you have the <cxsparse/cs.h> header file. */ | /* Define to 1 if you have the <cxsparse/cs.h> header file. */ | |||
/* #undef HAVE_CXSPARSE_CS_H */ | /* #undef HAVE_CXSPARSE_CS_H */ | |||
/* Define if C++ complex class has T& real (void) and T& imag (void) method | /* Define to 1 if C++ library has templated bitwise operators. */ | |||
s | #define HAVE_CXX_BITWISE_OP_TEMPLATES 1 | |||
*/ | ||||
/* Define to 1 if C++ complex class has T& real (void) and T& imag (void) | ||||
methods. */ | ||||
#define HAVE_CXX_COMPLEX_REFERENCE_ACCESSORS 1 | #define HAVE_CXX_COMPLEX_REFERENCE_ACCESSORS 1 | |||
/* Define if C++ complex class has void real (T) and void imag (T) methods | /* Define to 1 if C++ complex class has void real (T) and void imag (T) | |||
*/ | methods. */ | |||
#define HAVE_CXX_COMPLEX_SETTERS 1 | #define HAVE_CXX_COMPLEX_SETTERS 1 | |||
/* Define to 1 if you have the declaration of `alarm', and to 0 if you don' | ||||
t. | ||||
*/ | ||||
#define HAVE_DECL_ALARM 1 | ||||
/* Define to 1 if you have the declaration of `ceilf', and to 0 if you don' t. | /* Define to 1 if you have the declaration of `ceilf', and to 0 if you don' t. | |||
*/ | */ | |||
/* #undef HAVE_DECL_CEILF */ | /* #undef HAVE_DECL_CEILF */ | |||
/* Define to 1 if you have the declaration of `copysign', and to 0 if you | /* Define to 1 if you have the declaration of `copysign', and to 0 if you | |||
don't. */ | don't. */ | |||
/* #undef HAVE_DECL_COPYSIGN */ | /* #undef HAVE_DECL_COPYSIGN */ | |||
/* Define to 1 if you have the declaration of `copysignf', and to 0 if you | /* Define to 1 if you have the declaration of `copysignf', and to 0 if you | |||
don't. */ | don't. */ | |||
skipping to change at line 589 | skipping to change at line 661 | |||
/* Define to 1 if you have the declaration of `fchdir', and to 0 if you don 't. | /* Define to 1 if you have the declaration of `fchdir', and to 0 if you don 't. | |||
*/ | */ | |||
#define HAVE_DECL_FCHDIR 1 | #define HAVE_DECL_FCHDIR 1 | |||
/* Define to 1 if you have the declaration of `fdopendir', and to 0 if you | /* Define to 1 if you have the declaration of `fdopendir', and to 0 if you | |||
don't. */ | don't. */ | |||
#define HAVE_DECL_FDOPENDIR 1 | #define HAVE_DECL_FDOPENDIR 1 | |||
/* Define to 1 if you have the declaration of `floorf', and to 0 if you don 't. | /* Define to 1 if you have the declaration of `floorf', and to 0 if you don 't. | |||
*/ | */ | |||
/* #undef HAVE_DECL_FLOORF */ | #define HAVE_DECL_FLOORF 1 | |||
/* Define to 1 if you have the declaration of `fpurge', and to 0 if you don 't. | /* Define to 1 if you have the declaration of `fpurge', and to 0 if you don 't. | |||
*/ | */ | |||
#define HAVE_DECL_FPURGE 0 | #define HAVE_DECL_FPURGE 0 | |||
/* Define to 1 if you have the declaration of `fseeko', and to 0 if you don 't. | /* Define to 1 if you have the declaration of `fseeko', and to 0 if you don 't. | |||
*/ | */ | |||
#define HAVE_DECL_FSEEKO 1 | #define HAVE_DECL_FSEEKO 1 | |||
/* Define to 1 if you have the declaration of `ftello', and to 0 if you don 't. | /* Define to 1 if you have the declaration of `ftello', and to 0 if you don 't. | |||
skipping to change at line 629 | skipping to change at line 701 | |||
/* Define to 1 if you have the declaration of `getlogin_r', and to 0 if you | /* Define to 1 if you have the declaration of `getlogin_r', and to 0 if you | |||
don't. */ | don't. */ | |||
#define HAVE_DECL_GETLOGIN_R 1 | #define HAVE_DECL_GETLOGIN_R 1 | |||
/* Define to 1 if you have the declaration of `isblank', and to 0 if you | /* Define to 1 if you have the declaration of `isblank', and to 0 if you | |||
don't. */ | don't. */ | |||
/* #undef HAVE_DECL_ISBLANK */ | /* #undef HAVE_DECL_ISBLANK */ | |||
/* Define to 1 if you have the declaration of `localtime_r', and to 0 if yo u | /* Define to 1 if you have the declaration of `localtime_r', and to 0 if yo u | |||
don't. */ | don't. */ | |||
#define HAVE_DECL_LOCALTIME_R 0 | #define HAVE_DECL_LOCALTIME_R 1 | |||
/* Define to 1 if you have the declaration of `mbrtowc', and to 0 if you | /* Define to 1 if you have the declaration of `mbrtowc', and to 0 if you | |||
don't. */ | don't. */ | |||
/* #undef HAVE_DECL_MBRTOWC */ | /* #undef HAVE_DECL_MBRTOWC */ | |||
/* Define to 1 if you have the declaration of `mbsinit', and to 0 if you | /* Define to 1 if you have the declaration of `mbsinit', and to 0 if you | |||
don't. */ | don't. */ | |||
/* #undef HAVE_DECL_MBSINIT */ | /* #undef HAVE_DECL_MBSINIT */ | |||
/* Define to 1 if you have the declaration of `mbsrtowcs', and to 0 if you | /* Define to 1 if you have the declaration of `mbsrtowcs', and to 0 if you | |||
skipping to change at line 687 | skipping to change at line 759 | |||
#define HAVE_DECL_STRERROR_R 1 | #define HAVE_DECL_STRERROR_R 1 | |||
/* Define to 1 if you have the declaration of `strmode', and to 0 if you | /* Define to 1 if you have the declaration of `strmode', and to 0 if you | |||
don't. */ | don't. */ | |||
#define HAVE_DECL_STRMODE 0 | #define HAVE_DECL_STRMODE 0 | |||
/* Define to 1 if you have the declaration of `strncasecmp', and to 0 if yo u | /* Define to 1 if you have the declaration of `strncasecmp', and to 0 if yo u | |||
don't. */ | don't. */ | |||
#define HAVE_DECL_STRNCASECMP 1 | #define HAVE_DECL_STRNCASECMP 1 | |||
/* Define to 1 if you have the declaration of `strndup', and to 0 if you | ||||
don't. */ | ||||
#define HAVE_DECL_STRNDUP 1 | ||||
/* Define to 1 if you have the declaration of `strnlen', and to 0 if you | ||||
don't. */ | ||||
#define HAVE_DECL_STRNLEN 1 | ||||
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if yo u | /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if yo u | |||
don't. */ | don't. */ | |||
#define HAVE_DECL_SYS_SIGLIST 1 | #define HAVE_DECL_SYS_SIGLIST 1 | |||
/* Define to 1 if you have the declaration of `tgamma', and to 0 if you don 't. | /* Define to 1 if you have the declaration of `tgamma', and to 0 if you don 't. | |||
*/ | */ | |||
#define HAVE_DECL_TGAMMA 1 | #define HAVE_DECL_TGAMMA 1 | |||
/* Define to 1 if you have the declaration of `towlower', and to 0 if you | /* Define to 1 if you have the declaration of `towlower', and to 0 if you | |||
don't. */ | don't. */ | |||
skipping to change at line 711 | skipping to change at line 791 | |||
#define HAVE_DECL_TRUNC 1 | #define HAVE_DECL_TRUNC 1 | |||
/* Define to 1 if you have the declaration of `truncf', and to 0 if you don 't. | /* Define to 1 if you have the declaration of `truncf', and to 0 if you don 't. | |||
*/ | */ | |||
#define HAVE_DECL_TRUNCF 1 | #define HAVE_DECL_TRUNCF 1 | |||
/* Define to 1 if you have the declaration of `tzname', and to 0 if you don 't. | /* Define to 1 if you have the declaration of `tzname', and to 0 if you don 't. | |||
*/ | */ | |||
/* #undef HAVE_DECL_TZNAME */ | /* #undef HAVE_DECL_TZNAME */ | |||
/* Define to 1 if you have the declaration of `_putenv', and to 0 if you | ||||
don't. */ | ||||
/* #undef HAVE_DECL__PUTENV */ | ||||
/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you | /* Define to 1 if you have the declaration of `_snprintf', and to 0 if you | |||
don't. */ | don't. */ | |||
#define HAVE_DECL__SNPRINTF 0 | #define HAVE_DECL__SNPRINTF 0 | |||
/* Define to 1 if the system has the type `dev_t'. */ | /* Define to 1 if the system has the type `dev_t'. */ | |||
#define HAVE_DEV_T 1 | #define HAVE_DEV_T 1 | |||
/* Define to 1 if you have the <direct.h> header file. */ | /* Define to 1 if you have the <direct.h> header file. */ | |||
/* #undef HAVE_DIRECT_H */ | /* #undef HAVE_DIRECT_H */ | |||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR' | /* Define to 1 if you have the <dirent.h> header file. */ | |||
. | ||||
*/ | ||||
#define HAVE_DIRENT_H 1 | #define HAVE_DIRENT_H 1 | |||
/* Define to 1 if you have the `dirfd' function. */ | /* Define to 1 if you have the `dirfd' function. */ | |||
#define HAVE_DIRFD 1 | #define HAVE_DIRFD 1 | |||
/* Define to 1 if you have the <dlfcn.h> header file. */ | /* Define to 1 if you have the <dlfcn.h> header file. */ | |||
#define HAVE_DLFCN_H 1 | #define HAVE_DLFCN_H 1 | |||
/* Define if your system has dlopen, dlsym, dlerror, and dlclose for dynami | /* Define to 1 if your system has dlopen, dlsym, dlerror, and dlclose for | |||
c | dynamic linking. */ | |||
linking */ | ||||
#define HAVE_DLOPEN_API 1 | #define HAVE_DLOPEN_API 1 | |||
/* Define to 1 if you have the `dup2' function. */ | /* Define to 1 if you have the `dup2' function. */ | |||
#define HAVE_DUP2 1 | #define HAVE_DUP2 1 | |||
/* Define if your system has dyld for dynamic linking */ | /* Define to 1 if your system has dyld for dynamic linking. */ | |||
/* #undef HAVE_DYLD_API */ | /* #undef HAVE_DYLD_API */ | |||
/* Define if C++ supports dynamic auto arrays */ | /* Define to 1 if C++ supports dynamic auto arrays. */ | |||
#define HAVE_DYNAMIC_AUTO_ARRAYS 1 | #define HAVE_DYNAMIC_AUTO_ARRAYS 1 | |||
/* Define to 1 if you have the `endgrent' function. */ | /* Define to 1 if you have the `endgrent' function. */ | |||
#define HAVE_ENDGRENT 1 | #define HAVE_ENDGRENT 1 | |||
/* Define to 1 if you have the `endpwent' function. */ | /* Define to 1 if you have the `endpwent' function. */ | |||
#define HAVE_ENDPWENT 1 | #define HAVE_ENDPWENT 1 | |||
/* Define if you have the declaration of environ. */ | ||||
#define HAVE_ENVIRON_DECL 1 | ||||
/* Define to 1 if you have the `erf' function. */ | /* Define to 1 if you have the `erf' function. */ | |||
#define HAVE_ERF 1 | #define HAVE_ERF 1 | |||
/* Define to 1 if you have the `erfc' function. */ | /* Define to 1 if you have the `erfc' function. */ | |||
#define HAVE_ERFC 1 | #define HAVE_ERFC 1 | |||
/* Define to 1 if you have the `erfcf' function. */ | /* Define to 1 if you have the `erfcf' function. */ | |||
#define HAVE_ERFCF 1 | #define HAVE_ERFCF 1 | |||
/* Define to 1 if you have the `erff' function. */ | /* Define to 1 if you have the `erff' function. */ | |||
skipping to change at line 777 | skipping to change at line 863 | |||
/* Define to 1 if you have the `exp2f' function. */ | /* Define to 1 if you have the `exp2f' function. */ | |||
#define HAVE_EXP2F 1 | #define HAVE_EXP2F 1 | |||
/* Define to 1 if you have the `expm1' function. */ | /* Define to 1 if you have the `expm1' function. */ | |||
#define HAVE_EXPM1 1 | #define HAVE_EXPM1 1 | |||
/* Define to 1 if you have the `expm1f' function. */ | /* Define to 1 if you have the `expm1f' function. */ | |||
#define HAVE_EXPM1F 1 | #define HAVE_EXPM1F 1 | |||
/* Define if signed integers use two's complement */ | /* Define to 1 if signed integers use two's complement. */ | |||
#define HAVE_FAST_INT_OPS 1 | #define HAVE_FAST_INT_OPS 1 | |||
/* Define to 1 if you have the `fchdir' function. */ | /* Define to 1 if you have the `fchdir' function. */ | |||
#define HAVE_FCHDIR 1 | #define HAVE_FCHDIR 1 | |||
/* Define to 1 if you have the `fcntl' function. */ | /* Define to 1 if you have the `fcntl' function. */ | |||
#define HAVE_FCNTL 1 | #define HAVE_FCNTL 1 | |||
/* Define to 1 if you have the `fdopendir' function. */ | /* Define to 1 if you have the `fdopendir' function. */ | |||
#define HAVE_FDOPENDIR 1 | #define HAVE_FDOPENDIR 1 | |||
/* Define to 1 if you have the <features.h> header file. */ | /* Define to 1 if you have the <features.h> header file. */ | |||
#define HAVE_FEATURES_H 1 | #define HAVE_FEATURES_H 1 | |||
/* Define if FFTW3 is available. */ | /* Define if you have both FFTW3 and FFTW3F libraries. */ | |||
#define HAVE_FFTW 1 | ||||
/* Define to 1 if FFTW3 is available. */ | ||||
#define HAVE_FFTW3 1 | #define HAVE_FFTW3 1 | |||
/* Define if FFTW3F is available. */ | /* Define to 1 if FFTW3F is available. */ | |||
#define HAVE_FFTW3F 1 | #define HAVE_FFTW3F 1 | |||
/* Define to 1 if FFTW3F has multi-threading support. */ | ||||
#define HAVE_FFTW3F_THREADS 1 | ||||
/* Define to 1 if you have the <fftw3.h> header file. */ | /* Define to 1 if you have the <fftw3.h> header file. */ | |||
#define HAVE_FFTW3_H 1 | #define HAVE_FFTW3_H 1 | |||
/* Define to 1 if FFTW3 has multi-threading support. */ | ||||
#define HAVE_FFTW3_THREADS 1 | ||||
/* Define to 1 if you have the `finite' function. */ | /* Define to 1 if you have the `finite' function. */ | |||
#define HAVE_FINITE 1 | #define HAVE_FINITE 1 | |||
/* Define to 1 if you have the <floatingpoint.h> header file. */ | /* Define to 1 if you have the <floatingpoint.h> header file. */ | |||
/* #undef HAVE_FLOATINGPOINT_H */ | /* #undef HAVE_FLOATINGPOINT_H */ | |||
/* Define if the both the floorf() and ceilf() functions exist. */ | /* Define if the both the floorf() and ceilf() functions exist. */ | |||
/* #undef HAVE_FLOORF_AND_CEILF */ | /* #undef HAVE_FLOORF_AND_CEILF */ | |||
/* Define if FLTK is available */ | /* Define to 1 if FLTK is available. */ | |||
#define HAVE_FLTK 1 | #define HAVE_FLTK 1 | |||
/* Define to 1 if you have the <fnmatch.h> header file. */ | /* Define to 1 if you have the <fnmatch.h> header file. */ | |||
#define HAVE_FNMATCH_H 1 | #define HAVE_FNMATCH_H 1 | |||
/* Define to 1 if fontconfig is present */ | /* Define to 1 if fontconfig is present. */ | |||
#define HAVE_FONTCONFIG 1 | #define HAVE_FONTCONFIG 1 | |||
/* Define to 1 if you have the `fork' function. */ | /* Define to 1 if you have the `fork' function. */ | |||
#define HAVE_FORK 1 | #define HAVE_FORK 1 | |||
/* Define to 1 if you have the `fpurge' function. */ | /* Define to 1 if you have the `fpurge' function. */ | |||
/* #undef HAVE_FPURGE */ | /* #undef HAVE_FPURGE */ | |||
/* Define if framework CARBON is available. */ | /* Define to 1 if you have the <fpu_control.h> header file. */ | |||
#define HAVE_FPU_CONTROL_H 1 | ||||
/* Define to 1 if framework CARBON is available. */ | ||||
/* #undef HAVE_FRAMEWORK_CARBON */ | /* #undef HAVE_FRAMEWORK_CARBON */ | |||
/* Define if framework OPENGL is available. */ | /* Define to 1 if framework OPENGL is available. */ | |||
/* #undef HAVE_FRAMEWORK_OPENGL */ | /* #undef HAVE_FRAMEWORK_OPENGL */ | |||
/* Define to 1 if you have Freetype library. */ | /* Define to 1 if you have Freetype library. */ | |||
#define HAVE_FREETYPE 1 | #define HAVE_FREETYPE 1 | |||
/* Define if the frexp() function is available and works. */ | ||||
#define HAVE_FREXP 1 | ||||
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ | /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ | |||
#define HAVE_FSEEKO 1 | #define HAVE_FSEEKO 1 | |||
/* Define to 1 if you have the `fstatat' function. */ | /* Define to 1 if you have the `fstatat' function. */ | |||
#define HAVE_FSTATAT 1 | #define HAVE_FSTATAT 1 | |||
/* Define to 1 if you have the `ftruncate' function. */ | ||||
#define HAVE_FTRUNCATE 1 | ||||
/* Define to 1 if you have the `FT_Reference_Face' function. */ | ||||
#define HAVE_FT_REFERENCE_FACE 1 | ||||
/* Define to 1 if you have the `getcwd' function. */ | /* Define to 1 if you have the `getcwd' function. */ | |||
#define HAVE_GETCWD 1 | #define HAVE_GETCWD 1 | |||
/* Define to 1 if you have the `getdtablesize' function. */ | /* Define to 1 if you have the `getdtablesize' function. */ | |||
#define HAVE_GETDTABLESIZE 1 | #define HAVE_GETDTABLESIZE 1 | |||
/* Define to 1 if you have the `getegid' function. */ | /* Define to 1 if you have the `getegid' function. */ | |||
#define HAVE_GETEGID 1 | #define HAVE_GETEGID 1 | |||
/* Define to 1 if you have the `geteuid' function. */ | /* Define to 1 if you have the `geteuid' function. */ | |||
skipping to change at line 909 | skipping to change at line 1016 | |||
/* Define to 1 if you have the `getrusage' function. */ | /* Define to 1 if you have the `getrusage' function. */ | |||
#define HAVE_GETRUSAGE 1 | #define HAVE_GETRUSAGE 1 | |||
/* Define to 1 if you have the `gettimeofday' function. */ | /* Define to 1 if you have the `gettimeofday' function. */ | |||
#define HAVE_GETTIMEOFDAY 1 | #define HAVE_GETTIMEOFDAY 1 | |||
/* Define to 1 if you have the `getuid' function. */ | /* Define to 1 if you have the `getuid' function. */ | |||
#define HAVE_GETUID 1 | #define HAVE_GETUID 1 | |||
/* Define to 1 if you have the `getwd' function. */ | /* Define to 1 if you have the <gl2ps.h> header file. */ | |||
#define HAVE_GETWD 1 | /* #undef HAVE_GL2PS_H */ | |||
/* Define to 1 if you have the <glob.h> header file. */ | /* Define to 1 if you have the <glob.h> header file. */ | |||
#define HAVE_GLOB_H 1 | #define HAVE_GLOB_H 1 | |||
/* Define if GLPK is available. */ | /* Define to 1 if GLPK is available. */ | |||
#define HAVE_GLPK 1 | #define HAVE_GLPK 1 | |||
/* Define to 1 if you have the <glpk/glpk.h> header file. */ | /* Define to 1 if you have the <glpk/glpk.h> header file. */ | |||
/* #undef HAVE_GLPK_GLPK_H */ | /* #undef HAVE_GLPK_GLPK_H */ | |||
/* Define to 1 if you have the <glpk.h> header file. */ | /* Define to 1 if you have the <glpk.h> header file. */ | |||
#define HAVE_GLPK_H 1 | #define HAVE_GLPK_H 1 | |||
/* Define if gluTessCallback is called with (...) */ | /* Define to 1 if gluTessCallback is called with (...). */ | |||
/* #undef HAVE_GLUTESSCALLBACK_THREEDOTS */ | /* #undef HAVE_GLUTESSCALLBACK_THREEDOTS */ | |||
/* Define to 1 if you have the <GL/glu.h> header file. */ | /* Define to 1 if you have the <GL/glu.h> header file. */ | |||
#define HAVE_GL_GLU_H 1 | #define HAVE_GL_GLU_H 1 | |||
/* Define to 1 if you have the <GL/gl.h> header file. */ | /* Define to 1 if you have the <GL/gl.h> header file. */ | |||
#define HAVE_GL_GL_H 1 | #define HAVE_GL_GL_H 1 | |||
/* Define to 1 if you have the <grp.h> header file. */ | /* Define to 1 if you have the <grp.h> header file. */ | |||
#define HAVE_GRP_H 1 | #define HAVE_GRP_H 1 | |||
/* Define if HDF5 is available and newer than version 1.6. */ | /* Define to 1 if HDF5 is available and newer than version 1.6. */ | |||
#define HAVE_HDF5 1 | #define HAVE_HDF5 1 | |||
/* Define if >=HDF5-1.8 is available. */ | /* Define to 1 if >=HDF5-1.8 is available. */ | |||
#define HAVE_HDF5_18 1 | #define HAVE_HDF5_18 1 | |||
/* Define to 1 if you have the <hdf5.h> header file. */ | /* Define to 1 if you have the <hdf5.h> header file. */ | |||
#define HAVE_HDF5_H 1 | #define HAVE_HDF5_H 1 | |||
/* Define to 1 if you have the `hypotf' function. */ | /* Define to 1 if you have the `hypotf' function. */ | |||
#define HAVE_HYPOTF 1 | #define HAVE_HYPOTF 1 | |||
/* Define if your system uses IEEE 754 data format. */ | /* Define to 1 if your system uses IEEE 754 data format. */ | |||
#define HAVE_IEEE754_DATA_FORMAT 1 | #define HAVE_IEEE754_DATA_FORMAT 1 | |||
/* Define to 1 if you have the <ieeefp.h> header file. */ | /* Define to 1 if you have the <ieeefp.h> header file. */ | |||
/* #undef HAVE_IEEEFP_H */ | /* #undef HAVE_IEEEFP_H */ | |||
/* Define to 1 if the system has the type `ino_t'. */ | /* Define to 1 if the system has the type `ino_t'. */ | |||
#define HAVE_INO_T 1 | #define HAVE_INO_T 1 | |||
/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */ | /* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */ | |||
#define HAVE_INTMAX_T 1 | #define HAVE_INTMAX_T 1 | |||
/* Define to 1 if you have the <inttypes.h> header file. */ | /* Define to 1 if you have the <inttypes.h> header file. */ | |||
#define HAVE_INTTYPES_H 1 | #define HAVE_INTTYPES_H 1 | |||
/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and | /* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and | |||
declares uintmax_t. */ | declares uintmax_t. */ | |||
#define HAVE_INTTYPES_H_WITH_UINTMAX 1 | #define HAVE_INTTYPES_H_WITH_UINTMAX 1 | |||
/* Define to 1 if you have the `isascii' function. */ | ||||
#define HAVE_ISASCII 1 | ||||
/* Define to 1 if you have the `isblank' function. */ | /* Define to 1 if you have the `isblank' function. */ | |||
#define HAVE_ISBLANK 1 | #define HAVE_ISBLANK 1 | |||
/* Define to 1 if you have the `isinf' function. */ | /* Define to 1 if you have the `isinf' function. */ | |||
#define HAVE_ISINF 1 | #define HAVE_ISINF 1 | |||
/* Define to 1 if you have the `isnan' function. */ | /* Define to 1 if you have the `isnan' function. */ | |||
#define HAVE_ISNAN 1 | #define HAVE_ISNAN 1 | |||
/* Define if the isnan(double) function is available in libc. */ | /* Define if the isnan(double) function is available in libc. */ | |||
#define HAVE_ISNAND_IN_LIBC 1 | #define HAVE_ISNAND_IN_LIBC 1 | |||
/* Define if the isnan(float) function is available in libc. */ | /* Define if the isnan(float) function is available in libc. */ | |||
#define HAVE_ISNANF_IN_LIBC 1 | #define HAVE_ISNANF_IN_LIBC 1 | |||
/* Define if the isnan(long double) function is available in libc. */ | /* Define if the isnan(long double) function is available in libc. */ | |||
/* #undef HAVE_ISNANL_IN_LIBC */ | /* #undef HAVE_ISNANL_IN_LIBC */ | |||
/* Define to 1 if you have the `issetugid' function. */ | ||||
/* #undef HAVE_ISSETUGID */ | ||||
/* Define to 1 if you have the `iswcntrl' function. */ | /* Define to 1 if you have the `iswcntrl' function. */ | |||
#define HAVE_ISWCNTRL 1 | #define HAVE_ISWCNTRL 1 | |||
/* Define to 1 if you have the `iswctype' function. */ | /* Define to 1 if you have the `iswctype' function. */ | |||
#define HAVE_ISWCTYPE 1 | #define HAVE_ISWCTYPE 1 | |||
/* Define to 1 if Java is available and is at least version 1.5 */ | ||||
#define HAVE_JAVA 1 | ||||
/* Define to 1 if you have the `kill' function. */ | /* Define to 1 if you have the `kill' function. */ | |||
#define HAVE_KILL 1 | #define HAVE_KILL 1 | |||
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ | /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ | |||
#define HAVE_LANGINFO_CODESET 1 | #define HAVE_LANGINFO_CODESET 1 | |||
/* Define if you have LAPACK library. */ | /* Define if you have LAPACK library. */ | |||
/* #undef HAVE_LAPACK */ | /* #undef HAVE_LAPACK */ | |||
/* Define to 1 if you have the `lgamma' function. */ | /* Define to 1 if you have the `lgamma' function. */ | |||
skipping to change at line 1027 | skipping to change at line 1143 | |||
/* Define to 1 if you have the <libqhull.h> header file. */ | /* Define to 1 if you have the <libqhull.h> header file. */ | |||
/* #undef HAVE_LIBQHULL_H */ | /* #undef HAVE_LIBQHULL_H */ | |||
/* Define to 1 if you have the <libqhull/libqhull.h> header file. */ | /* Define to 1 if you have the <libqhull/libqhull.h> header file. */ | |||
/* #undef HAVE_LIBQHULL_LIBQHULL_H */ | /* #undef HAVE_LIBQHULL_LIBQHULL_H */ | |||
/* Define to 1 if you have the `sun' library (-lsun). */ | /* Define to 1 if you have the `sun' library (-lsun). */ | |||
/* #undef HAVE_LIBSUN */ | /* #undef HAVE_LIBSUN */ | |||
/* Define to 1 if you have the <libutil.h> header file. */ | ||||
/* #undef HAVE_LIBUTIL_H */ | ||||
/* Define to 1 if you have the `link' function. */ | /* Define to 1 if you have the `link' function. */ | |||
#define HAVE_LINK 1 | #define HAVE_LINK 1 | |||
/* Define if your system has LoadLibrary for dynamic linking */ | /* Define to 1 if LLVM is available. */ | |||
/* #undef HAVE_LLVM */ | ||||
/* Define to 1 if you have the <llvm/DataLayout.h> header file. */ | ||||
/* #undef HAVE_LLVM_DATALAYOUT_H */ | ||||
/* Define to 1 if you have the <llvm/Function.h> header file. */ | ||||
#define HAVE_LLVM_FUNCTION_H 1 | ||||
/* Define to 1 if you have the <llvm/IRBuilder.h> header file. */ | ||||
/* #undef HAVE_LLVM_IRBUILDER_H */ | ||||
/* Define to 1 if you have the <llvm/IR/DataLayout.h> header file. */ | ||||
/* #undef HAVE_LLVM_IR_DATALAYOUT_H */ | ||||
/* Define to 1 if you have the <llvm/IR/Function.h> header file. */ | ||||
/* #undef HAVE_LLVM_IR_FUNCTION_H */ | ||||
/* Define to 1 if you have the <llvm/IR/IRBuilder.h> header file. */ | ||||
/* #undef HAVE_LLVM_IR_IRBUILDER_H */ | ||||
/* Define to 1 if you have the <llvm/Support/IRBuilder.h> header file. */ | ||||
#define HAVE_LLVM_SUPPORT_IRBUILDER_H 1 | ||||
/* Define to 1 if you have the <llvm/Target/TargetData.h> header file. */ | ||||
#define HAVE_LLVM_TARGET_TARGETDATA_H 1 | ||||
/* Define to 1 if your system has LoadLibrary for dynamic linking. */ | ||||
/* #undef HAVE_LOADLIBRARY_API */ | /* #undef HAVE_LOADLIBRARY_API */ | |||
/* Define to 1 if you have the <locale.h> header file. */ | /* Define to 1 if you have the <locale.h> header file. */ | |||
#define HAVE_LOCALE_H 1 | #define HAVE_LOCALE_H 1 | |||
/* Define to 1 if you have the `localtime_r' function. */ | /* Define to 1 if you have the `localtime_r' function. */ | |||
#define HAVE_LOCALTIME_R 1 | #define HAVE_LOCALTIME_R 1 | |||
/* Define to 1 if you have the `log1p' function. */ | /* Define to 1 if you have the `log1p' function. */ | |||
#define HAVE_LOG1P 1 | #define HAVE_LOG1P 1 | |||
/* Define to 1 if you have the `log1pf' function. */ | /* Define to 1 if you have the `log1pf' function. */ | |||
#define HAVE_LOG1PF 1 | #define HAVE_LOG1PF 1 | |||
/* Define to 1 if you have the `log2' function. */ | /* Define to 1 if you have the `log2' function. */ | |||
#define HAVE_LOG2 1 | #define HAVE_LOG2 1 | |||
/* Define to 1 if you have the `log2f' function. */ | /* Define to 1 if you have the `log2f' function. */ | |||
#define HAVE_LOG2F 1 | #define HAVE_LOG2F 1 | |||
/* Define to 1 if the system has the type `long long int'. */ | /* Define to 1 if you support file names longer than 14 characters. */ | |||
#define HAVE_LONG_FILE_NAMES 1 | ||||
/* Define to 1 if the system has the type 'long long int'. */ | ||||
#define HAVE_LONG_LONG_INT 1 | #define HAVE_LONG_LONG_INT 1 | |||
/* Define to 1 if you have the `lstat' function. */ | /* Define to 1 if you have the `lstat' function. */ | |||
#define HAVE_LSTAT 1 | #define HAVE_LSTAT 1 | |||
/* Define if Graphics/ImageMagick++ is available. */ | /* Define to 1 if Graphics/ImageMagick++ is available. */ | |||
#define HAVE_MAGICK 1 | #define HAVE_MAGICK 1 | |||
/* Define to 1 if your system has a GNU libc compatible 'malloc' function, | ||||
and | ||||
to 0 otherwise. */ | ||||
#define HAVE_MALLOC_GNU 1 | ||||
/* Define if the 'malloc' function is POSIX compliant. */ | /* Define if the 'malloc' function is POSIX compliant. */ | |||
#define HAVE_MALLOC_POSIX 1 | #define HAVE_MALLOC_POSIX 1 | |||
/* Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including | /* Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including | |||
config.h and <sys/mman.h>. */ | config.h and <sys/mman.h>. */ | |||
#define HAVE_MAP_ANONYMOUS 1 | #define HAVE_MAP_ANONYMOUS 1 | |||
/* Define to 1 if defines such as M_PI are available in math.h */ | ||||
#define HAVE_MATH_DEFINES 1 | ||||
/* Define to 1 if you have the <math.h> header file. */ | /* Define to 1 if you have the <math.h> header file. */ | |||
#define HAVE_MATH_H 1 | #define HAVE_MATH_H 1 | |||
/* Define to 1 if you have the `mbrtowc' function. */ | /* Define to 1 if you have the `mbrtowc' function. */ | |||
#define HAVE_MBRTOWC 1 | #define HAVE_MBRTOWC 1 | |||
/* Define to 1 if you have the `mbsinit' function. */ | /* Define to 1 if you have the `mbsinit' function. */ | |||
#define HAVE_MBSINIT 1 | #define HAVE_MBSINIT 1 | |||
/* Define to 1 if you have the `mbsrtowcs' function. */ | /* Define to 1 if you have the `mbsrtowcs' function. */ | |||
skipping to change at line 1101 | skipping to change at line 1257 | |||
/* Define to 1 if getcwd minimally works, that is, its result can be truste d | /* Define to 1 if getcwd minimally works, that is, its result can be truste d | |||
when it succeeds. */ | when it succeeds. */ | |||
#define HAVE_MINIMALLY_WORKING_GETCWD 1 | #define HAVE_MINIMALLY_WORKING_GETCWD 1 | |||
/* Define to 1 if you have the `mkfifo' function. */ | /* Define to 1 if you have the `mkfifo' function. */ | |||
#define HAVE_MKFIFO 1 | #define HAVE_MKFIFO 1 | |||
/* Define to 1 if you have the `mkostemp' function. */ | /* Define to 1 if you have the `mkostemp' function. */ | |||
#define HAVE_MKOSTEMP 1 | #define HAVE_MKOSTEMP 1 | |||
/* Define to 1 if you have the `mkstemp' function. */ | /* Define to 1 if you have the `mmap' function. */ | |||
#define HAVE_MKSTEMP 1 | #define HAVE_MMAP 1 | |||
/* Define if mkstemps is available in libiberty. */ | /* Define to 1 if you have the `modf' function. */ | |||
/* #undef HAVE_MKSTEMPS */ | #define HAVE_MODF 1 | |||
/* Define to 1 if you have the `mprotect' function. */ | /* Define to 1 if you have the `mprotect' function. */ | |||
#define HAVE_MPROTECT 1 | #define HAVE_MPROTECT 1 | |||
/* Define to 1 on MSVC platforms that have the "invalid parameter handler" | /* Define to 1 on MSVC platforms that have the "invalid parameter handler" | |||
concept. */ | concept. */ | |||
/* #undef HAVE_MSVC_INVALID_PARAMETER_HANDLER */ | /* #undef HAVE_MSVC_INVALID_PARAMETER_HANDLER */ | |||
/* Define to 1 if you have the `munmap' function. */ | ||||
#define HAVE_MUNMAP 1 | ||||
/* Define to 1 if you have the <ncurses.h> header file. */ | /* Define to 1 if you have the <ncurses.h> header file. */ | |||
#define HAVE_NCURSES_H 1 | #define HAVE_NCURSES_H 1 | |||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ | /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ | |||
/* #undef HAVE_NDIR_H */ | /* #undef HAVE_NDIR_H */ | |||
/* Define to 1 if you have the <netdb.h> header file. */ | /* Define to 1 if you have the <netdb.h> header file. */ | |||
#define HAVE_NETDB_H 1 | #define HAVE_NETDB_H 1 | |||
/* Define to 1 if you have the `openat' function. */ | /* Define to 1 if you have the `openat' function. */ | |||
#define HAVE_OPENAT 1 | #define HAVE_OPENAT 1 | |||
/* Define to 1 if you have the `opendir' function. */ | /* Define to 1 if you have the `opendir' function. */ | |||
#define HAVE_OPENDIR 1 | #define HAVE_OPENDIR 1 | |||
/* Define if OpenGL is available */ | /* Define to 1 if OpenGL is available. */ | |||
#define HAVE_OPENGL 1 | #define HAVE_OPENGL 1 | |||
/* Define to 1 if you have the <OpenGL/glu.h> header file. */ | /* Define to 1 if you have the <OpenGL/glu.h> header file. */ | |||
/* #undef HAVE_OPENGL_GLU_H */ | /* #undef HAVE_OPENGL_GLU_H */ | |||
/* Define to 1 if you have the <OpenGL/gl.h> header file. */ | /* Define to 1 if you have the <OpenGL/gl.h> header file. */ | |||
/* #undef HAVE_OPENGL_GL_H */ | /* #undef HAVE_OPENGL_GL_H */ | |||
/* Define if compiler supports OpenMP */ | /* Define to 1 if compiler supports OpenMP. */ | |||
/* #undef HAVE_OPENMP */ | /* #undef HAVE_OPENMP */ | |||
/* Define whether openpty exists */ | ||||
#define HAVE_OPENPTY /**/ | ||||
/* Define to 1 if getcwd works, except it sometimes fails when it shouldn't , | /* Define to 1 if getcwd works, except it sometimes fails when it shouldn't , | |||
setting errno to ERANGE, ENAMETOOLONG, or ENOENT. */ | setting errno to ERANGE, ENAMETOOLONG, or ENOENT. */ | |||
#define HAVE_PARTLY_WORKING_GETCWD 1 | #define HAVE_PARTLY_WORKING_GETCWD 1 | |||
/* Define to 1 if you have the `pathconf' function. */ | ||||
#define HAVE_PATHCONF 1 | ||||
/* Define to 1 if you have the `pcre_compile' function. */ | /* Define to 1 if you have the `pcre_compile' function. */ | |||
#define HAVE_PCRE_COMPILE 1 | #define HAVE_PCRE_COMPILE 1 | |||
/* Define to 1 if you have the <pcre.h> header file. */ | /* Define to 1 if you have the <pcre.h> header file. */ | |||
#define HAVE_PCRE_H 1 | #define HAVE_PCRE_H 1 | |||
/* Define to 1 if you have the <pcre/pcre.h> header file. */ | /* Define to 1 if you have the <pcre/pcre.h> header file. */ | |||
/* #undef HAVE_PCRE_PCRE_H */ | /* #undef HAVE_PCRE_PCRE_H */ | |||
/* Define to 1 if you have the `pipe' function. */ | /* Define to 1 if you have the `pipe' function. */ | |||
#define HAVE_PIPE 1 | #define HAVE_PIPE 1 | |||
/* Define if C++ supports operator delete(void *, void *) */ | /* Define to 1 if C++ supports operator delete(void *, void *). */ | |||
#define HAVE_PLACEMENT_DELETE 1 | #define HAVE_PLACEMENT_DELETE 1 | |||
/* Define to 1 if you have the <poll.h> header file. */ | /* Define to 1 if you have the <poll.h> header file. */ | |||
#define HAVE_POLL_H 1 | #define HAVE_POLL_H 1 | |||
/* Define to 1 if you have the `pow' function. */ | ||||
#define HAVE_POW 1 | ||||
/* Define to 1 if you have the `pstat_getdynamic' function. */ | /* Define to 1 if you have the `pstat_getdynamic' function. */ | |||
/* #undef HAVE_PSTAT_GETDYNAMIC */ | /* #undef HAVE_PSTAT_GETDYNAMIC */ | |||
/* Define if you have POSIX threads libraries and header files. */ | /* Define if you have POSIX threads libraries and header files. */ | |||
#define HAVE_PTHREAD 1 | #define HAVE_PTHREAD 1 | |||
/* Define to 1 if you have the <pthread.h> header file. */ | /* Define to 1 if you have the <pthread.h> header file. */ | |||
#define HAVE_PTHREAD_H 1 | #define HAVE_PTHREAD_H 1 | |||
/* Define to 1 if you have the `putenv' function. */ | /* Have PTHREAD_PRIO_INHERIT. */ | |||
#define HAVE_PUTENV 1 | #define HAVE_PTHREAD_PRIO_INHERIT 1 | |||
/* Define to 1 if the system has the type `ptrdiff_t'. */ | ||||
#define HAVE_PTRDIFF_T 1 | ||||
/* Define to 1 if you have the <pty.h> header file. */ | ||||
#define HAVE_PTY_H 1 | ||||
/* Define to 1 if you have the <pwd.h> header file. */ | /* Define to 1 if you have the <pwd.h> header file. */ | |||
#define HAVE_PWD_H 1 | #define HAVE_PWD_H 1 | |||
/* Define if QHull is available. */ | /* Define to 1 if Qt has the QAbstractItemModel::beginResetModel() function | |||
. | ||||
*/ | ||||
#define HAVE_QABSTRACTITEMMODEL_BEGINRESETMODEL 1 | ||||
/* Define to 1 if Qt provides QFont::Monospace. */ | ||||
#define HAVE_QFONT_MONOSPACE 1 | ||||
/* Define to 1 if Qhull is available. */ | ||||
/* #undef HAVE_QHULL */ | /* #undef HAVE_QHULL */ | |||
/* Define to 1 if you have the <qhull.h> header file. */ | /* Define to 1 if you have the <qhull.h> header file. */ | |||
/* #undef HAVE_QHULL_H */ | /* #undef HAVE_QHULL_H */ | |||
/* Define to 1 if you have the <qhull/libqhull.h> header file. */ | /* Define to 1 if you have the <qhull/libqhull.h> header file. */ | |||
/* #undef HAVE_QHULL_LIBQHULL_H */ | /* #undef HAVE_QHULL_LIBQHULL_H */ | |||
/* Define to 1 if you have the <qhull/qhull.h> header file. */ | /* Define to 1 if you have the <qhull/qhull.h> header file. */ | |||
/* #undef HAVE_QHULL_QHULL_H */ | /* #undef HAVE_QHULL_QHULL_H */ | |||
/* Define if qrupdate is available. */ | /* Define to 1 if qrupdate is available. */ | |||
#define HAVE_QRUPDATE 1 | #define HAVE_QRUPDATE 1 | |||
/* Define if qrupdate supports LU updates */ | /* Define to 1 if qrupdate supports LU updates. */ | |||
/* #undef HAVE_QRUPDATE_LUU */ | /* #undef HAVE_QRUPDATE_LUU */ | |||
/* Define to 1 if the QScintilla library and header files are available */ | ||||
/* #undef HAVE_QSCINTILLA */ | ||||
/* Define to 1 if you have the <Qsci/qscilexermatlab.h> header file. */ | ||||
/* #undef HAVE_QSCI_QSCILEXERMATLAB_H */ | ||||
/* Define to 1 if you have the <Qsci/qscilexeroctave.h> header file. */ | ||||
/* #undef HAVE_QSCI_QSCILEXEROCTAVE_H */ | ||||
/* Define to 1 if Qscintilla is of Version 2.6.0 or later. */ | ||||
/* #undef HAVE_QSCI_VERSION_2_6_0 */ | ||||
/* Define to 1 if Qt is available (libraries, developer header files, utili | ||||
ty | ||||
programs (moc, uic, rcc, and lrelease)) */ | ||||
#define HAVE_QT 1 | ||||
/* Define to 1 if you have the `raise' function. */ | /* Define to 1 if you have the `raise' function. */ | |||
#define HAVE_RAISE 1 | #define HAVE_RAISE 1 | |||
/* Define to 1 if accept is declared even after undefining macros. */ | /* Define to 1 if accept is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_ACCEPT 1 | #define HAVE_RAW_DECL_ACCEPT 1 | |||
/* Define to 1 if accept4 is declared even after undefining macros. */ | /* Define to 1 if accept4 is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_ACCEPT4 1 | #define HAVE_RAW_DECL_ACCEPT4 1 | |||
/* Define to 1 if acosf is declared even after undefining macros. */ | /* Define to 1 if acosf is declared even after undefining macros. */ | |||
skipping to change at line 1239 | skipping to change at line 1436 | |||
/* Define to 1 if bind is declared even after undefining macros. */ | /* Define to 1 if bind is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_BIND 1 | #define HAVE_RAW_DECL_BIND 1 | |||
/* Define to 1 if btowc is declared even after undefining macros. */ | /* Define to 1 if btowc is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_BTOWC 1 | #define HAVE_RAW_DECL_BTOWC 1 | |||
/* Define to 1 if canonicalize_file_name is declared even after undefining | /* Define to 1 if canonicalize_file_name is declared even after undefining | |||
macros. */ | macros. */ | |||
#define HAVE_RAW_DECL_CANONICALIZE_FILE_NAME 1 | #define HAVE_RAW_DECL_CANONICALIZE_FILE_NAME 1 | |||
/* Define to 1 if cbrt is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_CBRT 1 | ||||
/* Define to 1 if cbrtf is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_CBRTF 1 | ||||
/* Define to 1 if cbrtl is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_CBRTL 1 | ||||
/* Define to 1 if ceilf is declared even after undefining macros. */ | /* Define to 1 if ceilf is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_CEILF 1 | #define HAVE_RAW_DECL_CEILF 1 | |||
/* Define to 1 if ceill is declared even after undefining macros. */ | /* Define to 1 if ceill is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_CEILL 1 | #define HAVE_RAW_DECL_CEILL 1 | |||
/* Define to 1 if chdir is declared even after undefining macros. */ | /* Define to 1 if chdir is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_CHDIR 1 | #define HAVE_RAW_DECL_CHDIR 1 | |||
/* Define to 1 if chown is declared even after undefining macros. */ | /* Define to 1 if chown is declared even after undefining macros. */ | |||
skipping to change at line 1299 | skipping to change at line 1505 | |||
/* Define to 1 if endusershell is declared even after undefining macros. */ | /* Define to 1 if endusershell is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_ENDUSERSHELL 1 | #define HAVE_RAW_DECL_ENDUSERSHELL 1 | |||
/* Define to 1 if environ is declared even after undefining macros. */ | /* Define to 1 if environ is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_ENVIRON 1 | #define HAVE_RAW_DECL_ENVIRON 1 | |||
/* Define to 1 if euidaccess is declared even after undefining macros. */ | /* Define to 1 if euidaccess is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_EUIDACCESS 1 | #define HAVE_RAW_DECL_EUIDACCESS 1 | |||
/* Define to 1 if exp2 is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_EXP2 1 | ||||
/* Define to 1 if exp2f is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_EXP2F 1 | ||||
/* Define to 1 if exp2l is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_EXP2L 1 | ||||
/* Define to 1 if expf is declared even after undefining macros. */ | /* Define to 1 if expf is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_EXPF 1 | #define HAVE_RAW_DECL_EXPF 1 | |||
/* Define to 1 if expl is declared even after undefining macros. */ | /* Define to 1 if expl is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_EXPL 1 | #define HAVE_RAW_DECL_EXPL 1 | |||
/* Define to 1 if expm1 is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_EXPM1 1 | ||||
/* Define to 1 if expm1f is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_EXPM1F 1 | ||||
/* Define to 1 if expm1l is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_EXPM1L 1 | ||||
/* Define to 1 if fabsf is declared even after undefining macros. */ | /* Define to 1 if fabsf is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_FABSF 1 | #define HAVE_RAW_DECL_FABSF 1 | |||
/* Define to 1 if fabsl is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_FABSL 1 | ||||
/* Define to 1 if faccessat is declared even after undefining macros. */ | /* Define to 1 if faccessat is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_FACCESSAT 1 | #define HAVE_RAW_DECL_FACCESSAT 1 | |||
/* Define to 1 if fchdir is declared even after undefining macros. */ | /* Define to 1 if fchdir is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_FCHDIR 1 | #define HAVE_RAW_DECL_FCHDIR 1 | |||
/* Define to 1 if fchmodat is declared even after undefining macros. */ | /* Define to 1 if fchmodat is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_FCHMODAT 1 | #define HAVE_RAW_DECL_FCHMODAT 1 | |||
/* Define to 1 if fchownat is declared even after undefining macros. */ | /* Define to 1 if fchownat is declared even after undefining macros. */ | |||
skipping to change at line 1353 | skipping to change at line 1580 | |||
/* Define to 1 if fma is declared even after undefining macros. */ | /* Define to 1 if fma is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_FMA 1 | #define HAVE_RAW_DECL_FMA 1 | |||
/* Define to 1 if fmaf is declared even after undefining macros. */ | /* Define to 1 if fmaf is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_FMAF 1 | #define HAVE_RAW_DECL_FMAF 1 | |||
/* Define to 1 if fmal is declared even after undefining macros. */ | /* Define to 1 if fmal is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_FMAL 1 | #define HAVE_RAW_DECL_FMAL 1 | |||
/* Define to 1 if fmod is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_FMOD 1 | ||||
/* Define to 1 if fmodf is declared even after undefining macros. */ | /* Define to 1 if fmodf is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_FMODF 1 | #define HAVE_RAW_DECL_FMODF 1 | |||
/* Define to 1 if fmodl is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_FMODL 1 | ||||
/* Define to 1 if fpurge is declared even after undefining macros. */ | /* Define to 1 if fpurge is declared even after undefining macros. */ | |||
/* #undef HAVE_RAW_DECL_FPURGE */ | /* #undef HAVE_RAW_DECL_FPURGE */ | |||
/* Define to 1 if frexpf is declared even after undefining macros. */ | /* Define to 1 if frexpf is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_FREXPF 1 | #define HAVE_RAW_DECL_FREXPF 1 | |||
/* Define to 1 if frexpl is declared even after undefining macros. */ | /* Define to 1 if frexpl is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_FREXPL 1 | #define HAVE_RAW_DECL_FREXPL 1 | |||
/* Define to 1 if fseeko is declared even after undefining macros. */ | /* Define to 1 if fseeko is declared even after undefining macros. */ | |||
skipping to change at line 1446 | skipping to change at line 1679 | |||
/* Define to 1 if getusershell is declared even after undefining macros. */ | /* Define to 1 if getusershell is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_GETUSERSHELL 1 | #define HAVE_RAW_DECL_GETUSERSHELL 1 | |||
/* Define to 1 if grantpt is declared even after undefining macros. */ | /* Define to 1 if grantpt is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_GRANTPT 1 | #define HAVE_RAW_DECL_GRANTPT 1 | |||
/* Define to 1 if group_member is declared even after undefining macros. */ | /* Define to 1 if group_member is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_GROUP_MEMBER 1 | #define HAVE_RAW_DECL_GROUP_MEMBER 1 | |||
/* Define to 1 if hypotf is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_HYPOTF 1 | ||||
/* Define to 1 if hypotl is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_HYPOTL 1 | ||||
/* Define to 1 if ilogb is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_ILOGB 1 | ||||
/* Define to 1 if ilogbf is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_ILOGBF 1 | ||||
/* Define to 1 if ilogbl is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_ILOGBL 1 | ||||
/* Define to 1 if initstate is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_INITSTATE 1 | ||||
/* Define to 1 if initstate_r is declared even after undefining macros. */ | /* Define to 1 if initstate_r is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_INITSTATE_R 1 | #define HAVE_RAW_DECL_INITSTATE_R 1 | |||
/* Define to 1 if isatty is declared even after undefining macros. */ | /* Define to 1 if isatty is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_ISATTY 1 | #define HAVE_RAW_DECL_ISATTY 1 | |||
/* Define to 1 if iswctype is declared even after undefining macros. */ | /* Define to 1 if iswctype is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_ISWCTYPE 1 | #define HAVE_RAW_DECL_ISWCTYPE 1 | |||
/* Define to 1 if lchmod is declared even after undefining macros. */ | /* Define to 1 if lchmod is declared even after undefining macros. */ | |||
skipping to change at line 1476 | skipping to change at line 1727 | |||
/* Define to 1 if link is declared even after undefining macros. */ | /* Define to 1 if link is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_LINK 1 | #define HAVE_RAW_DECL_LINK 1 | |||
/* Define to 1 if linkat is declared even after undefining macros. */ | /* Define to 1 if linkat is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_LINKAT 1 | #define HAVE_RAW_DECL_LINKAT 1 | |||
/* Define to 1 if listen is declared even after undefining macros. */ | /* Define to 1 if listen is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_LISTEN 1 | #define HAVE_RAW_DECL_LISTEN 1 | |||
/* Define to 1 if log is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_LOG 1 | ||||
/* Define to 1 if log10 is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_LOG10 1 | ||||
/* Define to 1 if log10f is declared even after undefining macros. */ | /* Define to 1 if log10f is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_LOG10F 1 | #define HAVE_RAW_DECL_LOG10F 1 | |||
/* Define to 1 if log10l is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_LOG10L 1 | ||||
/* Define to 1 if log1p is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_LOG1P 1 | ||||
/* Define to 1 if log1pf is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_LOG1PF 1 | ||||
/* Define to 1 if log1pl is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_LOG1PL 1 | ||||
/* Define to 1 if log2 is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_LOG2 1 | ||||
/* Define to 1 if log2f is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_LOG2F 1 | ||||
/* Define to 1 if log2l is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_LOG2L 1 | ||||
/* Define to 1 if logb is declared even after undefining macros. */ | /* Define to 1 if logb is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_LOGB 1 | #define HAVE_RAW_DECL_LOGB 1 | |||
/* Define to 1 if logbf is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_LOGBF 1 | ||||
/* Define to 1 if logbl is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_LOGBL 1 | ||||
/* Define to 1 if logf is declared even after undefining macros. */ | /* Define to 1 if logf is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_LOGF 1 | #define HAVE_RAW_DECL_LOGF 1 | |||
/* Define to 1 if logl is declared even after undefining macros. */ | /* Define to 1 if logl is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_LOGL 1 | #define HAVE_RAW_DECL_LOGL 1 | |||
/* Define to 1 if lseek is declared even after undefining macros. */ | /* Define to 1 if lseek is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_LSEEK 1 | #define HAVE_RAW_DECL_LSEEK 1 | |||
/* Define to 1 if lstat is declared even after undefining macros. */ | /* Define to 1 if lstat is declared even after undefining macros. */ | |||
skipping to change at line 1548 | skipping to change at line 1832 | |||
/* Define to 1 if mkostemps is declared even after undefining macros. */ | /* Define to 1 if mkostemps is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_MKOSTEMPS 1 | #define HAVE_RAW_DECL_MKOSTEMPS 1 | |||
/* Define to 1 if mkstemp is declared even after undefining macros. */ | /* Define to 1 if mkstemp is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_MKSTEMP 1 | #define HAVE_RAW_DECL_MKSTEMP 1 | |||
/* Define to 1 if mkstemps is declared even after undefining macros. */ | /* Define to 1 if mkstemps is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_MKSTEMPS 1 | #define HAVE_RAW_DECL_MKSTEMPS 1 | |||
/* Define to 1 if modf is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_MODF 1 | ||||
/* Define to 1 if modff is declared even after undefining macros. */ | /* Define to 1 if modff is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_MODFF 1 | #define HAVE_RAW_DECL_MODFF 1 | |||
/* Define to 1 if modfl is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_MODFL 1 | ||||
/* Define to 1 if openat is declared even after undefining macros. */ | /* Define to 1 if openat is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_OPENAT 1 | #define HAVE_RAW_DECL_OPENAT 1 | |||
/* Define to 1 if opendir is declared even after undefining macros. */ | /* Define to 1 if opendir is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_OPENDIR 1 | #define HAVE_RAW_DECL_OPENDIR 1 | |||
/* Define to 1 if pclose is declared even after undefining macros. */ | /* Define to 1 if pclose is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_PCLOSE 1 | #define HAVE_RAW_DECL_PCLOSE 1 | |||
/* Define to 1 if pipe is declared even after undefining macros. */ | /* Define to 1 if pipe is declared even after undefining macros. */ | |||
skipping to change at line 1593 | skipping to change at line 1883 | |||
/* Define to 1 if ptsname is declared even after undefining macros. */ | /* Define to 1 if ptsname is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_PTSNAME 1 | #define HAVE_RAW_DECL_PTSNAME 1 | |||
/* Define to 1 if ptsname_r is declared even after undefining macros. */ | /* Define to 1 if ptsname_r is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_PTSNAME_R 1 | #define HAVE_RAW_DECL_PTSNAME_R 1 | |||
/* Define to 1 if pwrite is declared even after undefining macros. */ | /* Define to 1 if pwrite is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_PWRITE 1 | #define HAVE_RAW_DECL_PWRITE 1 | |||
/* Define to 1 if random is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_RANDOM 1 | ||||
/* Define to 1 if random_r is declared even after undefining macros. */ | /* Define to 1 if random_r is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_RANDOM_R 1 | #define HAVE_RAW_DECL_RANDOM_R 1 | |||
/* Define to 1 if rawmemchr is declared even after undefining macros. */ | /* Define to 1 if rawmemchr is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_RAWMEMCHR 1 | #define HAVE_RAW_DECL_RAWMEMCHR 1 | |||
/* Define to 1 if readdir is declared even after undefining macros. */ | /* Define to 1 if readdir is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_READDIR 1 | #define HAVE_RAW_DECL_READDIR 1 | |||
/* Define to 1 if readlink is declared even after undefining macros. */ | /* Define to 1 if readlink is declared even after undefining macros. */ | |||
skipping to change at line 1617 | skipping to change at line 1910 | |||
/* Define to 1 if realpath is declared even after undefining macros. */ | /* Define to 1 if realpath is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_REALPATH 1 | #define HAVE_RAW_DECL_REALPATH 1 | |||
/* Define to 1 if recv is declared even after undefining macros. */ | /* Define to 1 if recv is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_RECV 1 | #define HAVE_RAW_DECL_RECV 1 | |||
/* Define to 1 if recvfrom is declared even after undefining macros. */ | /* Define to 1 if recvfrom is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_RECVFROM 1 | #define HAVE_RAW_DECL_RECVFROM 1 | |||
/* Define to 1 if remainder is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_REMAINDER 1 | ||||
/* Define to 1 if remainderf is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_REMAINDERF 1 | ||||
/* Define to 1 if remainderl is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_REMAINDERL 1 | ||||
/* Define to 1 if renameat is declared even after undefining macros. */ | /* Define to 1 if renameat is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_RENAMEAT 1 | #define HAVE_RAW_DECL_RENAMEAT 1 | |||
/* Define to 1 if rewinddir is declared even after undefining macros. */ | /* Define to 1 if rewinddir is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_REWINDDIR 1 | #define HAVE_RAW_DECL_REWINDDIR 1 | |||
/* Define to 1 if rint is declared even after undefining macros. */ | /* Define to 1 if rint is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_RINT 1 | #define HAVE_RAW_DECL_RINT 1 | |||
/* Define to 1 if rintf is declared even after undefining macros. */ | /* Define to 1 if rintf is declared even after undefining macros. */ | |||
skipping to change at line 1650 | skipping to change at line 1952 | |||
/* Define to 1 if roundl is declared even after undefining macros. */ | /* Define to 1 if roundl is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_ROUNDL 1 | #define HAVE_RAW_DECL_ROUNDL 1 | |||
/* Define to 1 if rpmatch is declared even after undefining macros. */ | /* Define to 1 if rpmatch is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_RPMATCH 1 | #define HAVE_RAW_DECL_RPMATCH 1 | |||
/* Define to 1 if scandir is declared even after undefining macros. */ | /* Define to 1 if scandir is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SCANDIR 1 | #define HAVE_RAW_DECL_SCANDIR 1 | |||
/* Define to 1 if secure_getenv is declared even after undefining macros. * | ||||
/ | ||||
/* #undef HAVE_RAW_DECL_SECURE_GETENV */ | ||||
/* Define to 1 if select is declared even after undefining macros. */ | /* Define to 1 if select is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SELECT 1 | #define HAVE_RAW_DECL_SELECT 1 | |||
/* Define to 1 if send is declared even after undefining macros. */ | /* Define to 1 if send is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SEND 1 | #define HAVE_RAW_DECL_SEND 1 | |||
/* Define to 1 if sendto is declared even after undefining macros. */ | /* Define to 1 if sendto is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SENDTO 1 | #define HAVE_RAW_DECL_SENDTO 1 | |||
/* Define to 1 if setenv is declared even after undefining macros. */ | /* Define to 1 if setenv is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SETENV 1 | #define HAVE_RAW_DECL_SETENV 1 | |||
/* Define to 1 if sethostname is declared even after undefining macros. */ | /* Define to 1 if sethostname is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SETHOSTNAME 1 | #define HAVE_RAW_DECL_SETHOSTNAME 1 | |||
/* Define to 1 if setsockopt is declared even after undefining macros. */ | /* Define to 1 if setsockopt is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SETSOCKOPT 1 | #define HAVE_RAW_DECL_SETSOCKOPT 1 | |||
/* Define to 1 if setstate is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_SETSTATE 1 | ||||
/* Define to 1 if setstate_r is declared even after undefining macros. */ | /* Define to 1 if setstate_r is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SETSTATE_R 1 | #define HAVE_RAW_DECL_SETSTATE_R 1 | |||
/* Define to 1 if setusershell is declared even after undefining macros. */ | /* Define to 1 if setusershell is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SETUSERSHELL 1 | #define HAVE_RAW_DECL_SETUSERSHELL 1 | |||
/* Define to 1 if shutdown is declared even after undefining macros. */ | /* Define to 1 if shutdown is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SHUTDOWN 1 | #define HAVE_RAW_DECL_SHUTDOWN 1 | |||
/* Define to 1 if sigaction is declared even after undefining macros. */ | /* Define to 1 if sigaction is declared even after undefining macros. */ | |||
skipping to change at line 1725 | skipping to change at line 2033 | |||
/* Define to 1 if socket is declared even after undefining macros. */ | /* Define to 1 if socket is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SOCKET 1 | #define HAVE_RAW_DECL_SOCKET 1 | |||
/* Define to 1 if sqrtf is declared even after undefining macros. */ | /* Define to 1 if sqrtf is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SQRTF 1 | #define HAVE_RAW_DECL_SQRTF 1 | |||
/* Define to 1 if sqrtl is declared even after undefining macros. */ | /* Define to 1 if sqrtl is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SQRTL 1 | #define HAVE_RAW_DECL_SQRTL 1 | |||
/* Define to 1 if srandom is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_SRANDOM 1 | ||||
/* Define to 1 if srandom_r is declared even after undefining macros. */ | /* Define to 1 if srandom_r is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_SRANDOM_R 1 | #define HAVE_RAW_DECL_SRANDOM_R 1 | |||
/* Define to 1 if stat is declared even after undefining macros. */ | /* Define to 1 if stat is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_STAT 1 | #define HAVE_RAW_DECL_STAT 1 | |||
/* Define to 1 if stpcpy is declared even after undefining macros. */ | /* Define to 1 if stpcpy is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_STPCPY 1 | #define HAVE_RAW_DECL_STPCPY 1 | |||
/* Define to 1 if stpncpy is declared even after undefining macros. */ | /* Define to 1 if stpncpy is declared even after undefining macros. */ | |||
skipping to change at line 1824 | skipping to change at line 2135 | |||
/* Define to 1 if truncf is declared even after undefining macros. */ | /* Define to 1 if truncf is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_TRUNCF 1 | #define HAVE_RAW_DECL_TRUNCF 1 | |||
/* Define to 1 if truncl is declared even after undefining macros. */ | /* Define to 1 if truncl is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_TRUNCL 1 | #define HAVE_RAW_DECL_TRUNCL 1 | |||
/* Define to 1 if ttyname_r is declared even after undefining macros. */ | /* Define to 1 if ttyname_r is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_TTYNAME_R 1 | #define HAVE_RAW_DECL_TTYNAME_R 1 | |||
/* Define to 1 if uname is declared even after undefining macros. */ | ||||
#define HAVE_RAW_DECL_UNAME 1 | ||||
/* Define to 1 if unlink is declared even after undefining macros. */ | /* Define to 1 if unlink is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_UNLINK 1 | #define HAVE_RAW_DECL_UNLINK 1 | |||
/* Define to 1 if unlinkat is declared even after undefining macros. */ | /* Define to 1 if unlinkat is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_UNLINKAT 1 | #define HAVE_RAW_DECL_UNLINKAT 1 | |||
/* Define to 1 if unlockpt is declared even after undefining macros. */ | /* Define to 1 if unlockpt is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL_UNLOCKPT 1 | #define HAVE_RAW_DECL_UNLOCKPT 1 | |||
/* Define to 1 if unsetenv is declared even after undefining macros. */ | /* Define to 1 if unsetenv is declared even after undefining macros. */ | |||
skipping to change at line 1962 | skipping to change at line 2276 | |||
/* Define to 1 if _Exit is declared even after undefining macros. */ | /* Define to 1 if _Exit is declared even after undefining macros. */ | |||
#define HAVE_RAW_DECL__EXIT 1 | #define HAVE_RAW_DECL__EXIT 1 | |||
/* Define to 1 if you have the `readdir' function. */ | /* Define to 1 if you have the `readdir' function. */ | |||
#define HAVE_READDIR 1 | #define HAVE_READDIR 1 | |||
/* Define to 1 if you have the `readlink' function. */ | /* Define to 1 if you have the `readlink' function. */ | |||
#define HAVE_READLINK 1 | #define HAVE_READLINK 1 | |||
/* Define to 1 if your system has a GNU libc compatible 'realloc' function, | ||||
and to 0 otherwise. */ | ||||
#define HAVE_REALLOC_GNU 1 | ||||
/* Define if the 'realloc' function is POSIX compliant. */ | /* Define if the 'realloc' function is POSIX compliant. */ | |||
#define HAVE_REALLOC_POSIX 1 | #define HAVE_REALLOC_POSIX 1 | |||
/* Define to 1 if you have the `realpath' function. */ | /* Define to 1 if you have the `realpath' function. */ | |||
#define HAVE_REALPATH 1 | #define HAVE_REALPATH 1 | |||
/* Define to 1 if you have the `resolvepath' function. */ | /* Define to 1 if you have the `resolvepath' function. */ | |||
/* #undef HAVE_RESOLVEPATH */ | /* #undef HAVE_RESOLVEPATH */ | |||
/* Define to 1 if you have the `rewinddir' function. */ | /* Define to 1 if you have the `rewinddir' function. */ | |||
#define HAVE_REWINDDIR 1 | #define HAVE_REWINDDIR 1 | |||
/* Define to 1 if you have the `rindex' function. */ | ||||
#define HAVE_RINDEX 1 | ||||
/* Define to 1 if you have the `round' function. */ | /* Define to 1 if you have the `round' function. */ | |||
#define HAVE_ROUND 1 | #define HAVE_ROUND 1 | |||
/* Define to 1 if you have the `roundl' function. */ | /* Define to 1 if you have the `roundl' function. */ | |||
#define HAVE_ROUNDL 1 | #define HAVE_ROUNDL 1 | |||
/* Define to 1 if 'long double' and 'double' have the same representation. */ | /* Define to 1 if 'long double' and 'double' have the same representation. */ | |||
/* #undef HAVE_SAME_LONG_DOUBLE_AS_DOUBLE */ | /* #undef HAVE_SAME_LONG_DOUBLE_AS_DOUBLE */ | |||
/* Define to 1 if the system has the type `sa_family_t'. */ | /* Define to 1 if the system has the type `sa_family_t'. */ | |||
skipping to change at line 1998 | skipping to change at line 2313 | |||
/* Define to 1 if you have the `sched_getaffinity' function. */ | /* Define to 1 if you have the `sched_getaffinity' function. */ | |||
#define HAVE_SCHED_GETAFFINITY 1 | #define HAVE_SCHED_GETAFFINITY 1 | |||
/* Define to 1 if sched_getaffinity has a glibc compatible declaration. */ | /* Define to 1 if sched_getaffinity has a glibc compatible declaration. */ | |||
#define HAVE_SCHED_GETAFFINITY_LIKE_GLIBC 1 | #define HAVE_SCHED_GETAFFINITY_LIKE_GLIBC 1 | |||
/* Define to 1 if you have the `sched_getaffinity_np' function. */ | /* Define to 1 if you have the `sched_getaffinity_np' function. */ | |||
/* #undef HAVE_SCHED_GETAFFINITY_NP */ | /* #undef HAVE_SCHED_GETAFFINITY_NP */ | |||
/* Define to 1 if you have the `secure_getenv' function. */ | ||||
/* #undef HAVE_SECURE_GETENV */ | ||||
/* Define to 1 if you have the `select' function. */ | /* Define to 1 if you have the `select' function. */ | |||
#define HAVE_SELECT 1 | #define HAVE_SELECT 1 | |||
/* Define to 1 if you have the `setdtablesize' function. */ | ||||
/* #undef HAVE_SETDTABLESIZE */ | ||||
/* Define to 1 if you have the `setgrent' function. */ | /* Define to 1 if you have the `setgrent' function. */ | |||
#define HAVE_SETGRENT 1 | #define HAVE_SETGRENT 1 | |||
/* Define to 1 if you have the `setlocale' function. */ | /* Define to 1 if you have the `setlocale' function. */ | |||
#define HAVE_SETLOCALE 1 | #define HAVE_SETLOCALE 1 | |||
/* Define to 1 if you have the Qt SetPlaceholderText function. */ | ||||
#define HAVE_SETPLACEHOLDERTEXT 1 | ||||
/* Define to 1 if you have the `setpwent' function. */ | /* Define to 1 if you have the `setpwent' function. */ | |||
#define HAVE_SETPWENT 1 | #define HAVE_SETPWENT 1 | |||
/* Define to 1 if you have the `setvbuf' function. */ | /* Define to 1 if you have the `setvbuf' function. */ | |||
#define HAVE_SETVBUF 1 | /* #undef HAVE_SETVBUF */ | |||
/* Define to 1 if you have the <sgtty.h> header file. */ | /* Define to 1 if you have the <sgtty.h> header file. */ | |||
#define HAVE_SGTTY_H 1 | #define HAVE_SGTTY_H 1 | |||
/* Define if your system has shl_load and shl_findsym for dynamic linking * | /* Define to 1 if your system has shl_load and shl_findsym for dynamic | |||
/ | linking. */ | |||
/* #undef HAVE_SHL_LOAD_API */ | /* #undef HAVE_SHL_LOAD_API */ | |||
/* Define to 1 if you have the `shutdown' function. */ | /* Define to 1 if you have the `shutdown' function. */ | |||
#define HAVE_SHUTDOWN 1 | #define HAVE_SHUTDOWN 1 | |||
/* Define to 1 if you have the `sigaction' function. */ | /* Define to 1 if you have the `sigaction' function. */ | |||
#define HAVE_SIGACTION 1 | #define HAVE_SIGACTION 1 | |||
/* Define to 1 if you have the `sigaltstack' function. */ | /* Define to 1 if you have the `sigaltstack' function. */ | |||
#define HAVE_SIGALTSTACK 1 | #define HAVE_SIGALTSTACK 1 | |||
skipping to change at line 2063 | skipping to change at line 2388 | |||
#define HAVE_SLEEP 1 | #define HAVE_SLEEP 1 | |||
/* Define to 1 if you have the `snprintf' function. */ | /* Define to 1 if you have the `snprintf' function. */ | |||
#define HAVE_SNPRINTF 1 | #define HAVE_SNPRINTF 1 | |||
/* Define if the return value of the snprintf function is the number of of | /* Define if the return value of the snprintf function is the number of of | |||
bytes (excluding the terminating NUL) that would have been produced if t he | bytes (excluding the terminating NUL) that would have been produced if t he | |||
buffer had been large enough. */ | buffer had been large enough. */ | |||
#define HAVE_SNPRINTF_RETVAL_C99 1 | #define HAVE_SNPRINTF_RETVAL_C99 1 | |||
/* Define to 1 if you have the `sqrt' function. */ | ||||
#define HAVE_SQRT 1 | ||||
/* Define to 1 if you have the `sqrtf' function. */ | ||||
#define HAVE_SQRTF 1 | ||||
/* Define to 1 if you have the <sstream> header file. */ | /* Define to 1 if you have the <sstream> header file. */ | |||
#define HAVE_SSTREAM 1 | #define HAVE_SSTREAM 1 | |||
/* Define to 1 if you have the <stdint.h> header file. */ | /* Define to 1 if you have the <stdint.h> header file. */ | |||
#define HAVE_STDINT_H 1 | #define HAVE_STDINT_H 1 | |||
/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and decla res | /* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and decla res | |||
uintmax_t. */ | uintmax_t. */ | |||
#define HAVE_STDINT_H_WITH_UINTMAX 1 | #define HAVE_STDINT_H_WITH_UINTMAX 1 | |||
skipping to change at line 2094 | skipping to change at line 2425 | |||
/* Define to 1 if you have the <strings.h> header file. */ | /* Define to 1 if you have the <strings.h> header file. */ | |||
#define HAVE_STRINGS_H 1 | #define HAVE_STRINGS_H 1 | |||
/* Define to 1 if you have the <string.h> header file. */ | /* Define to 1 if you have the <string.h> header file. */ | |||
#define HAVE_STRING_H 1 | #define HAVE_STRING_H 1 | |||
/* Define to 1 if you have the `strncasecmp' function. */ | /* Define to 1 if you have the `strncasecmp' function. */ | |||
#define HAVE_STRNCASECMP 1 | #define HAVE_STRNCASECMP 1 | |||
/* Define to 1 if you have the `strndup' function. */ | ||||
#define HAVE_STRNDUP 1 | ||||
/* Define to 1 if you have the `strnlen' function. */ | /* Define to 1 if you have the `strnlen' function. */ | |||
#define HAVE_STRNLEN 1 | #define HAVE_STRNLEN 1 | |||
/* Define to 1 if you have the `strptime' function. */ | /* Define to 1 if you have the `strptime' function. */ | |||
#define HAVE_STRPTIME 1 | #define HAVE_STRPTIME 1 | |||
/* Define to 1 if you have the `strsignal' function. */ | /* Define to 1 if you have the `strsignal' function. */ | |||
#define HAVE_STRSIGNAL 1 | #define HAVE_STRSIGNAL 1 | |||
/* Define if there is a member named d_type in the struct describing direct ory | /* Define if there is a member named d_type in the struct describing direct ory | |||
skipping to change at line 2134 | skipping to change at line 2468 | |||
/* Define to 1 if `st_rdev' is a member of `struct stat'. */ | /* Define to 1 if `st_rdev' is a member of `struct stat'. */ | |||
#define HAVE_STRUCT_STAT_ST_RDEV 1 | #define HAVE_STRUCT_STAT_ST_RDEV 1 | |||
/* Define to 1 if the system has the type `struct tms'. */ | /* Define to 1 if the system has the type `struct tms'. */ | |||
#define HAVE_STRUCT_TMS 1 | #define HAVE_STRUCT_TMS 1 | |||
/* Define to 1 if `tm_zone' is a member of `struct tm'. */ | /* Define to 1 if `tm_zone' is a member of `struct tm'. */ | |||
#define HAVE_STRUCT_TM_TM_ZONE 1 | #define HAVE_STRUCT_TM_TM_ZONE 1 | |||
/* Define to 1 if the system has the type `struct utsname'. */ | ||||
#define HAVE_STRUCT_UTSNAME 1 | ||||
/* Define if struct stat has an st_dm_mode member. */ | /* Define if struct stat has an st_dm_mode member. */ | |||
/* #undef HAVE_ST_DM_MODE */ | /* #undef HAVE_ST_DM_MODE */ | |||
/* Define to 1 if you have the <suitesparse/amd.h> header file. */ | /* Define to 1 if you have the <suitesparse/amd.h> header file. */ | |||
#define HAVE_SUITESPARSE_AMD_H 1 | #define HAVE_SUITESPARSE_AMD_H 1 | |||
/* Define to 1 if you have the <suitesparse/camd.h> header file. */ | /* Define to 1 if you have the <suitesparse/camd.h> header file. */ | |||
#define HAVE_SUITESPARSE_CAMD_H 1 | #define HAVE_SUITESPARSE_CAMD_H 1 | |||
/* Define to 1 if you have the <suitesparse/ccolamd.h> header file. */ | /* Define to 1 if you have the <suitesparse/ccolamd.h> header file. */ | |||
skipping to change at line 2269 | skipping to change at line 2606 | |||
/* Define to 1 if you have the `times' function. */ | /* Define to 1 if you have the `times' function. */ | |||
#define HAVE_TIMES 1 | #define HAVE_TIMES 1 | |||
/* Define if struct tm has the tm_gmtoff member. */ | /* Define if struct tm has the tm_gmtoff member. */ | |||
#define HAVE_TM_GMTOFF 1 | #define HAVE_TM_GMTOFF 1 | |||
/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use | /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use | |||
`HAVE_STRUCT_TM_TM_ZONE' instead. */ | `HAVE_STRUCT_TM_TM_ZONE' instead. */ | |||
#define HAVE_TM_ZONE 1 | #define HAVE_TM_ZONE 1 | |||
/* Define to 1 if you have the `toascii' function. */ | ||||
#define HAVE_TOASCII 1 | ||||
/* Define to 1 if you have the `towlower' function. */ | /* Define to 1 if you have the `towlower' function. */ | |||
#define HAVE_TOWLOWER 1 | #define HAVE_TOWLOWER 1 | |||
/* Define to 1 if you have the <tr1/unordered_map> header file. */ | /* Define to 1 if you have the <tr1/unordered_map> header file. */ | |||
#define HAVE_TR1_UNORDERED_MAP 1 | #define HAVE_TR1_UNORDERED_MAP 1 | |||
/* Define to 1 if you don't have `tm_zone' but do have the external array | /* Define to 1 if you don't have `tm_zone' but do have the external array | |||
`tzname'. */ | `tzname'. */ | |||
/* #undef HAVE_TZNAME */ | /* #undef HAVE_TZNAME */ | |||
skipping to change at line 2306 | skipping to change at line 2646 | |||
/* Define to 1 if you have the <ufsparse/cs.h> header file. */ | /* Define to 1 if you have the <ufsparse/cs.h> header file. */ | |||
/* #undef HAVE_UFSPARSE_CS_H */ | /* #undef HAVE_UFSPARSE_CS_H */ | |||
/* Define to 1 if you have the <ufsparse/umfpack.h> header file. */ | /* Define to 1 if you have the <ufsparse/umfpack.h> header file. */ | |||
/* #undef HAVE_UFSPARSE_UMFPACK_H */ | /* #undef HAVE_UFSPARSE_UMFPACK_H */ | |||
/* Define to 1 if you have the `umask' function. */ | /* Define to 1 if you have the `umask' function. */ | |||
#define HAVE_UMASK 1 | #define HAVE_UMASK 1 | |||
/* Define if UMFPACK is available. */ | /* Define to 1 if UMFPACK is available. */ | |||
/* #undef HAVE_UMFPACK */ | /* #undef HAVE_UMFPACK */ | |||
/* Define to 1 if you have the <umfpack.h> header file. */ | /* Define to 1 if you have the <umfpack.h> header file. */ | |||
/* #undef HAVE_UMFPACK_H */ | /* #undef HAVE_UMFPACK_H */ | |||
/* Define to 1 if you have the <umfpack/umfpack.h> header file. */ | /* Define to 1 if you have the <umfpack/umfpack.h> header file. */ | |||
/* #undef HAVE_UMFPACK_UMFPACK_H */ | /* #undef HAVE_UMFPACK_UMFPACK_H */ | |||
/* Define to 1 if you have the `uname' function. */ | /* Define to 1 if you have the `uname' function. */ | |||
#define HAVE_UNAME 1 | #define HAVE_UNAME 1 | |||
/* Define to 1 if you have the <unistd.h> header file. */ | /* Define to 1 if you have the <unistd.h> header file. */ | |||
#define HAVE_UNISTD_H 1 | #define HAVE_UNISTD_H 1 | |||
/* Define to 1 if you have the <unordered_map> header file. */ | /* Define to 1 if you have the <unordered_map> header file. */ | |||
/* #undef HAVE_UNORDERED_MAP */ | /* #undef HAVE_UNORDERED_MAP */ | |||
/* Define to 1 if the system has the type `unsigned long long int'. */ | /* Define to 1 if the system has the type 'unsigned long long int'. */ | |||
#define HAVE_UNSIGNED_LONG_LONG_INT 1 | #define HAVE_UNSIGNED_LONG_LONG_INT 1 | |||
/* Define to 1 if you have the `utime' function. */ | /* Define to 1 if you have the <util.h> header file. */ | |||
#define HAVE_UTIME 1 | /* #undef HAVE_UTIL_H */ | |||
/* Define to 1 if you have the `vasnprintf' function. */ | /* Define to 1 if you have the `vasnprintf' function. */ | |||
/* #undef HAVE_VASNPRINTF */ | /* #undef HAVE_VASNPRINTF */ | |||
/* Define to 1 if you have the `vasprintf' function. */ | /* Define to 1 if you have the `vasprintf' function. */ | |||
#define HAVE_VASPRINTF 1 | #define HAVE_VASPRINTF 1 | |||
/* Define to 1 if you have the `waitpid' function. */ | /* Define to 1 if you have the `waitpid' function. */ | |||
#define HAVE_WAITPID 1 | #define HAVE_WAITPID 1 | |||
skipping to change at line 2388 | skipping to change at line 2728 | |||
/* Define to 1 if O_NOATIME works. */ | /* Define to 1 if O_NOATIME works. */ | |||
#define HAVE_WORKING_O_NOATIME 1 | #define HAVE_WORKING_O_NOATIME 1 | |||
/* Define to 1 if O_NOFOLLOW works. */ | /* Define to 1 if O_NOFOLLOW works. */ | |||
#define HAVE_WORKING_O_NOFOLLOW 1 | #define HAVE_WORKING_O_NOFOLLOW 1 | |||
/* Define to 1 if you have the <ws2tcpip.h> header file. */ | /* Define to 1 if you have the <ws2tcpip.h> header file. */ | |||
/* #undef HAVE_WS2TCPIP_H */ | /* #undef HAVE_WS2TCPIP_H */ | |||
/* Define to 1 if you have the `x_utime' function. */ | /* Define to 1 if Xft is present. */ | |||
/* #undef HAVE_X_UTIME */ | #define HAVE_XFT 1 | |||
/* Define if you have X11 */ | /* Define to 1 if you have X11. */ | |||
#define HAVE_X_WINDOWS 1 | #define HAVE_X_WINDOWS 1 | |||
/* Define if ZLIB is available. */ | /* Define to 1 if ZLIB is available. */ | |||
#define HAVE_Z 1 | #define HAVE_Z 1 | |||
/* Define to 1 if ZLIB is available. */ | ||||
#define HAVE_ZLIB 1 | ||||
/* Define to 1 if you have the <zlib.h> header file. */ | /* Define to 1 if you have the <zlib.h> header file. */ | |||
#define HAVE_ZLIB_H 1 | #define HAVE_ZLIB_H 1 | |||
/* Define to 1 if the system has the type `_Bool'. */ | /* Define to 1 if the system has the type `_Bool'. */ | |||
#define HAVE__BOOL 1 | #define HAVE__BOOL 1 | |||
/* Define to 1 if you have the `_chmod' function. */ | ||||
/* #undef HAVE__CHMOD */ | ||||
/* Define to 1 if you have the `_finite' function. */ | /* Define to 1 if you have the `_finite' function. */ | |||
/* #undef HAVE__FINITE */ | /* #undef HAVE__FINITE */ | |||
/* Define to 1 if you have the `_fseeki64' function. */ | ||||
/* #undef HAVE__FSEEKI64 */ | ||||
/* Define to 1 if you have the `_ftelli64' function. */ | ||||
/* #undef HAVE__FTELLI64 */ | ||||
/* Define to 1 if you have the `_ftime' function. */ | /* Define to 1 if you have the `_ftime' function. */ | |||
/* #undef HAVE__FTIME */ | /* #undef HAVE__FTIME */ | |||
/* Define to 1 if you have the `_hypotf' function. */ | /* Define to 1 if you have the `_hypotf' function. */ | |||
/* #undef HAVE__HYPOTF */ | /* #undef HAVE__HYPOTF */ | |||
/* Define to 1 if you have the `_isnan' function. */ | /* Define to 1 if you have the `_isnan' function. */ | |||
/* #undef HAVE__ISNAN */ | /* #undef HAVE__ISNAN */ | |||
/* Define to 1 if you have the `_kbhit' function. */ | /* Define to 1 if you have the `_kbhit' function. */ | |||
/* #undef HAVE__KBHIT */ | /* #undef HAVE__KBHIT */ | |||
/* Define to 1 if you have the `_set_invalid_parameter_handler' function. * / | /* Define to 1 if you have the `_set_invalid_parameter_handler' function. * / | |||
/* #undef HAVE__SET_INVALID_PARAMETER_HANDLER */ | /* #undef HAVE__SET_INVALID_PARAMETER_HANDLER */ | |||
/* Define to 1 if you have the `_utime32' function. */ | ||||
/* #undef HAVE__UTIME32 */ | ||||
/* Define to 1 if you have the `__fpurge' function. */ | /* Define to 1 if you have the `__fpurge' function. */ | |||
#define HAVE___FPURGE 1 | #define HAVE___FPURGE 1 | |||
/* Define to 1 if you have the `__freading' function. */ | /* Define to 1 if you have the `__freading' function. */ | |||
#define HAVE___FREADING 1 | #define HAVE___FREADING 1 | |||
/* Define to 1 if you have the `__secure_getenv' function. */ | /* Define to 1 if you have the `__secure_getenv' function. */ | |||
#define HAVE___SECURE_GETENV 1 | #define HAVE___SECURE_GETENV 1 | |||
/* Define HOST_NAME_MAX when <limits.h> does not define it. */ | /* Define HOST_NAME_MAX when <limits.h> does not define it. */ | |||
/* #undef HOST_NAME_MAX */ | /* #undef HOST_NAME_MAX */ | |||
/* Define to 1 if octave index type is long */ | /* Java home (top-level installation dir) */ | |||
/* #undef IDX_TYPE_LONG */ | #define JAVA_HOME "/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0" | |||
/* Java library path (libjvm) */ | ||||
#define JAVA_LDPATH "/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386/c | ||||
lient" | ||||
/* Define as the bit index in the word where to find bit 0 of the exponent of | /* Define as the bit index in the word where to find bit 0 of the exponent of | |||
'long double'. */ | 'long double'. */ | |||
#define LDBL_EXPBIT0_BIT 0 | #define LDBL_EXPBIT0_BIT 0 | |||
/* Define as the word index where to find the exponent of 'long double'. */ | /* Define as the word index where to find the exponent of 'long double'. */ | |||
#define LDBL_EXPBIT0_WORD 2 | #define LDBL_EXPBIT0_WORD 2 | |||
/* Define as the bit index in the word where to find the sign of 'long | /* Define as the bit index in the word where to find the sign of 'long | |||
double'. */ | double'. */ | |||
skipping to change at line 2488 | skipping to change at line 2834 | |||
/* Define if the mbrtowc function does not return 0 for a NUL character. */ | /* Define if the mbrtowc function does not return 0 for a NUL character. */ | |||
/* #undef MBRTOWC_NUL_RETVAL_BUG */ | /* #undef MBRTOWC_NUL_RETVAL_BUG */ | |||
/* Define if the mbrtowc function returns a wrong return value. */ | /* Define if the mbrtowc function returns a wrong return value. */ | |||
/* #undef MBRTOWC_RETVAL_BUG */ | /* #undef MBRTOWC_RETVAL_BUG */ | |||
/* Define to 1 if mkfifo does not reject trailing slash */ | /* Define to 1 if mkfifo does not reject trailing slash */ | |||
/* #undef MKFIFO_TRAILING_SLASH_BUG */ | /* #undef MKFIFO_TRAILING_SLASH_BUG */ | |||
/* Define if the QHull library needs a qh_version variable defined. */ | /* Define to 1 if the Qhull library needs a qh_version variable defined. */ | |||
/* #undef NEED_QHULL_VERSION */ | /* #undef NEED_QHULL_VERSION */ | |||
/* Define if you want to avoid min/max macro definition in Windows headers | /* Define to 1 if you want to avoid min/max macro definition in Windows | |||
*/ | headers. */ | |||
/* #undef NOMINMAX */ | /* #undef NOMINMAX */ | |||
/* Define to the type of octave_idx_type (64 or 32 bit signed integer) */ | /* Define to the type of octave_idx_type (64 or 32 bit signed integer). */ | |||
#define OCTAVE_IDX_TYPE int | #define OCTAVE_IDX_TYPE int | |||
/* Define if this is Octave. */ | /* Define to 1 if this is Octave. */ | |||
#define OCTAVE_SOURCE 1 | #define OCTAVE_SOURCE 1 | |||
/* Define to 1 if open() fails to recognize a trailing slash. */ | /* Define to 1 if open() fails to recognize a trailing slash. */ | |||
/* #undef OPEN_TRAILING_SLASH_BUG */ | /* #undef OPEN_TRAILING_SLASH_BUG */ | |||
/* Name of package */ | /* Name of package */ | |||
#define PACKAGE "octave" | #define PACKAGE "octave" | |||
/* Define to the address where bug reports for this package should be sent. */ | /* Define to the address where bug reports for this package should be sent. */ | |||
#define PACKAGE_BUGREPORT "http://octave.org/bugs.html" | #define PACKAGE_BUGREPORT "http://octave.org/bugs.html" | |||
/* Define to the full name of this package. */ | /* Define to the full name of this package. */ | |||
#define PACKAGE_NAME "GNU Octave" | #define PACKAGE_NAME "GNU Octave" | |||
/* Define to the full name and version of this package. */ | /* Define to the full name and version of this package. */ | |||
#define PACKAGE_STRING "GNU Octave 3.6.4" | #define PACKAGE_STRING "GNU Octave 3.8.0" | |||
/* Define to the one symbol short name of this package. */ | /* Define to the one symbol short name of this package. */ | |||
#define PACKAGE_TARNAME "octave" | #define PACKAGE_TARNAME "octave" | |||
/* Define to the home page for this package. */ | /* Define to the home page for this package. */ | |||
#define PACKAGE_URL "http://www.gnu.org/software/octave/" | #define PACKAGE_URL "http://www.gnu.org/software/octave/" | |||
/* Define to the version of this package. */ | /* Define to the version of this package. */ | |||
#define PACKAGE_VERSION "3.6.4" | #define PACKAGE_VERSION "3.8.0" | |||
/* Define to the type that is the result of default argument promotions of | /* Define to the type that is the result of default argument promotions of | |||
type mode_t. */ | type mode_t. */ | |||
#define PROMOTED_MODE_T mode_t | #define PROMOTED_MODE_T mode_t | |||
/* Define to necessary symbol if this constant uses a non-standard name on | /* Define to necessary symbol if this constant uses a non-standard name on | |||
your system. */ | your system. */ | |||
/* #undef PTHREAD_CREATE_JOINABLE */ | /* #undef PTHREAD_CREATE_JOINABLE */ | |||
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | |||
skipping to change at line 2576 | skipping to change at line 2923 | |||
/* Define to 1 if open() should work around the inability to open a directo ry. | /* Define to 1 if open() should work around the inability to open a directo ry. | |||
*/ | */ | |||
/* #undef REPLACE_OPEN_DIRECTORY */ | /* #undef REPLACE_OPEN_DIRECTORY */ | |||
/* Define to 1 if strerror(0) does not return a message implying success. * / | /* Define to 1 if strerror(0) does not return a message implying success. * / | |||
/* #undef REPLACE_STRERROR_0 */ | /* #undef REPLACE_STRERROR_0 */ | |||
/* Define if vasnprintf exists but is overridden by gnulib. */ | /* Define if vasnprintf exists but is overridden by gnulib. */ | |||
/* #undef REPLACE_VASNPRINTF */ | /* #undef REPLACE_VASNPRINTF */ | |||
/* Define if your struct rusage only has time information. */ | /* Define to 1 if your struct rusage only has time information. */ | |||
/* #undef RUSAGE_TIMES_ONLY */ | /* #undef RUSAGE_TIMES_ONLY */ | |||
/* Define this to be the path separator for your system, as a character | /* Define this to be the path separator for your system, as a character | |||
constant. */ | constant. */ | |||
#define SEPCHAR ':' | #define SEPCHAR ':' | |||
/* Define this to the path separator, as a string. */ | /* Define this to be the path separator for your system, as a string. */ | |||
#define SEPCHAR_STR ":" | #define SEPCHAR_STR ":" | |||
/* Define this to be the path to the shell command interpreter. */ | ||||
#define SHELL_PATH "/bin/sh" | ||||
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | |||
'sig_atomic_t'. */ | 'sig_atomic_t'. */ | |||
/* #undef SIG_ATOMIC_T_SUFFIX */ | /* #undef SIG_ATOMIC_T_SUFFIX */ | |||
/* The size of `int', as computed by sizeof. */ | /* The size of `int', as computed by sizeof. */ | |||
#define SIZEOF_INT 4 | #define SIZEOF_INT 4 | |||
/* The size of `int64_t', as computed by sizeof. */ | ||||
/* #undef SIZEOF_INT64_T */ | ||||
/* The size of `long', as computed by sizeof. */ | /* The size of `long', as computed by sizeof. */ | |||
#define SIZEOF_LONG 4 | #define SIZEOF_LONG 4 | |||
/* The size of `long double', as computed by sizeof. */ | /* The size of `long double', as computed by sizeof. */ | |||
#define SIZEOF_LONG_DOUBLE 12 | #define SIZEOF_LONG_DOUBLE 12 | |||
/* The size of `long long', as computed by sizeof. */ | /* The size of `long long', as computed by sizeof. */ | |||
#define SIZEOF_LONG_LONG 8 | #define SIZEOF_LONG_LONG 8 | |||
/* The size of `short', as computed by sizeof. */ | /* The size of `short', as computed by sizeof. */ | |||
skipping to change at line 2618 | skipping to change at line 2971 | |||
/* Define as the maximum value of type 'size_t', if the system doesn't defi ne | /* Define as the maximum value of type 'size_t', if the system doesn't defi ne | |||
it. */ | it. */ | |||
#ifndef SIZE_MAX | #ifndef SIZE_MAX | |||
/* # undef SIZE_MAX */ | /* # undef SIZE_MAX */ | |||
#endif | #endif | |||
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | |||
'size_t'. */ | 'size_t'. */ | |||
/* #undef SIZE_T_SUFFIX */ | /* #undef SIZE_T_SUFFIX */ | |||
/* To quiet autoheader. */ | ||||
/* #undef SMART_PUTENV */ | ||||
/* If using the C implementation of alloca, define if you know the | /* If using the C implementation of alloca, define if you know the | |||
direction of stack growth for your system; otherwise it will be | direction of stack growth for your system; otherwise it will be | |||
automatically deduced at runtime. | automatically deduced at runtime. | |||
STACK_DIRECTION > 0 => grows toward higher addresses | STACK_DIRECTION > 0 => grows toward higher addresses | |||
STACK_DIRECTION < 0 => grows toward lower addresses | STACK_DIRECTION < 0 => grows toward lower addresses | |||
STACK_DIRECTION = 0 => direction of growth unknown */ | STACK_DIRECTION = 0 => direction of growth unknown */ | |||
/* #undef STACK_DIRECTION */ | /* #undef STACK_DIRECTION */ | |||
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ | /* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ | |||
/* #undef STAT_MACROS_BROKEN */ | /* #undef STAT_MACROS_BROKEN */ | |||
/* Define to 1 if you have the ANSI C header files. */ | /* Define to 1 if you have the ANSI C header files. */ | |||
#define STDC_HEADERS 1 | #define STDC_HEADERS 1 | |||
/* Define to 1 if strerror_r returns char *. */ | /* Define to 1 if strerror_r returns char *. */ | |||
#define STRERROR_R_CHAR_P 1 | #define STRERROR_R_CHAR_P 1 | |||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */ | /* Define to 1 if your <sys/time.h> declares `struct tm'. */ | |||
/* #undef TM_IN_SYS_TIME */ | /* #undef TM_IN_SYS_TIME */ | |||
/* Define if the UMFPACK Complex solver allow matrix and RHS to be split | /* Define to 1 if the UMFPACK Complex solver allows matrix and RHS to be sp | |||
independently */ | lit | |||
independently. */ | ||||
/* #undef UMFPACK_SEPARATE_SPLIT */ | /* #undef UMFPACK_SEPARATE_SPLIT */ | |||
/* Define to 1 if unlink() on a parent directory may succeed */ | /* Define to 1 if unlink() on a parent directory may succeed */ | |||
/* #undef UNLINK_PARENT_BUG */ | /* #undef UNLINK_PARENT_BUG */ | |||
/* Define if using 64-bit integers for array dimensions and indexing */ | /* Define to 1 if using 64-bit integers for array dimensions and indexing. */ | |||
/* #undef USE_64_BIT_IDX_T */ | /* #undef USE_64_BIT_IDX_T */ | |||
/* Define to use atomic operations for reference counting. */ | /* Define to 1 to use atomic operations for reference counting. */ | |||
/* #undef USE_ATOMIC_REFCOUNT */ | /* #undef USE_ATOMIC_REFCOUNT */ | |||
/* Define this if BLAS functions need to be wrapped (potentially needed for | /* Define to 1 if BLAS functions need to be wrapped (potentially needed for | |||
64-bit OSX only). */ | 64-bit OSX only). */ | |||
/* #undef USE_BLASWRAP */ | /* #undef USE_BLASWRAP */ | |||
/* Define to use octave_allocator class. */ | /* Define to 1 to use octave_allocator class. */ | |||
/* #undef USE_OCTAVE_ALLOCATOR */ | /* #undef USE_OCTAVE_ALLOCATOR */ | |||
/* Define to use the readline library. */ | /* Define to 1 to use the readline library. */ | |||
#define USE_READLINE 1 | #define USE_READLINE 1 | |||
/* Defines whether unordered_map requires the use of tr1 namespace. */ | /* Enable extensions on AIX 3, Interix. */ | |||
#ifndef _ALL_SOURCE | ||||
# define _ALL_SOURCE 1 | ||||
#endif | ||||
/* Enable general extensions on OS X. */ | ||||
#ifndef _DARWIN_C_SOURCE | ||||
# define _DARWIN_C_SOURCE 1 | ||||
#endif | ||||
/* Enable GNU extensions on systems that have them. */ | ||||
#ifndef _GNU_SOURCE | ||||
# define _GNU_SOURCE 1 | ||||
#endif | ||||
/* Enable threading extensions on Solaris. */ | ||||
#ifndef _POSIX_PTHREAD_SEMANTICS | ||||
# define _POSIX_PTHREAD_SEMANTICS 1 | ||||
#endif | ||||
/* Enable extensions on HP NonStop. */ | ||||
#ifndef _TANDEM_SOURCE | ||||
# define _TANDEM_SOURCE 1 | ||||
#endif | ||||
/* Enable X/Open extensions if necessary. HP-UX 11.11 defines | ||||
mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of | ||||
whether compiling with -Ae or -D_HPUX_SOURCE=1. */ | ||||
#ifndef _XOPEN_SOURCE | ||||
/* # undef _XOPEN_SOURCE */ | ||||
#endif | ||||
/* Enable general extensions on Solaris. */ | ||||
#ifndef __EXTENSIONS__ | ||||
# define __EXTENSIONS__ 1 | ||||
#endif | ||||
/* Define to 1 if unordered_map requires the use of tr1 namespace. */ | ||||
#define USE_UNORDERED_MAP_WITH_TR1 1 | #define USE_UNORDERED_MAP_WITH_TR1 1 | |||
/* Version number of package */ | /* Version number of package */ | |||
#define VERSION "3.6.4" | #define VERSION "3.8.0" | |||
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | |||
'wchar_t'. */ | 'wchar_t'. */ | |||
/* #undef WCHAR_T_SUFFIX */ | /* #undef WCHAR_T_SUFFIX */ | |||
/* Define if WSAStartup is needed. */ | /* Define if WSAStartup is needed. */ | |||
/* #undef WINDOWS_SOCKETS */ | /* #undef WINDOWS_SOCKETS */ | |||
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | |||
'wint_t'. */ | 'wint_t'. */ | |||
skipping to change at line 2701 | skipping to change at line 3082 | |||
#endif | #endif | |||
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a | /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a | |||
`char[]'. */ | `char[]'. */ | |||
#define YYTEXT_POINTER 1 | #define YYTEXT_POINTER 1 | |||
#if defined (__cplusplus) | #if defined (__cplusplus) | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#if HAVE_EXP2 && ! HAVE_DECL_EXP2 | #if HAVE_EXP2 && ! HAVE_DECL_EXP2 | |||
double exp2 (double ); | double exp2 (double); | |||
#endif | #endif | |||
#if HAVE_ROUND && ! HAVE_DECL_ROUND | #if HAVE_ROUND && ! HAVE_DECL_ROUND | |||
double round (double); | double round (double); | |||
#endif | #endif | |||
#if HAVE_TGAMMA && ! HAVE_DECL_TGAMMA | #if HAVE_TGAMMA && ! HAVE_DECL_TGAMMA | |||
double tgamma (double); | double tgamma (double); | |||
#endif | #endif | |||
#if defined (__cplusplus) | #if defined (__cplusplus) | |||
} | } | |||
#endif | #endif | |||
/* Enable large inode numbers on Mac OS X 10.5. */ | /* Enable large inode numbers on Mac OS X 10.5. */ | |||
#ifndef _DARWIN_USE_64_BIT_INODE | #define _DARWIN_USE_64_BIT_INODE 1 | |||
# define _DARWIN_USE_64_BIT_INODE 1 | ||||
#endif | ||||
/* Number of bits in a file offset, on hosts where this is settable. */ | /* Number of bits in a file offset, on hosts where this is settable. */ | |||
#define _FILE_OFFSET_BITS 64 | #define _FILE_OFFSET_BITS 64 | |||
/* Define if using HDF5 dll (Win32) */ | /* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct | |||
stat.st_size becomes 64-bit. */ | ||||
/* #undef _GL_WINDOWS_64_BIT_ST_SIZE */ | ||||
/* Define to 1 if using HDF5 dll (Win32). */ | ||||
/* #undef _HDF5USEDLL_ */ | /* #undef _HDF5USEDLL_ */ | |||
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ | /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ | |||
/* #undef _LARGEFILE_SOURCE */ | /* #undef _LARGEFILE_SOURCE */ | |||
/* Define for large files, on AIX-style hosts. */ | /* Define for large files, on AIX-style hosts. */ | |||
/* #undef _LARGE_FILES */ | /* #undef _LARGE_FILES */ | |||
/* Define to 1 if on MINIX. */ | /* Define to 1 if on MINIX. */ | |||
/* #undef _MINIX */ | /* #undef _MINIX */ | |||
/* Define to 1 to make NetBSD features available. MINIX 3 needs this. */ | ||||
/* #undef _NETBSD_SOURCE */ | ||||
/* The _Noreturn keyword of C11. */ | /* The _Noreturn keyword of C11. */ | |||
#ifndef _Noreturn | #if ! (defined _Noreturn \ | |||
|| (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) | ||||
# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ | # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ | |||
|| 0x5110 <= __SUNPRO_C) | || 0x5110 <= __SUNPRO_C) | |||
# define _Noreturn __attribute__ ((__noreturn__)) | # define _Noreturn __attribute__ ((__noreturn__)) | |||
# elif defined _MSC_VER && 1200 <= _MSC_VER | # elif defined _MSC_VER && 1200 <= _MSC_VER | |||
# define _Noreturn __declspec (noreturn) | # define _Noreturn __declspec (noreturn) | |||
# else | # else | |||
# define _Noreturn | # define _Noreturn | |||
# endif | # endif | |||
#endif | #endif | |||
skipping to change at line 2756 | skipping to change at line 3143 | |||
this defined. */ | this defined. */ | |||
/* #undef _POSIX_1_SOURCE */ | /* #undef _POSIX_1_SOURCE */ | |||
/* Define to 1 in order to get the POSIX compatible declarations of socket | /* Define to 1 in order to get the POSIX compatible declarations of socket | |||
functions. */ | functions. */ | |||
/* #undef _POSIX_PII_SOCKET */ | /* #undef _POSIX_PII_SOCKET */ | |||
/* Define to 1 if you need to in order for 'stat' and other things to work. */ | /* Define to 1 if you need to in order for 'stat' and other things to work. */ | |||
/* #undef _POSIX_SOURCE */ | /* #undef _POSIX_SOURCE */ | |||
/* Define if your system needs it to define math constants like M_LN2 */ | /* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>, | |||
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, | ||||
the | ||||
#define below would cause a syntax error. */ | ||||
/* #undef _UINT64_T */ | ||||
/* Define to 1 if _USE_MATH_DEFINES is required to get math constants like | ||||
M_LN2. */ | ||||
/* #undef _USE_MATH_DEFINES */ | /* #undef _USE_MATH_DEFINES */ | |||
/* Define to 0x0403 to access InitializeCriticalSectionAndSpinCount */ | /* Define to 0x0403 to access InitializeCriticalSectionAndSpinCount. */ | |||
/* #undef _WIN32_WINNT */ | /* #undef _WIN32_WINNT */ | |||
/* Define to 500 only on HP-UX. */ | ||||
/* #undef _XOPEN_SOURCE */ | ||||
/* Enable extensions on AIX 3, Interix. */ | ||||
#ifndef _ALL_SOURCE | ||||
# define _ALL_SOURCE 1 | ||||
#endif | ||||
/* Enable general extensions on MacOS X. */ | ||||
#ifndef _DARWIN_C_SOURCE | ||||
# define _DARWIN_C_SOURCE 1 | ||||
#endif | ||||
/* Enable GNU extensions on systems that have them. */ | ||||
#ifndef _GNU_SOURCE | ||||
# define _GNU_SOURCE 1 | ||||
#endif | ||||
/* Enable threading extensions on Solaris. */ | ||||
#ifndef _POSIX_PTHREAD_SEMANTICS | ||||
# define _POSIX_PTHREAD_SEMANTICS 1 | ||||
#endif | ||||
/* Enable extensions on HP NonStop. */ | ||||
#ifndef _TANDEM_SOURCE | ||||
# define _TANDEM_SOURCE 1 | ||||
#endif | ||||
/* Enable general extensions on Solaris. */ | ||||
#ifndef __EXTENSIONS__ | ||||
# define __EXTENSIONS__ 1 | ||||
#endif | ||||
/* Define to rpl_ if the getopt replacement functions and variables should be | /* Define to rpl_ if the getopt replacement functions and variables should be | |||
used. */ | used. */ | |||
#define __GETOPT_PREFIX rpl_ | #define __GETOPT_PREFIX rpl_ | |||
/* Define if your version of GNU libc has buggy inline assembly code for ma | /* Define to 1 if your version of GNU libc has buggy inline assembly code f | |||
th | or | |||
functions like exp. */ | math functions like exp. */ | |||
#define __NO_MATH_INLINES 1 | #define __NO_MATH_INLINES 1 | |||
/* Please see the Gnulib manual for how to use these macros. | ||||
Suppress extern inline with HP-UX cc, as it appears to be broken; see | ||||
<http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>. | ||||
Suppress extern inline with Sun C in standards-conformance mode, as it | ||||
mishandles inline functions that call each other. E.g., for 'inline voi | ||||
d f | ||||
(void) { } inline void g (void) { f (); }', c99 incorrectly complains | ||||
'reference to static identifier "f" in extern inline function'. | ||||
This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. | ||||
Suppress the use of extern inline on problematic Apple configurations, a | ||||
s | ||||
Libc at least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., | ||||
<http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. | ||||
Perhaps Apple will fix this some day. */ | ||||
#if (defined __APPLE__ \ | ||||
&& ((! defined _DONT_USE_CTYPE_INLINE_ \ | ||||
&& (defined __GNUC__ || defined __cplusplus)) \ | ||||
|| (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ | ||||
&& defined __GNUC__ && ! defined __cplusplus))) | ||||
# define _GL_EXTERN_INLINE_APPLE_BUG | ||||
#endif | ||||
#if ((__GNUC__ \ | ||||
? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ | ||||
: (199901L <= __STDC_VERSION__ \ | ||||
&& !defined __HP_cc \ | ||||
&& !(defined __SUNPRO_C && __STDC__))) \ | ||||
&& !defined _GL_EXTERN_INLINE_APPLE_BUG) | ||||
# define _GL_INLINE inline | ||||
# define _GL_EXTERN_INLINE extern inline | ||||
# define _GL_EXTERN_INLINE_IN_USE | ||||
#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ | ||||
&& !defined _GL_EXTERN_INLINE_APPLE_BUG) | ||||
# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ | ||||
/* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ | ||||
# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) | ||||
# else | ||||
# define _GL_INLINE extern inline | ||||
# endif | ||||
# define _GL_EXTERN_INLINE extern | ||||
# define _GL_EXTERN_INLINE_IN_USE | ||||
#else | ||||
# define _GL_INLINE static _GL_UNUSED | ||||
# define _GL_EXTERN_INLINE static _GL_UNUSED | ||||
#endif | ||||
#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) | ||||
# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ | ||||
# define _GL_INLINE_HEADER_CONST_PRAGMA | ||||
# else | ||||
# define _GL_INLINE_HEADER_CONST_PRAGMA \ | ||||
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") | ||||
# endif | ||||
/* Suppress GCC's bogus "no previous prototype for 'FOO'" | ||||
and "no previous declaration for 'FOO'" diagnostics, | ||||
when FOO is an inline function in the header; see | ||||
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */ | ||||
# define _GL_INLINE_HEADER_BEGIN \ | ||||
_Pragma ("GCC diagnostic push") \ | ||||
_Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ | ||||
_Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ | ||||
_GL_INLINE_HEADER_CONST_PRAGMA | ||||
# define _GL_INLINE_HEADER_END \ | ||||
_Pragma ("GCC diagnostic pop") | ||||
#else | ||||
# define _GL_INLINE_HEADER_BEGIN | ||||
# define _GL_INLINE_HEADER_END | ||||
#endif | ||||
/* Define to a replacement function name for fnmatch(). */ | /* Define to a replacement function name for fnmatch(). */ | |||
/* #undef fnmatch */ | /* #undef fnmatch */ | |||
/* Define to `int' if <sys/types.h> doesn't define. */ | /* Define to `int' if <sys/types.h> doesn't define. */ | |||
/* #undef gid_t */ | /* #undef gid_t */ | |||
/* Define to rpl_gmtime if the replacement function should be used. */ | /* Define to rpl_gmtime if the replacement function should be used. */ | |||
/* #undef gmtime */ | /* #undef gmtime */ | |||
/* Define to `__inline__' or `__inline' if that's what the C compiler | /* Define to `__inline__' or `__inline' if that's what the C compiler | |||
calls it, or to nothing if 'inline' is not supported under any name. */ | calls it, or to nothing if 'inline' is not supported under any name. */ | |||
#ifndef __cplusplus | #ifndef __cplusplus | |||
/* #undef inline */ | /* #undef inline */ | |||
#endif | #endif | |||
/* Define to the type of a signed integer type of width exactly 64 bits if | ||||
such a type exists and the standard includes do not define it. */ | ||||
/* #undef int64_t */ | ||||
/* Define to long or long long if <stdint.h> and <inttypes.h> don't define. */ | /* Define to long or long long if <stdint.h> and <inttypes.h> don't define. */ | |||
/* #undef intmax_t */ | /* #undef intmax_t */ | |||
/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it support s | /* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it support s | |||
the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of | the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of | |||
earlier versions), but does not display it by setting __GNUC_STDC_INLINE __. | earlier versions), but does not display it by setting __GNUC_STDC_INLINE __. | |||
__APPLE__ && __MACH__ test for MacOS X. | __APPLE__ && __MACH__ test for Mac OS X. | |||
__APPLE_CC__ tests for the Apple compiler and its version. | __APPLE_CC__ tests for the Apple compiler and its version. | |||
__STDC_VERSION__ tests for the C99 mode. */ | __STDC_VERSION__ tests for the C99 mode. */ | |||
#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defin ed __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLIN E__ | #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defin ed __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLIN E__ | |||
# define __GNUC_STDC_INLINE__ 1 | # define __GNUC_STDC_INLINE__ 1 | |||
#endif | #endif | |||
/* Define to rpl_localtime if the replacement function should be used. */ | /* Define to rpl_localtime if the replacement function should be used. */ | |||
/* #undef localtime */ | /* #undef localtime */ | |||
/* Define to a type if <wchar.h> does not define. */ | /* Define to a type if <wchar.h> does not define. */ | |||
skipping to change at line 2877 | skipping to change at line 3315 | |||
/* type to use in place of socklen_t if not defined */ | /* type to use in place of socklen_t if not defined */ | |||
/* #undef socklen_t */ | /* #undef socklen_t */ | |||
/* Define as a signed type of the same size as size_t. */ | /* Define as a signed type of the same size as size_t. */ | |||
/* #undef ssize_t */ | /* #undef ssize_t */ | |||
/* Define to `int' if <sys/types.h> doesn't define. */ | /* Define to `int' if <sys/types.h> doesn't define. */ | |||
/* #undef uid_t */ | /* #undef uid_t */ | |||
/* Define to the type of an unsigned integer type of width exactly 64 bits | ||||
if | ||||
such a type exists and the standard includes do not define it. */ | ||||
/* #undef uint64_t */ | ||||
/* Define as a marker that can be attached to declarations that might not | /* Define as a marker that can be attached to declarations that might not | |||
be used. This helps to reduce warnings, such as from | be used. This helps to reduce warnings, such as from | |||
GCC -Wunused-parameter. */ | GCC -Wunused-parameter. */ | |||
#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) | #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) | |||
# define _GL_UNUSED __attribute__ ((__unused__)) | # define _GL_UNUSED __attribute__ ((__unused__)) | |||
#else | #else | |||
# define _GL_UNUSED | # define _GL_UNUSED | |||
#endif | #endif | |||
/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name | /* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name | |||
is a misnomer outside of parameter lists. */ | is a misnomer outside of parameter lists. */ | |||
skipping to change at line 2903 | skipping to change at line 3345 | |||
# define _GL_ATTRIBUTE_PURE /* empty */ | # define _GL_ATTRIBUTE_PURE /* empty */ | |||
#endif | #endif | |||
/* The __const__ attribute was added in gcc 2.95. */ | /* The __const__ attribute was added in gcc 2.95. */ | |||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | |||
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) | # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) | |||
#else | #else | |||
# define _GL_ATTRIBUTE_CONST /* empty */ | # define _GL_ATTRIBUTE_CONST /* empty */ | |||
#endif | #endif | |||
#if !defined (GNULIB_NAMESPACE) | #include "oct-conf-post.h" | |||
#define GNULIB_NAMESPACE gnulib | ||||
#endif | ||||
#if defined (__GNUC__) | ||||
#define GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__)) | ||||
#define GCC_ATTR_NORETURN __attribute__ ((__noreturn__)) | ||||
#define GCC_ATTR_UNUSED __attribute__ ((__unused__)) | ||||
#else | ||||
#define GCC_ATTR_DEPRECATED | ||||
#define GCC_ATTR_NORETURN | ||||
#define GCC_ATTR_UNUSED | ||||
#endif | ||||
#define X_CAST(T, E) (T) (E) | ||||
#if defined (CXX_BROKEN_REINTERPRET_CAST) | ||||
#define FCN_PTR_CAST(T, E) (T) (E) | ||||
#else | ||||
#define FCN_PTR_CAST(T, E) reinterpret_cast<T> (E) | ||||
#endif | ||||
#if !defined(HAVE_DEV_T) | ||||
typedef short dev_t; | ||||
#endif | ||||
#if !defined(HAVE_INO_T) | ||||
typedef unsigned long ino_t; | ||||
#endif | ||||
#if defined (_MSC_VER) | ||||
#define __WIN32__ | ||||
#define WIN32 | ||||
/* missing parameters in macros */ | ||||
#pragma warning (disable: 4003) | ||||
/* missing implementations in template instantiation */ | ||||
#pragma warning (disable: 4996) | ||||
/* deprecated function names (FIXME?) */ | ||||
#pragma warning (disable: 4661) | ||||
#endif | ||||
#if defined (__WIN32__) && ! defined (__CYGWIN__) | ||||
#define OCTAVE_HAVE_WINDOWS_FILESYSTEM 1 | ||||
#elif defined (__CYGWIN__) | ||||
#define OCTAVE_HAVE_WINDOWS_FILESYSTEM 1 | ||||
#define OCTAVE_HAVE_POSIX_FILESYSTEM 1 | ||||
#else | ||||
#define OCTAVE_HAVE_POSIX_FILESYSTEM 1 | ||||
#endif | ||||
/* Define if we expect to have <windows.h>, Sleep, etc. */ | ||||
#if defined (__WIN32__) && ! defined (__CYGWIN__) | ||||
#define OCTAVE_USE_WINDOWS_API 1 | ||||
#endif | ||||
#if defined (__APPLE__) && defined (__MACH__) | ||||
#define OCTAVE_USE_OS_X_API 1 | ||||
#endif | ||||
/* sigsetjmp is a macro, not a function. */ | ||||
#if defined (sigsetjmp) && defined (HAVE_SIGLONGJMP) | ||||
#define OCTAVE_HAVE_SIG_JUMP | ||||
#endif | ||||
#if defined (_UNICOS) | ||||
#define F77_USES_CRAY_CALLING_CONVENTION | ||||
#endif | ||||
#if 0 | ||||
#define F77_USES_VISUAL_FORTRAN_CALLING_CONVENTION | ||||
#endif | ||||
#ifdef USE_64_BIT_IDX_T | ||||
#define SIZEOF_OCTAVE_IDX_TYPE 8 | ||||
#else | ||||
#define SIZEOF_OCTAVE_IDX_TYPE SIZEOF_INT | ||||
#endif | ||||
/* To be able to use long doubles for 64-bit mixed arithmetics, we need | ||||
them at least 80 bits wide and we need roundl declared in math.h. | ||||
FIXME -- maybe substitute this by a more precise check in the future. * | ||||
/ | ||||
#if (SIZEOF_LONG_DOUBLE >= 10) && defined (HAVE_ROUNDL) | ||||
#define OCTAVE_INT_USE_LONG_DOUBLE | ||||
#endif | ||||
#define OCTAVE_EMPTY_CPP_ARG | ||||
/* Octave is currently unable to use FFTW unless both float | ||||
and double versions are both available. */ | ||||
#if defined (HAVE_FFTW3) && defined (HAVE_FFTW3F) | ||||
#define HAVE_FFTW | ||||
#endif | ||||
/* Backward compatibility. */ | ||||
#if defined (HAVE_Z) | ||||
#define HAVE_ZLIB | ||||
#endif | ||||
/* oct-dlldefs.h */ | ||||
#if defined (_MSC_VER) | ||||
#define OCTAVE_EXPORT __declspec(dllexport) | ||||
#define OCTAVE_IMPORT __declspec(dllimport) | ||||
#else | ||||
/* All other compilers, at least for now. */ | ||||
#define OCTAVE_EXPORT | ||||
#define OCTAVE_IMPORT | ||||
#endif | ||||
/* API macro for libcruft */ | ||||
#ifdef CRUFT_DLL | ||||
#define CRUFT_API OCTAVE_EXPORT | ||||
#else | ||||
#define CRUFT_API OCTAVE_IMPORT | ||||
#endif | ||||
/* API macro for liboctave */ | ||||
#ifdef OCTAVE_DLL | ||||
#define OCTAVE_API OCTAVE_EXPORT | ||||
#else | ||||
#define OCTAVE_API OCTAVE_IMPORT | ||||
#endif | ||||
/* API macro for src */ | ||||
#ifdef OCTINTERP_DLL | ||||
#define OCTINTERP_API OCTAVE_EXPORT | ||||
#else | ||||
#define OCTINTERP_API OCTAVE_IMPORT | ||||
#endif | ||||
/* API macro for src/graphics */ | ||||
#ifdef OCTGRAPHICS_DLL | ||||
#define OCTGRAPHICS_API OCTAVE_EXPORT | ||||
#else | ||||
#define OCTGRAPHICS_API OCTAVE_IMPORT | ||||
#endif | ||||
/* oct-types.h */ | ||||
typedef OCTAVE_IDX_TYPE octave_idx_type; | ||||
#include <stdint.h> | ||||
/* Tag indicating octave config.h has been included */ | ||||
#define OCTAVE_CONFIG_INCLUDED 1 | ||||
End of changes. 166 change blocks. | ||||
163 lines changed or deleted | 619 lines changed or added | |||
cutils.h | cutils.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2012 John W. Eaton | Copyright (C) 2012-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
dColVector.h | dColVector.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ColumnVector_h) | #if !defined (octave_dColVector_h) | |||
#define octave_ColumnVector_h 1 | #define octave_dColVector_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
ColumnVector : public MArray<double> | ColumnVector : public MArray<double> | |||
{ | { | |||
public: | public: | |||
skipping to change at line 54 | skipping to change at line 54 | |||
ColumnVector (octave_idx_type n, double val) | ColumnVector (octave_idx_type n, double val) | |||
: MArray<double> (dim_vector (n, 1), val) { } | : MArray<double> (dim_vector (n, 1), val) { } | |||
ColumnVector (const ColumnVector& a) : MArray<double> (a) { } | ColumnVector (const ColumnVector& a) : MArray<double> (a) { } | |||
ColumnVector (const MArray<double>& a) : MArray<double> (a.as_column ()) { } | ColumnVector (const MArray<double>& a) : MArray<double> (a.as_column ()) { } | |||
ColumnVector (const Array<double>& a) : MArray<double> (a.as_column ()) { } | ColumnVector (const Array<double>& a) : MArray<double> (a.as_column ()) { } | |||
ColumnVector& operator = (const ColumnVector& a) | ColumnVector& operator = (const ColumnVector& a) | |||
{ | { | |||
MArray<double>::operator = (a); | MArray<double>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const ColumnVector& a) const; | bool operator == (const ColumnVector& a) const; | |||
bool operator != (const ColumnVector& a) const; | bool operator != (const ColumnVector& a) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
ColumnVector& insert (const ColumnVector& a, octave_idx_type r); | ColumnVector& insert (const ColumnVector& a, octave_idx_type r); | |||
ColumnVector& fill (double val); | ColumnVector& fill (double val); | |||
ColumnVector& fill (double val, octave_idx_type r1, octave_idx_type r2); | ColumnVector& fill (double val, octave_idx_type r1, octave_idx_type r2); | |||
skipping to change at line 84 | skipping to change at line 84 | |||
friend OCTAVE_API ColumnVector imag (const ComplexColumnVector& a); | friend OCTAVE_API ColumnVector imag (const ComplexColumnVector& a); | |||
// resize is the destructive equivalent for this one | // resize is the destructive equivalent for this one | |||
ColumnVector extract (octave_idx_type r1, octave_idx_type r2) const; | ColumnVector extract (octave_idx_type r1, octave_idx_type r2) const; | |||
ColumnVector extract_n (octave_idx_type r1, octave_idx_type n) const; | ColumnVector extract_n (octave_idx_type r1, octave_idx_type n) const; | |||
// matrix by column vector -> column vector operations | // matrix by column vector -> column vector operations | |||
friend OCTAVE_API ColumnVector operator * (const Matrix& a, const ColumnV | friend OCTAVE_API ColumnVector operator * (const Matrix& a, | |||
ector& b); | const ColumnVector& b); | |||
// diagonal matrix by column vector -> column vector operations | // diagonal matrix by column vector -> column vector operations | |||
friend OCTAVE_API ColumnVector operator * (const DiagMatrix& a, const Col | friend OCTAVE_API ColumnVector operator * (const DiagMatrix& a, | |||
umnVector& b); | const ColumnVector& b); | |||
// other operations | // other operations | |||
double min (void) const; | double min (void) const; | |||
double max (void) const; | double max (void) const; | |||
ColumnVector abs (void) const; | ColumnVector abs (void) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Colu | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
mnVector& a); | const ColumnVector& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, ColumnVect | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
or& a); | ColumnVector& a); | |||
void resize (octave_idx_type n, | void resize (octave_idx_type n, const double& rfv = 0) | |||
const double& rfv = Array<double>::resize_fill_value ()) | ||||
{ | { | |||
Array<double>::resize (dim_vector (n, 1), rfv); | Array<double>::resize (dim_vector (n, 1), rfv); | |||
} | } | |||
void clear (octave_idx_type n) | void clear (octave_idx_type n) | |||
{ Array<double>::clear (n, 1); } | { Array<double>::clear (n, 1); } | |||
}; | }; | |||
// Publish externally used friend functions. | // Publish externally used friend functions. | |||
extern OCTAVE_API ColumnVector real (const ComplexColumnVector& a); | extern OCTAVE_API ColumnVector real (const ComplexColumnVector& a); | |||
extern OCTAVE_API ColumnVector imag (const ComplexColumnVector& a); | extern OCTAVE_API ColumnVector imag (const ComplexColumnVector& a); | |||
MARRAY_FORWARD_DEFS (MArray, ColumnVector, double) | MARRAY_FORWARD_DEFS (MArray, ColumnVector, double) | |||
End of changes. 8 change blocks. | ||||
18 lines changed or deleted | 17 lines changed or added | |||
dDiagMatrix.h | dDiagMatrix.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_DiagMatrix_h) | #if !defined (octave_dDiagMatrix_h) | |||
#define octave_DiagMatrix_h 1 | #define octave_dDiagMatrix_h 1 | |||
#include "MDiagArray2.h" | #include "MDiagArray2.h" | |||
#include "dRowVector.h" | #include "dRowVector.h" | |||
#include "dColVector.h" | #include "dColVector.h" | |||
#include "DET.h" | #include "DET.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
DiagMatrix : public MDiagArray2<double> | DiagMatrix : public MDiagArray2<double> | |||
{ | { | |||
friend class SVD; | friend class SVD; | |||
friend class ComplexSVD; | friend class ComplexSVD; | |||
public: | public: | |||
DiagMatrix (void) : MDiagArray2<double> () { } | DiagMatrix (void) : MDiagArray2<double> () { } | |||
DiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<double> ( | DiagMatrix (octave_idx_type r, octave_idx_type c) | |||
r, c) { } | : MDiagArray2<double> (r, c) { } | |||
DiagMatrix (octave_idx_type r, octave_idx_type c, double val) : MDiagArra | DiagMatrix (octave_idx_type r, octave_idx_type c, double val) | |||
y2<double> (r, c, val) { } | : MDiagArray2<double> (r, c, val) { } | |||
DiagMatrix (const DiagMatrix& a) : MDiagArray2<double> (a) { } | DiagMatrix (const DiagMatrix& a) : MDiagArray2<double> (a) { } | |||
DiagMatrix (const MDiagArray2<double>& a) : MDiagArray2<double> (a) { } | DiagMatrix (const MDiagArray2<double>& a) : MDiagArray2<double> (a) { } | |||
template <class U> | template <class U> | |||
DiagMatrix (const DiagArray2<U>& a) : MDiagArray2<double> (a) { } | DiagMatrix (const DiagArray2<U>& a) : MDiagArray2<double> (a) { } | |||
explicit DiagMatrix (const Array<double>& a) : MDiagArray2<double> (a) { } | explicit DiagMatrix (const Array<double>& a) : MDiagArray2<double> (a) { } | |||
DiagMatrix (const Array<double>& a, octave_idx_type r, octave_idx_type c) | DiagMatrix (const Array<double>& a, octave_idx_type r, octave_idx_type c) | |||
: MDiagArray2<double> (a, r, c) { } | : MDiagArray2<double> (a, r, c) { } | |||
DiagMatrix& operator = (const DiagMatrix& a) | DiagMatrix& operator = (const DiagMatrix& a) | |||
{ | { | |||
MDiagArray2<double>::operator = (a); | MDiagArray2<double>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const DiagMatrix& a) const; | bool operator == (const DiagMatrix& a) const; | |||
bool operator != (const DiagMatrix& a) const; | bool operator != (const DiagMatrix& a) const; | |||
DiagMatrix& fill (double val); | DiagMatrix& fill (double val); | |||
DiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end); | DiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end); | |||
DiagMatrix& fill (const ColumnVector& a); | DiagMatrix& fill (const ColumnVector& a); | |||
DiagMatrix& fill (const RowVector& a); | DiagMatrix& fill (const RowVector& a); | |||
DiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); | DiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); | |||
DiagMatrix& fill (const RowVector& a, octave_idx_type beg); | DiagMatrix& fill (const RowVector& a, octave_idx_type beg); | |||
DiagMatrix transpose (void) const { return MDiagArray2<double>::transpose | DiagMatrix transpose (void) const | |||
(); } | { return MDiagArray2<double>::transpose (); } | |||
DiagMatrix abs (void) const; | DiagMatrix abs (void) const; | |||
friend OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a); | friend OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a); | |||
friend OCTAVE_API DiagMatrix imag (const ComplexDiagMatrix& a); | friend OCTAVE_API DiagMatrix imag (const ComplexDiagMatrix& a); | |||
// resize is the destructive analog for this one | // resize is the destructive analog for this one | |||
Matrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r | Matrix extract (octave_idx_type r1, octave_idx_type c1, | |||
2, octave_idx_type c2) const; | octave_idx_type r2, octave_idx_type c2) const; | |||
// extract row or column i. | // extract row or column i. | |||
RowVector row (octave_idx_type i) const; | RowVector row (octave_idx_type i) const; | |||
RowVector row (char *s) const; | RowVector row (char *s) const; | |||
ColumnVector column (octave_idx_type i) const; | ColumnVector column (octave_idx_type i) const; | |||
ColumnVector column (char *s) const; | ColumnVector column (char *s) const; | |||
DiagMatrix inverse (void) const; | DiagMatrix inverse (void) const; | |||
DiagMatrix inverse (octave_idx_type& info) const; | DiagMatrix inverse (octave_idx_type& info) const; | |||
DiagMatrix pseudo_inverse (void) const; | DiagMatrix pseudo_inverse (void) const; | |||
// other operations | // other operations | |||
ColumnVector diag (octave_idx_type k = 0) const | ColumnVector extract_diag (octave_idx_type k = 0) const | |||
{ return MDiagArray2<double>::diag (k); } | { return MDiagArray2<double>::extract_diag (k); } | |||
DET determinant (void) const; | DET determinant (void) const; | |||
double rcond (void) const; | double rcond (void) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Diag | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
Matrix& a); | const DiagMatrix& a); | |||
}; | }; | |||
OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a); | OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a); | |||
OCTAVE_API DiagMatrix imag (const ComplexDiagMatrix& a); | OCTAVE_API DiagMatrix imag (const ComplexDiagMatrix& a); | |||
// diagonal matrix by diagonal matrix -> diagonal matrix operations | // diagonal matrix by diagonal matrix -> diagonal matrix operations | |||
OCTAVE_API DiagMatrix | OCTAVE_API DiagMatrix | |||
operator * (const DiagMatrix& a, const DiagMatrix& b); | operator * (const DiagMatrix& a, const DiagMatrix& b); | |||
End of changes. 10 change blocks. | ||||
21 lines changed or deleted | 21 lines changed or added | |||
dMatrix.h | dMatrix.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_Matrix_int_h) | #if !defined (octave_dMatrix_h) | |||
#define octave_Matrix_int_h 1 | #define octave_dMatrix_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "MDiagArray2.h" | #include "MDiagArray2.h" | |||
#include "MatrixType.h" | #include "MatrixType.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
#include "mx-op-decl.h" | #include "mx-op-decl.h" | |||
#include "DET.h" | #include "DET.h" | |||
class | class | |||
skipping to change at line 79 | skipping to change at line 79 | |||
explicit Matrix (const DiagMatrix& a); | explicit Matrix (const DiagMatrix& a); | |||
explicit Matrix (const PermMatrix& a); | explicit Matrix (const PermMatrix& a); | |||
explicit Matrix (const boolMatrix& a); | explicit Matrix (const boolMatrix& a); | |||
explicit Matrix (const charMatrix& a); | explicit Matrix (const charMatrix& a); | |||
Matrix& operator = (const Matrix& a) | Matrix& operator = (const Matrix& a) | |||
{ | { | |||
MArray<double>::operator = (a); | MArray<double>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const Matrix& a) const; | bool operator == (const Matrix& a) const; | |||
bool operator != (const Matrix& a) const; | bool operator != (const Matrix& a) const; | |||
bool is_symmetric (void) const; | bool is_symmetric (void) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
Matrix& insert (const Matrix& a, octave_idx_type r, octave_idx_type c); | Matrix& insert (const Matrix& a, octave_idx_type r, octave_idx_type c); | |||
Matrix& insert (const RowVector& a, octave_idx_type r, octave_idx_type c) ; | Matrix& insert (const RowVector& a, octave_idx_type r, octave_idx_type c) ; | |||
Matrix& insert (const ColumnVector& a, octave_idx_type r, octave_idx_type c); | Matrix& insert (const ColumnVector& a, octave_idx_type r, octave_idx_type c); | |||
Matrix& insert (const DiagMatrix& a, octave_idx_type r, octave_idx_type c ); | Matrix& insert (const DiagMatrix& a, octave_idx_type r, octave_idx_type c ); | |||
Matrix& fill (double val); | Matrix& fill (double val); | |||
Matrix& fill (double val, octave_idx_type r1, octave_idx_type c1, octave_ | Matrix& fill (double val, octave_idx_type r1, octave_idx_type c1, | |||
idx_type r2, octave_idx_type c2); | octave_idx_type r2, octave_idx_type c2); | |||
Matrix append (const Matrix& a) const; | Matrix append (const Matrix& a) const; | |||
Matrix append (const RowVector& a) const; | Matrix append (const RowVector& a) const; | |||
Matrix append (const ColumnVector& a) const; | Matrix append (const ColumnVector& a) const; | |||
Matrix append (const DiagMatrix& a) const; | Matrix append (const DiagMatrix& a) const; | |||
Matrix stack (const Matrix& a) const; | Matrix stack (const Matrix& a) const; | |||
Matrix stack (const RowVector& a) const; | Matrix stack (const RowVector& a) const; | |||
Matrix stack (const ColumnVector& a) const; | Matrix stack (const ColumnVector& a) const; | |||
Matrix stack (const DiagMatrix& a) const; | Matrix stack (const DiagMatrix& a) const; | |||
friend OCTAVE_API Matrix real (const ComplexMatrix& a); | friend OCTAVE_API Matrix real (const ComplexMatrix& a); | |||
friend OCTAVE_API Matrix imag (const ComplexMatrix& a); | friend OCTAVE_API Matrix imag (const ComplexMatrix& a); | |||
friend class ComplexMatrix; | friend class ComplexMatrix; | |||
Matrix transpose (void) const { return MArray<double>::transpose (); } | Matrix transpose (void) const { return MArray<double>::transpose (); } | |||
// resize is the destructive equivalent for this one | // resize is the destructive equivalent for this one | |||
Matrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r | Matrix extract (octave_idx_type r1, octave_idx_type c1, | |||
2, octave_idx_type c2) const; | octave_idx_type r2, octave_idx_type c2) const; | |||
Matrix extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type | Matrix extract_n (octave_idx_type r1, octave_idx_type c1, | |||
nr, octave_idx_type nc) const; | octave_idx_type nr, octave_idx_type nc) const; | |||
// extract row or column i. | // extract row or column i. | |||
RowVector row (octave_idx_type i) const; | RowVector row (octave_idx_type i) const; | |||
ColumnVector column (octave_idx_type i) const; | ColumnVector column (octave_idx_type i) const; | |||
void resize (octave_idx_type nr, octave_idx_type nc, | void resize (octave_idx_type nr, octave_idx_type nc, double rfv = 0) | |||
double rfv = resize_fill_value ()) | ||||
{ | { | |||
MArray<double>::resize (dim_vector (nr, nc), rfv); | MArray<double>::resize (dim_vector (nr, nc), rfv); | |||
} | } | |||
private: | private: | |||
Matrix tinverse (MatrixType &mattype, octave_idx_type& info, double& rcon , | Matrix tinverse (MatrixType &mattype, octave_idx_type& info, double& rcon , | |||
int force, int calc_cond) const; | int force, int calc_cond) const; | |||
Matrix finverse (MatrixType &mattype, octave_idx_type& info, double& rcon , | Matrix finverse (MatrixType &mattype, octave_idx_type& info, double& rcon , | |||
int force, int calc_cond) const; | int force, int calc_cond) const; | |||
skipping to change at line 162 | skipping to change at line 164 | |||
Matrix pseudo_inverse (double tol = 0.0) const; | Matrix pseudo_inverse (double tol = 0.0) const; | |||
ComplexMatrix fourier (void) const; | ComplexMatrix fourier (void) const; | |||
ComplexMatrix ifourier (void) const; | ComplexMatrix ifourier (void) const; | |||
ComplexMatrix fourier2d (void) const; | ComplexMatrix fourier2d (void) const; | |||
ComplexMatrix ifourier2d (void) const; | ComplexMatrix ifourier2d (void) const; | |||
DET determinant (void) const; | DET determinant (void) const; | |||
DET determinant (octave_idx_type& info) const; | DET determinant (octave_idx_type& info) const; | |||
DET determinant (octave_idx_type& info, double& rcon, int calc_cond = 1) | DET determinant (octave_idx_type& info, double& rcon, | |||
const; | int calc_cond = 1) const; | |||
DET determinant (MatrixType &mattype, octave_idx_type& info, | DET determinant (MatrixType &mattype, octave_idx_type& info, | |||
double& rcon, int calc_cond = 1) const; | double& rcon, int calc_cond = 1) const; | |||
double rcond (void) const; | double rcond (void) const; | |||
double rcond (MatrixType &mattype) const; | double rcond (MatrixType &mattype) const; | |||
private: | private: | |||
// Upper triangular matrix solvers | // Upper triangular matrix solvers | |||
Matrix utsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix utsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcon, solve_singularity_handler sing_handler, | double& rcon, solve_singularity_handler sing_handler, | |||
bool calc_cond = false, blas_trans_type transt = blas_no_ | bool calc_cond = false, | |||
trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
// Lower triangular matrix solvers | // Lower triangular matrix solvers | |||
Matrix ltsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix ltsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcon, solve_singularity_handler sing_handler, | double& rcon, solve_singularity_handler sing_handler, | |||
bool calc_cond = false, blas_trans_type transt = blas_no_ | bool calc_cond = false, | |||
trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
// Full matrix solvers (lu/cholesky) | // Full matrix solvers (lu/cholesky) | |||
Matrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcon, solve_singularity_handler sing_handler, | double& rcon, solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
public: | public: | |||
// Generic interface to solver with no probing of type | // Generic interface to solver with no probing of type | |||
Matrix solve (MatrixType &typ, const Matrix& b) const; | Matrix solve (MatrixType &typ, const Matrix& b) const; | |||
Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info) co nst; | Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info) co nst; | |||
Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcon) const; | double& rcon) const; | |||
Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcon, solve_singularity_handler sing_handler, | double& rcon, solve_singularity_handler sing_handler, | |||
bool singular_fallback = true, blas_trans_type transt = bla | bool singular_fallback = true, | |||
s_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; | ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; | |||
ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcon) const; | octave_idx_type& info, double& rcon) const; | |||
ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcon, | octave_idx_type& info, double& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool singular_fallback = true, | bool singular_fallback = true, | |||
skipping to change at line 237 | skipping to change at line 243 | |||
// Generic interface to solver with probing of type | // Generic interface to solver with probing of type | |||
Matrix solve (const Matrix& b) const; | Matrix solve (const Matrix& b) const; | |||
Matrix solve (const Matrix& b, octave_idx_type& info) const; | Matrix solve (const Matrix& b, octave_idx_type& info) const; | |||
Matrix solve (const Matrix& b, octave_idx_type& info, double& rcon) const ; | Matrix solve (const Matrix& b, octave_idx_type& info, double& rcon) const ; | |||
Matrix solve (const Matrix& b, octave_idx_type& info, double& rcon, | Matrix solve (const Matrix& b, octave_idx_type& info, double& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
ComplexMatrix solve (const ComplexMatrix& b) const; | ComplexMatrix solve (const ComplexMatrix& b) const; | |||
ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const ; | ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const ; | |||
ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, doubl | ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | |||
e& rcon) const; | double& rcon) const; | |||
ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, doubl | ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | |||
e& rcon, | double& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
ColumnVector solve (const ColumnVector& b) const; | ColumnVector solve (const ColumnVector& b) const; | |||
ColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; | ColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; | |||
ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& | ColumnVector solve (const ColumnVector& b, octave_idx_type& info, | |||
rcon) const; | double& rcon) const; | |||
ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& | ColumnVector solve (const ColumnVector& b, octave_idx_type& info, | |||
rcon, | double& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b) const; | ComplexColumnVector solve (const ComplexColumnVector& b) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& | ComplexColumnVector solve (const ComplexColumnVector& b, | |||
info) const; | octave_idx_type& info) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& | ComplexColumnVector solve (const ComplexColumnVector& b, | |||
info, | octave_idx_type& info, double& rcon) const; | |||
double& rcon) const; | ComplexColumnVector solve (const ComplexColumnVector& b, | |||
ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& | octave_idx_type& info, double& rcon, | |||
info, | solve_singularity_handler sing_handler, | |||
double& rcon, solve_singularity_handler sing_h | ||||
andler, | ||||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
// Singular solvers | // Singular solvers | |||
Matrix lssolve (const Matrix& b) const; | Matrix lssolve (const Matrix& b) const; | |||
Matrix lssolve (const Matrix& b, octave_idx_type& info) const; | Matrix lssolve (const Matrix& b, octave_idx_type& info) const; | |||
Matrix lssolve (const Matrix& b, octave_idx_type& info, | Matrix lssolve (const Matrix& b, octave_idx_type& info, | |||
octave_idx_type& rank) const; | octave_idx_type& rank) const; | |||
Matrix lssolve (const Matrix& b, octave_idx_type& info, | Matrix lssolve (const Matrix& b, octave_idx_type& info, | |||
octave_idx_type& rank, double& rcon) const; | octave_idx_type& rank, double& rcon) const; | |||
skipping to change at line 319 | skipping to change at line 331 | |||
Matrix cumprod (int dim = -1) const; | Matrix cumprod (int dim = -1) const; | |||
Matrix cumsum (int dim = -1) const; | Matrix cumsum (int dim = -1) const; | |||
Matrix prod (int dim = -1) const; | Matrix prod (int dim = -1) const; | |||
Matrix sum (int dim = -1) const; | Matrix sum (int dim = -1) const; | |||
Matrix sumsq (int dim = -1) const; | Matrix sumsq (int dim = -1) const; | |||
Matrix abs (void) const; | Matrix abs (void) const; | |||
Matrix diag (octave_idx_type k = 0) const; | Matrix diag (octave_idx_type k = 0) const; | |||
DiagMatrix diag (octave_idx_type m, octave_idx_type n) const; | ||||
ColumnVector row_min (void) const; | ColumnVector row_min (void) const; | |||
ColumnVector row_max (void) const; | ColumnVector row_max (void) const; | |||
ColumnVector row_min (Array<octave_idx_type>& index) const; | ColumnVector row_min (Array<octave_idx_type>& index) const; | |||
ColumnVector row_max (Array<octave_idx_type>& index) const; | ColumnVector row_max (Array<octave_idx_type>& index) const; | |||
RowVector column_min (void) const; | RowVector column_min (void) const; | |||
RowVector column_max (void) const; | RowVector column_max (void) const; | |||
RowVector column_min (Array<octave_idx_type>& index) const; | RowVector column_min (Array<octave_idx_type>& index) const; | |||
RowVector column_max (Array<octave_idx_type>& index) const; | RowVector column_max (Array<octave_idx_type>& index) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Matr | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
ix& a); | const Matrix& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, Matrix& a) ; | friend OCTAVE_API std::istream& operator >> (std::istream& is, Matrix& a) ; | |||
static double resize_fill_value (void) { return 0; } | ||||
}; | }; | |||
// Publish externally used friend functions. | // Publish externally used friend functions. | |||
extern OCTAVE_API Matrix real (const ComplexMatrix& a); | extern OCTAVE_API Matrix real (const ComplexMatrix& a); | |||
extern OCTAVE_API Matrix imag (const ComplexMatrix& a); | extern OCTAVE_API Matrix imag (const ComplexMatrix& a); | |||
// column vector by row vector -> matrix operations | // column vector by row vector -> matrix operations | |||
extern OCTAVE_API Matrix operator * (const ColumnVector& a, const RowVector | extern OCTAVE_API Matrix operator * (const ColumnVector& a, | |||
& b); | const RowVector& b); | |||
// Other functions. | // Other functions. | |||
extern OCTAVE_API Matrix Givens (double, double); | extern OCTAVE_API Matrix Givens (double, double); | |||
extern OCTAVE_API Matrix Sylvester (const Matrix&, const Matrix&, const Mat | extern OCTAVE_API Matrix Sylvester (const Matrix&, const Matrix&, | |||
rix&); | const Matrix&); | |||
extern OCTAVE_API Matrix xgemm (const Matrix& a, const Matrix& b, | extern OCTAVE_API Matrix xgemm (const Matrix& a, const Matrix& b, | |||
blas_trans_type transa = blas_no_trans, | blas_trans_type transa = blas_no_trans, | |||
blas_trans_type transb = blas_no_trans); | blas_trans_type transb = blas_no_trans); | |||
extern OCTAVE_API Matrix operator * (const Matrix& a, const Matrix& b); | extern OCTAVE_API Matrix operator * (const Matrix& a, const Matrix& b); | |||
extern OCTAVE_API Matrix min (double d, const Matrix& m); | extern OCTAVE_API Matrix min (double d, const Matrix& m); | |||
extern OCTAVE_API Matrix min (const Matrix& m, double d); | extern OCTAVE_API Matrix min (const Matrix& m, double d); | |||
extern OCTAVE_API Matrix min (const Matrix& a, const Matrix& b); | extern OCTAVE_API Matrix min (const Matrix& a, const Matrix& b); | |||
End of changes. 19 change blocks. | ||||
48 lines changed or deleted | 45 lines changed or added | |||
dNDArray.h | dNDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_NDArray_h) | #if !defined (octave_dNDArray_h) | |||
#define octave_NDArray_h 1 | #define octave_dNDArray_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
#include "intNDArray.h" | #include "intNDArray.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
#include "mx-op-decl.h" | #include "mx-op-decl.h" | |||
#include "bsxfun-decl.h" | #include "bsxfun-decl.h" | |||
class | class | |||
skipping to change at line 67 | skipping to change at line 67 | |||
NDArray (const MArray<U>& a) : MArray<double> (a) { } | NDArray (const MArray<U>& a) : MArray<double> (a) { } | |||
template <class U> | template <class U> | |||
NDArray (const Array<U>& a) : MArray<double> (a) { } | NDArray (const Array<U>& a) : MArray<double> (a) { } | |||
template <class U> | template <class U> | |||
explicit NDArray (const intNDArray<U>& a) : MArray<double> (a) { } | explicit NDArray (const intNDArray<U>& a) : MArray<double> (a) { } | |||
NDArray (const charNDArray&); | NDArray (const charNDArray&); | |||
// For jit support only | ||||
NDArray (double *sdata, octave_idx_type slen, octave_idx_type *adims, | ||||
void *arep) | ||||
: MArray<double> (sdata, slen, adims, arep) { } | ||||
NDArray& operator = (const NDArray& a) | NDArray& operator = (const NDArray& a) | |||
{ | { | |||
MArray<double>::operator = (a); | MArray<double>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
// unary operations | // unary operations | |||
boolNDArray operator ! (void) const; | boolNDArray operator ! (void) const; | |||
bool any_element_is_negative (bool = false) const; | bool any_element_is_negative (bool = false) const; | |||
bool any_element_is_positive (bool = false) const; | bool any_element_is_positive (bool = false) const; | |||
bool any_element_is_nan (void) const; | bool any_element_is_nan (void) const; | |||
bool any_element_is_inf_or_nan (void) const; | bool any_element_is_inf_or_nan (void) const; | |||
bool any_element_not_one_or_zero (void) const; | bool any_element_not_one_or_zero (void) const; | |||
bool all_elements_are_zero (void) const; | bool all_elements_are_zero (void) const; | |||
bool all_elements_are_int_or_inf_or_nan (void) const; | bool all_elements_are_int_or_inf_or_nan (void) const; | |||
bool all_integers (double& max_val, double& min_val) const; | bool all_integers (double& max_val, double& min_val) const; | |||
bool all_integers (void) const; | bool all_integers (void) const; | |||
bool too_large_for_float (void) const; | bool too_large_for_float (void) const; | |||
// FIXME -- this is not quite the right thing. | // FIXME: this is not quite the right thing. | |||
boolNDArray all (int dim = -1) const; | boolNDArray all (int dim = -1) const; | |||
boolNDArray any (int dim = -1) const; | boolNDArray any (int dim = -1) const; | |||
NDArray cumprod (int dim = -1) const; | NDArray cumprod (int dim = -1) const; | |||
NDArray cumsum (int dim = -1) const; | NDArray cumsum (int dim = -1) const; | |||
NDArray prod (int dim = -1) const; | NDArray prod (int dim = -1) const; | |||
NDArray sum (int dim = -1) const; | NDArray sum (int dim = -1) const; | |||
NDArray xsum (int dim = -1) const; | NDArray xsum (int dim = -1) const; | |||
NDArray sumsq (int dim = -1) const; | NDArray sumsq (int dim = -1) const; | |||
NDArray concat (const NDArray& rb, const Array<octave_idx_type>& ra_idx); | NDArray concat (const NDArray& rb, const Array<octave_idx_type>& ra_idx); | |||
ComplexNDArray concat (const ComplexNDArray& rb, const Array<octave_idx_t | ComplexNDArray concat (const ComplexNDArray& rb, | |||
ype>& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
charNDArray concat (const charNDArray& rb, const Array<octave_idx_type>& | charNDArray concat (const charNDArray& rb, | |||
ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
NDArray max (int dim = -1) const; | NDArray max (int dim = -1) const; | |||
NDArray max (Array<octave_idx_type>& index, int dim = -1) const; | NDArray max (Array<octave_idx_type>& index, int dim = -1) const; | |||
NDArray min (int dim = -1) const; | NDArray min (int dim = -1) const; | |||
NDArray min (Array<octave_idx_type>& index, int dim = -1) const; | NDArray min (Array<octave_idx_type>& index, int dim = -1) const; | |||
NDArray cummax (int dim = -1) const; | NDArray cummax (int dim = -1) const; | |||
NDArray cummax (Array<octave_idx_type>& index, int dim = -1) const; | NDArray cummax (Array<octave_idx_type>& index, int dim = -1) const; | |||
NDArray cummin (int dim = -1) const; | NDArray cummin (int dim = -1) const; | |||
NDArray cummin (Array<octave_idx_type>& index, int dim = -1) const; | NDArray cummin (Array<octave_idx_type>& index, int dim = -1) const; | |||
skipping to change at line 146 | skipping to change at line 153 | |||
Matrix matrix_value (void) const; | Matrix matrix_value (void) const; | |||
NDArray squeeze (void) const { return MArray<double>::squeeze (); } | NDArray squeeze (void) const { return MArray<double>::squeeze (); } | |||
static void increment_index (Array<octave_idx_type>& ra_idx, | static void increment_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions, | const dim_vector& dimensions, | |||
int start_dimension = 0); | int start_dimension = 0); | |||
static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions); | const dim_vector& dimensions); | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const NDAr | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
ray& a); | const NDArray& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, NDArray& a ); | friend OCTAVE_API std::istream& operator >> (std::istream& is, NDArray& a ); | |||
static double resize_fill_value (void) { return 0; } | ||||
NDArray diag (octave_idx_type k = 0) const; | NDArray diag (octave_idx_type k = 0) const; | |||
NDArray diag (octave_idx_type m, octave_idx_type n) const; | ||||
NDArray& changesign (void) | NDArray& changesign (void) | |||
{ | { | |||
MArray<double>::changesign (); | MArray<double>::changesign (); | |||
return *this; | return *this; | |||
} | } | |||
}; | }; | |||
// Publish externally used friend functions. | // Publish externally used friend functions. | |||
extern OCTAVE_API NDArray real (const ComplexNDArray& a); | extern OCTAVE_API NDArray real (const ComplexNDArray& a); | |||
extern OCTAVE_API NDArray imag (const ComplexNDArray& a); | extern OCTAVE_API NDArray imag (const ComplexNDArray& a); | |||
MINMAX_DECLS (NDArray, double, OCTAVE_API) | MINMAX_DECLS (NDArray, double, OCTAVE_API) | |||
End of changes. 11 change blocks. | ||||
21 lines changed or deleted | 26 lines changed or added | |||
dRowVector.h | dRowVector.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_RowVector_h) | #if !defined (octave_dRowVector_h) | |||
#define octave_RowVector_h 1 | #define octave_dRowVector_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
RowVector : public MArray<double> | RowVector : public MArray<double> | |||
{ | { | |||
public: | public: | |||
skipping to change at line 53 | skipping to change at line 53 | |||
RowVector (octave_idx_type n, double val) | RowVector (octave_idx_type n, double val) | |||
: MArray<double> (dim_vector (1, n), val) { } | : MArray<double> (dim_vector (1, n), val) { } | |||
RowVector (const RowVector& a) : MArray<double> (a) { } | RowVector (const RowVector& a) : MArray<double> (a) { } | |||
RowVector (const MArray<double>& a) : MArray<double> (a.as_row ()) { } | RowVector (const MArray<double>& a) : MArray<double> (a.as_row ()) { } | |||
RowVector (const Array<double>& a) : MArray<double> (a.as_row ()) { } | RowVector (const Array<double>& a) : MArray<double> (a.as_row ()) { } | |||
RowVector& operator = (const RowVector& a) | RowVector& operator = (const RowVector& a) | |||
{ | { | |||
MArray<double>::operator = (a); | MArray<double>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const RowVector& a) const; | bool operator == (const RowVector& a) const; | |||
bool operator != (const RowVector& a) const; | bool operator != (const RowVector& a) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
RowVector& insert (const RowVector& a, octave_idx_type c); | RowVector& insert (const RowVector& a, octave_idx_type c); | |||
RowVector& fill (double val); | RowVector& fill (double val); | |||
RowVector& fill (double val, octave_idx_type c1, octave_idx_type c2); | RowVector& fill (double val, octave_idx_type c1, octave_idx_type c2); | |||
skipping to change at line 92 | skipping to change at line 92 | |||
friend OCTAVE_API RowVector operator * (const RowVector& a, const Matrix& b); | friend OCTAVE_API RowVector operator * (const RowVector& a, const Matrix& b); | |||
// other operations | // other operations | |||
double min (void) const; | double min (void) const; | |||
double max (void) const; | double max (void) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const RowV | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
ector& a); | const RowVector& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, RowVector& a); | friend OCTAVE_API std::istream& operator >> (std::istream& is, RowVector& a); | |||
void resize (octave_idx_type n, | void resize (octave_idx_type n, const double& rfv = 0) | |||
const double& rfv = Array<double>::resize_fill_value ()) | ||||
{ | { | |||
Array<double>::resize (dim_vector (1, n), rfv); | Array<double>::resize (dim_vector (1, n), rfv); | |||
} | } | |||
void clear (octave_idx_type n) | void clear (octave_idx_type n) | |||
{ Array<double>::clear (1, n); } | { Array<double>::clear (1, n); } | |||
}; | }; | |||
// row vector by column vector -> scalar | // row vector by column vector -> scalar | |||
double OCTAVE_API operator * (const RowVector& a, const ColumnVector& b); | double OCTAVE_API operator * (const RowVector& a, const ColumnVector& b); | |||
Complex OCTAVE_API operator * (const RowVector& a, const ComplexColumnVecto | Complex OCTAVE_API operator * (const RowVector& a, | |||
r& b); | const ComplexColumnVector& b); | |||
// other operations | // other operations | |||
OCTAVE_API RowVector linspace (double x1, double x2, octave_idx_type n); | OCTAVE_API RowVector linspace (double x1, double x2, octave_idx_type n); | |||
MARRAY_FORWARD_DEFS (MArray, RowVector, double) | MARRAY_FORWARD_DEFS (MArray, RowVector, double) | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
14 lines changed or deleted | 13 lines changed or added | |||
dSparse.h | dSparse.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 48 | skipping to change at line 48 | |||
class PermMatrix; | class PermMatrix; | |||
class DiagMatrix; | class DiagMatrix; | |||
class SparseComplexMatrix; | class SparseComplexMatrix; | |||
class SparseBoolMatrix; | class SparseBoolMatrix; | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
SparseMatrix : public MSparse<double> | SparseMatrix : public MSparse<double> | |||
{ | { | |||
public: | public: | |||
typedef void (*solve_singularity_handler) (double rcond); | typedef void (*solve_singularity_handler) (double rcond); | |||
SparseMatrix (void) : MSparse<double> () { } | SparseMatrix (void) : MSparse<double> () { } | |||
SparseMatrix (octave_idx_type r, octave_idx_type c) : MSparse<double> (r, | SparseMatrix (octave_idx_type r, octave_idx_type c) | |||
c) { } | : MSparse<double> (r, c) { } | |||
SparseMatrix (const dim_vector& dv, octave_idx_type nz = 0) : | SparseMatrix (const dim_vector& dv, octave_idx_type nz = 0) : | |||
MSparse<double> (dv, nz) { } | MSparse<double> (dv, nz) { } | |||
explicit SparseMatrix (octave_idx_type r, octave_idx_type c, double val) | explicit SparseMatrix (octave_idx_type r, octave_idx_type c, double val) | |||
: MSparse<double> (r, c, val) { } | : MSparse<double> (r, c, val) { } | |||
SparseMatrix (const SparseMatrix& a) : MSparse<double> (a) { } | SparseMatrix (const SparseMatrix& a) : MSparse<double> (a) { } | |||
SparseMatrix (const SparseMatrix& a, const dim_vector& dv) | SparseMatrix (const SparseMatrix& a, const dim_vector& dv) | |||
skipping to change at line 87 | skipping to change at line 88 | |||
SparseMatrix (const Array<double>& a, const idx_vector& r, | SparseMatrix (const Array<double>& a, const idx_vector& r, | |||
const idx_vector& c, octave_idx_type nr = -1, | const idx_vector& c, octave_idx_type nr = -1, | |||
octave_idx_type nc = -1, bool sum_terms = true, | octave_idx_type nc = -1, bool sum_terms = true, | |||
octave_idx_type nzm = -1) | octave_idx_type nzm = -1) | |||
: MSparse<double> (a, r, c, nr, nc, sum_terms, nzm) { } | : MSparse<double> (a, r, c, nr, nc, sum_terms, nzm) { } | |||
explicit SparseMatrix (const DiagMatrix& a); | explicit SparseMatrix (const DiagMatrix& a); | |||
explicit SparseMatrix (const PermMatrix& a) : MSparse<double>(a) { } | explicit SparseMatrix (const PermMatrix& a) : MSparse<double>(a) { } | |||
SparseMatrix (octave_idx_type r, octave_idx_type c, octave_idx_type num_n | SparseMatrix (octave_idx_type r, octave_idx_type c, | |||
z) : MSparse<double> (r, c, num_nz) { } | octave_idx_type num_nz) : MSparse<double> (r, c, num_nz) { | |||
} | ||||
SparseMatrix& operator = (const SparseMatrix& a) | SparseMatrix& operator = (const SparseMatrix& a) | |||
{ | { | |||
MSparse<double>::operator = (a); | MSparse<double>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const SparseMatrix& a) const; | bool operator == (const SparseMatrix& a) const; | |||
bool operator != (const SparseMatrix& a) const; | bool operator != (const SparseMatrix& a) const; | |||
bool is_symmetric (void) const; | bool is_symmetric (void) const; | |||
SparseMatrix max (int dim = -1) const; | SparseMatrix max (int dim = -1) const; | |||
SparseMatrix max (Array<octave_idx_type>& index, int dim = -1) const; | SparseMatrix max (Array<octave_idx_type>& index, int dim = -1) const; | |||
SparseMatrix min (int dim = -1) const; | SparseMatrix min (int dim = -1) const; | |||
SparseMatrix min (Array<octave_idx_type>& index, int dim = -1) const; | SparseMatrix min (Array<octave_idx_type>& index, int dim = -1) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
SparseMatrix& insert (const SparseMatrix& a, octave_idx_type r, octave_id | SparseMatrix& insert (const SparseMatrix& a, octave_idx_type r, | |||
x_type c); | octave_idx_type c); | |||
SparseMatrix& insert (const SparseMatrix& a, const Array<octave_idx_type> | SparseMatrix& insert (const SparseMatrix& a, | |||
& indx); | const Array<octave_idx_type>& indx); | |||
SparseMatrix concat (const SparseMatrix& rb, const Array<octave_idx_type> | SparseMatrix concat (const SparseMatrix& rb, | |||
& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
SparseComplexMatrix concat (const SparseComplexMatrix& rb, | SparseComplexMatrix concat (const SparseComplexMatrix& rb, | |||
const Array<octave_idx_type>& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
friend OCTAVE_API SparseMatrix real (const SparseComplexMatrix& a); | friend OCTAVE_API SparseMatrix real (const SparseComplexMatrix& a); | |||
friend OCTAVE_API SparseMatrix imag (const SparseComplexMatrix& a); | friend OCTAVE_API SparseMatrix imag (const SparseComplexMatrix& a); | |||
friend OCTAVE_API SparseMatrix atan2 (const double& x, const SparseMatrix & y); | friend OCTAVE_API SparseMatrix atan2 (const double& x, const SparseMatrix & y); | |||
friend OCTAVE_API SparseMatrix atan2 (const SparseMatrix& x, const double & y); | friend OCTAVE_API SparseMatrix atan2 (const SparseMatrix& x, const double & y); | |||
friend OCTAVE_API SparseMatrix atan2 (const SparseMatrix& x, const Sparse | friend OCTAVE_API SparseMatrix atan2 (const SparseMatrix& x, | |||
Matrix& y); | const SparseMatrix& y); | |||
SparseMatrix transpose (void) const | SparseMatrix transpose (void) const | |||
{ | { | |||
return MSparse<double>::transpose (); | return MSparse<double>::transpose (); | |||
} | } | |||
SparseMatrix hermitian (void) const { return transpose (); } | SparseMatrix hermitian (void) const { return transpose (); } | |||
// extract row or column i. | // extract row or column i. | |||
RowVector row (octave_idx_type i) const; | RowVector row (octave_idx_type i) const; | |||
ColumnVector column (octave_idx_type i) const; | ColumnVector column (octave_idx_type i) const; | |||
private: | private: | |||
SparseMatrix dinverse (MatrixType &mattyp, octave_idx_type& info, | SparseMatrix dinverse (MatrixType &mattyp, octave_idx_type& info, | |||
skipping to change at line 152 | skipping to change at line 158 | |||
public: | public: | |||
SparseMatrix inverse (void) const; | SparseMatrix inverse (void) const; | |||
SparseMatrix inverse (MatrixType& mattype) const; | SparseMatrix inverse (MatrixType& mattype) const; | |||
SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info) const; | SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info) const; | |||
SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info, | SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info, | |||
double& rcond, int force = 0, int calc_cond = 1) co nst; | double& rcond, int force = 0, int calc_cond = 1) co nst; | |||
DET determinant (void) const; | DET determinant (void) const; | |||
DET determinant (octave_idx_type& info) const; | DET determinant (octave_idx_type& info) const; | |||
DET determinant (octave_idx_type& info, double& rcond, int calc_cond = 1) | DET determinant (octave_idx_type& info, double& rcond, | |||
const; | int calc_cond = 1) const; | |||
private: | private: | |||
// Diagonal matrix solvers | // Diagonal matrix solvers | |||
Matrix dsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix dsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcond, solve_singularity_handler sing_handler, | double& rcond, solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
ComplexMatrix dsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix dsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseMatrix dsolve (MatrixType &typ, const SparseMatrix& b, | SparseMatrix dsolve (MatrixType &typ, const SparseMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix dsolve (MatrixType &typ, const SparseComplexMatrix& b , | SparseComplexMatrix dsolve (MatrixType &typ, const SparseComplexMatrix& b , | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
// Upper triangular matrix solvers | // Upper triangular matrix solvers | |||
Matrix utsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix utsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcond, solve_singularity_handler sing_handler, | double& rcond, solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseMatrix utsolve (MatrixType &typ, const SparseMatrix& b, | SparseMatrix utsolve (MatrixType &typ, const SparseMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix utsolve (MatrixType &typ, const SparseComplexMatrix& b, | SparseComplexMatrix utsolve (MatrixType &typ, const SparseComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
// Lower triangular matrix solvers | // Lower triangular matrix solvers | |||
Matrix ltsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix ltsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcond, solve_singularity_handler sing_handler, | double& rcond, solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseMatrix ltsolve (MatrixType &typ, const SparseMatrix& b, | SparseMatrix ltsolve (MatrixType &typ, const SparseMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix ltsolve (MatrixType &typ, const SparseComplexMatrix& b, | SparseComplexMatrix ltsolve (MatrixType &typ, const SparseComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
// Tridiagonal matrix solvers | // Tridiagonal matrix solvers | |||
Matrix trisolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix trisolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcond, solve_singularity_handler sing_handler, | double& rcond, solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
ComplexMatrix trisolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix trisolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseMatrix trisolve (MatrixType &typ, const SparseMatrix& b, | SparseMatrix trisolve (MatrixType &typ, const SparseMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix trisolve (MatrixType &typ, const SparseComplexMatrix& b, | SparseComplexMatrix trisolve (MatrixType &typ, const SparseComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
// Banded matrix solvers (umfpack/cholesky) | // Banded matrix solvers (umfpack/cholesky) | |||
Matrix bsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix bsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcond, solve_singularity_handler sing_handler, | double& rcond, solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
ComplexMatrix bsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix bsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseMatrix bsolve (MatrixType &typ, const SparseMatrix& b, | SparseMatrix bsolve (MatrixType &typ, const SparseMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix bsolve (MatrixType &typ, const SparseComplexMatrix& b , | SparseComplexMatrix bsolve (MatrixType &typ, const SparseComplexMatrix& b , | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
// Full matrix solvers (umfpack/cholesky) | // Full matrix solvers (umfpack/cholesky) | |||
void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, | void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, | |||
Matrix &Info, solve_singularity_handler sing_handler, | Matrix &Info, solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
Matrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcond, solve_singularity_handler sing_handler, | double& rcond, solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, | ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseMatrix fsolve (MatrixType &typ, const SparseMatrix& b, | SparseMatrix fsolve (MatrixType &typ, const SparseMatrix& b, | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
SparseComplexMatrix fsolve (MatrixType &typ, const SparseComplexMatrix& b , | SparseComplexMatrix fsolve (MatrixType &typ, const SparseComplexMatrix& b , | |||
octave_idx_type& info, double& rcond, | octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
public: | public: | |||
// Generic interface to solver with no probing of type | // Generic interface to solver with no probing of type | |||
Matrix solve (MatrixType &typ, const Matrix& b) const; | Matrix solve (MatrixType &typ, const Matrix& b) const; | |||
Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info) co nst; | Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info) co nst; | |||
Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcond) const; | double& rcond) const; | |||
Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, | |||
double& rcond, solve_singularity_handler sing_handler, | double& rcond, solve_singularity_handler sing_handler, | |||
bool singular_fallback = true) const; | bool singular_fallback = true) const; | |||
skipping to change at line 350 | skipping to change at line 357 | |||
Matrix solve (const Matrix& b) const; | Matrix solve (const Matrix& b) const; | |||
Matrix solve (const Matrix& b, octave_idx_type& info) const; | Matrix solve (const Matrix& b, octave_idx_type& info) const; | |||
Matrix solve (const Matrix& b, octave_idx_type& info, double& rcond) cons t; | Matrix solve (const Matrix& b, octave_idx_type& info, double& rcond) cons t; | |||
Matrix solve (const Matrix& b, octave_idx_type& info, double& rcond, | Matrix solve (const Matrix& b, octave_idx_type& info, double& rcond, | |||
solve_singularity_handler sing_handler) const; | solve_singularity_handler sing_handler) const; | |||
ComplexMatrix solve (const ComplexMatrix& b) const; | ComplexMatrix solve (const ComplexMatrix& b) const; | |||
ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const ; | ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const ; | |||
ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | |||
double& rcond) const; | double& rcond) const; | |||
ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, doubl | ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, | |||
e& rcond, | double& rcond, | |||
solve_singularity_handler sing_handler) const; | solve_singularity_handler sing_handler) const; | |||
SparseMatrix solve (const SparseMatrix& b) const; | SparseMatrix solve (const SparseMatrix& b) const; | |||
SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info) const; | SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info) const; | |||
SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, | SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, | |||
double& rcond) const; | double& rcond) const; | |||
SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, double& | SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, | |||
rcond, | double& rcond, | |||
solve_singularity_handler sing_handler) const; | solve_singularity_handler sing_handler) const; | |||
SparseComplexMatrix solve (const SparseComplexMatrix& b) const; | SparseComplexMatrix solve (const SparseComplexMatrix& b) const; | |||
SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& | SparseComplexMatrix solve (const SparseComplexMatrix& b, | |||
info) const; | octave_idx_type& info) const; | |||
SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& | SparseComplexMatrix solve (const SparseComplexMatrix& b, | |||
info, | octave_idx_type& info, double& rcond) const; | |||
double& rcond) const; | SparseComplexMatrix solve (const SparseComplexMatrix& b, | |||
SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& | octave_idx_type& info, double& rcond, | |||
info, | ||||
double& rcond, | ||||
solve_singularity_handler sing_handler) const; | solve_singularity_handler sing_handler) const; | |||
ColumnVector solve (const ColumnVector& b) const; | ColumnVector solve (const ColumnVector& b) const; | |||
ColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; | ColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; | |||
ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& | ColumnVector solve (const ColumnVector& b, octave_idx_type& info, | |||
rcond) const; | double& rcond) const; | |||
ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& | ColumnVector solve (const ColumnVector& b, octave_idx_type& info, | |||
rcond, | double& rcond, | |||
solve_singularity_handler sing_handler) const; | solve_singularity_handler sing_handler) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b) const; | ComplexColumnVector solve (const ComplexColumnVector& b) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& | ComplexColumnVector solve (const ComplexColumnVector& b, | |||
info) const; | octave_idx_type& info) const; | |||
ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& | ComplexColumnVector solve (const ComplexColumnVector& b, | |||
info, | octave_idx_type& info, double& rcond) const; | |||
double& rcond) const; | ComplexColumnVector solve (const ComplexColumnVector& b, | |||
ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& | octave_idx_type& info, double& rcond, | |||
info, | ||||
double& rcond, | ||||
solve_singularity_handler sing_handler) const; | solve_singularity_handler sing_handler) const; | |||
// other operations | // other operations | |||
bool any_element_is_negative (bool = false) const; | bool any_element_is_negative (bool = false) const; | |||
bool any_element_is_nan (void) const; | bool any_element_is_nan (void) const; | |||
bool any_element_is_inf_or_nan (void) const; | bool any_element_is_inf_or_nan (void) const; | |||
bool any_element_not_one_or_zero (void) const; | bool any_element_not_one_or_zero (void) const; | |||
bool all_elements_are_zero (void) const; | bool all_elements_are_zero (void) const; | |||
bool all_elements_are_int_or_inf_or_nan (void) const; | bool all_elements_are_int_or_inf_or_nan (void) const; | |||
skipping to change at line 413 | skipping to change at line 426 | |||
SparseMatrix abs (void) const; | SparseMatrix abs (void) const; | |||
SparseMatrix diag (octave_idx_type k = 0) const; | SparseMatrix diag (octave_idx_type k = 0) const; | |||
Matrix matrix_value (void) const; | Matrix matrix_value (void) const; | |||
SparseMatrix squeeze (void) const; | SparseMatrix squeeze (void) const; | |||
SparseMatrix reshape (const dim_vector& new_dims) const; | SparseMatrix reshape (const dim_vector& new_dims) const; | |||
SparseMatrix permute (const Array<octave_idx_type>& vec, bool inv = false | SparseMatrix permute (const Array<octave_idx_type>& vec, | |||
) const; | bool inv = false) const; | |||
SparseMatrix ipermute (const Array<octave_idx_type>& vec) const; | SparseMatrix ipermute (const Array<octave_idx_type>& vec) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Spar | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
seMatrix& a); | const SparseMatrix& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, SparseMatr | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
ix& a); | SparseMatrix& a); | |||
}; | }; | |||
// Publish externally used friend functions. | // Publish externally used friend functions. | |||
extern OCTAVE_API SparseMatrix real (const SparseComplexMatrix& a); | extern OCTAVE_API SparseMatrix real (const SparseComplexMatrix& a); | |||
extern OCTAVE_API SparseMatrix imag (const SparseComplexMatrix& a); | extern OCTAVE_API SparseMatrix imag (const SparseComplexMatrix& a); | |||
// Other operators. | // Other operators. | |||
extern OCTAVE_API SparseMatrix operator * (const SparseMatrix& a, | extern OCTAVE_API SparseMatrix operator * (const SparseMatrix& a, | |||
const SparseMatrix& b); | const SparseMatrix& b); | |||
extern OCTAVE_API Matrix operator * (const Matrix& a, | extern OCTAVE_API Matrix operator * (const Matrix& a, | |||
const SparseMatrix& b); | const SparseMatrix& b); | |||
extern OCTAVE_API Matrix mul_trans (const Matrix& a, | extern OCTAVE_API Matrix mul_trans (const Matrix& a, | |||
const SparseMatrix& b); | const SparseMatrix& b); | |||
extern OCTAVE_API Matrix operator * (const SparseMatrix& a, | extern OCTAVE_API Matrix operator * (const SparseMatrix& a, | |||
const Matrix& b); | const Matrix& b); | |||
extern OCTAVE_API Matrix trans_mul (const SparseMatrix& a, | extern OCTAVE_API Matrix trans_mul (const SparseMatrix& a, | |||
const Matrix& b); | const Matrix& b); | |||
extern OCTAVE_API SparseMatrix operator * (const DiagMatrix&, const SparseM | ||||
atrix&); | ||||
extern OCTAVE_API SparseMatrix operator * (const SparseMatrix&, const DiagM | ||||
atrix&); | ||||
extern OCTAVE_API SparseMatrix operator + (const DiagMatrix&, const SparseM | ||||
atrix&); | ||||
extern OCTAVE_API SparseMatrix operator + (const SparseMatrix&, const DiagM | ||||
atrix&); | ||||
extern OCTAVE_API SparseMatrix operator - (const DiagMatrix&, const SparseM | ||||
atrix&); | ||||
extern OCTAVE_API SparseMatrix operator - (const SparseMatrix&, const DiagM | ||||
atrix&); | ||||
extern OCTAVE_API SparseMatrix operator * (const PermMatrix&, const SparseM | extern OCTAVE_API SparseMatrix operator * (const DiagMatrix&, | |||
atrix&); | const SparseMatrix&); | |||
extern OCTAVE_API SparseMatrix operator * (const SparseMatrix&, const PermM | extern OCTAVE_API SparseMatrix operator * (const SparseMatrix&, | |||
atrix&); | const DiagMatrix&); | |||
extern OCTAVE_API SparseMatrix operator + (const DiagMatrix&, | ||||
const SparseMatrix&); | ||||
extern OCTAVE_API SparseMatrix operator + (const SparseMatrix&, | ||||
const DiagMatrix&); | ||||
extern OCTAVE_API SparseMatrix operator - (const DiagMatrix&, | ||||
const SparseMatrix&); | ||||
extern OCTAVE_API SparseMatrix operator - (const SparseMatrix&, | ||||
const DiagMatrix&); | ||||
extern OCTAVE_API SparseMatrix operator * (const PermMatrix&, | ||||
const SparseMatrix&); | ||||
extern OCTAVE_API SparseMatrix operator * (const SparseMatrix&, | ||||
const PermMatrix&); | ||||
extern OCTAVE_API SparseMatrix min (double d, const SparseMatrix& m); | extern OCTAVE_API SparseMatrix min (double d, const SparseMatrix& m); | |||
extern OCTAVE_API SparseMatrix min (const SparseMatrix& m, double d); | extern OCTAVE_API SparseMatrix min (const SparseMatrix& m, double d); | |||
extern OCTAVE_API SparseMatrix min (const SparseMatrix& a, const SparseMatr | extern OCTAVE_API SparseMatrix min (const SparseMatrix& a, | |||
ix& b); | const SparseMatrix& b); | |||
extern OCTAVE_API SparseMatrix max (double d, const SparseMatrix& m); | extern OCTAVE_API SparseMatrix max (double d, const SparseMatrix& m); | |||
extern OCTAVE_API SparseMatrix max (const SparseMatrix& m, double d); | extern OCTAVE_API SparseMatrix max (const SparseMatrix& m, double d); | |||
extern OCTAVE_API SparseMatrix max (const SparseMatrix& a, const SparseMatr | extern OCTAVE_API SparseMatrix max (const SparseMatrix& a, | |||
ix& b); | const SparseMatrix& b); | |||
SPARSE_SMS_CMP_OP_DECLS (SparseMatrix, double, OCTAVE_API) | SPARSE_SMS_CMP_OP_DECLS (SparseMatrix, double, OCTAVE_API) | |||
SPARSE_SMS_BOOL_OP_DECLS (SparseMatrix, double, OCTAVE_API) | SPARSE_SMS_BOOL_OP_DECLS (SparseMatrix, double, OCTAVE_API) | |||
SPARSE_SSM_CMP_OP_DECLS (double, SparseMatrix, OCTAVE_API) | SPARSE_SSM_CMP_OP_DECLS (double, SparseMatrix, OCTAVE_API) | |||
SPARSE_SSM_BOOL_OP_DECLS (double, SparseMatrix, OCTAVE_API) | SPARSE_SSM_BOOL_OP_DECLS (double, SparseMatrix, OCTAVE_API) | |||
SPARSE_SMSM_CMP_OP_DECLS (SparseMatrix, SparseMatrix, OCTAVE_API) | SPARSE_SMSM_CMP_OP_DECLS (SparseMatrix, SparseMatrix, OCTAVE_API) | |||
SPARSE_SMSM_BOOL_OP_DECLS (SparseMatrix, SparseMatrix, OCTAVE_API) | SPARSE_SMSM_BOOL_OP_DECLS (SparseMatrix, SparseMatrix, OCTAVE_API) | |||
SPARSE_FORWARD_DEFS (MSparse, SparseMatrix, Matrix, double) | SPARSE_FORWARD_DEFS (MSparse, SparseMatrix, Matrix, double) | |||
#ifdef IDX_TYPE_LONG | #ifdef USE_64_BIT_IDX_T | |||
#define UMFPACK_DNAME(name) umfpack_dl_ ## name | #define UMFPACK_DNAME(name) umfpack_dl_ ## name | |||
#else | #else | |||
#define UMFPACK_DNAME(name) umfpack_di_ ## name | #define UMFPACK_DNAME(name) umfpack_di_ ## name | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 51 change blocks. | ||||
148 lines changed or deleted | 145 lines changed or added | |||
data-conv.h | data-conv.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 26 | skipping to change at line 26 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_data_conv_h) | #if !defined (octave_data_conv_h) | |||
#define octave_data_conv_h 1 | #define octave_data_conv_h 1 | |||
#include <climits> | #include <limits> | |||
#include "mach-info.h" | #include "mach-info.h" | |||
#include "oct-inttypes.h" | ||||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
oct_data_conv | oct_data_conv | |||
{ | { | |||
public: | public: | |||
enum data_type | enum data_type | |||
{ | { | |||
dt_int8 = 0, | dt_int8 = 0, | |||
dt_uint8 = 1, | dt_uint8 = 1, | |||
dt_int16 = 2, | dt_int16 = 2, | |||
dt_uint16 = 3, | dt_uint16 = 3, | |||
dt_int32 = 4, | dt_int32 = 4, | |||
dt_uint32 = 5, | dt_uint32 = 5, | |||
dt_int64 = 6, | dt_int64 = 6, | |||
dt_uint64 = 7, | dt_uint64 = 7, | |||
dt_single = 8, | dt_single = 8, | |||
dt_double = 9, | dt_double = 9, | |||
dt_char = 10, | dt_char = 10, | |||
dt_schar = 11, | dt_schar = 11, | |||
dt_uchar = 12, | dt_uchar = 12, | |||
dt_logical = 13, | dt_logical = 13, | |||
dt_short = 14, | dt_short = 14, | |||
dt_ushort = 15, | dt_ushort = 15, | |||
dt_int = 16, | dt_int = 16, | |||
dt_uint = 17, | dt_uint = 17, | |||
dt_long = 18, | dt_long = 18, | |||
dt_ulong = 19, | dt_ulong = 19, | |||
dt_longlong = 20, | dt_longlong = 20, | |||
dt_ulonglong = 21, | dt_ulonglong = 21, | |||
dt_float = 22, | dt_float = 22, | |||
dt_unknown = 23 // Must be last, have largest value! | dt_unknown = 23 // Must be last, have largest value! | |||
}; | }; | |||
static size_t data_type_size (data_type dt); | ||||
static data_type string_to_data_type (const std::string& s); | static data_type string_to_data_type (const std::string& s); | |||
static void string_to_data_type (const std::string& s, int& block_size, | static void string_to_data_type (const std::string& s, int& block_size, | |||
data_type& input_type, | data_type& input_type, | |||
data_type& output_type); | data_type& output_type); | |||
static void string_to_data_type (const std::string& s, int& block_size, | static void string_to_data_type (const std::string& s, int& block_size, | |||
data_type& output_type); | data_type& output_type); | |||
static std::string data_type_as_string (data_type dt); | static std::string data_type_as_string (data_type dt); | |||
}; | }; | |||
// Add new entries to the end of this enum, otherwise Octave will not | // Add new entries to the end of this enum, otherwise Octave will not | |||
// be able to read binary data files stored in Octave's binary data | // be able to read binary data files stored in Octave's binary data | |||
// format that were created with previous versions of Octave. | // format that were created with previous versions of Octave. | |||
enum save_type | enum save_type | |||
{ | { | |||
LS_U_CHAR = 0, | LS_U_CHAR = 0, | |||
LS_U_SHORT = 1, | LS_U_SHORT = 1, | |||
LS_U_INT = 2, | LS_U_INT = 2, | |||
LS_CHAR = 3, | LS_CHAR = 3, | |||
LS_SHORT = 4, | LS_SHORT = 4, | |||
LS_INT = 5, | LS_INT = 5, | |||
LS_FLOAT = 6, | LS_FLOAT = 6, | |||
LS_DOUBLE = 7, | LS_DOUBLE = 7, | |||
LS_U_LONG = 8, | LS_U_LONG = 8, | |||
LS_LONG = 9 | LS_LONG = 9 | |||
}; | }; | |||
extern OCTAVE_API void | extern OCTAVE_API void | |||
do_double_format_conversion (void *data, octave_idx_type len, | do_double_format_conversion (void *data, octave_idx_type len, | |||
oct_mach_info::float_format from_fmt, | oct_mach_info::float_format from_fmt, | |||
oct_mach_info::float_format to_fmt | oct_mach_info::float_format to_fmt | |||
= oct_mach_info::native_float_format ()); | = oct_mach_info::native_float_format ()); | |||
extern OCTAVE_API void | extern OCTAVE_API void | |||
do_float_format_conversion (void *data, octave_idx_type len, | do_float_format_conversion (void *data, octave_idx_type len, | |||
oct_mach_info::float_format from_fmt, | oct_mach_info::float_format from_fmt, | |||
oct_mach_info::float_format to_fmt | oct_mach_info::float_format to_fmt | |||
= oct_mach_info::native_float_format ()); | = oct_mach_info::native_float_format ()); | |||
extern OCTAVE_API void | extern OCTAVE_API void | |||
do_float_format_conversion (void *data, size_t sz, octave_idx_type len, | do_float_format_conversion (void *data, size_t sz, octave_idx_type len, | |||
oct_mach_info::float_format from_fmt, | oct_mach_info::float_format from_fmt, | |||
oct_mach_info::float_format to_fmt | oct_mach_info::float_format to_fmt | |||
= oct_mach_info::native_float_format ()); | = oct_mach_info::native_float_format ()); | |||
extern OCTAVE_API void | extern OCTAVE_API void | |||
read_doubles (std::istream& is, double *data, save_type type, | read_doubles (std::istream& is, double *data, save_type type, | |||
octave_idx_type len, bool swap, oct_mach_info::float_format f mt); | octave_idx_type len, bool swap, oct_mach_info::float_format f mt); | |||
extern OCTAVE_API void | extern OCTAVE_API void | |||
write_doubles (std::ostream& os, const double *data, save_type type, | write_doubles (std::ostream& os, const double *data, save_type type, | |||
octave_idx_type len); | octave_idx_type len); | |||
extern OCTAVE_API void | extern OCTAVE_API void | |||
read_floats (std::istream& is, float *data, save_type type, | read_floats (std::istream& is, float *data, save_type type, | |||
octave_idx_type len, bool swap, oct_mach_info::float_format fm t); | octave_idx_type len, bool swap, oct_mach_info::float_format fm t); | |||
extern OCTAVE_API void | extern OCTAVE_API void | |||
write_floats (std::ostream& os, const float *data, save_type type, | write_floats (std::ostream& os, const float *data, save_type type, | |||
octave_idx_type len); | octave_idx_type len); | |||
template <typename T> | ||||
inline bool | ||||
is_equivalent_type (oct_data_conv::data_type) | ||||
{ | ||||
return false; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<int8_t> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_int8; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<int16_t> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_int16; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<int32_t> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_int32; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<int64_t> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_int64; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<uint8_t> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_uint8; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<uint16_t> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_uint16; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<uint32_t> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_uint32; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<uint64_t> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_uint64; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<octave_int8> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_int8; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<octave_int16> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_int16; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<octave_int32> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_int32; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<octave_int64> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_int64; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<octave_uint8> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_uint8; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<octave_uint16> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_uint16; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<octave_uint32> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_uint32; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<octave_uint64> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_uint64; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<double> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_double; | ||||
} | ||||
template <> | ||||
inline bool | ||||
is_equivalent_type<float> (oct_data_conv::data_type t) | ||||
{ | ||||
return t == oct_data_conv::dt_single || t == oct_data_conv::dt_float; | ||||
} | ||||
#endif | #endif | |||
End of changes. 9 change blocks. | ||||
43 lines changed or deleted | 179 lines changed or added | |||
data.h | data.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2012 John W. Eaton | Copyright (C) 2012-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
dbleAEPBAL.h | dbleAEPBAL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_AEPBALANCE_h) | #if !defined (octave_dbleAEPBAL_h) | |||
#define octave_AEPBALANCE_h 1 | #define octave_dbleAEPBAL_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "base-aepbal.h" | #include "base-aepbal.h" | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
#include "dColVector.h" | #include "dColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
dbleCHOL.h | dbleCHOL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_CHOL_h) | #if !defined (octave_dbleCHOL_h) | |||
#define octave_CHOL_h 1 | #define octave_dbleCHOL_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
#include "dColVector.h" | #include "dColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
CHOL | CHOL | |||
{ | { | |||
public: | public: | |||
CHOL (void) : chol_mat (), xrcond (0) { } | CHOL (void) : chol_mat (), xrcond (0) { } | |||
CHOL (const Matrix& a, bool calc_cond = false) | CHOL (const Matrix& a, bool calc_cond = false) | |||
: chol_mat (), xrcond (0) | : chol_mat (), xrcond (0) | |||
{ | { | |||
init (a, calc_cond); | init (a, calc_cond); | |||
} | } | |||
CHOL (const Matrix& a, octave_idx_type& info, bool calc_cond = false) | CHOL (const Matrix& a, octave_idx_type& info, bool calc_cond = false) | |||
: chol_mat (), xrcond (0) | : chol_mat (), xrcond (0) | |||
{ | { | |||
info = init (a, calc_cond); | info = init (a, calc_cond); | |||
} | } | |||
CHOL (const CHOL& a) : chol_mat (a.chol_mat), xrcond (a.xrcond) { } | CHOL (const CHOL& a) : chol_mat (a.chol_mat), xrcond (a.xrcond) { } | |||
CHOL& operator = (const CHOL& a) | CHOL& operator = (const CHOL& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
chol_mat = a.chol_mat; | chol_mat = a.chol_mat; | |||
xrcond = a.xrcond; | xrcond = a.xrcond; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
Matrix chol_matrix (void) const { return chol_mat; } | Matrix chol_matrix (void) const { return chol_mat; } | |||
double rcond (void) const { return xrcond; } | double rcond (void) const { return xrcond; } | |||
// Compute the inverse of a matrix using the Cholesky factorization. | // Compute the inverse of a matrix using the Cholesky factorization. | |||
Matrix inverse (void) const; | Matrix inverse (void) const; | |||
void set (const Matrix& R); | void set (const Matrix& R); | |||
End of changes. 5 change blocks. | ||||
17 lines changed or deleted | 17 lines changed or added | |||
dbleGEPBAL.h | dbleGEPBAL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_GEPBALANCE_h) | #if !defined (octave_dbleGEPBAL_h) | |||
#define octave_GEPBALANCE_h 1 | #define octave_dbleGEPBAL_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
GEPBALANCE | GEPBALANCE | |||
{ | { | |||
public: | public: | |||
GEPBALANCE (void) | GEPBALANCE (void) | |||
: balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | |||
{ } | { } | |||
GEPBALANCE (const Matrix& a, const Matrix& b, const std::string& balance_ job) | GEPBALANCE (const Matrix& a, const Matrix& b, const std::string& balance_ job) | |||
: balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | |||
{ | { | |||
init (a, b, balance_job); | init (a, b, balance_job); | |||
} | } | |||
GEPBALANCE (const GEPBALANCE& a) | GEPBALANCE (const GEPBALANCE& a) | |||
: balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2), | : balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2), | |||
balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2) | balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2) | |||
{ } | { } | |||
GEPBALANCE& operator = (const GEPBALANCE& a) | GEPBALANCE& operator = (const GEPBALANCE& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
balanced_mat = a.balanced_mat; | balanced_mat = a.balanced_mat; | |||
balanced_mat2 = a.balanced_mat2; | balanced_mat2 = a.balanced_mat2; | |||
balancing_mat = a.balancing_mat; | balancing_mat = a.balancing_mat; | |||
balancing_mat2 = a.balancing_mat2; | balancing_mat2 = a.balancing_mat2; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~GEPBALANCE (void) { } | ~GEPBALANCE (void) { } | |||
Matrix balanced_matrix (void) const { return balanced_mat; } | Matrix balanced_matrix (void) const { return balanced_mat; } | |||
Matrix balanced_matrix2 (void) const { return balanced_mat2; } | Matrix balanced_matrix2 (void) const { return balanced_mat2; } | |||
Matrix balancing_matrix (void) const { return balancing_mat; } | Matrix balancing_matrix (void) const { return balancing_mat; } | |||
Matrix balancing_matrix2 (void) const { return balancing_mat2; } | Matrix balancing_matrix2 (void) const { return balancing_mat2; } | |||
End of changes. 6 change blocks. | ||||
18 lines changed or deleted | 18 lines changed or added | |||
dbleHESS.h | dbleHESS.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_HESS_h) | #if !defined (octave_dbleHESS_h) | |||
#define octave_HESS_h 1 | #define octave_dbleHESS_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
HESS | HESS | |||
{ | { | |||
public: | public: | |||
HESS (void) : hess_mat (), unitary_hess_mat () { } | HESS (void) : hess_mat (), unitary_hess_mat () { } | |||
HESS (const Matrix& a) : hess_mat (), unitary_hess_mat () { init (a); } | HESS (const Matrix& a) : hess_mat (), unitary_hess_mat () { init (a); } | |||
HESS (const Matrix& a, octave_idx_type& info) | HESS (const Matrix& a, octave_idx_type& info) | |||
: hess_mat (), unitary_hess_mat () | : hess_mat (), unitary_hess_mat () | |||
{ | { | |||
info = init (a); | info = init (a); | |||
} | } | |||
HESS (const HESS& a) | HESS (const HESS& a) | |||
: hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } | : hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } | |||
HESS& operator = (const HESS& a) | HESS& operator = (const HESS& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
hess_mat = a.hess_mat; | hess_mat = a.hess_mat; | |||
unitary_hess_mat = a.unitary_hess_mat; | unitary_hess_mat = a.unitary_hess_mat; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~HESS (void) { } | ~HESS (void) { } | |||
Matrix hess_matrix (void) const { return hess_mat; } | Matrix hess_matrix (void) const { return hess_mat; } | |||
Matrix unitary_hess_matrix (void) const { return unitary_hess_mat; } | Matrix unitary_hess_matrix (void) const { return unitary_hess_mat; } | |||
friend std::ostream& operator << (std::ostream& os, const HESS& a); | friend std::ostream& operator << (std::ostream& os, const HESS& a); | |||
private: | private: | |||
End of changes. 4 change blocks. | ||||
14 lines changed or deleted | 14 lines changed or added | |||
dbleLU.h | dbleLU.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_LU_h) | #if !defined (octave_dbleLU_h) | |||
#define octave_LU_h 1 | #define octave_dbleLU_h 1 | |||
#include "base-lu.h" | #include "base-lu.h" | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
LU : public base_lu <Matrix> | LU : public base_lu <Matrix> | |||
{ | { | |||
public: | public: | |||
LU (void) : base_lu <Matrix> () { } | LU (void) : base_lu <Matrix> () { } | |||
LU (const Matrix& a); | LU (const Matrix& a); | |||
LU (const LU& a) : base_lu <Matrix> (a) { } | LU (const LU& a) : base_lu <Matrix> (a) { } | |||
LU (const Matrix& l, const Matrix& u, const PermMatrix& p) | LU (const Matrix& l, const Matrix& u, const PermMatrix& p) | |||
: base_lu <Matrix> (l, u, p) { } | : base_lu <Matrix> (l, u, p) { } | |||
LU& operator = (const LU& a) | LU& operator = (const LU& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
base_lu <Matrix> :: operator = (a); | base_lu <Matrix> :: operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
~LU (void) { } | ~LU (void) { } | |||
void update (const ColumnVector& u, const ColumnVector& v); | void update (const ColumnVector& u, const ColumnVector& v); | |||
void update (const Matrix& u, const Matrix& v); | void update (const Matrix& u, const Matrix& v); | |||
void update_piv (const ColumnVector& u, const ColumnVector& v); | void update_piv (const ColumnVector& u, const ColumnVector& v); | |||
void update_piv (const Matrix& u, const Matrix& v); | void update_piv (const Matrix& u, const Matrix& v); | |||
End of changes. 4 change blocks. | ||||
8 lines changed or deleted | 8 lines changed or added | |||
dbleQR.h | dbleQR.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_QR_h) | #if !defined (octave_dbleQR_h) | |||
#define octave_QR_h 1 | #define octave_dbleQR_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
#include "dColVector.h" | #include "dColVector.h" | |||
#include "dRowVector.h" | #include "dRowVector.h" | |||
#include "base-qr.h" | #include "base-qr.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
dbleQRP.h | dbleQRP.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_QRP_h) | #if !defined (octave_dbleQRP_h) | |||
#define octave_QRP_h 1 | #define octave_dbleQRP_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "dbleQR.h" | #include "dbleQR.h" | |||
#include "PermMatrix.h" | #include "PermMatrix.h" | |||
#include "dColVector.h" | #include "dColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
QRP : public QR | QRP : public QR | |||
{ | { | |||
public: | public: | |||
QRP (void) : QR (), p () { } | QRP (void) : QR (), p () { } | |||
QRP (const Matrix&, qr_type_t = qr_type_std); | QRP (const Matrix&, qr_type_t = qr_type_std); | |||
QRP (const QRP& a) : QR (a), p (a.p) { } | QRP (const QRP& a) : QR (a), p (a.p) { } | |||
QRP& operator = (const QRP& a) | QRP& operator = (const QRP& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
QR::operator = (a); | QR::operator = (a); | |||
p = a.p; | p = a.p; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~QRP (void) { } | ~QRP (void) { } | |||
void init (const Matrix&, qr_type_t = qr_type_std); | void init (const Matrix&, qr_type_t = qr_type_std); | |||
PermMatrix P (void) const { return p; } | PermMatrix P (void) const { return p; } | |||
RowVector Pvec (void) const; | RowVector Pvec (void) const; | |||
friend std::ostream& operator << (std::ostream&, const QRP&); | friend std::ostream& operator << (std::ostream&, const QRP&); | |||
End of changes. 4 change blocks. | ||||
11 lines changed or deleted | 11 lines changed or added | |||
dbleSCHUR.h | dbleSCHUR.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_SCHUR_h) | #if !defined (octave_dbleSCHUR_h) | |||
#define octave_SCHUR_h 1 | #define octave_dbleSCHUR_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
SCHUR | SCHUR | |||
{ | { | |||
public: | public: | |||
SCHUR (void) : schur_mat (), unitary_mat (), selector (0) { } | SCHUR (void) : schur_mat (), unitary_mat (), selector (0) { } | |||
SCHUR (const Matrix& a, const std::string& ord, bool calc_unitary = true) | SCHUR (const Matrix& a, const std::string& ord, bool calc_unitary = true) | |||
: schur_mat (), unitary_mat (), selector (0) | : schur_mat (), unitary_mat (), selector (0) | |||
{ | { | |||
init (a, ord, calc_unitary); | init (a, ord, calc_unitary); | |||
} | } | |||
SCHUR (const Matrix& a, const std::string& ord, int& info, | SCHUR (const Matrix& a, const std::string& ord, int& info, | |||
bool calc_unitary = true) | bool calc_unitary = true) | |||
: schur_mat (), unitary_mat (), selector (0) | : schur_mat (), unitary_mat (), selector (0) | |||
{ | { | |||
info = init (a, ord, calc_unitary); | info = init (a, ord, calc_unitary); | |||
} | } | |||
SCHUR (const SCHUR& a) | SCHUR (const SCHUR& a) | |||
: schur_mat (a.schur_mat), unitary_mat (a.unitary_mat), selector (0) | : schur_mat (a.schur_mat), unitary_mat (a.unitary_mat), selector (0) | |||
{ } | { } | |||
SCHUR (const Matrix& s, const Matrix& u); | SCHUR (const Matrix& s, const Matrix& u); | |||
SCHUR& operator = (const SCHUR& a) | SCHUR& operator = (const SCHUR& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
schur_mat = a.schur_mat; | schur_mat = a.schur_mat; | |||
unitary_mat = a.unitary_mat; | unitary_mat = a.unitary_mat; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~SCHUR (void) { } | ~SCHUR (void) { } | |||
Matrix schur_matrix (void) const { return schur_mat; } | Matrix schur_matrix (void) const { return schur_mat; } | |||
Matrix unitary_matrix (void) const { return unitary_mat; } | Matrix unitary_matrix (void) const { return unitary_mat; } | |||
friend std::ostream& operator << (std::ostream& os, const SCHUR& a); | friend std::ostream& operator << (std::ostream& os, const SCHUR& a); | |||
typedef octave_idx_type (*select_function) (const double&, const double&) ; | typedef octave_idx_type (*select_function) (const double&, const double&) ; | |||
private: | private: | |||
Matrix schur_mat; | Matrix schur_mat; | |||
Matrix unitary_mat; | Matrix unitary_mat; | |||
select_function selector; | select_function selector; | |||
octave_idx_type init (const Matrix& a, const std::string& ord, bool calc_ | octave_idx_type init (const Matrix& a, const std::string& ord, | |||
unitary); | bool calc_unitary); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
20 lines changed or deleted | 20 lines changed or added | |||
dbleSVD.h | dbleSVD.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_SVD_h) | #if !defined (octave_dbleSVD_h) | |||
#define octave_SVD_h 1 | #define octave_dbleSVD_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "dDiagMatrix.h" | #include "dDiagMatrix.h" | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
SVD | SVD | |||
{ | { | |||
public: | public: | |||
enum type | enum type | |||
{ | { | |||
std, | std, | |||
economy, | economy, | |||
sigma_only | sigma_only | |||
}; | }; | |||
enum driver | enum driver | |||
{ | { | |||
GESVD, | GESVD, | |||
GESDD | GESDD | |||
}; | }; | |||
SVD (void) : type_computed (), sigma (), left_sm (), right_sm () { } | SVD (void) : type_computed (), sigma (), left_sm (), right_sm () { } | |||
SVD (const Matrix& a, | SVD (const Matrix& a, | |||
type svd_type = SVD::std, driver svd_driver = SVD::GESVD) | type svd_type = SVD::std, driver svd_driver = SVD::GESVD) | |||
: type_computed (), sigma (), left_sm (), right_sm () | : type_computed (), sigma (), left_sm (), right_sm () | |||
{ | { | |||
init (a, svd_type, svd_driver); | init (a, svd_type, svd_driver); | |||
} | } | |||
SVD (const Matrix& a, octave_idx_type& info, | SVD (const Matrix& a, octave_idx_type& info, | |||
type svd_type = SVD::std, driver svd_driver = SVD::GESVD) | type svd_type = SVD::std, driver svd_driver = SVD::GESVD) | |||
: type_computed (), sigma (), left_sm (), right_sm () | : type_computed (), sigma (), left_sm (), right_sm () | |||
{ | { | |||
info = init (a, svd_type, svd_driver); | info = init (a, svd_type, svd_driver); | |||
} | } | |||
SVD (const SVD& a) | SVD (const SVD& a) | |||
: type_computed (a.type_computed), sigma (a.sigma), | : type_computed (a.type_computed), sigma (a.sigma), | |||
left_sm (a.left_sm), right_sm (a.right_sm) | left_sm (a.left_sm), right_sm (a.right_sm) | |||
{ } | { } | |||
SVD& operator = (const SVD& a) | SVD& operator = (const SVD& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
type_computed = a.type_computed; | type_computed = a.type_computed; | |||
sigma = a.sigma; | sigma = a.sigma; | |||
left_sm = a.left_sm; | left_sm = a.left_sm; | |||
right_sm = a.right_sm; | right_sm = a.right_sm; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~SVD (void) { } | ~SVD (void) { } | |||
DiagMatrix singular_values (void) const { return sigma; } | DiagMatrix singular_values (void) const { return sigma; } | |||
Matrix left_singular_matrix (void) const; | Matrix left_singular_matrix (void) const; | |||
Matrix right_singular_matrix (void) const; | Matrix right_singular_matrix (void) const; | |||
friend std::ostream& operator << (std::ostream& os, const SVD& a); | friend std::ostream& operator << (std::ostream& os, const SVD& a); | |||
End of changes. 9 change blocks. | ||||
29 lines changed or deleted | 29 lines changed or added | |||
debug.h | debug.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2001-2012 Ben Sapp | Copyright (C) 2001-2013 Ben Sapp | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 118 | skipping to change at line 118 | |||
typedef std::set<std::string>::const_iterator const_bp_set_iterator; | typedef std::set<std::string>::const_iterator const_bp_set_iterator; | |||
typedef std::set<std::string>::iterator bp_set_iterator; | typedef std::set<std::string>::iterator bp_set_iterator; | |||
// Set of function names containing at least one breakpoint. | // Set of function names containing at least one breakpoint. | |||
std::set<std::string> bp_set; | std::set<std::string> bp_set; | |||
static bp_table *instance; | static bp_table *instance; | |||
static void cleanup_instance (void) { delete instance; instance = 0; } | static void cleanup_instance (void) { delete instance; instance = 0; } | |||
bool do_add_breakpoint_1 (octave_user_code *fcn, const std::string& fname | ||||
, | ||||
const intmap& line, intmap& retval); | ||||
intmap do_add_breakpoint (const std::string& fname, const intmap& lines); | intmap do_add_breakpoint (const std::string& fname, const intmap& lines); | |||
int do_remove_breakpoint_1 (octave_user_code *fcn, const std::string&, | ||||
const intmap& lines); | ||||
int do_remove_breakpoint (const std::string&, const intmap& lines); | int do_remove_breakpoint (const std::string&, const intmap& lines); | |||
intmap do_remove_all_breakpoints_in_file_1 (octave_user_code *fcn, | ||||
const std::string& fname); | ||||
intmap do_remove_all_breakpoints_in_file (const std::string& fname, | intmap do_remove_all_breakpoints_in_file (const std::string& fname, | |||
bool silent); | bool silent); | |||
void do_remove_all_breakpoints (void); | void do_remove_all_breakpoints (void); | |||
fname_line_map do_get_breakpoint_list (const octave_value_list& fname_lis t); | fname_line_map do_get_breakpoint_list (const octave_value_list& fname_lis t); | |||
bool do_have_breakpoints (void) { return (! bp_set.empty ()); } | bool do_have_breakpoints (void) { return (! bp_set.empty ()); } | |||
}; | }; | |||
std::string get_file_line (const std::string& fname, size_t line); | extern std::string get_file_line (const std::string& fname, size_t line); | |||
#endif | #endif | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 12 lines changed or added | |||
defaults.h | defaults.h | |||
---|---|---|---|---|
// defaults.h.in | // DO NOT EDIT! Generated automatically from defaults.in.h by Make. | |||
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 40 | skipping to change at line 40 | |||
#ifndef OCTAVE_CANONICAL_HOST_TYPE | #ifndef OCTAVE_CANONICAL_HOST_TYPE | |||
#define OCTAVE_CANONICAL_HOST_TYPE "i686-pc-linux-gnu" | #define OCTAVE_CANONICAL_HOST_TYPE "i686-pc-linux-gnu" | |||
#endif | #endif | |||
#ifndef OCTAVE_DEFAULT_PAGER | #ifndef OCTAVE_DEFAULT_PAGER | |||
#define OCTAVE_DEFAULT_PAGER "less" | #define OCTAVE_DEFAULT_PAGER "less" | |||
#endif | #endif | |||
#ifndef OCTAVE_ARCHLIBDIR | #ifndef OCTAVE_ARCHLIBDIR | |||
#define OCTAVE_ARCHLIBDIR "/home/ut/testing/octave/3.6.4/libexec/octave/3.6 .4/exec/i686-pc-linux-gnu" | #define OCTAVE_ARCHLIBDIR "/home/ut/testing/octave/3.8.0/libexec/octave/3.8 .0/exec/i686-pc-linux-gnu" | |||
#endif | #endif | |||
#ifndef OCTAVE_BINDIR | #ifndef OCTAVE_BINDIR | |||
#define OCTAVE_BINDIR "/home/ut/testing/octave/3.6.4/bin" | #define OCTAVE_BINDIR "/home/ut/testing/octave/3.8.0/bin" | |||
#endif | #endif | |||
#ifndef OCTAVE_DATADIR | #ifndef OCTAVE_DATADIR | |||
#define OCTAVE_DATADIR "admin" | #define OCTAVE_DATADIR "/home/ut/testing/octave/3.8.0/share" | |||
#endif | #endif | |||
#ifndef OCTAVE_DATAROOTDIR | #ifndef OCTAVE_DATAROOTDIR | |||
#define OCTAVE_DATAROOTDIR "admin" | #define OCTAVE_DATAROOTDIR "/home/ut/testing/octave/3.8.0/share" | |||
#endif | #endif | |||
#ifndef OCTAVE_DOC_CACHE_FILE | #ifndef OCTAVE_DOC_CACHE_FILE | |||
#define OCTAVE_DOC_CACHE_FILE "admin/octave/3.6.4/etc/doc-cache" | #define OCTAVE_DOC_CACHE_FILE "/home/ut/testing/octave/3.8.0/share/octave/3 | |||
.8.0/etc/doc-cache" | ||||
#endif | ||||
#ifndef OCTAVE_TEXI_MACROS_FILE | ||||
#define OCTAVE_TEXI_MACROS_FILE "/home/ut/testing/octave/3.8.0/share/octave | ||||
/3.8.0/etc/macros.texi" | ||||
#endif | #endif | |||
#ifndef OCTAVE_EXEC_PREFIX | #ifndef OCTAVE_EXEC_PREFIX | |||
#define OCTAVE_EXEC_PREFIX "/home/ut/testing/octave/3.6.4" | #define OCTAVE_EXEC_PREFIX "/home/ut/testing/octave/3.8.0" | |||
#endif | #endif | |||
#ifndef OCTAVE_FCNFILEDIR | #ifndef OCTAVE_FCNFILEDIR | |||
#define OCTAVE_FCNFILEDIR "admin/octave/3.6.4/m" | #define OCTAVE_FCNFILEDIR "/home/ut/testing/octave/3.8.0/share/octave/3.8.0 /m" | |||
#endif | #endif | |||
#ifndef OCTAVE_IMAGEDIR | #ifndef OCTAVE_IMAGEDIR | |||
#define OCTAVE_IMAGEDIR "admin/octave/3.6.4/imagelib" | #define OCTAVE_IMAGEDIR "/home/ut/testing/octave/3.8.0/share/octave/3.8.0/i magelib" | |||
#endif | #endif | |||
#ifndef OCTAVE_INCLUDEDIR | #ifndef OCTAVE_INCLUDEDIR | |||
#define OCTAVE_INCLUDEDIR "/home/ut/testing/octave/3.6.4/include" | #define OCTAVE_INCLUDEDIR "/home/ut/testing/octave/3.8.0/include" | |||
#endif | #endif | |||
#ifndef OCTAVE_INFODIR | #ifndef OCTAVE_INFODIR | |||
#define OCTAVE_INFODIR "admin/info" | #define OCTAVE_INFODIR "/home/ut/testing/octave/3.8.0/share/info" | |||
#endif | #endif | |||
#ifndef OCTAVE_INFOFILE | #ifndef OCTAVE_INFOFILE | |||
#define OCTAVE_INFOFILE "admin/info/octave.info" | #define OCTAVE_INFOFILE "/home/ut/testing/octave/3.8.0/share/info/octave.in fo" | |||
#endif | #endif | |||
#ifndef OCTAVE_LIBDIR | #ifndef OCTAVE_LIBDIR | |||
#define OCTAVE_LIBDIR "/home/ut/testing/octave/3.6.4/lib" | #define OCTAVE_LIBDIR "/home/ut/testing/octave/3.8.0/lib" | |||
#endif | #endif | |||
#ifndef OCTAVE_LIBEXECDIR | #ifndef OCTAVE_LIBEXECDIR | |||
#define OCTAVE_LIBEXECDIR "/home/ut/testing/octave/3.6.4/libexec" | #define OCTAVE_LIBEXECDIR "/home/ut/testing/octave/3.8.0/libexec" | |||
#endif | #endif | |||
#ifndef OCTAVE_LIBEXECDIR | #ifndef OCTAVE_LIBEXECDIR | |||
#define OCTAVE_LIBEXECDIR "/home/ut/testing/octave/3.6.4/libexec" | #define OCTAVE_LIBEXECDIR "/home/ut/testing/octave/3.8.0/libexec" | |||
#endif | #endif | |||
#ifndef OCTAVE_LOCALAPIFCNFILEDIR | #ifndef OCTAVE_LOCALAPIFCNFILEDIR | |||
#define OCTAVE_LOCALAPIFCNFILEDIR "admin/octave/site/api-v48+/m" | #define OCTAVE_LOCALAPIFCNFILEDIR "/home/ut/testing/octave/3.8.0/share/octa ve/site/api-v49+/m" | |||
#endif | #endif | |||
#ifndef OCTAVE_LOCALAPIOCTFILEDIR | #ifndef OCTAVE_LOCALAPIOCTFILEDIR | |||
#define OCTAVE_LOCALAPIOCTFILEDIR "/home/ut/testing/octave/3.6.4/lib/octave /site/oct/api-v48+/i686-pc-linux-gnu" | #define OCTAVE_LOCALAPIOCTFILEDIR "/home/ut/testing/octave/3.8.0/lib/octave /site/oct/api-v49+/i686-pc-linux-gnu" | |||
#endif | #endif | |||
#ifndef OCTAVE_LOCALARCHLIBDIR | #ifndef OCTAVE_LOCALARCHLIBDIR | |||
#define OCTAVE_LOCALARCHLIBDIR "/home/ut/testing/octave/3.6.4/libexec/octav e/site/exec/i686-pc-linux-gnu" | #define OCTAVE_LOCALARCHLIBDIR "/home/ut/testing/octave/3.8.0/libexec/octav e/site/exec/i686-pc-linux-gnu" | |||
#endif | #endif | |||
#ifndef OCTAVE_LOCALFCNFILEDIR | #ifndef OCTAVE_LOCALFCNFILEDIR | |||
#define OCTAVE_LOCALFCNFILEDIR "admin/octave/site/m" | #define OCTAVE_LOCALFCNFILEDIR "/home/ut/testing/octave/3.8.0/share/octave/ site/m" | |||
#endif | #endif | |||
#ifndef OCTAVE_LOCALOCTFILEDIR | #ifndef OCTAVE_LOCALOCTFILEDIR | |||
#define OCTAVE_LOCALOCTFILEDIR "/home/ut/testing/octave/3.6.4/lib/octave/si te/oct/i686-pc-linux-gnu" | #define OCTAVE_LOCALOCTFILEDIR "/home/ut/testing/octave/3.8.0/lib/octave/si te/oct/i686-pc-linux-gnu" | |||
#endif | #endif | |||
#ifndef OCTAVE_LOCALSTARTUPFILEDIR | #ifndef OCTAVE_LOCALSTARTUPFILEDIR | |||
#define OCTAVE_LOCALSTARTUPFILEDIR "admin/octave/site/m/startup" | #define OCTAVE_LOCALSTARTUPFILEDIR "/home/ut/testing/octave/3.8.0/share/oct ave/site/m/startup" | |||
#endif | #endif | |||
#ifndef OCTAVE_LOCALAPIARCHLIBDIR | #ifndef OCTAVE_LOCALAPIARCHLIBDIR | |||
#define OCTAVE_LOCALAPIARCHLIBDIR "/home/ut/testing/octave/3.6.4/libexec/oc tave/api-v48+/site/exec/i686-pc-linux-gnu" | #define OCTAVE_LOCALAPIARCHLIBDIR "/home/ut/testing/octave/3.8.0/libexec/oc tave/api-v49+/site/exec/i686-pc-linux-gnu" | |||
#endif | #endif | |||
#ifndef OCTAVE_LOCALVERARCHLIBDIR | #ifndef OCTAVE_LOCALVERARCHLIBDIR | |||
#define OCTAVE_LOCALVERARCHLIBDIR "/home/ut/testing/octave/3.6.4/libexec/oc tave/3.6.4/site/exec/i686-pc-linux-gnu" | #define OCTAVE_LOCALVERARCHLIBDIR "/home/ut/testing/octave/3.8.0/libexec/oc tave/3.8.0/site/exec/i686-pc-linux-gnu" | |||
#endif | #endif | |||
#ifndef OCTAVE_LOCALVERFCNFILEDIR | #ifndef OCTAVE_LOCALVERFCNFILEDIR | |||
#define OCTAVE_LOCALVERFCNFILEDIR "admin/octave/3.6.4/site/m" | #define OCTAVE_LOCALVERFCNFILEDIR "/home/ut/testing/octave/3.8.0/share/octa ve/3.8.0/site/m" | |||
#endif | #endif | |||
#ifndef OCTAVE_LOCALVEROCTFILEDIR | #ifndef OCTAVE_LOCALVEROCTFILEDIR | |||
#define OCTAVE_LOCALVEROCTFILEDIR "/home/ut/testing/octave/3.6.4/lib/octave /3.6.4/site/oct/i686-pc-linux-gnu" | #define OCTAVE_LOCALVEROCTFILEDIR "/home/ut/testing/octave/3.8.0/lib/octave /3.8.0/site/oct/i686-pc-linux-gnu" | |||
#endif | #endif | |||
#ifndef OCTAVE_MAN1DIR | #ifndef OCTAVE_MAN1DIR | |||
#define OCTAVE_MAN1DIR "admin/man/man1" | #define OCTAVE_MAN1DIR "/home/ut/testing/octave/3.8.0/share/man/man1" | |||
#endif | #endif | |||
#ifndef OCTAVE_MAN1EXT | #ifndef OCTAVE_MAN1EXT | |||
#define OCTAVE_MAN1EXT ".1" | #define OCTAVE_MAN1EXT ".1" | |||
#endif | #endif | |||
#ifndef OCTAVE_MANDIR | #ifndef OCTAVE_MANDIR | |||
#define OCTAVE_MANDIR "admin/man" | #define OCTAVE_MANDIR "/home/ut/testing/octave/3.8.0/share/man" | |||
#endif | #endif | |||
#ifndef OCTAVE_OCTFILEDIR | #ifndef OCTAVE_OCTFILEDIR | |||
#define OCTAVE_OCTFILEDIR "/home/ut/testing/octave/3.6.4/lib/octave/3.6.4/o ct/i686-pc-linux-gnu" | #define OCTAVE_OCTFILEDIR "/home/ut/testing/octave/3.8.0/lib/octave/3.8.0/o ct/i686-pc-linux-gnu" | |||
#endif | #endif | |||
#ifndef OCTAVE_OCTETCDIR | #ifndef OCTAVE_OCTETCDIR | |||
#define OCTAVE_OCTETCDIR "admin/octave/3.6.4/etc" | #define OCTAVE_OCTETCDIR "/home/ut/testing/octave/3.8.0/share/octave/3.8.0/ | |||
etc" | ||||
#endif | ||||
#ifndef OCTAVE_OCTLOCALEDIR | ||||
#define OCTAVE_OCTLOCALEDIR "/home/ut/testing/octave/3.8.0/share/octave/3.8 | ||||
.0/locale" | ||||
#endif | #endif | |||
#ifndef OCTAVE_OCTINCLUDEDIR | #ifndef OCTAVE_OCTINCLUDEDIR | |||
#define OCTAVE_OCTINCLUDEDIR "/home/ut/testing/octave/3.6.4/include/octave- 3.6.4/octave" | #define OCTAVE_OCTINCLUDEDIR "/home/ut/testing/octave/3.8.0/include/octave- 3.8.0/octave" | |||
#endif | #endif | |||
#ifndef OCTAVE_OCTLIBDIR | #ifndef OCTAVE_OCTLIBDIR | |||
#define OCTAVE_OCTLIBDIR "/home/ut/testing/octave/3.6.4/lib/octave/3.6.4" | #define OCTAVE_OCTLIBDIR "/home/ut/testing/octave/3.8.0/lib/octave/3.8.0" | |||
#endif | ||||
#ifndef OCTAVE_OCTTESTSDIR | ||||
#define OCTAVE_OCTTESTSDIR "/home/ut/testing/octave/3.8.0/share/octave/3.8. | ||||
0/etc/tests" | ||||
#endif | #endif | |||
#ifndef OCTAVE_PREFIX | #ifndef OCTAVE_PREFIX | |||
#define OCTAVE_PREFIX "/home/ut/testing/octave/3.6.4" | #define OCTAVE_PREFIX "/home/ut/testing/octave/3.8.0" | |||
#endif | #endif | |||
#ifndef OCTAVE_STARTUPFILEDIR | #ifndef OCTAVE_STARTUPFILEDIR | |||
#define OCTAVE_STARTUPFILEDIR "admin/octave/3.6.4/m/startup" | #define OCTAVE_STARTUPFILEDIR "/home/ut/testing/octave/3.8.0/share/octave/3 .8.0/m/startup" | |||
#endif | #endif | |||
#ifndef OCTAVE_RELEASE | #ifndef OCTAVE_RELEASE | |||
#define OCTAVE_RELEASE "" | #define OCTAVE_RELEASE "" | |||
#endif | #endif | |||
extern std::string Voctave_home; | extern OCTINTERP_API std::string Voctave_home; | |||
extern OCTINTERP_API std::string Vbin_dir; | ||||
extern OCTINTERP_API std::string Vinfo_dir; | ||||
extern OCTINTERP_API std::string Vdata_dir; | ||||
extern OCTINTERP_API std::string Vlibexec_dir; | ||||
extern OCTINTERP_API std::string Varch_lib_dir; | ||||
extern OCTINTERP_API std::string Vlocal_arch_lib_dir; | ||||
extern OCTINTERP_API std::string Vlocal_ver_arch_lib_dir; | ||||
extern OCTINTERP_API std::string Vlocal_ver_oct_file_dir; | ||||
extern OCTINTERP_API std::string Vlocal_api_oct_file_dir; | ||||
extern OCTINTERP_API std::string Vlocal_oct_file_dir; | ||||
extern OCTINTERP_API std::string Vlocal_ver_fcn_file_dir; | ||||
extern OCTINTERP_API std::string Vlocal_api_fcn_file_dir; | ||||
extern OCTINTERP_API std::string Vlocal_fcn_file_dir; | ||||
extern std::string Vbin_dir; | extern OCTINTERP_API std::string Voct_etc_dir; | |||
extern std::string Vinfo_dir; | extern OCTINTERP_API std::string Voct_locale_dir; | |||
extern std::string Vdata_dir; | ||||
extern std::string Vlibexec_dir; | ||||
extern std::string Varch_lib_dir; | ||||
extern std::string Vlocal_arch_lib_dir; | ||||
extern std::string Vlocal_ver_arch_lib_dir; | ||||
extern std::string Vlocal_ver_oct_file_dir; | ||||
extern std::string Vlocal_api_oct_file_dir; | ||||
extern std::string Vlocal_oct_file_dir; | ||||
extern std::string Vlocal_ver_fcn_file_dir; | ||||
extern std::string Vlocal_api_fcn_file_dir; | ||||
extern std::string Vlocal_fcn_file_dir; | ||||
extern std::string Voct_file_dir; | extern OCTINTERP_API std::string Voct_file_dir; | |||
extern std::string Vfcn_file_dir; | extern OCTINTERP_API std::string Vfcn_file_dir; | |||
extern std::string Vimage_dir; | extern OCTINTERP_API std::string Vimage_dir; | |||
// Name of the editor to be invoked by the edit_history command. | // Name of the editor to be invoked by the edit_history command. | |||
extern std::string VEDITOR; | extern OCTINTERP_API std::string VEDITOR; | |||
extern std::string Vlocal_site_defaults_file; | extern OCTINTERP_API std::string Vlocal_site_defaults_file; | |||
extern std::string Vsite_defaults_file; | extern OCTINTERP_API std::string Vsite_defaults_file; | |||
extern OCTINTERP_API std::string Vbuilt_in_docstrings_file; | ||||
// Name of the FFTW wisdom program. | // Name of the FFTW wisdom program. | |||
extern OCTINTERP_API std::string Vfftw_wisdom_program; | extern OCTINTERP_API std::string Vfftw_wisdom_program; | |||
extern std::string subst_octave_home (const std::string&); | extern OCTINTERP_API std::string subst_octave_home (const std::string&); | |||
extern OCTINTERP_API void install_defaults (void); | ||||
extern void install_defaults (void); | extern OCTINTERP_API void | |||
set_exec_path (const std::string& path = std::string ()); | ||||
extern void set_exec_path (const std::string& path = std::string ()); | extern OCTINTERP_API void | |||
extern void set_image_path (const std::string& path = std::string ()); | set_image_path (const std::string& path = std::string ()); | |||
#endif | #endif | |||
End of changes. 43 change blocks. | ||||
60 lines changed or deleted | 85 lines changed or added | |||
defun-dld.h | defun-dld.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
defun-int.h | defun-int.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 38 | skipping to change at line 38 | |||
#include "ov-builtin.h" | #include "ov-builtin.h" | |||
#include "ov-dld-fcn.h" | #include "ov-dld-fcn.h" | |||
#include "symtab.h" | #include "symtab.h" | |||
#include "version.h" | #include "version.h" | |||
class octave_value; | class octave_value; | |||
extern OCTINTERP_API void print_usage (void); | extern OCTINTERP_API void print_usage (void); | |||
extern OCTINTERP_API void print_usage (const std::string&); | extern OCTINTERP_API void print_usage (const std::string&); | |||
extern OCTINTERP_API void check_version (const std::string& version, const | extern OCTINTERP_API void check_version (const std::string& version, | |||
std::string& fcn); | const std::string& fcn); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
install_builtin_function (octave_builtin::fcn f, const std::string& name, | install_builtin_function (octave_builtin::fcn f, const std::string& name, | |||
const std::string& doc, | const std::string& file, const std::string& doc, | |||
bool can_hide_function = true); | bool can_hide_function = true); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
install_dld_function (octave_dld_function::fcn f, const std::string& name, | install_dld_function (octave_dld_function::fcn f, const std::string& name, | |||
const octave_shlib& shl, const std::string& doc, | const octave_shlib& shl, const std::string& doc, | |||
bool relative = false); | bool relative = false); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
install_mex_function (void *fptr, bool fmex, const std::string& name, | install_mex_function (void *fptr, bool fmex, const std::string& name, | |||
const octave_shlib& shl, bool relative = false); | const octave_shlib& shl, bool relative = false); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
alias_builtin (const std::string& alias, const std::string& name); | alias_builtin (const std::string& alias, const std::string& name); | |||
// Gets the shlib of the currently executing DLD function, if any. | // Gets the shlib of the currently executing DLD function, if any. | |||
extern OCTINTERP_API octave_shlib | extern OCTINTERP_API octave_shlib | |||
get_current_shlib (void); | get_current_shlib (void); | |||
// This is a convenience class that calls the above function automatically at | // This is a convenience class that calls the above function automatically at | |||
// construction time. When deriving new classes, you can either use it as a | // construction time. When deriving new classes, you can either use it as a | |||
field | // field or as a parent (with multiple inheritance). | |||
// or as a parent (with multiple inheritance). | ||||
class octave_auto_shlib : public octave_shlib | class octave_auto_shlib : public octave_shlib | |||
{ | { | |||
public: | public: | |||
octave_auto_shlib (void) | octave_auto_shlib (void) | |||
: octave_shlib (get_current_shlib ()) { } | : octave_shlib (get_current_shlib ()) { } | |||
octave_auto_shlib (const octave_shlib& shl) | octave_auto_shlib (const octave_shlib& shl) | |||
: octave_shlib (shl) { } | : octave_shlib (shl) { } | |||
}; | }; | |||
skipping to change at line 93 | skipping to change at line 94 | |||
#define DECLARE_FUN(name, args_name, nargout_name) \ | #define DECLARE_FUN(name, args_name, nargout_name) \ | |||
DECLARE_FUNX (F ## name, args_name, nargout_name) | DECLARE_FUNX (F ## name, args_name, nargout_name) | |||
// Define the code that will be used to insert the new function into | // Define the code that will be used to insert the new function into | |||
// the symbol table. We look for this name instead of the actual | // the symbol table. We look for this name instead of the actual | |||
// function so that we can easily install the doc std::string too. | // function so that we can easily install the doc std::string too. | |||
typedef bool (*octave_dld_fcn_installer) (const octave_shlib&, bool relativ e); | typedef bool (*octave_dld_fcn_installer) (const octave_shlib&, bool relativ e); | |||
typedef octave_function * (*octave_dld_fcn_getter) (const octave_shlib&, bo | typedef octave_function * | |||
ol relative); | (*octave_dld_fcn_getter) (const octave_shlib&, bool relative); | |||
#define DEFINE_FUN_INSTALLER_FUN(name, doc) \ | #define DEFINE_FUN_INSTALLER_FUN(name, doc) \ | |||
DEFINE_FUNX_INSTALLER_FUN(#name, F ## name, G ## name, doc) | DEFINE_FUNX_INSTALLER_FUN(#name, F ## name, G ## name, doc) | |||
#define DEFINE_FUNX_INSTALLER_FUN(name, fname, gname, doc) \ | #define DEFINE_FUNX_INSTALLER_FUN(name, fname, gname, doc) \ | |||
extern "C" \ | extern "C" \ | |||
OCTAVE_EXPORT \ | OCTAVE_EXPORT \ | |||
octave_function * \ | octave_function * \ | |||
gname (const octave_shlib& shl, bool relative) \ | gname (const octave_shlib& shl, bool relative) \ | |||
{ \ | { \ | |||
End of changes. 5 change blocks. | ||||
9 lines changed or deleted | 8 lines changed or added | |||
defun.h | defun.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
dim-vector.h | dim-vector.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
Copyirght (C) 2009, 2010 VZLU Prague | Copyirght (C) 2009, 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 69 | skipping to change at line 69 | |||
octave_idx_type *rep; | octave_idx_type *rep; | |||
octave_idx_type& ndims (void) const { return rep[-1]; } | octave_idx_type& ndims (void) const { return rep[-1]; } | |||
octave_idx_type& count (void) const { return rep[-2]; } | octave_idx_type& count (void) const { return rep[-2]; } | |||
// Construct a new rep with count = 1 and ndims given. | // Construct a new rep with count = 1 and ndims given. | |||
static octave_idx_type *newrep (int ndims) | static octave_idx_type *newrep (int ndims) | |||
{ | { | |||
octave_idx_type *r = new octave_idx_type[ndims + 2]; | octave_idx_type *r = new octave_idx_type [ndims + 2]; | |||
*r++ = 1; | *r++ = 1; | |||
*r++ = ndims; | *r++ = ndims; | |||
return r; | return r; | |||
} | } | |||
// Clone this->rep. | // Clone this->rep. | |||
octave_idx_type *clonerep (void) | octave_idx_type *clonerep (void) | |||
{ | { | |||
int l = ndims (); | int l = ndims (); | |||
octave_idx_type *r = new octave_idx_type[l + 2]; | octave_idx_type *r = new octave_idx_type [l + 2]; | |||
*r++ = 1; | *r++ = 1; | |||
*r++ = l; | *r++ = l; | |||
for (int i = 0; i < l; i++) | for (int i = 0; i < l; i++) | |||
r[i] = rep[i]; | r[i] = rep[i]; | |||
return r; | return r; | |||
} | } | |||
// Clone and resize this->rep to length n, filling by given value. | // Clone and resize this->rep to length n, filling by given value. | |||
octave_idx_type *resizerep (int n, octave_idx_type fill_value) | octave_idx_type *resizerep (int n, octave_idx_type fill_value) | |||
{ | { | |||
int l = ndims (); | int l = ndims (); | |||
if (n < 2) | if (n < 2) | |||
n = 2; | n = 2; | |||
octave_idx_type *r = new octave_idx_type[n + 2]; | octave_idx_type *r = new octave_idx_type [n + 2]; | |||
*r++ = 1; | *r++ = 1; | |||
*r++ = n; | *r++ = n; | |||
if (l > n) | if (l > n) | |||
l = n; | l = n; | |||
int j; | int j; | |||
for (j = 0; j < l; j++) | for (j = 0; j < l; j++) | |||
r[j] = rep[j]; | r[j] = rep[j]; | |||
skipping to change at line 132 | skipping to change at line 132 | |||
void freerep (void) | void freerep (void) | |||
{ | { | |||
assert (count () == 0); | assert (count () == 0); | |||
delete [] (rep - 2); | delete [] (rep - 2); | |||
} | } | |||
void make_unique (void) | void make_unique (void) | |||
{ | { | |||
if (count () > 1) | if (count () > 1) | |||
{ | { | |||
octave_idx_type *new_rep = clonerep (); | octave_idx_type *new_rep = clonerep (); | |||
if (OCTREFCOUNT_ATOMIC_DECREMENT(&(count())) == 0) | if (OCTREFCOUNT_ATOMIC_DECREMENT(&(count())) == 0) | |||
freerep (); | freerep (); | |||
rep = new_rep; | rep = new_rep; | |||
} | } | |||
} | } | |||
public: | public: | |||
// The constructor | // The constructor | |||
// | // | |||
// dim_vector (n) | // dim_vector (n) | |||
skipping to change at line 215 | skipping to change at line 215 | |||
make_unique (); | make_unique (); | |||
do | do | |||
l--; | l--; | |||
while (l > 2 && rep[l-1] == 1); | while (l > 2 && rep[l-1] == 1); | |||
ndims () = l; | ndims () = l; | |||
} | } | |||
} | } | |||
void chop_all_singletons (void); | void chop_all_singletons (void); | |||
// WARNING: Only call by jit | ||||
octave_idx_type *to_jit (void) const | ||||
{ | ||||
return rep; | ||||
} | ||||
private: | private: | |||
static octave_idx_type *nil_rep (void) | static octave_idx_type *nil_rep (void) | |||
{ | { | |||
static dim_vector zv (0, 0); | static dim_vector zv (0, 0); | |||
return zv.rep; | return zv.rep; | |||
} | } | |||
explicit dim_vector (octave_idx_type *r) | ||||
: rep (r) { } | ||||
public: | public: | |||
static octave_idx_type dim_max (void); | static octave_idx_type dim_max (void); | |||
explicit dim_vector (void) : rep (nil_rep ()) | explicit dim_vector (void) : rep (nil_rep ()) | |||
{ OCTREFCOUNT_ATOMIC_INCREMENT (&(count())); } | { OCTREFCOUNT_ATOMIC_INCREMENT (&(count())); } | |||
dim_vector (const dim_vector& dv) : rep (dv.rep) | dim_vector (const dim_vector& dv) : rep (dv.rep) | |||
{ OCTREFCOUNT_ATOMIC_INCREMENT (&(count())); } | { OCTREFCOUNT_ATOMIC_INCREMENT (&(count())); } | |||
// FIXME: Should be private, but required by array constructor for jit | ||||
explicit dim_vector (octave_idx_type *r) : rep (r) { } | ||||
static dim_vector alloc (int n) | static dim_vector alloc (int n) | |||
{ | { | |||
return dim_vector (newrep (n < 2 ? 2 : n)); | return dim_vector (newrep (n < 2 ? 2 : n)); | |||
} | } | |||
dim_vector& operator = (const dim_vector& dv) | dim_vector& operator = (const dim_vector& dv) | |||
{ | { | |||
if (&dv != this) | if (&dv != this) | |||
{ | { | |||
if (OCTREFCOUNT_ATOMIC_DECREMENT (&(count())) == 0) | if (OCTREFCOUNT_ATOMIC_DECREMENT (&(count())) == 0) | |||
skipping to change at line 388 | skipping to change at line 394 | |||
bool hvcat (const dim_vector& dvb, int dim); | bool hvcat (const dim_vector& dvb, int dim); | |||
// Force certain dimensionality, preserving numel (). Missing | // Force certain dimensionality, preserving numel (). Missing | |||
// dimensions are set to 1, redundant are folded into the trailing | // dimensions are set to 1, redundant are folded into the trailing | |||
// one. If n = 1, the result is 2d and the second dim is 1 | // one. If n = 1, the result is 2d and the second dim is 1 | |||
// (dim_vectors are always at least 2D). | // (dim_vectors are always at least 2D). | |||
dim_vector redim (int n) const; | dim_vector redim (int n) const; | |||
dim_vector as_column (void) const | dim_vector as_column (void) const | |||
{ | { | |||
if (length () == 2 && elem (1) == 1) | if (length () == 2 && elem (1) == 1) | |||
return *this; | return *this; | |||
else | else | |||
return dim_vector (numel (), 1); | return dim_vector (numel (), 1); | |||
} | } | |||
dim_vector as_row (void) const | dim_vector as_row (void) const | |||
{ | { | |||
if (length () == 2 && elem (0) == 1) | if (length () == 2 && elem (0) == 1) | |||
return *this; | return *this; | |||
else | else | |||
return dim_vector (1, numel ()); | return dim_vector (1, numel ()); | |||
} | } | |||
bool is_vector (void) const | bool is_vector (void) const | |||
{ | { | |||
return (length () == 2 && (elem (0) == 1 || elem (1) == 1)); | return (length () == 2 && (elem (0) == 1 || elem (1) == 1)); | |||
} | } | |||
int first_non_singleton (int def = 0) const | int first_non_singleton (int def = 0) const | |||
{ | { | |||
for (int i = 0; i < length (); i++) | for (int i = 0; i < length (); i++) | |||
{ | { | |||
if (elem (i) != 1) | if (elem (i) != 1) | |||
return i; | return i; | |||
} | } | |||
return def; | return def; | |||
} | } | |||
// Compute a linear index from an index tuple. | // Compute a linear index from an index tuple. | |||
octave_idx_type compute_index (const octave_idx_type *idx) const | octave_idx_type compute_index (const octave_idx_type *idx) const | |||
{ | { | |||
octave_idx_type k = 0; | octave_idx_type k = 0; | |||
for (int i = length () - 1; i >= 0; i--) | for (int i = length () - 1; i >= 0; i--) | |||
k = k * rep[i] + idx[i]; | k = k * rep[i] + idx[i]; | |||
return k; | return k; | |||
} | } | |||
// Ditto, but the tuple may be incomplete (nidx < length ()). | // Ditto, but the tuple may be incomplete (nidx < length ()). | |||
octave_idx_type compute_index (const octave_idx_type *idx, int nidx) cons t | octave_idx_type compute_index (const octave_idx_type *idx, int nidx) cons t | |||
{ | { | |||
octave_idx_type k = 0; | octave_idx_type k = 0; | |||
for (int i = nidx - 1; i >= 0; i--) | for (int i = nidx - 1; i >= 0; i--) | |||
k = k * rep[i] + idx[i]; | k = k * rep[i] + idx[i]; | |||
return k; | return k; | |||
} | } | |||
// Increment a multi-dimensional index tuple, optionally starting | // Increment a multi-dimensional index tuple, optionally starting | |||
// from an offset position and return the index of the last index | // from an offset position and return the index of the last index | |||
// position that was changed, or length () if just cycled over. | // position that was changed, or length () if just cycled over. | |||
int increment_index (octave_idx_type *idx, int start = 0) const | int increment_index (octave_idx_type *idx, int start = 0) const | |||
{ | { | |||
int i; | int i; | |||
for (i = start; i < length (); i++) | for (i = start; i < length (); i++) | |||
{ | { | |||
if (++(*idx) == rep[i]) | if (++(*idx) == rep[i]) | |||
*idx++ = 0; | *idx++ = 0; | |||
else | else | |||
break; | break; | |||
} | } | |||
return i; | return i; | |||
} | } | |||
// Return cumulative dimensions. | // Return cumulative dimensions. | |||
dim_vector cumulative (void) const | dim_vector cumulative (void) const | |||
{ | { | |||
int nd = length (); | int nd = length (); | |||
dim_vector retval = alloc (nd); | dim_vector retval = alloc (nd); | |||
octave_idx_type k = 1; | octave_idx_type k = 1; | |||
for (int i = 0; i < nd; i++) | for (int i = 0; i < nd; i++) | |||
retval.rep[i] = k *= rep[i]; | retval.rep[i] = k *= rep[i]; | |||
return retval; | return retval; | |||
} | } | |||
// Compute a linear index from an index tuple. Dimensions are | // Compute a linear index from an index tuple. Dimensions are | |||
// required to be cumulative. | // required to be cumulative. | |||
octave_idx_type cum_compute_index (const octave_idx_type *idx) const | octave_idx_type cum_compute_index (const octave_idx_type *idx) const | |||
{ | { | |||
octave_idx_type k = idx[0]; | octave_idx_type k = idx[0]; | |||
for (int i = 1; i < length (); i++) | for (int i = 1; i < length (); i++) | |||
k += rep[i-1] * idx[i]; | k += rep[i-1] * idx[i]; | |||
return k; | return k; | |||
} | } | |||
friend bool operator == (const dim_vector& a, const dim_vector& b); | friend bool operator == (const dim_vector& a, const dim_vector& b); | |||
}; | }; | |||
inline bool | inline bool | |||
operator == (const dim_vector& a, const dim_vector& b) | operator == (const dim_vector& a, const dim_vector& b) | |||
{ | { | |||
// Fast case. | // Fast case. | |||
if (a.rep == b.rep) | if (a.rep == b.rep) | |||
return true; | return true; | |||
End of changes. 24 change blocks. | ||||
75 lines changed or deleted | 81 lines changed or added | |||
dir-ops.h | dir-ops.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 38 | skipping to change at line 38 | |||
#include "str-vec.h" | #include "str-vec.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
dir_entry | dir_entry | |||
{ | { | |||
public: | public: | |||
dir_entry (const std::string& n = std::string ()) | dir_entry (const std::string& n = std::string ()) | |||
: name (n), dir (0), fail (false), errmsg () | : name (n), dir (0), fail (false), errmsg () | |||
{ | { | |||
if (! name.empty ()) | if (! name.empty ()) | |||
open (); | open (); | |||
} | } | |||
dir_entry (const dir_entry& d) | dir_entry (const dir_entry& d) | |||
: name (d.name), dir (d.dir), fail (d.fail), errmsg (d.errmsg) { } | : name (d.name), dir (d.dir), fail (d.fail), errmsg (d.errmsg) { } | |||
dir_entry& operator = (const dir_entry& d) | dir_entry& operator = (const dir_entry& d) | |||
{ | { | |||
if (this != &d) | if (this != &d) | |||
{ | { | |||
name = d.name; | name = d.name; | |||
dir = d.dir; | dir = d.dir; | |||
fail = d.fail; | fail = d.fail; | |||
errmsg = d.errmsg; | errmsg = d.errmsg; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~dir_entry (void) { close (); } | ~dir_entry (void) { close (); } | |||
bool open (const std::string& = std::string ()); | bool open (const std::string& = std::string ()); | |||
string_vector read (void); | string_vector read (void); | |||
void close (void); | void close (void); | |||
bool ok (void) const { return dir && ! fail; } | bool ok (void) const { return dir && ! fail; } | |||
End of changes. 4 change blocks. | ||||
15 lines changed or deleted | 15 lines changed or added | |||
dirfns.h | dirfns.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 32 | skipping to change at line 32 | |||
#if !defined (octave_dirfns_h) | #if !defined (octave_dirfns_h) | |||
#define octave_dirfns_h 1 | #define octave_dirfns_h 1 | |||
#include <ctime> | #include <ctime> | |||
#include <string> | #include <string> | |||
#include "oct-time.h" | #include "oct-time.h" | |||
extern std::string polite_directory_format (const std::string&); | ||||
extern std::string base_pathname (const std::string&); | ||||
extern std::string make_absolute (const std::string&, const std::string&); | ||||
extern std::string get_working_directory (const std::string&); | ||||
// The time we last time we changed directories. | // The time we last time we changed directories. | |||
extern octave_time Vlast_chdir_time; | extern octave_time Vlast_chdir_time; | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
6 lines changed or deleted | 1 lines changed or added | |||
display.h | display.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 John W. Eaton | Copyright (C) 2009-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 26 | skipping to change at line 26 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_display_h) | #if !defined (octave_display_h) | |||
#define octave_display_h 1 | #define octave_display_h 1 | |||
#include <string> | ||||
class Matrix; | class Matrix; | |||
class display_info | class | |||
OCTINTERP_API | ||||
display_info | ||||
{ | { | |||
protected: | protected: | |||
display_info (bool query = true) | display_info (bool query = true) | |||
: ht (1), wd (1), dp (0), rx (72), ry (72) | : ht (1), wd (1), dp (0), rx (72), ry (72), dpy_avail (false), | |||
err_msg () | ||||
{ | { | |||
init (query); | init (query); | |||
} | } | |||
public: | public: | |||
static int height (void) | static int height (void) | |||
{ | { | |||
return instance_ok () ? instance->do_height () : 0; | return instance_ok () ? instance->do_height () : 0; | |||
} | } | |||
skipping to change at line 65 | skipping to change at line 70 | |||
static double x_dpi (void) | static double x_dpi (void) | |||
{ | { | |||
return instance_ok () ? instance->do_x_dpi () : 0; | return instance_ok () ? instance->do_x_dpi () : 0; | |||
} | } | |||
static double y_dpi (void) | static double y_dpi (void) | |||
{ | { | |||
return instance_ok () ? instance->do_y_dpi () : 0; | return instance_ok () ? instance->do_y_dpi () : 0; | |||
} | } | |||
static bool display_available (void) | ||||
{ | ||||
std::string msg; | ||||
return instance_ok () ? instance->do_display_available (msg) : false; | ||||
} | ||||
static bool display_available (std::string& msg) | ||||
{ | ||||
return instance_ok () ? instance->do_display_available (msg) : false; | ||||
} | ||||
// To disable querying the window system for defaults, this function | // To disable querying the window system for defaults, this function | |||
// must be called before any other display_info function. | // must be called before any other display_info function. | |||
static void no_window_system (void) | static void no_window_system (void) | |||
{ | { | |||
instance_ok (false); | instance_ok (false); | |||
} | } | |||
private: | private: | |||
static display_info *instance; | static display_info *instance; | |||
skipping to change at line 87 | skipping to change at line 103 | |||
// Height, width, and depth of the display. | // Height, width, and depth of the display. | |||
int ht; | int ht; | |||
int wd; | int wd; | |||
int dp; | int dp; | |||
// X- and Y- Resolution of the display in dots (pixels) per inch. | // X- and Y- Resolution of the display in dots (pixels) per inch. | |||
double rx; | double rx; | |||
double ry; | double ry; | |||
bool dpy_avail; | ||||
std::string err_msg; | ||||
int do_height (void) const { return ht; } | int do_height (void) const { return ht; } | |||
int do_width (void) const { return wd; } | int do_width (void) const { return wd; } | |||
int do_depth (void) const { return dp; } | int do_depth (void) const { return dp; } | |||
double do_x_dpi (void) const { return rx; } | double do_x_dpi (void) const { return rx; } | |||
double do_y_dpi (void) const { return ry; } | double do_y_dpi (void) const { return ry; } | |||
bool do_display_available (std::string& msg) const | ||||
{ | ||||
msg = err_msg; | ||||
return dpy_avail; | ||||
} | ||||
void init (bool query = true); | void init (bool query = true); | |||
static bool instance_ok (bool query = true); | static bool instance_ok (bool query = true); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
3 lines changed or deleted | 30 lines changed or added | |||
dynamic-ld.h | dynamic-ld.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 45 | skipping to change at line 45 | |||
protected: | protected: | |||
octave_dynamic_loader (void) { } | octave_dynamic_loader (void) { } | |||
public: | public: | |||
virtual ~octave_dynamic_loader (void) { } | virtual ~octave_dynamic_loader (void) { } | |||
static octave_function * | static octave_function * | |||
load_oct (const std::string& fcn_name, | load_oct (const std::string& fcn_name, | |||
const std::string& file_name = std::string (), | const std::string& file_name = std::string (), | |||
bool relative = false); | bool relative = false); | |||
static octave_function * | static octave_function * | |||
load_mex (const std::string& fcn_name, | load_mex (const std::string& fcn_name, | |||
const std::string& file_name = std::string (), | const std::string& file_name = std::string (), | |||
bool relative = false); | bool relative = false); | |||
static bool remove_oct (const std::string& fcn_name, octave_shlib& shl); | static bool remove_oct (const std::string& fcn_name, octave_shlib& shl); | |||
static bool remove_mex (const std::string& fcn_name, octave_shlib& shl); | static bool remove_mex (const std::string& fcn_name, octave_shlib& shl); | |||
private: | private: | |||
// No copying! | // No copying! | |||
octave_dynamic_loader (const octave_dynamic_loader&); | octave_dynamic_loader (const octave_dynamic_loader&); | |||
skipping to change at line 73 | skipping to change at line 73 | |||
octave_dynamic_loader& operator = (const octave_dynamic_loader&); | octave_dynamic_loader& operator = (const octave_dynamic_loader&); | |||
static octave_dynamic_loader *instance; | static octave_dynamic_loader *instance; | |||
static void cleanup_instance (void) { delete instance; instance = 0; } | static void cleanup_instance (void) { delete instance; instance = 0; } | |||
static bool instance_ok (void); | static bool instance_ok (void); | |||
octave_function * | octave_function * | |||
do_load_oct (const std::string& fcn_name, | do_load_oct (const std::string& fcn_name, | |||
const std::string& file_name = std::string (), | const std::string& file_name = std::string (), | |||
bool relative = false); | bool relative = false); | |||
octave_function * | octave_function * | |||
do_load_mex (const std::string& fcn_name, | do_load_mex (const std::string& fcn_name, | |||
const std::string& file_name = std::string (), | const std::string& file_name = std::string (), | |||
bool relative = false); | bool relative = false); | |||
bool do_remove_oct (const std::string& fcn_name, octave_shlib& shl); | bool do_remove_oct (const std::string& fcn_name, octave_shlib& shl); | |||
bool do_remove_mex (const std::string& fcn_name, octave_shlib& shl); | bool do_remove_mex (const std::string& fcn_name, octave_shlib& shl); | |||
static bool doing_load; | static bool doing_load; | |||
protected: | protected: | |||
static std::string name_mangler (const std::string& name); | static std::string name_mangler (const std::string& name); | |||
End of changes. 5 change blocks. | ||||
9 lines changed or deleted | 9 lines changed or added | |||
eigs-base.cc | eigs-base.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2005-2012 David Bateman | Copyright (C) 2005-2013 David Bateman | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 157 | skipping to change at line 157 | |||
F77_FUNC (dgemv, DGEMV) (F77_CONST_CHAR_ARG_DECL, | F77_FUNC (dgemv, DGEMV) (F77_CONST_CHAR_ARG_DECL, | |||
const octave_idx_type&, const octave_idx_type&, | const octave_idx_type&, const octave_idx_type&, | |||
const double&, const double*, | const double&, const double*, | |||
const octave_idx_type&, const double*, | const octave_idx_type&, const double*, | |||
const octave_idx_type&, const double&, double*, | const octave_idx_type&, const double&, double*, | |||
const octave_idx_type& | const octave_idx_type& | |||
F77_CHAR_ARG_LEN_DECL); | F77_CHAR_ARG_LEN_DECL); | |||
F77_RET_T | F77_RET_T | |||
F77_FUNC (zgemv, ZGEMV) (F77_CONST_CHAR_ARG_DECL, | F77_FUNC (zgemv, ZGEMV) (F77_CONST_CHAR_ARG_DECL, | |||
const octave_idx_type&, const octave_idx_type&, | const octave_idx_type&, const octave_idx_type&, | |||
const Complex&, | const Complex&, const Complex*, | |||
const Complex*, const octave_idx_type&, const Co | const octave_idx_type&, const Complex*, | |||
mplex*, | const octave_idx_type&, const Complex&, Complex* | |||
const octave_idx_type&, const Complex&, Complex* | , | |||
, const octave_idx_type& | const octave_idx_type& | |||
F77_CHAR_ARG_LEN_DECL); | F77_CHAR_ARG_LEN_DECL); | |||
} | } | |||
#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | |||
static octave_idx_type | static octave_idx_type | |||
lusolve (const SparseMatrix&, const SparseMatrix&, Matrix&); | lusolve (const SparseMatrix&, const SparseMatrix&, Matrix&); | |||
static octave_idx_type | static octave_idx_type | |||
lusolve (const SparseComplexMatrix&, const SparseComplexMatrix&, | lusolve (const SparseComplexMatrix&, const SparseComplexMatrix&, | |||
ComplexMatrix&); | ComplexMatrix&); | |||
static octave_idx_type | static octave_idx_type | |||
lusolve (const Matrix&, const Matrix&, Matrix&); | lusolve (const Matrix&, const Matrix&, Matrix&); | |||
static octave_idx_type | static octave_idx_type | |||
lusolve (const ComplexMatrix&, const ComplexMatrix&, ComplexMatrix&); | lusolve (const ComplexMatrix&, const ComplexMatrix&, ComplexMatrix&); | |||
static ComplexMatrix | static ComplexMatrix | |||
ltsolve (const SparseComplexMatrix&, const ColumnVector&, | ltsolve (const SparseComplexMatrix&, const ColumnVector&, | |||
const ComplexMatrix&); | const ComplexMatrix&); | |||
static Matrix | static Matrix | |||
ltsolve (const SparseMatrix&, const ColumnVector&, const Matrix&,); | ltsolve (const SparseMatrix&, const ColumnVector&, const Matrix&,); | |||
static ComplexMatrix | static ComplexMatrix | |||
ltsolve (const ComplexMatrix&, const ColumnVector&, const ComplexMatrix&); | ltsolve (const ComplexMatrix&, const ColumnVector&, const ComplexMatrix&); | |||
static Matrix | static Matrix | |||
ltsolve (const Matrix&, const ColumnVector&, const Matrix&,); | ltsolve (const Matrix&, const ColumnVector&, const Matrix&,); | |||
skipping to change at line 227 | skipping to change at line 229 | |||
m = U.solve (utyp, m, err, rcond, 0); | m = U.solve (utyp, m, err, rcond, 0); | |||
return err; | return err; | |||
} | } | |||
template <class SM, class M> | template <class SM, class M> | |||
static M | static M | |||
ltsolve (const SM& L, const ColumnVector& Q, const M& m) | ltsolve (const SM& L, const ColumnVector& Q, const M& m) | |||
{ | { | |||
octave_idx_type n = L.cols(); | octave_idx_type n = L.cols (); | |||
octave_idx_type b_nc = m.cols(); | octave_idx_type b_nc = m.cols (); | |||
octave_idx_type err = 0; | octave_idx_type err = 0; | |||
double rcond; | double rcond; | |||
MatrixType ltyp (MatrixType::Lower); | MatrixType ltyp (MatrixType::Lower); | |||
M tmp = L.solve (ltyp, m, err, rcond, 0); | M tmp = L.solve (ltyp, m, err, rcond, 0); | |||
M retval; | M retval; | |||
const double* qv = Q.fortran_vec(); | const double* qv = Q.fortran_vec (); | |||
if (!err) | if (!err) | |||
{ | { | |||
retval.resize (n, b_nc); | retval.resize (n, b_nc); | |||
for (octave_idx_type j = 0; j < b_nc; j++) | for (octave_idx_type j = 0; j < b_nc; j++) | |||
{ | { | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
retval.elem(static_cast<octave_idx_type>(qv[i]), j) = | retval.elem (static_cast<octave_idx_type>(qv[i]), j) = | |||
tmp.elem(i,j); | tmp.elem (i,j); | |||
} | } | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
template <class SM, class M> | template <class SM, class M> | |||
static M | static M | |||
utsolve (const SM& U, const ColumnVector& Q, const M& m) | utsolve (const SM& U, const ColumnVector& Q, const M& m) | |||
{ | { | |||
octave_idx_type n = U.cols(); | octave_idx_type n = U.cols (); | |||
octave_idx_type b_nc = m.cols(); | octave_idx_type b_nc = m.cols (); | |||
octave_idx_type err = 0; | octave_idx_type err = 0; | |||
double rcond; | double rcond; | |||
MatrixType utyp (MatrixType::Upper); | MatrixType utyp (MatrixType::Upper); | |||
M retval (n, b_nc); | M retval (n, b_nc); | |||
const double* qv = Q.fortran_vec(); | const double* qv = Q.fortran_vec (); | |||
for (octave_idx_type j = 0; j < b_nc; j++) | for (octave_idx_type j = 0; j < b_nc; j++) | |||
{ | { | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
retval.elem(i,j) = m.elem(static_cast<octave_idx_type>(qv[i]), j); | retval.elem (i,j) = m.elem (static_cast<octave_idx_type>(qv[i]), j) ; | |||
} | } | |||
return U.solve (utyp, retval, err, rcond, 0); | return U.solve (utyp, retval, err, rcond, 0); | |||
} | } | |||
static bool | static bool | |||
vector_product (const SparseMatrix& m, const double* x, double* y) | vector_product (const SparseMatrix& m, const double* x, double* y) | |||
{ | { | |||
octave_idx_type nc = m.cols (); | octave_idx_type nc = m.cols (); | |||
for (octave_idx_type j = 0; j < nc; j++) | for (octave_idx_type j = 0; j < nc; j++) | |||
y[j] = 0.; | y[j] = 0.; | |||
for (octave_idx_type j = 0; j < nc; j++) | for (octave_idx_type j = 0; j < nc; j++) | |||
for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) | for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) | |||
y[m.ridx(i)] += m.data(i) * x[j]; | y[m.ridx (i)] += m.data (i) * x[j]; | |||
return true; | return true; | |||
} | } | |||
static bool | static bool | |||
vector_product (const Matrix& m, const double *x, double *y) | vector_product (const Matrix& m, const double *x, double *y) | |||
{ | { | |||
octave_idx_type nr = m.rows (); | octave_idx_type nr = m.rows (); | |||
octave_idx_type nc = m.cols (); | octave_idx_type nc = m.cols (); | |||
skipping to change at line 308 | skipping to change at line 310 | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: unrecoverable error in dgemv"); | ("eigs: unrecoverable error in dgemv"); | |||
return false; | return false; | |||
} | } | |||
else | else | |||
return true; | return true; | |||
} | } | |||
static bool | static bool | |||
vector_product (const SparseComplexMatrix& m, const Complex* x, | vector_product (const SparseComplexMatrix& m, const Complex* x, | |||
Complex* y) | Complex* y) | |||
{ | { | |||
octave_idx_type nc = m.cols (); | octave_idx_type nc = m.cols (); | |||
for (octave_idx_type j = 0; j < nc; j++) | for (octave_idx_type j = 0; j < nc; j++) | |||
y[j] = 0.; | y[j] = 0.; | |||
for (octave_idx_type j = 0; j < nc; j++) | for (octave_idx_type j = 0; j < nc; j++) | |||
for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) | for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) | |||
y[m.ridx(i)] += m.data(i) * x[j]; | y[m.ridx (i)] += m.data (i) * x[j]; | |||
return true; | return true; | |||
} | } | |||
static bool | static bool | |||
vector_product (const ComplexMatrix& m, const Complex *x, Complex *y) | vector_product (const ComplexMatrix& m, const Complex *x, Complex *y) | |||
{ | { | |||
octave_idx_type nr = m.rows (); | octave_idx_type nr = m.rows (); | |||
octave_idx_type nc = m.cols (); | octave_idx_type nc = m.cols (); | |||
skipping to change at line 348 | skipping to change at line 350 | |||
} | } | |||
else | else | |||
return true; | return true; | |||
} | } | |||
static bool | static bool | |||
make_cholb (Matrix& b, Matrix& bt, ColumnVector& permB) | make_cholb (Matrix& b, Matrix& bt, ColumnVector& permB) | |||
{ | { | |||
octave_idx_type info; | octave_idx_type info; | |||
CHOL fact (b, info); | CHOL fact (b, info); | |||
octave_idx_type n = b.cols(); | octave_idx_type n = b.cols (); | |||
if (info != 0) | if (info != 0) | |||
return false; | return false; | |||
else | else | |||
{ | { | |||
bt = fact.chol_matrix (); | bt = fact.chol_matrix (); | |||
b = bt.transpose(); | b = bt.transpose (); | |||
permB = ColumnVector(n); | permB = ColumnVector (n); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
permB(i) = i; | permB(i) = i; | |||
return true; | return true; | |||
} | } | |||
} | } | |||
static bool | static bool | |||
make_cholb (SparseMatrix& b, SparseMatrix& bt, ColumnVector& permB) | make_cholb (SparseMatrix& b, SparseMatrix& bt, ColumnVector& permB) | |||
{ | { | |||
octave_idx_type info; | octave_idx_type info; | |||
SparseCHOL fact (b, info, false); | SparseCHOL fact (b, info, false); | |||
if (fact.P() != 0) | if (fact.P () != 0) | |||
return false; | return false; | |||
else | else | |||
{ | { | |||
b = fact.L(); | b = fact.L (); | |||
bt = b.transpose(); | bt = b.transpose (); | |||
permB = fact.perm() - 1.0; | permB = fact.perm () - 1.0; | |||
return true; | return true; | |||
} | } | |||
} | } | |||
static bool | static bool | |||
make_cholb (ComplexMatrix& b, ComplexMatrix& bt, ColumnVector& permB) | make_cholb (ComplexMatrix& b, ComplexMatrix& bt, ColumnVector& permB) | |||
{ | { | |||
octave_idx_type info; | octave_idx_type info; | |||
ComplexCHOL fact (b, info); | ComplexCHOL fact (b, info); | |||
octave_idx_type n = b.cols(); | octave_idx_type n = b.cols (); | |||
if (info != 0) | if (info != 0) | |||
return false; | return false; | |||
else | else | |||
{ | { | |||
bt = fact.chol_matrix (); | bt = fact.chol_matrix (); | |||
b = bt.hermitian(); | b = bt.hermitian (); | |||
permB = ColumnVector(n); | permB = ColumnVector (n); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
permB(i) = i; | permB(i) = i; | |||
return true; | return true; | |||
} | } | |||
} | } | |||
static bool | static bool | |||
make_cholb (SparseComplexMatrix& b, SparseComplexMatrix& bt, | make_cholb (SparseComplexMatrix& b, SparseComplexMatrix& bt, | |||
ColumnVector& permB) | ColumnVector& permB) | |||
{ | { | |||
octave_idx_type info; | octave_idx_type info; | |||
SparseComplexCHOL fact (b, info, false); | SparseComplexCHOL fact (b, info, false); | |||
if (fact.P() != 0) | if (fact.P () != 0) | |||
return false; | return false; | |||
else | else | |||
{ | { | |||
b = fact.L(); | b = fact.L (); | |||
bt = b.hermitian(); | bt = b.hermitian (); | |||
permB = fact.perm() - 1.0; | permB = fact.perm () - 1.0; | |||
return true; | return true; | |||
} | } | |||
} | } | |||
static bool | static bool | |||
LuAminusSigmaB (const SparseMatrix &m, const SparseMatrix &b, | LuAminusSigmaB (const SparseMatrix &m, const SparseMatrix &b, | |||
bool cholB, const ColumnVector& permB, double sigma, | bool cholB, const ColumnVector& permB, double sigma, | |||
SparseMatrix &L, SparseMatrix &U, octave_idx_type *P, | SparseMatrix &L, SparseMatrix &U, octave_idx_type *P, | |||
octave_idx_type *Q) | octave_idx_type *Q) | |||
{ | { | |||
bool have_b = ! b.is_empty (); | bool have_b = ! b.is_empty (); | |||
octave_idx_type n = m.rows(); | octave_idx_type n = m.rows (); | |||
// Caclulate LU decomposition of 'A - sigma * B' | // Caclulate LU decomposition of 'A - sigma * B' | |||
SparseMatrix AminusSigmaB (m); | SparseMatrix AminusSigmaB (m); | |||
if (have_b) | if (have_b) | |||
{ | { | |||
if (cholB) | if (cholB) | |||
{ | { | |||
if (permB.length()) | if (permB.length ()) | |||
{ | { | |||
SparseMatrix tmp(n,n,n); | SparseMatrix tmp(n,n,n); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
{ | { | |||
tmp.xcidx(i) = i; | tmp.xcidx (i) = i; | |||
tmp.xridx(i) = | tmp.xridx (i) = | |||
static_cast<octave_idx_type>(permB(i)); | static_cast<octave_idx_type>(permB(i)); | |||
tmp.xdata(i) = 1; | tmp.xdata (i) = 1; | |||
} | } | |||
tmp.xcidx(n) = n; | tmp.xcidx (n) = n; | |||
AminusSigmaB = AminusSigmaB - sigma * tmp * | AminusSigmaB = AminusSigmaB - sigma * tmp * | |||
b.transpose() * b * tmp.transpose(); | b.transpose () * b * tmp.transpose (); | |||
} | } | |||
else | else | |||
AminusSigmaB = AminusSigmaB - sigma * | AminusSigmaB = AminusSigmaB - sigma * | |||
b.transpose() * b; | b.transpose () * b; | |||
} | } | |||
else | else | |||
AminusSigmaB = AminusSigmaB - sigma * b; | AminusSigmaB = AminusSigmaB - sigma * b; | |||
} | } | |||
else | else | |||
{ | { | |||
SparseMatrix sigmat (n, n, n); | SparseMatrix sigmat (n, n, n); | |||
// Create sigma * speye(n,n) | // Create sigma * speye (n,n) | |||
sigmat.xcidx (0) = 0; | sigmat.xcidx (0) = 0; | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
{ | { | |||
sigmat.xdata(i) = sigma; | sigmat.xdata (i) = sigma; | |||
sigmat.xridx(i) = i; | sigmat.xridx (i) = i; | |||
sigmat.xcidx(i+1) = i + 1; | sigmat.xcidx (i+1) = i + 1; | |||
} | ||||
AminusSigmaB = AminusSigmaB - sigmat; | ||||
} | } | |||
AminusSigmaB = AminusSigmaB - sigmat; | ||||
} | ||||
SparseLU fact (AminusSigmaB); | SparseLU fact (AminusSigmaB); | |||
L = fact.L (); | L = fact.L (); | |||
U = fact.U (); | U = fact.U (); | |||
const octave_idx_type *P2 = fact.row_perm (); | const octave_idx_type *P2 = fact.row_perm (); | |||
const octave_idx_type *Q2 = fact.col_perm (); | const octave_idx_type *Q2 = fact.col_perm (); | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
{ | { | |||
P[j] = P2[j]; | P[j] = P2[j]; | |||
Q[j] = Q2[j]; | Q[j] = Q2[j]; | |||
} | } | |||
// Test condition number of LU decomposition | // Test condition number of LU decomposition | |||
double minU = octave_NaN; | double minU = octave_NaN; | |||
double maxU = octave_NaN; | double maxU = octave_NaN; | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
{ | { | |||
double d = 0.; | double d = 0.; | |||
if (U.xcidx(j+1) > U.xcidx(j) && | if (U.xcidx (j+1) > U.xcidx (j) && | |||
U.xridx (U.xcidx(j+1)-1) == j) | U.xridx (U.xcidx (j+1)-1) == j) | |||
d = std::abs (U.xdata (U.xcidx(j+1)-1)); | d = std::abs (U.xdata (U.xcidx (j+1)-1)); | |||
if (xisnan (minU) || d < minU) | if (xisnan (minU) || d < minU) | |||
minU = d; | minU = d; | |||
if (xisnan (maxU) || d > maxU) | if (xisnan (maxU) || d > maxU) | |||
maxU = d; | maxU = d; | |||
} | } | |||
double rcond = (minU / maxU); | double rcond = (minU / maxU); | |||
volatile double rcond_plus_one = rcond + 1.0; | volatile double rcond_plus_one = rcond + 1.0; | |||
skipping to change at line 523 | skipping to change at line 525 | |||
return true; | return true; | |||
} | } | |||
static bool | static bool | |||
LuAminusSigmaB (const Matrix &m, const Matrix &b, | LuAminusSigmaB (const Matrix &m, const Matrix &b, | |||
bool cholB, const ColumnVector& permB, double sigma, | bool cholB, const ColumnVector& permB, double sigma, | |||
Matrix &L, Matrix &U, octave_idx_type *P, | Matrix &L, Matrix &U, octave_idx_type *P, | |||
octave_idx_type *Q) | octave_idx_type *Q) | |||
{ | { | |||
bool have_b = ! b.is_empty (); | bool have_b = ! b.is_empty (); | |||
octave_idx_type n = m.cols(); | octave_idx_type n = m.cols (); | |||
// Caclulate LU decomposition of 'A - sigma * B' | // Caclulate LU decomposition of 'A - sigma * B' | |||
Matrix AminusSigmaB (m); | Matrix AminusSigmaB (m); | |||
if (have_b) | if (have_b) | |||
{ | { | |||
if (cholB) | if (cholB) | |||
{ | { | |||
Matrix tmp = sigma * b.transpose() * b; | Matrix tmp = sigma * b.transpose () * b; | |||
const double *pB = permB.fortran_vec(); | const double *pB = permB.fortran_vec (); | |||
double *p = AminusSigmaB.fortran_vec(); | double *p = AminusSigmaB.fortran_vec (); | |||
if (permB.length()) | if (permB.length ()) | |||
{ | { | |||
for (octave_idx_type j = 0; | for (octave_idx_type j = 0; | |||
j < b.cols(); j++) | j < b.cols (); j++) | |||
for (octave_idx_type i = 0; | for (octave_idx_type i = 0; | |||
i < b.rows(); i++) | i < b.rows (); i++) | |||
*p++ -= tmp.xelem (static_cast<octave_idx_type>(pB[i]), | *p++ -= tmp.xelem (static_cast<octave_idx_type>(pB[i]), | |||
static_cast<octave_idx_type>(pB[j])); | static_cast<octave_idx_type>(pB[j])); | |||
} | } | |||
else | else | |||
AminusSigmaB = AminusSigmaB - tmp; | AminusSigmaB = AminusSigmaB - tmp; | |||
} | } | |||
else | else | |||
AminusSigmaB = AminusSigmaB - sigma * b; | AminusSigmaB = AminusSigmaB - sigma * b; | |||
} | } | |||
else | else | |||
{ | { | |||
double *p = AminusSigmaB.fortran_vec(); | double *p = AminusSigmaB.fortran_vec (); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
p[i*(n+1)] -= sigma; | p[i*(n+1)] -= sigma; | |||
} | } | |||
LU fact (AminusSigmaB); | LU fact (AminusSigmaB); | |||
L = fact.P().transpose() * fact.L (); | L = fact.P ().transpose () * fact.L (); | |||
U = fact.U (); | U = fact.U (); | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
P[j] = Q[j] = j; | P[j] = Q[j] = j; | |||
// Test condition number of LU decomposition | // Test condition number of LU decomposition | |||
double minU = octave_NaN; | double minU = octave_NaN; | |||
double maxU = octave_NaN; | double maxU = octave_NaN; | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
{ | { | |||
double d = std::abs (U.xelem(j,j)); | double d = std::abs (U.xelem (j,j)); | |||
if (xisnan (minU) || d < minU) | if (xisnan (minU) || d < minU) | |||
minU = d; | minU = d; | |||
if (xisnan (maxU) || d > maxU) | if (xisnan (maxU) || d > maxU) | |||
maxU = d; | maxU = d; | |||
} | } | |||
double rcond = (minU / maxU); | double rcond = (minU / maxU); | |||
volatile double rcond_plus_one = rcond + 1.0; | volatile double rcond_plus_one = rcond + 1.0; | |||
skipping to change at line 600 | skipping to change at line 602 | |||
return true; | return true; | |||
} | } | |||
static bool | static bool | |||
LuAminusSigmaB (const SparseComplexMatrix &m, const SparseComplexMatrix &b, | LuAminusSigmaB (const SparseComplexMatrix &m, const SparseComplexMatrix &b, | |||
bool cholB, const ColumnVector& permB, Complex sigma, | bool cholB, const ColumnVector& permB, Complex sigma, | |||
SparseComplexMatrix &L, SparseComplexMatrix &U, | SparseComplexMatrix &L, SparseComplexMatrix &U, | |||
octave_idx_type *P, octave_idx_type *Q) | octave_idx_type *P, octave_idx_type *Q) | |||
{ | { | |||
bool have_b = ! b.is_empty (); | bool have_b = ! b.is_empty (); | |||
octave_idx_type n = m.rows(); | octave_idx_type n = m.rows (); | |||
// Caclulate LU decomposition of 'A - sigma * B' | // Caclulate LU decomposition of 'A - sigma * B' | |||
SparseComplexMatrix AminusSigmaB (m); | SparseComplexMatrix AminusSigmaB (m); | |||
if (have_b) | if (have_b) | |||
{ | { | |||
if (cholB) | if (cholB) | |||
{ | { | |||
if (permB.length()) | if (permB.length ()) | |||
{ | { | |||
SparseMatrix tmp(n,n,n); | SparseMatrix tmp(n,n,n); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
{ | { | |||
tmp.xcidx(i) = i; | tmp.xcidx (i) = i; | |||
tmp.xridx(i) = | tmp.xridx (i) = | |||
static_cast<octave_idx_type>(permB(i)); | static_cast<octave_idx_type>(permB(i)); | |||
tmp.xdata(i) = 1; | tmp.xdata (i) = 1; | |||
} | } | |||
tmp.xcidx(n) = n; | tmp.xcidx (n) = n; | |||
AminusSigmaB = AminusSigmaB - tmp * b.hermitian() * b * | AminusSigmaB = AminusSigmaB - tmp * b.hermitian () * b * | |||
tmp.transpose() * sigma; | tmp.transpose () * sigma; | |||
} | } | |||
else | else | |||
AminusSigmaB = AminusSigmaB - sigma * b.hermitian() * b; | AminusSigmaB = AminusSigmaB - sigma * b.hermitian () * b; | |||
} | } | |||
else | else | |||
AminusSigmaB = AminusSigmaB - sigma * b; | AminusSigmaB = AminusSigmaB - sigma * b; | |||
} | } | |||
else | else | |||
{ | { | |||
SparseComplexMatrix sigmat (n, n, n); | SparseComplexMatrix sigmat (n, n, n); | |||
// Create sigma * speye(n,n) | // Create sigma * speye (n,n) | |||
sigmat.xcidx (0) = 0; | sigmat.xcidx (0) = 0; | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
{ | { | |||
sigmat.xdata(i) = sigma; | sigmat.xdata (i) = sigma; | |||
sigmat.xridx(i) = i; | sigmat.xridx (i) = i; | |||
sigmat.xcidx(i+1) = i + 1; | sigmat.xcidx (i+1) = i + 1; | |||
} | } | |||
AminusSigmaB = AminusSigmaB - sigmat; | AminusSigmaB = AminusSigmaB - sigmat; | |||
} | } | |||
SparseComplexLU fact (AminusSigmaB); | SparseComplexLU fact (AminusSigmaB); | |||
L = fact.L (); | L = fact.L (); | |||
U = fact.U (); | U = fact.U (); | |||
const octave_idx_type *P2 = fact.row_perm (); | const octave_idx_type *P2 = fact.row_perm (); | |||
skipping to change at line 665 | skipping to change at line 667 | |||
P[j] = P2[j]; | P[j] = P2[j]; | |||
Q[j] = Q2[j]; | Q[j] = Q2[j]; | |||
} | } | |||
// Test condition number of LU decomposition | // Test condition number of LU decomposition | |||
double minU = octave_NaN; | double minU = octave_NaN; | |||
double maxU = octave_NaN; | double maxU = octave_NaN; | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
{ | { | |||
double d = 0.; | double d = 0.; | |||
if (U.xcidx(j+1) > U.xcidx(j) && | if (U.xcidx (j+1) > U.xcidx (j) && | |||
U.xridx (U.xcidx(j+1)-1) == j) | U.xridx (U.xcidx (j+1)-1) == j) | |||
d = std::abs (U.xdata (U.xcidx(j+1)-1)); | d = std::abs (U.xdata (U.xcidx (j+1)-1)); | |||
if (xisnan (minU) || d < minU) | if (xisnan (minU) || d < minU) | |||
minU = d; | minU = d; | |||
if (xisnan (maxU) || d > maxU) | if (xisnan (maxU) || d > maxU) | |||
maxU = d; | maxU = d; | |||
} | } | |||
double rcond = (minU / maxU); | double rcond = (minU / maxU); | |||
volatile double rcond_plus_one = rcond + 1.0; | volatile double rcond_plus_one = rcond + 1.0; | |||
skipping to change at line 697 | skipping to change at line 699 | |||
return true; | return true; | |||
} | } | |||
static bool | static bool | |||
LuAminusSigmaB (const ComplexMatrix &m, const ComplexMatrix &b, | LuAminusSigmaB (const ComplexMatrix &m, const ComplexMatrix &b, | |||
bool cholB, const ColumnVector& permB, Complex sigma, | bool cholB, const ColumnVector& permB, Complex sigma, | |||
ComplexMatrix &L, ComplexMatrix &U, octave_idx_type *P, | ComplexMatrix &L, ComplexMatrix &U, octave_idx_type *P, | |||
octave_idx_type *Q) | octave_idx_type *Q) | |||
{ | { | |||
bool have_b = ! b.is_empty (); | bool have_b = ! b.is_empty (); | |||
octave_idx_type n = m.cols(); | octave_idx_type n = m.cols (); | |||
// Caclulate LU decomposition of 'A - sigma * B' | // Caclulate LU decomposition of 'A - sigma * B' | |||
ComplexMatrix AminusSigmaB (m); | ComplexMatrix AminusSigmaB (m); | |||
if (have_b) | if (have_b) | |||
{ | { | |||
if (cholB) | if (cholB) | |||
{ | { | |||
ComplexMatrix tmp = sigma * b.hermitian() * b; | ComplexMatrix tmp = sigma * b.hermitian () * b; | |||
const double *pB = permB.fortran_vec(); | const double *pB = permB.fortran_vec (); | |||
Complex *p = AminusSigmaB.fortran_vec(); | Complex *p = AminusSigmaB.fortran_vec (); | |||
if (permB.length()) | if (permB.length ()) | |||
{ | { | |||
for (octave_idx_type j = 0; | for (octave_idx_type j = 0; | |||
j < b.cols(); j++) | j < b.cols (); j++) | |||
for (octave_idx_type i = 0; | for (octave_idx_type i = 0; | |||
i < b.rows(); i++) | i < b.rows (); i++) | |||
*p++ -= tmp.xelem (static_cast<octave_idx_type>(pB[i]), | *p++ -= tmp.xelem (static_cast<octave_idx_type>(pB[i]), | |||
static_cast<octave_idx_type>(pB[j])); | static_cast<octave_idx_type>(pB[j])); | |||
} | } | |||
else | else | |||
AminusSigmaB = AminusSigmaB - tmp; | AminusSigmaB = AminusSigmaB - tmp; | |||
} | } | |||
else | else | |||
AminusSigmaB = AminusSigmaB - sigma * b; | AminusSigmaB = AminusSigmaB - sigma * b; | |||
} | } | |||
else | else | |||
{ | { | |||
Complex *p = AminusSigmaB.fortran_vec(); | Complex *p = AminusSigmaB.fortran_vec (); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
p[i*(n+1)] -= sigma; | p[i*(n+1)] -= sigma; | |||
} | } | |||
ComplexLU fact (AminusSigmaB); | ComplexLU fact (AminusSigmaB); | |||
L = fact.P().transpose() * fact.L (); | L = fact.P ().transpose () * fact.L (); | |||
U = fact.U (); | U = fact.U (); | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
P[j] = Q[j] = j; | P[j] = Q[j] = j; | |||
// Test condition number of LU decomposition | // Test condition number of LU decomposition | |||
double minU = octave_NaN; | double minU = octave_NaN; | |||
double maxU = octave_NaN; | double maxU = octave_NaN; | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
{ | { | |||
double d = std::abs (U.xelem(j,j)); | double d = std::abs (U.xelem (j,j)); | |||
if (xisnan (minU) || d < minU) | if (xisnan (minU) || d < minU) | |||
minU = d; | minU = d; | |||
if (xisnan (maxU) || d > maxU) | if (xisnan (maxU) || d > maxU) | |||
maxU = d; | maxU = d; | |||
} | } | |||
double rcond = (minU / maxU); | double rcond = (minU / maxU); | |||
volatile double rcond_plus_one = rcond + 1.0; | volatile double rcond_plus_one = rcond + 1.0; | |||
skipping to change at line 780 | skipping to change at line 782 | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, Matrix &eig_vec, | octave_idx_type &info, Matrix &eig_vec, | |||
ColumnVector &eig_val, const M& _b, | ColumnVector &eig_val, const M& _b, | |||
ColumnVector &permB, ColumnVector &resid, | ColumnVector &permB, ColumnVector &resid, | |||
std::ostream& os, double tol, bool rvec, | std::ostream& os, double tol, bool rvec, | |||
bool cholB, int disp, int maxit) | bool cholB, int disp, int maxit) | |||
{ | { | |||
M b(_b); | M b(_b); | |||
octave_idx_type n = m.cols (); | octave_idx_type n = m.cols (); | |||
octave_idx_type mode = 1; | octave_idx_type mode = 1; | |||
bool have_b = ! b.is_empty(); | bool have_b = ! b.is_empty (); | |||
bool note3 = false; | bool note3 = false; | |||
char bmat = 'I'; | char bmat = 'I'; | |||
double sigma = 0.; | double sigma = 0.; | |||
M bt; | M bt; | |||
if (m.rows() != m.cols()) | if (m.rows () != m.cols ()) | |||
{ | { | |||
(*current_liboctave_error_handler) ("eigs: A must be square"); | (*current_liboctave_error_handler) ("eigs: A must be square"); | |||
return -1; | return -1; | |||
} | } | |||
if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) | if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ())) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: B must be square and the same size as A"); | ("eigs: B must be square and the same size as A"); | |||
return -1; | return -1; | |||
} | } | |||
if (resid.is_empty()) | if (resid.is_empty ()) | |||
{ | { | |||
std::string rand_dist = octave_rand::distribution(); | std::string rand_dist = octave_rand::distribution (); | |||
octave_rand::distribution("uniform"); | octave_rand::distribution ("uniform"); | |||
resid = ColumnVector (octave_rand::vector(n)); | resid = ColumnVector (octave_rand::vector (n)); | |||
octave_rand::distribution(rand_dist); | octave_rand::distribution (rand_dist); | |||
} | } | |||
if (n < 3) | if (n < 3) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: n must be at least 3"); | ("eigs: n must be at least 3"); | |||
return -1; | return -1; | |||
} | } | |||
if (p < 0) | if (p < 0) | |||
skipping to change at line 828 | skipping to change at line 830 | |||
p = 20; | p = 20; | |||
if (p > n - 1) | if (p > n - 1) | |||
p = n - 1 ; | p = n - 1 ; | |||
} | } | |||
if (k < 1 || k > n - 2) | if (k < 1 || k > n - 2) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1-1).\n" | ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1-1).\n" | |||
" Use 'eig(full(A))' instead"); | " Use 'eig (full (A))' instead"); | |||
return -1; | return -1; | |||
} | } | |||
if (p <= k || p >= n) | if (p <= k || p >= n) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: opts.p must be greater than k and less than n"); | ("eigs: opts.p must be greater than k and less than n"); | |||
return -1; | return -1; | |||
} | } | |||
if (have_b && cholB && permB.length() != 0) | if (have_b && cholB && permB.length () != 0) | |||
{ | { | |||
// Check the we really have a permutation vector | // Check the we really have a permutation vector | |||
if (permB.length() != n) | if (permB.length () != n) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: permB vector invalid"); | ("eigs: permB vector invalid"); | |||
return -1; | return -1; | |||
} | } | |||
else | else | |||
{ | { | |||
Array<bool> checked (dim_vector (n, 1), false); | Array<bool> checked (dim_vector (n, 1), false); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
{ | { | |||
skipping to change at line 889 | skipping to change at line 891 | |||
return -1; | return -1; | |||
} | } | |||
if (have_b) | if (have_b) | |||
{ | { | |||
// See Note 3 dsaupd | // See Note 3 dsaupd | |||
note3 = true; | note3 = true; | |||
if (cholB) | if (cholB) | |||
{ | { | |||
bt = b; | bt = b; | |||
b = b.transpose(); | b = b.transpose (); | |||
if (permB.length() == 0) | if (permB.length () == 0) | |||
{ | { | |||
permB = ColumnVector(n); | permB = ColumnVector (n); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
permB(i) = i; | permB(i) = i; | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
if (! make_cholb(b, bt, permB)) | if (! make_cholb (b, bt, permB)) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: The matrix B is not positive definite"); | ("eigs: The matrix B is not positive definite"); | |||
return -1; | return -1; | |||
} | } | |||
} | } | |||
} | } | |||
Array<octave_idx_type> ip (dim_vector (11, 1)); | Array<octave_idx_type> ip (dim_vector (11, 1)); | |||
octave_idx_type *iparam = ip.fortran_vec (); | octave_idx_type *iparam = ip.fortran_vec (); | |||
skipping to change at line 940 | skipping to change at line 942 | |||
OCTAVE_LOCAL_BUFFER (double, v, n * p); | OCTAVE_LOCAL_BUFFER (double, v, n * p); | |||
OCTAVE_LOCAL_BUFFER (double, workl, lwork); | OCTAVE_LOCAL_BUFFER (double, workl, lwork); | |||
OCTAVE_LOCAL_BUFFER (double, workd, 3 * n); | OCTAVE_LOCAL_BUFFER (double, workd, 3 * n); | |||
double *presid = resid.fortran_vec (); | double *presid = resid.fortran_vec (); | |||
do | do | |||
{ | { | |||
F77_FUNC (dsaupd, DSAUPD) | F77_FUNC (dsaupd, DSAUPD) | |||
(ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | |||
F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), | F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), | |||
k, tol, presid, p, v, n, iparam, | k, tol, presid, p, v, n, iparam, | |||
ipntr, workd, workl, lwork, info | ipntr, workd, workl, lwork, info | |||
F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | |||
if (f77_exception_encountered) | if (f77_exception_encountered) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: unrecoverable exception encountered in dsaupd"); | ("eigs: unrecoverable exception encountered in dsaupd"); | |||
return -1; | return -1; | |||
} | } | |||
if (disp > 0 && !xisnan(workl[iptr(5)-1])) | if (disp > 0 && !xisnan (workl[iptr (5)-1])) | |||
{ | { | |||
if (iter++) | if (iter++) | |||
{ | { | |||
os << "Iteration " << iter - 1 << | os << "Iteration " << iter - 1 << | |||
": a few Ritz values of the " << p << "-by-" << | ": a few Ritz values of the " << p << "-by-" << | |||
p << " matrix\n"; | p << " matrix\n"; | |||
for (int i = 0 ; i < k; i++) | for (int i = 0 ; i < k; i++) | |||
os << " " << workl[iptr(5)+i-1] << "\n"; | os << " " << workl[iptr(5)+i-1] << "\n"; | |||
} | } | |||
// This is a kludge, as ARPACK doesn't give its | // This is a kludge, as ARPACK doesn't give its | |||
// iteration pointer. But as workl[iptr(5)-1] is | // iteration pointer. But as workl[iptr(5)-1] is | |||
// an output value updated at each iteration, setting | // an output value updated at each iteration, setting | |||
// a value in this array to NaN and testing for it | // a value in this array to NaN and testing for it | |||
// is a way of obtaining the iteration counter. | // is a way of obtaining the iteration counter. | |||
if (ido != 99) | if (ido != 99) | |||
skipping to change at line 980 | skipping to change at line 982 | |||
} | } | |||
if (ido == -1 || ido == 1 || ido == 2) | if (ido == -1 || ido == 1 || ido == 2) | |||
{ | { | |||
if (have_b) | if (have_b) | |||
{ | { | |||
Matrix mtmp (n,1); | Matrix mtmp (n,1); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
mtmp(i,0) = workd[i + iptr(0) - 1]; | mtmp(i,0) = workd[i + iptr(0) - 1]; | |||
mtmp = utsolve(bt, permB, m * ltsolve(b, permB, mtmp)); | mtmp = utsolve (bt, permB, m * ltsolve (b, permB, mtmp)); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
workd[i+iptr(1)-1] = mtmp(i,0); | workd[i+iptr(1)-1] = mtmp(i,0); | |||
} | } | |||
else if (!vector_product (m, workd + iptr(0) - 1, | else if (!vector_product (m, workd + iptr(0) - 1, | |||
workd + iptr(1) - 1)) | workd + iptr(1) - 1)) | |||
break; | break; | |||
} | } | |||
else | else | |||
{ | { | |||
skipping to change at line 1074 | skipping to change at line 1076 | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
z[off1 + j] = z[off2 + j]; | z[off1 + j] = z[off2 + j]; | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
z[off2 + j] = dtmp[j]; | z[off2 + j] = dtmp[j]; | |||
} | } | |||
} | } | |||
if (note3) | if (note3) | |||
eig_vec = ltsolve(b, permB, eig_vec); | eig_vec = ltsolve (b, permB, eig_vec); | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: error %d in dseupd", info2); | ("eigs: error %d in dseupd", info2); | |||
return -1; | return -1; | |||
} | } | |||
} | } | |||
skipping to change at line 1101 | skipping to change at line 1103 | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, Matrix &eig_vec, | octave_idx_type &info, Matrix &eig_vec, | |||
ColumnVector &eig_val, const M& _b, | ColumnVector &eig_val, const M& _b, | |||
ColumnVector &permB, ColumnVector &resid, | ColumnVector &permB, ColumnVector &resid, | |||
std::ostream& os, double tol, bool rvec, | std::ostream& os, double tol, bool rvec, | |||
bool cholB, int disp, int maxit) | bool cholB, int disp, int maxit) | |||
{ | { | |||
M b(_b); | M b(_b); | |||
octave_idx_type n = m.cols (); | octave_idx_type n = m.cols (); | |||
octave_idx_type mode = 3; | octave_idx_type mode = 3; | |||
bool have_b = ! b.is_empty(); | bool have_b = ! b.is_empty (); | |||
std::string typ = "LM"; | std::string typ = "LM"; | |||
if (m.rows() != m.cols()) | if (m.rows () != m.cols ()) | |||
{ | { | |||
(*current_liboctave_error_handler) ("eigs: A must be square"); | (*current_liboctave_error_handler) ("eigs: A must be square"); | |||
return -1; | return -1; | |||
} | } | |||
if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) | if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ())) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: B must be square and the same size as A"); | ("eigs: B must be square and the same size as A"); | |||
return -1; | return -1; | |||
} | } | |||
// FIXME: The "SM" type for mode 1 seems unstable though faster!! | // FIXME: The "SM" type for mode 1 seems unstable though faster!! | |||
//if (! std::abs (sigma)) | //if (! std::abs (sigma)) | |||
// return EigsRealSymmetricMatrix (m, "SM", k, p, info, eig_vec, eig_val , | // return EigsRealSymmetricMatrix (m, "SM", k, p, info, eig_vec, eig_val , | |||
// _b, permB, resid, os, tol, rvec, cholB, | // _b, permB, resid, os, tol, rvec, cholB, | |||
// disp, maxit); | // disp, maxit); | |||
if (resid.is_empty()) | if (resid.is_empty ()) | |||
{ | { | |||
std::string rand_dist = octave_rand::distribution(); | std::string rand_dist = octave_rand::distribution (); | |||
octave_rand::distribution("uniform"); | octave_rand::distribution ("uniform"); | |||
resid = ColumnVector (octave_rand::vector(n)); | resid = ColumnVector (octave_rand::vector (n)); | |||
octave_rand::distribution(rand_dist); | octave_rand::distribution (rand_dist); | |||
} | } | |||
if (n < 3) | if (n < 3) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: n must be at least 3"); | ("eigs: n must be at least 3"); | |||
return -1; | return -1; | |||
} | } | |||
if (k <= 0 || k >= n - 1) | if (k <= 0 || k >= n - 1) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1-1).\n" | ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1-1).\n" | |||
" Use 'eig(full(A))' instead"); | " Use 'eig (full (A))' instead"); | |||
return -1; | return -1; | |||
} | } | |||
if (p < 0) | if (p < 0) | |||
{ | { | |||
p = k * 2; | p = k * 2; | |||
if (p < 20) | if (p < 20) | |||
p = 20; | p = 20; | |||
skipping to change at line 1163 | skipping to change at line 1165 | |||
p = n - 1 ; | p = n - 1 ; | |||
} | } | |||
if (p <= k || p >= n) | if (p <= k || p >= n) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: opts.p must be greater than k and less than n"); | ("eigs: opts.p must be greater than k and less than n"); | |||
return -1; | return -1; | |||
} | } | |||
if (have_b && cholB && permB.length() != 0) | if (have_b && cholB && permB.length () != 0) | |||
{ | { | |||
// Check the we really have a permutation vector | // Check the we really have a permutation vector | |||
if (permB.length() != n) | if (permB.length () != n) | |||
{ | { | |||
(*current_liboctave_error_handler) ("eigs: permB vector invalid") ; | (*current_liboctave_error_handler) ("eigs: permB vector invalid") ; | |||
return -1; | return -1; | |||
} | } | |||
else | else | |||
{ | { | |||
Array<bool> checked (dim_vector (n, 1), false); | Array<bool> checked (dim_vector (n, 1), false); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
{ | { | |||
octave_idx_type bidx = | octave_idx_type bidx = | |||
skipping to change at line 1216 | skipping to change at line 1218 | |||
ip(10) = 0; | ip(10) = 0; | |||
// ip(7) to ip(10) return values | // ip(7) to ip(10) return values | |||
Array<octave_idx_type> iptr (dim_vector (14, 1)); | Array<octave_idx_type> iptr (dim_vector (14, 1)); | |||
octave_idx_type *ipntr = iptr.fortran_vec (); | octave_idx_type *ipntr = iptr.fortran_vec (); | |||
octave_idx_type ido = 0; | octave_idx_type ido = 0; | |||
int iter = 0; | int iter = 0; | |||
M L, U; | M L, U; | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows() : m.rows())); | OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows () : m.rows ()) | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols() : m.cols())); | ); | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols () : m.cols ()) | ||||
); | ||||
if (! LuAminusSigmaB(m, b, cholB, permB, sigma, L, U, P, Q)) | if (! LuAminusSigmaB (m, b, cholB, permB, sigma, L, U, P, Q)) | |||
return -1; | return -1; | |||
octave_idx_type lwork = p * (p + 8); | octave_idx_type lwork = p * (p + 8); | |||
OCTAVE_LOCAL_BUFFER (double, v, n * p); | OCTAVE_LOCAL_BUFFER (double, v, n * p); | |||
OCTAVE_LOCAL_BUFFER (double, workl, lwork); | OCTAVE_LOCAL_BUFFER (double, workl, lwork); | |||
OCTAVE_LOCAL_BUFFER (double, workd, 3 * n); | OCTAVE_LOCAL_BUFFER (double, workd, 3 * n); | |||
double *presid = resid.fortran_vec (); | double *presid = resid.fortran_vec (); | |||
do | do | |||
{ | { | |||
F77_FUNC (dsaupd, DSAUPD) | F77_FUNC (dsaupd, DSAUPD) | |||
(ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | |||
F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), | F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), | |||
k, tol, presid, p, v, n, iparam, | k, tol, presid, p, v, n, iparam, | |||
ipntr, workd, workl, lwork, info | ipntr, workd, workl, lwork, info | |||
F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | |||
if (f77_exception_encountered) | if (f77_exception_encountered) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: unrecoverable exception encountered in dsaupd"); | ("eigs: unrecoverable exception encountered in dsaupd"); | |||
return -1; | return -1; | |||
} | } | |||
if (disp > 0 && !xisnan(workl[iptr(5)-1])) | if (disp > 0 && !xisnan (workl[iptr (5)-1])) | |||
{ | { | |||
if (iter++) | if (iter++) | |||
{ | { | |||
os << "Iteration " << iter - 1 << | os << "Iteration " << iter - 1 << | |||
": a few Ritz values of the " << p << "-by-" << | ": a few Ritz values of the " << p << "-by-" << | |||
p << " matrix\n"; | p << " matrix\n"; | |||
for (int i = 0 ; i < k; i++) | for (int i = 0 ; i < k; i++) | |||
os << " " << workl[iptr(5)+i-1] << "\n"; | os << " " << workl[iptr(5)+i-1] << "\n"; | |||
} | } | |||
// This is a kludge, as ARPACK doesn't give its | // This is a kludge, as ARPACK doesn't give its | |||
// iteration pointer. But as workl[iptr(5)-1] is | // iteration pointer. But as workl[iptr(5)-1] is | |||
// an output value updated at each iteration, setting | // an output value updated at each iteration, setting | |||
// a value in this array to NaN and testing for it | // a value in this array to NaN and testing for it | |||
// is a way of obtaining the iteration counter. | // is a way of obtaining the iteration counter. | |||
if (ido != 99) | if (ido != 99) | |||
skipping to change at line 1431 | skipping to change at line 1433 | |||
ColumnVector &eig_val, ColumnVector &resid, | ColumnVector &eig_val, ColumnVector &resid, | |||
std::ostream& os, double tol, bool rvec, | std::ostream& os, double tol, bool rvec, | |||
bool /* cholB */, int disp, int maxit) | bool /* cholB */, int disp, int maxit) | |||
{ | { | |||
std::string typ (_typ); | std::string typ (_typ); | |||
bool have_sigma = (sigma ? true : false); | bool have_sigma = (sigma ? true : false); | |||
char bmat = 'I'; | char bmat = 'I'; | |||
octave_idx_type mode = 1; | octave_idx_type mode = 1; | |||
int err = 0; | int err = 0; | |||
if (resid.is_empty()) | if (resid.is_empty ()) | |||
{ | { | |||
std::string rand_dist = octave_rand::distribution(); | std::string rand_dist = octave_rand::distribution (); | |||
octave_rand::distribution("uniform"); | octave_rand::distribution ("uniform"); | |||
resid = ColumnVector (octave_rand::vector(n)); | resid = ColumnVector (octave_rand::vector (n)); | |||
octave_rand::distribution(rand_dist); | octave_rand::distribution (rand_dist); | |||
} | } | |||
if (n < 3) | if (n < 3) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: n must be at least 3"); | ("eigs: n must be at least 3"); | |||
return -1; | return -1; | |||
} | } | |||
if (p < 0) | if (p < 0) | |||
skipping to change at line 1461 | skipping to change at line 1463 | |||
p = 20; | p = 20; | |||
if (p > n - 1) | if (p > n - 1) | |||
p = n - 1 ; | p = n - 1 ; | |||
} | } | |||
if (k <= 0 || k >= n - 1) | if (k <= 0 || k >= n - 1) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | |||
" Use 'eig(full(A))' instead"); | " Use 'eig (full (A))' instead"); | |||
return -1; | return -1; | |||
} | } | |||
if (p <= k || p >= n) | if (p <= k || p >= n) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: opts.p must be greater than k and less than n"); | ("eigs: opts.p must be greater than k and less than n"); | |||
return -1; | return -1; | |||
} | } | |||
skipping to change at line 1534 | skipping to change at line 1536 | |||
OCTAVE_LOCAL_BUFFER (double, v, n * p); | OCTAVE_LOCAL_BUFFER (double, v, n * p); | |||
OCTAVE_LOCAL_BUFFER (double, workl, lwork); | OCTAVE_LOCAL_BUFFER (double, workl, lwork); | |||
OCTAVE_LOCAL_BUFFER (double, workd, 3 * n); | OCTAVE_LOCAL_BUFFER (double, workd, 3 * n); | |||
double *presid = resid.fortran_vec (); | double *presid = resid.fortran_vec (); | |||
do | do | |||
{ | { | |||
F77_FUNC (dsaupd, DSAUPD) | F77_FUNC (dsaupd, DSAUPD) | |||
(ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | |||
F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), | F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), | |||
k, tol, presid, p, v, n, iparam, | k, tol, presid, p, v, n, iparam, | |||
ipntr, workd, workl, lwork, info | ipntr, workd, workl, lwork, info | |||
F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | |||
if (f77_exception_encountered) | if (f77_exception_encountered) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: unrecoverable exception encountered in dsaupd"); | ("eigs: unrecoverable exception encountered in dsaupd"); | |||
return -1; | return -1; | |||
} | } | |||
if (disp > 0 && !xisnan(workl[iptr(5)-1])) | if (disp > 0 && !xisnan (workl[iptr (5)-1])) | |||
{ | { | |||
if (iter++) | if (iter++) | |||
{ | { | |||
os << "Iteration " << iter - 1 << | os << "Iteration " << iter - 1 << | |||
": a few Ritz values of the " << p << "-by-" << | ": a few Ritz values of the " << p << "-by-" << | |||
p << " matrix\n"; | p << " matrix\n"; | |||
for (int i = 0 ; i < k; i++) | for (int i = 0 ; i < k; i++) | |||
os << " " << workl[iptr(5)+i-1] << "\n"; | os << " " << workl[iptr(5)+i-1] << "\n"; | |||
} | } | |||
// This is a kludge, as ARPACK doesn't give its | // This is a kludge, as ARPACK doesn't give its | |||
// iteration pointer. But as workl[iptr(5)-1] is | // iteration pointer. But as workl[iptr(5)-1] is | |||
// an output value updated at each iteration, setting | // an output value updated at each iteration, setting | |||
// a value in this array to NaN and testing for it | // a value in this array to NaN and testing for it | |||
// is a way of obtaining the iteration counter. | // is a way of obtaining the iteration counter. | |||
if (ido != 99) | if (ido != 99) | |||
skipping to change at line 1692 | skipping to change at line 1694 | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, ComplexMatrix &eig_vec, | octave_idx_type &info, ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, const M& _b, | ComplexColumnVector &eig_val, const M& _b, | |||
ColumnVector &permB, ColumnVector &resid, | ColumnVector &permB, ColumnVector &resid, | |||
std::ostream& os, double tol, bool rvec, | std::ostream& os, double tol, bool rvec, | |||
bool cholB, int disp, int maxit) | bool cholB, int disp, int maxit) | |||
{ | { | |||
M b(_b); | M b(_b); | |||
octave_idx_type n = m.cols (); | octave_idx_type n = m.cols (); | |||
octave_idx_type mode = 1; | octave_idx_type mode = 1; | |||
bool have_b = ! b.is_empty(); | bool have_b = ! b.is_empty (); | |||
bool note3 = false; | bool note3 = false; | |||
char bmat = 'I'; | char bmat = 'I'; | |||
double sigmar = 0.; | double sigmar = 0.; | |||
double sigmai = 0.; | double sigmai = 0.; | |||
M bt; | M bt; | |||
if (m.rows() != m.cols()) | if (m.rows () != m.cols ()) | |||
{ | { | |||
(*current_liboctave_error_handler) ("eigs: A must be square"); | (*current_liboctave_error_handler) ("eigs: A must be square"); | |||
return -1; | return -1; | |||
} | } | |||
if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) | if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ())) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: B must be square and the same size as A"); | ("eigs: B must be square and the same size as A"); | |||
return -1; | return -1; | |||
} | } | |||
if (resid.is_empty()) | if (resid.is_empty ()) | |||
{ | { | |||
std::string rand_dist = octave_rand::distribution(); | std::string rand_dist = octave_rand::distribution (); | |||
octave_rand::distribution("uniform"); | octave_rand::distribution ("uniform"); | |||
resid = ColumnVector (octave_rand::vector(n)); | resid = ColumnVector (octave_rand::vector (n)); | |||
octave_rand::distribution(rand_dist); | octave_rand::distribution (rand_dist); | |||
} | } | |||
if (n < 3) | if (n < 3) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: n must be at least 3"); | ("eigs: n must be at least 3"); | |||
return -1; | return -1; | |||
} | } | |||
if (p < 0) | if (p < 0) | |||
skipping to change at line 1741 | skipping to change at line 1743 | |||
p = 20; | p = 20; | |||
if (p > n - 1) | if (p > n - 1) | |||
p = n - 1 ; | p = n - 1 ; | |||
} | } | |||
if (k <= 0 || k >= n - 1) | if (k <= 0 || k >= n - 1) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | |||
" Use 'eig(full(A))' instead"); | " Use 'eig (full (A))' instead"); | |||
return -1; | return -1; | |||
} | } | |||
if (p <= k || p >= n) | if (p <= k || p >= n) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: opts.p must be greater than k and less than n"); | ("eigs: opts.p must be greater than k and less than n"); | |||
return -1; | return -1; | |||
} | } | |||
if (have_b && cholB && permB.length() != 0) | if (have_b && cholB && permB.length () != 0) | |||
{ | { | |||
// Check the we really have a permutation vector | // Check the we really have a permutation vector | |||
if (permB.length() != n) | if (permB.length () != n) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: permB vector invalid"); | ("eigs: permB vector invalid"); | |||
return -1; | return -1; | |||
} | } | |||
else | else | |||
{ | { | |||
Array<bool> checked (dim_vector (n, 1), false); | Array<bool> checked (dim_vector (n, 1), false); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
{ | { | |||
skipping to change at line 1802 | skipping to change at line 1804 | |||
return -1; | return -1; | |||
} | } | |||
if (have_b) | if (have_b) | |||
{ | { | |||
// See Note 3 dsaupd | // See Note 3 dsaupd | |||
note3 = true; | note3 = true; | |||
if (cholB) | if (cholB) | |||
{ | { | |||
bt = b; | bt = b; | |||
b = b.transpose(); | b = b.transpose (); | |||
if (permB.length() == 0) | if (permB.length () == 0) | |||
{ | { | |||
permB = ColumnVector(n); | permB = ColumnVector (n); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
permB(i) = i; | permB(i) = i; | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
if (! make_cholb(b, bt, permB)) | if (! make_cholb (b, bt, permB)) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: The matrix B is not positive definite"); | ("eigs: The matrix B is not positive definite"); | |||
return -1; | return -1; | |||
} | } | |||
} | } | |||
} | } | |||
Array<octave_idx_type> ip (dim_vector (11, 1)); | Array<octave_idx_type> ip (dim_vector (11, 1)); | |||
octave_idx_type *iparam = ip.fortran_vec (); | octave_idx_type *iparam = ip.fortran_vec (); | |||
skipping to change at line 1853 | skipping to change at line 1855 | |||
OCTAVE_LOCAL_BUFFER (double, v, n * (p + 1)); | OCTAVE_LOCAL_BUFFER (double, v, n * (p + 1)); | |||
OCTAVE_LOCAL_BUFFER (double, workl, lwork + 1); | OCTAVE_LOCAL_BUFFER (double, workl, lwork + 1); | |||
OCTAVE_LOCAL_BUFFER (double, workd, 3 * n + 1); | OCTAVE_LOCAL_BUFFER (double, workd, 3 * n + 1); | |||
double *presid = resid.fortran_vec (); | double *presid = resid.fortran_vec (); | |||
do | do | |||
{ | { | |||
F77_FUNC (dnaupd, DNAUPD) | F77_FUNC (dnaupd, DNAUPD) | |||
(ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | |||
F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), | F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), | |||
k, tol, presid, p, v, n, iparam, | k, tol, presid, p, v, n, iparam, | |||
ipntr, workd, workl, lwork, info | ipntr, workd, workl, lwork, info | |||
F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | |||
if (f77_exception_encountered) | if (f77_exception_encountered) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: unrecoverable exception encountered in dnaupd"); | ("eigs: unrecoverable exception encountered in dnaupd"); | |||
return -1; | return -1; | |||
} | } | |||
if (disp > 0 && !xisnan(workl[iptr(5)-1])) | if (disp > 0 && !xisnan(workl[iptr(5)-1])) | |||
{ | { | |||
if (iter++) | if (iter++) | |||
{ | { | |||
os << "Iteration " << iter - 1 << | os << "Iteration " << iter - 1 << | |||
": a few Ritz values of the " << p << "-by-" << | ": a few Ritz values of the " << p << "-by-" << | |||
p << " matrix\n"; | p << " matrix\n"; | |||
for (int i = 0 ; i < k; i++) | for (int i = 0 ; i < k; i++) | |||
os << " " << workl[iptr(5)+i-1] << "\n"; | os << " " << workl[iptr(5)+i-1] << "\n"; | |||
} | } | |||
// This is a kludge, as ARPACK doesn't give its | // This is a kludge, as ARPACK doesn't give its | |||
// iteration pointer. But as workl[iptr(5)-1] is | // iteration pointer. But as workl[iptr(5)-1] is | |||
// an output value updated at each iteration, setting | // an output value updated at each iteration, setting | |||
// a value in this array to NaN and testing for it | // a value in this array to NaN and testing for it | |||
// is a way of obtaining the iteration counter. | // is a way of obtaining the iteration counter. | |||
if (ido != 99) | if (ido != 99) | |||
skipping to change at line 1893 | skipping to change at line 1895 | |||
} | } | |||
if (ido == -1 || ido == 1 || ido == 2) | if (ido == -1 || ido == 1 || ido == 2) | |||
{ | { | |||
if (have_b) | if (have_b) | |||
{ | { | |||
Matrix mtmp (n,1); | Matrix mtmp (n,1); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
mtmp(i,0) = workd[i + iptr(0) - 1]; | mtmp(i,0) = workd[i + iptr(0) - 1]; | |||
mtmp = utsolve(bt, permB, m * ltsolve(b, permB, mtmp)); | mtmp = utsolve (bt, permB, m * ltsolve (b, permB, mtmp)); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
workd[i+iptr(1)-1] = mtmp(i,0); | workd[i+iptr(1)-1] = mtmp(i,0); | |||
} | } | |||
else if (!vector_product (m, workd + iptr(0) - 1, | else if (!vector_product (m, workd + iptr(0) - 1, | |||
workd + iptr(1) - 1)) | workd + iptr(1) - 1)) | |||
break; | break; | |||
} | } | |||
else | else | |||
{ | { | |||
skipping to change at line 1927 | skipping to change at line 1929 | |||
// We have a problem in that the size of the C++ bool | // We have a problem in that the size of the C++ bool | |||
// type relative to the fortran logical type. It appears | // type relative to the fortran logical type. It appears | |||
// that fortran uses 4- or 8-bytes per logical and C++ 1-byte | // that fortran uses 4- or 8-bytes per logical and C++ 1-byte | |||
// per bool, though this might be system dependent. As | // per bool, though this might be system dependent. As | |||
// long as the HOWMNY arg is not "S", the logical array | // long as the HOWMNY arg is not "S", the logical array | |||
// is just workspace for ARPACK, so use int type to | // is just workspace for ARPACK, so use int type to | |||
// avoid problems. | // avoid problems. | |||
Array<octave_idx_type> s (dim_vector (p, 1)); | Array<octave_idx_type> s (dim_vector (p, 1)); | |||
octave_idx_type *sel = s.fortran_vec (); | octave_idx_type *sel = s.fortran_vec (); | |||
// FIXME -- initialize eig_vec2 to zero; apparently dneupd can skip | // FIXME: initialize eig_vec2 to zero; apparently dneupd can skip | |||
// the assignment to elements of Z that represent imaginary parts. | // the assignment to elements of Z that represent imaginary parts. | |||
// Found with valgrind and | // Found with valgrind and | |||
// | // | |||
// A = [1,0,0,-1;0,1,0,0;0,0,1,0;0,0,2,1]; | // A = [1,0,0,-1;0,1,0,0;0,0,1,0;0,0,2,1]; | |||
// [vecs, vals, f] = eigs (A, 1) | // [vecs, vals, f] = eigs (A, 1) | |||
Matrix eig_vec2 (n, k + 1, 0.0); | Matrix eig_vec2 (n, k + 1, 0.0); | |||
double *z = eig_vec2.fortran_vec (); | double *z = eig_vec2.fortran_vec (); | |||
OCTAVE_LOCAL_BUFFER (double, dr, k + 1); | OCTAVE_LOCAL_BUFFER (double, dr, k + 1); | |||
skipping to change at line 1969 | skipping to change at line 1971 | |||
Complex *d = eig_val.fortran_vec (); | Complex *d = eig_val.fortran_vec (); | |||
if (info2 == 0) | if (info2 == 0) | |||
{ | { | |||
octave_idx_type jj = 0; | octave_idx_type jj = 0; | |||
for (octave_idx_type i = 0; i < k+1; i++) | for (octave_idx_type i = 0; i < k+1; i++) | |||
{ | { | |||
if (dr[i] == 0.0 && di[i] == 0.0 && jj == 0) | if (dr[i] == 0.0 && di[i] == 0.0 && jj == 0) | |||
jj++; | jj++; | |||
else | else | |||
d [i-jj] = Complex (dr[i], di[i]); | d[i-jj] = Complex (dr[i], di[i]); | |||
} | } | |||
if (jj == 0 && !rvec) | if (jj == 0 && !rvec) | |||
for (octave_idx_type i = 0; i < k; i++) | for (octave_idx_type i = 0; i < k; i++) | |||
d[i] = d[i+1]; | d[i] = d[i+1]; | |||
octave_idx_type k2 = k / 2; | octave_idx_type k2 = k / 2; | |||
for (octave_idx_type i = 0; i < k2; i++) | for (octave_idx_type i = 0; i < k2; i++) | |||
{ | { | |||
Complex dtmp = d[i]; | Complex dtmp = d[i]; | |||
d[i] = d[k - i - 1]; | d[i] = d[k - i - 1]; | |||
d[k - i - 1] = dtmp; | d[k - i - 1] = dtmp; | |||
} | } | |||
eig_val.resize(k); | eig_val.resize (k); | |||
if (rvec) | if (rvec) | |||
{ | { | |||
OCTAVE_LOCAL_BUFFER (double, dtmp, n); | OCTAVE_LOCAL_BUFFER (double, dtmp, n); | |||
for (octave_idx_type i = 0; i < k2; i++) | for (octave_idx_type i = 0; i < k2; i++) | |||
{ | { | |||
octave_idx_type off1 = i * n; | octave_idx_type off1 = i * n; | |||
octave_idx_type off2 = (k - i - 1) * n; | octave_idx_type off2 = (k - i - 1) * n; | |||
skipping to change at line 2012 | skipping to change at line 2014 | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
z[off2 + j] = dtmp[j]; | z[off2 + j] = dtmp[j]; | |||
} | } | |||
eig_vec.resize (n, k); | eig_vec.resize (n, k); | |||
octave_idx_type i = 0; | octave_idx_type i = 0; | |||
while (i < k) | while (i < k) | |||
{ | { | |||
octave_idx_type off1 = i * n; | octave_idx_type off1 = i * n; | |||
octave_idx_type off2 = (i+1) * n; | octave_idx_type off2 = (i+1) * n; | |||
if (std::imag(eig_val(i)) == 0) | if (std::imag (eig_val(i)) == 0) | |||
{ | { | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
eig_vec(j,i) = | eig_vec(j,i) = | |||
Complex(z[j+off1],0.); | Complex (z[j+off1],0.); | |||
i++; | i++; | |||
} | } | |||
else | else | |||
{ | { | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
{ | { | |||
eig_vec(j,i) = | eig_vec(j,i) = | |||
Complex(z[j+off1],z[j+off2]); | Complex (z[j+off1],z[j+off2]); | |||
if (i < k - 1) | if (i < k - 1) | |||
eig_vec(j,i+1) = | eig_vec(j,i+1) = | |||
Complex(z[j+off1],-z[j+off2]); | Complex (z[j+off1],-z[j+off2]); | |||
} | } | |||
i+=2; | i+=2; | |||
} | } | |||
} | } | |||
if (note3) | if (note3) | |||
eig_vec = ltsolve(M (b), permB, eig_vec); | eig_vec = ltsolve (M(b), permB, eig_vec); | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: error %d in dneupd", info2); | ("eigs: error %d in dneupd", info2); | |||
return -1; | return -1; | |||
} | } | |||
} | } | |||
skipping to change at line 2062 | skipping to change at line 2064 | |||
octave_idx_type &info, | octave_idx_type &info, | |||
ComplexMatrix &eig_vec, | ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, const M& _b, | ComplexColumnVector &eig_val, const M& _b, | |||
ColumnVector &permB, ColumnVector &resid, | ColumnVector &permB, ColumnVector &resid, | |||
std::ostream& os, double tol, bool rvec, | std::ostream& os, double tol, bool rvec, | |||
bool cholB, int disp, int maxit) | bool cholB, int disp, int maxit) | |||
{ | { | |||
M b(_b); | M b(_b); | |||
octave_idx_type n = m.cols (); | octave_idx_type n = m.cols (); | |||
octave_idx_type mode = 3; | octave_idx_type mode = 3; | |||
bool have_b = ! b.is_empty(); | bool have_b = ! b.is_empty (); | |||
std::string typ = "LM"; | std::string typ = "LM"; | |||
double sigmai = 0.; | double sigmai = 0.; | |||
if (m.rows() != m.cols()) | if (m.rows () != m.cols ()) | |||
{ | { | |||
(*current_liboctave_error_handler) ("eigs: A must be square"); | (*current_liboctave_error_handler) ("eigs: A must be square"); | |||
return -1; | return -1; | |||
} | } | |||
if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) | if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ())) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: B must be square and the same size as A"); | ("eigs: B must be square and the same size as A"); | |||
return -1; | return -1; | |||
} | } | |||
// FIXME: The "SM" type for mode 1 seems unstable though faster!! | // FIXME: The "SM" type for mode 1 seems unstable though faster!! | |||
//if (! std::abs (sigmar)) | //if (! std::abs (sigmar)) | |||
// return EigsRealNonSymmetricMatrix (m, "SM", k, p, info, eig_vec, eig_ val, | // return EigsRealNonSymmetricMatrix (m, "SM", k, p, info, eig_vec, eig_ val, | |||
// _b, permB, resid, os, tol, rvec, cho lB, | // _b, permB, resid, os, tol, rvec, cho lB, | |||
// disp, maxit); | // disp, maxit); | |||
if (resid.is_empty()) | if (resid.is_empty ()) | |||
{ | { | |||
std::string rand_dist = octave_rand::distribution(); | std::string rand_dist = octave_rand::distribution (); | |||
octave_rand::distribution("uniform"); | octave_rand::distribution ("uniform"); | |||
resid = ColumnVector (octave_rand::vector(n)); | resid = ColumnVector (octave_rand::vector (n)); | |||
octave_rand::distribution(rand_dist); | octave_rand::distribution (rand_dist); | |||
} | } | |||
if (n < 3) | if (n < 3) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: n must be at least 3"); | ("eigs: n must be at least 3"); | |||
return -1; | return -1; | |||
} | } | |||
if (p < 0) | if (p < 0) | |||
skipping to change at line 2114 | skipping to change at line 2116 | |||
p = 20; | p = 20; | |||
if (p > n - 1) | if (p > n - 1) | |||
p = n - 1 ; | p = n - 1 ; | |||
} | } | |||
if (k <= 0 || k >= n - 1) | if (k <= 0 || k >= n - 1) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | |||
" Use 'eig(full(A))' instead"); | " Use 'eig (full (A))' instead"); | |||
return -1; | return -1; | |||
} | } | |||
if (p <= k || p >= n) | if (p <= k || p >= n) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: opts.p must be greater than k and less than n"); | ("eigs: opts.p must be greater than k and less than n"); | |||
return -1; | return -1; | |||
} | } | |||
if (have_b && cholB && permB.length() != 0) | if (have_b && cholB && permB.length () != 0) | |||
{ | { | |||
// Check that we really have a permutation vector | // Check that we really have a permutation vector | |||
if (permB.length() != n) | if (permB.length () != n) | |||
{ | { | |||
(*current_liboctave_error_handler) ("eigs: permB vector invalid") ; | (*current_liboctave_error_handler) ("eigs: permB vector invalid") ; | |||
return -1; | return -1; | |||
} | } | |||
else | else | |||
{ | { | |||
Array<bool> checked (dim_vector (n, 1), false); | Array<bool> checked (dim_vector (n, 1), false); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
{ | { | |||
octave_idx_type bidx = | octave_idx_type bidx = | |||
skipping to change at line 2178 | skipping to change at line 2180 | |||
ip(10) = 0; | ip(10) = 0; | |||
// ip(7) to ip(10) return values | // ip(7) to ip(10) return values | |||
Array<octave_idx_type> iptr (dim_vector (14, 1)); | Array<octave_idx_type> iptr (dim_vector (14, 1)); | |||
octave_idx_type *ipntr = iptr.fortran_vec (); | octave_idx_type *ipntr = iptr.fortran_vec (); | |||
octave_idx_type ido = 0; | octave_idx_type ido = 0; | |||
int iter = 0; | int iter = 0; | |||
M L, U; | M L, U; | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows() : m.rows())); | OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows () : m.rows ()) | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols() : m.cols())); | ); | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols () : m.cols ()) | ||||
); | ||||
if (! LuAminusSigmaB(m, b, cholB, permB, sigmar, L, U, P, Q)) | if (! LuAminusSigmaB (m, b, cholB, permB, sigmar, L, U, P, Q)) | |||
return -1; | return -1; | |||
octave_idx_type lwork = 3 * p * (p + 2); | octave_idx_type lwork = 3 * p * (p + 2); | |||
OCTAVE_LOCAL_BUFFER (double, v, n * (p + 1)); | OCTAVE_LOCAL_BUFFER (double, v, n * (p + 1)); | |||
OCTAVE_LOCAL_BUFFER (double, workl, lwork + 1); | OCTAVE_LOCAL_BUFFER (double, workl, lwork + 1); | |||
OCTAVE_LOCAL_BUFFER (double, workd, 3 * n + 1); | OCTAVE_LOCAL_BUFFER (double, workd, 3 * n + 1); | |||
double *presid = resid.fortran_vec (); | double *presid = resid.fortran_vec (); | |||
do | do | |||
{ | { | |||
F77_FUNC (dnaupd, DNAUPD) | F77_FUNC (dnaupd, DNAUPD) | |||
(ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | |||
F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), | F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), | |||
k, tol, presid, p, v, n, iparam, | k, tol, presid, p, v, n, iparam, | |||
ipntr, workd, workl, lwork, info | ipntr, workd, workl, lwork, info | |||
F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | |||
if (f77_exception_encountered) | if (f77_exception_encountered) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: unrecoverable exception encountered in dsaupd"); | ("eigs: unrecoverable exception encountered in dsaupd"); | |||
return -1; | return -1; | |||
} | } | |||
if (disp > 0 && !xisnan(workl[iptr(5)-1])) | if (disp > 0 && !xisnan (workl[iptr (5)-1])) | |||
{ | { | |||
if (iter++) | if (iter++) | |||
{ | { | |||
os << "Iteration " << iter - 1 << | os << "Iteration " << iter - 1 << | |||
": a few Ritz values of the " << p << "-by-" << | ": a few Ritz values of the " << p << "-by-" << | |||
p << " matrix\n"; | p << " matrix\n"; | |||
for (int i = 0 ; i < k; i++) | for (int i = 0 ; i < k; i++) | |||
os << " " << workl[iptr(5)+i-1] << "\n"; | os << " " << workl[iptr(5)+i-1] << "\n"; | |||
} | } | |||
// This is a kludge, as ARPACK doesn't give its | // This is a kludge, as ARPACK doesn't give its | |||
// iteration pointer. But as workl[iptr(5)-1] is | // iteration pointer. But as workl[iptr(5)-1] is | |||
// an output value updated at each iteration, setting | // an output value updated at each iteration, setting | |||
// a value in this array to NaN and testing for it | // a value in this array to NaN and testing for it | |||
// is a way of obtaining the iteration counter. | // is a way of obtaining the iteration counter. | |||
if (ido != 99) | if (ido != 99) | |||
skipping to change at line 2313 | skipping to change at line 2315 | |||
// We have a problem in that the size of the C++ bool | // We have a problem in that the size of the C++ bool | |||
// type relative to the fortran logical type. It appears | // type relative to the fortran logical type. It appears | |||
// that fortran uses 4- or 8-bytes per logical and C++ 1-byte | // that fortran uses 4- or 8-bytes per logical and C++ 1-byte | |||
// per bool, though this might be system dependent. As | // per bool, though this might be system dependent. As | |||
// long as the HOWMNY arg is not "S", the logical array | // long as the HOWMNY arg is not "S", the logical array | |||
// is just workspace for ARPACK, so use int type to | // is just workspace for ARPACK, so use int type to | |||
// avoid problems. | // avoid problems. | |||
Array<octave_idx_type> s (dim_vector (p, 1)); | Array<octave_idx_type> s (dim_vector (p, 1)); | |||
octave_idx_type *sel = s.fortran_vec (); | octave_idx_type *sel = s.fortran_vec (); | |||
// FIXME -- initialize eig_vec2 to zero; apparently dneupd can skip | // FIXME: initialize eig_vec2 to zero; apparently dneupd can skip | |||
// the assignment to elements of Z that represent imaginary parts. | // the assignment to elements of Z that represent imaginary parts. | |||
// Found with valgrind and | // Found with valgrind and | |||
// | // | |||
// A = [1,0,0,-1;0,1,0,0;0,0,1,0;0,0,2,1]; | // A = [1,0,0,-1;0,1,0,0;0,0,1,0;0,0,2,1]; | |||
// [vecs, vals, f] = eigs (A, 1) | // [vecs, vals, f] = eigs (A, 1) | |||
Matrix eig_vec2 (n, k + 1, 0.0); | Matrix eig_vec2 (n, k + 1, 0.0); | |||
double *z = eig_vec2.fortran_vec (); | double *z = eig_vec2.fortran_vec (); | |||
OCTAVE_LOCAL_BUFFER (double, dr, k + 1); | OCTAVE_LOCAL_BUFFER (double, dr, k + 1); | |||
skipping to change at line 2355 | skipping to change at line 2357 | |||
Complex *d = eig_val.fortran_vec (); | Complex *d = eig_val.fortran_vec (); | |||
if (info2 == 0) | if (info2 == 0) | |||
{ | { | |||
octave_idx_type jj = 0; | octave_idx_type jj = 0; | |||
for (octave_idx_type i = 0; i < k+1; i++) | for (octave_idx_type i = 0; i < k+1; i++) | |||
{ | { | |||
if (dr[i] == 0.0 && di[i] == 0.0 && jj == 0) | if (dr[i] == 0.0 && di[i] == 0.0 && jj == 0) | |||
jj++; | jj++; | |||
else | else | |||
d [i-jj] = Complex (dr[i], di[i]); | d[i-jj] = Complex (dr[i], di[i]); | |||
} | } | |||
if (jj == 0 && !rvec) | if (jj == 0 && !rvec) | |||
for (octave_idx_type i = 0; i < k; i++) | for (octave_idx_type i = 0; i < k; i++) | |||
d[i] = d[i+1]; | d[i] = d[i+1]; | |||
octave_idx_type k2 = k / 2; | octave_idx_type k2 = k / 2; | |||
for (octave_idx_type i = 0; i < k2; i++) | for (octave_idx_type i = 0; i < k2; i++) | |||
{ | { | |||
Complex dtmp = d[i]; | Complex dtmp = d[i]; | |||
d[i] = d[k - i - 1]; | d[i] = d[k - i - 1]; | |||
d[k - i - 1] = dtmp; | d[k - i - 1] = dtmp; | |||
} | } | |||
eig_val.resize(k); | eig_val.resize (k); | |||
if (rvec) | if (rvec) | |||
{ | { | |||
OCTAVE_LOCAL_BUFFER (double, dtmp, n); | OCTAVE_LOCAL_BUFFER (double, dtmp, n); | |||
for (octave_idx_type i = 0; i < k2; i++) | for (octave_idx_type i = 0; i < k2; i++) | |||
{ | { | |||
octave_idx_type off1 = i * n; | octave_idx_type off1 = i * n; | |||
octave_idx_type off2 = (k - i - 1) * n; | octave_idx_type off2 = (k - i - 1) * n; | |||
skipping to change at line 2398 | skipping to change at line 2400 | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
z[off2 + j] = dtmp[j]; | z[off2 + j] = dtmp[j]; | |||
} | } | |||
eig_vec.resize (n, k); | eig_vec.resize (n, k); | |||
octave_idx_type i = 0; | octave_idx_type i = 0; | |||
while (i < k) | while (i < k) | |||
{ | { | |||
octave_idx_type off1 = i * n; | octave_idx_type off1 = i * n; | |||
octave_idx_type off2 = (i+1) * n; | octave_idx_type off2 = (i+1) * n; | |||
if (std::imag(eig_val(i)) == 0) | if (std::imag (eig_val(i)) == 0) | |||
{ | { | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
eig_vec(j,i) = | eig_vec(j,i) = | |||
Complex(z[j+off1],0.); | Complex (z[j+off1],0.); | |||
i++; | i++; | |||
} | } | |||
else | else | |||
{ | { | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
{ | { | |||
eig_vec(j,i) = | eig_vec(j,i) = | |||
Complex(z[j+off1],z[j+off2]); | Complex (z[j+off1],z[j+off2]); | |||
if (i < k - 1) | if (i < k - 1) | |||
eig_vec(j,i+1) = | eig_vec(j,i+1) = | |||
Complex(z[j+off1],-z[j+off2]); | Complex (z[j+off1],-z[j+off2]); | |||
} | } | |||
i+=2; | i+=2; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: error %d in dneupd", info2); | ("eigs: error %d in dneupd", info2); | |||
skipping to change at line 2447 | skipping to change at line 2449 | |||
std::ostream& os, double tol, bool rvec, | std::ostream& os, double tol, bool rvec, | |||
bool /* cholB */, int disp, int maxit) | bool /* cholB */, int disp, int maxit) | |||
{ | { | |||
std::string typ (_typ); | std::string typ (_typ); | |||
bool have_sigma = (sigmar ? true : false); | bool have_sigma = (sigmar ? true : false); | |||
char bmat = 'I'; | char bmat = 'I'; | |||
double sigmai = 0.; | double sigmai = 0.; | |||
octave_idx_type mode = 1; | octave_idx_type mode = 1; | |||
int err = 0; | int err = 0; | |||
if (resid.is_empty()) | if (resid.is_empty ()) | |||
{ | { | |||
std::string rand_dist = octave_rand::distribution(); | std::string rand_dist = octave_rand::distribution (); | |||
octave_rand::distribution("uniform"); | octave_rand::distribution ("uniform"); | |||
resid = ColumnVector (octave_rand::vector(n)); | resid = ColumnVector (octave_rand::vector (n)); | |||
octave_rand::distribution(rand_dist); | octave_rand::distribution (rand_dist); | |||
} | } | |||
if (n < 3) | if (n < 3) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: n must be at least 3"); | ("eigs: n must be at least 3"); | |||
return -1; | return -1; | |||
} | } | |||
if (p < 0) | if (p < 0) | |||
skipping to change at line 2477 | skipping to change at line 2479 | |||
p = 20; | p = 20; | |||
if (p > n - 1) | if (p > n - 1) | |||
p = n - 1 ; | p = n - 1 ; | |||
} | } | |||
if (k <= 0 || k >= n - 1) | if (k <= 0 || k >= n - 1) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | |||
" Use 'eig(full(A))' instead"); | " Use 'eig (full (A))' instead"); | |||
return -1; | return -1; | |||
} | } | |||
if (p <= k || p >= n) | if (p <= k || p >= n) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: opts.p must be greater than k and less than n"); | ("eigs: opts.p must be greater than k and less than n"); | |||
return -1; | return -1; | |||
} | } | |||
skipping to change at line 2550 | skipping to change at line 2552 | |||
OCTAVE_LOCAL_BUFFER (double, v, n * (p + 1)); | OCTAVE_LOCAL_BUFFER (double, v, n * (p + 1)); | |||
OCTAVE_LOCAL_BUFFER (double, workl, lwork + 1); | OCTAVE_LOCAL_BUFFER (double, workl, lwork + 1); | |||
OCTAVE_LOCAL_BUFFER (double, workd, 3 * n + 1); | OCTAVE_LOCAL_BUFFER (double, workd, 3 * n + 1); | |||
double *presid = resid.fortran_vec (); | double *presid = resid.fortran_vec (); | |||
do | do | |||
{ | { | |||
F77_FUNC (dnaupd, DNAUPD) | F77_FUNC (dnaupd, DNAUPD) | |||
(ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | |||
F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), | F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), | |||
k, tol, presid, p, v, n, iparam, | k, tol, presid, p, v, n, iparam, | |||
ipntr, workd, workl, lwork, info | ipntr, workd, workl, lwork, info | |||
F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | |||
if (f77_exception_encountered) | if (f77_exception_encountered) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: unrecoverable exception encountered in dnaupd"); | ("eigs: unrecoverable exception encountered in dnaupd"); | |||
return -1; | return -1; | |||
} | } | |||
if (disp > 0 && !xisnan(workl[iptr(5)-1])) | if (disp > 0 && !xisnan(workl[iptr(5)-1])) | |||
{ | { | |||
if (iter++) | if (iter++) | |||
{ | { | |||
os << "Iteration " << iter - 1 << | os << "Iteration " << iter - 1 << | |||
": a few Ritz values of the " << p << "-by-" << | ": a few Ritz values of the " << p << "-by-" << | |||
p << " matrix\n"; | p << " matrix\n"; | |||
for (int i = 0 ; i < k; i++) | for (int i = 0 ; i < k; i++) | |||
os << " " << workl[iptr(5)+i-1] << "\n"; | os << " " << workl[iptr(5)+i-1] << "\n"; | |||
} | } | |||
// This is a kludge, as ARPACK doesn't give its | // This is a kludge, as ARPACK doesn't give its | |||
// iteration pointer. But as workl[iptr(5)-1] is | // iteration pointer. But as workl[iptr(5)-1] is | |||
// an output value updated at each iteration, setting | // an output value updated at each iteration, setting | |||
// a value in this array to NaN and testing for it | // a value in this array to NaN and testing for it | |||
// is a way of obtaining the iteration counter. | // is a way of obtaining the iteration counter. | |||
if (ido != 99) | if (ido != 99) | |||
skipping to change at line 2624 | skipping to change at line 2626 | |||
// We have a problem in that the size of the C++ bool | // We have a problem in that the size of the C++ bool | |||
// type relative to the fortran logical type. It appears | // type relative to the fortran logical type. It appears | |||
// that fortran uses 4- or 8-bytes per logical and C++ 1-byte | // that fortran uses 4- or 8-bytes per logical and C++ 1-byte | |||
// per bool, though this might be system dependent. As | // per bool, though this might be system dependent. As | |||
// long as the HOWMNY arg is not "S", the logical array | // long as the HOWMNY arg is not "S", the logical array | |||
// is just workspace for ARPACK, so use int type to | // is just workspace for ARPACK, so use int type to | |||
// avoid problems. | // avoid problems. | |||
Array<octave_idx_type> s (dim_vector (p, 1)); | Array<octave_idx_type> s (dim_vector (p, 1)); | |||
octave_idx_type *sel = s.fortran_vec (); | octave_idx_type *sel = s.fortran_vec (); | |||
// FIXME -- initialize eig_vec2 to zero; apparently dneupd can skip | // FIXME: initialize eig_vec2 to zero; apparently dneupd can skip | |||
// the assignment to elements of Z that represent imaginary parts. | // the assignment to elements of Z that represent imaginary parts. | |||
// Found with valgrind and | // Found with valgrind and | |||
// | // | |||
// A = [1,0,0,-1;0,1,0,0;0,0,1,0;0,0,2,1]; | // A = [1,0,0,-1;0,1,0,0;0,0,1,0;0,0,2,1]; | |||
// [vecs, vals, f] = eigs (A, 1) | // [vecs, vals, f] = eigs (A, 1) | |||
Matrix eig_vec2 (n, k + 1, 0.0); | Matrix eig_vec2 (n, k + 1, 0.0); | |||
double *z = eig_vec2.fortran_vec (); | double *z = eig_vec2.fortran_vec (); | |||
OCTAVE_LOCAL_BUFFER (double, dr, k + 1); | OCTAVE_LOCAL_BUFFER (double, dr, k + 1); | |||
skipping to change at line 2666 | skipping to change at line 2668 | |||
Complex *d = eig_val.fortran_vec (); | Complex *d = eig_val.fortran_vec (); | |||
if (info2 == 0) | if (info2 == 0) | |||
{ | { | |||
octave_idx_type jj = 0; | octave_idx_type jj = 0; | |||
for (octave_idx_type i = 0; i < k+1; i++) | for (octave_idx_type i = 0; i < k+1; i++) | |||
{ | { | |||
if (dr[i] == 0.0 && di[i] == 0.0 && jj == 0) | if (dr[i] == 0.0 && di[i] == 0.0 && jj == 0) | |||
jj++; | jj++; | |||
else | else | |||
d [i-jj] = Complex (dr[i], di[i]); | d[i-jj] = Complex (dr[i], di[i]); | |||
} | } | |||
if (jj == 0 && !rvec) | if (jj == 0 && !rvec) | |||
for (octave_idx_type i = 0; i < k; i++) | for (octave_idx_type i = 0; i < k; i++) | |||
d[i] = d[i+1]; | d[i] = d[i+1]; | |||
octave_idx_type k2 = k / 2; | octave_idx_type k2 = k / 2; | |||
for (octave_idx_type i = 0; i < k2; i++) | for (octave_idx_type i = 0; i < k2; i++) | |||
{ | { | |||
Complex dtmp = d[i]; | Complex dtmp = d[i]; | |||
d[i] = d[k - i - 1]; | d[i] = d[k - i - 1]; | |||
d[k - i - 1] = dtmp; | d[k - i - 1] = dtmp; | |||
} | } | |||
eig_val.resize(k); | eig_val.resize (k); | |||
if (rvec) | if (rvec) | |||
{ | { | |||
OCTAVE_LOCAL_BUFFER (double, dtmp, n); | OCTAVE_LOCAL_BUFFER (double, dtmp, n); | |||
for (octave_idx_type i = 0; i < k2; i++) | for (octave_idx_type i = 0; i < k2; i++) | |||
{ | { | |||
octave_idx_type off1 = i * n; | octave_idx_type off1 = i * n; | |||
octave_idx_type off2 = (k - i - 1) * n; | octave_idx_type off2 = (k - i - 1) * n; | |||
skipping to change at line 2709 | skipping to change at line 2711 | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
z[off2 + j] = dtmp[j]; | z[off2 + j] = dtmp[j]; | |||
} | } | |||
eig_vec.resize (n, k); | eig_vec.resize (n, k); | |||
octave_idx_type i = 0; | octave_idx_type i = 0; | |||
while (i < k) | while (i < k) | |||
{ | { | |||
octave_idx_type off1 = i * n; | octave_idx_type off1 = i * n; | |||
octave_idx_type off2 = (i+1) * n; | octave_idx_type off2 = (i+1) * n; | |||
if (std::imag(eig_val(i)) == 0) | if (std::imag (eig_val(i)) == 0) | |||
{ | { | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
eig_vec(j,i) = | eig_vec(j,i) = | |||
Complex(z[j+off1],0.); | Complex (z[j+off1],0.); | |||
i++; | i++; | |||
} | } | |||
else | else | |||
{ | { | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
{ | { | |||
eig_vec(j,i) = | eig_vec(j,i) = | |||
Complex(z[j+off1],z[j+off2]); | Complex (z[j+off1],z[j+off2]); | |||
if (i < k - 1) | if (i < k - 1) | |||
eig_vec(j,i+1) = | eig_vec(j,i+1) = | |||
Complex(z[j+off1],-z[j+off2]); | Complex (z[j+off1],-z[j+off2]); | |||
} | } | |||
i+=2; | i+=2; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: error %d in dneupd", info2); | ("eigs: error %d in dneupd", info2); | |||
skipping to change at line 2756 | skipping to change at line 2758 | |||
octave_idx_type &info, ComplexMatrix &eig_ve c, | octave_idx_type &info, ComplexMatrix &eig_ve c, | |||
ComplexColumnVector &eig_val, const M& _b, | ComplexColumnVector &eig_val, const M& _b, | |||
ColumnVector &permB, | ColumnVector &permB, | |||
ComplexColumnVector &cresid, | ComplexColumnVector &cresid, | |||
std::ostream& os, double tol, bool rvec, | std::ostream& os, double tol, bool rvec, | |||
bool cholB, int disp, int maxit) | bool cholB, int disp, int maxit) | |||
{ | { | |||
M b(_b); | M b(_b); | |||
octave_idx_type n = m.cols (); | octave_idx_type n = m.cols (); | |||
octave_idx_type mode = 1; | octave_idx_type mode = 1; | |||
bool have_b = ! b.is_empty(); | bool have_b = ! b.is_empty (); | |||
bool note3 = false; | bool note3 = false; | |||
char bmat = 'I'; | char bmat = 'I'; | |||
Complex sigma = 0.; | Complex sigma = 0.; | |||
M bt; | M bt; | |||
if (m.rows() != m.cols()) | if (m.rows () != m.cols ()) | |||
{ | { | |||
(*current_liboctave_error_handler) ("eigs: A must be square"); | (*current_liboctave_error_handler) ("eigs: A must be square"); | |||
return -1; | return -1; | |||
} | } | |||
if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) | if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ())) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: B must be square and the same size as A"); | ("eigs: B must be square and the same size as A"); | |||
return -1; | return -1; | |||
} | } | |||
if (cresid.is_empty()) | if (cresid.is_empty ()) | |||
{ | { | |||
std::string rand_dist = octave_rand::distribution(); | std::string rand_dist = octave_rand::distribution (); | |||
octave_rand::distribution("uniform"); | octave_rand::distribution ("uniform"); | |||
Array<double> rr (octave_rand::vector(n)); | Array<double> rr (octave_rand::vector (n)); | |||
Array<double> ri (octave_rand::vector(n)); | Array<double> ri (octave_rand::vector (n)); | |||
cresid = ComplexColumnVector (n); | cresid = ComplexColumnVector (n); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
cresid(i) = Complex(rr(i),ri(i)); | cresid(i) = Complex (rr(i),ri(i)); | |||
octave_rand::distribution(rand_dist); | octave_rand::distribution (rand_dist); | |||
} | } | |||
if (n < 3) | if (n < 3) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: n must be at least 3"); | ("eigs: n must be at least 3"); | |||
return -1; | return -1; | |||
} | } | |||
if (p < 0) | if (p < 0) | |||
skipping to change at line 2808 | skipping to change at line 2810 | |||
p = 20; | p = 20; | |||
if (p > n - 1) | if (p > n - 1) | |||
p = n - 1 ; | p = n - 1 ; | |||
} | } | |||
if (k <= 0 || k >= n - 1) | if (k <= 0 || k >= n - 1) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | |||
" Use 'eig(full(A))' instead"); | " Use 'eig (full (A))' instead"); | |||
return -1; | return -1; | |||
} | } | |||
if (p <= k || p >= n) | if (p <= k || p >= n) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: opts.p must be greater than k and less than n"); | ("eigs: opts.p must be greater than k and less than n"); | |||
return -1; | return -1; | |||
} | } | |||
if (have_b && cholB && permB.length() != 0) | if (have_b && cholB && permB.length () != 0) | |||
{ | { | |||
// Check the we really have a permutation vector | // Check the we really have a permutation vector | |||
if (permB.length() != n) | if (permB.length () != n) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: permB vector invalid"); | ("eigs: permB vector invalid"); | |||
return -1; | return -1; | |||
} | } | |||
else | else | |||
{ | { | |||
Array<bool> checked (dim_vector (n, 1), false); | Array<bool> checked (dim_vector (n, 1), false); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
{ | { | |||
skipping to change at line 2869 | skipping to change at line 2871 | |||
return -1; | return -1; | |||
} | } | |||
if (have_b) | if (have_b) | |||
{ | { | |||
// See Note 3 dsaupd | // See Note 3 dsaupd | |||
note3 = true; | note3 = true; | |||
if (cholB) | if (cholB) | |||
{ | { | |||
bt = b; | bt = b; | |||
b = b.hermitian(); | b = b.hermitian (); | |||
if (permB.length() == 0) | if (permB.length () == 0) | |||
{ | { | |||
permB = ColumnVector(n); | permB = ColumnVector (n); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
permB(i) = i; | permB(i) = i; | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
if (! make_cholb(b, bt, permB)) | if (! make_cholb (b, bt, permB)) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: The matrix B is not positive definite"); | ("eigs: The matrix B is not positive definite"); | |||
return -1; | return -1; | |||
} | } | |||
} | } | |||
} | } | |||
Array<octave_idx_type> ip (dim_vector (11, 1)); | Array<octave_idx_type> ip (dim_vector (11, 1)); | |||
octave_idx_type *iparam = ip.fortran_vec (); | octave_idx_type *iparam = ip.fortran_vec (); | |||
skipping to change at line 2921 | skipping to change at line 2923 | |||
OCTAVE_LOCAL_BUFFER (Complex, v, n * p); | OCTAVE_LOCAL_BUFFER (Complex, v, n * p); | |||
OCTAVE_LOCAL_BUFFER (Complex, workl, lwork); | OCTAVE_LOCAL_BUFFER (Complex, workl, lwork); | |||
OCTAVE_LOCAL_BUFFER (Complex, workd, 3 * n); | OCTAVE_LOCAL_BUFFER (Complex, workd, 3 * n); | |||
OCTAVE_LOCAL_BUFFER (double, rwork, p); | OCTAVE_LOCAL_BUFFER (double, rwork, p); | |||
Complex *presid = cresid.fortran_vec (); | Complex *presid = cresid.fortran_vec (); | |||
do | do | |||
{ | { | |||
F77_FUNC (znaupd, ZNAUPD) | F77_FUNC (znaupd, ZNAUPD) | |||
(ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | |||
F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), | F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), | |||
k, tol, presid, p, v, n, iparam, | k, tol, presid, p, v, n, iparam, | |||
ipntr, workd, workl, lwork, rwork, info | ipntr, workd, workl, lwork, rwork, info | |||
F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | |||
if (f77_exception_encountered) | if (f77_exception_encountered) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: unrecoverable exception encountered in znaupd"); | ("eigs: unrecoverable exception encountered in znaupd"); | |||
return -1; | return -1; | |||
} | } | |||
if (disp > 0 && !xisnan(workl[iptr(5)-1])) | if (disp > 0 && !xisnan (workl[iptr (5)-1])) | |||
{ | { | |||
if (iter++) | if (iter++) | |||
{ | { | |||
os << "Iteration " << iter - 1 << | os << "Iteration " << iter - 1 << | |||
": a few Ritz values of the " << p << "-by-" << | ": a few Ritz values of the " << p << "-by-" << | |||
p << " matrix\n"; | p << " matrix\n"; | |||
for (int i = 0 ; i < k; i++) | for (int i = 0 ; i < k; i++) | |||
os << " " << workl[iptr(5)+i-1] << "\n"; | os << " " << workl[iptr(5)+i-1] << "\n"; | |||
} | } | |||
// This is a kludge, as ARPACK doesn't give its | // This is a kludge, as ARPACK doesn't give its | |||
// iteration pointer. But as workl[iptr(5)-1] is | // iteration pointer. But as workl[iptr(5)-1] is | |||
// an output value updated at each iteration, setting | // an output value updated at each iteration, setting | |||
// a value in this array to NaN and testing for it | // a value in this array to NaN and testing for it | |||
// is a way of obtaining the iteration counter. | // is a way of obtaining the iteration counter. | |||
if (ido != 99) | if (ido != 99) | |||
workl[iptr(5)-1] = octave_NaN; | workl[iptr(5)-1] = octave_NaN; | |||
} | } | |||
if (ido == -1 || ido == 1 || ido == 2) | if (ido == -1 || ido == 1 || ido == 2) | |||
{ | { | |||
if (have_b) | if (have_b) | |||
{ | { | |||
ComplexMatrix mtmp (n,1); | ComplexMatrix mtmp (n,1); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
mtmp(i,0) = workd[i + iptr(0) - 1]; | mtmp(i,0) = workd[i + iptr(0) - 1]; | |||
mtmp = utsolve(bt, permB, m * ltsolve(b, permB, mtmp)); | mtmp = utsolve (bt, permB, m * ltsolve (b, permB, mtmp)); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
workd[i+iptr(1)-1] = mtmp(i,0); | workd[i+iptr(1)-1] = mtmp(i,0); | |||
} | } | |||
else if (!vector_product (m, workd + iptr(0) - 1, | else if (!vector_product (m, workd + iptr(0) - 1, | |||
workd + iptr(1) - 1)) | workd + iptr(1) - 1)) | |||
break; | break; | |||
} | } | |||
else | else | |||
{ | { | |||
skipping to change at line 3025 | skipping to change at line 3027 | |||
if (info2 == 0) | if (info2 == 0) | |||
{ | { | |||
octave_idx_type k2 = k / 2; | octave_idx_type k2 = k / 2; | |||
for (octave_idx_type i = 0; i < k2; i++) | for (octave_idx_type i = 0; i < k2; i++) | |||
{ | { | |||
Complex ctmp = d[i]; | Complex ctmp = d[i]; | |||
d[i] = d[k - i - 1]; | d[i] = d[k - i - 1]; | |||
d[k - i - 1] = ctmp; | d[k - i - 1] = ctmp; | |||
} | } | |||
eig_val.resize(k); | eig_val.resize (k); | |||
if (rvec) | if (rvec) | |||
{ | { | |||
OCTAVE_LOCAL_BUFFER (Complex, ctmp, n); | OCTAVE_LOCAL_BUFFER (Complex, ctmp, n); | |||
for (octave_idx_type i = 0; i < k2; i++) | for (octave_idx_type i = 0; i < k2; i++) | |||
{ | { | |||
octave_idx_type off1 = i * n; | octave_idx_type off1 = i * n; | |||
octave_idx_type off2 = (k - i - 1) * n; | octave_idx_type off2 = (k - i - 1) * n; | |||
skipping to change at line 3050 | skipping to change at line 3052 | |||
ctmp[j] = z[off1 + j]; | ctmp[j] = z[off1 + j]; | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
z[off1 + j] = z[off2 + j]; | z[off1 + j] = z[off2 + j]; | |||
for (octave_idx_type j = 0; j < n; j++) | for (octave_idx_type j = 0; j < n; j++) | |||
z[off2 + j] = ctmp[j]; | z[off2 + j] = ctmp[j]; | |||
} | } | |||
if (note3) | if (note3) | |||
eig_vec = ltsolve(b, permB, eig_vec); | eig_vec = ltsolve (b, permB, eig_vec); | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: error %d in zneupd", info2); | ("eigs: error %d in zneupd", info2); | |||
return -1; | return -1; | |||
} | } | |||
return ip(4); | return ip(4); | |||
skipping to change at line 3078 | skipping to change at line 3080 | |||
ComplexMatrix &eig_vec, | ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, const M& _b, | ComplexColumnVector &eig_val, const M& _b, | |||
ColumnVector &permB, | ColumnVector &permB, | |||
ComplexColumnVector &cresid, | ComplexColumnVector &cresid, | |||
std::ostream& os, double tol, bool rvec , | std::ostream& os, double tol, bool rvec , | |||
bool cholB, int disp, int maxit) | bool cholB, int disp, int maxit) | |||
{ | { | |||
M b(_b); | M b(_b); | |||
octave_idx_type n = m.cols (); | octave_idx_type n = m.cols (); | |||
octave_idx_type mode = 3; | octave_idx_type mode = 3; | |||
bool have_b = ! b.is_empty(); | bool have_b = ! b.is_empty (); | |||
std::string typ = "LM"; | std::string typ = "LM"; | |||
if (m.rows() != m.cols()) | if (m.rows () != m.cols ()) | |||
{ | { | |||
(*current_liboctave_error_handler) ("eigs: A must be square"); | (*current_liboctave_error_handler) ("eigs: A must be square"); | |||
return -1; | return -1; | |||
} | } | |||
if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) | if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ())) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: B must be square and the same size as A"); | ("eigs: B must be square and the same size as A"); | |||
return -1; | return -1; | |||
} | } | |||
// FIXME: The "SM" type for mode 1 seems unstable though faster!! | // FIXME: The "SM" type for mode 1 seems unstable though faster!! | |||
//if (! std::abs (sigma)) | //if (! std::abs (sigma)) | |||
// return EigsComplexNonSymmetricMatrix (m, "SM", k, p, info, eig_vec, | // return EigsComplexNonSymmetricMatrix (m, "SM", k, p, info, eig_vec, | |||
// eig_val, _b, permB, cresid, os, t ol, | // eig_val, _b, permB, cresid, os, t ol, | |||
// rvec, cholB, disp, maxit); | // rvec, cholB, disp, maxit); | |||
if (cresid.is_empty()) | if (cresid.is_empty ()) | |||
{ | { | |||
std::string rand_dist = octave_rand::distribution(); | std::string rand_dist = octave_rand::distribution (); | |||
octave_rand::distribution("uniform"); | octave_rand::distribution ("uniform"); | |||
Array<double> rr (octave_rand::vector(n)); | Array<double> rr (octave_rand::vector (n)); | |||
Array<double> ri (octave_rand::vector(n)); | Array<double> ri (octave_rand::vector (n)); | |||
cresid = ComplexColumnVector (n); | cresid = ComplexColumnVector (n); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
cresid(i) = Complex(rr(i),ri(i)); | cresid(i) = Complex (rr(i),ri(i)); | |||
octave_rand::distribution(rand_dist); | octave_rand::distribution (rand_dist); | |||
} | } | |||
if (n < 3) | if (n < 3) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: n must be at least 3"); | ("eigs: n must be at least 3"); | |||
return -1; | return -1; | |||
} | } | |||
if (p < 0) | if (p < 0) | |||
skipping to change at line 3133 | skipping to change at line 3135 | |||
p = 20; | p = 20; | |||
if (p > n - 1) | if (p > n - 1) | |||
p = n - 1 ; | p = n - 1 ; | |||
} | } | |||
if (k <= 0 || k >= n - 1) | if (k <= 0 || k >= n - 1) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | |||
" Use 'eig(full(A))' instead"); | " Use 'eig (full (A))' instead"); | |||
return -1; | return -1; | |||
} | } | |||
if (p <= k || p >= n) | if (p <= k || p >= n) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: opts.p must be greater than k and less than n"); | ("eigs: opts.p must be greater than k and less than n"); | |||
return -1; | return -1; | |||
} | } | |||
if (have_b && cholB && permB.length() != 0) | if (have_b && cholB && permB.length () != 0) | |||
{ | { | |||
// Check that we really have a permutation vector | // Check that we really have a permutation vector | |||
if (permB.length() != n) | if (permB.length () != n) | |||
{ | { | |||
(*current_liboctave_error_handler) ("eigs: permB vector invalid") ; | (*current_liboctave_error_handler) ("eigs: permB vector invalid") ; | |||
return -1; | return -1; | |||
} | } | |||
else | else | |||
{ | { | |||
Array<bool> checked (dim_vector (n, 1), false); | Array<bool> checked (dim_vector (n, 1), false); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
{ | { | |||
octave_idx_type bidx = | octave_idx_type bidx = | |||
skipping to change at line 3197 | skipping to change at line 3199 | |||
ip(10) = 0; | ip(10) = 0; | |||
// ip(7) to ip(10) return values | // ip(7) to ip(10) return values | |||
Array<octave_idx_type> iptr (dim_vector (14, 1)); | Array<octave_idx_type> iptr (dim_vector (14, 1)); | |||
octave_idx_type *ipntr = iptr.fortran_vec (); | octave_idx_type *ipntr = iptr.fortran_vec (); | |||
octave_idx_type ido = 0; | octave_idx_type ido = 0; | |||
int iter = 0; | int iter = 0; | |||
M L, U; | M L, U; | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows() : m.rows())); | OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows () : m.rows ()) | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols() : m.cols())); | ); | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols () : m.cols ()) | ||||
); | ||||
if (! LuAminusSigmaB(m, b, cholB, permB, sigma, L, U, P, Q)) | if (! LuAminusSigmaB (m, b, cholB, permB, sigma, L, U, P, Q)) | |||
return -1; | return -1; | |||
octave_idx_type lwork = p * (3 * p + 5); | octave_idx_type lwork = p * (3 * p + 5); | |||
OCTAVE_LOCAL_BUFFER (Complex, v, n * p); | OCTAVE_LOCAL_BUFFER (Complex, v, n * p); | |||
OCTAVE_LOCAL_BUFFER (Complex, workl, lwork); | OCTAVE_LOCAL_BUFFER (Complex, workl, lwork); | |||
OCTAVE_LOCAL_BUFFER (Complex, workd, 3 * n); | OCTAVE_LOCAL_BUFFER (Complex, workd, 3 * n); | |||
OCTAVE_LOCAL_BUFFER (double, rwork, p); | OCTAVE_LOCAL_BUFFER (double, rwork, p); | |||
Complex *presid = cresid.fortran_vec (); | Complex *presid = cresid.fortran_vec (); | |||
do | do | |||
{ | { | |||
F77_FUNC (znaupd, ZNAUPD) | F77_FUNC (znaupd, ZNAUPD) | |||
(ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | |||
F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), | F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), | |||
k, tol, presid, p, v, n, iparam, | k, tol, presid, p, v, n, iparam, | |||
ipntr, workd, workl, lwork, rwork, info | ipntr, workd, workl, lwork, rwork, info | |||
F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | |||
if (f77_exception_encountered) | if (f77_exception_encountered) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: unrecoverable exception encountered in znaupd"); | ("eigs: unrecoverable exception encountered in znaupd"); | |||
return -1; | return -1; | |||
} | } | |||
if (disp > 0 && !xisnan(workl[iptr(5)-1])) | if (disp > 0 && !xisnan(workl[iptr(5)-1])) | |||
{ | { | |||
if (iter++) | if (iter++) | |||
{ | { | |||
os << "Iteration " << iter - 1 << | os << "Iteration " << iter - 1 << | |||
": a few Ritz values of the " << p << "-by-" << | ": a few Ritz values of the " << p << "-by-" << | |||
p << " matrix\n"; | p << " matrix\n"; | |||
for (int i = 0 ; i < k; i++) | for (int i = 0 ; i < k; i++) | |||
os << " " << workl[iptr(5)+i-1] << "\n"; | os << " " << workl[iptr(5)+i-1] << "\n"; | |||
} | } | |||
// This is a kludge, as ARPACK doesn't give its | // This is a kludge, as ARPACK doesn't give its | |||
// iteration pointer. But as workl[iptr(5)-1] is | // iteration pointer. But as workl[iptr(5)-1] is | |||
// an output value updated at each iteration, setting | // an output value updated at each iteration, setting | |||
// a value in this array to NaN and testing for it | // a value in this array to NaN and testing for it | |||
// is a way of obtaining the iteration counter. | // is a way of obtaining the iteration counter. | |||
if (ido != 99) | if (ido != 99) | |||
skipping to change at line 3365 | skipping to change at line 3367 | |||
if (info2 == 0) | if (info2 == 0) | |||
{ | { | |||
octave_idx_type k2 = k / 2; | octave_idx_type k2 = k / 2; | |||
for (octave_idx_type i = 0; i < k2; i++) | for (octave_idx_type i = 0; i < k2; i++) | |||
{ | { | |||
Complex ctmp = d[i]; | Complex ctmp = d[i]; | |||
d[i] = d[k - i - 1]; | d[i] = d[k - i - 1]; | |||
d[k - i - 1] = ctmp; | d[k - i - 1] = ctmp; | |||
} | } | |||
eig_val.resize(k); | eig_val.resize (k); | |||
if (rvec) | if (rvec) | |||
{ | { | |||
OCTAVE_LOCAL_BUFFER (Complex, ctmp, n); | OCTAVE_LOCAL_BUFFER (Complex, ctmp, n); | |||
for (octave_idx_type i = 0; i < k2; i++) | for (octave_idx_type i = 0; i < k2; i++) | |||
{ | { | |||
octave_idx_type off1 = i * n; | octave_idx_type off1 = i * n; | |||
octave_idx_type off2 = (k - i - 1) * n; | octave_idx_type off2 = (k - i - 1) * n; | |||
skipping to change at line 3411 | skipping to change at line 3413 | |||
EigsComplexNonSymmetricFunc (EigsComplexFunc fun, octave_idx_type n, | EigsComplexNonSymmetricFunc (EigsComplexFunc fun, octave_idx_type n, | |||
const std::string &_typ, Complex sigma, | const std::string &_typ, Complex sigma, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, ComplexMatrix &eig_vec, | octave_idx_type &info, ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, | ComplexColumnVector &eig_val, | |||
ComplexColumnVector &cresid, std::ostream& os, | ComplexColumnVector &cresid, std::ostream& os, | |||
double tol, bool rvec, bool /* cholB */, | double tol, bool rvec, bool /* cholB */, | |||
int disp, int maxit) | int disp, int maxit) | |||
{ | { | |||
std::string typ (_typ); | std::string typ (_typ); | |||
bool have_sigma = (std::abs(sigma) ? true : false); | bool have_sigma = (std::abs (sigma) ? true : false); | |||
char bmat = 'I'; | char bmat = 'I'; | |||
octave_idx_type mode = 1; | octave_idx_type mode = 1; | |||
int err = 0; | int err = 0; | |||
if (cresid.is_empty()) | if (cresid.is_empty ()) | |||
{ | { | |||
std::string rand_dist = octave_rand::distribution(); | std::string rand_dist = octave_rand::distribution (); | |||
octave_rand::distribution("uniform"); | octave_rand::distribution ("uniform"); | |||
Array<double> rr (octave_rand::vector(n)); | Array<double> rr (octave_rand::vector (n)); | |||
Array<double> ri (octave_rand::vector(n)); | Array<double> ri (octave_rand::vector (n)); | |||
cresid = ComplexColumnVector (n); | cresid = ComplexColumnVector (n); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
cresid(i) = Complex(rr(i),ri(i)); | cresid(i) = Complex (rr(i),ri(i)); | |||
octave_rand::distribution(rand_dist); | octave_rand::distribution (rand_dist); | |||
} | } | |||
if (n < 3) | if (n < 3) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: n must be at least 3"); | ("eigs: n must be at least 3"); | |||
return -1; | return -1; | |||
} | } | |||
if (p < 0) | if (p < 0) | |||
skipping to change at line 3450 | skipping to change at line 3452 | |||
p = 20; | p = 20; | |||
if (p > n - 1) | if (p > n - 1) | |||
p = n - 1 ; | p = n - 1 ; | |||
} | } | |||
if (k <= 0 || k >= n - 1) | if (k <= 0 || k >= n - 1) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n -1).\n" | |||
" Use 'eig(full(A))' instead"); | " Use 'eig (full (A))' instead"); | |||
return -1; | return -1; | |||
} | } | |||
if (p <= k || p >= n) | if (p <= k || p >= n) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: opts.p must be greater than k and less than n"); | ("eigs: opts.p must be greater than k and less than n"); | |||
return -1; | return -1; | |||
} | } | |||
skipping to change at line 3524 | skipping to change at line 3526 | |||
OCTAVE_LOCAL_BUFFER (Complex, v, n * p); | OCTAVE_LOCAL_BUFFER (Complex, v, n * p); | |||
OCTAVE_LOCAL_BUFFER (Complex, workl, lwork); | OCTAVE_LOCAL_BUFFER (Complex, workl, lwork); | |||
OCTAVE_LOCAL_BUFFER (Complex, workd, 3 * n); | OCTAVE_LOCAL_BUFFER (Complex, workd, 3 * n); | |||
OCTAVE_LOCAL_BUFFER (double, rwork, p); | OCTAVE_LOCAL_BUFFER (double, rwork, p); | |||
Complex *presid = cresid.fortran_vec (); | Complex *presid = cresid.fortran_vec (); | |||
do | do | |||
{ | { | |||
F77_FUNC (znaupd, ZNAUPD) | F77_FUNC (znaupd, ZNAUPD) | |||
(ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, | |||
F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), | F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), | |||
k, tol, presid, p, v, n, iparam, | k, tol, presid, p, v, n, iparam, | |||
ipntr, workd, workl, lwork, rwork, info | ipntr, workd, workl, lwork, rwork, info | |||
F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); | |||
if (f77_exception_encountered) | if (f77_exception_encountered) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("eigs: unrecoverable exception encountered in znaupd"); | ("eigs: unrecoverable exception encountered in znaupd"); | |||
return -1; | return -1; | |||
} | } | |||
if (disp > 0 && !xisnan(workl[iptr(5)-1])) | if (disp > 0 && !xisnan(workl[iptr(5)-1])) | |||
{ | { | |||
if (iter++) | if (iter++) | |||
{ | { | |||
os << "Iteration " << iter - 1 << | os << "Iteration " << iter - 1 << | |||
": a few Ritz values of the " << p << "-by-" << | ": a few Ritz values of the " << p << "-by-" << | |||
p << " matrix\n"; | p << " matrix\n"; | |||
for (int i = 0 ; i < k; i++) | for (int i = 0 ; i < k; i++) | |||
os << " " << workl[iptr(5)+i-1] << "\n"; | os << " " << workl[iptr(5)+i-1] << "\n"; | |||
} | } | |||
// This is a kludge, as ARPACK doesn't give its | // This is a kludge, as ARPACK doesn't give its | |||
// iteration pointer. But as workl[iptr(5)-1] is | // iteration pointer. But as workl[iptr(5)-1] is | |||
// an output value updated at each iteration, setting | // an output value updated at each iteration, setting | |||
// a value in this array to NaN and testing for it | // a value in this array to NaN and testing for it | |||
// is a way of obtaining the iteration counter. | // is a way of obtaining the iteration counter. | |||
if (ido != 99) | if (ido != 99) | |||
skipping to change at line 3629 | skipping to change at line 3631 | |||
if (info2 == 0) | if (info2 == 0) | |||
{ | { | |||
octave_idx_type k2 = k / 2; | octave_idx_type k2 = k / 2; | |||
for (octave_idx_type i = 0; i < k2; i++) | for (octave_idx_type i = 0; i < k2; i++) | |||
{ | { | |||
Complex ctmp = d[i]; | Complex ctmp = d[i]; | |||
d[i] = d[k - i - 1]; | d[i] = d[k - i - 1]; | |||
d[k - i - 1] = ctmp; | d[k - i - 1] = ctmp; | |||
} | } | |||
eig_val.resize(k); | eig_val.resize (k); | |||
if (rvec) | if (rvec) | |||
{ | { | |||
OCTAVE_LOCAL_BUFFER (Complex, ctmp, n); | OCTAVE_LOCAL_BUFFER (Complex, ctmp, n); | |||
for (octave_idx_type i = 0; i < k2; i++) | for (octave_idx_type i = 0; i < k2; i++) | |||
{ | { | |||
octave_idx_type off1 = i * n; | octave_idx_type off1 = i * n; | |||
octave_idx_type off2 = (k - i - 1) * n; | octave_idx_type off2 = (k - i - 1) * n; | |||
skipping to change at line 3671 | skipping to change at line 3673 | |||
return ip(4); | return ip(4); | |||
} | } | |||
#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsRealSymmetricMatrix (const Matrix& m, const std::string typ, | EigsRealSymmetricMatrix (const Matrix& m, const std::string typ, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, Matrix &eig_vec, | octave_idx_type &info, Matrix &eig_vec, | |||
ColumnVector &eig_val, const Matrix& b, | ColumnVector &eig_val, const Matrix& b, | |||
ColumnVector &permB, ColumnVector &resid, | ColumnVector &permB, ColumnVector &resid, | |||
std::ostream &os, double tol = DBL_EPSILON, | std::ostream &os, | |||
double tol = std::numeric_limits<double>::epsilon | ||||
(), | ||||
bool rvec = false, bool cholB = 0, int disp = 0, | bool rvec = false, bool cholB = 0, int disp = 0, | |||
int maxit = 300); | int maxit = 300); | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsRealSymmetricMatrix (const SparseMatrix& m, const std::string typ, | EigsRealSymmetricMatrix (const SparseMatrix& m, const std::string typ, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, Matrix &eig_vec, | octave_idx_type &info, Matrix &eig_vec, | |||
ColumnVector &eig_val, const SparseMatrix& b, | ColumnVector &eig_val, const SparseMatrix& b, | |||
ColumnVector &permB, ColumnVector &resid, | ColumnVector &permB, ColumnVector &resid, | |||
std::ostream& os, double tol = DBL_EPSILON, | std::ostream& os, | |||
double tol = std::numeric_limits<double>::epsilon | ||||
(), | ||||
bool rvec = false, bool cholB = 0, int disp = 0, | bool rvec = false, bool cholB = 0, int disp = 0, | |||
int maxit = 300); | int maxit = 300); | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsRealSymmetricMatrixShift (const Matrix& m, double sigma, | EigsRealSymmetricMatrixShift (const Matrix& m, double sigma, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, Matrix &eig_vec, | octave_idx_type &info, Matrix &eig_vec, | |||
ColumnVector &eig_val, const Matrix& b, | ColumnVector &eig_val, const Matrix& b, | |||
ColumnVector &permB, ColumnVector &resid, | ColumnVector &permB, ColumnVector &resid, | |||
std::ostream &os, double tol = DBL_EPSILON, | std::ostream &os, | |||
double tol = std::numeric_limits<double>::eps | ||||
ilon (), | ||||
bool rvec = false, bool cholB = 0, int disp = 0, | bool rvec = false, bool cholB = 0, int disp = 0, | |||
int maxit = 300); | int maxit = 300); | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsRealSymmetricMatrixShift (const SparseMatrix& m, double sigma, | EigsRealSymmetricMatrixShift (const SparseMatrix& m, double sigma, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, Matrix &eig_vec, | octave_idx_type &info, Matrix &eig_vec, | |||
ColumnVector &eig_val, const SparseMatrix& b, | ColumnVector &eig_val, const SparseMatrix& b, | |||
ColumnVector &permB, ColumnVector &resid, | ColumnVector &permB, ColumnVector &resid, | |||
std::ostream &os, double tol = DBL_EPSILON, | std::ostream &os, | |||
double tol = std::numeric_limits<double>::eps | ||||
ilon (), | ||||
bool rvec = false, bool cholB = 0, int disp = 0, | bool rvec = false, bool cholB = 0, int disp = 0, | |||
int maxit = 300); | int maxit = 300); | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsRealSymmetricFunc (EigsFunc fun, octave_idx_type n, | EigsRealSymmetricFunc (EigsFunc fun, octave_idx_type n, | |||
const std::string &typ, double sigma, | const std::string &typ, double sigma, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, | octave_idx_type &info, | |||
Matrix &eig_vec, ColumnVector &eig_val, | Matrix &eig_vec, ColumnVector &eig_val, | |||
ColumnVector &resid, std::ostream &os, | ColumnVector &resid, std::ostream &os, | |||
double tol = DBL_EPSILON, bool rvec = false, | double tol = std::numeric_limits<double>::epsilon () | |||
bool cholB = 0, int disp = 0, int maxit = 300); | , | |||
bool rvec = false, bool cholB = 0, int disp = 0, | ||||
int maxit = 300); | ||||
extern octave_idx_type | extern octave_idx_type | |||
EigsRealNonSymmetricMatrix (const Matrix& m, const std::string typ, | EigsRealNonSymmetricMatrix (const Matrix& m, const std::string typ, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, ComplexMatrix &eig_vec, | octave_idx_type &info, ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, const Matrix& b, | ComplexColumnVector &eig_val, const Matrix& b, | |||
ColumnVector &permB, ColumnVector &resid, | ColumnVector &permB, ColumnVector &resid, | |||
std::ostream &os, double tol = DBL_EPSILON, | std::ostream &os, | |||
double tol = std::numeric_limits<double>::epsil | ||||
on (), | ||||
bool rvec = false, bool cholB = 0, int disp = 0 , | bool rvec = false, bool cholB = 0, int disp = 0 , | |||
int maxit = 300); | int maxit = 300); | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsRealNonSymmetricMatrix (const SparseMatrix& m, const std::string typ, | EigsRealNonSymmetricMatrix (const SparseMatrix& m, const std::string typ, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, ComplexMatrix &eig_vec, | octave_idx_type &info, ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, | ComplexColumnVector &eig_val, | |||
const SparseMatrix& b, | const SparseMatrix& b, | |||
ColumnVector &permB, ColumnVector &resid, | ColumnVector &permB, ColumnVector &resid, | |||
std::ostream &os, double tol = DBL_EPSILON, | std::ostream &os, | |||
double tol = std::numeric_limits<double>::epsil | ||||
on (), | ||||
bool rvec = false, bool cholB = 0, int disp = 0 , | bool rvec = false, bool cholB = 0, int disp = 0 , | |||
int maxit = 300); | int maxit = 300); | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsRealNonSymmetricMatrixShift (const Matrix& m, double sigma, | EigsRealNonSymmetricMatrixShift (const Matrix& m, double sigma, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, | octave_idx_type &info, | |||
ComplexMatrix &eig_vec, | ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, const Matrix & b, | ComplexColumnVector &eig_val, const Matrix & b, | |||
ColumnVector &permB, ColumnVector &resid, | ColumnVector &permB, ColumnVector &resid, | |||
std::ostream &os, double tol = DBL_EPSILON | std::ostream &os, | |||
, | double tol = std::numeric_limits<double>:: | |||
epsilon (), | ||||
bool rvec = false, bool cholB = 0, | bool rvec = false, bool cholB = 0, | |||
int disp = 0, int maxit = 300); | int disp = 0, int maxit = 300); | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsRealNonSymmetricMatrixShift (const SparseMatrix& m, double sigma, | EigsRealNonSymmetricMatrixShift (const SparseMatrix& m, double sigma, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, | octave_idx_type &info, | |||
ComplexMatrix &eig_vec, | ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, | ComplexColumnVector &eig_val, | |||
const SparseMatrix& b, | const SparseMatrix& b, | |||
ColumnVector &permB, ColumnVector &resid, | ColumnVector &permB, ColumnVector &resid, | |||
std::ostream &os, double tol = DBL_EPSILON | std::ostream &os, | |||
, | double tol = std::numeric_limits<double>:: | |||
epsilon (), | ||||
bool rvec = false, bool cholB = 0, | bool rvec = false, bool cholB = 0, | |||
int disp = 0, int maxit = 300); | int disp = 0, int maxit = 300); | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsRealNonSymmetricFunc (EigsFunc fun, octave_idx_type n, | EigsRealNonSymmetricFunc (EigsFunc fun, octave_idx_type n, | |||
const std::string &_typ, double sigma, | const std::string &_typ, double sigma, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, ComplexMatrix &eig_vec, | octave_idx_type &info, ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, | ComplexColumnVector &eig_val, | |||
ColumnVector &resid, std::ostream& os, | ColumnVector &resid, std::ostream& os, | |||
double tol = DBL_EPSILON, bool rvec = false, | double tol = std::numeric_limits<double>::epsilon | |||
bool cholB = 0, int disp = 0, int maxit = 300); | (), | |||
bool rvec = false, bool cholB = 0, int disp = 0, | ||||
int maxit = 300); | ||||
extern octave_idx_type | extern octave_idx_type | |||
EigsComplexNonSymmetricMatrix (const ComplexMatrix& m, const std::string ty p, | EigsComplexNonSymmetricMatrix (const ComplexMatrix& m, const std::string ty p, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, ComplexMatrix &eig_ve c, | octave_idx_type &info, ComplexMatrix &eig_ve c, | |||
ComplexColumnVector &eig_val, | ComplexColumnVector &eig_val, | |||
const ComplexMatrix& b, ColumnVector &permB, | const ComplexMatrix& b, ColumnVector &permB, | |||
ComplexColumnVector &resid, | ComplexColumnVector &resid, | |||
std::ostream &os, double tol = DBL_EPSILON, | std::ostream &os, | |||
double tol = std::numeric_limits<double>::ep | ||||
silon (), | ||||
bool rvec = false, bool cholB = 0, int disp = 0, | bool rvec = false, bool cholB = 0, int disp = 0, | |||
int maxit = 300); | int maxit = 300); | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsComplexNonSymmetricMatrix (const SparseComplexMatrix& m, | EigsComplexNonSymmetricMatrix (const SparseComplexMatrix& m, | |||
const std::string typ, octave_idx_type k, | const std::string typ, octave_idx_type k, | |||
octave_idx_type p, octave_idx_type &info, | octave_idx_type p, octave_idx_type &info, | |||
ComplexMatrix &eig_vec, | ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, | ComplexColumnVector &eig_val, | |||
const SparseComplexMatrix& b, | const SparseComplexMatrix& b, | |||
ColumnVector &permB, | ColumnVector &permB, | |||
ComplexColumnVector &resid, | ComplexColumnVector &resid, | |||
std::ostream &os, double tol = DBL_EPSILON, | std::ostream &os, | |||
double tol = std::numeric_limits<double>::ep | ||||
silon (), | ||||
bool rvec = false, bool cholB = 0, int disp = 0, | bool rvec = false, bool cholB = 0, int disp = 0, | |||
int maxit = 300); | int maxit = 300); | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsComplexNonSymmetricMatrixShift (const ComplexMatrix& m, Complex sigma, | EigsComplexNonSymmetricMatrixShift (const ComplexMatrix& m, Complex sigma, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, | octave_idx_type &info, | |||
ComplexMatrix &eig_vec, | ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, | ComplexColumnVector &eig_val, | |||
const ComplexMatrix& b, | const ComplexMatrix& b, | |||
ColumnVector &permB, | ColumnVector &permB, | |||
ComplexColumnVector &resid, | ComplexColumnVector &resid, | |||
std::ostream &os, double tol = DBL_EPSI | std::ostream &os, | |||
LON, | double tol = std::numeric_limits<double | |||
>::epsilon (), | ||||
bool rvec = false, bool cholB = 0, | bool rvec = false, bool cholB = 0, | |||
int disp = 0, int maxit = 300); | int disp = 0, int maxit = 300); | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsComplexNonSymmetricMatrixShift (const SparseComplexMatrix& m, | EigsComplexNonSymmetricMatrixShift (const SparseComplexMatrix& m, | |||
Complex sigma, | Complex sigma, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, | octave_idx_type &info, | |||
ComplexMatrix &eig_vec, | ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, | ComplexColumnVector &eig_val, | |||
const SparseComplexMatrix& b, | const SparseComplexMatrix& b, | |||
ColumnVector &permB, | ColumnVector &permB, | |||
ComplexColumnVector &resid, | ComplexColumnVector &resid, | |||
std::ostream &os, double tol = DBL_EPSI | std::ostream &os, | |||
LON, | double tol = std::numeric_limits<double | |||
>::epsilon (), | ||||
bool rvec = false, bool cholB = 0, | bool rvec = false, bool cholB = 0, | |||
int disp = 0, int maxit = 300); | int disp = 0, int maxit = 300); | |||
extern octave_idx_type | extern octave_idx_type | |||
EigsComplexNonSymmetricFunc (EigsComplexFunc fun, octave_idx_type n, | EigsComplexNonSymmetricFunc (EigsComplexFunc fun, octave_idx_type n, | |||
const std::string &_typ, Complex sigma, | const std::string &_typ, Complex sigma, | |||
octave_idx_type k, octave_idx_type p, | octave_idx_type k, octave_idx_type p, | |||
octave_idx_type &info, ComplexMatrix &eig_vec, | octave_idx_type &info, ComplexMatrix &eig_vec, | |||
ComplexColumnVector &eig_val, | ComplexColumnVector &eig_val, | |||
ComplexColumnVector &resid, std::ostream& os, | ComplexColumnVector &resid, std::ostream& os, | |||
double tol = DBL_EPSILON, bool rvec = false, | double tol = std::numeric_limits<double>::epsi | |||
bool cholB = 0, int disp = 0, int maxit = 300) | lon (), | |||
; | bool rvec = false, bool cholB = 0, | |||
int disp = 0, int maxit = 300); | ||||
#endif | #endif | |||
#ifndef _MSC_VER | #ifndef _MSC_VER | |||
template static octave_idx_type | template octave_idx_type | |||
lusolve (const SparseMatrix&, const SparseMatrix&, Matrix&); | lusolve (const SparseMatrix&, const SparseMatrix&, Matrix&); | |||
template static octave_idx_type | template octave_idx_type | |||
lusolve (const SparseComplexMatrix&, const SparseComplexMatrix&, | lusolve (const SparseComplexMatrix&, const SparseComplexMatrix&, | |||
ComplexMatrix&); | ComplexMatrix&); | |||
template static octave_idx_type | template octave_idx_type | |||
lusolve (const Matrix&, const Matrix&, Matrix&); | lusolve (const Matrix&, const Matrix&, Matrix&); | |||
template static octave_idx_type | template octave_idx_type | |||
lusolve (const ComplexMatrix&, const ComplexMatrix&, ComplexMatrix&); | lusolve (const ComplexMatrix&, const ComplexMatrix&, ComplexMatrix&); | |||
template static ComplexMatrix | template ComplexMatrix | |||
ltsolve (const SparseComplexMatrix&, const ColumnVector&, | ltsolve (const SparseComplexMatrix&, const ColumnVector&, | |||
const ComplexMatrix&); | const ComplexMatrix&); | |||
template static Matrix | template Matrix | |||
ltsolve (const SparseMatrix&, const ColumnVector&, const Matrix&); | ltsolve (const SparseMatrix&, const ColumnVector&, const Matrix&); | |||
template static ComplexMatrix | template ComplexMatrix | |||
ltsolve (const ComplexMatrix&, const ColumnVector&, const ComplexMatrix&); | ltsolve (const ComplexMatrix&, const ColumnVector&, const ComplexMatrix&); | |||
template static Matrix | template Matrix | |||
ltsolve (const Matrix&, const ColumnVector&, const Matrix&); | ltsolve (const Matrix&, const ColumnVector&, const Matrix&); | |||
template static ComplexMatrix | template ComplexMatrix | |||
utsolve (const SparseComplexMatrix&, const ColumnVector&, | utsolve (const SparseComplexMatrix&, const ColumnVector&, | |||
const ComplexMatrix&); | const ComplexMatrix&); | |||
template static Matrix | template Matrix | |||
utsolve (const SparseMatrix&, const ColumnVector&, const Matrix&); | utsolve (const SparseMatrix&, const ColumnVector&, const Matrix&); | |||
template static ComplexMatrix | template ComplexMatrix | |||
utsolve (const ComplexMatrix&, const ColumnVector&, const ComplexMatrix&); | utsolve (const ComplexMatrix&, const ColumnVector&, const ComplexMatrix&); | |||
template static Matrix | template Matrix | |||
utsolve (const Matrix&, const ColumnVector&, const Matrix&); | utsolve (const Matrix&, const ColumnVector&, const Matrix&); | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 212 change blocks. | ||||
306 lines changed or deleted | 337 lines changed or added | |||
error.h | error.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 40 | skipping to change at line 40 | |||
class unwind_protect; | class unwind_protect; | |||
#define panic_impossible() \ | #define panic_impossible() \ | |||
panic ("impossible state reached in file '%s' at line %d", \ | panic ("impossible state reached in file '%s' at line %d", \ | |||
__FILE__, __LINE__) | __FILE__, __LINE__) | |||
extern OCTINTERP_API void reset_error_handler (void); | extern OCTINTERP_API void reset_error_handler (void); | |||
extern OCTINTERP_API int warning_enabled (const std::string& id); | extern OCTINTERP_API int warning_enabled (const std::string& id); | |||
extern OCTINTERP_API void vmessage (const char *name, const char *fmt, va_l | extern OCTINTERP_API void | |||
ist args); | vmessage (const char *name, const char *fmt, va_list args); | |||
extern OCTINTERP_API void message (const char *name, const char *fmt, ...); | extern OCTINTERP_API void message (const char *name, const char *fmt, ...); | |||
extern OCTINTERP_API void vusage (const char *fmt, va_list args); | extern OCTINTERP_API void vusage (const char *fmt, va_list args); | |||
extern OCTINTERP_API void usage (const char *fmt, ...); | extern OCTINTERP_API void usage (const char *fmt, ...); | |||
extern OCTINTERP_API void vwarning (const char *fmt, va_list args); | extern OCTINTERP_API void vwarning (const char *fmt, va_list args); | |||
extern OCTINTERP_API void warning (const char *fmt, ...); | extern OCTINTERP_API void warning (const char *fmt, ...); | |||
extern OCTINTERP_API void verror (const char *fmt, va_list args); | extern OCTINTERP_API void verror (const char *fmt, va_list args); | |||
extern OCTINTERP_API void error (const char *fmt, ...); | extern OCTINTERP_API void error (const char *fmt, ...); | |||
extern OCTINTERP_API void verror_with_cfn (const char *fmt, va_list args); | extern OCTINTERP_API void verror_with_cfn (const char *fmt, va_list args); | |||
extern OCTINTERP_API void error_with_cfn (const char *fmt, ...); | extern OCTINTERP_API void error_with_cfn (const char *fmt, ...); | |||
extern OCTINTERP_API void vparse_error (const char *fmt, va_list args); | extern OCTINTERP_API void vparse_error (const char *fmt, va_list args); | |||
extern OCTINTERP_API void parse_error (const char *fmt, ...); | extern OCTINTERP_API void parse_error (const char *fmt, ...); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
vmessage_with_id (const char *id, const char *name, const char *fmt, va_lis | vmessage_with_id (const char *id, const char *name, | |||
t args); | const char *fmt, va_list args); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
message_with_id (const char *id, const char *name, const char *fmt, ...); | message_with_id (const char *id, const char *name, const char *fmt, ...); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
vusage_with_id (const char *id, const char *fmt, va_list args); | vusage_with_id (const char *id, const char *fmt, va_list args); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
usage_with_id (const char *id, const char *fmt, ...); | usage_with_id (const char *id, const char *fmt, ...); | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 6 lines changed or added | |||
f77-fcn.h | f77-fcn.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 84 | skipping to change at line 84 | |||
} \ | } \ | |||
while (0) | while (0) | |||
/* So we can check to see if an exception has occurred. */ | /* So we can check to see if an exception has occurred. */ | |||
CRUFT_API extern int f77_exception_encountered; | CRUFT_API extern int f77_exception_encountered; | |||
#if !defined (F77_FCN) | #if !defined (F77_FCN) | |||
#define F77_FCN(f, F) F77_FUNC (f, F) | #define F77_FCN(f, F) F77_FUNC (f, F) | |||
#endif | #endif | |||
/* | ||||
The following macros are used for handling Fortran <-> C calling | ||||
conventions. They are defined below for three different types of | ||||
systems, Cray (possibly now obsolete), Visual Fortran, and any system | ||||
that is compatible with the f2c calling conventions, including g77 and | ||||
gfortran. Note that gfortran is not completely compatible with the | ||||
f2c calling conventions, but that we only use the parts that are | ||||
compatible. For example, f2c and gfortran differ in the way they | ||||
handle Fortran functions that return complex values, but Octave does | ||||
not call any Fortran functions like that directly from C or C++. | ||||
Use these macros to pass character strings from C to Fortran: | ||||
F77_CHAR_ARG(x) | ||||
F77_CONST_CHAR_ARG(x) | ||||
F77_CXX_STRING_ARG(x) | ||||
F77_CHAR_ARG_LEN(l) | ||||
F77_CHAR_ARG_DECL | ||||
F77_CONST_CHAR_ARG_DECL | ||||
F77_CHAR_ARG_LEN_DECL | ||||
Use these macros to write C-language functions that accept | ||||
Fortran-style character strings: | ||||
F77_CHAR_ARG_DEF(s, len) | ||||
F77_CONST_CHAR_ARG_DEF(s, len) | ||||
F77_CHAR_ARG_LEN_DEF(len) | ||||
F77_CHAR_ARG_USE(s) | ||||
F77_CHAR_ARG_LEN_USE(s, len) | ||||
Use this macro to declare the return type of a C-language function | ||||
that is supposed to act like a Fortran subroutine: | ||||
F77_RET_T int | ||||
Use these macros to return from C-language functions that are supposed | ||||
to act like Fortran subroutines. F77_NORETURN is intended to be used | ||||
as the last statement of such a function that has been tagged with a | ||||
"noreturn" attribute. If the compiler supports the "noreturn" | ||||
attribute or if F77_RET_T is void, then it should expand to nothing so | ||||
that we avoid warnings about functions tagged as "noreturn" | ||||
containing a return statement. Otherwise, it should expand to a | ||||
statement that returns the given value so that we avoid warnings about | ||||
not returning a value from a function declared to return something. | ||||
F77_RETURN(retval) | ||||
F77_NORETURN(retval) | ||||
*/ | ||||
#if defined (F77_USES_CRAY_CALLING_CONVENTION) | #if defined (F77_USES_CRAY_CALLING_CONVENTION) | |||
#include <fortran.h> | #include <fortran.h> | |||
/* Use these macros to pass character strings from C to Fortran. */ | /* Use these macros to pass character strings from C to Fortran. */ | |||
#define F77_CHAR_ARG(x) octave_make_cray_ftn_ch_dsc (x, strlen (x)) | #define F77_CHAR_ARG(x) octave_make_cray_ftn_ch_dsc (x, strlen (x)) | |||
#define F77_CONST_CHAR_ARG(x) \ | #define F77_CONST_CHAR_ARG(x) \ | |||
octave_make_cray_const_ftn_ch_dsc (x, strlen (x)) | octave_make_cray_const_ftn_ch_dsc (x, strlen (x)) | |||
#define F77_CHAR_ARG2(x, l) octave_make_cray_ftn_ch_dsc (x, l) | #define F77_CHAR_ARG2(x, l) octave_make_cray_ftn_ch_dsc (x, l) | |||
#define F77_CONST_CHAR_ARG2(x, l) octave_make_cray_const_ftn_ch_dsc (x, l) | #define F77_CONST_CHAR_ARG2(x, l) octave_make_cray_const_ftn_ch_dsc (x, l) | |||
skipping to change at line 109 | skipping to change at line 160 | |||
#define F77_CHAR_ARG_LEN_DECL | #define F77_CHAR_ARG_LEN_DECL | |||
/* Use these macros to write C-language functions that accept | /* Use these macros to write C-language functions that accept | |||
Fortran-style character strings. */ | Fortran-style character strings. */ | |||
#define F77_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s | #define F77_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s | |||
#define F77_CONST_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s | #define F77_CONST_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s | |||
#define F77_CHAR_ARG_LEN_DEF(len) | #define F77_CHAR_ARG_LEN_DEF(len) | |||
#define F77_CHAR_ARG_USE(s) s.ptr | #define F77_CHAR_ARG_USE(s) s.ptr | |||
#define F77_CHAR_ARG_LEN_USE(s, len) (s.mask.len>>3) | #define F77_CHAR_ARG_LEN_USE(s, len) (s.mask.len>>3) | |||
/* Use this macro to declare the return type of a C-language function | ||||
that is supposed to act like a Fortran subroutine. */ | ||||
#define F77_RET_T int | #define F77_RET_T int | |||
/* Use these macros to return from C-language functions that are | ||||
supposed to act like Fortran subroutines. F77_NORETURN is intended | ||||
to be used as the last statement of such a function that has been | ||||
tagged with a "noreturn" attribute. */ | ||||
#define F77_RETURN(retval) return retval; | #define F77_RETURN(retval) return retval; | |||
#if defined (HAVE_ATTR_NORETURN) | ||||
#define F77_NORETURN(retval) | ||||
#else | ||||
#define F77_NORETURN(retval) return retval; | ||||
#endif | ||||
/* FIXME -- these should work for SV1 or Y-MP systems but will | /* FIXME -- these should work for SV1 or Y-MP systems but will | |||
need to be changed for others. */ | need to be changed for others. */ | |||
typedef union | typedef union | |||
{ | { | |||
const char *const_ptr; | const char *const_ptr; | |||
char *ptr; | char *ptr; | |||
struct | struct | |||
{ | { | |||
skipping to change at line 170 | skipping to change at line 233 | |||
#define F77_CHAR_ARG(x) x, strlen (x) | #define F77_CHAR_ARG(x) x, strlen (x) | |||
#define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x) | #define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x) | |||
#define F77_CHAR_ARG2(x, l) x, l | #define F77_CHAR_ARG2(x, l) x, l | |||
#define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l) | #define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l) | |||
#define F77_CXX_STRING_ARG(x) F77_CONST_CHAR_ARG2 (x.c_str (), x.length ()) | #define F77_CXX_STRING_ARG(x) F77_CONST_CHAR_ARG2 (x.c_str (), x.length ()) | |||
#define F77_CHAR_ARG_LEN(l) | #define F77_CHAR_ARG_LEN(l) | |||
#define F77_CHAR_ARG_DECL char *, int | #define F77_CHAR_ARG_DECL char *, int | |||
#define F77_CONST_CHAR_ARG_DECL const char *, int | #define F77_CONST_CHAR_ARG_DECL const char *, int | |||
#define F77_CHAR_ARG_LEN_DECL | #define F77_CHAR_ARG_LEN_DECL | |||
/* Use these macros to write C-language functions that accept | ||||
Fortran-style character strings. */ | ||||
#define F77_CHAR_ARG_DEF(s, len) char *s, int len | #define F77_CHAR_ARG_DEF(s, len) char *s, int len | |||
#define F77_CONST_CHAR_ARG_DEF(s, len) const char *s, int len | #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s, int len | |||
#define F77_CHAR_ARG_LEN_DEF(len) | #define F77_CHAR_ARG_LEN_DEF(len) | |||
#define F77_CHAR_ARG_USE(s) s | #define F77_CHAR_ARG_USE(s) s | |||
#define F77_CHAR_ARG_LEN_USE(s, len) len | #define F77_CHAR_ARG_LEN_USE(s, len) len | |||
#define F77_RET_T void | #define F77_RET_T void | |||
#define F77_RETURN(retval) | ||||
#define F77_RETURN(retval) return; | ||||
#define F77_NORETURN(retval) | ||||
#else | #else | |||
/* Assume f2c-compatible calling convention. */ | /* Assume f2c-compatible calling convention. */ | |||
/* Use these macros to pass character strings from C to Fortran. */ | ||||
#define F77_CHAR_ARG(x) x | #define F77_CHAR_ARG(x) x | |||
#define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x) | #define F77_CONST_CHAR_ARG(x) F77_CHAR_ARG (x) | |||
#define F77_CHAR_ARG2(x, l) x | #define F77_CHAR_ARG2(x, l) x | |||
#define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l) | #define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l) | |||
#define F77_CXX_STRING_ARG(x) F77_CONST_CHAR_ARG2 (x.c_str (), x.length ()) | #define F77_CXX_STRING_ARG(x) F77_CONST_CHAR_ARG2 (x.c_str (), x.length ()) | |||
#define F77_CHAR_ARG_LEN(l) , l | #define F77_CHAR_ARG_LEN(l) , l | |||
#define F77_CHAR_ARG_DECL char * | #define F77_CHAR_ARG_DECL char * | |||
#define F77_CONST_CHAR_ARG_DECL const char * | #define F77_CONST_CHAR_ARG_DECL const char * | |||
#define F77_CHAR_ARG_LEN_DECL , long | #define F77_CHAR_ARG_LEN_DECL , long | |||
/* Use these macros to write C-language functions that accept | ||||
Fortran-style character strings. */ | ||||
#define F77_CHAR_ARG_DEF(s, len) char *s | #define F77_CHAR_ARG_DEF(s, len) char *s | |||
#define F77_CONST_CHAR_ARG_DEF(s, len) const char *s | #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s | |||
#define F77_CHAR_ARG_LEN_DEF(len) , long len | #define F77_CHAR_ARG_LEN_DEF(len) , long len | |||
#define F77_CHAR_ARG_USE(s) s | #define F77_CHAR_ARG_USE(s) s | |||
#define F77_CHAR_ARG_LEN_USE(s, len) len | #define F77_CHAR_ARG_LEN_USE(s, len) len | |||
#define F77_RET_T int | #define F77_RET_T int | |||
#define F77_RETURN(retval) return retval; | #define F77_RETURN(retval) return retval; | |||
#if defined (HAVE_ATTR_NORETURN) | ||||
#define F77_NORETURN(retval) | ||||
#else | ||||
#define F77_NORETURN(retval) return retval; | ||||
#endif | ||||
#endif | #endif | |||
/* Build a C string local variable CS from the Fortran string parameter S | /* Build a C string local variable CS from the Fortran string parameter S | |||
declared as F77_CHAR_ARG_DEF(s, len) or F77_CONST_CHAR_ARG_DEF(s, len). | declared as F77_CHAR_ARG_DEF(s, len) or F77_CONST_CHAR_ARG_DEF(s, len). | |||
The string will be cleaned up at the end of the current block. | The string will be cleaned up at the end of the current block. | |||
Needs to include <cstring> and <vector>. */ | Needs to include <cstring> and <vector>. */ | |||
#define F77_CSTRING(s, len, cs) \ | #define F77_CSTRING(s, len, cs) \ | |||
OCTAVE_LOCAL_BUFFER (char, cs, F77_CHAR_ARG_LEN_USE (s, len) + 1); \ | OCTAVE_LOCAL_BUFFER (char, cs, F77_CHAR_ARG_LEN_USE (s, len) + 1); \ | |||
End of changes. 11 change blocks. | ||||
7 lines changed or deleted | 73 lines changed or added | |||
fCColVector.h | fCColVector.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexColumnVector_h) | #if !defined (octave_fCColVector_h) | |||
#define octave_FloatComplexColumnVector_h 1 | #define octave_fCColVector_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatComplexColumnVector : public MArray<FloatComplex> | FloatComplexColumnVector : public MArray<FloatComplex> | |||
{ | { | |||
friend class FloatComplexMatrix; | friend class FloatComplexMatrix; | |||
friend class FloatComplexRowVector; | friend class FloatComplexRowVector; | |||
public: | public: | |||
FloatComplexColumnVector (void) | FloatComplexColumnVector (void) | |||
: MArray<FloatComplex> (dim_vector (0, 1)) { } | : MArray<FloatComplex> (dim_vector (0, 1)) { } | |||
explicit FloatComplexColumnVector (octave_idx_type n) | explicit FloatComplexColumnVector (octave_idx_type n) | |||
: MArray<FloatComplex> (dim_vector (n, 1)) { } | : MArray<FloatComplex> (dim_vector (n, 1)) { } | |||
explicit FloatComplexColumnVector (const dim_vector& dv) | explicit FloatComplexColumnVector (const dim_vector& dv) | |||
: MArray<FloatComplex> (dv.as_column ()) { } | : MArray<FloatComplex> (dv.as_column ()) { } | |||
FloatComplexColumnVector (octave_idx_type n, const FloatComplex& val) | FloatComplexColumnVector (octave_idx_type n, const FloatComplex& val) | |||
: MArray<FloatComplex> (dim_vector (n, 1), val) { } | : MArray<FloatComplex> (dim_vector (n, 1), val) { } | |||
skipping to change at line 64 | skipping to change at line 64 | |||
FloatComplexColumnVector (const MArray<FloatComplex>& a) | FloatComplexColumnVector (const MArray<FloatComplex>& a) | |||
: MArray<FloatComplex> (a.as_column ()) { } | : MArray<FloatComplex> (a.as_column ()) { } | |||
FloatComplexColumnVector (const Array<FloatComplex>& a) | FloatComplexColumnVector (const Array<FloatComplex>& a) | |||
: MArray<FloatComplex> (a.as_column ()) { } | : MArray<FloatComplex> (a.as_column ()) { } | |||
explicit FloatComplexColumnVector (const FloatColumnVector& a); | explicit FloatComplexColumnVector (const FloatColumnVector& a); | |||
FloatComplexColumnVector& operator = (const FloatComplexColumnVector& a) | FloatComplexColumnVector& operator = (const FloatComplexColumnVector& a) | |||
{ | { | |||
MArray<FloatComplex>::operator = (a); | MArray<FloatComplex>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const FloatComplexColumnVector& a) const; | bool operator == (const FloatComplexColumnVector& a) const; | |||
bool operator != (const FloatComplexColumnVector& a) const; | bool operator != (const FloatComplexColumnVector& a) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
FloatComplexColumnVector& insert (const FloatColumnVector& a, octave_idx_ | FloatComplexColumnVector& insert (const FloatColumnVector& a, | |||
type r); | octave_idx_type r); | |||
FloatComplexColumnVector& insert (const FloatComplexColumnVector& a, octa | FloatComplexColumnVector& insert (const FloatComplexColumnVector& a, | |||
ve_idx_type r); | octave_idx_type r); | |||
FloatComplexColumnVector& fill (float val); | FloatComplexColumnVector& fill (float val); | |||
FloatComplexColumnVector& fill (const FloatComplex& val); | FloatComplexColumnVector& fill (const FloatComplex& val); | |||
FloatComplexColumnVector& fill (float val, octave_idx_type r1, octave_idx | FloatComplexColumnVector& fill (float val, | |||
_type r2); | octave_idx_type r1, octave_idx_type r2); | |||
FloatComplexColumnVector& fill (const FloatComplex& val, octave_idx_type | FloatComplexColumnVector& fill (const FloatComplex& val, | |||
r1, octave_idx_type r2); | octave_idx_type r1, octave_idx_type r2); | |||
FloatComplexColumnVector stack (const FloatColumnVector& a) const; | FloatComplexColumnVector stack (const FloatColumnVector& a) const; | |||
FloatComplexColumnVector stack (const FloatComplexColumnVector& a) const; | FloatComplexColumnVector stack (const FloatComplexColumnVector& a) const; | |||
FloatComplexRowVector hermitian (void) const; | FloatComplexRowVector hermitian (void) const; | |||
FloatComplexRowVector transpose (void) const; | FloatComplexRowVector transpose (void) const; | |||
friend OCTAVE_API FloatComplexColumnVector conj (const FloatComplexColumn | friend OCTAVE_API FloatComplexColumnVector | |||
Vector& a); | conj (const FloatComplexColumnVector& a); | |||
// resize is the destructive equivalent for this one | // resize is the destructive equivalent for this one | |||
FloatComplexColumnVector extract (octave_idx_type r1, octave_idx_type r2) | FloatComplexColumnVector extract (octave_idx_type r1, | |||
const; | octave_idx_type r2) const; | |||
FloatComplexColumnVector extract_n (octave_idx_type r1, octave_idx_type n | FloatComplexColumnVector extract_n (octave_idx_type r1, | |||
) const; | octave_idx_type n) const; | |||
// column vector by column vector -> column vector operations | // column vector by column vector -> column vector operations | |||
FloatComplexColumnVector& operator += (const FloatColumnVector& a); | FloatComplexColumnVector& operator += (const FloatColumnVector& a); | |||
FloatComplexColumnVector& operator -= (const FloatColumnVector& a); | FloatComplexColumnVector& operator -= (const FloatColumnVector& a); | |||
// matrix by column vector -> column vector operations | // matrix by column vector -> column vector operations | |||
friend OCTAVE_API FloatComplexColumnVector operator * (const FloatComplex | friend OCTAVE_API FloatComplexColumnVector | |||
Matrix& a, | operator * (const FloatComplexMatrix& a, const FloatColumnVector& b); | |||
const FloatColumnVector& b); | ||||
friend OCTAVE_API FloatComplexColumnVector operator * (const FloatComplex | friend OCTAVE_API FloatComplexColumnVector | |||
Matrix& a, | operator * (const FloatComplexMatrix& a, const FloatComplexColumnVector& | |||
const FloatComplexColumnVector& b) | b); | |||
; | ||||
// matrix by column vector -> column vector operations | // matrix by column vector -> column vector operations | |||
friend OCTAVE_API FloatComplexColumnVector operator * (const FloatMatrix& | friend OCTAVE_API FloatComplexColumnVector | |||
a, | operator * (const FloatMatrix& a, const FloatComplexColumnVector& b); | |||
const FloatComplexColumnVector& b) | ||||
; | ||||
// diagonal matrix by column vector -> column vector operations | // diagonal matrix by column vector -> column vector operations | |||
friend OCTAVE_API FloatComplexColumnVector operator * (const FloatDiagMat | friend OCTAVE_API FloatComplexColumnVector | |||
rix& a, | operator * (const FloatDiagMatrix& a, const FloatComplexColumnVector& b); | |||
const FloatComplexColumnVector& b) | ||||
; | ||||
friend OCTAVE_API FloatComplexColumnVector operator * (const FloatComplex | friend OCTAVE_API FloatComplexColumnVector | |||
DiagMatrix& a, | operator * (const FloatComplexDiagMatrix& a, const ColumnVector& b); | |||
const ColumnVector& b); | ||||
friend OCTAVE_API FloatComplexColumnVector operator * (const FloatComplex | friend OCTAVE_API FloatComplexColumnVector | |||
DiagMatrix& a, | operator * (const FloatComplexDiagMatrix& a, const FloatComplexColumnVect | |||
const FloatComplexColumnVector& b) | or& b); | |||
; | ||||
// other operations | // other operations | |||
FloatComplex min (void) const; | FloatComplex min (void) const; | |||
FloatComplex max (void) const; | FloatComplex max (void) const; | |||
FloatColumnVector abs (void) const; | FloatColumnVector abs (void) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Floa | friend OCTAVE_API std::ostream& | |||
tComplexColumnVector& a); | operator << (std::ostream& os, const FloatComplexColumnVector& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatCompl | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
exColumnVector& a); | FloatComplexColumnVector& a) | |||
; | ||||
void resize (octave_idx_type n, | void resize (octave_idx_type n, const FloatComplex& rfv = FloatComplex (0 | |||
const FloatComplex& rfv = Array<FloatComplex>::resize_fill_v | )) | |||
alue ()) | ||||
{ | { | |||
Array<FloatComplex>::resize (dim_vector (n, 1), rfv); | Array<FloatComplex>::resize (dim_vector (n, 1), rfv); | |||
} | } | |||
void clear (octave_idx_type n) | void clear (octave_idx_type n) | |||
{ Array<FloatComplex>::clear (n, 1); } | { Array<FloatComplex>::clear (n, 1); } | |||
}; | }; | |||
MARRAY_FORWARD_DEFS (MArray, FloatComplexColumnVector, FloatComplex) | MARRAY_FORWARD_DEFS (MArray, FloatComplexColumnVector, FloatComplex) | |||
#endif | #endif | |||
End of changes. 19 change blocks. | ||||
55 lines changed or deleted | 47 lines changed or added | |||
fCDiagMatrix.h | fCDiagMatrix.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexDiagMatrix_h) | #if !defined (octave_fCDiagMatrix_h) | |||
#define octave_FloatComplexDiagMatrix_h 1 | #define octave_fCDiagMatrix_h 1 | |||
#include "MDiagArray2.h" | #include "MDiagArray2.h" | |||
#include "fRowVector.h" | #include "fRowVector.h" | |||
#include "fCRowVector.h" | #include "fCRowVector.h" | |||
#include "fColVector.h" | #include "fColVector.h" | |||
#include "fCColVector.h" | #include "fCColVector.h" | |||
#include "DET.h" | #include "DET.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatComplexDiagMatrix : public MDiagArray2<FloatComplex> | FloatComplexDiagMatrix : public MDiagArray2<FloatComplex> | |||
{ | { | |||
public: | public: | |||
FloatComplexDiagMatrix (void) : MDiagArray2<FloatComplex> () { } | FloatComplexDiagMatrix (void) : MDiagArray2<FloatComplex> () { } | |||
FloatComplexDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArra | FloatComplexDiagMatrix (octave_idx_type r, | |||
y2<FloatComplex> (r, c) { } | octave_idx_type c) | |||
: MDiagArray2<FloatComplex> (r, c) { } | ||||
FloatComplexDiagMatrix (octave_idx_type r, octave_idx_type c, const Float | FloatComplexDiagMatrix (octave_idx_type r, octave_idx_type c, | |||
Complex& val) | const FloatComplex& val) | |||
: MDiagArray2<FloatComplex> (r, c, val) { } | : MDiagArray2<FloatComplex> (r, c, val) { } | |||
explicit FloatComplexDiagMatrix (const Array<FloatComplex>& a) | explicit FloatComplexDiagMatrix (const Array<FloatComplex>& a) | |||
: MDiagArray2<FloatComplex> (a) { } | : MDiagArray2<FloatComplex> (a) { } | |||
FloatComplexDiagMatrix (const Array<FloatComplex>& a, octave_idx_type r, | FloatComplexDiagMatrix (const Array<FloatComplex>& a, octave_idx_type r, | |||
octave_idx_type c) | octave_idx_type c) | |||
: MDiagArray2<FloatComplex> (a, r, c) { } | : MDiagArray2<FloatComplex> (a, r, c) { } | |||
explicit FloatComplexDiagMatrix (const Array<float>& a) | explicit FloatComplexDiagMatrix (const Array<float>& a) | |||
: MDiagArray2<FloatComplex> (Array<FloatComplex> (a)) { } | : MDiagArray2<FloatComplex> (Array<FloatComplex> (a)) { } | |||
explicit FloatComplexDiagMatrix (const FloatDiagMatrix& a); | explicit FloatComplexDiagMatrix (const FloatDiagMatrix& a); | |||
FloatComplexDiagMatrix (const MDiagArray2<FloatComplex>& a) | FloatComplexDiagMatrix (const MDiagArray2<FloatComplex>& a) | |||
: MDiagArray2<FloatComplex> (a) { } | : MDiagArray2<FloatComplex> (a) { } | |||
FloatComplexDiagMatrix (const FloatComplexDiagMatrix& a) | FloatComplexDiagMatrix (const FloatComplexDiagMatrix& a) | |||
: MDiagArray2<FloatComplex> (a) { } | : MDiagArray2<FloatComplex> (a) { } | |||
template <class U> | template <class U> | |||
FloatComplexDiagMatrix (const DiagArray2<U>& a) | FloatComplexDiagMatrix (const DiagArray2<U>& a) | |||
: MDiagArray2<FloatComplex> (a) { } | : MDiagArray2<FloatComplex> (a) { } | |||
FloatComplexDiagMatrix& operator = (const FloatComplexDiagMatrix& a) | FloatComplexDiagMatrix& operator = (const FloatComplexDiagMatrix& a) | |||
{ | { | |||
MDiagArray2<FloatComplex>::operator = (a); | MDiagArray2<FloatComplex>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const FloatComplexDiagMatrix& a) const; | bool operator == (const FloatComplexDiagMatrix& a) const; | |||
bool operator != (const FloatComplexDiagMatrix& a) const; | bool operator != (const FloatComplexDiagMatrix& a) const; | |||
FloatComplexDiagMatrix& fill (float val); | FloatComplexDiagMatrix& fill (float val); | |||
FloatComplexDiagMatrix& fill (const FloatComplex& val); | FloatComplexDiagMatrix& fill (const FloatComplex& val); | |||
FloatComplexDiagMatrix& fill (float val, octave_idx_type beg, octave_idx_ | FloatComplexDiagMatrix& fill (float val, | |||
type end); | octave_idx_type beg, octave_idx_type end); | |||
FloatComplexDiagMatrix& fill (const FloatComplex& val, octave_idx_type be | FloatComplexDiagMatrix& fill (const FloatComplex& val, | |||
g, octave_idx_type end); | octave_idx_type beg, octave_idx_type end); | |||
FloatComplexDiagMatrix& fill (const FloatColumnVector& a); | FloatComplexDiagMatrix& fill (const FloatColumnVector& a); | |||
FloatComplexDiagMatrix& fill (const FloatComplexColumnVector& a); | FloatComplexDiagMatrix& fill (const FloatComplexColumnVector& a); | |||
FloatComplexDiagMatrix& fill (const FloatRowVector& a); | FloatComplexDiagMatrix& fill (const FloatRowVector& a); | |||
FloatComplexDiagMatrix& fill (const FloatComplexRowVector& a); | FloatComplexDiagMatrix& fill (const FloatComplexRowVector& a); | |||
FloatComplexDiagMatrix& fill (const FloatColumnVector& a, octave_idx_type | FloatComplexDiagMatrix& fill (const FloatColumnVector& a, | |||
beg); | octave_idx_type beg); | |||
FloatComplexDiagMatrix& fill (const FloatComplexColumnVector& a, octave_i | FloatComplexDiagMatrix& fill (const FloatComplexColumnVector& a, | |||
dx_type beg); | octave_idx_type beg); | |||
FloatComplexDiagMatrix& fill (const FloatRowVector& a, octave_idx_type be g); | FloatComplexDiagMatrix& fill (const FloatRowVector& a, octave_idx_type be g); | |||
FloatComplexDiagMatrix& fill (const FloatComplexRowVector& a, octave_idx_ | FloatComplexDiagMatrix& fill (const FloatComplexRowVector& a, | |||
type beg); | octave_idx_type beg); | |||
FloatComplexDiagMatrix hermitian (void) const { return MDiagArray2<FloatC | FloatComplexDiagMatrix hermitian (void) const | |||
omplex>::hermitian (std::conj); } | { return MDiagArray2<FloatComplex>::hermitian (std::conj); } | |||
FloatComplexDiagMatrix transpose (void) const { return MDiagArray2<FloatC | FloatComplexDiagMatrix transpose (void) const | |||
omplex>::transpose(); } | { return MDiagArray2<FloatComplex>::transpose (); } | |||
FloatDiagMatrix abs (void) const; | FloatDiagMatrix abs (void) const; | |||
friend OCTAVE_API FloatComplexDiagMatrix conj (const FloatComplexDiagMatr | friend OCTAVE_API FloatComplexDiagMatrix | |||
ix& a); | conj (const FloatComplexDiagMatrix& a); | |||
// resize is the destructive analog for this one | // resize is the destructive analog for this one | |||
FloatComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octav | FloatComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, | |||
e_idx_type r2, octave_idx_type c2) const; | octave_idx_type r2, octave_idx_type c2) const | |||
; | ||||
// extract row or column i | // extract row or column i | |||
FloatComplexRowVector row (octave_idx_type i) const; | FloatComplexRowVector row (octave_idx_type i) const; | |||
FloatComplexRowVector row (char *s) const; | FloatComplexRowVector row (char *s) const; | |||
FloatComplexColumnVector column (octave_idx_type i) const; | FloatComplexColumnVector column (octave_idx_type i) const; | |||
FloatComplexColumnVector column (char *s) const; | FloatComplexColumnVector column (char *s) const; | |||
FloatComplexDiagMatrix inverse (octave_idx_type& info) const; | FloatComplexDiagMatrix inverse (octave_idx_type& info) const; | |||
skipping to change at line 123 | skipping to change at line 136 | |||
bool all_elements_are_real (void) const; | bool all_elements_are_real (void) const; | |||
// diagonal matrix by diagonal matrix -> diagonal matrix operations | // diagonal matrix by diagonal matrix -> diagonal matrix operations | |||
FloatComplexDiagMatrix& operator += (const FloatDiagMatrix& a); | FloatComplexDiagMatrix& operator += (const FloatDiagMatrix& a); | |||
FloatComplexDiagMatrix& operator -= (const FloatDiagMatrix& a); | FloatComplexDiagMatrix& operator -= (const FloatDiagMatrix& a); | |||
// other operations | // other operations | |||
FloatComplexColumnVector diag (octave_idx_type k = 0) const | FloatComplexColumnVector extract_diag (octave_idx_type k = 0) const | |||
{ return MDiagArray2<FloatComplex>::diag (k); } | { return MDiagArray2<FloatComplex>::extract_diag (k); } | |||
FloatComplexDET determinant (void) const; | FloatComplexDET determinant (void) const; | |||
float rcond (void) const; | float rcond (void) const; | |||
// i/o | // i/o | |||
friend std::ostream& operator << (std::ostream& os, const FloatComplexDia | friend std::ostream& operator << (std::ostream& os, | |||
gMatrix& a); | const FloatComplexDiagMatrix& a); | |||
}; | }; | |||
OCTAVE_API FloatComplexDiagMatrix conj (const FloatComplexDiagMatrix& a); | OCTAVE_API FloatComplexDiagMatrix conj (const FloatComplexDiagMatrix& a); | |||
// diagonal matrix by diagonal matrix -> diagonal matrix operations | // diagonal matrix by diagonal matrix -> diagonal matrix operations | |||
OCTAVE_API FloatComplexDiagMatrix | OCTAVE_API FloatComplexDiagMatrix | |||
operator * (const FloatComplexDiagMatrix& a, const FloatComplexDiagMatrix& b); | operator * (const FloatComplexDiagMatrix& a, const FloatComplexDiagMatrix& b); | |||
End of changes. 14 change blocks. | ||||
35 lines changed or deleted | 37 lines changed or added | |||
fCMatrix.h | fCMatrix.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexMatrix_h) | #if !defined (octave_fCMatrix_h) | |||
#define octave_FloatComplexMatrix_h 1 | #define octave_fCMatrix_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "MDiagArray2.h" | #include "MDiagArray2.h" | |||
#include "MatrixType.h" | #include "MatrixType.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
#include "mx-op-decl.h" | #include "mx-op-decl.h" | |||
#include "oct-cmplx.h" | #include "oct-cmplx.h" | |||
#include "DET.h" | #include "DET.h" | |||
skipping to change at line 93 | skipping to change at line 93 | |||
explicit FloatComplexMatrix (const FloatComplexDiagMatrix& a); | explicit FloatComplexMatrix (const FloatComplexDiagMatrix& a); | |||
explicit FloatComplexMatrix (const boolMatrix& a); | explicit FloatComplexMatrix (const boolMatrix& a); | |||
explicit FloatComplexMatrix (const charMatrix& a); | explicit FloatComplexMatrix (const charMatrix& a); | |||
FloatComplexMatrix (const FloatMatrix& re, const FloatMatrix& im); | FloatComplexMatrix (const FloatMatrix& re, const FloatMatrix& im); | |||
FloatComplexMatrix& operator = (const FloatComplexMatrix& a) | FloatComplexMatrix& operator = (const FloatComplexMatrix& a) | |||
{ | { | |||
MArray<FloatComplex>::operator = (a); | MArray<FloatComplex>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const FloatComplexMatrix& a) const; | bool operator == (const FloatComplexMatrix& a) const; | |||
bool operator != (const FloatComplexMatrix& a) const; | bool operator != (const FloatComplexMatrix& a) const; | |||
bool is_hermitian (void) const; | bool is_hermitian (void) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
FloatComplexMatrix& insert (const FloatMatrix& a, octave_idx_type r, octa | FloatComplexMatrix& insert (const FloatMatrix& a, | |||
ve_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatComplexMatrix& insert (const FloatRowVector& a, octave_idx_type r, o | FloatComplexMatrix& insert (const FloatRowVector& a, | |||
ctave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatComplexMatrix& insert (const FloatColumnVector& a, octave_idx_type r | FloatComplexMatrix& insert (const FloatColumnVector& a, | |||
, octave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatComplexMatrix& insert (const FloatDiagMatrix& a, octave_idx_type r, | FloatComplexMatrix& insert (const FloatDiagMatrix& a, | |||
octave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatComplexMatrix& insert (const FloatComplexMatrix& a, octave_idx_type | FloatComplexMatrix& insert (const FloatComplexMatrix& a, | |||
r, octave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatComplexMatrix& insert (const FloatComplexRowVector& a, octave_idx_ty | FloatComplexMatrix& insert (const FloatComplexRowVector& a, | |||
pe r, octave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatComplexMatrix& insert (const FloatComplexColumnVector& a, octave_idx | FloatComplexMatrix& insert (const FloatComplexColumnVector& a, | |||
_type r, octave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatComplexMatrix& insert (const FloatComplexDiagMatrix& a, octave_idx_t | FloatComplexMatrix& insert (const FloatComplexDiagMatrix& a, | |||
ype r, octave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatComplexMatrix& fill (float val); | FloatComplexMatrix& fill (float val); | |||
FloatComplexMatrix& fill (const FloatComplex& val); | FloatComplexMatrix& fill (const FloatComplex& val); | |||
FloatComplexMatrix& fill (float val, octave_idx_type r1, octave_idx_type | FloatComplexMatrix& fill (float val, octave_idx_type r1, octave_idx_type | |||
c1, octave_idx_type r2, octave_idx_type c2); | c1, | |||
FloatComplexMatrix& fill (const FloatComplex& val, octave_idx_type r1, oc | octave_idx_type r2, octave_idx_type c2); | |||
tave_idx_type c1, octave_idx_type r2, octave_idx_type c2); | FloatComplexMatrix& fill (const FloatComplex& val, | |||
octave_idx_type r1, octave_idx_type c1, | ||||
octave_idx_type r2, octave_idx_type c2); | ||||
FloatComplexMatrix append (const FloatMatrix& a) const; | FloatComplexMatrix append (const FloatMatrix& a) const; | |||
FloatComplexMatrix append (const FloatRowVector& a) const; | FloatComplexMatrix append (const FloatRowVector& a) const; | |||
FloatComplexMatrix append (const FloatColumnVector& a) const; | FloatComplexMatrix append (const FloatColumnVector& a) const; | |||
FloatComplexMatrix append (const FloatDiagMatrix& a) const; | FloatComplexMatrix append (const FloatDiagMatrix& a) const; | |||
FloatComplexMatrix append (const FloatComplexMatrix& a) const; | FloatComplexMatrix append (const FloatComplexMatrix& a) const; | |||
FloatComplexMatrix append (const FloatComplexRowVector& a) const; | FloatComplexMatrix append (const FloatComplexRowVector& a) const; | |||
FloatComplexMatrix append (const FloatComplexColumnVector& a) const; | FloatComplexMatrix append (const FloatComplexColumnVector& a) const; | |||
FloatComplexMatrix append (const FloatComplexDiagMatrix& a) const; | FloatComplexMatrix append (const FloatComplexDiagMatrix& a) const; | |||
skipping to change at line 141 | skipping to change at line 152 | |||
FloatComplexMatrix stack (const FloatRowVector& a) const; | FloatComplexMatrix stack (const FloatRowVector& a) const; | |||
FloatComplexMatrix stack (const FloatColumnVector& a) const; | FloatComplexMatrix stack (const FloatColumnVector& a) const; | |||
FloatComplexMatrix stack (const FloatDiagMatrix& a) const; | FloatComplexMatrix stack (const FloatDiagMatrix& a) const; | |||
FloatComplexMatrix stack (const FloatComplexMatrix& a) const; | FloatComplexMatrix stack (const FloatComplexMatrix& a) const; | |||
FloatComplexMatrix stack (const FloatComplexRowVector& a) const; | FloatComplexMatrix stack (const FloatComplexRowVector& a) const; | |||
FloatComplexMatrix stack (const FloatComplexColumnVector& a) const; | FloatComplexMatrix stack (const FloatComplexColumnVector& a) const; | |||
FloatComplexMatrix stack (const FloatComplexDiagMatrix& a) const; | FloatComplexMatrix stack (const FloatComplexDiagMatrix& a) const; | |||
FloatComplexMatrix hermitian (void) const | FloatComplexMatrix hermitian (void) const | |||
{ return MArray<FloatComplex>::hermitian (std::conj); } | { return MArray<FloatComplex>::hermitian (std::conj); } | |||
FloatComplexMatrix transpose (void) const | FloatComplexMatrix transpose (void) const | |||
{ return MArray<FloatComplex>::transpose (); } | { return MArray<FloatComplex>::transpose (); } | |||
friend OCTAVE_API FloatComplexMatrix conj (const FloatComplexMatrix& a); | friend OCTAVE_API FloatComplexMatrix conj (const FloatComplexMatrix& a); | |||
// resize is the destructive equivalent for this one | // resize is the destructive equivalent for this one | |||
FloatComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octav | FloatComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, | |||
e_idx_type r2, octave_idx_type c2) const; | octave_idx_type r2, octave_idx_type c2) const | |||
; | ||||
FloatComplexMatrix extract_n (octave_idx_type r1, octave_idx_type c1, oct | FloatComplexMatrix extract_n (octave_idx_type r1, octave_idx_type c1, | |||
ave_idx_type nr, octave_idx_type nc) const; | octave_idx_type nr, octave_idx_type nc) con | |||
st; | ||||
// extract row or column i. | // extract row or column i. | |||
FloatComplexRowVector row (octave_idx_type i) const; | FloatComplexRowVector row (octave_idx_type i) const; | |||
FloatComplexColumnVector column (octave_idx_type i) const; | FloatComplexColumnVector column (octave_idx_type i) const; | |||
void resize (octave_idx_type nr, octave_idx_type nc, | void resize (octave_idx_type nr, octave_idx_type nc, | |||
const FloatComplex& rfv = resize_fill_value ()) | const FloatComplex& rfv = FloatComplex (0)) | |||
{ | { | |||
MArray<FloatComplex>::resize (dim_vector (nr, nc), rfv); | MArray<FloatComplex>::resize (dim_vector (nr, nc), rfv); | |||
} | } | |||
private: | private: | |||
FloatComplexMatrix tinverse (MatrixType &mattype, octave_idx_type& info, | FloatComplexMatrix tinverse (MatrixType &mattype, octave_idx_type& info, | |||
float& rcon, int force, int calc_cond) const; | float& rcon, int force, int calc_cond) const ; | |||
FloatComplexMatrix finverse (MatrixType &mattype, octave_idx_type& info, | FloatComplexMatrix finverse (MatrixType &mattype, octave_idx_type& info, | |||
float& rcon, int force, int calc_cond) const; | float& rcon, int force, int calc_cond) const ; | |||
public: | public: | |||
FloatComplexMatrix inverse (void) const; | FloatComplexMatrix inverse (void) const; | |||
FloatComplexMatrix inverse (octave_idx_type& info) const; | FloatComplexMatrix inverse (octave_idx_type& info) const; | |||
FloatComplexMatrix inverse (octave_idx_type& info, float& rcon, int force | FloatComplexMatrix inverse (octave_idx_type& info, float& rcon, | |||
= 0, | int force = 0, int calc_cond = 1) const; | |||
int calc_cond = 1) const; | ||||
FloatComplexMatrix inverse (MatrixType &mattype) const; | FloatComplexMatrix inverse (MatrixType &mattype) const; | |||
FloatComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info) c onst; | FloatComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info) c onst; | |||
FloatComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info, | FloatComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info, | |||
float& rcon, int force = 0, | float& rcon, int force = 0, | |||
int calc_cond = 1) const; | int calc_cond = 1) const; | |||
FloatComplexMatrix pseudo_inverse (float tol = 0.0) const; | FloatComplexMatrix pseudo_inverse (float tol = 0.0) const; | |||
FloatComplexMatrix fourier (void) const; | FloatComplexMatrix fourier (void) const; | |||
FloatComplexMatrix ifourier (void) const; | FloatComplexMatrix ifourier (void) const; | |||
FloatComplexMatrix fourier2d (void) const; | FloatComplexMatrix fourier2d (void) const; | |||
FloatComplexMatrix ifourier2d (void) const; | FloatComplexMatrix ifourier2d (void) const; | |||
FloatComplexDET determinant (void) const; | FloatComplexDET determinant (void) const; | |||
FloatComplexDET determinant (octave_idx_type& info) const; | FloatComplexDET determinant (octave_idx_type& info) const; | |||
FloatComplexDET determinant (octave_idx_type& info, float& rcon, int calc | FloatComplexDET determinant (octave_idx_type& info, float& rcon, | |||
_cond = 1) const; | int calc_cond = 1) const; | |||
FloatComplexDET determinant (MatrixType &mattype, octave_idx_type& info, | FloatComplexDET determinant (MatrixType &mattype, octave_idx_type& info, | |||
float& rcon, int calc_cond = 1) const; | float& rcon, int calc_cond = 1) const; | |||
float rcond (void) const; | float rcond (void) const; | |||
float rcond (MatrixType &mattype) const; | float rcond (MatrixType &mattype) const; | |||
private: | private: | |||
// Upper triangular matrix solvers | // Upper triangular matrix solvers | |||
FloatComplexMatrix utsolve (MatrixType &typ, const FloatComplexMatrix& b, | FloatComplexMatrix utsolve (MatrixType &typ, const FloatComplexMatrix& b, | |||
octave_idx_type& info, float& rcon, | octave_idx_type& info, float& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false, blas_trans_type transt = blas_no_ | bool calc_cond = false, | |||
trans) const; | blas_trans_type transt = blas_no_trans) const | |||
; | ||||
// Lower triangular matrix solvers | // Lower triangular matrix solvers | |||
FloatComplexMatrix ltsolve (MatrixType &typ, const FloatComplexMatrix& b, | FloatComplexMatrix ltsolve (MatrixType &typ, const FloatComplexMatrix& b, | |||
octave_idx_type& info, float& rcon, | octave_idx_type& info, float& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false, blas_trans_type transt = blas_no_ | bool calc_cond = false, | |||
trans) const; | blas_trans_type transt = blas_no_trans) const | |||
; | ||||
// Full matrix solvers (umfpack/cholesky) | // Full matrix solvers (umfpack/cholesky) | |||
FloatComplexMatrix fsolve (MatrixType &typ, const FloatComplexMatrix& b, | FloatComplexMatrix fsolve (MatrixType &typ, const FloatComplexMatrix& b, | |||
octave_idx_type& info, float& rcon, | octave_idx_type& info, float& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
public: | public: | |||
// Generic interface to solver with no probing of type | // Generic interface to solver with no probing of type | |||
FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b) const; | FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b) const; | |||
FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, | FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, | ||||
octave_idx_type& info, float& rcon) const; | ||||
FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, | FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, | |||
octave_idx_type& info, float& rcon) const; | octave_idx_type& info, | |||
FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_i | float& rcon, solve_singularity_handler sing_han | |||
dx_type& info, | dler, | |||
float& rcon, solve_singularity_handler sing_handler, | bool singular_fallback = true, | |||
bool singular_fallback = true, | blas_trans_type transt = blas_no_trans) const; | |||
blas_trans_type transt = blas_no_trans) const; | ||||
FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b) c onst; | FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b) c onst; | |||
FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, | FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, | FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, | |||
octave_idx_type& info, float& rcon) const; | octave_idx_type& info, float& rcon) const; | |||
FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, | FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, | |||
octave_idx_type& info, float& rcon, | octave_idx_type& info, float& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool singular_fallback = true, | bool singular_fallback = true, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& | FloatComplexColumnVector solve (MatrixType &typ, | |||
b) const; | const FloatColumnVector& b) const; | |||
FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, | FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, | FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, | |||
octave_idx_type& info, float& rcon) const; | octave_idx_type& info, float& rcon) const ; | |||
FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, | FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, | |||
octave_idx_type& info, float& rcon, | octave_idx_type& info, float& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) c | |||
onst; | ||||
FloatComplexColumnVector solve (MatrixType &typ, | FloatComplexColumnVector solve (MatrixType &typ, | |||
const FloatComplexColumnVector& b) const; | const FloatComplexColumnVector& b) const; | |||
FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumn | FloatComplexColumnVector solve (MatrixType &typ, | |||
Vector& b, | const FloatComplexColumnVector& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumn | FloatComplexColumnVector solve (MatrixType &typ, | |||
Vector& b, | const FloatComplexColumnVector& b, | |||
octave_idx_type& info, float& rcon) const; | octave_idx_type& info, float& rcon) const | |||
FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumn | ; | |||
Vector& b, | FloatComplexColumnVector solve (MatrixType &typ, | |||
octave_idx_type& info, float& rcon, | const FloatComplexColumnVector& b, | |||
solve_singularity_handler sing_handler, | octave_idx_type& info, float& rcon, | |||
blas_trans_type transt = blas_no_trans) const; | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) c | ||||
onst; | ||||
// Generic interface to solver with probing of type | // Generic interface to solver with probing of type | |||
FloatComplexMatrix solve (const FloatMatrix& b) const; | FloatComplexMatrix solve (const FloatMatrix& b) const; | |||
FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info) co nst; | FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info) co nst; | |||
FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info, fl | FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info, | |||
oat& rcon) const; | float& rcon) const; | |||
FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info, fl | FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info, | |||
oat& rcon, | float& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
FloatComplexMatrix solve (const FloatComplexMatrix& b) const; | FloatComplexMatrix solve (const FloatComplexMatrix& b) const; | |||
FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& i | FloatComplexMatrix solve (const FloatComplexMatrix& b, | |||
nfo) const; | octave_idx_type& info) const; | |||
FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& i | FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& i | |||
nfo, float& rcon) const; | nfo, | |||
FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& i | float& rcon) const; | |||
nfo, float& rcon, | FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& i | |||
solve_singularity_handler sing_handler, | nfo, | |||
blas_trans_type transt = blas_no_trans) const; | float& rcon, | |||
solve_singularity_handler sing_handler, | ||||
blas_trans_type transt = blas_no_trans) const; | ||||
FloatComplexColumnVector solve (const FloatColumnVector& b) const; | FloatComplexColumnVector solve (const FloatColumnVector& b) const; | |||
FloatComplexColumnVector solve (const FloatColumnVector& b, octave_idx_ty | FloatComplexColumnVector solve (const FloatColumnVector& b, | |||
pe& info) const; | octave_idx_type& info) const; | |||
FloatComplexColumnVector solve (const FloatColumnVector& b, octave_idx_ty | FloatComplexColumnVector solve (const FloatColumnVector& b, | |||
pe& info, | octave_idx_type& info, | |||
float& rcon) const; | float& rcon) const; | |||
FloatComplexColumnVector solve (const FloatColumnVector& b, octave_idx_ty | FloatComplexColumnVector solve (const FloatColumnVector& b, | |||
pe& info, float& rcon, | octave_idx_type& info, float& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) c | |||
onst; | ||||
FloatComplexColumnVector solve (const FloatComplexColumnVector& b) const; | FloatComplexColumnVector solve (const FloatComplexColumnVector& b) const; | |||
FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave | FloatComplexColumnVector solve (const FloatComplexColumnVector& b, | |||
_idx_type& info) const; | octave_idx_type& info) const; | |||
FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave | FloatComplexColumnVector solve (const FloatComplexColumnVector& b, | |||
_idx_type& info, | octave_idx_type& info, | |||
float& rcon) const; | float& rcon) const; | |||
FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave | FloatComplexColumnVector solve (const FloatComplexColumnVector& b, | |||
_idx_type& info, | octave_idx_type& info, | |||
float& rcon, | float& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) c | |||
onst; | ||||
FloatComplexMatrix lssolve (const FloatMatrix& b) const; | FloatComplexMatrix lssolve (const FloatMatrix& b) const; | |||
FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info) | FloatComplexMatrix lssolve (const FloatMatrix& b, | |||
const; | octave_idx_type& info) const; | |||
FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, | FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, | |||
octave_idx_type& rank) const; | octave_idx_type& rank) const; | |||
FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, | FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, | |||
octave_idx_type& rank, float& rcon) const; | octave_idx_type& rank, float& rcon) const; | |||
FloatComplexMatrix lssolve (const FloatComplexMatrix& b) const; | FloatComplexMatrix lssolve (const FloatComplexMatrix& b) const; | |||
FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& | FloatComplexMatrix lssolve (const FloatComplexMatrix& b, | |||
info) const; | octave_idx_type& info) const; | |||
FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& | FloatComplexMatrix lssolve (const FloatComplexMatrix& b, | |||
info, | octave_idx_type& info, octave_idx_type& rank) | |||
octave_idx_type& rank) const; | const; | |||
FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& | FloatComplexMatrix lssolve (const FloatComplexMatrix& b, | |||
info, | octave_idx_type& info, octave_idx_type& rank, | |||
octave_idx_type& rank, float& rcon) const; | float& rcon) const; | |||
FloatComplexColumnVector lssolve (const FloatColumnVector& b) const; | FloatComplexColumnVector lssolve (const FloatColumnVector& b) const; | |||
FloatComplexColumnVector lssolve (const FloatColumnVector& b, | FloatComplexColumnVector lssolve (const FloatColumnVector& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
FloatComplexColumnVector lssolve (const FloatColumnVector& b, octave_idx_ | FloatComplexColumnVector lssolve (const FloatColumnVector& b, | |||
type& info, | octave_idx_type& info, | |||
octave_idx_type& rank) const; | octave_idx_type& rank) const; | |||
FloatComplexColumnVector lssolve (const FloatColumnVector& b, octave_idx_ | FloatComplexColumnVector lssolve (const FloatColumnVector& b, | |||
type& info, | octave_idx_type& info, | |||
octave_idx_type& rank, float& rcon) const; | octave_idx_type& rank, float& rcon) con | |||
st; | ||||
FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b) cons t; | FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b) cons t; | |||
FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, | FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, | FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, | |||
octave_idx_type& info, | octave_idx_type& info, | |||
octave_idx_type& rank) const; | octave_idx_type& rank) const; | |||
FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, | FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, | |||
octave_idx_type& info, | octave_idx_type& info, | |||
octave_idx_type& rank, float& rcon) const; | octave_idx_type& rank, float& rcon) con | |||
st; | ||||
// matrix by diagonal matrix -> matrix operations | // matrix by diagonal matrix -> matrix operations | |||
FloatComplexMatrix& operator += (const FloatDiagMatrix& a); | FloatComplexMatrix& operator += (const FloatDiagMatrix& a); | |||
FloatComplexMatrix& operator -= (const FloatDiagMatrix& a); | FloatComplexMatrix& operator -= (const FloatDiagMatrix& a); | |||
FloatComplexMatrix& operator += (const FloatComplexDiagMatrix& a); | FloatComplexMatrix& operator += (const FloatComplexDiagMatrix& a); | |||
FloatComplexMatrix& operator -= (const FloatComplexDiagMatrix& a); | FloatComplexMatrix& operator -= (const FloatComplexDiagMatrix& a); | |||
// matrix by matrix -> matrix operations | // matrix by matrix -> matrix operations | |||
skipping to change at line 365 | skipping to change at line 401 | |||
FloatComplexMatrix cumprod (int dim = -1) const; | FloatComplexMatrix cumprod (int dim = -1) const; | |||
FloatComplexMatrix cumsum (int dim = -1) const; | FloatComplexMatrix cumsum (int dim = -1) const; | |||
FloatComplexMatrix prod (int dim = -1) const; | FloatComplexMatrix prod (int dim = -1) const; | |||
FloatComplexMatrix sum (int dim = -1) const; | FloatComplexMatrix sum (int dim = -1) const; | |||
FloatComplexMatrix sumsq (int dim = -1) const; | FloatComplexMatrix sumsq (int dim = -1) const; | |||
FloatMatrix abs (void) const; | FloatMatrix abs (void) const; | |||
FloatComplexMatrix diag (octave_idx_type k = 0) const; | FloatComplexMatrix diag (octave_idx_type k = 0) const; | |||
FloatComplexDiagMatrix diag (octave_idx_type m, octave_idx_type n) const; | ||||
bool row_is_real_only (octave_idx_type) const; | bool row_is_real_only (octave_idx_type) const; | |||
bool column_is_real_only (octave_idx_type) const; | bool column_is_real_only (octave_idx_type) const; | |||
FloatComplexColumnVector row_min (void) const; | FloatComplexColumnVector row_min (void) const; | |||
FloatComplexColumnVector row_max (void) const; | FloatComplexColumnVector row_max (void) const; | |||
FloatComplexColumnVector row_min (Array<octave_idx_type>& index) const; | FloatComplexColumnVector row_min (Array<octave_idx_type>& index) const; | |||
FloatComplexColumnVector row_max (Array<octave_idx_type>& index) const; | FloatComplexColumnVector row_max (Array<octave_idx_type>& index) const; | |||
FloatComplexRowVector column_min (void) const; | FloatComplexRowVector column_min (void) const; | |||
FloatComplexRowVector column_max (void) const; | FloatComplexRowVector column_max (void) const; | |||
FloatComplexRowVector column_min (Array<octave_idx_type>& index) const; | FloatComplexRowVector column_min (Array<octave_idx_type>& index) const; | |||
FloatComplexRowVector column_max (Array<octave_idx_type>& index) const; | FloatComplexRowVector column_max (Array<octave_idx_type>& index) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Floa | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
tComplexMatrix& a); | const FloatComplexMatrix& a) | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatCompl | ; | |||
exMatrix& a); | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
FloatComplexMatrix& a); | ||||
static FloatComplex resize_fill_value (void) { return FloatComplex (0.0, | ||||
0.0); } | ||||
}; | }; | |||
extern OCTAVE_API FloatComplexMatrix conj (const FloatComplexMatrix& a); | extern OCTAVE_API FloatComplexMatrix conj (const FloatComplexMatrix& a); | |||
// column vector by row vector -> matrix operations | // column vector by row vector -> matrix operations | |||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
operator * (const FloatColumnVector& a, const FloatComplexRowVector& b); | operator * (const FloatColumnVector& a, const FloatComplexRowVector& b); | |||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
operator * (const FloatComplexColumnVector& a, const FloatRowVector& b); | operator * (const FloatComplexColumnVector& a, const FloatRowVector& b); | |||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
operator * (const FloatComplexColumnVector& a, const FloatComplexRowVector& b); | operator * (const FloatComplexColumnVector& a, const FloatComplexRowVector& b); | |||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
Givens (const FloatComplex&, const FloatComplex&); | Givens (const FloatComplex&, const FloatComplex&); | |||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
Sylvester (const FloatComplexMatrix&, const FloatComplexMatrix&, const Floa | Sylvester (const FloatComplexMatrix&, const FloatComplexMatrix&, | |||
tComplexMatrix&); | const FloatComplexMatrix&); | |||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
xgemm (const FloatComplexMatrix& a, const FloatComplexMatrix& b, | xgemm (const FloatComplexMatrix& a, const FloatComplexMatrix& b, | |||
blas_trans_type transa = blas_no_trans, | blas_trans_type transa = blas_no_trans, | |||
blas_trans_type transb = blas_no_trans); | blas_trans_type transb = blas_no_trans); | |||
extern OCTAVE_API FloatComplexMatrix operator * (const FloatMatrix&, | extern OCTAVE_API FloatComplexMatrix operator * (const FloatMatrix&, | |||
const FloatComplexMatrix&); | const FloatComplexMatrix&) | |||
extern OCTAVE_API FloatComplexMatrix operator * (const FloatComplexMatrix&, | ; | |||
const FloatMatrix&); | extern OCTAVE_API FloatComplexMatrix operator * (const FloatComplexMatrix&, | |||
extern OCTAVE_API FloatComplexMatrix operator * (const FloatComplexMatrix&, | const FloatMatrix&); | |||
const FloatComplexMatrix&); | extern OCTAVE_API FloatComplexMatrix operator * (const FloatComplexMatrix&, | |||
const FloatComplexMatrix&) | ||||
extern OCTAVE_API FloatComplexMatrix min (const FloatComplex& c, const Floa | ; | |||
tComplexMatrix& m); | ||||
extern OCTAVE_API FloatComplexMatrix min (const FloatComplexMatrix& m, cons | extern OCTAVE_API FloatComplexMatrix min (const FloatComplex& c, | |||
t FloatComplex& c); | const FloatComplexMatrix& m); | |||
extern OCTAVE_API FloatComplexMatrix min (const FloatComplexMatrix& a, cons | extern OCTAVE_API FloatComplexMatrix min (const FloatComplexMatrix& m, | |||
t FloatComplexMatrix& b); | const FloatComplex& c); | |||
extern OCTAVE_API FloatComplexMatrix min (const FloatComplexMatrix& a, | ||||
extern OCTAVE_API FloatComplexMatrix max (const FloatComplex& c, const Floa | const FloatComplexMatrix& b); | |||
tComplexMatrix& m); | ||||
extern OCTAVE_API FloatComplexMatrix max (const FloatComplexMatrix& m, cons | extern OCTAVE_API FloatComplexMatrix max (const FloatComplex& c, | |||
t FloatComplex& c); | const FloatComplexMatrix& m); | |||
extern OCTAVE_API FloatComplexMatrix max (const FloatComplexMatrix& a, cons | extern OCTAVE_API FloatComplexMatrix max (const FloatComplexMatrix& m, | |||
t FloatComplexMatrix& b); | const FloatComplex& c); | |||
extern OCTAVE_API FloatComplexMatrix max (const FloatComplexMatrix& a, | ||||
extern OCTAVE_API FloatComplexMatrix linspace (const FloatComplexColumnVect | const FloatComplexMatrix& b); | |||
or& x1, | ||||
const FloatComplexColumnVect | extern OCTAVE_API FloatComplexMatrix | |||
or& x2, | linspace (const FloatComplexColumnVector& x1, | |||
octave_idx_type n); | const FloatComplexColumnVector& x2, | |||
octave_idx_type n); | ||||
MS_CMP_OP_DECLS (FloatComplexMatrix, FloatComplex, OCTAVE_API) | MS_CMP_OP_DECLS (FloatComplexMatrix, FloatComplex, OCTAVE_API) | |||
MS_BOOL_OP_DECLS (FloatComplexMatrix, FloatComplex, OCTAVE_API) | MS_BOOL_OP_DECLS (FloatComplexMatrix, FloatComplex, OCTAVE_API) | |||
SM_CMP_OP_DECLS (FloatComplex, FloatComplexMatrix, OCTAVE_API) | SM_CMP_OP_DECLS (FloatComplex, FloatComplexMatrix, OCTAVE_API) | |||
SM_BOOL_OP_DECLS (FloatComplex, FloatComplexMatrix, OCTAVE_API) | SM_BOOL_OP_DECLS (FloatComplex, FloatComplexMatrix, OCTAVE_API) | |||
MM_CMP_OP_DECLS (FloatComplexMatrix, FloatComplexMatrix, OCTAVE_API) | MM_CMP_OP_DECLS (FloatComplexMatrix, FloatComplexMatrix, OCTAVE_API) | |||
MM_BOOL_OP_DECLS (FloatComplexMatrix, FloatComplexMatrix, OCTAVE_API) | MM_BOOL_OP_DECLS (FloatComplexMatrix, FloatComplexMatrix, OCTAVE_API) | |||
End of changes. 44 change blocks. | ||||
180 lines changed or deleted | 195 lines changed or added | |||
fCNDArray.h | fCNDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexNDArray_h) | #if !defined (octave_fCNDArray_h) | |||
#define octave_FloatComplexNDArray_h 1 | #define octave_fCNDArray_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "fCMatrix.h" | #include "fCMatrix.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
#include "mx-op-decl.h" | #include "mx-op-decl.h" | |||
#include "bsxfun-decl.h" | #include "bsxfun-decl.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
skipping to change at line 48 | skipping to change at line 48 | |||
typedef FloatComplexMatrix matrix_type; | typedef FloatComplexMatrix matrix_type; | |||
FloatComplexNDArray (void) : MArray<FloatComplex> () { } | FloatComplexNDArray (void) : MArray<FloatComplex> () { } | |||
FloatComplexNDArray (const dim_vector& dv) : MArray<FloatComplex> (dv) { } | FloatComplexNDArray (const dim_vector& dv) : MArray<FloatComplex> (dv) { } | |||
FloatComplexNDArray (const dim_vector& dv, const FloatComplex& val) | FloatComplexNDArray (const dim_vector& dv, const FloatComplex& val) | |||
: MArray<FloatComplex> (dv, val) { } | : MArray<FloatComplex> (dv, val) { } | |||
FloatComplexNDArray (const FloatComplexNDArray& a) : MArray<FloatComplex> | FloatComplexNDArray (const FloatComplexNDArray& a) | |||
(a) { } | : MArray<FloatComplex> (a) { } | |||
FloatComplexNDArray (const FloatComplexMatrix& a) : MArray<FloatComplex> | FloatComplexNDArray (const FloatComplexMatrix& a) | |||
(a) { } | : MArray<FloatComplex> (a) { } | |||
template <class U> | template <class U> | |||
FloatComplexNDArray (const MArray<U>& a) : MArray<FloatComplex> (a) { } | FloatComplexNDArray (const MArray<U>& a) : MArray<FloatComplex> (a) { } | |||
template <class U> | template <class U> | |||
FloatComplexNDArray (const Array<U>& a) : MArray<FloatComplex> (a) { } | FloatComplexNDArray (const Array<U>& a) : MArray<FloatComplex> (a) { } | |||
FloatComplexNDArray (const charNDArray&); | FloatComplexNDArray (const charNDArray&); | |||
FloatComplexNDArray& operator = (const FloatComplexNDArray& a) | FloatComplexNDArray& operator = (const FloatComplexNDArray& a) | |||
{ | { | |||
MArray<FloatComplex>::operator = (a); | MArray<FloatComplex>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
// unary operations | // unary operations | |||
boolNDArray operator ! (void) const; | boolNDArray operator ! (void) const; | |||
// FIXME -- this is not quite the right thing. | // FIXME: this is not quite the right thing. | |||
bool any_element_is_nan (void) const; | bool any_element_is_nan (void) const; | |||
bool any_element_is_inf_or_nan (void) const; | bool any_element_is_inf_or_nan (void) const; | |||
bool all_elements_are_real (void) const; | bool all_elements_are_real (void) const; | |||
bool all_integers (float& max_val, float& min_val) const; | bool all_integers (float& max_val, float& min_val) const; | |||
bool too_large_for_float (void) const; | bool too_large_for_float (void) const; | |||
boolNDArray all (int dim = -1) const; | boolNDArray all (int dim = -1) const; | |||
boolNDArray any (int dim = -1) const; | boolNDArray any (int dim = -1) const; | |||
FloatComplexNDArray cumprod (int dim = -1) const; | FloatComplexNDArray cumprod (int dim = -1) const; | |||
FloatComplexNDArray cumsum (int dim = -1) const; | FloatComplexNDArray cumsum (int dim = -1) const; | |||
FloatComplexNDArray prod (int dim = -1) const; | FloatComplexNDArray prod (int dim = -1) const; | |||
FloatComplexNDArray sum (int dim = -1) const; | FloatComplexNDArray sum (int dim = -1) const; | |||
ComplexNDArray dsum (int dim = -1) const; | ComplexNDArray dsum (int dim = -1) const; | |||
FloatComplexNDArray sumsq (int dim = -1) const; | FloatComplexNDArray sumsq (int dim = -1) const; | |||
FloatComplexNDArray concat (const FloatComplexNDArray& rb, const Array<oc | FloatComplexNDArray concat (const FloatComplexNDArray& rb, | |||
tave_idx_type>& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
FloatComplexNDArray concat (const FloatNDArray& rb, const Array<octave_id | FloatComplexNDArray concat (const FloatNDArray& rb, | |||
x_type>& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
FloatComplexNDArray max (int dim = -1) const; | FloatComplexNDArray max (int dim = -1) const; | |||
FloatComplexNDArray max (Array<octave_idx_type>& index, int dim = -1) con st; | FloatComplexNDArray max (Array<octave_idx_type>& index, int dim = -1) con st; | |||
FloatComplexNDArray min (int dim = -1) const; | FloatComplexNDArray min (int dim = -1) const; | |||
FloatComplexNDArray min (Array<octave_idx_type>& index, int dim = -1) con st; | FloatComplexNDArray min (Array<octave_idx_type>& index, int dim = -1) con st; | |||
FloatComplexNDArray cummax (int dim = -1) const; | FloatComplexNDArray cummax (int dim = -1) const; | |||
FloatComplexNDArray cummax (Array<octave_idx_type>& index, int dim = -1) | FloatComplexNDArray cummax (Array<octave_idx_type>& index, | |||
const; | int dim = -1) const; | |||
FloatComplexNDArray cummin (int dim = -1) const; | FloatComplexNDArray cummin (int dim = -1) const; | |||
FloatComplexNDArray cummin (Array<octave_idx_type>& index, int dim = -1) | FloatComplexNDArray cummin (Array<octave_idx_type>& index, | |||
const; | int dim = -1) const; | |||
FloatComplexNDArray diff (octave_idx_type order = 1, int dim = -1) const; | FloatComplexNDArray diff (octave_idx_type order = 1, int dim = -1) const; | |||
FloatComplexNDArray& insert (const NDArray& a, octave_idx_type r, octave_ | FloatComplexNDArray& insert (const NDArray& a, | |||
idx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatComplexNDArray& insert (const FloatComplexNDArray& a, octave_idx_typ | FloatComplexNDArray& insert (const FloatComplexNDArray& a, | |||
e r, octave_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatComplexNDArray& insert (const FloatComplexNDArray& a, const Array<oc | FloatComplexNDArray& insert (const FloatComplexNDArray& a, | |||
tave_idx_type>& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
FloatNDArray abs (void) const; | FloatNDArray abs (void) const; | |||
boolNDArray isnan (void) const; | boolNDArray isnan (void) const; | |||
boolNDArray isinf (void) const; | boolNDArray isinf (void) const; | |||
boolNDArray isfinite (void) const; | boolNDArray isfinite (void) const; | |||
friend OCTAVE_API FloatComplexNDArray conj (const FloatComplexNDArray& a) ; | friend OCTAVE_API FloatComplexNDArray conj (const FloatComplexNDArray& a) ; | |||
FloatComplexNDArray fourier (int dim = 1) const; | FloatComplexNDArray fourier (int dim = 1) const; | |||
FloatComplexNDArray ifourier (int dim = 1) const; | FloatComplexNDArray ifourier (int dim = 1) const; | |||
FloatComplexNDArray fourier2d (void) const; | FloatComplexNDArray fourier2d (void) const; | |||
FloatComplexNDArray ifourier2d (void) const; | FloatComplexNDArray ifourier2d (void) const; | |||
FloatComplexNDArray fourierNd (void) const; | FloatComplexNDArray fourierNd (void) const; | |||
FloatComplexNDArray ifourierNd (void) const; | FloatComplexNDArray ifourierNd (void) const; | |||
FloatComplexMatrix matrix_value (void) const; | FloatComplexMatrix matrix_value (void) const; | |||
FloatComplexNDArray squeeze (void) const { return MArray<FloatComplex>::s | FloatComplexNDArray squeeze (void) const | |||
queeze (); } | { return MArray<FloatComplex>::squeeze (); } | |||
static void increment_index (Array<octave_idx_type>& ra_idx, | static void increment_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions, | const dim_vector& dimensions, | |||
int start_dimension = 0); | int start_dimension = 0); | |||
static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions); | const dim_vector& dimensions); | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Floa | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
tComplexNDArray& a); | const FloatComplexNDArray& a | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatCompl | ); | |||
exNDArray& a); | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
FloatComplexNDArray& a); | ||||
static FloatComplex resize_fill_value (void) { return FloatComplex (0.0, | ||||
0.0); } | ||||
// bool all_elements_are_real (void) const; | // bool all_elements_are_real (void) const; | |||
// bool all_integers (float& max_val, float& min_val) const; | // bool all_integers (float& max_val, float& min_val) const; | |||
FloatComplexNDArray diag (octave_idx_type k = 0) const; | FloatComplexNDArray diag (octave_idx_type k = 0) const; | |||
FloatComplexNDArray diag (octave_idx_type m, octave_idx_type n) const; | ||||
FloatComplexNDArray& changesign (void) | FloatComplexNDArray& changesign (void) | |||
{ | { | |||
MArray<FloatComplex>::changesign (); | MArray<FloatComplex>::changesign (); | |||
return *this; | return *this; | |||
} | } | |||
}; | }; | |||
extern OCTAVE_API FloatComplexNDArray conj (const FloatComplexNDArray& a); | extern OCTAVE_API FloatComplexNDArray conj (const FloatComplexNDArray& a); | |||
MINMAX_DECLS (FloatComplexNDArray, FloatComplex, OCTAVE_API) | MINMAX_DECLS (FloatComplexNDArray, FloatComplex, OCTAVE_API) | |||
NDS_CMP_OP_DECLS (FloatComplexNDArray, FloatComplex, OCTAVE_API) | NDS_CMP_OP_DECLS (FloatComplexNDArray, FloatComplex, OCTAVE_API) | |||
NDS_BOOL_OP_DECLS (FloatComplexNDArray, FloatComplex, OCTAVE_API) | NDS_BOOL_OP_DECLS (FloatComplexNDArray, FloatComplex, OCTAVE_API) | |||
SND_CMP_OP_DECLS (FloatComplex, FloatComplexNDArray, OCTAVE_API) | SND_CMP_OP_DECLS (FloatComplex, FloatComplexNDArray, OCTAVE_API) | |||
SND_BOOL_OP_DECLS (FloatComplex, FloatComplexNDArray, OCTAVE_API) | SND_BOOL_OP_DECLS (FloatComplex, FloatComplexNDArray, OCTAVE_API) | |||
NDND_CMP_OP_DECLS (FloatComplexNDArray, FloatComplexNDArray, OCTAVE_API) | NDND_CMP_OP_DECLS (FloatComplexNDArray, FloatComplexNDArray, OCTAVE_API) | |||
NDND_BOOL_OP_DECLS (FloatComplexNDArray, FloatComplexNDArray, OCTAVE_API) | NDND_BOOL_OP_DECLS (FloatComplexNDArray, FloatComplexNDArray, OCTAVE_API) | |||
MARRAY_FORWARD_DEFS (MArray, FloatComplexNDArray, FloatComplex) | MARRAY_FORWARD_DEFS (MArray, FloatComplexNDArray, FloatComplex) | |||
extern OCTAVE_API FloatComplexNDArray& operator *= (FloatComplexNDArray& a, | extern OCTAVE_API FloatComplexNDArray& operator *= (FloatComplexNDArray& a, | |||
float s); | float s); | |||
extern OCTAVE_API FloatComplexNDArray& operator /= (FloatComplexNDArray& a, | extern OCTAVE_API FloatComplexNDArray& operator /= (FloatComplexNDArray& a, | |||
float s); | float s); | |||
BSXFUN_STDOP_DECLS (FloatComplexNDArray, OCTAVE_API) | BSXFUN_STDOP_DECLS (FloatComplexNDArray, OCTAVE_API) | |||
BSXFUN_STDREL_DECLS (FloatComplexNDArray, OCTAVE_API) | BSXFUN_STDREL_DECLS (FloatComplexNDArray, OCTAVE_API) | |||
BSXFUN_OP_DECL (pow, FloatComplexNDArray, OCTAVE_API) | BSXFUN_OP_DECL (pow, FloatComplexNDArray, OCTAVE_API) | |||
#endif | #endif | |||
End of changes. 17 change blocks. | ||||
45 lines changed or deleted | 45 lines changed or added | |||
fCRowVector.h | fCRowVector.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexRowVector_h) | #if !defined (octave_fCRowVector_h) | |||
#define octave_FloatComplexRowVector_h 1 | #define octave_fCRowVector_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "fRowVector.h" | #include "fRowVector.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatComplexRowVector : public MArray<FloatComplex> | FloatComplexRowVector : public MArray<FloatComplex> | |||
{ | { | |||
friend class FloatComplexColumnVector; | friend class FloatComplexColumnVector; | |||
public: | public: | |||
FloatComplexRowVector (void) | FloatComplexRowVector (void) | |||
: MArray<FloatComplex> (dim_vector (1, 0)) { } | : MArray<FloatComplex> (dim_vector (1, 0)) { } | |||
explicit FloatComplexRowVector (octave_idx_type n) | explicit FloatComplexRowVector (octave_idx_type n) | |||
: MArray<FloatComplex> (dim_vector (1, n)) { } | : MArray<FloatComplex> (dim_vector (1, n)) { } | |||
explicit FloatComplexRowVector (const dim_vector& dv) | explicit FloatComplexRowVector (const dim_vector& dv) | |||
skipping to change at line 64 | skipping to change at line 64 | |||
FloatComplexRowVector (const MArray<FloatComplex>& a) | FloatComplexRowVector (const MArray<FloatComplex>& a) | |||
: MArray<FloatComplex> (a.as_row ()) { } | : MArray<FloatComplex> (a.as_row ()) { } | |||
FloatComplexRowVector (const Array<FloatComplex>& a) | FloatComplexRowVector (const Array<FloatComplex>& a) | |||
: MArray<FloatComplex> (a.as_row ()) { } | : MArray<FloatComplex> (a.as_row ()) { } | |||
explicit FloatComplexRowVector (const FloatRowVector& a) | explicit FloatComplexRowVector (const FloatRowVector& a) | |||
: MArray<FloatComplex> (a) { } | : MArray<FloatComplex> (a) { } | |||
FloatComplexRowVector& operator = (const FloatComplexRowVector& a) | FloatComplexRowVector& operator = (const FloatComplexRowVector& a) | |||
{ | { | |||
MArray<FloatComplex>::operator = (a); | MArray<FloatComplex>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const FloatComplexRowVector& a) const; | bool operator == (const FloatComplexRowVector& a) const; | |||
bool operator != (const FloatComplexRowVector& a) const; | bool operator != (const FloatComplexRowVector& a) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
FloatComplexRowVector& insert (const FloatRowVector& a, octave_idx_type c ); | FloatComplexRowVector& insert (const FloatRowVector& a, octave_idx_type c ); | |||
FloatComplexRowVector& insert (const FloatComplexRowVector& a, octave_idx | FloatComplexRowVector& insert (const FloatComplexRowVector& a, | |||
_type c); | octave_idx_type c); | |||
FloatComplexRowVector& fill (float val); | FloatComplexRowVector& fill (float val); | |||
FloatComplexRowVector& fill (const FloatComplex& val); | FloatComplexRowVector& fill (const FloatComplex& val); | |||
FloatComplexRowVector& fill (float val, octave_idx_type c1, octave_idx_ty | FloatComplexRowVector& fill (float val, | |||
pe c2); | octave_idx_type c1, octave_idx_type c2); | |||
FloatComplexRowVector& fill (const FloatComplex& val, octave_idx_type c1, | FloatComplexRowVector& fill (const FloatComplex& val, | |||
octave_idx_type c2); | octave_idx_type c1, octave_idx_type c2); | |||
FloatComplexRowVector append (const FloatRowVector& a) const; | FloatComplexRowVector append (const FloatRowVector& a) const; | |||
FloatComplexRowVector append (const FloatComplexRowVector& a) const; | FloatComplexRowVector append (const FloatComplexRowVector& a) const; | |||
FloatComplexColumnVector hermitian (void) const; | FloatComplexColumnVector hermitian (void) const; | |||
FloatComplexColumnVector transpose (void) const; | FloatComplexColumnVector transpose (void) const; | |||
friend FloatComplexRowVector conj (const FloatComplexRowVector& a); | friend FloatComplexRowVector conj (const FloatComplexRowVector& a); | |||
// resize is the destructive equivalent for this one | // resize is the destructive equivalent for this one | |||
skipping to change at line 104 | skipping to change at line 107 | |||
FloatComplexRowVector extract_n (octave_idx_type c1, octave_idx_type n) c onst; | FloatComplexRowVector extract_n (octave_idx_type c1, octave_idx_type n) c onst; | |||
// row vector by row vector -> row vector operations | // row vector by row vector -> row vector operations | |||
FloatComplexRowVector& operator += (const FloatRowVector& a); | FloatComplexRowVector& operator += (const FloatRowVector& a); | |||
FloatComplexRowVector& operator -= (const FloatRowVector& a); | FloatComplexRowVector& operator -= (const FloatRowVector& a); | |||
// row vector by matrix -> row vector | // row vector by matrix -> row vector | |||
friend FloatComplexRowVector operator * (const FloatComplexRowVector& a, | friend FloatComplexRowVector operator * (const FloatComplexRowVector& a, | |||
const FloatComplexMatrix& b); | const FloatComplexMatrix& b); | |||
friend FloatComplexRowVector operator * (const FloatRowVector& a, | friend FloatComplexRowVector operator * (const FloatRowVector& a, | |||
const FloatComplexMatrix& b); | const FloatComplexMatrix& b); | |||
// other operations | // other operations | |||
FloatComplex min (void) const; | FloatComplex min (void) const; | |||
FloatComplex max (void) const; | FloatComplex max (void) const; | |||
// i/o | // i/o | |||
friend std::ostream& operator << (std::ostream& os, const FloatComplexRow | friend std::ostream& operator << (std::ostream& os, | |||
Vector& a); | const FloatComplexRowVector& a); | |||
friend std::istream& operator >> (std::istream& is, FloatComplexRowVector | friend std::istream& operator >> (std::istream& is, | |||
& a); | FloatComplexRowVector& a); | |||
void resize (octave_idx_type n, | void resize (octave_idx_type n, const FloatComplex& rfv = FloatComplex (0 | |||
const FloatComplex& rfv = Array<FloatComplex>::resize_fill_v | )) | |||
alue ()) | ||||
{ | { | |||
Array<FloatComplex>::resize (dim_vector (1, n), rfv); | Array<FloatComplex>::resize (dim_vector (1, n), rfv); | |||
} | } | |||
void clear (octave_idx_type n) | void clear (octave_idx_type n) | |||
{ Array<FloatComplex>::clear (1, n); } | { Array<FloatComplex>::clear (1, n); } | |||
}; | }; | |||
// row vector by column vector -> scalar | // row vector by column vector -> scalar | |||
FloatComplex OCTAVE_API operator * (const FloatComplexRowVector& a, const C | FloatComplex OCTAVE_API operator * (const FloatComplexRowVector& a, | |||
olumnVector& b); | const ColumnVector& b); | |||
FloatComplex OCTAVE_API operator * (const FloatComplexRowVector& a, const F | FloatComplex OCTAVE_API operator * (const FloatComplexRowVector& a, | |||
loatComplexColumnVector& b); | const FloatComplexColumnVector& b); | |||
// other operations | // other operations | |||
OCTAVE_API FloatComplexRowVector linspace (const FloatComplex& x1, const Fl | OCTAVE_API FloatComplexRowVector linspace (const FloatComplex& x1, | |||
oatComplex& x2, octave_idx_type n); | const FloatComplex& x2, octave_idx_type n); | |||
MARRAY_FORWARD_DEFS (MArray, FloatComplexRowVector, FloatComplex) | MARRAY_FORWARD_DEFS (MArray, FloatComplexRowVector, FloatComplex) | |||
#endif | #endif | |||
End of changes. 14 change blocks. | ||||
30 lines changed or deleted | 29 lines changed or added | |||
fCmplxAEPBAL.h | fCmplxAEPBAL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexAEPBALANCE_h) | #if !defined (octave_fCmplxAEPBAL_h) | |||
#define octave_FloatComplexAEPBALANCE_h 1 | #define octave_fCmplxAEPBAL_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "base-aepbal.h" | #include "base-aepbal.h" | |||
#include "fCMatrix.h" | #include "fCMatrix.h" | |||
#include "fColVector.h" | #include "fColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatComplexAEPBALANCE : public base_aepbal<FloatComplexMatrix, FloatColumn | FloatComplexAEPBALANCE | |||
Vector> | : public base_aepbal<FloatComplexMatrix, FloatColumnVector> | |||
{ | { | |||
public: | public: | |||
FloatComplexAEPBALANCE (void) : base_aepbal<FloatComplexMatrix, FloatColu | FloatComplexAEPBALANCE (void) | |||
mnVector> () { } | : base_aepbal<FloatComplexMatrix, FloatColumnVector> () { } | |||
FloatComplexAEPBALANCE (const FloatComplexMatrix& a, bool noperm = false, | FloatComplexAEPBALANCE (const FloatComplexMatrix& a, bool noperm = false, | |||
bool noscal = false); | bool noscal = false); | |||
FloatComplexAEPBALANCE (const FloatComplexAEPBALANCE& a) | FloatComplexAEPBALANCE (const FloatComplexAEPBALANCE& a) | |||
: base_aepbal<FloatComplexMatrix, FloatColumnVector> (a) { } | : base_aepbal<FloatComplexMatrix, FloatColumnVector> (a) { } | |||
FloatComplexMatrix balancing_matrix (void) const; | FloatComplexMatrix balancing_matrix (void) const; | |||
}; | }; | |||
End of changes. 4 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
fCmplxCHOL.h | fCmplxCHOL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexCHOL_h) | #if !defined (octave_fCmplxCHOL_h) | |||
#define octave_FloatComplexCHOL_h 1 | #define octave_fCmplxCHOL_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "fCMatrix.h" | #include "fCMatrix.h" | |||
#include "fCColVector.h" | #include "fCColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatComplexCHOL | FloatComplexCHOL | |||
{ | { | |||
public: | public: | |||
FloatComplexCHOL (void) : chol_mat (), xrcond (0) { } | FloatComplexCHOL (void) : chol_mat (), xrcond (0) { } | |||
FloatComplexCHOL (const FloatComplexMatrix& a, bool calc_cond = false) | FloatComplexCHOL (const FloatComplexMatrix& a, bool calc_cond = false) | |||
: chol_mat (), xrcond (0) | : chol_mat (), xrcond (0) | |||
{ | { | |||
init (a, calc_cond); | init (a, calc_cond); | |||
} | } | |||
FloatComplexCHOL (const FloatComplexMatrix& a, octave_idx_type& info, | FloatComplexCHOL (const FloatComplexMatrix& a, octave_idx_type& info, | |||
bool calc_cond = false) | bool calc_cond = false) | |||
: chol_mat (), xrcond (0) | : chol_mat (), xrcond (0) | |||
{ | { | |||
info = init (a, calc_cond); | info = init (a, calc_cond); | |||
} | } | |||
FloatComplexCHOL (const FloatComplexCHOL& a) | FloatComplexCHOL (const FloatComplexCHOL& a) | |||
: chol_mat (a.chol_mat), xrcond (a.xrcond) { } | : chol_mat (a.chol_mat), xrcond (a.xrcond) { } | |||
FloatComplexCHOL& operator = (const FloatComplexCHOL& a) | FloatComplexCHOL& operator = (const FloatComplexCHOL& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
chol_mat = a.chol_mat; | chol_mat = a.chol_mat; | |||
xrcond = a.xrcond; | xrcond = a.xrcond; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
FloatComplexMatrix chol_matrix (void) const { return chol_mat; } | FloatComplexMatrix chol_matrix (void) const { return chol_mat; } | |||
float rcond (void) const { return xrcond; } | float rcond (void) const { return xrcond; } | |||
FloatComplexMatrix inverse (void) const; | FloatComplexMatrix inverse (void) const; | |||
void set (const FloatComplexMatrix& R); | void set (const FloatComplexMatrix& R); | |||
void update (const FloatComplexColumnVector& u); | void update (const FloatComplexColumnVector& u); | |||
End of changes. 6 change blocks. | ||||
17 lines changed or deleted | 17 lines changed or added | |||
fCmplxGEPBAL.h | fCmplxGEPBAL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexGEPBALANCE_h) | #if !defined (octave_fCmplxGEPBAL_h) | |||
#define octave_FloatComplexGEPBALANCE_h 1 | #define octave_fCmplxGEPBAL_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "fMatrix.h" | #include "fMatrix.h" | |||
#include "fCMatrix.h" | #include "fCMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatComplexGEPBALANCE | FloatComplexGEPBALANCE | |||
{ | { | |||
public: | public: | |||
FloatComplexGEPBALANCE (void) | FloatComplexGEPBALANCE (void) | |||
: balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | |||
{ } | { } | |||
FloatComplexGEPBALANCE (const FloatComplexMatrix& a, | FloatComplexGEPBALANCE (const FloatComplexMatrix& a, | |||
const FloatComplexMatrix& b, | const FloatComplexMatrix& b, | |||
const std::string& balance_job) | const std::string& balance_job) | |||
: balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | |||
{ | { | |||
init (a, b, balance_job); | init (a, b, balance_job); | |||
} | } | |||
FloatComplexGEPBALANCE (const FloatComplexGEPBALANCE& a) | FloatComplexGEPBALANCE (const FloatComplexGEPBALANCE& a) | |||
: balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2), | : balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2), | |||
balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2) | balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2) | |||
{ } | { } | |||
FloatComplexGEPBALANCE& operator = (const FloatComplexGEPBALANCE& a) | FloatComplexGEPBALANCE& operator = (const FloatComplexGEPBALANCE& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
balanced_mat = a.balanced_mat; | balanced_mat = a.balanced_mat; | |||
balanced_mat2 = a.balanced_mat2; | balanced_mat2 = a.balanced_mat2; | |||
balancing_mat = a.balancing_mat; | balancing_mat = a.balancing_mat; | |||
balancing_mat2 = a.balancing_mat2; | balancing_mat2 = a.balancing_mat2; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~FloatComplexGEPBALANCE (void) { } | ~FloatComplexGEPBALANCE (void) { } | |||
FloatComplexMatrix balanced_matrix (void) const { return balanced_mat; } | FloatComplexMatrix balanced_matrix (void) const { return balanced_mat; } | |||
FloatComplexMatrix balanced_matrix2 (void) const { return balanced_mat2; } | FloatComplexMatrix balanced_matrix2 (void) const { return balanced_mat2; } | |||
FloatMatrix balancing_matrix (void) const { return balancing_mat; } | FloatMatrix balancing_matrix (void) const { return balancing_mat; } | |||
FloatMatrix balancing_matrix2 (void) const { return balancing_mat2; } | FloatMatrix balancing_matrix2 (void) const { return balancing_mat2; } | |||
friend std::ostream& operator << (std::ostream& os, const FloatComplexGEP | friend std::ostream& operator << (std::ostream& os, | |||
BALANCE& a); | const FloatComplexGEPBALANCE& a); | |||
private: | private: | |||
FloatComplexMatrix balanced_mat; | FloatComplexMatrix balanced_mat; | |||
FloatComplexMatrix balanced_mat2; | FloatComplexMatrix balanced_mat2; | |||
FloatMatrix balancing_mat; | FloatMatrix balancing_mat; | |||
FloatMatrix balancing_mat2; | FloatMatrix balancing_mat2; | |||
octave_idx_type init (const FloatComplexMatrix& a, const FloatComplexMatr | octave_idx_type init (const FloatComplexMatrix& a, | |||
ix& b, | const FloatComplexMatrix& b, | |||
const std::string& balance_job); | const std::string& balance_job); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
22 lines changed or deleted | 22 lines changed or added | |||
fCmplxHESS.h | fCmplxHESS.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexHESS_h) | #if !defined (octave_fCmplxHESS_h) | |||
#define octave_FloatComplexHESS_h 1 | #define octave_fCmplxHESS_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "fCMatrix.h" | #include "fCMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatComplexHESS | FloatComplexHESS | |||
{ | { | |||
public: | public: | |||
FloatComplexHESS (void) : hess_mat (), unitary_hess_mat () { } | FloatComplexHESS (void) : hess_mat (), unitary_hess_mat () { } | |||
FloatComplexHESS (const FloatComplexMatrix& a) | FloatComplexHESS (const FloatComplexMatrix& a) | |||
: hess_mat (), unitary_hess_mat () | : hess_mat (), unitary_hess_mat () | |||
{ | { | |||
init (a); | init (a); | |||
} | } | |||
FloatComplexHESS (const FloatComplexMatrix& a, octave_idx_type& info) | FloatComplexHESS (const FloatComplexMatrix& a, octave_idx_type& info) | |||
: hess_mat (), unitary_hess_mat () | : hess_mat (), unitary_hess_mat () | |||
{ | { | |||
info = init (a); | info = init (a); | |||
} | } | |||
FloatComplexHESS (const FloatComplexHESS& a) | FloatComplexHESS (const FloatComplexHESS& a) | |||
: hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } | : hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } | |||
FloatComplexHESS& operator = (const FloatComplexHESS& a) | FloatComplexHESS& operator = (const FloatComplexHESS& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
hess_mat = a.hess_mat; | hess_mat = a.hess_mat; | |||
unitary_hess_mat = a.unitary_hess_mat; | unitary_hess_mat = a.unitary_hess_mat; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~FloatComplexHESS (void) { } | ~FloatComplexHESS (void) { } | |||
FloatComplexMatrix hess_matrix (void) const { return hess_mat; } | FloatComplexMatrix hess_matrix (void) const { return hess_mat; } | |||
FloatComplexMatrix unitary_hess_matrix (void) const | FloatComplexMatrix unitary_hess_matrix (void) const | |||
{ | { | |||
return unitary_hess_mat; | return unitary_hess_mat; | |||
} | } | |||
friend std::ostream& operator << (std::ostream& os, const FloatComplexHES | friend std::ostream& operator << (std::ostream& os, | |||
S& a); | const FloatComplexHESS& a); | |||
private: | private: | |||
FloatComplexMatrix hess_mat; | FloatComplexMatrix hess_mat; | |||
FloatComplexMatrix unitary_hess_mat; | FloatComplexMatrix unitary_hess_mat; | |||
octave_idx_type init (const FloatComplexMatrix& a); | octave_idx_type init (const FloatComplexMatrix& a); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
22 lines changed or deleted | 22 lines changed or added | |||
fCmplxLU.h | fCmplxLU.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexLU_h) | #if !defined (octave_fCmplxLU_h) | |||
#define octave_FloatComplexLU_h 1 | #define octave_fCmplxLU_h 1 | |||
#include "base-lu.h" | #include "base-lu.h" | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
#include "fCMatrix.h" | #include "fCMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatComplexLU : public base_lu <FloatComplexMatrix> | FloatComplexLU : public base_lu <FloatComplexMatrix> | |||
{ | { | |||
public: | public: | |||
skipping to change at line 49 | skipping to change at line 49 | |||
FloatComplexLU (const FloatComplexMatrix& a); | FloatComplexLU (const FloatComplexMatrix& a); | |||
FloatComplexLU (const FloatComplexLU& a) | FloatComplexLU (const FloatComplexLU& a) | |||
: base_lu <FloatComplexMatrix> (a) { } | : base_lu <FloatComplexMatrix> (a) { } | |||
FloatComplexLU (const FloatComplexMatrix& l, const FloatComplexMatrix& u, | FloatComplexLU (const FloatComplexMatrix& l, const FloatComplexMatrix& u, | |||
const PermMatrix& p) | const PermMatrix& p) | |||
: base_lu <FloatComplexMatrix> (l, u, p) { } | : base_lu <FloatComplexMatrix> (l, u, p) { } | |||
FloatComplexLU& operator = (const FloatComplexLU& a) | FloatComplexLU& operator = (const FloatComplexLU& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
base_lu <FloatComplexMatrix> :: operator = (a); | base_lu <FloatComplexMatrix> :: operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
~FloatComplexLU (void) { } | ~FloatComplexLU (void) { } | |||
void update (const FloatComplexColumnVector& u, const FloatComplexColumnV | void update (const FloatComplexColumnVector& u, | |||
ector& v); | const FloatComplexColumnVector& v); | |||
void update (const FloatComplexMatrix& u, const FloatComplexMatrix& v); | void update (const FloatComplexMatrix& u, const FloatComplexMatrix& v); | |||
void update_piv (const FloatComplexColumnVector& u, const FloatComplexCol | void update_piv (const FloatComplexColumnVector& u, | |||
umnVector& v); | const FloatComplexColumnVector& v); | |||
void update_piv (const FloatComplexMatrix& u, const FloatComplexMatrix& v ); | void update_piv (const FloatComplexMatrix& u, const FloatComplexMatrix& v ); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
12 lines changed or deleted | 12 lines changed or added | |||
fCmplxQR.h | fCmplxQR.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 26 | skipping to change at line 26 | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
// updating/downdating by Jaroslav Hajek 2008 | // updating/downdating by Jaroslav Hajek 2008 | |||
#if !defined (octave_FloatComplexQR_h) | #if !defined (octave_fCmplxQR_h) | |||
#define octave_FloatComplexQR_h 1 | #define octave_fCmplxQR_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "fCMatrix.h" | #include "fCMatrix.h" | |||
#include "fCColVector.h" | #include "fCColVector.h" | |||
#include "fCRowVector.h" | #include "fCRowVector.h" | |||
#include "base-qr.h" | #include "base-qr.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
skipping to change at line 53 | skipping to change at line 53 | |||
FloatComplexQR (const FloatComplexMatrix&, qr_type_t = qr_type_std); | FloatComplexQR (const FloatComplexMatrix&, qr_type_t = qr_type_std); | |||
FloatComplexQR (const FloatComplexMatrix& qx, const FloatComplexMatrix& r x) | FloatComplexQR (const FloatComplexMatrix& qx, const FloatComplexMatrix& r x) | |||
: base_qr<FloatComplexMatrix> (qx, rx) { } | : base_qr<FloatComplexMatrix> (qx, rx) { } | |||
FloatComplexQR (const FloatComplexQR& a) : base_qr<FloatComplexMatrix> (a ) { } | FloatComplexQR (const FloatComplexQR& a) : base_qr<FloatComplexMatrix> (a ) { } | |||
void init (const FloatComplexMatrix&, qr_type_t = qr_type_std); | void init (const FloatComplexMatrix&, qr_type_t = qr_type_std); | |||
void update (const FloatComplexColumnVector& u, const FloatComplexColumnV | void update (const FloatComplexColumnVector& u, | |||
ector& v); | const FloatComplexColumnVector& v); | |||
void update (const FloatComplexMatrix& u, const FloatComplexMatrix& v); | void update (const FloatComplexMatrix& u, const FloatComplexMatrix& v); | |||
void insert_col (const FloatComplexColumnVector& u, octave_idx_type j); | void insert_col (const FloatComplexColumnVector& u, octave_idx_type j); | |||
void insert_col (const FloatComplexMatrix& u, const Array<octave_idx_type | void insert_col (const FloatComplexMatrix& u, | |||
>& j); | const Array<octave_idx_type>& j); | |||
void delete_col (octave_idx_type j); | void delete_col (octave_idx_type j); | |||
void delete_col (const Array<octave_idx_type>& j); | void delete_col (const Array<octave_idx_type>& j); | |||
void insert_row (const FloatComplexRowVector& u, octave_idx_type j); | void insert_row (const FloatComplexRowVector& u, octave_idx_type j); | |||
void delete_row (octave_idx_type j); | void delete_row (octave_idx_type j); | |||
void shift_cols (octave_idx_type i, octave_idx_type j); | void shift_cols (octave_idx_type i, octave_idx_type j); | |||
End of changes. 4 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
fCmplxQRP.h | fCmplxQRP.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexQRP_h) | #if !defined (octave_fCmplxQRP_h) | |||
#define octave_FloatComplexQRP_h 1 | #define octave_fCmplxQRP_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "fCmplxQR.h" | #include "fCmplxQR.h" | |||
#include "PermMatrix.h" | #include "PermMatrix.h" | |||
#include "fColVector.h" | #include "fColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatComplexQRP : public FloatComplexQR | FloatComplexQRP : public FloatComplexQR | |||
{ | { | |||
public: | public: | |||
FloatComplexQRP (void) : FloatComplexQR (), p () { } | FloatComplexQRP (void) : FloatComplexQR (), p () { } | |||
FloatComplexQRP (const FloatComplexMatrix&, qr_type_t = qr_type_std); | FloatComplexQRP (const FloatComplexMatrix&, qr_type_t = qr_type_std); | |||
FloatComplexQRP (const FloatComplexQRP& a) : FloatComplexQR (a), p (a.p) { } | FloatComplexQRP (const FloatComplexQRP& a) : FloatComplexQR (a), p (a.p) { } | |||
FloatComplexQRP& operator = (const FloatComplexQRP& a) | FloatComplexQRP& operator = (const FloatComplexQRP& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
FloatComplexQR::operator = (a); | FloatComplexQR::operator = (a); | |||
p = a.p; | p = a.p; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~FloatComplexQRP (void) { } | ~FloatComplexQRP (void) { } | |||
void init (const FloatComplexMatrix&, qr_type_t = qr_type_std); | void init (const FloatComplexMatrix&, qr_type_t = qr_type_std); | |||
PermMatrix P (void) const { return p; } | PermMatrix P (void) const { return p; } | |||
FloatRowVector Pvec (void) const; | FloatRowVector Pvec (void) const; | |||
friend std::ostream& operator << (std::ostream&, const FloatComplexQRP&) ; | friend std::ostream& operator << (std::ostream&, const FloatComplexQRP&) ; | |||
End of changes. 3 change blocks. | ||||
11 lines changed or deleted | 11 lines changed or added | |||
fCmplxSCHUR.h | fCmplxSCHUR.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexSCHUR_h) | #if !defined (octave_fCmplxSCHUR_h) | |||
#define octave_FloatComplexSCHUR_h 1 | #define octave_fCmplxSCHUR_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "fCMatrix.h" | #include "fCMatrix.h" | |||
#include "floatSCHUR.h" | #include "floatSCHUR.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatComplexSCHUR | FloatComplexSCHUR | |||
{ | { | |||
public: | public: | |||
FloatComplexSCHUR (void) : schur_mat (), unitary_mat (), selector (0) { } | FloatComplexSCHUR (void) : schur_mat (), unitary_mat (), selector (0) { } | |||
FloatComplexSCHUR (const FloatComplexMatrix& a, const std::string& ord, | FloatComplexSCHUR (const FloatComplexMatrix& a, const std::string& ord, | |||
bool calc_unitary = true) | bool calc_unitary = true) | |||
: schur_mat (), unitary_mat (), selector (0) | : schur_mat (), unitary_mat (), selector (0) | |||
{ | { | |||
init (a, ord, calc_unitary); | init (a, ord, calc_unitary); | |||
} | } | |||
FloatComplexSCHUR (const FloatComplexMatrix& a, const std::string& ord, | FloatComplexSCHUR (const FloatComplexMatrix& a, const std::string& ord, | |||
octave_idx_type& info, bool calc_unitary = true) | octave_idx_type& info, bool calc_unitary = true) | |||
: schur_mat (), unitary_mat (), selector (0) | : schur_mat (), unitary_mat (), selector (0) | |||
{ | { | |||
info = init (a, ord, calc_unitary); | info = init (a, ord, calc_unitary); | |||
} | } | |||
FloatComplexSCHUR (const FloatComplexSCHUR& a) | FloatComplexSCHUR (const FloatComplexSCHUR& a) | |||
: schur_mat (a.schur_mat), unitary_mat (a.unitary_mat), selector (0) | : schur_mat (a.schur_mat), unitary_mat (a.unitary_mat), selector (0) | |||
{ } | { } | |||
FloatComplexSCHUR (const FloatComplexMatrix& s, const FloatComplexMatrix& u); | FloatComplexSCHUR (const FloatComplexMatrix& s, const FloatComplexMatrix& u); | |||
FloatComplexSCHUR (const FloatSCHUR& s); | FloatComplexSCHUR (const FloatSCHUR& s); | |||
FloatComplexSCHUR& operator = (const FloatComplexSCHUR& a) | FloatComplexSCHUR& operator = (const FloatComplexSCHUR& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
schur_mat = a.schur_mat; | schur_mat = a.schur_mat; | |||
unitary_mat = a.unitary_mat; | unitary_mat = a.unitary_mat; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~FloatComplexSCHUR (void) { } | ~FloatComplexSCHUR (void) { } | |||
FloatComplexMatrix schur_matrix (void) const { return schur_mat; } | FloatComplexMatrix schur_matrix (void) const { return schur_mat; } | |||
FloatComplexMatrix unitary_matrix (void) const { return unitary_mat; } | FloatComplexMatrix unitary_matrix (void) const { return unitary_mat; } | |||
friend std::ostream& operator << (std::ostream& os, const FloatComplexSCH | friend std::ostream& operator << (std::ostream& os, | |||
UR& a); | const FloatComplexSCHUR& a); | |||
typedef octave_idx_type (*select_function) (const FloatComplex&); | typedef octave_idx_type (*select_function) (const FloatComplex&); | |||
private: | private: | |||
FloatComplexMatrix schur_mat; | FloatComplexMatrix schur_mat; | |||
FloatComplexMatrix unitary_mat; | FloatComplexMatrix unitary_mat; | |||
select_function selector; | select_function selector; | |||
octave_idx_type init (const FloatComplexMatrix& a, const std::string& ord | octave_idx_type init (const FloatComplexMatrix& a, const std::string& ord | |||
, bool calc_unitary); | , | |||
bool calc_unitary); | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 9 change blocks. | ||||
23 lines changed or deleted | 24 lines changed or added | |||
fCmplxSVD.h | fCmplxSVD.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatComplexSVD_h) | #if !defined (octave_fCmplxSVD_h) | |||
#define octave_FloatComplexSVD_h 1 | #define octave_fCmplxSVD_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "fDiagMatrix.h" | #include "fDiagMatrix.h" | |||
#include "fCMatrix.h" | #include "fCMatrix.h" | |||
#include "dbleSVD.h" | #include "dbleSVD.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatComplexSVD | FloatComplexSVD | |||
{ | { | |||
public: | public: | |||
FloatComplexSVD (void) | FloatComplexSVD (void) | |||
: type_computed (), sigma (), left_sm (), right_sm () | : type_computed (), sigma (), left_sm (), right_sm () | |||
{ } | { } | |||
FloatComplexSVD (const FloatComplexMatrix& a, | FloatComplexSVD (const FloatComplexMatrix& a, | |||
SVD::type svd_type = SVD::std, | SVD::type svd_type = SVD::std, | |||
SVD::driver svd_driver = SVD::GESVD) | SVD::driver svd_driver = SVD::GESVD) | |||
: type_computed (), sigma (), left_sm (), right_sm () | : type_computed (), sigma (), left_sm (), right_sm () | |||
{ | { | |||
init (a, svd_type, svd_driver); | init (a, svd_type, svd_driver); | |||
} | } | |||
FloatComplexSVD (const FloatComplexMatrix& a, octave_idx_type& info, | FloatComplexSVD (const FloatComplexMatrix& a, octave_idx_type& info, | |||
SVD::type svd_type = SVD::std, | SVD::type svd_type = SVD::std, | |||
SVD::driver svd_driver = SVD::GESVD) | SVD::driver svd_driver = SVD::GESVD) | |||
: type_computed (), sigma (), left_sm (), right_sm () | : type_computed (), sigma (), left_sm (), right_sm () | |||
{ | { | |||
info = init (a, svd_type, svd_driver); | info = init (a, svd_type, svd_driver); | |||
} | } | |||
FloatComplexSVD (const FloatComplexSVD& a) | FloatComplexSVD (const FloatComplexSVD& a) | |||
: type_computed (a.type_computed), sigma (a.sigma), | : type_computed (a.type_computed), sigma (a.sigma), | |||
left_sm (a.left_sm), right_sm (a.right_sm) | left_sm (a.left_sm), right_sm (a.right_sm) | |||
{ } | { } | |||
FloatComplexSVD& operator = (const FloatComplexSVD& a) | FloatComplexSVD& operator = (const FloatComplexSVD& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
type_computed = a.type_computed; | type_computed = a.type_computed; | |||
sigma = a.sigma; | sigma = a.sigma; | |||
left_sm = a.left_sm; | left_sm = a.left_sm; | |||
right_sm = a.right_sm; | right_sm = a.right_sm; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~FloatComplexSVD (void) { } | ~FloatComplexSVD (void) { } | |||
FloatDiagMatrix singular_values (void) const { return sigma; } | FloatDiagMatrix singular_values (void) const { return sigma; } | |||
FloatComplexMatrix left_singular_matrix (void) const; | FloatComplexMatrix left_singular_matrix (void) const; | |||
FloatComplexMatrix right_singular_matrix (void) const; | FloatComplexMatrix right_singular_matrix (void) const; | |||
friend std::ostream& operator << (std::ostream& os, const FloatComplexSV | friend std::ostream& operator << (std::ostream& os, | |||
D& a); | const FloatComplexSVD& a); | |||
private: | private: | |||
SVD::type type_computed; | SVD::type type_computed; | |||
FloatDiagMatrix sigma; | FloatDiagMatrix sigma; | |||
FloatComplexMatrix left_sm; | FloatComplexMatrix left_sm; | |||
FloatComplexMatrix right_sm; | FloatComplexMatrix right_sm; | |||
octave_idx_type init (const FloatComplexMatrix& a, | octave_idx_type init (const FloatComplexMatrix& a, | |||
End of changes. 8 change blocks. | ||||
23 lines changed or deleted | 23 lines changed or added | |||
fColVector.h | fColVector.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatColumnVector_h) | #if !defined (octave_fColVector_h) | |||
#define octave_FloatColumnVector_h 1 | #define octave_fColVector_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatColumnVector : public MArray<float> | FloatColumnVector : public MArray<float> | |||
{ | { | |||
public: | public: | |||
skipping to change at line 57 | skipping to change at line 57 | |||
FloatColumnVector (const FloatColumnVector& a) : MArray<float> (a) { } | FloatColumnVector (const FloatColumnVector& a) : MArray<float> (a) { } | |||
FloatColumnVector (const MArray<float>& a) | FloatColumnVector (const MArray<float>& a) | |||
: MArray<float> (a.as_column ()) { } | : MArray<float> (a.as_column ()) { } | |||
FloatColumnVector (const Array<float>& a) | FloatColumnVector (const Array<float>& a) | |||
: MArray<float> (a.as_column ()) { } | : MArray<float> (a.as_column ()) { } | |||
FloatColumnVector& operator = (const FloatColumnVector& a) | FloatColumnVector& operator = (const FloatColumnVector& a) | |||
{ | { | |||
MArray<float>::operator = (a); | MArray<float>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const FloatColumnVector& a) const; | bool operator == (const FloatColumnVector& a) const; | |||
bool operator != (const FloatColumnVector& a) const; | bool operator != (const FloatColumnVector& a) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
FloatColumnVector& insert (const FloatColumnVector& a, octave_idx_type r) ; | FloatColumnVector& insert (const FloatColumnVector& a, octave_idx_type r) ; | |||
FloatColumnVector& fill (float val); | FloatColumnVector& fill (float val); | |||
FloatColumnVector& fill (float val, octave_idx_type r1, octave_idx_type r 2); | FloatColumnVector& fill (float val, octave_idx_type r1, octave_idx_type r 2); | |||
skipping to change at line 87 | skipping to change at line 87 | |||
friend OCTAVE_API FloatColumnVector imag (const FloatComplexColumnVector& a); | friend OCTAVE_API FloatColumnVector imag (const FloatComplexColumnVector& a); | |||
// resize is the destructive equivalent for this one | // resize is the destructive equivalent for this one | |||
FloatColumnVector extract (octave_idx_type r1, octave_idx_type r2) const; | FloatColumnVector extract (octave_idx_type r1, octave_idx_type r2) const; | |||
FloatColumnVector extract_n (octave_idx_type r1, octave_idx_type n) const ; | FloatColumnVector extract_n (octave_idx_type r1, octave_idx_type n) const ; | |||
// matrix by column vector -> column vector operations | // matrix by column vector -> column vector operations | |||
friend OCTAVE_API FloatColumnVector operator * (const FloatMatrix& a, con | friend OCTAVE_API FloatColumnVector operator * (const FloatMatrix& a, | |||
st FloatColumnVector& b); | const FloatColumnVector& | |||
b); | ||||
// diagonal matrix by column vector -> column vector operations | // diagonal matrix by column vector -> column vector operations | |||
friend OCTAVE_API FloatColumnVector operator * (const FloatDiagMatrix& a, | friend OCTAVE_API FloatColumnVector operator * (const FloatDiagMatrix& a, | |||
const FloatColumnVector& b); | const FloatColumnVector& | |||
b); | ||||
// other operations | // other operations | |||
float min (void) const; | float min (void) const; | |||
float max (void) const; | float max (void) const; | |||
FloatColumnVector abs (void) const; | FloatColumnVector abs (void) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Floa | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
tColumnVector& a); | const FloatColumnVector& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatColum | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
nVector& a); | FloatColumnVector& a); | |||
void resize (octave_idx_type n, | void resize (octave_idx_type n, const float& rfv = 0) | |||
const float& rfv = Array<float>::resize_fill_value ()) | ||||
{ | { | |||
Array<float>::resize (dim_vector (n, 1), rfv); | Array<float>::resize (dim_vector (n, 1), rfv); | |||
} | } | |||
void clear (octave_idx_type n) | void clear (octave_idx_type n) | |||
{ Array<float>::clear (n, 1); } | { Array<float>::clear (n, 1); } | |||
}; | }; | |||
// Publish externally used friend functions. | // Publish externally used friend functions. | |||
extern OCTAVE_API FloatColumnVector real (const FloatComplexColumnVector& a ); | extern OCTAVE_API FloatColumnVector real (const FloatComplexColumnVector& a ); | |||
extern OCTAVE_API FloatColumnVector imag (const FloatComplexColumnVector& a ); | extern OCTAVE_API FloatColumnVector imag (const FloatComplexColumnVector& a ); | |||
MARRAY_FORWARD_DEFS (MArray, FloatColumnVector, float) | MARRAY_FORWARD_DEFS (MArray, FloatColumnVector, float) | |||
End of changes. 8 change blocks. | ||||
18 lines changed or deleted | 19 lines changed or added | |||
fDiagMatrix.h | fDiagMatrix.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatDiagMatrix_h) | #if !defined (octave_fDiagMatrix_h) | |||
#define octave_FloatDiagMatrix_h 1 | #define octave_fDiagMatrix_h 1 | |||
#include "MDiagArray2.h" | #include "MDiagArray2.h" | |||
#include "fRowVector.h" | #include "fRowVector.h" | |||
#include "fColVector.h" | #include "fColVector.h" | |||
#include "DET.h" | #include "DET.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatDiagMatrix : public MDiagArray2<float> | FloatDiagMatrix : public MDiagArray2<float> | |||
{ | { | |||
friend class FloatSVD; | friend class FloatSVD; | |||
friend class FloatComplexSVD; | friend class FloatComplexSVD; | |||
public: | public: | |||
FloatDiagMatrix (void) : MDiagArray2<float> () { } | FloatDiagMatrix (void) : MDiagArray2<float> () { } | |||
FloatDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<floa | FloatDiagMatrix (octave_idx_type r, octave_idx_type c) | |||
t> (r, c) { } | : MDiagArray2<float> (r, c) { } | |||
FloatDiagMatrix (octave_idx_type r, octave_idx_type c, float val) : MDiag | FloatDiagMatrix (octave_idx_type r, octave_idx_type c, float val) | |||
Array2<float> (r, c, val) { } | : MDiagArray2<float> (r, c, val) { } | |||
FloatDiagMatrix (const FloatDiagMatrix& a) : MDiagArray2<float> (a) { } | FloatDiagMatrix (const FloatDiagMatrix& a) : MDiagArray2<float> (a) { } | |||
FloatDiagMatrix (const MDiagArray2<float>& a) : MDiagArray2<float> (a) { } | FloatDiagMatrix (const MDiagArray2<float>& a) : MDiagArray2<float> (a) { } | |||
template <class U> | template <class U> | |||
FloatDiagMatrix (const DiagArray2<U>& a) : MDiagArray2<float> (a) { } | FloatDiagMatrix (const DiagArray2<U>& a) : MDiagArray2<float> (a) { } | |||
explicit FloatDiagMatrix (const Array<double>& a) : MDiagArray2<float> (a ) { } | explicit FloatDiagMatrix (const Array<double>& a) : MDiagArray2<float> (a ) { } | |||
FloatDiagMatrix (const Array<float>& a, octave_idx_type r, octave_idx_typ e c) | FloatDiagMatrix (const Array<float>& a, octave_idx_type r, octave_idx_typ e c) | |||
: MDiagArray2<float> (a, r, c) { } | : MDiagArray2<float> (a, r, c) { } | |||
FloatDiagMatrix& operator = (const FloatDiagMatrix& a) | FloatDiagMatrix& operator = (const FloatDiagMatrix& a) | |||
{ | { | |||
MDiagArray2<float>::operator = (a); | MDiagArray2<float>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const FloatDiagMatrix& a) const; | bool operator == (const FloatDiagMatrix& a) const; | |||
bool operator != (const FloatDiagMatrix& a) const; | bool operator != (const FloatDiagMatrix& a) const; | |||
FloatDiagMatrix& fill (float val); | FloatDiagMatrix& fill (float val); | |||
FloatDiagMatrix& fill (float val, octave_idx_type beg, octave_idx_type en d); | FloatDiagMatrix& fill (float val, octave_idx_type beg, octave_idx_type en d); | |||
FloatDiagMatrix& fill (const FloatColumnVector& a); | FloatDiagMatrix& fill (const FloatColumnVector& a); | |||
FloatDiagMatrix& fill (const FloatRowVector& a); | FloatDiagMatrix& fill (const FloatRowVector& a); | |||
FloatDiagMatrix& fill (const FloatColumnVector& a, octave_idx_type beg); | FloatDiagMatrix& fill (const FloatColumnVector& a, octave_idx_type beg); | |||
FloatDiagMatrix& fill (const FloatRowVector& a, octave_idx_type beg); | FloatDiagMatrix& fill (const FloatRowVector& a, octave_idx_type beg); | |||
FloatDiagMatrix transpose (void) const { return MDiagArray2<float>::trans | FloatDiagMatrix transpose (void) const | |||
pose(); } | { return MDiagArray2<float>::transpose (); } | |||
FloatDiagMatrix abs (void) const; | FloatDiagMatrix abs (void) const; | |||
friend OCTAVE_API FloatDiagMatrix real (const FloatComplexDiagMatrix& a); | friend OCTAVE_API FloatDiagMatrix real (const FloatComplexDiagMatrix& a); | |||
friend OCTAVE_API FloatDiagMatrix imag (const FloatComplexDiagMatrix& a); | friend OCTAVE_API FloatDiagMatrix imag (const FloatComplexDiagMatrix& a); | |||
// resize is the destructive analog for this one | // resize is the destructive analog for this one | |||
FloatMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_t | FloatMatrix extract (octave_idx_type r1, octave_idx_type c1, | |||
ype r2, octave_idx_type c2) const; | octave_idx_type r2, octave_idx_type c2) const; | |||
// extract row or column i. | // extract row or column i. | |||
FloatRowVector row (octave_idx_type i) const; | FloatRowVector row (octave_idx_type i) const; | |||
FloatRowVector row (char *s) const; | FloatRowVector row (char *s) const; | |||
FloatColumnVector column (octave_idx_type i) const; | FloatColumnVector column (octave_idx_type i) const; | |||
FloatColumnVector column (char *s) const; | FloatColumnVector column (char *s) const; | |||
FloatDiagMatrix inverse (void) const; | FloatDiagMatrix inverse (void) const; | |||
FloatDiagMatrix inverse (octave_idx_type& info) const; | FloatDiagMatrix inverse (octave_idx_type& info) const; | |||
FloatDiagMatrix pseudo_inverse (void) const; | FloatDiagMatrix pseudo_inverse (void) const; | |||
// other operations | // other operations | |||
FloatColumnVector diag (octave_idx_type k = 0) const | FloatColumnVector extract_diag (octave_idx_type k = 0) const | |||
{ return MDiagArray2<float>::diag (k); } | { return MDiagArray2<float>::extract_diag (k); } | |||
FloatDET determinant (void) const; | FloatDET determinant (void) const; | |||
float rcond (void) const; | float rcond (void) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Floa | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
tDiagMatrix& a); | const FloatDiagMatrix& a); | |||
}; | }; | |||
OCTAVE_API FloatDiagMatrix real (const FloatComplexDiagMatrix& a); | OCTAVE_API FloatDiagMatrix real (const FloatComplexDiagMatrix& a); | |||
OCTAVE_API FloatDiagMatrix imag (const FloatComplexDiagMatrix& a); | OCTAVE_API FloatDiagMatrix imag (const FloatComplexDiagMatrix& a); | |||
// diagonal matrix by diagonal matrix -> diagonal matrix operations | // diagonal matrix by diagonal matrix -> diagonal matrix operations | |||
OCTAVE_API FloatDiagMatrix | OCTAVE_API FloatDiagMatrix operator * (const FloatDiagMatrix& a, | |||
operator * (const FloatDiagMatrix& a, const FloatDiagMatrix& b); | const FloatDiagMatrix& b); | |||
MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, FloatDiagMatrix, float) | MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, FloatDiagMatrix, float) | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
23 lines changed or deleted | 24 lines changed or added | |||
fEIG.h | fEIG.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_float_EIG_h) | #if !defined (octave_fEIG_h) | |||
#define octave_float_EIG_h 1 | #define octave_fEIG_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "fMatrix.h" | #include "fMatrix.h" | |||
#include "fCMatrix.h" | #include "fCMatrix.h" | |||
#include "fCColVector.h" | #include "fCColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatEIG | FloatEIG | |||
{ | { | |||
friend class FloatMatrix; | friend class FloatMatrix; | |||
friend class FloatComplexMatrix; | friend class FloatComplexMatrix; | |||
public: | public: | |||
FloatEIG (void) | FloatEIG (void) | |||
: lambda (), v () { } | : lambda (), v () { } | |||
FloatEIG (const FloatMatrix& a, bool calc_eigenvectors = true) | FloatEIG (const FloatMatrix& a, bool calc_eigenvectors = true) | |||
: lambda (), v () | : lambda (), v () | |||
{ | { | |||
init (a, calc_eigenvectors); | init (a, calc_eigenvectors); | |||
skipping to change at line 101 | skipping to change at line 101 | |||
FloatEIG (const FloatComplexMatrix& a, const FloatComplexMatrix& b, | FloatEIG (const FloatComplexMatrix& a, const FloatComplexMatrix& b, | |||
octave_idx_type& info, bool calc_eigenvectors = true) | octave_idx_type& info, bool calc_eigenvectors = true) | |||
: lambda (), v () | : lambda (), v () | |||
{ | { | |||
info = init (a, b, calc_eigenvectors); | info = init (a, b, calc_eigenvectors); | |||
} | } | |||
FloatEIG (const FloatEIG& a) : lambda (a.lambda), v (a.v) { } | FloatEIG (const FloatEIG& a) : lambda (a.lambda), v (a.v) { } | |||
FloatEIG& operator = (const FloatEIG& a) | FloatEIG& operator = (const FloatEIG& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
lambda = a.lambda; | lambda = a.lambda; | |||
v = a.v; | v = a.v; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~FloatEIG (void) { } | ~FloatEIG (void) { } | |||
FloatComplexColumnVector eigenvalues (void) const { return lambda; } | FloatComplexColumnVector eigenvalues (void) const { return lambda; } | |||
FloatComplexMatrix eigenvectors (void) const { return v; } | FloatComplexMatrix eigenvectors (void) const { return v; } | |||
friend std::ostream& operator << (std::ostream& os, const FloatEIG& a); | friend std::ostream& operator << (std::ostream& os, const FloatEIG& a); | |||
private: | private: | |||
FloatComplexColumnVector lambda; | FloatComplexColumnVector lambda; | |||
FloatComplexMatrix v; | FloatComplexMatrix v; | |||
octave_idx_type init (const FloatMatrix& a, bool calc_eigenvectors); | octave_idx_type init (const FloatMatrix& a, bool calc_eigenvectors); | |||
octave_idx_type init (const FloatMatrix& a, const FloatMatrix& b, bool ca | octave_idx_type init (const FloatMatrix& a, const FloatMatrix& b, | |||
lc_eigenvectors); | bool calc_eigenvectors); | |||
octave_idx_type init (const FloatComplexMatrix& a, bool calc_eigenvectors ); | octave_idx_type init (const FloatComplexMatrix& a, bool calc_eigenvectors ); | |||
octave_idx_type init (const FloatComplexMatrix& a, const FloatComplexMatr | octave_idx_type init (const FloatComplexMatrix& a, | |||
ix& b, bool calc_eigenvectors); | const FloatComplexMatrix& b, bool calc_eigenvectors | |||
); | ||||
octave_idx_type symmetric_init (const FloatMatrix& a, bool calc_eigenvect ors); | octave_idx_type symmetric_init (const FloatMatrix& a, bool calc_eigenvect ors); | |||
octave_idx_type symmetric_init (const FloatMatrix& a, const FloatMatrix& | octave_idx_type symmetric_init (const FloatMatrix& a, const FloatMatrix& | |||
b, bool calc_eigenvectors); | b, | |||
octave_idx_type hermitian_init (const FloatComplexMatrix& a, bool calc_ei | bool calc_eigenvectors); | |||
genvectors); | octave_idx_type hermitian_init (const FloatComplexMatrix& a, | |||
octave_idx_type hermitian_init (const FloatComplexMatrix& a, const FloatC | bool calc_eigenvectors); | |||
omplexMatrix& b, bool calc_eigenvectors); | octave_idx_type hermitian_init (const FloatComplexMatrix& a, | |||
const FloatComplexMatrix& b, | ||||
bool calc_eigenvectors); | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
23 lines changed or deleted | 26 lines changed or added | |||
fMatrix.h | fMatrix.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatMatrix_int_h) | #if !defined (octave_fMatrix_h) | |||
#define octave_FloatMatrix_int_h 1 | #define octave_fMatrix_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "MDiagArray2.h" | #include "MDiagArray2.h" | |||
#include "MatrixType.h" | #include "MatrixType.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
#include "mx-op-decl.h" | #include "mx-op-decl.h" | |||
#include "DET.h" | #include "DET.h" | |||
class | class | |||
skipping to change at line 79 | skipping to change at line 79 | |||
explicit FloatMatrix (const FloatDiagMatrix& a); | explicit FloatMatrix (const FloatDiagMatrix& a); | |||
explicit FloatMatrix (const PermMatrix& a); | explicit FloatMatrix (const PermMatrix& a); | |||
explicit FloatMatrix (const boolMatrix& a); | explicit FloatMatrix (const boolMatrix& a); | |||
explicit FloatMatrix (const charMatrix& a); | explicit FloatMatrix (const charMatrix& a); | |||
FloatMatrix& operator = (const FloatMatrix& a) | FloatMatrix& operator = (const FloatMatrix& a) | |||
{ | { | |||
MArray<float>::operator = (a); | MArray<float>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const FloatMatrix& a) const; | bool operator == (const FloatMatrix& a) const; | |||
bool operator != (const FloatMatrix& a) const; | bool operator != (const FloatMatrix& a) const; | |||
bool is_symmetric (void) const; | bool is_symmetric (void) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
FloatMatrix& insert (const FloatMatrix& a, octave_idx_type r, octave_idx_ | FloatMatrix& insert (const FloatMatrix& a, | |||
type c); | octave_idx_type r, octave_idx_type c); | |||
FloatMatrix& insert (const FloatRowVector& a, octave_idx_type r, octave_i | FloatMatrix& insert (const FloatRowVector& a, | |||
dx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatMatrix& insert (const FloatColumnVector& a, octave_idx_type r, octav | FloatMatrix& insert (const FloatColumnVector& a, | |||
e_idx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatMatrix& insert (const FloatDiagMatrix& a, octave_idx_type r, octave_ | FloatMatrix& insert (const FloatDiagMatrix& a, | |||
idx_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatMatrix& fill (float val); | FloatMatrix& fill (float val); | |||
FloatMatrix& fill (float val, octave_idx_type r1, octave_idx_type c1, oct | FloatMatrix& fill (float val, octave_idx_type r1, octave_idx_type c1, | |||
ave_idx_type r2, octave_idx_type c2); | octave_idx_type r2, octave_idx_type c2); | |||
FloatMatrix append (const FloatMatrix& a) const; | FloatMatrix append (const FloatMatrix& a) const; | |||
FloatMatrix append (const FloatRowVector& a) const; | FloatMatrix append (const FloatRowVector& a) const; | |||
FloatMatrix append (const FloatColumnVector& a) const; | FloatMatrix append (const FloatColumnVector& a) const; | |||
FloatMatrix append (const FloatDiagMatrix& a) const; | FloatMatrix append (const FloatDiagMatrix& a) const; | |||
FloatMatrix stack (const FloatMatrix& a) const; | FloatMatrix stack (const FloatMatrix& a) const; | |||
FloatMatrix stack (const FloatRowVector& a) const; | FloatMatrix stack (const FloatRowVector& a) const; | |||
FloatMatrix stack (const FloatColumnVector& a) const; | FloatMatrix stack (const FloatColumnVector& a) const; | |||
FloatMatrix stack (const FloatDiagMatrix& a) const; | FloatMatrix stack (const FloatDiagMatrix& a) const; | |||
friend OCTAVE_API FloatMatrix real (const FloatComplexMatrix& a); | friend OCTAVE_API FloatMatrix real (const FloatComplexMatrix& a); | |||
friend OCTAVE_API FloatMatrix imag (const FloatComplexMatrix& a); | friend OCTAVE_API FloatMatrix imag (const FloatComplexMatrix& a); | |||
friend class FloatComplexMatrix; | friend class FloatComplexMatrix; | |||
FloatMatrix transpose (void) const { return MArray<float>::transpose (); } | FloatMatrix transpose (void) const { return MArray<float>::transpose (); } | |||
// resize is the destructive equivalent for this one | // resize is the destructive equivalent for this one | |||
FloatMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_t | FloatMatrix extract (octave_idx_type r1, octave_idx_type c1, | |||
ype r2, octave_idx_type c2) const; | octave_idx_type r2, octave_idx_type c2) const; | |||
FloatMatrix extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx | FloatMatrix extract_n (octave_idx_type r1, octave_idx_type c1, | |||
_type nr, octave_idx_type nc) const; | octave_idx_type nr, octave_idx_type nc) const; | |||
// extract row or column i. | // extract row or column i. | |||
FloatRowVector row (octave_idx_type i) const; | FloatRowVector row (octave_idx_type i) const; | |||
FloatColumnVector column (octave_idx_type i) const; | FloatColumnVector column (octave_idx_type i) const; | |||
void resize (octave_idx_type nr, octave_idx_type nc, | void resize (octave_idx_type nr, octave_idx_type nc, float rfv = 0) | |||
float rfv = resize_fill_value ()) | ||||
{ | { | |||
MArray<float>::resize (dim_vector (nr, nc), rfv); | MArray<float>::resize (dim_vector (nr, nc), rfv); | |||
} | } | |||
private: | private: | |||
FloatMatrix tinverse (MatrixType &mattype, octave_idx_type& info, float& | FloatMatrix tinverse (MatrixType &mattype, octave_idx_type& info, | |||
rcon, | float& rcon, int force, int calc_cond) const; | |||
int force, int calc_cond) const; | ||||
FloatMatrix finverse (MatrixType &mattype, octave_idx_type& info, float& | FloatMatrix finverse (MatrixType &mattype, octave_idx_type& info, | |||
rcon, | float& rcon, int force, int calc_cond) const; | |||
int force, int calc_cond) const; | ||||
public: | public: | |||
FloatMatrix inverse (void) const; | FloatMatrix inverse (void) const; | |||
FloatMatrix inverse (octave_idx_type& info) const; | FloatMatrix inverse (octave_idx_type& info) const; | |||
FloatMatrix inverse (octave_idx_type& info, float& rcon, int force = 0, | FloatMatrix inverse (octave_idx_type& info, float& rcon, int force = 0, | |||
int calc_cond = 1) const; | int calc_cond = 1) const; | |||
FloatMatrix inverse (MatrixType &mattype) const; | FloatMatrix inverse (MatrixType &mattype) const; | |||
FloatMatrix inverse (MatrixType &mattype, octave_idx_type& info) const; | FloatMatrix inverse (MatrixType &mattype, octave_idx_type& info) const; | |||
FloatMatrix inverse (MatrixType &mattype, octave_idx_type& info, float& r con, | FloatMatrix inverse (MatrixType &mattype, octave_idx_type& info, float& r con, | |||
int force = 0, int calc_cond = 1) const; | int force = 0, int calc_cond = 1) const; | |||
FloatMatrix pseudo_inverse (float tol = 0.0) const; | FloatMatrix pseudo_inverse (float tol = 0.0) const; | |||
FloatComplexMatrix fourier (void) const; | FloatComplexMatrix fourier (void) const; | |||
FloatComplexMatrix ifourier (void) const; | FloatComplexMatrix ifourier (void) const; | |||
FloatComplexMatrix fourier2d (void) const; | FloatComplexMatrix fourier2d (void) const; | |||
FloatComplexMatrix ifourier2d (void) const; | FloatComplexMatrix ifourier2d (void) const; | |||
FloatDET determinant (void) const; | FloatDET determinant (void) const; | |||
FloatDET determinant (octave_idx_type& info) const; | FloatDET determinant (octave_idx_type& info) const; | |||
FloatDET determinant (octave_idx_type& info, float& rcon, int calc_cond = | FloatDET determinant (octave_idx_type& info, float& rcon, | |||
1) const; | int calc_cond = 1) const; | |||
FloatDET determinant (MatrixType &mattype, octave_idx_type& info, | FloatDET determinant (MatrixType &mattype, octave_idx_type& info, | |||
float& rcon, int calc_cond = 1) const; | float& rcon, int calc_cond = 1) const; | |||
float rcond (void) const; | float rcond (void) const; | |||
float rcond (MatrixType &mattype) const; | float rcond (MatrixType &mattype) const; | |||
private: | private: | |||
// Upper triangular matrix solvers | // Upper triangular matrix solvers | |||
FloatMatrix utsolve (MatrixType &typ, const FloatMatrix& b, octave_idx_ty | FloatMatrix utsolve (MatrixType &typ, const FloatMatrix& b, | |||
pe& info, | octave_idx_type& info, | |||
float& rcon, solve_singularity_handler sing_handler, | float& rcon, solve_singularity_handler sing_handler, | |||
bool calc_cond = false, blas_trans_type transt = blas_no_ | bool calc_cond = false, | |||
trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
// Lower triangular matrix solvers | // Lower triangular matrix solvers | |||
FloatMatrix ltsolve (MatrixType &typ, const FloatMatrix& b, octave_idx_ty | FloatMatrix ltsolve (MatrixType &typ, const FloatMatrix& b, | |||
pe& info, | octave_idx_type& info, | |||
float& rcon, solve_singularity_handler sing_handler, | float& rcon, solve_singularity_handler sing_handler, | |||
bool calc_cond = false, blas_trans_type transt = blas_no_ | bool calc_cond = false, | |||
trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
// Full matrix solvers (lu/cholesky) | // Full matrix solvers (lu/cholesky) | |||
FloatMatrix fsolve (MatrixType &typ, const FloatMatrix& b, octave_idx_typ | FloatMatrix fsolve (MatrixType &typ, const FloatMatrix& b, | |||
e& info, | octave_idx_type& info, | |||
float& rcon, solve_singularity_handler sing_handler, | float& rcon, solve_singularity_handler sing_handler, | |||
bool calc_cond = false) const; | bool calc_cond = false) const; | |||
public: | public: | |||
// Generic interface to solver with no probing of type | // Generic interface to solver with no probing of type | |||
FloatMatrix solve (MatrixType &typ, const FloatMatrix& b) const; | FloatMatrix solve (MatrixType &typ, const FloatMatrix& b) const; | |||
FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type | FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, | |||
& info) const; | octave_idx_type& info) const; | |||
FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type | FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, | |||
& info, | octave_idx_type& info, float& rcon) const; | |||
float& rcon) const; | FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, | |||
FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type | octave_idx_type& info, float& rcon, | |||
& info, | solve_singularity_handler sing_handler, | |||
float& rcon, solve_singularity_handler sing_handler, | bool singular_fallback = true, | |||
bool singular_fallback = true, blas_trans_type transt = bla | blas_trans_type transt = blas_no_trans) const; | |||
s_no_trans) const; | ||||
FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b) c onst; | FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b) c onst; | |||
FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, | FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, | FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, | |||
octave_idx_type& info, float& rcon) const; | octave_idx_type& info, float& rcon) const; | |||
FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, | FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, | |||
octave_idx_type& info, float& rcon, | octave_idx_type& info, float& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
bool singular_fallback = true, | bool singular_fallback = true, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b) con st; | FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b) con st; | |||
FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, | FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, | FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, | |||
octave_idx_type& info, float& rcon) const; | octave_idx_type& info, float& rcon) const; | |||
FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, | FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, | |||
octave_idx_type& info, float& rcon, | octave_idx_type& info, float& rcon, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
FloatComplexColumnVector solve (MatrixType &typ, | FloatComplexColumnVector solve (MatrixType &typ, | |||
const FloatComplexColumnVector& b) const; | const FloatComplexColumnVector& b) const; | |||
FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumn | FloatComplexColumnVector solve (MatrixType &typ, | |||
Vector& b, | const FloatComplexColumnVector& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumn | FloatComplexColumnVector solve (MatrixType &typ, | |||
Vector& b, | const FloatComplexColumnVector& b, | |||
octave_idx_type& info, float& rcon) const; | octave_idx_type& info, float& rcon) const | |||
FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumn | ; | |||
Vector& b, | FloatComplexColumnVector solve (MatrixType &typ, | |||
octave_idx_type& info, float& rcon, | const FloatComplexColumnVector& b, | |||
solve_singularity_handler sing_handler, blas_t | octave_idx_type& info, float& rcon, | |||
rans_type transt = blas_no_trans) const; | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) c | ||||
onst; | ||||
// Generic interface to solver with probing of type | // Generic interface to solver with probing of type | |||
FloatMatrix solve (const FloatMatrix& b) const; | FloatMatrix solve (const FloatMatrix& b) const; | |||
FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info) const; | FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info) const; | |||
FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rc | FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info, | |||
on) const; | float& rcon) const; | |||
FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rc on, | FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rc on, | |||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
FloatComplexMatrix solve (const FloatComplexMatrix& b) const; | FloatComplexMatrix solve (const FloatComplexMatrix& b) const; | |||
FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& i | FloatComplexMatrix solve (const FloatComplexMatrix& b, | |||
nfo) const; | octave_idx_type& info) const; | |||
FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& i | FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& i | |||
nfo, float& rcon) const; | nfo, | |||
FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& i | float& rcon) const; | |||
nfo, float& rcon, | FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& i | |||
nfo, | ||||
float& rcon, | ||||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
FloatColumnVector solve (const FloatColumnVector& b) const; | FloatColumnVector solve (const FloatColumnVector& b) const; | |||
FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& inf | FloatColumnVector solve (const FloatColumnVector& b, | |||
o) const; | octave_idx_type& info) const; | |||
FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& inf | FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& inf | |||
o, float& rcon) const; | o, | |||
FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& inf | float& rcon) const; | |||
o, float& rcon, | FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& inf | |||
o, | ||||
float& rcon, | ||||
solve_singularity_handler sing_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) const; | blas_trans_type transt = blas_no_trans) const; | |||
FloatComplexColumnVector solve (const FloatComplexColumnVector& b) const; | FloatComplexColumnVector solve (const FloatComplexColumnVector& b) const; | |||
FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave | FloatComplexColumnVector solve (const FloatComplexColumnVector& b, | |||
_idx_type& info) const; | octave_idx_type& info) const; | |||
FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave | FloatComplexColumnVector solve (const FloatComplexColumnVector& b, | |||
_idx_type& info, | octave_idx_type& info, | |||
float& rcon) const; | float& rcon) const; | |||
FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave | FloatComplexColumnVector solve (const FloatComplexColumnVector& b, | |||
_idx_type& info, | octave_idx_type& info, | |||
float& rcon, solve_singularity_handler si | float& rcon, | |||
ng_handler, | solve_singularity_handler sing_handler, | |||
blas_trans_type transt = blas_no_trans) c onst; | blas_trans_type transt = blas_no_trans) c onst; | |||
// Singular solvers | // Singular solvers | |||
FloatMatrix lssolve (const FloatMatrix& b) const; | FloatMatrix lssolve (const FloatMatrix& b) const; | |||
FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info) const; | FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info) const; | |||
FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, | FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, | |||
octave_idx_type& rank) const; | octave_idx_type& rank) const; | |||
FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, | FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, | |||
octave_idx_type& rank, float& rcon) const; | octave_idx_type& rank, float& rcon) const; | |||
FloatComplexMatrix lssolve (const FloatComplexMatrix& b) const; | FloatComplexMatrix lssolve (const FloatComplexMatrix& b) const; | |||
FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& | FloatComplexMatrix lssolve (const FloatComplexMatrix& b, | |||
info) const; | octave_idx_type& info) const; | |||
FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& | FloatComplexMatrix lssolve (const FloatComplexMatrix& b, | |||
info, | octave_idx_type& info, | |||
octave_idx_type& rank) const; | octave_idx_type& rank) const; | |||
FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& | FloatComplexMatrix lssolve (const FloatComplexMatrix& b, | |||
info, | octave_idx_type& info, octave_idx_type& rank, | |||
octave_idx_type& rank, float &rcon) const; | float &rcon) const; | |||
FloatColumnVector lssolve (const FloatColumnVector& b) const; | FloatColumnVector lssolve (const FloatColumnVector& b) const; | |||
FloatColumnVector lssolve (const FloatColumnVector& b, octave_idx_type& i | FloatColumnVector lssolve (const FloatColumnVector& b, | |||
nfo) const; | octave_idx_type& info) const; | |||
FloatColumnVector lssolve (const FloatColumnVector& b, octave_idx_type& i nfo, | FloatColumnVector lssolve (const FloatColumnVector& b, octave_idx_type& i nfo, | |||
octave_idx_type& rank) const; | octave_idx_type& rank) const; | |||
FloatColumnVector lssolve (const FloatColumnVector& b, octave_idx_type& i nfo, | FloatColumnVector lssolve (const FloatColumnVector& b, octave_idx_type& i nfo, | |||
octave_idx_type& rank, float& rcon) const; | octave_idx_type& rank, float& rcon) const; | |||
FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b) cons t; | FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b) cons t; | |||
FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, | FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, | |||
octave_idx_type& info) const; | octave_idx_type& info) const; | |||
FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, | FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, | |||
octave_idx_type& info, | octave_idx_type& info, | |||
octave_idx_type& rank) const; | octave_idx_type& rank) const; | |||
FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, | FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, | |||
octave_idx_type& info, | octave_idx_type& info, | |||
octave_idx_type& rank, float& rcon) const; | octave_idx_type& rank, float& rcon) con | |||
st; | ||||
FloatMatrix& operator += (const FloatDiagMatrix& a); | FloatMatrix& operator += (const FloatDiagMatrix& a); | |||
FloatMatrix& operator -= (const FloatDiagMatrix& a); | FloatMatrix& operator -= (const FloatDiagMatrix& a); | |||
// unary operations | // unary operations | |||
boolMatrix operator ! (void) const; | boolMatrix operator ! (void) const; | |||
// other operations | // other operations | |||
skipping to change at line 318 | skipping to change at line 352 | |||
FloatMatrix cumprod (int dim = -1) const; | FloatMatrix cumprod (int dim = -1) const; | |||
FloatMatrix cumsum (int dim = -1) const; | FloatMatrix cumsum (int dim = -1) const; | |||
FloatMatrix prod (int dim = -1) const; | FloatMatrix prod (int dim = -1) const; | |||
FloatMatrix sum (int dim = -1) const; | FloatMatrix sum (int dim = -1) const; | |||
FloatMatrix sumsq (int dim = -1) const; | FloatMatrix sumsq (int dim = -1) const; | |||
FloatMatrix abs (void) const; | FloatMatrix abs (void) const; | |||
FloatMatrix diag (octave_idx_type k = 0) const; | FloatMatrix diag (octave_idx_type k = 0) const; | |||
FloatDiagMatrix diag (octave_idx_type m, octave_idx_type n) const; | ||||
FloatColumnVector row_min (void) const; | FloatColumnVector row_min (void) const; | |||
FloatColumnVector row_max (void) const; | FloatColumnVector row_max (void) const; | |||
FloatColumnVector row_min (Array<octave_idx_type>& index) const; | FloatColumnVector row_min (Array<octave_idx_type>& index) const; | |||
FloatColumnVector row_max (Array<octave_idx_type>& index) const; | FloatColumnVector row_max (Array<octave_idx_type>& index) const; | |||
FloatRowVector column_min (void) const; | FloatRowVector column_min (void) const; | |||
FloatRowVector column_max (void) const; | FloatRowVector column_max (void) const; | |||
FloatRowVector column_min (Array<octave_idx_type>& index) const; | FloatRowVector column_min (Array<octave_idx_type>& index) const; | |||
FloatRowVector column_max (Array<octave_idx_type>& index) const; | FloatRowVector column_max (Array<octave_idx_type>& index) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Floa | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
tMatrix& a); | const FloatMatrix& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatMatri | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
x& a); | FloatMatrix& a); | |||
static float resize_fill_value (void) { return 0; } | ||||
}; | }; | |||
// Publish externally used friend functions. | // Publish externally used friend functions. | |||
extern OCTAVE_API FloatMatrix real (const FloatComplexMatrix& a); | extern OCTAVE_API FloatMatrix real (const FloatComplexMatrix& a); | |||
extern OCTAVE_API FloatMatrix imag (const FloatComplexMatrix& a); | extern OCTAVE_API FloatMatrix imag (const FloatComplexMatrix& a); | |||
// column vector by row vector -> matrix operations | // column vector by row vector -> matrix operations | |||
extern OCTAVE_API FloatMatrix operator * (const FloatColumnVector& a, const | extern OCTAVE_API FloatMatrix operator * (const FloatColumnVector& a, | |||
FloatRowVector& b); | const FloatRowVector& b); | |||
// Other functions. | // Other functions. | |||
extern OCTAVE_API FloatMatrix Givens (float, float); | extern OCTAVE_API FloatMatrix Givens (float, float); | |||
extern OCTAVE_API FloatMatrix Sylvester (const FloatMatrix&, const FloatMat | extern OCTAVE_API FloatMatrix Sylvester (const FloatMatrix&, const FloatMat | |||
rix&, const FloatMatrix&); | rix&, | |||
const FloatMatrix&); | ||||
extern OCTAVE_API FloatMatrix xgemm (const FloatMatrix& a, const FloatMatri x& b, | extern OCTAVE_API FloatMatrix xgemm (const FloatMatrix& a, const FloatMatri x& b, | |||
blas_trans_type transa = blas_no_trans , | blas_trans_type transa = blas_no_trans , | |||
blas_trans_type transb = blas_no_trans ); | blas_trans_type transb = blas_no_trans ); | |||
extern OCTAVE_API FloatMatrix operator * (const FloatMatrix& a, const Float | extern OCTAVE_API FloatMatrix operator * (const FloatMatrix& a, | |||
Matrix& b); | const FloatMatrix& b); | |||
extern OCTAVE_API FloatMatrix min (float d, const FloatMatrix& m); | extern OCTAVE_API FloatMatrix min (float d, const FloatMatrix& m); | |||
extern OCTAVE_API FloatMatrix min (const FloatMatrix& m, float d); | extern OCTAVE_API FloatMatrix min (const FloatMatrix& m, float d); | |||
extern OCTAVE_API FloatMatrix min (const FloatMatrix& a, const FloatMatrix& b); | extern OCTAVE_API FloatMatrix min (const FloatMatrix& a, const FloatMatrix& b); | |||
extern OCTAVE_API FloatMatrix max (float d, const FloatMatrix& m); | extern OCTAVE_API FloatMatrix max (float d, const FloatMatrix& m); | |||
extern OCTAVE_API FloatMatrix max (const FloatMatrix& m, float d); | extern OCTAVE_API FloatMatrix max (const FloatMatrix& m, float d); | |||
extern OCTAVE_API FloatMatrix max (const FloatMatrix& a, const FloatMatrix& b); | extern OCTAVE_API FloatMatrix max (const FloatMatrix& a, const FloatMatrix& b); | |||
extern OCTAVE_API FloatMatrix linspace (const FloatColumnVector& x1, | extern OCTAVE_API FloatMatrix linspace (const FloatColumnVector& x1, | |||
End of changes. 43 change blocks. | ||||
134 lines changed or deleted | 137 lines changed or added | |||
fNDArray.h | fNDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatNDArray_h) | #if !defined (octave_fNDArray_h) | |||
#define octave_FloatNDArray_h 1 | #define octave_fNDArray_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "fMatrix.h" | #include "fMatrix.h" | |||
#include "intNDArray.h" | #include "intNDArray.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
#include "mx-op-decl.h" | #include "mx-op-decl.h" | |||
#include "bsxfun-decl.h" | #include "bsxfun-decl.h" | |||
class | class | |||
skipping to change at line 65 | skipping to change at line 65 | |||
template <class U> | template <class U> | |||
FloatNDArray (const Array<U>& a) : MArray<float> (a) { } | FloatNDArray (const Array<U>& a) : MArray<float> (a) { } | |||
template <class U> | template <class U> | |||
explicit FloatNDArray (const intNDArray<U>& a) : MArray<float> (a) { } | explicit FloatNDArray (const intNDArray<U>& a) : MArray<float> (a) { } | |||
FloatNDArray (const charNDArray&); | FloatNDArray (const charNDArray&); | |||
FloatNDArray& operator = (const FloatNDArray& a) | FloatNDArray& operator = (const FloatNDArray& a) | |||
{ | { | |||
MArray<float>::operator = (a); | MArray<float>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
// unary operations | // unary operations | |||
boolNDArray operator ! (void) const; | boolNDArray operator ! (void) const; | |||
bool any_element_is_negative (bool = false) const; | bool any_element_is_negative (bool = false) const; | |||
bool any_element_is_positive (bool = false) const; | bool any_element_is_positive (bool = false) const; | |||
bool any_element_is_nan (void) const; | bool any_element_is_nan (void) const; | |||
bool any_element_is_inf_or_nan (void) const; | bool any_element_is_inf_or_nan (void) const; | |||
bool any_element_not_one_or_zero (void) const; | bool any_element_not_one_or_zero (void) const; | |||
bool all_elements_are_zero (void) const; | bool all_elements_are_zero (void) const; | |||
bool all_elements_are_int_or_inf_or_nan (void) const; | bool all_elements_are_int_or_inf_or_nan (void) const; | |||
bool all_integers (float& max_val, float& min_val) const; | bool all_integers (float& max_val, float& min_val) const; | |||
bool all_integers (void) const; | bool all_integers (void) const; | |||
bool too_large_for_float (void) const; | bool too_large_for_float (void) const; | |||
// FIXME -- this is not quite the right thing. | // FIXME: this is not quite the right thing. | |||
boolNDArray all (int dim = -1) const; | boolNDArray all (int dim = -1) const; | |||
boolNDArray any (int dim = -1) const; | boolNDArray any (int dim = -1) const; | |||
FloatNDArray cumprod (int dim = -1) const; | FloatNDArray cumprod (int dim = -1) const; | |||
FloatNDArray cumsum (int dim = -1) const; | FloatNDArray cumsum (int dim = -1) const; | |||
FloatNDArray prod (int dim = -1) const; | FloatNDArray prod (int dim = -1) const; | |||
FloatNDArray sum (int dim = -1) const; | FloatNDArray sum (int dim = -1) const; | |||
NDArray dsum (int dim = -1) const; | NDArray dsum (int dim = -1) const; | |||
FloatNDArray sumsq (int dim = -1) const; | FloatNDArray sumsq (int dim = -1) const; | |||
FloatNDArray concat (const FloatNDArray& rb, const Array<octave_idx_type> | FloatNDArray concat (const FloatNDArray& rb, | |||
& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
FloatComplexNDArray concat (const FloatComplexNDArray& rb, const Array<oc | FloatComplexNDArray concat (const FloatComplexNDArray& rb, | |||
tave_idx_type>& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
charNDArray concat (const charNDArray& rb, const Array<octave_idx_type>& | charNDArray concat (const charNDArray& rb, | |||
ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
FloatNDArray max (int dim = -1) const; | FloatNDArray max (int dim = -1) const; | |||
FloatNDArray max (Array<octave_idx_type>& index, int dim = -1) const; | FloatNDArray max (Array<octave_idx_type>& index, int dim = -1) const; | |||
FloatNDArray min (int dim = -1) const; | FloatNDArray min (int dim = -1) const; | |||
FloatNDArray min (Array<octave_idx_type>& index, int dim = -1) const; | FloatNDArray min (Array<octave_idx_type>& index, int dim = -1) const; | |||
FloatNDArray cummax (int dim = -1) const; | FloatNDArray cummax (int dim = -1) const; | |||
FloatNDArray cummax (Array<octave_idx_type>& index, int dim = -1) const; | FloatNDArray cummax (Array<octave_idx_type>& index, int dim = -1) const; | |||
FloatNDArray cummin (int dim = -1) const; | FloatNDArray cummin (int dim = -1) const; | |||
FloatNDArray cummin (Array<octave_idx_type>& index, int dim = -1) const; | FloatNDArray cummin (Array<octave_idx_type>& index, int dim = -1) const; | |||
FloatNDArray diff (octave_idx_type order = 1, int dim = -1) const; | FloatNDArray diff (octave_idx_type order = 1, int dim = -1) const; | |||
FloatNDArray& insert (const FloatNDArray& a, octave_idx_type r, octave_id | FloatNDArray& insert (const FloatNDArray& a, | |||
x_type c); | octave_idx_type r, octave_idx_type c); | |||
FloatNDArray& insert (const FloatNDArray& a, const Array<octave_idx_type> | FloatNDArray& insert (const FloatNDArray& a, | |||
& ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
FloatNDArray abs (void) const; | FloatNDArray abs (void) const; | |||
boolNDArray isnan (void) const; | boolNDArray isnan (void) const; | |||
boolNDArray isinf (void) const; | boolNDArray isinf (void) const; | |||
boolNDArray isfinite (void) const; | boolNDArray isfinite (void) const; | |||
FloatComplexNDArray fourier (int dim = 1) const; | FloatComplexNDArray fourier (int dim = 1) const; | |||
FloatComplexNDArray ifourier (int dim = 1) const; | FloatComplexNDArray ifourier (int dim = 1) const; | |||
FloatComplexNDArray fourier2d (void) const; | FloatComplexNDArray fourier2d (void) const; | |||
skipping to change at line 143 | skipping to change at line 148 | |||
FloatMatrix matrix_value (void) const; | FloatMatrix matrix_value (void) const; | |||
FloatNDArray squeeze (void) const { return MArray<float>::squeeze (); } | FloatNDArray squeeze (void) const { return MArray<float>::squeeze (); } | |||
static void increment_index (Array<octave_idx_type>& ra_idx, | static void increment_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions, | const dim_vector& dimensions, | |||
int start_dimension = 0); | int start_dimension = 0); | |||
static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions); | const dim_vector& dimensions); | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Floa | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
tNDArray& a); | const FloatNDArray& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatNDArr ay& a); | friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatNDArr ay& a); | |||
static float resize_fill_value (void) { return 0; } | ||||
FloatNDArray diag (octave_idx_type k = 0) const; | FloatNDArray diag (octave_idx_type k = 0) const; | |||
FloatNDArray diag (octave_idx_type m, octave_idx_type n) const; | ||||
FloatNDArray& changesign (void) | FloatNDArray& changesign (void) | |||
{ | { | |||
MArray<float>::changesign (); | MArray<float>::changesign (); | |||
return *this; | return *this; | |||
} | } | |||
}; | }; | |||
// Publish externally used friend functions. | // Publish externally used friend functions. | |||
extern OCTAVE_API FloatNDArray real (const FloatComplexNDArray& a); | extern OCTAVE_API FloatNDArray real (const FloatComplexNDArray& a); | |||
extern OCTAVE_API FloatNDArray imag (const FloatComplexNDArray& a); | extern OCTAVE_API FloatNDArray imag (const FloatComplexNDArray& a); | |||
MINMAX_DECLS (FloatNDArray, float, OCTAVE_API) | MINMAX_DECLS (FloatNDArray, float, OCTAVE_API) | |||
End of changes. 12 change blocks. | ||||
28 lines changed or deleted | 28 lines changed or added | |||
fRowVector.h | fRowVector.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatRowVector_h) | #if !defined (octave_fRowVector_h) | |||
#define octave_FloatRowVector_h 1 | #define octave_fRowVector_h 1 | |||
#include "MArray.h" | #include "MArray.h" | |||
#include "mx-defs.h" | #include "mx-defs.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatRowVector : public MArray<float> | FloatRowVector : public MArray<float> | |||
{ | { | |||
public: | public: | |||
skipping to change at line 54 | skipping to change at line 54 | |||
FloatRowVector (octave_idx_type n, float val) | FloatRowVector (octave_idx_type n, float val) | |||
: MArray<float> (dim_vector (1, n), val) { } | : MArray<float> (dim_vector (1, n), val) { } | |||
FloatRowVector (const FloatRowVector& a) : MArray<float> (a) { } | FloatRowVector (const FloatRowVector& a) : MArray<float> (a) { } | |||
FloatRowVector (const MArray<float>& a) : MArray<float> (a.as_row ()) { } | FloatRowVector (const MArray<float>& a) : MArray<float> (a.as_row ()) { } | |||
FloatRowVector (const Array<float>& a) : MArray<float> (a.as_row ()) { } | FloatRowVector (const Array<float>& a) : MArray<float> (a.as_row ()) { } | |||
FloatRowVector& operator = (const FloatRowVector& a) | FloatRowVector& operator = (const FloatRowVector& a) | |||
{ | { | |||
MArray<float>::operator = (a); | MArray<float>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const FloatRowVector& a) const; | bool operator == (const FloatRowVector& a) const; | |||
bool operator != (const FloatRowVector& a) const; | bool operator != (const FloatRowVector& a) const; | |||
// destructive insert/delete/reorder operations | // destructive insert/delete/reorder operations | |||
FloatRowVector& insert (const FloatRowVector& a, octave_idx_type c); | FloatRowVector& insert (const FloatRowVector& a, octave_idx_type c); | |||
FloatRowVector& fill (float val); | FloatRowVector& fill (float val); | |||
FloatRowVector& fill (float val, octave_idx_type c1, octave_idx_type c2); | FloatRowVector& fill (float val, octave_idx_type c1, octave_idx_type c2); | |||
skipping to change at line 84 | skipping to change at line 84 | |||
friend OCTAVE_API FloatRowVector imag (const FloatComplexRowVector& a); | friend OCTAVE_API FloatRowVector imag (const FloatComplexRowVector& a); | |||
// resize is the destructive equivalent for this one | // resize is the destructive equivalent for this one | |||
FloatRowVector extract (octave_idx_type c1, octave_idx_type c2) const; | FloatRowVector extract (octave_idx_type c1, octave_idx_type c2) const; | |||
FloatRowVector extract_n (octave_idx_type c1, octave_idx_type n) const; | FloatRowVector extract_n (octave_idx_type c1, octave_idx_type n) const; | |||
// row vector by matrix -> row vector | // row vector by matrix -> row vector | |||
friend OCTAVE_API FloatRowVector operator * (const FloatRowVector& a, con | friend OCTAVE_API FloatRowVector operator * (const FloatRowVector& a, | |||
st FloatMatrix& b); | const FloatMatrix& b); | |||
// other operations | // other operations | |||
float min (void) const; | float min (void) const; | |||
float max (void) const; | float max (void) const; | |||
// i/o | // i/o | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Floa | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
tRowVector& a); | const FloatRowVector& a); | |||
friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatRowVe | friend OCTAVE_API std::istream& operator >> (std::istream& is, | |||
ctor& a); | FloatRowVector& a); | |||
void resize (octave_idx_type n, | void resize (octave_idx_type n, const float& rfv = 0) | |||
const float& rfv = Array<float>::resize_fill_value ()) | ||||
{ | { | |||
Array<float>::resize (dim_vector (1, n), rfv); | Array<float>::resize (dim_vector (1, n), rfv); | |||
} | } | |||
void clear (octave_idx_type n) | void clear (octave_idx_type n) | |||
{ Array<float>::clear (1, n); } | { Array<float>::clear (1, n); } | |||
}; | }; | |||
// row vector by column vector -> scalar | // row vector by column vector -> scalar | |||
float OCTAVE_API operator * (const FloatRowVector& a, const FloatColumnVect | float OCTAVE_API operator * (const FloatRowVector& a, | |||
or& b); | const FloatColumnVector& b); | |||
Complex OCTAVE_API operator * (const FloatRowVector& a, const ComplexColumn | Complex OCTAVE_API operator * (const FloatRowVector& a, | |||
Vector& b); | const ComplexColumnVector& b); | |||
// other operations | // other operations | |||
OCTAVE_API FloatRowVector linspace (float x1, float x2, octave_idx_type n); | OCTAVE_API FloatRowVector linspace (float x1, float x2, octave_idx_type n); | |||
MARRAY_FORWARD_DEFS (MArray, FloatRowVector, float) | MARRAY_FORWARD_DEFS (MArray, FloatRowVector, float) | |||
#endif | #endif | |||
End of changes. 9 change blocks. | ||||
20 lines changed or deleted | 19 lines changed or added | |||
file-io.h | file-io.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
file-ops.h | file-ops.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
file-stat.h | file-stat.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 78 | skipping to change at line 78 | |||
fs_ctime = fs.fs_ctime; | fs_ctime = fs.fs_ctime; | |||
fs_rdev = fs.fs_rdev; | fs_rdev = fs.fs_rdev; | |||
fs_blksize = fs.fs_blksize; | fs_blksize = fs.fs_blksize; | |||
fs_blocks = fs.fs_blocks; | fs_blocks = fs.fs_blocks; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
// The minimum difference in file time stamp values. | // The minimum difference in file time stamp values. | |||
// FIXME -- this value should come from the filesystem itself. How | // FIXME: This value should come from the filesystem itself. | |||
// can we get that info? | // How can we get that info? | |||
octave_time time_resolution (void) const | octave_time time_resolution (void) const | |||
{ | { | |||
static octave_time resolution (1.0); | static octave_time resolution (1.0); | |||
return resolution; | return resolution; | |||
} | } | |||
// File status and info. The is_XXX functions will return false for | // File status and info. The is_XXX functions will return false for | |||
// file_stat objects that are not properly initialized. The others | // file_stat objects that are not properly initialized. The others | |||
// should all return 0 (or the equivalent, for the given object) | // should all return 0 (or the equivalent, for the given object) | |||
// which is likely not meaningful. | // which is likely not meaningful. | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
floatAEPBAL.h | floatAEPBAL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatAEPBALANCE_h) | #if !defined (octave_floatAEPBAL_h) | |||
#define octave_FloatAEPBALANCE_h 1 | #define octave_floatAEPBAL_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "base-aepbal.h" | #include "base-aepbal.h" | |||
#include "fMatrix.h" | #include "fMatrix.h" | |||
#include "fColVector.h" | #include "fColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
floatCHOL.h | floatCHOL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatCHOL_h) | #if !defined (octave_floatCHOL_h) | |||
#define octave_FloatCHOL_h 1 | #define octave_floatCHOL_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "fMatrix.h" | #include "fMatrix.h" | |||
#include "fColVector.h" | #include "fColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatCHOL | FloatCHOL | |||
{ | { | |||
public: | public: | |||
FloatCHOL (void) : chol_mat (), xrcond (0) { } | FloatCHOL (void) : chol_mat (), xrcond (0) { } | |||
FloatCHOL (const FloatMatrix& a, bool calc_cond = false) | FloatCHOL (const FloatMatrix& a, bool calc_cond = false) | |||
: chol_mat (), xrcond (0) | : chol_mat (), xrcond (0) | |||
{ | { | |||
init (a, calc_cond); | init (a, calc_cond); | |||
} | } | |||
FloatCHOL (const FloatMatrix& a, octave_idx_type& info, | FloatCHOL (const FloatMatrix& a, octave_idx_type& info, | |||
bool calc_cond = false) | bool calc_cond = false) | |||
: chol_mat (), xrcond (0) | : chol_mat (), xrcond (0) | |||
{ | { | |||
info = init (a, calc_cond); | info = init (a, calc_cond); | |||
} | } | |||
FloatCHOL (const FloatCHOL& a) : chol_mat (a.chol_mat), xrcond (a.xrcond) { } | FloatCHOL (const FloatCHOL& a) : chol_mat (a.chol_mat), xrcond (a.xrcond) { } | |||
FloatCHOL& operator = (const FloatCHOL& a) | FloatCHOL& operator = (const FloatCHOL& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
chol_mat = a.chol_mat; | chol_mat = a.chol_mat; | |||
xrcond = a.xrcond; | xrcond = a.xrcond; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
FloatMatrix chol_matrix (void) const { return chol_mat; } | FloatMatrix chol_matrix (void) const { return chol_mat; } | |||
float rcond (void) const { return xrcond; } | float rcond (void) const { return xrcond; } | |||
// Compute the inverse of a matrix using the Cholesky factorization. | // Compute the inverse of a matrix using the Cholesky factorization. | |||
FloatMatrix inverse (void) const; | FloatMatrix inverse (void) const; | |||
void set (const FloatMatrix& R); | void set (const FloatMatrix& R); | |||
void update (const FloatColumnVector& u); | void update (const FloatColumnVector& u); | |||
octave_idx_type downdate (const FloatColumnVector& u); | octave_idx_type downdate (const FloatColumnVector& u); | |||
octave_idx_type insert_sym (const FloatColumnVector& u, octave_idx_type j ); | octave_idx_type insert_sym (const FloatColumnVector& u, octave_idx_type j ); | |||
void delete_sym (octave_idx_type j); | void delete_sym (octave_idx_type j); | |||
void shift_sym (octave_idx_type i, octave_idx_type j); | void shift_sym (octave_idx_type i, octave_idx_type j); | |||
friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Floa | friend OCTAVE_API std::ostream& operator << (std::ostream& os, | |||
tCHOL& a); | const FloatCHOL& a); | |||
private: | private: | |||
FloatMatrix chol_mat; | FloatMatrix chol_mat; | |||
float xrcond; | float xrcond; | |||
octave_idx_type init (const FloatMatrix& a, bool calc_cond); | octave_idx_type init (const FloatMatrix& a, bool calc_cond); | |||
}; | }; | |||
End of changes. 6 change blocks. | ||||
19 lines changed or deleted | 19 lines changed or added | |||
floatGEPBAL.h | floatGEPBAL.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatGEPBALANCE_h) | #if !defined (octave_floatGEPBAL_h) | |||
#define octave_FloatGEPBALANCE_h 1 | #define octave_floatGEPBAL_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "fMatrix.h" | #include "fMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatGEPBALANCE | FloatGEPBALANCE | |||
{ | { | |||
public: | public: | |||
FloatGEPBALANCE (void) | FloatGEPBALANCE (void) | |||
: balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | |||
{ } | { } | |||
FloatGEPBALANCE (const FloatMatrix& a, const FloatMatrix& b, | FloatGEPBALANCE (const FloatMatrix& a, const FloatMatrix& b, | |||
const std::string& balance_job) | const std::string& balance_job) | |||
: balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ( ) | |||
{ | { | |||
init (a, b, balance_job); | init (a, b, balance_job); | |||
} | } | |||
FloatGEPBALANCE (const FloatGEPBALANCE& a) | FloatGEPBALANCE (const FloatGEPBALANCE& a) | |||
: balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2), | : balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2), | |||
balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2) { } | balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2) { } | |||
FloatGEPBALANCE& operator = (const FloatGEPBALANCE& a) | FloatGEPBALANCE& operator = (const FloatGEPBALANCE& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
balanced_mat = a.balanced_mat; | balanced_mat = a.balanced_mat; | |||
balanced_mat2 = a.balanced_mat2; | balanced_mat2 = a.balanced_mat2; | |||
balancing_mat = a.balancing_mat; | balancing_mat = a.balancing_mat; | |||
balancing_mat2 = a.balancing_mat2; | balancing_mat2 = a.balancing_mat2; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~FloatGEPBALANCE (void) { } | ~FloatGEPBALANCE (void) { } | |||
FloatMatrix balanced_matrix (void) const { return balanced_mat; } | FloatMatrix balanced_matrix (void) const { return balanced_mat; } | |||
FloatMatrix balanced_matrix2 (void) const { return balanced_mat2; } | FloatMatrix balanced_matrix2 (void) const { return balanced_mat2; } | |||
FloatMatrix balancing_matrix (void) const { return balancing_mat; } | FloatMatrix balancing_matrix (void) const { return balancing_mat; } | |||
FloatMatrix balancing_matrix2 (void) const { return balancing_mat2; } | FloatMatrix balancing_matrix2 (void) const { return balancing_mat2; } | |||
End of changes. 5 change blocks. | ||||
17 lines changed or deleted | 17 lines changed or added | |||
floatHESS.h | floatHESS.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatHESS_h) | #if !defined (octave_floatHESS_h) | |||
#define octave_FloatHESS_h 1 | #define octave_floatHESS_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "fMatrix.h" | #include "fMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatHESS | FloatHESS | |||
{ | { | |||
public: | public: | |||
FloatHESS (void) : hess_mat (), unitary_hess_mat () { } | FloatHESS (void) : hess_mat (), unitary_hess_mat () { } | |||
FloatHESS (const FloatMatrix& a) | FloatHESS (const FloatMatrix& a) | |||
: hess_mat (), unitary_hess_mat () | : hess_mat (), unitary_hess_mat () | |||
{ | { | |||
init (a); | init (a); | |||
} | } | |||
FloatHESS (const FloatMatrix& a, octave_idx_type& info) | FloatHESS (const FloatMatrix& a, octave_idx_type& info) | |||
: hess_mat (), unitary_hess_mat () | : hess_mat (), unitary_hess_mat () | |||
{ | { | |||
info = init (a); | info = init (a); | |||
} | } | |||
FloatHESS (const FloatHESS& a) | FloatHESS (const FloatHESS& a) | |||
: hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } | : hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } | |||
FloatHESS& operator = (const FloatHESS& a) | FloatHESS& operator = (const FloatHESS& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
hess_mat = a.hess_mat; | hess_mat = a.hess_mat; | |||
unitary_hess_mat = a.unitary_hess_mat; | unitary_hess_mat = a.unitary_hess_mat; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~FloatHESS (void) { } | ~FloatHESS (void) { } | |||
FloatMatrix hess_matrix (void) const { return hess_mat; } | FloatMatrix hess_matrix (void) const { return hess_mat; } | |||
FloatMatrix unitary_hess_matrix (void) const { return unitary_hess_mat; } | FloatMatrix unitary_hess_matrix (void) const { return unitary_hess_mat; } | |||
friend std::ostream& operator << (std::ostream& os, const FloatHESS& a); | friend std::ostream& operator << (std::ostream& os, const FloatHESS& a); | |||
private: | private: | |||
End of changes. 5 change blocks. | ||||
18 lines changed or deleted | 18 lines changed or added | |||
floatLU.h | floatLU.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatLU_h) | #if !defined (octave_floatLU_h) | |||
#define octave_FloatLU_h 1 | #define octave_floatLU_h 1 | |||
#include "base-lu.h" | #include "base-lu.h" | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
#include "fMatrix.h" | #include "fMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatLU : public base_lu <FloatMatrix> | FloatLU : public base_lu <FloatMatrix> | |||
{ | { | |||
public: | public: | |||
skipping to change at line 47 | skipping to change at line 47 | |||
FloatLU (const FloatMatrix& a); | FloatLU (const FloatMatrix& a); | |||
FloatLU (const FloatLU& a) : base_lu <FloatMatrix> (a) { } | FloatLU (const FloatLU& a) : base_lu <FloatMatrix> (a) { } | |||
FloatLU (const FloatMatrix& l, const FloatMatrix& u, | FloatLU (const FloatMatrix& l, const FloatMatrix& u, | |||
const PermMatrix& p) | const PermMatrix& p) | |||
: base_lu <FloatMatrix> (l, u, p) { } | : base_lu <FloatMatrix> (l, u, p) { } | |||
FloatLU& operator = (const FloatLU& a) | FloatLU& operator = (const FloatLU& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
base_lu <FloatMatrix> :: operator = (a); | base_lu <FloatMatrix> :: operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
~FloatLU (void) { } | ~FloatLU (void) { } | |||
void update (const FloatColumnVector& u, const FloatColumnVector& v); | void update (const FloatColumnVector& u, const FloatColumnVector& v); | |||
void update (const FloatMatrix& u, const FloatMatrix& v); | void update (const FloatMatrix& u, const FloatMatrix& v); | |||
void update_piv (const FloatColumnVector& u, const FloatColumnVector& v); | void update_piv (const FloatColumnVector& u, const FloatColumnVector& v); | |||
void update_piv (const FloatMatrix& u, const FloatMatrix& v); | void update_piv (const FloatMatrix& u, const FloatMatrix& v); | |||
End of changes. 4 change blocks. | ||||
8 lines changed or deleted | 8 lines changed or added | |||
floatQR.h | floatQR.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatQR_h) | #if !defined (octave_floatQR_h) | |||
#define octave_FloatQR_h 1 | #define octave_floatQR_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "fMatrix.h" | #include "fMatrix.h" | |||
#include "fColVector.h" | #include "fColVector.h" | |||
#include "fRowVector.h" | #include "fRowVector.h" | |||
#include "base-qr.h" | #include "base-qr.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
floatQRP.h | floatQRP.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatQRP_h) | #if !defined (octave_floatQRP_h) | |||
#define octave_FloatQRP_h 1 | #define octave_floatQRP_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "floatQR.h" | #include "floatQR.h" | |||
#include "PermMatrix.h" | #include "PermMatrix.h" | |||
#include "fColVector.h" | #include "fColVector.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatQRP : public FloatQR | FloatQRP : public FloatQR | |||
{ | { | |||
public: | public: | |||
FloatQRP (void) : FloatQR (), p () { } | FloatQRP (void) : FloatQR (), p () { } | |||
FloatQRP (const FloatMatrix&, qr_type_t = qr_type_std); | FloatQRP (const FloatMatrix&, qr_type_t = qr_type_std); | |||
FloatQRP (const FloatQRP& a) : FloatQR (a), p (a.p) { } | FloatQRP (const FloatQRP& a) : FloatQR (a), p (a.p) { } | |||
FloatQRP& operator = (const FloatQRP& a) | FloatQRP& operator = (const FloatQRP& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
FloatQR::operator = (a); | FloatQR::operator = (a); | |||
p = a.p; | p = a.p; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~FloatQRP (void) { } | ~FloatQRP (void) { } | |||
void init (const FloatMatrix&, qr_type_t = qr_type_std); | void init (const FloatMatrix&, qr_type_t = qr_type_std); | |||
PermMatrix P (void) const { return p; } | PermMatrix P (void) const { return p; } | |||
FloatRowVector Pvec (void) const; | FloatRowVector Pvec (void) const; | |||
friend std::ostream& operator << (std::ostream&, const FloatQRP&); | friend std::ostream& operator << (std::ostream&, const FloatQRP&); | |||
End of changes. 4 change blocks. | ||||
11 lines changed or deleted | 11 lines changed or added | |||
floatSCHUR.h | floatSCHUR.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatSCHUR_h) | #if !defined (octave_floatSCHUR_h) | |||
#define octave_FloatSCHUR_h 1 | #define octave_floatSCHUR_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "fMatrix.h" | #include "fMatrix.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatSCHUR | FloatSCHUR | |||
{ | { | |||
public: | public: | |||
FloatSCHUR (void) : schur_mat (), unitary_mat (), selector (0) { } | FloatSCHUR (void) : schur_mat (), unitary_mat (), selector (0) { } | |||
FloatSCHUR (const FloatMatrix& a, const std::string& ord, | FloatSCHUR (const FloatMatrix& a, const std::string& ord, | |||
bool calc_unitary = true) | bool calc_unitary = true) | |||
: schur_mat (), unitary_mat (), selector (0) | : schur_mat (), unitary_mat (), selector (0) | |||
{ | { | |||
init (a, ord, calc_unitary); | init (a, ord, calc_unitary); | |||
} | } | |||
FloatSCHUR (const FloatMatrix& a, const std::string& ord, int& info, | FloatSCHUR (const FloatMatrix& a, const std::string& ord, int& info, | |||
bool calc_unitary = true) | bool calc_unitary = true) | |||
: schur_mat (), unitary_mat (), selector (0) | : schur_mat (), unitary_mat (), selector (0) | |||
{ | { | |||
info = init (a, ord, calc_unitary); | info = init (a, ord, calc_unitary); | |||
} | } | |||
FloatSCHUR (const FloatSCHUR& a) | FloatSCHUR (const FloatSCHUR& a) | |||
: schur_mat (a.schur_mat), unitary_mat (a.unitary_mat), selector (0) | : schur_mat (a.schur_mat), unitary_mat (a.unitary_mat), selector (0) | |||
{ } | { } | |||
FloatSCHUR (const FloatMatrix& s, const FloatMatrix& u); | FloatSCHUR (const FloatMatrix& s, const FloatMatrix& u); | |||
FloatSCHUR& operator = (const FloatSCHUR& a) | FloatSCHUR& operator = (const FloatSCHUR& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
schur_mat = a.schur_mat; | schur_mat = a.schur_mat; | |||
unitary_mat = a.unitary_mat; | unitary_mat = a.unitary_mat; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~FloatSCHUR (void) { } | ~FloatSCHUR (void) { } | |||
FloatMatrix schur_matrix (void) const { return schur_mat; } | FloatMatrix schur_matrix (void) const { return schur_mat; } | |||
FloatMatrix unitary_matrix (void) const { return unitary_mat; } | FloatMatrix unitary_matrix (void) const { return unitary_mat; } | |||
friend std::ostream& operator << (std::ostream& os, const FloatSCHUR& a); | friend std::ostream& operator << (std::ostream& os, const FloatSCHUR& a); | |||
typedef octave_idx_type (*select_function) (const float&, const float&); | typedef octave_idx_type (*select_function) (const float&, const float&); | |||
private: | private: | |||
FloatMatrix schur_mat; | FloatMatrix schur_mat; | |||
FloatMatrix unitary_mat; | FloatMatrix unitary_mat; | |||
select_function selector; | select_function selector; | |||
octave_idx_type init (const FloatMatrix& a, const std::string& ord, bool | octave_idx_type init (const FloatMatrix& a, const std::string& ord, | |||
calc_unitary); | bool calc_unitary); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
20 lines changed or deleted | 20 lines changed or added | |||
floatSVD.h | floatSVD.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_FloatSVD_h) | #if !defined (octave_floatSVD_h) | |||
#define octave_FloatSVD_h 1 | #define octave_floatSVD_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "fDiagMatrix.h" | #include "fDiagMatrix.h" | |||
#include "fMatrix.h" | #include "fMatrix.h" | |||
#include "dbleSVD.h" | #include "dbleSVD.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
FloatSVD | FloatSVD | |||
{ | { | |||
public: | public: | |||
FloatSVD (void) : type_computed (), sigma (), left_sm (), right_sm () { } | FloatSVD (void) : type_computed (), sigma (), left_sm (), right_sm () { } | |||
FloatSVD (const FloatMatrix& a, | FloatSVD (const FloatMatrix& a, | |||
SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GE SVD) | SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GE SVD) | |||
: type_computed (), sigma (), left_sm (), right_sm () | : type_computed (), sigma (), left_sm (), right_sm () | |||
{ | { | |||
init (a, svd_type, svd_driver); | init (a, svd_type, svd_driver); | |||
} | } | |||
FloatSVD (const FloatMatrix& a, octave_idx_type& info, | FloatSVD (const FloatMatrix& a, octave_idx_type& info, | |||
SVD::type svd_type = SVD::std, | SVD::type svd_type = SVD::std, | |||
SVD::driver svd_driver = SVD::GESVD) | SVD::driver svd_driver = SVD::GESVD) | |||
: type_computed (), sigma (), left_sm (), right_sm () | : type_computed (), sigma (), left_sm (), right_sm () | |||
{ | { | |||
info = init (a, svd_type, svd_driver); | info = init (a, svd_type, svd_driver); | |||
} | } | |||
FloatSVD (const FloatSVD& a) | FloatSVD (const FloatSVD& a) | |||
: type_computed (a.type_computed), sigma (a.sigma), | : type_computed (a.type_computed), sigma (a.sigma), | |||
left_sm (a.left_sm), right_sm (a.right_sm) | left_sm (a.left_sm), right_sm (a.right_sm) | |||
{ } | { } | |||
FloatSVD& operator = (const FloatSVD& a) | FloatSVD& operator = (const FloatSVD& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
type_computed = a.type_computed; | type_computed = a.type_computed; | |||
sigma = a.sigma; | sigma = a.sigma; | |||
left_sm = a.left_sm; | left_sm = a.left_sm; | |||
right_sm = a.right_sm; | right_sm = a.right_sm; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~FloatSVD (void) { } | ~FloatSVD (void) { } | |||
FloatDiagMatrix singular_values (void) const { return sigma; } | FloatDiagMatrix singular_values (void) const { return sigma; } | |||
FloatMatrix left_singular_matrix (void) const; | FloatMatrix left_singular_matrix (void) const; | |||
FloatMatrix right_singular_matrix (void) const; | FloatMatrix right_singular_matrix (void) const; | |||
friend std::ostream& operator << (std::ostream& os, const FloatSVD& a); | friend std::ostream& operator << (std::ostream& os, const FloatSVD& a); | |||
End of changes. 7 change blocks. | ||||
20 lines changed or deleted | 20 lines changed or added | |||
functor.h | functor.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 John W. Eaton | Copyright (C) 2008-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
gl-render.h | gl-render.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Michael Goffioul | Copyright (C) 2008-2013 Michael Goffioul | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (gl_render_h) | #if !defined (octave_gl_render_h) | |||
#define gl_render_h 1 | #define octave_gl_render_h 1 | |||
#ifdef HAVE_WINDOWS_H | #ifdef HAVE_WINDOWS_H | |||
#define WIN32_LEAN_AND_MEAN | #define WIN32_LEAN_AND_MEAN | |||
#include <windows.h> | #include <windows.h> | |||
#endif | #endif | |||
#ifdef HAVE_GL_GL_H | #ifdef HAVE_GL_GL_H | |||
#include <GL/gl.h> | #include <GL/gl.h> | |||
#elif defined HAVE_OPENGL_GL_H || defined HAVE_FRAMEWORK_OPENGL | #elif defined HAVE_OPENGL_GL_H || defined HAVE_FRAMEWORK_OPENGL | |||
#include <OpenGL/gl.h> | #include <OpenGL/gl.h> | |||
skipping to change at line 93 | skipping to change at line 93 | |||
virtual void draw_line (const line::properties& props); | virtual void draw_line (const line::properties& props); | |||
virtual void draw_surface (const surface::properties& props); | virtual void draw_surface (const surface::properties& props); | |||
virtual void draw_patch (const patch::properties& props); | virtual void draw_patch (const patch::properties& props); | |||
virtual void draw_hggroup (const hggroup::properties& props); | virtual void draw_hggroup (const hggroup::properties& props); | |||
virtual void draw_text (const text::properties& props); | virtual void draw_text (const text::properties& props); | |||
virtual void draw_image (const image::properties& props); | virtual void draw_image (const image::properties& props); | |||
virtual void draw_uipanel (const uipanel::properties& props, | virtual void draw_uipanel (const uipanel::properties& props, | |||
const graphics_object& go); | const graphics_object& go); | |||
virtual void init_gl_context (bool enhanced, const Matrix& backgroundColo r); | virtual void init_gl_context (bool enhanced, const Matrix& backgroundColo r); | |||
virtual void setup_opengl_transformation (const axes::properties& props); | ||||
virtual void set_color (const Matrix& c); | virtual void set_color (const Matrix& c); | |||
virtual void set_polygon_offset (bool on, double offset = 0.0); | virtual void set_polygon_offset (bool on, double offset = 0.0); | |||
virtual void set_linewidth (float w); | virtual void set_linewidth (float w); | |||
virtual void set_linestyle (const std::string& s, bool stipple = false); | virtual void set_linestyle (const std::string& s, bool stipple = false); | |||
virtual void set_clipbox (double x1, double x2, double y1, double y2, | virtual void set_clipbox (double x1, double x2, double y1, double y2, | |||
double z1, double z2); | double z1, double z2); | |||
virtual void set_clipping (bool on); | virtual void set_clipping (bool on); | |||
virtual void set_font (const base_properties& props); | virtual void set_font (const base_properties& props); | |||
skipping to change at line 171 | skipping to change at line 172 | |||
| (y < ymin ? 1 : 0) << 2 | | (y < ymin ? 1 : 0) << 2 | |||
| (y > ymax ? 1 : 0) << 3 | | (y > ymax ? 1 : 0) << 3 | |||
| (z < zmin ? 1 : 0) << 4 | | (z < zmin ? 1 : 0) << 4 | |||
| (z > zmax ? 1 : 0) << 5 | | (z > zmax ? 1 : 0) << 5 | |||
| (is_nan_or_inf (x, y, z) ? 0 : 1) << 6); | | (is_nan_or_inf (x, y, z) ? 0 : 1) << 6); | |||
} | } | |||
unsigned int make_marker_list (const std::string& m, double size, | unsigned int make_marker_list (const std::string& m, double size, | |||
bool filled) const; | bool filled) const; | |||
void setup_opengl_transformation (const axes::properties& props); | ||||
void draw_axes_planes (const axes::properties& props); | void draw_axes_planes (const axes::properties& props); | |||
void draw_axes_boxes (const axes::properties& props); | void draw_axes_boxes (const axes::properties& props); | |||
void draw_axes_x_grid (const axes::properties& props); | void draw_axes_x_grid (const axes::properties& props); | |||
void draw_axes_y_grid (const axes::properties& props); | void draw_axes_y_grid (const axes::properties& props); | |||
void draw_axes_z_grid (const axes::properties& props); | void draw_axes_z_grid (const axes::properties& props); | |||
void draw_axes_children (const axes::properties& props); | void draw_axes_children (const axes::properties& props); | |||
private: | private: | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 4 lines changed or added | |||
gl2ps-renderer.h | gl2ps-renderer.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 Shai Ayal | Copyright (C) 2009-2013 Shai Ayal | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (gl2ps_renderer_h) | #if !defined (octave_gl2ps_renderer_h) | |||
#define gl2ps_renderer_h 1 | #define octave_gl2ps_renderer_h 1 | |||
#ifdef HAVE_GL2PS_H | ||||
#include "gl-render.h" | #include "gl-render.h" | |||
#include "gl2ps.h" | #include <gl2ps.h> | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
glps_renderer : public opengl_renderer | glps_renderer : public opengl_renderer | |||
{ | { | |||
public: | public: | |||
glps_renderer (const int _fid, const std::string& _term) | glps_renderer (FILE *_fp, const std::string& _term) | |||
: opengl_renderer () , fid (_fid), term (_term), | : opengl_renderer () , fp (_fp), term (_term), fontsize (), fontname () | |||
fontsize (), fontname () { } | { } | |||
~glps_renderer (void) { } | ~glps_renderer (void) { } | |||
void draw (const graphics_object& go); | void draw (const graphics_object& go, const std::string print_cmd); | |||
protected: | protected: | |||
Matrix render_text (const std::string& txt, | Matrix render_text (const std::string& txt, | |||
double x, double y, double z, | double x, double y, double z, | |||
int halign, int valign, double rotation = 0.0); | int halign, int valign, double rotation = 0.0); | |||
void set_font (const base_properties& props); | void set_font (const base_properties& props); | |||
void draw_text (const text::properties& props); | void draw_text (const text::properties& props); | |||
void draw_pixels (GLsizei w, GLsizei h, GLenum format, | void draw_pixels (GLsizei w, GLsizei h, GLenum format, | |||
GLenum type, const GLvoid *data); | GLenum type, const GLvoid *data); | |||
void set_linestyle (const std::string& s, bool use_stipple) | void set_linestyle (const std::string& s, bool use_stipple = false) | |||
{ | { | |||
opengl_renderer::set_linestyle (s, use_stipple); | opengl_renderer::set_linestyle (s, use_stipple); | |||
if (use_stipple) | ||||
gl2psEnable (GL2PS_LINE_STIPPLE); | if (s == "-" && ! use_stipple) | |||
else | ||||
gl2psDisable (GL2PS_LINE_STIPPLE); | gl2psDisable (GL2PS_LINE_STIPPLE); | |||
else | ||||
gl2psEnable (GL2PS_LINE_STIPPLE); | ||||
} | } | |||
void set_polygon_offset (bool on, double offset = 0.0) | void set_polygon_offset (bool on, double offset = 0.0) | |||
{ | { | |||
opengl_renderer::set_polygon_offset (on, offset); | opengl_renderer::set_polygon_offset (on, offset); | |||
if (on) | if (on) | |||
gl2psEnable (GL2PS_POLYGON_OFFSET_FILL); | gl2psEnable (GL2PS_POLYGON_OFFSET_FILL); | |||
else | else | |||
gl2psDisable (GL2PS_POLYGON_OFFSET_FILL); | gl2psDisable (GL2PS_POLYGON_OFFSET_FILL); | |||
} | } | |||
void set_linewidth (float w) | void set_linewidth (float w) | |||
{ | { | |||
gl2psLineWidth (w); | gl2psLineWidth (w); | |||
} | } | |||
private: | private: | |||
int alignment_to_mode (int ha, int va) const; | int alignment_to_mode (int ha, int va) const; | |||
int fid; | FILE *fp; | |||
caseless_str term; | caseless_str term; | |||
double fontsize; | double fontsize; | |||
std::string fontname; | std::string fontname; | |||
}; | }; | |||
#endif // HAVE_GL2PS_H | ||||
#endif | #endif | |||
End of changes. 10 change blocks. | ||||
13 lines changed or deleted | 18 lines changed or added | |||
glob-match.h | glob-match.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
graphics-props.cc | graphics-props.cc | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
createfcn ("createfcn", mh, Matrix ()), | createfcn ("createfcn", mh, Matrix ()), | |||
deletefcn ("deletefcn", mh, Matrix ()), | deletefcn ("deletefcn", mh, Matrix ()), | |||
handlevisibility ("handlevisibility", mh, "{on}|callback|off"), | handlevisibility ("handlevisibility", mh, "{on}|callback|off"), | |||
hittest ("hittest", mh, "on"), | hittest ("hittest", mh, "on"), | |||
interruptible ("interruptible", mh, "on"), | interruptible ("interruptible", mh, "on"), | |||
parent ("parent", mh, p), | parent ("parent", mh, p), | |||
selected ("selected", mh, "off"), | selected ("selected", mh, "off"), | |||
selectionhighlight ("selectionhighlight", mh, "on"), | selectionhighlight ("selectionhighlight", mh, "on"), | |||
tag ("tag", mh, ""), | tag ("tag", mh, ""), | |||
type ("type", mh, ty), | type ("type", mh, ty), | |||
uicontextmenu ("uicontextmenu", mh, graphics_handle ()), | ||||
userdata ("userdata", mh, Matrix ()), | userdata ("userdata", mh, Matrix ()), | |||
visible ("visible", mh, "on"), | visible ("visible", mh, "on"), | |||
__modified__ ("__modified__", mh, "on"), | __modified__ ("__modified__", mh, "on"), | |||
__myhandle__ (mh), | __myhandle__ (mh) | |||
uicontextmenu ("uicontextmenu", mh, graphics_handle ()) | ||||
{ | { | |||
beingdeleted.set_id (ID_BEINGDELETED); | beingdeleted.set_id (ID_BEINGDELETED); | |||
busyaction.set_id (ID_BUSYACTION); | busyaction.set_id (ID_BUSYACTION); | |||
buttondownfcn.set_id (ID_BUTTONDOWNFCN); | buttondownfcn.set_id (ID_BUTTONDOWNFCN); | |||
children.set_id (ID_CHILDREN); | children.set_id (ID_CHILDREN); | |||
clipping.set_id (ID_CLIPPING); | clipping.set_id (ID_CLIPPING); | |||
createfcn.set_id (ID_CREATEFCN); | createfcn.set_id (ID_CREATEFCN); | |||
deletefcn.set_id (ID_DELETEFCN); | deletefcn.set_id (ID_DELETEFCN); | |||
handlevisibility.set_id (ID_HANDLEVISIBILITY); | handlevisibility.set_id (ID_HANDLEVISIBILITY); | |||
hittest.set_id (ID_HITTEST); | hittest.set_id (ID_HITTEST); | |||
interruptible.set_id (ID_INTERRUPTIBLE); | interruptible.set_id (ID_INTERRUPTIBLE); | |||
parent.set_id (ID_PARENT); | parent.set_id (ID_PARENT); | |||
selected.set_id (ID_SELECTED); | selected.set_id (ID_SELECTED); | |||
selectionhighlight.set_id (ID_SELECTIONHIGHLIGHT); | selectionhighlight.set_id (ID_SELECTIONHIGHLIGHT); | |||
tag.set_id (ID_TAG); | tag.set_id (ID_TAG); | |||
type.set_id (ID_TYPE); | type.set_id (ID_TYPE); | |||
uicontextmenu.set_id (ID_UICONTEXTMENU); | ||||
userdata.set_id (ID_USERDATA); | userdata.set_id (ID_USERDATA); | |||
visible.set_id (ID_VISIBLE); | visible.set_id (ID_VISIBLE); | |||
__modified__.set_id (ID___MODIFIED__); | __modified__.set_id (ID___MODIFIED__); | |||
uicontextmenu.set_id (ID_UICONTEXTMENU); | ||||
init (); | init (); | |||
} | } | |||
void | void | |||
base_properties::set (const caseless_str& pname, const octave_value& val) | base_properties::set (const caseless_str& pname, const octave_value& val) | |||
{ | { | |||
if (pname.compare ("beingdeleted")) | if (pname.compare ("beingdeleted")) | |||
set_beingdeleted (val); | set_beingdeleted (val); | |||
else if (pname.compare ("busyaction")) | else if (pname.compare ("busyaction")) | |||
set_busyaction (val); | set_busyaction (val); | |||
skipping to change at line 80 | skipping to change at line 80 | |||
else if (pname.compare ("interruptible")) | else if (pname.compare ("interruptible")) | |||
set_interruptible (val); | set_interruptible (val); | |||
else if (pname.compare ("parent")) | else if (pname.compare ("parent")) | |||
set_parent (val); | set_parent (val); | |||
else if (pname.compare ("selected")) | else if (pname.compare ("selected")) | |||
set_selected (val); | set_selected (val); | |||
else if (pname.compare ("selectionhighlight")) | else if (pname.compare ("selectionhighlight")) | |||
set_selectionhighlight (val); | set_selectionhighlight (val); | |||
else if (pname.compare ("tag")) | else if (pname.compare ("tag")) | |||
set_tag (val); | set_tag (val); | |||
else if (pname.compare ("uicontextmenu")) | ||||
set_uicontextmenu (val); | ||||
else if (pname.compare ("userdata")) | else if (pname.compare ("userdata")) | |||
set_userdata (val); | set_userdata (val); | |||
else if (pname.compare ("visible")) | else if (pname.compare ("visible")) | |||
set_visible (val); | set_visible (val); | |||
else if (pname.compare ("__modified__")) | else if (pname.compare ("__modified__")) | |||
set___modified__ (val); | set___modified__ (val); | |||
else if (pname.compare ("uicontextmenu")) | ||||
set_uicontextmenu (val); | ||||
else | else | |||
set_dynamic (pname, val); | set_dynamic (pname, val); | |||
} | } | |||
octave_value | octave_value | |||
base_properties::get (bool all) const | base_properties::get (bool all) const | |||
{ | { | |||
octave_map m = get_dynamic (all).map_value (); | octave_map m = get_dynamic (all).map_value (); | |||
m.assign ("beingdeleted", octave_value (get_beingdeleted ())); | m.assign ("beingdeleted", octave_value (get_beingdeleted ())); | |||
skipping to change at line 112 | skipping to change at line 112 | |||
m.assign ("createfcn", octave_value (get_createfcn ())); | m.assign ("createfcn", octave_value (get_createfcn ())); | |||
m.assign ("deletefcn", octave_value (get_deletefcn ())); | m.assign ("deletefcn", octave_value (get_deletefcn ())); | |||
m.assign ("handlevisibility", octave_value (get_handlevisibility ())); | m.assign ("handlevisibility", octave_value (get_handlevisibility ())); | |||
m.assign ("hittest", octave_value (get_hittest ())); | m.assign ("hittest", octave_value (get_hittest ())); | |||
m.assign ("interruptible", octave_value (get_interruptible ())); | m.assign ("interruptible", octave_value (get_interruptible ())); | |||
m.assign ("parent", octave_value (get_parent ().as_octave_value ())); | m.assign ("parent", octave_value (get_parent ().as_octave_value ())); | |||
m.assign ("selected", octave_value (get_selected ())); | m.assign ("selected", octave_value (get_selected ())); | |||
m.assign ("selectionhighlight", octave_value (get_selectionhighlight ())) ; | m.assign ("selectionhighlight", octave_value (get_selectionhighlight ())) ; | |||
m.assign ("tag", octave_value (get_tag ())); | m.assign ("tag", octave_value (get_tag ())); | |||
m.assign ("type", octave_value (get_type ())); | m.assign ("type", octave_value (get_type ())); | |||
m.assign ("uicontextmenu", octave_value (get_uicontextmenu ().as_octave_v alue ())); | ||||
m.assign ("userdata", octave_value (get_userdata ())); | m.assign ("userdata", octave_value (get_userdata ())); | |||
m.assign ("visible", octave_value (get_visible ())); | m.assign ("visible", octave_value (get_visible ())); | |||
m.assign ("__modified__", octave_value (get___modified__ ())); | m.assign ("__modified__", octave_value (get___modified__ ())); | |||
if (all) | if (all) | |||
m.assign ("__myhandle__", octave_value (get___myhandle__ ().as_octave_v alue ())); | m.assign ("__myhandle__", octave_value (get___myhandle__ ().as_octave_v alue ())); | |||
m.assign ("uicontextmenu", octave_value (get_uicontextmenu ().as_octave_v alue ())); | ||||
return m; | return m; | |||
} | } | |||
octave_value | octave_value | |||
base_properties::get (const caseless_str& pname) const | base_properties::get (const caseless_str& pname) const | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
if (pname.compare ("beingdeleted")) | if (pname.compare ("beingdeleted")) | |||
skipping to change at line 157 | skipping to change at line 157 | |||
else if (pname.compare ("parent")) | else if (pname.compare ("parent")) | |||
retval = get_parent ().as_octave_value (); | retval = get_parent ().as_octave_value (); | |||
else if (pname.compare ("selected")) | else if (pname.compare ("selected")) | |||
retval = get_selected (); | retval = get_selected (); | |||
else if (pname.compare ("selectionhighlight")) | else if (pname.compare ("selectionhighlight")) | |||
retval = get_selectionhighlight (); | retval = get_selectionhighlight (); | |||
else if (pname.compare ("tag")) | else if (pname.compare ("tag")) | |||
retval = get_tag (); | retval = get_tag (); | |||
else if (pname.compare ("type")) | else if (pname.compare ("type")) | |||
retval = get_type (); | retval = get_type (); | |||
else if (pname.compare ("uicontextmenu")) | ||||
retval = get_uicontextmenu ().as_octave_value (); | ||||
else if (pname.compare ("userdata")) | else if (pname.compare ("userdata")) | |||
retval = get_userdata (); | retval = get_userdata (); | |||
else if (pname.compare ("visible")) | else if (pname.compare ("visible")) | |||
retval = get_visible (); | retval = get_visible (); | |||
else if (pname.compare ("__modified__")) | else if (pname.compare ("__modified__")) | |||
retval = get___modified__ (); | retval = get___modified__ (); | |||
else if (pname.compare ("__myhandle__")) | else if (pname.compare ("__myhandle__")) | |||
retval = get___myhandle__ ().as_octave_value (); | retval = get___myhandle__ ().as_octave_value (); | |||
else if (pname.compare ("uicontextmenu")) | ||||
retval = get_uicontextmenu ().as_octave_value (); | ||||
else | else | |||
retval = get_dynamic (pname); | retval = get_dynamic (pname); | |||
return retval; | return retval; | |||
} | } | |||
property | property | |||
base_properties::get_property (const caseless_str& pname) | base_properties::get_property (const caseless_str& pname) | |||
{ | { | |||
if (pname.compare ("beingdeleted")) | if (pname.compare ("beingdeleted")) | |||
skipping to change at line 206 | skipping to change at line 206 | |||
else if (pname.compare ("parent")) | else if (pname.compare ("parent")) | |||
return property (&parent, true); | return property (&parent, true); | |||
else if (pname.compare ("selected")) | else if (pname.compare ("selected")) | |||
return property (&selected, true); | return property (&selected, true); | |||
else if (pname.compare ("selectionhighlight")) | else if (pname.compare ("selectionhighlight")) | |||
return property (&selectionhighlight, true); | return property (&selectionhighlight, true); | |||
else if (pname.compare ("tag")) | else if (pname.compare ("tag")) | |||
return property (&tag, true); | return property (&tag, true); | |||
else if (pname.compare ("type")) | else if (pname.compare ("type")) | |||
return property (&type, true); | return property (&type, true); | |||
else if (pname.compare ("uicontextmenu")) | ||||
return property (&uicontextmenu, true); | ||||
else if (pname.compare ("userdata")) | else if (pname.compare ("userdata")) | |||
return property (&userdata, true); | return property (&userdata, true); | |||
else if (pname.compare ("visible")) | else if (pname.compare ("visible")) | |||
return property (&visible, true); | return property (&visible, true); | |||
else if (pname.compare ("__modified__")) | else if (pname.compare ("__modified__")) | |||
return property (&__modified__, true); | return property (&__modified__, true); | |||
else if (pname.compare ("uicontextmenu")) | ||||
return property (&uicontextmenu, true); | ||||
else | else | |||
return get_property_dynamic (pname); | return get_property_dynamic (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
base_properties::factory_defaults (void) | base_properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m; | property_list::pval_map_type m; | |||
m["beingdeleted"] = "off"; | m["beingdeleted"] = "off"; | |||
skipping to change at line 235 | skipping to change at line 235 | |||
m["buttondownfcn"] = Matrix (); | m["buttondownfcn"] = Matrix (); | |||
m["clipping"] = "on"; | m["clipping"] = "on"; | |||
m["createfcn"] = Matrix (); | m["createfcn"] = Matrix (); | |||
m["deletefcn"] = Matrix (); | m["deletefcn"] = Matrix (); | |||
m["handlevisibility"] = "on"; | m["handlevisibility"] = "on"; | |||
m["hittest"] = "on"; | m["hittest"] = "on"; | |||
m["interruptible"] = "on"; | m["interruptible"] = "on"; | |||
m["selected"] = "off"; | m["selected"] = "off"; | |||
m["selectionhighlight"] = "on"; | m["selectionhighlight"] = "on"; | |||
m["tag"] = ""; | m["tag"] = ""; | |||
m["uicontextmenu"] = graphics_handle ().as_octave_value (); | ||||
m["userdata"] = Matrix (); | m["userdata"] = Matrix (); | |||
m["visible"] = "on"; | m["visible"] = "on"; | |||
m["__modified__"] = "on"; | m["__modified__"] = "on"; | |||
m["uicontextmenu"] = graphics_handle ().as_octave_value (); | ||||
return m; | return m; | |||
} | } | |||
std::set<std::string> | std::set<std::string> | |||
base_properties::core_property_names (void) | base_properties::core_property_names (void) | |||
{ | { | |||
static std::set<std::string> all_pnames; | static std::set<std::string> all_pnames; | |||
static bool initialized = false; | static bool initialized = false; | |||
skipping to change at line 267 | skipping to change at line 267 | |||
all_pnames.insert ("createfcn"); | all_pnames.insert ("createfcn"); | |||
all_pnames.insert ("deletefcn"); | all_pnames.insert ("deletefcn"); | |||
all_pnames.insert ("handlevisibility"); | all_pnames.insert ("handlevisibility"); | |||
all_pnames.insert ("hittest"); | all_pnames.insert ("hittest"); | |||
all_pnames.insert ("interruptible"); | all_pnames.insert ("interruptible"); | |||
all_pnames.insert ("parent"); | all_pnames.insert ("parent"); | |||
all_pnames.insert ("selected"); | all_pnames.insert ("selected"); | |||
all_pnames.insert ("selectionhighlight"); | all_pnames.insert ("selectionhighlight"); | |||
all_pnames.insert ("tag"); | all_pnames.insert ("tag"); | |||
all_pnames.insert ("type"); | all_pnames.insert ("type"); | |||
all_pnames.insert ("uicontextmenu"); | ||||
all_pnames.insert ("userdata"); | all_pnames.insert ("userdata"); | |||
all_pnames.insert ("visible"); | all_pnames.insert ("visible"); | |||
all_pnames.insert ("__modified__"); | all_pnames.insert ("__modified__"); | |||
all_pnames.insert ("__myhandle__"); | all_pnames.insert ("__myhandle__"); | |||
all_pnames.insert ("uicontextmenu"); | ||||
initialized = true; | initialized = true; | |||
} | } | |||
return all_pnames; | return all_pnames; | |||
} | } | |||
bool | bool | |||
base_properties::has_core_property (const caseless_str& pname) | base_properties::has_core_property (const caseless_str& pname) | |||
{ | { | |||
skipping to change at line 312 | skipping to change at line 312 | |||
// ******** root_figure ******** | // ******** root_figure ******** | |||
root_figure::properties::properties (const graphics_handle& mh, const graph ics_handle& p) | root_figure::properties::properties (const graphics_handle& mh, const graph ics_handle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
callbackobject ("callbackobject", mh, graphics_handle ()), | callbackobject ("callbackobject", mh, graphics_handle ()), | |||
commandwindowsize ("commandwindowsize", mh, Matrix (1, 2, 0)), | commandwindowsize ("commandwindowsize", mh, Matrix (1, 2, 0)), | |||
currentfigure ("currentfigure", mh, graphics_handle ()), | currentfigure ("currentfigure", mh, graphics_handle ()), | |||
diary ("diary", mh, "off"), | diary ("diary", mh, "off"), | |||
diaryfile ("diaryfile", mh, "diary"), | diaryfile ("diaryfile", mh, "diary"), | |||
echo ("echo", mh, "off"), | echo ("echo", mh, "off"), | |||
format ("format", mh, "+|bank|bit|debug|hex|long|longe|longeng|longg|na | errormessage ("errormessage", mh, ""), | |||
tive-bit|native-hex|rational|{short}|shorte|shorteng|shortg"), | fixedwidthfontname ("fixedwidthfontname", mh, "Courier"), | |||
formatspacing ("formatspacing", mh, "{loose}|compact"), | format ("format", mh, "+|bank|bit|hex|long|longe|longeng|longg|native-b | |||
it|native-hex|none|rational|{short}|shorte|shorteng|shortg"), | ||||
formatspacing ("formatspacing", mh, "compact|{loose}"), | ||||
language ("language", mh, "ascii"), | language ("language", mh, "ascii"), | |||
monitorpositions ("monitorpositions", mh, Matrix (1, 4, 0)), | monitorpositions ("monitorpositions", mh, Matrix (1, 4, 0)), | |||
pointerlocation ("pointerlocation", mh, Matrix (1, 2, 0)), | pointerlocation ("pointerlocation", mh, Matrix (1, 2, 0)), | |||
pointerwindow ("pointerwindow", mh, 0.0), | pointerwindow ("pointerwindow", mh, 0.0), | |||
recursionlimit ("recursionlimit", mh, 256.0), | recursionlimit ("recursionlimit", mh, 256.0), | |||
screendepth ("screendepth", mh, default_screendepth ()), | screendepth ("screendepth", mh, default_screendepth ()), | |||
screenpixelsperinch ("screenpixelsperinch", mh, default_screenpixelsper inch ()), | screenpixelsperinch ("screenpixelsperinch", mh, default_screenpixelsper inch ()), | |||
screensize ("screensize", mh, default_screensize ()), | screensize ("screensize", mh, default_screensize ()), | |||
showhiddenhandles ("showhiddenhandles", mh, "off"), | showhiddenhandles ("showhiddenhandles", mh, "off"), | |||
units ("units", mh, "inches|centimeters|normalized|points|{pixels}") | units ("units", mh, "inches|centimeters|normalized|points|{pixels}") | |||
{ | { | |||
callbackobject.set_id (ID_CALLBACKOBJECT); | callbackobject.set_id (ID_CALLBACKOBJECT); | |||
commandwindowsize.set_id (ID_COMMANDWINDOWSIZE); | commandwindowsize.set_id (ID_COMMANDWINDOWSIZE); | |||
currentfigure.set_id (ID_CURRENTFIGURE); | currentfigure.set_id (ID_CURRENTFIGURE); | |||
diary.set_id (ID_DIARY); | diary.set_id (ID_DIARY); | |||
diaryfile.set_id (ID_DIARYFILE); | diaryfile.set_id (ID_DIARYFILE); | |||
echo.set_id (ID_ECHO); | echo.set_id (ID_ECHO); | |||
errormessage.set_id (ID_ERRORMESSAGE); | ||||
fixedwidthfontname.set_id (ID_FIXEDWIDTHFONTNAME); | ||||
format.set_id (ID_FORMAT); | format.set_id (ID_FORMAT); | |||
formatspacing.set_id (ID_FORMATSPACING); | formatspacing.set_id (ID_FORMATSPACING); | |||
language.set_id (ID_LANGUAGE); | language.set_id (ID_LANGUAGE); | |||
monitorpositions.set_id (ID_MONITORPOSITIONS); | monitorpositions.set_id (ID_MONITORPOSITIONS); | |||
pointerlocation.set_id (ID_POINTERLOCATION); | pointerlocation.set_id (ID_POINTERLOCATION); | |||
pointerwindow.set_id (ID_POINTERWINDOW); | pointerwindow.set_id (ID_POINTERWINDOW); | |||
recursionlimit.set_id (ID_RECURSIONLIMIT); | recursionlimit.set_id (ID_RECURSIONLIMIT); | |||
screendepth.set_id (ID_SCREENDEPTH); | screendepth.set_id (ID_SCREENDEPTH); | |||
screenpixelsperinch.set_id (ID_SCREENPIXELSPERINCH); | screenpixelsperinch.set_id (ID_SCREENPIXELSPERINCH); | |||
screensize.set_id (ID_SCREENSIZE); | screensize.set_id (ID_SCREENSIZE); | |||
skipping to change at line 364 | skipping to change at line 368 | |||
return; | return; | |||
if (pname.compare ("currentfigure")) | if (pname.compare ("currentfigure")) | |||
set_currentfigure (val); | set_currentfigure (val); | |||
else if (pname.compare ("diary")) | else if (pname.compare ("diary")) | |||
set_diary (val); | set_diary (val); | |||
else if (pname.compare ("diaryfile")) | else if (pname.compare ("diaryfile")) | |||
set_diaryfile (val); | set_diaryfile (val); | |||
else if (pname.compare ("echo")) | else if (pname.compare ("echo")) | |||
set_echo (val); | set_echo (val); | |||
else if (pname.compare ("errormessage")) | ||||
set_errormessage (val); | ||||
else if (pname.compare ("fixedwidthfontname")) | ||||
set_fixedwidthfontname (val); | ||||
else if (pname.compare ("format")) | else if (pname.compare ("format")) | |||
set_format (val); | set_format (val); | |||
else if (pname.compare ("formatspacing")) | else if (pname.compare ("formatspacing")) | |||
set_formatspacing (val); | set_formatspacing (val); | |||
else if (pname.compare ("language")) | else if (pname.compare ("language")) | |||
set_language (val); | set_language (val); | |||
else if (pname.compare ("monitorpositions")) | else if (pname.compare ("monitorpositions")) | |||
set_monitorpositions (val); | set_monitorpositions (val); | |||
else if (pname.compare ("pointerlocation")) | else if (pname.compare ("pointerlocation")) | |||
set_pointerlocation (val); | set_pointerlocation (val); | |||
else if (pname.compare ("pointerwindow")) | ||||
set_pointerwindow (val); | ||||
else if (pname.compare ("recursionlimit")) | else if (pname.compare ("recursionlimit")) | |||
set_recursionlimit (val); | set_recursionlimit (val); | |||
else if (pname.compare ("showhiddenhandles")) | else if (pname.compare ("showhiddenhandles")) | |||
set_showhiddenhandles (val); | set_showhiddenhandles (val); | |||
else if (pname.compare ("units")) | else if (pname.compare ("units")) | |||
set_units (val); | set_units (val); | |||
else | else | |||
base_properties::set (pname, val); | base_properties::set (pname, val); | |||
} | } | |||
skipping to change at line 397 | skipping to change at line 403 | |||
root_figure::properties::get (bool all) const | root_figure::properties::get (bool all) const | |||
{ | { | |||
octave_map m = base_properties::get (all).map_value (); | octave_map m = base_properties::get (all).map_value (); | |||
m.assign ("callbackobject", octave_value (get_callbackobject ().as_octave _value ())); | m.assign ("callbackobject", octave_value (get_callbackobject ().as_octave _value ())); | |||
m.assign ("commandwindowsize", octave_value (get_commandwindowsize ())); | m.assign ("commandwindowsize", octave_value (get_commandwindowsize ())); | |||
m.assign ("currentfigure", octave_value (get_currentfigure ().as_octave_v alue ())); | m.assign ("currentfigure", octave_value (get_currentfigure ().as_octave_v alue ())); | |||
m.assign ("diary", octave_value (get_diary ())); | m.assign ("diary", octave_value (get_diary ())); | |||
m.assign ("diaryfile", octave_value (get_diaryfile ())); | m.assign ("diaryfile", octave_value (get_diaryfile ())); | |||
m.assign ("echo", octave_value (get_echo ())); | m.assign ("echo", octave_value (get_echo ())); | |||
m.assign ("errormessage", octave_value (get_errormessage ())); | ||||
m.assign ("fixedwidthfontname", octave_value (get_fixedwidthfontname ())) | ||||
; | ||||
m.assign ("format", octave_value (get_format ())); | m.assign ("format", octave_value (get_format ())); | |||
m.assign ("formatspacing", octave_value (get_formatspacing ())); | m.assign ("formatspacing", octave_value (get_formatspacing ())); | |||
m.assign ("language", octave_value (get_language ())); | m.assign ("language", octave_value (get_language ())); | |||
m.assign ("monitorpositions", octave_value (get_monitorpositions ())); | m.assign ("monitorpositions", octave_value (get_monitorpositions ())); | |||
m.assign ("pointerlocation", octave_value (get_pointerlocation ())); | m.assign ("pointerlocation", octave_value (get_pointerlocation ())); | |||
m.assign ("pointerwindow", octave_value (get_pointerwindow ())); | m.assign ("pointerwindow", octave_value (get_pointerwindow ())); | |||
m.assign ("recursionlimit", octave_value (get_recursionlimit ())); | m.assign ("recursionlimit", octave_value (get_recursionlimit ())); | |||
m.assign ("screendepth", octave_value (get_screendepth ())); | m.assign ("screendepth", octave_value (get_screendepth ())); | |||
m.assign ("screenpixelsperinch", octave_value (get_screenpixelsperinch () )); | m.assign ("screenpixelsperinch", octave_value (get_screenpixelsperinch () )); | |||
m.assign ("screensize", octave_value (get_screensize ())); | m.assign ("screensize", octave_value (get_screensize ())); | |||
skipping to change at line 437 | skipping to change at line 445 | |||
else if (pname.compare ("commandwindowsize")) | else if (pname.compare ("commandwindowsize")) | |||
retval = get_commandwindowsize (); | retval = get_commandwindowsize (); | |||
else if (pname.compare ("currentfigure")) | else if (pname.compare ("currentfigure")) | |||
retval = get_currentfigure ().as_octave_value (); | retval = get_currentfigure ().as_octave_value (); | |||
else if (pname.compare ("diary")) | else if (pname.compare ("diary")) | |||
retval = get_diary (); | retval = get_diary (); | |||
else if (pname.compare ("diaryfile")) | else if (pname.compare ("diaryfile")) | |||
retval = get_diaryfile (); | retval = get_diaryfile (); | |||
else if (pname.compare ("echo")) | else if (pname.compare ("echo")) | |||
retval = get_echo (); | retval = get_echo (); | |||
else if (pname.compare ("errormessage")) | ||||
retval = get_errormessage (); | ||||
else if (pname.compare ("fixedwidthfontname")) | ||||
retval = get_fixedwidthfontname (); | ||||
else if (pname.compare ("format")) | else if (pname.compare ("format")) | |||
retval = get_format (); | retval = get_format (); | |||
else if (pname.compare ("formatspacing")) | else if (pname.compare ("formatspacing")) | |||
retval = get_formatspacing (); | retval = get_formatspacing (); | |||
else if (pname.compare ("language")) | else if (pname.compare ("language")) | |||
retval = get_language (); | retval = get_language (); | |||
else if (pname.compare ("monitorpositions")) | else if (pname.compare ("monitorpositions")) | |||
retval = get_monitorpositions (); | retval = get_monitorpositions (); | |||
else if (pname.compare ("pointerlocation")) | else if (pname.compare ("pointerlocation")) | |||
retval = get_pointerlocation (); | retval = get_pointerlocation (); | |||
skipping to change at line 489 | skipping to change at line 501 | |||
else if (pname.compare ("commandwindowsize")) | else if (pname.compare ("commandwindowsize")) | |||
return property (&commandwindowsize, true); | return property (&commandwindowsize, true); | |||
else if (pname.compare ("currentfigure")) | else if (pname.compare ("currentfigure")) | |||
return property (¤tfigure, true); | return property (¤tfigure, true); | |||
else if (pname.compare ("diary")) | else if (pname.compare ("diary")) | |||
return property (&diary, true); | return property (&diary, true); | |||
else if (pname.compare ("diaryfile")) | else if (pname.compare ("diaryfile")) | |||
return property (&diaryfile, true); | return property (&diaryfile, true); | |||
else if (pname.compare ("echo")) | else if (pname.compare ("echo")) | |||
return property (&echo, true); | return property (&echo, true); | |||
else if (pname.compare ("errormessage")) | ||||
return property (&errormessage, true); | ||||
else if (pname.compare ("fixedwidthfontname")) | ||||
return property (&fixedwidthfontname, true); | ||||
else if (pname.compare ("format")) | else if (pname.compare ("format")) | |||
return property (&format, true); | return property (&format, true); | |||
else if (pname.compare ("formatspacing")) | else if (pname.compare ("formatspacing")) | |||
return property (&formatspacing, true); | return property (&formatspacing, true); | |||
else if (pname.compare ("language")) | else if (pname.compare ("language")) | |||
return property (&language, true); | return property (&language, true); | |||
else if (pname.compare ("monitorpositions")) | else if (pname.compare ("monitorpositions")) | |||
return property (&monitorpositions, true); | return property (&monitorpositions, true); | |||
else if (pname.compare ("pointerlocation")) | else if (pname.compare ("pointerlocation")) | |||
return property (&pointerlocation, true); | return property (&pointerlocation, true); | |||
skipping to change at line 528 | skipping to change at line 544 | |||
root_figure::properties::factory_defaults (void) | root_figure::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["callbackobject"] = graphics_handle ().as_octave_value (); | m["callbackobject"] = graphics_handle ().as_octave_value (); | |||
m["commandwindowsize"] = Matrix (1, 2, 0); | m["commandwindowsize"] = Matrix (1, 2, 0); | |||
m["currentfigure"] = graphics_handle ().as_octave_value (); | m["currentfigure"] = graphics_handle ().as_octave_value (); | |||
m["diary"] = "off"; | m["diary"] = "off"; | |||
m["diaryfile"] = "diary"; | m["diaryfile"] = "diary"; | |||
m["echo"] = "off"; | m["echo"] = "off"; | |||
m["errormessage"] = ""; | ||||
m["fixedwidthfontname"] = "Courier"; | ||||
m["format"] = "short"; | m["format"] = "short"; | |||
m["formatspacing"] = "loose"; | m["formatspacing"] = "loose"; | |||
m["language"] = "ascii"; | m["language"] = "ascii"; | |||
m["monitorpositions"] = Matrix (1, 4, 0); | m["monitorpositions"] = Matrix (1, 4, 0); | |||
m["pointerlocation"] = Matrix (1, 2, 0); | m["pointerlocation"] = Matrix (1, 2, 0); | |||
m["pointerwindow"] = 0.0; | m["pointerwindow"] = 0.0; | |||
m["recursionlimit"] = 256.0; | m["recursionlimit"] = 256.0; | |||
m["screendepth"] = default_screendepth (); | m["screendepth"] = default_screendepth (); | |||
m["screenpixelsperinch"] = default_screenpixelsperinch (); | m["screenpixelsperinch"] = default_screenpixelsperinch (); | |||
m["screensize"] = default_screensize (); | m["screensize"] = default_screensize (); | |||
skipping to change at line 561 | skipping to change at line 579 | |||
static bool initialized = false; | static bool initialized = false; | |||
if (! initialized) | if (! initialized) | |||
{ | { | |||
all_pnames.insert ("callbackobject"); | all_pnames.insert ("callbackobject"); | |||
all_pnames.insert ("commandwindowsize"); | all_pnames.insert ("commandwindowsize"); | |||
all_pnames.insert ("currentfigure"); | all_pnames.insert ("currentfigure"); | |||
all_pnames.insert ("diary"); | all_pnames.insert ("diary"); | |||
all_pnames.insert ("diaryfile"); | all_pnames.insert ("diaryfile"); | |||
all_pnames.insert ("echo"); | all_pnames.insert ("echo"); | |||
all_pnames.insert ("errormessage"); | ||||
all_pnames.insert ("fixedwidthfontname"); | ||||
all_pnames.insert ("format"); | all_pnames.insert ("format"); | |||
all_pnames.insert ("formatspacing"); | all_pnames.insert ("formatspacing"); | |||
all_pnames.insert ("language"); | all_pnames.insert ("language"); | |||
all_pnames.insert ("monitorpositions"); | all_pnames.insert ("monitorpositions"); | |||
all_pnames.insert ("pointerlocation"); | all_pnames.insert ("pointerlocation"); | |||
all_pnames.insert ("pointerwindow"); | all_pnames.insert ("pointerwindow"); | |||
all_pnames.insert ("recursionlimit"); | all_pnames.insert ("recursionlimit"); | |||
all_pnames.insert ("screendepth"); | all_pnames.insert ("screendepth"); | |||
all_pnames.insert ("screenpixelsperinch"); | all_pnames.insert ("screenpixelsperinch"); | |||
all_pnames.insert ("screensize"); | all_pnames.insert ("screensize"); | |||
skipping to change at line 615 | skipping to change at line 635 | |||
{ | { | |||
std::set<std::string> pnames = all_property_names (); | std::set<std::string> pnames = all_property_names (); | |||
return pnames.find (pname) != pnames.end (); | return pnames.find (pname) != pnames.end (); | |||
} | } | |||
// ******** figure ******** | // ******** figure ******** | |||
figure::properties::properties (const graphics_handle& mh, const graphics_h andle& p) | figure::properties::properties (const graphics_handle& mh, const graphics_h andle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
__plot_stream__ ("__plot_stream__", mh, Matrix ()), | alphamap ("alphamap", mh, Matrix (64, 1, 1)), | |||
__enhanced__ ("__enhanced__", mh, "on"), | buttondownfcn ("buttondownfcn", mh, Matrix ()), | |||
nextplot ("nextplot", mh, "new|{add}|replacechildren|replace"), | ||||
closerequestfcn ("closerequestfcn", mh, "closereq"), | closerequestfcn ("closerequestfcn", mh, "closereq"), | |||
currentaxes ("currentaxes", mh, graphics_handle ()), | ||||
colormap ("colormap", mh, jet_colormap ()), | ||||
paperorientation ("paperorientation", mh, "{portrait}|landscape|rotated | ||||
"), | ||||
color ("color", mh, color_property (color_values (1, 1, 1), radio_value s ("none"))), | color ("color", mh, color_property (color_values (1, 1, 1), radio_value s ("none"))), | |||
alphamap ("alphamap", mh, Matrix (64, 1, 1)), | colormap ("colormap", mh, jet_colormap ()), | |||
currentaxes ("currentaxes", mh, graphics_handle ()), | ||||
currentcharacter ("currentcharacter", mh, ""), | currentcharacter ("currentcharacter", mh, ""), | |||
currentobject ("currentobject", mh, graphics_handle ()), | currentobject ("currentobject", mh, graphics_handle ()), | |||
currentpoint ("currentpoint", mh, Matrix (2, 1, 0)), | currentpoint ("currentpoint", mh, Matrix (2, 1, 0)), | |||
dockcontrols ("dockcontrols", mh, "off"), | dockcontrols ("dockcontrols", mh, "off"), | |||
doublebuffer ("doublebuffer", mh, "on"), | doublebuffer ("doublebuffer", mh, "on"), | |||
filename ("filename", mh, ""), | filename ("filename", mh, ""), | |||
integerhandle ("integerhandle", mh, "on"), | integerhandle ("integerhandle", mh, "on"), | |||
inverthardcopy ("inverthardcopy", mh, "off"), | inverthardcopy ("inverthardcopy", mh, "off"), | |||
keypressfcn ("keypressfcn", mh, Matrix ()), | keypressfcn ("keypressfcn", mh, Matrix ()), | |||
keyreleasefcn ("keyreleasefcn", mh, Matrix ()), | keyreleasefcn ("keyreleasefcn", mh, Matrix ()), | |||
menubar ("menubar", mh, "none|{figure}"), | menubar ("menubar", mh, "none|{figure}"), | |||
mincolormap ("mincolormap", mh, 64), | mincolormap ("mincolormap", mh, 64), | |||
name ("name", mh, ""), | name ("name", mh, ""), | |||
nextplot ("nextplot", mh, "new|{add}|replacechildren|replace"), | ||||
numbertitle ("numbertitle", mh, "on"), | numbertitle ("numbertitle", mh, "on"), | |||
outerposition ("outerposition", mh, Matrix (1, 4, -1.0)), | outerposition ("outerposition", mh, Matrix (1, 4, -1.0)), | |||
paperunits ("paperunits", mh, "{inches}|centimeters|normalized|points") , | paperorientation ("paperorientation", mh, "{portrait}|landscape|rotated "), | |||
paperposition ("paperposition", mh, default_figure_paperposition ()), | paperposition ("paperposition", mh, default_figure_paperposition ()), | |||
paperpositionmode ("paperpositionmode", mh, "auto|{manual}"), | paperpositionmode ("paperpositionmode", mh, "auto|{manual}"), | |||
papersize ("papersize", mh, default_figure_papersize ()), | papersize ("papersize", mh, default_figure_papersize ()), | |||
papertype ("papertype", mh, "{usletter}|uslegal|a0|a1|a2|a3|a4|a5|b0|b1 |b2|b3|b4|b5|arch-a|arch-b|arch-c|arch-d|arch-e|a|b|c|d|e|tabloid|<custom>" ), | papertype ("papertype", mh, "{usletter}|uslegal|a0|a1|a2|a3|a4|a5|b0|b1 |b2|b3|b4|b5|arch-a|arch-b|arch-c|arch-d|arch-e|a|b|c|d|e|tabloid|<custom>" ), | |||
paperunits ("paperunits", mh, "{inches}|centimeters|normalized|points") , | ||||
pointer ("pointer", mh, "crosshair|fullcrosshair|{arrow}|ibeam|watch|to pl|topr|botl|botr|left|top|right|bottom|circle|cross|fleur|custom|hand"), | pointer ("pointer", mh, "crosshair|fullcrosshair|{arrow}|ibeam|watch|to pl|topr|botl|botr|left|top|right|bottom|circle|cross|fleur|custom|hand"), | |||
pointershapecdata ("pointershapecdata", mh, Matrix (16, 16, 0)), | pointershapecdata ("pointershapecdata", mh, Matrix (16, 16, 0)), | |||
pointershapehotspot ("pointershapehotspot", mh, Matrix (1, 2, 0)), | pointershapehotspot ("pointershapehotspot", mh, Matrix (1, 2, 0)), | |||
position ("position", mh, default_figure_position ()), | position ("position", mh, default_figure_position ()), | |||
renderer ("renderer", mh, "{painters}|zbuffer|opengl|none"), | renderer ("renderer", mh, "{painters}|zbuffer|opengl|none"), | |||
renderermode ("renderermode", mh, "{auto}|manual"), | renderermode ("renderermode", mh, "{auto}|manual"), | |||
resize ("resize", mh, "on"), | resize ("resize", mh, "on"), | |||
resizefcn ("resizefcn", mh, Matrix ()), | resizefcn ("resizefcn", mh, Matrix ()), | |||
selectiontype ("selectiontype", mh, "{normal}|open|alt|extend"), | selectiontype ("selectiontype", mh, "{normal}|open|alt|extend"), | |||
toolbar ("toolbar", mh, "none|{auto}|figure"), | toolbar ("toolbar", mh, "none|{auto}|figure"), | |||
units ("units", mh, "inches|centimeters|normalized|points|{pixels}|char acters"), | units ("units", mh, "inches|centimeters|normalized|points|{pixels}|char acters"), | |||
windowbuttondownfcn ("windowbuttondownfcn", mh, Matrix ()), | windowbuttondownfcn ("windowbuttondownfcn", mh, Matrix ()), | |||
windowbuttonmotionfcn ("windowbuttonmotionfcn", mh, Matrix ()), | windowbuttonmotionfcn ("windowbuttonmotionfcn", mh, Matrix ()), | |||
windowbuttonupfcn ("windowbuttonupfcn", mh, Matrix ()), | windowbuttonupfcn ("windowbuttonupfcn", mh, Matrix ()), | |||
windowbuttonwheelfcn ("windowbuttonwheelfcn", mh, Matrix ()), | windowkeypressfcn ("windowkeypressfcn", mh, Matrix ()), | |||
windowkeyreleasefcn ("windowkeyreleasefcn", mh, Matrix ()), | ||||
windowscrollwheelfcn ("windowscrollwheelfcn", mh, Matrix ()), | ||||
windowstyle ("windowstyle", mh, "{normal}|modal|docked"), | windowstyle ("windowstyle", mh, "{normal}|modal|docked"), | |||
wvisual ("wvisual", mh, ""), | wvisual ("wvisual", mh, ""), | |||
wvisualmode ("wvisualmode", mh, "{auto}|manual"), | wvisualmode ("wvisualmode", mh, "{auto}|manual"), | |||
xdisplay ("xdisplay", mh, ""), | xdisplay ("xdisplay", mh, ""), | |||
xvisual ("xvisual", mh, ""), | xvisual ("xvisual", mh, ""), | |||
xvisualmode ("xvisualmode", mh, "{auto}|manual"), | xvisualmode ("xvisualmode", mh, "{auto}|manual"), | |||
buttondownfcn ("buttondownfcn", mh, Matrix ()), | __enhanced__ ("__enhanced__", mh, "on"), | |||
__graphics_toolkit__ ("__graphics_toolkit__", mh, "gnuplot"), | __graphics_toolkit__ ("__graphics_toolkit__", mh, gtk_manager::default_ | |||
__guidata__ ("__guidata__", mh, Matrix ()) | toolkit ()), | |||
__guidata__ ("__guidata__", mh, Matrix ()), | ||||
__plot_stream__ ("__plot_stream__", mh, Matrix ()) | ||||
{ | { | |||
__plot_stream__.set_id (ID___PLOT_STREAM__); | alphamap.set_id (ID_ALPHAMAP); | |||
__plot_stream__.set_hidden (true); | buttondownfcn.set_id (ID_BUTTONDOWNFCN); | |||
__enhanced__.set_id (ID___ENHANCED__); | ||||
__enhanced__.set_hidden (true); | ||||
nextplot.set_id (ID_NEXTPLOT); | ||||
closerequestfcn.set_id (ID_CLOSEREQUESTFCN); | closerequestfcn.set_id (ID_CLOSEREQUESTFCN); | |||
currentaxes.set_id (ID_CURRENTAXES); | ||||
colormap.set_id (ID_COLORMAP); | ||||
paperorientation.set_id (ID_PAPERORIENTATION); | ||||
color.set_id (ID_COLOR); | color.set_id (ID_COLOR); | |||
alphamap.set_id (ID_ALPHAMAP); | colormap.set_id (ID_COLORMAP); | |||
currentaxes.set_id (ID_CURRENTAXES); | ||||
currentcharacter.set_id (ID_CURRENTCHARACTER); | currentcharacter.set_id (ID_CURRENTCHARACTER); | |||
currentobject.set_id (ID_CURRENTOBJECT); | currentobject.set_id (ID_CURRENTOBJECT); | |||
currentpoint.set_id (ID_CURRENTPOINT); | currentpoint.set_id (ID_CURRENTPOINT); | |||
dockcontrols.set_id (ID_DOCKCONTROLS); | dockcontrols.set_id (ID_DOCKCONTROLS); | |||
doublebuffer.set_id (ID_DOUBLEBUFFER); | doublebuffer.set_id (ID_DOUBLEBUFFER); | |||
filename.set_id (ID_FILENAME); | filename.set_id (ID_FILENAME); | |||
integerhandle.set_id (ID_INTEGERHANDLE); | integerhandle.set_id (ID_INTEGERHANDLE); | |||
inverthardcopy.set_id (ID_INVERTHARDCOPY); | inverthardcopy.set_id (ID_INVERTHARDCOPY); | |||
keypressfcn.set_id (ID_KEYPRESSFCN); | keypressfcn.set_id (ID_KEYPRESSFCN); | |||
keyreleasefcn.set_id (ID_KEYRELEASEFCN); | keyreleasefcn.set_id (ID_KEYRELEASEFCN); | |||
menubar.set_id (ID_MENUBAR); | menubar.set_id (ID_MENUBAR); | |||
mincolormap.set_id (ID_MINCOLORMAP); | mincolormap.set_id (ID_MINCOLORMAP); | |||
name.set_id (ID_NAME); | name.set_id (ID_NAME); | |||
nextplot.set_id (ID_NEXTPLOT); | ||||
numbertitle.set_id (ID_NUMBERTITLE); | numbertitle.set_id (ID_NUMBERTITLE); | |||
outerposition.set_id (ID_OUTERPOSITION); | outerposition.set_id (ID_OUTERPOSITION); | |||
paperunits.set_id (ID_PAPERUNITS); | paperorientation.set_id (ID_PAPERORIENTATION); | |||
paperposition.set_id (ID_PAPERPOSITION); | paperposition.set_id (ID_PAPERPOSITION); | |||
paperpositionmode.set_id (ID_PAPERPOSITIONMODE); | paperpositionmode.set_id (ID_PAPERPOSITIONMODE); | |||
papersize.set_id (ID_PAPERSIZE); | papersize.set_id (ID_PAPERSIZE); | |||
papertype.set_id (ID_PAPERTYPE); | papertype.set_id (ID_PAPERTYPE); | |||
paperunits.set_id (ID_PAPERUNITS); | ||||
pointer.set_id (ID_POINTER); | pointer.set_id (ID_POINTER); | |||
pointershapecdata.set_id (ID_POINTERSHAPECDATA); | pointershapecdata.set_id (ID_POINTERSHAPECDATA); | |||
pointershapehotspot.set_id (ID_POINTERSHAPEHOTSPOT); | pointershapehotspot.set_id (ID_POINTERSHAPEHOTSPOT); | |||
position.set_id (ID_POSITION); | position.set_id (ID_POSITION); | |||
renderer.set_id (ID_RENDERER); | renderer.set_id (ID_RENDERER); | |||
renderermode.set_id (ID_RENDERERMODE); | renderermode.set_id (ID_RENDERERMODE); | |||
resize.set_id (ID_RESIZE); | resize.set_id (ID_RESIZE); | |||
resizefcn.set_id (ID_RESIZEFCN); | resizefcn.set_id (ID_RESIZEFCN); | |||
selectiontype.set_id (ID_SELECTIONTYPE); | selectiontype.set_id (ID_SELECTIONTYPE); | |||
toolbar.set_id (ID_TOOLBAR); | toolbar.set_id (ID_TOOLBAR); | |||
units.set_id (ID_UNITS); | units.set_id (ID_UNITS); | |||
windowbuttondownfcn.set_id (ID_WINDOWBUTTONDOWNFCN); | windowbuttondownfcn.set_id (ID_WINDOWBUTTONDOWNFCN); | |||
windowbuttonmotionfcn.set_id (ID_WINDOWBUTTONMOTIONFCN); | windowbuttonmotionfcn.set_id (ID_WINDOWBUTTONMOTIONFCN); | |||
windowbuttonupfcn.set_id (ID_WINDOWBUTTONUPFCN); | windowbuttonupfcn.set_id (ID_WINDOWBUTTONUPFCN); | |||
windowbuttonwheelfcn.set_id (ID_WINDOWBUTTONWHEELFCN); | windowkeypressfcn.set_id (ID_WINDOWKEYPRESSFCN); | |||
windowkeyreleasefcn.set_id (ID_WINDOWKEYRELEASEFCN); | ||||
windowscrollwheelfcn.set_id (ID_WINDOWSCROLLWHEELFCN); | ||||
windowstyle.set_id (ID_WINDOWSTYLE); | windowstyle.set_id (ID_WINDOWSTYLE); | |||
wvisual.set_id (ID_WVISUAL); | wvisual.set_id (ID_WVISUAL); | |||
wvisualmode.set_id (ID_WVISUALMODE); | wvisualmode.set_id (ID_WVISUALMODE); | |||
xdisplay.set_id (ID_XDISPLAY); | xdisplay.set_id (ID_XDISPLAY); | |||
xvisual.set_id (ID_XVISUAL); | xvisual.set_id (ID_XVISUAL); | |||
xvisualmode.set_id (ID_XVISUALMODE); | xvisualmode.set_id (ID_XVISUALMODE); | |||
buttondownfcn.set_id (ID_BUTTONDOWNFCN); | __enhanced__.set_id (ID___ENHANCED__); | |||
__enhanced__.set_hidden (true); | ||||
__graphics_toolkit__.set_id (ID___GRAPHICS_TOOLKIT__); | __graphics_toolkit__.set_id (ID___GRAPHICS_TOOLKIT__); | |||
__guidata__.set_id (ID___GUIDATA__); | __guidata__.set_id (ID___GUIDATA__); | |||
__guidata__.set_hidden (true); | __guidata__.set_hidden (true); | |||
__plot_stream__.set_id (ID___PLOT_STREAM__); | ||||
__plot_stream__.set_hidden (true); | ||||
init (); | init (); | |||
} | } | |||
void | void | |||
figure::properties::set (const caseless_str& pname_arg, const octave_value& val) | figure::properties::set (const caseless_str& pname_arg, const octave_value& val) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return; | return; | |||
if (pname.compare ("__plot_stream__")) | if (pname.compare ("alphamap")) | |||
set___plot_stream__ (val); | set_alphamap (val); | |||
else if (pname.compare ("__enhanced__")) | else if (pname.compare ("buttondownfcn")) | |||
set___enhanced__ (val); | set_buttondownfcn (val); | |||
else if (pname.compare ("nextplot")) | ||||
set_nextplot (val); | ||||
else if (pname.compare ("closerequestfcn")) | else if (pname.compare ("closerequestfcn")) | |||
set_closerequestfcn (val); | set_closerequestfcn (val); | |||
else if (pname.compare ("currentaxes")) | ||||
set_currentaxes (val); | ||||
else if (pname.compare ("colormap")) | ||||
set_colormap (val); | ||||
else if (pname.compare ("paperorientation")) | ||||
set_paperorientation (val); | ||||
else if (pname.compare ("color")) | else if (pname.compare ("color")) | |||
set_color (val); | set_color (val); | |||
else if (pname.compare ("alphamap")) | else if (pname.compare ("colormap")) | |||
set_alphamap (val); | set_colormap (val); | |||
else if (pname.compare ("currentaxes")) | ||||
set_currentaxes (val); | ||||
else if (pname.compare ("dockcontrols")) | else if (pname.compare ("dockcontrols")) | |||
set_dockcontrols (val); | set_dockcontrols (val); | |||
else if (pname.compare ("doublebuffer")) | else if (pname.compare ("doublebuffer")) | |||
set_doublebuffer (val); | set_doublebuffer (val); | |||
else if (pname.compare ("filename")) | else if (pname.compare ("filename")) | |||
set_filename (val); | set_filename (val); | |||
else if (pname.compare ("integerhandle")) | else if (pname.compare ("integerhandle")) | |||
set_integerhandle (val); | set_integerhandle (val); | |||
else if (pname.compare ("inverthardcopy")) | else if (pname.compare ("inverthardcopy")) | |||
set_inverthardcopy (val); | set_inverthardcopy (val); | |||
else if (pname.compare ("keypressfcn")) | else if (pname.compare ("keypressfcn")) | |||
set_keypressfcn (val); | set_keypressfcn (val); | |||
else if (pname.compare ("keyreleasefcn")) | else if (pname.compare ("keyreleasefcn")) | |||
set_keyreleasefcn (val); | set_keyreleasefcn (val); | |||
else if (pname.compare ("menubar")) | else if (pname.compare ("menubar")) | |||
set_menubar (val); | set_menubar (val); | |||
else if (pname.compare ("mincolormap")) | else if (pname.compare ("mincolormap")) | |||
set_mincolormap (val); | set_mincolormap (val); | |||
else if (pname.compare ("name")) | else if (pname.compare ("name")) | |||
set_name (val); | set_name (val); | |||
else if (pname.compare ("nextplot")) | ||||
set_nextplot (val); | ||||
else if (pname.compare ("numbertitle")) | else if (pname.compare ("numbertitle")) | |||
set_numbertitle (val); | set_numbertitle (val); | |||
else if (pname.compare ("outerposition")) | else if (pname.compare ("outerposition")) | |||
set_outerposition (val); | set_outerposition (val); | |||
else if (pname.compare ("paperunits")) | else if (pname.compare ("paperorientation")) | |||
set_paperunits (val); | set_paperorientation (val); | |||
else if (pname.compare ("paperposition")) | else if (pname.compare ("paperposition")) | |||
set_paperposition (val); | set_paperposition (val); | |||
else if (pname.compare ("paperpositionmode")) | else if (pname.compare ("paperpositionmode")) | |||
set_paperpositionmode (val); | set_paperpositionmode (val); | |||
else if (pname.compare ("papersize")) | else if (pname.compare ("papersize")) | |||
set_papersize (val); | set_papersize (val); | |||
else if (pname.compare ("papertype")) | else if (pname.compare ("papertype")) | |||
set_papertype (val); | set_papertype (val); | |||
else if (pname.compare ("paperunits")) | ||||
set_paperunits (val); | ||||
else if (pname.compare ("pointer")) | else if (pname.compare ("pointer")) | |||
set_pointer (val); | set_pointer (val); | |||
else if (pname.compare ("pointershapecdata")) | else if (pname.compare ("pointershapecdata")) | |||
set_pointershapecdata (val); | set_pointershapecdata (val); | |||
else if (pname.compare ("pointershapehotspot")) | else if (pname.compare ("pointershapehotspot")) | |||
set_pointershapehotspot (val); | set_pointershapehotspot (val); | |||
else if (pname.compare ("position")) | else if (pname.compare ("position")) | |||
set_position (val); | set_position (val); | |||
else if (pname.compare ("renderer")) | else if (pname.compare ("renderer")) | |||
set_renderer (val); | set_renderer (val); | |||
skipping to change at line 818 | skipping to change at line 840 | |||
else if (pname.compare ("toolbar")) | else if (pname.compare ("toolbar")) | |||
set_toolbar (val); | set_toolbar (val); | |||
else if (pname.compare ("units")) | else if (pname.compare ("units")) | |||
set_units (val); | set_units (val); | |||
else if (pname.compare ("windowbuttondownfcn")) | else if (pname.compare ("windowbuttondownfcn")) | |||
set_windowbuttondownfcn (val); | set_windowbuttondownfcn (val); | |||
else if (pname.compare ("windowbuttonmotionfcn")) | else if (pname.compare ("windowbuttonmotionfcn")) | |||
set_windowbuttonmotionfcn (val); | set_windowbuttonmotionfcn (val); | |||
else if (pname.compare ("windowbuttonupfcn")) | else if (pname.compare ("windowbuttonupfcn")) | |||
set_windowbuttonupfcn (val); | set_windowbuttonupfcn (val); | |||
else if (pname.compare ("windowbuttonwheelfcn")) | else if (pname.compare ("windowkeypressfcn")) | |||
set_windowbuttonwheelfcn (val); | set_windowkeypressfcn (val); | |||
else if (pname.compare ("windowkeyreleasefcn")) | ||||
set_windowkeyreleasefcn (val); | ||||
else if (pname.compare ("windowscrollwheelfcn")) | ||||
set_windowscrollwheelfcn (val); | ||||
else if (pname.compare ("windowstyle")) | else if (pname.compare ("windowstyle")) | |||
set_windowstyle (val); | set_windowstyle (val); | |||
else if (pname.compare ("wvisual")) | else if (pname.compare ("wvisual")) | |||
set_wvisual (val); | set_wvisual (val); | |||
else if (pname.compare ("wvisualmode")) | else if (pname.compare ("wvisualmode")) | |||
set_wvisualmode (val); | set_wvisualmode (val); | |||
else if (pname.compare ("xdisplay")) | else if (pname.compare ("xdisplay")) | |||
set_xdisplay (val); | set_xdisplay (val); | |||
else if (pname.compare ("xvisual")) | else if (pname.compare ("xvisual")) | |||
set_xvisual (val); | set_xvisual (val); | |||
else if (pname.compare ("xvisualmode")) | else if (pname.compare ("xvisualmode")) | |||
set_xvisualmode (val); | set_xvisualmode (val); | |||
else if (pname.compare ("buttondownfcn")) | else if (pname.compare ("__enhanced__")) | |||
set_buttondownfcn (val); | set___enhanced__ (val); | |||
else if (pname.compare ("__graphics_toolkit__")) | else if (pname.compare ("__graphics_toolkit__")) | |||
set___graphics_toolkit__ (val); | set___graphics_toolkit__ (val); | |||
else if (pname.compare ("__guidata__")) | else if (pname.compare ("__guidata__")) | |||
set___guidata__ (val); | set___guidata__ (val); | |||
else if (pname.compare ("__plot_stream__")) | ||||
set___plot_stream__ (val); | ||||
else | else | |||
base_properties::set (pname, val); | base_properties::set (pname, val); | |||
} | } | |||
octave_value | octave_value | |||
figure::properties::get (bool all) const | figure::properties::get (bool all) const | |||
{ | { | |||
octave_map m = base_properties::get (all).map_value (); | octave_map m = base_properties::get (all).map_value (); | |||
if (all) | m.assign ("alphamap", octave_value (get_alphamap ())); | |||
m.assign ("__plot_stream__", octave_value (get___plot_stream__ ())); | m.assign ("buttondownfcn", octave_value (get_buttondownfcn ())); | |||
if (all) | ||||
m.assign ("__enhanced__", octave_value (get___enhanced__ ())); | ||||
m.assign ("nextplot", octave_value (get_nextplot ())); | ||||
m.assign ("closerequestfcn", octave_value (get_closerequestfcn ())); | m.assign ("closerequestfcn", octave_value (get_closerequestfcn ())); | |||
m.assign ("currentaxes", octave_value (get_currentaxes ().as_octave_value | ||||
())); | ||||
m.assign ("colormap", octave_value (get_colormap ())); | ||||
m.assign ("paperorientation", octave_value (get_paperorientation ())); | ||||
m.assign ("color", octave_value (get_color ())); | m.assign ("color", octave_value (get_color ())); | |||
m.assign ("alphamap", octave_value (get_alphamap ())); | m.assign ("colormap", octave_value (get_colormap ())); | |||
m.assign ("currentaxes", octave_value (get_currentaxes ().as_octave_value | ||||
())); | ||||
m.assign ("currentcharacter", octave_value (get_currentcharacter ())); | m.assign ("currentcharacter", octave_value (get_currentcharacter ())); | |||
m.assign ("currentobject", octave_value (get_currentobject ().as_octave_v alue ())); | m.assign ("currentobject", octave_value (get_currentobject ().as_octave_v alue ())); | |||
m.assign ("currentpoint", octave_value (get_currentpoint ())); | m.assign ("currentpoint", octave_value (get_currentpoint ())); | |||
m.assign ("dockcontrols", octave_value (get_dockcontrols ())); | m.assign ("dockcontrols", octave_value (get_dockcontrols ())); | |||
m.assign ("doublebuffer", octave_value (get_doublebuffer ())); | m.assign ("doublebuffer", octave_value (get_doublebuffer ())); | |||
m.assign ("filename", octave_value (get_filename ())); | m.assign ("filename", octave_value (get_filename ())); | |||
m.assign ("integerhandle", octave_value (get_integerhandle ())); | m.assign ("integerhandle", octave_value (get_integerhandle ())); | |||
m.assign ("inverthardcopy", octave_value (get_inverthardcopy ())); | m.assign ("inverthardcopy", octave_value (get_inverthardcopy ())); | |||
m.assign ("keypressfcn", octave_value (get_keypressfcn ())); | m.assign ("keypressfcn", octave_value (get_keypressfcn ())); | |||
m.assign ("keyreleasefcn", octave_value (get_keyreleasefcn ())); | m.assign ("keyreleasefcn", octave_value (get_keyreleasefcn ())); | |||
m.assign ("menubar", octave_value (get_menubar ())); | m.assign ("menubar", octave_value (get_menubar ())); | |||
m.assign ("mincolormap", octave_value (get_mincolormap ())); | m.assign ("mincolormap", octave_value (get_mincolormap ())); | |||
m.assign ("name", octave_value (get_name ())); | m.assign ("name", octave_value (get_name ())); | |||
m.assign ("nextplot", octave_value (get_nextplot ())); | ||||
m.assign ("numbertitle", octave_value (get_numbertitle ())); | m.assign ("numbertitle", octave_value (get_numbertitle ())); | |||
m.assign ("outerposition", octave_value (get_outerposition ())); | m.assign ("outerposition", octave_value (get_outerposition ())); | |||
m.assign ("paperunits", octave_value (get_paperunits ())); | m.assign ("paperorientation", octave_value (get_paperorientation ())); | |||
m.assign ("paperposition", octave_value (get_paperposition ())); | m.assign ("paperposition", octave_value (get_paperposition ())); | |||
m.assign ("paperpositionmode", octave_value (get_paperpositionmode ())); | m.assign ("paperpositionmode", octave_value (get_paperpositionmode ())); | |||
m.assign ("papersize", octave_value (get_papersize ())); | m.assign ("papersize", octave_value (get_papersize ())); | |||
m.assign ("papertype", octave_value (get_papertype ())); | m.assign ("papertype", octave_value (get_papertype ())); | |||
m.assign ("paperunits", octave_value (get_paperunits ())); | ||||
m.assign ("pointer", octave_value (get_pointer ())); | m.assign ("pointer", octave_value (get_pointer ())); | |||
m.assign ("pointershapecdata", octave_value (get_pointershapecdata ())); | m.assign ("pointershapecdata", octave_value (get_pointershapecdata ())); | |||
m.assign ("pointershapehotspot", octave_value (get_pointershapehotspot () )); | m.assign ("pointershapehotspot", octave_value (get_pointershapehotspot () )); | |||
m.assign ("position", octave_value (get_position ())); | m.assign ("position", octave_value (get_position ())); | |||
m.assign ("renderer", octave_value (get_renderer ())); | m.assign ("renderer", octave_value (get_renderer ())); | |||
m.assign ("renderermode", octave_value (get_renderermode ())); | m.assign ("renderermode", octave_value (get_renderermode ())); | |||
m.assign ("resize", octave_value (get_resize ())); | m.assign ("resize", octave_value (get_resize ())); | |||
m.assign ("resizefcn", octave_value (get_resizefcn ())); | m.assign ("resizefcn", octave_value (get_resizefcn ())); | |||
m.assign ("selectiontype", octave_value (get_selectiontype ())); | m.assign ("selectiontype", octave_value (get_selectiontype ())); | |||
m.assign ("toolbar", octave_value (get_toolbar ())); | m.assign ("toolbar", octave_value (get_toolbar ())); | |||
m.assign ("units", octave_value (get_units ())); | m.assign ("units", octave_value (get_units ())); | |||
m.assign ("windowbuttondownfcn", octave_value (get_windowbuttondownfcn () )); | m.assign ("windowbuttondownfcn", octave_value (get_windowbuttondownfcn () )); | |||
m.assign ("windowbuttonmotionfcn", octave_value (get_windowbuttonmotionfc n ())); | m.assign ("windowbuttonmotionfcn", octave_value (get_windowbuttonmotionfc n ())); | |||
m.assign ("windowbuttonupfcn", octave_value (get_windowbuttonupfcn ())); | m.assign ("windowbuttonupfcn", octave_value (get_windowbuttonupfcn ())); | |||
m.assign ("windowbuttonwheelfcn", octave_value (get_windowbuttonwheelfcn | m.assign ("windowkeypressfcn", octave_value (get_windowkeypressfcn ())); | |||
())); | m.assign ("windowkeyreleasefcn", octave_value (get_windowkeyreleasefcn () | |||
)); | ||||
m.assign ("windowscrollwheelfcn", octave_value (get_windowscrollwheelfcn | ||||
())); | ||||
m.assign ("windowstyle", octave_value (get_windowstyle ())); | m.assign ("windowstyle", octave_value (get_windowstyle ())); | |||
m.assign ("wvisual", octave_value (get_wvisual ())); | m.assign ("wvisual", octave_value (get_wvisual ())); | |||
m.assign ("wvisualmode", octave_value (get_wvisualmode ())); | m.assign ("wvisualmode", octave_value (get_wvisualmode ())); | |||
m.assign ("xdisplay", octave_value (get_xdisplay ())); | m.assign ("xdisplay", octave_value (get_xdisplay ())); | |||
m.assign ("xvisual", octave_value (get_xvisual ())); | m.assign ("xvisual", octave_value (get_xvisual ())); | |||
m.assign ("xvisualmode", octave_value (get_xvisualmode ())); | m.assign ("xvisualmode", octave_value (get_xvisualmode ())); | |||
m.assign ("buttondownfcn", octave_value (get_buttondownfcn ())); | if (all) | |||
m.assign ("__enhanced__", octave_value (get___enhanced__ ())); | ||||
m.assign ("__graphics_toolkit__", octave_value (get___graphics_toolkit__ ())); | m.assign ("__graphics_toolkit__", octave_value (get___graphics_toolkit__ ())); | |||
if (all) | if (all) | |||
m.assign ("__guidata__", octave_value (get___guidata__ ())); | m.assign ("__guidata__", octave_value (get___guidata__ ())); | |||
if (all) | ||||
m.assign ("__plot_stream__", octave_value (get___plot_stream__ ())); | ||||
return m; | return m; | |||
} | } | |||
octave_value | octave_value | |||
figure::properties::get (const caseless_str& pname_arg) const | figure::properties::get (const caseless_str& pname_arg) const | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return retval; | return retval; | |||
if (pname.compare ("__plot_stream__")) | if (pname.compare ("alphamap")) | |||
retval = get___plot_stream__ (); | retval = get_alphamap (); | |||
else if (pname.compare ("__enhanced__")) | else if (pname.compare ("buttondownfcn")) | |||
retval = get___enhanced__ (); | retval = get_buttondownfcn (); | |||
else if (pname.compare ("nextplot")) | ||||
retval = get_nextplot (); | ||||
else if (pname.compare ("closerequestfcn")) | else if (pname.compare ("closerequestfcn")) | |||
retval = get_closerequestfcn (); | retval = get_closerequestfcn (); | |||
else if (pname.compare ("currentaxes")) | ||||
retval = get_currentaxes ().as_octave_value (); | ||||
else if (pname.compare ("colormap")) | ||||
retval = get_colormap (); | ||||
else if (pname.compare ("paperorientation")) | ||||
retval = get_paperorientation (); | ||||
else if (pname.compare ("color")) | else if (pname.compare ("color")) | |||
retval = get_color (); | retval = get_color (); | |||
else if (pname.compare ("alphamap")) | else if (pname.compare ("colormap")) | |||
retval = get_alphamap (); | retval = get_colormap (); | |||
else if (pname.compare ("currentaxes")) | ||||
retval = get_currentaxes ().as_octave_value (); | ||||
else if (pname.compare ("currentcharacter")) | else if (pname.compare ("currentcharacter")) | |||
retval = get_currentcharacter (); | retval = get_currentcharacter (); | |||
else if (pname.compare ("currentobject")) | else if (pname.compare ("currentobject")) | |||
retval = get_currentobject ().as_octave_value (); | retval = get_currentobject ().as_octave_value (); | |||
else if (pname.compare ("currentpoint")) | else if (pname.compare ("currentpoint")) | |||
retval = get_currentpoint (); | retval = get_currentpoint (); | |||
else if (pname.compare ("dockcontrols")) | else if (pname.compare ("dockcontrols")) | |||
retval = get_dockcontrols (); | retval = get_dockcontrols (); | |||
else if (pname.compare ("doublebuffer")) | else if (pname.compare ("doublebuffer")) | |||
retval = get_doublebuffer (); | retval = get_doublebuffer (); | |||
skipping to change at line 963 | skipping to change at line 987 | |||
else if (pname.compare ("keypressfcn")) | else if (pname.compare ("keypressfcn")) | |||
retval = get_keypressfcn (); | retval = get_keypressfcn (); | |||
else if (pname.compare ("keyreleasefcn")) | else if (pname.compare ("keyreleasefcn")) | |||
retval = get_keyreleasefcn (); | retval = get_keyreleasefcn (); | |||
else if (pname.compare ("menubar")) | else if (pname.compare ("menubar")) | |||
retval = get_menubar (); | retval = get_menubar (); | |||
else if (pname.compare ("mincolormap")) | else if (pname.compare ("mincolormap")) | |||
retval = get_mincolormap (); | retval = get_mincolormap (); | |||
else if (pname.compare ("name")) | else if (pname.compare ("name")) | |||
retval = get_name (); | retval = get_name (); | |||
else if (pname.compare ("nextplot")) | ||||
retval = get_nextplot (); | ||||
else if (pname.compare ("numbertitle")) | else if (pname.compare ("numbertitle")) | |||
retval = get_numbertitle (); | retval = get_numbertitle (); | |||
else if (pname.compare ("outerposition")) | else if (pname.compare ("outerposition")) | |||
retval = get_outerposition (); | retval = get_outerposition (); | |||
else if (pname.compare ("paperunits")) | else if (pname.compare ("paperorientation")) | |||
retval = get_paperunits (); | retval = get_paperorientation (); | |||
else if (pname.compare ("paperposition")) | else if (pname.compare ("paperposition")) | |||
retval = get_paperposition (); | retval = get_paperposition (); | |||
else if (pname.compare ("paperpositionmode")) | else if (pname.compare ("paperpositionmode")) | |||
retval = get_paperpositionmode (); | retval = get_paperpositionmode (); | |||
else if (pname.compare ("papersize")) | else if (pname.compare ("papersize")) | |||
retval = get_papersize (); | retval = get_papersize (); | |||
else if (pname.compare ("papertype")) | else if (pname.compare ("papertype")) | |||
retval = get_papertype (); | retval = get_papertype (); | |||
else if (pname.compare ("paperunits")) | ||||
retval = get_paperunits (); | ||||
else if (pname.compare ("pointer")) | else if (pname.compare ("pointer")) | |||
retval = get_pointer (); | retval = get_pointer (); | |||
else if (pname.compare ("pointershapecdata")) | else if (pname.compare ("pointershapecdata")) | |||
retval = get_pointershapecdata (); | retval = get_pointershapecdata (); | |||
else if (pname.compare ("pointershapehotspot")) | else if (pname.compare ("pointershapehotspot")) | |||
retval = get_pointershapehotspot (); | retval = get_pointershapehotspot (); | |||
else if (pname.compare ("position")) | else if (pname.compare ("position")) | |||
retval = get_position (); | retval = get_position (); | |||
else if (pname.compare ("renderer")) | else if (pname.compare ("renderer")) | |||
retval = get_renderer (); | retval = get_renderer (); | |||
skipping to change at line 1005 | skipping to change at line 1033 | |||
else if (pname.compare ("toolbar")) | else if (pname.compare ("toolbar")) | |||
retval = get_toolbar (); | retval = get_toolbar (); | |||
else if (pname.compare ("units")) | else if (pname.compare ("units")) | |||
retval = get_units (); | retval = get_units (); | |||
else if (pname.compare ("windowbuttondownfcn")) | else if (pname.compare ("windowbuttondownfcn")) | |||
retval = get_windowbuttondownfcn (); | retval = get_windowbuttondownfcn (); | |||
else if (pname.compare ("windowbuttonmotionfcn")) | else if (pname.compare ("windowbuttonmotionfcn")) | |||
retval = get_windowbuttonmotionfcn (); | retval = get_windowbuttonmotionfcn (); | |||
else if (pname.compare ("windowbuttonupfcn")) | else if (pname.compare ("windowbuttonupfcn")) | |||
retval = get_windowbuttonupfcn (); | retval = get_windowbuttonupfcn (); | |||
else if (pname.compare ("windowbuttonwheelfcn")) | else if (pname.compare ("windowkeypressfcn")) | |||
retval = get_windowbuttonwheelfcn (); | retval = get_windowkeypressfcn (); | |||
else if (pname.compare ("windowkeyreleasefcn")) | ||||
retval = get_windowkeyreleasefcn (); | ||||
else if (pname.compare ("windowscrollwheelfcn")) | ||||
retval = get_windowscrollwheelfcn (); | ||||
else if (pname.compare ("windowstyle")) | else if (pname.compare ("windowstyle")) | |||
retval = get_windowstyle (); | retval = get_windowstyle (); | |||
else if (pname.compare ("wvisual")) | else if (pname.compare ("wvisual")) | |||
retval = get_wvisual (); | retval = get_wvisual (); | |||
else if (pname.compare ("wvisualmode")) | else if (pname.compare ("wvisualmode")) | |||
retval = get_wvisualmode (); | retval = get_wvisualmode (); | |||
else if (pname.compare ("xdisplay")) | else if (pname.compare ("xdisplay")) | |||
retval = get_xdisplay (); | retval = get_xdisplay (); | |||
else if (pname.compare ("xvisual")) | else if (pname.compare ("xvisual")) | |||
retval = get_xvisual (); | retval = get_xvisual (); | |||
else if (pname.compare ("xvisualmode")) | else if (pname.compare ("xvisualmode")) | |||
retval = get_xvisualmode (); | retval = get_xvisualmode (); | |||
else if (pname.compare ("buttondownfcn")) | else if (pname.compare ("__enhanced__")) | |||
retval = get_buttondownfcn (); | retval = get___enhanced__ (); | |||
else if (pname.compare ("__graphics_toolkit__")) | else if (pname.compare ("__graphics_toolkit__")) | |||
retval = get___graphics_toolkit__ (); | retval = get___graphics_toolkit__ (); | |||
else if (pname.compare ("__guidata__")) | else if (pname.compare ("__guidata__")) | |||
retval = get___guidata__ (); | retval = get___guidata__ (); | |||
else if (pname.compare ("__plot_stream__")) | ||||
retval = get___plot_stream__ (); | ||||
else | else | |||
retval = base_properties::get (pname); | retval = base_properties::get (pname); | |||
return retval; | return retval; | |||
} | } | |||
property | property | |||
figure::properties::get_property (const caseless_str& pname_arg) | figure::properties::get_property (const caseless_str& pname_arg) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return property (); | return property (); | |||
if (pname.compare ("__plot_stream__")) | if (pname.compare ("alphamap")) | |||
return property (&__plot_stream__, true); | return property (&alphamap, true); | |||
else if (pname.compare ("__enhanced__")) | else if (pname.compare ("buttondownfcn")) | |||
return property (&__enhanced__, true); | return property (&buttondownfcn, true); | |||
else if (pname.compare ("nextplot")) | ||||
return property (&nextplot, true); | ||||
else if (pname.compare ("closerequestfcn")) | else if (pname.compare ("closerequestfcn")) | |||
return property (&closerequestfcn, true); | return property (&closerequestfcn, true); | |||
else if (pname.compare ("currentaxes")) | ||||
return property (¤taxes, true); | ||||
else if (pname.compare ("colormap")) | ||||
return property (&colormap, true); | ||||
else if (pname.compare ("paperorientation")) | ||||
return property (&paperorientation, true); | ||||
else if (pname.compare ("color")) | else if (pname.compare ("color")) | |||
return property (&color, true); | return property (&color, true); | |||
else if (pname.compare ("alphamap")) | else if (pname.compare ("colormap")) | |||
return property (&alphamap, true); | return property (&colormap, true); | |||
else if (pname.compare ("currentaxes")) | ||||
return property (¤taxes, true); | ||||
else if (pname.compare ("currentcharacter")) | else if (pname.compare ("currentcharacter")) | |||
return property (¤tcharacter, true); | return property (¤tcharacter, true); | |||
else if (pname.compare ("currentobject")) | else if (pname.compare ("currentobject")) | |||
return property (¤tobject, true); | return property (¤tobject, true); | |||
else if (pname.compare ("currentpoint")) | else if (pname.compare ("currentpoint")) | |||
return property (¤tpoint, true); | return property (¤tpoint, true); | |||
else if (pname.compare ("dockcontrols")) | else if (pname.compare ("dockcontrols")) | |||
return property (&dockcontrols, true); | return property (&dockcontrols, true); | |||
else if (pname.compare ("doublebuffer")) | else if (pname.compare ("doublebuffer")) | |||
return property (&doublebuffer, true); | return property (&doublebuffer, true); | |||
skipping to change at line 1085 | skipping to change at line 1113 | |||
else if (pname.compare ("keypressfcn")) | else if (pname.compare ("keypressfcn")) | |||
return property (&keypressfcn, true); | return property (&keypressfcn, true); | |||
else if (pname.compare ("keyreleasefcn")) | else if (pname.compare ("keyreleasefcn")) | |||
return property (&keyreleasefcn, true); | return property (&keyreleasefcn, true); | |||
else if (pname.compare ("menubar")) | else if (pname.compare ("menubar")) | |||
return property (&menubar, true); | return property (&menubar, true); | |||
else if (pname.compare ("mincolormap")) | else if (pname.compare ("mincolormap")) | |||
return property (&mincolormap, true); | return property (&mincolormap, true); | |||
else if (pname.compare ("name")) | else if (pname.compare ("name")) | |||
return property (&name, true); | return property (&name, true); | |||
else if (pname.compare ("nextplot")) | ||||
return property (&nextplot, true); | ||||
else if (pname.compare ("numbertitle")) | else if (pname.compare ("numbertitle")) | |||
return property (&numbertitle, true); | return property (&numbertitle, true); | |||
else if (pname.compare ("outerposition")) | else if (pname.compare ("outerposition")) | |||
return property (&outerposition, true); | return property (&outerposition, true); | |||
else if (pname.compare ("paperunits")) | else if (pname.compare ("paperorientation")) | |||
return property (&paperunits, true); | return property (&paperorientation, true); | |||
else if (pname.compare ("paperposition")) | else if (pname.compare ("paperposition")) | |||
return property (&paperposition, true); | return property (&paperposition, true); | |||
else if (pname.compare ("paperpositionmode")) | else if (pname.compare ("paperpositionmode")) | |||
return property (&paperpositionmode, true); | return property (&paperpositionmode, true); | |||
else if (pname.compare ("papersize")) | else if (pname.compare ("papersize")) | |||
return property (&papersize, true); | return property (&papersize, true); | |||
else if (pname.compare ("papertype")) | else if (pname.compare ("papertype")) | |||
return property (&papertype, true); | return property (&papertype, true); | |||
else if (pname.compare ("paperunits")) | ||||
return property (&paperunits, true); | ||||
else if (pname.compare ("pointer")) | else if (pname.compare ("pointer")) | |||
return property (&pointer, true); | return property (&pointer, true); | |||
else if (pname.compare ("pointershapecdata")) | else if (pname.compare ("pointershapecdata")) | |||
return property (&pointershapecdata, true); | return property (&pointershapecdata, true); | |||
else if (pname.compare ("pointershapehotspot")) | else if (pname.compare ("pointershapehotspot")) | |||
return property (&pointershapehotspot, true); | return property (&pointershapehotspot, true); | |||
else if (pname.compare ("position")) | else if (pname.compare ("position")) | |||
return property (&position, true); | return property (&position, true); | |||
else if (pname.compare ("renderer")) | else if (pname.compare ("renderer")) | |||
return property (&renderer, true); | return property (&renderer, true); | |||
skipping to change at line 1127 | skipping to change at line 1159 | |||
else if (pname.compare ("toolbar")) | else if (pname.compare ("toolbar")) | |||
return property (&toolbar, true); | return property (&toolbar, true); | |||
else if (pname.compare ("units")) | else if (pname.compare ("units")) | |||
return property (&units, true); | return property (&units, true); | |||
else if (pname.compare ("windowbuttondownfcn")) | else if (pname.compare ("windowbuttondownfcn")) | |||
return property (&windowbuttondownfcn, true); | return property (&windowbuttondownfcn, true); | |||
else if (pname.compare ("windowbuttonmotionfcn")) | else if (pname.compare ("windowbuttonmotionfcn")) | |||
return property (&windowbuttonmotionfcn, true); | return property (&windowbuttonmotionfcn, true); | |||
else if (pname.compare ("windowbuttonupfcn")) | else if (pname.compare ("windowbuttonupfcn")) | |||
return property (&windowbuttonupfcn, true); | return property (&windowbuttonupfcn, true); | |||
else if (pname.compare ("windowbuttonwheelfcn")) | else if (pname.compare ("windowkeypressfcn")) | |||
return property (&windowbuttonwheelfcn, true); | return property (&windowkeypressfcn, true); | |||
else if (pname.compare ("windowkeyreleasefcn")) | ||||
return property (&windowkeyreleasefcn, true); | ||||
else if (pname.compare ("windowscrollwheelfcn")) | ||||
return property (&windowscrollwheelfcn, true); | ||||
else if (pname.compare ("windowstyle")) | else if (pname.compare ("windowstyle")) | |||
return property (&windowstyle, true); | return property (&windowstyle, true); | |||
else if (pname.compare ("wvisual")) | else if (pname.compare ("wvisual")) | |||
return property (&wvisual, true); | return property (&wvisual, true); | |||
else if (pname.compare ("wvisualmode")) | else if (pname.compare ("wvisualmode")) | |||
return property (&wvisualmode, true); | return property (&wvisualmode, true); | |||
else if (pname.compare ("xdisplay")) | else if (pname.compare ("xdisplay")) | |||
return property (&xdisplay, true); | return property (&xdisplay, true); | |||
else if (pname.compare ("xvisual")) | else if (pname.compare ("xvisual")) | |||
return property (&xvisual, true); | return property (&xvisual, true); | |||
else if (pname.compare ("xvisualmode")) | else if (pname.compare ("xvisualmode")) | |||
return property (&xvisualmode, true); | return property (&xvisualmode, true); | |||
else if (pname.compare ("buttondownfcn")) | else if (pname.compare ("__enhanced__")) | |||
return property (&buttondownfcn, true); | return property (&__enhanced__, true); | |||
else if (pname.compare ("__graphics_toolkit__")) | else if (pname.compare ("__graphics_toolkit__")) | |||
return property (&__graphics_toolkit__, true); | return property (&__graphics_toolkit__, true); | |||
else if (pname.compare ("__guidata__")) | else if (pname.compare ("__guidata__")) | |||
return property (&__guidata__, true); | return property (&__guidata__, true); | |||
else if (pname.compare ("__plot_stream__")) | ||||
return property (&__plot_stream__, true); | ||||
else | else | |||
return base_properties::get_property (pname); | return base_properties::get_property (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
figure::properties::factory_defaults (void) | figure::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["__plot_stream__"] = Matrix (); | m["alphamap"] = Matrix (64, 1, 1); | |||
m["__enhanced__"] = "on"; | m["buttondownfcn"] = Matrix (); | |||
m["nextplot"] = "add"; | ||||
m["closerequestfcn"] = "closereq"; | m["closerequestfcn"] = "closereq"; | |||
m["currentaxes"] = graphics_handle ().as_octave_value (); | ||||
m["colormap"] = jet_colormap (); | ||||
m["paperorientation"] = "portrait"; | ||||
m["color"] = color_property (color_values (1, 1, 1), radio_values ("none" )); | m["color"] = color_property (color_values (1, 1, 1), radio_values ("none" )); | |||
m["alphamap"] = Matrix (64, 1, 1); | m["colormap"] = jet_colormap (); | |||
m["currentaxes"] = graphics_handle ().as_octave_value (); | ||||
m["currentcharacter"] = ""; | m["currentcharacter"] = ""; | |||
m["currentobject"] = graphics_handle ().as_octave_value (); | m["currentobject"] = graphics_handle ().as_octave_value (); | |||
m["currentpoint"] = Matrix (2, 1, 0); | m["currentpoint"] = Matrix (2, 1, 0); | |||
m["dockcontrols"] = "off"; | m["dockcontrols"] = "off"; | |||
m["doublebuffer"] = "on"; | m["doublebuffer"] = "on"; | |||
m["filename"] = ""; | m["filename"] = ""; | |||
m["integerhandle"] = "on"; | m["integerhandle"] = "on"; | |||
m["inverthardcopy"] = "off"; | m["inverthardcopy"] = "off"; | |||
m["keypressfcn"] = Matrix (); | m["keypressfcn"] = Matrix (); | |||
m["keyreleasefcn"] = Matrix (); | m["keyreleasefcn"] = Matrix (); | |||
m["menubar"] = "figure"; | m["menubar"] = "figure"; | |||
m["mincolormap"] = 64; | m["mincolormap"] = 64; | |||
m["name"] = ""; | m["name"] = ""; | |||
m["nextplot"] = "add"; | ||||
m["numbertitle"] = "on"; | m["numbertitle"] = "on"; | |||
m["outerposition"] = Matrix (1, 4, -1.0); | m["outerposition"] = Matrix (1, 4, -1.0); | |||
m["paperunits"] = "inches"; | m["paperorientation"] = "portrait"; | |||
m["paperposition"] = default_figure_paperposition (); | m["paperposition"] = default_figure_paperposition (); | |||
m["paperpositionmode"] = "manual"; | m["paperpositionmode"] = "manual"; | |||
m["papersize"] = default_figure_papersize (); | m["papersize"] = default_figure_papersize (); | |||
m["papertype"] = "usletter"; | m["papertype"] = "usletter"; | |||
m["paperunits"] = "inches"; | ||||
m["pointer"] = "arrow"; | m["pointer"] = "arrow"; | |||
m["pointershapecdata"] = Matrix (16, 16, 0); | m["pointershapecdata"] = Matrix (16, 16, 0); | |||
m["pointershapehotspot"] = Matrix (1, 2, 0); | m["pointershapehotspot"] = Matrix (1, 2, 0); | |||
m["position"] = default_figure_position (); | m["position"] = default_figure_position (); | |||
m["renderer"] = "painters"; | m["renderer"] = "painters"; | |||
m["renderermode"] = "auto"; | m["renderermode"] = "auto"; | |||
m["resize"] = "on"; | m["resize"] = "on"; | |||
m["resizefcn"] = Matrix (); | m["resizefcn"] = Matrix (); | |||
m["selectiontype"] = "normal"; | m["selectiontype"] = "normal"; | |||
m["toolbar"] = "auto"; | m["toolbar"] = "auto"; | |||
m["units"] = "pixels"; | m["units"] = "pixels"; | |||
m["windowbuttondownfcn"] = Matrix (); | m["windowbuttondownfcn"] = Matrix (); | |||
m["windowbuttonmotionfcn"] = Matrix (); | m["windowbuttonmotionfcn"] = Matrix (); | |||
m["windowbuttonupfcn"] = Matrix (); | m["windowbuttonupfcn"] = Matrix (); | |||
m["windowbuttonwheelfcn"] = Matrix (); | m["windowkeypressfcn"] = Matrix (); | |||
m["windowkeyreleasefcn"] = Matrix (); | ||||
m["windowscrollwheelfcn"] = Matrix (); | ||||
m["windowstyle"] = "normal"; | m["windowstyle"] = "normal"; | |||
m["wvisual"] = ""; | m["wvisual"] = ""; | |||
m["wvisualmode"] = "auto"; | m["wvisualmode"] = "auto"; | |||
m["xdisplay"] = ""; | m["xdisplay"] = ""; | |||
m["xvisual"] = ""; | m["xvisual"] = ""; | |||
m["xvisualmode"] = "auto"; | m["xvisualmode"] = "auto"; | |||
m["buttondownfcn"] = Matrix (); | m["__enhanced__"] = "on"; | |||
m["__graphics_toolkit__"] = "gnuplot"; | m["__graphics_toolkit__"] = gtk_manager::default_toolkit (); | |||
m["__guidata__"] = Matrix (); | m["__guidata__"] = Matrix (); | |||
m["__plot_stream__"] = Matrix (); | ||||
return m; | return m; | |||
} | } | |||
std::string figure::properties::go_name ("figure"); | std::string figure::properties::go_name ("figure"); | |||
std::set<std::string> | std::set<std::string> | |||
figure::properties::core_property_names (void) | figure::properties::core_property_names (void) | |||
{ | { | |||
static std::set<std::string> all_pnames; | static std::set<std::string> all_pnames; | |||
static bool initialized = false; | static bool initialized = false; | |||
if (! initialized) | if (! initialized) | |||
{ | { | |||
all_pnames.insert ("__plot_stream__"); | all_pnames.insert ("alphamap"); | |||
all_pnames.insert ("__enhanced__"); | all_pnames.insert ("buttondownfcn"); | |||
all_pnames.insert ("nextplot"); | ||||
all_pnames.insert ("closerequestfcn"); | all_pnames.insert ("closerequestfcn"); | |||
all_pnames.insert ("currentaxes"); | ||||
all_pnames.insert ("colormap"); | ||||
all_pnames.insert ("paperorientation"); | ||||
all_pnames.insert ("color"); | all_pnames.insert ("color"); | |||
all_pnames.insert ("alphamap"); | all_pnames.insert ("colormap"); | |||
all_pnames.insert ("currentaxes"); | ||||
all_pnames.insert ("currentcharacter"); | all_pnames.insert ("currentcharacter"); | |||
all_pnames.insert ("currentobject"); | all_pnames.insert ("currentobject"); | |||
all_pnames.insert ("currentpoint"); | all_pnames.insert ("currentpoint"); | |||
all_pnames.insert ("dockcontrols"); | all_pnames.insert ("dockcontrols"); | |||
all_pnames.insert ("doublebuffer"); | all_pnames.insert ("doublebuffer"); | |||
all_pnames.insert ("filename"); | all_pnames.insert ("filename"); | |||
all_pnames.insert ("integerhandle"); | all_pnames.insert ("integerhandle"); | |||
all_pnames.insert ("inverthardcopy"); | all_pnames.insert ("inverthardcopy"); | |||
all_pnames.insert ("keypressfcn"); | all_pnames.insert ("keypressfcn"); | |||
all_pnames.insert ("keyreleasefcn"); | all_pnames.insert ("keyreleasefcn"); | |||
all_pnames.insert ("menubar"); | all_pnames.insert ("menubar"); | |||
all_pnames.insert ("mincolormap"); | all_pnames.insert ("mincolormap"); | |||
all_pnames.insert ("name"); | all_pnames.insert ("name"); | |||
all_pnames.insert ("nextplot"); | ||||
all_pnames.insert ("numbertitle"); | all_pnames.insert ("numbertitle"); | |||
all_pnames.insert ("outerposition"); | all_pnames.insert ("outerposition"); | |||
all_pnames.insert ("paperunits"); | all_pnames.insert ("paperorientation"); | |||
all_pnames.insert ("paperposition"); | all_pnames.insert ("paperposition"); | |||
all_pnames.insert ("paperpositionmode"); | all_pnames.insert ("paperpositionmode"); | |||
all_pnames.insert ("papersize"); | all_pnames.insert ("papersize"); | |||
all_pnames.insert ("papertype"); | all_pnames.insert ("papertype"); | |||
all_pnames.insert ("paperunits"); | ||||
all_pnames.insert ("pointer"); | all_pnames.insert ("pointer"); | |||
all_pnames.insert ("pointershapecdata"); | all_pnames.insert ("pointershapecdata"); | |||
all_pnames.insert ("pointershapehotspot"); | all_pnames.insert ("pointershapehotspot"); | |||
all_pnames.insert ("position"); | all_pnames.insert ("position"); | |||
all_pnames.insert ("renderer"); | all_pnames.insert ("renderer"); | |||
all_pnames.insert ("renderermode"); | all_pnames.insert ("renderermode"); | |||
all_pnames.insert ("resize"); | all_pnames.insert ("resize"); | |||
all_pnames.insert ("resizefcn"); | all_pnames.insert ("resizefcn"); | |||
all_pnames.insert ("selectiontype"); | all_pnames.insert ("selectiontype"); | |||
all_pnames.insert ("toolbar"); | all_pnames.insert ("toolbar"); | |||
all_pnames.insert ("units"); | all_pnames.insert ("units"); | |||
all_pnames.insert ("windowbuttondownfcn"); | all_pnames.insert ("windowbuttondownfcn"); | |||
all_pnames.insert ("windowbuttonmotionfcn"); | all_pnames.insert ("windowbuttonmotionfcn"); | |||
all_pnames.insert ("windowbuttonupfcn"); | all_pnames.insert ("windowbuttonupfcn"); | |||
all_pnames.insert ("windowbuttonwheelfcn"); | all_pnames.insert ("windowkeypressfcn"); | |||
all_pnames.insert ("windowkeyreleasefcn"); | ||||
all_pnames.insert ("windowscrollwheelfcn"); | ||||
all_pnames.insert ("windowstyle"); | all_pnames.insert ("windowstyle"); | |||
all_pnames.insert ("wvisual"); | all_pnames.insert ("wvisual"); | |||
all_pnames.insert ("wvisualmode"); | all_pnames.insert ("wvisualmode"); | |||
all_pnames.insert ("xdisplay"); | all_pnames.insert ("xdisplay"); | |||
all_pnames.insert ("xvisual"); | all_pnames.insert ("xvisual"); | |||
all_pnames.insert ("xvisualmode"); | all_pnames.insert ("xvisualmode"); | |||
all_pnames.insert ("buttondownfcn"); | all_pnames.insert ("__enhanced__"); | |||
all_pnames.insert ("__graphics_toolkit__"); | all_pnames.insert ("__graphics_toolkit__"); | |||
all_pnames.insert ("__guidata__"); | all_pnames.insert ("__guidata__"); | |||
all_pnames.insert ("__plot_stream__"); | ||||
std::set<std::string> base_pnames = base_properties::core_property_na mes (); | std::set<std::string> base_pnames = base_properties::core_property_na mes (); | |||
all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | |||
initialized = true; | initialized = true; | |||
} | } | |||
return all_pnames; | return all_pnames; | |||
} | } | |||
skipping to change at line 1319 | skipping to change at line 1361 | |||
{ | { | |||
std::set<std::string> pnames = all_property_names (); | std::set<std::string> pnames = all_property_names (); | |||
return pnames.find (pname) != pnames.end (); | return pnames.find (pname) != pnames.end (); | |||
} | } | |||
// ******** axes ******** | // ******** axes ******** | |||
axes::properties::properties (const graphics_handle& mh, const graphics_han dle& p) | axes::properties::properties (const graphics_handle& mh, const graphics_han dle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
position ("position", mh, default_axes_position ()), | activepositionproperty ("activepositionproperty", mh, "{outerposition}| | |||
position"), | ||||
alim ("alim", mh, default_lim ()), | ||||
alimmode ("alimmode", mh, "{auto}|manual"), | ||||
ambientlightcolor ("ambientlightcolor", mh, color_values (1, 1, 1)), | ||||
box ("box", mh, "on"), | box ("box", mh, "on"), | |||
cameraposition ("cameraposition", mh, Matrix (1, 3, 0.0)), | ||||
camerapositionmode ("camerapositionmode", mh, "{auto}|manual"), | ||||
cameratarget ("cameratarget", mh, Matrix (1, 3, 0.0)), | ||||
cameratargetmode ("cameratargetmode", mh, "{auto}|manual"), | ||||
cameraupvector ("cameraupvector", mh, Matrix ()), | ||||
cameraupvectormode ("cameraupvectormode", mh, "{auto}|manual"), | ||||
cameraviewangle ("cameraviewangle", mh, 10.0), | ||||
cameraviewanglemode ("cameraviewanglemode", mh, "{auto}|manual"), | ||||
clim ("clim", mh, default_lim ()), | ||||
climmode ("climmode", mh, "{auto}|manual"), | ||||
color ("color", mh, color_property (color_values (1, 1, 1), radio_value | ||||
s ("none"))), | ||||
colororder ("colororder", mh, default_colororder ()), | colororder ("colororder", mh, default_colororder ()), | |||
currentpoint ("currentpoint", mh, Matrix (2, 3, 0.0)), | ||||
dataaspectratio ("dataaspectratio", mh, Matrix (1, 3, 1.0)), | dataaspectratio ("dataaspectratio", mh, Matrix (1, 3, 1.0)), | |||
dataaspectratiomode ("dataaspectratiomode", mh, "{auto}|manual"), | dataaspectratiomode ("dataaspectratiomode", mh, "{auto}|manual"), | |||
drawmode ("drawmode", mh, "{normal}|fast"), | ||||
fontangle ("fontangle", mh, "{normal}|italic|oblique"), | ||||
fontname ("fontname", mh, OCTAVE_DEFAULT_FONTNAME), | ||||
fontsize ("fontsize", mh, 10), | ||||
fontunits ("fontunits", mh, "{points}|normalized|inches|centimeters|pix | ||||
els"), | ||||
fontweight ("fontweight", mh, "{normal}|light|demi|bold"), | ||||
gridlinestyle ("gridlinestyle", mh, "-|--|{:}|-.|none"), | ||||
interpreter ("interpreter", mh, "tex|{none}|latex"), | ||||
layer ("layer", mh, "{bottom}|top"), | layer ("layer", mh, "{bottom}|top"), | |||
xlim ("xlim", mh, default_lim ()), | ||||
ylim ("ylim", mh, default_lim ()), | ||||
zlim ("zlim", mh, default_lim ()), | ||||
clim ("clim", mh, default_lim ()), | ||||
alim ("alim", mh, default_lim ()), | ||||
xlimmode ("xlimmode", mh, "{auto}|manual"), | ||||
ylimmode ("ylimmode", mh, "{auto}|manual"), | ||||
zlimmode ("zlimmode", mh, "{auto}|manual"), | ||||
climmode ("climmode", mh, "{auto}|manual"), | ||||
alimmode ("alimmode", mh, "{auto}|manual"), | ||||
xlabel ("xlabel", mh, gh_manager::make_graphics_handle ("text", __myhan | ||||
dle__, false, false, false)), | ||||
ylabel ("ylabel", mh, gh_manager::make_graphics_handle ("text", __myhan | ||||
dle__, false, false, false)), | ||||
zlabel ("zlabel", mh, gh_manager::make_graphics_handle ("text", __myhan | ||||
dle__, false, false, false)), | ||||
title ("title", mh, gh_manager::make_graphics_handle ("text", __myhandl | ||||
e__, false, false, false)), | ||||
xgrid ("xgrid", mh, "off"), | ||||
ygrid ("ygrid", mh, "off"), | ||||
zgrid ("zgrid", mh, "off"), | ||||
xminorgrid ("xminorgrid", mh, "off"), | ||||
yminorgrid ("yminorgrid", mh, "off"), | ||||
zminorgrid ("zminorgrid", mh, "off"), | ||||
xtick ("xtick", mh, default_axes_tick ()), | ||||
ytick ("ytick", mh, default_axes_tick ()), | ||||
ztick ("ztick", mh, default_axes_tick ()), | ||||
xtickmode ("xtickmode", mh, "{auto}|manual"), | ||||
ytickmode ("ytickmode", mh, "{auto}|manual"), | ||||
ztickmode ("ztickmode", mh, "{auto}|manual"), | ||||
xminortick ("xminortick", mh, "off"), | ||||
yminortick ("yminortick", mh, "off"), | ||||
zminortick ("zminortick", mh, "off"), | ||||
xticklabel ("xticklabel", mh, ""), | ||||
yticklabel ("yticklabel", mh, ""), | ||||
zticklabel ("zticklabel", mh, ""), | ||||
xticklabelmode ("xticklabelmode", mh, "{auto}|manual"), | ||||
yticklabelmode ("yticklabelmode", mh, "{auto}|manual"), | ||||
zticklabelmode ("zticklabelmode", mh, "{auto}|manual"), | ||||
interpreter ("interpreter", mh, "tex|{none}|latex"), | ||||
color ("color", mh, color_property (color_values (1, 1, 1), radio_value | ||||
s ("none"))), | ||||
xcolor ("xcolor", mh, color_values (0, 0, 0)), | ||||
ycolor ("ycolor", mh, color_values (0, 0, 0)), | ||||
zcolor ("zcolor", mh, color_values (0, 0, 0)), | ||||
xscale ("xscale", mh, "{linear}|log"), | ||||
yscale ("yscale", mh, "{linear}|log"), | ||||
zscale ("zscale", mh, "{linear}|log"), | ||||
xdir ("xdir", mh, "{normal}|reverse"), | ||||
ydir ("ydir", mh, "{normal}|reverse"), | ||||
zdir ("zdir", mh, "{normal}|reverse"), | ||||
yaxislocation ("yaxislocation", mh, "{left}|right|zero"), | ||||
xaxislocation ("xaxislocation", mh, "{bottom}|top|zero"), | ||||
view ("view", mh, Matrix ()), | ||||
__hold_all__ ("__hold_all__", mh, "off"), | ||||
nextplot ("nextplot", mh, "new|add|replacechildren|{replace}"), | ||||
outerposition ("outerposition", mh, default_axes_outerposition ()), | ||||
activepositionproperty ("activepositionproperty", mh, "{outerposition}| | ||||
position"), | ||||
ambientlightcolor ("ambientlightcolor", mh, color_values (1, 1, 1)), | ||||
cameraposition ("cameraposition", mh, Matrix (1, 3, 0.0)), | ||||
cameratarget ("cameratarget", mh, Matrix (1, 3, 0.0)), | ||||
cameraupvector ("cameraupvector", mh, Matrix ()), | ||||
cameraviewangle ("cameraviewangle", mh, 10.0), | ||||
camerapositionmode ("camerapositionmode", mh, "{auto}|manual"), | ||||
cameratargetmode ("cameratargetmode", mh, "{auto}|manual"), | ||||
cameraupvectormode ("cameraupvectormode", mh, "{auto}|manual"), | ||||
cameraviewanglemode ("cameraviewanglemode", mh, "{auto}|manual"), | ||||
currentpoint ("currentpoint", mh, Matrix (2, 3, 0.0)), | ||||
drawmode ("drawmode", mh, "{normal}|fast"), | ||||
fontangle ("fontangle", mh, "{normal}|italic|oblique"), | ||||
fontname ("fontname", mh, OCTAVE_DEFAULT_FONTNAME), | ||||
fontsize ("fontsize", mh, 10), | ||||
fontunits ("fontunits", mh, "{points}|normalized|inches|centimeters|pix | ||||
els"), | ||||
fontweight ("fontweight", mh, "{normal}|light|demi|bold"), | ||||
gridlinestyle ("gridlinestyle", mh, "-|--|{:}|-.|none"), | ||||
linestyleorder ("linestyleorder", mh, "-"), | linestyleorder ("linestyleorder", mh, "-"), | |||
linewidth ("linewidth", mh, 0.5), | linewidth ("linewidth", mh, 0.5), | |||
minorgridlinestyle ("minorgridlinestyle", mh, "-|--|{:}|-.|none"), | minorgridlinestyle ("minorgridlinestyle", mh, "-|--|{:}|-.|none"), | |||
nextplot ("nextplot", mh, "add|replacechildren|{replace}"), | ||||
outerposition ("outerposition", mh, default_axes_outerposition ()), | ||||
plotboxaspectratio ("plotboxaspectratio", mh, Matrix (1, 3, 1.0)), | plotboxaspectratio ("plotboxaspectratio", mh, Matrix (1, 3, 1.0)), | |||
plotboxaspectratiomode ("plotboxaspectratiomode", mh, "{auto}|manual"), | plotboxaspectratiomode ("plotboxaspectratiomode", mh, "{auto}|manual"), | |||
position ("position", mh, default_axes_position ()), | ||||
projection ("projection", mh, "{orthographic}|perpective"), | projection ("projection", mh, "{orthographic}|perpective"), | |||
tickdir ("tickdir", mh, "{in}|out"), | tickdir ("tickdir", mh, "{in}|out"), | |||
tickdirmode ("tickdirmode", mh, "{auto}|manual"), | tickdirmode ("tickdirmode", mh, "{auto}|manual"), | |||
ticklength ("ticklength", mh, default_axes_ticklength ()), | ticklength ("ticklength", mh, default_axes_ticklength ()), | |||
tightinset ("tightinset", mh, Matrix (1, 4, 0.0)), | tightinset ("tightinset", mh, Matrix (1, 4, 0.0)), | |||
title ("title", mh, gh_manager::make_graphics_handle ("text", __myhandl e__, false, false, false)), | ||||
units ("units", mh, "{normalized}|inches|centimeters|points|pixels|char acters"), | units ("units", mh, "{normalized}|inches|centimeters|points|pixels|char acters"), | |||
view ("view", mh, Matrix ()), | ||||
xaxislocation ("xaxislocation", mh, "{bottom}|top|zero"), | ||||
xcolor ("xcolor", mh, color_values (0, 0, 0)), | ||||
xdir ("xdir", mh, "{normal}|reverse"), | ||||
xgrid ("xgrid", mh, "off"), | ||||
xlabel ("xlabel", mh, gh_manager::make_graphics_handle ("text", __myhan | ||||
dle__, false, false, false)), | ||||
xlim ("xlim", mh, default_lim ()), | ||||
xlimmode ("xlimmode", mh, "{auto}|manual"), | ||||
xminorgrid ("xminorgrid", mh, "off"), | ||||
xminortick ("xminortick", mh, "off"), | ||||
xscale ("xscale", mh, "{linear}|log"), | ||||
xtick ("xtick", mh, default_axes_tick ()), | ||||
xticklabel ("xticklabel", mh, ""), | ||||
xticklabelmode ("xticklabelmode", mh, "{auto}|manual"), | ||||
xtickmode ("xtickmode", mh, "{auto}|manual"), | ||||
yaxislocation ("yaxislocation", mh, "{left}|right|zero"), | ||||
ycolor ("ycolor", mh, color_values (0, 0, 0)), | ||||
ydir ("ydir", mh, "{normal}|reverse"), | ||||
ygrid ("ygrid", mh, "off"), | ||||
ylabel ("ylabel", mh, gh_manager::make_graphics_handle ("text", __myhan | ||||
dle__, false, false, false)), | ||||
ylim ("ylim", mh, default_lim ()), | ||||
ylimmode ("ylimmode", mh, "{auto}|manual"), | ||||
yminorgrid ("yminorgrid", mh, "off"), | ||||
yminortick ("yminortick", mh, "off"), | ||||
yscale ("yscale", mh, "{linear}|log"), | ||||
ytick ("ytick", mh, default_axes_tick ()), | ||||
yticklabel ("yticklabel", mh, ""), | ||||
yticklabelmode ("yticklabelmode", mh, "{auto}|manual"), | ||||
ytickmode ("ytickmode", mh, "{auto}|manual"), | ||||
zcolor ("zcolor", mh, color_values (0, 0, 0)), | ||||
zdir ("zdir", mh, "{normal}|reverse"), | ||||
zgrid ("zgrid", mh, "off"), | ||||
zlabel ("zlabel", mh, gh_manager::make_graphics_handle ("text", __myhan | ||||
dle__, false, false, false)), | ||||
zlim ("zlim", mh, default_lim ()), | ||||
zlimmode ("zlimmode", mh, "{auto}|manual"), | ||||
zminorgrid ("zminorgrid", mh, "off"), | ||||
zminortick ("zminortick", mh, "off"), | ||||
zscale ("zscale", mh, "{linear}|log"), | ||||
ztick ("ztick", mh, default_axes_tick ()), | ||||
zticklabel ("zticklabel", mh, ""), | ||||
zticklabelmode ("zticklabelmode", mh, "{auto}|manual"), | ||||
ztickmode ("ztickmode", mh, "{auto}|manual"), | ||||
__hold_all__ ("__hold_all__", mh, "off"), | ||||
autopos_tag ("autopos_tag", mh, "{none}|subplot"), | ||||
looseinset ("looseinset", mh, Matrix (1, 4, 0.0)), | ||||
x_viewtransform ("x_viewtransform", mh, Matrix (4, 4, 0.0)), | x_viewtransform ("x_viewtransform", mh, Matrix (4, 4, 0.0)), | |||
x_projectiontransform ("x_projectiontransform", mh, Matrix (4, 4, 0.0)) , | x_projectiontransform ("x_projectiontransform", mh, Matrix (4, 4, 0.0)) , | |||
x_viewporttransform ("x_viewporttransform", mh, Matrix (4, 4, 0.0)), | x_viewporttransform ("x_viewporttransform", mh, Matrix (4, 4, 0.0)), | |||
x_normrendertransform ("x_normrendertransform", mh, Matrix (4, 4, 0.0)) , | x_normrendertransform ("x_normrendertransform", mh, Matrix (4, 4, 0.0)) , | |||
x_rendertransform ("x_rendertransform", mh, Matrix (4, 4, 0.0)), | x_rendertransform ("x_rendertransform", mh, Matrix (4, 4, 0.0)), | |||
xmtick ("xmtick", mh, Matrix ()), | xmtick ("xmtick", mh, Matrix ()), | |||
ymtick ("ymtick", mh, Matrix ()), | ymtick ("ymtick", mh, Matrix ()), | |||
zmtick ("zmtick", mh, Matrix ()), | zmtick ("zmtick", mh, Matrix ()) | |||
looseinset ("looseinset", mh, Matrix (1, 4, 0.0)), | ||||
autopos_tag ("autopos_tag", mh, "{none}|subplot") | ||||
{ | { | |||
position.set_id (ID_POSITION); | activepositionproperty.set_id (ID_ACTIVEPOSITIONPROPERTY); | |||
box.set_id (ID_BOX); | ||||
colororder.set_id (ID_COLORORDER); | ||||
dataaspectratio.set_id (ID_DATAASPECTRATIO); | ||||
dataaspectratiomode.set_id (ID_DATAASPECTRATIOMODE); | ||||
layer.set_id (ID_LAYER); | ||||
xlim.set_id (ID_XLIM); | ||||
ylim.set_id (ID_YLIM); | ||||
zlim.set_id (ID_ZLIM); | ||||
clim.set_id (ID_CLIM); | ||||
alim.set_id (ID_ALIM); | alim.set_id (ID_ALIM); | |||
xlimmode.set_id (ID_XLIMMODE); | ||||
ylimmode.set_id (ID_YLIMMODE); | ||||
zlimmode.set_id (ID_ZLIMMODE); | ||||
climmode.set_id (ID_CLIMMODE); | ||||
alimmode.set_id (ID_ALIMMODE); | alimmode.set_id (ID_ALIMMODE); | |||
xlabel.set_id (ID_XLABEL); | ||||
ylabel.set_id (ID_YLABEL); | ||||
zlabel.set_id (ID_ZLABEL); | ||||
title.set_id (ID_TITLE); | ||||
xgrid.set_id (ID_XGRID); | ||||
ygrid.set_id (ID_YGRID); | ||||
zgrid.set_id (ID_ZGRID); | ||||
xminorgrid.set_id (ID_XMINORGRID); | ||||
yminorgrid.set_id (ID_YMINORGRID); | ||||
zminorgrid.set_id (ID_ZMINORGRID); | ||||
xtick.set_id (ID_XTICK); | ||||
ytick.set_id (ID_YTICK); | ||||
ztick.set_id (ID_ZTICK); | ||||
xtickmode.set_id (ID_XTICKMODE); | ||||
ytickmode.set_id (ID_YTICKMODE); | ||||
ztickmode.set_id (ID_ZTICKMODE); | ||||
xminortick.set_id (ID_XMINORTICK); | ||||
yminortick.set_id (ID_YMINORTICK); | ||||
zminortick.set_id (ID_ZMINORTICK); | ||||
xticklabel.set_id (ID_XTICKLABEL); | ||||
yticklabel.set_id (ID_YTICKLABEL); | ||||
zticklabel.set_id (ID_ZTICKLABEL); | ||||
xticklabelmode.set_id (ID_XTICKLABELMODE); | ||||
yticklabelmode.set_id (ID_YTICKLABELMODE); | ||||
zticklabelmode.set_id (ID_ZTICKLABELMODE); | ||||
interpreter.set_id (ID_INTERPRETER); | ||||
color.set_id (ID_COLOR); | ||||
xcolor.set_id (ID_XCOLOR); | ||||
ycolor.set_id (ID_YCOLOR); | ||||
zcolor.set_id (ID_ZCOLOR); | ||||
xscale.set_id (ID_XSCALE); | ||||
yscale.set_id (ID_YSCALE); | ||||
zscale.set_id (ID_ZSCALE); | ||||
xdir.set_id (ID_XDIR); | ||||
ydir.set_id (ID_YDIR); | ||||
zdir.set_id (ID_ZDIR); | ||||
yaxislocation.set_id (ID_YAXISLOCATION); | ||||
xaxislocation.set_id (ID_XAXISLOCATION); | ||||
view.set_id (ID_VIEW); | ||||
__hold_all__.set_id (ID___HOLD_ALL__); | ||||
__hold_all__.set_hidden (true); | ||||
nextplot.set_id (ID_NEXTPLOT); | ||||
outerposition.set_id (ID_OUTERPOSITION); | ||||
activepositionproperty.set_id (ID_ACTIVEPOSITIONPROPERTY); | ||||
ambientlightcolor.set_id (ID_AMBIENTLIGHTCOLOR); | ambientlightcolor.set_id (ID_AMBIENTLIGHTCOLOR); | |||
box.set_id (ID_BOX); | ||||
cameraposition.set_id (ID_CAMERAPOSITION); | cameraposition.set_id (ID_CAMERAPOSITION); | |||
cameratarget.set_id (ID_CAMERATARGET); | ||||
cameraupvector.set_id (ID_CAMERAUPVECTOR); | ||||
cameraviewangle.set_id (ID_CAMERAVIEWANGLE); | ||||
camerapositionmode.set_id (ID_CAMERAPOSITIONMODE); | camerapositionmode.set_id (ID_CAMERAPOSITIONMODE); | |||
cameratarget.set_id (ID_CAMERATARGET); | ||||
cameratargetmode.set_id (ID_CAMERATARGETMODE); | cameratargetmode.set_id (ID_CAMERATARGETMODE); | |||
cameraupvector.set_id (ID_CAMERAUPVECTOR); | ||||
cameraupvectormode.set_id (ID_CAMERAUPVECTORMODE); | cameraupvectormode.set_id (ID_CAMERAUPVECTORMODE); | |||
cameraviewangle.set_id (ID_CAMERAVIEWANGLE); | ||||
cameraviewanglemode.set_id (ID_CAMERAVIEWANGLEMODE); | cameraviewanglemode.set_id (ID_CAMERAVIEWANGLEMODE); | |||
clim.set_id (ID_CLIM); | ||||
climmode.set_id (ID_CLIMMODE); | ||||
color.set_id (ID_COLOR); | ||||
colororder.set_id (ID_COLORORDER); | ||||
currentpoint.set_id (ID_CURRENTPOINT); | currentpoint.set_id (ID_CURRENTPOINT); | |||
dataaspectratio.set_id (ID_DATAASPECTRATIO); | ||||
dataaspectratiomode.set_id (ID_DATAASPECTRATIOMODE); | ||||
drawmode.set_id (ID_DRAWMODE); | drawmode.set_id (ID_DRAWMODE); | |||
fontangle.set_id (ID_FONTANGLE); | fontangle.set_id (ID_FONTANGLE); | |||
fontname.set_id (ID_FONTNAME); | fontname.set_id (ID_FONTNAME); | |||
fontsize.set_id (ID_FONTSIZE); | fontsize.set_id (ID_FONTSIZE); | |||
fontunits.set_id (ID_FONTUNITS); | fontunits.set_id (ID_FONTUNITS); | |||
fontweight.set_id (ID_FONTWEIGHT); | fontweight.set_id (ID_FONTWEIGHT); | |||
gridlinestyle.set_id (ID_GRIDLINESTYLE); | gridlinestyle.set_id (ID_GRIDLINESTYLE); | |||
interpreter.set_id (ID_INTERPRETER); | ||||
layer.set_id (ID_LAYER); | ||||
linestyleorder.set_id (ID_LINESTYLEORDER); | linestyleorder.set_id (ID_LINESTYLEORDER); | |||
linewidth.set_id (ID_LINEWIDTH); | linewidth.set_id (ID_LINEWIDTH); | |||
minorgridlinestyle.set_id (ID_MINORGRIDLINESTYLE); | minorgridlinestyle.set_id (ID_MINORGRIDLINESTYLE); | |||
nextplot.set_id (ID_NEXTPLOT); | ||||
outerposition.set_id (ID_OUTERPOSITION); | ||||
plotboxaspectratio.set_id (ID_PLOTBOXASPECTRATIO); | plotboxaspectratio.set_id (ID_PLOTBOXASPECTRATIO); | |||
plotboxaspectratiomode.set_id (ID_PLOTBOXASPECTRATIOMODE); | plotboxaspectratiomode.set_id (ID_PLOTBOXASPECTRATIOMODE); | |||
position.set_id (ID_POSITION); | ||||
projection.set_id (ID_PROJECTION); | projection.set_id (ID_PROJECTION); | |||
tickdir.set_id (ID_TICKDIR); | tickdir.set_id (ID_TICKDIR); | |||
tickdirmode.set_id (ID_TICKDIRMODE); | tickdirmode.set_id (ID_TICKDIRMODE); | |||
ticklength.set_id (ID_TICKLENGTH); | ticklength.set_id (ID_TICKLENGTH); | |||
tightinset.set_id (ID_TIGHTINSET); | tightinset.set_id (ID_TIGHTINSET); | |||
title.set_id (ID_TITLE); | ||||
units.set_id (ID_UNITS); | units.set_id (ID_UNITS); | |||
x_viewtransform.set_id (ID_X_VIEWTRANSFORM); | view.set_id (ID_VIEW); | |||
x_viewtransform.set_hidden (true); | xaxislocation.set_id (ID_XAXISLOCATION); | |||
x_projectiontransform.set_id (ID_X_PROJECTIONTRANSFORM); | xcolor.set_id (ID_XCOLOR); | |||
x_projectiontransform.set_hidden (true); | xdir.set_id (ID_XDIR); | |||
x_viewporttransform.set_id (ID_X_VIEWPORTTRANSFORM); | xgrid.set_id (ID_XGRID); | |||
x_viewporttransform.set_hidden (true); | xlabel.set_id (ID_XLABEL); | |||
x_normrendertransform.set_id (ID_X_NORMRENDERTRANSFORM); | xlim.set_id (ID_XLIM); | |||
x_normrendertransform.set_hidden (true); | xlimmode.set_id (ID_XLIMMODE); | |||
x_rendertransform.set_id (ID_X_RENDERTRANSFORM); | xminorgrid.set_id (ID_XMINORGRID); | |||
x_rendertransform.set_hidden (true); | xminortick.set_id (ID_XMINORTICK); | |||
xmtick.set_id (ID_XMTICK); | xscale.set_id (ID_XSCALE); | |||
xmtick.set_hidden (true); | xtick.set_id (ID_XTICK); | |||
ymtick.set_id (ID_YMTICK); | xticklabel.set_id (ID_XTICKLABEL); | |||
ymtick.set_hidden (true); | xticklabelmode.set_id (ID_XTICKLABELMODE); | |||
zmtick.set_id (ID_ZMTICK); | xtickmode.set_id (ID_XTICKMODE); | |||
zmtick.set_hidden (true); | yaxislocation.set_id (ID_YAXISLOCATION); | |||
looseinset.set_id (ID_LOOSEINSET); | ycolor.set_id (ID_YCOLOR); | |||
looseinset.set_hidden (true); | ydir.set_id (ID_YDIR); | |||
autopos_tag.set_id (ID_AUTOPOS_TAG); | ygrid.set_id (ID_YGRID); | |||
autopos_tag.set_hidden (true); | ylabel.set_id (ID_YLABEL); | |||
init (); | ylim.set_id (ID_YLIM); | |||
} | ylimmode.set_id (ID_YLIMMODE); | |||
yminorgrid.set_id (ID_YMINORGRID); | ||||
void | yminortick.set_id (ID_YMINORTICK); | |||
axes::properties::set (const caseless_str& pname_arg, const octave_value& v | yscale.set_id (ID_YSCALE); | |||
al) | ytick.set_id (ID_YTICK); | |||
{ | yticklabel.set_id (ID_YTICKLABEL); | |||
const std::set<std::string>& pnames = all_property_names (); | yticklabelmode.set_id (ID_YTICKLABELMODE); | |||
ytickmode.set_id (ID_YTICKMODE); | ||||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam | zcolor.set_id (ID_ZCOLOR); | |||
e_arg); | zdir.set_id (ID_ZDIR); | |||
zgrid.set_id (ID_ZGRID); | ||||
if (error_state) | zlabel.set_id (ID_ZLABEL); | |||
return; | zlim.set_id (ID_ZLIM); | |||
zlimmode.set_id (ID_ZLIMMODE); | ||||
if (pname.compare ("position")) | zminorgrid.set_id (ID_ZMINORGRID); | |||
set_position (val); | zminortick.set_id (ID_ZMINORTICK); | |||
else if (pname.compare ("box")) | zscale.set_id (ID_ZSCALE); | |||
set_box (val); | ztick.set_id (ID_ZTICK); | |||
else if (pname.compare ("colororder")) | zticklabel.set_id (ID_ZTICKLABEL); | |||
set_colororder (val); | zticklabelmode.set_id (ID_ZTICKLABELMODE); | |||
else if (pname.compare ("dataaspectratio")) | ztickmode.set_id (ID_ZTICKMODE); | |||
set_dataaspectratio (val); | __hold_all__.set_id (ID___HOLD_ALL__); | |||
else if (pname.compare ("dataaspectratiomode")) | __hold_all__.set_hidden (true); | |||
set_dataaspectratiomode (val); | autopos_tag.set_id (ID_AUTOPOS_TAG); | |||
else if (pname.compare ("layer")) | autopos_tag.set_hidden (true); | |||
set_layer (val); | looseinset.set_id (ID_LOOSEINSET); | |||
else if (pname.compare ("xlim")) | looseinset.set_hidden (true); | |||
set_xlim (val); | x_viewtransform.set_id (ID_X_VIEWTRANSFORM); | |||
else if (pname.compare ("ylim")) | x_viewtransform.set_hidden (true); | |||
set_ylim (val); | x_projectiontransform.set_id (ID_X_PROJECTIONTRANSFORM); | |||
else if (pname.compare ("zlim")) | x_projectiontransform.set_hidden (true); | |||
set_zlim (val); | x_viewporttransform.set_id (ID_X_VIEWPORTTRANSFORM); | |||
else if (pname.compare ("clim")) | x_viewporttransform.set_hidden (true); | |||
set_clim (val); | x_normrendertransform.set_id (ID_X_NORMRENDERTRANSFORM); | |||
else if (pname.compare ("alim")) | x_normrendertransform.set_hidden (true); | |||
set_alim (val); | x_rendertransform.set_id (ID_X_RENDERTRANSFORM); | |||
else if (pname.compare ("xlimmode")) | x_rendertransform.set_hidden (true); | |||
set_xlimmode (val); | xmtick.set_id (ID_XMTICK); | |||
else if (pname.compare ("ylimmode")) | xmtick.set_hidden (true); | |||
set_ylimmode (val); | ymtick.set_id (ID_YMTICK); | |||
else if (pname.compare ("zlimmode")) | ymtick.set_hidden (true); | |||
set_zlimmode (val); | zmtick.set_id (ID_ZMTICK); | |||
else if (pname.compare ("climmode")) | zmtick.set_hidden (true); | |||
set_climmode (val); | init (); | |||
else if (pname.compare ("alimmode")) | } | |||
set_alimmode (val); | ||||
else if (pname.compare ("xlabel")) | void | |||
set_xlabel (val); | axes::properties::set (const caseless_str& pname_arg, const octave_value& v | |||
else if (pname.compare ("ylabel")) | al) | |||
set_ylabel (val); | { | |||
else if (pname.compare ("zlabel")) | const std::set<std::string>& pnames = all_property_names (); | |||
set_zlabel (val); | ||||
else if (pname.compare ("title")) | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam | |||
set_title (val); | e_arg); | |||
else if (pname.compare ("xgrid")) | ||||
set_xgrid (val); | if (error_state) | |||
else if (pname.compare ("ygrid")) | return; | |||
set_ygrid (val); | ||||
else if (pname.compare ("zgrid")) | if (pname.compare ("activepositionproperty")) | |||
set_zgrid (val); | ||||
else if (pname.compare ("xminorgrid")) | ||||
set_xminorgrid (val); | ||||
else if (pname.compare ("yminorgrid")) | ||||
set_yminorgrid (val); | ||||
else if (pname.compare ("zminorgrid")) | ||||
set_zminorgrid (val); | ||||
else if (pname.compare ("xtick")) | ||||
set_xtick (val); | ||||
else if (pname.compare ("ytick")) | ||||
set_ytick (val); | ||||
else if (pname.compare ("ztick")) | ||||
set_ztick (val); | ||||
else if (pname.compare ("xtickmode")) | ||||
set_xtickmode (val); | ||||
else if (pname.compare ("ytickmode")) | ||||
set_ytickmode (val); | ||||
else if (pname.compare ("ztickmode")) | ||||
set_ztickmode (val); | ||||
else if (pname.compare ("xminortick")) | ||||
set_xminortick (val); | ||||
else if (pname.compare ("yminortick")) | ||||
set_yminortick (val); | ||||
else if (pname.compare ("zminortick")) | ||||
set_zminortick (val); | ||||
else if (pname.compare ("xticklabel")) | ||||
set_xticklabel (val); | ||||
else if (pname.compare ("yticklabel")) | ||||
set_yticklabel (val); | ||||
else if (pname.compare ("zticklabel")) | ||||
set_zticklabel (val); | ||||
else if (pname.compare ("xticklabelmode")) | ||||
set_xticklabelmode (val); | ||||
else if (pname.compare ("yticklabelmode")) | ||||
set_yticklabelmode (val); | ||||
else if (pname.compare ("zticklabelmode")) | ||||
set_zticklabelmode (val); | ||||
else if (pname.compare ("interpreter")) | ||||
set_interpreter (val); | ||||
else if (pname.compare ("color")) | ||||
set_color (val); | ||||
else if (pname.compare ("xcolor")) | ||||
set_xcolor (val); | ||||
else if (pname.compare ("ycolor")) | ||||
set_ycolor (val); | ||||
else if (pname.compare ("zcolor")) | ||||
set_zcolor (val); | ||||
else if (pname.compare ("xscale")) | ||||
set_xscale (val); | ||||
else if (pname.compare ("yscale")) | ||||
set_yscale (val); | ||||
else if (pname.compare ("zscale")) | ||||
set_zscale (val); | ||||
else if (pname.compare ("xdir")) | ||||
set_xdir (val); | ||||
else if (pname.compare ("ydir")) | ||||
set_ydir (val); | ||||
else if (pname.compare ("zdir")) | ||||
set_zdir (val); | ||||
else if (pname.compare ("yaxislocation")) | ||||
set_yaxislocation (val); | ||||
else if (pname.compare ("xaxislocation")) | ||||
set_xaxislocation (val); | ||||
else if (pname.compare ("view")) | ||||
set_view (val); | ||||
else if (pname.compare ("__hold_all__")) | ||||
set___hold_all__ (val); | ||||
else if (pname.compare ("nextplot")) | ||||
set_nextplot (val); | ||||
else if (pname.compare ("outerposition")) | ||||
set_outerposition (val); | ||||
else if (pname.compare ("activepositionproperty")) | ||||
set_activepositionproperty (val); | set_activepositionproperty (val); | |||
else if (pname.compare ("alim")) | ||||
set_alim (val); | ||||
else if (pname.compare ("alimmode")) | ||||
set_alimmode (val); | ||||
else if (pname.compare ("ambientlightcolor")) | else if (pname.compare ("ambientlightcolor")) | |||
set_ambientlightcolor (val); | set_ambientlightcolor (val); | |||
else if (pname.compare ("box")) | ||||
set_box (val); | ||||
else if (pname.compare ("cameraposition")) | else if (pname.compare ("cameraposition")) | |||
set_cameraposition (val); | set_cameraposition (val); | |||
else if (pname.compare ("cameratarget")) | ||||
set_cameratarget (val); | ||||
else if (pname.compare ("cameraupvector")) | ||||
set_cameraupvector (val); | ||||
else if (pname.compare ("cameraviewangle")) | ||||
set_cameraviewangle (val); | ||||
else if (pname.compare ("camerapositionmode")) | else if (pname.compare ("camerapositionmode")) | |||
set_camerapositionmode (val); | set_camerapositionmode (val); | |||
else if (pname.compare ("cameratarget")) | ||||
set_cameratarget (val); | ||||
else if (pname.compare ("cameratargetmode")) | else if (pname.compare ("cameratargetmode")) | |||
set_cameratargetmode (val); | set_cameratargetmode (val); | |||
else if (pname.compare ("cameraupvector")) | ||||
set_cameraupvector (val); | ||||
else if (pname.compare ("cameraupvectormode")) | else if (pname.compare ("cameraupvectormode")) | |||
set_cameraupvectormode (val); | set_cameraupvectormode (val); | |||
else if (pname.compare ("cameraviewangle")) | ||||
set_cameraviewangle (val); | ||||
else if (pname.compare ("cameraviewanglemode")) | else if (pname.compare ("cameraviewanglemode")) | |||
set_cameraviewanglemode (val); | set_cameraviewanglemode (val); | |||
else if (pname.compare ("clim")) | ||||
set_clim (val); | ||||
else if (pname.compare ("climmode")) | ||||
set_climmode (val); | ||||
else if (pname.compare ("color")) | ||||
set_color (val); | ||||
else if (pname.compare ("colororder")) | ||||
set_colororder (val); | ||||
else if (pname.compare ("currentpoint")) | else if (pname.compare ("currentpoint")) | |||
set_currentpoint (val); | set_currentpoint (val); | |||
else if (pname.compare ("dataaspectratio")) | ||||
set_dataaspectratio (val); | ||||
else if (pname.compare ("dataaspectratiomode")) | ||||
set_dataaspectratiomode (val); | ||||
else if (pname.compare ("drawmode")) | else if (pname.compare ("drawmode")) | |||
set_drawmode (val); | set_drawmode (val); | |||
else if (pname.compare ("fontangle")) | else if (pname.compare ("fontangle")) | |||
set_fontangle (val); | set_fontangle (val); | |||
else if (pname.compare ("fontname")) | else if (pname.compare ("fontname")) | |||
set_fontname (val); | set_fontname (val); | |||
else if (pname.compare ("fontsize")) | else if (pname.compare ("fontsize")) | |||
set_fontsize (val); | set_fontsize (val); | |||
else if (pname.compare ("fontunits")) | else if (pname.compare ("fontunits")) | |||
set_fontunits (val); | set_fontunits (val); | |||
else if (pname.compare ("fontweight")) | else if (pname.compare ("fontweight")) | |||
set_fontweight (val); | set_fontweight (val); | |||
else if (pname.compare ("gridlinestyle")) | else if (pname.compare ("gridlinestyle")) | |||
set_gridlinestyle (val); | set_gridlinestyle (val); | |||
else if (pname.compare ("interpreter")) | ||||
set_interpreter (val); | ||||
else if (pname.compare ("layer")) | ||||
set_layer (val); | ||||
else if (pname.compare ("linestyleorder")) | else if (pname.compare ("linestyleorder")) | |||
set_linestyleorder (val); | set_linestyleorder (val); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
set_linewidth (val); | set_linewidth (val); | |||
else if (pname.compare ("minorgridlinestyle")) | else if (pname.compare ("minorgridlinestyle")) | |||
set_minorgridlinestyle (val); | set_minorgridlinestyle (val); | |||
else if (pname.compare ("nextplot")) | ||||
set_nextplot (val); | ||||
else if (pname.compare ("outerposition")) | ||||
set_outerposition (val); | ||||
else if (pname.compare ("plotboxaspectratio")) | else if (pname.compare ("plotboxaspectratio")) | |||
set_plotboxaspectratio (val); | set_plotboxaspectratio (val); | |||
else if (pname.compare ("plotboxaspectratiomode")) | else if (pname.compare ("plotboxaspectratiomode")) | |||
set_plotboxaspectratiomode (val); | set_plotboxaspectratiomode (val); | |||
else if (pname.compare ("position")) | ||||
set_position (val); | ||||
else if (pname.compare ("projection")) | else if (pname.compare ("projection")) | |||
set_projection (val); | set_projection (val); | |||
else if (pname.compare ("tickdir")) | else if (pname.compare ("tickdir")) | |||
set_tickdir (val); | set_tickdir (val); | |||
else if (pname.compare ("tickdirmode")) | else if (pname.compare ("tickdirmode")) | |||
set_tickdirmode (val); | set_tickdirmode (val); | |||
else if (pname.compare ("ticklength")) | else if (pname.compare ("ticklength")) | |||
set_ticklength (val); | set_ticklength (val); | |||
else if (pname.compare ("title")) | ||||
set_title (val); | ||||
else if (pname.compare ("units")) | else if (pname.compare ("units")) | |||
set_units (val); | set_units (val); | |||
else if (pname.compare ("view")) | ||||
set_view (val); | ||||
else if (pname.compare ("xaxislocation")) | ||||
set_xaxislocation (val); | ||||
else if (pname.compare ("xcolor")) | ||||
set_xcolor (val); | ||||
else if (pname.compare ("xdir")) | ||||
set_xdir (val); | ||||
else if (pname.compare ("xgrid")) | ||||
set_xgrid (val); | ||||
else if (pname.compare ("xlabel")) | ||||
set_xlabel (val); | ||||
else if (pname.compare ("xlim")) | ||||
set_xlim (val); | ||||
else if (pname.compare ("xlimmode")) | ||||
set_xlimmode (val); | ||||
else if (pname.compare ("xminorgrid")) | ||||
set_xminorgrid (val); | ||||
else if (pname.compare ("xminortick")) | ||||
set_xminortick (val); | ||||
else if (pname.compare ("xscale")) | ||||
set_xscale (val); | ||||
else if (pname.compare ("xtick")) | ||||
set_xtick (val); | ||||
else if (pname.compare ("xticklabel")) | ||||
set_xticklabel (val); | ||||
else if (pname.compare ("xticklabelmode")) | ||||
set_xticklabelmode (val); | ||||
else if (pname.compare ("xtickmode")) | ||||
set_xtickmode (val); | ||||
else if (pname.compare ("yaxislocation")) | ||||
set_yaxislocation (val); | ||||
else if (pname.compare ("ycolor")) | ||||
set_ycolor (val); | ||||
else if (pname.compare ("ydir")) | ||||
set_ydir (val); | ||||
else if (pname.compare ("ygrid")) | ||||
set_ygrid (val); | ||||
else if (pname.compare ("ylabel")) | ||||
set_ylabel (val); | ||||
else if (pname.compare ("ylim")) | ||||
set_ylim (val); | ||||
else if (pname.compare ("ylimmode")) | ||||
set_ylimmode (val); | ||||
else if (pname.compare ("yminorgrid")) | ||||
set_yminorgrid (val); | ||||
else if (pname.compare ("yminortick")) | ||||
set_yminortick (val); | ||||
else if (pname.compare ("yscale")) | ||||
set_yscale (val); | ||||
else if (pname.compare ("ytick")) | ||||
set_ytick (val); | ||||
else if (pname.compare ("yticklabel")) | ||||
set_yticklabel (val); | ||||
else if (pname.compare ("yticklabelmode")) | ||||
set_yticklabelmode (val); | ||||
else if (pname.compare ("ytickmode")) | ||||
set_ytickmode (val); | ||||
else if (pname.compare ("zcolor")) | ||||
set_zcolor (val); | ||||
else if (pname.compare ("zdir")) | ||||
set_zdir (val); | ||||
else if (pname.compare ("zgrid")) | ||||
set_zgrid (val); | ||||
else if (pname.compare ("zlabel")) | ||||
set_zlabel (val); | ||||
else if (pname.compare ("zlim")) | ||||
set_zlim (val); | ||||
else if (pname.compare ("zlimmode")) | ||||
set_zlimmode (val); | ||||
else if (pname.compare ("zminorgrid")) | ||||
set_zminorgrid (val); | ||||
else if (pname.compare ("zminortick")) | ||||
set_zminortick (val); | ||||
else if (pname.compare ("zscale")) | ||||
set_zscale (val); | ||||
else if (pname.compare ("ztick")) | ||||
set_ztick (val); | ||||
else if (pname.compare ("zticklabel")) | ||||
set_zticklabel (val); | ||||
else if (pname.compare ("zticklabelmode")) | ||||
set_zticklabelmode (val); | ||||
else if (pname.compare ("ztickmode")) | ||||
set_ztickmode (val); | ||||
else if (pname.compare ("__hold_all__")) | ||||
set___hold_all__ (val); | ||||
else if (pname.compare ("autopos_tag")) | ||||
set_autopos_tag (val); | ||||
else if (pname.compare ("looseinset")) | ||||
set_looseinset (val); | ||||
else if (pname.compare ("x_viewtransform")) | else if (pname.compare ("x_viewtransform")) | |||
set_x_viewtransform (val); | set_x_viewtransform (val); | |||
else if (pname.compare ("x_projectiontransform")) | else if (pname.compare ("x_projectiontransform")) | |||
set_x_projectiontransform (val); | set_x_projectiontransform (val); | |||
else if (pname.compare ("x_viewporttransform")) | else if (pname.compare ("x_viewporttransform")) | |||
set_x_viewporttransform (val); | set_x_viewporttransform (val); | |||
else if (pname.compare ("x_normrendertransform")) | else if (pname.compare ("x_normrendertransform")) | |||
set_x_normrendertransform (val); | set_x_normrendertransform (val); | |||
else if (pname.compare ("x_rendertransform")) | else if (pname.compare ("x_rendertransform")) | |||
set_x_rendertransform (val); | set_x_rendertransform (val); | |||
else if (pname.compare ("xmtick")) | else if (pname.compare ("xmtick")) | |||
set_xmtick (val); | set_xmtick (val); | |||
else if (pname.compare ("ymtick")) | else if (pname.compare ("ymtick")) | |||
set_ymtick (val); | set_ymtick (val); | |||
else if (pname.compare ("zmtick")) | else if (pname.compare ("zmtick")) | |||
set_zmtick (val); | set_zmtick (val); | |||
else if (pname.compare ("looseinset")) | ||||
set_looseinset (val); | ||||
else if (pname.compare ("autopos_tag")) | ||||
set_autopos_tag (val); | ||||
else | else | |||
base_properties::set (pname, val); | base_properties::set (pname, val); | |||
} | } | |||
octave_value | octave_value | |||
axes::properties::get (bool all) const | axes::properties::get (bool all) const | |||
{ | { | |||
octave_map m = base_properties::get (all).map_value (); | octave_map m = base_properties::get (all).map_value (); | |||
m.assign ("position", octave_value (get_position ())); | m.assign ("activepositionproperty", octave_value (get_activepositionprope | |||
m.assign ("box", octave_value (get_box ())); | rty ())); | |||
m.assign ("colororder", octave_value (get_colororder ())); | ||||
m.assign ("dataaspectratio", octave_value (get_dataaspectratio ())); | ||||
m.assign ("dataaspectratiomode", octave_value (get_dataaspectratiomode () | ||||
)); | ||||
m.assign ("layer", octave_value (get_layer ())); | ||||
m.assign ("xlim", octave_value (get_xlim ())); | ||||
m.assign ("ylim", octave_value (get_ylim ())); | ||||
m.assign ("zlim", octave_value (get_zlim ())); | ||||
m.assign ("clim", octave_value (get_clim ())); | ||||
m.assign ("alim", octave_value (get_alim ())); | m.assign ("alim", octave_value (get_alim ())); | |||
m.assign ("xlimmode", octave_value (get_xlimmode ())); | ||||
m.assign ("ylimmode", octave_value (get_ylimmode ())); | ||||
m.assign ("zlimmode", octave_value (get_zlimmode ())); | ||||
m.assign ("climmode", octave_value (get_climmode ())); | ||||
m.assign ("alimmode", octave_value (get_alimmode ())); | m.assign ("alimmode", octave_value (get_alimmode ())); | |||
m.assign ("xlabel", octave_value (get_xlabel ().as_octave_value ())); | ||||
m.assign ("ylabel", octave_value (get_ylabel ().as_octave_value ())); | ||||
m.assign ("zlabel", octave_value (get_zlabel ().as_octave_value ())); | ||||
m.assign ("title", octave_value (get_title ().as_octave_value ())); | ||||
m.assign ("xgrid", octave_value (get_xgrid ())); | ||||
m.assign ("ygrid", octave_value (get_ygrid ())); | ||||
m.assign ("zgrid", octave_value (get_zgrid ())); | ||||
m.assign ("xminorgrid", octave_value (get_xminorgrid ())); | ||||
m.assign ("yminorgrid", octave_value (get_yminorgrid ())); | ||||
m.assign ("zminorgrid", octave_value (get_zminorgrid ())); | ||||
m.assign ("xtick", octave_value (get_xtick ())); | ||||
m.assign ("ytick", octave_value (get_ytick ())); | ||||
m.assign ("ztick", octave_value (get_ztick ())); | ||||
m.assign ("xtickmode", octave_value (get_xtickmode ())); | ||||
m.assign ("ytickmode", octave_value (get_ytickmode ())); | ||||
m.assign ("ztickmode", octave_value (get_ztickmode ())); | ||||
m.assign ("xminortick", octave_value (get_xminortick ())); | ||||
m.assign ("yminortick", octave_value (get_yminortick ())); | ||||
m.assign ("zminortick", octave_value (get_zminortick ())); | ||||
m.assign ("xticklabel", octave_value (get_xticklabel ())); | ||||
m.assign ("yticklabel", octave_value (get_yticklabel ())); | ||||
m.assign ("zticklabel", octave_value (get_zticklabel ())); | ||||
m.assign ("xticklabelmode", octave_value (get_xticklabelmode ())); | ||||
m.assign ("yticklabelmode", octave_value (get_yticklabelmode ())); | ||||
m.assign ("zticklabelmode", octave_value (get_zticklabelmode ())); | ||||
m.assign ("interpreter", octave_value (get_interpreter ())); | ||||
m.assign ("color", octave_value (get_color ())); | ||||
m.assign ("xcolor", octave_value (get_xcolor ())); | ||||
m.assign ("ycolor", octave_value (get_ycolor ())); | ||||
m.assign ("zcolor", octave_value (get_zcolor ())); | ||||
m.assign ("xscale", octave_value (get_xscale ())); | ||||
m.assign ("yscale", octave_value (get_yscale ())); | ||||
m.assign ("zscale", octave_value (get_zscale ())); | ||||
m.assign ("xdir", octave_value (get_xdir ())); | ||||
m.assign ("ydir", octave_value (get_ydir ())); | ||||
m.assign ("zdir", octave_value (get_zdir ())); | ||||
m.assign ("yaxislocation", octave_value (get_yaxislocation ())); | ||||
m.assign ("xaxislocation", octave_value (get_xaxislocation ())); | ||||
m.assign ("view", octave_value (get_view ())); | ||||
if (all) | ||||
m.assign ("__hold_all__", octave_value (get___hold_all__ ())); | ||||
m.assign ("nextplot", octave_value (get_nextplot ())); | ||||
m.assign ("outerposition", octave_value (get_outerposition ())); | ||||
m.assign ("activepositionproperty", octave_value (get_activepositionprope | ||||
rty ())); | ||||
m.assign ("ambientlightcolor", octave_value (get_ambientlightcolor ())); | m.assign ("ambientlightcolor", octave_value (get_ambientlightcolor ())); | |||
m.assign ("box", octave_value (get_box ())); | ||||
m.assign ("cameraposition", octave_value (get_cameraposition ())); | m.assign ("cameraposition", octave_value (get_cameraposition ())); | |||
m.assign ("cameratarget", octave_value (get_cameratarget ())); | ||||
m.assign ("cameraupvector", octave_value (get_cameraupvector ())); | ||||
m.assign ("cameraviewangle", octave_value (get_cameraviewangle ())); | ||||
m.assign ("camerapositionmode", octave_value (get_camerapositionmode ())) ; | m.assign ("camerapositionmode", octave_value (get_camerapositionmode ())) ; | |||
m.assign ("cameratarget", octave_value (get_cameratarget ())); | ||||
m.assign ("cameratargetmode", octave_value (get_cameratargetmode ())); | m.assign ("cameratargetmode", octave_value (get_cameratargetmode ())); | |||
m.assign ("cameraupvector", octave_value (get_cameraupvector ())); | ||||
m.assign ("cameraupvectormode", octave_value (get_cameraupvectormode ())) ; | m.assign ("cameraupvectormode", octave_value (get_cameraupvectormode ())) ; | |||
m.assign ("cameraviewangle", octave_value (get_cameraviewangle ())); | ||||
m.assign ("cameraviewanglemode", octave_value (get_cameraviewanglemode () )); | m.assign ("cameraviewanglemode", octave_value (get_cameraviewanglemode () )); | |||
m.assign ("clim", octave_value (get_clim ())); | ||||
m.assign ("climmode", octave_value (get_climmode ())); | ||||
m.assign ("color", octave_value (get_color ())); | ||||
m.assign ("colororder", octave_value (get_colororder ())); | ||||
m.assign ("currentpoint", octave_value (get_currentpoint ())); | m.assign ("currentpoint", octave_value (get_currentpoint ())); | |||
m.assign ("dataaspectratio", octave_value (get_dataaspectratio ())); | ||||
m.assign ("dataaspectratiomode", octave_value (get_dataaspectratiomode () | ||||
)); | ||||
m.assign ("drawmode", octave_value (get_drawmode ())); | m.assign ("drawmode", octave_value (get_drawmode ())); | |||
m.assign ("fontangle", octave_value (get_fontangle ())); | m.assign ("fontangle", octave_value (get_fontangle ())); | |||
m.assign ("fontname", octave_value (get_fontname ())); | m.assign ("fontname", octave_value (get_fontname ())); | |||
m.assign ("fontsize", octave_value (get_fontsize ())); | m.assign ("fontsize", octave_value (get_fontsize ())); | |||
m.assign ("fontunits", octave_value (get_fontunits ())); | m.assign ("fontunits", octave_value (get_fontunits ())); | |||
m.assign ("fontweight", octave_value (get_fontweight ())); | m.assign ("fontweight", octave_value (get_fontweight ())); | |||
m.assign ("gridlinestyle", octave_value (get_gridlinestyle ())); | m.assign ("gridlinestyle", octave_value (get_gridlinestyle ())); | |||
m.assign ("interpreter", octave_value (get_interpreter ())); | ||||
m.assign ("layer", octave_value (get_layer ())); | ||||
m.assign ("linestyleorder", octave_value (get_linestyleorder ())); | m.assign ("linestyleorder", octave_value (get_linestyleorder ())); | |||
m.assign ("linewidth", octave_value (get_linewidth ())); | m.assign ("linewidth", octave_value (get_linewidth ())); | |||
m.assign ("minorgridlinestyle", octave_value (get_minorgridlinestyle ())) ; | m.assign ("minorgridlinestyle", octave_value (get_minorgridlinestyle ())) ; | |||
m.assign ("nextplot", octave_value (get_nextplot ())); | ||||
m.assign ("outerposition", octave_value (get_outerposition ())); | ||||
m.assign ("plotboxaspectratio", octave_value (get_plotboxaspectratio ())) ; | m.assign ("plotboxaspectratio", octave_value (get_plotboxaspectratio ())) ; | |||
m.assign ("plotboxaspectratiomode", octave_value (get_plotboxaspectratiom ode ())); | m.assign ("plotboxaspectratiomode", octave_value (get_plotboxaspectratiom ode ())); | |||
m.assign ("position", octave_value (get_position ())); | ||||
m.assign ("projection", octave_value (get_projection ())); | m.assign ("projection", octave_value (get_projection ())); | |||
m.assign ("tickdir", octave_value (get_tickdir ())); | m.assign ("tickdir", octave_value (get_tickdir ())); | |||
m.assign ("tickdirmode", octave_value (get_tickdirmode ())); | m.assign ("tickdirmode", octave_value (get_tickdirmode ())); | |||
m.assign ("ticklength", octave_value (get_ticklength ())); | m.assign ("ticklength", octave_value (get_ticklength ())); | |||
m.assign ("tightinset", octave_value (get_tightinset ())); | m.assign ("tightinset", octave_value (get_tightinset ())); | |||
m.assign ("title", octave_value (get_title ().as_octave_value ())); | ||||
m.assign ("units", octave_value (get_units ())); | m.assign ("units", octave_value (get_units ())); | |||
m.assign ("view", octave_value (get_view ())); | ||||
m.assign ("xaxislocation", octave_value (get_xaxislocation ())); | ||||
m.assign ("xcolor", octave_value (get_xcolor ())); | ||||
m.assign ("xdir", octave_value (get_xdir ())); | ||||
m.assign ("xgrid", octave_value (get_xgrid ())); | ||||
m.assign ("xlabel", octave_value (get_xlabel ().as_octave_value ())); | ||||
m.assign ("xlim", octave_value (get_xlim ())); | ||||
m.assign ("xlimmode", octave_value (get_xlimmode ())); | ||||
m.assign ("xminorgrid", octave_value (get_xminorgrid ())); | ||||
m.assign ("xminortick", octave_value (get_xminortick ())); | ||||
m.assign ("xscale", octave_value (get_xscale ())); | ||||
m.assign ("xtick", octave_value (get_xtick ())); | ||||
m.assign ("xticklabel", octave_value (get_xticklabel ())); | ||||
m.assign ("xticklabelmode", octave_value (get_xticklabelmode ())); | ||||
m.assign ("xtickmode", octave_value (get_xtickmode ())); | ||||
m.assign ("yaxislocation", octave_value (get_yaxislocation ())); | ||||
m.assign ("ycolor", octave_value (get_ycolor ())); | ||||
m.assign ("ydir", octave_value (get_ydir ())); | ||||
m.assign ("ygrid", octave_value (get_ygrid ())); | ||||
m.assign ("ylabel", octave_value (get_ylabel ().as_octave_value ())); | ||||
m.assign ("ylim", octave_value (get_ylim ())); | ||||
m.assign ("ylimmode", octave_value (get_ylimmode ())); | ||||
m.assign ("yminorgrid", octave_value (get_yminorgrid ())); | ||||
m.assign ("yminortick", octave_value (get_yminortick ())); | ||||
m.assign ("yscale", octave_value (get_yscale ())); | ||||
m.assign ("ytick", octave_value (get_ytick ())); | ||||
m.assign ("yticklabel", octave_value (get_yticklabel ())); | ||||
m.assign ("yticklabelmode", octave_value (get_yticklabelmode ())); | ||||
m.assign ("ytickmode", octave_value (get_ytickmode ())); | ||||
m.assign ("zcolor", octave_value (get_zcolor ())); | ||||
m.assign ("zdir", octave_value (get_zdir ())); | ||||
m.assign ("zgrid", octave_value (get_zgrid ())); | ||||
m.assign ("zlabel", octave_value (get_zlabel ().as_octave_value ())); | ||||
m.assign ("zlim", octave_value (get_zlim ())); | ||||
m.assign ("zlimmode", octave_value (get_zlimmode ())); | ||||
m.assign ("zminorgrid", octave_value (get_zminorgrid ())); | ||||
m.assign ("zminortick", octave_value (get_zminortick ())); | ||||
m.assign ("zscale", octave_value (get_zscale ())); | ||||
m.assign ("ztick", octave_value (get_ztick ())); | ||||
m.assign ("zticklabel", octave_value (get_zticklabel ())); | ||||
m.assign ("zticklabelmode", octave_value (get_zticklabelmode ())); | ||||
m.assign ("ztickmode", octave_value (get_ztickmode ())); | ||||
if (all) | ||||
m.assign ("__hold_all__", octave_value (get___hold_all__ ())); | ||||
if (all) | ||||
m.assign ("autopos_tag", octave_value (get_autopos_tag ())); | ||||
if (all) | ||||
m.assign ("looseinset", octave_value (get_looseinset ())); | ||||
if (all) | if (all) | |||
m.assign ("x_viewtransform", octave_value (get_x_viewtransform ())); | m.assign ("x_viewtransform", octave_value (get_x_viewtransform ())); | |||
if (all) | if (all) | |||
m.assign ("x_projectiontransform", octave_value (get_x_projectiontransf orm ())); | m.assign ("x_projectiontransform", octave_value (get_x_projectiontransf orm ())); | |||
if (all) | if (all) | |||
m.assign ("x_viewporttransform", octave_value (get_x_viewporttransform ())); | m.assign ("x_viewporttransform", octave_value (get_x_viewporttransform ())); | |||
if (all) | if (all) | |||
m.assign ("x_normrendertransform", octave_value (get_x_normrendertransf orm ())); | m.assign ("x_normrendertransform", octave_value (get_x_normrendertransf orm ())); | |||
if (all) | if (all) | |||
m.assign ("x_rendertransform", octave_value (get_x_rendertransform ())) ; | m.assign ("x_rendertransform", octave_value (get_x_rendertransform ())) ; | |||
if (all) | if (all) | |||
m.assign ("xmtick", octave_value (get_xmtick ())); | m.assign ("xmtick", octave_value (get_xmtick ())); | |||
if (all) | if (all) | |||
m.assign ("ymtick", octave_value (get_ymtick ())); | m.assign ("ymtick", octave_value (get_ymtick ())); | |||
if (all) | if (all) | |||
m.assign ("zmtick", octave_value (get_zmtick ())); | m.assign ("zmtick", octave_value (get_zmtick ())); | |||
if (all) | ||||
m.assign ("looseinset", octave_value (get_looseinset ())); | ||||
if (all) | ||||
m.assign ("autopos_tag", octave_value (get_autopos_tag ())); | ||||
return m; | return m; | |||
} | } | |||
octave_value | octave_value | |||
axes::properties::get (const caseless_str& pname_arg) const | axes::properties::get (const caseless_str& pname_arg) const | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return retval; | return retval; | |||
if (pname.compare ("position")) | if (pname.compare ("activepositionproperty")) | |||
retval = get_position (); | retval = get_activepositionproperty (); | |||
else if (pname.compare ("box")) | ||||
retval = get_box (); | ||||
else if (pname.compare ("colororder")) | ||||
retval = get_colororder (); | ||||
else if (pname.compare ("dataaspectratio")) | ||||
retval = get_dataaspectratio (); | ||||
else if (pname.compare ("dataaspectratiomode")) | ||||
retval = get_dataaspectratiomode (); | ||||
else if (pname.compare ("layer")) | ||||
retval = get_layer (); | ||||
else if (pname.compare ("xlim")) | ||||
retval = get_xlim (); | ||||
else if (pname.compare ("ylim")) | ||||
retval = get_ylim (); | ||||
else if (pname.compare ("zlim")) | ||||
retval = get_zlim (); | ||||
else if (pname.compare ("clim")) | ||||
retval = get_clim (); | ||||
else if (pname.compare ("alim")) | else if (pname.compare ("alim")) | |||
retval = get_alim (); | retval = get_alim (); | |||
else if (pname.compare ("xlimmode")) | ||||
retval = get_xlimmode (); | ||||
else if (pname.compare ("ylimmode")) | ||||
retval = get_ylimmode (); | ||||
else if (pname.compare ("zlimmode")) | ||||
retval = get_zlimmode (); | ||||
else if (pname.compare ("climmode")) | ||||
retval = get_climmode (); | ||||
else if (pname.compare ("alimmode")) | else if (pname.compare ("alimmode")) | |||
retval = get_alimmode (); | retval = get_alimmode (); | |||
else if (pname.compare ("xlabel")) | ||||
retval = get_xlabel ().as_octave_value (); | ||||
else if (pname.compare ("ylabel")) | ||||
retval = get_ylabel ().as_octave_value (); | ||||
else if (pname.compare ("zlabel")) | ||||
retval = get_zlabel ().as_octave_value (); | ||||
else if (pname.compare ("title")) | ||||
retval = get_title ().as_octave_value (); | ||||
else if (pname.compare ("xgrid")) | ||||
retval = get_xgrid (); | ||||
else if (pname.compare ("ygrid")) | ||||
retval = get_ygrid (); | ||||
else if (pname.compare ("zgrid")) | ||||
retval = get_zgrid (); | ||||
else if (pname.compare ("xminorgrid")) | ||||
retval = get_xminorgrid (); | ||||
else if (pname.compare ("yminorgrid")) | ||||
retval = get_yminorgrid (); | ||||
else if (pname.compare ("zminorgrid")) | ||||
retval = get_zminorgrid (); | ||||
else if (pname.compare ("xtick")) | ||||
retval = get_xtick (); | ||||
else if (pname.compare ("ytick")) | ||||
retval = get_ytick (); | ||||
else if (pname.compare ("ztick")) | ||||
retval = get_ztick (); | ||||
else if (pname.compare ("xtickmode")) | ||||
retval = get_xtickmode (); | ||||
else if (pname.compare ("ytickmode")) | ||||
retval = get_ytickmode (); | ||||
else if (pname.compare ("ztickmode")) | ||||
retval = get_ztickmode (); | ||||
else if (pname.compare ("xminortick")) | ||||
retval = get_xminortick (); | ||||
else if (pname.compare ("yminortick")) | ||||
retval = get_yminortick (); | ||||
else if (pname.compare ("zminortick")) | ||||
retval = get_zminortick (); | ||||
else if (pname.compare ("xticklabel")) | ||||
retval = get_xticklabel (); | ||||
else if (pname.compare ("yticklabel")) | ||||
retval = get_yticklabel (); | ||||
else if (pname.compare ("zticklabel")) | ||||
retval = get_zticklabel (); | ||||
else if (pname.compare ("xticklabelmode")) | ||||
retval = get_xticklabelmode (); | ||||
else if (pname.compare ("yticklabelmode")) | ||||
retval = get_yticklabelmode (); | ||||
else if (pname.compare ("zticklabelmode")) | ||||
retval = get_zticklabelmode (); | ||||
else if (pname.compare ("interpreter")) | ||||
retval = get_interpreter (); | ||||
else if (pname.compare ("color")) | ||||
retval = get_color (); | ||||
else if (pname.compare ("xcolor")) | ||||
retval = get_xcolor (); | ||||
else if (pname.compare ("ycolor")) | ||||
retval = get_ycolor (); | ||||
else if (pname.compare ("zcolor")) | ||||
retval = get_zcolor (); | ||||
else if (pname.compare ("xscale")) | ||||
retval = get_xscale (); | ||||
else if (pname.compare ("yscale")) | ||||
retval = get_yscale (); | ||||
else if (pname.compare ("zscale")) | ||||
retval = get_zscale (); | ||||
else if (pname.compare ("xdir")) | ||||
retval = get_xdir (); | ||||
else if (pname.compare ("ydir")) | ||||
retval = get_ydir (); | ||||
else if (pname.compare ("zdir")) | ||||
retval = get_zdir (); | ||||
else if (pname.compare ("yaxislocation")) | ||||
retval = get_yaxislocation (); | ||||
else if (pname.compare ("xaxislocation")) | ||||
retval = get_xaxislocation (); | ||||
else if (pname.compare ("view")) | ||||
retval = get_view (); | ||||
else if (pname.compare ("__hold_all__")) | ||||
retval = get___hold_all__ (); | ||||
else if (pname.compare ("nextplot")) | ||||
retval = get_nextplot (); | ||||
else if (pname.compare ("outerposition")) | ||||
retval = get_outerposition (); | ||||
else if (pname.compare ("activepositionproperty")) | ||||
retval = get_activepositionproperty (); | ||||
else if (pname.compare ("ambientlightcolor")) | else if (pname.compare ("ambientlightcolor")) | |||
retval = get_ambientlightcolor (); | retval = get_ambientlightcolor (); | |||
else if (pname.compare ("box")) | ||||
retval = get_box (); | ||||
else if (pname.compare ("cameraposition")) | else if (pname.compare ("cameraposition")) | |||
retval = get_cameraposition (); | retval = get_cameraposition (); | |||
else if (pname.compare ("cameratarget")) | ||||
retval = get_cameratarget (); | ||||
else if (pname.compare ("cameraupvector")) | ||||
retval = get_cameraupvector (); | ||||
else if (pname.compare ("cameraviewangle")) | ||||
retval = get_cameraviewangle (); | ||||
else if (pname.compare ("camerapositionmode")) | else if (pname.compare ("camerapositionmode")) | |||
retval = get_camerapositionmode (); | retval = get_camerapositionmode (); | |||
else if (pname.compare ("cameratarget")) | ||||
retval = get_cameratarget (); | ||||
else if (pname.compare ("cameratargetmode")) | else if (pname.compare ("cameratargetmode")) | |||
retval = get_cameratargetmode (); | retval = get_cameratargetmode (); | |||
else if (pname.compare ("cameraupvector")) | ||||
retval = get_cameraupvector (); | ||||
else if (pname.compare ("cameraupvectormode")) | else if (pname.compare ("cameraupvectormode")) | |||
retval = get_cameraupvectormode (); | retval = get_cameraupvectormode (); | |||
else if (pname.compare ("cameraviewangle")) | ||||
retval = get_cameraviewangle (); | ||||
else if (pname.compare ("cameraviewanglemode")) | else if (pname.compare ("cameraviewanglemode")) | |||
retval = get_cameraviewanglemode (); | retval = get_cameraviewanglemode (); | |||
else if (pname.compare ("clim")) | ||||
retval = get_clim (); | ||||
else if (pname.compare ("climmode")) | ||||
retval = get_climmode (); | ||||
else if (pname.compare ("color")) | ||||
retval = get_color (); | ||||
else if (pname.compare ("colororder")) | ||||
retval = get_colororder (); | ||||
else if (pname.compare ("currentpoint")) | else if (pname.compare ("currentpoint")) | |||
retval = get_currentpoint (); | retval = get_currentpoint (); | |||
else if (pname.compare ("dataaspectratio")) | ||||
retval = get_dataaspectratio (); | ||||
else if (pname.compare ("dataaspectratiomode")) | ||||
retval = get_dataaspectratiomode (); | ||||
else if (pname.compare ("drawmode")) | else if (pname.compare ("drawmode")) | |||
retval = get_drawmode (); | retval = get_drawmode (); | |||
else if (pname.compare ("fontangle")) | else if (pname.compare ("fontangle")) | |||
retval = get_fontangle (); | retval = get_fontangle (); | |||
else if (pname.compare ("fontname")) | else if (pname.compare ("fontname")) | |||
retval = get_fontname (); | retval = get_fontname (); | |||
else if (pname.compare ("fontsize")) | else if (pname.compare ("fontsize")) | |||
retval = get_fontsize (); | retval = get_fontsize (); | |||
else if (pname.compare ("fontunits")) | else if (pname.compare ("fontunits")) | |||
retval = get_fontunits (); | retval = get_fontunits (); | |||
else if (pname.compare ("fontweight")) | else if (pname.compare ("fontweight")) | |||
retval = get_fontweight (); | retval = get_fontweight (); | |||
else if (pname.compare ("gridlinestyle")) | else if (pname.compare ("gridlinestyle")) | |||
retval = get_gridlinestyle (); | retval = get_gridlinestyle (); | |||
else if (pname.compare ("interpreter")) | ||||
retval = get_interpreter (); | ||||
else if (pname.compare ("layer")) | ||||
retval = get_layer (); | ||||
else if (pname.compare ("linestyleorder")) | else if (pname.compare ("linestyleorder")) | |||
retval = get_linestyleorder (); | retval = get_linestyleorder (); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
retval = get_linewidth (); | retval = get_linewidth (); | |||
else if (pname.compare ("minorgridlinestyle")) | else if (pname.compare ("minorgridlinestyle")) | |||
retval = get_minorgridlinestyle (); | retval = get_minorgridlinestyle (); | |||
else if (pname.compare ("nextplot")) | ||||
retval = get_nextplot (); | ||||
else if (pname.compare ("outerposition")) | ||||
retval = get_outerposition (); | ||||
else if (pname.compare ("plotboxaspectratio")) | else if (pname.compare ("plotboxaspectratio")) | |||
retval = get_plotboxaspectratio (); | retval = get_plotboxaspectratio (); | |||
else if (pname.compare ("plotboxaspectratiomode")) | else if (pname.compare ("plotboxaspectratiomode")) | |||
retval = get_plotboxaspectratiomode (); | retval = get_plotboxaspectratiomode (); | |||
else if (pname.compare ("position")) | ||||
retval = get_position (); | ||||
else if (pname.compare ("projection")) | else if (pname.compare ("projection")) | |||
retval = get_projection (); | retval = get_projection (); | |||
else if (pname.compare ("tickdir")) | else if (pname.compare ("tickdir")) | |||
retval = get_tickdir (); | retval = get_tickdir (); | |||
else if (pname.compare ("tickdirmode")) | else if (pname.compare ("tickdirmode")) | |||
retval = get_tickdirmode (); | retval = get_tickdirmode (); | |||
else if (pname.compare ("ticklength")) | else if (pname.compare ("ticklength")) | |||
retval = get_ticklength (); | retval = get_ticklength (); | |||
else if (pname.compare ("tightinset")) | else if (pname.compare ("tightinset")) | |||
retval = get_tightinset (); | retval = get_tightinset (); | |||
else if (pname.compare ("title")) | ||||
retval = get_title ().as_octave_value (); | ||||
else if (pname.compare ("units")) | else if (pname.compare ("units")) | |||
retval = get_units (); | retval = get_units (); | |||
else if (pname.compare ("view")) | ||||
retval = get_view (); | ||||
else if (pname.compare ("xaxislocation")) | ||||
retval = get_xaxislocation (); | ||||
else if (pname.compare ("xcolor")) | ||||
retval = get_xcolor (); | ||||
else if (pname.compare ("xdir")) | ||||
retval = get_xdir (); | ||||
else if (pname.compare ("xgrid")) | ||||
retval = get_xgrid (); | ||||
else if (pname.compare ("xlabel")) | ||||
retval = get_xlabel ().as_octave_value (); | ||||
else if (pname.compare ("xlim")) | ||||
retval = get_xlim (); | ||||
else if (pname.compare ("xlimmode")) | ||||
retval = get_xlimmode (); | ||||
else if (pname.compare ("xminorgrid")) | ||||
retval = get_xminorgrid (); | ||||
else if (pname.compare ("xminortick")) | ||||
retval = get_xminortick (); | ||||
else if (pname.compare ("xscale")) | ||||
retval = get_xscale (); | ||||
else if (pname.compare ("xtick")) | ||||
retval = get_xtick (); | ||||
else if (pname.compare ("xticklabel")) | ||||
retval = get_xticklabel (); | ||||
else if (pname.compare ("xticklabelmode")) | ||||
retval = get_xticklabelmode (); | ||||
else if (pname.compare ("xtickmode")) | ||||
retval = get_xtickmode (); | ||||
else if (pname.compare ("yaxislocation")) | ||||
retval = get_yaxislocation (); | ||||
else if (pname.compare ("ycolor")) | ||||
retval = get_ycolor (); | ||||
else if (pname.compare ("ydir")) | ||||
retval = get_ydir (); | ||||
else if (pname.compare ("ygrid")) | ||||
retval = get_ygrid (); | ||||
else if (pname.compare ("ylabel")) | ||||
retval = get_ylabel ().as_octave_value (); | ||||
else if (pname.compare ("ylim")) | ||||
retval = get_ylim (); | ||||
else if (pname.compare ("ylimmode")) | ||||
retval = get_ylimmode (); | ||||
else if (pname.compare ("yminorgrid")) | ||||
retval = get_yminorgrid (); | ||||
else if (pname.compare ("yminortick")) | ||||
retval = get_yminortick (); | ||||
else if (pname.compare ("yscale")) | ||||
retval = get_yscale (); | ||||
else if (pname.compare ("ytick")) | ||||
retval = get_ytick (); | ||||
else if (pname.compare ("yticklabel")) | ||||
retval = get_yticklabel (); | ||||
else if (pname.compare ("yticklabelmode")) | ||||
retval = get_yticklabelmode (); | ||||
else if (pname.compare ("ytickmode")) | ||||
retval = get_ytickmode (); | ||||
else if (pname.compare ("zcolor")) | ||||
retval = get_zcolor (); | ||||
else if (pname.compare ("zdir")) | ||||
retval = get_zdir (); | ||||
else if (pname.compare ("zgrid")) | ||||
retval = get_zgrid (); | ||||
else if (pname.compare ("zlabel")) | ||||
retval = get_zlabel ().as_octave_value (); | ||||
else if (pname.compare ("zlim")) | ||||
retval = get_zlim (); | ||||
else if (pname.compare ("zlimmode")) | ||||
retval = get_zlimmode (); | ||||
else if (pname.compare ("zminorgrid")) | ||||
retval = get_zminorgrid (); | ||||
else if (pname.compare ("zminortick")) | ||||
retval = get_zminortick (); | ||||
else if (pname.compare ("zscale")) | ||||
retval = get_zscale (); | ||||
else if (pname.compare ("ztick")) | ||||
retval = get_ztick (); | ||||
else if (pname.compare ("zticklabel")) | ||||
retval = get_zticklabel (); | ||||
else if (pname.compare ("zticklabelmode")) | ||||
retval = get_zticklabelmode (); | ||||
else if (pname.compare ("ztickmode")) | ||||
retval = get_ztickmode (); | ||||
else if (pname.compare ("__hold_all__")) | ||||
retval = get___hold_all__ (); | ||||
else if (pname.compare ("autopos_tag")) | ||||
retval = get_autopos_tag (); | ||||
else if (pname.compare ("looseinset")) | ||||
retval = get_looseinset (); | ||||
else if (pname.compare ("x_viewtransform")) | else if (pname.compare ("x_viewtransform")) | |||
retval = get_x_viewtransform (); | retval = get_x_viewtransform (); | |||
else if (pname.compare ("x_projectiontransform")) | else if (pname.compare ("x_projectiontransform")) | |||
retval = get_x_projectiontransform (); | retval = get_x_projectiontransform (); | |||
else if (pname.compare ("x_viewporttransform")) | else if (pname.compare ("x_viewporttransform")) | |||
retval = get_x_viewporttransform (); | retval = get_x_viewporttransform (); | |||
else if (pname.compare ("x_normrendertransform")) | else if (pname.compare ("x_normrendertransform")) | |||
retval = get_x_normrendertransform (); | retval = get_x_normrendertransform (); | |||
else if (pname.compare ("x_rendertransform")) | else if (pname.compare ("x_rendertransform")) | |||
retval = get_x_rendertransform (); | retval = get_x_rendertransform (); | |||
else if (pname.compare ("xmtick")) | else if (pname.compare ("xmtick")) | |||
retval = get_xmtick (); | retval = get_xmtick (); | |||
else if (pname.compare ("ymtick")) | else if (pname.compare ("ymtick")) | |||
retval = get_ymtick (); | retval = get_ymtick (); | |||
else if (pname.compare ("zmtick")) | else if (pname.compare ("zmtick")) | |||
retval = get_zmtick (); | retval = get_zmtick (); | |||
else if (pname.compare ("looseinset")) | ||||
retval = get_looseinset (); | ||||
else if (pname.compare ("autopos_tag")) | ||||
retval = get_autopos_tag (); | ||||
else | else | |||
retval = base_properties::get (pname); | retval = base_properties::get (pname); | |||
return retval; | return retval; | |||
} | } | |||
property | property | |||
axes::properties::get_property (const caseless_str& pname_arg) | axes::properties::get_property (const caseless_str& pname_arg) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return property (); | return property (); | |||
if (pname.compare ("position")) | if (pname.compare ("activepositionproperty")) | |||
return property (&position, true); | return property (&activepositionproperty, true); | |||
else if (pname.compare ("box")) | ||||
return property (&box, true); | ||||
else if (pname.compare ("colororder")) | ||||
return property (&colororder, true); | ||||
else if (pname.compare ("dataaspectratio")) | ||||
return property (&dataaspectratio, true); | ||||
else if (pname.compare ("dataaspectratiomode")) | ||||
return property (&dataaspectratiomode, true); | ||||
else if (pname.compare ("layer")) | ||||
return property (&layer, true); | ||||
else if (pname.compare ("xlim")) | ||||
return property (&xlim, true); | ||||
else if (pname.compare ("ylim")) | ||||
return property (&ylim, true); | ||||
else if (pname.compare ("zlim")) | ||||
return property (&zlim, true); | ||||
else if (pname.compare ("clim")) | ||||
return property (&clim, true); | ||||
else if (pname.compare ("alim")) | else if (pname.compare ("alim")) | |||
return property (&alim, true); | return property (&alim, true); | |||
else if (pname.compare ("xlimmode")) | ||||
return property (&xlimmode, true); | ||||
else if (pname.compare ("ylimmode")) | ||||
return property (&ylimmode, true); | ||||
else if (pname.compare ("zlimmode")) | ||||
return property (&zlimmode, true); | ||||
else if (pname.compare ("climmode")) | ||||
return property (&climmode, true); | ||||
else if (pname.compare ("alimmode")) | else if (pname.compare ("alimmode")) | |||
return property (&alimmode, true); | return property (&alimmode, true); | |||
else if (pname.compare ("xlabel")) | ||||
return property (&xlabel, true); | ||||
else if (pname.compare ("ylabel")) | ||||
return property (&ylabel, true); | ||||
else if (pname.compare ("zlabel")) | ||||
return property (&zlabel, true); | ||||
else if (pname.compare ("title")) | ||||
return property (&title, true); | ||||
else if (pname.compare ("xgrid")) | ||||
return property (&xgrid, true); | ||||
else if (pname.compare ("ygrid")) | ||||
return property (&ygrid, true); | ||||
else if (pname.compare ("zgrid")) | ||||
return property (&zgrid, true); | ||||
else if (pname.compare ("xminorgrid")) | ||||
return property (&xminorgrid, true); | ||||
else if (pname.compare ("yminorgrid")) | ||||
return property (&yminorgrid, true); | ||||
else if (pname.compare ("zminorgrid")) | ||||
return property (&zminorgrid, true); | ||||
else if (pname.compare ("xtick")) | ||||
return property (&xtick, true); | ||||
else if (pname.compare ("ytick")) | ||||
return property (&ytick, true); | ||||
else if (pname.compare ("ztick")) | ||||
return property (&ztick, true); | ||||
else if (pname.compare ("xtickmode")) | ||||
return property (&xtickmode, true); | ||||
else if (pname.compare ("ytickmode")) | ||||
return property (&ytickmode, true); | ||||
else if (pname.compare ("ztickmode")) | ||||
return property (&ztickmode, true); | ||||
else if (pname.compare ("xminortick")) | ||||
return property (&xminortick, true); | ||||
else if (pname.compare ("yminortick")) | ||||
return property (&yminortick, true); | ||||
else if (pname.compare ("zminortick")) | ||||
return property (&zminortick, true); | ||||
else if (pname.compare ("xticklabel")) | ||||
return property (&xticklabel, true); | ||||
else if (pname.compare ("yticklabel")) | ||||
return property (&yticklabel, true); | ||||
else if (pname.compare ("zticklabel")) | ||||
return property (&zticklabel, true); | ||||
else if (pname.compare ("xticklabelmode")) | ||||
return property (&xticklabelmode, true); | ||||
else if (pname.compare ("yticklabelmode")) | ||||
return property (&yticklabelmode, true); | ||||
else if (pname.compare ("zticklabelmode")) | ||||
return property (&zticklabelmode, true); | ||||
else if (pname.compare ("interpreter")) | ||||
return property (&interpreter, true); | ||||
else if (pname.compare ("color")) | ||||
return property (&color, true); | ||||
else if (pname.compare ("xcolor")) | ||||
return property (&xcolor, true); | ||||
else if (pname.compare ("ycolor")) | ||||
return property (&ycolor, true); | ||||
else if (pname.compare ("zcolor")) | ||||
return property (&zcolor, true); | ||||
else if (pname.compare ("xscale")) | ||||
return property (&xscale, true); | ||||
else if (pname.compare ("yscale")) | ||||
return property (&yscale, true); | ||||
else if (pname.compare ("zscale")) | ||||
return property (&zscale, true); | ||||
else if (pname.compare ("xdir")) | ||||
return property (&xdir, true); | ||||
else if (pname.compare ("ydir")) | ||||
return property (&ydir, true); | ||||
else if (pname.compare ("zdir")) | ||||
return property (&zdir, true); | ||||
else if (pname.compare ("yaxislocation")) | ||||
return property (&yaxislocation, true); | ||||
else if (pname.compare ("xaxislocation")) | ||||
return property (&xaxislocation, true); | ||||
else if (pname.compare ("view")) | ||||
return property (&view, true); | ||||
else if (pname.compare ("__hold_all__")) | ||||
return property (&__hold_all__, true); | ||||
else if (pname.compare ("nextplot")) | ||||
return property (&nextplot, true); | ||||
else if (pname.compare ("outerposition")) | ||||
return property (&outerposition, true); | ||||
else if (pname.compare ("activepositionproperty")) | ||||
return property (&activepositionproperty, true); | ||||
else if (pname.compare ("ambientlightcolor")) | else if (pname.compare ("ambientlightcolor")) | |||
return property (&ambientlightcolor, true); | return property (&ambientlightcolor, true); | |||
else if (pname.compare ("box")) | ||||
return property (&box, true); | ||||
else if (pname.compare ("cameraposition")) | else if (pname.compare ("cameraposition")) | |||
return property (&cameraposition, true); | return property (&cameraposition, true); | |||
else if (pname.compare ("cameratarget")) | ||||
return property (&cameratarget, true); | ||||
else if (pname.compare ("cameraupvector")) | ||||
return property (&cameraupvector, true); | ||||
else if (pname.compare ("cameraviewangle")) | ||||
return property (&cameraviewangle, true); | ||||
else if (pname.compare ("camerapositionmode")) | else if (pname.compare ("camerapositionmode")) | |||
return property (&camerapositionmode, true); | return property (&camerapositionmode, true); | |||
else if (pname.compare ("cameratarget")) | ||||
return property (&cameratarget, true); | ||||
else if (pname.compare ("cameratargetmode")) | else if (pname.compare ("cameratargetmode")) | |||
return property (&cameratargetmode, true); | return property (&cameratargetmode, true); | |||
else if (pname.compare ("cameraupvector")) | ||||
return property (&cameraupvector, true); | ||||
else if (pname.compare ("cameraupvectormode")) | else if (pname.compare ("cameraupvectormode")) | |||
return property (&cameraupvectormode, true); | return property (&cameraupvectormode, true); | |||
else if (pname.compare ("cameraviewangle")) | ||||
return property (&cameraviewangle, true); | ||||
else if (pname.compare ("cameraviewanglemode")) | else if (pname.compare ("cameraviewanglemode")) | |||
return property (&cameraviewanglemode, true); | return property (&cameraviewanglemode, true); | |||
else if (pname.compare ("clim")) | ||||
return property (&clim, true); | ||||
else if (pname.compare ("climmode")) | ||||
return property (&climmode, true); | ||||
else if (pname.compare ("color")) | ||||
return property (&color, true); | ||||
else if (pname.compare ("colororder")) | ||||
return property (&colororder, true); | ||||
else if (pname.compare ("currentpoint")) | else if (pname.compare ("currentpoint")) | |||
return property (¤tpoint, true); | return property (¤tpoint, true); | |||
else if (pname.compare ("dataaspectratio")) | ||||
return property (&dataaspectratio, true); | ||||
else if (pname.compare ("dataaspectratiomode")) | ||||
return property (&dataaspectratiomode, true); | ||||
else if (pname.compare ("drawmode")) | else if (pname.compare ("drawmode")) | |||
return property (&drawmode, true); | return property (&drawmode, true); | |||
else if (pname.compare ("fontangle")) | else if (pname.compare ("fontangle")) | |||
return property (&fontangle, true); | return property (&fontangle, true); | |||
else if (pname.compare ("fontname")) | else if (pname.compare ("fontname")) | |||
return property (&fontname, true); | return property (&fontname, true); | |||
else if (pname.compare ("fontsize")) | else if (pname.compare ("fontsize")) | |||
return property (&fontsize, true); | return property (&fontsize, true); | |||
else if (pname.compare ("fontunits")) | else if (pname.compare ("fontunits")) | |||
return property (&fontunits, true); | return property (&fontunits, true); | |||
else if (pname.compare ("fontweight")) | else if (pname.compare ("fontweight")) | |||
return property (&fontweight, true); | return property (&fontweight, true); | |||
else if (pname.compare ("gridlinestyle")) | else if (pname.compare ("gridlinestyle")) | |||
return property (&gridlinestyle, true); | return property (&gridlinestyle, true); | |||
else if (pname.compare ("interpreter")) | ||||
return property (&interpreter, true); | ||||
else if (pname.compare ("layer")) | ||||
return property (&layer, true); | ||||
else if (pname.compare ("linestyleorder")) | else if (pname.compare ("linestyleorder")) | |||
return property (&linestyleorder, true); | return property (&linestyleorder, true); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
return property (&linewidth, true); | return property (&linewidth, true); | |||
else if (pname.compare ("minorgridlinestyle")) | else if (pname.compare ("minorgridlinestyle")) | |||
return property (&minorgridlinestyle, true); | return property (&minorgridlinestyle, true); | |||
else if (pname.compare ("nextplot")) | ||||
return property (&nextplot, true); | ||||
else if (pname.compare ("outerposition")) | ||||
return property (&outerposition, true); | ||||
else if (pname.compare ("plotboxaspectratio")) | else if (pname.compare ("plotboxaspectratio")) | |||
return property (&plotboxaspectratio, true); | return property (&plotboxaspectratio, true); | |||
else if (pname.compare ("plotboxaspectratiomode")) | else if (pname.compare ("plotboxaspectratiomode")) | |||
return property (&plotboxaspectratiomode, true); | return property (&plotboxaspectratiomode, true); | |||
else if (pname.compare ("position")) | ||||
return property (&position, true); | ||||
else if (pname.compare ("projection")) | else if (pname.compare ("projection")) | |||
return property (&projection, true); | return property (&projection, true); | |||
else if (pname.compare ("tickdir")) | else if (pname.compare ("tickdir")) | |||
return property (&tickdir, true); | return property (&tickdir, true); | |||
else if (pname.compare ("tickdirmode")) | else if (pname.compare ("tickdirmode")) | |||
return property (&tickdirmode, true); | return property (&tickdirmode, true); | |||
else if (pname.compare ("ticklength")) | else if (pname.compare ("ticklength")) | |||
return property (&ticklength, true); | return property (&ticklength, true); | |||
else if (pname.compare ("tightinset")) | else if (pname.compare ("tightinset")) | |||
return property (&tightinset, true); | return property (&tightinset, true); | |||
else if (pname.compare ("title")) | ||||
return property (&title, true); | ||||
else if (pname.compare ("units")) | else if (pname.compare ("units")) | |||
return property (&units, true); | return property (&units, true); | |||
else if (pname.compare ("view")) | ||||
return property (&view, true); | ||||
else if (pname.compare ("xaxislocation")) | ||||
return property (&xaxislocation, true); | ||||
else if (pname.compare ("xcolor")) | ||||
return property (&xcolor, true); | ||||
else if (pname.compare ("xdir")) | ||||
return property (&xdir, true); | ||||
else if (pname.compare ("xgrid")) | ||||
return property (&xgrid, true); | ||||
else if (pname.compare ("xlabel")) | ||||
return property (&xlabel, true); | ||||
else if (pname.compare ("xlim")) | ||||
return property (&xlim, true); | ||||
else if (pname.compare ("xlimmode")) | ||||
return property (&xlimmode, true); | ||||
else if (pname.compare ("xminorgrid")) | ||||
return property (&xminorgrid, true); | ||||
else if (pname.compare ("xminortick")) | ||||
return property (&xminortick, true); | ||||
else if (pname.compare ("xscale")) | ||||
return property (&xscale, true); | ||||
else if (pname.compare ("xtick")) | ||||
return property (&xtick, true); | ||||
else if (pname.compare ("xticklabel")) | ||||
return property (&xticklabel, true); | ||||
else if (pname.compare ("xticklabelmode")) | ||||
return property (&xticklabelmode, true); | ||||
else if (pname.compare ("xtickmode")) | ||||
return property (&xtickmode, true); | ||||
else if (pname.compare ("yaxislocation")) | ||||
return property (&yaxislocation, true); | ||||
else if (pname.compare ("ycolor")) | ||||
return property (&ycolor, true); | ||||
else if (pname.compare ("ydir")) | ||||
return property (&ydir, true); | ||||
else if (pname.compare ("ygrid")) | ||||
return property (&ygrid, true); | ||||
else if (pname.compare ("ylabel")) | ||||
return property (&ylabel, true); | ||||
else if (pname.compare ("ylim")) | ||||
return property (&ylim, true); | ||||
else if (pname.compare ("ylimmode")) | ||||
return property (&ylimmode, true); | ||||
else if (pname.compare ("yminorgrid")) | ||||
return property (&yminorgrid, true); | ||||
else if (pname.compare ("yminortick")) | ||||
return property (&yminortick, true); | ||||
else if (pname.compare ("yscale")) | ||||
return property (&yscale, true); | ||||
else if (pname.compare ("ytick")) | ||||
return property (&ytick, true); | ||||
else if (pname.compare ("yticklabel")) | ||||
return property (&yticklabel, true); | ||||
else if (pname.compare ("yticklabelmode")) | ||||
return property (&yticklabelmode, true); | ||||
else if (pname.compare ("ytickmode")) | ||||
return property (&ytickmode, true); | ||||
else if (pname.compare ("zcolor")) | ||||
return property (&zcolor, true); | ||||
else if (pname.compare ("zdir")) | ||||
return property (&zdir, true); | ||||
else if (pname.compare ("zgrid")) | ||||
return property (&zgrid, true); | ||||
else if (pname.compare ("zlabel")) | ||||
return property (&zlabel, true); | ||||
else if (pname.compare ("zlim")) | ||||
return property (&zlim, true); | ||||
else if (pname.compare ("zlimmode")) | ||||
return property (&zlimmode, true); | ||||
else if (pname.compare ("zminorgrid")) | ||||
return property (&zminorgrid, true); | ||||
else if (pname.compare ("zminortick")) | ||||
return property (&zminortick, true); | ||||
else if (pname.compare ("zscale")) | ||||
return property (&zscale, true); | ||||
else if (pname.compare ("ztick")) | ||||
return property (&ztick, true); | ||||
else if (pname.compare ("zticklabel")) | ||||
return property (&zticklabel, true); | ||||
else if (pname.compare ("zticklabelmode")) | ||||
return property (&zticklabelmode, true); | ||||
else if (pname.compare ("ztickmode")) | ||||
return property (&ztickmode, true); | ||||
else if (pname.compare ("__hold_all__")) | ||||
return property (&__hold_all__, true); | ||||
else if (pname.compare ("autopos_tag")) | ||||
return property (&autopos_tag, true); | ||||
else if (pname.compare ("looseinset")) | ||||
return property (&looseinset, true); | ||||
else if (pname.compare ("x_viewtransform")) | else if (pname.compare ("x_viewtransform")) | |||
return property (&x_viewtransform, true); | return property (&x_viewtransform, true); | |||
else if (pname.compare ("x_projectiontransform")) | else if (pname.compare ("x_projectiontransform")) | |||
return property (&x_projectiontransform, true); | return property (&x_projectiontransform, true); | |||
else if (pname.compare ("x_viewporttransform")) | else if (pname.compare ("x_viewporttransform")) | |||
return property (&x_viewporttransform, true); | return property (&x_viewporttransform, true); | |||
else if (pname.compare ("x_normrendertransform")) | else if (pname.compare ("x_normrendertransform")) | |||
return property (&x_normrendertransform, true); | return property (&x_normrendertransform, true); | |||
else if (pname.compare ("x_rendertransform")) | else if (pname.compare ("x_rendertransform")) | |||
return property (&x_rendertransform, true); | return property (&x_rendertransform, true); | |||
else if (pname.compare ("xmtick")) | else if (pname.compare ("xmtick")) | |||
return property (&xmtick, true); | return property (&xmtick, true); | |||
else if (pname.compare ("ymtick")) | else if (pname.compare ("ymtick")) | |||
return property (&ymtick, true); | return property (&ymtick, true); | |||
else if (pname.compare ("zmtick")) | else if (pname.compare ("zmtick")) | |||
return property (&zmtick, true); | return property (&zmtick, true); | |||
else if (pname.compare ("looseinset")) | ||||
return property (&looseinset, true); | ||||
else if (pname.compare ("autopos_tag")) | ||||
return property (&autopos_tag, true); | ||||
else | else | |||
return base_properties::get_property (pname); | return base_properties::get_property (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
axes::properties::factory_defaults (void) | axes::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["position"] = default_axes_position (); | m["activepositionproperty"] = "outerposition"; | |||
m["box"] = "on"; | ||||
m["colororder"] = default_colororder (); | ||||
m["dataaspectratio"] = Matrix (1, 3, 1.0); | ||||
m["dataaspectratiomode"] = "auto"; | ||||
m["layer"] = "bottom"; | ||||
m["xlim"] = default_lim (); | ||||
m["ylim"] = default_lim (); | ||||
m["zlim"] = default_lim (); | ||||
m["clim"] = default_lim (); | ||||
m["alim"] = default_lim (); | m["alim"] = default_lim (); | |||
m["xlimmode"] = "auto"; | ||||
m["ylimmode"] = "auto"; | ||||
m["zlimmode"] = "auto"; | ||||
m["climmode"] = "auto"; | ||||
m["alimmode"] = "auto"; | m["alimmode"] = "auto"; | |||
m["xgrid"] = "off"; | ||||
m["ygrid"] = "off"; | ||||
m["zgrid"] = "off"; | ||||
m["xminorgrid"] = "off"; | ||||
m["yminorgrid"] = "off"; | ||||
m["zminorgrid"] = "off"; | ||||
m["xtick"] = default_axes_tick (); | ||||
m["ytick"] = default_axes_tick (); | ||||
m["ztick"] = default_axes_tick (); | ||||
m["xtickmode"] = "auto"; | ||||
m["ytickmode"] = "auto"; | ||||
m["ztickmode"] = "auto"; | ||||
m["xminortick"] = "off"; | ||||
m["yminortick"] = "off"; | ||||
m["zminortick"] = "off"; | ||||
m["xticklabel"] = ""; | ||||
m["yticklabel"] = ""; | ||||
m["zticklabel"] = ""; | ||||
m["xticklabelmode"] = "auto"; | ||||
m["yticklabelmode"] = "auto"; | ||||
m["zticklabelmode"] = "auto"; | ||||
m["interpreter"] = "none"; | ||||
m["color"] = color_property (color_values (1, 1, 1), radio_values ("none" | ||||
)); | ||||
m["xcolor"] = color_values (0, 0, 0); | ||||
m["ycolor"] = color_values (0, 0, 0); | ||||
m["zcolor"] = color_values (0, 0, 0); | ||||
m["xscale"] = "linear"; | ||||
m["yscale"] = "linear"; | ||||
m["zscale"] = "linear"; | ||||
m["xdir"] = "normal"; | ||||
m["ydir"] = "normal"; | ||||
m["zdir"] = "normal"; | ||||
m["yaxislocation"] = "left"; | ||||
m["xaxislocation"] = "bottom"; | ||||
m["view"] = Matrix (); | ||||
m["__hold_all__"] = "off"; | ||||
m["nextplot"] = "replace"; | ||||
m["outerposition"] = default_axes_outerposition (); | ||||
m["activepositionproperty"] = "outerposition"; | ||||
m["ambientlightcolor"] = color_values (1, 1, 1); | m["ambientlightcolor"] = color_values (1, 1, 1); | |||
m["box"] = "on"; | ||||
m["cameraposition"] = Matrix (1, 3, 0.0); | m["cameraposition"] = Matrix (1, 3, 0.0); | |||
m["cameratarget"] = Matrix (1, 3, 0.0); | ||||
m["cameraupvector"] = Matrix (); | ||||
m["cameraviewangle"] = 10.0; | ||||
m["camerapositionmode"] = "auto"; | m["camerapositionmode"] = "auto"; | |||
m["cameratarget"] = Matrix (1, 3, 0.0); | ||||
m["cameratargetmode"] = "auto"; | m["cameratargetmode"] = "auto"; | |||
m["cameraupvector"] = Matrix (); | ||||
m["cameraupvectormode"] = "auto"; | m["cameraupvectormode"] = "auto"; | |||
m["cameraviewangle"] = 10.0; | ||||
m["cameraviewanglemode"] = "auto"; | m["cameraviewanglemode"] = "auto"; | |||
m["clim"] = default_lim (); | ||||
m["climmode"] = "auto"; | ||||
m["color"] = color_property (color_values (1, 1, 1), radio_values ("none" | ||||
)); | ||||
m["colororder"] = default_colororder (); | ||||
m["currentpoint"] = Matrix (2, 3, 0.0); | m["currentpoint"] = Matrix (2, 3, 0.0); | |||
m["dataaspectratio"] = Matrix (1, 3, 1.0); | ||||
m["dataaspectratiomode"] = "auto"; | ||||
m["drawmode"] = "normal"; | m["drawmode"] = "normal"; | |||
m["fontangle"] = "normal"; | m["fontangle"] = "normal"; | |||
m["fontname"] = OCTAVE_DEFAULT_FONTNAME; | m["fontname"] = OCTAVE_DEFAULT_FONTNAME; | |||
m["fontsize"] = 10; | m["fontsize"] = 10; | |||
m["fontunits"] = "points"; | m["fontunits"] = "points"; | |||
m["fontweight"] = "normal"; | m["fontweight"] = "normal"; | |||
m["gridlinestyle"] = ":"; | m["gridlinestyle"] = ":"; | |||
m["interpreter"] = "none"; | ||||
m["layer"] = "bottom"; | ||||
m["linestyleorder"] = "-"; | m["linestyleorder"] = "-"; | |||
m["linewidth"] = 0.5; | m["linewidth"] = 0.5; | |||
m["minorgridlinestyle"] = ":"; | m["minorgridlinestyle"] = ":"; | |||
m["nextplot"] = "replace"; | ||||
m["outerposition"] = default_axes_outerposition (); | ||||
m["plotboxaspectratio"] = Matrix (1, 3, 1.0); | m["plotboxaspectratio"] = Matrix (1, 3, 1.0); | |||
m["plotboxaspectratiomode"] = "auto"; | m["plotboxaspectratiomode"] = "auto"; | |||
m["position"] = default_axes_position (); | ||||
m["projection"] = "orthographic"; | m["projection"] = "orthographic"; | |||
m["tickdir"] = "in"; | m["tickdir"] = "in"; | |||
m["tickdirmode"] = "auto"; | m["tickdirmode"] = "auto"; | |||
m["ticklength"] = default_axes_ticklength (); | m["ticklength"] = default_axes_ticklength (); | |||
m["tightinset"] = Matrix (1, 4, 0.0); | m["tightinset"] = Matrix (1, 4, 0.0); | |||
m["units"] = "normalized"; | m["units"] = "normalized"; | |||
m["view"] = Matrix (); | ||||
m["xaxislocation"] = "bottom"; | ||||
m["xcolor"] = color_values (0, 0, 0); | ||||
m["xdir"] = "normal"; | ||||
m["xgrid"] = "off"; | ||||
m["xlim"] = default_lim (); | ||||
m["xlimmode"] = "auto"; | ||||
m["xminorgrid"] = "off"; | ||||
m["xminortick"] = "off"; | ||||
m["xscale"] = "linear"; | ||||
m["xtick"] = default_axes_tick (); | ||||
m["xticklabel"] = ""; | ||||
m["xticklabelmode"] = "auto"; | ||||
m["xtickmode"] = "auto"; | ||||
m["yaxislocation"] = "left"; | ||||
m["ycolor"] = color_values (0, 0, 0); | ||||
m["ydir"] = "normal"; | ||||
m["ygrid"] = "off"; | ||||
m["ylim"] = default_lim (); | ||||
m["ylimmode"] = "auto"; | ||||
m["yminorgrid"] = "off"; | ||||
m["yminortick"] = "off"; | ||||
m["yscale"] = "linear"; | ||||
m["ytick"] = default_axes_tick (); | ||||
m["yticklabel"] = ""; | ||||
m["yticklabelmode"] = "auto"; | ||||
m["ytickmode"] = "auto"; | ||||
m["zcolor"] = color_values (0, 0, 0); | ||||
m["zdir"] = "normal"; | ||||
m["zgrid"] = "off"; | ||||
m["zlim"] = default_lim (); | ||||
m["zlimmode"] = "auto"; | ||||
m["zminorgrid"] = "off"; | ||||
m["zminortick"] = "off"; | ||||
m["zscale"] = "linear"; | ||||
m["ztick"] = default_axes_tick (); | ||||
m["zticklabel"] = ""; | ||||
m["zticklabelmode"] = "auto"; | ||||
m["ztickmode"] = "auto"; | ||||
m["__hold_all__"] = "off"; | ||||
m["autopos_tag"] = "none"; | ||||
m["looseinset"] = Matrix (1, 4, 0.0); | ||||
m["x_viewtransform"] = Matrix (4, 4, 0.0); | m["x_viewtransform"] = Matrix (4, 4, 0.0); | |||
m["x_projectiontransform"] = Matrix (4, 4, 0.0); | m["x_projectiontransform"] = Matrix (4, 4, 0.0); | |||
m["x_viewporttransform"] = Matrix (4, 4, 0.0); | m["x_viewporttransform"] = Matrix (4, 4, 0.0); | |||
m["x_normrendertransform"] = Matrix (4, 4, 0.0); | m["x_normrendertransform"] = Matrix (4, 4, 0.0); | |||
m["x_rendertransform"] = Matrix (4, 4, 0.0); | m["x_rendertransform"] = Matrix (4, 4, 0.0); | |||
m["xmtick"] = Matrix (); | m["xmtick"] = Matrix (); | |||
m["ymtick"] = Matrix (); | m["ymtick"] = Matrix (); | |||
m["zmtick"] = Matrix (); | m["zmtick"] = Matrix (); | |||
m["looseinset"] = Matrix (1, 4, 0.0); | ||||
m["autopos_tag"] = "none"; | ||||
return m; | return m; | |||
} | } | |||
std::string axes::properties::go_name ("axes"); | std::string axes::properties::go_name ("axes"); | |||
std::set<std::string> | std::set<std::string> | |||
axes::properties::core_property_names (void) | axes::properties::core_property_names (void) | |||
{ | { | |||
static std::set<std::string> all_pnames; | static std::set<std::string> all_pnames; | |||
static bool initialized = false; | static bool initialized = false; | |||
if (! initialized) | if (! initialized) | |||
{ | { | |||
all_pnames.insert ("position"); | all_pnames.insert ("activepositionproperty"); | |||
all_pnames.insert ("box"); | ||||
all_pnames.insert ("colororder"); | ||||
all_pnames.insert ("dataaspectratio"); | ||||
all_pnames.insert ("dataaspectratiomode"); | ||||
all_pnames.insert ("layer"); | ||||
all_pnames.insert ("xlim"); | ||||
all_pnames.insert ("ylim"); | ||||
all_pnames.insert ("zlim"); | ||||
all_pnames.insert ("clim"); | ||||
all_pnames.insert ("alim"); | all_pnames.insert ("alim"); | |||
all_pnames.insert ("xlimmode"); | ||||
all_pnames.insert ("ylimmode"); | ||||
all_pnames.insert ("zlimmode"); | ||||
all_pnames.insert ("climmode"); | ||||
all_pnames.insert ("alimmode"); | all_pnames.insert ("alimmode"); | |||
all_pnames.insert ("xlabel"); | ||||
all_pnames.insert ("ylabel"); | ||||
all_pnames.insert ("zlabel"); | ||||
all_pnames.insert ("title"); | ||||
all_pnames.insert ("xgrid"); | ||||
all_pnames.insert ("ygrid"); | ||||
all_pnames.insert ("zgrid"); | ||||
all_pnames.insert ("xminorgrid"); | ||||
all_pnames.insert ("yminorgrid"); | ||||
all_pnames.insert ("zminorgrid"); | ||||
all_pnames.insert ("xtick"); | ||||
all_pnames.insert ("ytick"); | ||||
all_pnames.insert ("ztick"); | ||||
all_pnames.insert ("xtickmode"); | ||||
all_pnames.insert ("ytickmode"); | ||||
all_pnames.insert ("ztickmode"); | ||||
all_pnames.insert ("xminortick"); | ||||
all_pnames.insert ("yminortick"); | ||||
all_pnames.insert ("zminortick"); | ||||
all_pnames.insert ("xticklabel"); | ||||
all_pnames.insert ("yticklabel"); | ||||
all_pnames.insert ("zticklabel"); | ||||
all_pnames.insert ("xticklabelmode"); | ||||
all_pnames.insert ("yticklabelmode"); | ||||
all_pnames.insert ("zticklabelmode"); | ||||
all_pnames.insert ("interpreter"); | ||||
all_pnames.insert ("color"); | ||||
all_pnames.insert ("xcolor"); | ||||
all_pnames.insert ("ycolor"); | ||||
all_pnames.insert ("zcolor"); | ||||
all_pnames.insert ("xscale"); | ||||
all_pnames.insert ("yscale"); | ||||
all_pnames.insert ("zscale"); | ||||
all_pnames.insert ("xdir"); | ||||
all_pnames.insert ("ydir"); | ||||
all_pnames.insert ("zdir"); | ||||
all_pnames.insert ("yaxislocation"); | ||||
all_pnames.insert ("xaxislocation"); | ||||
all_pnames.insert ("view"); | ||||
all_pnames.insert ("__hold_all__"); | ||||
all_pnames.insert ("nextplot"); | ||||
all_pnames.insert ("outerposition"); | ||||
all_pnames.insert ("activepositionproperty"); | ||||
all_pnames.insert ("ambientlightcolor"); | all_pnames.insert ("ambientlightcolor"); | |||
all_pnames.insert ("box"); | ||||
all_pnames.insert ("cameraposition"); | all_pnames.insert ("cameraposition"); | |||
all_pnames.insert ("cameratarget"); | ||||
all_pnames.insert ("cameraupvector"); | ||||
all_pnames.insert ("cameraviewangle"); | ||||
all_pnames.insert ("camerapositionmode"); | all_pnames.insert ("camerapositionmode"); | |||
all_pnames.insert ("cameratarget"); | ||||
all_pnames.insert ("cameratargetmode"); | all_pnames.insert ("cameratargetmode"); | |||
all_pnames.insert ("cameraupvector"); | ||||
all_pnames.insert ("cameraupvectormode"); | all_pnames.insert ("cameraupvectormode"); | |||
all_pnames.insert ("cameraviewangle"); | ||||
all_pnames.insert ("cameraviewanglemode"); | all_pnames.insert ("cameraviewanglemode"); | |||
all_pnames.insert ("clim"); | ||||
all_pnames.insert ("climmode"); | ||||
all_pnames.insert ("color"); | ||||
all_pnames.insert ("colororder"); | ||||
all_pnames.insert ("currentpoint"); | all_pnames.insert ("currentpoint"); | |||
all_pnames.insert ("dataaspectratio"); | ||||
all_pnames.insert ("dataaspectratiomode"); | ||||
all_pnames.insert ("drawmode"); | all_pnames.insert ("drawmode"); | |||
all_pnames.insert ("fontangle"); | all_pnames.insert ("fontangle"); | |||
all_pnames.insert ("fontname"); | all_pnames.insert ("fontname"); | |||
all_pnames.insert ("fontsize"); | all_pnames.insert ("fontsize"); | |||
all_pnames.insert ("fontunits"); | all_pnames.insert ("fontunits"); | |||
all_pnames.insert ("fontweight"); | all_pnames.insert ("fontweight"); | |||
all_pnames.insert ("gridlinestyle"); | all_pnames.insert ("gridlinestyle"); | |||
all_pnames.insert ("interpreter"); | ||||
all_pnames.insert ("layer"); | ||||
all_pnames.insert ("linestyleorder"); | all_pnames.insert ("linestyleorder"); | |||
all_pnames.insert ("linewidth"); | all_pnames.insert ("linewidth"); | |||
all_pnames.insert ("minorgridlinestyle"); | all_pnames.insert ("minorgridlinestyle"); | |||
all_pnames.insert ("nextplot"); | ||||
all_pnames.insert ("outerposition"); | ||||
all_pnames.insert ("plotboxaspectratio"); | all_pnames.insert ("plotboxaspectratio"); | |||
all_pnames.insert ("plotboxaspectratiomode"); | all_pnames.insert ("plotboxaspectratiomode"); | |||
all_pnames.insert ("position"); | ||||
all_pnames.insert ("projection"); | all_pnames.insert ("projection"); | |||
all_pnames.insert ("tickdir"); | all_pnames.insert ("tickdir"); | |||
all_pnames.insert ("tickdirmode"); | all_pnames.insert ("tickdirmode"); | |||
all_pnames.insert ("ticklength"); | all_pnames.insert ("ticklength"); | |||
all_pnames.insert ("tightinset"); | all_pnames.insert ("tightinset"); | |||
all_pnames.insert ("title"); | ||||
all_pnames.insert ("units"); | all_pnames.insert ("units"); | |||
all_pnames.insert ("view"); | ||||
all_pnames.insert ("xaxislocation"); | ||||
all_pnames.insert ("xcolor"); | ||||
all_pnames.insert ("xdir"); | ||||
all_pnames.insert ("xgrid"); | ||||
all_pnames.insert ("xlabel"); | ||||
all_pnames.insert ("xlim"); | ||||
all_pnames.insert ("xlimmode"); | ||||
all_pnames.insert ("xminorgrid"); | ||||
all_pnames.insert ("xminortick"); | ||||
all_pnames.insert ("xscale"); | ||||
all_pnames.insert ("xtick"); | ||||
all_pnames.insert ("xticklabel"); | ||||
all_pnames.insert ("xticklabelmode"); | ||||
all_pnames.insert ("xtickmode"); | ||||
all_pnames.insert ("yaxislocation"); | ||||
all_pnames.insert ("ycolor"); | ||||
all_pnames.insert ("ydir"); | ||||
all_pnames.insert ("ygrid"); | ||||
all_pnames.insert ("ylabel"); | ||||
all_pnames.insert ("ylim"); | ||||
all_pnames.insert ("ylimmode"); | ||||
all_pnames.insert ("yminorgrid"); | ||||
all_pnames.insert ("yminortick"); | ||||
all_pnames.insert ("yscale"); | ||||
all_pnames.insert ("ytick"); | ||||
all_pnames.insert ("yticklabel"); | ||||
all_pnames.insert ("yticklabelmode"); | ||||
all_pnames.insert ("ytickmode"); | ||||
all_pnames.insert ("zcolor"); | ||||
all_pnames.insert ("zdir"); | ||||
all_pnames.insert ("zgrid"); | ||||
all_pnames.insert ("zlabel"); | ||||
all_pnames.insert ("zlim"); | ||||
all_pnames.insert ("zlimmode"); | ||||
all_pnames.insert ("zminorgrid"); | ||||
all_pnames.insert ("zminortick"); | ||||
all_pnames.insert ("zscale"); | ||||
all_pnames.insert ("ztick"); | ||||
all_pnames.insert ("zticklabel"); | ||||
all_pnames.insert ("zticklabelmode"); | ||||
all_pnames.insert ("ztickmode"); | ||||
all_pnames.insert ("__hold_all__"); | ||||
all_pnames.insert ("autopos_tag"); | ||||
all_pnames.insert ("looseinset"); | ||||
all_pnames.insert ("x_viewtransform"); | all_pnames.insert ("x_viewtransform"); | |||
all_pnames.insert ("x_projectiontransform"); | all_pnames.insert ("x_projectiontransform"); | |||
all_pnames.insert ("x_viewporttransform"); | all_pnames.insert ("x_viewporttransform"); | |||
all_pnames.insert ("x_normrendertransform"); | all_pnames.insert ("x_normrendertransform"); | |||
all_pnames.insert ("x_rendertransform"); | all_pnames.insert ("x_rendertransform"); | |||
all_pnames.insert ("xmtick"); | all_pnames.insert ("xmtick"); | |||
all_pnames.insert ("ymtick"); | all_pnames.insert ("ymtick"); | |||
all_pnames.insert ("zmtick"); | all_pnames.insert ("zmtick"); | |||
all_pnames.insert ("looseinset"); | ||||
all_pnames.insert ("autopos_tag"); | ||||
std::set<std::string> base_pnames = base_properties::core_property_na mes (); | std::set<std::string> base_pnames = base_properties::core_property_na mes (); | |||
all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | |||
initialized = true; | initialized = true; | |||
} | } | |||
return all_pnames; | return all_pnames; | |||
} | } | |||
skipping to change at line 2523 | skipping to change at line 2565 | |||
{ | { | |||
std::set<std::string> pnames = all_property_names (); | std::set<std::string> pnames = all_property_names (); | |||
return pnames.find (pname) != pnames.end (); | return pnames.find (pname) != pnames.end (); | |||
} | } | |||
// ******** line ******** | // ******** line ******** | |||
line::properties::properties (const graphics_handle& mh, const graphics_han dle& p) | line::properties::properties (const graphics_handle& mh, const graphics_han dle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
xdata ("xdata", mh, default_data ()), | ||||
ydata ("ydata", mh, default_data ()), | ||||
zdata ("zdata", mh, Matrix ()), | ||||
xdatasource ("xdatasource", mh, ""), | ||||
ydatasource ("ydatasource", mh, ""), | ||||
zdatasource ("zdatasource", mh, ""), | ||||
color ("color", mh, color_values (0, 0, 0)), | color ("color", mh, color_values (0, 0, 0)), | |||
displayname ("displayname", mh, ""), | ||||
erasemode ("erasemode", mh, "{normal}|none|xor|background"), | ||||
interpreter ("interpreter", mh, "{tex}|none|latex"), | ||||
linestyle ("linestyle", mh, "{-}|--|:|-.|none"), | linestyle ("linestyle", mh, "{-}|--|:|-.|none"), | |||
linewidth ("linewidth", mh, 0.5), | linewidth ("linewidth", mh, 0.5), | |||
marker ("marker", mh, "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h|@"), | marker ("marker", mh, "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pe | |||
markeredgecolor ("markeredgecolor", mh, "{auto}|none"), | ntagram|h|hexagram"), | |||
markerfacecolor ("markerfacecolor", mh, "auto|{none}"), | markeredgecolor ("markeredgecolor", mh, color_property (radio_values (" | |||
{auto}|none"), color_values (0, 0, 0))), | ||||
markerfacecolor ("markerfacecolor", mh, color_property (radio_values (" | ||||
auto|{none}"), color_values (0, 0, 0))), | ||||
markersize ("markersize", mh, 6), | markersize ("markersize", mh, 6), | |||
interpreter ("interpreter", mh, "{tex}|none|latex"), | xdata ("xdata", mh, default_data ()), | |||
displayname ("displayname", mh, ""), | xdatasource ("xdatasource", mh, ""), | |||
erasemode ("erasemode", mh, "{normal}|none|xor|background"), | ydata ("ydata", mh, default_data ()), | |||
ydatasource ("ydatasource", mh, ""), | ||||
zdata ("zdata", mh, Matrix ()), | ||||
zdatasource ("zdatasource", mh, ""), | ||||
xlim ("xlim", mh, Matrix ()), | xlim ("xlim", mh, Matrix ()), | |||
ylim ("ylim", mh, Matrix ()), | ylim ("ylim", mh, Matrix ()), | |||
zlim ("zlim", mh, Matrix ()), | zlim ("zlim", mh, Matrix ()), | |||
xliminclude ("xliminclude", mh, "on"), | xliminclude ("xliminclude", mh, "on"), | |||
yliminclude ("yliminclude", mh, "on"), | yliminclude ("yliminclude", mh, "on"), | |||
zliminclude ("zliminclude", mh, "off") | zliminclude ("zliminclude", mh, "off") | |||
{ | { | |||
xdata.set_id (ID_XDATA); | ||||
ydata.set_id (ID_YDATA); | ||||
zdata.set_id (ID_ZDATA); | ||||
xdatasource.set_id (ID_XDATASOURCE); | ||||
ydatasource.set_id (ID_YDATASOURCE); | ||||
zdatasource.set_id (ID_ZDATASOURCE); | ||||
color.set_id (ID_COLOR); | color.set_id (ID_COLOR); | |||
displayname.set_id (ID_DISPLAYNAME); | ||||
erasemode.set_id (ID_ERASEMODE); | ||||
interpreter.set_id (ID_INTERPRETER); | ||||
linestyle.set_id (ID_LINESTYLE); | linestyle.set_id (ID_LINESTYLE); | |||
linewidth.set_id (ID_LINEWIDTH); | linewidth.set_id (ID_LINEWIDTH); | |||
marker.set_id (ID_MARKER); | marker.set_id (ID_MARKER); | |||
markeredgecolor.set_id (ID_MARKEREDGECOLOR); | markeredgecolor.set_id (ID_MARKEREDGECOLOR); | |||
markerfacecolor.set_id (ID_MARKERFACECOLOR); | markerfacecolor.set_id (ID_MARKERFACECOLOR); | |||
markersize.set_id (ID_MARKERSIZE); | markersize.set_id (ID_MARKERSIZE); | |||
interpreter.set_id (ID_INTERPRETER); | xdata.set_id (ID_XDATA); | |||
displayname.set_id (ID_DISPLAYNAME); | xdatasource.set_id (ID_XDATASOURCE); | |||
erasemode.set_id (ID_ERASEMODE); | ydata.set_id (ID_YDATA); | |||
ydatasource.set_id (ID_YDATASOURCE); | ||||
zdata.set_id (ID_ZDATA); | ||||
zdatasource.set_id (ID_ZDATASOURCE); | ||||
xlim.set_id (ID_XLIM); | xlim.set_id (ID_XLIM); | |||
xlim.set_hidden (true); | xlim.set_hidden (true); | |||
ylim.set_id (ID_YLIM); | ylim.set_id (ID_YLIM); | |||
ylim.set_hidden (true); | ylim.set_hidden (true); | |||
zlim.set_id (ID_ZLIM); | zlim.set_id (ID_ZLIM); | |||
zlim.set_hidden (true); | zlim.set_hidden (true); | |||
xliminclude.set_id (ID_XLIMINCLUDE); | xliminclude.set_id (ID_XLIMINCLUDE); | |||
xliminclude.set_hidden (true); | xliminclude.set_hidden (true); | |||
yliminclude.set_id (ID_YLIMINCLUDE); | yliminclude.set_id (ID_YLIMINCLUDE); | |||
yliminclude.set_hidden (true); | yliminclude.set_hidden (true); | |||
skipping to change at line 2587 | skipping to change at line 2629 | |||
void | void | |||
line::properties::set (const caseless_str& pname_arg, const octave_value& v al) | line::properties::set (const caseless_str& pname_arg, const octave_value& v al) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return; | return; | |||
if (pname.compare ("xdata")) | if (pname.compare ("color")) | |||
set_xdata (val); | ||||
else if (pname.compare ("ydata")) | ||||
set_ydata (val); | ||||
else if (pname.compare ("zdata")) | ||||
set_zdata (val); | ||||
else if (pname.compare ("xdatasource")) | ||||
set_xdatasource (val); | ||||
else if (pname.compare ("ydatasource")) | ||||
set_ydatasource (val); | ||||
else if (pname.compare ("zdatasource")) | ||||
set_zdatasource (val); | ||||
else if (pname.compare ("color")) | ||||
set_color (val); | set_color (val); | |||
else if (pname.compare ("displayname")) | ||||
set_displayname (val); | ||||
else if (pname.compare ("erasemode")) | ||||
set_erasemode (val); | ||||
else if (pname.compare ("interpreter")) | ||||
set_interpreter (val); | ||||
else if (pname.compare ("linestyle")) | else if (pname.compare ("linestyle")) | |||
set_linestyle (val); | set_linestyle (val); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
set_linewidth (val); | set_linewidth (val); | |||
else if (pname.compare ("marker")) | else if (pname.compare ("marker")) | |||
set_marker (val); | set_marker (val); | |||
else if (pname.compare ("markeredgecolor")) | else if (pname.compare ("markeredgecolor")) | |||
set_markeredgecolor (val); | set_markeredgecolor (val); | |||
else if (pname.compare ("markerfacecolor")) | else if (pname.compare ("markerfacecolor")) | |||
set_markerfacecolor (val); | set_markerfacecolor (val); | |||
else if (pname.compare ("markersize")) | else if (pname.compare ("markersize")) | |||
set_markersize (val); | set_markersize (val); | |||
else if (pname.compare ("interpreter")) | else if (pname.compare ("xdata")) | |||
set_interpreter (val); | set_xdata (val); | |||
else if (pname.compare ("displayname")) | else if (pname.compare ("xdatasource")) | |||
set_displayname (val); | set_xdatasource (val); | |||
else if (pname.compare ("erasemode")) | else if (pname.compare ("ydata")) | |||
set_erasemode (val); | set_ydata (val); | |||
else if (pname.compare ("ydatasource")) | ||||
set_ydatasource (val); | ||||
else if (pname.compare ("zdata")) | ||||
set_zdata (val); | ||||
else if (pname.compare ("zdatasource")) | ||||
set_zdatasource (val); | ||||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
set_xliminclude (val); | set_xliminclude (val); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
set_yliminclude (val); | set_yliminclude (val); | |||
else if (pname.compare ("zliminclude")) | else if (pname.compare ("zliminclude")) | |||
set_zliminclude (val); | set_zliminclude (val); | |||
else | else | |||
base_properties::set (pname, val); | base_properties::set (pname, val); | |||
} | } | |||
octave_value | octave_value | |||
line::properties::get (bool all) const | line::properties::get (bool all) const | |||
{ | { | |||
octave_map m = base_properties::get (all).map_value (); | octave_map m = base_properties::get (all).map_value (); | |||
m.assign ("xdata", octave_value (get_xdata ())); | ||||
m.assign ("ydata", octave_value (get_ydata ())); | ||||
m.assign ("zdata", octave_value (get_zdata ())); | ||||
m.assign ("xdatasource", octave_value (get_xdatasource ())); | ||||
m.assign ("ydatasource", octave_value (get_ydatasource ())); | ||||
m.assign ("zdatasource", octave_value (get_zdatasource ())); | ||||
m.assign ("color", octave_value (get_color ())); | m.assign ("color", octave_value (get_color ())); | |||
m.assign ("displayname", octave_value (get_displayname ())); | ||||
m.assign ("erasemode", octave_value (get_erasemode ())); | ||||
m.assign ("interpreter", octave_value (get_interpreter ())); | ||||
m.assign ("linestyle", octave_value (get_linestyle ())); | m.assign ("linestyle", octave_value (get_linestyle ())); | |||
m.assign ("linewidth", octave_value (get_linewidth ())); | m.assign ("linewidth", octave_value (get_linewidth ())); | |||
m.assign ("marker", octave_value (get_marker ())); | m.assign ("marker", octave_value (get_marker ())); | |||
m.assign ("markeredgecolor", octave_value (get_markeredgecolor ())); | m.assign ("markeredgecolor", octave_value (get_markeredgecolor ())); | |||
m.assign ("markerfacecolor", octave_value (get_markerfacecolor ())); | m.assign ("markerfacecolor", octave_value (get_markerfacecolor ())); | |||
m.assign ("markersize", octave_value (get_markersize ())); | m.assign ("markersize", octave_value (get_markersize ())); | |||
m.assign ("interpreter", octave_value (get_interpreter ())); | m.assign ("xdata", octave_value (get_xdata ())); | |||
m.assign ("displayname", octave_value (get_displayname ())); | m.assign ("xdatasource", octave_value (get_xdatasource ())); | |||
m.assign ("erasemode", octave_value (get_erasemode ())); | m.assign ("ydata", octave_value (get_ydata ())); | |||
m.assign ("ydatasource", octave_value (get_ydatasource ())); | ||||
m.assign ("zdata", octave_value (get_zdata ())); | ||||
m.assign ("zdatasource", octave_value (get_zdatasource ())); | ||||
if (all) | if (all) | |||
m.assign ("xlim", octave_value (get_xlim ())); | m.assign ("xlim", octave_value (get_xlim ())); | |||
if (all) | if (all) | |||
m.assign ("ylim", octave_value (get_ylim ())); | m.assign ("ylim", octave_value (get_ylim ())); | |||
if (all) | if (all) | |||
m.assign ("zlim", octave_value (get_zlim ())); | m.assign ("zlim", octave_value (get_zlim ())); | |||
if (all) | if (all) | |||
m.assign ("xliminclude", octave_value (get_xliminclude ())); | m.assign ("xliminclude", octave_value (get_xliminclude ())); | |||
if (all) | if (all) | |||
m.assign ("yliminclude", octave_value (get_yliminclude ())); | m.assign ("yliminclude", octave_value (get_yliminclude ())); | |||
skipping to change at line 2678 | skipping to change at line 2720 | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return retval; | return retval; | |||
if (pname.compare ("xdata")) | if (pname.compare ("color")) | |||
retval = get_xdata (); | ||||
else if (pname.compare ("ydata")) | ||||
retval = get_ydata (); | ||||
else if (pname.compare ("zdata")) | ||||
retval = get_zdata (); | ||||
else if (pname.compare ("xdatasource")) | ||||
retval = get_xdatasource (); | ||||
else if (pname.compare ("ydatasource")) | ||||
retval = get_ydatasource (); | ||||
else if (pname.compare ("zdatasource")) | ||||
retval = get_zdatasource (); | ||||
else if (pname.compare ("color")) | ||||
retval = get_color (); | retval = get_color (); | |||
else if (pname.compare ("displayname")) | ||||
retval = get_displayname (); | ||||
else if (pname.compare ("erasemode")) | ||||
retval = get_erasemode (); | ||||
else if (pname.compare ("interpreter")) | ||||
retval = get_interpreter (); | ||||
else if (pname.compare ("linestyle")) | else if (pname.compare ("linestyle")) | |||
retval = get_linestyle (); | retval = get_linestyle (); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
retval = get_linewidth (); | retval = get_linewidth (); | |||
else if (pname.compare ("marker")) | else if (pname.compare ("marker")) | |||
retval = get_marker (); | retval = get_marker (); | |||
else if (pname.compare ("markeredgecolor")) | else if (pname.compare ("markeredgecolor")) | |||
retval = get_markeredgecolor (); | retval = get_markeredgecolor (); | |||
else if (pname.compare ("markerfacecolor")) | else if (pname.compare ("markerfacecolor")) | |||
retval = get_markerfacecolor (); | retval = get_markerfacecolor (); | |||
else if (pname.compare ("markersize")) | else if (pname.compare ("markersize")) | |||
retval = get_markersize (); | retval = get_markersize (); | |||
else if (pname.compare ("interpreter")) | else if (pname.compare ("xdata")) | |||
retval = get_interpreter (); | retval = get_xdata (); | |||
else if (pname.compare ("displayname")) | else if (pname.compare ("xdatasource")) | |||
retval = get_displayname (); | retval = get_xdatasource (); | |||
else if (pname.compare ("erasemode")) | else if (pname.compare ("ydata")) | |||
retval = get_erasemode (); | retval = get_ydata (); | |||
else if (pname.compare ("ydatasource")) | ||||
retval = get_ydatasource (); | ||||
else if (pname.compare ("zdata")) | ||||
retval = get_zdata (); | ||||
else if (pname.compare ("zdatasource")) | ||||
retval = get_zdatasource (); | ||||
else if (pname.compare ("xlim")) | else if (pname.compare ("xlim")) | |||
retval = get_xlim (); | retval = get_xlim (); | |||
else if (pname.compare ("ylim")) | else if (pname.compare ("ylim")) | |||
retval = get_ylim (); | retval = get_ylim (); | |||
else if (pname.compare ("zlim")) | else if (pname.compare ("zlim")) | |||
retval = get_zlim (); | retval = get_zlim (); | |||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
retval = get_xliminclude (); | retval = get_xliminclude (); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
retval = get_yliminclude (); | retval = get_yliminclude (); | |||
skipping to change at line 2738 | skipping to change at line 2780 | |||
property | property | |||
line::properties::get_property (const caseless_str& pname_arg) | line::properties::get_property (const caseless_str& pname_arg) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return property (); | return property (); | |||
if (pname.compare ("xdata")) | if (pname.compare ("color")) | |||
return property (&xdata, true); | ||||
else if (pname.compare ("ydata")) | ||||
return property (&ydata, true); | ||||
else if (pname.compare ("zdata")) | ||||
return property (&zdata, true); | ||||
else if (pname.compare ("xdatasource")) | ||||
return property (&xdatasource, true); | ||||
else if (pname.compare ("ydatasource")) | ||||
return property (&ydatasource, true); | ||||
else if (pname.compare ("zdatasource")) | ||||
return property (&zdatasource, true); | ||||
else if (pname.compare ("color")) | ||||
return property (&color, true); | return property (&color, true); | |||
else if (pname.compare ("displayname")) | ||||
return property (&displayname, true); | ||||
else if (pname.compare ("erasemode")) | ||||
return property (&erasemode, true); | ||||
else if (pname.compare ("interpreter")) | ||||
return property (&interpreter, true); | ||||
else if (pname.compare ("linestyle")) | else if (pname.compare ("linestyle")) | |||
return property (&linestyle, true); | return property (&linestyle, true); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
return property (&linewidth, true); | return property (&linewidth, true); | |||
else if (pname.compare ("marker")) | else if (pname.compare ("marker")) | |||
return property (&marker, true); | return property (&marker, true); | |||
else if (pname.compare ("markeredgecolor")) | else if (pname.compare ("markeredgecolor")) | |||
return property (&markeredgecolor, true); | return property (&markeredgecolor, true); | |||
else if (pname.compare ("markerfacecolor")) | else if (pname.compare ("markerfacecolor")) | |||
return property (&markerfacecolor, true); | return property (&markerfacecolor, true); | |||
else if (pname.compare ("markersize")) | else if (pname.compare ("markersize")) | |||
return property (&markersize, true); | return property (&markersize, true); | |||
else if (pname.compare ("interpreter")) | else if (pname.compare ("xdata")) | |||
return property (&interpreter, true); | return property (&xdata, true); | |||
else if (pname.compare ("displayname")) | else if (pname.compare ("xdatasource")) | |||
return property (&displayname, true); | return property (&xdatasource, true); | |||
else if (pname.compare ("erasemode")) | else if (pname.compare ("ydata")) | |||
return property (&erasemode, true); | return property (&ydata, true); | |||
else if (pname.compare ("ydatasource")) | ||||
return property (&ydatasource, true); | ||||
else if (pname.compare ("zdata")) | ||||
return property (&zdata, true); | ||||
else if (pname.compare ("zdatasource")) | ||||
return property (&zdatasource, true); | ||||
else if (pname.compare ("xlim")) | else if (pname.compare ("xlim")) | |||
return property (&xlim, true); | return property (&xlim, true); | |||
else if (pname.compare ("ylim")) | else if (pname.compare ("ylim")) | |||
return property (&ylim, true); | return property (&ylim, true); | |||
else if (pname.compare ("zlim")) | else if (pname.compare ("zlim")) | |||
return property (&zlim, true); | return property (&zlim, true); | |||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
return property (&xliminclude, true); | return property (&xliminclude, true); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
return property (&yliminclude, true); | return property (&yliminclude, true); | |||
skipping to change at line 2791 | skipping to change at line 2833 | |||
return property (&zliminclude, true); | return property (&zliminclude, true); | |||
else | else | |||
return base_properties::get_property (pname); | return base_properties::get_property (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
line::properties::factory_defaults (void) | line::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["xdata"] = default_data (); | ||||
m["ydata"] = default_data (); | ||||
m["zdata"] = Matrix (); | ||||
m["xdatasource"] = ""; | ||||
m["ydatasource"] = ""; | ||||
m["zdatasource"] = ""; | ||||
m["color"] = color_values (0, 0, 0); | m["color"] = color_values (0, 0, 0); | |||
m["displayname"] = ""; | ||||
m["erasemode"] = "normal"; | ||||
m["interpreter"] = "tex"; | ||||
m["linestyle"] = "-"; | m["linestyle"] = "-"; | |||
m["linewidth"] = 0.5; | m["linewidth"] = 0.5; | |||
m["marker"] = "none"; | m["marker"] = "none"; | |||
m["markeredgecolor"] = "{auto}|none"; | m["markeredgecolor"] = color_property (radio_values ("{auto}|none"), colo | |||
m["markerfacecolor"] = "auto|{none}"; | r_values (0, 0, 0)); | |||
m["markerfacecolor"] = color_property (radio_values ("auto|{none}"), colo | ||||
r_values (0, 0, 0)); | ||||
m["markersize"] = 6; | m["markersize"] = 6; | |||
m["interpreter"] = "tex"; | m["xdata"] = default_data (); | |||
m["displayname"] = ""; | m["xdatasource"] = ""; | |||
m["erasemode"] = "normal"; | m["ydata"] = default_data (); | |||
m["ydatasource"] = ""; | ||||
m["zdata"] = Matrix (); | ||||
m["zdatasource"] = ""; | ||||
m["xlim"] = Matrix (); | m["xlim"] = Matrix (); | |||
m["ylim"] = Matrix (); | m["ylim"] = Matrix (); | |||
m["zlim"] = Matrix (); | m["zlim"] = Matrix (); | |||
m["xliminclude"] = "on"; | m["xliminclude"] = "on"; | |||
m["yliminclude"] = "on"; | m["yliminclude"] = "on"; | |||
m["zliminclude"] = "off"; | m["zliminclude"] = "off"; | |||
return m; | return m; | |||
} | } | |||
skipping to change at line 2828 | skipping to change at line 2870 | |||
std::set<std::string> | std::set<std::string> | |||
line::properties::core_property_names (void) | line::properties::core_property_names (void) | |||
{ | { | |||
static std::set<std::string> all_pnames; | static std::set<std::string> all_pnames; | |||
static bool initialized = false; | static bool initialized = false; | |||
if (! initialized) | if (! initialized) | |||
{ | { | |||
all_pnames.insert ("xdata"); | ||||
all_pnames.insert ("ydata"); | ||||
all_pnames.insert ("zdata"); | ||||
all_pnames.insert ("xdatasource"); | ||||
all_pnames.insert ("ydatasource"); | ||||
all_pnames.insert ("zdatasource"); | ||||
all_pnames.insert ("color"); | all_pnames.insert ("color"); | |||
all_pnames.insert ("displayname"); | ||||
all_pnames.insert ("erasemode"); | ||||
all_pnames.insert ("interpreter"); | ||||
all_pnames.insert ("linestyle"); | all_pnames.insert ("linestyle"); | |||
all_pnames.insert ("linewidth"); | all_pnames.insert ("linewidth"); | |||
all_pnames.insert ("marker"); | all_pnames.insert ("marker"); | |||
all_pnames.insert ("markeredgecolor"); | all_pnames.insert ("markeredgecolor"); | |||
all_pnames.insert ("markerfacecolor"); | all_pnames.insert ("markerfacecolor"); | |||
all_pnames.insert ("markersize"); | all_pnames.insert ("markersize"); | |||
all_pnames.insert ("interpreter"); | all_pnames.insert ("xdata"); | |||
all_pnames.insert ("displayname"); | all_pnames.insert ("xdatasource"); | |||
all_pnames.insert ("erasemode"); | all_pnames.insert ("ydata"); | |||
all_pnames.insert ("ydatasource"); | ||||
all_pnames.insert ("zdata"); | ||||
all_pnames.insert ("zdatasource"); | ||||
all_pnames.insert ("xlim"); | all_pnames.insert ("xlim"); | |||
all_pnames.insert ("ylim"); | all_pnames.insert ("ylim"); | |||
all_pnames.insert ("zlim"); | all_pnames.insert ("zlim"); | |||
all_pnames.insert ("xliminclude"); | all_pnames.insert ("xliminclude"); | |||
all_pnames.insert ("yliminclude"); | all_pnames.insert ("yliminclude"); | |||
all_pnames.insert ("zliminclude"); | all_pnames.insert ("zliminclude"); | |||
std::set<std::string> base_pnames = base_properties::core_property_na mes (); | std::set<std::string> base_pnames = base_properties::core_property_na mes (); | |||
all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | |||
skipping to change at line 2892 | skipping to change at line 2934 | |||
{ | { | |||
std::set<std::string> pnames = all_property_names (); | std::set<std::string> pnames = all_property_names (); | |||
return pnames.find (pname) != pnames.end (); | return pnames.find (pname) != pnames.end (); | |||
} | } | |||
// ******** text ******** | // ******** text ******** | |||
text::properties::properties (const graphics_handle& mh, const graphics_han dle& p) | text::properties::properties (const graphics_handle& mh, const graphics_han dle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
string ("string", mh, ""), | backgroundcolor ("backgroundcolor", mh, color_property (radio_values (" | |||
units ("units", mh, "{data}|pixels|normalized|inches|centimeters|points | {none}"), color_values (1, 1, 1))), | |||
"), | ||||
position ("position", mh, Matrix (1, 3, 0.0)), | ||||
rotation ("rotation", mh, 0), | ||||
horizontalalignment ("horizontalalignment", mh, "{left}|center|right"), | ||||
color ("color", mh, color_values (0, 0, 0)), | color ("color", mh, color_values (0, 0, 0)), | |||
displayname ("displayname", mh, ""), | ||||
edgecolor ("edgecolor", mh, color_property (radio_values ("{none}"), co | ||||
lor_values (0, 0, 0))), | ||||
editing ("editing", mh, "off"), | ||||
erasemode ("erasemode", mh, "{normal}|none|xor|background"), | ||||
extent ("extent", mh, Matrix (1, 4, 0.0)), | ||||
fontangle ("fontangle", mh, "{normal}|italic|oblique"), | ||||
fontname ("fontname", mh, OCTAVE_DEFAULT_FONTNAME), | fontname ("fontname", mh, OCTAVE_DEFAULT_FONTNAME), | |||
fontsize ("fontsize", mh, 10), | fontsize ("fontsize", mh, 10), | |||
fontangle ("fontangle", mh, "{normal}|italic|oblique"), | fontunits ("fontunits", mh, "inches|centimeters|normalized|{points}|pix els"), | |||
fontweight ("fontweight", mh, "light|{normal}|demi|bold"), | fontweight ("fontweight", mh, "light|{normal}|demi|bold"), | |||
horizontalalignment ("horizontalalignment", mh, "{left}|center|right"), | ||||
interpreter ("interpreter", mh, "{tex}|none|latex"), | interpreter ("interpreter", mh, "{tex}|none|latex"), | |||
backgroundcolor ("backgroundcolor", mh, "{none}"), | ||||
displayname ("displayname", mh, ""), | ||||
edgecolor ("edgecolor", mh, "{none}"), | ||||
erasemode ("erasemode", mh, "{normal}|none|xor|background"), | ||||
editing ("editing", mh, "off"), | ||||
fontunits ("fontunits", mh, "inches|centimeters|normalized|{points}|pix | ||||
els"), | ||||
linestyle ("linestyle", mh, "{-}|--|:|-.|none"), | linestyle ("linestyle", mh, "{-}|--|:|-.|none"), | |||
linewidth ("linewidth", mh, 0.5), | linewidth ("linewidth", mh, 0.5), | |||
margin ("margin", mh, 1), | margin ("margin", mh, 1), | |||
position ("position", mh, Matrix (1, 3, 0.0)), | ||||
rotation ("rotation", mh, 0), | ||||
string ("string", mh, ""), | ||||
units ("units", mh, "{data}|pixels|normalized|inches|centimeters|points | ||||
"), | ||||
verticalalignment ("verticalalignment", mh, "top|cap|{middle}|baseline| bottom"), | verticalalignment ("verticalalignment", mh, "top|cap|{middle}|baseline| bottom"), | |||
extent ("extent", mh, Matrix (1, 4, 0.0)), | ||||
xlim ("xlim", mh, Matrix ()), | xlim ("xlim", mh, Matrix ()), | |||
ylim ("ylim", mh, Matrix ()), | ylim ("ylim", mh, Matrix ()), | |||
zlim ("zlim", mh, Matrix ()), | zlim ("zlim", mh, Matrix ()), | |||
xliminclude ("xliminclude", mh, "off"), | xliminclude ("xliminclude", mh, "off"), | |||
yliminclude ("yliminclude", mh, "off"), | yliminclude ("yliminclude", mh, "off"), | |||
zliminclude ("zliminclude", mh, "off"), | zliminclude ("zliminclude", mh, "off"), | |||
positionmode ("positionmode", mh, "{auto}|manual"), | positionmode ("positionmode", mh, "{auto}|manual"), | |||
rotationmode ("rotationmode", mh, "{auto}|manual"), | rotationmode ("rotationmode", mh, "{auto}|manual"), | |||
horizontalalignmentmode ("horizontalalignmentmode", mh, "{auto}|manual" | horizontalalignmentmode ("horizontalalignmentmode", mh, "{auto}|manual" | |||
), | ), | |||
verticalalignmentmode ("verticalalignmentmode", mh, "{auto}|manual"), | verticalalignmentmode ("verticalalignmentmode", mh, "{auto}|manual"), | |||
autopos_tag ("autopos_tag", mh, "{none}|xlabel|ylabel|zlabel|title") | autopos_tag ("autopos_tag", mh, "{none}|xlabel|ylabel|zlabel|title") | |||
{ | { | |||
string.set_id (ID_STRING); | ||||
units.set_id (ID_UNITS); | ||||
position.set_id (ID_POSITION); | ||||
rotation.set_id (ID_ROTATION); | ||||
horizontalalignment.set_id (ID_HORIZONTALALIGNMENT); | ||||
color.set_id (ID_COLOR); | ||||
fontname.set_id (ID_FONTNAME); | ||||
fontsize.set_id (ID_FONTSIZE); | ||||
fontangle.set_id (ID_FONTANGLE); | ||||
fontweight.set_id (ID_FONTWEIGHT); | ||||
interpreter.set_id (ID_INTERPRETER); | ||||
backgroundcolor.set_id (ID_BACKGROUNDCOLOR); | backgroundcolor.set_id (ID_BACKGROUNDCOLOR); | |||
color.set_id (ID_COLOR); | ||||
displayname.set_id (ID_DISPLAYNAME); | displayname.set_id (ID_DISPLAYNAME); | |||
edgecolor.set_id (ID_EDGECOLOR); | edgecolor.set_id (ID_EDGECOLOR); | |||
erasemode.set_id (ID_ERASEMODE); | ||||
editing.set_id (ID_EDITING); | editing.set_id (ID_EDITING); | |||
erasemode.set_id (ID_ERASEMODE); | ||||
extent.set_id (ID_EXTENT); | ||||
fontangle.set_id (ID_FONTANGLE); | ||||
fontname.set_id (ID_FONTNAME); | ||||
fontsize.set_id (ID_FONTSIZE); | ||||
fontunits.set_id (ID_FONTUNITS); | fontunits.set_id (ID_FONTUNITS); | |||
fontweight.set_id (ID_FONTWEIGHT); | ||||
horizontalalignment.set_id (ID_HORIZONTALALIGNMENT); | ||||
interpreter.set_id (ID_INTERPRETER); | ||||
linestyle.set_id (ID_LINESTYLE); | linestyle.set_id (ID_LINESTYLE); | |||
linewidth.set_id (ID_LINEWIDTH); | linewidth.set_id (ID_LINEWIDTH); | |||
margin.set_id (ID_MARGIN); | margin.set_id (ID_MARGIN); | |||
position.set_id (ID_POSITION); | ||||
rotation.set_id (ID_ROTATION); | ||||
string.set_id (ID_STRING); | ||||
units.set_id (ID_UNITS); | ||||
verticalalignment.set_id (ID_VERTICALALIGNMENT); | verticalalignment.set_id (ID_VERTICALALIGNMENT); | |||
extent.set_id (ID_EXTENT); | ||||
xlim.set_id (ID_XLIM); | xlim.set_id (ID_XLIM); | |||
xlim.set_hidden (true); | xlim.set_hidden (true); | |||
ylim.set_id (ID_YLIM); | ylim.set_id (ID_YLIM); | |||
ylim.set_hidden (true); | ylim.set_hidden (true); | |||
zlim.set_id (ID_ZLIM); | zlim.set_id (ID_ZLIM); | |||
zlim.set_hidden (true); | zlim.set_hidden (true); | |||
xliminclude.set_id (ID_XLIMINCLUDE); | xliminclude.set_id (ID_XLIMINCLUDE); | |||
xliminclude.set_hidden (true); | xliminclude.set_hidden (true); | |||
yliminclude.set_id (ID_YLIMINCLUDE); | yliminclude.set_id (ID_YLIMINCLUDE); | |||
yliminclude.set_hidden (true); | yliminclude.set_hidden (true); | |||
skipping to change at line 2983 | skipping to change at line 3025 | |||
void | void | |||
text::properties::set (const caseless_str& pname_arg, const octave_value& v al) | text::properties::set (const caseless_str& pname_arg, const octave_value& v al) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return; | return; | |||
if (pname.compare ("string")) | if (pname.compare ("backgroundcolor")) | |||
set_string (val); | set_backgroundcolor (val); | |||
else if (pname.compare ("units")) | ||||
set_units (val); | ||||
else if (pname.compare ("position")) | ||||
set_position (val); | ||||
else if (pname.compare ("rotation")) | ||||
set_rotation (val); | ||||
else if (pname.compare ("horizontalalignment")) | ||||
set_horizontalalignment (val); | ||||
else if (pname.compare ("color")) | else if (pname.compare ("color")) | |||
set_color (val); | set_color (val); | |||
else if (pname.compare ("fontname")) | ||||
set_fontname (val); | ||||
else if (pname.compare ("fontsize")) | ||||
set_fontsize (val); | ||||
else if (pname.compare ("fontangle")) | ||||
set_fontangle (val); | ||||
else if (pname.compare ("fontweight")) | ||||
set_fontweight (val); | ||||
else if (pname.compare ("interpreter")) | ||||
set_interpreter (val); | ||||
else if (pname.compare ("backgroundcolor")) | ||||
set_backgroundcolor (val); | ||||
else if (pname.compare ("displayname")) | else if (pname.compare ("displayname")) | |||
set_displayname (val); | set_displayname (val); | |||
else if (pname.compare ("edgecolor")) | else if (pname.compare ("edgecolor")) | |||
set_edgecolor (val); | set_edgecolor (val); | |||
else if (pname.compare ("erasemode")) | ||||
set_erasemode (val); | ||||
else if (pname.compare ("editing")) | else if (pname.compare ("editing")) | |||
set_editing (val); | set_editing (val); | |||
else if (pname.compare ("erasemode")) | ||||
set_erasemode (val); | ||||
else if (pname.compare ("fontangle")) | ||||
set_fontangle (val); | ||||
else if (pname.compare ("fontname")) | ||||
set_fontname (val); | ||||
else if (pname.compare ("fontsize")) | ||||
set_fontsize (val); | ||||
else if (pname.compare ("fontunits")) | else if (pname.compare ("fontunits")) | |||
set_fontunits (val); | set_fontunits (val); | |||
else if (pname.compare ("fontweight")) | ||||
set_fontweight (val); | ||||
else if (pname.compare ("horizontalalignment")) | ||||
set_horizontalalignment (val); | ||||
else if (pname.compare ("interpreter")) | ||||
set_interpreter (val); | ||||
else if (pname.compare ("linestyle")) | else if (pname.compare ("linestyle")) | |||
set_linestyle (val); | set_linestyle (val); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
set_linewidth (val); | set_linewidth (val); | |||
else if (pname.compare ("margin")) | else if (pname.compare ("margin")) | |||
set_margin (val); | set_margin (val); | |||
else if (pname.compare ("position")) | ||||
set_position (val); | ||||
else if (pname.compare ("rotation")) | ||||
set_rotation (val); | ||||
else if (pname.compare ("string")) | ||||
set_string (val); | ||||
else if (pname.compare ("units")) | ||||
set_units (val); | ||||
else if (pname.compare ("verticalalignment")) | else if (pname.compare ("verticalalignment")) | |||
set_verticalalignment (val); | set_verticalalignment (val); | |||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
set_xliminclude (val); | set_xliminclude (val); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
set_yliminclude (val); | set_yliminclude (val); | |||
else if (pname.compare ("zliminclude")) | else if (pname.compare ("zliminclude")) | |||
set_zliminclude (val); | set_zliminclude (val); | |||
else if (pname.compare ("positionmode")) | else if (pname.compare ("positionmode")) | |||
set_positionmode (val); | set_positionmode (val); | |||
skipping to change at line 3050 | skipping to change at line 3092 | |||
set_autopos_tag (val); | set_autopos_tag (val); | |||
else | else | |||
base_properties::set (pname, val); | base_properties::set (pname, val); | |||
} | } | |||
octave_value | octave_value | |||
text::properties::get (bool all) const | text::properties::get (bool all) const | |||
{ | { | |||
octave_map m = base_properties::get (all).map_value (); | octave_map m = base_properties::get (all).map_value (); | |||
m.assign ("string", octave_value (get_string ())); | ||||
m.assign ("units", octave_value (get_units ())); | ||||
m.assign ("position", octave_value (get_position ())); | ||||
m.assign ("rotation", octave_value (get_rotation ())); | ||||
m.assign ("horizontalalignment", octave_value (get_horizontalalignment () | ||||
)); | ||||
m.assign ("color", octave_value (get_color ())); | ||||
m.assign ("fontname", octave_value (get_fontname ())); | ||||
m.assign ("fontsize", octave_value (get_fontsize ())); | ||||
m.assign ("fontangle", octave_value (get_fontangle ())); | ||||
m.assign ("fontweight", octave_value (get_fontweight ())); | ||||
m.assign ("interpreter", octave_value (get_interpreter ())); | ||||
m.assign ("backgroundcolor", octave_value (get_backgroundcolor ())); | m.assign ("backgroundcolor", octave_value (get_backgroundcolor ())); | |||
m.assign ("color", octave_value (get_color ())); | ||||
m.assign ("displayname", octave_value (get_displayname ())); | m.assign ("displayname", octave_value (get_displayname ())); | |||
m.assign ("edgecolor", octave_value (get_edgecolor ())); | m.assign ("edgecolor", octave_value (get_edgecolor ())); | |||
m.assign ("erasemode", octave_value (get_erasemode ())); | ||||
m.assign ("editing", octave_value (get_editing ())); | m.assign ("editing", octave_value (get_editing ())); | |||
m.assign ("erasemode", octave_value (get_erasemode ())); | ||||
m.assign ("extent", octave_value (get_extent ())); | ||||
m.assign ("fontangle", octave_value (get_fontangle ())); | ||||
m.assign ("fontname", octave_value (get_fontname ())); | ||||
m.assign ("fontsize", octave_value (get_fontsize ())); | ||||
m.assign ("fontunits", octave_value (get_fontunits ())); | m.assign ("fontunits", octave_value (get_fontunits ())); | |||
m.assign ("fontweight", octave_value (get_fontweight ())); | ||||
m.assign ("horizontalalignment", octave_value (get_horizontalalignment () | ||||
)); | ||||
m.assign ("interpreter", octave_value (get_interpreter ())); | ||||
m.assign ("linestyle", octave_value (get_linestyle ())); | m.assign ("linestyle", octave_value (get_linestyle ())); | |||
m.assign ("linewidth", octave_value (get_linewidth ())); | m.assign ("linewidth", octave_value (get_linewidth ())); | |||
m.assign ("margin", octave_value (get_margin ())); | m.assign ("margin", octave_value (get_margin ())); | |||
m.assign ("position", octave_value (get_position ())); | ||||
m.assign ("rotation", octave_value (get_rotation ())); | ||||
m.assign ("string", octave_value (get_string ())); | ||||
m.assign ("units", octave_value (get_units ())); | ||||
m.assign ("verticalalignment", octave_value (get_verticalalignment ())); | m.assign ("verticalalignment", octave_value (get_verticalalignment ())); | |||
m.assign ("extent", octave_value (get_extent ())); | ||||
if (all) | if (all) | |||
m.assign ("xlim", octave_value (get_xlim ())); | m.assign ("xlim", octave_value (get_xlim ())); | |||
if (all) | if (all) | |||
m.assign ("ylim", octave_value (get_ylim ())); | m.assign ("ylim", octave_value (get_ylim ())); | |||
if (all) | if (all) | |||
m.assign ("zlim", octave_value (get_zlim ())); | m.assign ("zlim", octave_value (get_zlim ())); | |||
if (all) | if (all) | |||
m.assign ("xliminclude", octave_value (get_xliminclude ())); | m.assign ("xliminclude", octave_value (get_xliminclude ())); | |||
if (all) | if (all) | |||
m.assign ("yliminclude", octave_value (get_yliminclude ())); | m.assign ("yliminclude", octave_value (get_yliminclude ())); | |||
skipping to change at line 3110 | skipping to change at line 3152 | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return retval; | return retval; | |||
if (pname.compare ("string")) | if (pname.compare ("backgroundcolor")) | |||
retval = get_string (); | retval = get_backgroundcolor (); | |||
else if (pname.compare ("units")) | ||||
retval = get_units (); | ||||
else if (pname.compare ("position")) | ||||
retval = get_position (); | ||||
else if (pname.compare ("rotation")) | ||||
retval = get_rotation (); | ||||
else if (pname.compare ("horizontalalignment")) | ||||
retval = get_horizontalalignment (); | ||||
else if (pname.compare ("color")) | else if (pname.compare ("color")) | |||
retval = get_color (); | retval = get_color (); | |||
else if (pname.compare ("fontname")) | ||||
retval = get_fontname (); | ||||
else if (pname.compare ("fontsize")) | ||||
retval = get_fontsize (); | ||||
else if (pname.compare ("fontangle")) | ||||
retval = get_fontangle (); | ||||
else if (pname.compare ("fontweight")) | ||||
retval = get_fontweight (); | ||||
else if (pname.compare ("interpreter")) | ||||
retval = get_interpreter (); | ||||
else if (pname.compare ("backgroundcolor")) | ||||
retval = get_backgroundcolor (); | ||||
else if (pname.compare ("displayname")) | else if (pname.compare ("displayname")) | |||
retval = get_displayname (); | retval = get_displayname (); | |||
else if (pname.compare ("edgecolor")) | else if (pname.compare ("edgecolor")) | |||
retval = get_edgecolor (); | retval = get_edgecolor (); | |||
else if (pname.compare ("erasemode")) | ||||
retval = get_erasemode (); | ||||
else if (pname.compare ("editing")) | else if (pname.compare ("editing")) | |||
retval = get_editing (); | retval = get_editing (); | |||
else if (pname.compare ("erasemode")) | ||||
retval = get_erasemode (); | ||||
else if (pname.compare ("extent")) | ||||
retval = get_extent (); | ||||
else if (pname.compare ("fontangle")) | ||||
retval = get_fontangle (); | ||||
else if (pname.compare ("fontname")) | ||||
retval = get_fontname (); | ||||
else if (pname.compare ("fontsize")) | ||||
retval = get_fontsize (); | ||||
else if (pname.compare ("fontunits")) | else if (pname.compare ("fontunits")) | |||
retval = get_fontunits (); | retval = get_fontunits (); | |||
else if (pname.compare ("fontweight")) | ||||
retval = get_fontweight (); | ||||
else if (pname.compare ("horizontalalignment")) | ||||
retval = get_horizontalalignment (); | ||||
else if (pname.compare ("interpreter")) | ||||
retval = get_interpreter (); | ||||
else if (pname.compare ("linestyle")) | else if (pname.compare ("linestyle")) | |||
retval = get_linestyle (); | retval = get_linestyle (); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
retval = get_linewidth (); | retval = get_linewidth (); | |||
else if (pname.compare ("margin")) | else if (pname.compare ("margin")) | |||
retval = get_margin (); | retval = get_margin (); | |||
else if (pname.compare ("position")) | ||||
retval = get_position (); | ||||
else if (pname.compare ("rotation")) | ||||
retval = get_rotation (); | ||||
else if (pname.compare ("string")) | ||||
retval = get_string (); | ||||
else if (pname.compare ("units")) | ||||
retval = get_units (); | ||||
else if (pname.compare ("verticalalignment")) | else if (pname.compare ("verticalalignment")) | |||
retval = get_verticalalignment (); | retval = get_verticalalignment (); | |||
else if (pname.compare ("extent")) | ||||
retval = get_extent (); | ||||
else if (pname.compare ("xlim")) | else if (pname.compare ("xlim")) | |||
retval = get_xlim (); | retval = get_xlim (); | |||
else if (pname.compare ("ylim")) | else if (pname.compare ("ylim")) | |||
retval = get_ylim (); | retval = get_ylim (); | |||
else if (pname.compare ("zlim")) | else if (pname.compare ("zlim")) | |||
retval = get_zlim (); | retval = get_zlim (); | |||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
retval = get_xliminclude (); | retval = get_xliminclude (); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
retval = get_yliminclude (); | retval = get_yliminclude (); | |||
skipping to change at line 3192 | skipping to change at line 3234 | |||
property | property | |||
text::properties::get_property (const caseless_str& pname_arg) | text::properties::get_property (const caseless_str& pname_arg) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return property (); | return property (); | |||
if (pname.compare ("string")) | if (pname.compare ("backgroundcolor")) | |||
return property (&string, true); | return property (&backgroundcolor, true); | |||
else if (pname.compare ("units")) | ||||
return property (&units, true); | ||||
else if (pname.compare ("position")) | ||||
return property (&position, true); | ||||
else if (pname.compare ("rotation")) | ||||
return property (&rotation, true); | ||||
else if (pname.compare ("horizontalalignment")) | ||||
return property (&horizontalalignment, true); | ||||
else if (pname.compare ("color")) | else if (pname.compare ("color")) | |||
return property (&color, true); | return property (&color, true); | |||
else if (pname.compare ("fontname")) | ||||
return property (&fontname, true); | ||||
else if (pname.compare ("fontsize")) | ||||
return property (&fontsize, true); | ||||
else if (pname.compare ("fontangle")) | ||||
return property (&fontangle, true); | ||||
else if (pname.compare ("fontweight")) | ||||
return property (&fontweight, true); | ||||
else if (pname.compare ("interpreter")) | ||||
return property (&interpreter, true); | ||||
else if (pname.compare ("backgroundcolor")) | ||||
return property (&backgroundcolor, true); | ||||
else if (pname.compare ("displayname")) | else if (pname.compare ("displayname")) | |||
return property (&displayname, true); | return property (&displayname, true); | |||
else if (pname.compare ("edgecolor")) | else if (pname.compare ("edgecolor")) | |||
return property (&edgecolor, true); | return property (&edgecolor, true); | |||
else if (pname.compare ("erasemode")) | ||||
return property (&erasemode, true); | ||||
else if (pname.compare ("editing")) | else if (pname.compare ("editing")) | |||
return property (&editing, true); | return property (&editing, true); | |||
else if (pname.compare ("erasemode")) | ||||
return property (&erasemode, true); | ||||
else if (pname.compare ("extent")) | ||||
return property (&extent, true); | ||||
else if (pname.compare ("fontangle")) | ||||
return property (&fontangle, true); | ||||
else if (pname.compare ("fontname")) | ||||
return property (&fontname, true); | ||||
else if (pname.compare ("fontsize")) | ||||
return property (&fontsize, true); | ||||
else if (pname.compare ("fontunits")) | else if (pname.compare ("fontunits")) | |||
return property (&fontunits, true); | return property (&fontunits, true); | |||
else if (pname.compare ("fontweight")) | ||||
return property (&fontweight, true); | ||||
else if (pname.compare ("horizontalalignment")) | ||||
return property (&horizontalalignment, true); | ||||
else if (pname.compare ("interpreter")) | ||||
return property (&interpreter, true); | ||||
else if (pname.compare ("linestyle")) | else if (pname.compare ("linestyle")) | |||
return property (&linestyle, true); | return property (&linestyle, true); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
return property (&linewidth, true); | return property (&linewidth, true); | |||
else if (pname.compare ("margin")) | else if (pname.compare ("margin")) | |||
return property (&margin, true); | return property (&margin, true); | |||
else if (pname.compare ("position")) | ||||
return property (&position, true); | ||||
else if (pname.compare ("rotation")) | ||||
return property (&rotation, true); | ||||
else if (pname.compare ("string")) | ||||
return property (&string, true); | ||||
else if (pname.compare ("units")) | ||||
return property (&units, true); | ||||
else if (pname.compare ("verticalalignment")) | else if (pname.compare ("verticalalignment")) | |||
return property (&verticalalignment, true); | return property (&verticalalignment, true); | |||
else if (pname.compare ("extent")) | ||||
return property (&extent, true); | ||||
else if (pname.compare ("xlim")) | else if (pname.compare ("xlim")) | |||
return property (&xlim, true); | return property (&xlim, true); | |||
else if (pname.compare ("ylim")) | else if (pname.compare ("ylim")) | |||
return property (&ylim, true); | return property (&ylim, true); | |||
else if (pname.compare ("zlim")) | else if (pname.compare ("zlim")) | |||
return property (&zlim, true); | return property (&zlim, true); | |||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
return property (&xliminclude, true); | return property (&xliminclude, true); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
return property (&yliminclude, true); | return property (&yliminclude, true); | |||
skipping to change at line 3267 | skipping to change at line 3309 | |||
return property (&autopos_tag, true); | return property (&autopos_tag, true); | |||
else | else | |||
return base_properties::get_property (pname); | return base_properties::get_property (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
text::properties::factory_defaults (void) | text::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["string"] = ""; | m["backgroundcolor"] = color_property (radio_values ("{none}"), color_val | |||
m["units"] = "data"; | ues (1, 1, 1)); | |||
m["position"] = Matrix (1, 3, 0.0); | ||||
m["rotation"] = 0; | ||||
m["horizontalalignment"] = "left"; | ||||
m["color"] = color_values (0, 0, 0); | m["color"] = color_values (0, 0, 0); | |||
m["displayname"] = ""; | ||||
m["edgecolor"] = color_property (radio_values ("{none}"), color_values (0 | ||||
, 0, 0)); | ||||
m["editing"] = "off"; | ||||
m["erasemode"] = "normal"; | ||||
m["extent"] = Matrix (1, 4, 0.0); | ||||
m["fontangle"] = "normal"; | ||||
m["fontname"] = OCTAVE_DEFAULT_FONTNAME; | m["fontname"] = OCTAVE_DEFAULT_FONTNAME; | |||
m["fontsize"] = 10; | m["fontsize"] = 10; | |||
m["fontangle"] = "normal"; | m["fontunits"] = "points"; | |||
m["fontweight"] = "normal"; | m["fontweight"] = "normal"; | |||
m["horizontalalignment"] = "left"; | ||||
m["interpreter"] = "tex"; | m["interpreter"] = "tex"; | |||
m["backgroundcolor"] = "{none}"; | ||||
m["displayname"] = ""; | ||||
m["edgecolor"] = "{none}"; | ||||
m["erasemode"] = "normal"; | ||||
m["editing"] = "off"; | ||||
m["fontunits"] = "points"; | ||||
m["linestyle"] = "-"; | m["linestyle"] = "-"; | |||
m["linewidth"] = 0.5; | m["linewidth"] = 0.5; | |||
m["margin"] = 1; | m["margin"] = 1; | |||
m["position"] = Matrix (1, 3, 0.0); | ||||
m["rotation"] = 0; | ||||
m["string"] = ""; | ||||
m["units"] = "data"; | ||||
m["verticalalignment"] = "middle"; | m["verticalalignment"] = "middle"; | |||
m["extent"] = Matrix (1, 4, 0.0); | ||||
m["xlim"] = Matrix (); | m["xlim"] = Matrix (); | |||
m["ylim"] = Matrix (); | m["ylim"] = Matrix (); | |||
m["zlim"] = Matrix (); | m["zlim"] = Matrix (); | |||
m["xliminclude"] = "off"; | m["xliminclude"] = "off"; | |||
m["yliminclude"] = "off"; | m["yliminclude"] = "off"; | |||
m["zliminclude"] = "off"; | m["zliminclude"] = "off"; | |||
m["positionmode"] = "auto"; | m["positionmode"] = "auto"; | |||
m["rotationmode"] = "auto"; | m["rotationmode"] = "auto"; | |||
m["horizontalalignmentmode"] = "auto"; | m["horizontalalignmentmode"] = "auto"; | |||
m["verticalalignmentmode"] = "auto"; | m["verticalalignmentmode"] = "auto"; | |||
skipping to change at line 3315 | skipping to change at line 3357 | |||
std::set<std::string> | std::set<std::string> | |||
text::properties::core_property_names (void) | text::properties::core_property_names (void) | |||
{ | { | |||
static std::set<std::string> all_pnames; | static std::set<std::string> all_pnames; | |||
static bool initialized = false; | static bool initialized = false; | |||
if (! initialized) | if (! initialized) | |||
{ | { | |||
all_pnames.insert ("string"); | ||||
all_pnames.insert ("units"); | ||||
all_pnames.insert ("position"); | ||||
all_pnames.insert ("rotation"); | ||||
all_pnames.insert ("horizontalalignment"); | ||||
all_pnames.insert ("color"); | ||||
all_pnames.insert ("fontname"); | ||||
all_pnames.insert ("fontsize"); | ||||
all_pnames.insert ("fontangle"); | ||||
all_pnames.insert ("fontweight"); | ||||
all_pnames.insert ("interpreter"); | ||||
all_pnames.insert ("backgroundcolor"); | all_pnames.insert ("backgroundcolor"); | |||
all_pnames.insert ("color"); | ||||
all_pnames.insert ("displayname"); | all_pnames.insert ("displayname"); | |||
all_pnames.insert ("edgecolor"); | all_pnames.insert ("edgecolor"); | |||
all_pnames.insert ("erasemode"); | ||||
all_pnames.insert ("editing"); | all_pnames.insert ("editing"); | |||
all_pnames.insert ("erasemode"); | ||||
all_pnames.insert ("extent"); | ||||
all_pnames.insert ("fontangle"); | ||||
all_pnames.insert ("fontname"); | ||||
all_pnames.insert ("fontsize"); | ||||
all_pnames.insert ("fontunits"); | all_pnames.insert ("fontunits"); | |||
all_pnames.insert ("fontweight"); | ||||
all_pnames.insert ("horizontalalignment"); | ||||
all_pnames.insert ("interpreter"); | ||||
all_pnames.insert ("linestyle"); | all_pnames.insert ("linestyle"); | |||
all_pnames.insert ("linewidth"); | all_pnames.insert ("linewidth"); | |||
all_pnames.insert ("margin"); | all_pnames.insert ("margin"); | |||
all_pnames.insert ("position"); | ||||
all_pnames.insert ("rotation"); | ||||
all_pnames.insert ("string"); | ||||
all_pnames.insert ("units"); | ||||
all_pnames.insert ("verticalalignment"); | all_pnames.insert ("verticalalignment"); | |||
all_pnames.insert ("extent"); | ||||
all_pnames.insert ("xlim"); | all_pnames.insert ("xlim"); | |||
all_pnames.insert ("ylim"); | all_pnames.insert ("ylim"); | |||
all_pnames.insert ("zlim"); | all_pnames.insert ("zlim"); | |||
all_pnames.insert ("xliminclude"); | all_pnames.insert ("xliminclude"); | |||
all_pnames.insert ("yliminclude"); | all_pnames.insert ("yliminclude"); | |||
all_pnames.insert ("zliminclude"); | all_pnames.insert ("zliminclude"); | |||
all_pnames.insert ("positionmode"); | all_pnames.insert ("positionmode"); | |||
all_pnames.insert ("rotationmode"); | all_pnames.insert ("rotationmode"); | |||
all_pnames.insert ("horizontalalignmentmode"); | all_pnames.insert ("horizontalalignmentmode"); | |||
all_pnames.insert ("verticalalignmentmode"); | all_pnames.insert ("verticalalignmentmode"); | |||
skipping to change at line 3390 | skipping to change at line 3432 | |||
{ | { | |||
std::set<std::string> pnames = all_property_names (); | std::set<std::string> pnames = all_property_names (); | |||
return pnames.find (pname) != pnames.end (); | return pnames.find (pname) != pnames.end (); | |||
} | } | |||
// ******** image ******** | // ******** image ******** | |||
image::properties::properties (const graphics_handle& mh, const graphics_ha ndle& p) | image::properties::properties (const graphics_handle& mh, const graphics_ha ndle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
alphadata ("alphadata", mh, Matrix ()), | ||||
alphadatamapping ("alphadatamapping", mh, "none|direct|{scaled}"), | ||||
cdata ("cdata", mh, Matrix ()), | ||||
cdatamapping ("cdatamapping", mh, "scaled|{direct}"), | ||||
erasemode ("erasemode", mh, "{normal}|none|xor|background"), | ||||
xdata ("xdata", mh, Matrix ()), | xdata ("xdata", mh, Matrix ()), | |||
ydata ("ydata", mh, Matrix ()), | ydata ("ydata", mh, Matrix ()), | |||
cdata ("cdata", mh, Matrix ()), | alim ("alim", mh, Matrix ()), | |||
cdatamapping ("cdatamapping", mh, "{scaled}|direct"), | clim ("clim", mh, Matrix ()), | |||
xlim ("xlim", mh, Matrix()), | xlim ("xlim", mh, Matrix ()), | |||
ylim ("ylim", mh, Matrix()), | ylim ("ylim", mh, Matrix ()), | |||
clim ("clim", mh, Matrix()), | aliminclude ("aliminclude", mh, "on"), | |||
climinclude ("climinclude", mh, "on"), | ||||
xliminclude ("xliminclude", mh, "on"), | xliminclude ("xliminclude", mh, "on"), | |||
yliminclude ("yliminclude", mh, "on"), | yliminclude ("yliminclude", mh, "on") | |||
climinclude ("climinclude", mh, "on") | ||||
{ | { | |||
xdata.set_id (ID_XDATA); | alphadata.set_id (ID_ALPHADATA); | |||
ydata.set_id (ID_YDATA); | alphadatamapping.set_id (ID_ALPHADATAMAPPING); | |||
cdata.set_id (ID_CDATA); | cdata.set_id (ID_CDATA); | |||
cdatamapping.set_id (ID_CDATAMAPPING); | cdatamapping.set_id (ID_CDATAMAPPING); | |||
erasemode.set_id (ID_ERASEMODE); | ||||
xdata.set_id (ID_XDATA); | ||||
ydata.set_id (ID_YDATA); | ||||
alim.set_id (ID_ALIM); | ||||
alim.set_hidden (true); | ||||
clim.set_id (ID_CLIM); | ||||
clim.set_hidden (true); | ||||
xlim.set_id (ID_XLIM); | xlim.set_id (ID_XLIM); | |||
xlim.set_hidden (true); | xlim.set_hidden (true); | |||
ylim.set_id (ID_YLIM); | ylim.set_id (ID_YLIM); | |||
ylim.set_hidden (true); | ylim.set_hidden (true); | |||
clim.set_id (ID_CLIM); | aliminclude.set_id (ID_ALIMINCLUDE); | |||
clim.set_hidden (true); | aliminclude.set_hidden (true); | |||
climinclude.set_id (ID_CLIMINCLUDE); | ||||
climinclude.set_hidden (true); | ||||
xliminclude.set_id (ID_XLIMINCLUDE); | xliminclude.set_id (ID_XLIMINCLUDE); | |||
xliminclude.set_hidden (true); | xliminclude.set_hidden (true); | |||
yliminclude.set_id (ID_YLIMINCLUDE); | yliminclude.set_id (ID_YLIMINCLUDE); | |||
yliminclude.set_hidden (true); | yliminclude.set_hidden (true); | |||
climinclude.set_id (ID_CLIMINCLUDE); | ||||
climinclude.set_hidden (true); | ||||
init (); | init (); | |||
} | } | |||
void | void | |||
image::properties::set (const caseless_str& pname_arg, const octave_value& val) | image::properties::set (const caseless_str& pname_arg, const octave_value& val) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return; | return; | |||
if (pname.compare ("xdata")) | if (pname.compare ("alphadata")) | |||
set_xdata (val); | set_alphadata (val); | |||
else if (pname.compare ("ydata")) | else if (pname.compare ("alphadatamapping")) | |||
set_ydata (val); | set_alphadatamapping (val); | |||
else if (pname.compare ("cdata")) | else if (pname.compare ("cdata")) | |||
set_cdata (val); | set_cdata (val); | |||
else if (pname.compare ("cdatamapping")) | else if (pname.compare ("cdatamapping")) | |||
set_cdatamapping (val); | set_cdatamapping (val); | |||
else if (pname.compare ("erasemode")) | ||||
set_erasemode (val); | ||||
else if (pname.compare ("xdata")) | ||||
set_xdata (val); | ||||
else if (pname.compare ("ydata")) | ||||
set_ydata (val); | ||||
else if (pname.compare ("aliminclude")) | ||||
set_aliminclude (val); | ||||
else if (pname.compare ("climinclude")) | ||||
set_climinclude (val); | ||||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
set_xliminclude (val); | set_xliminclude (val); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
set_yliminclude (val); | set_yliminclude (val); | |||
else if (pname.compare ("climinclude")) | ||||
set_climinclude (val); | ||||
else | else | |||
base_properties::set (pname, val); | base_properties::set (pname, val); | |||
} | } | |||
octave_value | octave_value | |||
image::properties::get (bool all) const | image::properties::get (bool all) const | |||
{ | { | |||
octave_map m = base_properties::get (all).map_value (); | octave_map m = base_properties::get (all).map_value (); | |||
m.assign ("xdata", octave_value (get_xdata ())); | m.assign ("alphadata", octave_value (get_alphadata ())); | |||
m.assign ("ydata", octave_value (get_ydata ())); | m.assign ("alphadatamapping", octave_value (get_alphadatamapping ())); | |||
m.assign ("cdata", octave_value (get_cdata ())); | m.assign ("cdata", octave_value (get_cdata ())); | |||
m.assign ("cdatamapping", octave_value (get_cdatamapping ())); | m.assign ("cdatamapping", octave_value (get_cdatamapping ())); | |||
m.assign ("erasemode", octave_value (get_erasemode ())); | ||||
m.assign ("xdata", octave_value (get_xdata ())); | ||||
m.assign ("ydata", octave_value (get_ydata ())); | ||||
if (all) | ||||
m.assign ("alim", octave_value (get_alim ())); | ||||
if (all) | ||||
m.assign ("clim", octave_value (get_clim ())); | ||||
if (all) | if (all) | |||
m.assign ("xlim", octave_value (get_xlim ())); | m.assign ("xlim", octave_value (get_xlim ())); | |||
if (all) | if (all) | |||
m.assign ("ylim", octave_value (get_ylim ())); | m.assign ("ylim", octave_value (get_ylim ())); | |||
if (all) | if (all) | |||
m.assign ("clim", octave_value (get_clim ())); | m.assign ("aliminclude", octave_value (get_aliminclude ())); | |||
if (all) | ||||
m.assign ("climinclude", octave_value (get_climinclude ())); | ||||
if (all) | if (all) | |||
m.assign ("xliminclude", octave_value (get_xliminclude ())); | m.assign ("xliminclude", octave_value (get_xliminclude ())); | |||
if (all) | if (all) | |||
m.assign ("yliminclude", octave_value (get_yliminclude ())); | m.assign ("yliminclude", octave_value (get_yliminclude ())); | |||
if (all) | ||||
m.assign ("climinclude", octave_value (get_climinclude ())); | ||||
return m; | return m; | |||
} | } | |||
octave_value | octave_value | |||
image::properties::get (const caseless_str& pname_arg) const | image::properties::get (const caseless_str& pname_arg) const | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return retval; | return retval; | |||
if (pname.compare ("xdata")) | if (pname.compare ("alphadata")) | |||
retval = get_xdata (); | retval = get_alphadata (); | |||
else if (pname.compare ("ydata")) | else if (pname.compare ("alphadatamapping")) | |||
retval = get_ydata (); | retval = get_alphadatamapping (); | |||
else if (pname.compare ("cdata")) | else if (pname.compare ("cdata")) | |||
retval = get_cdata (); | retval = get_cdata (); | |||
else if (pname.compare ("cdatamapping")) | else if (pname.compare ("cdatamapping")) | |||
retval = get_cdatamapping (); | retval = get_cdatamapping (); | |||
else if (pname.compare ("erasemode")) | ||||
retval = get_erasemode (); | ||||
else if (pname.compare ("xdata")) | ||||
retval = get_xdata (); | ||||
else if (pname.compare ("ydata")) | ||||
retval = get_ydata (); | ||||
else if (pname.compare ("alim")) | ||||
retval = get_alim (); | ||||
else if (pname.compare ("clim")) | ||||
retval = get_clim (); | ||||
else if (pname.compare ("xlim")) | else if (pname.compare ("xlim")) | |||
retval = get_xlim (); | retval = get_xlim (); | |||
else if (pname.compare ("ylim")) | else if (pname.compare ("ylim")) | |||
retval = get_ylim (); | retval = get_ylim (); | |||
else if (pname.compare ("clim")) | else if (pname.compare ("aliminclude")) | |||
retval = get_clim (); | retval = get_aliminclude (); | |||
else if (pname.compare ("climinclude")) | ||||
retval = get_climinclude (); | ||||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
retval = get_xliminclude (); | retval = get_xliminclude (); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
retval = get_yliminclude (); | retval = get_yliminclude (); | |||
else if (pname.compare ("climinclude")) | ||||
retval = get_climinclude (); | ||||
else | else | |||
retval = base_properties::get (pname); | retval = base_properties::get (pname); | |||
return retval; | return retval; | |||
} | } | |||
property | property | |||
image::properties::get_property (const caseless_str& pname_arg) | image::properties::get_property (const caseless_str& pname_arg) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return property (); | return property (); | |||
if (pname.compare ("xdata")) | if (pname.compare ("alphadata")) | |||
return property (&xdata, true); | return property (&alphadata, true); | |||
else if (pname.compare ("ydata")) | else if (pname.compare ("alphadatamapping")) | |||
return property (&ydata, true); | return property (&alphadatamapping, true); | |||
else if (pname.compare ("cdata")) | else if (pname.compare ("cdata")) | |||
return property (&cdata, true); | return property (&cdata, true); | |||
else if (pname.compare ("cdatamapping")) | else if (pname.compare ("cdatamapping")) | |||
return property (&cdatamapping, true); | return property (&cdatamapping, true); | |||
else if (pname.compare ("erasemode")) | ||||
return property (&erasemode, true); | ||||
else if (pname.compare ("xdata")) | ||||
return property (&xdata, true); | ||||
else if (pname.compare ("ydata")) | ||||
return property (&ydata, true); | ||||
else if (pname.compare ("alim")) | ||||
return property (&alim, true); | ||||
else if (pname.compare ("clim")) | ||||
return property (&clim, true); | ||||
else if (pname.compare ("xlim")) | else if (pname.compare ("xlim")) | |||
return property (&xlim, true); | return property (&xlim, true); | |||
else if (pname.compare ("ylim")) | else if (pname.compare ("ylim")) | |||
return property (&ylim, true); | return property (&ylim, true); | |||
else if (pname.compare ("clim")) | else if (pname.compare ("aliminclude")) | |||
return property (&clim, true); | return property (&aliminclude, true); | |||
else if (pname.compare ("climinclude")) | ||||
return property (&climinclude, true); | ||||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
return property (&xliminclude, true); | return property (&xliminclude, true); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
return property (&yliminclude, true); | return property (&yliminclude, true); | |||
else if (pname.compare ("climinclude")) | ||||
return property (&climinclude, true); | ||||
else | else | |||
return base_properties::get_property (pname); | return base_properties::get_property (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
image::properties::factory_defaults (void) | image::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["alphadata"] = Matrix (); | ||||
m["alphadatamapping"] = "scaled"; | ||||
m["cdata"] = Matrix (); | ||||
m["cdatamapping"] = "direct"; | ||||
m["erasemode"] = "normal"; | ||||
m["xdata"] = Matrix (); | m["xdata"] = Matrix (); | |||
m["ydata"] = Matrix (); | m["ydata"] = Matrix (); | |||
m["cdata"] = Matrix (); | m["alim"] = Matrix (); | |||
m["cdatamapping"] = "scaled"; | m["clim"] = Matrix (); | |||
m["xlim"] = Matrix(); | m["xlim"] = Matrix (); | |||
m["ylim"] = Matrix(); | m["ylim"] = Matrix (); | |||
m["clim"] = Matrix(); | m["aliminclude"] = "on"; | |||
m["climinclude"] = "on"; | ||||
m["xliminclude"] = "on"; | m["xliminclude"] = "on"; | |||
m["yliminclude"] = "on"; | m["yliminclude"] = "on"; | |||
m["climinclude"] = "on"; | ||||
return m; | return m; | |||
} | } | |||
std::string image::properties::go_name ("image"); | std::string image::properties::go_name ("image"); | |||
std::set<std::string> | std::set<std::string> | |||
image::properties::core_property_names (void) | image::properties::core_property_names (void) | |||
{ | { | |||
static std::set<std::string> all_pnames; | static std::set<std::string> all_pnames; | |||
static bool initialized = false; | static bool initialized = false; | |||
if (! initialized) | if (! initialized) | |||
{ | { | |||
all_pnames.insert ("xdata"); | all_pnames.insert ("alphadata"); | |||
all_pnames.insert ("ydata"); | all_pnames.insert ("alphadatamapping"); | |||
all_pnames.insert ("cdata"); | all_pnames.insert ("cdata"); | |||
all_pnames.insert ("cdatamapping"); | all_pnames.insert ("cdatamapping"); | |||
all_pnames.insert ("erasemode"); | ||||
all_pnames.insert ("xdata"); | ||||
all_pnames.insert ("ydata"); | ||||
all_pnames.insert ("alim"); | ||||
all_pnames.insert ("clim"); | ||||
all_pnames.insert ("xlim"); | all_pnames.insert ("xlim"); | |||
all_pnames.insert ("ylim"); | all_pnames.insert ("ylim"); | |||
all_pnames.insert ("clim"); | all_pnames.insert ("aliminclude"); | |||
all_pnames.insert ("climinclude"); | ||||
all_pnames.insert ("xliminclude"); | all_pnames.insert ("xliminclude"); | |||
all_pnames.insert ("yliminclude"); | all_pnames.insert ("yliminclude"); | |||
all_pnames.insert ("climinclude"); | ||||
std::set<std::string> base_pnames = base_properties::core_property_na mes (); | std::set<std::string> base_pnames = base_properties::core_property_na mes (); | |||
all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | |||
initialized = true; | initialized = true; | |||
} | } | |||
return all_pnames; | return all_pnames; | |||
} | } | |||
skipping to change at line 3627 | skipping to change at line 3726 | |||
{ | { | |||
std::set<std::string> pnames = all_property_names (); | std::set<std::string> pnames = all_property_names (); | |||
return pnames.find (pname) != pnames.end (); | return pnames.find (pname) != pnames.end (); | |||
} | } | |||
// ******** patch ******** | // ******** patch ******** | |||
patch::properties::properties (const graphics_handle& mh, const graphics_ha ndle& p) | patch::properties::properties (const graphics_handle& mh, const graphics_ha ndle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
xdata ("xdata", mh, Matrix ()), | alphadatamapping ("alphadatamapping", mh, "none|{scaled}|direct"), | |||
ydata ("ydata", mh, Matrix ()), | ambientstrength ("ambientstrength", mh, 0.3), | |||
zdata ("zdata", mh, Matrix ()), | backfacelighting ("backfacelighting", mh, "unlit|lit|{reverselit}"), | |||
cdata ("cdata", mh, Matrix ()), | cdata ("cdata", mh, Matrix ()), | |||
cdatamapping ("cdatamapping", mh, "{scaled}|direct"), | cdatamapping ("cdatamapping", mh, "{scaled}|direct"), | |||
faces ("faces", mh, Matrix ()), | diffusestrength ("diffusestrength", mh, 0.6), | |||
facevertexalphadata ("facevertexalphadata", mh, Matrix ()), | displayname ("displayname", mh, ""), | |||
facevertexcdata ("facevertexcdata", mh, Matrix ()), | ||||
vertices ("vertices", mh, Matrix ()), | ||||
vertexnormals ("vertexnormals", mh, Matrix ()), | ||||
normalmode ("normalmode", mh, "{auto}|manual"), | ||||
facecolor ("facecolor", mh, color_property (color_values (0, 0, 0), rad | ||||
io_values ("flat|none|interp"))), | ||||
facealpha ("facealpha", mh, double_radio_property (1.0, radio_values (" | ||||
flat|interp"))), | ||||
facelighting ("facelighting", mh, "flat|{none}|gouraud|phong"), | ||||
edgecolor ("edgecolor", mh, color_property (color_values (0, 0, 0), rad | ||||
io_values ("flat|none|interp"))), | ||||
edgealpha ("edgealpha", mh, double_radio_property (1.0, radio_values (" flat|interp"))), | edgealpha ("edgealpha", mh, double_radio_property (1.0, radio_values (" flat|interp"))), | |||
edgecolor ("edgecolor", mh, color_property (color_values (0, 0, 0), rad io_values ("none|flat|interp"))), | ||||
edgelighting ("edgelighting", mh, "{none}|flat|gouraud|phong"), | edgelighting ("edgelighting", mh, "{none}|flat|gouraud|phong"), | |||
backfacelighting ("backfacelighting", mh, "{reverselit}|unlit|lit"), | ||||
ambientstrength ("ambientstrength", mh, 0.3), | ||||
diffusestrength ("diffusestrength", mh, 0.6), | ||||
specularstrength ("specularstrength", mh, 0.6), | ||||
specularexponent ("specularexponent", mh, 10.0), | ||||
specularcolorreflectance ("specularcolorreflectance", mh, 1.0), | ||||
erasemode ("erasemode", mh, "{normal}|background|xor|none"), | erasemode ("erasemode", mh, "{normal}|background|xor|none"), | |||
facealpha ("facealpha", mh, double_radio_property (1.0, radio_values (" | ||||
flat|interp"))), | ||||
facecolor ("facecolor", mh, color_property (color_values (0, 0, 0), rad | ||||
io_values ("none|flat|interp"))), | ||||
facelighting ("facelighting", mh, "{none}|flat|gouraud|phong"), | ||||
faces ("faces", mh, Matrix ()), | ||||
facevertexalphadata ("facevertexalphadata", mh, Matrix ()), | ||||
facevertexcdata ("facevertexcdata", mh, Matrix ()), | ||||
interpreter ("interpreter", mh, "{tex}|none|latex"), | ||||
linestyle ("linestyle", mh, "{-}|--|:|-.|none"), | linestyle ("linestyle", mh, "{-}|--|:|-.|none"), | |||
linewidth ("linewidth", mh, 0.5), | linewidth ("linewidth", mh, 0.5), | |||
marker ("marker", mh, "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h|@"), | marker ("marker", mh, "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pe | |||
markeredgecolor ("markeredgecolor", mh, "{auto}|none|flat"), | ntagram|h|hexagram"), | |||
markerfacecolor ("markerfacecolor", mh, "auto|{none}|flat"), | markeredgecolor ("markeredgecolor", mh, color_property (radio_values (" | |||
none|{auto}|flat"), color_values (0, 0, 0))), | ||||
markerfacecolor ("markerfacecolor", mh, color_property (radio_values (" | ||||
{none}|auto|flat"), color_values (0, 0, 0))), | ||||
markersize ("markersize", mh, 6), | markersize ("markersize", mh, 6), | |||
interpreter ("interpreter", mh, "{tex}|none|latex"), | normalmode ("normalmode", mh, "{auto}|manual"), | |||
displayname ("displayname", mh, ""), | specularcolorreflectance ("specularcolorreflectance", mh, 1.0), | |||
alphadatamapping ("alphadatamapping", mh, "none|{scaled}|direct"), | specularexponent ("specularexponent", mh, 10.0), | |||
specularstrength ("specularstrength", mh, 0.6), | ||||
vertexnormals ("vertexnormals", mh, Matrix ()), | ||||
vertices ("vertices", mh, Matrix ()), | ||||
xdata ("xdata", mh, Matrix ()), | ||||
ydata ("ydata", mh, Matrix ()), | ||||
zdata ("zdata", mh, Matrix ()), | ||||
alim ("alim", mh, Matrix ()), | ||||
clim ("clim", mh, Matrix ()), | ||||
xlim ("xlim", mh, Matrix ()), | xlim ("xlim", mh, Matrix ()), | |||
ylim ("ylim", mh, Matrix ()), | ylim ("ylim", mh, Matrix ()), | |||
zlim ("zlim", mh, Matrix ()), | zlim ("zlim", mh, Matrix ()), | |||
clim ("clim", mh, Matrix ()), | aliminclude ("aliminclude", mh, "on"), | |||
alim ("alim", mh, Matrix ()), | climinclude ("climinclude", mh, "on"), | |||
xliminclude ("xliminclude", mh, "on"), | xliminclude ("xliminclude", mh, "on"), | |||
yliminclude ("yliminclude", mh, "on"), | yliminclude ("yliminclude", mh, "on"), | |||
zliminclude ("zliminclude", mh, "on"), | zliminclude ("zliminclude", mh, "on") | |||
climinclude ("climinclude", mh, "on"), | ||||
aliminclude ("aliminclude", mh, "on") | ||||
{ | { | |||
xdata.set_id (ID_XDATA); | alphadatamapping.set_id (ID_ALPHADATAMAPPING); | |||
ydata.set_id (ID_YDATA); | ambientstrength.set_id (ID_AMBIENTSTRENGTH); | |||
zdata.set_id (ID_ZDATA); | backfacelighting.set_id (ID_BACKFACELIGHTING); | |||
cdata.set_id (ID_CDATA); | cdata.set_id (ID_CDATA); | |||
cdatamapping.set_id (ID_CDATAMAPPING); | cdatamapping.set_id (ID_CDATAMAPPING); | |||
faces.set_id (ID_FACES); | diffusestrength.set_id (ID_DIFFUSESTRENGTH); | |||
facevertexalphadata.set_id (ID_FACEVERTEXALPHADATA); | displayname.set_id (ID_DISPLAYNAME); | |||
facevertexcdata.set_id (ID_FACEVERTEXCDATA); | ||||
vertices.set_id (ID_VERTICES); | ||||
vertexnormals.set_id (ID_VERTEXNORMALS); | ||||
normalmode.set_id (ID_NORMALMODE); | ||||
facecolor.set_id (ID_FACECOLOR); | ||||
facealpha.set_id (ID_FACEALPHA); | ||||
facelighting.set_id (ID_FACELIGHTING); | ||||
edgecolor.set_id (ID_EDGECOLOR); | ||||
edgealpha.set_id (ID_EDGEALPHA); | edgealpha.set_id (ID_EDGEALPHA); | |||
edgecolor.set_id (ID_EDGECOLOR); | ||||
edgelighting.set_id (ID_EDGELIGHTING); | edgelighting.set_id (ID_EDGELIGHTING); | |||
backfacelighting.set_id (ID_BACKFACELIGHTING); | ||||
ambientstrength.set_id (ID_AMBIENTSTRENGTH); | ||||
diffusestrength.set_id (ID_DIFFUSESTRENGTH); | ||||
specularstrength.set_id (ID_SPECULARSTRENGTH); | ||||
specularexponent.set_id (ID_SPECULAREXPONENT); | ||||
specularcolorreflectance.set_id (ID_SPECULARCOLORREFLECTANCE); | ||||
erasemode.set_id (ID_ERASEMODE); | erasemode.set_id (ID_ERASEMODE); | |||
facealpha.set_id (ID_FACEALPHA); | ||||
facecolor.set_id (ID_FACECOLOR); | ||||
facelighting.set_id (ID_FACELIGHTING); | ||||
faces.set_id (ID_FACES); | ||||
facevertexalphadata.set_id (ID_FACEVERTEXALPHADATA); | ||||
facevertexcdata.set_id (ID_FACEVERTEXCDATA); | ||||
interpreter.set_id (ID_INTERPRETER); | ||||
linestyle.set_id (ID_LINESTYLE); | linestyle.set_id (ID_LINESTYLE); | |||
linewidth.set_id (ID_LINEWIDTH); | linewidth.set_id (ID_LINEWIDTH); | |||
marker.set_id (ID_MARKER); | marker.set_id (ID_MARKER); | |||
markeredgecolor.set_id (ID_MARKEREDGECOLOR); | markeredgecolor.set_id (ID_MARKEREDGECOLOR); | |||
markerfacecolor.set_id (ID_MARKERFACECOLOR); | markerfacecolor.set_id (ID_MARKERFACECOLOR); | |||
markersize.set_id (ID_MARKERSIZE); | markersize.set_id (ID_MARKERSIZE); | |||
interpreter.set_id (ID_INTERPRETER); | normalmode.set_id (ID_NORMALMODE); | |||
displayname.set_id (ID_DISPLAYNAME); | specularcolorreflectance.set_id (ID_SPECULARCOLORREFLECTANCE); | |||
alphadatamapping.set_id (ID_ALPHADATAMAPPING); | specularexponent.set_id (ID_SPECULAREXPONENT); | |||
specularstrength.set_id (ID_SPECULARSTRENGTH); | ||||
vertexnormals.set_id (ID_VERTEXNORMALS); | ||||
vertices.set_id (ID_VERTICES); | ||||
xdata.set_id (ID_XDATA); | ||||
ydata.set_id (ID_YDATA); | ||||
zdata.set_id (ID_ZDATA); | ||||
alim.set_id (ID_ALIM); | ||||
alim.set_hidden (true); | ||||
clim.set_id (ID_CLIM); | ||||
clim.set_hidden (true); | ||||
xlim.set_id (ID_XLIM); | xlim.set_id (ID_XLIM); | |||
xlim.set_hidden (true); | xlim.set_hidden (true); | |||
ylim.set_id (ID_YLIM); | ylim.set_id (ID_YLIM); | |||
ylim.set_hidden (true); | ylim.set_hidden (true); | |||
zlim.set_id (ID_ZLIM); | zlim.set_id (ID_ZLIM); | |||
zlim.set_hidden (true); | zlim.set_hidden (true); | |||
clim.set_id (ID_CLIM); | aliminclude.set_id (ID_ALIMINCLUDE); | |||
clim.set_hidden (true); | aliminclude.set_hidden (true); | |||
alim.set_id (ID_ALIM); | climinclude.set_id (ID_CLIMINCLUDE); | |||
alim.set_hidden (true); | climinclude.set_hidden (true); | |||
xliminclude.set_id (ID_XLIMINCLUDE); | xliminclude.set_id (ID_XLIMINCLUDE); | |||
xliminclude.set_hidden (true); | xliminclude.set_hidden (true); | |||
yliminclude.set_id (ID_YLIMINCLUDE); | yliminclude.set_id (ID_YLIMINCLUDE); | |||
yliminclude.set_hidden (true); | yliminclude.set_hidden (true); | |||
zliminclude.set_id (ID_ZLIMINCLUDE); | zliminclude.set_id (ID_ZLIMINCLUDE); | |||
zliminclude.set_hidden (true); | zliminclude.set_hidden (true); | |||
climinclude.set_id (ID_CLIMINCLUDE); | ||||
climinclude.set_hidden (true); | ||||
aliminclude.set_id (ID_ALIMINCLUDE); | ||||
aliminclude.set_hidden (true); | ||||
init (); | init (); | |||
} | } | |||
void | void | |||
patch::properties::set (const caseless_str& pname_arg, const octave_value& val) | patch::properties::set (const caseless_str& pname_arg, const octave_value& val) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return; | return; | |||
if (pname.compare ("xdata")) | if (pname.compare ("alphadatamapping")) | |||
set_xdata (val); | set_alphadatamapping (val); | |||
else if (pname.compare ("ydata")) | else if (pname.compare ("ambientstrength")) | |||
set_ydata (val); | set_ambientstrength (val); | |||
else if (pname.compare ("zdata")) | else if (pname.compare ("backfacelighting")) | |||
set_zdata (val); | set_backfacelighting (val); | |||
else if (pname.compare ("cdata")) | else if (pname.compare ("cdata")) | |||
set_cdata (val); | set_cdata (val); | |||
else if (pname.compare ("cdatamapping")) | else if (pname.compare ("cdatamapping")) | |||
set_cdatamapping (val); | set_cdatamapping (val); | |||
else if (pname.compare ("faces")) | else if (pname.compare ("diffusestrength")) | |||
set_faces (val); | set_diffusestrength (val); | |||
else if (pname.compare ("facevertexalphadata")) | else if (pname.compare ("displayname")) | |||
set_facevertexalphadata (val); | set_displayname (val); | |||
else if (pname.compare ("facevertexcdata")) | ||||
set_facevertexcdata (val); | ||||
else if (pname.compare ("vertices")) | ||||
set_vertices (val); | ||||
else if (pname.compare ("vertexnormals")) | ||||
set_vertexnormals (val); | ||||
else if (pname.compare ("normalmode")) | ||||
set_normalmode (val); | ||||
else if (pname.compare ("facecolor")) | ||||
set_facecolor (val); | ||||
else if (pname.compare ("facealpha")) | ||||
set_facealpha (val); | ||||
else if (pname.compare ("facelighting")) | ||||
set_facelighting (val); | ||||
else if (pname.compare ("edgecolor")) | ||||
set_edgecolor (val); | ||||
else if (pname.compare ("edgealpha")) | else if (pname.compare ("edgealpha")) | |||
set_edgealpha (val); | set_edgealpha (val); | |||
else if (pname.compare ("edgecolor")) | ||||
set_edgecolor (val); | ||||
else if (pname.compare ("edgelighting")) | else if (pname.compare ("edgelighting")) | |||
set_edgelighting (val); | set_edgelighting (val); | |||
else if (pname.compare ("backfacelighting")) | ||||
set_backfacelighting (val); | ||||
else if (pname.compare ("ambientstrength")) | ||||
set_ambientstrength (val); | ||||
else if (pname.compare ("diffusestrength")) | ||||
set_diffusestrength (val); | ||||
else if (pname.compare ("specularstrength")) | ||||
set_specularstrength (val); | ||||
else if (pname.compare ("specularexponent")) | ||||
set_specularexponent (val); | ||||
else if (pname.compare ("specularcolorreflectance")) | ||||
set_specularcolorreflectance (val); | ||||
else if (pname.compare ("erasemode")) | else if (pname.compare ("erasemode")) | |||
set_erasemode (val); | set_erasemode (val); | |||
else if (pname.compare ("facealpha")) | ||||
set_facealpha (val); | ||||
else if (pname.compare ("facecolor")) | ||||
set_facecolor (val); | ||||
else if (pname.compare ("facelighting")) | ||||
set_facelighting (val); | ||||
else if (pname.compare ("faces")) | ||||
set_faces (val); | ||||
else if (pname.compare ("facevertexalphadata")) | ||||
set_facevertexalphadata (val); | ||||
else if (pname.compare ("facevertexcdata")) | ||||
set_facevertexcdata (val); | ||||
else if (pname.compare ("interpreter")) | ||||
set_interpreter (val); | ||||
else if (pname.compare ("linestyle")) | else if (pname.compare ("linestyle")) | |||
set_linestyle (val); | set_linestyle (val); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
set_linewidth (val); | set_linewidth (val); | |||
else if (pname.compare ("marker")) | else if (pname.compare ("marker")) | |||
set_marker (val); | set_marker (val); | |||
else if (pname.compare ("markeredgecolor")) | else if (pname.compare ("markeredgecolor")) | |||
set_markeredgecolor (val); | set_markeredgecolor (val); | |||
else if (pname.compare ("markerfacecolor")) | else if (pname.compare ("markerfacecolor")) | |||
set_markerfacecolor (val); | set_markerfacecolor (val); | |||
else if (pname.compare ("markersize")) | else if (pname.compare ("markersize")) | |||
set_markersize (val); | set_markersize (val); | |||
else if (pname.compare ("interpreter")) | else if (pname.compare ("normalmode")) | |||
set_interpreter (val); | set_normalmode (val); | |||
else if (pname.compare ("displayname")) | else if (pname.compare ("specularcolorreflectance")) | |||
set_displayname (val); | set_specularcolorreflectance (val); | |||
else if (pname.compare ("alphadatamapping")) | else if (pname.compare ("specularexponent")) | |||
set_alphadatamapping (val); | set_specularexponent (val); | |||
else if (pname.compare ("specularstrength")) | ||||
set_specularstrength (val); | ||||
else if (pname.compare ("vertexnormals")) | ||||
set_vertexnormals (val); | ||||
else if (pname.compare ("vertices")) | ||||
set_vertices (val); | ||||
else if (pname.compare ("xdata")) | ||||
set_xdata (val); | ||||
else if (pname.compare ("ydata")) | ||||
set_ydata (val); | ||||
else if (pname.compare ("zdata")) | ||||
set_zdata (val); | ||||
else if (pname.compare ("aliminclude")) | ||||
set_aliminclude (val); | ||||
else if (pname.compare ("climinclude")) | ||||
set_climinclude (val); | ||||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
set_xliminclude (val); | set_xliminclude (val); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
set_yliminclude (val); | set_yliminclude (val); | |||
else if (pname.compare ("zliminclude")) | else if (pname.compare ("zliminclude")) | |||
set_zliminclude (val); | set_zliminclude (val); | |||
else if (pname.compare ("climinclude")) | ||||
set_climinclude (val); | ||||
else if (pname.compare ("aliminclude")) | ||||
set_aliminclude (val); | ||||
else | else | |||
base_properties::set (pname, val); | base_properties::set (pname, val); | |||
} | } | |||
octave_value | octave_value | |||
patch::properties::get (bool all) const | patch::properties::get (bool all) const | |||
{ | { | |||
octave_map m = base_properties::get (all).map_value (); | octave_map m = base_properties::get (all).map_value (); | |||
m.assign ("xdata", octave_value (get_xdata ())); | m.assign ("alphadatamapping", octave_value (get_alphadatamapping ())); | |||
m.assign ("ydata", octave_value (get_ydata ())); | m.assign ("ambientstrength", octave_value (get_ambientstrength ())); | |||
m.assign ("zdata", octave_value (get_zdata ())); | m.assign ("backfacelighting", octave_value (get_backfacelighting ())); | |||
m.assign ("cdata", octave_value (get_cdata ())); | m.assign ("cdata", octave_value (get_cdata ())); | |||
m.assign ("cdatamapping", octave_value (get_cdatamapping ())); | m.assign ("cdatamapping", octave_value (get_cdatamapping ())); | |||
m.assign ("faces", octave_value (get_faces ())); | m.assign ("diffusestrength", octave_value (get_diffusestrength ())); | |||
m.assign ("facevertexalphadata", octave_value (get_facevertexalphadata () | m.assign ("displayname", octave_value (get_displayname ())); | |||
)); | ||||
m.assign ("facevertexcdata", octave_value (get_facevertexcdata ())); | ||||
m.assign ("vertices", octave_value (get_vertices ())); | ||||
m.assign ("vertexnormals", octave_value (get_vertexnormals ())); | ||||
m.assign ("normalmode", octave_value (get_normalmode ())); | ||||
m.assign ("facecolor", octave_value (get_facecolor ())); | ||||
m.assign ("facealpha", octave_value (get_facealpha ())); | ||||
m.assign ("facelighting", octave_value (get_facelighting ())); | ||||
m.assign ("edgecolor", octave_value (get_edgecolor ())); | ||||
m.assign ("edgealpha", octave_value (get_edgealpha ())); | m.assign ("edgealpha", octave_value (get_edgealpha ())); | |||
m.assign ("edgecolor", octave_value (get_edgecolor ())); | ||||
m.assign ("edgelighting", octave_value (get_edgelighting ())); | m.assign ("edgelighting", octave_value (get_edgelighting ())); | |||
m.assign ("backfacelighting", octave_value (get_backfacelighting ())); | ||||
m.assign ("ambientstrength", octave_value (get_ambientstrength ())); | ||||
m.assign ("diffusestrength", octave_value (get_diffusestrength ())); | ||||
m.assign ("specularstrength", octave_value (get_specularstrength ())); | ||||
m.assign ("specularexponent", octave_value (get_specularexponent ())); | ||||
m.assign ("specularcolorreflectance", octave_value (get_specularcolorrefl | ||||
ectance ())); | ||||
m.assign ("erasemode", octave_value (get_erasemode ())); | m.assign ("erasemode", octave_value (get_erasemode ())); | |||
m.assign ("facealpha", octave_value (get_facealpha ())); | ||||
m.assign ("facecolor", octave_value (get_facecolor ())); | ||||
m.assign ("facelighting", octave_value (get_facelighting ())); | ||||
m.assign ("faces", octave_value (get_faces ())); | ||||
m.assign ("facevertexalphadata", octave_value (get_facevertexalphadata () | ||||
)); | ||||
m.assign ("facevertexcdata", octave_value (get_facevertexcdata ())); | ||||
m.assign ("interpreter", octave_value (get_interpreter ())); | ||||
m.assign ("linestyle", octave_value (get_linestyle ())); | m.assign ("linestyle", octave_value (get_linestyle ())); | |||
m.assign ("linewidth", octave_value (get_linewidth ())); | m.assign ("linewidth", octave_value (get_linewidth ())); | |||
m.assign ("marker", octave_value (get_marker ())); | m.assign ("marker", octave_value (get_marker ())); | |||
m.assign ("markeredgecolor", octave_value (get_markeredgecolor ())); | m.assign ("markeredgecolor", octave_value (get_markeredgecolor ())); | |||
m.assign ("markerfacecolor", octave_value (get_markerfacecolor ())); | m.assign ("markerfacecolor", octave_value (get_markerfacecolor ())); | |||
m.assign ("markersize", octave_value (get_markersize ())); | m.assign ("markersize", octave_value (get_markersize ())); | |||
m.assign ("interpreter", octave_value (get_interpreter ())); | m.assign ("normalmode", octave_value (get_normalmode ())); | |||
m.assign ("displayname", octave_value (get_displayname ())); | m.assign ("specularcolorreflectance", octave_value (get_specularcolorrefl | |||
m.assign ("alphadatamapping", octave_value (get_alphadatamapping ())); | ectance ())); | |||
m.assign ("specularexponent", octave_value (get_specularexponent ())); | ||||
m.assign ("specularstrength", octave_value (get_specularstrength ())); | ||||
m.assign ("vertexnormals", octave_value (get_vertexnormals ())); | ||||
m.assign ("vertices", octave_value (get_vertices ())); | ||||
m.assign ("xdata", octave_value (get_xdata ())); | ||||
m.assign ("ydata", octave_value (get_ydata ())); | ||||
m.assign ("zdata", octave_value (get_zdata ())); | ||||
if (all) | ||||
m.assign ("alim", octave_value (get_alim ())); | ||||
if (all) | ||||
m.assign ("clim", octave_value (get_clim ())); | ||||
if (all) | if (all) | |||
m.assign ("xlim", octave_value (get_xlim ())); | m.assign ("xlim", octave_value (get_xlim ())); | |||
if (all) | if (all) | |||
m.assign ("ylim", octave_value (get_ylim ())); | m.assign ("ylim", octave_value (get_ylim ())); | |||
if (all) | if (all) | |||
m.assign ("zlim", octave_value (get_zlim ())); | m.assign ("zlim", octave_value (get_zlim ())); | |||
if (all) | if (all) | |||
m.assign ("clim", octave_value (get_clim ())); | m.assign ("aliminclude", octave_value (get_aliminclude ())); | |||
if (all) | if (all) | |||
m.assign ("alim", octave_value (get_alim ())); | m.assign ("climinclude", octave_value (get_climinclude ())); | |||
if (all) | if (all) | |||
m.assign ("xliminclude", octave_value (get_xliminclude ())); | m.assign ("xliminclude", octave_value (get_xliminclude ())); | |||
if (all) | if (all) | |||
m.assign ("yliminclude", octave_value (get_yliminclude ())); | m.assign ("yliminclude", octave_value (get_yliminclude ())); | |||
if (all) | if (all) | |||
m.assign ("zliminclude", octave_value (get_zliminclude ())); | m.assign ("zliminclude", octave_value (get_zliminclude ())); | |||
if (all) | ||||
m.assign ("climinclude", octave_value (get_climinclude ())); | ||||
if (all) | ||||
m.assign ("aliminclude", octave_value (get_aliminclude ())); | ||||
return m; | return m; | |||
} | } | |||
octave_value | octave_value | |||
patch::properties::get (const caseless_str& pname_arg) const | patch::properties::get (const caseless_str& pname_arg) const | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return retval; | return retval; | |||
if (pname.compare ("xdata")) | if (pname.compare ("alphadatamapping")) | |||
retval = get_xdata (); | retval = get_alphadatamapping (); | |||
else if (pname.compare ("ydata")) | else if (pname.compare ("ambientstrength")) | |||
retval = get_ydata (); | retval = get_ambientstrength (); | |||
else if (pname.compare ("zdata")) | else if (pname.compare ("backfacelighting")) | |||
retval = get_zdata (); | retval = get_backfacelighting (); | |||
else if (pname.compare ("cdata")) | else if (pname.compare ("cdata")) | |||
retval = get_cdata (); | retval = get_cdata (); | |||
else if (pname.compare ("cdatamapping")) | else if (pname.compare ("cdatamapping")) | |||
retval = get_cdatamapping (); | retval = get_cdatamapping (); | |||
else if (pname.compare ("faces")) | else if (pname.compare ("diffusestrength")) | |||
retval = get_faces (); | retval = get_diffusestrength (); | |||
else if (pname.compare ("facevertexalphadata")) | else if (pname.compare ("displayname")) | |||
retval = get_facevertexalphadata (); | retval = get_displayname (); | |||
else if (pname.compare ("facevertexcdata")) | ||||
retval = get_facevertexcdata (); | ||||
else if (pname.compare ("vertices")) | ||||
retval = get_vertices (); | ||||
else if (pname.compare ("vertexnormals")) | ||||
retval = get_vertexnormals (); | ||||
else if (pname.compare ("normalmode")) | ||||
retval = get_normalmode (); | ||||
else if (pname.compare ("facecolor")) | ||||
retval = get_facecolor (); | ||||
else if (pname.compare ("facealpha")) | ||||
retval = get_facealpha (); | ||||
else if (pname.compare ("facelighting")) | ||||
retval = get_facelighting (); | ||||
else if (pname.compare ("edgecolor")) | ||||
retval = get_edgecolor (); | ||||
else if (pname.compare ("edgealpha")) | else if (pname.compare ("edgealpha")) | |||
retval = get_edgealpha (); | retval = get_edgealpha (); | |||
else if (pname.compare ("edgecolor")) | ||||
retval = get_edgecolor (); | ||||
else if (pname.compare ("edgelighting")) | else if (pname.compare ("edgelighting")) | |||
retval = get_edgelighting (); | retval = get_edgelighting (); | |||
else if (pname.compare ("backfacelighting")) | ||||
retval = get_backfacelighting (); | ||||
else if (pname.compare ("ambientstrength")) | ||||
retval = get_ambientstrength (); | ||||
else if (pname.compare ("diffusestrength")) | ||||
retval = get_diffusestrength (); | ||||
else if (pname.compare ("specularstrength")) | ||||
retval = get_specularstrength (); | ||||
else if (pname.compare ("specularexponent")) | ||||
retval = get_specularexponent (); | ||||
else if (pname.compare ("specularcolorreflectance")) | ||||
retval = get_specularcolorreflectance (); | ||||
else if (pname.compare ("erasemode")) | else if (pname.compare ("erasemode")) | |||
retval = get_erasemode (); | retval = get_erasemode (); | |||
else if (pname.compare ("facealpha")) | ||||
retval = get_facealpha (); | ||||
else if (pname.compare ("facecolor")) | ||||
retval = get_facecolor (); | ||||
else if (pname.compare ("facelighting")) | ||||
retval = get_facelighting (); | ||||
else if (pname.compare ("faces")) | ||||
retval = get_faces (); | ||||
else if (pname.compare ("facevertexalphadata")) | ||||
retval = get_facevertexalphadata (); | ||||
else if (pname.compare ("facevertexcdata")) | ||||
retval = get_facevertexcdata (); | ||||
else if (pname.compare ("interpreter")) | ||||
retval = get_interpreter (); | ||||
else if (pname.compare ("linestyle")) | else if (pname.compare ("linestyle")) | |||
retval = get_linestyle (); | retval = get_linestyle (); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
retval = get_linewidth (); | retval = get_linewidth (); | |||
else if (pname.compare ("marker")) | else if (pname.compare ("marker")) | |||
retval = get_marker (); | retval = get_marker (); | |||
else if (pname.compare ("markeredgecolor")) | else if (pname.compare ("markeredgecolor")) | |||
retval = get_markeredgecolor (); | retval = get_markeredgecolor (); | |||
else if (pname.compare ("markerfacecolor")) | else if (pname.compare ("markerfacecolor")) | |||
retval = get_markerfacecolor (); | retval = get_markerfacecolor (); | |||
else if (pname.compare ("markersize")) | else if (pname.compare ("markersize")) | |||
retval = get_markersize (); | retval = get_markersize (); | |||
else if (pname.compare ("interpreter")) | else if (pname.compare ("normalmode")) | |||
retval = get_interpreter (); | retval = get_normalmode (); | |||
else if (pname.compare ("displayname")) | else if (pname.compare ("specularcolorreflectance")) | |||
retval = get_displayname (); | retval = get_specularcolorreflectance (); | |||
else if (pname.compare ("alphadatamapping")) | else if (pname.compare ("specularexponent")) | |||
retval = get_alphadatamapping (); | retval = get_specularexponent (); | |||
else if (pname.compare ("specularstrength")) | ||||
retval = get_specularstrength (); | ||||
else if (pname.compare ("vertexnormals")) | ||||
retval = get_vertexnormals (); | ||||
else if (pname.compare ("vertices")) | ||||
retval = get_vertices (); | ||||
else if (pname.compare ("xdata")) | ||||
retval = get_xdata (); | ||||
else if (pname.compare ("ydata")) | ||||
retval = get_ydata (); | ||||
else if (pname.compare ("zdata")) | ||||
retval = get_zdata (); | ||||
else if (pname.compare ("alim")) | ||||
retval = get_alim (); | ||||
else if (pname.compare ("clim")) | ||||
retval = get_clim (); | ||||
else if (pname.compare ("xlim")) | else if (pname.compare ("xlim")) | |||
retval = get_xlim (); | retval = get_xlim (); | |||
else if (pname.compare ("ylim")) | else if (pname.compare ("ylim")) | |||
retval = get_ylim (); | retval = get_ylim (); | |||
else if (pname.compare ("zlim")) | else if (pname.compare ("zlim")) | |||
retval = get_zlim (); | retval = get_zlim (); | |||
else if (pname.compare ("clim")) | else if (pname.compare ("aliminclude")) | |||
retval = get_clim (); | retval = get_aliminclude (); | |||
else if (pname.compare ("alim")) | else if (pname.compare ("climinclude")) | |||
retval = get_alim (); | retval = get_climinclude (); | |||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
retval = get_xliminclude (); | retval = get_xliminclude (); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
retval = get_yliminclude (); | retval = get_yliminclude (); | |||
else if (pname.compare ("zliminclude")) | else if (pname.compare ("zliminclude")) | |||
retval = get_zliminclude (); | retval = get_zliminclude (); | |||
else if (pname.compare ("climinclude")) | ||||
retval = get_climinclude (); | ||||
else if (pname.compare ("aliminclude")) | ||||
retval = get_aliminclude (); | ||||
else | else | |||
retval = base_properties::get (pname); | retval = base_properties::get (pname); | |||
return retval; | return retval; | |||
} | } | |||
property | property | |||
patch::properties::get_property (const caseless_str& pname_arg) | patch::properties::get_property (const caseless_str& pname_arg) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return property (); | return property (); | |||
if (pname.compare ("xdata")) | if (pname.compare ("alphadatamapping")) | |||
return property (&xdata, true); | return property (&alphadatamapping, true); | |||
else if (pname.compare ("ydata")) | else if (pname.compare ("ambientstrength")) | |||
return property (&ydata, true); | return property (&ambientstrength, true); | |||
else if (pname.compare ("zdata")) | else if (pname.compare ("backfacelighting")) | |||
return property (&zdata, true); | return property (&backfacelighting, true); | |||
else if (pname.compare ("cdata")) | else if (pname.compare ("cdata")) | |||
return property (&cdata, true); | return property (&cdata, true); | |||
else if (pname.compare ("cdatamapping")) | else if (pname.compare ("cdatamapping")) | |||
return property (&cdatamapping, true); | return property (&cdatamapping, true); | |||
else if (pname.compare ("faces")) | else if (pname.compare ("diffusestrength")) | |||
return property (&faces, true); | return property (&diffusestrength, true); | |||
else if (pname.compare ("facevertexalphadata")) | else if (pname.compare ("displayname")) | |||
return property (&facevertexalphadata, true); | return property (&displayname, true); | |||
else if (pname.compare ("facevertexcdata")) | ||||
return property (&facevertexcdata, true); | ||||
else if (pname.compare ("vertices")) | ||||
return property (&vertices, true); | ||||
else if (pname.compare ("vertexnormals")) | ||||
return property (&vertexnormals, true); | ||||
else if (pname.compare ("normalmode")) | ||||
return property (&normalmode, true); | ||||
else if (pname.compare ("facecolor")) | ||||
return property (&facecolor, true); | ||||
else if (pname.compare ("facealpha")) | ||||
return property (&facealpha, true); | ||||
else if (pname.compare ("facelighting")) | ||||
return property (&facelighting, true); | ||||
else if (pname.compare ("edgecolor")) | ||||
return property (&edgecolor, true); | ||||
else if (pname.compare ("edgealpha")) | else if (pname.compare ("edgealpha")) | |||
return property (&edgealpha, true); | return property (&edgealpha, true); | |||
else if (pname.compare ("edgecolor")) | ||||
return property (&edgecolor, true); | ||||
else if (pname.compare ("edgelighting")) | else if (pname.compare ("edgelighting")) | |||
return property (&edgelighting, true); | return property (&edgelighting, true); | |||
else if (pname.compare ("backfacelighting")) | ||||
return property (&backfacelighting, true); | ||||
else if (pname.compare ("ambientstrength")) | ||||
return property (&ambientstrength, true); | ||||
else if (pname.compare ("diffusestrength")) | ||||
return property (&diffusestrength, true); | ||||
else if (pname.compare ("specularstrength")) | ||||
return property (&specularstrength, true); | ||||
else if (pname.compare ("specularexponent")) | ||||
return property (&specularexponent, true); | ||||
else if (pname.compare ("specularcolorreflectance")) | ||||
return property (&specularcolorreflectance, true); | ||||
else if (pname.compare ("erasemode")) | else if (pname.compare ("erasemode")) | |||
return property (&erasemode, true); | return property (&erasemode, true); | |||
else if (pname.compare ("facealpha")) | ||||
return property (&facealpha, true); | ||||
else if (pname.compare ("facecolor")) | ||||
return property (&facecolor, true); | ||||
else if (pname.compare ("facelighting")) | ||||
return property (&facelighting, true); | ||||
else if (pname.compare ("faces")) | ||||
return property (&faces, true); | ||||
else if (pname.compare ("facevertexalphadata")) | ||||
return property (&facevertexalphadata, true); | ||||
else if (pname.compare ("facevertexcdata")) | ||||
return property (&facevertexcdata, true); | ||||
else if (pname.compare ("interpreter")) | ||||
return property (&interpreter, true); | ||||
else if (pname.compare ("linestyle")) | else if (pname.compare ("linestyle")) | |||
return property (&linestyle, true); | return property (&linestyle, true); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
return property (&linewidth, true); | return property (&linewidth, true); | |||
else if (pname.compare ("marker")) | else if (pname.compare ("marker")) | |||
return property (&marker, true); | return property (&marker, true); | |||
else if (pname.compare ("markeredgecolor")) | else if (pname.compare ("markeredgecolor")) | |||
return property (&markeredgecolor, true); | return property (&markeredgecolor, true); | |||
else if (pname.compare ("markerfacecolor")) | else if (pname.compare ("markerfacecolor")) | |||
return property (&markerfacecolor, true); | return property (&markerfacecolor, true); | |||
else if (pname.compare ("markersize")) | else if (pname.compare ("markersize")) | |||
return property (&markersize, true); | return property (&markersize, true); | |||
else if (pname.compare ("interpreter")) | else if (pname.compare ("normalmode")) | |||
return property (&interpreter, true); | return property (&normalmode, true); | |||
else if (pname.compare ("displayname")) | else if (pname.compare ("specularcolorreflectance")) | |||
return property (&displayname, true); | return property (&specularcolorreflectance, true); | |||
else if (pname.compare ("alphadatamapping")) | else if (pname.compare ("specularexponent")) | |||
return property (&alphadatamapping, true); | return property (&specularexponent, true); | |||
else if (pname.compare ("specularstrength")) | ||||
return property (&specularstrength, true); | ||||
else if (pname.compare ("vertexnormals")) | ||||
return property (&vertexnormals, true); | ||||
else if (pname.compare ("vertices")) | ||||
return property (&vertices, true); | ||||
else if (pname.compare ("xdata")) | ||||
return property (&xdata, true); | ||||
else if (pname.compare ("ydata")) | ||||
return property (&ydata, true); | ||||
else if (pname.compare ("zdata")) | ||||
return property (&zdata, true); | ||||
else if (pname.compare ("alim")) | ||||
return property (&alim, true); | ||||
else if (pname.compare ("clim")) | ||||
return property (&clim, true); | ||||
else if (pname.compare ("xlim")) | else if (pname.compare ("xlim")) | |||
return property (&xlim, true); | return property (&xlim, true); | |||
else if (pname.compare ("ylim")) | else if (pname.compare ("ylim")) | |||
return property (&ylim, true); | return property (&ylim, true); | |||
else if (pname.compare ("zlim")) | else if (pname.compare ("zlim")) | |||
return property (&zlim, true); | return property (&zlim, true); | |||
else if (pname.compare ("clim")) | else if (pname.compare ("aliminclude")) | |||
return property (&clim, true); | return property (&aliminclude, true); | |||
else if (pname.compare ("alim")) | else if (pname.compare ("climinclude")) | |||
return property (&alim, true); | return property (&climinclude, true); | |||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
return property (&xliminclude, true); | return property (&xliminclude, true); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
return property (&yliminclude, true); | return property (&yliminclude, true); | |||
else if (pname.compare ("zliminclude")) | else if (pname.compare ("zliminclude")) | |||
return property (&zliminclude, true); | return property (&zliminclude, true); | |||
else if (pname.compare ("climinclude")) | ||||
return property (&climinclude, true); | ||||
else if (pname.compare ("aliminclude")) | ||||
return property (&aliminclude, true); | ||||
else | else | |||
return base_properties::get_property (pname); | return base_properties::get_property (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
patch::properties::factory_defaults (void) | patch::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["xdata"] = Matrix (); | m["alphadatamapping"] = "scaled"; | |||
m["ydata"] = Matrix (); | m["ambientstrength"] = 0.3; | |||
m["zdata"] = Matrix (); | m["backfacelighting"] = "reverselit"; | |||
m["cdata"] = Matrix (); | m["cdata"] = Matrix (); | |||
m["cdatamapping"] = "scaled"; | m["cdatamapping"] = "scaled"; | |||
m["faces"] = Matrix (); | m["diffusestrength"] = 0.6; | |||
m["facevertexalphadata"] = Matrix (); | m["displayname"] = ""; | |||
m["facevertexcdata"] = Matrix (); | ||||
m["vertices"] = Matrix (); | ||||
m["vertexnormals"] = Matrix (); | ||||
m["normalmode"] = "auto"; | ||||
m["facecolor"] = color_property (color_values (0, 0, 0), radio_values ("f | ||||
lat|none|interp")); | ||||
m["facealpha"] = double_radio_property (1.0, radio_values ("flat|interp") | ||||
); | ||||
m["facelighting"] = "none"; | ||||
m["edgecolor"] = color_property (color_values (0, 0, 0), radio_values ("f | ||||
lat|none|interp")); | ||||
m["edgealpha"] = double_radio_property (1.0, radio_values ("flat|interp") ); | m["edgealpha"] = double_radio_property (1.0, radio_values ("flat|interp") ); | |||
m["edgecolor"] = color_property (color_values (0, 0, 0), radio_values ("n one|flat|interp")); | ||||
m["edgelighting"] = "none"; | m["edgelighting"] = "none"; | |||
m["backfacelighting"] = "reverselit"; | ||||
m["ambientstrength"] = 0.3; | ||||
m["diffusestrength"] = 0.6; | ||||
m["specularstrength"] = 0.6; | ||||
m["specularexponent"] = 10.0; | ||||
m["specularcolorreflectance"] = 1.0; | ||||
m["erasemode"] = "normal"; | m["erasemode"] = "normal"; | |||
m["facealpha"] = double_radio_property (1.0, radio_values ("flat|interp") | ||||
); | ||||
m["facecolor"] = color_property (color_values (0, 0, 0), radio_values ("n | ||||
one|flat|interp")); | ||||
m["facelighting"] = "none"; | ||||
m["faces"] = Matrix (); | ||||
m["facevertexalphadata"] = Matrix (); | ||||
m["facevertexcdata"] = Matrix (); | ||||
m["interpreter"] = "tex"; | ||||
m["linestyle"] = "-"; | m["linestyle"] = "-"; | |||
m["linewidth"] = 0.5; | m["linewidth"] = 0.5; | |||
m["marker"] = "none"; | m["marker"] = "none"; | |||
m["markeredgecolor"] = "{auto}|none|flat"; | m["markeredgecolor"] = color_property (radio_values ("none|{auto}|flat"), | |||
m["markerfacecolor"] = "auto|{none}|flat"; | color_values (0, 0, 0)); | |||
m["markerfacecolor"] = color_property (radio_values ("{none}|auto|flat"), | ||||
color_values (0, 0, 0)); | ||||
m["markersize"] = 6; | m["markersize"] = 6; | |||
m["interpreter"] = "tex"; | m["normalmode"] = "auto"; | |||
m["displayname"] = ""; | m["specularcolorreflectance"] = 1.0; | |||
m["alphadatamapping"] = "scaled"; | m["specularexponent"] = 10.0; | |||
m["specularstrength"] = 0.6; | ||||
m["vertexnormals"] = Matrix (); | ||||
m["vertices"] = Matrix (); | ||||
m["xdata"] = Matrix (); | ||||
m["ydata"] = Matrix (); | ||||
m["zdata"] = Matrix (); | ||||
m["alim"] = Matrix (); | ||||
m["clim"] = Matrix (); | ||||
m["xlim"] = Matrix (); | m["xlim"] = Matrix (); | |||
m["ylim"] = Matrix (); | m["ylim"] = Matrix (); | |||
m["zlim"] = Matrix (); | m["zlim"] = Matrix (); | |||
m["clim"] = Matrix (); | m["aliminclude"] = "on"; | |||
m["alim"] = Matrix (); | m["climinclude"] = "on"; | |||
m["xliminclude"] = "on"; | m["xliminclude"] = "on"; | |||
m["yliminclude"] = "on"; | m["yliminclude"] = "on"; | |||
m["zliminclude"] = "on"; | m["zliminclude"] = "on"; | |||
m["climinclude"] = "on"; | ||||
m["aliminclude"] = "on"; | ||||
return m; | return m; | |||
} | } | |||
std::string patch::properties::go_name ("patch"); | std::string patch::properties::go_name ("patch"); | |||
std::set<std::string> | std::set<std::string> | |||
patch::properties::core_property_names (void) | patch::properties::core_property_names (void) | |||
{ | { | |||
static std::set<std::string> all_pnames; | static std::set<std::string> all_pnames; | |||
static bool initialized = false; | static bool initialized = false; | |||
if (! initialized) | if (! initialized) | |||
{ | { | |||
all_pnames.insert ("xdata"); | all_pnames.insert ("alphadatamapping"); | |||
all_pnames.insert ("ydata"); | all_pnames.insert ("ambientstrength"); | |||
all_pnames.insert ("zdata"); | all_pnames.insert ("backfacelighting"); | |||
all_pnames.insert ("cdata"); | all_pnames.insert ("cdata"); | |||
all_pnames.insert ("cdatamapping"); | all_pnames.insert ("cdatamapping"); | |||
all_pnames.insert ("faces"); | all_pnames.insert ("diffusestrength"); | |||
all_pnames.insert ("facevertexalphadata"); | all_pnames.insert ("displayname"); | |||
all_pnames.insert ("facevertexcdata"); | ||||
all_pnames.insert ("vertices"); | ||||
all_pnames.insert ("vertexnormals"); | ||||
all_pnames.insert ("normalmode"); | ||||
all_pnames.insert ("facecolor"); | ||||
all_pnames.insert ("facealpha"); | ||||
all_pnames.insert ("facelighting"); | ||||
all_pnames.insert ("edgecolor"); | ||||
all_pnames.insert ("edgealpha"); | all_pnames.insert ("edgealpha"); | |||
all_pnames.insert ("edgecolor"); | ||||
all_pnames.insert ("edgelighting"); | all_pnames.insert ("edgelighting"); | |||
all_pnames.insert ("backfacelighting"); | ||||
all_pnames.insert ("ambientstrength"); | ||||
all_pnames.insert ("diffusestrength"); | ||||
all_pnames.insert ("specularstrength"); | ||||
all_pnames.insert ("specularexponent"); | ||||
all_pnames.insert ("specularcolorreflectance"); | ||||
all_pnames.insert ("erasemode"); | all_pnames.insert ("erasemode"); | |||
all_pnames.insert ("facealpha"); | ||||
all_pnames.insert ("facecolor"); | ||||
all_pnames.insert ("facelighting"); | ||||
all_pnames.insert ("faces"); | ||||
all_pnames.insert ("facevertexalphadata"); | ||||
all_pnames.insert ("facevertexcdata"); | ||||
all_pnames.insert ("interpreter"); | ||||
all_pnames.insert ("linestyle"); | all_pnames.insert ("linestyle"); | |||
all_pnames.insert ("linewidth"); | all_pnames.insert ("linewidth"); | |||
all_pnames.insert ("marker"); | all_pnames.insert ("marker"); | |||
all_pnames.insert ("markeredgecolor"); | all_pnames.insert ("markeredgecolor"); | |||
all_pnames.insert ("markerfacecolor"); | all_pnames.insert ("markerfacecolor"); | |||
all_pnames.insert ("markersize"); | all_pnames.insert ("markersize"); | |||
all_pnames.insert ("interpreter"); | all_pnames.insert ("normalmode"); | |||
all_pnames.insert ("displayname"); | all_pnames.insert ("specularcolorreflectance"); | |||
all_pnames.insert ("alphadatamapping"); | all_pnames.insert ("specularexponent"); | |||
all_pnames.insert ("specularstrength"); | ||||
all_pnames.insert ("vertexnormals"); | ||||
all_pnames.insert ("vertices"); | ||||
all_pnames.insert ("xdata"); | ||||
all_pnames.insert ("ydata"); | ||||
all_pnames.insert ("zdata"); | ||||
all_pnames.insert ("alim"); | ||||
all_pnames.insert ("clim"); | ||||
all_pnames.insert ("xlim"); | all_pnames.insert ("xlim"); | |||
all_pnames.insert ("ylim"); | all_pnames.insert ("ylim"); | |||
all_pnames.insert ("zlim"); | all_pnames.insert ("zlim"); | |||
all_pnames.insert ("clim"); | all_pnames.insert ("aliminclude"); | |||
all_pnames.insert ("alim"); | all_pnames.insert ("climinclude"); | |||
all_pnames.insert ("xliminclude"); | all_pnames.insert ("xliminclude"); | |||
all_pnames.insert ("yliminclude"); | all_pnames.insert ("yliminclude"); | |||
all_pnames.insert ("zliminclude"); | all_pnames.insert ("zliminclude"); | |||
all_pnames.insert ("climinclude"); | ||||
all_pnames.insert ("aliminclude"); | ||||
std::set<std::string> base_pnames = base_properties::core_property_na mes (); | std::set<std::string> base_pnames = base_properties::core_property_na mes (); | |||
all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | |||
initialized = true; | initialized = true; | |||
} | } | |||
return all_pnames; | return all_pnames; | |||
} | } | |||
skipping to change at line 4231 | skipping to change at line 4330 | |||
{ | { | |||
std::set<std::string> pnames = all_property_names (); | std::set<std::string> pnames = all_property_names (); | |||
return pnames.find (pname) != pnames.end (); | return pnames.find (pname) != pnames.end (); | |||
} | } | |||
// ******** surface ******** | // ******** surface ******** | |||
surface::properties::properties (const graphics_handle& mh, const graphics_ handle& p) | surface::properties::properties (const graphics_handle& mh, const graphics_ handle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
xdata ("xdata", mh, Matrix ()), | ||||
ydata ("ydata", mh, Matrix ()), | ||||
zdata ("zdata", mh, Matrix ()), | ||||
cdata ("cdata", mh, Matrix ()), | ||||
cdatamapping ("cdatamapping", mh, "{scaled}|direct"), | ||||
xdatasource ("xdatasource", mh, ""), | ||||
ydatasource ("ydatasource", mh, ""), | ||||
zdatasource ("zdatasource", mh, ""), | ||||
cdatasource ("cdatasource", mh, ""), | ||||
facecolor ("facecolor", mh, "{flat}|none|interp|texturemap"), | ||||
facealpha ("facealpha", mh, double_radio_property (1.0, radio_values (" | ||||
flat|interp"))), | ||||
edgecolor ("edgecolor", mh, color_property (color_values (0, 0, 0), rad | ||||
io_values ("flat|none|interp"))), | ||||
linestyle ("linestyle", mh, "{-}|--|:|-.|none"), | ||||
linewidth ("linewidth", mh, 0.5), | ||||
marker ("marker", mh, "{none}|s|o|x|+|.|*|<|>|v|^|d|p|h|@"), | ||||
markeredgecolor ("markeredgecolor", mh, "{auto}|none"), | ||||
markerfacecolor ("markerfacecolor", mh, "auto|{none}"), | ||||
markersize ("markersize", mh, 6), | ||||
interpreter ("interpreter", mh, "{tex}|none|latex"), | ||||
displayname ("displayname", mh, ""), | ||||
alphadata ("alphadata", mh, Matrix ()), | alphadata ("alphadata", mh, Matrix ()), | |||
alphadatamapping ("alphadatamapping", mh, "none|direct|{scaled}"), | alphadatamapping ("alphadatamapping", mh, "none|direct|{scaled}"), | |||
ambientstrength ("ambientstrength", mh, 0.3), | ambientstrength ("ambientstrength", mh, 0.3), | |||
backfacelighting ("backfacelighting", mh, "unlit|lit|{reverselit}"), | backfacelighting ("backfacelighting", mh, "unlit|lit|{reverselit}"), | |||
cdata ("cdata", mh, Matrix ()), | ||||
cdatamapping ("cdatamapping", mh, "{scaled}|direct"), | ||||
cdatasource ("cdatasource", mh, ""), | ||||
diffusestrength ("diffusestrength", mh, 0.6), | diffusestrength ("diffusestrength", mh, 0.6), | |||
displayname ("displayname", mh, ""), | ||||
edgealpha ("edgealpha", mh, double_radio_property (1.0, radio_values (" flat|interp"))), | edgealpha ("edgealpha", mh, double_radio_property (1.0, radio_values (" flat|interp"))), | |||
edgecolor ("edgecolor", mh, color_property (color_values (0, 0, 0), rad io_values ("none|flat|interp"))), | ||||
edgelighting ("edgelighting", mh, "{none}|flat|gouraud|phong"), | edgelighting ("edgelighting", mh, "{none}|flat|gouraud|phong"), | |||
erasemode ("erasemode", mh, "{normal}|none|xor|background"), | erasemode ("erasemode", mh, "{normal}|none|xor|background"), | |||
facealpha ("facealpha", mh, double_radio_property (1.0, radio_values (" | ||||
flat|interp|texturemap"))), | ||||
facecolor ("facecolor", mh, color_property (radio_values ("none|{flat}| | ||||
interp|texturemap"), color_values (0, 0, 0))), | ||||
facelighting ("facelighting", mh, "{none}|flat|gouraud|phong"), | facelighting ("facelighting", mh, "{none}|flat|gouraud|phong"), | |||
interpreter ("interpreter", mh, "{tex}|none|latex"), | ||||
linestyle ("linestyle", mh, "{-}|--|:|-.|none"), | ||||
linewidth ("linewidth", mh, 0.5), | ||||
marker ("marker", mh, "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pe | ||||
ntagram|h|hexagram"), | ||||
markeredgecolor ("markeredgecolor", mh, color_property (radio_values (" | ||||
none|{auto}|flat"), color_values (0, 0, 0))), | ||||
markerfacecolor ("markerfacecolor", mh, color_property (radio_values (" | ||||
{none}|auto|flat"), color_values (0, 0, 0))), | ||||
markersize ("markersize", mh, 6), | ||||
meshstyle ("meshstyle", mh, "{both}|row|column"), | meshstyle ("meshstyle", mh, "{both}|row|column"), | |||
normalmode ("normalmode", mh, "{auto}|manual"), | normalmode ("normalmode", mh, "{auto}|manual"), | |||
specularcolorreflectance ("specularcolorreflectance", mh, 1), | specularcolorreflectance ("specularcolorreflectance", mh, 1), | |||
specularexponent ("specularexponent", mh, 10), | specularexponent ("specularexponent", mh, 10), | |||
specularstrength ("specularstrength", mh, 0.9), | specularstrength ("specularstrength", mh, 0.9), | |||
vertexnormals ("vertexnormals", mh, Matrix ()), | vertexnormals ("vertexnormals", mh, Matrix ()), | |||
xdata ("xdata", mh, Matrix ()), | ||||
xdatasource ("xdatasource", mh, ""), | ||||
ydata ("ydata", mh, Matrix ()), | ||||
ydatasource ("ydatasource", mh, ""), | ||||
zdata ("zdata", mh, Matrix ()), | ||||
zdatasource ("zdatasource", mh, ""), | ||||
alim ("alim", mh, Matrix ()), | ||||
clim ("clim", mh, Matrix ()), | ||||
xlim ("xlim", mh, Matrix ()), | xlim ("xlim", mh, Matrix ()), | |||
ylim ("ylim", mh, Matrix ()), | ylim ("ylim", mh, Matrix ()), | |||
zlim ("zlim", mh, Matrix ()), | zlim ("zlim", mh, Matrix ()), | |||
clim ("clim", mh, Matrix ()), | aliminclude ("aliminclude", mh, "on"), | |||
alim ("alim", mh, Matrix ()), | climinclude ("climinclude", mh, "on"), | |||
xliminclude ("xliminclude", mh, "on"), | xliminclude ("xliminclude", mh, "on"), | |||
yliminclude ("yliminclude", mh, "on"), | yliminclude ("yliminclude", mh, "on"), | |||
zliminclude ("zliminclude", mh, "on"), | zliminclude ("zliminclude", mh, "on") | |||
climinclude ("climinclude", mh, "on"), | ||||
aliminclude ("aliminclude", mh, "on") | ||||
{ | { | |||
xdata.set_id (ID_XDATA); | alphadata.set_id (ID_ALPHADATA); | |||
ydata.set_id (ID_YDATA); | alphadatamapping.set_id (ID_ALPHADATAMAPPING); | |||
zdata.set_id (ID_ZDATA); | ambientstrength.set_id (ID_AMBIENTSTRENGTH); | |||
backfacelighting.set_id (ID_BACKFACELIGHTING); | ||||
cdata.set_id (ID_CDATA); | cdata.set_id (ID_CDATA); | |||
cdatamapping.set_id (ID_CDATAMAPPING); | cdatamapping.set_id (ID_CDATAMAPPING); | |||
xdatasource.set_id (ID_XDATASOURCE); | ||||
ydatasource.set_id (ID_YDATASOURCE); | ||||
zdatasource.set_id (ID_ZDATASOURCE); | ||||
cdatasource.set_id (ID_CDATASOURCE); | cdatasource.set_id (ID_CDATASOURCE); | |||
facecolor.set_id (ID_FACECOLOR); | diffusestrength.set_id (ID_DIFFUSESTRENGTH); | |||
facealpha.set_id (ID_FACEALPHA); | displayname.set_id (ID_DISPLAYNAME); | |||
edgealpha.set_id (ID_EDGEALPHA); | ||||
edgecolor.set_id (ID_EDGECOLOR); | edgecolor.set_id (ID_EDGECOLOR); | |||
edgelighting.set_id (ID_EDGELIGHTING); | ||||
erasemode.set_id (ID_ERASEMODE); | ||||
facealpha.set_id (ID_FACEALPHA); | ||||
facecolor.set_id (ID_FACECOLOR); | ||||
facelighting.set_id (ID_FACELIGHTING); | ||||
interpreter.set_id (ID_INTERPRETER); | ||||
linestyle.set_id (ID_LINESTYLE); | linestyle.set_id (ID_LINESTYLE); | |||
linewidth.set_id (ID_LINEWIDTH); | linewidth.set_id (ID_LINEWIDTH); | |||
marker.set_id (ID_MARKER); | marker.set_id (ID_MARKER); | |||
markeredgecolor.set_id (ID_MARKEREDGECOLOR); | markeredgecolor.set_id (ID_MARKEREDGECOLOR); | |||
markerfacecolor.set_id (ID_MARKERFACECOLOR); | markerfacecolor.set_id (ID_MARKERFACECOLOR); | |||
markersize.set_id (ID_MARKERSIZE); | markersize.set_id (ID_MARKERSIZE); | |||
interpreter.set_id (ID_INTERPRETER); | ||||
displayname.set_id (ID_DISPLAYNAME); | ||||
alphadata.set_id (ID_ALPHADATA); | ||||
alphadatamapping.set_id (ID_ALPHADATAMAPPING); | ||||
ambientstrength.set_id (ID_AMBIENTSTRENGTH); | ||||
backfacelighting.set_id (ID_BACKFACELIGHTING); | ||||
diffusestrength.set_id (ID_DIFFUSESTRENGTH); | ||||
edgealpha.set_id (ID_EDGEALPHA); | ||||
edgelighting.set_id (ID_EDGELIGHTING); | ||||
erasemode.set_id (ID_ERASEMODE); | ||||
facelighting.set_id (ID_FACELIGHTING); | ||||
meshstyle.set_id (ID_MESHSTYLE); | meshstyle.set_id (ID_MESHSTYLE); | |||
normalmode.set_id (ID_NORMALMODE); | normalmode.set_id (ID_NORMALMODE); | |||
specularcolorreflectance.set_id (ID_SPECULARCOLORREFLECTANCE); | specularcolorreflectance.set_id (ID_SPECULARCOLORREFLECTANCE); | |||
specularexponent.set_id (ID_SPECULAREXPONENT); | specularexponent.set_id (ID_SPECULAREXPONENT); | |||
specularstrength.set_id (ID_SPECULARSTRENGTH); | specularstrength.set_id (ID_SPECULARSTRENGTH); | |||
vertexnormals.set_id (ID_VERTEXNORMALS); | vertexnormals.set_id (ID_VERTEXNORMALS); | |||
xdata.set_id (ID_XDATA); | ||||
xdatasource.set_id (ID_XDATASOURCE); | ||||
ydata.set_id (ID_YDATA); | ||||
ydatasource.set_id (ID_YDATASOURCE); | ||||
zdata.set_id (ID_ZDATA); | ||||
zdatasource.set_id (ID_ZDATASOURCE); | ||||
alim.set_id (ID_ALIM); | ||||
alim.set_hidden (true); | ||||
clim.set_id (ID_CLIM); | ||||
clim.set_hidden (true); | ||||
xlim.set_id (ID_XLIM); | xlim.set_id (ID_XLIM); | |||
xlim.set_hidden (true); | xlim.set_hidden (true); | |||
ylim.set_id (ID_YLIM); | ylim.set_id (ID_YLIM); | |||
ylim.set_hidden (true); | ylim.set_hidden (true); | |||
zlim.set_id (ID_ZLIM); | zlim.set_id (ID_ZLIM); | |||
zlim.set_hidden (true); | zlim.set_hidden (true); | |||
clim.set_id (ID_CLIM); | aliminclude.set_id (ID_ALIMINCLUDE); | |||
clim.set_hidden (true); | aliminclude.set_hidden (true); | |||
alim.set_id (ID_ALIM); | climinclude.set_id (ID_CLIMINCLUDE); | |||
alim.set_hidden (true); | climinclude.set_hidden (true); | |||
xliminclude.set_id (ID_XLIMINCLUDE); | xliminclude.set_id (ID_XLIMINCLUDE); | |||
xliminclude.set_hidden (true); | xliminclude.set_hidden (true); | |||
yliminclude.set_id (ID_YLIMINCLUDE); | yliminclude.set_id (ID_YLIMINCLUDE); | |||
yliminclude.set_hidden (true); | yliminclude.set_hidden (true); | |||
zliminclude.set_id (ID_ZLIMINCLUDE); | zliminclude.set_id (ID_ZLIMINCLUDE); | |||
zliminclude.set_hidden (true); | zliminclude.set_hidden (true); | |||
climinclude.set_id (ID_CLIMINCLUDE); | ||||
climinclude.set_hidden (true); | ||||
aliminclude.set_id (ID_ALIMINCLUDE); | ||||
aliminclude.set_hidden (true); | ||||
init (); | init (); | |||
} | } | |||
void | void | |||
surface::properties::set (const caseless_str& pname_arg, const octave_value & val) | surface::properties::set (const caseless_str& pname_arg, const octave_value & val) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return; | return; | |||
if (pname.compare ("xdata")) | if (pname.compare ("alphadata")) | |||
set_xdata (val); | set_alphadata (val); | |||
else if (pname.compare ("ydata")) | else if (pname.compare ("alphadatamapping")) | |||
set_ydata (val); | set_alphadatamapping (val); | |||
else if (pname.compare ("zdata")) | else if (pname.compare ("ambientstrength")) | |||
set_zdata (val); | set_ambientstrength (val); | |||
else if (pname.compare ("backfacelighting")) | ||||
set_backfacelighting (val); | ||||
else if (pname.compare ("cdata")) | else if (pname.compare ("cdata")) | |||
set_cdata (val); | set_cdata (val); | |||
else if (pname.compare ("cdatamapping")) | else if (pname.compare ("cdatamapping")) | |||
set_cdatamapping (val); | set_cdatamapping (val); | |||
else if (pname.compare ("xdatasource")) | ||||
set_xdatasource (val); | ||||
else if (pname.compare ("ydatasource")) | ||||
set_ydatasource (val); | ||||
else if (pname.compare ("zdatasource")) | ||||
set_zdatasource (val); | ||||
else if (pname.compare ("cdatasource")) | else if (pname.compare ("cdatasource")) | |||
set_cdatasource (val); | set_cdatasource (val); | |||
else if (pname.compare ("facecolor")) | else if (pname.compare ("diffusestrength")) | |||
set_facecolor (val); | set_diffusestrength (val); | |||
else if (pname.compare ("facealpha")) | else if (pname.compare ("displayname")) | |||
set_facealpha (val); | set_displayname (val); | |||
else if (pname.compare ("edgealpha")) | ||||
set_edgealpha (val); | ||||
else if (pname.compare ("edgecolor")) | else if (pname.compare ("edgecolor")) | |||
set_edgecolor (val); | set_edgecolor (val); | |||
else if (pname.compare ("edgelighting")) | ||||
set_edgelighting (val); | ||||
else if (pname.compare ("erasemode")) | ||||
set_erasemode (val); | ||||
else if (pname.compare ("facealpha")) | ||||
set_facealpha (val); | ||||
else if (pname.compare ("facecolor")) | ||||
set_facecolor (val); | ||||
else if (pname.compare ("facelighting")) | ||||
set_facelighting (val); | ||||
else if (pname.compare ("interpreter")) | ||||
set_interpreter (val); | ||||
else if (pname.compare ("linestyle")) | else if (pname.compare ("linestyle")) | |||
set_linestyle (val); | set_linestyle (val); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
set_linewidth (val); | set_linewidth (val); | |||
else if (pname.compare ("marker")) | else if (pname.compare ("marker")) | |||
set_marker (val); | set_marker (val); | |||
else if (pname.compare ("markeredgecolor")) | else if (pname.compare ("markeredgecolor")) | |||
set_markeredgecolor (val); | set_markeredgecolor (val); | |||
else if (pname.compare ("markerfacecolor")) | else if (pname.compare ("markerfacecolor")) | |||
set_markerfacecolor (val); | set_markerfacecolor (val); | |||
else if (pname.compare ("markersize")) | else if (pname.compare ("markersize")) | |||
set_markersize (val); | set_markersize (val); | |||
else if (pname.compare ("interpreter")) | ||||
set_interpreter (val); | ||||
else if (pname.compare ("displayname")) | ||||
set_displayname (val); | ||||
else if (pname.compare ("alphadata")) | ||||
set_alphadata (val); | ||||
else if (pname.compare ("alphadatamapping")) | ||||
set_alphadatamapping (val); | ||||
else if (pname.compare ("ambientstrength")) | ||||
set_ambientstrength (val); | ||||
else if (pname.compare ("backfacelighting")) | ||||
set_backfacelighting (val); | ||||
else if (pname.compare ("diffusestrength")) | ||||
set_diffusestrength (val); | ||||
else if (pname.compare ("edgealpha")) | ||||
set_edgealpha (val); | ||||
else if (pname.compare ("edgelighting")) | ||||
set_edgelighting (val); | ||||
else if (pname.compare ("erasemode")) | ||||
set_erasemode (val); | ||||
else if (pname.compare ("facelighting")) | ||||
set_facelighting (val); | ||||
else if (pname.compare ("meshstyle")) | else if (pname.compare ("meshstyle")) | |||
set_meshstyle (val); | set_meshstyle (val); | |||
else if (pname.compare ("normalmode")) | else if (pname.compare ("normalmode")) | |||
set_normalmode (val); | set_normalmode (val); | |||
else if (pname.compare ("specularcolorreflectance")) | else if (pname.compare ("specularcolorreflectance")) | |||
set_specularcolorreflectance (val); | set_specularcolorreflectance (val); | |||
else if (pname.compare ("specularexponent")) | else if (pname.compare ("specularexponent")) | |||
set_specularexponent (val); | set_specularexponent (val); | |||
else if (pname.compare ("specularstrength")) | else if (pname.compare ("specularstrength")) | |||
set_specularstrength (val); | set_specularstrength (val); | |||
else if (pname.compare ("vertexnormals")) | else if (pname.compare ("vertexnormals")) | |||
set_vertexnormals (val); | set_vertexnormals (val); | |||
else if (pname.compare ("xdata")) | ||||
set_xdata (val); | ||||
else if (pname.compare ("xdatasource")) | ||||
set_xdatasource (val); | ||||
else if (pname.compare ("ydata")) | ||||
set_ydata (val); | ||||
else if (pname.compare ("ydatasource")) | ||||
set_ydatasource (val); | ||||
else if (pname.compare ("zdata")) | ||||
set_zdata (val); | ||||
else if (pname.compare ("zdatasource")) | ||||
set_zdatasource (val); | ||||
else if (pname.compare ("aliminclude")) | ||||
set_aliminclude (val); | ||||
else if (pname.compare ("climinclude")) | ||||
set_climinclude (val); | ||||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
set_xliminclude (val); | set_xliminclude (val); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
set_yliminclude (val); | set_yliminclude (val); | |||
else if (pname.compare ("zliminclude")) | else if (pname.compare ("zliminclude")) | |||
set_zliminclude (val); | set_zliminclude (val); | |||
else if (pname.compare ("climinclude")) | ||||
set_climinclude (val); | ||||
else if (pname.compare ("aliminclude")) | ||||
set_aliminclude (val); | ||||
else | else | |||
base_properties::set (pname, val); | base_properties::set (pname, val); | |||
} | } | |||
octave_value | octave_value | |||
surface::properties::get (bool all) const | surface::properties::get (bool all) const | |||
{ | { | |||
octave_map m = base_properties::get (all).map_value (); | octave_map m = base_properties::get (all).map_value (); | |||
m.assign ("xdata", octave_value (get_xdata ())); | m.assign ("alphadata", octave_value (get_alphadata ())); | |||
m.assign ("ydata", octave_value (get_ydata ())); | m.assign ("alphadatamapping", octave_value (get_alphadatamapping ())); | |||
m.assign ("zdata", octave_value (get_zdata ())); | m.assign ("ambientstrength", octave_value (get_ambientstrength ())); | |||
m.assign ("backfacelighting", octave_value (get_backfacelighting ())); | ||||
m.assign ("cdata", octave_value (get_cdata ())); | m.assign ("cdata", octave_value (get_cdata ())); | |||
m.assign ("cdatamapping", octave_value (get_cdatamapping ())); | m.assign ("cdatamapping", octave_value (get_cdatamapping ())); | |||
m.assign ("xdatasource", octave_value (get_xdatasource ())); | ||||
m.assign ("ydatasource", octave_value (get_ydatasource ())); | ||||
m.assign ("zdatasource", octave_value (get_zdatasource ())); | ||||
m.assign ("cdatasource", octave_value (get_cdatasource ())); | m.assign ("cdatasource", octave_value (get_cdatasource ())); | |||
m.assign ("facecolor", octave_value (get_facecolor ())); | m.assign ("diffusestrength", octave_value (get_diffusestrength ())); | |||
m.assign ("facealpha", octave_value (get_facealpha ())); | m.assign ("displayname", octave_value (get_displayname ())); | |||
m.assign ("edgealpha", octave_value (get_edgealpha ())); | ||||
m.assign ("edgecolor", octave_value (get_edgecolor ())); | m.assign ("edgecolor", octave_value (get_edgecolor ())); | |||
m.assign ("edgelighting", octave_value (get_edgelighting ())); | ||||
m.assign ("erasemode", octave_value (get_erasemode ())); | ||||
m.assign ("facealpha", octave_value (get_facealpha ())); | ||||
m.assign ("facecolor", octave_value (get_facecolor ())); | ||||
m.assign ("facelighting", octave_value (get_facelighting ())); | ||||
m.assign ("interpreter", octave_value (get_interpreter ())); | ||||
m.assign ("linestyle", octave_value (get_linestyle ())); | m.assign ("linestyle", octave_value (get_linestyle ())); | |||
m.assign ("linewidth", octave_value (get_linewidth ())); | m.assign ("linewidth", octave_value (get_linewidth ())); | |||
m.assign ("marker", octave_value (get_marker ())); | m.assign ("marker", octave_value (get_marker ())); | |||
m.assign ("markeredgecolor", octave_value (get_markeredgecolor ())); | m.assign ("markeredgecolor", octave_value (get_markeredgecolor ())); | |||
m.assign ("markerfacecolor", octave_value (get_markerfacecolor ())); | m.assign ("markerfacecolor", octave_value (get_markerfacecolor ())); | |||
m.assign ("markersize", octave_value (get_markersize ())); | m.assign ("markersize", octave_value (get_markersize ())); | |||
m.assign ("interpreter", octave_value (get_interpreter ())); | ||||
m.assign ("displayname", octave_value (get_displayname ())); | ||||
m.assign ("alphadata", octave_value (get_alphadata ())); | ||||
m.assign ("alphadatamapping", octave_value (get_alphadatamapping ())); | ||||
m.assign ("ambientstrength", octave_value (get_ambientstrength ())); | ||||
m.assign ("backfacelighting", octave_value (get_backfacelighting ())); | ||||
m.assign ("diffusestrength", octave_value (get_diffusestrength ())); | ||||
m.assign ("edgealpha", octave_value (get_edgealpha ())); | ||||
m.assign ("edgelighting", octave_value (get_edgelighting ())); | ||||
m.assign ("erasemode", octave_value (get_erasemode ())); | ||||
m.assign ("facelighting", octave_value (get_facelighting ())); | ||||
m.assign ("meshstyle", octave_value (get_meshstyle ())); | m.assign ("meshstyle", octave_value (get_meshstyle ())); | |||
m.assign ("normalmode", octave_value (get_normalmode ())); | m.assign ("normalmode", octave_value (get_normalmode ())); | |||
m.assign ("specularcolorreflectance", octave_value (get_specularcolorrefl ectance ())); | m.assign ("specularcolorreflectance", octave_value (get_specularcolorrefl ectance ())); | |||
m.assign ("specularexponent", octave_value (get_specularexponent ())); | m.assign ("specularexponent", octave_value (get_specularexponent ())); | |||
m.assign ("specularstrength", octave_value (get_specularstrength ())); | m.assign ("specularstrength", octave_value (get_specularstrength ())); | |||
m.assign ("vertexnormals", octave_value (get_vertexnormals ())); | m.assign ("vertexnormals", octave_value (get_vertexnormals ())); | |||
m.assign ("xdata", octave_value (get_xdata ())); | ||||
m.assign ("xdatasource", octave_value (get_xdatasource ())); | ||||
m.assign ("ydata", octave_value (get_ydata ())); | ||||
m.assign ("ydatasource", octave_value (get_ydatasource ())); | ||||
m.assign ("zdata", octave_value (get_zdata ())); | ||||
m.assign ("zdatasource", octave_value (get_zdatasource ())); | ||||
if (all) | ||||
m.assign ("alim", octave_value (get_alim ())); | ||||
if (all) | ||||
m.assign ("clim", octave_value (get_clim ())); | ||||
if (all) | if (all) | |||
m.assign ("xlim", octave_value (get_xlim ())); | m.assign ("xlim", octave_value (get_xlim ())); | |||
if (all) | if (all) | |||
m.assign ("ylim", octave_value (get_ylim ())); | m.assign ("ylim", octave_value (get_ylim ())); | |||
if (all) | if (all) | |||
m.assign ("zlim", octave_value (get_zlim ())); | m.assign ("zlim", octave_value (get_zlim ())); | |||
if (all) | if (all) | |||
m.assign ("clim", octave_value (get_clim ())); | m.assign ("aliminclude", octave_value (get_aliminclude ())); | |||
if (all) | if (all) | |||
m.assign ("alim", octave_value (get_alim ())); | m.assign ("climinclude", octave_value (get_climinclude ())); | |||
if (all) | if (all) | |||
m.assign ("xliminclude", octave_value (get_xliminclude ())); | m.assign ("xliminclude", octave_value (get_xliminclude ())); | |||
if (all) | if (all) | |||
m.assign ("yliminclude", octave_value (get_yliminclude ())); | m.assign ("yliminclude", octave_value (get_yliminclude ())); | |||
if (all) | if (all) | |||
m.assign ("zliminclude", octave_value (get_zliminclude ())); | m.assign ("zliminclude", octave_value (get_zliminclude ())); | |||
if (all) | ||||
m.assign ("climinclude", octave_value (get_climinclude ())); | ||||
if (all) | ||||
m.assign ("aliminclude", octave_value (get_aliminclude ())); | ||||
return m; | return m; | |||
} | } | |||
octave_value | octave_value | |||
surface::properties::get (const caseless_str& pname_arg) const | surface::properties::get (const caseless_str& pname_arg) const | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return retval; | return retval; | |||
if (pname.compare ("xdata")) | if (pname.compare ("alphadata")) | |||
retval = get_xdata (); | retval = get_alphadata (); | |||
else if (pname.compare ("ydata")) | else if (pname.compare ("alphadatamapping")) | |||
retval = get_ydata (); | retval = get_alphadatamapping (); | |||
else if (pname.compare ("zdata")) | else if (pname.compare ("ambientstrength")) | |||
retval = get_zdata (); | retval = get_ambientstrength (); | |||
else if (pname.compare ("backfacelighting")) | ||||
retval = get_backfacelighting (); | ||||
else if (pname.compare ("cdata")) | else if (pname.compare ("cdata")) | |||
retval = get_cdata (); | retval = get_cdata (); | |||
else if (pname.compare ("cdatamapping")) | else if (pname.compare ("cdatamapping")) | |||
retval = get_cdatamapping (); | retval = get_cdatamapping (); | |||
else if (pname.compare ("xdatasource")) | ||||
retval = get_xdatasource (); | ||||
else if (pname.compare ("ydatasource")) | ||||
retval = get_ydatasource (); | ||||
else if (pname.compare ("zdatasource")) | ||||
retval = get_zdatasource (); | ||||
else if (pname.compare ("cdatasource")) | else if (pname.compare ("cdatasource")) | |||
retval = get_cdatasource (); | retval = get_cdatasource (); | |||
else if (pname.compare ("facecolor")) | else if (pname.compare ("diffusestrength")) | |||
retval = get_facecolor (); | retval = get_diffusestrength (); | |||
else if (pname.compare ("facealpha")) | else if (pname.compare ("displayname")) | |||
retval = get_facealpha (); | retval = get_displayname (); | |||
else if (pname.compare ("edgealpha")) | ||||
retval = get_edgealpha (); | ||||
else if (pname.compare ("edgecolor")) | else if (pname.compare ("edgecolor")) | |||
retval = get_edgecolor (); | retval = get_edgecolor (); | |||
else if (pname.compare ("edgelighting")) | ||||
retval = get_edgelighting (); | ||||
else if (pname.compare ("erasemode")) | ||||
retval = get_erasemode (); | ||||
else if (pname.compare ("facealpha")) | ||||
retval = get_facealpha (); | ||||
else if (pname.compare ("facecolor")) | ||||
retval = get_facecolor (); | ||||
else if (pname.compare ("facelighting")) | ||||
retval = get_facelighting (); | ||||
else if (pname.compare ("interpreter")) | ||||
retval = get_interpreter (); | ||||
else if (pname.compare ("linestyle")) | else if (pname.compare ("linestyle")) | |||
retval = get_linestyle (); | retval = get_linestyle (); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
retval = get_linewidth (); | retval = get_linewidth (); | |||
else if (pname.compare ("marker")) | else if (pname.compare ("marker")) | |||
retval = get_marker (); | retval = get_marker (); | |||
else if (pname.compare ("markeredgecolor")) | else if (pname.compare ("markeredgecolor")) | |||
retval = get_markeredgecolor (); | retval = get_markeredgecolor (); | |||
else if (pname.compare ("markerfacecolor")) | else if (pname.compare ("markerfacecolor")) | |||
retval = get_markerfacecolor (); | retval = get_markerfacecolor (); | |||
else if (pname.compare ("markersize")) | else if (pname.compare ("markersize")) | |||
retval = get_markersize (); | retval = get_markersize (); | |||
else if (pname.compare ("interpreter")) | ||||
retval = get_interpreter (); | ||||
else if (pname.compare ("displayname")) | ||||
retval = get_displayname (); | ||||
else if (pname.compare ("alphadata")) | ||||
retval = get_alphadata (); | ||||
else if (pname.compare ("alphadatamapping")) | ||||
retval = get_alphadatamapping (); | ||||
else if (pname.compare ("ambientstrength")) | ||||
retval = get_ambientstrength (); | ||||
else if (pname.compare ("backfacelighting")) | ||||
retval = get_backfacelighting (); | ||||
else if (pname.compare ("diffusestrength")) | ||||
retval = get_diffusestrength (); | ||||
else if (pname.compare ("edgealpha")) | ||||
retval = get_edgealpha (); | ||||
else if (pname.compare ("edgelighting")) | ||||
retval = get_edgelighting (); | ||||
else if (pname.compare ("erasemode")) | ||||
retval = get_erasemode (); | ||||
else if (pname.compare ("facelighting")) | ||||
retval = get_facelighting (); | ||||
else if (pname.compare ("meshstyle")) | else if (pname.compare ("meshstyle")) | |||
retval = get_meshstyle (); | retval = get_meshstyle (); | |||
else if (pname.compare ("normalmode")) | else if (pname.compare ("normalmode")) | |||
retval = get_normalmode (); | retval = get_normalmode (); | |||
else if (pname.compare ("specularcolorreflectance")) | else if (pname.compare ("specularcolorreflectance")) | |||
retval = get_specularcolorreflectance (); | retval = get_specularcolorreflectance (); | |||
else if (pname.compare ("specularexponent")) | else if (pname.compare ("specularexponent")) | |||
retval = get_specularexponent (); | retval = get_specularexponent (); | |||
else if (pname.compare ("specularstrength")) | else if (pname.compare ("specularstrength")) | |||
retval = get_specularstrength (); | retval = get_specularstrength (); | |||
else if (pname.compare ("vertexnormals")) | else if (pname.compare ("vertexnormals")) | |||
retval = get_vertexnormals (); | retval = get_vertexnormals (); | |||
else if (pname.compare ("xdata")) | ||||
retval = get_xdata (); | ||||
else if (pname.compare ("xdatasource")) | ||||
retval = get_xdatasource (); | ||||
else if (pname.compare ("ydata")) | ||||
retval = get_ydata (); | ||||
else if (pname.compare ("ydatasource")) | ||||
retval = get_ydatasource (); | ||||
else if (pname.compare ("zdata")) | ||||
retval = get_zdata (); | ||||
else if (pname.compare ("zdatasource")) | ||||
retval = get_zdatasource (); | ||||
else if (pname.compare ("alim")) | ||||
retval = get_alim (); | ||||
else if (pname.compare ("clim")) | ||||
retval = get_clim (); | ||||
else if (pname.compare ("xlim")) | else if (pname.compare ("xlim")) | |||
retval = get_xlim (); | retval = get_xlim (); | |||
else if (pname.compare ("ylim")) | else if (pname.compare ("ylim")) | |||
retval = get_ylim (); | retval = get_ylim (); | |||
else if (pname.compare ("zlim")) | else if (pname.compare ("zlim")) | |||
retval = get_zlim (); | retval = get_zlim (); | |||
else if (pname.compare ("clim")) | else if (pname.compare ("aliminclude")) | |||
retval = get_clim (); | retval = get_aliminclude (); | |||
else if (pname.compare ("alim")) | else if (pname.compare ("climinclude")) | |||
retval = get_alim (); | retval = get_climinclude (); | |||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
retval = get_xliminclude (); | retval = get_xliminclude (); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
retval = get_yliminclude (); | retval = get_yliminclude (); | |||
else if (pname.compare ("zliminclude")) | else if (pname.compare ("zliminclude")) | |||
retval = get_zliminclude (); | retval = get_zliminclude (); | |||
else if (pname.compare ("climinclude")) | ||||
retval = get_climinclude (); | ||||
else if (pname.compare ("aliminclude")) | ||||
retval = get_aliminclude (); | ||||
else | else | |||
retval = base_properties::get (pname); | retval = base_properties::get (pname); | |||
return retval; | return retval; | |||
} | } | |||
property | property | |||
surface::properties::get_property (const caseless_str& pname_arg) | surface::properties::get_property (const caseless_str& pname_arg) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return property (); | return property (); | |||
if (pname.compare ("xdata")) | if (pname.compare ("alphadata")) | |||
return property (&xdata, true); | return property (&alphadata, true); | |||
else if (pname.compare ("ydata")) | else if (pname.compare ("alphadatamapping")) | |||
return property (&ydata, true); | return property (&alphadatamapping, true); | |||
else if (pname.compare ("zdata")) | else if (pname.compare ("ambientstrength")) | |||
return property (&zdata, true); | return property (&ambientstrength, true); | |||
else if (pname.compare ("backfacelighting")) | ||||
return property (&backfacelighting, true); | ||||
else if (pname.compare ("cdata")) | else if (pname.compare ("cdata")) | |||
return property (&cdata, true); | return property (&cdata, true); | |||
else if (pname.compare ("cdatamapping")) | else if (pname.compare ("cdatamapping")) | |||
return property (&cdatamapping, true); | return property (&cdatamapping, true); | |||
else if (pname.compare ("xdatasource")) | ||||
return property (&xdatasource, true); | ||||
else if (pname.compare ("ydatasource")) | ||||
return property (&ydatasource, true); | ||||
else if (pname.compare ("zdatasource")) | ||||
return property (&zdatasource, true); | ||||
else if (pname.compare ("cdatasource")) | else if (pname.compare ("cdatasource")) | |||
return property (&cdatasource, true); | return property (&cdatasource, true); | |||
else if (pname.compare ("facecolor")) | else if (pname.compare ("diffusestrength")) | |||
return property (&facecolor, true); | return property (&diffusestrength, true); | |||
else if (pname.compare ("facealpha")) | else if (pname.compare ("displayname")) | |||
return property (&facealpha, true); | return property (&displayname, true); | |||
else if (pname.compare ("edgealpha")) | ||||
return property (&edgealpha, true); | ||||
else if (pname.compare ("edgecolor")) | else if (pname.compare ("edgecolor")) | |||
return property (&edgecolor, true); | return property (&edgecolor, true); | |||
else if (pname.compare ("edgelighting")) | ||||
return property (&edgelighting, true); | ||||
else if (pname.compare ("erasemode")) | ||||
return property (&erasemode, true); | ||||
else if (pname.compare ("facealpha")) | ||||
return property (&facealpha, true); | ||||
else if (pname.compare ("facecolor")) | ||||
return property (&facecolor, true); | ||||
else if (pname.compare ("facelighting")) | ||||
return property (&facelighting, true); | ||||
else if (pname.compare ("interpreter")) | ||||
return property (&interpreter, true); | ||||
else if (pname.compare ("linestyle")) | else if (pname.compare ("linestyle")) | |||
return property (&linestyle, true); | return property (&linestyle, true); | |||
else if (pname.compare ("linewidth")) | else if (pname.compare ("linewidth")) | |||
return property (&linewidth, true); | return property (&linewidth, true); | |||
else if (pname.compare ("marker")) | else if (pname.compare ("marker")) | |||
return property (&marker, true); | return property (&marker, true); | |||
else if (pname.compare ("markeredgecolor")) | else if (pname.compare ("markeredgecolor")) | |||
return property (&markeredgecolor, true); | return property (&markeredgecolor, true); | |||
else if (pname.compare ("markerfacecolor")) | else if (pname.compare ("markerfacecolor")) | |||
return property (&markerfacecolor, true); | return property (&markerfacecolor, true); | |||
else if (pname.compare ("markersize")) | else if (pname.compare ("markersize")) | |||
return property (&markersize, true); | return property (&markersize, true); | |||
else if (pname.compare ("interpreter")) | ||||
return property (&interpreter, true); | ||||
else if (pname.compare ("displayname")) | ||||
return property (&displayname, true); | ||||
else if (pname.compare ("alphadata")) | ||||
return property (&alphadata, true); | ||||
else if (pname.compare ("alphadatamapping")) | ||||
return property (&alphadatamapping, true); | ||||
else if (pname.compare ("ambientstrength")) | ||||
return property (&ambientstrength, true); | ||||
else if (pname.compare ("backfacelighting")) | ||||
return property (&backfacelighting, true); | ||||
else if (pname.compare ("diffusestrength")) | ||||
return property (&diffusestrength, true); | ||||
else if (pname.compare ("edgealpha")) | ||||
return property (&edgealpha, true); | ||||
else if (pname.compare ("edgelighting")) | ||||
return property (&edgelighting, true); | ||||
else if (pname.compare ("erasemode")) | ||||
return property (&erasemode, true); | ||||
else if (pname.compare ("facelighting")) | ||||
return property (&facelighting, true); | ||||
else if (pname.compare ("meshstyle")) | else if (pname.compare ("meshstyle")) | |||
return property (&meshstyle, true); | return property (&meshstyle, true); | |||
else if (pname.compare ("normalmode")) | else if (pname.compare ("normalmode")) | |||
return property (&normalmode, true); | return property (&normalmode, true); | |||
else if (pname.compare ("specularcolorreflectance")) | else if (pname.compare ("specularcolorreflectance")) | |||
return property (&specularcolorreflectance, true); | return property (&specularcolorreflectance, true); | |||
else if (pname.compare ("specularexponent")) | else if (pname.compare ("specularexponent")) | |||
return property (&specularexponent, true); | return property (&specularexponent, true); | |||
else if (pname.compare ("specularstrength")) | else if (pname.compare ("specularstrength")) | |||
return property (&specularstrength, true); | return property (&specularstrength, true); | |||
else if (pname.compare ("vertexnormals")) | else if (pname.compare ("vertexnormals")) | |||
return property (&vertexnormals, true); | return property (&vertexnormals, true); | |||
else if (pname.compare ("xdata")) | ||||
return property (&xdata, true); | ||||
else if (pname.compare ("xdatasource")) | ||||
return property (&xdatasource, true); | ||||
else if (pname.compare ("ydata")) | ||||
return property (&ydata, true); | ||||
else if (pname.compare ("ydatasource")) | ||||
return property (&ydatasource, true); | ||||
else if (pname.compare ("zdata")) | ||||
return property (&zdata, true); | ||||
else if (pname.compare ("zdatasource")) | ||||
return property (&zdatasource, true); | ||||
else if (pname.compare ("alim")) | ||||
return property (&alim, true); | ||||
else if (pname.compare ("clim")) | ||||
return property (&clim, true); | ||||
else if (pname.compare ("xlim")) | else if (pname.compare ("xlim")) | |||
return property (&xlim, true); | return property (&xlim, true); | |||
else if (pname.compare ("ylim")) | else if (pname.compare ("ylim")) | |||
return property (&ylim, true); | return property (&ylim, true); | |||
else if (pname.compare ("zlim")) | else if (pname.compare ("zlim")) | |||
return property (&zlim, true); | return property (&zlim, true); | |||
else if (pname.compare ("clim")) | else if (pname.compare ("aliminclude")) | |||
return property (&clim, true); | return property (&aliminclude, true); | |||
else if (pname.compare ("alim")) | else if (pname.compare ("climinclude")) | |||
return property (&alim, true); | return property (&climinclude, true); | |||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
return property (&xliminclude, true); | return property (&xliminclude, true); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
return property (&yliminclude, true); | return property (&yliminclude, true); | |||
else if (pname.compare ("zliminclude")) | else if (pname.compare ("zliminclude")) | |||
return property (&zliminclude, true); | return property (&zliminclude, true); | |||
else if (pname.compare ("climinclude")) | ||||
return property (&climinclude, true); | ||||
else if (pname.compare ("aliminclude")) | ||||
return property (&aliminclude, true); | ||||
else | else | |||
return base_properties::get_property (pname); | return base_properties::get_property (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
surface::properties::factory_defaults (void) | surface::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["xdata"] = Matrix (); | ||||
m["ydata"] = Matrix (); | ||||
m["zdata"] = Matrix (); | ||||
m["cdata"] = Matrix (); | ||||
m["cdatamapping"] = "scaled"; | ||||
m["xdatasource"] = ""; | ||||
m["ydatasource"] = ""; | ||||
m["zdatasource"] = ""; | ||||
m["cdatasource"] = ""; | ||||
m["facecolor"] = "{flat}|none|interp|texturemap"; | ||||
m["facealpha"] = double_radio_property (1.0, radio_values ("flat|interp") | ||||
); | ||||
m["edgecolor"] = color_property (color_values (0, 0, 0), radio_values ("f | ||||
lat|none|interp")); | ||||
m["linestyle"] = "-"; | ||||
m["linewidth"] = 0.5; | ||||
m["marker"] = "none"; | ||||
m["markeredgecolor"] = "{auto}|none"; | ||||
m["markerfacecolor"] = "auto|{none}"; | ||||
m["markersize"] = 6; | ||||
m["interpreter"] = "tex"; | ||||
m["displayname"] = ""; | ||||
m["alphadata"] = Matrix (); | m["alphadata"] = Matrix (); | |||
m["alphadatamapping"] = "scaled"; | m["alphadatamapping"] = "scaled"; | |||
m["ambientstrength"] = 0.3; | m["ambientstrength"] = 0.3; | |||
m["backfacelighting"] = "reverselit"; | m["backfacelighting"] = "reverselit"; | |||
m["cdata"] = Matrix (); | ||||
m["cdatamapping"] = "scaled"; | ||||
m["cdatasource"] = ""; | ||||
m["diffusestrength"] = 0.6; | m["diffusestrength"] = 0.6; | |||
m["displayname"] = ""; | ||||
m["edgealpha"] = double_radio_property (1.0, radio_values ("flat|interp") ); | m["edgealpha"] = double_radio_property (1.0, radio_values ("flat|interp") ); | |||
m["edgecolor"] = color_property (color_values (0, 0, 0), radio_values ("n one|flat|interp")); | ||||
m["edgelighting"] = "none"; | m["edgelighting"] = "none"; | |||
m["erasemode"] = "normal"; | m["erasemode"] = "normal"; | |||
m["facealpha"] = double_radio_property (1.0, radio_values ("flat|interp|t | ||||
exturemap")); | ||||
m["facecolor"] = color_property (radio_values ("none|{flat}|interp|textur | ||||
emap"), color_values (0, 0, 0)); | ||||
m["facelighting"] = "none"; | m["facelighting"] = "none"; | |||
m["interpreter"] = "tex"; | ||||
m["linestyle"] = "-"; | ||||
m["linewidth"] = 0.5; | ||||
m["marker"] = "none"; | ||||
m["markeredgecolor"] = color_property (radio_values ("none|{auto}|flat"), | ||||
color_values (0, 0, 0)); | ||||
m["markerfacecolor"] = color_property (radio_values ("{none}|auto|flat"), | ||||
color_values (0, 0, 0)); | ||||
m["markersize"] = 6; | ||||
m["meshstyle"] = "both"; | m["meshstyle"] = "both"; | |||
m["normalmode"] = "auto"; | m["normalmode"] = "auto"; | |||
m["specularcolorreflectance"] = 1; | m["specularcolorreflectance"] = 1; | |||
m["specularexponent"] = 10; | m["specularexponent"] = 10; | |||
m["specularstrength"] = 0.9; | m["specularstrength"] = 0.9; | |||
m["vertexnormals"] = Matrix (); | m["vertexnormals"] = Matrix (); | |||
m["xdata"] = Matrix (); | ||||
m["xdatasource"] = ""; | ||||
m["ydata"] = Matrix (); | ||||
m["ydatasource"] = ""; | ||||
m["zdata"] = Matrix (); | ||||
m["zdatasource"] = ""; | ||||
m["alim"] = Matrix (); | ||||
m["clim"] = Matrix (); | ||||
m["xlim"] = Matrix (); | m["xlim"] = Matrix (); | |||
m["ylim"] = Matrix (); | m["ylim"] = Matrix (); | |||
m["zlim"] = Matrix (); | m["zlim"] = Matrix (); | |||
m["clim"] = Matrix (); | m["aliminclude"] = "on"; | |||
m["alim"] = Matrix (); | m["climinclude"] = "on"; | |||
m["xliminclude"] = "on"; | m["xliminclude"] = "on"; | |||
m["yliminclude"] = "on"; | m["yliminclude"] = "on"; | |||
m["zliminclude"] = "on"; | m["zliminclude"] = "on"; | |||
m["climinclude"] = "on"; | ||||
m["aliminclude"] = "on"; | ||||
return m; | return m; | |||
} | } | |||
std::string surface::properties::go_name ("surface"); | std::string surface::properties::go_name ("surface"); | |||
std::set<std::string> | std::set<std::string> | |||
surface::properties::core_property_names (void) | surface::properties::core_property_names (void) | |||
{ | { | |||
static std::set<std::string> all_pnames; | static std::set<std::string> all_pnames; | |||
static bool initialized = false; | static bool initialized = false; | |||
if (! initialized) | if (! initialized) | |||
{ | { | |||
all_pnames.insert ("xdata"); | all_pnames.insert ("alphadata"); | |||
all_pnames.insert ("ydata"); | all_pnames.insert ("alphadatamapping"); | |||
all_pnames.insert ("zdata"); | all_pnames.insert ("ambientstrength"); | |||
all_pnames.insert ("backfacelighting"); | ||||
all_pnames.insert ("cdata"); | all_pnames.insert ("cdata"); | |||
all_pnames.insert ("cdatamapping"); | all_pnames.insert ("cdatamapping"); | |||
all_pnames.insert ("xdatasource"); | ||||
all_pnames.insert ("ydatasource"); | ||||
all_pnames.insert ("zdatasource"); | ||||
all_pnames.insert ("cdatasource"); | all_pnames.insert ("cdatasource"); | |||
all_pnames.insert ("facecolor"); | all_pnames.insert ("diffusestrength"); | |||
all_pnames.insert ("facealpha"); | all_pnames.insert ("displayname"); | |||
all_pnames.insert ("edgealpha"); | ||||
all_pnames.insert ("edgecolor"); | all_pnames.insert ("edgecolor"); | |||
all_pnames.insert ("edgelighting"); | ||||
all_pnames.insert ("erasemode"); | ||||
all_pnames.insert ("facealpha"); | ||||
all_pnames.insert ("facecolor"); | ||||
all_pnames.insert ("facelighting"); | ||||
all_pnames.insert ("interpreter"); | ||||
all_pnames.insert ("linestyle"); | all_pnames.insert ("linestyle"); | |||
all_pnames.insert ("linewidth"); | all_pnames.insert ("linewidth"); | |||
all_pnames.insert ("marker"); | all_pnames.insert ("marker"); | |||
all_pnames.insert ("markeredgecolor"); | all_pnames.insert ("markeredgecolor"); | |||
all_pnames.insert ("markerfacecolor"); | all_pnames.insert ("markerfacecolor"); | |||
all_pnames.insert ("markersize"); | all_pnames.insert ("markersize"); | |||
all_pnames.insert ("interpreter"); | ||||
all_pnames.insert ("displayname"); | ||||
all_pnames.insert ("alphadata"); | ||||
all_pnames.insert ("alphadatamapping"); | ||||
all_pnames.insert ("ambientstrength"); | ||||
all_pnames.insert ("backfacelighting"); | ||||
all_pnames.insert ("diffusestrength"); | ||||
all_pnames.insert ("edgealpha"); | ||||
all_pnames.insert ("edgelighting"); | ||||
all_pnames.insert ("erasemode"); | ||||
all_pnames.insert ("facelighting"); | ||||
all_pnames.insert ("meshstyle"); | all_pnames.insert ("meshstyle"); | |||
all_pnames.insert ("normalmode"); | all_pnames.insert ("normalmode"); | |||
all_pnames.insert ("specularcolorreflectance"); | all_pnames.insert ("specularcolorreflectance"); | |||
all_pnames.insert ("specularexponent"); | all_pnames.insert ("specularexponent"); | |||
all_pnames.insert ("specularstrength"); | all_pnames.insert ("specularstrength"); | |||
all_pnames.insert ("vertexnormals"); | all_pnames.insert ("vertexnormals"); | |||
all_pnames.insert ("xdata"); | ||||
all_pnames.insert ("xdatasource"); | ||||
all_pnames.insert ("ydata"); | ||||
all_pnames.insert ("ydatasource"); | ||||
all_pnames.insert ("zdata"); | ||||
all_pnames.insert ("zdatasource"); | ||||
all_pnames.insert ("alim"); | ||||
all_pnames.insert ("clim"); | ||||
all_pnames.insert ("xlim"); | all_pnames.insert ("xlim"); | |||
all_pnames.insert ("ylim"); | all_pnames.insert ("ylim"); | |||
all_pnames.insert ("zlim"); | all_pnames.insert ("zlim"); | |||
all_pnames.insert ("clim"); | all_pnames.insert ("aliminclude"); | |||
all_pnames.insert ("alim"); | all_pnames.insert ("climinclude"); | |||
all_pnames.insert ("xliminclude"); | all_pnames.insert ("xliminclude"); | |||
all_pnames.insert ("yliminclude"); | all_pnames.insert ("yliminclude"); | |||
all_pnames.insert ("zliminclude"); | all_pnames.insert ("zliminclude"); | |||
all_pnames.insert ("climinclude"); | ||||
all_pnames.insert ("aliminclude"); | ||||
std::set<std::string> base_pnames = base_properties::core_property_na mes (); | std::set<std::string> base_pnames = base_properties::core_property_na mes (); | |||
all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | |||
initialized = true; | initialized = true; | |||
} | } | |||
return all_pnames; | return all_pnames; | |||
} | } | |||
skipping to change at line 4857 | skipping to change at line 4956 | |||
{ | { | |||
std::set<std::string> pnames = all_property_names (); | std::set<std::string> pnames = all_property_names (); | |||
return pnames.find (pname) != pnames.end (); | return pnames.find (pname) != pnames.end (); | |||
} | } | |||
// ******** hggroup ******** | // ******** hggroup ******** | |||
hggroup::properties::properties (const graphics_handle& mh, const graphics_ handle& p) | hggroup::properties::properties (const graphics_handle& mh, const graphics_ handle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
xlim ("xlim", mh, Matrix()), | displayname ("displayname", mh, ""), | |||
ylim ("ylim", mh, Matrix()), | erasemode ("erasemode", mh, "{normal}|none|xor|background"), | |||
zlim ("zlim", mh, Matrix()), | alim ("alim", mh, Matrix ()), | |||
clim ("clim", mh, Matrix()), | clim ("clim", mh, Matrix ()), | |||
alim ("alim", mh, Matrix()), | xlim ("xlim", mh, Matrix ()), | |||
ylim ("ylim", mh, Matrix ()), | ||||
zlim ("zlim", mh, Matrix ()), | ||||
aliminclude ("aliminclude", mh, "on"), | ||||
climinclude ("climinclude", mh, "on"), | ||||
xliminclude ("xliminclude", mh, "on"), | xliminclude ("xliminclude", mh, "on"), | |||
yliminclude ("yliminclude", mh, "on"), | yliminclude ("yliminclude", mh, "on"), | |||
zliminclude ("zliminclude", mh, "on"), | zliminclude ("zliminclude", mh, "on") | |||
climinclude ("climinclude", mh, "on"), | ||||
aliminclude ("aliminclude", mh, "on") | ||||
{ | { | |||
displayname.set_id (ID_DISPLAYNAME); | ||||
erasemode.set_id (ID_ERASEMODE); | ||||
alim.set_id (ID_ALIM); | ||||
alim.set_hidden (true); | ||||
clim.set_id (ID_CLIM); | ||||
clim.set_hidden (true); | ||||
xlim.set_id (ID_XLIM); | xlim.set_id (ID_XLIM); | |||
xlim.set_hidden (true); | xlim.set_hidden (true); | |||
ylim.set_id (ID_YLIM); | ylim.set_id (ID_YLIM); | |||
ylim.set_hidden (true); | ylim.set_hidden (true); | |||
zlim.set_id (ID_ZLIM); | zlim.set_id (ID_ZLIM); | |||
zlim.set_hidden (true); | zlim.set_hidden (true); | |||
clim.set_id (ID_CLIM); | aliminclude.set_id (ID_ALIMINCLUDE); | |||
clim.set_hidden (true); | aliminclude.set_hidden (true); | |||
alim.set_id (ID_ALIM); | climinclude.set_id (ID_CLIMINCLUDE); | |||
alim.set_hidden (true); | climinclude.set_hidden (true); | |||
xliminclude.set_id (ID_XLIMINCLUDE); | xliminclude.set_id (ID_XLIMINCLUDE); | |||
xliminclude.set_hidden (true); | xliminclude.set_hidden (true); | |||
yliminclude.set_id (ID_YLIMINCLUDE); | yliminclude.set_id (ID_YLIMINCLUDE); | |||
yliminclude.set_hidden (true); | yliminclude.set_hidden (true); | |||
zliminclude.set_id (ID_ZLIMINCLUDE); | zliminclude.set_id (ID_ZLIMINCLUDE); | |||
zliminclude.set_hidden (true); | zliminclude.set_hidden (true); | |||
climinclude.set_id (ID_CLIMINCLUDE); | ||||
climinclude.set_hidden (true); | ||||
aliminclude.set_id (ID_ALIMINCLUDE); | ||||
aliminclude.set_hidden (true); | ||||
init (); | init (); | |||
} | } | |||
void | void | |||
hggroup::properties::set (const caseless_str& pname_arg, const octave_value & val) | hggroup::properties::set (const caseless_str& pname_arg, const octave_value & val) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return; | return; | |||
if (pname.compare ("xliminclude")) | if (pname.compare ("displayname")) | |||
set_displayname (val); | ||||
else if (pname.compare ("erasemode")) | ||||
set_erasemode (val); | ||||
else if (pname.compare ("aliminclude")) | ||||
set_aliminclude (val); | ||||
else if (pname.compare ("climinclude")) | ||||
set_climinclude (val); | ||||
else if (pname.compare ("xliminclude")) | ||||
set_xliminclude (val); | set_xliminclude (val); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
set_yliminclude (val); | set_yliminclude (val); | |||
else if (pname.compare ("zliminclude")) | else if (pname.compare ("zliminclude")) | |||
set_zliminclude (val); | set_zliminclude (val); | |||
else if (pname.compare ("climinclude")) | ||||
set_climinclude (val); | ||||
else if (pname.compare ("aliminclude")) | ||||
set_aliminclude (val); | ||||
else | else | |||
base_properties::set (pname, val); | base_properties::set (pname, val); | |||
} | } | |||
octave_value | octave_value | |||
hggroup::properties::get (bool all) const | hggroup::properties::get (bool all) const | |||
{ | { | |||
octave_map m = base_properties::get (all).map_value (); | octave_map m = base_properties::get (all).map_value (); | |||
m.assign ("displayname", octave_value (get_displayname ())); | ||||
m.assign ("erasemode", octave_value (get_erasemode ())); | ||||
if (all) | ||||
m.assign ("alim", octave_value (get_alim ())); | ||||
if (all) | ||||
m.assign ("clim", octave_value (get_clim ())); | ||||
if (all) | if (all) | |||
m.assign ("xlim", octave_value (get_xlim ())); | m.assign ("xlim", octave_value (get_xlim ())); | |||
if (all) | if (all) | |||
m.assign ("ylim", octave_value (get_ylim ())); | m.assign ("ylim", octave_value (get_ylim ())); | |||
if (all) | if (all) | |||
m.assign ("zlim", octave_value (get_zlim ())); | m.assign ("zlim", octave_value (get_zlim ())); | |||
if (all) | if (all) | |||
m.assign ("clim", octave_value (get_clim ())); | m.assign ("aliminclude", octave_value (get_aliminclude ())); | |||
if (all) | if (all) | |||
m.assign ("alim", octave_value (get_alim ())); | m.assign ("climinclude", octave_value (get_climinclude ())); | |||
if (all) | if (all) | |||
m.assign ("xliminclude", octave_value (get_xliminclude ())); | m.assign ("xliminclude", octave_value (get_xliminclude ())); | |||
if (all) | if (all) | |||
m.assign ("yliminclude", octave_value (get_yliminclude ())); | m.assign ("yliminclude", octave_value (get_yliminclude ())); | |||
if (all) | if (all) | |||
m.assign ("zliminclude", octave_value (get_zliminclude ())); | m.assign ("zliminclude", octave_value (get_zliminclude ())); | |||
if (all) | ||||
m.assign ("climinclude", octave_value (get_climinclude ())); | ||||
if (all) | ||||
m.assign ("aliminclude", octave_value (get_aliminclude ())); | ||||
return m; | return m; | |||
} | } | |||
octave_value | octave_value | |||
hggroup::properties::get (const caseless_str& pname_arg) const | hggroup::properties::get (const caseless_str& pname_arg) const | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return retval; | return retval; | |||
if (pname.compare ("xlim")) | if (pname.compare ("displayname")) | |||
retval = get_displayname (); | ||||
else if (pname.compare ("erasemode")) | ||||
retval = get_erasemode (); | ||||
else if (pname.compare ("alim")) | ||||
retval = get_alim (); | ||||
else if (pname.compare ("clim")) | ||||
retval = get_clim (); | ||||
else if (pname.compare ("xlim")) | ||||
retval = get_xlim (); | retval = get_xlim (); | |||
else if (pname.compare ("ylim")) | else if (pname.compare ("ylim")) | |||
retval = get_ylim (); | retval = get_ylim (); | |||
else if (pname.compare ("zlim")) | else if (pname.compare ("zlim")) | |||
retval = get_zlim (); | retval = get_zlim (); | |||
else if (pname.compare ("clim")) | else if (pname.compare ("aliminclude")) | |||
retval = get_clim (); | retval = get_aliminclude (); | |||
else if (pname.compare ("alim")) | else if (pname.compare ("climinclude")) | |||
retval = get_alim (); | retval = get_climinclude (); | |||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
retval = get_xliminclude (); | retval = get_xliminclude (); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
retval = get_yliminclude (); | retval = get_yliminclude (); | |||
else if (pname.compare ("zliminclude")) | else if (pname.compare ("zliminclude")) | |||
retval = get_zliminclude (); | retval = get_zliminclude (); | |||
else if (pname.compare ("climinclude")) | ||||
retval = get_climinclude (); | ||||
else if (pname.compare ("aliminclude")) | ||||
retval = get_aliminclude (); | ||||
else | else | |||
retval = base_properties::get (pname); | retval = base_properties::get (pname); | |||
return retval; | return retval; | |||
} | } | |||
property | property | |||
hggroup::properties::get_property (const caseless_str& pname_arg) | hggroup::properties::get_property (const caseless_str& pname_arg) | |||
{ | { | |||
const std::set<std::string>& pnames = all_property_names (); | const std::set<std::string>& pnames = all_property_names (); | |||
caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | caseless_str pname = validate_property_name ("get", go_name, pnames, pnam e_arg); | |||
if (error_state) | if (error_state) | |||
return property (); | return property (); | |||
if (pname.compare ("xlim")) | if (pname.compare ("displayname")) | |||
return property (&displayname, true); | ||||
else if (pname.compare ("erasemode")) | ||||
return property (&erasemode, true); | ||||
else if (pname.compare ("alim")) | ||||
return property (&alim, true); | ||||
else if (pname.compare ("clim")) | ||||
return property (&clim, true); | ||||
else if (pname.compare ("xlim")) | ||||
return property (&xlim, true); | return property (&xlim, true); | |||
else if (pname.compare ("ylim")) | else if (pname.compare ("ylim")) | |||
return property (&ylim, true); | return property (&ylim, true); | |||
else if (pname.compare ("zlim")) | else if (pname.compare ("zlim")) | |||
return property (&zlim, true); | return property (&zlim, true); | |||
else if (pname.compare ("clim")) | else if (pname.compare ("aliminclude")) | |||
return property (&clim, true); | return property (&aliminclude, true); | |||
else if (pname.compare ("alim")) | else if (pname.compare ("climinclude")) | |||
return property (&alim, true); | return property (&climinclude, true); | |||
else if (pname.compare ("xliminclude")) | else if (pname.compare ("xliminclude")) | |||
return property (&xliminclude, true); | return property (&xliminclude, true); | |||
else if (pname.compare ("yliminclude")) | else if (pname.compare ("yliminclude")) | |||
return property (&yliminclude, true); | return property (&yliminclude, true); | |||
else if (pname.compare ("zliminclude")) | else if (pname.compare ("zliminclude")) | |||
return property (&zliminclude, true); | return property (&zliminclude, true); | |||
else if (pname.compare ("climinclude")) | ||||
return property (&climinclude, true); | ||||
else if (pname.compare ("aliminclude")) | ||||
return property (&aliminclude, true); | ||||
else | else | |||
return base_properties::get_property (pname); | return base_properties::get_property (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
hggroup::properties::factory_defaults (void) | hggroup::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["xlim"] = Matrix(); | m["displayname"] = ""; | |||
m["ylim"] = Matrix(); | m["erasemode"] = "normal"; | |||
m["zlim"] = Matrix(); | m["alim"] = Matrix (); | |||
m["clim"] = Matrix(); | m["clim"] = Matrix (); | |||
m["alim"] = Matrix(); | m["xlim"] = Matrix (); | |||
m["ylim"] = Matrix (); | ||||
m["zlim"] = Matrix (); | ||||
m["aliminclude"] = "on"; | ||||
m["climinclude"] = "on"; | ||||
m["xliminclude"] = "on"; | m["xliminclude"] = "on"; | |||
m["yliminclude"] = "on"; | m["yliminclude"] = "on"; | |||
m["zliminclude"] = "on"; | m["zliminclude"] = "on"; | |||
m["climinclude"] = "on"; | ||||
m["aliminclude"] = "on"; | ||||
return m; | return m; | |||
} | } | |||
std::string hggroup::properties::go_name ("hggroup"); | std::string hggroup::properties::go_name ("hggroup"); | |||
std::set<std::string> | std::set<std::string> | |||
hggroup::properties::core_property_names (void) | hggroup::properties::core_property_names (void) | |||
{ | { | |||
static std::set<std::string> all_pnames; | static std::set<std::string> all_pnames; | |||
static bool initialized = false; | static bool initialized = false; | |||
if (! initialized) | if (! initialized) | |||
{ | { | |||
all_pnames.insert ("displayname"); | ||||
all_pnames.insert ("erasemode"); | ||||
all_pnames.insert ("alim"); | ||||
all_pnames.insert ("clim"); | ||||
all_pnames.insert ("xlim"); | all_pnames.insert ("xlim"); | |||
all_pnames.insert ("ylim"); | all_pnames.insert ("ylim"); | |||
all_pnames.insert ("zlim"); | all_pnames.insert ("zlim"); | |||
all_pnames.insert ("clim"); | all_pnames.insert ("aliminclude"); | |||
all_pnames.insert ("alim"); | all_pnames.insert ("climinclude"); | |||
all_pnames.insert ("xliminclude"); | all_pnames.insert ("xliminclude"); | |||
all_pnames.insert ("yliminclude"); | all_pnames.insert ("yliminclude"); | |||
all_pnames.insert ("zliminclude"); | all_pnames.insert ("zliminclude"); | |||
all_pnames.insert ("climinclude"); | ||||
all_pnames.insert ("aliminclude"); | ||||
std::set<std::string> base_pnames = base_properties::core_property_na mes (); | std::set<std::string> base_pnames = base_properties::core_property_na mes (); | |||
all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | all_pnames.insert (base_pnames.begin (), base_pnames.end ()); | |||
initialized = true; | initialized = true; | |||
} | } | |||
return all_pnames; | return all_pnames; | |||
} | } | |||
skipping to change at line 5100 | skipping to change at line 5221 | |||
return pnames.find (pname) != pnames.end (); | return pnames.find (pname) != pnames.end (); | |||
} | } | |||
// ******** uimenu ******** | // ******** uimenu ******** | |||
uimenu::properties::properties (const graphics_handle& mh, const graphics_h andle& p) | uimenu::properties::properties (const graphics_handle& mh, const graphics_h andle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
__object__ ("__object__", mh, Matrix ()), | __object__ ("__object__", mh, Matrix ()), | |||
accelerator ("accelerator", mh, ""), | accelerator ("accelerator", mh, ""), | |||
callback ("callback", mh, Matrix()), | callback ("callback", mh, Matrix ()), | |||
checked ("checked", mh, "off"), | checked ("checked", mh, "off"), | |||
enable ("enable", mh, "on"), | enable ("enable", mh, "on"), | |||
foregroundcolor ("foregroundcolor", mh, color_values (0, 0, 0)), | foregroundcolor ("foregroundcolor", mh, color_values (0, 0, 0)), | |||
label ("label", mh, ""), | label ("label", mh, ""), | |||
position ("position", mh, 9), | position ("position", mh, 9), | |||
separator ("separator", mh, "off"), | separator ("separator", mh, "off"), | |||
fltk_label ("fltk_label", mh, "") | fltk_label ("fltk_label", mh, "") | |||
{ | { | |||
__object__.set_id (ID___OBJECT__); | __object__.set_id (ID___OBJECT__); | |||
accelerator.set_id (ID_ACCELERATOR); | accelerator.set_id (ID_ACCELERATOR); | |||
skipping to change at line 5256 | skipping to change at line 5377 | |||
return base_properties::get_property (pname); | return base_properties::get_property (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
uimenu::properties::factory_defaults (void) | uimenu::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["__object__"] = Matrix (); | m["__object__"] = Matrix (); | |||
m["accelerator"] = ""; | m["accelerator"] = ""; | |||
m["callback"] = Matrix(); | m["callback"] = Matrix (); | |||
m["checked"] = "off"; | m["checked"] = "off"; | |||
m["enable"] = "on"; | m["enable"] = "on"; | |||
m["foregroundcolor"] = color_values (0, 0, 0); | m["foregroundcolor"] = color_values (0, 0, 0); | |||
m["label"] = ""; | m["label"] = ""; | |||
m["position"] = 9; | m["position"] = 9; | |||
m["separator"] = "off"; | m["separator"] = "off"; | |||
m["fltk_label"] = ""; | m["fltk_label"] = ""; | |||
return m; | return m; | |||
} | } | |||
skipping to change at line 5332 | skipping to change at line 5453 | |||
std::set<std::string> pnames = all_property_names (); | std::set<std::string> pnames = all_property_names (); | |||
return pnames.find (pname) != pnames.end (); | return pnames.find (pname) != pnames.end (); | |||
} | } | |||
// ******** uicontextmenu ******** | // ******** uicontextmenu ******** | |||
uicontextmenu::properties::properties (const graphics_handle& mh, const gra phics_handle& p) | uicontextmenu::properties::properties (const graphics_handle& mh, const gra phics_handle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
__object__ ("__object__", mh, Matrix ()), | __object__ ("__object__", mh, Matrix ()), | |||
callback ("callback", mh, Matrix()), | callback ("callback", mh, Matrix ()), | |||
position ("position", mh, Matrix (1, 2, 0.0)) | position ("position", mh, Matrix (1, 2, 0.0)) | |||
{ | { | |||
__object__.set_id (ID___OBJECT__); | __object__.set_id (ID___OBJECT__); | |||
callback.set_id (ID_CALLBACK); | callback.set_id (ID_CALLBACK); | |||
position.set_id (ID_POSITION); | position.set_id (ID_POSITION); | |||
init (); | init (); | |||
} | } | |||
void | void | |||
uicontextmenu::properties::set (const caseless_str& pname_arg, const octave _value& val) | uicontextmenu::properties::set (const caseless_str& pname_arg, const octave _value& val) | |||
skipping to change at line 5423 | skipping to change at line 5544 | |||
else | else | |||
return base_properties::get_property (pname); | return base_properties::get_property (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
uicontextmenu::properties::factory_defaults (void) | uicontextmenu::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["__object__"] = Matrix (); | m["__object__"] = Matrix (); | |||
m["callback"] = Matrix(); | m["callback"] = Matrix (); | |||
m["position"] = Matrix (1, 2, 0.0); | m["position"] = Matrix (1, 2, 0.0); | |||
return m; | return m; | |||
} | } | |||
std::string uicontextmenu::properties::go_name ("uicontextmenu"); | std::string uicontextmenu::properties::go_name ("uicontextmenu"); | |||
std::set<std::string> | std::set<std::string> | |||
uicontextmenu::properties::core_property_names (void) | uicontextmenu::properties::core_property_names (void) | |||
{ | { | |||
skipping to change at line 5498 | skipping to change at line 5619 | |||
cdata ("cdata", mh, Matrix ()), | cdata ("cdata", mh, Matrix ()), | |||
clipping ("clipping", mh, "on"), | clipping ("clipping", mh, "on"), | |||
enable ("enable", mh, "{on}|inactive|off"), | enable ("enable", mh, "{on}|inactive|off"), | |||
extent ("extent", mh, Matrix (1, 4, 0.0)), | extent ("extent", mh, Matrix (1, 4, 0.0)), | |||
fontangle ("fontangle", mh, "{normal}|italic|oblique"), | fontangle ("fontangle", mh, "{normal}|italic|oblique"), | |||
fontname ("fontname", mh, OCTAVE_DEFAULT_FONTNAME), | fontname ("fontname", mh, OCTAVE_DEFAULT_FONTNAME), | |||
fontsize ("fontsize", mh, 10), | fontsize ("fontsize", mh, 10), | |||
fontunits ("fontunits", mh, "inches|centimeters|normalized|{points}|pix els"), | fontunits ("fontunits", mh, "inches|centimeters|normalized|{points}|pix els"), | |||
fontweight ("fontweight", mh, "light|{normal}|demi|bold"), | fontweight ("fontweight", mh, "light|{normal}|demi|bold"), | |||
foregroundcolor ("foregroundcolor", mh, color_values (0, 0, 0)), | foregroundcolor ("foregroundcolor", mh, color_values (0, 0, 0)), | |||
horizontalalignment ("horizontalalignment", mh, "{left}|center|right"), | horizontalalignment ("horizontalalignment", mh, "left|{center}|right"), | |||
keypressfcn ("keypressfcn", mh, Matrix ()), | keypressfcn ("keypressfcn", mh, Matrix ()), | |||
listboxtop ("listboxtop", mh, 1), | listboxtop ("listboxtop", mh, 1), | |||
max ("max", mh, 1), | max ("max", mh, 1), | |||
min ("min", mh, 0), | min ("min", mh, 0), | |||
position ("position", mh, default_control_position ()), | position ("position", mh, default_control_position ()), | |||
sliderstep ("sliderstep", mh, default_control_sliderstep ()), | sliderstep ("sliderstep", mh, default_control_sliderstep ()), | |||
string ("string", mh, ""), | string ("string", mh, ""), | |||
style ("style", mh, "{pushbutton}|togglebutton|radiobutton|checkbox|edi t|text|slider|frame|listbox|popupmenu"), | style ("style", mh, "{pushbutton}|togglebutton|radiobutton|checkbox|edi t|text|slider|frame|listbox|popupmenu"), | |||
tooltipstring ("tooltipstring", mh, ""), | tooltipstring ("tooltipstring", mh, ""), | |||
units ("units", mh, "normalized|inches|centimeters|points|{pixels}|char acters"), | units ("units", mh, "normalized|inches|centimeters|points|{pixels}|char acters"), | |||
skipping to change at line 5794 | skipping to change at line 5915 | |||
m["cdata"] = Matrix (); | m["cdata"] = Matrix (); | |||
m["clipping"] = "on"; | m["clipping"] = "on"; | |||
m["enable"] = "on"; | m["enable"] = "on"; | |||
m["extent"] = Matrix (1, 4, 0.0); | m["extent"] = Matrix (1, 4, 0.0); | |||
m["fontangle"] = "normal"; | m["fontangle"] = "normal"; | |||
m["fontname"] = OCTAVE_DEFAULT_FONTNAME; | m["fontname"] = OCTAVE_DEFAULT_FONTNAME; | |||
m["fontsize"] = 10; | m["fontsize"] = 10; | |||
m["fontunits"] = "points"; | m["fontunits"] = "points"; | |||
m["fontweight"] = "normal"; | m["fontweight"] = "normal"; | |||
m["foregroundcolor"] = color_values (0, 0, 0); | m["foregroundcolor"] = color_values (0, 0, 0); | |||
m["horizontalalignment"] = "left"; | m["horizontalalignment"] = "center"; | |||
m["keypressfcn"] = Matrix (); | m["keypressfcn"] = Matrix (); | |||
m["listboxtop"] = 1; | m["listboxtop"] = 1; | |||
m["max"] = 1; | m["max"] = 1; | |||
m["min"] = 0; | m["min"] = 0; | |||
m["position"] = default_control_position (); | m["position"] = default_control_position (); | |||
m["sliderstep"] = default_control_sliderstep (); | m["sliderstep"] = default_control_sliderstep (); | |||
m["string"] = ""; | m["string"] = ""; | |||
m["style"] = "pushbutton"; | m["style"] = "pushbutton"; | |||
m["tooltipstring"] = ""; | m["tooltipstring"] = ""; | |||
m["units"] = "pixels"; | m["units"] = "pixels"; | |||
skipping to change at line 6332 | skipping to change at line 6453 | |||
return pnames.find (pname) != pnames.end (); | return pnames.find (pname) != pnames.end (); | |||
} | } | |||
// ******** uipushtool ******** | // ******** uipushtool ******** | |||
uipushtool::properties::properties (const graphics_handle& mh, const graphi cs_handle& p) | uipushtool::properties::properties (const graphics_handle& mh, const graphi cs_handle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
__object__ ("__object__", mh, Matrix ()), | __object__ ("__object__", mh, Matrix ()), | |||
cdata ("cdata", mh, Matrix ()), | cdata ("cdata", mh, Matrix ()), | |||
clickedcallback ("clickedcallback", mh, Matrix()), | clickedcallback ("clickedcallback", mh, Matrix ()), | |||
enable ("enable", mh, "on"), | enable ("enable", mh, "on"), | |||
separator ("separator", mh, "off"), | separator ("separator", mh, "off"), | |||
tooltipstring ("tooltipstring", mh, "") | tooltipstring ("tooltipstring", mh, "") | |||
{ | { | |||
__object__.set_id (ID___OBJECT__); | __object__.set_id (ID___OBJECT__); | |||
cdata.set_id (ID_CDATA); | cdata.set_id (ID_CDATA); | |||
clickedcallback.set_id (ID_CLICKEDCALLBACK); | clickedcallback.set_id (ID_CLICKEDCALLBACK); | |||
enable.set_id (ID_ENABLE); | enable.set_id (ID_ENABLE); | |||
separator.set_id (ID_SEPARATOR); | separator.set_id (ID_SEPARATOR); | |||
tooltipstring.set_id (ID_TOOLTIPSTRING); | tooltipstring.set_id (ID_TOOLTIPSTRING); | |||
skipping to change at line 6450 | skipping to change at line 6571 | |||
return base_properties::get_property (pname); | return base_properties::get_property (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
uipushtool::properties::factory_defaults (void) | uipushtool::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["__object__"] = Matrix (); | m["__object__"] = Matrix (); | |||
m["cdata"] = Matrix (); | m["cdata"] = Matrix (); | |||
m["clickedcallback"] = Matrix(); | m["clickedcallback"] = Matrix (); | |||
m["enable"] = "on"; | m["enable"] = "on"; | |||
m["separator"] = "off"; | m["separator"] = "off"; | |||
m["tooltipstring"] = ""; | m["tooltipstring"] = ""; | |||
return m; | return m; | |||
} | } | |||
std::string uipushtool::properties::go_name ("uipushtool"); | std::string uipushtool::properties::go_name ("uipushtool"); | |||
std::set<std::string> | std::set<std::string> | |||
skipping to change at line 6519 | skipping to change at line 6640 | |||
return pnames.find (pname) != pnames.end (); | return pnames.find (pname) != pnames.end (); | |||
} | } | |||
// ******** uitoggletool ******** | // ******** uitoggletool ******** | |||
uitoggletool::properties::properties (const graphics_handle& mh, const grap hics_handle& p) | uitoggletool::properties::properties (const graphics_handle& mh, const grap hics_handle& p) | |||
: base_properties (go_name, mh, p), | : base_properties (go_name, mh, p), | |||
__object__ ("__object__", mh, Matrix ()), | __object__ ("__object__", mh, Matrix ()), | |||
cdata ("cdata", mh, Matrix ()), | cdata ("cdata", mh, Matrix ()), | |||
clickedcallback ("clickedcallback", mh, Matrix()), | clickedcallback ("clickedcallback", mh, Matrix ()), | |||
enable ("enable", mh, "on"), | enable ("enable", mh, "on"), | |||
offcallback ("offcallback", mh, Matrix()), | offcallback ("offcallback", mh, Matrix ()), | |||
oncallback ("oncallback", mh, Matrix()), | oncallback ("oncallback", mh, Matrix ()), | |||
separator ("separator", mh, "off"), | separator ("separator", mh, "off"), | |||
state ("state", mh, "off"), | state ("state", mh, "off"), | |||
tooltipstring ("tooltipstring", mh, "") | tooltipstring ("tooltipstring", mh, "") | |||
{ | { | |||
__object__.set_id (ID___OBJECT__); | __object__.set_id (ID___OBJECT__); | |||
cdata.set_id (ID_CDATA); | cdata.set_id (ID_CDATA); | |||
clickedcallback.set_id (ID_CLICKEDCALLBACK); | clickedcallback.set_id (ID_CLICKEDCALLBACK); | |||
enable.set_id (ID_ENABLE); | enable.set_id (ID_ENABLE); | |||
offcallback.set_id (ID_OFFCALLBACK); | offcallback.set_id (ID_OFFCALLBACK); | |||
oncallback.set_id (ID_ONCALLBACK); | oncallback.set_id (ID_ONCALLBACK); | |||
skipping to change at line 6664 | skipping to change at line 6785 | |||
return base_properties::get_property (pname); | return base_properties::get_property (pname); | |||
} | } | |||
property_list::pval_map_type | property_list::pval_map_type | |||
uitoggletool::properties::factory_defaults (void) | uitoggletool::properties::factory_defaults (void) | |||
{ | { | |||
property_list::pval_map_type m = base_properties::factory_defaults (); | property_list::pval_map_type m = base_properties::factory_defaults (); | |||
m["__object__"] = Matrix (); | m["__object__"] = Matrix (); | |||
m["cdata"] = Matrix (); | m["cdata"] = Matrix (); | |||
m["clickedcallback"] = Matrix(); | m["clickedcallback"] = Matrix (); | |||
m["enable"] = "on"; | m["enable"] = "on"; | |||
m["offcallback"] = Matrix(); | m["offcallback"] = Matrix (); | |||
m["oncallback"] = Matrix(); | m["oncallback"] = Matrix (); | |||
m["separator"] = "off"; | m["separator"] = "off"; | |||
m["state"] = "off"; | m["state"] = "off"; | |||
m["tooltipstring"] = ""; | m["tooltipstring"] = ""; | |||
return m; | return m; | |||
} | } | |||
std::string uitoggletool::properties::go_name ("uitoggletool"); | std::string uitoggletool::properties::go_name ("uitoggletool"); | |||
std::set<std::string> | std::set<std::string> | |||
End of changes. 490 change blocks. | ||||
1820 lines changed or deleted | 1958 lines changed or added | |||
graphics.h | graphics.h | |||
---|---|---|---|---|
// DO NOT EDIT! Generated automatically by genprops.awk. | // DO NOT EDIT! Generated automatically by genprops.awk. | |||
/* | /* | |||
Copyright (C) 2007-2012 John W. Eaton | Copyright (C) 2007-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (graphics_h) | #if !defined (octave_graphics_h) | |||
#define graphics_h 1 | #define octave_graphics_h 1 | |||
#ifdef HAVE_CONFIG_H | #ifdef HAVE_CONFIG_H | |||
#include <config.h> | #include <config.h> | |||
#endif | #endif | |||
#include <cctype> | #include <cctype> | |||
#include <algorithm> | #include <algorithm> | |||
#include <list> | #include <list> | |||
#include <map> | #include <map> | |||
#include <set> | #include <set> | |||
#include <sstream> | #include <sstream> | |||
#include <string> | #include <string> | |||
#include "caseless-str.h" | #include "caseless-str.h" | |||
#include "lo-ieee.h" | ||||
#include "gripes.h" | #include "gripes.h" | |||
#include "oct-handle.h" | ||||
#include "oct-map.h" | #include "oct-map.h" | |||
#include "oct-mutex.h" | #include "oct-mutex.h" | |||
#include "oct-refcount.h" | #include "oct-refcount.h" | |||
#include "ov.h" | #include "ov.h" | |||
#include "txt-eng-ft.h" | #include "txt-eng-ft.h" | |||
// FIXME -- maybe this should be a configure option? | // FIXME: maybe this should be a configure option? | |||
// Matlab defaults to "Helvetica", but that causes problems for many | // Matlab defaults to "Helvetica", but that causes problems for many | |||
// gnuplot users. | // gnuplot users. | |||
#if !defined (OCTAVE_DEFAULT_FONTNAME) | #if !defined (OCTAVE_DEFAULT_FONTNAME) | |||
#define OCTAVE_DEFAULT_FONTNAME "*" | #define OCTAVE_DEFAULT_FONTNAME "*" | |||
#endif | #endif | |||
// --------------------------------------------------------------------- | typedef octave_handle graphics_handle; | |||
class graphics_handle | ||||
{ | ||||
public: | ||||
graphics_handle (void) : val (octave_NaN) { } | ||||
graphics_handle (const octave_value& a); | ||||
graphics_handle (int a) : val (a) { } | ||||
graphics_handle (double a) : val (a) { } | ||||
graphics_handle (const graphics_handle& a) : val (a.val) { } | ||||
graphics_handle& operator = (const graphics_handle& a) | ||||
{ | ||||
if (&a != this) | ||||
val = a.val; | ||||
return *this; | ||||
} | ||||
~graphics_handle (void) { } | ||||
double value (void) const { return val; } | ||||
octave_value as_octave_value (void) const | ||||
{ | ||||
return ok () ? octave_value (val) : octave_value (Matrix ()); | ||||
} | ||||
// Prefix increment/decrement operators. | ||||
graphics_handle& operator ++ (void) | ||||
{ | ||||
++val; | ||||
return *this; | ||||
} | ||||
graphics_handle& operator -- (void) | ||||
{ | ||||
--val; | ||||
return *this; | ||||
} | ||||
// Postfix increment/decrement operators. | ||||
const graphics_handle operator ++ (int) | ||||
{ | ||||
graphics_handle old_value = *this; | ||||
++(*this); | ||||
return old_value; | ||||
} | ||||
const graphics_handle operator -- (int) | ||||
{ | ||||
graphics_handle old_value = *this; | ||||
--(*this); | ||||
return old_value; | ||||
} | ||||
bool ok (void) const { return ! xisnan (val); } | ||||
private: | ||||
double val; | ||||
}; | ||||
inline bool | ||||
operator == (const graphics_handle& a, const graphics_handle& b) | ||||
{ | ||||
return a.value () == b.value (); | ||||
} | ||||
inline bool | ||||
operator != (const graphics_handle& a, const graphics_handle& b) | ||||
{ | ||||
return a.value () != b.value (); | ||||
} | ||||
inline bool | ||||
operator < (const graphics_handle& a, const graphics_handle& b) | ||||
{ | ||||
return a.value () < b.value (); | ||||
} | ||||
inline bool | ||||
operator <= (const graphics_handle& a, const graphics_handle& b) | ||||
{ | ||||
return a.value () <= b.value (); | ||||
} | ||||
inline bool | ||||
operator >= (const graphics_handle& a, const graphics_handle& b) | ||||
{ | ||||
return a.value () >= b.value (); | ||||
} | ||||
inline bool | ||||
operator > (const graphics_handle& a, const graphics_handle& b) | ||||
{ | ||||
return a.value () > b.value (); | ||||
} | ||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class base_scaler | class base_scaler | |||
{ | { | |||
public: | public: | |||
base_scaler (void) { } | base_scaler (void) { } | |||
virtual ~base_scaler (void) { } | virtual ~base_scaler (void) { } | |||
virtual Matrix scale (const Matrix& m) const | virtual Matrix scale (const Matrix& m) const | |||
{ | { | |||
error ("invalid axis scale"); | error ("invalid axis scale"); | |||
return m; | return m; | |||
} | } | |||
virtual NDArray scale (const NDArray& m) const | virtual NDArray scale (const NDArray& m) const | |||
{ | { | |||
error ("invalid axis scale"); | error ("invalid axis scale"); | |||
return m; | return m; | |||
} | } | |||
virtual double scale (double d) const | virtual double scale (double d) const | |||
{ | { | |||
error ("invalid axis scale"); | error ("invalid axis scale"); | |||
return d; | return d; | |||
} | } | |||
virtual double unscale (double d) const | virtual double unscale (double d) const | |||
{ | { | |||
error ("invalid axis scale"); | error ("invalid axis scale"); | |||
return d; | return d; | |||
} | } | |||
virtual base_scaler* clone () const | virtual base_scaler* clone () const | |||
{ return new base_scaler (); } | { return new base_scaler (); } | |||
virtual bool is_linear (void) const | virtual bool is_linear (void) const | |||
{ return false; } | { return false; } | |||
}; | }; | |||
class lin_scaler : public base_scaler | class lin_scaler : public base_scaler | |||
{ | { | |||
public: | public: | |||
lin_scaler (void) { } | lin_scaler (void) { } | |||
Matrix scale (const Matrix& m) const { return m; } | Matrix scale (const Matrix& m) const { return m; } | |||
NDArray scale (const NDArray& m) const { return m; } | NDArray scale (const NDArray& m) const { return m; } | |||
skipping to change at line 224 | skipping to change at line 124 | |||
bool is_linear (void) const { return true; } | bool is_linear (void) const { return true; } | |||
}; | }; | |||
class log_scaler : public base_scaler | class log_scaler : public base_scaler | |||
{ | { | |||
public: | public: | |||
log_scaler (void) { } | log_scaler (void) { } | |||
Matrix scale (const Matrix& m) const | Matrix scale (const Matrix& m) const | |||
{ | { | |||
Matrix retval (m.rows (), m.cols ()); | Matrix retval (m.rows (), m.cols ()); | |||
if (m.any_element_is_positive ()) | do_scale (m.data (), retval.fortran_vec (), m.numel ()); | |||
do_scale (m.data (), retval.fortran_vec (), m.numel ()); | ||||
else | ||||
do_neg_scale (m.data (), retval.fortran_vec (), m.numel ()); | ||||
return retval; | return retval; | |||
} | } | |||
NDArray scale (const NDArray& m) const | NDArray scale (const NDArray& m) const | |||
{ | { | |||
NDArray retval (m.dims ()); | NDArray retval (m.dims ()); | |||
if (m.any_element_is_positive ()) | do_scale (m.data (), retval.fortran_vec (), m.numel ()); | |||
do_scale (m.data (), retval.fortran_vec (), m.numel ()); | ||||
else | ||||
do_neg_scale (m.data (), retval.fortran_vec (), m.numel ()); | ||||
return retval; | return retval; | |||
} | } | |||
double scale (double d) const | double scale (double d) const | |||
{ return log10 (d); } | { return log10 (d); } | |||
double unscale (double d) const | double unscale (double d) const | |||
{ return pow (10.0, d); } | { return pow (10.0, d); } | |||
base_scaler* clone (void) const | base_scaler* clone (void) const | |||
{ return new log_scaler (); } | { return new log_scaler (); } | |||
private: | private: | |||
void do_scale (const double *src, double *dest, int n) const | void do_scale (const double *src, double *dest, int n) const | |||
{ | { | |||
for (int i = 0; i < n; i++) | for (int i = 0; i < n; i++) | |||
dest[i] = log10(src[i]); | dest[i] = log10 (src[i]); | |||
} | } | |||
}; | ||||
void do_neg_scale (const double *src, double *dest, int n) const | class neg_log_scaler : public base_scaler | |||
{ | { | |||
for (int i = 0; i < n; i++) | public: | |||
dest[i] = -log10(-src[i]); | neg_log_scaler (void) { } | |||
} | ||||
Matrix scale (const Matrix& m) const | ||||
{ | ||||
Matrix retval (m.rows (), m.cols ()); | ||||
do_scale (m.data (), retval.fortran_vec (), m.numel ()); | ||||
return retval; | ||||
} | ||||
NDArray scale (const NDArray& m) const | ||||
{ | ||||
NDArray retval (m.dims ()); | ||||
do_scale (m.data (), retval.fortran_vec (), m.numel ()); | ||||
return retval; | ||||
} | ||||
double scale (double d) const | ||||
{ return -log10 (-d); } | ||||
double unscale (double d) const | ||||
{ return -pow (10.0, -d); } | ||||
base_scaler* clone (void) const | ||||
{ return new neg_log_scaler (); } | ||||
private: | ||||
void do_scale (const double *src, double *dest, int n) const | ||||
{ | ||||
for (int i = 0; i < n; i++) | ||||
dest[i] = -log10 (-src[i]); | ||||
} | ||||
}; | }; | |||
class scaler | class scaler | |||
{ | { | |||
public: | public: | |||
scaler (void) : rep (new base_scaler ()) { } | scaler (void) : rep (new base_scaler ()) { } | |||
scaler (const scaler& s) : rep (s.rep->clone()) { } | scaler (const scaler& s) : rep (s.rep->clone ()) { } | |||
scaler (const std::string& s) | scaler (const std::string& s) | |||
: rep (s == "log" | : rep (s == "log" | |||
? new log_scaler () | ? new log_scaler () | |||
: (s == "linear" ? new lin_scaler () : new base_scaler ())) | : (s == "neglog" ? new neg_log_scaler () | |||
{ } | : (s == "linear" ? new lin_scaler () : new base_scaler ()))) | |||
{ } | ||||
~scaler (void) { delete rep; } | ~scaler (void) { delete rep; } | |||
Matrix scale (const Matrix& m) const | Matrix scale (const Matrix& m) const | |||
{ return rep->scale (m); } | { return rep->scale (m); } | |||
NDArray scale (const NDArray& m) const | NDArray scale (const NDArray& m) const | |||
{ return rep->scale (m); } | { return rep->scale (m); } | |||
double scale (double d) const | double scale (double d) const | |||
{ return rep->scale (d); } | { return rep->scale (d); } | |||
double unscale (double d) const | double unscale (double d) const | |||
{ return rep->unscale (d); } | { return rep->unscale (d); } | |||
bool is_linear (void) const | bool is_linear (void) const | |||
{ return rep->is_linear (); } | { return rep->is_linear (); } | |||
scaler& operator = (const scaler& s) | scaler& operator = (const scaler& s) | |||
{ | { | |||
if (rep) | if (rep) | |||
{ | { | |||
delete rep; | delete rep; | |||
rep = 0; | rep = 0; | |||
} | } | |||
rep = s.rep->clone (); | rep = s.rep->clone (); | |||
return *this; | return *this; | |||
} | } | |||
scaler& operator = (const std::string& s) | scaler& operator = (const std::string& s) | |||
{ | { | |||
if (rep) | if (rep) | |||
{ | { | |||
delete rep; | delete rep; | |||
rep = 0; | rep = 0; | |||
} | } | |||
if (s == "log") | if (s == "log") | |||
rep = new log_scaler (); | rep = new log_scaler (); | |||
else if (s == "linear") | else if (s == "neglog") | |||
rep = new lin_scaler (); | rep = new neg_log_scaler (); | |||
else | else if (s == "linear") | |||
rep = new base_scaler (); | rep = new lin_scaler (); | |||
else | ||||
rep = new base_scaler (); | ||||
return *this; | return *this; | |||
} | } | |||
private: | private: | |||
base_scaler *rep; | base_scaler *rep; | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class property; | class property; | |||
enum listener_mode { POSTSET, PERSISTENT, PREDELETE }; | enum listener_mode { POSTSET, PERSISTENT, PREDELETE }; | |||
class base_property | class base_property | |||
{ | { | |||
public: | public: | |||
friend class property; | friend class property; | |||
public: | public: | |||
base_property (void) | base_property (void) | |||
: id (-1), count (1), name (), parent (), hidden (), listeners () | : id (-1), count (1), name (), parent (), hidden (), listeners () | |||
{ } | { } | |||
base_property (const std::string& s, const graphics_handle& h) | base_property (const std::string& s, const graphics_handle& h) | |||
: id (-1), count (1), name (s), parent (h), hidden (false), listeners ( ) | : id (-1), count (1), name (s), parent (h), hidden (false), listeners ( ) | |||
{ } | { } | |||
base_property (const base_property& p) | base_property (const base_property& p) | |||
: id (-1), count (1), name (p.name), parent (p.parent), | : id (-1), count (1), name (p.name), parent (p.parent), | |||
hidden (p.hidden), listeners () | hidden (p.hidden), listeners () | |||
{ } | { } | |||
virtual ~base_property (void) { } | virtual ~base_property (void) { } | |||
bool ok (void) const { return parent.ok (); } | bool ok (void) const { return parent.ok (); } | |||
std::string get_name (void) const { return name; } | std::string get_name (void) const { return name; } | |||
void set_name (const std::string& s) { name = s; } | void set_name (const std::string& s) { name = s; } | |||
graphics_handle get_parent (void) const { return parent; } | graphics_handle get_parent (void) const { return parent; } | |||
skipping to change at line 388 | skipping to change at line 319 | |||
int get_id (void) const { return id; } | int get_id (void) const { return id; } | |||
void set_id (int d) { id = d; } | void set_id (int d) { id = d; } | |||
// Sets property value, notifies graphics toolkit. | // Sets property value, notifies graphics toolkit. | |||
// If do_run is true, runs associated listeners. | // If do_run is true, runs associated listeners. | |||
OCTINTERP_API bool set (const octave_value& v, bool do_run = true, | OCTINTERP_API bool set (const octave_value& v, bool do_run = true, | |||
bool do_notify_toolkit = true); | bool do_notify_toolkit = true); | |||
virtual octave_value get (void) const | virtual octave_value get (void) const | |||
{ | { | |||
error ("get: invalid property \"%s\"", name.c_str ()); | error ("get: invalid property \"%s\"", name.c_str ()); | |||
return octave_value (); | return octave_value (); | |||
} | } | |||
virtual std::string values_as_string (void) const | virtual std::string values_as_string (void) const | |||
{ | { | |||
error ("values_as_string: invalid property \"%s\"", name.c_str ()); | error ("values_as_string: invalid property \"%s\"", name.c_str ()); | |||
return std::string (); | return std::string (); | |||
} | } | |||
virtual Cell values_as_cell (void) const | virtual Cell values_as_cell (void) const | |||
{ | { | |||
error ("values_as_cell: invalid property \"%s\"", name.c_str ()); | error ("values_as_cell: invalid property \"%s\"", name.c_str ()); | |||
return Cell (); | return Cell (); | |||
} | } | |||
base_property& operator = (const octave_value& val) | base_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
void add_listener (const octave_value& v, listener_mode mode = POSTSET) | void add_listener (const octave_value& v, listener_mode mode = POSTSET) | |||
{ | { | |||
octave_value_list& l = listeners[mode]; | octave_value_list& l = listeners[mode]; | |||
l.resize (l.length () + 1, v); | l.resize (l.length () + 1, v); | |||
} | } | |||
void delete_listener (const octave_value& v = octave_value (), | void delete_listener (const octave_value& v = octave_value (), | |||
listener_mode mode = POSTSET) | listener_mode mode = POSTSET) | |||
{ | { | |||
octave_value_list& l = listeners[mode]; | octave_value_list& l = listeners[mode]; | |||
if (v.is_defined ()) | if (v.is_defined ()) | |||
{ | { | |||
bool found = false; | bool found = false; | |||
int i; | int i; | |||
for (i = 0; i < l.length (); i++) | for (i = 0; i < l.length (); i++) | |||
{ | { | |||
if (v.internal_rep () == l(i).internal_rep ()) | if (v.internal_rep () == l(i).internal_rep ()) | |||
{ | { | |||
found = true; | found = true; | |||
break; | break; | |||
} | } | |||
} | } | |||
if (found) | if (found) | |||
{ | { | |||
for (int j = i; j < l.length() - 1; j++) | for (int j = i; j < l.length () - 1; j++) | |||
l(j) = l (j + 1); | l(j) = l(j + 1); | |||
l.resize (l.length () - 1); | l.resize (l.length () - 1); | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
if (mode == PERSISTENT) | if (mode == PERSISTENT) | |||
l.resize (0); | l.resize (0); | |||
else | else | |||
{ | { | |||
octave_value_list lnew (0); | octave_value_list lnew (0); | |||
octave_value_list& lp = listeners[PERSISTENT]; | octave_value_list& lp = listeners[PERSISTENT]; | |||
for (int i = l.length () - 1; i >= 0 ; i--) | for (int i = l.length () - 1; i >= 0 ; i--) | |||
{ | { | |||
for (int j = 0; j < lp.length (); j++) | for (int j = 0; j < lp.length (); j++) | |||
{ | { | |||
if (l(i).internal_rep () == lp(j).internal_rep ()) | if (l(i).internal_rep () == lp(j).internal_rep ()) | |||
{ | { | |||
lnew.resize (lnew.length () + 1, l(i)); | lnew.resize (lnew.length () + 1, l(i)); | |||
break; | break; | |||
} | } | |||
} | } | |||
} | } | |||
l = lnew; | l = lnew; | |||
} | } | |||
} | } | |||
} | } | |||
OCTINTERP_API void run_listeners (listener_mode mode = POSTSET); | OCTINTERP_API void run_listeners (listener_mode mode = POSTSET); | |||
virtual base_property* clone (void) const | virtual base_property* clone (void) const | |||
{ return new base_property (*this); } | { return new base_property (*this); } | |||
protected: | protected: | |||
virtual bool do_set (const octave_value&) | virtual bool do_set (const octave_value&) | |||
{ | { | |||
error ("set: invalid property \"%s\"", name.c_str ()); | error ("set: invalid property \"%s\"", name.c_str ()); | |||
return false; | return false; | |||
} | } | |||
private: | private: | |||
typedef std::map<listener_mode, octave_value_list> listener_map; | typedef std::map<listener_mode, octave_value_list> listener_map; | |||
typedef std::map<listener_mode, octave_value_list>::iterator listener_map | typedef std::map<listener_mode, octave_value_list>::iterator | |||
_iterator; | listener_map_iterator; | |||
typedef std::map<listener_mode, octave_value_list>::const_iterator listen | typedef std::map<listener_mode, octave_value_list>::const_iterator | |||
er_map_const_iterator; | listener_map_const_iterator; | |||
private: | private: | |||
int id; | int id; | |||
octave_refcount<int> count; | octave_refcount<int> count; | |||
std::string name; | std::string name; | |||
graphics_handle parent; | graphics_handle parent; | |||
bool hidden; | bool hidden; | |||
listener_map listeners; | listener_map listeners; | |||
}; | }; | |||
skipping to change at line 507 | skipping to change at line 440 | |||
{ | { | |||
public: | public: | |||
string_property (const std::string& s, const graphics_handle& h, | string_property (const std::string& s, const graphics_handle& h, | |||
const std::string& val = "") | const std::string& val = "") | |||
: base_property (s, h), str (val) { } | : base_property (s, h), str (val) { } | |||
string_property (const string_property& p) | string_property (const string_property& p) | |||
: base_property (p), str (p.str) { } | : base_property (p), str (p.str) { } | |||
octave_value get (void) const | octave_value get (void) const | |||
{ return octave_value (str); } | { return octave_value (str); } | |||
std::string string_value (void) const { return str; } | std::string string_value (void) const { return str; } | |||
string_property& operator = (const octave_value& val) | string_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
base_property* clone (void) const { return new string_property (*this); } | base_property* clone (void) const { return new string_property (*this); } | |||
protected: | protected: | |||
bool do_set (const octave_value& val) | bool do_set (const octave_value& val) | |||
{ | { | |||
if (val.is_string ()) | if (val.is_string ()) | |||
{ | { | |||
std::string new_str = val.string_value (); | std::string new_str = val.string_value (); | |||
if (new_str != str) | if (new_str != str) | |||
{ | { | |||
str = new_str; | str = new_str; | |||
return true; | return true; | |||
} | } | |||
} | } | |||
else | else | |||
error ("set: invalid string property value for \"%s\"", | error ("set: invalid string property value for \"%s\"", | |||
get_name ().c_str ()); | get_name ().c_str ()); | |||
return false; | return false; | |||
} | } | |||
private: | private: | |||
std::string str; | std::string str; | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class string_array_property : public base_property | class string_array_property : public base_property | |||
{ | { | |||
public: | public: | |||
enum desired_enum { string_t, cell_t }; | enum desired_enum { string_t, cell_t }; | |||
string_array_property (const std::string& s, const graphics_handle& h, | string_array_property (const std::string& s, const graphics_handle& h, | |||
const std::string& val = "", const char& sep = '|', | const std::string& val = "", const char& sep = '|' | |||
const desired_enum& typ = string_t) | , | |||
const desired_enum& typ = string_t) | ||||
: base_property (s, h), desired_type (typ), separator (sep), str () | : base_property (s, h), desired_type (typ), separator (sep), str () | |||
{ | { | |||
size_t pos = 0; | size_t pos = 0; | |||
while (true) | while (true) | |||
{ | { | |||
size_t new_pos = val.find_first_of (separator, pos); | size_t new_pos = val.find_first_of (separator, pos); | |||
if (new_pos == std::string::npos) | if (new_pos == std::string::npos) | |||
{ | { | |||
str.append (val.substr (pos)); | str.append (val.substr (pos)); | |||
break; | break; | |||
} | } | |||
else | else | |||
str.append (val.substr (pos, new_pos - pos)); | str.append (val.substr (pos, new_pos - pos)); | |||
pos = new_pos + 1; | pos = new_pos + 1; | |||
} | } | |||
} | } | |||
string_array_property (const std::string& s, const graphics_handle& h, | string_array_property (const std::string& s, const graphics_handle& h, | |||
const Cell& c, const char& sep = '|', | const Cell& c, const char& sep = '|', | |||
const desired_enum& typ = string_t) | const desired_enum& typ = string_t) | |||
: base_property (s, h), desired_type (typ), separator (sep), str () | : base_property (s, h), desired_type (typ), separator (sep), str () | |||
{ | { | |||
if (c.is_cellstr ()) | if (c.is_cellstr ()) | |||
{ | { | |||
string_vector strings (c.numel ()); | string_vector strings (c.numel ()); | |||
for (octave_idx_type i = 0; i < c.numel (); i++) | for (octave_idx_type i = 0; i < c.numel (); i++) | |||
strings[i] = c(i).string_value (); | strings[i] = c(i).string_value (); | |||
str = strings; | str = strings; | |||
} | } | |||
else | else | |||
error ("set: invalid order property value for \"%s\"", | error ("set: invalid order property value for \"%s\"", | |||
get_name ().c_str ()); | get_name ().c_str ()); | |||
} | } | |||
string_array_property (const string_array_property& p) | string_array_property (const string_array_property& p) | |||
: base_property (p), desired_type (p.desired_type), | : base_property (p), desired_type (p.desired_type), | |||
separator (p.separator), str (p.str) { } | separator (p.separator), str (p.str) { } | |||
octave_value get (void) const | octave_value get (void) const | |||
{ | { | |||
if (desired_type == string_t) | if (desired_type == string_t) | |||
return octave_value (string_value ()); | return octave_value (string_value ()); | |||
else | else | |||
return octave_value (cell_value ()); | return octave_value (cell_value ()); | |||
} | } | |||
std::string string_value (void) const | std::string string_value (void) const | |||
{ | { | |||
std::string s; | std::string s; | |||
for (octave_idx_type i = 0; i < str.length (); i++) | for (octave_idx_type i = 0; i < str.length (); i++) | |||
{ | { | |||
s += str[i]; | s += str[i]; | |||
if (i != str.length () - 1) | if (i != str.length () - 1) | |||
s += separator; | s += separator; | |||
} | } | |||
return s; | return s; | |||
} | } | |||
Cell cell_value (void) const {return Cell (str);} | Cell cell_value (void) const {return Cell (str);} | |||
string_vector string_vector_value (void) const { return str; } | string_vector string_vector_value (void) const { return str; } | |||
string_array_property& operator = (const octave_value& val) | string_array_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
base_property* clone (void) const { return new string_array_property (*th | base_property* clone (void) const | |||
is); } | { return new string_array_property (*this); } | |||
protected: | protected: | |||
bool do_set (const octave_value& val) | bool do_set (const octave_value& val) | |||
{ | { | |||
if (val.is_string ()) | if (val.is_string () && val.rows () == 1) | |||
{ | { | |||
bool replace = false; | bool replace = false; | |||
std::string new_str = val.string_value (); | std::string new_str = val.string_value (); | |||
string_vector strings; | string_vector strings; | |||
size_t pos = 0; | size_t pos = 0; | |||
while (pos != std::string::npos) | // Split single string on delimiter (usually '|') | |||
{ | while (pos != std::string::npos) | |||
size_t new_pos = new_str.find_first_of (separator, pos); | { | |||
size_t new_pos = new_str.find_first_of (separator, pos); | ||||
if (new_pos == std::string::npos) | ||||
{ | ||||
strings.append (new_str.substr (pos)); | ||||
break; | ||||
} | ||||
else | ||||
strings.append (new_str.substr (pos, new_pos - pos)); | ||||
pos = new_pos + 1; | ||||
} | ||||
if (new_pos == std::string::npos) | if (str.numel () == strings.numel ()) | |||
{ | ||||
for (octave_idx_type i = 0; i < str.numel (); i++) | ||||
if (strings[i] != str[i]) | ||||
{ | { | |||
strings.append (new_str.substr (pos)); | replace = true; | |||
break; | break; | |||
} | } | |||
else | } | |||
strings.append (new_str.substr (pos, new_pos - pos)); | else | |||
replace = true; | ||||
pos = new_pos + 1; | desired_type = string_t; | |||
} | ||||
if (str.numel () == strings.numel ()) | if (replace) | |||
{ | { | |||
for (octave_idx_type i = 0; i < str.numel (); i++) | str = strings; | |||
if (strings[i] != str[i]) | return true; | |||
{ | } | |||
replace = true; | } | |||
break; | else if (val.is_string ()) // multi-row character matrix | |||
} | { | |||
} | bool replace = false; | |||
else | charMatrix chm = val.char_matrix_value (); | |||
replace = true; | octave_idx_type nel = chm.rows (); | |||
string_vector strings (nel); | ||||
if (nel != str.numel ()) | ||||
replace = true; | ||||
for (octave_idx_type i = 0; i < nel; i++) | ||||
{ | ||||
strings[i] = chm.row_as_string (i); | ||||
if (!replace && strings[i] != str[i]) | ||||
replace = true; | ||||
} | ||||
desired_type = string_t; | desired_type = string_t; | |||
if (replace) | if (replace) | |||
{ | { | |||
str = strings; | str = strings; | |||
return true; | return true; | |||
} | } | |||
} | } | |||
else if (val.is_cellstr ()) | else if (val.is_cellstr ()) | |||
{ | { | |||
bool replace = false; | bool replace = false; | |||
Cell new_cell = val.cell_value (); | Cell new_cell = val.cell_value (); | |||
string_vector strings = new_cell.cellstr_value (); | string_vector strings = new_cell.cellstr_value (); | |||
octave_idx_type nel = strings.length (); | octave_idx_type nel = strings.length (); | |||
if (nel != str.length ()) | if (nel != str.length ()) | |||
replace = true; | replace = true; | |||
else | else | |||
{ | { | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
{ | { | |||
if (strings[i] != str[i]) | if (strings[i] != str[i]) | |||
{ | { | |||
replace = true; | replace = true; | |||
break; | break; | |||
} | } | |||
} | } | |||
} | } | |||
desired_type = cell_t; | desired_type = cell_t; | |||
if (replace) | if (replace) | |||
{ | { | |||
str = strings; | str = strings; | |||
return true; | return true; | |||
} | } | |||
} | } | |||
else | else | |||
error ("set: invalid string property value for \"%s\"", | error ("set: invalid string property value for \"%s\"", | |||
get_name ().c_str ()); | get_name ().c_str ()); | |||
return false; | return false; | |||
} | } | |||
private: | private: | |||
desired_enum desired_type; | desired_enum desired_type; | |||
char separator; | char separator; | |||
string_vector str; | string_vector str; | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class text_label_property : public base_property | class text_label_property : public base_property | |||
skipping to change at line 1009 | skipping to change at line 968 | |||
octave_value get (void) const { return octave_value (current_val); } | octave_value get (void) const { return octave_value (current_val); } | |||
const std::string& current_value (void) const { return current_val; } | const std::string& current_value (void) const { return current_val; } | |||
std::string values_as_string (void) const { return vals.values_as_string (); } | std::string values_as_string (void) const { return vals.values_as_string (); } | |||
Cell values_as_cell (void) const { return vals.values_as_cell (); } | Cell values_as_cell (void) const { return vals.values_as_cell (); } | |||
bool is (const caseless_str& v) const | bool is (const caseless_str& v) const | |||
{ return v.compare (current_val); } | { return v.compare (current_val); } | |||
bool is_radio (void) const { return true; } | bool is_radio (void) const { return true; } | |||
radio_property& operator = (const octave_value& val) | radio_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
base_property* clone (void) const { return new radio_property (*this); } | base_property* clone (void) const { return new radio_property (*this); } | |||
protected: | protected: | |||
bool do_set (const octave_value& newval) | bool do_set (const octave_value& newval) | |||
{ | { | |||
if (newval.is_string ()) | if (newval.is_string ()) | |||
{ | { | |||
std::string s = newval.string_value (); | std::string s = newval.string_value (); | |||
skipping to change at line 1045 | skipping to change at line 1004 | |||
warning_with_id ("Octave:abbreviated-property-match", | warning_with_id ("Octave:abbreviated-property-match", | |||
"%s: allowing %s to match %s value %s", | "%s: allowing %s to match %s value %s", | |||
"set", s.c_str (), get_name ().c_str (), | "set", s.c_str (), get_name ().c_str (), | |||
match.c_str ()); | match.c_str ()); | |||
current_val = match; | current_val = match; | |||
return true; | return true; | |||
} | } | |||
} | } | |||
else | else | |||
error ("set: invalid value for radio property \"%s\" (value = %s) ", | error ("set: invalid value for radio property \"%s\" (value = %s) ", | |||
get_name ().c_str (), s.c_str ()); | get_name ().c_str (), s.c_str ()); | |||
} | } | |||
else | else | |||
error ("set: invalid value for radio property \"%s\"", | error ("set: invalid value for radio property \"%s\"", | |||
get_name ().c_str ()); | get_name ().c_str ()); | |||
return false; | return false; | |||
} | } | |||
private: | private: | |||
radio_values vals; | radio_values vals; | |||
std::string current_val; | std::string current_val; | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
skipping to change at line 1093 | skipping to change at line 1052 | |||
color_values& operator = (const color_values& c) | color_values& operator = (const color_values& c) | |||
{ | { | |||
if (&c != this) | if (&c != this) | |||
xrgb = c.xrgb; | xrgb = c.xrgb; | |||
return *this; | return *this; | |||
} | } | |||
bool operator == (const color_values& c) const | bool operator == (const color_values& c) const | |||
{ | { | |||
return (xrgb(0) == c.xrgb(0) | return (xrgb(0) == c.xrgb(0) | |||
&& xrgb(1) == c.xrgb(1) | && xrgb(1) == c.xrgb(1) | |||
&& xrgb(2) == c.xrgb(2)); | && xrgb(2) == c.xrgb(2)); | |||
} | } | |||
bool operator != (const color_values& c) const | bool operator != (const color_values& c) const | |||
{ return ! (*this == c); } | { return ! (*this == c); } | |||
Matrix rgb (void) const { return xrgb; } | Matrix rgb (void) const { return xrgb; } | |||
operator octave_value (void) const { return xrgb; } | operator octave_value (void) const { return xrgb; } | |||
void validate (void) const | void validate (void) const | |||
{ | { | |||
for (int i = 0; i < 3; i++) | for (int i = 0; i < 3; i++) | |||
{ | { | |||
if (xrgb(i) < 0 || xrgb(i) > 1) | if (xrgb(i) < 0 || xrgb(i) > 1) | |||
skipping to change at line 1133 | skipping to change at line 1092 | |||
class color_property : public base_property | class color_property : public base_property | |||
{ | { | |||
public: | public: | |||
color_property (const color_values& c, const radio_values& v) | color_property (const color_values& c, const radio_values& v) | |||
: base_property ("", graphics_handle ()), | : base_property ("", graphics_handle ()), | |||
current_type (color_t), color_val (c), radio_val (v), | current_type (color_t), color_val (c), radio_val (v), | |||
current_val (v.default_value ()) | current_val (v.default_value ()) | |||
{ } | { } | |||
color_property (const radio_values& v, const color_values& c) | ||||
: base_property ("", graphics_handle ()), | ||||
current_type (radio_t), color_val (c), radio_val (v), | ||||
current_val (v.default_value ()) | ||||
{ } | ||||
color_property (const std::string& nm, const graphics_handle& h, | color_property (const std::string& nm, const graphics_handle& h, | |||
const color_values& c = color_values (), | const color_values& c = color_values (), | |||
const radio_values& v = radio_values ()) | const radio_values& v = radio_values ()) | |||
: base_property (nm, h), | : base_property (nm, h), | |||
current_type (color_t), color_val (c), radio_val (v), | current_type (color_t), color_val (c), radio_val (v), | |||
current_val (v.default_value ()) | current_val (v.default_value ()) | |||
{ } | { } | |||
color_property (const std::string& nm, const graphics_handle& h, | color_property (const std::string& nm, const graphics_handle& h, | |||
const radio_values& v) | const radio_values& v) | |||
skipping to change at line 1180 | skipping to change at line 1145 | |||
return color_val.rgb (); | return color_val.rgb (); | |||
return current_val; | return current_val; | |||
} | } | |||
bool is_rgb (void) const { return (current_type == color_t); } | bool is_rgb (void) const { return (current_type == color_t); } | |||
bool is_radio (void) const { return (current_type == radio_t); } | bool is_radio (void) const { return (current_type == radio_t); } | |||
bool is (const std::string& v) const | bool is (const std::string& v) const | |||
{ return (is_radio () && current_val == v); } | { return (is_radio () && current_val == v); } | |||
Matrix rgb (void) const | Matrix rgb (void) const | |||
{ | { | |||
if (current_type != color_t) | if (current_type != color_t) | |||
error ("color has no rgb value"); | error ("color has no rgb value"); | |||
return color_val.rgb (); | return color_val.rgb (); | |||
} | } | |||
const std::string& current_value (void) const | const std::string& current_value (void) const | |||
{ | { | |||
if (current_type != radio_t) | if (current_type != radio_t) | |||
error ("color has no radio value"); | error ("color has no radio value"); | |||
return current_val; | return current_val; | |||
} | } | |||
color_property& operator = (const octave_value& val) | color_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
operator octave_value (void) const { return get (); } | operator octave_value (void) const { return get (); } | |||
base_property* clone (void) const { return new color_property (*this); } | base_property* clone (void) const { return new color_property (*this); } | |||
std::string values_as_string (void) const { return radio_val.values_as_st | std::string values_as_string (void) const | |||
ring (); } | { return radio_val.values_as_string (); } | |||
Cell values_as_cell (void) const { return radio_val.values_as_cell (); } | Cell values_as_cell (void) const { return radio_val.values_as_cell (); } | |||
protected: | protected: | |||
OCTINTERP_API bool do_set (const octave_value& newval); | OCTINTERP_API bool do_set (const octave_value& newval); | |||
private: | private: | |||
enum current_enum { color_t, radio_t } current_type; | enum current_enum { color_t, radio_t } current_type; | |||
color_values color_val; | color_values color_val; | |||
radio_values radio_val; | radio_values radio_val; | |||
skipping to change at line 1240 | skipping to change at line 1206 | |||
current_val (d) { } | current_val (d) { } | |||
double_property (const double_property& p) | double_property (const double_property& p) | |||
: base_property (p), current_val (p.current_val) { } | : base_property (p), current_val (p.current_val) { } | |||
octave_value get (void) const { return octave_value (current_val); } | octave_value get (void) const { return octave_value (current_val); } | |||
double double_value (void) const { return current_val; } | double double_value (void) const { return current_val; } | |||
double_property& operator = (const octave_value& val) | double_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
base_property* clone (void) const { return new double_property (*this); } | base_property* clone (void) const { return new double_property (*this); } | |||
protected: | protected: | |||
bool do_set (const octave_value& v) | bool do_set (const octave_value& v) | |||
{ | { | |||
if (v.is_scalar_type () && v.is_real_type ()) | if (v.is_scalar_type () && v.is_real_type ()) | |||
{ | { | |||
double new_val = v.double_value (); | double new_val = v.double_value (); | |||
if (new_val != current_val) | if (new_val != current_val) | |||
{ | { | |||
current_val = new_val; | current_val = new_val; | |||
return true; | return true; | |||
} | } | |||
} | } | |||
else | else | |||
error ("set: invalid value for double property \"%s\"", | error ("set: invalid value for double property \"%s\"", | |||
get_name ().c_str ()); | get_name ().c_str ()); | |||
return false; | return false; | |||
} | } | |||
private: | private: | |||
double current_val; | double current_val; | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class double_radio_property : public base_property | class double_radio_property : public base_property | |||
{ | { | |||
public: | public: | |||
double_radio_property (double d, const radio_values& v) | double_radio_property (double d, const radio_values& v) | |||
: base_property ("", graphics_handle ()), | : base_property ("", graphics_handle ()), | |||
current_type (double_t), dval (d), radio_val (v), | current_type (double_t), dval (d), radio_val (v), | |||
current_val (v.default_value ()) | current_val (v.default_value ()) | |||
{ } | { } | |||
double_radio_property (const std::string& nm, const graphics_handle& h, | double_radio_property (const std::string& nm, const graphics_handle& h, | |||
const std::string& v) | const std::string& v) | |||
: base_property (nm, h), | : base_property (nm, h), | |||
current_type (radio_t), dval (0), radio_val (v), | current_type (radio_t), dval (0), radio_val (v), | |||
current_val (radio_val.default_value ()) | current_val (radio_val.default_value ()) | |||
{ } | { } | |||
double_radio_property (const std::string& nm, const graphics_handle& h, | double_radio_property (const std::string& nm, const graphics_handle& h, | |||
const double_radio_property& v) | const double_radio_property& v) | |||
: base_property (nm, h), | : base_property (nm, h), | |||
current_type (v.current_type), dval (v.dval), | current_type (v.current_type), dval (v.dval), | |||
radio_val (v.radio_val), current_val (v.current_val) | radio_val (v.radio_val), current_val (v.current_val) | |||
{ } | { } | |||
double_radio_property (const double_radio_property& p) | double_radio_property (const double_radio_property& p) | |||
: base_property (p), current_type (p.current_type), | : base_property (p), current_type (p.current_type), | |||
dval (p.dval), radio_val (p.radio_val), | dval (p.dval), radio_val (p.radio_val), | |||
current_val (p.current_val) { } | current_val (p.current_val) { } | |||
octave_value get (void) const | octave_value get (void) const | |||
{ | { | |||
if (current_type == double_t) | if (current_type == double_t) | |||
return dval; | return dval; | |||
return current_val; | return current_val; | |||
} | } | |||
bool is_double (void) const { return (current_type == double_t); } | bool is_double (void) const { return (current_type == double_t); } | |||
bool is_radio (void) const { return (current_type == radio_t); } | bool is_radio (void) const { return (current_type == radio_t); } | |||
bool is (const std::string& v) const | bool is (const std::string& v) const | |||
{ return (is_radio () && current_val == v); } | { return (is_radio () && current_val == v); } | |||
double double_value (void) const | double double_value (void) const | |||
{ | { | |||
if (current_type != double_t) | if (current_type != double_t) | |||
error ("%s: property has no double", get_name ().c_str ()); | error ("%s: property has no double", get_name ().c_str ()); | |||
return dval; | return dval; | |||
} | } | |||
const std::string& current_value (void) const | const std::string& current_value (void) const | |||
{ | { | |||
if (current_type != radio_t) | if (current_type != radio_t) | |||
error ("%s: property has no radio value"); | error ("%s: property has no radio value"); | |||
return current_val; | return current_val; | |||
} | } | |||
double_radio_property& operator = (const octave_value& val) | double_radio_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
operator octave_value (void) const { return get (); } | operator octave_value (void) const { return get (); } | |||
base_property* clone (void) const | base_property* clone (void) const | |||
{ return new double_radio_property (*this); } | { return new double_radio_property (*this); } | |||
protected: | protected: | |||
OCTINTERP_API bool do_set (const octave_value& v); | OCTINTERP_API bool do_set (const octave_value& v); | |||
private: | private: | |||
enum current_enum { double_t, radio_t } current_type; | enum current_enum { double_t, radio_t } current_type; | |||
double dval; | double dval; | |||
radio_values radio_val; | radio_values radio_val; | |||
std::string current_val; | std::string current_val; | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class array_property : public base_property | class array_property : public base_property | |||
{ | { | |||
public: | public: | |||
array_property (void) | array_property (void) | |||
: base_property ("", graphics_handle ()), data (Matrix ()), | : base_property ("", graphics_handle ()), data (Matrix ()), | |||
xmin (), xmax (), xminp (), xmaxp (), | xmin (), xmax (), xminp (), xmaxp (), | |||
type_constraints (), size_constraints () | type_constraints (), size_constraints () | |||
{ | { | |||
get_data_limits (); | get_data_limits (); | |||
} | } | |||
array_property (const std::string& nm, const graphics_handle& h, | array_property (const std::string& nm, const graphics_handle& h, | |||
const octave_value& m) | const octave_value& m) | |||
: base_property (nm, h), data (m), | : base_property (nm, h), data (m.is_sparse_type () ? m.full_value () : m), | |||
xmin (), xmax (), xminp (), xmaxp (), | xmin (), xmax (), xminp (), xmaxp (), | |||
type_constraints (), size_constraints () | type_constraints (), size_constraints () | |||
{ | { | |||
get_data_limits (); | get_data_limits (); | |||
} | } | |||
// This copy constructor is only intended to be used | // This copy constructor is only intended to be used | |||
// internally to access min/max values; no need to | // internally to access min/max values; no need to | |||
// copy constraints. | // copy constraints. | |||
array_property (const array_property& p) | array_property (const array_property& p) | |||
: base_property (p), data (p.data), | : base_property (p), data (p.data), | |||
xmin (p.xmin), xmax (p.xmax), xminp (p.xminp), xmaxp (p.xmaxp), | xmin (p.xmin), xmax (p.xmax), xminp (p.xminp), xmaxp (p.xmaxp), | |||
type_constraints (), size_constraints () | type_constraints (), size_constraints () | |||
{ } | { } | |||
octave_value get (void) const { return data; } | octave_value get (void) const { return data; } | |||
void add_constraint (const std::string& type) | void add_constraint (const std::string& type) | |||
{ type_constraints.push_back (type); } | { type_constraints.insert (type); } | |||
void add_constraint (const dim_vector& dims) | void add_constraint (const dim_vector& dims) | |||
{ size_constraints.push_back (dims); } | { size_constraints.push_back (dims); } | |||
double min_val (void) const { return xmin; } | double min_val (void) const { return xmin; } | |||
double max_val (void) const { return xmax; } | double max_val (void) const { return xmax; } | |||
double min_pos (void) const { return xminp; } | double min_pos (void) const { return xminp; } | |||
double max_neg (void) const { return xmaxp; } | double max_neg (void) const { return xmaxp; } | |||
Matrix get_limits (void) const | Matrix get_limits (void) const | |||
{ | { | |||
Matrix m (1, 4); | Matrix m (1, 4); | |||
m(0) = min_val (); | m(0) = min_val (); | |||
m(1) = max_val (); | m(1) = max_val (); | |||
m(2) = min_pos (); | m(2) = min_pos (); | |||
m(3) = max_neg (); | m(3) = max_neg (); | |||
return m; | return m; | |||
} | } | |||
array_property& operator = (const octave_value& val) | array_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
base_property* clone (void) const | base_property* clone (void) const | |||
{ | { | |||
array_property *p = new array_property (*this); | array_property *p = new array_property (*this); | |||
p->type_constraints = type_constraints; | p->type_constraints = type_constraints; | |||
p->size_constraints = size_constraints; | p->size_constraints = size_constraints; | |||
return p; | return p; | |||
} | } | |||
protected: | protected: | |||
bool do_set (const octave_value& v) | bool do_set (const octave_value& v) | |||
{ | { | |||
if (validate (v)) | octave_value tmp = v.is_sparse_type () ? v.full_value () : v; | |||
{ | ||||
// FIXME -- should we check for actual data change? | ||||
if (! is_equal (v)) | ||||
{ | ||||
data = v; | ||||
get_data_limits (); | if (validate (tmp)) | |||
{ | ||||
// FIXME: should we check for actual data change? | ||||
if (! is_equal (tmp)) | ||||
{ | ||||
data = tmp; | ||||
return true; | get_data_limits (); | |||
} | ||||
} | ||||
else | ||||
error ("invalid value for array property \"%s\"", | ||||
get_name ().c_str ()); | ||||
return false; | return true; | |||
} | } | |||
} | ||||
else | ||||
error ("invalid value for array property \"%s\"", | ||||
get_name ().c_str ()); | ||||
return false; | ||||
} | ||||
private: | private: | |||
OCTINTERP_API bool validate (const octave_value& v); | OCTINTERP_API bool validate (const octave_value& v); | |||
OCTINTERP_API bool is_equal (const octave_value& v) const; | OCTINTERP_API bool is_equal (const octave_value& v) const; | |||
OCTINTERP_API void get_data_limits (void); | OCTINTERP_API void get_data_limits (void); | |||
protected: | protected: | |||
octave_value data; | octave_value data; | |||
double xmin; | double xmin; | |||
double xmax; | double xmax; | |||
double xminp; | double xminp; | |||
double xmaxp; | double xmaxp; | |||
std::list<std::string> type_constraints; | std::set<std::string> type_constraints; | |||
std::list<dim_vector> size_constraints; | std::list<dim_vector> size_constraints; | |||
}; | }; | |||
class row_vector_property : public array_property | class row_vector_property : public array_property | |||
{ | { | |||
public: | public: | |||
row_vector_property (const std::string& nm, const graphics_handle& h, | row_vector_property (const std::string& nm, const graphics_handle& h, | |||
const octave_value& m) | const octave_value& m) | |||
: array_property (nm, h, m) | : array_property (nm, h, m) | |||
{ | { | |||
add_constraint (dim_vector (-1, 1)); | add_constraint (dim_vector (-1, 1)); | |||
add_constraint (dim_vector (1, -1)); | add_constraint (dim_vector (1, -1)); | |||
add_constraint (dim_vector (0, 0)); | ||||
} | } | |||
row_vector_property (const row_vector_property& p) | row_vector_property (const row_vector_property& p) | |||
: array_property (p) | : array_property (p) | |||
{ | { | |||
add_constraint (dim_vector (-1, 1)); | add_constraint (dim_vector (-1, 1)); | |||
add_constraint (dim_vector (1, -1)); | add_constraint (dim_vector (1, -1)); | |||
add_constraint (dim_vector (0, 0)); | ||||
} | } | |||
void add_constraint (const std::string& type) | void add_constraint (const std::string& type) | |||
{ | { | |||
array_property::add_constraint (type); | array_property::add_constraint (type); | |||
} | } | |||
void add_constraint (const dim_vector& dims) | void add_constraint (const dim_vector& dims) | |||
{ | { | |||
array_property::add_constraint (dims); | array_property::add_constraint (dims); | |||
skipping to change at line 1507 | skipping to change at line 1477 | |||
add_constraint (dim_vector (len, 1)); | add_constraint (dim_vector (len, 1)); | |||
} | } | |||
row_vector_property& operator = (const octave_value& val) | row_vector_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
base_property* clone (void) const | base_property* clone (void) const | |||
{ | { | |||
row_vector_property *p = new row_vector_property (*this); | row_vector_property *p = new row_vector_property (*this); | |||
p->type_constraints = type_constraints; | p->type_constraints = type_constraints; | |||
p->size_constraints = size_constraints; | p->size_constraints = size_constraints; | |||
return p; | return p; | |||
} | } | |||
protected: | protected: | |||
bool do_set (const octave_value& v) | bool do_set (const octave_value& v) | |||
{ | { | |||
bool retval = array_property::do_set (v); | bool retval = array_property::do_set (v); | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
dim_vector dv = data.dims (); | dim_vector dv = data.dims (); | |||
skipping to change at line 1552 | skipping to change at line 1522 | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class bool_property : public radio_property | class bool_property : public radio_property | |||
{ | { | |||
public: | public: | |||
bool_property (const std::string& nm, const graphics_handle& h, | bool_property (const std::string& nm, const graphics_handle& h, | |||
bool val) | bool val) | |||
: radio_property (nm, h, radio_values (val ? "{on}|off" : "on|{off}")) | : radio_property (nm, h, radio_values (val ? "{on}|off" : "on|{off}")) | |||
{ } | { } | |||
bool_property (const std::string& nm, const graphics_handle& h, | bool_property (const std::string& nm, const graphics_handle& h, | |||
const char* val) | const char* val) | |||
: radio_property (nm, h, radio_values ("on|off"), val) | : radio_property (nm, h, radio_values ("on|off"), val) | |||
{ } | { } | |||
bool_property (const bool_property& p) | bool_property (const bool_property& p) | |||
: radio_property (p) { } | : radio_property (p) { } | |||
bool is_on (void) const { return is ("on"); } | bool is_on (void) const { return is ("on"); } | |||
bool_property& operator = (const octave_value& val) | bool_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
base_property* clone (void) const { return new bool_property (*this); } | base_property* clone (void) const { return new bool_property (*this); } | |||
protected: | protected: | |||
bool do_set (const octave_value& val) | bool do_set (const octave_value& val) | |||
{ | { | |||
if (val.is_bool_scalar ()) | if (val.is_bool_scalar ()) | |||
return radio_property::do_set (val.bool_value () ? "on" : "off"); | return radio_property::do_set (val.bool_value () ? "on" : "off"); | |||
else | else | |||
return radio_property::do_set (val); | return radio_property::do_set (val); | |||
} | } | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class handle_property : public base_property | class handle_property : public base_property | |||
{ | { | |||
public: | public: | |||
handle_property (const std::string& nm, const graphics_handle& h, | handle_property (const std::string& nm, const graphics_handle& h, | |||
const graphics_handle& val = graphics_handle ()) | const graphics_handle& val = graphics_handle ()) | |||
: base_property (nm, h), | : base_property (nm, h), | |||
current_val (val) { } | current_val (val) { } | |||
handle_property (const handle_property& p) | handle_property (const handle_property& p) | |||
: base_property (p), current_val (p.current_val) { } | : base_property (p), current_val (p.current_val) { } | |||
octave_value get (void) const { return current_val.as_octave_value (); } | octave_value get (void) const { return current_val.as_octave_value (); } | |||
graphics_handle handle_value (void) const { return current_val; } | graphics_handle handle_value (void) const { return current_val; } | |||
handle_property& operator = (const octave_value& val) | handle_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
handle_property& operator = (const graphics_handle& h) | handle_property& operator = (const graphics_handle& h) | |||
{ | { | |||
set (octave_value (h.value ())); | set (octave_value (h.value ())); | |||
return *this; | return *this; | |||
} | } | |||
base_property* clone (void) const { return new handle_property (*this); } | base_property* clone (void) const { return new handle_property (*this); } | |||
protected: | protected: | |||
OCTINTERP_API bool do_set (const octave_value& v); | OCTINTERP_API bool do_set (const octave_value& v); | |||
private: | private: | |||
graphics_handle current_val; | graphics_handle current_val; | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class any_property : public base_property | class any_property : public base_property | |||
{ | { | |||
public: | public: | |||
any_property (const std::string& nm, const graphics_handle& h, | any_property (const std::string& nm, const graphics_handle& h, | |||
const octave_value& m = Matrix ()) | const octave_value& m = Matrix ()) | |||
: base_property (nm, h), data (m) { } | : base_property (nm, h), data (m) { } | |||
any_property (const any_property& p) | any_property (const any_property& p) | |||
: base_property (p), data (p.data) { } | : base_property (p), data (p.data) { } | |||
octave_value get (void) const { return data; } | octave_value get (void) const { return data; } | |||
any_property& operator = (const octave_value& val) | any_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
base_property* clone (void) const { return new any_property (*this); } | base_property* clone (void) const { return new any_property (*this); } | |||
protected: | protected: | |||
bool do_set (const octave_value& v) | bool do_set (const octave_value& v) | |||
{ | { | |||
data = v; | data = v; | |||
return true; | return true; | |||
} | } | |||
private: | private: | |||
octave_value data; | octave_value data; | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class children_property : public base_property | class children_property : public base_property | |||
{ | { | |||
public: | public: | |||
children_property (void) | children_property (void) | |||
: base_property ("", graphics_handle ()), children_list () | : base_property ("", graphics_handle ()), children_list () | |||
{ | { | |||
do_init_children (Matrix ()); | do_init_children (Matrix ()); | |||
} | } | |||
children_property (const std::string& nm, const graphics_handle& h, | children_property (const std::string& nm, const graphics_handle& h, | |||
const Matrix &val) | const Matrix &val) | |||
: base_property (nm, h), children_list () | : base_property (nm, h), children_list () | |||
{ | { | |||
do_init_children (val); | do_init_children (val); | |||
} | } | |||
children_property (const children_property& p) | children_property (const children_property& p) | |||
: base_property (p), children_list () | : base_property (p), children_list () | |||
{ | { | |||
do_init_children (p.children_list); | do_init_children (p.children_list); | |||
} | } | |||
children_property& operator = (const octave_value& val) | children_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
base_property* clone (void) const { return new children_property (*this); } | base_property* clone (void) const { return new children_property (*this); } | |||
bool remove_child (const double &val) | bool remove_child (const double &val) | |||
{ | { | |||
return do_remove_child (val); | return do_remove_child (val); | |||
} | } | |||
void adopt (const double &val) | void adopt (const double &val) | |||
{ | { | |||
do_adopt_child (val); | do_adopt_child (val); | |||
} | } | |||
Matrix get_children (void) const | Matrix get_children (void) const | |||
{ | { | |||
return do_get_children (false); | return do_get_children (false); | |||
} | } | |||
Matrix get_hidden (void) const | Matrix get_hidden (void) const | |||
{ | { | |||
return do_get_children (true); | return do_get_children (true); | |||
} | } | |||
Matrix get_all (void) const | Matrix get_all (void) const | |||
{ | { | |||
return do_get_all_children (); | return do_get_all_children (); | |||
} | } | |||
octave_value get (void) const | octave_value get (void) const | |||
{ | { | |||
return octave_value (get_children ()); | return octave_value (get_children ()); | |||
} | } | |||
void delete_children (bool clear = false) | void delete_children (bool clear = false) | |||
{ | { | |||
do_delete_children (clear); | do_delete_children (clear); | |||
} | } | |||
void renumber (graphics_handle old_gh, graphics_handle new_gh) | void renumber (graphics_handle old_gh, graphics_handle new_gh) | |||
{ | { | |||
for (children_list_iterator p = children_list.begin (); | for (children_list_iterator p = children_list.begin (); | |||
p != children_list.end (); p++) | p != children_list.end (); p++) | |||
{ | { | |||
if (*p == old_gh) | if (*p == old_gh) | |||
{ | { | |||
*p = new_gh.value (); | *p = new_gh.value (); | |||
return; | return; | |||
} | } | |||
} | } | |||
error ("children_list::renumber: child not found!"); | error ("children_list::renumber: child not found!"); | |||
} | } | |||
private: | private: | |||
typedef std::list<double>::iterator children_list_iterator; | typedef std::list<double>::iterator children_list_iterator; | |||
typedef std::list<double>::const_iterator const_children_list_iterator; | typedef std::list<double>::const_iterator const_children_list_iterator; | |||
std::list<double> children_list; | std::list<double> children_list; | |||
protected: | protected: | |||
bool do_set (const octave_value& val) | bool do_set (const octave_value& val) | |||
{ | { | |||
const Matrix new_kids = val.matrix_value (); | const Matrix new_kids = val.matrix_value (); | |||
octave_idx_type nel = new_kids.numel (); | ||||
const Matrix new_kids_column = new_kids.reshape (dim_vector (nel, 1)) ; | octave_idx_type nel = new_kids.numel (); | |||
bool is_ok = true; | const Matrix new_kids_column = new_kids.reshape (dim_vector (nel, 1)); | |||
if (! error_state) | bool is_ok = true; | |||
{ | ||||
const Matrix visible_kids = do_get_children (false); | ||||
if (visible_kids.numel () == new_kids.numel ()) | if (! error_state) | |||
{ | { | |||
Matrix t1 = visible_kids.sort (); | const Matrix visible_kids = do_get_children (false); | |||
Matrix t2 = new_kids_column.sort (); | ||||
if (t1 != t2) | if (visible_kids.numel () == new_kids.numel ()) | |||
is_ok = false; | { | |||
} | Matrix t1 = visible_kids.sort (); | |||
else | Matrix t2 = new_kids_column.sort (); | |||
is_ok = false; | ||||
if (! is_ok) | if (t1 != t2) | |||
error ("set: new children must be a permutation of existing chi | is_ok = false; | |||
ldren"); | } | |||
} | else | |||
else | ||||
{ | ||||
is_ok = false; | is_ok = false; | |||
error ("set: expecting children to be array of graphics handles") | ||||
; | ||||
} | ||||
if (is_ok) | if (! is_ok) | |||
{ | error ("set: new children must be a permutation of existing child | |||
Matrix tmp = new_kids_column.stack (get_hidden ()); | ren"); | |||
} | ||||
else | ||||
{ | ||||
is_ok = false; | ||||
error ("set: expecting children to be array of graphics handles"); | ||||
} | ||||
children_list.clear (); | if (is_ok) | |||
{ | ||||
Matrix tmp = new_kids_column.stack (get_hidden ()); | ||||
// Don't use do_init_children here, as that reverses the | children_list.clear (); | |||
// order of the list, and we don't want to do that if setting | ||||
// the child list directly. | ||||
for (octave_idx_type i = 0; i < tmp.numel (); i++) | // Don't use do_init_children here, as that reverses the | |||
children_list.push_back (tmp.xelem (i)); | // order of the list, and we don't want to do that if setting | |||
} | // the child list directly. | |||
return is_ok; | for (octave_idx_type i = 0; i < tmp.numel (); i++) | |||
} | children_list.push_back (tmp.xelem (i)); | |||
} | ||||
return is_ok; | ||||
} | ||||
private: | private: | |||
void do_init_children (const Matrix &val) | void do_init_children (const Matrix &val) | |||
{ | { | |||
children_list.clear (); | children_list.clear (); | |||
for (octave_idx_type i = 0; i < val.numel (); i++) | for (octave_idx_type i = 0; i < val.numel (); i++) | |||
children_list.push_front (val.xelem (i)); | children_list.push_front (val.xelem (i)); | |||
} | } | |||
void do_init_children (const std::list<double> &val) | void do_init_children (const std::list<double> &val) | |||
{ | { | |||
children_list.clear (); | children_list.clear (); | |||
for (const_children_list_iterator p = val.begin (); p != val.end (); | for (const_children_list_iterator p = val.begin (); p != val.end (); p+ | |||
p++) | +) | |||
children_list.push_front (*p); | children_list.push_front (*p); | |||
} | } | |||
Matrix do_get_children (bool return_hidden) const; | Matrix do_get_children (bool return_hidden) const; | |||
Matrix do_get_all_children (void) const | Matrix do_get_all_children (void) const | |||
{ | { | |||
Matrix retval (children_list.size (), 1); | Matrix retval (children_list.size (), 1); | |||
octave_idx_type i = 0; | octave_idx_type i = 0; | |||
for (const_children_list_iterator p = children_list.begin (); | for (const_children_list_iterator p = children_list.begin (); | |||
p != children_list.end (); p++) | p != children_list.end (); p++) | |||
retval(i++) = *p; | retval(i++) = *p; | |||
return retval; | return retval; | |||
} | } | |||
bool do_remove_child (double child) | bool do_remove_child (double child) | |||
{ | { | |||
for (children_list_iterator p = children_list.begin (); | for (children_list_iterator p = children_list.begin (); | |||
p != children_list.end (); p++) | p != children_list.end (); p++) | |||
{ | { | |||
if (*p == child) | if (*p == child) | |||
{ | { | |||
children_list.erase (p); | children_list.erase (p); | |||
return true; | return true; | |||
} | } | |||
} | } | |||
return false; | return false; | |||
} | } | |||
void do_adopt_child (const double &val) | void do_adopt_child (const double &val) | |||
{ | { | |||
children_list.push_front (val); | children_list.push_front (val); | |||
} | } | |||
void do_delete_children (bool clear); | void do_delete_children (bool clear); | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class callback_property : public base_property | class callback_property : public base_property | |||
{ | { | |||
public: | public: | |||
callback_property (const std::string& nm, const graphics_handle& h, | callback_property (const std::string& nm, const graphics_handle& h, | |||
skipping to change at line 1859 | skipping to change at line 1829 | |||
: base_property (nm, h), callback (m), executing (false) { } | : base_property (nm, h), callback (m), executing (false) { } | |||
callback_property (const callback_property& p) | callback_property (const callback_property& p) | |||
: base_property (p), callback (p.callback), executing (false) { } | : base_property (p), callback (p.callback), executing (false) { } | |||
octave_value get (void) const { return callback; } | octave_value get (void) const { return callback; } | |||
OCTINTERP_API void execute (const octave_value& data = octave_value ()) c onst; | OCTINTERP_API void execute (const octave_value& data = octave_value ()) c onst; | |||
bool is_defined (void) const | bool is_defined (void) const | |||
{ | { | |||
return (callback.is_defined () && ! callback.is_empty ()); | return (callback.is_defined () && ! callback.is_empty ()); | |||
} | } | |||
callback_property& operator = (const octave_value& val) | callback_property& operator = (const octave_value& val) | |||
{ | { | |||
set (val); | set (val); | |||
return *this; | return *this; | |||
} | } | |||
base_property* clone (void) const { return new callback_property (*this); } | base_property* clone (void) const { return new callback_property (*this); } | |||
protected: | protected: | |||
bool do_set (const octave_value& v) | bool do_set (const octave_value& v) | |||
{ | { | |||
if (validate (v)) | if (validate (v)) | |||
{ | { | |||
callback = v; | callback = v; | |||
return true; | return true; | |||
} | } | |||
else | else | |||
error ("invalid value for callback property \"%s\"", | error ("invalid value for callback property \"%s\"", | |||
get_name ().c_str ()); | get_name ().c_str ()); | |||
return false; | return false; | |||
} | } | |||
private: | private: | |||
OCTINTERP_API bool validate (const octave_value& v) const; | OCTINTERP_API bool validate (const octave_value& v) const; | |||
private: | private: | |||
octave_value callback; | octave_value callback; | |||
// If TRUE, we are executing this callback. | // If TRUE, we are executing this callback. | |||
mutable bool executing; | mutable bool executing; | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class property | class property | |||
{ | { | |||
public: | public: | |||
property (void) : rep (new base_property ("", graphics_handle ())) | property (void) : rep (new base_property ("", graphics_handle ())) | |||
{ } | { } | |||
property (base_property *bp, bool persist = false) : rep (bp) | property (base_property *bp, bool persist = false) : rep (bp) | |||
{ if (persist) rep->count++; } | { if (persist) rep->count++; } | |||
property (const property& p) : rep (p.rep) | property (const property& p) : rep (p.rep) | |||
{ | { | |||
rep->count++; | rep->count++; | |||
} | } | |||
~property (void) | ~property (void) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
} | } | |||
bool ok (void) const | bool ok (void) const | |||
{ return rep->ok (); } | { return rep->ok (); } | |||
std::string get_name (void) const | std::string get_name (void) const | |||
{ return rep->get_name (); } | { return rep->get_name (); } | |||
void set_name (const std::string& name) | void set_name (const std::string& name) | |||
{ rep->set_name (name); } | { rep->set_name (name); } | |||
graphics_handle get_parent (void) const | graphics_handle get_parent (void) const | |||
{ return rep->get_parent (); } | { return rep->get_parent (); } | |||
void set_parent (const graphics_handle& h) | void set_parent (const graphics_handle& h) | |||
{ rep->set_parent (h); } | { rep->set_parent (h); } | |||
bool is_hidden (void) const | bool is_hidden (void) const | |||
{ return rep->is_hidden (); } | { return rep->is_hidden (); } | |||
void set_hidden (bool flag) | void set_hidden (bool flag) | |||
{ rep->set_hidden (flag); } | { rep->set_hidden (flag); } | |||
bool is_radio (void) const | bool is_radio (void) const | |||
{ return rep->is_radio (); } | { return rep->is_radio (); } | |||
int get_id (void) const | int get_id (void) const | |||
{ return rep->get_id (); } | { return rep->get_id (); } | |||
void set_id (int d) | void set_id (int d) | |||
{ rep->set_id (d); } | { rep->set_id (d); } | |||
octave_value get (void) const | octave_value get (void) const | |||
{ return rep->get (); } | { return rep->get (); } | |||
bool set (const octave_value& val, bool do_run = true, | bool set (const octave_value& val, bool do_run = true, | |||
bool do_notify_toolkit = true) | bool do_notify_toolkit = true) | |||
{ return rep->set (val, do_run, do_notify_toolkit); } | { return rep->set (val, do_run, do_notify_toolkit); } | |||
std::string values_as_string (void) const | std::string values_as_string (void) const | |||
{ return rep->values_as_string (); } | { return rep->values_as_string (); } | |||
Cell values_as_cell (void) const | Cell values_as_cell (void) const | |||
{ return rep->values_as_cell (); } | { return rep->values_as_cell (); } | |||
property& operator = (const octave_value& val) | property& operator = (const octave_value& val) | |||
{ | { | |||
*rep = val; | *rep = val; | |||
return *this; | return *this; | |||
} | } | |||
property& operator = (const property& p) | property& operator = (const property& p) | |||
{ | { | |||
if (rep && --rep->count == 0) | if (rep && --rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = p.rep; | rep = p.rep; | |||
rep->count++; | rep->count++; | |||
return *this; | return *this; | |||
} | } | |||
void add_listener (const octave_value& v, listener_mode mode = POSTSET) | void add_listener (const octave_value& v, listener_mode mode = POSTSET) | |||
{ rep->add_listener (v, mode); } | { rep->add_listener (v, mode); } | |||
void delete_listener (const octave_value& v = octave_value (), | void delete_listener (const octave_value& v = octave_value (), | |||
listener_mode mode = POSTSET) | listener_mode mode = POSTSET) | |||
{ rep->delete_listener (v, mode); } | { rep->delete_listener (v, mode); } | |||
void run_listeners (listener_mode mode = POSTSET) | void run_listeners (listener_mode mode = POSTSET) | |||
{ rep->run_listeners (mode); } | { rep->run_listeners (mode); } | |||
OCTINTERP_API static | OCTINTERP_API static | |||
property create (const std::string& name, const graphics_handle& pare | property create (const std::string& name, const graphics_handle& parent, | |||
nt, | const caseless_str& type, | |||
const caseless_str& type, | const octave_value_list& args); | |||
const octave_value_list& args); | ||||
property clone (void) const | property clone (void) const | |||
{ return property (rep->clone ()); } | { return property (rep->clone ()); } | |||
/* | /* | |||
const string_property& as_string_property (void) const | const string_property& as_string_property (void) const | |||
{ return *(dynamic_cast<string_property*> (rep)); } | { return *(dynamic_cast<string_property*> (rep)); } | |||
const radio_property& as_radio_property (void) const | const radio_property& as_radio_property (void) const | |||
{ return *(dynamic_cast<radio_property*> (rep)); } | { return *(dynamic_cast<radio_property*> (rep)); } | |||
const color_property& as_color_property (void) const | const color_property& as_color_property (void) const | |||
{ return *(dynamic_cast<color_property*> (rep)); } | { return *(dynamic_cast<color_property*> (rep)); } | |||
skipping to change at line 2076 | skipping to change at line 2046 | |||
class graphics_toolkit; | class graphics_toolkit; | |||
class graphics_object; | class graphics_object; | |||
class base_graphics_toolkit | class base_graphics_toolkit | |||
{ | { | |||
public: | public: | |||
friend class graphics_toolkit; | friend class graphics_toolkit; | |||
public: | public: | |||
base_graphics_toolkit (const std::string& nm) | base_graphics_toolkit (const std::string& nm) | |||
: name (nm), count (0) { } | : name (nm), count (0) { } | |||
virtual ~base_graphics_toolkit (void) { } | virtual ~base_graphics_toolkit (void) { } | |||
std::string get_name (void) const { return name; } | std::string get_name (void) const { return name; } | |||
virtual bool is_valid (void) const { return false; } | virtual bool is_valid (void) const { return false; } | |||
virtual void redraw_figure (const graphics_object&) const | virtual void redraw_figure (const graphics_object&) const | |||
{ gripe_invalid ("redraw_figure"); } | { gripe_invalid ("redraw_figure"); } | |||
virtual void print_figure (const graphics_object&, const std::string&, | virtual void print_figure (const graphics_object&, const std::string&, | |||
const std::string&, bool, | const std::string&, bool, | |||
const std::string& = "") const | const std::string& = "") const | |||
{ gripe_invalid ("print_figure"); } | { gripe_invalid ("print_figure"); } | |||
virtual Matrix get_canvas_size (const graphics_handle&) const | virtual Matrix get_canvas_size (const graphics_handle&) const | |||
{ | { | |||
gripe_invalid ("get_canvas_size"); | gripe_invalid ("get_canvas_size"); | |||
return Matrix (1, 2, 0.0); | return Matrix (1, 2, 0.0); | |||
} | } | |||
virtual double get_screen_resolution (void) const | virtual double get_screen_resolution (void) const | |||
{ | { | |||
gripe_invalid ("get_screen_resolution"); | gripe_invalid ("get_screen_resolution"); | |||
return 72.0; | return 72.0; | |||
} | } | |||
virtual Matrix get_screen_size (void) const | virtual Matrix get_screen_size (void) const | |||
{ | { | |||
gripe_invalid ("get_screen_size"); | gripe_invalid ("get_screen_size"); | |||
return Matrix (1, 2, 0.0); | return Matrix (1, 2, 0.0); | |||
} | } | |||
// Callback function executed when the given graphics object | // Callback function executed when the given graphics object | |||
// changes. This allows the graphics toolkit to act on property | // changes. This allows the graphics toolkit to act on property | |||
// changes if needed. | // changes if needed. | |||
virtual void update (const graphics_object&, int) | virtual void update (const graphics_object&, int) | |||
{ gripe_invalid ("base_graphics_toolkit::update"); } | { gripe_invalid ("base_graphics_toolkit::update"); } | |||
void update (const graphics_handle&, int); | void update (const graphics_handle&, int); | |||
// Callback function executed when the given graphics object is | // Callback function executed when the given graphics object is | |||
// created. This allows the graphics toolkit to do toolkit-specific | // created. This allows the graphics toolkit to do toolkit-specific | |||
// initializations for a newly created object. | // initializations for a newly created object. | |||
virtual bool initialize (const graphics_object&) | virtual bool initialize (const graphics_object&) | |||
{ gripe_invalid ("base_graphics_toolkit::initialize"); return false; } | { gripe_invalid ("base_graphics_toolkit::initialize"); return false; } | |||
bool initialize (const graphics_handle&); | bool initialize (const graphics_handle&); | |||
// Callback function executed just prior to deleting the given | // Callback function executed just prior to deleting the given | |||
// graphics object. This allows the graphics toolkit to perform | // graphics object. This allows the graphics toolkit to perform | |||
// toolkit-specific cleanup operations before an object is deleted. | // toolkit-specific cleanup operations before an object is deleted. | |||
virtual void finalize (const graphics_object&) | virtual void finalize (const graphics_object&) | |||
{ gripe_invalid ("base_graphics_toolkit::finalize"); } | { gripe_invalid ("base_graphics_toolkit::finalize"); } | |||
void finalize (const graphics_handle&); | void finalize (const graphics_handle&); | |||
// Close the graphics toolkit. | // Close the graphics toolkit. | |||
virtual void close (void) | virtual void close (void) | |||
{ gripe_invalid ("base_graphics_toolkit::close"); } | { gripe_invalid ("base_graphics_toolkit::close"); } | |||
private: | private: | |||
std::string name; | std::string name; | |||
octave_refcount<int> count; | octave_refcount<int> count; | |||
private: | private: | |||
void gripe_invalid (const std::string& fname) const | void gripe_invalid (const std::string& fname) const | |||
{ | { | |||
if (! is_valid ()) | if (! is_valid ()) | |||
error ("%s: invalid graphics toolkit", fname.c_str ()); | error ("%s: invalid graphics toolkit", fname.c_str ()); | |||
} | } | |||
}; | }; | |||
class graphics_toolkit | class graphics_toolkit | |||
{ | { | |||
public: | public: | |||
graphics_toolkit (void) | graphics_toolkit (void) | |||
: rep (new base_graphics_toolkit ("unknown")) | : rep (new base_graphics_toolkit ("unknown")) | |||
{ | { | |||
rep->count++; | rep->count++; | |||
} | } | |||
graphics_toolkit (base_graphics_toolkit* b) | graphics_toolkit (base_graphics_toolkit* b) | |||
: rep (b) | : rep (b) | |||
{ | { | |||
rep->count++; | rep->count++; | |||
} | } | |||
graphics_toolkit (const graphics_toolkit& b) | graphics_toolkit (const graphics_toolkit& b) | |||
: rep (b.rep) | : rep (b.rep) | |||
{ | { | |||
rep->count++; | rep->count++; | |||
} | } | |||
~graphics_toolkit (void) | ~graphics_toolkit (void) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
} | } | |||
graphics_toolkit& operator = (const graphics_toolkit& b) | graphics_toolkit& operator = (const graphics_toolkit& b) | |||
{ | { | |||
if (rep != b.rep) | if (rep != b.rep) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = b.rep; | rep = b.rep; | |||
rep->count++; | rep->count++; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
operator bool (void) const { return rep->is_valid (); } | operator bool (void) const { return rep->is_valid (); } | |||
std::string get_name (void) const { return rep->get_name (); } | std::string get_name (void) const { return rep->get_name (); } | |||
void redraw_figure (const graphics_object& go) const | void redraw_figure (const graphics_object& go) const | |||
{ rep->redraw_figure (go); } | { rep->redraw_figure (go); } | |||
void print_figure (const graphics_object& go, const std::string& term, | void print_figure (const graphics_object& go, const std::string& term, | |||
const std::string& file, bool mono, | const std::string& file, bool mono, | |||
const std::string& debug_file = "") const | const std::string& debug_file = "") const | |||
{ rep->print_figure (go, term, file, mono, debug_file); } | { rep->print_figure (go, term, file, mono, debug_file); } | |||
Matrix get_canvas_size (const graphics_handle& fh) const | Matrix get_canvas_size (const graphics_handle& fh) const | |||
{ return rep->get_canvas_size (fh); } | { return rep->get_canvas_size (fh); } | |||
double get_screen_resolution (void) const | double get_screen_resolution (void) const | |||
{ return rep->get_screen_resolution (); } | { return rep->get_screen_resolution (); } | |||
Matrix get_screen_size (void) const | Matrix get_screen_size (void) const | |||
{ return rep->get_screen_size (); } | { return rep->get_screen_size (); } | |||
// Notifies graphics toolkit that object't property has changed. | // Notifies graphics toolkit that object't property has changed. | |||
void update (const graphics_object& go, int id) | void update (const graphics_object& go, int id) | |||
{ rep->update (go, id); } | { rep->update (go, id); } | |||
void update (const graphics_handle& h, int id) | void update (const graphics_handle& h, int id) | |||
{ rep->update (h, id); } | { rep->update (h, id); } | |||
// Notifies graphics toolkit that new object was created. | // Notifies graphics toolkit that new object was created. | |||
bool initialize (const graphics_object& go) | bool initialize (const graphics_object& go) | |||
{ return rep->initialize (go); } | { return rep->initialize (go); } | |||
bool initialize (const graphics_handle& h) | bool initialize (const graphics_handle& h) | |||
{ return rep->initialize (h); } | { return rep->initialize (h); } | |||
// Notifies graphics toolkit that object was destroyed. | // Notifies graphics toolkit that object was destroyed. | |||
// This is called only for explicitly deleted object. Children are | // This is called only for explicitly deleted object. Children are | |||
// deleted implicitly and graphics toolkit isn't notified. | // deleted implicitly and graphics toolkit isn't notified. | |||
void finalize (const graphics_object& go) | void finalize (const graphics_object& go) | |||
{ rep->finalize (go); } | { rep->finalize (go); } | |||
void finalize (const graphics_handle& h) | void finalize (const graphics_handle& h) | |||
{ rep->finalize (h); } | { rep->finalize (h); } | |||
// Close the graphics toolkit. | // Close the graphics toolkit. | |||
void close (void) { rep->close (); } | void close (void) { rep->close (); } | |||
private: | private: | |||
base_graphics_toolkit *rep; | base_graphics_toolkit *rep; | |||
}; | }; | |||
class gtk_manager | class gtk_manager | |||
skipping to change at line 2279 | skipping to change at line 2249 | |||
static void unload_toolkit (const std::string& name) | static void unload_toolkit (const std::string& name) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_unload_toolkit (name); | instance->do_unload_toolkit (name); | |||
} | } | |||
static graphics_toolkit find_toolkit (const std::string& name) | static graphics_toolkit find_toolkit (const std::string& name) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_find_toolkit (name) : graphics_toolkit (); | ? instance->do_find_toolkit (name) : graphics_toolkit (); | |||
} | } | |||
static Cell available_toolkits_list (void) | static Cell available_toolkits_list (void) | |||
{ | { | |||
return instance_ok () ? instance->do_available_toolkits_list () : Cell (); | return instance_ok () ? instance->do_available_toolkits_list () : Cell (); | |||
} | } | |||
static Cell loaded_toolkits_list (void) | static Cell loaded_toolkits_list (void) | |||
{ | { | |||
return instance_ok () ? instance->do_loaded_toolkits_list () : Cell (); | return instance_ok () ? instance->do_loaded_toolkits_list () : Cell (); | |||
skipping to change at line 2305 | skipping to change at line 2275 | |||
instance->do_unload_all_toolkits (); | instance->do_unload_all_toolkits (); | |||
} | } | |||
static std::string default_toolkit (void) | static std::string default_toolkit (void) | |||
{ | { | |||
return instance_ok () ? instance->do_default_toolkit () : std::string ( ); | return instance_ok () ? instance->do_default_toolkit () : std::string ( ); | |||
} | } | |||
private: | private: | |||
// FIXME -- default toolkit should be configurable. | gtk_manager (void); | |||
gtk_manager (void) | ||||
: dtk ("gnuplot"), available_toolkits (), loaded_toolkits () { } | ||||
~gtk_manager (void) { } | ~gtk_manager (void) { } | |||
static void create_instance (void); | OCTINTERP_API static void create_instance (void); | |||
static bool instance_ok (void) | static bool instance_ok (void) | |||
{ | { | |||
bool retval = true; | bool retval = true; | |||
if (! instance) | if (! instance) | |||
create_instance (); | create_instance (); | |||
if (! instance) | if (! instance) | |||
{ | { | |||
::error ("unable to create gh_manager!"); | ::error ("unable to create gh_manager!"); | |||
retval = false; | retval = false; | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
static void cleanup_instance (void) { delete instance; instance = 0; } | static void cleanup_instance (void) { delete instance; instance = 0; } | |||
static gtk_manager *instance; | OCTINTERP_API static gtk_manager *instance; | |||
// The name of the default toolkit. | // The name of the default toolkit. | |||
std::string dtk; | std::string dtk; | |||
// The list of toolkits that we know about. | // The list of toolkits that we know about. | |||
std::set<std::string> available_toolkits; | std::set<std::string> available_toolkits; | |||
// The list of toolkits we have actually loaded. | // The list of toolkits we have actually loaded. | |||
std::map<std::string, graphics_toolkit> loaded_toolkits; | std::map<std::string, graphics_toolkit> loaded_toolkits; | |||
skipping to change at line 2445 | skipping to change at line 2412 | |||
class OCTINTERP_API base_properties | class OCTINTERP_API base_properties | |||
{ | { | |||
public: | public: | |||
base_properties (const std::string& ty = "unknown", | base_properties (const std::string& ty = "unknown", | |||
const graphics_handle& mh = graphics_handle (), | const graphics_handle& mh = graphics_handle (), | |||
const graphics_handle& p = graphics_handle ()); | const graphics_handle& p = graphics_handle ()); | |||
virtual ~base_properties (void) { } | virtual ~base_properties (void) { } | |||
virtual std::string graphics_object_name (void) const { return "unknonwn" ; } | virtual std::string graphics_object_name (void) const { return "unknown"; } | |||
void mark_modified (void); | void mark_modified (void); | |||
void override_defaults (base_graphics_object& obj); | void override_defaults (base_graphics_object& obj); | |||
virtual void init_integerhandle (const octave_value&) | virtual void init_integerhandle (const octave_value&) | |||
{ | { | |||
panic_impossible (); | panic_impossible (); | |||
} | } | |||
// Look through DEFAULTS for properties with given CLASS_NAME, and | // Look through DEFAULTS for properties with given CLASS_NAME, and | |||
// apply them to the current object with set (virtual method). | // apply them to the current object with set (virtual method). | |||
void set_from_list (base_graphics_object& obj, property_list& defaults); | void set_from_list (base_graphics_object& obj, property_list& defaults); | |||
void insert_property (const std::string& name, property p) | void insert_property (const std::string& name, property p) | |||
{ | { | |||
p.set_name (name); | p.set_name (name); | |||
p.set_parent (__myhandle__); | p.set_parent (__myhandle__); | |||
all_props[name] = p; | all_props[name] = p; | |||
} | } | |||
virtual void set (const caseless_str&, const octave_value&); | virtual void set (const caseless_str&, const octave_value&); | |||
virtual octave_value get (const caseless_str& pname) const; | virtual octave_value get (const caseless_str& pname) const; | |||
virtual octave_value get (const std::string& pname) const | virtual octave_value get (const std::string& pname) const | |||
{ | { | |||
return get (caseless_str (pname)); | return get (caseless_str (pname)); | |||
} | } | |||
skipping to change at line 2495 | skipping to change at line 2462 | |||
virtual bool has_property (const caseless_str&) const | virtual bool has_property (const caseless_str&) const | |||
{ | { | |||
panic_impossible (); | panic_impossible (); | |||
return false; | return false; | |||
} | } | |||
bool is_modified (void) const { return is___modified__ (); } | bool is_modified (void) const { return is___modified__ (); } | |||
virtual void remove_child (const graphics_handle& h) | virtual void remove_child (const graphics_handle& h) | |||
{ | { | |||
if (children.remove_child (h.value ())) | if (children.remove_child (h.value ())) | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
virtual void adopt (const graphics_handle& h) | virtual void adopt (const graphics_handle& h) | |||
{ | { | |||
children.adopt (h.value ()); | children.adopt (h.value ()); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
virtual graphics_toolkit get_toolkit (void) const; | virtual graphics_toolkit get_toolkit (void) const; | |||
virtual Matrix get_boundingbox (bool /*internal*/ = false, | virtual Matrix | |||
const Matrix& /*parent_pix_size*/ = Matri | get_boundingbox (bool /*internal*/ = false, | |||
x ()) const | const Matrix& /*parent_pix_size*/ = Matrix ()) const | |||
{ return Matrix (1, 4, 0.0); } | { return Matrix (1, 4, 0.0); } | |||
virtual void update_boundingbox (void); | virtual void update_boundingbox (void); | |||
virtual void update_autopos (const std::string& elem_type); | virtual void update_autopos (const std::string& elem_type); | |||
virtual void add_listener (const caseless_str&, const octave_value&, | virtual void add_listener (const caseless_str&, const octave_value&, | |||
listener_mode = POSTSET); | listener_mode = POSTSET); | |||
virtual void delete_listener (const caseless_str&, const octave_value&, | virtual void delete_listener (const caseless_str&, const octave_value&, | |||
listener_mode = POSTSET); | listener_mode = POSTSET); | |||
void set_tag (const octave_value& val) { tag = val; } | void set_tag (const octave_value& val) { tag = val; } | |||
void set_parent (const octave_value& val); | void set_parent (const octave_value& val); | |||
Matrix get_children (void) const | Matrix get_children (void) const | |||
{ | { | |||
return children.get_children (); | return children.get_children (); | |||
} | } | |||
Matrix get_all_children (void) const | Matrix get_all_children (void) const | |||
{ | { | |||
return children.get_all (); | return children.get_all (); | |||
} | } | |||
Matrix get_hidden_children (void) const | Matrix get_hidden_children (void) const | |||
{ | { | |||
return children.get_hidden (); | return children.get_hidden (); | |||
} | } | |||
void set_modified (const octave_value& val) { set___modified__ (val); } | void set_modified (const octave_value& val) { set___modified__ (val); } | |||
void set___modified__ (const octave_value& val) { __modified__ = val; } | void set___modified__ (const octave_value& val) { __modified__ = val; } | |||
void reparent (const graphics_handle& new_parent) { parent = new_parent; } | void reparent (const graphics_handle& new_parent) { parent = new_parent; } | |||
// Update data limits for AXIS_TYPE (xdata, ydata, etc.) in the parent | // Update data limits for AXIS_TYPE (xdata, ydata, etc.) in the parent | |||
// axes object. | // axes object. | |||
virtual void update_axis_limits (const std::string& axis_type) const; | virtual void update_axis_limits (const std::string& axis_type) const; | |||
virtual void update_axis_limits (const std::string& axis_type, | virtual void update_axis_limits (const std::string& axis_type, | |||
const graphics_handle& h) const; | const graphics_handle& h) const; | |||
virtual void delete_children (bool clear = false) | virtual void delete_children (bool clear = false) | |||
{ | { | |||
children.delete_children (clear); | children.delete_children (clear); | |||
} | } | |||
void renumber_child (graphics_handle old_gh, graphics_handle new_gh) | void renumber_child (graphics_handle old_gh, graphics_handle new_gh) | |||
{ | { | |||
children.renumber (old_gh, new_gh); | children.renumber (old_gh, new_gh); | |||
} | } | |||
void renumber_parent (graphics_handle new_gh) | void renumber_parent (graphics_handle new_gh) | |||
{ | { | |||
parent = new_gh; | parent = new_gh; | |||
} | } | |||
static property_list::pval_map_type factory_defaults (void); | static property_list::pval_map_type factory_defaults (void); | |||
// FIXME -- these functions should be generated automatically by the | // FIXME: these functions should be generated automatically by the | |||
// genprops.awk script. | // genprops.awk script. | |||
// | // | |||
// EMIT_BASE_PROPERTIES_GET_FUNCTIONS | // EMIT_BASE_PROPERTIES_GET_FUNCTIONS | |||
virtual octave_value get_alim (void) const { return octave_value (); } | ||||
virtual octave_value get_clim (void) const { return octave_value (); } | ||||
virtual octave_value get_xlim (void) const { return octave_value (); } | virtual octave_value get_xlim (void) const { return octave_value (); } | |||
virtual octave_value get_ylim (void) const { return octave_value (); } | virtual octave_value get_ylim (void) const { return octave_value (); } | |||
virtual octave_value get_zlim (void) const { return octave_value (); } | virtual octave_value get_zlim (void) const { return octave_value (); } | |||
virtual octave_value get_clim (void) const { return octave_value (); } | ||||
virtual octave_value get_alim (void) const { return octave_value (); } | ||||
virtual bool is_aliminclude (void) const { return false; } | ||||
virtual bool is_climinclude (void) const { return false; } | ||||
virtual bool is_xliminclude (void) const { return false; } | virtual bool is_xliminclude (void) const { return false; } | |||
virtual bool is_yliminclude (void) const { return false; } | virtual bool is_yliminclude (void) const { return false; } | |||
virtual bool is_zliminclude (void) const { return false; } | virtual bool is_zliminclude (void) const { return false; } | |||
virtual bool is_climinclude (void) const { return false; } | ||||
virtual bool is_aliminclude (void) const { return false; } | ||||
bool is_handle_visible (void) const; | bool is_handle_visible (void) const; | |||
std::set<std::string> dynamic_property_names (void) const; | std::set<std::string> dynamic_property_names (void) const; | |||
bool has_dynamic_property (const std::string& pname); | bool has_dynamic_property (const std::string& pname); | |||
protected: | protected: | |||
std::set<std::string> dynamic_properties; | std::set<std::string> dynamic_properties; | |||
skipping to change at line 2631 | skipping to change at line 2599 | |||
callback_property createfcn; | callback_property createfcn; | |||
callback_property deletefcn; | callback_property deletefcn; | |||
radio_property handlevisibility; | radio_property handlevisibility; | |||
bool_property hittest; | bool_property hittest; | |||
bool_property interruptible; | bool_property interruptible; | |||
handle_property parent; | handle_property parent; | |||
bool_property selected; | bool_property selected; | |||
bool_property selectionhighlight; | bool_property selectionhighlight; | |||
string_property tag; | string_property tag; | |||
string_property type; | string_property type; | |||
handle_property uicontextmenu; | ||||
any_property userdata; | any_property userdata; | |||
bool_property visible; | bool_property visible; | |||
bool_property __modified__; | bool_property __modified__; | |||
graphics_handle __myhandle__; | graphics_handle __myhandle__; | |||
handle_property uicontextmenu; | ||||
public: | public: | |||
enum | enum | |||
{ | { | |||
ID_BEINGDELETED = 0, | ID_BEINGDELETED = 0, | |||
ID_BUSYACTION = 1, | ID_BUSYACTION = 1, | |||
ID_BUTTONDOWNFCN = 2, | ID_BUTTONDOWNFCN = 2, | |||
ID_CHILDREN = 3, | ID_CHILDREN = 3, | |||
ID_CLIPPING = 4, | ID_CLIPPING = 4, | |||
ID_CREATEFCN = 5, | ID_CREATEFCN = 5, | |||
ID_DELETEFCN = 6, | ID_DELETEFCN = 6, | |||
ID_HANDLEVISIBILITY = 7, | ID_HANDLEVISIBILITY = 7, | |||
ID_HITTEST = 8, | ID_HITTEST = 8, | |||
ID_INTERRUPTIBLE = 9, | ID_INTERRUPTIBLE = 9, | |||
ID_PARENT = 10, | ID_PARENT = 10, | |||
ID_SELECTED = 11, | ID_SELECTED = 11, | |||
ID_SELECTIONHIGHLIGHT = 12, | ID_SELECTIONHIGHLIGHT = 12, | |||
ID_TAG = 13, | ID_TAG = 13, | |||
ID_TYPE = 14, | ID_TYPE = 14, | |||
ID_USERDATA = 15, | ID_UICONTEXTMENU = 15, | |||
ID_VISIBLE = 16, | ID_USERDATA = 16, | |||
ID___MODIFIED__ = 17, | ID_VISIBLE = 17, | |||
ID___MYHANDLE__ = 18, | ID___MODIFIED__ = 18, | |||
ID_UICONTEXTMENU = 19 | ID___MYHANDLE__ = 19 | |||
}; | }; | |||
bool is_beingdeleted (void) const { return beingdeleted.is_on (); } | bool is_beingdeleted (void) const { return beingdeleted.is_on (); } | |||
std::string get_beingdeleted (void) const { return beingdeleted.current_v alue (); } | std::string get_beingdeleted (void) const { return beingdeleted.current_v alue (); } | |||
bool busyaction_is (const std::string& v) const { return busyaction.is (v ); } | bool busyaction_is (const std::string& v) const { return busyaction.is (v ); } | |||
std::string get_busyaction (void) const { return busyaction.current_value (); } | std::string get_busyaction (void) const { return busyaction.current_value (); } | |||
void execute_buttondownfcn (const octave_value& data = octave_value ()) c onst { buttondownfcn.execute (data); } | void execute_buttondownfcn (const octave_value& data = octave_value ()) c onst { buttondownfcn.execute (data); } | |||
octave_value get_buttondownfcn (void) const { return buttondownfcn.get () ; } | octave_value get_buttondownfcn (void) const { return buttondownfcn.get () ; } | |||
skipping to change at line 2702 | skipping to change at line 2670 | |||
bool is_selected (void) const { return selected.is_on (); } | bool is_selected (void) const { return selected.is_on (); } | |||
std::string get_selected (void) const { return selected.current_value (); } | std::string get_selected (void) const { return selected.current_value (); } | |||
bool is_selectionhighlight (void) const { return selectionhighlight.is_on (); } | bool is_selectionhighlight (void) const { return selectionhighlight.is_on (); } | |||
std::string get_selectionhighlight (void) const { return selectionhighlig ht.current_value (); } | std::string get_selectionhighlight (void) const { return selectionhighlig ht.current_value (); } | |||
std::string get_tag (void) const { return tag.string_value (); } | std::string get_tag (void) const { return tag.string_value (); } | |||
std::string get_type (void) const { return type.string_value (); } | std::string get_type (void) const { return type.string_value (); } | |||
graphics_handle get_uicontextmenu (void) const { return uicontextmenu.han | ||||
dle_value (); } | ||||
octave_value get_userdata (void) const { return userdata.get (); } | octave_value get_userdata (void) const { return userdata.get (); } | |||
bool is_visible (void) const { return visible.is_on (); } | bool is_visible (void) const { return visible.is_on (); } | |||
std::string get_visible (void) const { return visible.current_value (); } | std::string get_visible (void) const { return visible.current_value (); } | |||
bool is___modified__ (void) const { return __modified__.is_on (); } | bool is___modified__ (void) const { return __modified__.is_on (); } | |||
std::string get___modified__ (void) const { return __modified__.current_v alue (); } | std::string get___modified__ (void) const { return __modified__.current_v alue (); } | |||
graphics_handle get___myhandle__ (void) const { return __myhandle__; } | graphics_handle get___myhandle__ (void) const { return __myhandle__; } | |||
graphics_handle get_uicontextmenu (void) const { return uicontextmenu.han | ||||
dle_value (); } | ||||
void set_beingdeleted (const octave_value& val) | void set_beingdeleted (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (beingdeleted.set (val, true)) | if (beingdeleted.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
skipping to change at line 2846 | skipping to change at line 2814 | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (selectionhighlight.set (val, true)) | if (selectionhighlight.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_userdata (const octave_value& val) | void set_uicontextmenu (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (userdata.set (val, true)) | if (uicontextmenu.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_visible (const octave_value& val) | void set_userdata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (visible.set (val, true)) | if (userdata.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_uicontextmenu (const octave_value& val) | void set_visible (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (uicontextmenu.set (val, true)) | if (visible.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
protected: | protected: | |||
struct cmp_caseless_str | struct cmp_caseless_str | |||
{ | ||||
bool operator () (const caseless_str &a, const caseless_str &b) const | ||||
{ | { | |||
bool operator () (const caseless_str &a, const caseless_str &b) const | std::string a1 = a; | |||
{ | std::transform (a1.begin (), a1.end (), a1.begin (), tolower); | |||
std::string a1 = a; | std::string b1 = b; | |||
std::transform (a1.begin (), a1.end (), a1.begin (), tolower); | std::transform (b1.begin (), b1.end (), b1.begin (), tolower); | |||
std::string b1 = b; | ||||
std::transform (b1.begin (), b1.end (), b1.begin (), tolower); | ||||
return a1 < b1; | return a1 < b1; | |||
} | } | |||
}; | }; | |||
std::map<caseless_str, property, cmp_caseless_str> all_props; | std::map<caseless_str, property, cmp_caseless_str> all_props; | |||
protected: | protected: | |||
void insert_static_property (const std::string& name, base_property& p) | void insert_static_property (const std::string& name, base_property& p) | |||
{ insert_property (name, property (&p, true)); } | { insert_property (name, property (&p, true)); } | |||
virtual void init (void) { } | virtual void init (void) { } | |||
}; | }; | |||
class OCTINTERP_API base_graphics_object | class OCTINTERP_API base_graphics_object | |||
{ | { | |||
public: | public: | |||
friend class graphics_object; | friend class graphics_object; | |||
base_graphics_object (void) : count (1), toolkit_flag (false) { } | base_graphics_object (void) : count (1), toolkit_flag (false) { } | |||
skipping to change at line 3073 | skipping to change at line 3041 | |||
virtual void update_axis_limits (const std::string& axis_type, | virtual void update_axis_limits (const std::string& axis_type, | |||
const graphics_handle& h); | const graphics_handle& h); | |||
virtual bool valid_object (void) const { return false; } | virtual bool valid_object (void) const { return false; } | |||
bool valid_toolkit_object (void) const { return toolkit_flag; } | bool valid_toolkit_object (void) const { return toolkit_flag; } | |||
virtual std::string type (void) const | virtual std::string type (void) const | |||
{ | { | |||
return (valid_object () ? get_properties ().graphics_object_name () | return (valid_object () ? get_properties ().graphics_object_name () | |||
: "unknown"); | : "unknown"); | |||
} | } | |||
bool isa (const std::string& go_name) const | bool isa (const std::string& go_name) const | |||
{ | { | |||
return type () == go_name; | return type () == go_name; | |||
} | } | |||
virtual graphics_toolkit get_toolkit (void) const | virtual graphics_toolkit get_toolkit (void) const | |||
{ | { | |||
if (valid_object ()) | if (valid_object ()) | |||
skipping to change at line 3095 | skipping to change at line 3063 | |||
else | else | |||
{ | { | |||
error ("base_graphics_object::get_toolkit: invalid graphics object" ); | error ("base_graphics_object::get_toolkit: invalid graphics object" ); | |||
return graphics_toolkit (); | return graphics_toolkit (); | |||
} | } | |||
} | } | |||
virtual void add_property_listener (const std::string& nm, | virtual void add_property_listener (const std::string& nm, | |||
const octave_value& v, | const octave_value& v, | |||
listener_mode mode = POSTSET) | listener_mode mode = POSTSET) | |||
{ | { | |||
if (valid_object ()) | if (valid_object ()) | |||
get_properties ().add_listener (nm, v, mode); | get_properties ().add_listener (nm, v, mode); | |||
} | } | |||
virtual void delete_property_listener (const std::string& nm, | virtual void delete_property_listener (const std::string& nm, | |||
const octave_value& v, | const octave_value& v, | |||
listener_mode mode = POSTSET) | listener_mode mode = POSTSET) | |||
{ | { | |||
if (valid_object ()) | if (valid_object ()) | |||
get_properties ().delete_listener (nm, v, mode); | get_properties ().delete_listener (nm, v, mode); | |||
} | } | |||
virtual void remove_all_listeners (void); | virtual void remove_all_listeners (void); | |||
virtual void reset_default_properties (void) | virtual void reset_default_properties (void) | |||
{ | { | |||
if (valid_object ()) | if (valid_object ()) | |||
{ | { | |||
std::string msg = (type () + "::reset_default_properties"); | std::string msg = (type () + "::reset_default_properties"); | |||
gripe_not_implemented (msg.c_str ()); | gripe_not_implemented (msg.c_str ()); | |||
} | } | |||
else | else | |||
error ("base_graphics_object::default: invalid graphics object"); | error ("base_graphics_object::default: invalid graphics object"); | |||
} | } | |||
protected: | protected: | |||
virtual void initialize (const graphics_object& go) | virtual void initialize (const graphics_object& go) | |||
{ | { | |||
if (! toolkit_flag) | if (! toolkit_flag) | |||
toolkit_flag = get_toolkit ().initialize (go); | toolkit_flag = get_toolkit ().initialize (go); | |||
} | } | |||
virtual void finalize (const graphics_object& go) | virtual void finalize (const graphics_object& go) | |||
{ | { | |||
if (toolkit_flag) | if (toolkit_flag) | |||
{ | { | |||
get_toolkit ().finalize (go); | get_toolkit ().finalize (go); | |||
toolkit_flag = false; | toolkit_flag = false; | |||
} | } | |||
} | } | |||
virtual void update (const graphics_object& go, int id) | virtual void update (const graphics_object& go, int id) | |||
{ | { | |||
if (toolkit_flag) | if (toolkit_flag) | |||
get_toolkit ().update (go, id); | get_toolkit ().update (go, id); | |||
} | } | |||
protected: | protected: | |||
// A reference count. | // A reference count. | |||
octave_refcount<int> count; | octave_refcount<int> count; | |||
// A flag telling whether this object is a valid object | // A flag telling whether this object is a valid object | |||
// in the backend context. | // in the backend context. | |||
bool toolkit_flag; | bool toolkit_flag; | |||
// No copying! | // No copying! | |||
skipping to change at line 3225 | skipping to change at line 3193 | |||
void set_value_or_default (const caseless_str& name, | void set_value_or_default (const caseless_str& name, | |||
const octave_value& val); | const octave_value& val); | |||
void set_defaults (const std::string& mode) { rep->set_defaults (mode); } | void set_defaults (const std::string& mode) { rep->set_defaults (mode); } | |||
octave_value get (bool all = false) const { return rep->get (all); } | octave_value get (bool all = false) const { return rep->get (all); } | |||
octave_value get (const caseless_str& name) const | octave_value get (const caseless_str& name) const | |||
{ | { | |||
return name.compare ("default") | return name.compare ("default") | |||
? get_defaults () | ? get_defaults () | |||
: (name.compare ("factory") | : (name.compare ("factory") | |||
? get_factory_defaults () : rep->get (name)); | ? get_factory_defaults () : rep->get (name)); | |||
} | } | |||
octave_value get (const std::string& name) const | octave_value get (const std::string& name) const | |||
{ | { | |||
return get (caseless_str (name)); | return get (caseless_str (name)); | |||
} | } | |||
octave_value get (const char *name) const | octave_value get (const char *name) const | |||
{ | { | |||
return get (caseless_str (name)); | return get (caseless_str (name)); | |||
skipping to change at line 3301 | skipping to change at line 3269 | |||
{ | { | |||
rep->update_axis_limits (axis_type, h); | rep->update_axis_limits (axis_type, h); | |||
} | } | |||
bool valid_object (void) const { return rep->valid_object (); } | bool valid_object (void) const { return rep->valid_object (); } | |||
std::string type (void) const { return rep->type (); } | std::string type (void) const { return rep->type (); } | |||
operator bool (void) const { return rep->valid_object (); } | operator bool (void) const { return rep->valid_object (); } | |||
// FIXME -- these functions should be generated automatically by the | // FIXME: these functions should be generated automatically by the | |||
// genprops.awk script. | // genprops.awk script. | |||
// | // | |||
// EMIT_GRAPHICS_OBJECT_GET_FUNCTIONS | // EMIT_GRAPHICS_OBJECT_GET_FUNCTIONS | |||
octave_value get_alim (void) const | ||||
{ return get_properties ().get_alim (); } | ||||
octave_value get_clim (void) const | ||||
{ return get_properties ().get_clim (); } | ||||
octave_value get_xlim (void) const | octave_value get_xlim (void) const | |||
{ return get_properties ().get_xlim (); } | { return get_properties ().get_xlim (); } | |||
octave_value get_ylim (void) const | octave_value get_ylim (void) const | |||
{ return get_properties ().get_ylim (); } | { return get_properties ().get_ylim (); } | |||
octave_value get_zlim (void) const | octave_value get_zlim (void) const | |||
{ return get_properties ().get_zlim (); } | { return get_properties ().get_zlim (); } | |||
octave_value get_clim (void) const | bool is_aliminclude (void) const | |||
{ return get_properties ().get_clim (); } | { return get_properties ().is_aliminclude (); } | |||
octave_value get_alim (void) const | bool is_climinclude (void) const | |||
{ return get_properties ().get_alim (); } | { return get_properties ().is_climinclude (); } | |||
bool is_xliminclude (void) const | bool is_xliminclude (void) const | |||
{ return get_properties ().is_xliminclude (); } | { return get_properties ().is_xliminclude (); } | |||
bool is_yliminclude (void) const | bool is_yliminclude (void) const | |||
{ return get_properties ().is_yliminclude (); } | { return get_properties ().is_yliminclude (); } | |||
bool is_zliminclude (void) const | bool is_zliminclude (void) const | |||
{ return get_properties ().is_zliminclude (); } | { return get_properties ().is_zliminclude (); } | |||
bool is_climinclude (void) const | ||||
{ return get_properties ().is_climinclude (); } | ||||
bool is_aliminclude (void) const | ||||
{ return get_properties ().is_aliminclude (); } | ||||
bool is_handle_visible (void) const | bool is_handle_visible (void) const | |||
{ return get_properties ().is_handle_visible (); } | { return get_properties ().is_handle_visible (); } | |||
graphics_toolkit get_toolkit (void) const { return rep->get_toolkit (); } | graphics_toolkit get_toolkit (void) const { return rep->get_toolkit (); } | |||
void add_property_listener (const std::string& nm, const octave_value& v, | void add_property_listener (const std::string& nm, const octave_value& v, | |||
listener_mode mode = POSTSET) | listener_mode mode = POSTSET) | |||
{ rep->add_property_listener (nm, v, mode); } | { rep->add_property_listener (nm, v, mode); } | |||
void delete_property_listener (const std::string& nm, const octave_value& v, | void delete_property_listener (const std::string& nm, const octave_value& v, | |||
listener_mode mode = POSTSET) | listener_mode mode = POSTSET) | |||
{ rep->delete_property_listener (nm, v, mode); } | { rep->delete_property_listener (nm, v, mode); } | |||
void initialize (void) { rep->initialize (*this); } | void initialize (void) { rep->initialize (*this); } | |||
void finalize (void) { rep->finalize (*this); } | void finalize (void) { rep->finalize (*this); } | |||
void update (int id) { rep->update (*this, id); } | void update (int id) { rep->update (*this, id); } | |||
void reset_default_properties (void) | void reset_default_properties (void) | |||
{ rep->reset_default_properties (); } | { rep->reset_default_properties (); } | |||
skipping to change at line 3372 | skipping to change at line 3340 | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API root_figure : public base_graphics_object | class OCTINTERP_API root_figure : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
void remove_child (const graphics_handle& h); | void remove_child (const graphics_handle& h); | |||
Matrix get_boundingbox (bool internal = false, | ||||
const Matrix& parent_pix_size = Matrix ()) cons | ||||
t; | ||||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// FIXME -- it seems strange to me that the diary, diaryfile, | // FIXME: it seems strange to me that the diary, diaryfile, | |||
// echo, format, formatspacing, language, and recursionlimit | // echo, errormessage, format, formatspacing, language, and | |||
// properties are here. WTF do they have to do with graphics? | // recursionlimit properties are here. | |||
// WTF do they have to do with graphics? | ||||
// Also note that these properties (and the monitorpositions, | // Also note that these properties (and the monitorpositions, | |||
// pointerlocation, and pointerwindow properties) are not yet used | // pointerlocation, and pointerwindow properties) are not yet used | |||
// by Octave, so setting them will have no effect, and changes | // by Octave, so setting them will have no effect, and changes | |||
// made elswhere (say, the diary or format functions) will not | // made elswhere (say, the diary or format functions) will not | |||
// cause these properties to be updated. | // cause these properties to be updated. | |||
// ANSWER: Matlab defines these properties and uses them in | ||||
// the same way that Octave uses an internal static variable to | ||||
// keep track of state. set (0, "echo", "on") is equivalent | ||||
// to Octave's echo ("on"). Maybe someday we can connect callbacks | ||||
// that actually call Octave's own functions for this. | ||||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 3432 | skipping to change at line 3411 | |||
bool has_property (const caseless_str& pname) const; | bool has_property (const caseless_str& pname) const; | |||
private: | private: | |||
handle_property callbackobject; | handle_property callbackobject; | |||
array_property commandwindowsize; | array_property commandwindowsize; | |||
handle_property currentfigure; | handle_property currentfigure; | |||
bool_property diary; | bool_property diary; | |||
string_property diaryfile; | string_property diaryfile; | |||
bool_property echo; | bool_property echo; | |||
string_property errormessage; | ||||
string_property fixedwidthfontname; | ||||
radio_property format; | radio_property format; | |||
radio_property formatspacing; | radio_property formatspacing; | |||
string_property language; | string_property language; | |||
array_property monitorpositions; | array_property monitorpositions; | |||
array_property pointerlocation; | array_property pointerlocation; | |||
double_property pointerwindow; | double_property pointerwindow; | |||
double_property recursionlimit; | double_property recursionlimit; | |||
double_property screendepth; | double_property screendepth; | |||
double_property screenpixelsperinch; | double_property screenpixelsperinch; | |||
array_property screensize; | array_property screensize; | |||
skipping to change at line 3455 | skipping to change at line 3436 | |||
public: | public: | |||
enum | enum | |||
{ | { | |||
ID_CALLBACKOBJECT = 1000, | ID_CALLBACKOBJECT = 1000, | |||
ID_COMMANDWINDOWSIZE = 1001, | ID_COMMANDWINDOWSIZE = 1001, | |||
ID_CURRENTFIGURE = 1002, | ID_CURRENTFIGURE = 1002, | |||
ID_DIARY = 1003, | ID_DIARY = 1003, | |||
ID_DIARYFILE = 1004, | ID_DIARYFILE = 1004, | |||
ID_ECHO = 1005, | ID_ECHO = 1005, | |||
ID_FORMAT = 1006, | ID_ERRORMESSAGE = 1006, | |||
ID_FORMATSPACING = 1007, | ID_FIXEDWIDTHFONTNAME = 1007, | |||
ID_LANGUAGE = 1008, | ID_FORMAT = 1008, | |||
ID_MONITORPOSITIONS = 1009, | ID_FORMATSPACING = 1009, | |||
ID_POINTERLOCATION = 1010, | ID_LANGUAGE = 1010, | |||
ID_POINTERWINDOW = 1011, | ID_MONITORPOSITIONS = 1011, | |||
ID_RECURSIONLIMIT = 1012, | ID_POINTERLOCATION = 1012, | |||
ID_SCREENDEPTH = 1013, | ID_POINTERWINDOW = 1013, | |||
ID_SCREENPIXELSPERINCH = 1014, | ID_RECURSIONLIMIT = 1014, | |||
ID_SCREENSIZE = 1015, | ID_SCREENDEPTH = 1015, | |||
ID_SHOWHIDDENHANDLES = 1016, | ID_SCREENPIXELSPERINCH = 1016, | |||
ID_UNITS = 1017 | ID_SCREENSIZE = 1017, | |||
ID_SHOWHIDDENHANDLES = 1018, | ||||
ID_UNITS = 1019 | ||||
}; | }; | |||
graphics_handle get_callbackobject (void) const { return callbackobject.h andle_value (); } | graphics_handle get_callbackobject (void) const { return callbackobject.h andle_value (); } | |||
octave_value get_commandwindowsize (void) const { return commandwindowsiz e.get (); } | octave_value get_commandwindowsize (void) const { return commandwindowsiz e.get (); } | |||
graphics_handle get_currentfigure (void) const { return currentfigure.han dle_value (); } | graphics_handle get_currentfigure (void) const { return currentfigure.han dle_value (); } | |||
bool is_diary (void) const { return diary.is_on (); } | bool is_diary (void) const { return diary.is_on (); } | |||
std::string get_diary (void) const { return diary.current_value (); } | std::string get_diary (void) const { return diary.current_value (); } | |||
std::string get_diaryfile (void) const { return diaryfile.string_value () ; } | std::string get_diaryfile (void) const { return diaryfile.string_value () ; } | |||
bool is_echo (void) const { return echo.is_on (); } | bool is_echo (void) const { return echo.is_on (); } | |||
std::string get_echo (void) const { return echo.current_value (); } | std::string get_echo (void) const { return echo.current_value (); } | |||
std::string get_errormessage (void) const { return errormessage.string_va | ||||
lue (); } | ||||
std::string get_fixedwidthfontname (void) const { return fixedwidthfontna | ||||
me.string_value (); } | ||||
bool format_is (const std::string& v) const { return format.is (v); } | bool format_is (const std::string& v) const { return format.is (v); } | |||
std::string get_format (void) const { return format.current_value (); } | std::string get_format (void) const { return format.current_value (); } | |||
bool formatspacing_is (const std::string& v) const { return formatspacing .is (v); } | bool formatspacing_is (const std::string& v) const { return formatspacing .is (v); } | |||
std::string get_formatspacing (void) const { return formatspacing.current _value (); } | std::string get_formatspacing (void) const { return formatspacing.current _value (); } | |||
std::string get_language (void) const { return language.string_value (); } | std::string get_language (void) const { return language.string_value (); } | |||
octave_value get_monitorpositions (void) const { return monitorpositions. get (); } | octave_value get_monitorpositions (void) const { return monitorpositions. get (); } | |||
skipping to change at line 3559 | skipping to change at line 3546 | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (echo.set (val, true)) | if (echo.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_errormessage (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (errormessage.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_fixedwidthfontname (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (fixedwidthfontname.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_format (const octave_value& val) | void set_format (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (format.set (val, true)) | if (format.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
skipping to change at line 3703 | skipping to change at line 3712 | |||
private: | private: | |||
std::list<graphics_handle> cbo_stack; | std::list<graphics_handle> cbo_stack; | |||
}; | }; | |||
private: | private: | |||
properties xproperties; | properties xproperties; | |||
public: | public: | |||
root_figure (void) : xproperties (0, graphics_handle ()), default_propert | root_figure (void) | |||
ies () { } | : xproperties (0, graphics_handle ()), default_properties () { } | |||
~root_figure (void) { } | ~root_figure (void) { } | |||
void mark_modified (void) { } | void mark_modified (void) { } | |||
void override_defaults (base_graphics_object& obj) | void override_defaults (base_graphics_object& obj) | |||
{ | { | |||
// Now override with our defaults. If the default_properties | // Now override with our defaults. If the default_properties | |||
// list includes the properties for all defaults (line, | // list includes the properties for all defaults (line, | |||
// surface, etc.) then we don't have to know the type of OBJ | // surface, etc.) then we don't have to know the type of OBJ | |||
skipping to change at line 3754 | skipping to change at line 3764 | |||
octave_value get_default (const caseless_str& name) const | octave_value get_default (const caseless_str& name) const | |||
{ | { | |||
octave_value retval = default_properties.lookup (name); | octave_value retval = default_properties.lookup (name); | |||
if (retval.is_undefined ()) | if (retval.is_undefined ()) | |||
{ | { | |||
// no default property found, use factory default | // no default property found, use factory default | |||
retval = factory_properties.lookup (name); | retval = factory_properties.lookup (name); | |||
if (retval.is_undefined ()) | if (retval.is_undefined ()) | |||
error ("get: invalid default property `%s'", name.c_str ()); | error ("get: invalid default property '%s'", name.c_str ()); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
octave_value get_factory_default (const caseless_str& name) const | octave_value get_factory_default (const caseless_str& name) const | |||
{ | { | |||
octave_value retval = factory_properties.lookup (name); | octave_value retval = factory_properties.lookup (name); | |||
if (retval.is_undefined ()) | if (retval.is_undefined ()) | |||
error ("get: invalid factory default property `%s'", name.c_str ()); | error ("get: invalid factory default property '%s'", name.c_str ()); | |||
return retval; | return retval; | |||
} | } | |||
octave_value get_defaults (void) const | octave_value get_defaults (void) const | |||
{ | { | |||
return default_properties.as_struct ("default"); | return default_properties.as_struct ("default"); | |||
} | } | |||
octave_value get_factory_defaults (void) const | octave_value get_factory_defaults (void) const | |||
skipping to change at line 3805 | skipping to change at line 3815 | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API figure : public base_graphics_object | class OCTINTERP_API figure : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
void init_integerhandle (const octave_value& val) | void init_integerhandle (const octave_value& val) | |||
{ | { | |||
integerhandle = val; | integerhandle = val; | |||
} | } | |||
void remove_child (const graphics_handle& h); | void remove_child (const graphics_handle& h); | |||
void set_visible (const octave_value& val); | void set_visible (const octave_value& val); | |||
graphics_toolkit get_toolkit (void) const | graphics_toolkit get_toolkit (void) const | |||
{ | { | |||
if (! toolkit) | if (! toolkit) | |||
toolkit = gtk_manager::get_toolkit (); | toolkit = gtk_manager::get_toolkit (); | |||
return toolkit; | return toolkit; | |||
} | } | |||
void set_toolkit (const graphics_toolkit& b); | void set_toolkit (const graphics_toolkit& b); | |||
void set___graphics_toolkit__ (const octave_value& val) | void set___graphics_toolkit__ (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (val.is_string ()) | if (val.is_string ()) | |||
{ | { | |||
std::string nm = val.string_value (); | std::string nm = val.string_value (); | |||
skipping to change at line 3870 | skipping to change at line 3880 | |||
Matrix map_to_boundingbox (double x, double y) const; | Matrix map_to_boundingbox (double x, double y) const; | |||
void update_units (const caseless_str& old_units); | void update_units (const caseless_str& old_units); | |||
void update_paperunits (const caseless_str& old_paperunits); | void update_paperunits (const caseless_str& old_paperunits); | |||
std::string get_title (void) const; | std::string get_title (void) const; | |||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 3913 | skipping to change at line 3924 | |||
static std::set<std::string> core_property_names (void); | static std::set<std::string> core_property_names (void); | |||
static bool has_core_property (const caseless_str& pname); | static bool has_core_property (const caseless_str& pname); | |||
std::set<std::string> all_property_names (void) const; | std::set<std::string> all_property_names (void) const; | |||
bool has_property (const caseless_str& pname) const; | bool has_property (const caseless_str& pname) const; | |||
private: | private: | |||
any_property __plot_stream__; | array_property alphamap; | |||
bool_property __enhanced__; | callback_property buttondownfcn; | |||
radio_property nextplot; | ||||
callback_property closerequestfcn; | callback_property closerequestfcn; | |||
handle_property currentaxes; | ||||
array_property colormap; | ||||
radio_property paperorientation; | ||||
color_property color; | color_property color; | |||
array_property alphamap; | array_property colormap; | |||
handle_property currentaxes; | ||||
string_property currentcharacter; | string_property currentcharacter; | |||
handle_property currentobject; | handle_property currentobject; | |||
array_property currentpoint; | array_property currentpoint; | |||
bool_property dockcontrols; | bool_property dockcontrols; | |||
bool_property doublebuffer; | bool_property doublebuffer; | |||
string_property filename; | string_property filename; | |||
bool_property integerhandle; | bool_property integerhandle; | |||
bool_property inverthardcopy; | bool_property inverthardcopy; | |||
callback_property keypressfcn; | callback_property keypressfcn; | |||
callback_property keyreleasefcn; | callback_property keyreleasefcn; | |||
radio_property menubar; | radio_property menubar; | |||
double_property mincolormap; | double_property mincolormap; | |||
string_property name; | string_property name; | |||
radio_property nextplot; | ||||
bool_property numbertitle; | bool_property numbertitle; | |||
array_property outerposition; | array_property outerposition; | |||
radio_property paperunits; | radio_property paperorientation; | |||
array_property paperposition; | array_property paperposition; | |||
radio_property paperpositionmode; | radio_property paperpositionmode; | |||
array_property papersize; | array_property papersize; | |||
radio_property papertype; | radio_property papertype; | |||
radio_property paperunits; | ||||
radio_property pointer; | radio_property pointer; | |||
array_property pointershapecdata; | array_property pointershapecdata; | |||
array_property pointershapehotspot; | array_property pointershapehotspot; | |||
array_property position; | array_property position; | |||
radio_property renderer; | radio_property renderer; | |||
radio_property renderermode; | radio_property renderermode; | |||
bool_property resize; | bool_property resize; | |||
callback_property resizefcn; | callback_property resizefcn; | |||
radio_property selectiontype; | radio_property selectiontype; | |||
radio_property toolbar; | radio_property toolbar; | |||
radio_property units; | radio_property units; | |||
callback_property windowbuttondownfcn; | callback_property windowbuttondownfcn; | |||
callback_property windowbuttonmotionfcn; | callback_property windowbuttonmotionfcn; | |||
callback_property windowbuttonupfcn; | callback_property windowbuttonupfcn; | |||
callback_property windowbuttonwheelfcn; | callback_property windowkeypressfcn; | |||
callback_property windowkeyreleasefcn; | ||||
callback_property windowscrollwheelfcn; | ||||
radio_property windowstyle; | radio_property windowstyle; | |||
string_property wvisual; | string_property wvisual; | |||
radio_property wvisualmode; | radio_property wvisualmode; | |||
string_property xdisplay; | string_property xdisplay; | |||
string_property xvisual; | string_property xvisual; | |||
radio_property xvisualmode; | radio_property xvisualmode; | |||
callback_property buttondownfcn; | bool_property __enhanced__; | |||
string_property __graphics_toolkit__; | string_property __graphics_toolkit__; | |||
any_property __guidata__; | any_property __guidata__; | |||
any_property __plot_stream__; | ||||
public: | public: | |||
enum | enum | |||
{ | { | |||
ID___PLOT_STREAM__ = 2000, | ID_ALPHAMAP = 2000, | |||
ID___ENHANCED__ = 2001, | ID_BUTTONDOWNFCN = 2001, | |||
ID_NEXTPLOT = 2002, | ID_CLOSEREQUESTFCN = 2002, | |||
ID_CLOSEREQUESTFCN = 2003, | ID_COLOR = 2003, | |||
ID_CURRENTAXES = 2004, | ID_COLORMAP = 2004, | |||
ID_COLORMAP = 2005, | ID_CURRENTAXES = 2005, | |||
ID_PAPERORIENTATION = 2006, | ID_CURRENTCHARACTER = 2006, | |||
ID_COLOR = 2007, | ID_CURRENTOBJECT = 2007, | |||
ID_ALPHAMAP = 2008, | ID_CURRENTPOINT = 2008, | |||
ID_CURRENTCHARACTER = 2009, | ID_DOCKCONTROLS = 2009, | |||
ID_CURRENTOBJECT = 2010, | ID_DOUBLEBUFFER = 2010, | |||
ID_CURRENTPOINT = 2011, | ID_FILENAME = 2011, | |||
ID_DOCKCONTROLS = 2012, | ID_INTEGERHANDLE = 2012, | |||
ID_DOUBLEBUFFER = 2013, | ID_INVERTHARDCOPY = 2013, | |||
ID_FILENAME = 2014, | ID_KEYPRESSFCN = 2014, | |||
ID_INTEGERHANDLE = 2015, | ID_KEYRELEASEFCN = 2015, | |||
ID_INVERTHARDCOPY = 2016, | ID_MENUBAR = 2016, | |||
ID_KEYPRESSFCN = 2017, | ID_MINCOLORMAP = 2017, | |||
ID_KEYRELEASEFCN = 2018, | ID_NAME = 2018, | |||
ID_MENUBAR = 2019, | ID_NEXTPLOT = 2019, | |||
ID_MINCOLORMAP = 2020, | ID_NUMBERTITLE = 2020, | |||
ID_NAME = 2021, | ID_OUTERPOSITION = 2021, | |||
ID_NUMBERTITLE = 2022, | ID_PAPERORIENTATION = 2022, | |||
ID_OUTERPOSITION = 2023, | ID_PAPERPOSITION = 2023, | |||
ID_PAPERUNITS = 2024, | ID_PAPERPOSITIONMODE = 2024, | |||
ID_PAPERPOSITION = 2025, | ID_PAPERSIZE = 2025, | |||
ID_PAPERPOSITIONMODE = 2026, | ID_PAPERTYPE = 2026, | |||
ID_PAPERSIZE = 2027, | ID_PAPERUNITS = 2027, | |||
ID_PAPERTYPE = 2028, | ID_POINTER = 2028, | |||
ID_POINTER = 2029, | ID_POINTERSHAPECDATA = 2029, | |||
ID_POINTERSHAPECDATA = 2030, | ID_POINTERSHAPEHOTSPOT = 2030, | |||
ID_POINTERSHAPEHOTSPOT = 2031, | ID_POSITION = 2031, | |||
ID_POSITION = 2032, | ID_RENDERER = 2032, | |||
ID_RENDERER = 2033, | ID_RENDERERMODE = 2033, | |||
ID_RENDERERMODE = 2034, | ID_RESIZE = 2034, | |||
ID_RESIZE = 2035, | ID_RESIZEFCN = 2035, | |||
ID_RESIZEFCN = 2036, | ID_SELECTIONTYPE = 2036, | |||
ID_SELECTIONTYPE = 2037, | ID_TOOLBAR = 2037, | |||
ID_TOOLBAR = 2038, | ID_UNITS = 2038, | |||
ID_UNITS = 2039, | ID_WINDOWBUTTONDOWNFCN = 2039, | |||
ID_WINDOWBUTTONDOWNFCN = 2040, | ID_WINDOWBUTTONMOTIONFCN = 2040, | |||
ID_WINDOWBUTTONMOTIONFCN = 2041, | ID_WINDOWBUTTONUPFCN = 2041, | |||
ID_WINDOWBUTTONUPFCN = 2042, | ID_WINDOWKEYPRESSFCN = 2042, | |||
ID_WINDOWBUTTONWHEELFCN = 2043, | ID_WINDOWKEYRELEASEFCN = 2043, | |||
ID_WINDOWSTYLE = 2044, | ID_WINDOWSCROLLWHEELFCN = 2044, | |||
ID_WVISUAL = 2045, | ID_WINDOWSTYLE = 2045, | |||
ID_WVISUALMODE = 2046, | ID_WVISUAL = 2046, | |||
ID_XDISPLAY = 2047, | ID_WVISUALMODE = 2047, | |||
ID_XVISUAL = 2048, | ID_XDISPLAY = 2048, | |||
ID_XVISUALMODE = 2049, | ID_XVISUAL = 2049, | |||
ID_BUTTONDOWNFCN = 2050, | ID_XVISUALMODE = 2050, | |||
ID___GRAPHICS_TOOLKIT__ = 2051, | ID___ENHANCED__ = 2051, | |||
ID___GUIDATA__ = 2052 | ID___GRAPHICS_TOOLKIT__ = 2052, | |||
ID___GUIDATA__ = 2053, | ||||
ID___PLOT_STREAM__ = 2054 | ||||
}; | }; | |||
octave_value get___plot_stream__ (void) const { return __plot_stream__.ge | octave_value get_alphamap (void) const { return alphamap.get (); } | |||
t (); } | ||||
bool is___enhanced__ (void) const { return __enhanced__.is_on (); } | ||||
std::string get___enhanced__ (void) const { return __enhanced__.current_v | ||||
alue (); } | ||||
bool nextplot_is (const std::string& v) const { return nextplot.is (v); } | void execute_buttondownfcn (const octave_value& data = octave_value ()) c | |||
std::string get_nextplot (void) const { return nextplot.current_value (); | onst { buttondownfcn.execute (data); } | |||
} | octave_value get_buttondownfcn (void) const { return buttondownfcn.get () | |||
; } | ||||
void execute_closerequestfcn (const octave_value& data = octave_value ()) const { closerequestfcn.execute (data); } | void execute_closerequestfcn (const octave_value& data = octave_value ()) const { closerequestfcn.execute (data); } | |||
octave_value get_closerequestfcn (void) const { return closerequestfcn.ge t (); } | octave_value get_closerequestfcn (void) const { return closerequestfcn.ge t (); } | |||
graphics_handle get_currentaxes (void) const { return currentaxes.handle_ | ||||
value (); } | ||||
octave_value get_colormap (void) const { return colormap.get (); } | ||||
bool paperorientation_is (const std::string& v) const { return paperorien | ||||
tation.is (v); } | ||||
std::string get_paperorientation (void) const { return paperorientation.c | ||||
urrent_value (); } | ||||
bool color_is_rgb (void) const { return color.is_rgb (); } | bool color_is_rgb (void) const { return color.is_rgb (); } | |||
bool color_is (const std::string& v) const { return color.is (v); } | bool color_is (const std::string& v) const { return color.is (v); } | |||
Matrix get_color_rgb (void) const { return (color.is_rgb () ? color.rgb ( ) : Matrix ()); } | Matrix get_color_rgb (void) const { return (color.is_rgb () ? color.rgb ( ) : Matrix ()); } | |||
octave_value get_color (void) const { return color.get (); } | octave_value get_color (void) const { return color.get (); } | |||
octave_value get_alphamap (void) const { return alphamap.get (); } | octave_value get_colormap (void) const { return colormap.get (); } | |||
graphics_handle get_currentaxes (void) const { return currentaxes.handle_ | ||||
value (); } | ||||
std::string get_currentcharacter (void) const { return currentcharacter.s tring_value (); } | std::string get_currentcharacter (void) const { return currentcharacter.s tring_value (); } | |||
graphics_handle get_currentobject (void) const { return currentobject.han dle_value (); } | graphics_handle get_currentobject (void) const { return currentobject.han dle_value (); } | |||
octave_value get_currentpoint (void) const { return currentpoint.get (); } | octave_value get_currentpoint (void) const { return currentpoint.get (); } | |||
bool is_dockcontrols (void) const { return dockcontrols.is_on (); } | bool is_dockcontrols (void) const { return dockcontrols.is_on (); } | |||
std::string get_dockcontrols (void) const { return dockcontrols.current_v alue (); } | std::string get_dockcontrols (void) const { return dockcontrols.current_v alue (); } | |||
skipping to change at line 4084 | skipping to change at line 4091 | |||
void execute_keyreleasefcn (const octave_value& data = octave_value ()) c onst { keyreleasefcn.execute (data); } | void execute_keyreleasefcn (const octave_value& data = octave_value ()) c onst { keyreleasefcn.execute (data); } | |||
octave_value get_keyreleasefcn (void) const { return keyreleasefcn.get () ; } | octave_value get_keyreleasefcn (void) const { return keyreleasefcn.get () ; } | |||
bool menubar_is (const std::string& v) const { return menubar.is (v); } | bool menubar_is (const std::string& v) const { return menubar.is (v); } | |||
std::string get_menubar (void) const { return menubar.current_value (); } | std::string get_menubar (void) const { return menubar.current_value (); } | |||
double get_mincolormap (void) const { return mincolormap.double_value (); } | double get_mincolormap (void) const { return mincolormap.double_value (); } | |||
std::string get_name (void) const { return name.string_value (); } | std::string get_name (void) const { return name.string_value (); } | |||
bool nextplot_is (const std::string& v) const { return nextplot.is (v); } | ||||
std::string get_nextplot (void) const { return nextplot.current_value (); | ||||
} | ||||
bool is_numbertitle (void) const { return numbertitle.is_on (); } | bool is_numbertitle (void) const { return numbertitle.is_on (); } | |||
std::string get_numbertitle (void) const { return numbertitle.current_val ue (); } | std::string get_numbertitle (void) const { return numbertitle.current_val ue (); } | |||
octave_value get_outerposition (void) const { return outerposition.get () ; } | octave_value get_outerposition (void) const { return outerposition.get () ; } | |||
bool paperunits_is (const std::string& v) const { return paperunits.is (v | bool paperorientation_is (const std::string& v) const { return paperorien | |||
); } | tation.is (v); } | |||
std::string get_paperunits (void) const { return paperunits.current_value | std::string get_paperorientation (void) const { return paperorientation.c | |||
(); } | urrent_value (); } | |||
octave_value get_paperposition (void) const { return paperposition.get () ; } | octave_value get_paperposition (void) const { return paperposition.get () ; } | |||
bool paperpositionmode_is (const std::string& v) const { return paperposi tionmode.is (v); } | bool paperpositionmode_is (const std::string& v) const { return paperposi tionmode.is (v); } | |||
std::string get_paperpositionmode (void) const { return paperpositionmode .current_value (); } | std::string get_paperpositionmode (void) const { return paperpositionmode .current_value (); } | |||
octave_value get_papersize (void) const { return papersize.get (); } | octave_value get_papersize (void) const { return papersize.get (); } | |||
bool papertype_is (const std::string& v) const { return papertype.is (v); } | bool papertype_is (const std::string& v) const { return papertype.is (v); } | |||
std::string get_papertype (void) const { return papertype.current_value ( ); } | std::string get_papertype (void) const { return papertype.current_value ( ); } | |||
bool paperunits_is (const std::string& v) const { return paperunits.is (v | ||||
); } | ||||
std::string get_paperunits (void) const { return paperunits.current_value | ||||
(); } | ||||
bool pointer_is (const std::string& v) const { return pointer.is (v); } | bool pointer_is (const std::string& v) const { return pointer.is (v); } | |||
std::string get_pointer (void) const { return pointer.current_value (); } | std::string get_pointer (void) const { return pointer.current_value (); } | |||
octave_value get_pointershapecdata (void) const { return pointershapecdat a.get (); } | octave_value get_pointershapecdata (void) const { return pointershapecdat a.get (); } | |||
octave_value get_pointershapehotspot (void) const { return pointershapeho tspot.get (); } | octave_value get_pointershapehotspot (void) const { return pointershapeho tspot.get (); } | |||
octave_value get_position (void) const { return position.get (); } | octave_value get_position (void) const { return position.get (); } | |||
bool renderer_is (const std::string& v) const { return renderer.is (v); } | bool renderer_is (const std::string& v) const { return renderer.is (v); } | |||
skipping to change at line 4141 | skipping to change at line 4154 | |||
void execute_windowbuttondownfcn (const octave_value& data = octave_value ()) const { windowbuttondownfcn.execute (data); } | void execute_windowbuttondownfcn (const octave_value& data = octave_value ()) const { windowbuttondownfcn.execute (data); } | |||
octave_value get_windowbuttondownfcn (void) const { return windowbuttondo wnfcn.get (); } | octave_value get_windowbuttondownfcn (void) const { return windowbuttondo wnfcn.get (); } | |||
void execute_windowbuttonmotionfcn (const octave_value& data = octave_val ue ()) const { windowbuttonmotionfcn.execute (data); } | void execute_windowbuttonmotionfcn (const octave_value& data = octave_val ue ()) const { windowbuttonmotionfcn.execute (data); } | |||
octave_value get_windowbuttonmotionfcn (void) const { return windowbutton motionfcn.get (); } | octave_value get_windowbuttonmotionfcn (void) const { return windowbutton motionfcn.get (); } | |||
void execute_windowbuttonupfcn (const octave_value& data = octave_value ( )) const { windowbuttonupfcn.execute (data); } | void execute_windowbuttonupfcn (const octave_value& data = octave_value ( )) const { windowbuttonupfcn.execute (data); } | |||
octave_value get_windowbuttonupfcn (void) const { return windowbuttonupfc n.get (); } | octave_value get_windowbuttonupfcn (void) const { return windowbuttonupfc n.get (); } | |||
void execute_windowbuttonwheelfcn (const octave_value& data = octave_valu | void execute_windowkeypressfcn (const octave_value& data = octave_value ( | |||
e ()) const { windowbuttonwheelfcn.execute (data); } | )) const { windowkeypressfcn.execute (data); } | |||
octave_value get_windowbuttonwheelfcn (void) const { return windowbuttonw | octave_value get_windowkeypressfcn (void) const { return windowkeypressfc | |||
heelfcn.get (); } | n.get (); } | |||
void execute_windowkeyreleasefcn (const octave_value& data = octave_value | ||||
()) const { windowkeyreleasefcn.execute (data); } | ||||
octave_value get_windowkeyreleasefcn (void) const { return windowkeyrelea | ||||
sefcn.get (); } | ||||
void execute_windowscrollwheelfcn (const octave_value& data = octave_valu | ||||
e ()) const { windowscrollwheelfcn.execute (data); } | ||||
octave_value get_windowscrollwheelfcn (void) const { return windowscrollw | ||||
heelfcn.get (); } | ||||
bool windowstyle_is (const std::string& v) const { return windowstyle.is (v); } | bool windowstyle_is (const std::string& v) const { return windowstyle.is (v); } | |||
std::string get_windowstyle (void) const { return windowstyle.current_val ue (); } | std::string get_windowstyle (void) const { return windowstyle.current_val ue (); } | |||
std::string get_wvisual (void) const { return wvisual.string_value (); } | std::string get_wvisual (void) const { return wvisual.string_value (); } | |||
bool wvisualmode_is (const std::string& v) const { return wvisualmode.is (v); } | bool wvisualmode_is (const std::string& v) const { return wvisualmode.is (v); } | |||
std::string get_wvisualmode (void) const { return wvisualmode.current_val ue (); } | std::string get_wvisualmode (void) const { return wvisualmode.current_val ue (); } | |||
std::string get_xdisplay (void) const { return xdisplay.string_value (); } | std::string get_xdisplay (void) const { return xdisplay.string_value (); } | |||
std::string get_xvisual (void) const { return xvisual.string_value (); } | std::string get_xvisual (void) const { return xvisual.string_value (); } | |||
bool xvisualmode_is (const std::string& v) const { return xvisualmode.is (v); } | bool xvisualmode_is (const std::string& v) const { return xvisualmode.is (v); } | |||
std::string get_xvisualmode (void) const { return xvisualmode.current_val ue (); } | std::string get_xvisualmode (void) const { return xvisualmode.current_val ue (); } | |||
void execute_buttondownfcn (const octave_value& data = octave_value ()) c | bool is___enhanced__ (void) const { return __enhanced__.is_on (); } | |||
onst { buttondownfcn.execute (data); } | std::string get___enhanced__ (void) const { return __enhanced__.current_v | |||
octave_value get_buttondownfcn (void) const { return buttondownfcn.get () | alue (); } | |||
; } | ||||
std::string get___graphics_toolkit__ (void) const { return __graphics_too lkit__.string_value (); } | std::string get___graphics_toolkit__ (void) const { return __graphics_too lkit__.string_value (); } | |||
octave_value get___guidata__ (void) const { return __guidata__.get (); } | octave_value get___guidata__ (void) const { return __guidata__.get (); } | |||
void set___plot_stream__ (const octave_value& val) | octave_value get___plot_stream__ (void) const { return __plot_stream__.ge | |||
{ | t (); } | |||
if (! error_state) | ||||
{ | ||||
if (__plot_stream__.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set___enhanced__ (const octave_value& val) | void set_alphamap (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (__enhanced__.set (val, true)) | if (alphamap.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_nextplot (const octave_value& val) | void set_buttondownfcn (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (nextplot.set (val, true)) | if (buttondownfcn.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_closerequestfcn (const octave_value& val) | void set_closerequestfcn (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (closerequestfcn.set (val, true)) | if (closerequestfcn.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_currentaxes (const octave_value& val); | ||||
void set_colormap (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (colormap.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_paperorientation (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (paperorientation.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_color (const octave_value& val) | void set_color (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (color.set (val, true)) | if (color.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_alphamap (const octave_value& val) | void set_colormap (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (alphamap.set (val, true)) | if (colormap.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_currentaxes (const octave_value& val); | ||||
void set_currentcharacter (const octave_value& val) | void set_currentcharacter (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (currentcharacter.set (val, true)) | if (currentcharacter.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
skipping to change at line 4390 | skipping to change at line 4378 | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (name.set (val, true)) | if (name.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_nextplot (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (nextplot.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_numbertitle (const octave_value& val) | void set_numbertitle (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (numbertitle.set (val, true)) | if (numbertitle.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_paperunits (const octave_value& val); | void set_paperorientation (const octave_value& val) | |||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (paperorientation.set (val, true)) | ||||
{ | ||||
update_paperorientation (); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void update_paperorientation (void); | ||||
void set_paperposition (const octave_value& val) | void set_paperposition (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (paperposition.set (val, true)) | if (paperposition.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
skipping to change at line 4443 | skipping to change at line 4454 | |||
} | } | |||
} | } | |||
} | } | |||
void update_papersize (void); | void update_papersize (void); | |||
void set_papertype (const octave_value& val); | void set_papertype (const octave_value& val); | |||
void update_papertype (void); | void update_papertype (void); | |||
void set_paperunits (const octave_value& val); | ||||
void set_pointer (const octave_value& val) | void set_pointer (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (pointer.set (val, true)) | if (pointer.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
skipping to change at line 4577 | skipping to change at line 4590 | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (windowbuttonupfcn.set (val, true)) | if (windowbuttonupfcn.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_windowbuttonwheelfcn (const octave_value& val) | void set_windowkeypressfcn (const octave_value& val) | |||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (windowkeypressfcn.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_windowkeyreleasefcn (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (windowkeyreleasefcn.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_windowscrollwheelfcn (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (windowbuttonwheelfcn.set (val, true)) | if (windowscrollwheelfcn.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_windowstyle (const octave_value& val) | void set_windowstyle (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
skipping to change at line 4654 | skipping to change at line 4689 | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xvisualmode.set (val, true)) | if (xvisualmode.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_buttondownfcn (const octave_value& val) | void set___enhanced__ (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (buttondownfcn.set (val, true)) | if (__enhanced__.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set___guidata__ (const octave_value& val) | void set___guidata__ (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (__guidata__.set (val, true)) | if (__guidata__.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
protected: | void set___plot_stream__ (const octave_value& val) | |||
void init (void) | { | |||
if (! error_state) | ||||
{ | { | |||
colormap.add_constraint (dim_vector (-1, 3)); | if (__plot_stream__.set (val, true)) | |||
alphamap.add_constraint (dim_vector (-1, 1)); | { | |||
paperposition.add_constraint (dim_vector (1, 4)); | mark_modified (); | |||
pointershapecdata.add_constraint (dim_vector (16, 16)); | } | |||
pointershapehotspot.add_constraint (dim_vector (1, 2)); | ||||
position.add_constraint (dim_vector (1, 4)); | ||||
outerposition.add_constraint (dim_vector (1, 4)); | ||||
} | } | |||
} | ||||
protected: | ||||
void init (void) | ||||
{ | ||||
alphamap.add_constraint (dim_vector (-1, 1)); | ||||
colormap.add_constraint (dim_vector (-1, 3)); | ||||
outerposition.add_constraint (dim_vector (1, 4)); | ||||
paperposition.add_constraint (dim_vector (1, 4)); | ||||
papersize.add_constraint (dim_vector (1, 2)); | ||||
pointershapecdata.add_constraint (dim_vector (16, 16)); | ||||
pointershapehotspot.add_constraint (dim_vector (1, 2)); | ||||
position.add_constraint (dim_vector (1, 4)); | ||||
} | ||||
private: | private: | |||
mutable graphics_toolkit toolkit; | mutable graphics_toolkit toolkit; | |||
}; | }; | |||
private: | private: | |||
properties xproperties; | properties xproperties; | |||
public: | public: | |||
figure (const graphics_handle& mh, const graphics_handle& p) | figure (const graphics_handle& mh, const graphics_handle& p) | |||
skipping to change at line 4768 | skipping to change at line 4815 | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API graphics_xform | class OCTINTERP_API graphics_xform | |||
{ | { | |||
public: | public: | |||
graphics_xform (void) | graphics_xform (void) | |||
: xform (xform_eye ()), xform_inv (xform_eye ()), | : xform (xform_eye ()), xform_inv (xform_eye ()), | |||
sx ("linear"), sy ("linear"), sz ("linear"), zlim (1, 2, 0.0) | sx ("linear"), sy ("linear"), sz ("linear"), zlim (1, 2, 0.0) | |||
{ | { | |||
zlim(1) = 1.0; | zlim(1) = 1.0; | |||
} | } | |||
graphics_xform (const Matrix& xm, const Matrix& xim, | graphics_xform (const Matrix& xm, const Matrix& xim, | |||
const scaler& x, const scaler& y, const scaler& z, | const scaler& x, const scaler& y, const scaler& z, | |||
const Matrix& zl) | const Matrix& zl) | |||
: xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { } | : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { } | |||
graphics_xform (const graphics_xform& g) | graphics_xform (const graphics_xform& g) | |||
: xform (g.xform), xform_inv (g.xform_inv), sx (g.sx), | : xform (g.xform), xform_inv (g.xform_inv), sx (g.sx), | |||
sy (g.sy), sz (g.sz), zlim (g.zlim) { } | sy (g.sy), sz (g.sz), zlim (g.zlim) { } | |||
~graphics_xform (void) { } | ~graphics_xform (void) { } | |||
graphics_xform& operator = (const graphics_xform& g) | graphics_xform& operator = (const graphics_xform& g) | |||
{ | { | |||
xform = g.xform; | xform = g.xform; | |||
xform_inv = g.xform_inv; | xform_inv = g.xform_inv; | |||
sx = g.sx; | sx = g.sx; | |||
sy = g.sy; | sy = g.sy; | |||
sz = g.sz; | sz = g.sz; | |||
zlim = g.zlim; | zlim = g.zlim; | |||
return *this; | return *this; | |||
} | } | |||
static ColumnVector xform_vector (double x, double y, double z); | static ColumnVector xform_vector (double x, double y, double z); | |||
static Matrix xform_eye (void); | static Matrix xform_eye (void); | |||
ColumnVector transform (double x, double y, double z, | ColumnVector transform (double x, double y, double z, | |||
bool use_scale = true) const; | bool use_scale = true) const; | |||
ColumnVector untransform (double x, double y, double z, | ColumnVector untransform (double x, double y, double z, | |||
bool use_scale = true) const; | bool use_scale = true) const; | |||
ColumnVector untransform (double x, double y, bool use_scale = true) cons t | ColumnVector untransform (double x, double y, bool use_scale = true) cons t | |||
{ return untransform (x, y, (zlim(0)+zlim(1))/2, use_scale); } | { return untransform (x, y, (zlim(0)+zlim(1))/2, use_scale); } | |||
Matrix xscale (const Matrix& m) const { return sx.scale (m); } | Matrix xscale (const Matrix& m) const { return sx.scale (m); } | |||
Matrix yscale (const Matrix& m) const { return sy.scale (m); } | Matrix yscale (const Matrix& m) const { return sy.scale (m); } | |||
Matrix zscale (const Matrix& m) const { return sz.scale (m); } | Matrix zscale (const Matrix& m) const { return sz.scale (m); } | |||
Matrix scale (const Matrix& m) const | Matrix scale (const Matrix& m) const | |||
{ | { | |||
bool has_z = (m.columns () > 2); | bool has_z = (m.columns () > 2); | |||
if (sx.is_linear () && sy.is_linear () | if (sx.is_linear () && sy.is_linear () | |||
&& (! has_z || sz.is_linear ())) | && (! has_z || sz.is_linear ())) | |||
return m; | return m; | |||
Matrix retval (m.dims ()); | Matrix retval (m.dims ()); | |||
int r = m.rows (); | int r = m.rows (); | |||
for (int i = 0; i < r; i++) | for (int i = 0; i < r; i++) | |||
{ | { | |||
retval(i,0) = sx.scale (m(i,0)); | retval(i,0) = sx.scale (m(i,0)); | |||
retval(i,1) = sy.scale (m(i,1)); | retval(i,1) = sy.scale (m(i,1)); | |||
if (has_z) | if (has_z) | |||
retval(i,2) = sz.scale (m(i,2)); | retval(i,2) = sz.scale (m(i,2)); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
private: | private: | |||
Matrix xform; | Matrix xform; | |||
Matrix xform_inv; | Matrix xform_inv; | |||
scaler sx, sy, sz; | scaler sx, sy, sz; | |||
Matrix zlim; | Matrix zlim; | |||
}; | }; | |||
enum { | enum | |||
{ | ||||
AXE_ANY_DIR = 0, | AXE_ANY_DIR = 0, | |||
AXE_DEPTH_DIR = 1, | AXE_DEPTH_DIR = 1, | |||
AXE_HORZ_DIR = 2, | AXE_HORZ_DIR = 2, | |||
AXE_VERT_DIR = 3 | AXE_VERT_DIR = 3 | |||
}; | }; | |||
class OCTINTERP_API axes : public base_graphics_object | class OCTINTERP_API axes : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
skipping to change at line 4865 | skipping to change at line 4913 | |||
void set_defaults (base_graphics_object& obj, const std::string& mode); | void set_defaults (base_graphics_object& obj, const std::string& mode); | |||
void remove_child (const graphics_handle& h); | void remove_child (const graphics_handle& h); | |||
const scaler& get_x_scaler (void) const { return sx; } | const scaler& get_x_scaler (void) const { return sx; } | |||
const scaler& get_y_scaler (void) const { return sy; } | const scaler& get_y_scaler (void) const { return sy; } | |||
const scaler& get_z_scaler (void) const { return sz; } | const scaler& get_z_scaler (void) const { return sz; } | |||
Matrix get_boundingbox (bool internal = false, | Matrix get_boundingbox (bool internal = false, | |||
const Matrix& parent_pix_size = Matrix ()) cons t; | const Matrix& parent_pix_size = Matrix ()) cons t; | |||
Matrix get_extent (bool with_text = false, bool only_text_height=false) | Matrix get_extent (bool with_text = false, | |||
const; | bool only_text_height=false) const; | |||
double get_fontsize_points (double box_pix_height = 0) const; | double get_fontsize_points (double box_pix_height = 0) const; | |||
void update_boundingbox (void) | void update_boundingbox (void) | |||
{ | { | |||
if (units_is ("normalized")) | if (units_is ("normalized")) | |||
{ | { | |||
sync_positions (); | sync_positions (); | |||
base_properties::update_boundingbox (); | base_properties::update_boundingbox (); | |||
} | } | |||
} | } | |||
void update_camera (void); | void update_camera (void); | |||
void update_axes_layout (void); | void update_axes_layout (void); | |||
void update_aspectratios (void); | void update_aspectratios (void); | |||
void update_transform (void) | void update_transform (void) | |||
{ | { | |||
update_aspectratios (); | update_aspectratios (); | |||
update_camera (); | update_camera (); | |||
update_axes_layout (); | update_axes_layout (); | |||
} | } | |||
void sync_positions (void); | ||||
void update_autopos (const std::string& elem_type); | void update_autopos (const std::string& elem_type); | |||
void update_xlabel_position (void); | void update_xlabel_position (void); | |||
void update_ylabel_position (void); | void update_ylabel_position (void); | |||
void update_zlabel_position (void); | void update_zlabel_position (void); | |||
void update_title_position (void); | void update_title_position (void); | |||
graphics_xform get_transform (void) const | graphics_xform get_transform (void) const | |||
{ return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); } | { return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); } | |||
Matrix get_transform_matrix (void) const { return x_render; } | Matrix get_transform_matrix (void) const { return x_render; } | |||
Matrix get_inverse_transform_matrix (void) const { return x_render_inv; } | Matrix get_inverse_transform_matrix (void) const { return x_render_inv; } | |||
Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; } | Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; } | |||
Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; } | Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; } | |||
Matrix get_transform_zlim (void) const { return x_zlim; } | Matrix get_transform_zlim (void) const { return x_zlim; } | |||
int get_xstate (void) const { return xstate; } | int get_xstate (void) const { return xstate; } | |||
int get_ystate (void) const { return ystate; } | int get_ystate (void) const { return ystate; } | |||
int get_zstate (void) const { return zstate; } | int get_zstate (void) const { return zstate; } | |||
skipping to change at line 4949 | skipping to change at line 5000 | |||
bool get_nearhoriz (void) const { return nearhoriz; } | bool get_nearhoriz (void) const { return nearhoriz; } | |||
ColumnVector pixel2coord (double px, double py) const | ColumnVector pixel2coord (double px, double py) const | |||
{ return get_transform ().untransform (px, py, (x_zlim(0)+x_zlim(1))/2) ; } | { return get_transform ().untransform (px, py, (x_zlim(0)+x_zlim(1))/2) ; } | |||
ColumnVector coord2pixel (double x, double y, double z) const | ColumnVector coord2pixel (double x, double y, double z) const | |||
{ return get_transform ().transform (x, y, z); } | { return get_transform ().transform (x, y, z); } | |||
void zoom_about_point (double x, double y, double factor, | void zoom_about_point (double x, double y, double factor, | |||
bool push_to_zoom_stack = true); | bool push_to_zoom_stack = true); | |||
void zoom (const Matrix& xl, const Matrix& yl, bool push_to_zoom_stack | void zoom (const Matrix& xl, const Matrix& yl, | |||
= true); | bool push_to_zoom_stack = true); | |||
void translate_view (double delta_x, double delta_y); | void translate_view (double x0, double x1, double y0, double y1); | |||
void rotate_view (double delta_az, double delta_el); | void rotate_view (double delta_az, double delta_el); | |||
void unzoom (void); | void unzoom (void); | |||
void clear_zoom_stack (void); | void clear_zoom_stack (void); | |||
void update_units (const caseless_str& old_units); | void update_units (const caseless_str& old_units); | |||
void update_fontunits (const caseless_str& old_fontunits); | void update_fontunits (const caseless_str& old_fontunits); | |||
private: | private: | |||
scaler sx, sy, sz; | scaler sx, sy, sz; | |||
skipping to change at line 4988 | skipping to change at line 5040 | |||
ft_render text_renderer; | ft_render text_renderer; | |||
#endif | #endif | |||
void set_text_child (handle_property& h, const std::string& who, | void set_text_child (handle_property& h, const std::string& who, | |||
const octave_value& v); | const octave_value& v); | |||
void delete_text_child (handle_property& h); | void delete_text_child (handle_property& h); | |||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
// properties which are not in matlab: interpreter | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 5033 | skipping to change at line 5084 | |||
static std::set<std::string> core_property_names (void); | static std::set<std::string> core_property_names (void); | |||
static bool has_core_property (const caseless_str& pname); | static bool has_core_property (const caseless_str& pname); | |||
std::set<std::string> all_property_names (void) const; | std::set<std::string> all_property_names (void) const; | |||
bool has_property (const caseless_str& pname) const; | bool has_property (const caseless_str& pname) const; | |||
private: | private: | |||
array_property position; | radio_property activepositionproperty; | |||
bool_property box; | ||||
array_property colororder; | ||||
array_property dataaspectratio; | ||||
radio_property dataaspectratiomode; | ||||
radio_property layer; | ||||
row_vector_property xlim; | ||||
row_vector_property ylim; | ||||
row_vector_property zlim; | ||||
row_vector_property clim; | ||||
row_vector_property alim; | row_vector_property alim; | |||
radio_property xlimmode; | ||||
radio_property ylimmode; | ||||
radio_property zlimmode; | ||||
radio_property climmode; | ||||
radio_property alimmode; | radio_property alimmode; | |||
handle_property xlabel; | ||||
handle_property ylabel; | ||||
handle_property zlabel; | ||||
handle_property title; | ||||
bool_property xgrid; | ||||
bool_property ygrid; | ||||
bool_property zgrid; | ||||
bool_property xminorgrid; | ||||
bool_property yminorgrid; | ||||
bool_property zminorgrid; | ||||
row_vector_property xtick; | ||||
row_vector_property ytick; | ||||
row_vector_property ztick; | ||||
radio_property xtickmode; | ||||
radio_property ytickmode; | ||||
radio_property ztickmode; | ||||
bool_property xminortick; | ||||
bool_property yminortick; | ||||
bool_property zminortick; | ||||
any_property xticklabel; | ||||
any_property yticklabel; | ||||
any_property zticklabel; | ||||
radio_property xticklabelmode; | ||||
radio_property yticklabelmode; | ||||
radio_property zticklabelmode; | ||||
radio_property interpreter; | ||||
color_property color; | ||||
color_property xcolor; | ||||
color_property ycolor; | ||||
color_property zcolor; | ||||
radio_property xscale; | ||||
radio_property yscale; | ||||
radio_property zscale; | ||||
radio_property xdir; | ||||
radio_property ydir; | ||||
radio_property zdir; | ||||
radio_property yaxislocation; | ||||
radio_property xaxislocation; | ||||
array_property view; | ||||
bool_property __hold_all__; | ||||
radio_property nextplot; | ||||
array_property outerposition; | ||||
radio_property activepositionproperty; | ||||
color_property ambientlightcolor; | color_property ambientlightcolor; | |||
bool_property box; | ||||
array_property cameraposition; | array_property cameraposition; | |||
array_property cameratarget; | ||||
array_property cameraupvector; | ||||
double_property cameraviewangle; | ||||
radio_property camerapositionmode; | radio_property camerapositionmode; | |||
array_property cameratarget; | ||||
radio_property cameratargetmode; | radio_property cameratargetmode; | |||
array_property cameraupvector; | ||||
radio_property cameraupvectormode; | radio_property cameraupvectormode; | |||
double_property cameraviewangle; | ||||
radio_property cameraviewanglemode; | radio_property cameraviewanglemode; | |||
row_vector_property clim; | ||||
radio_property climmode; | ||||
color_property color; | ||||
array_property colororder; | ||||
array_property currentpoint; | array_property currentpoint; | |||
array_property dataaspectratio; | ||||
radio_property dataaspectratiomode; | ||||
radio_property drawmode; | radio_property drawmode; | |||
radio_property fontangle; | radio_property fontangle; | |||
string_property fontname; | string_property fontname; | |||
double_property fontsize; | double_property fontsize; | |||
radio_property fontunits; | radio_property fontunits; | |||
radio_property fontweight; | radio_property fontweight; | |||
radio_property gridlinestyle; | radio_property gridlinestyle; | |||
string_array_property linestyleorder; | radio_property interpreter; | |||
radio_property layer; | ||||
any_property linestyleorder; | ||||
double_property linewidth; | double_property linewidth; | |||
radio_property minorgridlinestyle; | radio_property minorgridlinestyle; | |||
radio_property nextplot; | ||||
array_property outerposition; | ||||
array_property plotboxaspectratio; | array_property plotboxaspectratio; | |||
radio_property plotboxaspectratiomode; | radio_property plotboxaspectratiomode; | |||
array_property position; | ||||
radio_property projection; | radio_property projection; | |||
radio_property tickdir; | radio_property tickdir; | |||
radio_property tickdirmode; | radio_property tickdirmode; | |||
array_property ticklength; | array_property ticklength; | |||
array_property tightinset; | array_property tightinset; | |||
handle_property title; | ||||
radio_property units; | radio_property units; | |||
array_property view; | ||||
radio_property xaxislocation; | ||||
color_property xcolor; | ||||
radio_property xdir; | ||||
bool_property xgrid; | ||||
handle_property xlabel; | ||||
row_vector_property xlim; | ||||
radio_property xlimmode; | ||||
bool_property xminorgrid; | ||||
bool_property xminortick; | ||||
radio_property xscale; | ||||
row_vector_property xtick; | ||||
any_property xticklabel; | ||||
radio_property xticklabelmode; | ||||
radio_property xtickmode; | ||||
radio_property yaxislocation; | ||||
color_property ycolor; | ||||
radio_property ydir; | ||||
bool_property ygrid; | ||||
handle_property ylabel; | ||||
row_vector_property ylim; | ||||
radio_property ylimmode; | ||||
bool_property yminorgrid; | ||||
bool_property yminortick; | ||||
radio_property yscale; | ||||
row_vector_property ytick; | ||||
any_property yticklabel; | ||||
radio_property yticklabelmode; | ||||
radio_property ytickmode; | ||||
color_property zcolor; | ||||
radio_property zdir; | ||||
bool_property zgrid; | ||||
handle_property zlabel; | ||||
row_vector_property zlim; | ||||
radio_property zlimmode; | ||||
bool_property zminorgrid; | ||||
bool_property zminortick; | ||||
radio_property zscale; | ||||
row_vector_property ztick; | ||||
any_property zticklabel; | ||||
radio_property zticklabelmode; | ||||
radio_property ztickmode; | ||||
bool_property __hold_all__; | ||||
radio_property autopos_tag; | ||||
array_property looseinset; | ||||
array_property x_viewtransform; | array_property x_viewtransform; | |||
array_property x_projectiontransform; | array_property x_projectiontransform; | |||
array_property x_viewporttransform; | array_property x_viewporttransform; | |||
array_property x_normrendertransform; | array_property x_normrendertransform; | |||
array_property x_rendertransform; | array_property x_rendertransform; | |||
row_vector_property xmtick; | row_vector_property xmtick; | |||
row_vector_property ymtick; | row_vector_property ymtick; | |||
row_vector_property zmtick; | row_vector_property zmtick; | |||
array_property looseinset; | ||||
radio_property autopos_tag; | ||||
public: | public: | |||
enum | enum | |||
{ | { | |||
ID_POSITION = 3000, | ID_ACTIVEPOSITIONPROPERTY = 3000, | |||
ID_BOX = 3001, | ID_ALIM = 3001, | |||
ID_COLORORDER = 3002, | ID_ALIMMODE = 3002, | |||
ID_DATAASPECTRATIO = 3003, | ID_AMBIENTLIGHTCOLOR = 3003, | |||
ID_DATAASPECTRATIOMODE = 3004, | ID_BOX = 3004, | |||
ID_LAYER = 3005, | ID_CAMERAPOSITION = 3005, | |||
ID_XLIM = 3006, | ID_CAMERAPOSITIONMODE = 3006, | |||
ID_YLIM = 3007, | ID_CAMERATARGET = 3007, | |||
ID_ZLIM = 3008, | ID_CAMERATARGETMODE = 3008, | |||
ID_CLIM = 3009, | ID_CAMERAUPVECTOR = 3009, | |||
ID_ALIM = 3010, | ID_CAMERAUPVECTORMODE = 3010, | |||
ID_XLIMMODE = 3011, | ID_CAMERAVIEWANGLE = 3011, | |||
ID_YLIMMODE = 3012, | ID_CAMERAVIEWANGLEMODE = 3012, | |||
ID_ZLIMMODE = 3013, | ID_CLIM = 3013, | |||
ID_CLIMMODE = 3014, | ID_CLIMMODE = 3014, | |||
ID_ALIMMODE = 3015, | ID_COLOR = 3015, | |||
ID_XLABEL = 3016, | ID_COLORORDER = 3016, | |||
ID_YLABEL = 3017, | ID_CURRENTPOINT = 3017, | |||
ID_ZLABEL = 3018, | ID_DATAASPECTRATIO = 3018, | |||
ID_TITLE = 3019, | ID_DATAASPECTRATIOMODE = 3019, | |||
ID_XGRID = 3020, | ID_DRAWMODE = 3020, | |||
ID_YGRID = 3021, | ID_FONTANGLE = 3021, | |||
ID_ZGRID = 3022, | ID_FONTNAME = 3022, | |||
ID_XMINORGRID = 3023, | ID_FONTSIZE = 3023, | |||
ID_YMINORGRID = 3024, | ID_FONTUNITS = 3024, | |||
ID_ZMINORGRID = 3025, | ID_FONTWEIGHT = 3025, | |||
ID_XTICK = 3026, | ID_GRIDLINESTYLE = 3026, | |||
ID_YTICK = 3027, | ID_INTERPRETER = 3027, | |||
ID_ZTICK = 3028, | ID_LAYER = 3028, | |||
ID_XTICKMODE = 3029, | ID_LINESTYLEORDER = 3029, | |||
ID_YTICKMODE = 3030, | ID_LINEWIDTH = 3030, | |||
ID_ZTICKMODE = 3031, | ID_MINORGRIDLINESTYLE = 3031, | |||
ID_XMINORTICK = 3032, | ID_NEXTPLOT = 3032, | |||
ID_YMINORTICK = 3033, | ID_OUTERPOSITION = 3033, | |||
ID_ZMINORTICK = 3034, | ID_PLOTBOXASPECTRATIO = 3034, | |||
ID_XTICKLABEL = 3035, | ID_PLOTBOXASPECTRATIOMODE = 3035, | |||
ID_YTICKLABEL = 3036, | ID_POSITION = 3036, | |||
ID_ZTICKLABEL = 3037, | ID_PROJECTION = 3037, | |||
ID_XTICKLABELMODE = 3038, | ID_TICKDIR = 3038, | |||
ID_YTICKLABELMODE = 3039, | ID_TICKDIRMODE = 3039, | |||
ID_ZTICKLABELMODE = 3040, | ID_TICKLENGTH = 3040, | |||
ID_INTERPRETER = 3041, | ID_TIGHTINSET = 3041, | |||
ID_COLOR = 3042, | ID_TITLE = 3042, | |||
ID_XCOLOR = 3043, | ID_UNITS = 3043, | |||
ID_YCOLOR = 3044, | ID_VIEW = 3044, | |||
ID_ZCOLOR = 3045, | ID_XAXISLOCATION = 3045, | |||
ID_XSCALE = 3046, | ID_XCOLOR = 3046, | |||
ID_YSCALE = 3047, | ID_XDIR = 3047, | |||
ID_ZSCALE = 3048, | ID_XGRID = 3048, | |||
ID_XDIR = 3049, | ID_XLABEL = 3049, | |||
ID_YDIR = 3050, | ID_XLIM = 3050, | |||
ID_ZDIR = 3051, | ID_XLIMMODE = 3051, | |||
ID_YAXISLOCATION = 3052, | ID_XMINORGRID = 3052, | |||
ID_XAXISLOCATION = 3053, | ID_XMINORTICK = 3053, | |||
ID_VIEW = 3054, | ID_XSCALE = 3054, | |||
ID___HOLD_ALL__ = 3055, | ID_XTICK = 3055, | |||
ID_NEXTPLOT = 3056, | ID_XTICKLABEL = 3056, | |||
ID_OUTERPOSITION = 3057, | ID_XTICKLABELMODE = 3057, | |||
ID_ACTIVEPOSITIONPROPERTY = 3058, | ID_XTICKMODE = 3058, | |||
ID_AMBIENTLIGHTCOLOR = 3059, | ID_YAXISLOCATION = 3059, | |||
ID_CAMERAPOSITION = 3060, | ID_YCOLOR = 3060, | |||
ID_CAMERATARGET = 3061, | ID_YDIR = 3061, | |||
ID_CAMERAUPVECTOR = 3062, | ID_YGRID = 3062, | |||
ID_CAMERAVIEWANGLE = 3063, | ID_YLABEL = 3063, | |||
ID_CAMERAPOSITIONMODE = 3064, | ID_YLIM = 3064, | |||
ID_CAMERATARGETMODE = 3065, | ID_YLIMMODE = 3065, | |||
ID_CAMERAUPVECTORMODE = 3066, | ID_YMINORGRID = 3066, | |||
ID_CAMERAVIEWANGLEMODE = 3067, | ID_YMINORTICK = 3067, | |||
ID_CURRENTPOINT = 3068, | ID_YSCALE = 3068, | |||
ID_DRAWMODE = 3069, | ID_YTICK = 3069, | |||
ID_FONTANGLE = 3070, | ID_YTICKLABEL = 3070, | |||
ID_FONTNAME = 3071, | ID_YTICKLABELMODE = 3071, | |||
ID_FONTSIZE = 3072, | ID_YTICKMODE = 3072, | |||
ID_FONTUNITS = 3073, | ID_ZCOLOR = 3073, | |||
ID_FONTWEIGHT = 3074, | ID_ZDIR = 3074, | |||
ID_GRIDLINESTYLE = 3075, | ID_ZGRID = 3075, | |||
ID_LINESTYLEORDER = 3076, | ID_ZLABEL = 3076, | |||
ID_LINEWIDTH = 3077, | ID_ZLIM = 3077, | |||
ID_MINORGRIDLINESTYLE = 3078, | ID_ZLIMMODE = 3078, | |||
ID_PLOTBOXASPECTRATIO = 3079, | ID_ZMINORGRID = 3079, | |||
ID_PLOTBOXASPECTRATIOMODE = 3080, | ID_ZMINORTICK = 3080, | |||
ID_PROJECTION = 3081, | ID_ZSCALE = 3081, | |||
ID_TICKDIR = 3082, | ID_ZTICK = 3082, | |||
ID_TICKDIRMODE = 3083, | ID_ZTICKLABEL = 3083, | |||
ID_TICKLENGTH = 3084, | ID_ZTICKLABELMODE = 3084, | |||
ID_TIGHTINSET = 3085, | ID_ZTICKMODE = 3085, | |||
ID_UNITS = 3086, | ID___HOLD_ALL__ = 3086, | |||
ID_X_VIEWTRANSFORM = 3087, | ID_AUTOPOS_TAG = 3087, | |||
ID_X_PROJECTIONTRANSFORM = 3088, | ID_LOOSEINSET = 3088, | |||
ID_X_VIEWPORTTRANSFORM = 3089, | ID_X_VIEWTRANSFORM = 3089, | |||
ID_X_NORMRENDERTRANSFORM = 3090, | ID_X_PROJECTIONTRANSFORM = 3090, | |||
ID_X_RENDERTRANSFORM = 3091, | ID_X_VIEWPORTTRANSFORM = 3091, | |||
ID_XMTICK = 3092, | ID_X_NORMRENDERTRANSFORM = 3092, | |||
ID_YMTICK = 3093, | ID_X_RENDERTRANSFORM = 3093, | |||
ID_ZMTICK = 3094, | ID_XMTICK = 3094, | |||
ID_LOOSEINSET = 3095, | ID_YMTICK = 3095, | |||
ID_AUTOPOS_TAG = 3096 | ID_ZMTICK = 3096 | |||
}; | }; | |||
octave_value get_position (void) const { return position.get (); } | bool activepositionproperty_is (const std::string& v) const { return acti | |||
vepositionproperty.is (v); } | ||||
std::string get_activepositionproperty (void) const { return activepositi | ||||
onproperty.current_value (); } | ||||
bool is_box (void) const { return box.is_on (); } | octave_value get_alim (void) const { return alim.get (); } | |||
std::string get_box (void) const { return box.current_value (); } | ||||
octave_value get_colororder (void) const { return colororder.get (); } | bool alimmode_is (const std::string& v) const { return alimmode.is (v); } | |||
std::string get_alimmode (void) const { return alimmode.current_value (); | ||||
} | ||||
octave_value get_dataaspectratio (void) const { return dataaspectratio.ge | bool ambientlightcolor_is_rgb (void) const { return ambientlightcolor.is_ | |||
t (); } | rgb (); } | |||
bool ambientlightcolor_is (const std::string& v) const { return ambientli | ||||
ghtcolor.is (v); } | ||||
Matrix get_ambientlightcolor_rgb (void) const { return (ambientlightcolor | ||||
.is_rgb () ? ambientlightcolor.rgb () : Matrix ()); } | ||||
octave_value get_ambientlightcolor (void) const { return ambientlightcolo | ||||
r.get (); } | ||||
bool dataaspectratiomode_is (const std::string& v) const { return dataasp | bool is_box (void) const { return box.is_on (); } | |||
ectratiomode.is (v); } | std::string get_box (void) const { return box.current_value (); } | |||
std::string get_dataaspectratiomode (void) const { return dataaspectratio | ||||
mode.current_value (); } | ||||
bool layer_is (const std::string& v) const { return layer.is (v); } | octave_value get_cameraposition (void) const { return cameraposition.get | |||
std::string get_layer (void) const { return layer.current_value (); } | (); } | |||
octave_value get_xlim (void) const { return xlim.get (); } | bool camerapositionmode_is (const std::string& v) const { return camerapo | |||
sitionmode.is (v); } | ||||
std::string get_camerapositionmode (void) const { return camerapositionmo | ||||
de.current_value (); } | ||||
octave_value get_ylim (void) const { return ylim.get (); } | octave_value get_cameratarget (void) const { return cameratarget.get (); } | |||
octave_value get_zlim (void) const { return zlim.get (); } | bool cameratargetmode_is (const std::string& v) const { return cameratarg | |||
etmode.is (v); } | ||||
std::string get_cameratargetmode (void) const { return cameratargetmode.c | ||||
urrent_value (); } | ||||
octave_value get_clim (void) const { return clim.get (); } | octave_value get_cameraupvector (void) const { return cameraupvector.get (); } | |||
octave_value get_alim (void) const { return alim.get (); } | bool cameraupvectormode_is (const std::string& v) const { return cameraup | |||
vectormode.is (v); } | ||||
std::string get_cameraupvectormode (void) const { return cameraupvectormo | ||||
de.current_value (); } | ||||
bool xlimmode_is (const std::string& v) const { return xlimmode.is (v); } | double get_cameraviewangle (void) const { return cameraviewangle.double_v | |||
std::string get_xlimmode (void) const { return xlimmode.current_value (); | alue (); } | |||
} | ||||
bool ylimmode_is (const std::string& v) const { return ylimmode.is (v); } | bool cameraviewanglemode_is (const std::string& v) const { return camerav | |||
std::string get_ylimmode (void) const { return ylimmode.current_value (); | iewanglemode.is (v); } | |||
} | std::string get_cameraviewanglemode (void) const { return cameraviewangle | |||
mode.current_value (); } | ||||
bool zlimmode_is (const std::string& v) const { return zlimmode.is (v); } | octave_value get_clim (void) const { return clim.get (); } | |||
std::string get_zlimmode (void) const { return zlimmode.current_value (); | ||||
} | ||||
bool climmode_is (const std::string& v) const { return climmode.is (v); } | bool climmode_is (const std::string& v) const { return climmode.is (v); } | |||
std::string get_climmode (void) const { return climmode.current_value (); } | std::string get_climmode (void) const { return climmode.current_value (); } | |||
bool alimmode_is (const std::string& v) const { return alimmode.is (v); } | bool color_is_rgb (void) const { return color.is_rgb (); } | |||
std::string get_alimmode (void) const { return alimmode.current_value (); | bool color_is (const std::string& v) const { return color.is (v); } | |||
} | Matrix get_color_rgb (void) const { return (color.is_rgb () ? color.rgb ( | |||
) : Matrix ()); } | ||||
graphics_handle get_xlabel (void) const { return xlabel.handle_value (); | octave_value get_color (void) const { return color.get (); } | |||
} | ||||
graphics_handle get_ylabel (void) const { return ylabel.handle_value (); } | octave_value get_colororder (void) const { return colororder.get (); } | |||
graphics_handle get_zlabel (void) const { return zlabel.handle_value (); } | octave_value get_currentpoint (void) const { return currentpoint.get (); } | |||
graphics_handle get_title (void) const { return title.handle_value (); } | octave_value get_dataaspectratio (void) const { return dataaspectratio.ge t (); } | |||
bool is_xgrid (void) const { return xgrid.is_on (); } | bool dataaspectratiomode_is (const std::string& v) const { return dataasp | |||
std::string get_xgrid (void) const { return xgrid.current_value (); } | ectratiomode.is (v); } | |||
std::string get_dataaspectratiomode (void) const { return dataaspectratio | ||||
mode.current_value (); } | ||||
bool is_ygrid (void) const { return ygrid.is_on (); } | bool drawmode_is (const std::string& v) const { return drawmode.is (v); } | |||
std::string get_ygrid (void) const { return ygrid.current_value (); } | std::string get_drawmode (void) const { return drawmode.current_value (); | |||
} | ||||
bool is_zgrid (void) const { return zgrid.is_on (); } | bool fontangle_is (const std::string& v) const { return fontangle.is (v); | |||
std::string get_zgrid (void) const { return zgrid.current_value (); } | } | |||
std::string get_fontangle (void) const { return fontangle.current_value ( | ||||
); } | ||||
bool is_xminorgrid (void) const { return xminorgrid.is_on (); } | std::string get_fontname (void) const { return fontname.string_value (); | |||
std::string get_xminorgrid (void) const { return xminorgrid.current_value | } | |||
(); } | ||||
bool is_yminorgrid (void) const { return yminorgrid.is_on (); } | double get_fontsize (void) const { return fontsize.double_value (); } | |||
std::string get_yminorgrid (void) const { return yminorgrid.current_value | ||||
(); } | ||||
bool is_zminorgrid (void) const { return zminorgrid.is_on (); } | bool fontunits_is (const std::string& v) const { return fontunits.is (v); | |||
std::string get_zminorgrid (void) const { return zminorgrid.current_value | } | |||
(); } | std::string get_fontunits (void) const { return fontunits.current_value ( | |||
); } | ||||
octave_value get_xtick (void) const { return xtick.get (); } | bool fontweight_is (const std::string& v) const { return fontweight.is (v | |||
); } | ||||
std::string get_fontweight (void) const { return fontweight.current_value | ||||
(); } | ||||
octave_value get_ytick (void) const { return ytick.get (); } | bool gridlinestyle_is (const std::string& v) const { return gridlinestyle | |||
.is (v); } | ||||
std::string get_gridlinestyle (void) const { return gridlinestyle.current | ||||
_value (); } | ||||
octave_value get_ztick (void) const { return ztick.get (); } | bool interpreter_is (const std::string& v) const { return interpreter.is | |||
(v); } | ||||
std::string get_interpreter (void) const { return interpreter.current_val | ||||
ue (); } | ||||
bool xtickmode_is (const std::string& v) const { return xtickmode.is (v); | bool layer_is (const std::string& v) const { return layer.is (v); } | |||
} | std::string get_layer (void) const { return layer.current_value (); } | |||
std::string get_xtickmode (void) const { return xtickmode.current_value ( | ||||
); } | ||||
bool ytickmode_is (const std::string& v) const { return ytickmode.is (v); | octave_value get_linestyleorder (void) const { return linestyleorder.get | |||
} | (); } | |||
std::string get_ytickmode (void) const { return ytickmode.current_value ( | ||||
); } | ||||
bool ztickmode_is (const std::string& v) const { return ztickmode.is (v); | double get_linewidth (void) const { return linewidth.double_value (); } | |||
} | ||||
std::string get_ztickmode (void) const { return ztickmode.current_value ( | ||||
); } | ||||
bool is_xminortick (void) const { return xminortick.is_on (); } | bool minorgridlinestyle_is (const std::string& v) const { return minorgri | |||
std::string get_xminortick (void) const { return xminortick.current_value | dlinestyle.is (v); } | |||
(); } | std::string get_minorgridlinestyle (void) const { return minorgridlinesty | |||
le.current_value (); } | ||||
bool is_yminortick (void) const { return yminortick.is_on (); } | bool nextplot_is (const std::string& v) const { return nextplot.is (v); } | |||
std::string get_yminortick (void) const { return yminortick.current_value | std::string get_nextplot (void) const { return nextplot.current_value (); | |||
(); } | } | |||
bool is_zminortick (void) const { return zminortick.is_on (); } | octave_value get_outerposition (void) const { return outerposition.get () | |||
std::string get_zminortick (void) const { return zminortick.current_value | ; } | |||
(); } | ||||
octave_value get_xticklabel (void) const { return xticklabel.get (); } | octave_value get_plotboxaspectratio (void) const { return plotboxaspectra tio.get (); } | |||
octave_value get_yticklabel (void) const { return yticklabel.get (); } | bool plotboxaspectratiomode_is (const std::string& v) const { return plot | |||
boxaspectratiomode.is (v); } | ||||
std::string get_plotboxaspectratiomode (void) const { return plotboxaspec | ||||
tratiomode.current_value (); } | ||||
octave_value get_zticklabel (void) const { return zticklabel.get (); } | octave_value get_position (void) const { return position.get (); } | |||
bool xticklabelmode_is (const std::string& v) const { return xticklabelmo | bool projection_is (const std::string& v) const { return projection.is (v | |||
de.is (v); } | ); } | |||
std::string get_xticklabelmode (void) const { return xticklabelmode.curre | std::string get_projection (void) const { return projection.current_value | |||
nt_value (); } | (); } | |||
bool yticklabelmode_is (const std::string& v) const { return yticklabelmo | bool tickdir_is (const std::string& v) const { return tickdir.is (v); } | |||
de.is (v); } | std::string get_tickdir (void) const { return tickdir.current_value (); } | |||
std::string get_yticklabelmode (void) const { return yticklabelmode.curre | ||||
nt_value (); } | ||||
bool zticklabelmode_is (const std::string& v) const { return zticklabelmo | bool tickdirmode_is (const std::string& v) const { return tickdirmode.is | |||
de.is (v); } | (v); } | |||
std::string get_zticklabelmode (void) const { return zticklabelmode.curre | std::string get_tickdirmode (void) const { return tickdirmode.current_val | |||
nt_value (); } | ue (); } | |||
bool interpreter_is (const std::string& v) const { return interpreter.is | octave_value get_ticklength (void) const { return ticklength.get (); } | |||
(v); } | ||||
std::string get_interpreter (void) const { return interpreter.current_val | ||||
ue (); } | ||||
bool color_is_rgb (void) const { return color.is_rgb (); } | octave_value get_tightinset (void) const { return tightinset.get (); } | |||
bool color_is (const std::string& v) const { return color.is (v); } | ||||
Matrix get_color_rgb (void) const { return (color.is_rgb () ? color.rgb ( | graphics_handle get_title (void) const { return title.handle_value (); } | |||
) : Matrix ()); } | ||||
octave_value get_color (void) const { return color.get (); } | bool units_is (const std::string& v) const { return units.is (v); } | |||
std::string get_units (void) const { return units.current_value (); } | ||||
octave_value get_view (void) const { return view.get (); } | ||||
bool xaxislocation_is (const std::string& v) const { return xaxislocation | ||||
.is (v); } | ||||
std::string get_xaxislocation (void) const { return xaxislocation.current | ||||
_value (); } | ||||
bool xcolor_is_rgb (void) const { return xcolor.is_rgb (); } | bool xcolor_is_rgb (void) const { return xcolor.is_rgb (); } | |||
bool xcolor_is (const std::string& v) const { return xcolor.is (v); } | bool xcolor_is (const std::string& v) const { return xcolor.is (v); } | |||
Matrix get_xcolor_rgb (void) const { return (xcolor.is_rgb () ? xcolor.rg b () : Matrix ()); } | Matrix get_xcolor_rgb (void) const { return (xcolor.is_rgb () ? xcolor.rg b () : Matrix ()); } | |||
octave_value get_xcolor (void) const { return xcolor.get (); } | octave_value get_xcolor (void) const { return xcolor.get (); } | |||
bool ycolor_is_rgb (void) const { return ycolor.is_rgb (); } | bool xdir_is (const std::string& v) const { return xdir.is (v); } | |||
bool ycolor_is (const std::string& v) const { return ycolor.is (v); } | std::string get_xdir (void) const { return xdir.current_value (); } | |||
Matrix get_ycolor_rgb (void) const { return (ycolor.is_rgb () ? ycolor.rg | ||||
b () : Matrix ()); } | ||||
octave_value get_ycolor (void) const { return ycolor.get (); } | ||||
bool zcolor_is_rgb (void) const { return zcolor.is_rgb (); } | ||||
bool zcolor_is (const std::string& v) const { return zcolor.is (v); } | ||||
Matrix get_zcolor_rgb (void) const { return (zcolor.is_rgb () ? zcolor.rg | ||||
b () : Matrix ()); } | ||||
octave_value get_zcolor (void) const { return zcolor.get (); } | ||||
bool xscale_is (const std::string& v) const { return xscale.is (v); } | bool is_xgrid (void) const { return xgrid.is_on (); } | |||
std::string get_xscale (void) const { return xscale.current_value (); } | std::string get_xgrid (void) const { return xgrid.current_value (); } | |||
bool yscale_is (const std::string& v) const { return yscale.is (v); } | graphics_handle get_xlabel (void) const { return xlabel.handle_value (); | |||
std::string get_yscale (void) const { return yscale.current_value (); } | } | |||
bool zscale_is (const std::string& v) const { return zscale.is (v); } | octave_value get_xlim (void) const { return xlim.get (); } | |||
std::string get_zscale (void) const { return zscale.current_value (); } | ||||
bool xdir_is (const std::string& v) const { return xdir.is (v); } | bool xlimmode_is (const std::string& v) const { return xlimmode.is (v); } | |||
std::string get_xdir (void) const { return xdir.current_value (); } | std::string get_xlimmode (void) const { return xlimmode.current_value (); | |||
} | ||||
bool ydir_is (const std::string& v) const { return ydir.is (v); } | bool is_xminorgrid (void) const { return xminorgrid.is_on (); } | |||
std::string get_ydir (void) const { return ydir.current_value (); } | std::string get_xminorgrid (void) const { return xminorgrid.current_value | |||
(); } | ||||
bool zdir_is (const std::string& v) const { return zdir.is (v); } | bool is_xminortick (void) const { return xminortick.is_on (); } | |||
std::string get_zdir (void) const { return zdir.current_value (); } | std::string get_xminortick (void) const { return xminortick.current_value | |||
(); } | ||||
bool yaxislocation_is (const std::string& v) const { return yaxislocation | bool xscale_is (const std::string& v) const { return xscale.is (v); } | |||
.is (v); } | std::string get_xscale (void) const { return xscale.current_value (); } | |||
std::string get_yaxislocation (void) const { return yaxislocation.current | ||||
_value (); } | ||||
bool xaxislocation_is (const std::string& v) const { return xaxislocation | octave_value get_xtick (void) const { return xtick.get (); } | |||
.is (v); } | ||||
std::string get_xaxislocation (void) const { return xaxislocation.current | ||||
_value (); } | ||||
octave_value get_view (void) const { return view.get (); } | octave_value get_xticklabel (void) const { return xticklabel.get (); } | |||
bool is___hold_all__ (void) const { return __hold_all__.is_on (); } | bool xticklabelmode_is (const std::string& v) const { return xticklabelmo | |||
std::string get___hold_all__ (void) const { return __hold_all__.current_v | de.is (v); } | |||
alue (); } | std::string get_xticklabelmode (void) const { return xticklabelmode.curre | |||
nt_value (); } | ||||
bool nextplot_is (const std::string& v) const { return nextplot.is (v); } | bool xtickmode_is (const std::string& v) const { return xtickmode.is (v); | |||
std::string get_nextplot (void) const { return nextplot.current_value (); | } | |||
} | std::string get_xtickmode (void) const { return xtickmode.current_value ( | |||
); } | ||||
octave_value get_outerposition (void) const { return outerposition.get () | bool yaxislocation_is (const std::string& v) const { return yaxislocation | |||
; } | .is (v); } | |||
std::string get_yaxislocation (void) const { return yaxislocation.current | ||||
_value (); } | ||||
bool activepositionproperty_is (const std::string& v) const { return acti | bool ycolor_is_rgb (void) const { return ycolor.is_rgb (); } | |||
vepositionproperty.is (v); } | bool ycolor_is (const std::string& v) const { return ycolor.is (v); } | |||
std::string get_activepositionproperty (void) const { return activepositi | Matrix get_ycolor_rgb (void) const { return (ycolor.is_rgb () ? ycolor.rg | |||
onproperty.current_value (); } | b () : Matrix ()); } | |||
octave_value get_ycolor (void) const { return ycolor.get (); } | ||||
bool ambientlightcolor_is_rgb (void) const { return ambientlightcolor.is_ | bool ydir_is (const std::string& v) const { return ydir.is (v); } | |||
rgb (); } | std::string get_ydir (void) const { return ydir.current_value (); } | |||
bool ambientlightcolor_is (const std::string& v) const { return ambientli | ||||
ghtcolor.is (v); } | ||||
Matrix get_ambientlightcolor_rgb (void) const { return (ambientlightcolor | ||||
.is_rgb () ? ambientlightcolor.rgb () : Matrix ()); } | ||||
octave_value get_ambientlightcolor (void) const { return ambientlightcolo | ||||
r.get (); } | ||||
octave_value get_cameraposition (void) const { return cameraposition.get | bool is_ygrid (void) const { return ygrid.is_on (); } | |||
(); } | std::string get_ygrid (void) const { return ygrid.current_value (); } | |||
octave_value get_cameratarget (void) const { return cameratarget.get (); } | graphics_handle get_ylabel (void) const { return ylabel.handle_value (); } | |||
octave_value get_cameraupvector (void) const { return cameraupvector.get (); } | octave_value get_ylim (void) const { return ylim.get (); } | |||
double get_cameraviewangle (void) const { return cameraviewangle.double_v | bool ylimmode_is (const std::string& v) const { return ylimmode.is (v); } | |||
alue (); } | std::string get_ylimmode (void) const { return ylimmode.current_value (); | |||
} | ||||
bool camerapositionmode_is (const std::string& v) const { return camerapo | bool is_yminorgrid (void) const { return yminorgrid.is_on (); } | |||
sitionmode.is (v); } | std::string get_yminorgrid (void) const { return yminorgrid.current_value | |||
std::string get_camerapositionmode (void) const { return camerapositionmo | (); } | |||
de.current_value (); } | ||||
bool cameratargetmode_is (const std::string& v) const { return cameratarg | bool is_yminortick (void) const { return yminortick.is_on (); } | |||
etmode.is (v); } | std::string get_yminortick (void) const { return yminortick.current_value | |||
std::string get_cameratargetmode (void) const { return cameratargetmode.c | (); } | |||
urrent_value (); } | ||||
bool cameraupvectormode_is (const std::string& v) const { return cameraup | bool yscale_is (const std::string& v) const { return yscale.is (v); } | |||
vectormode.is (v); } | std::string get_yscale (void) const { return yscale.current_value (); } | |||
std::string get_cameraupvectormode (void) const { return cameraupvectormo | ||||
de.current_value (); } | ||||
bool cameraviewanglemode_is (const std::string& v) const { return camerav | octave_value get_ytick (void) const { return ytick.get (); } | |||
iewanglemode.is (v); } | ||||
std::string get_cameraviewanglemode (void) const { return cameraviewangle | ||||
mode.current_value (); } | ||||
octave_value get_currentpoint (void) const { return currentpoint.get (); } | octave_value get_yticklabel (void) const { return yticklabel.get (); } | |||
bool drawmode_is (const std::string& v) const { return drawmode.is (v); } | bool yticklabelmode_is (const std::string& v) const { return yticklabelmo | |||
std::string get_drawmode (void) const { return drawmode.current_value (); | de.is (v); } | |||
} | std::string get_yticklabelmode (void) const { return yticklabelmode.curre | |||
nt_value (); } | ||||
bool fontangle_is (const std::string& v) const { return fontangle.is (v); | bool ytickmode_is (const std::string& v) const { return ytickmode.is (v); | |||
} | } | |||
std::string get_fontangle (void) const { return fontangle.current_value ( | std::string get_ytickmode (void) const { return ytickmode.current_value ( | |||
); } | ); } | |||
std::string get_fontname (void) const { return fontname.string_value (); | bool zcolor_is_rgb (void) const { return zcolor.is_rgb (); } | |||
} | bool zcolor_is (const std::string& v) const { return zcolor.is (v); } | |||
Matrix get_zcolor_rgb (void) const { return (zcolor.is_rgb () ? zcolor.rg | ||||
b () : Matrix ()); } | ||||
octave_value get_zcolor (void) const { return zcolor.get (); } | ||||
double get_fontsize (void) const { return fontsize.double_value (); } | bool zdir_is (const std::string& v) const { return zdir.is (v); } | |||
std::string get_zdir (void) const { return zdir.current_value (); } | ||||
bool fontunits_is (const std::string& v) const { return fontunits.is (v); | bool is_zgrid (void) const { return zgrid.is_on (); } | |||
} | std::string get_zgrid (void) const { return zgrid.current_value (); } | |||
std::string get_fontunits (void) const { return fontunits.current_value ( | ||||
); } | ||||
bool fontweight_is (const std::string& v) const { return fontweight.is (v | graphics_handle get_zlabel (void) const { return zlabel.handle_value (); | |||
); } | } | |||
std::string get_fontweight (void) const { return fontweight.current_value | ||||
(); } | ||||
bool gridlinestyle_is (const std::string& v) const { return gridlinestyle | octave_value get_zlim (void) const { return zlim.get (); } | |||
.is (v); } | ||||
std::string get_gridlinestyle (void) const { return gridlinestyle.current | ||||
_value (); } | ||||
std::string get_linestyleorder_string (void) const { return linestyleorde | bool zlimmode_is (const std::string& v) const { return zlimmode.is (v); } | |||
r.string_value (); } | std::string get_zlimmode (void) const { return zlimmode.current_value (); | |||
string_vector get_linestyleorder_vector (void) const { return linestyleor | } | |||
der.string_vector_value (); } | ||||
octave_value get_linestyleorder (void) const { return linestyleorder.get | ||||
(); } | ||||
double get_linewidth (void) const { return linewidth.double_value (); } | bool is_zminorgrid (void) const { return zminorgrid.is_on (); } | |||
std::string get_zminorgrid (void) const { return zminorgrid.current_value | ||||
(); } | ||||
bool minorgridlinestyle_is (const std::string& v) const { return minorgri | bool is_zminortick (void) const { return zminortick.is_on (); } | |||
dlinestyle.is (v); } | std::string get_zminortick (void) const { return zminortick.current_value | |||
std::string get_minorgridlinestyle (void) const { return minorgridlinesty | (); } | |||
le.current_value (); } | ||||
octave_value get_plotboxaspectratio (void) const { return plotboxaspectra | bool zscale_is (const std::string& v) const { return zscale.is (v); } | |||
tio.get (); } | std::string get_zscale (void) const { return zscale.current_value (); } | |||
bool plotboxaspectratiomode_is (const std::string& v) const { return plot | octave_value get_ztick (void) const { return ztick.get (); } | |||
boxaspectratiomode.is (v); } | ||||
std::string get_plotboxaspectratiomode (void) const { return plotboxaspec | ||||
tratiomode.current_value (); } | ||||
bool projection_is (const std::string& v) const { return projection.is (v | octave_value get_zticklabel (void) const { return zticklabel.get (); } | |||
); } | ||||
std::string get_projection (void) const { return projection.current_value | ||||
(); } | ||||
bool tickdir_is (const std::string& v) const { return tickdir.is (v); } | bool zticklabelmode_is (const std::string& v) const { return zticklabelmo | |||
std::string get_tickdir (void) const { return tickdir.current_value (); } | de.is (v); } | |||
std::string get_zticklabelmode (void) const { return zticklabelmode.curre | ||||
nt_value (); } | ||||
bool tickdirmode_is (const std::string& v) const { return tickdirmode.is | bool ztickmode_is (const std::string& v) const { return ztickmode.is (v); | |||
(v); } | } | |||
std::string get_tickdirmode (void) const { return tickdirmode.current_val | std::string get_ztickmode (void) const { return ztickmode.current_value ( | |||
ue (); } | ); } | |||
octave_value get_ticklength (void) const { return ticklength.get (); } | bool is___hold_all__ (void) const { return __hold_all__.is_on (); } | |||
std::string get___hold_all__ (void) const { return __hold_all__.current_v | ||||
alue (); } | ||||
octave_value get_tightinset (void) const { return tightinset.get (); } | bool autopos_tag_is (const std::string& v) const { return autopos_tag.is | |||
(v); } | ||||
std::string get_autopos_tag (void) const { return autopos_tag.current_val | ||||
ue (); } | ||||
bool units_is (const std::string& v) const { return units.is (v); } | octave_value get_looseinset (void) const { return looseinset.get (); } | |||
std::string get_units (void) const { return units.current_value (); } | ||||
octave_value get_x_viewtransform (void) const { return x_viewtransform.ge t (); } | octave_value get_x_viewtransform (void) const { return x_viewtransform.ge t (); } | |||
octave_value get_x_projectiontransform (void) const { return x_projection transform.get (); } | octave_value get_x_projectiontransform (void) const { return x_projection transform.get (); } | |||
octave_value get_x_viewporttransform (void) const { return x_viewporttran sform.get (); } | octave_value get_x_viewporttransform (void) const { return x_viewporttran sform.get (); } | |||
octave_value get_x_normrendertransform (void) const { return x_normrender transform.get (); } | octave_value get_x_normrendertransform (void) const { return x_normrender transform.get (); } | |||
octave_value get_x_rendertransform (void) const { return x_rendertransfor m.get (); } | octave_value get_x_rendertransform (void) const { return x_rendertransfor m.get (); } | |||
octave_value get_xmtick (void) const { return xmtick.get (); } | octave_value get_xmtick (void) const { return xmtick.get (); } | |||
octave_value get_ymtick (void) const { return ymtick.get (); } | octave_value get_ymtick (void) const { return ymtick.get (); } | |||
octave_value get_zmtick (void) const { return zmtick.get (); } | octave_value get_zmtick (void) const { return zmtick.get (); } | |||
octave_value get_looseinset (void) const { return looseinset.get (); } | void set_activepositionproperty (const octave_value& val) | |||
bool autopos_tag_is (const std::string& v) const { return autopos_tag.is | ||||
(v); } | ||||
std::string get_autopos_tag (void) const { return autopos_tag.current_val | ||||
ue (); } | ||||
void set_position (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (position.set (val, true)) | ||||
{ | ||||
update_position (); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_box (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (box.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_colororder (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (colororder.set (val, true)) | if (activepositionproperty.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_dataaspectratio (const octave_value& val) | void set_alim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (dataaspectratio.set (val, false)) | if (alim.set (val, false)) | |||
{ | { | |||
set_dataaspectratiomode ("manual"); | set_alimmode ("manual"); | |||
update_dataaspectratio (); | alim.run_listeners (POSTSET); | |||
dataaspectratio.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | else | |||
set_dataaspectratiomode ("manual"); | set_alimmode ("manual"); | |||
} | } | |||
} | } | |||
void set_dataaspectratiomode (const octave_value& val) | void set_alimmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (dataaspectratiomode.set (val, true)) | if (alimmode.set (val, true)) | |||
{ | { | |||
update_dataaspectratiomode (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_layer (const octave_value& val) | void set_ambientlightcolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (layer.set (val, true)) | if (ambientlightcolor.set (val, true)) | |||
{ | { | |||
update_layer (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xlim (const octave_value& val) | void set_box (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xlim.set (val, false)) | if (box.set (val, true)) | |||
{ | { | |||
set_xlimmode ("manual"); | ||||
update_xlim (); | ||||
xlim.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_xlimmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_ylim (const octave_value& val) | void set_cameraposition (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ylim.set (val, false)) | if (cameraposition.set (val, false)) | |||
{ | { | |||
set_ylimmode ("manual"); | set_camerapositionmode ("manual"); | |||
update_ylim (); | cameraposition.run_listeners (POSTSET); | |||
ylim.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | else | |||
set_ylimmode ("manual"); | set_camerapositionmode ("manual"); | |||
} | } | |||
} | } | |||
void set_zlim (const octave_value& val) | void set_camerapositionmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zlim.set (val, false)) | if (camerapositionmode.set (val, true)) | |||
{ | { | |||
set_zlimmode ("manual"); | ||||
update_zlim (); | ||||
zlim.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_zlimmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_clim (const octave_value& val) | void set_cameratarget (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (clim.set (val, false)) | if (cameratarget.set (val, false)) | |||
{ | { | |||
set_climmode ("manual"); | set_cameratargetmode ("manual"); | |||
clim.run_listeners (POSTSET); | cameratarget.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | else | |||
set_climmode ("manual"); | set_cameratargetmode ("manual"); | |||
} | } | |||
} | } | |||
void set_alim (const octave_value& val) | void set_cameratargetmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (alim.set (val, false)) | if (cameratargetmode.set (val, true)) | |||
{ | { | |||
set_alimmode ("manual"); | ||||
alim.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_alimmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_xlimmode (const octave_value& val) | void set_cameraupvector (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xlimmode.set (val, false)) | if (cameraupvector.set (val, false)) | |||
{ | { | |||
update_axis_limits ("xlimmode"); | set_cameraupvectormode ("manual"); | |||
xlimmode.run_listeners (POSTSET); | cameraupvector.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_cameraupvectormode ("manual"); | ||||
} | } | |||
} | } | |||
void set_ylimmode (const octave_value& val) | void set_cameraupvectormode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ylimmode.set (val, false)) | if (cameraupvectormode.set (val, true)) | |||
{ | { | |||
update_axis_limits ("ylimmode"); | ||||
ylimmode.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zlimmode (const octave_value& val) | void set_cameraviewangle (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zlimmode.set (val, false)) | if (cameraviewangle.set (val, false)) | |||
{ | { | |||
update_axis_limits ("zlimmode"); | set_cameraviewanglemode ("manual"); | |||
zlimmode.run_listeners (POSTSET); | cameraviewangle.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_cameraviewanglemode ("manual"); | ||||
} | } | |||
} | } | |||
void set_climmode (const octave_value& val) | void set_cameraviewanglemode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (climmode.set (val, false)) | if (cameraviewanglemode.set (val, true)) | |||
{ | { | |||
update_axis_limits ("climmode"); | ||||
climmode.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_alimmode (const octave_value& val) | void set_clim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (alimmode.set (val, true)) | if (clim.set (val, false)) | |||
{ | { | |||
set_climmode ("manual"); | ||||
clim.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_climmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_xlabel (const octave_value& val); | void set_climmode (const octave_value& val) | |||
void set_ylabel (const octave_value& val); | ||||
void set_zlabel (const octave_value& val); | ||||
void set_title (const octave_value& val); | ||||
void set_xgrid (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xgrid.set (val, true)) | if (climmode.set (val, false)) | |||
{ | { | |||
update_axis_limits ("climmode"); | ||||
climmode.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ygrid (const octave_value& val) | void set_color (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ygrid.set (val, true)) | if (color.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zgrid (const octave_value& val) | void set_colororder (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zgrid.set (val, true)) | if (colororder.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xminorgrid (const octave_value& val) | void set_currentpoint (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xminorgrid.set (val, true)) | if (currentpoint.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_yminorgrid (const octave_value& val) | void set_dataaspectratio (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (yminorgrid.set (val, true)) | if (dataaspectratio.set (val, false)) | |||
{ | { | |||
set_dataaspectratiomode ("manual"); | ||||
update_dataaspectratio (); | ||||
dataaspectratio.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_dataaspectratiomode ("manual"); | ||||
} | } | |||
} | } | |||
void set_zminorgrid (const octave_value& val) | void set_dataaspectratiomode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zminorgrid.set (val, true)) | if (dataaspectratiomode.set (val, true)) | |||
{ | { | |||
update_dataaspectratiomode (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xtick (const octave_value& val) | void set_drawmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xtick.set (val, false)) | if (drawmode.set (val, true)) | |||
{ | { | |||
set_xtickmode ("manual"); | ||||
update_xtick (); | ||||
xtick.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_xtickmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_ytick (const octave_value& val) | void set_fontangle (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ytick.set (val, false)) | if (fontangle.set (val, true)) | |||
{ | { | |||
set_ytickmode ("manual"); | update_fontangle (); | |||
update_ytick (); | ||||
ytick.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_ytickmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_ztick (const octave_value& val) | void set_fontname (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ztick.set (val, false)) | if (fontname.set (val, true)) | |||
{ | { | |||
set_ztickmode ("manual"); | update_fontname (); | |||
update_ztick (); | ||||
ztick.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_ztickmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_xtickmode (const octave_value& val) | void set_fontsize (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xtickmode.set (val, true)) | if (fontsize.set (val, true)) | |||
{ | { | |||
update_xtickmode (); | update_fontsize (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ytickmode (const octave_value& val) | void set_fontunits (const octave_value& val); | |||
void update_fontunits (void); | ||||
void set_fontweight (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ytickmode.set (val, true)) | if (fontweight.set (val, true)) | |||
{ | { | |||
update_ytickmode (); | update_fontweight (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ztickmode (const octave_value& val) | void set_gridlinestyle (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ztickmode.set (val, true)) | if (gridlinestyle.set (val, true)) | |||
{ | { | |||
update_ztickmode (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xminortick (const octave_value& val) | void set_interpreter (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xminortick.set (val, true)) | if (interpreter.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_yminortick (const octave_value& val) | void set_layer (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (yminortick.set (val, true)) | if (layer.set (val, true)) | |||
{ | { | |||
update_layer (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zminortick (const octave_value& val) | void set_linestyleorder (const octave_value& val); | |||
void set_linewidth (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zminortick.set (val, true)) | if (linewidth.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xticklabel (const octave_value& val) | void set_minorgridlinestyle (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xticklabel.set (val, false)) | if (minorgridlinestyle.set (val, true)) | |||
{ | { | |||
set_xticklabelmode ("manual"); | ||||
xticklabel.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_xticklabelmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_yticklabel (const octave_value& val) | void set_nextplot (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (yticklabel.set (val, false)) | if (nextplot.set (val, true)) | |||
{ | { | |||
set_yticklabelmode ("manual"); | ||||
yticklabel.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_yticklabelmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_zticklabel (const octave_value& val) | void set_outerposition (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zticklabel.set (val, false)) | if (outerposition.set (val, true)) | |||
{ | { | |||
set_zticklabelmode ("manual"); | update_outerposition (); | |||
zticklabel.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_zticklabelmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_xticklabelmode (const octave_value& val) | void set_plotboxaspectratio (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xticklabelmode.set (val, true)) | if (plotboxaspectratio.set (val, false)) | |||
{ | { | |||
update_xticklabelmode (); | set_plotboxaspectratiomode ("manual"); | |||
update_plotboxaspectratio (); | ||||
plotboxaspectratio.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_plotboxaspectratiomode ("manual"); | ||||
} | } | |||
} | } | |||
void set_yticklabelmode (const octave_value& val) | void set_plotboxaspectratiomode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (yticklabelmode.set (val, true)) | if (plotboxaspectratiomode.set (val, true)) | |||
{ | { | |||
update_yticklabelmode (); | update_plotboxaspectratiomode (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zticklabelmode (const octave_value& val) | void set_position (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zticklabelmode.set (val, true)) | if (position.set (val, true)) | |||
{ | { | |||
update_zticklabelmode (); | update_position (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_interpreter (const octave_value& val) | void set_projection (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (interpreter.set (val, true)) | if (projection.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_color (const octave_value& val) | void set_tickdir (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (color.set (val, true)) | if (tickdir.set (val, false)) | |||
{ | { | |||
set_tickdirmode ("manual"); | ||||
update_tickdir (); | ||||
tickdir.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_tickdirmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_xcolor (const octave_value& val) | void set_tickdirmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xcolor.set (val, true)) | if (tickdirmode.set (val, true)) | |||
{ | { | |||
update_tickdirmode (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ycolor (const octave_value& val) | void set_ticklength (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ycolor.set (val, true)) | if (ticklength.set (val, true)) | |||
{ | { | |||
update_ticklength (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zcolor (const octave_value& val) | void set_tightinset (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zcolor.set (val, true)) | if (tightinset.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xscale (const octave_value& val) | void set_title (const octave_value& val); | |||
void set_units (const octave_value& val); | ||||
void update_units (void); | ||||
void set_view (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xscale.set (val, false)) | if (view.set (val, true)) | |||
{ | { | |||
update_xscale (); | update_view (); | |||
update_axis_limits ("xscale"); | ||||
xscale.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_yscale (const octave_value& val) | void set_xaxislocation (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (yscale.set (val, false)) | if (xaxislocation.set (val, true)) | |||
{ | { | |||
update_yscale (); | update_xaxislocation (); | |||
update_axis_limits ("yscale"); | ||||
yscale.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zscale (const octave_value& val) | void set_xcolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zscale.set (val, false)) | if (xcolor.set (val, true)) | |||
{ | { | |||
update_zscale (); | ||||
update_axis_limits ("zscale"); | ||||
zscale.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xdir (const octave_value& val) | void set_xdir (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xdir.set (val, true)) | if (xdir.set (val, true)) | |||
{ | { | |||
update_xdir (); | update_xdir (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ydir (const octave_value& val) | void set_xgrid (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ydir.set (val, true)) | if (xgrid.set (val, true)) | |||
{ | { | |||
update_ydir (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zdir (const octave_value& val) | void set_xlabel (const octave_value& val); | |||
void set_xlim (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zdir.set (val, true)) | if (xlim.set (val, false)) | |||
{ | { | |||
update_zdir (); | set_xlimmode ("manual"); | |||
update_xlim (); | ||||
xlim.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_xlimmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_yaxislocation (const octave_value& val) | void set_xlimmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (yaxislocation.set (val, true)) | if (xlimmode.set (val, false)) | |||
{ | { | |||
update_yaxislocation (); | update_axis_limits ("xlimmode"); | |||
xlimmode.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xaxislocation (const octave_value& val) | void set_xminorgrid (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xaxislocation.set (val, true)) | if (xminorgrid.set (val, true)) | |||
{ | { | |||
update_xaxislocation (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_view (const octave_value& val) | void set_xminortick (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (view.set (val, true)) | if (xminortick.set (val, true)) | |||
{ | { | |||
update_view (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set___hold_all__ (const octave_value& val) | void set_xscale (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (__hold_all__.set (val, true)) | if (xscale.set (val, false)) | |||
{ | { | |||
update_xscale (); | ||||
update_axis_limits ("xscale"); | ||||
xscale.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_nextplot (const octave_value& val) | void set_xtick (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (nextplot.set (val, true)) | if (xtick.set (val, false)) | |||
{ | { | |||
set_xtickmode ("manual"); | ||||
update_xtick (); | ||||
xtick.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_xtickmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_outerposition (const octave_value& val) | void set_xticklabel (const octave_value& val); | |||
void set_xticklabelmode (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (outerposition.set (val, true)) | if (xticklabelmode.set (val, true)) | |||
{ | { | |||
update_outerposition (); | update_xticklabelmode (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_activepositionproperty (const octave_value& val) | void set_xtickmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (activepositionproperty.set (val, true)) | if (xtickmode.set (val, true)) | |||
{ | { | |||
update_xtickmode (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ambientlightcolor (const octave_value& val) | void set_yaxislocation (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ambientlightcolor.set (val, true)) | if (yaxislocation.set (val, true)) | |||
{ | { | |||
update_yaxislocation (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_cameraposition (const octave_value& val) | void set_ycolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (cameraposition.set (val, false)) | if (ycolor.set (val, true)) | |||
{ | { | |||
set_camerapositionmode ("manual"); | ||||
cameraposition.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_camerapositionmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_cameratarget (const octave_value& val) | void set_ydir (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (cameratarget.set (val, false)) | if (ydir.set (val, true)) | |||
{ | { | |||
set_cameratargetmode ("manual"); | update_ydir (); | |||
cameratarget.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_cameratargetmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_cameraupvector (const octave_value& val) | void set_ygrid (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (cameraupvector.set (val, false)) | if (ygrid.set (val, true)) | |||
{ | { | |||
set_cameraupvectormode ("manual"); | ||||
cameraupvector.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_cameraupvectormode ("manual"); | ||||
} | } | |||
} | } | |||
void set_cameraviewangle (const octave_value& val) | void set_ylabel (const octave_value& val); | |||
void set_ylim (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (cameraviewangle.set (val, false)) | if (ylim.set (val, false)) | |||
{ | { | |||
set_cameraviewanglemode ("manual"); | set_ylimmode ("manual"); | |||
cameraviewangle.run_listeners (POSTSET); | update_ylim (); | |||
ylim.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | else | |||
set_cameraviewanglemode ("manual"); | set_ylimmode ("manual"); | |||
} | } | |||
} | } | |||
void set_camerapositionmode (const octave_value& val) | void set_ylimmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (camerapositionmode.set (val, true)) | if (ylimmode.set (val, false)) | |||
{ | { | |||
update_axis_limits ("ylimmode"); | ||||
ylimmode.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_cameratargetmode (const octave_value& val) | void set_yminorgrid (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (cameratargetmode.set (val, true)) | if (yminorgrid.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_cameraupvectormode (const octave_value& val) | void set_yminortick (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (cameraupvectormode.set (val, true)) | if (yminortick.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_cameraviewanglemode (const octave_value& val) | void set_yscale (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (cameraviewanglemode.set (val, true)) | if (yscale.set (val, false)) | |||
{ | { | |||
update_yscale (); | ||||
update_axis_limits ("yscale"); | ||||
yscale.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_currentpoint (const octave_value& val) | void set_ytick (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (currentpoint.set (val, true)) | if (ytick.set (val, false)) | |||
{ | { | |||
set_ytickmode ("manual"); | ||||
update_ytick (); | ||||
ytick.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_ytickmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_drawmode (const octave_value& val) | void set_yticklabel (const octave_value& val); | |||
void set_yticklabelmode (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (drawmode.set (val, true)) | if (yticklabelmode.set (val, true)) | |||
{ | { | |||
update_yticklabelmode (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_fontangle (const octave_value& val) | void set_ytickmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (fontangle.set (val, true)) | if (ytickmode.set (val, true)) | |||
{ | { | |||
update_fontangle (); | update_ytickmode (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_fontname (const octave_value& val) | void set_zcolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (fontname.set (val, true)) | if (zcolor.set (val, true)) | |||
{ | { | |||
update_fontname (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_fontsize (const octave_value& val) | void set_zdir (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (fontsize.set (val, true)) | if (zdir.set (val, true)) | |||
{ | { | |||
update_fontsize (); | update_zdir (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_fontunits (const octave_value& val); | void set_zgrid (const octave_value& val) | |||
void update_fontunits (void); | ||||
void set_fontweight (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (fontweight.set (val, true)) | if (zgrid.set (val, true)) | |||
{ | { | |||
update_fontweight (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_gridlinestyle (const octave_value& val) | void set_zlabel (const octave_value& val); | |||
void set_zlim (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (gridlinestyle.set (val, true)) | if (zlim.set (val, false)) | |||
{ | { | |||
set_zlimmode ("manual"); | ||||
update_zlim (); | ||||
zlim.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_zlimmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_linestyleorder (const octave_value& val) | void set_zlimmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (linestyleorder.set (val, true)) | if (zlimmode.set (val, false)) | |||
{ | { | |||
update_axis_limits ("zlimmode"); | ||||
zlimmode.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_linewidth (const octave_value& val) | void set_zminorgrid (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (linewidth.set (val, true)) | if (zminorgrid.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_minorgridlinestyle (const octave_value& val) | void set_zminortick (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (minorgridlinestyle.set (val, true)) | if (zminortick.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_plotboxaspectratio (const octave_value& val) | void set_zscale (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (plotboxaspectratio.set (val, false)) | if (zscale.set (val, false)) | |||
{ | { | |||
set_plotboxaspectratiomode ("manual"); | update_zscale (); | |||
update_plotboxaspectratio (); | update_axis_limits ("zscale"); | |||
plotboxaspectratio.run_listeners (POSTSET); | zscale.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_plotboxaspectratiomode ("manual"); | ||||
} | } | |||
} | } | |||
void set_plotboxaspectratiomode (const octave_value& val) | void set_ztick (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (plotboxaspectratiomode.set (val, true)) | if (ztick.set (val, false)) | |||
{ | { | |||
update_plotboxaspectratiomode (); | set_ztickmode ("manual"); | |||
update_ztick (); | ||||
ztick.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_ztickmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_projection (const octave_value& val) | void set_zticklabel (const octave_value& val); | |||
void set_zticklabelmode (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (projection.set (val, true)) | if (zticklabelmode.set (val, true)) | |||
{ | { | |||
update_zticklabelmode (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_tickdir (const octave_value& val) | void set_ztickmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (tickdir.set (val, false)) | if (ztickmode.set (val, true)) | |||
{ | { | |||
set_tickdirmode ("manual"); | update_ztickmode (); | |||
update_tickdir (); | ||||
tickdir.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_tickdirmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_tickdirmode (const octave_value& val) | void set___hold_all__ (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (tickdirmode.set (val, true)) | if (__hold_all__.set (val, true)) | |||
{ | { | |||
update_tickdirmode (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ticklength (const octave_value& val) | void set_autopos_tag (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ticklength.set (val, true)) | if (autopos_tag.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_tightinset (const octave_value& val) | void set_looseinset (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (tightinset.set (val, true)) | if (looseinset.set (val, true)) | |||
{ | { | |||
update_looseinset (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_units (const octave_value& val); | ||||
void update_units (void); | ||||
void set_x_viewtransform (const octave_value& val) | void set_x_viewtransform (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (x_viewtransform.set (val, true)) | if (x_viewtransform.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
skipping to change at line 6611 | skipping to change at line 6636 | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zmtick.set (val, true)) | if (zmtick.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_looseinset (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (looseinset.set (val, true)) | ||||
{ | ||||
update_looseinset (); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_autopos_tag (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (autopos_tag.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
protected: | protected: | |||
void init (void); | void init (void); | |||
private: | private: | |||
void update_xscale (void) { sx = get_xscale (); } | ||||
void update_yscale (void) { sy = get_yscale (); } | std::string | |||
void update_zscale (void) { sz = get_zscale (); } | get_scale (const std::string& scale, const Matrix& lims) | |||
{ | ||||
std::string retval = scale; | ||||
if (scale == "log" && lims.numel () > 1 && lims(0) < 0 && lims(1) < 0 | ||||
) | ||||
retval = "neglog"; | ||||
return retval; | ||||
} | ||||
void update_xscale (void) | ||||
{ | ||||
sx = get_scale (get_xscale (), xlim.get ().matrix_value ()); | ||||
} | ||||
void update_yscale (void) | ||||
{ | ||||
sy = get_scale (get_yscale (), ylim.get ().matrix_value ()); | ||||
} | ||||
void update_zscale (void) | ||||
{ | ||||
sz = get_scale (get_zscale (), zlim.get ().matrix_value ()); | ||||
} | ||||
void update_view (void) { sync_positions (); } | void update_view (void) { sync_positions (); } | |||
void update_dataaspectratio (void) { sync_positions (); } | void update_dataaspectratio (void) { sync_positions (); } | |||
void update_dataaspectratiomode (void) { sync_positions (); } | void update_dataaspectratiomode (void) { sync_positions (); } | |||
void update_plotboxaspectratio (void) { sync_positions (); } | void update_plotboxaspectratio (void) { sync_positions (); } | |||
void update_plotboxaspectratiomode (void) { sync_positions (); } | void update_plotboxaspectratiomode (void) { sync_positions (); } | |||
void update_layer (void) { update_axes_layout (); } | void update_layer (void) { update_axes_layout (); } | |||
void update_yaxislocation (void) | void update_yaxislocation (void) | |||
{ | { | |||
update_axes_layout (); | update_axes_layout (); | |||
update_ylabel_position (); | update_ylabel_position (); | |||
} | } | |||
void update_xaxislocation (void) | void update_xaxislocation (void) | |||
{ | { | |||
update_axes_layout (); | update_axes_layout (); | |||
update_xlabel_position (); | update_xlabel_position (); | |||
} | } | |||
void update_xdir (void) { update_camera (); update_axes_layout (); } | void update_xdir (void) { update_camera (); update_axes_layout (); } | |||
void update_ydir (void) { update_camera (); update_axes_layout (); } | void update_ydir (void) { update_camera (); update_axes_layout (); } | |||
void update_zdir (void) { update_camera (); update_axes_layout (); } | void update_zdir (void) { update_camera (); update_axes_layout (); } | |||
void update_ticklengths (void); | void update_ticklength (void); | |||
void update_tickdir (void) { update_ticklengths (); } | void update_tickdir (void) { update_ticklength (); } | |||
void update_tickdirmode (void) { update_ticklengths (); } | void update_tickdirmode (void) { update_ticklength (); } | |||
void update_xtick (void) | void update_xtick (void) | |||
{ | { | |||
if (xticklabelmode.is ("auto")) | if (xticklabelmode.is ("auto")) | |||
calc_ticklabels (xtick, xticklabel, xscale.is ("log")); | calc_ticklabels (xtick, xticklabel, xscale.is ("log")); | |||
} | } | |||
void update_ytick (void) | void update_ytick (void) | |||
{ | { | |||
if (yticklabelmode.is ("auto")) | if (yticklabelmode.is ("auto")) | |||
calc_ticklabels (ytick, yticklabel, yscale.is ("log")); | calc_ticklabels (ytick, yticklabel, yscale.is ("log")); | |||
} | } | |||
void update_ztick (void) | void update_ztick (void) | |||
{ | { | |||
if (zticklabelmode.is ("auto")) | if (zticklabelmode.is ("auto")) | |||
calc_ticklabels (ztick, zticklabel, zscale.is ("log")); | calc_ticklabels (ztick, zticklabel, zscale.is ("log")); | |||
} | } | |||
void update_xtickmode (void) | void update_xtickmode (void) | |||
{ | { | |||
if (xtickmode.is ("auto")) | if (xtickmode.is ("auto")) | |||
{ | { | |||
calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), x | calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), | |||
scale.is ("log")); | xscale.is ("log")); | |||
update_xtick (); | update_xtick (); | |||
} | } | |||
} | } | |||
void update_ytickmode (void) | void update_ytickmode (void) | |||
{ | { | |||
if (ytickmode.is ("auto")) | if (ytickmode.is ("auto")) | |||
{ | { | |||
calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), y | calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), | |||
scale.is ("log")); | yscale.is ("log")); | |||
update_ytick (); | update_ytick (); | |||
} | } | |||
} | } | |||
void update_ztickmode (void) | void update_ztickmode (void) | |||
{ | { | |||
if (ztickmode.is ("auto")) | if (ztickmode.is ("auto")) | |||
{ | { | |||
calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), z | calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), | |||
scale.is ("log")); | zscale.is ("log")); | |||
update_ztick (); | update_ztick (); | |||
} | } | |||
} | } | |||
void update_xticklabelmode (void) | void update_xticklabelmode (void) | |||
{ | { | |||
if (xticklabelmode.is ("auto")) | if (xticklabelmode.is ("auto")) | |||
calc_ticklabels (xtick, xticklabel, xscale.is ("log")); | calc_ticklabels (xtick, xticklabel, xscale.is ("log")); | |||
} | } | |||
void update_yticklabelmode (void) | void update_yticklabelmode (void) | |||
{ | { | |||
if (yticklabelmode.is ("auto")) | if (yticklabelmode.is ("auto")) | |||
calc_ticklabels (ytick, yticklabel, yscale.is ("log")); | calc_ticklabels (ytick, yticklabel, yscale.is ("log")); | |||
} | } | |||
void update_zticklabelmode (void) | void update_zticklabelmode (void) | |||
{ | { | |||
if (zticklabelmode.is ("auto")) | if (zticklabelmode.is ("auto")) | |||
calc_ticklabels (ztick, zticklabel, zscale.is ("log")); | calc_ticklabels (ztick, zticklabel, zscale.is ("log")); | |||
} | } | |||
void update_font (void); | void update_font (void); | |||
void update_fontname (void) { update_font (); } | void update_fontname (void) { update_font (); } | |||
void update_fontsize (void) { update_font (); } | void update_fontsize (void) { update_font (); } | |||
void update_fontangle (void) { update_font (); } | void update_fontangle (void) { update_font (); } | |||
void update_fontweight (void) { update_font (); } | void update_fontweight (void) { update_font (); } | |||
void sync_positions (const Matrix& linset); | ||||
void sync_positions (void); | ||||
void update_outerposition (void) | void update_outerposition (void) | |||
{ | { | |||
set_activepositionproperty ("outerposition"); | set_activepositionproperty ("outerposition"); | |||
sync_positions (); | caseless_str old_units = get_units (); | |||
set_units ("normalized"); | ||||
Matrix outerbox = outerposition.get ().matrix_value (); | ||||
Matrix innerbox = position.get ().matrix_value (); | ||||
Matrix linset = looseinset.get ().matrix_value (); | ||||
Matrix tinset = tightinset.get ().matrix_value (); | ||||
outerbox(2) = outerbox(2) + outerbox(0); | ||||
outerbox(3) = outerbox(3) + outerbox(1); | ||||
innerbox(0) = outerbox(0) + std::max (linset(0), tinset(0)); | ||||
innerbox(1) = outerbox(1) + std::max (linset(1), tinset(1)); | ||||
innerbox(2) = outerbox(2) - std::max (linset(2), tinset(2)); | ||||
innerbox(3) = outerbox(3) - std::max (linset(3), tinset(3)); | ||||
innerbox(2) = innerbox(2) - innerbox(0); | ||||
innerbox(3) = innerbox(3) - innerbox(1); | ||||
position = innerbox; | ||||
set_units (old_units); | ||||
update_transform (); | ||||
} | } | |||
void update_position (void) | void update_position (void) | |||
{ | { | |||
set_activepositionproperty ("position"); | set_activepositionproperty ("position"); | |||
sync_positions (); | caseless_str old_units = get_units (); | |||
set_units ("normalized"); | ||||
Matrix outerbox = outerposition.get ().matrix_value (); | ||||
Matrix innerbox = position.get ().matrix_value (); | ||||
Matrix linset = looseinset.get ().matrix_value (); | ||||
Matrix tinset = tightinset.get ().matrix_value (); | ||||
innerbox(2) = innerbox(2) + innerbox(0); | ||||
innerbox(3) = innerbox(3) + innerbox(1); | ||||
outerbox(0) = innerbox(0) - std::max (linset(0), tinset(0)); | ||||
outerbox(1) = innerbox(1) - std::max (linset(1), tinset(1)); | ||||
outerbox(2) = innerbox(2) + std::max (linset(2), tinset(2)); | ||||
outerbox(3) = innerbox(3) + std::max (linset(3), tinset(3)); | ||||
outerbox(2) = outerbox(2) - outerbox(0); | ||||
outerbox(3) = outerbox(3) - outerbox(1); | ||||
outerposition = outerbox; | ||||
set_units (old_units); | ||||
update_transform (); | ||||
} | ||||
void update_looseinset (void) | ||||
{ | ||||
caseless_str old_units = get_units (); | ||||
set_units ("normalized"); | ||||
Matrix innerbox = position.get ().matrix_value (); | ||||
innerbox(2) = innerbox(2) + innerbox(0); | ||||
innerbox(3) = innerbox(3) + innerbox(1); | ||||
Matrix outerbox = outerposition.get ().matrix_value (); | ||||
outerbox(2) = outerbox(2) + outerbox(0); | ||||
outerbox(3) = outerbox(3) + outerbox(1); | ||||
Matrix linset = looseinset.get ().matrix_value (); | ||||
Matrix tinset = tightinset.get ().matrix_value (); | ||||
if (activepositionproperty.is ("position")) | ||||
{ | ||||
outerbox(0) = innerbox(0) - std::max (linset(0), tinset(0)); | ||||
outerbox(1) = innerbox(1) - std::max (linset(1), tinset(1)); | ||||
outerbox(2) = innerbox(2) + std::max (linset(2), tinset(2)); | ||||
outerbox(3) = innerbox(3) + std::max (linset(3), tinset(3)); | ||||
outerbox(2) = outerbox(2) - outerbox(0); | ||||
outerbox(3) = outerbox(3) - outerbox(1); | ||||
outerposition = outerbox; | ||||
} | ||||
else | ||||
{ | ||||
innerbox(0) = outerbox(0) + std::max (linset(0), tinset(0)); | ||||
innerbox(1) = outerbox(1) + std::max (linset(1), tinset(1)); | ||||
innerbox(2) = outerbox(2) - std::max (linset(2), tinset(2)); | ||||
innerbox(3) = outerbox(3) - std::max (linset(3), tinset(3)); | ||||
innerbox(2) = innerbox(2) - innerbox(0); | ||||
innerbox(3) = innerbox(3) - innerbox(1); | ||||
position = innerbox; | ||||
} | ||||
set_units (old_units); | ||||
update_transform (); | ||||
} | } | |||
void update_looseinset (void) { sync_positions (); } | ||||
double calc_tick_sep (double minval, double maxval); | double calc_tick_sep (double minval, double maxval); | |||
void calc_ticks_and_lims (array_property& lims, array_property& ticks, | void calc_ticks_and_lims (array_property& lims, array_property& ticks, | |||
array_property& mticks, | array_property& mticks, | |||
bool limmode_is_auto, bool is_logscale); | bool limmode_is_auto, bool is_logscale); | |||
void calc_ticklabels (const array_property& ticks, any_property& labels | void calc_ticklabels (const array_property& ticks, any_property& labels | |||
, bool is_logscale); | , | |||
bool is_logscale); | ||||
Matrix get_ticklabel_extents (const Matrix& ticks, | Matrix get_ticklabel_extents (const Matrix& ticks, | |||
const string_vector& ticklabels, | const string_vector& ticklabels, | |||
const Matrix& limits); | const Matrix& limits); | |||
void fix_limits (array_property& lims) | void fix_limits (array_property& lims) | |||
{ | { | |||
if (lims.get ().is_empty ()) | if (lims.get ().is_empty ()) | |||
return; | return; | |||
Matrix l = lims.get ().matrix_value (); | Matrix l = lims.get ().matrix_value (); | |||
skipping to change at line 6786 | skipping to change at line 6879 | |||
Matrix calc_tightbox (const Matrix& init_pos); | Matrix calc_tightbox (const Matrix& init_pos); | |||
public: | public: | |||
Matrix get_axis_limits (double xmin, double xmax, | Matrix get_axis_limits (double xmin, double xmax, | |||
double min_pos, double max_neg, | double min_pos, double max_neg, | |||
bool logscale); | bool logscale); | |||
void update_xlim (bool do_clr_zoom = true) | void update_xlim (bool do_clr_zoom = true) | |||
{ | { | |||
if (xtickmode.is ("auto")) | if (xtickmode.is ("auto")) | |||
calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), xsc | calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), | |||
ale.is ("log")); | xscale.is ("log")); | |||
if (xticklabelmode.is ("auto")) | if (xticklabelmode.is ("auto")) | |||
calc_ticklabels (xtick, xticklabel, xscale.is ("log")); | calc_ticklabels (xtick, xticklabel, xscale.is ("log")); | |||
fix_limits (xlim); | fix_limits (xlim); | |||
update_xscale (); | ||||
if (do_clr_zoom) | if (do_clr_zoom) | |||
zoom_stack.clear (); | zoom_stack.clear (); | |||
update_axes_layout (); | update_axes_layout (); | |||
} | } | |||
void update_ylim (bool do_clr_zoom = true) | void update_ylim (bool do_clr_zoom = true) | |||
{ | { | |||
if (ytickmode.is ("auto")) | if (ytickmode.is ("auto")) | |||
calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), ysc | calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), | |||
ale.is ("log")); | yscale.is ("log")); | |||
if (yticklabelmode.is ("auto")) | if (yticklabelmode.is ("auto")) | |||
calc_ticklabels (ytick, yticklabel, yscale.is ("log")); | calc_ticklabels (ytick, yticklabel, yscale.is ("log")); | |||
fix_limits (ylim); | fix_limits (ylim); | |||
update_yscale (); | ||||
if (do_clr_zoom) | if (do_clr_zoom) | |||
zoom_stack.clear (); | zoom_stack.clear (); | |||
update_axes_layout (); | update_axes_layout (); | |||
} | } | |||
void update_zlim (void) | void update_zlim (void) | |||
{ | { | |||
if (ztickmode.is ("auto")) | if (ztickmode.is ("auto")) | |||
calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), zsc | calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), | |||
ale.is ("log")); | zscale.is ("log")); | |||
if (zticklabelmode.is ("auto")) | if (zticklabelmode.is ("auto")) | |||
calc_ticklabels (ztick, zticklabel, zscale.is ("log")); | calc_ticklabels (ztick, zticklabel, zscale.is ("log")); | |||
fix_limits (zlim); | fix_limits (zlim); | |||
update_zscale (); | ||||
zoom_stack.clear (); | zoom_stack.clear (); | |||
update_axes_layout (); | update_axes_layout (); | |||
} | } | |||
}; | }; | |||
private: | private: | |||
properties xproperties; | properties xproperties; | |||
skipping to change at line 6877 | skipping to change at line 6979 | |||
void set_defaults (const std::string& mode) | void set_defaults (const std::string& mode) | |||
{ | { | |||
remove_all_listeners (); | remove_all_listeners (); | |||
xproperties.set_defaults (*this, mode); | xproperties.set_defaults (*this, mode); | |||
} | } | |||
octave_value get (const caseless_str& name) const | octave_value get (const caseless_str& name) const | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
// FIXME -- finish this. | // FIXME: finish this. | |||
if (name.compare ("default", 7)) | if (name.compare ("default", 7)) | |||
retval = get_default (name.substr (7)); | retval = get_default (name.substr (7)); | |||
else | else | |||
retval = xproperties.get (name); | retval = xproperties.get (name); | |||
return retval; | return retval; | |||
} | } | |||
octave_value get_default (const caseless_str& name) const; | octave_value get_default (const caseless_str& name) const; | |||
skipping to change at line 6923 | skipping to change at line 7025 | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API line : public base_graphics_object | class OCTINTERP_API line : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
// properties which are not in matlab: interpreter | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 6968 | skipping to change at line 7069 | |||
static std::set<std::string> core_property_names (void); | static std::set<std::string> core_property_names (void); | |||
static bool has_core_property (const caseless_str& pname); | static bool has_core_property (const caseless_str& pname); | |||
std::set<std::string> all_property_names (void) const; | std::set<std::string> all_property_names (void) const; | |||
bool has_property (const caseless_str& pname) const; | bool has_property (const caseless_str& pname) const; | |||
private: | private: | |||
row_vector_property xdata; | ||||
row_vector_property ydata; | ||||
row_vector_property zdata; | ||||
string_property xdatasource; | ||||
string_property ydatasource; | ||||
string_property zdatasource; | ||||
color_property color; | color_property color; | |||
string_property displayname; | ||||
radio_property erasemode; | ||||
radio_property interpreter; | ||||
radio_property linestyle; | radio_property linestyle; | |||
double_property linewidth; | double_property linewidth; | |||
radio_property marker; | radio_property marker; | |||
color_property markeredgecolor; | color_property markeredgecolor; | |||
color_property markerfacecolor; | color_property markerfacecolor; | |||
double_property markersize; | double_property markersize; | |||
radio_property interpreter; | row_vector_property xdata; | |||
string_property displayname; | string_property xdatasource; | |||
radio_property erasemode; | row_vector_property ydata; | |||
string_property ydatasource; | ||||
row_vector_property zdata; | ||||
string_property zdatasource; | ||||
row_vector_property xlim; | row_vector_property xlim; | |||
row_vector_property ylim; | row_vector_property ylim; | |||
row_vector_property zlim; | row_vector_property zlim; | |||
bool_property xliminclude; | bool_property xliminclude; | |||
bool_property yliminclude; | bool_property yliminclude; | |||
bool_property zliminclude; | bool_property zliminclude; | |||
public: | public: | |||
enum | enum | |||
{ | { | |||
ID_XDATA = 4000, | ID_COLOR = 4000, | |||
ID_YDATA = 4001, | ID_DISPLAYNAME = 4001, | |||
ID_ZDATA = 4002, | ID_ERASEMODE = 4002, | |||
ID_XDATASOURCE = 4003, | ID_INTERPRETER = 4003, | |||
ID_YDATASOURCE = 4004, | ID_LINESTYLE = 4004, | |||
ID_ZDATASOURCE = 4005, | ID_LINEWIDTH = 4005, | |||
ID_COLOR = 4006, | ID_MARKER = 4006, | |||
ID_LINESTYLE = 4007, | ID_MARKEREDGECOLOR = 4007, | |||
ID_LINEWIDTH = 4008, | ID_MARKERFACECOLOR = 4008, | |||
ID_MARKER = 4009, | ID_MARKERSIZE = 4009, | |||
ID_MARKEREDGECOLOR = 4010, | ID_XDATA = 4010, | |||
ID_MARKERFACECOLOR = 4011, | ID_XDATASOURCE = 4011, | |||
ID_MARKERSIZE = 4012, | ID_YDATA = 4012, | |||
ID_INTERPRETER = 4013, | ID_YDATASOURCE = 4013, | |||
ID_DISPLAYNAME = 4014, | ID_ZDATA = 4014, | |||
ID_ERASEMODE = 4015, | ID_ZDATASOURCE = 4015, | |||
ID_XLIM = 4016, | ID_XLIM = 4016, | |||
ID_YLIM = 4017, | ID_YLIM = 4017, | |||
ID_ZLIM = 4018, | ID_ZLIM = 4018, | |||
ID_XLIMINCLUDE = 4019, | ID_XLIMINCLUDE = 4019, | |||
ID_YLIMINCLUDE = 4020, | ID_YLIMINCLUDE = 4020, | |||
ID_ZLIMINCLUDE = 4021 | ID_ZLIMINCLUDE = 4021 | |||
}; | }; | |||
octave_value get_xdata (void) const { return xdata.get (); } | ||||
octave_value get_ydata (void) const { return ydata.get (); } | ||||
octave_value get_zdata (void) const { return zdata.get (); } | ||||
std::string get_xdatasource (void) const { return xdatasource.string_valu | ||||
e (); } | ||||
std::string get_ydatasource (void) const { return ydatasource.string_valu | ||||
e (); } | ||||
std::string get_zdatasource (void) const { return zdatasource.string_valu | ||||
e (); } | ||||
bool color_is_rgb (void) const { return color.is_rgb (); } | bool color_is_rgb (void) const { return color.is_rgb (); } | |||
bool color_is (const std::string& v) const { return color.is (v); } | bool color_is (const std::string& v) const { return color.is (v); } | |||
Matrix get_color_rgb (void) const { return (color.is_rgb () ? color.rgb ( ) : Matrix ()); } | Matrix get_color_rgb (void) const { return (color.is_rgb () ? color.rgb ( ) : Matrix ()); } | |||
octave_value get_color (void) const { return color.get (); } | octave_value get_color (void) const { return color.get (); } | |||
std::string get_displayname (void) const { return displayname.string_valu | ||||
e (); } | ||||
bool erasemode_is (const std::string& v) const { return erasemode.is (v); | ||||
} | ||||
std::string get_erasemode (void) const { return erasemode.current_value ( | ||||
); } | ||||
bool interpreter_is (const std::string& v) const { return interpreter.is | ||||
(v); } | ||||
std::string get_interpreter (void) const { return interpreter.current_val | ||||
ue (); } | ||||
bool linestyle_is (const std::string& v) const { return linestyle.is (v); } | bool linestyle_is (const std::string& v) const { return linestyle.is (v); } | |||
std::string get_linestyle (void) const { return linestyle.current_value ( ); } | std::string get_linestyle (void) const { return linestyle.current_value ( ); } | |||
double get_linewidth (void) const { return linewidth.double_value (); } | double get_linewidth (void) const { return linewidth.double_value (); } | |||
bool marker_is (const std::string& v) const { return marker.is (v); } | bool marker_is (const std::string& v) const { return marker.is (v); } | |||
std::string get_marker (void) const { return marker.current_value (); } | std::string get_marker (void) const { return marker.current_value (); } | |||
bool markeredgecolor_is_rgb (void) const { return markeredgecolor.is_rgb (); } | bool markeredgecolor_is_rgb (void) const { return markeredgecolor.is_rgb (); } | |||
bool markeredgecolor_is (const std::string& v) const { return markeredgec olor.is (v); } | bool markeredgecolor_is (const std::string& v) const { return markeredgec olor.is (v); } | |||
Matrix get_markeredgecolor_rgb (void) const { return (markeredgecolor.is_ rgb () ? markeredgecolor.rgb () : Matrix ()); } | Matrix get_markeredgecolor_rgb (void) const { return (markeredgecolor.is_ rgb () ? markeredgecolor.rgb () : Matrix ()); } | |||
octave_value get_markeredgecolor (void) const { return markeredgecolor.ge t (); } | octave_value get_markeredgecolor (void) const { return markeredgecolor.ge t (); } | |||
bool markerfacecolor_is_rgb (void) const { return markerfacecolor.is_rgb (); } | bool markerfacecolor_is_rgb (void) const { return markerfacecolor.is_rgb (); } | |||
bool markerfacecolor_is (const std::string& v) const { return markerfacec olor.is (v); } | bool markerfacecolor_is (const std::string& v) const { return markerfacec olor.is (v); } | |||
Matrix get_markerfacecolor_rgb (void) const { return (markerfacecolor.is_ rgb () ? markerfacecolor.rgb () : Matrix ()); } | Matrix get_markerfacecolor_rgb (void) const { return (markerfacecolor.is_ rgb () ? markerfacecolor.rgb () : Matrix ()); } | |||
octave_value get_markerfacecolor (void) const { return markerfacecolor.ge t (); } | octave_value get_markerfacecolor (void) const { return markerfacecolor.ge t (); } | |||
double get_markersize (void) const { return markersize.double_value (); } | double get_markersize (void) const { return markersize.double_value (); } | |||
bool interpreter_is (const std::string& v) const { return interpreter.is | octave_value get_xdata (void) const { return xdata.get (); } | |||
(v); } | ||||
std::string get_interpreter (void) const { return interpreter.current_val | ||||
ue (); } | ||||
std::string get_displayname (void) const { return displayname.string_valu e (); } | std::string get_xdatasource (void) const { return xdatasource.string_valu e (); } | |||
bool erasemode_is (const std::string& v) const { return erasemode.is (v); | octave_value get_ydata (void) const { return ydata.get (); } | |||
} | ||||
std::string get_erasemode (void) const { return erasemode.current_value ( | std::string get_ydatasource (void) const { return ydatasource.string_valu | |||
); } | e (); } | |||
octave_value get_zdata (void) const { return zdata.get (); } | ||||
std::string get_zdatasource (void) const { return zdatasource.string_valu | ||||
e (); } | ||||
octave_value get_xlim (void) const { return xlim.get (); } | octave_value get_xlim (void) const { return xlim.get (); } | |||
octave_value get_ylim (void) const { return ylim.get (); } | octave_value get_ylim (void) const { return ylim.get (); } | |||
octave_value get_zlim (void) const { return zlim.get (); } | octave_value get_zlim (void) const { return zlim.get (); } | |||
bool is_xliminclude (void) const { return xliminclude.is_on (); } | bool is_xliminclude (void) const { return xliminclude.is_on (); } | |||
std::string get_xliminclude (void) const { return xliminclude.current_val ue (); } | std::string get_xliminclude (void) const { return xliminclude.current_val ue (); } | |||
bool is_yliminclude (void) const { return yliminclude.is_on (); } | bool is_yliminclude (void) const { return yliminclude.is_on (); } | |||
std::string get_yliminclude (void) const { return yliminclude.current_val ue (); } | std::string get_yliminclude (void) const { return yliminclude.current_val ue (); } | |||
bool is_zliminclude (void) const { return zliminclude.is_on (); } | bool is_zliminclude (void) const { return zliminclude.is_on (); } | |||
std::string get_zliminclude (void) const { return zliminclude.current_val ue (); } | std::string get_zliminclude (void) const { return zliminclude.current_val ue (); } | |||
void set_xdata (const octave_value& val) | void set_color (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xdata.set (val, true)) | if (color.set (val, true)) | |||
{ | { | |||
update_xdata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ydata (const octave_value& val) | void set_displayname (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ydata.set (val, true)) | if (displayname.set (val, true)) | |||
{ | { | |||
update_ydata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zdata (const octave_value& val) | void set_erasemode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zdata.set (val, true)) | if (erasemode.set (val, true)) | |||
{ | { | |||
update_zdata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xdatasource (const octave_value& val) | void set_interpreter (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xdatasource.set (val, true)) | if (interpreter.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ydatasource (const octave_value& val) | void set_linestyle (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ydatasource.set (val, true)) | if (linestyle.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zdatasource (const octave_value& val) | void set_linewidth (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zdatasource.set (val, true)) | if (linewidth.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_color (const octave_value& val) | void set_marker (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (color.set (val, true)) | if (marker.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_linestyle (const octave_value& val) | void set_markeredgecolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (linestyle.set (val, true)) | if (markeredgecolor.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_linewidth (const octave_value& val) | void set_markerfacecolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (linewidth.set (val, true)) | if (markerfacecolor.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_marker (const octave_value& val) | void set_markersize (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (marker.set (val, true)) | if (markersize.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_markeredgecolor (const octave_value& val) | void set_xdata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (markeredgecolor.set (val, true)) | if (xdata.set (val, true)) | |||
{ | { | |||
update_xdata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_markerfacecolor (const octave_value& val) | void set_xdatasource (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (markerfacecolor.set (val, true)) | if (xdatasource.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_markersize (const octave_value& val) | void set_ydata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (markersize.set (val, true)) | if (ydata.set (val, true)) | |||
{ | { | |||
update_ydata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_interpreter (const octave_value& val) | void set_ydatasource (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (interpreter.set (val, true)) | if (ydatasource.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_displayname (const octave_value& val) | void set_zdata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (displayname.set (val, true)) | if (zdata.set (val, true)) | |||
{ | { | |||
update_zdata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_erasemode (const octave_value& val) | void set_zdatasource (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (erasemode.set (val, true)) | if (zdatasource.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xlim (const octave_value& val) | void set_xlim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
skipping to change at line 7345 | skipping to change at line 7446 | |||
private: | private: | |||
Matrix compute_xlim (void) const; | Matrix compute_xlim (void) const; | |||
Matrix compute_ylim (void) const; | Matrix compute_ylim (void) const; | |||
void update_xdata (void) { set_xlim (compute_xlim ()); } | void update_xdata (void) { set_xlim (compute_xlim ()); } | |||
void update_ydata (void) { set_ylim (compute_ylim ()); } | void update_ydata (void) { set_ylim (compute_ylim ()); } | |||
void update_zdata (void) | void update_zdata (void) | |||
{ | { | |||
set_zlim (zdata.get_limits ()); | set_zlim (zdata.get_limits ()); | |||
set_zliminclude (get_zdata ().numel () > 0); | set_zliminclude (get_zdata ().numel () > 0); | |||
} | } | |||
}; | }; | |||
private: | private: | |||
properties xproperties; | properties xproperties; | |||
public: | public: | |||
line (const graphics_handle& mh, const graphics_handle& p) | line (const graphics_handle& mh, const graphics_handle& p) | |||
: base_graphics_object (), xproperties (mh, p) | : base_graphics_object (), xproperties (mh, p) | |||
{ | { | |||
xproperties.override_defaults (*this); | xproperties.override_defaults (*this); | |||
skipping to change at line 7380 | skipping to change at line 7481 | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API text : public base_graphics_object | class OCTINTERP_API text : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
double get_fontsize_points (double box_pix_height = 0) const; | double get_fontsize_points (double box_pix_height = 0) const; | |||
void set_position (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
octave_value new_val (val); | ||||
if (new_val.numel () == 2) | ||||
{ | ||||
dim_vector dv (1, 3); | ||||
new_val = new_val.resize (dv, true); | ||||
} | ||||
if (position.set (new_val, false)) | ||||
{ | ||||
set_positionmode ("manual"); | ||||
update_position (); | ||||
position.run_listeners (POSTSET); | ||||
mark_modified (); | ||||
} | ||||
else | ||||
set_positionmode ("manual"); | ||||
} | ||||
} | ||||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
skipping to change at line 7425 | skipping to change at line 7551 | |||
static std::set<std::string> core_property_names (void); | static std::set<std::string> core_property_names (void); | |||
static bool has_core_property (const caseless_str& pname); | static bool has_core_property (const caseless_str& pname); | |||
std::set<std::string> all_property_names (void) const; | std::set<std::string> all_property_names (void) const; | |||
bool has_property (const caseless_str& pname) const; | bool has_property (const caseless_str& pname) const; | |||
private: | private: | |||
text_label_property string; | ||||
radio_property units; | ||||
array_property position; | ||||
double_property rotation; | ||||
radio_property horizontalalignment; | ||||
color_property color; | ||||
string_property fontname; | ||||
double_property fontsize; | ||||
radio_property fontangle; | ||||
radio_property fontweight; | ||||
radio_property interpreter; | ||||
color_property backgroundcolor; | color_property backgroundcolor; | |||
color_property color; | ||||
string_property displayname; | string_property displayname; | |||
color_property edgecolor; | color_property edgecolor; | |||
radio_property erasemode; | ||||
bool_property editing; | bool_property editing; | |||
radio_property erasemode; | ||||
array_property extent; | ||||
radio_property fontangle; | ||||
string_property fontname; | ||||
double_property fontsize; | ||||
radio_property fontunits; | radio_property fontunits; | |||
radio_property fontweight; | ||||
radio_property horizontalalignment; | ||||
radio_property interpreter; | ||||
radio_property linestyle; | radio_property linestyle; | |||
double_property linewidth; | double_property linewidth; | |||
double_property margin; | double_property margin; | |||
array_property position; | ||||
double_property rotation; | ||||
text_label_property string; | ||||
radio_property units; | ||||
radio_property verticalalignment; | radio_property verticalalignment; | |||
array_property extent; | ||||
row_vector_property xlim; | row_vector_property xlim; | |||
row_vector_property ylim; | row_vector_property ylim; | |||
row_vector_property zlim; | row_vector_property zlim; | |||
bool_property xliminclude; | bool_property xliminclude; | |||
bool_property yliminclude; | bool_property yliminclude; | |||
bool_property zliminclude; | bool_property zliminclude; | |||
radio_property positionmode; | radio_property positionmode; | |||
radio_property rotationmode; | radio_property rotationmode; | |||
radio_property horizontalalignmentmode; | radio_property horizontalalignmentmode; | |||
radio_property verticalalignmentmode; | radio_property verticalalignmentmode; | |||
radio_property autopos_tag; | radio_property autopos_tag; | |||
public: | public: | |||
enum | enum | |||
{ | { | |||
ID_STRING = 5000, | ID_BACKGROUNDCOLOR = 5000, | |||
ID_UNITS = 5001, | ID_COLOR = 5001, | |||
ID_POSITION = 5002, | ID_DISPLAYNAME = 5002, | |||
ID_ROTATION = 5003, | ID_EDGECOLOR = 5003, | |||
ID_HORIZONTALALIGNMENT = 5004, | ID_EDITING = 5004, | |||
ID_COLOR = 5005, | ID_ERASEMODE = 5005, | |||
ID_FONTNAME = 5006, | ID_EXTENT = 5006, | |||
ID_FONTSIZE = 5007, | ID_FONTANGLE = 5007, | |||
ID_FONTANGLE = 5008, | ID_FONTNAME = 5008, | |||
ID_FONTWEIGHT = 5009, | ID_FONTSIZE = 5009, | |||
ID_INTERPRETER = 5010, | ID_FONTUNITS = 5010, | |||
ID_BACKGROUNDCOLOR = 5011, | ID_FONTWEIGHT = 5011, | |||
ID_DISPLAYNAME = 5012, | ID_HORIZONTALALIGNMENT = 5012, | |||
ID_EDGECOLOR = 5013, | ID_INTERPRETER = 5013, | |||
ID_ERASEMODE = 5014, | ID_LINESTYLE = 5014, | |||
ID_EDITING = 5015, | ID_LINEWIDTH = 5015, | |||
ID_FONTUNITS = 5016, | ID_MARGIN = 5016, | |||
ID_LINESTYLE = 5017, | ID_POSITION = 5017, | |||
ID_LINEWIDTH = 5018, | ID_ROTATION = 5018, | |||
ID_MARGIN = 5019, | ID_STRING = 5019, | |||
ID_VERTICALALIGNMENT = 5020, | ID_UNITS = 5020, | |||
ID_EXTENT = 5021, | ID_VERTICALALIGNMENT = 5021, | |||
ID_XLIM = 5022, | ID_XLIM = 5022, | |||
ID_YLIM = 5023, | ID_YLIM = 5023, | |||
ID_ZLIM = 5024, | ID_ZLIM = 5024, | |||
ID_XLIMINCLUDE = 5025, | ID_XLIMINCLUDE = 5025, | |||
ID_YLIMINCLUDE = 5026, | ID_YLIMINCLUDE = 5026, | |||
ID_ZLIMINCLUDE = 5027, | ID_ZLIMINCLUDE = 5027, | |||
ID_POSITIONMODE = 5028, | ID_POSITIONMODE = 5028, | |||
ID_ROTATIONMODE = 5029, | ID_ROTATIONMODE = 5029, | |||
ID_HORIZONTALALIGNMENTMODE = 5030, | ID_HORIZONTALALIGNMENTMODE = 5030, | |||
ID_VERTICALALIGNMENTMODE = 5031, | ID_VERTICALALIGNMENTMODE = 5031, | |||
ID_AUTOPOS_TAG = 5032 | ID_AUTOPOS_TAG = 5032 | |||
}; | }; | |||
octave_value get_string (void) const { return string.get (); } | bool backgroundcolor_is_rgb (void) const { return backgroundcolor.is_rgb | |||
(); } | ||||
bool units_is (const std::string& v) const { return units.is (v); } | bool backgroundcolor_is (const std::string& v) const { return backgroundc | |||
std::string get_units (void) const { return units.current_value (); } | olor.is (v); } | |||
Matrix get_backgroundcolor_rgb (void) const { return (backgroundcolor.is_ | ||||
octave_value get_position (void) const { return position.get (); } | rgb () ? backgroundcolor.rgb () : Matrix ()); } | |||
octave_value get_backgroundcolor (void) const { return backgroundcolor.ge | ||||
double get_rotation (void) const { return rotation.double_value (); } | t (); } | |||
bool horizontalalignment_is (const std::string& v) const { return horizon | ||||
talalignment.is (v); } | ||||
std::string get_horizontalalignment (void) const { return horizontalalign | ||||
ment.current_value (); } | ||||
bool color_is_rgb (void) const { return color.is_rgb (); } | bool color_is_rgb (void) const { return color.is_rgb (); } | |||
bool color_is (const std::string& v) const { return color.is (v); } | bool color_is (const std::string& v) const { return color.is (v); } | |||
Matrix get_color_rgb (void) const { return (color.is_rgb () ? color.rgb ( ) : Matrix ()); } | Matrix get_color_rgb (void) const { return (color.is_rgb () ? color.rgb ( ) : Matrix ()); } | |||
octave_value get_color (void) const { return color.get (); } | octave_value get_color (void) const { return color.get (); } | |||
std::string get_fontname (void) const { return fontname.string_value (); | ||||
} | ||||
double get_fontsize (void) const { return fontsize.double_value (); } | ||||
bool fontangle_is (const std::string& v) const { return fontangle.is (v); | ||||
} | ||||
std::string get_fontangle (void) const { return fontangle.current_value ( | ||||
); } | ||||
bool fontweight_is (const std::string& v) const { return fontweight.is (v | ||||
); } | ||||
std::string get_fontweight (void) const { return fontweight.current_value | ||||
(); } | ||||
bool interpreter_is (const std::string& v) const { return interpreter.is | ||||
(v); } | ||||
std::string get_interpreter (void) const { return interpreter.current_val | ||||
ue (); } | ||||
bool backgroundcolor_is_rgb (void) const { return backgroundcolor.is_rgb | ||||
(); } | ||||
bool backgroundcolor_is (const std::string& v) const { return backgroundc | ||||
olor.is (v); } | ||||
Matrix get_backgroundcolor_rgb (void) const { return (backgroundcolor.is_ | ||||
rgb () ? backgroundcolor.rgb () : Matrix ()); } | ||||
octave_value get_backgroundcolor (void) const { return backgroundcolor.ge | ||||
t (); } | ||||
std::string get_displayname (void) const { return displayname.string_valu e (); } | std::string get_displayname (void) const { return displayname.string_valu e (); } | |||
bool edgecolor_is_rgb (void) const { return edgecolor.is_rgb (); } | bool edgecolor_is_rgb (void) const { return edgecolor.is_rgb (); } | |||
bool edgecolor_is (const std::string& v) const { return edgecolor.is (v); } | bool edgecolor_is (const std::string& v) const { return edgecolor.is (v); } | |||
Matrix get_edgecolor_rgb (void) const { return (edgecolor.is_rgb () ? edg ecolor.rgb () : Matrix ()); } | Matrix get_edgecolor_rgb (void) const { return (edgecolor.is_rgb () ? edg ecolor.rgb () : Matrix ()); } | |||
octave_value get_edgecolor (void) const { return edgecolor.get (); } | octave_value get_edgecolor (void) const { return edgecolor.get (); } | |||
bool is_editing (void) const { return editing.is_on (); } | ||||
std::string get_editing (void) const { return editing.current_value (); } | ||||
bool erasemode_is (const std::string& v) const { return erasemode.is (v); } | bool erasemode_is (const std::string& v) const { return erasemode.is (v); } | |||
std::string get_erasemode (void) const { return erasemode.current_value ( ); } | std::string get_erasemode (void) const { return erasemode.current_value ( ); } | |||
bool is_editing (void) const { return editing.is_on (); } | octave_value get_extent (void) const; | |||
std::string get_editing (void) const { return editing.current_value (); } | ||||
bool fontangle_is (const std::string& v) const { return fontangle.is (v); | ||||
} | ||||
std::string get_fontangle (void) const { return fontangle.current_value ( | ||||
); } | ||||
std::string get_fontname (void) const { return fontname.string_value (); | ||||
} | ||||
double get_fontsize (void) const { return fontsize.double_value (); } | ||||
bool fontunits_is (const std::string& v) const { return fontunits.is (v); } | bool fontunits_is (const std::string& v) const { return fontunits.is (v); } | |||
std::string get_fontunits (void) const { return fontunits.current_value ( ); } | std::string get_fontunits (void) const { return fontunits.current_value ( ); } | |||
bool fontweight_is (const std::string& v) const { return fontweight.is (v | ||||
); } | ||||
std::string get_fontweight (void) const { return fontweight.current_value | ||||
(); } | ||||
bool horizontalalignment_is (const std::string& v) const { return horizon | ||||
talalignment.is (v); } | ||||
std::string get_horizontalalignment (void) const { return horizontalalign | ||||
ment.current_value (); } | ||||
bool interpreter_is (const std::string& v) const { return interpreter.is | ||||
(v); } | ||||
std::string get_interpreter (void) const { return interpreter.current_val | ||||
ue (); } | ||||
bool linestyle_is (const std::string& v) const { return linestyle.is (v); } | bool linestyle_is (const std::string& v) const { return linestyle.is (v); } | |||
std::string get_linestyle (void) const { return linestyle.current_value ( ); } | std::string get_linestyle (void) const { return linestyle.current_value ( ); } | |||
double get_linewidth (void) const { return linewidth.double_value (); } | double get_linewidth (void) const { return linewidth.double_value (); } | |||
double get_margin (void) const { return margin.double_value (); } | double get_margin (void) const { return margin.double_value (); } | |||
octave_value get_position (void) const { return position.get (); } | ||||
double get_rotation (void) const { return rotation.double_value (); } | ||||
octave_value get_string (void) const { return string.get (); } | ||||
bool units_is (const std::string& v) const { return units.is (v); } | ||||
std::string get_units (void) const { return units.current_value (); } | ||||
bool verticalalignment_is (const std::string& v) const { return verticala lignment.is (v); } | bool verticalalignment_is (const std::string& v) const { return verticala lignment.is (v); } | |||
std::string get_verticalalignment (void) const { return verticalalignment .current_value (); } | std::string get_verticalalignment (void) const { return verticalalignment .current_value (); } | |||
octave_value get_extent (void) const; | ||||
octave_value get_xlim (void) const { return xlim.get (); } | octave_value get_xlim (void) const { return xlim.get (); } | |||
octave_value get_ylim (void) const { return ylim.get (); } | octave_value get_ylim (void) const { return ylim.get (); } | |||
octave_value get_zlim (void) const { return zlim.get (); } | octave_value get_zlim (void) const { return zlim.get (); } | |||
bool is_xliminclude (void) const { return xliminclude.is_on (); } | bool is_xliminclude (void) const { return xliminclude.is_on (); } | |||
std::string get_xliminclude (void) const { return xliminclude.current_val ue (); } | std::string get_xliminclude (void) const { return xliminclude.current_val ue (); } | |||
bool is_yliminclude (void) const { return yliminclude.is_on (); } | bool is_yliminclude (void) const { return yliminclude.is_on (); } | |||
skipping to change at line 7591 | skipping to change at line 7717 | |||
bool horizontalalignmentmode_is (const std::string& v) const { return hor izontalalignmentmode.is (v); } | bool horizontalalignmentmode_is (const std::string& v) const { return hor izontalalignmentmode.is (v); } | |||
std::string get_horizontalalignmentmode (void) const { return horizontala lignmentmode.current_value (); } | std::string get_horizontalalignmentmode (void) const { return horizontala lignmentmode.current_value (); } | |||
bool verticalalignmentmode_is (const std::string& v) const { return verti calalignmentmode.is (v); } | bool verticalalignmentmode_is (const std::string& v) const { return verti calalignmentmode.is (v); } | |||
std::string get_verticalalignmentmode (void) const { return verticalalign mentmode.current_value (); } | std::string get_verticalalignmentmode (void) const { return verticalalign mentmode.current_value (); } | |||
bool autopos_tag_is (const std::string& v) const { return autopos_tag.is (v); } | bool autopos_tag_is (const std::string& v) const { return autopos_tag.is (v); } | |||
std::string get_autopos_tag (void) const { return autopos_tag.current_val ue (); } | std::string get_autopos_tag (void) const { return autopos_tag.current_val ue (); } | |||
void set_string (const octave_value& val) | void set_backgroundcolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (string.set (val, true)) | if (backgroundcolor.set (val, true)) | |||
{ | { | |||
update_string (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_units (const octave_value& val) | void set_color (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (units.set (val, true)) | if (color.set (val, true)) | |||
{ | { | |||
update_units (); | update_color (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_position (const octave_value& val) | void set_displayname (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (position.set (val, false)) | if (displayname.set (val, true)) | |||
{ | { | |||
set_positionmode ("manual"); | ||||
update_position (); | ||||
position.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_positionmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_rotation (const octave_value& val) | void set_edgecolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (rotation.set (val, false)) | if (edgecolor.set (val, true)) | |||
{ | { | |||
set_rotationmode ("manual"); | ||||
update_rotation (); | ||||
rotation.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_rotationmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_horizontalalignment (const octave_value& val) | void set_editing (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (horizontalalignment.set (val, false)) | if (editing.set (val, true)) | |||
{ | { | |||
set_horizontalalignmentmode ("manual"); | ||||
update_horizontalalignment (); | ||||
horizontalalignment.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_horizontalalignmentmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_color (const octave_value& val) | void set_erasemode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (color.set (val, true)) | if (erasemode.set (val, true)) | |||
{ | { | |||
update_color (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_fontname (const octave_value& val) | void set_extent (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (fontname.set (val, true)) | if (extent.set (val, true)) | |||
{ | { | |||
update_fontname (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_fontsize (const octave_value& val) | void set_fontangle (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (fontsize.set (val, true)) | if (fontangle.set (val, true)) | |||
{ | { | |||
update_fontsize (); | update_fontangle (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_fontangle (const octave_value& val) | void set_fontname (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (fontangle.set (val, true)) | if (fontname.set (val, true)) | |||
{ | { | |||
update_fontangle (); | update_fontname (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_fontweight (const octave_value& val) | void set_fontsize (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (fontweight.set (val, true)) | if (fontsize.set (val, true)) | |||
{ | { | |||
update_fontweight (); | update_fontsize (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_interpreter (const octave_value& val) | void set_fontunits (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (interpreter.set (val, true)) | if (fontunits.set (val, true)) | |||
{ | { | |||
update_interpreter (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_backgroundcolor (const octave_value& val) | void set_fontweight (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (backgroundcolor.set (val, true)) | if (fontweight.set (val, true)) | |||
{ | { | |||
update_fontweight (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_displayname (const octave_value& val) | void set_horizontalalignment (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (displayname.set (val, true)) | if (horizontalalignment.set (val, false)) | |||
{ | { | |||
set_horizontalalignmentmode ("manual"); | ||||
update_horizontalalignment (); | ||||
horizontalalignment.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_horizontalalignmentmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_edgecolor (const octave_value& val) | void set_interpreter (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (edgecolor.set (val, true)) | if (interpreter.set (val, true)) | |||
{ | { | |||
update_interpreter (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_erasemode (const octave_value& val) | void set_linestyle (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (erasemode.set (val, true)) | if (linestyle.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_editing (const octave_value& val) | void set_linewidth (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (editing.set (val, true)) | if (linewidth.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_fontunits (const octave_value& val) | void set_margin (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (fontunits.set (val, true)) | if (margin.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_linestyle (const octave_value& val) | void set_rotation (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (linestyle.set (val, true)) | if (rotation.set (val, false)) | |||
{ | { | |||
set_rotationmode ("manual"); | ||||
update_rotation (); | ||||
rotation.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | ||||
set_rotationmode ("manual"); | ||||
} | } | |||
} | } | |||
void set_linewidth (const octave_value& val) | void set_string (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (linewidth.set (val, true)) | if (string.set (val, true)) | |||
{ | { | |||
update_string (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_margin (const octave_value& val) | void set_units (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (margin.set (val, true)) | if (units.set (val, true)) | |||
{ | { | |||
update_units (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_verticalalignment (const octave_value& val) | void set_verticalalignment (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (verticalalignment.set (val, false)) | if (verticalalignment.set (val, false)) | |||
skipping to change at line 7850 | skipping to change at line 7971 | |||
set_verticalalignmentmode ("manual"); | set_verticalalignmentmode ("manual"); | |||
update_verticalalignment (); | update_verticalalignment (); | |||
verticalalignment.run_listeners (POSTSET); | verticalalignment.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
else | else | |||
set_verticalalignmentmode ("manual"); | set_verticalalignmentmode ("manual"); | |||
} | } | |||
} | } | |||
void set_extent (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (extent.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_xlim (const octave_value& val) | void set_xlim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xlim.set (val, false)) | if (xlim.set (val, false)) | |||
{ | { | |||
update_axis_limits ("xlim"); | update_axis_limits ("xlim"); | |||
xlim.run_listeners (POSTSET); | xlim.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
skipping to change at line 8008 | skipping to change at line 8118 | |||
Matrix get_data_position (void) const; | Matrix get_data_position (void) const; | |||
Matrix get_extent_matrix (void) const; | Matrix get_extent_matrix (void) const; | |||
const uint8NDArray& get_pixels (void) const { return pixels; } | const uint8NDArray& get_pixels (void) const { return pixels; } | |||
#if HAVE_FREETYPE | #if HAVE_FREETYPE | |||
// freetype renderer, used for calculation of text size | // freetype renderer, used for calculation of text size | |||
ft_render renderer; | ft_render renderer; | |||
#endif | #endif | |||
protected: | protected: | |||
void init (void) | void init (void) | |||
{ | { | |||
position.add_constraint (dim_vector (1, 2)); | position.add_constraint (dim_vector (1, 3)); | |||
position.add_constraint (dim_vector (1, 3)); | cached_units = get_units (); | |||
cached_units = get_units (); | update_font (); | |||
update_font (); | } | |||
} | ||||
private: | private: | |||
void update_position (void) | void update_position (void) | |||
{ | { | |||
Matrix pos = get_data_position (); | Matrix pos = get_data_position (); | |||
Matrix lim; | Matrix lim; | |||
lim = Matrix (1, 3, pos(0)); | lim = Matrix (1, 3, pos(0)); | |||
lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); | lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); | |||
set_xlim (lim); | set_xlim (lim); | |||
lim = Matrix (1, 3, pos(1)); | lim = Matrix (1, 3, pos(1)); | |||
lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); | lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); | |||
set_ylim (lim); | set_ylim (lim); | |||
if (pos.numel () == 3) | if (pos.numel () == 3) | |||
{ | { | |||
lim = Matrix (1, 3, pos(2)); | lim = Matrix (1, 3, pos(2)); | |||
lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); | lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); | |||
set_zliminclude ("on"); | set_zliminclude ("on"); | |||
set_zlim (lim); | set_zlim (lim); | |||
} | } | |||
else | else | |||
set_zliminclude ("off"); | set_zliminclude ("off"); | |||
} | } | |||
void update_text_extent (void); | void update_text_extent (void); | |||
void request_autopos (void); | void request_autopos (void); | |||
void update_positionmode (void) { request_autopos (); } | void update_positionmode (void) { request_autopos (); } | |||
void update_rotationmode (void) { request_autopos (); } | void update_rotationmode (void) { request_autopos (); } | |||
void update_horizontalalignmentmode (void) { request_autopos (); } | void update_horizontalalignmentmode (void) { request_autopos (); } | |||
void update_verticalalignmentmode (void) { request_autopos (); } | void update_verticalalignmentmode (void) { request_autopos (); } | |||
void update_font (void); | void update_font (void); | |||
void update_string (void) { request_autopos (); update_text_extent (); } | void update_string (void) { request_autopos (); update_text_extent (); } | |||
void update_rotation (void) { update_text_extent (); } | void update_rotation (void) { update_text_extent (); } | |||
void update_color (void) { update_font (); } | void update_color (void) { update_font (); update_text_extent (); } | |||
void update_fontname (void) { update_font (); update_text_extent (); } | void update_fontname (void) { update_font (); update_text_extent (); } | |||
void update_fontsize (void) { update_font (); update_text_extent (); } | void update_fontsize (void) { update_font (); update_text_extent (); } | |||
void update_fontangle (void) { update_font (); update_text_extent (); } | void update_fontangle (void) { update_font (); update_text_extent (); } | |||
void update_fontweight (void) { update_font (); update_text_extent (); } | void update_fontweight (void) { update_font (); update_text_extent (); } | |||
void update_interpreter (void) { update_text_extent (); } | void update_interpreter (void) { update_text_extent (); } | |||
void update_horizontalalignment (void) { update_text_extent (); } | void update_horizontalalignment (void) { update_text_extent (); } | |||
void update_verticalalignment (void) { update_text_extent (); } | void update_verticalalignment (void) { update_text_extent (); } | |||
void update_units (void); | void update_units (void); | |||
skipping to change at line 8095 | skipping to change at line 8204 | |||
}; | }; | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API image : public base_graphics_object | class OCTINTERP_API image : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
bool is_aliminclude (void) const | ||||
{ return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } | ||||
std::string get_aliminclude (void) const | ||||
{ return aliminclude.current_value (); } | ||||
bool is_climinclude (void) const | bool is_climinclude (void) const | |||
{ return (climinclude.is_on () && cdatamapping.is ("scaled")); } | { return (climinclude.is_on () && cdatamapping.is ("scaled")); } | |||
std::string get_climinclude (void) const | std::string get_climinclude (void) const | |||
{ return climinclude.current_value (); } | { return climinclude.current_value (); } | |||
octave_value get_color_data (void) const; | octave_value get_color_data (void) const; | |||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 8147 | skipping to change at line 8262 | |||
static std::set<std::string> core_property_names (void); | static std::set<std::string> core_property_names (void); | |||
static bool has_core_property (const caseless_str& pname); | static bool has_core_property (const caseless_str& pname); | |||
std::set<std::string> all_property_names (void) const; | std::set<std::string> all_property_names (void) const; | |||
bool has_property (const caseless_str& pname) const; | bool has_property (const caseless_str& pname) const; | |||
private: | private: | |||
row_vector_property xdata; | array_property alphadata; | |||
row_vector_property ydata; | radio_property alphadatamapping; | |||
array_property cdata; | array_property cdata; | |||
radio_property cdatamapping; | radio_property cdatamapping; | |||
radio_property erasemode; | ||||
row_vector_property xdata; | ||||
row_vector_property ydata; | ||||
row_vector_property alim; | ||||
row_vector_property clim; | ||||
row_vector_property xlim; | row_vector_property xlim; | |||
row_vector_property ylim; | row_vector_property ylim; | |||
row_vector_property clim; | bool_property aliminclude; | |||
bool_property climinclude; | ||||
bool_property xliminclude; | bool_property xliminclude; | |||
bool_property yliminclude; | bool_property yliminclude; | |||
bool_property climinclude; | ||||
public: | public: | |||
enum | enum | |||
{ | { | |||
ID_XDATA = 6000, | ID_ALPHADATA = 6000, | |||
ID_YDATA = 6001, | ID_ALPHADATAMAPPING = 6001, | |||
ID_CDATA = 6002, | ID_CDATA = 6002, | |||
ID_CDATAMAPPING = 6003, | ID_CDATAMAPPING = 6003, | |||
ID_XLIM = 6004, | ID_ERASEMODE = 6004, | |||
ID_YLIM = 6005, | ID_XDATA = 6005, | |||
ID_CLIM = 6006, | ID_YDATA = 6006, | |||
ID_XLIMINCLUDE = 6007, | ID_ALIM = 6007, | |||
ID_YLIMINCLUDE = 6008, | ID_CLIM = 6008, | |||
ID_CLIMINCLUDE = 6009 | ID_XLIM = 6009, | |||
ID_YLIM = 6010, | ||||
ID_ALIMINCLUDE = 6011, | ||||
ID_CLIMINCLUDE = 6012, | ||||
ID_XLIMINCLUDE = 6013, | ||||
ID_YLIMINCLUDE = 6014 | ||||
}; | }; | |||
octave_value get_xdata (void) const { return xdata.get (); } | octave_value get_alphadata (void) const { return alphadata.get (); } | |||
octave_value get_ydata (void) const { return ydata.get (); } | bool alphadatamapping_is (const std::string& v) const { return alphadatam | |||
apping.is (v); } | ||||
std::string get_alphadatamapping (void) const { return alphadatamapping.c | ||||
urrent_value (); } | ||||
octave_value get_cdata (void) const { return cdata.get (); } | octave_value get_cdata (void) const { return cdata.get (); } | |||
bool cdatamapping_is (const std::string& v) const { return cdatamapping.i s (v); } | bool cdatamapping_is (const std::string& v) const { return cdatamapping.i s (v); } | |||
std::string get_cdatamapping (void) const { return cdatamapping.current_v alue (); } | std::string get_cdatamapping (void) const { return cdatamapping.current_v alue (); } | |||
octave_value get_xlim (void) const { return xlim.get (); } | bool erasemode_is (const std::string& v) const { return erasemode.is (v); | |||
} | ||||
std::string get_erasemode (void) const { return erasemode.current_value ( | ||||
); } | ||||
octave_value get_ylim (void) const { return ylim.get (); } | octave_value get_xdata (void) const { return xdata.get (); } | |||
octave_value get_ydata (void) const { return ydata.get (); } | ||||
octave_value get_alim (void) const { return alim.get (); } | ||||
octave_value get_clim (void) const { return clim.get (); } | octave_value get_clim (void) const { return clim.get (); } | |||
octave_value get_xlim (void) const { return xlim.get (); } | ||||
octave_value get_ylim (void) const { return ylim.get (); } | ||||
bool is_xliminclude (void) const { return xliminclude.is_on (); } | bool is_xliminclude (void) const { return xliminclude.is_on (); } | |||
std::string get_xliminclude (void) const { return xliminclude.current_val ue (); } | std::string get_xliminclude (void) const { return xliminclude.current_val ue (); } | |||
bool is_yliminclude (void) const { return yliminclude.is_on (); } | bool is_yliminclude (void) const { return yliminclude.is_on (); } | |||
std::string get_yliminclude (void) const { return yliminclude.current_val | std::string get_yliminclude (void) const { return yliminclude.current_val | |||
ue (); } | ue (); } | |||
void set_alphadata (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (alphadata.set (val, true)) | ||||
{ | ||||
update_alphadata (); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_alphadatamapping (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (alphadatamapping.set (val, false)) | ||||
{ | ||||
update_axis_limits ("alphadatamapping"); | ||||
alphadatamapping.run_listeners (POSTSET); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_cdata (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (cdata.set (val, true)) | ||||
{ | ||||
update_cdata (); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_cdatamapping (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (cdatamapping.set (val, false)) | ||||
{ | ||||
update_axis_limits ("cdatamapping"); | ||||
cdatamapping.run_listeners (POSTSET); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_erasemode (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (erasemode.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_xdata (const octave_value& val) | void set_xdata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xdata.set (val, true)) | if (xdata.set (val, true)) | |||
{ | { | |||
update_xdata (); | update_xdata (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
skipping to change at line 8219 | skipping to change at line 8415 | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ydata.set (val, true)) | if (ydata.set (val, true)) | |||
{ | { | |||
update_ydata (); | update_ydata (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_cdata (const octave_value& val) | void set_alim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (cdata.set (val, true)) | if (alim.set (val, false)) | |||
{ | { | |||
update_cdata (); | update_axis_limits ("alim"); | |||
alim.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_cdatamapping (const octave_value& val) | void set_clim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (cdatamapping.set (val, false)) | if (clim.set (val, false)) | |||
{ | { | |||
update_axis_limits ("cdatamapping"); | update_axis_limits ("clim"); | |||
cdatamapping.run_listeners (POSTSET); | clim.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xlim (const octave_value& val) | void set_xlim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xlim.set (val, false)) | if (xlim.set (val, false)) | |||
skipping to change at line 8270 | skipping to change at line 8467 | |||
{ | { | |||
if (ylim.set (val, false)) | if (ylim.set (val, false)) | |||
{ | { | |||
update_axis_limits ("ylim"); | update_axis_limits ("ylim"); | |||
ylim.run_listeners (POSTSET); | ylim.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_clim (const octave_value& val) | void set_aliminclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (clim.set (val, false)) | if (aliminclude.set (val, false)) | |||
{ | { | |||
update_axis_limits ("clim"); | update_axis_limits ("aliminclude"); | |||
clim.run_listeners (POSTSET); | aliminclude.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xliminclude (const octave_value& val) | void set_climinclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xliminclude.set (val, false)) | if (climinclude.set (val, false)) | |||
{ | { | |||
update_axis_limits ("xliminclude"); | update_axis_limits ("climinclude"); | |||
xliminclude.run_listeners (POSTSET); | climinclude.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_yliminclude (const octave_value& val) | void set_xliminclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (yliminclude.set (val, false)) | if (xliminclude.set (val, false)) | |||
{ | { | |||
update_axis_limits ("yliminclude"); | update_axis_limits ("xliminclude"); | |||
yliminclude.run_listeners (POSTSET); | xliminclude.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_climinclude (const octave_value& val) | void set_yliminclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (climinclude.set (val, false)) | if (yliminclude.set (val, false)) | |||
{ | { | |||
update_axis_limits ("climinclude"); | update_axis_limits ("yliminclude"); | |||
climinclude.run_listeners (POSTSET); | yliminclude.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
protected: | protected: | |||
void init (void) | void init (void) | |||
{ | { | |||
xdata.add_constraint (2); | xdata.add_constraint (2); | |||
ydata.add_constraint (2); | ydata.add_constraint (2); | |||
cdata.add_constraint ("double"); | cdata.add_constraint ("double"); | |||
cdata.add_constraint ("single"); | cdata.add_constraint ("single"); | |||
cdata.add_constraint ("logical"); | cdata.add_constraint ("logical"); | |||
cdata.add_constraint ("uint8"); | cdata.add_constraint ("uint8"); | |||
cdata.add_constraint ("uint16"); | cdata.add_constraint ("uint16"); | |||
cdata.add_constraint ("int16"); | cdata.add_constraint ("int16"); | |||
cdata.add_constraint ("real"); | ||||
cdata.add_constraint (dim_vector (-1, -1)); | cdata.add_constraint (dim_vector (-1, -1)); | |||
cdata.add_constraint (dim_vector (-1, -1, 3)); | cdata.add_constraint (dim_vector (-1, -1, 3)); | |||
alphadata.add_constraint (dim_vector (-1, -1)); | ||||
alphadata.add_constraint ("double"); | ||||
alphadata.add_constraint ("uint8"); | ||||
} | } | |||
private: | private: | |||
void update_alphadata (void) | ||||
{ | ||||
if (alphadatamapping_is ("scaled")) | ||||
set_alim (alphadata.get_limits ()); | ||||
else | ||||
alim = alphadata.get_limits (); | ||||
} | ||||
void update_cdata (void) | ||||
{ | ||||
if (cdatamapping_is ("scaled")) | ||||
set_clim (cdata.get_limits ()); | ||||
else | ||||
clim = cdata.get_limits (); | ||||
} | ||||
void update_xdata (void) | void update_xdata (void) | |||
{ | { | |||
Matrix limits = xdata.get_limits (); | Matrix limits = xdata.get_limits (); | |||
float dp = pixel_xsize (); | float dp = pixel_xsize (); | |||
limits(0) = limits(0) - dp; | limits(0) = limits(0) - dp; | |||
limits(1) = limits(1) + dp; | limits(1) = limits(1) + dp; | |||
set_xlim (limits); | set_xlim (limits); | |||
} | } | |||
void update_ydata (void) | void update_ydata (void) | |||
{ | { | |||
Matrix limits = ydata.get_limits (); | Matrix limits = ydata.get_limits (); | |||
float dp = pixel_ysize (); | float dp = pixel_ysize (); | |||
limits(0) = limits(0) - dp; | limits(0) = limits(0) - dp; | |||
limits(1) = limits(1) + dp; | limits(1) = limits(1) + dp; | |||
set_ylim (limits); | set_ylim (limits); | |||
} | } | |||
void update_cdata (void) | ||||
{ | ||||
if (cdatamapping_is ("scaled")) | ||||
set_clim (cdata.get_limits ()); | ||||
else | ||||
clim = cdata.get_limits (); | ||||
} | ||||
float pixel_size (octave_idx_type dim, const Matrix limits) | float pixel_size (octave_idx_type dim, const Matrix limits) | |||
{ | { | |||
octave_idx_type l = dim - 1; | octave_idx_type l = dim - 1; | |||
float dp; | float dp; | |||
if (l > 0 && limits(0) != limits(1)) | if (l > 0 && limits(0) != limits(1)) | |||
dp = (limits(1) - limits(0))/(2*l); | dp = (limits(1) - limits(0))/(2*l); | |||
else | else | |||
{ | { | |||
if (limits(1) == limits(2)) | if (limits(1) == limits(2)) | |||
skipping to change at line 8424 | skipping to change at line 8633 | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API patch : public base_graphics_object | class OCTINTERP_API patch : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
octave_value get_color_data (void) const; | octave_value get_color_data (void) const; | |||
bool is_climinclude (void) const | ||||
{ return (climinclude.is_on () && cdatamapping.is ("scaled")); } | ||||
std::string get_climinclude (void) const | ||||
{ return climinclude.current_value (); } | ||||
bool is_aliminclude (void) const | bool is_aliminclude (void) const | |||
{ return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } | { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } | |||
std::string get_aliminclude (void) const | std::string get_aliminclude (void) const | |||
{ return aliminclude.current_value (); } | { return aliminclude.current_value (); } | |||
bool is_climinclude (void) const | ||||
{ return (climinclude.is_on () && cdatamapping.is ("scaled")); } | ||||
std::string get_climinclude (void) const | ||||
{ return climinclude.current_value (); } | ||||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 8479 | skipping to change at line 8689 | |||
static std::set<std::string> core_property_names (void); | static std::set<std::string> core_property_names (void); | |||
static bool has_core_property (const caseless_str& pname); | static bool has_core_property (const caseless_str& pname); | |||
std::set<std::string> all_property_names (void) const; | std::set<std::string> all_property_names (void) const; | |||
bool has_property (const caseless_str& pname) const; | bool has_property (const caseless_str& pname) const; | |||
private: | private: | |||
array_property xdata; | radio_property alphadatamapping; | |||
array_property ydata; | double_property ambientstrength; | |||
array_property zdata; | radio_property backfacelighting; | |||
array_property cdata; | array_property cdata; | |||
radio_property cdatamapping; | radio_property cdatamapping; | |||
array_property faces; | double_property diffusestrength; | |||
array_property facevertexalphadata; | string_property displayname; | |||
array_property facevertexcdata; | ||||
array_property vertices; | ||||
array_property vertexnormals; | ||||
radio_property normalmode; | ||||
color_property facecolor; | ||||
double_radio_property facealpha; | ||||
radio_property facelighting; | ||||
color_property edgecolor; | ||||
double_radio_property edgealpha; | double_radio_property edgealpha; | |||
color_property edgecolor; | ||||
radio_property edgelighting; | radio_property edgelighting; | |||
radio_property backfacelighting; | ||||
double_property ambientstrength; | ||||
double_property diffusestrength; | ||||
double_property specularstrength; | ||||
double_property specularexponent; | ||||
double_property specularcolorreflectance; | ||||
radio_property erasemode; | radio_property erasemode; | |||
double_radio_property facealpha; | ||||
color_property facecolor; | ||||
radio_property facelighting; | ||||
array_property faces; | ||||
array_property facevertexalphadata; | ||||
array_property facevertexcdata; | ||||
radio_property interpreter; | ||||
radio_property linestyle; | radio_property linestyle; | |||
double_property linewidth; | double_property linewidth; | |||
radio_property marker; | radio_property marker; | |||
color_property markeredgecolor; | color_property markeredgecolor; | |||
color_property markerfacecolor; | color_property markerfacecolor; | |||
double_property markersize; | double_property markersize; | |||
radio_property interpreter; | radio_property normalmode; | |||
string_property displayname; | double_property specularcolorreflectance; | |||
radio_property alphadatamapping; | double_property specularexponent; | |||
double_property specularstrength; | ||||
array_property vertexnormals; | ||||
array_property vertices; | ||||
array_property xdata; | ||||
array_property ydata; | ||||
array_property zdata; | ||||
row_vector_property alim; | ||||
row_vector_property clim; | ||||
row_vector_property xlim; | row_vector_property xlim; | |||
row_vector_property ylim; | row_vector_property ylim; | |||
row_vector_property zlim; | row_vector_property zlim; | |||
row_vector_property clim; | bool_property aliminclude; | |||
row_vector_property alim; | bool_property climinclude; | |||
bool_property xliminclude; | bool_property xliminclude; | |||
bool_property yliminclude; | bool_property yliminclude; | |||
bool_property zliminclude; | bool_property zliminclude; | |||
bool_property climinclude; | ||||
bool_property aliminclude; | ||||
public: | public: | |||
enum | enum | |||
{ | { | |||
ID_XDATA = 7000, | ID_ALPHADATAMAPPING = 7000, | |||
ID_YDATA = 7001, | ID_AMBIENTSTRENGTH = 7001, | |||
ID_ZDATA = 7002, | ID_BACKFACELIGHTING = 7002, | |||
ID_CDATA = 7003, | ID_CDATA = 7003, | |||
ID_CDATAMAPPING = 7004, | ID_CDATAMAPPING = 7004, | |||
ID_FACES = 7005, | ID_DIFFUSESTRENGTH = 7005, | |||
ID_FACEVERTEXALPHADATA = 7006, | ID_DISPLAYNAME = 7006, | |||
ID_FACEVERTEXCDATA = 7007, | ID_EDGEALPHA = 7007, | |||
ID_VERTICES = 7008, | ID_EDGECOLOR = 7008, | |||
ID_VERTEXNORMALS = 7009, | ID_EDGELIGHTING = 7009, | |||
ID_NORMALMODE = 7010, | ID_ERASEMODE = 7010, | |||
ID_FACECOLOR = 7011, | ID_FACEALPHA = 7011, | |||
ID_FACEALPHA = 7012, | ID_FACECOLOR = 7012, | |||
ID_FACELIGHTING = 7013, | ID_FACELIGHTING = 7013, | |||
ID_EDGECOLOR = 7014, | ID_FACES = 7014, | |||
ID_EDGEALPHA = 7015, | ID_FACEVERTEXALPHADATA = 7015, | |||
ID_EDGELIGHTING = 7016, | ID_FACEVERTEXCDATA = 7016, | |||
ID_BACKFACELIGHTING = 7017, | ID_INTERPRETER = 7017, | |||
ID_AMBIENTSTRENGTH = 7018, | ID_LINESTYLE = 7018, | |||
ID_DIFFUSESTRENGTH = 7019, | ID_LINEWIDTH = 7019, | |||
ID_SPECULARSTRENGTH = 7020, | ID_MARKER = 7020, | |||
ID_SPECULAREXPONENT = 7021, | ID_MARKEREDGECOLOR = 7021, | |||
ID_SPECULARCOLORREFLECTANCE = 7022, | ID_MARKERFACECOLOR = 7022, | |||
ID_ERASEMODE = 7023, | ID_MARKERSIZE = 7023, | |||
ID_LINESTYLE = 7024, | ID_NORMALMODE = 7024, | |||
ID_LINEWIDTH = 7025, | ID_SPECULARCOLORREFLECTANCE = 7025, | |||
ID_MARKER = 7026, | ID_SPECULAREXPONENT = 7026, | |||
ID_MARKEREDGECOLOR = 7027, | ID_SPECULARSTRENGTH = 7027, | |||
ID_MARKERFACECOLOR = 7028, | ID_VERTEXNORMALS = 7028, | |||
ID_MARKERSIZE = 7029, | ID_VERTICES = 7029, | |||
ID_INTERPRETER = 7030, | ID_XDATA = 7030, | |||
ID_DISPLAYNAME = 7031, | ID_YDATA = 7031, | |||
ID_ALPHADATAMAPPING = 7032, | ID_ZDATA = 7032, | |||
ID_XLIM = 7033, | ID_ALIM = 7033, | |||
ID_YLIM = 7034, | ID_CLIM = 7034, | |||
ID_ZLIM = 7035, | ID_XLIM = 7035, | |||
ID_CLIM = 7036, | ID_YLIM = 7036, | |||
ID_ALIM = 7037, | ID_ZLIM = 7037, | |||
ID_XLIMINCLUDE = 7038, | ID_ALIMINCLUDE = 7038, | |||
ID_YLIMINCLUDE = 7039, | ID_CLIMINCLUDE = 7039, | |||
ID_ZLIMINCLUDE = 7040, | ID_XLIMINCLUDE = 7040, | |||
ID_CLIMINCLUDE = 7041, | ID_YLIMINCLUDE = 7041, | |||
ID_ALIMINCLUDE = 7042 | ID_ZLIMINCLUDE = 7042 | |||
}; | }; | |||
octave_value get_xdata (void) const { return xdata.get (); } | bool alphadatamapping_is (const std::string& v) const { return alphadatam | |||
apping.is (v); } | ||||
std::string get_alphadatamapping (void) const { return alphadatamapping.c | ||||
urrent_value (); } | ||||
octave_value get_ydata (void) const { return ydata.get (); } | double get_ambientstrength (void) const { return ambientstrength.double_v alue (); } | |||
octave_value get_zdata (void) const { return zdata.get (); } | bool backfacelighting_is (const std::string& v) const { return backfaceli | |||
ghting.is (v); } | ||||
std::string get_backfacelighting (void) const { return backfacelighting.c | ||||
urrent_value (); } | ||||
octave_value get_cdata (void) const { return cdata.get (); } | octave_value get_cdata (void) const { return cdata.get (); } | |||
bool cdatamapping_is (const std::string& v) const { return cdatamapping.i s (v); } | bool cdatamapping_is (const std::string& v) const { return cdatamapping.i s (v); } | |||
std::string get_cdatamapping (void) const { return cdatamapping.current_v alue (); } | std::string get_cdatamapping (void) const { return cdatamapping.current_v alue (); } | |||
octave_value get_faces (void) const { return faces.get (); } | double get_diffusestrength (void) const { return diffusestrength.double_v | |||
alue (); } | ||||
octave_value get_facevertexalphadata (void) const { return facevertexalph | ||||
adata.get (); } | ||||
octave_value get_facevertexcdata (void) const { return facevertexcdata.ge | ||||
t (); } | ||||
octave_value get_vertices (void) const { return vertices.get (); } | ||||
octave_value get_vertexnormals (void) const { return vertexnormals.get () | ||||
; } | ||||
bool normalmode_is (const std::string& v) const { return normalmode.is (v | ||||
); } | ||||
std::string get_normalmode (void) const { return normalmode.current_value | ||||
(); } | ||||
bool facecolor_is_rgb (void) const { return facecolor.is_rgb (); } | ||||
bool facecolor_is (const std::string& v) const { return facecolor.is (v); | ||||
} | ||||
Matrix get_facecolor_rgb (void) const { return (facecolor.is_rgb () ? fac | ||||
ecolor.rgb () : Matrix ()); } | ||||
octave_value get_facecolor (void) const { return facecolor.get (); } | ||||
bool facealpha_is_double (void) const { return facealpha.is_double (); } | std::string get_displayname (void) const { return displayname.string_valu | |||
bool facealpha_is (const std::string& v) const { return facealpha.is (v); | e (); } | |||
} | ||||
double get_facealpha_double (void) const { return (facealpha.is_double () | ||||
? facealpha.double_value () : 0); } | ||||
octave_value get_facealpha (void) const { return facealpha.get (); } | ||||
bool facelighting_is (const std::string& v) const { return facelighting.i | bool edgealpha_is_double (void) const { return edgealpha.is_double (); } | |||
s (v); } | bool edgealpha_is (const std::string& v) const { return edgealpha.is (v); | |||
std::string get_facelighting (void) const { return facelighting.current_v | } | |||
alue (); } | double get_edgealpha_double (void) const { return (edgealpha.is_double () | |||
? edgealpha.double_value () : 0); } | ||||
octave_value get_edgealpha (void) const { return edgealpha.get (); } | ||||
bool edgecolor_is_rgb (void) const { return edgecolor.is_rgb (); } | bool edgecolor_is_rgb (void) const { return edgecolor.is_rgb (); } | |||
bool edgecolor_is (const std::string& v) const { return edgecolor.is (v); } | bool edgecolor_is (const std::string& v) const { return edgecolor.is (v); } | |||
Matrix get_edgecolor_rgb (void) const { return (edgecolor.is_rgb () ? edg ecolor.rgb () : Matrix ()); } | Matrix get_edgecolor_rgb (void) const { return (edgecolor.is_rgb () ? edg ecolor.rgb () : Matrix ()); } | |||
octave_value get_edgecolor (void) const { return edgecolor.get (); } | octave_value get_edgecolor (void) const { return edgecolor.get (); } | |||
bool edgealpha_is_double (void) const { return edgealpha.is_double (); } | ||||
bool edgealpha_is (const std::string& v) const { return edgealpha.is (v); | ||||
} | ||||
double get_edgealpha_double (void) const { return (edgealpha.is_double () | ||||
? edgealpha.double_value () : 0); } | ||||
octave_value get_edgealpha (void) const { return edgealpha.get (); } | ||||
bool edgelighting_is (const std::string& v) const { return edgelighting.i s (v); } | bool edgelighting_is (const std::string& v) const { return edgelighting.i s (v); } | |||
std::string get_edgelighting (void) const { return edgelighting.current_v alue (); } | std::string get_edgelighting (void) const { return edgelighting.current_v alue (); } | |||
bool backfacelighting_is (const std::string& v) const { return backfaceli | bool erasemode_is (const std::string& v) const { return erasemode.is (v); | |||
ghting.is (v); } | } | |||
std::string get_backfacelighting (void) const { return backfacelighting.c | std::string get_erasemode (void) const { return erasemode.current_value ( | |||
urrent_value (); } | ); } | |||
double get_ambientstrength (void) const { return ambientstrength.double_v | bool facealpha_is_double (void) const { return facealpha.is_double (); } | |||
alue (); } | bool facealpha_is (const std::string& v) const { return facealpha.is (v); | |||
} | ||||
double get_facealpha_double (void) const { return (facealpha.is_double () | ||||
? facealpha.double_value () : 0); } | ||||
octave_value get_facealpha (void) const { return facealpha.get (); } | ||||
double get_diffusestrength (void) const { return diffusestrength.double_v | bool facecolor_is_rgb (void) const { return facecolor.is_rgb (); } | |||
alue (); } | bool facecolor_is (const std::string& v) const { return facecolor.is (v); | |||
} | ||||
Matrix get_facecolor_rgb (void) const { return (facecolor.is_rgb () ? fac | ||||
ecolor.rgb () : Matrix ()); } | ||||
octave_value get_facecolor (void) const { return facecolor.get (); } | ||||
double get_specularstrength (void) const { return specularstrength.double | bool facelighting_is (const std::string& v) const { return facelighting.i | |||
_value (); } | s (v); } | |||
std::string get_facelighting (void) const { return facelighting.current_v | ||||
alue (); } | ||||
double get_specularexponent (void) const { return specularexponent.double _value (); } | octave_value get_faces (void) const { return faces.get (); } | |||
double get_specularcolorreflectance (void) const { return specularcolorre flectance.double_value (); } | octave_value get_facevertexalphadata (void) const { return facevertexalph adata.get (); } | |||
bool erasemode_is (const std::string& v) const { return erasemode.is (v); | octave_value get_facevertexcdata (void) const { return facevertexcdata.ge | |||
} | t (); } | |||
std::string get_erasemode (void) const { return erasemode.current_value ( | ||||
); } | bool interpreter_is (const std::string& v) const { return interpreter.is | |||
(v); } | ||||
std::string get_interpreter (void) const { return interpreter.current_val | ||||
ue (); } | ||||
bool linestyle_is (const std::string& v) const { return linestyle.is (v); } | bool linestyle_is (const std::string& v) const { return linestyle.is (v); } | |||
std::string get_linestyle (void) const { return linestyle.current_value ( ); } | std::string get_linestyle (void) const { return linestyle.current_value ( ); } | |||
double get_linewidth (void) const { return linewidth.double_value (); } | double get_linewidth (void) const { return linewidth.double_value (); } | |||
bool marker_is (const std::string& v) const { return marker.is (v); } | bool marker_is (const std::string& v) const { return marker.is (v); } | |||
std::string get_marker (void) const { return marker.current_value (); } | std::string get_marker (void) const { return marker.current_value (); } | |||
bool markeredgecolor_is_rgb (void) const { return markeredgecolor.is_rgb (); } | bool markeredgecolor_is_rgb (void) const { return markeredgecolor.is_rgb (); } | |||
skipping to change at line 8658 | skipping to change at line 8857 | |||
Matrix get_markeredgecolor_rgb (void) const { return (markeredgecolor.is_ rgb () ? markeredgecolor.rgb () : Matrix ()); } | Matrix get_markeredgecolor_rgb (void) const { return (markeredgecolor.is_ rgb () ? markeredgecolor.rgb () : Matrix ()); } | |||
octave_value get_markeredgecolor (void) const { return markeredgecolor.ge t (); } | octave_value get_markeredgecolor (void) const { return markeredgecolor.ge t (); } | |||
bool markerfacecolor_is_rgb (void) const { return markerfacecolor.is_rgb (); } | bool markerfacecolor_is_rgb (void) const { return markerfacecolor.is_rgb (); } | |||
bool markerfacecolor_is (const std::string& v) const { return markerfacec olor.is (v); } | bool markerfacecolor_is (const std::string& v) const { return markerfacec olor.is (v); } | |||
Matrix get_markerfacecolor_rgb (void) const { return (markerfacecolor.is_ rgb () ? markerfacecolor.rgb () : Matrix ()); } | Matrix get_markerfacecolor_rgb (void) const { return (markerfacecolor.is_ rgb () ? markerfacecolor.rgb () : Matrix ()); } | |||
octave_value get_markerfacecolor (void) const { return markerfacecolor.ge t (); } | octave_value get_markerfacecolor (void) const { return markerfacecolor.ge t (); } | |||
double get_markersize (void) const { return markersize.double_value (); } | double get_markersize (void) const { return markersize.double_value (); } | |||
bool interpreter_is (const std::string& v) const { return interpreter.is | bool normalmode_is (const std::string& v) const { return normalmode.is (v | |||
(v); } | ); } | |||
std::string get_interpreter (void) const { return interpreter.current_val | std::string get_normalmode (void) const { return normalmode.current_value | |||
ue (); } | (); } | |||
std::string get_displayname (void) const { return displayname.string_valu e (); } | double get_specularcolorreflectance (void) const { return specularcolorre flectance.double_value (); } | |||
bool alphadatamapping_is (const std::string& v) const { return alphadatam | double get_specularexponent (void) const { return specularexponent.double | |||
apping.is (v); } | _value (); } | |||
std::string get_alphadatamapping (void) const { return alphadatamapping.c | ||||
urrent_value (); } | ||||
octave_value get_xlim (void) const { return xlim.get (); } | double get_specularstrength (void) const { return specularstrength.double _value (); } | |||
octave_value get_ylim (void) const { return ylim.get (); } | octave_value get_vertexnormals (void) const { return vertexnormals.get () ; } | |||
octave_value get_zlim (void) const { return zlim.get (); } | octave_value get_vertices (void) const { return vertices.get (); } | |||
octave_value get_clim (void) const { return clim.get (); } | octave_value get_xdata (void) const { return xdata.get (); } | |||
octave_value get_ydata (void) const { return ydata.get (); } | ||||
octave_value get_zdata (void) const { return zdata.get (); } | ||||
octave_value get_alim (void) const { return alim.get (); } | octave_value get_alim (void) const { return alim.get (); } | |||
octave_value get_clim (void) const { return clim.get (); } | ||||
octave_value get_xlim (void) const { return xlim.get (); } | ||||
octave_value get_ylim (void) const { return ylim.get (); } | ||||
octave_value get_zlim (void) const { return zlim.get (); } | ||||
bool is_xliminclude (void) const { return xliminclude.is_on (); } | bool is_xliminclude (void) const { return xliminclude.is_on (); } | |||
std::string get_xliminclude (void) const { return xliminclude.current_val ue (); } | std::string get_xliminclude (void) const { return xliminclude.current_val ue (); } | |||
bool is_yliminclude (void) const { return yliminclude.is_on (); } | bool is_yliminclude (void) const { return yliminclude.is_on (); } | |||
std::string get_yliminclude (void) const { return yliminclude.current_val ue (); } | std::string get_yliminclude (void) const { return yliminclude.current_val ue (); } | |||
bool is_zliminclude (void) const { return zliminclude.is_on (); } | bool is_zliminclude (void) const { return zliminclude.is_on (); } | |||
std::string get_zliminclude (void) const { return zliminclude.current_val ue (); } | std::string get_zliminclude (void) const { return zliminclude.current_val ue (); } | |||
void set_xdata (const octave_value& val) | void set_alphadatamapping (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xdata.set (val, true)) | if (alphadatamapping.set (val, false)) | |||
{ | { | |||
update_xdata (); | update_axis_limits ("alphadatamapping"); | |||
alphadatamapping.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ydata (const octave_value& val) | void set_ambientstrength (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ydata.set (val, true)) | if (ambientstrength.set (val, true)) | |||
{ | { | |||
update_ydata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zdata (const octave_value& val) | void set_backfacelighting (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zdata.set (val, true)) | if (backfacelighting.set (val, true)) | |||
{ | { | |||
update_zdata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_cdata (const octave_value& val) | void set_cdata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (cdata.set (val, true)) | if (cdata.set (val, true)) | |||
skipping to change at line 8746 | skipping to change at line 8955 | |||
{ | { | |||
if (cdatamapping.set (val, false)) | if (cdatamapping.set (val, false)) | |||
{ | { | |||
update_axis_limits ("cdatamapping"); | update_axis_limits ("cdatamapping"); | |||
cdatamapping.run_listeners (POSTSET); | cdatamapping.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_faces (const octave_value& val) | void set_diffusestrength (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (faces.set (val, true)) | if (diffusestrength.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_facevertexalphadata (const octave_value& val) | void set_displayname (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (facevertexalphadata.set (val, true)) | if (displayname.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_facevertexcdata (const octave_value& val) | void set_edgealpha (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (facevertexcdata.set (val, true)) | if (edgealpha.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_vertices (const octave_value& val) | void set_edgecolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (vertices.set (val, true)) | if (edgecolor.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_vertexnormals (const octave_value& val) | void set_edgelighting (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (vertexnormals.set (val, true)) | if (edgelighting.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_normalmode (const octave_value& val) | void set_erasemode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (normalmode.set (val, true)) | if (erasemode.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_facecolor (const octave_value& val) | void set_facealpha (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (facecolor.set (val, true)) | if (facealpha.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_facealpha (const octave_value& val) | void set_facecolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (facealpha.set (val, true)) | if (facecolor.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_facelighting (const octave_value& val) | void set_facelighting (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (facelighting.set (val, true)) | if (facelighting.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_edgecolor (const octave_value& val) | void set_faces (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (edgecolor.set (val, true)) | if (faces.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_edgealpha (const octave_value& val) | void set_facevertexalphadata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (edgealpha.set (val, true)) | if (facevertexalphadata.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_edgelighting (const octave_value& val) | void set_facevertexcdata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (edgelighting.set (val, true)) | if (facevertexcdata.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_backfacelighting (const octave_value& val) | void set_interpreter (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (backfacelighting.set (val, true)) | if (interpreter.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ambientstrength (const octave_value& val) | void set_linestyle (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ambientstrength.set (val, true)) | if (linestyle.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_diffusestrength (const octave_value& val) | void set_linewidth (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (diffusestrength.set (val, true)) | if (linewidth.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_specularstrength (const octave_value& val) | void set_marker (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (specularstrength.set (val, true)) | if (marker.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_specularexponent (const octave_value& val) | void set_markeredgecolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (specularexponent.set (val, true)) | if (markeredgecolor.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_specularcolorreflectance (const octave_value& val) | void set_markerfacecolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (specularcolorreflectance.set (val, true)) | if (markerfacecolor.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_erasemode (const octave_value& val) | void set_markersize (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (erasemode.set (val, true)) | if (markersize.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_linestyle (const octave_value& val) | void set_normalmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (linestyle.set (val, true)) | if (normalmode.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_linewidth (const octave_value& val) | void set_specularcolorreflectance (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (linewidth.set (val, true)) | if (specularcolorreflectance.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_marker (const octave_value& val) | void set_specularexponent (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (marker.set (val, true)) | if (specularexponent.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_markeredgecolor (const octave_value& val) | void set_specularstrength (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (markeredgecolor.set (val, true)) | if (specularstrength.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_markerfacecolor (const octave_value& val) | void set_vertexnormals (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (markerfacecolor.set (val, true)) | if (vertexnormals.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_markersize (const octave_value& val) | void set_vertices (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (markersize.set (val, true)) | if (vertices.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_interpreter (const octave_value& val) | void set_xdata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (interpreter.set (val, true)) | if (xdata.set (val, true)) | |||
{ | { | |||
update_xdata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_displayname (const octave_value& val) | void set_ydata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (displayname.set (val, true)) | if (ydata.set (val, true)) | |||
{ | { | |||
update_ydata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_alphadatamapping (const octave_value& val) | void set_zdata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (alphadatamapping.set (val, false)) | if (zdata.set (val, true)) | |||
{ | { | |||
update_axis_limits ("alphadatamapping"); | update_zdata (); | |||
alphadatamapping.run_listeners (POSTSET); | mark_modified (); | |||
} | ||||
} | ||||
} | ||||
void set_alim (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (alim.set (val, false)) | ||||
{ | ||||
update_axis_limits ("alim"); | ||||
alim.run_listeners (POSTSET); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_clim (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (clim.set (val, false)) | ||||
{ | ||||
update_axis_limits ("clim"); | ||||
clim.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xlim (const octave_value& val) | void set_xlim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xlim.set (val, false)) | if (xlim.set (val, false)) | |||
skipping to change at line 9095 | skipping to change at line 9331 | |||
{ | { | |||
if (zlim.set (val, false)) | if (zlim.set (val, false)) | |||
{ | { | |||
update_axis_limits ("zlim"); | update_axis_limits ("zlim"); | |||
zlim.run_listeners (POSTSET); | zlim.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_clim (const octave_value& val) | void set_aliminclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (clim.set (val, false)) | if (aliminclude.set (val, false)) | |||
{ | { | |||
update_axis_limits ("clim"); | update_axis_limits ("aliminclude"); | |||
clim.run_listeners (POSTSET); | aliminclude.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_alim (const octave_value& val) | void set_climinclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (alim.set (val, false)) | if (climinclude.set (val, false)) | |||
{ | { | |||
update_axis_limits ("alim"); | update_axis_limits ("climinclude"); | |||
alim.run_listeners (POSTSET); | climinclude.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xliminclude (const octave_value& val) | void set_xliminclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xliminclude.set (val, false)) | if (xliminclude.set (val, false)) | |||
skipping to change at line 9160 | skipping to change at line 9396 | |||
{ | { | |||
if (zliminclude.set (val, false)) | if (zliminclude.set (val, false)) | |||
{ | { | |||
update_axis_limits ("zliminclude"); | update_axis_limits ("zliminclude"); | |||
zliminclude.run_listeners (POSTSET); | zliminclude.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_climinclude (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (climinclude.set (val, false)) | ||||
{ | ||||
update_axis_limits ("climinclude"); | ||||
climinclude.run_listeners (POSTSET); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_aliminclude (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (aliminclude.set (val, false)) | ||||
{ | ||||
update_axis_limits ("aliminclude"); | ||||
aliminclude.run_listeners (POSTSET); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
protected: | protected: | |||
void init (void) | void init (void) | |||
{ | { | |||
xdata.add_constraint (dim_vector (-1, -1)); | xdata.add_constraint (dim_vector (-1, -1)); | |||
ydata.add_constraint (dim_vector (-1, -1)); | ydata.add_constraint (dim_vector (-1, -1)); | |||
zdata.add_constraint (dim_vector (-1, -1)); | zdata.add_constraint (dim_vector (-1, -1)); | |||
vertices.add_constraint (dim_vector (-1, 2)); | faces.add_constraint (dim_vector (-1, -1)); | |||
vertices.add_constraint (dim_vector (-1, 3)); | vertices.add_constraint (dim_vector (-1, 2)); | |||
cdata.add_constraint (dim_vector (-1, -1)); | vertices.add_constraint (dim_vector (-1, 3)); | |||
cdata.add_constraint (dim_vector (-1, -1, 3)); | cdata.add_constraint (dim_vector (-1, -1)); | |||
facevertexcdata.add_constraint (dim_vector (-1, 1)); | cdata.add_constraint (dim_vector (-1, -1, 3)); | |||
facevertexcdata.add_constraint (dim_vector (-1, 3)); | facevertexcdata.add_constraint (dim_vector (-1, 1)); | |||
facevertexalphadata.add_constraint (dim_vector (-1, 1)); | facevertexcdata.add_constraint (dim_vector (-1, 3)); | |||
} | facevertexalphadata.add_constraint (dim_vector (-1, 1)); | |||
vertexnormals.add_constraint (dim_vector (-1, -1)); | ||||
} | ||||
private: | private: | |||
void update_xdata (void) { set_xlim (xdata.get_limits ()); } | void update_xdata (void) { set_xlim (xdata.get_limits ()); } | |||
void update_ydata (void) { set_ylim (ydata.get_limits ()); } | void update_ydata (void) { set_ylim (ydata.get_limits ()); } | |||
void update_zdata (void) { set_zlim (zdata.get_limits ()); } | void update_zdata (void) { set_zlim (zdata.get_limits ()); } | |||
void update_cdata (void) | void update_cdata (void) | |||
{ | { | |||
if (cdatamapping_is ("scaled")) | if (cdatamapping_is ("scaled")) | |||
set_clim (cdata.get_limits ()); | set_clim (cdata.get_limits ()); | |||
else | else | |||
clim = cdata.get_limits (); | clim = cdata.get_limits (); | |||
} | } | |||
}; | }; | |||
private: | private: | |||
properties xproperties; | properties xproperties; | |||
public: | public: | |||
patch (const graphics_handle& mh, const graphics_handle& p) | patch (const graphics_handle& mh, const graphics_handle& p) | |||
: base_graphics_object (), xproperties (mh, p) | : base_graphics_object (), xproperties (mh, p) | |||
{ | { | |||
xproperties.override_defaults (*this); | xproperties.override_defaults (*this); | |||
skipping to change at line 9244 | skipping to change at line 9456 | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API surface : public base_graphics_object | class OCTINTERP_API surface : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
octave_value get_color_data (void) const; | octave_value get_color_data (void) const; | |||
bool is_climinclude (void) const | ||||
{ return (climinclude.is_on () && cdatamapping.is ("scaled")); } | ||||
std::string get_climinclude (void) const | ||||
{ return climinclude.current_value (); } | ||||
bool is_aliminclude (void) const | bool is_aliminclude (void) const | |||
{ return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } | { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } | |||
std::string get_aliminclude (void) const | std::string get_aliminclude (void) const | |||
{ return aliminclude.current_value (); } | { return aliminclude.current_value (); } | |||
bool is_climinclude (void) const | ||||
{ return (climinclude.is_on () && cdatamapping.is ("scaled")); } | ||||
std::string get_climinclude (void) const | ||||
{ return climinclude.current_value (); } | ||||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 9299 | skipping to change at line 9512 | |||
static std::set<std::string> core_property_names (void); | static std::set<std::string> core_property_names (void); | |||
static bool has_core_property (const caseless_str& pname); | static bool has_core_property (const caseless_str& pname); | |||
std::set<std::string> all_property_names (void) const; | std::set<std::string> all_property_names (void) const; | |||
bool has_property (const caseless_str& pname) const; | bool has_property (const caseless_str& pname) const; | |||
private: | private: | |||
array_property xdata; | array_property alphadata; | |||
array_property ydata; | radio_property alphadatamapping; | |||
array_property zdata; | double_property ambientstrength; | |||
radio_property backfacelighting; | ||||
array_property cdata; | array_property cdata; | |||
radio_property cdatamapping; | radio_property cdatamapping; | |||
string_property xdatasource; | ||||
string_property ydatasource; | ||||
string_property zdatasource; | ||||
string_property cdatasource; | string_property cdatasource; | |||
color_property facecolor; | double_property diffusestrength; | |||
double_radio_property facealpha; | string_property displayname; | |||
double_radio_property edgealpha; | ||||
color_property edgecolor; | color_property edgecolor; | |||
radio_property edgelighting; | ||||
radio_property erasemode; | ||||
double_radio_property facealpha; | ||||
color_property facecolor; | ||||
radio_property facelighting; | ||||
radio_property interpreter; | ||||
radio_property linestyle; | radio_property linestyle; | |||
double_property linewidth; | double_property linewidth; | |||
radio_property marker; | radio_property marker; | |||
color_property markeredgecolor; | color_property markeredgecolor; | |||
color_property markerfacecolor; | color_property markerfacecolor; | |||
double_property markersize; | double_property markersize; | |||
radio_property interpreter; | ||||
string_property displayname; | ||||
array_property alphadata; | ||||
radio_property alphadatamapping; | ||||
double_property ambientstrength; | ||||
radio_property backfacelighting; | ||||
double_property diffusestrength; | ||||
double_radio_property edgealpha; | ||||
radio_property edgelighting; | ||||
radio_property erasemode; | ||||
radio_property facelighting; | ||||
radio_property meshstyle; | radio_property meshstyle; | |||
radio_property normalmode; | radio_property normalmode; | |||
double_property specularcolorreflectance; | double_property specularcolorreflectance; | |||
double_property specularexponent; | double_property specularexponent; | |||
double_property specularstrength; | double_property specularstrength; | |||
array_property vertexnormals; | array_property vertexnormals; | |||
array_property xdata; | ||||
string_property xdatasource; | ||||
array_property ydata; | ||||
string_property ydatasource; | ||||
array_property zdata; | ||||
string_property zdatasource; | ||||
row_vector_property alim; | ||||
row_vector_property clim; | ||||
row_vector_property xlim; | row_vector_property xlim; | |||
row_vector_property ylim; | row_vector_property ylim; | |||
row_vector_property zlim; | row_vector_property zlim; | |||
row_vector_property clim; | bool_property aliminclude; | |||
row_vector_property alim; | bool_property climinclude; | |||
bool_property xliminclude; | bool_property xliminclude; | |||
bool_property yliminclude; | bool_property yliminclude; | |||
bool_property zliminclude; | bool_property zliminclude; | |||
bool_property climinclude; | ||||
bool_property aliminclude; | ||||
public: | public: | |||
enum | enum | |||
{ | { | |||
ID_XDATA = 8000, | ID_ALPHADATA = 8000, | |||
ID_YDATA = 8001, | ID_ALPHADATAMAPPING = 8001, | |||
ID_ZDATA = 8002, | ID_AMBIENTSTRENGTH = 8002, | |||
ID_CDATA = 8003, | ID_BACKFACELIGHTING = 8003, | |||
ID_CDATAMAPPING = 8004, | ID_CDATA = 8004, | |||
ID_XDATASOURCE = 8005, | ID_CDATAMAPPING = 8005, | |||
ID_YDATASOURCE = 8006, | ID_CDATASOURCE = 8006, | |||
ID_ZDATASOURCE = 8007, | ID_DIFFUSESTRENGTH = 8007, | |||
ID_CDATASOURCE = 8008, | ID_DISPLAYNAME = 8008, | |||
ID_FACECOLOR = 8009, | ID_EDGEALPHA = 8009, | |||
ID_FACEALPHA = 8010, | ID_EDGECOLOR = 8010, | |||
ID_EDGECOLOR = 8011, | ID_EDGELIGHTING = 8011, | |||
ID_LINESTYLE = 8012, | ID_ERASEMODE = 8012, | |||
ID_LINEWIDTH = 8013, | ID_FACEALPHA = 8013, | |||
ID_MARKER = 8014, | ID_FACECOLOR = 8014, | |||
ID_MARKEREDGECOLOR = 8015, | ID_FACELIGHTING = 8015, | |||
ID_MARKERFACECOLOR = 8016, | ID_INTERPRETER = 8016, | |||
ID_MARKERSIZE = 8017, | ID_LINESTYLE = 8017, | |||
ID_INTERPRETER = 8018, | ID_LINEWIDTH = 8018, | |||
ID_DISPLAYNAME = 8019, | ID_MARKER = 8019, | |||
ID_ALPHADATA = 8020, | ID_MARKEREDGECOLOR = 8020, | |||
ID_ALPHADATAMAPPING = 8021, | ID_MARKERFACECOLOR = 8021, | |||
ID_AMBIENTSTRENGTH = 8022, | ID_MARKERSIZE = 8022, | |||
ID_BACKFACELIGHTING = 8023, | ID_MESHSTYLE = 8023, | |||
ID_DIFFUSESTRENGTH = 8024, | ID_NORMALMODE = 8024, | |||
ID_EDGEALPHA = 8025, | ID_SPECULARCOLORREFLECTANCE = 8025, | |||
ID_EDGELIGHTING = 8026, | ID_SPECULAREXPONENT = 8026, | |||
ID_ERASEMODE = 8027, | ID_SPECULARSTRENGTH = 8027, | |||
ID_FACELIGHTING = 8028, | ID_VERTEXNORMALS = 8028, | |||
ID_MESHSTYLE = 8029, | ID_XDATA = 8029, | |||
ID_NORMALMODE = 8030, | ID_XDATASOURCE = 8030, | |||
ID_SPECULARCOLORREFLECTANCE = 8031, | ID_YDATA = 8031, | |||
ID_SPECULAREXPONENT = 8032, | ID_YDATASOURCE = 8032, | |||
ID_SPECULARSTRENGTH = 8033, | ID_ZDATA = 8033, | |||
ID_VERTEXNORMALS = 8034, | ID_ZDATASOURCE = 8034, | |||
ID_XLIM = 8035, | ID_ALIM = 8035, | |||
ID_YLIM = 8036, | ID_CLIM = 8036, | |||
ID_ZLIM = 8037, | ID_XLIM = 8037, | |||
ID_CLIM = 8038, | ID_YLIM = 8038, | |||
ID_ALIM = 8039, | ID_ZLIM = 8039, | |||
ID_XLIMINCLUDE = 8040, | ID_ALIMINCLUDE = 8040, | |||
ID_YLIMINCLUDE = 8041, | ID_CLIMINCLUDE = 8041, | |||
ID_ZLIMINCLUDE = 8042, | ID_XLIMINCLUDE = 8042, | |||
ID_CLIMINCLUDE = 8043, | ID_YLIMINCLUDE = 8043, | |||
ID_ALIMINCLUDE = 8044 | ID_ZLIMINCLUDE = 8044 | |||
}; | }; | |||
octave_value get_xdata (void) const { return xdata.get (); } | octave_value get_alphadata (void) const { return alphadata.get (); } | |||
octave_value get_ydata (void) const { return ydata.get (); } | bool alphadatamapping_is (const std::string& v) const { return alphadatam | |||
apping.is (v); } | ||||
std::string get_alphadatamapping (void) const { return alphadatamapping.c | ||||
urrent_value (); } | ||||
octave_value get_zdata (void) const { return zdata.get (); } | double get_ambientstrength (void) const { return ambientstrength.double_v | |||
alue (); } | ||||
bool backfacelighting_is (const std::string& v) const { return backfaceli | ||||
ghting.is (v); } | ||||
std::string get_backfacelighting (void) const { return backfacelighting.c | ||||
urrent_value (); } | ||||
octave_value get_cdata (void) const { return cdata.get (); } | octave_value get_cdata (void) const { return cdata.get (); } | |||
bool cdatamapping_is (const std::string& v) const { return cdatamapping.i s (v); } | bool cdatamapping_is (const std::string& v) const { return cdatamapping.i s (v); } | |||
std::string get_cdatamapping (void) const { return cdatamapping.current_v alue (); } | std::string get_cdatamapping (void) const { return cdatamapping.current_v alue (); } | |||
std::string get_xdatasource (void) const { return xdatasource.string_valu e (); } | std::string get_cdatasource (void) const { return cdatasource.string_valu e (); } | |||
std::string get_ydatasource (void) const { return ydatasource.string_valu e (); } | double get_diffusestrength (void) const { return diffusestrength.double_v alue (); } | |||
std::string get_zdatasource (void) const { return zdatasource.string_valu e (); } | std::string get_displayname (void) const { return displayname.string_valu e (); } | |||
std::string get_cdatasource (void) const { return cdatasource.string_valu | bool edgealpha_is_double (void) const { return edgealpha.is_double (); } | |||
e (); } | bool edgealpha_is (const std::string& v) const { return edgealpha.is (v); | |||
} | ||||
double get_edgealpha_double (void) const { return (edgealpha.is_double () | ||||
? edgealpha.double_value () : 0); } | ||||
octave_value get_edgealpha (void) const { return edgealpha.get (); } | ||||
bool facecolor_is_rgb (void) const { return facecolor.is_rgb (); } | bool edgecolor_is_rgb (void) const { return edgecolor.is_rgb (); } | |||
bool facecolor_is (const std::string& v) const { return facecolor.is (v); | bool edgecolor_is (const std::string& v) const { return edgecolor.is (v); | |||
} | } | |||
Matrix get_facecolor_rgb (void) const { return (facecolor.is_rgb () ? fac | Matrix get_edgecolor_rgb (void) const { return (edgecolor.is_rgb () ? edg | |||
ecolor.rgb () : Matrix ()); } | ecolor.rgb () : Matrix ()); } | |||
octave_value get_facecolor (void) const { return facecolor.get (); } | octave_value get_edgecolor (void) const { return edgecolor.get (); } | |||
bool edgelighting_is (const std::string& v) const { return edgelighting.i | ||||
s (v); } | ||||
std::string get_edgelighting (void) const { return edgelighting.current_v | ||||
alue (); } | ||||
bool erasemode_is (const std::string& v) const { return erasemode.is (v); | ||||
} | ||||
std::string get_erasemode (void) const { return erasemode.current_value ( | ||||
); } | ||||
bool facealpha_is_double (void) const { return facealpha.is_double (); } | bool facealpha_is_double (void) const { return facealpha.is_double (); } | |||
bool facealpha_is (const std::string& v) const { return facealpha.is (v); } | bool facealpha_is (const std::string& v) const { return facealpha.is (v); } | |||
double get_facealpha_double (void) const { return (facealpha.is_double () ? facealpha.double_value () : 0); } | double get_facealpha_double (void) const { return (facealpha.is_double () ? facealpha.double_value () : 0); } | |||
octave_value get_facealpha (void) const { return facealpha.get (); } | octave_value get_facealpha (void) const { return facealpha.get (); } | |||
bool edgecolor_is_rgb (void) const { return edgecolor.is_rgb (); } | bool facecolor_is_rgb (void) const { return facecolor.is_rgb (); } | |||
bool edgecolor_is (const std::string& v) const { return edgecolor.is (v); | bool facecolor_is (const std::string& v) const { return facecolor.is (v); | |||
} | } | |||
Matrix get_edgecolor_rgb (void) const { return (edgecolor.is_rgb () ? edg | Matrix get_facecolor_rgb (void) const { return (facecolor.is_rgb () ? fac | |||
ecolor.rgb () : Matrix ()); } | ecolor.rgb () : Matrix ()); } | |||
octave_value get_edgecolor (void) const { return edgecolor.get (); } | octave_value get_facecolor (void) const { return facecolor.get (); } | |||
bool facelighting_is (const std::string& v) const { return facelighting.i | ||||
s (v); } | ||||
std::string get_facelighting (void) const { return facelighting.current_v | ||||
alue (); } | ||||
bool interpreter_is (const std::string& v) const { return interpreter.is | ||||
(v); } | ||||
std::string get_interpreter (void) const { return interpreter.current_val | ||||
ue (); } | ||||
bool linestyle_is (const std::string& v) const { return linestyle.is (v); } | bool linestyle_is (const std::string& v) const { return linestyle.is (v); } | |||
std::string get_linestyle (void) const { return linestyle.current_value ( ); } | std::string get_linestyle (void) const { return linestyle.current_value ( ); } | |||
double get_linewidth (void) const { return linewidth.double_value (); } | double get_linewidth (void) const { return linewidth.double_value (); } | |||
bool marker_is (const std::string& v) const { return marker.is (v); } | bool marker_is (const std::string& v) const { return marker.is (v); } | |||
std::string get_marker (void) const { return marker.current_value (); } | std::string get_marker (void) const { return marker.current_value (); } | |||
bool markeredgecolor_is_rgb (void) const { return markeredgecolor.is_rgb (); } | bool markeredgecolor_is_rgb (void) const { return markeredgecolor.is_rgb (); } | |||
skipping to change at line 9450 | skipping to change at line 9682 | |||
Matrix get_markeredgecolor_rgb (void) const { return (markeredgecolor.is_ rgb () ? markeredgecolor.rgb () : Matrix ()); } | Matrix get_markeredgecolor_rgb (void) const { return (markeredgecolor.is_ rgb () ? markeredgecolor.rgb () : Matrix ()); } | |||
octave_value get_markeredgecolor (void) const { return markeredgecolor.ge t (); } | octave_value get_markeredgecolor (void) const { return markeredgecolor.ge t (); } | |||
bool markerfacecolor_is_rgb (void) const { return markerfacecolor.is_rgb (); } | bool markerfacecolor_is_rgb (void) const { return markerfacecolor.is_rgb (); } | |||
bool markerfacecolor_is (const std::string& v) const { return markerfacec olor.is (v); } | bool markerfacecolor_is (const std::string& v) const { return markerfacec olor.is (v); } | |||
Matrix get_markerfacecolor_rgb (void) const { return (markerfacecolor.is_ rgb () ? markerfacecolor.rgb () : Matrix ()); } | Matrix get_markerfacecolor_rgb (void) const { return (markerfacecolor.is_ rgb () ? markerfacecolor.rgb () : Matrix ()); } | |||
octave_value get_markerfacecolor (void) const { return markerfacecolor.ge t (); } | octave_value get_markerfacecolor (void) const { return markerfacecolor.ge t (); } | |||
double get_markersize (void) const { return markersize.double_value (); } | double get_markersize (void) const { return markersize.double_value (); } | |||
bool interpreter_is (const std::string& v) const { return interpreter.is | ||||
(v); } | ||||
std::string get_interpreter (void) const { return interpreter.current_val | ||||
ue (); } | ||||
std::string get_displayname (void) const { return displayname.string_valu | ||||
e (); } | ||||
octave_value get_alphadata (void) const { return alphadata.get (); } | ||||
bool alphadatamapping_is (const std::string& v) const { return alphadatam | ||||
apping.is (v); } | ||||
std::string get_alphadatamapping (void) const { return alphadatamapping.c | ||||
urrent_value (); } | ||||
double get_ambientstrength (void) const { return ambientstrength.double_v | ||||
alue (); } | ||||
bool backfacelighting_is (const std::string& v) const { return backfaceli | ||||
ghting.is (v); } | ||||
std::string get_backfacelighting (void) const { return backfacelighting.c | ||||
urrent_value (); } | ||||
double get_diffusestrength (void) const { return diffusestrength.double_v | ||||
alue (); } | ||||
bool edgealpha_is_double (void) const { return edgealpha.is_double (); } | ||||
bool edgealpha_is (const std::string& v) const { return edgealpha.is (v); | ||||
} | ||||
double get_edgealpha_double (void) const { return (edgealpha.is_double () | ||||
? edgealpha.double_value () : 0); } | ||||
octave_value get_edgealpha (void) const { return edgealpha.get (); } | ||||
bool edgelighting_is (const std::string& v) const { return edgelighting.i | ||||
s (v); } | ||||
std::string get_edgelighting (void) const { return edgelighting.current_v | ||||
alue (); } | ||||
bool erasemode_is (const std::string& v) const { return erasemode.is (v); | ||||
} | ||||
std::string get_erasemode (void) const { return erasemode.current_value ( | ||||
); } | ||||
bool facelighting_is (const std::string& v) const { return facelighting.i | ||||
s (v); } | ||||
std::string get_facelighting (void) const { return facelighting.current_v | ||||
alue (); } | ||||
bool meshstyle_is (const std::string& v) const { return meshstyle.is (v); } | bool meshstyle_is (const std::string& v) const { return meshstyle.is (v); } | |||
std::string get_meshstyle (void) const { return meshstyle.current_value ( ); } | std::string get_meshstyle (void) const { return meshstyle.current_value ( ); } | |||
bool normalmode_is (const std::string& v) const { return normalmode.is (v ); } | bool normalmode_is (const std::string& v) const { return normalmode.is (v ); } | |||
std::string get_normalmode (void) const { return normalmode.current_value (); } | std::string get_normalmode (void) const { return normalmode.current_value (); } | |||
double get_specularcolorreflectance (void) const { return specularcolorre flectance.double_value (); } | double get_specularcolorreflectance (void) const { return specularcolorre flectance.double_value (); } | |||
double get_specularexponent (void) const { return specularexponent.double _value (); } | double get_specularexponent (void) const { return specularexponent.double _value (); } | |||
double get_specularstrength (void) const { return specularstrength.double _value (); } | double get_specularstrength (void) const { return specularstrength.double _value (); } | |||
octave_value get_vertexnormals (void) const { return vertexnormals.get () ; } | octave_value get_vertexnormals (void) const { return vertexnormals.get () ; } | |||
octave_value get_xlim (void) const { return xlim.get (); } | octave_value get_xdata (void) const { return xdata.get (); } | |||
octave_value get_ylim (void) const { return ylim.get (); } | std::string get_xdatasource (void) const { return xdatasource.string_valu e (); } | |||
octave_value get_zlim (void) const { return zlim.get (); } | octave_value get_ydata (void) const { return ydata.get (); } | |||
octave_value get_clim (void) const { return clim.get (); } | std::string get_ydatasource (void) const { return ydatasource.string_valu | |||
e (); } | ||||
octave_value get_zdata (void) const { return zdata.get (); } | ||||
std::string get_zdatasource (void) const { return zdatasource.string_valu | ||||
e (); } | ||||
octave_value get_alim (void) const { return alim.get (); } | octave_value get_alim (void) const { return alim.get (); } | |||
octave_value get_clim (void) const { return clim.get (); } | ||||
octave_value get_xlim (void) const { return xlim.get (); } | ||||
octave_value get_ylim (void) const { return ylim.get (); } | ||||
octave_value get_zlim (void) const { return zlim.get (); } | ||||
bool is_xliminclude (void) const { return xliminclude.is_on (); } | bool is_xliminclude (void) const { return xliminclude.is_on (); } | |||
std::string get_xliminclude (void) const { return xliminclude.current_val ue (); } | std::string get_xliminclude (void) const { return xliminclude.current_val ue (); } | |||
bool is_yliminclude (void) const { return yliminclude.is_on (); } | bool is_yliminclude (void) const { return yliminclude.is_on (); } | |||
std::string get_yliminclude (void) const { return yliminclude.current_val ue (); } | std::string get_yliminclude (void) const { return yliminclude.current_val ue (); } | |||
bool is_zliminclude (void) const { return zliminclude.is_on (); } | bool is_zliminclude (void) const { return zliminclude.is_on (); } | |||
std::string get_zliminclude (void) const { return zliminclude.current_val ue (); } | std::string get_zliminclude (void) const { return zliminclude.current_val ue (); } | |||
void set_xdata (const octave_value& val) | void set_alphadata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xdata.set (val, true)) | if (alphadata.set (val, true)) | |||
{ | { | |||
update_xdata (); | update_alphadata (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ydata (const octave_value& val) | void set_alphadatamapping (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ydata.set (val, true)) | if (alphadatamapping.set (val, false)) | |||
{ | { | |||
update_ydata (); | update_axis_limits ("alphadatamapping"); | |||
alphadatamapping.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zdata (const octave_value& val) | void set_ambientstrength (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zdata.set (val, true)) | if (ambientstrength.set (val, true)) | |||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_backfacelighting (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (backfacelighting.set (val, true)) | ||||
{ | { | |||
update_zdata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_cdata (const octave_value& val) | void set_cdata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (cdata.set (val, true)) | if (cdata.set (val, true)) | |||
skipping to change at line 9575 | skipping to change at line 9799 | |||
{ | { | |||
if (cdatamapping.set (val, false)) | if (cdatamapping.set (val, false)) | |||
{ | { | |||
update_axis_limits ("cdatamapping"); | update_axis_limits ("cdatamapping"); | |||
cdatamapping.run_listeners (POSTSET); | cdatamapping.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xdatasource (const octave_value& val) | void set_cdatasource (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xdatasource.set (val, true)) | if (cdatasource.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ydatasource (const octave_value& val) | void set_diffusestrength (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ydatasource.set (val, true)) | if (diffusestrength.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zdatasource (const octave_value& val) | void set_displayname (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zdatasource.set (val, true)) | if (displayname.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_cdatasource (const octave_value& val) | void set_edgealpha (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (cdatasource.set (val, true)) | if (edgealpha.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_facecolor (const octave_value& val) | void set_edgecolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (facecolor.set (val, true)) | if (edgecolor.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_facealpha (const octave_value& val) | void set_edgelighting (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (facealpha.set (val, true)) | if (edgelighting.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_edgecolor (const octave_value& val) | void set_erasemode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (edgecolor.set (val, true)) | if (erasemode.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_linestyle (const octave_value& val) | void set_facealpha (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (linestyle.set (val, true)) | if (facealpha.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_linewidth (const octave_value& val) | void set_facecolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (linewidth.set (val, true)) | if (facecolor.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_marker (const octave_value& val) | void set_facelighting (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (marker.set (val, true)) | if (facelighting.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_markeredgecolor (const octave_value& val) | void set_interpreter (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (markeredgecolor.set (val, true)) | if (interpreter.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_markerfacecolor (const octave_value& val) | void set_linestyle (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (markerfacecolor.set (val, true)) | if (linestyle.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_markersize (const octave_value& val) | void set_linewidth (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (markersize.set (val, true)) | if (linewidth.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_interpreter (const octave_value& val) | void set_marker (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (interpreter.set (val, true)) | if (marker.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_displayname (const octave_value& val) | void set_markeredgecolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (displayname.set (val, true)) | if (markeredgecolor.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_alphadata (const octave_value& val) | void set_markerfacecolor (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (alphadata.set (val, true)) | if (markerfacecolor.set (val, true)) | |||
{ | { | |||
update_alphadata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_alphadatamapping (const octave_value& val) | void set_markersize (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (alphadatamapping.set (val, false)) | if (markersize.set (val, true)) | |||
{ | { | |||
update_axis_limits ("alphadatamapping"); | ||||
alphadatamapping.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ambientstrength (const octave_value& val) | void set_meshstyle (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ambientstrength.set (val, true)) | if (meshstyle.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_backfacelighting (const octave_value& val) | void set_normalmode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (backfacelighting.set (val, true)) | if (normalmode.set (val, true)) | |||
{ | { | |||
update_normalmode (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_diffusestrength (const octave_value& val) | void set_specularcolorreflectance (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (diffusestrength.set (val, true)) | if (specularcolorreflectance.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_edgealpha (const octave_value& val) | void set_specularexponent (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (edgealpha.set (val, true)) | if (specularexponent.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_edgelighting (const octave_value& val) | void set_specularstrength (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (edgelighting.set (val, true)) | if (specularstrength.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_erasemode (const octave_value& val) | void set_vertexnormals (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (erasemode.set (val, true)) | if (vertexnormals.set (val, true)) | |||
{ | { | |||
update_vertexnormals (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_facelighting (const octave_value& val) | void set_xdata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (facelighting.set (val, true)) | if (xdata.set (val, true)) | |||
{ | { | |||
update_xdata (); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_meshstyle (const octave_value& val) | void set_xdatasource (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (meshstyle.set (val, true)) | if (xdatasource.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_normalmode (const octave_value& val) | void set_ydata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (normalmode.set (val, true)) | if (ydata.set (val, true)) | |||
{ | { | |||
update_normalmode (); | update_ydata (); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_specularcolorreflectance (const octave_value& val) | void set_ydatasource (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (specularcolorreflectance.set (val, true)) | if (ydatasource.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_specularexponent (const octave_value& val) | void set_zdata (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (specularexponent.set (val, true)) | if (zdata.set (val, true)) | |||
{ | ||||
update_zdata (); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_zdatasource (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (zdatasource.set (val, true)) | ||||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_specularstrength (const octave_value& val) | void set_alim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (specularstrength.set (val, true)) | if (alim.set (val, false)) | |||
{ | { | |||
update_axis_limits ("alim"); | ||||
alim.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_vertexnormals (const octave_value& val) | void set_clim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (vertexnormals.set (val, true)) | if (clim.set (val, false)) | |||
{ | { | |||
update_vertexnormals (); | update_axis_limits ("clim"); | |||
clim.run_listeners (POSTSET); | ||||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xlim (const octave_value& val) | void set_xlim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xlim.set (val, false)) | if (xlim.set (val, false)) | |||
skipping to change at line 9949 | skipping to change at line 10188 | |||
{ | { | |||
if (zlim.set (val, false)) | if (zlim.set (val, false)) | |||
{ | { | |||
update_axis_limits ("zlim"); | update_axis_limits ("zlim"); | |||
zlim.run_listeners (POSTSET); | zlim.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_clim (const octave_value& val) | void set_aliminclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (clim.set (val, false)) | if (aliminclude.set (val, false)) | |||
{ | { | |||
update_axis_limits ("clim"); | update_axis_limits ("aliminclude"); | |||
clim.run_listeners (POSTSET); | aliminclude.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_alim (const octave_value& val) | void set_climinclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (alim.set (val, false)) | if (climinclude.set (val, false)) | |||
{ | { | |||
update_axis_limits ("alim"); | update_axis_limits ("climinclude"); | |||
alim.run_listeners (POSTSET); | climinclude.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xliminclude (const octave_value& val) | void set_xliminclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xliminclude.set (val, false)) | if (xliminclude.set (val, false)) | |||
skipping to change at line 10014 | skipping to change at line 10253 | |||
{ | { | |||
if (zliminclude.set (val, false)) | if (zliminclude.set (val, false)) | |||
{ | { | |||
update_axis_limits ("zliminclude"); | update_axis_limits ("zliminclude"); | |||
zliminclude.run_listeners (POSTSET); | zliminclude.run_listeners (POSTSET); | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_climinclude (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (climinclude.set (val, false)) | ||||
{ | ||||
update_axis_limits ("climinclude"); | ||||
climinclude.run_listeners (POSTSET); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_aliminclude (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (aliminclude.set (val, false)) | ||||
{ | ||||
update_axis_limits ("aliminclude"); | ||||
aliminclude.run_listeners (POSTSET); | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
protected: | protected: | |||
void init (void) | void init (void) | |||
{ | { | |||
xdata.add_constraint (dim_vector (-1, -1)); | xdata.add_constraint (dim_vector (-1, -1)); | |||
ydata.add_constraint (dim_vector (-1, -1)); | ydata.add_constraint (dim_vector (-1, -1)); | |||
zdata.add_constraint (dim_vector (-1, -1)); | zdata.add_constraint (dim_vector (-1, -1)); | |||
alphadata.add_constraint ("single"); | cdata.add_constraint ("double"); | |||
alphadata.add_constraint ("double"); | cdata.add_constraint ("single"); | |||
alphadata.add_constraint ("uint8"); | cdata.add_constraint (dim_vector (-1, -1)); | |||
alphadata.add_constraint (dim_vector (-1, -1)); | cdata.add_constraint (dim_vector (-1, -1, 3)); | |||
vertexnormals.add_constraint (dim_vector (-1, -1, 3)); | alphadata.add_constraint ("double"); | |||
cdata.add_constraint ("single"); | alphadata.add_constraint ("uint8"); | |||
cdata.add_constraint ("double"); | alphadata.add_constraint (dim_vector (-1, -1)); | |||
cdata.add_constraint ("uint8"); | vertexnormals.add_constraint (dim_vector (-1, -1, 3)); | |||
cdata.add_constraint (dim_vector (-1, -1)); | } | |||
cdata.add_constraint (dim_vector (-1, -1, 3)); | ||||
} | ||||
private: | private: | |||
void update_normals (void); | void update_alphadata (void) | |||
{ | ||||
if (alphadatamapping_is ("scaled")) | ||||
set_alim (alphadata.get_limits ()); | ||||
else | ||||
alim = alphadata.get_limits (); | ||||
} | ||||
void update_cdata (void) | ||||
{ | ||||
if (cdatamapping_is ("scaled")) | ||||
set_clim (cdata.get_limits ()); | ||||
else | ||||
clim = cdata.get_limits (); | ||||
} | ||||
void update_xdata (void) | void update_xdata (void) | |||
{ | { | |||
update_normals (); | update_normals (); | |||
set_xlim (xdata.get_limits ()); | set_xlim (xdata.get_limits ()); | |||
} | } | |||
void update_ydata (void) | void update_ydata (void) | |||
{ | { | |||
update_normals (); | update_normals (); | |||
set_ylim (ydata.get_limits ()); | set_ylim (ydata.get_limits ()); | |||
} | } | |||
void update_zdata (void) | void update_zdata (void) | |||
{ | { | |||
update_normals (); | update_normals (); | |||
set_zlim (zdata.get_limits ()); | set_zlim (zdata.get_limits ()); | |||
} | } | |||
void update_cdata (void) | ||||
{ | ||||
if (cdatamapping_is ("scaled")) | ||||
set_clim (cdata.get_limits ()); | ||||
else | ||||
clim = cdata.get_limits (); | ||||
} | ||||
void update_alphadata (void) | void update_normals (void); | |||
{ | ||||
if (alphadatamapping_is ("scaled")) | ||||
set_alim (alphadata.get_limits ()); | ||||
else | ||||
alim = alphadata.get_limits (); | ||||
} | ||||
void update_normalmode (void) | void update_normalmode (void) | |||
{ update_normals (); } | { update_normals (); } | |||
void update_vertexnormals (void) | void update_vertexnormals (void) | |||
{ set_normalmode ("manual"); } | { set_normalmode ("manual"); } | |||
}; | }; | |||
private: | private: | |||
properties xproperties; | properties xproperties; | |||
public: | public: | |||
surface (const graphics_handle& mh, const graphics_handle& p) | surface (const graphics_handle& mh, const graphics_handle& p) | |||
: base_graphics_object (), xproperties (mh, p) | : base_graphics_object (), xproperties (mh, p) | |||
{ | { | |||
xproperties.override_defaults (*this); | xproperties.override_defaults (*this); | |||
skipping to change at line 10130 | skipping to change at line 10341 | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API hggroup : public base_graphics_object | class OCTINTERP_API hggroup : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
void remove_child (const graphics_handle& h) | void remove_child (const graphics_handle& h) | |||
{ | { | |||
base_properties::remove_child (h); | base_properties::remove_child (h); | |||
update_limits (); | update_limits (); | |||
} | } | |||
void adopt (const graphics_handle& h) | void adopt (const graphics_handle& h) | |||
{ | { | |||
base_properties::adopt (h); | base_properties::adopt (h); | |||
update_limits (h); | update_limits (h); | |||
} | } | |||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 10187 | skipping to change at line 10399 | |||
static std::set<std::string> core_property_names (void); | static std::set<std::string> core_property_names (void); | |||
static bool has_core_property (const caseless_str& pname); | static bool has_core_property (const caseless_str& pname); | |||
std::set<std::string> all_property_names (void) const; | std::set<std::string> all_property_names (void) const; | |||
bool has_property (const caseless_str& pname) const; | bool has_property (const caseless_str& pname) const; | |||
private: | private: | |||
string_property displayname; | ||||
radio_property erasemode; | ||||
row_vector_property alim; | ||||
row_vector_property clim; | ||||
row_vector_property xlim; | row_vector_property xlim; | |||
row_vector_property ylim; | row_vector_property ylim; | |||
row_vector_property zlim; | row_vector_property zlim; | |||
row_vector_property clim; | bool_property aliminclude; | |||
row_vector_property alim; | bool_property climinclude; | |||
bool_property xliminclude; | bool_property xliminclude; | |||
bool_property yliminclude; | bool_property yliminclude; | |||
bool_property zliminclude; | bool_property zliminclude; | |||
bool_property climinclude; | ||||
bool_property aliminclude; | ||||
public: | public: | |||
enum | enum | |||
{ | { | |||
ID_XLIM = 9000, | ID_DISPLAYNAME = 9000, | |||
ID_YLIM = 9001, | ID_ERASEMODE = 9001, | |||
ID_ZLIM = 9002, | ID_ALIM = 9002, | |||
ID_CLIM = 9003, | ID_CLIM = 9003, | |||
ID_ALIM = 9004, | ID_XLIM = 9004, | |||
ID_XLIMINCLUDE = 9005, | ID_YLIM = 9005, | |||
ID_YLIMINCLUDE = 9006, | ID_ZLIM = 9006, | |||
ID_ZLIMINCLUDE = 9007, | ID_ALIMINCLUDE = 9007, | |||
ID_CLIMINCLUDE = 9008, | ID_CLIMINCLUDE = 9008, | |||
ID_ALIMINCLUDE = 9009 | ID_XLIMINCLUDE = 9009, | |||
ID_YLIMINCLUDE = 9010, | ||||
ID_ZLIMINCLUDE = 9011 | ||||
}; | }; | |||
std::string get_displayname (void) const { return displayname.string_valu | ||||
e (); } | ||||
bool erasemode_is (const std::string& v) const { return erasemode.is (v); | ||||
} | ||||
std::string get_erasemode (void) const { return erasemode.current_value ( | ||||
); } | ||||
octave_value get_alim (void) const { return alim.get (); } | ||||
octave_value get_clim (void) const { return clim.get (); } | ||||
octave_value get_xlim (void) const { return xlim.get (); } | octave_value get_xlim (void) const { return xlim.get (); } | |||
octave_value get_ylim (void) const { return ylim.get (); } | octave_value get_ylim (void) const { return ylim.get (); } | |||
octave_value get_zlim (void) const { return zlim.get (); } | octave_value get_zlim (void) const { return zlim.get (); } | |||
octave_value get_clim (void) const { return clim.get (); } | bool is_aliminclude (void) const { return aliminclude.is_on (); } | |||
std::string get_aliminclude (void) const { return aliminclude.current_val | ||||
ue (); } | ||||
octave_value get_alim (void) const { return alim.get (); } | bool is_climinclude (void) const { return climinclude.is_on (); } | |||
std::string get_climinclude (void) const { return climinclude.current_val | ||||
ue (); } | ||||
bool is_xliminclude (void) const { return xliminclude.is_on (); } | bool is_xliminclude (void) const { return xliminclude.is_on (); } | |||
std::string get_xliminclude (void) const { return xliminclude.current_val ue (); } | std::string get_xliminclude (void) const { return xliminclude.current_val ue (); } | |||
bool is_yliminclude (void) const { return yliminclude.is_on (); } | bool is_yliminclude (void) const { return yliminclude.is_on (); } | |||
std::string get_yliminclude (void) const { return yliminclude.current_val ue (); } | std::string get_yliminclude (void) const { return yliminclude.current_val ue (); } | |||
bool is_zliminclude (void) const { return zliminclude.is_on (); } | bool is_zliminclude (void) const { return zliminclude.is_on (); } | |||
std::string get_zliminclude (void) const { return zliminclude.current_val ue (); } | std::string get_zliminclude (void) const { return zliminclude.current_val ue (); } | |||
bool is_climinclude (void) const { return climinclude.is_on (); } | void set_displayname (const octave_value& val) | |||
std::string get_climinclude (void) const { return climinclude.current_val | ||||
ue (); } | ||||
bool is_aliminclude (void) const { return aliminclude.is_on (); } | ||||
std::string get_aliminclude (void) const { return aliminclude.current_val | ||||
ue (); } | ||||
void set_xlim (const octave_value& val) | ||||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xlim.set (val, true)) | if (displayname.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_ylim (const octave_value& val) | void set_erasemode (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (ylim.set (val, true)) | if (erasemode.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zlim (const octave_value& val) | void set_alim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zlim.set (val, true)) | if (alim.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_clim (const octave_value& val) | void set_clim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (clim.set (val, true)) | if (clim.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_alim (const octave_value& val) | void set_xlim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (alim.set (val, true)) | if (xlim.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_xliminclude (const octave_value& val) | void set_ylim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (xliminclude.set (val, true)) | if (ylim.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_yliminclude (const octave_value& val) | void set_zlim (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (yliminclude.set (val, true)) | if (zlim.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_zliminclude (const octave_value& val) | void set_aliminclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (zliminclude.set (val, true)) | if (aliminclude.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_climinclude (const octave_value& val) | void set_climinclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (climinclude.set (val, true)) | if (climinclude.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
void set_aliminclude (const octave_value& val) | void set_xliminclude (const octave_value& val) | |||
{ | { | |||
if (! error_state) | if (! error_state) | |||
{ | { | |||
if (aliminclude.set (val, true)) | if (xliminclude.set (val, true)) | |||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_yliminclude (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (yliminclude.set (val, true)) | ||||
{ | ||||
mark_modified (); | ||||
} | ||||
} | ||||
} | ||||
void set_zliminclude (const octave_value& val) | ||||
{ | ||||
if (! error_state) | ||||
{ | ||||
if (zliminclude.set (val, true)) | ||||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
private: | private: | |||
void update_limits (void) const; | void update_limits (void) const; | |||
void update_limits (const graphics_handle& h) const; | void update_limits (const graphics_handle& h) const; | |||
protected: | protected: | |||
void init (void) | void init (void) | |||
{ } | { } | |||
}; | }; | |||
private: | private: | |||
properties xproperties; | properties xproperties; | |||
public: | public: | |||
hggroup (const graphics_handle& mh, const graphics_handle& p) | hggroup (const graphics_handle& mh, const graphics_handle& p) | |||
: base_graphics_object (), xproperties (mh, p) | : base_graphics_object (), xproperties (mh, p) | |||
{ | { | |||
skipping to change at line 10394 | skipping to change at line 10637 | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API uimenu : public base_graphics_object | class OCTINTERP_API uimenu : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
void remove_child (const graphics_handle& h) | void remove_child (const graphics_handle& h) | |||
{ | { | |||
base_properties::remove_child (h); | base_properties::remove_child (h); | |||
} | } | |||
void adopt (const graphics_handle& h) | void adopt (const graphics_handle& h) | |||
{ | { | |||
base_properties::adopt (h); | base_properties::adopt (h); | |||
} | } | |||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 10614 | skipping to change at line 10858 | |||
{ | { | |||
if (fltk_label.set (val, true)) | if (fltk_label.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
protected: | protected: | |||
void init (void) | void init (void) | |||
{ } | { } | |||
}; | }; | |||
private: | private: | |||
properties xproperties; | properties xproperties; | |||
public: | public: | |||
uimenu (const graphics_handle& mh, const graphics_handle& p) | uimenu (const graphics_handle& mh, const graphics_handle& p) | |||
: base_graphics_object (), xproperties (mh, p) | : base_graphics_object (), xproperties (mh, p) | |||
{ | { | |||
xproperties.override_defaults (*this); | xproperties.override_defaults (*this); | |||
skipping to change at line 10647 | skipping to change at line 10891 | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API uicontextmenu : public base_graphics_object | class OCTINTERP_API uicontextmenu : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 10745 | skipping to change at line 10990 | |||
{ | { | |||
if (position.set (val, true)) | if (position.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
protected: | protected: | |||
void init (void) | void init (void) | |||
{ | { | |||
position.add_constraint (dim_vector (1, 2)); | position.add_constraint (dim_vector (1, 2)); | |||
position.add_constraint (dim_vector (2, 1)); | position.add_constraint (dim_vector (2, 1)); | |||
visible.set (octave_value (true)); | visible.set (octave_value (true)); | |||
} | } | |||
}; | }; | |||
private: | private: | |||
properties xproperties; | properties xproperties; | |||
public: | public: | |||
uicontextmenu (const graphics_handle& mh, const graphics_handle& p) | uicontextmenu (const graphics_handle& mh, const graphics_handle& p) | |||
: base_graphics_object (), xproperties (mh, p) | : base_graphics_object (), xproperties (mh, p) | |||
{ | { | |||
xproperties.override_defaults (*this); | xproperties.override_defaults (*this); | |||
skipping to change at line 10787 | skipping to change at line 11032 | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
Matrix get_boundingbox (bool internal = false, | Matrix get_boundingbox (bool internal = false, | |||
const Matrix& parent_pix_size = Matrix ()) cons t; | const Matrix& parent_pix_size = Matrix ()) cons t; | |||
double get_fontsize_points (double box_pix_height = 0) const; | double get_fontsize_points (double box_pix_height = 0) const; | |||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 11239 | skipping to change at line 11485 | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
private: | private: | |||
std::string cached_units; | std::string cached_units; | |||
protected: | protected: | |||
void init (void) | void init (void) | |||
{ | { | |||
cdata.add_constraint ("double"); | cdata.add_constraint ("double"); | |||
cdata.add_constraint ("single"); | cdata.add_constraint ("single"); | |||
cdata.add_constraint ("uint8"); | cdata.add_constraint (dim_vector (-1, -1, 3)); | |||
cdata.add_constraint (dim_vector (-1, -1, 3)); | position.add_constraint (dim_vector (1, 4)); | |||
position.add_constraint (dim_vector (1, 4)); | sliderstep.add_constraint (dim_vector (1, 2)); | |||
sliderstep.add_constraint (dim_vector (1, 2)); | cached_units = get_units (); | |||
cached_units = get_units (); | } | |||
} | ||||
void update_text_extent (void); | void update_text_extent (void); | |||
void update_string (void) { update_text_extent (); } | void update_string (void) { update_text_extent (); } | |||
void update_fontname (void) { update_text_extent (); } | void update_fontname (void) { update_text_extent (); } | |||
void update_fontsize (void) { update_text_extent (); } | void update_fontsize (void) { update_text_extent (); } | |||
void update_fontangle (void) { update_text_extent (); } | void update_fontangle (void) { update_text_extent (); } | |||
void update_fontweight (void) { update_text_extent (); } | void update_fontweight (void) { update_text_extent (); } | |||
void update_fontunits (const caseless_str& old_units); | void update_fontunits (const caseless_str& old_units); | |||
skipping to change at line 11296 | skipping to change at line 11541 | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
Matrix get_boundingbox (bool internal = false, | Matrix get_boundingbox (bool internal = false, | |||
const Matrix& parent_pix_size = Matrix ()) cons t; | const Matrix& parent_pix_size = Matrix ()) cons t; | |||
double get_fontsize_points (double box_pix_height = 0) const; | double get_fontsize_points (double box_pix_height = 0) const; | |||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 11642 | skipping to change at line 11888 | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API uitoolbar : public base_graphics_object | class OCTINTERP_API uitoolbar : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 11709 | skipping to change at line 11956 | |||
{ | { | |||
if (__object__.set (val, true)) | if (__object__.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
protected: | protected: | |||
void init (void) | void init (void) | |||
{ } | { } | |||
}; | }; | |||
private: | private: | |||
properties xproperties; | properties xproperties; | |||
public: | public: | |||
uitoolbar (const graphics_handle& mh, const graphics_handle& p) | uitoolbar (const graphics_handle& mh, const graphics_handle& p) | |||
: base_graphics_object (), xproperties (mh, p), default_properties () | : base_graphics_object (), xproperties (mh, p), default_properties () | |||
{ | { | |||
xproperties.override_defaults (*this); | xproperties.override_defaults (*this); | |||
skipping to change at line 11790 | skipping to change at line 12037 | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API uipushtool : public base_graphics_object | class OCTINTERP_API uipushtool : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 11935 | skipping to change at line 12183 | |||
{ | { | |||
if (tooltipstring.set (val, true)) | if (tooltipstring.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
protected: | protected: | |||
void init (void) | void init (void) | |||
{ | { | |||
cdata.add_constraint ("double"); | cdata.add_constraint ("double"); | |||
cdata.add_constraint ("single"); | cdata.add_constraint ("single"); | |||
cdata.add_constraint ("uint8"); | cdata.add_constraint (dim_vector (-1, -1, 3)); | |||
cdata.add_constraint (dim_vector (-1, -1, 3)); | } | |||
} | ||||
}; | }; | |||
private: | private: | |||
properties xproperties; | properties xproperties; | |||
public: | public: | |||
uipushtool (const graphics_handle& mh, const graphics_handle& p) | uipushtool (const graphics_handle& mh, const graphics_handle& p) | |||
: base_graphics_object (), xproperties (mh, p) | : base_graphics_object (), xproperties (mh, p) | |||
{ | { | |||
xproperties.override_defaults (*this); | xproperties.override_defaults (*this); | |||
skipping to change at line 11973 | skipping to change at line 12220 | |||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | |||
class OCTINTERP_API uitoggletool : public base_graphics_object | class OCTINTERP_API uitoggletool : public base_graphics_object | |||
{ | { | |||
public: | public: | |||
class OCTINTERP_API properties : public base_properties | class OCTINTERP_API properties : public base_properties | |||
{ | { | |||
public: | public: | |||
// See the genprops.awk script for an explanation of the | // See the genprops.awk script for an explanation of the | |||
// properties declarations. | // properties declarations. | |||
// Programming note: Keep property list sorted if new ones are added. | ||||
public: | public: | |||
properties (const graphics_handle& mh, const graphics_handle& p); | properties (const graphics_handle& mh, const graphics_handle& p); | |||
~properties (void) { } | ~properties (void) { } | |||
void set (const caseless_str& pname, const octave_value& val); | void set (const caseless_str& pname, const octave_value& val); | |||
octave_value get (bool all = false) const; | octave_value get (bool all = false) const; | |||
skipping to change at line 12166 | skipping to change at line 12414 | |||
{ | { | |||
if (tooltipstring.set (val, true)) | if (tooltipstring.set (val, true)) | |||
{ | { | |||
mark_modified (); | mark_modified (); | |||
} | } | |||
} | } | |||
} | } | |||
protected: | protected: | |||
void init (void) | void init (void) | |||
{ | { | |||
cdata.add_constraint ("double"); | cdata.add_constraint ("double"); | |||
cdata.add_constraint ("single"); | cdata.add_constraint ("single"); | |||
cdata.add_constraint ("uint8"); | cdata.add_constraint (dim_vector (-1, -1, 3)); | |||
cdata.add_constraint (dim_vector (-1, -1, 3)); | } | |||
} | ||||
}; | }; | |||
private: | private: | |||
properties xproperties; | properties xproperties; | |||
public: | public: | |||
uitoggletool (const graphics_handle& mh, const graphics_handle& p) | uitoggletool (const graphics_handle& mh, const graphics_handle& p) | |||
: base_graphics_object (), xproperties (mh, p) | : base_graphics_object (), xproperties (mh, p) | |||
{ | { | |||
xproperties.override_defaults (*this); | xproperties.override_defaults (*this); | |||
skipping to change at line 12232 | skipping to change at line 12479 | |||
class | class | |||
graphics_event | graphics_event | |||
{ | { | |||
public: | public: | |||
typedef void (*event_fcn) (void*); | typedef void (*event_fcn) (void*); | |||
graphics_event (void) : rep (0) { } | graphics_event (void) : rep (0) { } | |||
graphics_event (const graphics_event& e) : rep (e.rep) | graphics_event (const graphics_event& e) : rep (e.rep) | |||
{ | { | |||
rep->count++; | rep->count++; | |||
} | } | |||
~graphics_event (void) | ~graphics_event (void) | |||
{ | { | |||
if (rep && --rep->count == 0) | if (rep && --rep->count == 0) | |||
delete rep; | delete rep; | |||
} | } | |||
graphics_event& operator = (const graphics_event& e) | graphics_event& operator = (const graphics_event& e) | |||
{ | { | |||
if (rep != e.rep) | if (rep != e.rep) | |||
{ | { | |||
if (rep && --rep->count == 0) | if (rep && --rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = e.rep; | rep = e.rep; | |||
if (rep) | if (rep) | |||
rep->count++; | rep->count++; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
void execute (void) | void execute (void) | |||
{ if (rep) rep->execute (); } | { if (rep) rep->execute (); } | |||
bool ok (void) const | bool ok (void) const | |||
{ return (rep != 0); } | { return (rep != 0); } | |||
static graphics_event | static graphics_event | |||
create_callback_event (const graphics_handle& h, | create_callback_event (const graphics_handle& h, | |||
const std::string& name, | const std::string& name, | |||
const octave_value& data = Matrix ()); | const octave_value& data = Matrix ()); | |||
static graphics_event | static graphics_event | |||
create_callback_event (const graphics_handle& h, | create_callback_event (const graphics_handle& h, | |||
const octave_value& cb, | const octave_value& cb, | |||
const octave_value& data = Matrix ()); | const octave_value& data = Matrix ()); | |||
static graphics_event | static graphics_event | |||
create_function_event (event_fcn fcn, void *data = 0); | create_function_event (event_fcn fcn, void *data = 0); | |||
static graphics_event | static graphics_event | |||
create_set_event (const graphics_handle& h, const std::string& name, | create_set_event (const graphics_handle& h, const std::string& name, | |||
const octave_value& value, | const octave_value& value, | |||
bool notify_toolkit = true); | bool notify_toolkit = true); | |||
private: | private: | |||
base_graphics_event *rep; | base_graphics_event *rep; | |||
}; | }; | |||
class OCTINTERP_API gh_manager | class OCTINTERP_API gh_manager | |||
{ | { | |||
protected: | protected: | |||
gh_manager (void); | gh_manager (void); | |||
skipping to change at line 12316 | skipping to change at line 12563 | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
static void cleanup_instance (void) { delete instance; instance = 0; } | static void cleanup_instance (void) { delete instance; instance = 0; } | |||
static graphics_handle get_handle (bool integer_figure_handle) | static graphics_handle get_handle (bool integer_figure_handle) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_get_handle (integer_figure_handle) : graphics_handle ( | ? instance->do_get_handle (integer_figure_handle) | |||
); | : graphics_handle (); | |||
} | } | |||
static void free (const graphics_handle& h) | static void free (const graphics_handle& h) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_free (h); | instance->do_free (h); | |||
} | } | |||
static void renumber_figure (const graphics_handle& old_gh, | static void renumber_figure (const graphics_handle& old_gh, | |||
const graphics_handle& new_gh) | const graphics_handle& new_gh) | |||
skipping to change at line 12340 | skipping to change at line 12588 | |||
} | } | |||
static graphics_handle lookup (double val) | static graphics_handle lookup (double val) | |||
{ | { | |||
return instance_ok () ? instance->do_lookup (val) : graphics_handle (); | return instance_ok () ? instance->do_lookup (val) : graphics_handle (); | |||
} | } | |||
static graphics_handle lookup (const octave_value& val) | static graphics_handle lookup (const octave_value& val) | |||
{ | { | |||
return val.is_real_scalar () | return val.is_real_scalar () | |||
? lookup (val.double_value ()) : graphics_handle (); | ? lookup (val.double_value ()) : graphics_handle (); | |||
} | } | |||
static graphics_object get_object (double val) | static graphics_object get_object (double val) | |||
{ | { | |||
return get_object (lookup (val)); | return get_object (lookup (val)); | |||
} | } | |||
static graphics_object get_object (const graphics_handle& h) | static graphics_object get_object (const graphics_handle& h) | |||
{ | { | |||
return instance_ok () ? instance->do_get_object (h) : graphics_object ( ); | return instance_ok () ? instance->do_get_object (h) : graphics_object ( ); | |||
} | } | |||
static graphics_handle | static graphics_handle | |||
make_graphics_handle (const std::string& go_name, | make_graphics_handle (const std::string& go_name, | |||
const graphics_handle& parent, | const graphics_handle& parent, | |||
bool integer_figure_handle = false, | bool integer_figure_handle = false, | |||
bool do_createfcn = true, | bool do_createfcn = true, | |||
bool do_notify_toolkit = true) | bool do_notify_toolkit = true) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_make_graphics_handle (go_name, parent, | ? instance->do_make_graphics_handle (go_name, parent, | |||
integer_figure_handle, | integer_figure_handle, | |||
do_createfcn, do_notify_toolkit) | do_createfcn, do_notify_toolkit) | |||
: graphics_handle (); | : graphics_handle (); | |||
} | } | |||
static graphics_handle make_figure_handle (double val, | static graphics_handle make_figure_handle (double val, | |||
bool do_notify_toolkit = true) | bool do_notify_toolkit = true) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_make_figure_handle (val, do_notify_toolkit) | ? instance->do_make_figure_handle (val, do_notify_toolkit) | |||
: graphics_handle (); | : graphics_handle (); | |||
} | } | |||
static void push_figure (const graphics_handle& h) | static void push_figure (const graphics_handle& h) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_push_figure (h); | instance->do_push_figure (h); | |||
} | } | |||
static void pop_figure (const graphics_handle& h) | static void pop_figure (const graphics_handle& h) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_pop_figure (h); | instance->do_pop_figure (h); | |||
} | } | |||
static graphics_handle current_figure (void) | static graphics_handle current_figure (void) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_current_figure () : graphics_handle (); | ? instance->do_current_figure () : graphics_handle (); | |||
} | } | |||
static Matrix handle_list (bool show_hidden = false) | static Matrix handle_list (bool show_hidden = false) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_handle_list (show_hidden) : Matrix (); | ? instance->do_handle_list (show_hidden) : Matrix (); | |||
} | } | |||
static void lock (void) | static void lock (void) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_lock (); | instance->do_lock (); | |||
} | } | |||
static bool try_lock (void) | static bool try_lock (void) | |||
{ | { | |||
skipping to change at line 12422 | skipping to change at line 12670 | |||
static void unlock (void) | static void unlock (void) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_unlock (); | instance->do_unlock (); | |||
} | } | |||
static Matrix figure_handle_list (bool show_hidden = false) | static Matrix figure_handle_list (bool show_hidden = false) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_figure_handle_list (show_hidden) : Matrix (); | ? instance->do_figure_handle_list (show_hidden) : Matrix (); | |||
} | } | |||
static void execute_listener (const graphics_handle& h, | static void execute_listener (const graphics_handle& h, | |||
const octave_value& l) | const octave_value& l) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_execute_listener (h, l); | instance->do_execute_listener (h, l); | |||
} | } | |||
static void execute_callback (const graphics_handle& h, | static void execute_callback (const graphics_handle& h, | |||
skipping to change at line 12492 | skipping to change at line 12740 | |||
{ | { | |||
return (instance_ok () ? instance->do_process_events () : 0); | return (instance_ok () ? instance->do_process_events () : 0); | |||
} | } | |||
static int flush_events (void) | static int flush_events (void) | |||
{ | { | |||
return (instance_ok () ? instance->do_process_events (true) : 0); | return (instance_ok () ? instance->do_process_events (true) : 0); | |||
} | } | |||
static void enable_event_processing (bool enable = true) | static void enable_event_processing (bool enable = true) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_enable_event_processing (enable); | instance->do_enable_event_processing (enable); | |||
} | } | |||
static bool is_handle_visible (const graphics_handle& h) | static bool is_handle_visible (const graphics_handle& h) | |||
{ | { | |||
bool retval = false; | bool retval = false; | |||
graphics_object go = get_object (h); | graphics_object go = get_object (h); | |||
if (go.valid_object ()) | if (go.valid_object ()) | |||
retval = go.is_handle_visible (); | retval = go.is_handle_visible (); | |||
skipping to change at line 12524 | skipping to change at line 12772 | |||
public: | public: | |||
class auto_lock : public octave_autolock | class auto_lock : public octave_autolock | |||
{ | { | |||
public: | public: | |||
auto_lock (bool wait = true) | auto_lock (bool wait = true) | |||
: octave_autolock (instance_ok () | : octave_autolock (instance_ok () | |||
? instance->graphics_lock | ? instance->graphics_lock | |||
: octave_mutex (), | : octave_mutex (), | |||
wait) | wait) | |||
{ } | { } | |||
private: | private: | |||
// No copying! | // No copying! | |||
auto_lock (const auto_lock&); | auto_lock (const auto_lock&); | |||
auto_lock& operator = (const auto_lock&); | auto_lock& operator = (const auto_lock&); | |||
}; | }; | |||
private: | private: | |||
static gh_manager *instance; | static gh_manager *instance; | |||
typedef std::map<graphics_handle, graphics_object>::iterator iterator; | typedef std::map<graphics_handle, graphics_object>::iterator iterator; | |||
typedef std::map<graphics_handle, graphics_object>::const_iterator const_ | typedef std::map<graphics_handle, graphics_object>::const_iterator | |||
iterator; | const_iterator; | |||
typedef std::set<graphics_handle>::iterator free_list_iterator; | typedef std::set<graphics_handle>::iterator free_list_iterator; | |||
typedef std::set<graphics_handle>::const_iterator const_free_list_iterato r; | typedef std::set<graphics_handle>::const_iterator const_free_list_iterato r; | |||
typedef std::list<graphics_handle>::iterator figure_list_iterator; | typedef std::list<graphics_handle>::iterator figure_list_iterator; | |||
typedef std::list<graphics_handle>::const_iterator const_figure_list_iter ator; | typedef std::list<graphics_handle>::const_iterator const_figure_list_iter ator; | |||
// A map of handles to graphics objects. | // A map of handles to graphics objects. | |||
std::map<graphics_handle, graphics_object> handle_map; | std::map<graphics_handle, graphics_object> handle_map; | |||
End of changes. 1201 change blocks. | ||||
2933 lines changed or deleted | 3173 lines changed or added | |||
gripes.h | gripes.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 48 | skipping to change at line 48 | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
gripe_string_invalid (void); | gripe_string_invalid (void); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
gripe_range_invalid (void); | gripe_range_invalid (void); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
gripe_nonconformant (void); | gripe_nonconformant (void); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
gripe_nonconformant (octave_idx_type r1, octave_idx_type c1, octave_idx_typ | gripe_nonconformant (octave_idx_type r1, octave_idx_type c1, | |||
e r2, octave_idx_type c2); | octave_idx_type r2, octave_idx_type c2); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
gripe_empty_arg (const char *name, bool is_error); | gripe_empty_arg (const char *name, bool is_error); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
gripe_square_matrix_required (const char *name); | gripe_square_matrix_required (const char *name); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
gripe_user_supplied_eval (const char *name); | gripe_user_supplied_eval (const char *name); | |||
skipping to change at line 130 | skipping to change at line 131 | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
gripe_indexed_cs_list (void); | gripe_indexed_cs_list (void); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
gripe_nonbraced_cs_list_assignment (void); | gripe_nonbraced_cs_list_assignment (void); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
gripe_warn_complex_cmp (void); | gripe_warn_complex_cmp (void); | |||
extern OCTINTERP_API void | ||||
gripe_disabled_feature (const std::string& func, const std::string& feature | ||||
, | ||||
const std::string& pkg="Octave"); | ||||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 7 lines changed or added | |||
help.h | help.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 35 | skipping to change at line 35 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
class string_vector; | class string_vector; | |||
extern string_vector make_name_list (void); | extern string_vector make_name_list (void); | |||
extern OCTINTERP_API std::string raw_help (const std::string&, bool&); | extern OCTINTERP_API std::string raw_help (const std::string&, bool&); | |||
extern OCTINTERP_API void install_built_in_docstrings (void); | ||||
// Name of the doc cache file specified on the command line. | // Name of the doc cache file specified on the command line. | |||
// (--doc-cache-file file) | // (--doc-cache-file file) | |||
extern std::string Vdoc_cache_file; | extern OCTINTERP_API std::string Vdoc_cache_file; | |||
// Name of the file containing local Texinfo macros that are prepended | ||||
// to doc strings before processing. | ||||
// (--texi-macros-file) | ||||
extern OCTINTERP_API std::string Vtexi_macros_file; | ||||
// Name of the info file specified on command line. | // Name of the info file specified on command line. | |||
// (--info-file file) | // (--info-file file) | |||
extern std::string Vinfo_file; | extern OCTINTERP_API std::string Vinfo_file; | |||
// Name of the info reader we'd like to use. | // Name of the info reader we'd like to use. | |||
// (--info-program program) | // (--info-program program) | |||
extern std::string Vinfo_program; | extern OCTINTERP_API std::string Vinfo_program; | |||
extern std::string do_which (const std::string& name); | extern OCTINTERP_API std::string do_which (const std::string& name); | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
5 lines changed or deleted | 12 lines changed or added | |||
idx-vector.h | idx-vector.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
skipping to change at line 58 | skipping to change at line 58 | |||
// templates implementing "early dispatch", i.e. hoisting the checks for in dex | // templates implementing "early dispatch", i.e. hoisting the checks for in dex | |||
// type out of loops. | // type out of loops. | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
idx_vector | idx_vector | |||
{ | { | |||
public: | public: | |||
enum idx_class_type | enum idx_class_type | |||
{ | { | |||
class_invalid = -1, | class_invalid = -1, | |||
class_colon = 0, | class_colon = 0, | |||
class_range, | class_range, | |||
class_scalar, | class_scalar, | |||
class_vector, | class_vector, | |||
class_mask | class_mask | |||
}; | }; | |||
template<class T> friend class std::auto_ptr; | template<class T> friend class std::auto_ptr; | |||
private: | private: | |||
class OCTAVE_API idx_base_rep | class OCTAVE_API idx_base_rep | |||
{ | { | |||
public: | public: | |||
idx_base_rep (void) : count (1), err (false) { } | idx_base_rep (void) : count (1), err (false) { } | |||
skipping to change at line 101 | skipping to change at line 101 | |||
virtual idx_class_type idx_class (void) const { return class_invalid; } | virtual idx_class_type idx_class (void) const { return class_invalid; } | |||
// Sorts, maybe uniqifies, and returns a clone object pointer. | // Sorts, maybe uniqifies, and returns a clone object pointer. | |||
virtual idx_base_rep *sort_uniq_clone (bool uniq = false) = 0; | virtual idx_base_rep *sort_uniq_clone (bool uniq = false) = 0; | |||
// Sorts, and returns a sorting permutation (aka Array::sort). | // Sorts, and returns a sorting permutation (aka Array::sort). | |||
virtual idx_base_rep *sort_idx (Array<octave_idx_type>&) = 0; | virtual idx_base_rep *sort_idx (Array<octave_idx_type>&) = 0; | |||
// Checks whether the index is colon or a range equivalent to colon. | // Checks whether the index is colon or a range equivalent to colon. | |||
virtual bool is_colon_equiv (octave_idx_type) const { return false; } | virtual bool is_colon_equiv (octave_idx_type) const { return false; } | |||
// The original dimensions of this object (used when subscribing by mat rices). | // The original dimensions of object (used when subscribing by matrices ). | |||
virtual dim_vector orig_dimensions (void) const { return dim_vector (); } | virtual dim_vector orig_dimensions (void) const { return dim_vector (); } | |||
// i/o | // i/o | |||
virtual std::ostream& print (std::ostream& os) const = 0; | virtual std::ostream& print (std::ostream& os) const = 0; | |||
virtual Array<octave_idx_type> as_array (void); | virtual Array<octave_idx_type> as_array (void); | |||
octave_refcount<int> count; | octave_refcount<int> count; | |||
bool err; | bool err; | |||
skipping to change at line 139 | skipping to change at line 139 | |||
octave_idx_type checkelem (octave_idx_type i) const; | octave_idx_type checkelem (octave_idx_type i) const; | |||
octave_idx_type length (octave_idx_type n) const { return n; } | octave_idx_type length (octave_idx_type n) const { return n; } | |||
octave_idx_type extent (octave_idx_type n) const { return n; } | octave_idx_type extent (octave_idx_type n) const { return n; } | |||
idx_class_type idx_class (void) const { return class_colon; } | idx_class_type idx_class (void) const { return class_colon; } | |||
idx_base_rep *sort_uniq_clone (bool = false) | idx_base_rep *sort_uniq_clone (bool = false) | |||
{ count++; return this; } | { count++; return this; } | |||
idx_base_rep *sort_idx (Array<octave_idx_type>&); | idx_base_rep *sort_idx (Array<octave_idx_type>&); | |||
bool is_colon_equiv (octave_idx_type) const { return true; } | bool is_colon_equiv (octave_idx_type) const { return true; } | |||
std::ostream& print (std::ostream& os) const; | std::ostream& print (std::ostream& os) const; | |||
private: | private: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
skipping to change at line 177 | skipping to change at line 177 | |||
idx_range_rep (void) | idx_range_rep (void) | |||
: start(0), len(0), step(1) { } | : start(0), len(0), step(1) { } | |||
// Zero-based constructor. | // Zero-based constructor. | |||
idx_range_rep (octave_idx_type _start, octave_idx_type _limit, | idx_range_rep (octave_idx_type _start, octave_idx_type _limit, | |||
octave_idx_type _step); | octave_idx_type _step); | |||
idx_range_rep (const Range&); | idx_range_rep (const Range&); | |||
octave_idx_type xelem (octave_idx_type i) const | octave_idx_type xelem (octave_idx_type i) const | |||
{ return start + i * step; } | { return start + i * step; } | |||
octave_idx_type checkelem (octave_idx_type i) const; | octave_idx_type checkelem (octave_idx_type i) const; | |||
octave_idx_type length (octave_idx_type) const { return len; } | octave_idx_type length (octave_idx_type) const { return len; } | |||
octave_idx_type extent (octave_idx_type n) const | octave_idx_type extent (octave_idx_type n) const | |||
{ return len ? std::max (n, (start + 1 + (step < 0 ? 0 : step * (len | { return len ? std::max (n, (start + 1 + (step < 0 ? 0 : step * (len - | |||
- 1)))) : n; } | 1)))) | |||
: n; } | ||||
idx_class_type idx_class (void) const { return class_range; } | idx_class_type idx_class (void) const { return class_range; } | |||
idx_base_rep *sort_uniq_clone (bool uniq = false); | idx_base_rep *sort_uniq_clone (bool uniq = false); | |||
idx_base_rep *sort_idx (Array<octave_idx_type>&); | idx_base_rep *sort_idx (Array<octave_idx_type>&); | |||
bool is_colon_equiv (octave_idx_type n) const | bool is_colon_equiv (octave_idx_type n) const | |||
{ return start == 0 && step == 1 && len == n; } | { return start == 0 && step == 1 && len == n; } | |||
dim_vector orig_dimensions (void) const | dim_vector orig_dimensions (void) const | |||
{ return dim_vector (1, len); } | { return dim_vector (1, len); } | |||
octave_idx_type get_start (void) const { return start; } | octave_idx_type get_start (void) const { return start; } | |||
octave_idx_type get_step (void) const { return step; } | octave_idx_type get_step (void) const { return step; } | |||
std::ostream& print (std::ostream& os) const; | std::ostream& print (std::ostream& os) const; | |||
Range unconvert (void) const; | Range unconvert (void) const; | |||
Array<octave_idx_type> as_array (void); | Array<octave_idx_type> as_array (void); | |||
skipping to change at line 243 | skipping to change at line 244 | |||
template <class T> | template <class T> | |||
idx_scalar_rep (T x); | idx_scalar_rep (T x); | |||
octave_idx_type xelem (octave_idx_type) const { return data; } | octave_idx_type xelem (octave_idx_type) const { return data; } | |||
octave_idx_type checkelem (octave_idx_type i) const; | octave_idx_type checkelem (octave_idx_type i) const; | |||
octave_idx_type length (octave_idx_type) const { return 1; } | octave_idx_type length (octave_idx_type) const { return 1; } | |||
octave_idx_type extent (octave_idx_type n) const | octave_idx_type extent (octave_idx_type n) const | |||
{ return std::max (n, data + 1); } | { return std::max (n, data + 1); } | |||
idx_class_type idx_class (void) const { return class_scalar; } | idx_class_type idx_class (void) const { return class_scalar; } | |||
idx_base_rep *sort_uniq_clone (bool = false) | idx_base_rep *sort_uniq_clone (bool = false) | |||
{ count++; return this; } | { count++; return this; } | |||
idx_base_rep *sort_idx (Array<octave_idx_type>&); | idx_base_rep *sort_idx (Array<octave_idx_type>&); | |||
bool is_colon_equiv (octave_idx_type n) const | bool is_colon_equiv (octave_idx_type n) const | |||
{ return n == 1 && data == 0; } | { return n == 1 && data == 0; } | |||
dim_vector orig_dimensions (void) const { return dim_vector (1, 1); } | dim_vector orig_dimensions (void) const { return dim_vector (1, 1); } | |||
octave_idx_type get_data (void) const { return data; } | octave_idx_type get_data (void) const { return data; } | |||
std::ostream& print (std::ostream& os) const; | std::ostream& print (std::ostream& os) const; | |||
double unconvert (void) const; | double unconvert (void) const; | |||
Array<octave_idx_type> as_array (void); | Array<octave_idx_type> as_array (void); | |||
skipping to change at line 288 | skipping to change at line 289 | |||
class OCTAVE_API idx_vector_rep : public idx_base_rep | class OCTAVE_API idx_vector_rep : public idx_base_rep | |||
{ | { | |||
public: | public: | |||
// Direct constructor. | // Direct constructor. | |||
idx_vector_rep (octave_idx_type *_data, octave_idx_type _len, | idx_vector_rep (octave_idx_type *_data, octave_idx_type _len, | |||
octave_idx_type _ext, const dim_vector& od, direct) | octave_idx_type _ext, const dim_vector& od, direct) | |||
: data (_data), len (_len), ext (_ext), aowner (0), orig_dims (od) { } | : data (_data), len (_len), ext (_ext), aowner (0), orig_dims (od) { } | |||
idx_vector_rep (void) | idx_vector_rep (void) | |||
: data (0), len (0), ext (0), aowner (0), orig_dims () | : data (0), len (0), ext (0), aowner (0), orig_dims () | |||
{ } | { } | |||
// Zero-based constructor. | // Zero-based constructor. | |||
idx_vector_rep (const Array<octave_idx_type>& inda); | idx_vector_rep (const Array<octave_idx_type>& inda); | |||
idx_vector_rep (const Array<octave_idx_type>& inda, | idx_vector_rep (const Array<octave_idx_type>& inda, | |||
octave_idx_type _ext, direct); | octave_idx_type _ext, direct); | |||
template <class T> | template <class T> | |||
idx_vector_rep (const Array<T>&); | idx_vector_rep (const Array<T>&); | |||
skipping to change at line 314 | skipping to change at line 315 | |||
~idx_vector_rep (void); | ~idx_vector_rep (void); | |||
octave_idx_type xelem (octave_idx_type i) const { return data[i]; } | octave_idx_type xelem (octave_idx_type i) const { return data[i]; } | |||
octave_idx_type checkelem (octave_idx_type i) const; | octave_idx_type checkelem (octave_idx_type i) const; | |||
octave_idx_type length (octave_idx_type) const { return len; } | octave_idx_type length (octave_idx_type) const { return len; } | |||
octave_idx_type extent (octave_idx_type n) const | octave_idx_type extent (octave_idx_type n) const | |||
{ return std::max (n, ext); } | { return std::max (n, ext); } | |||
idx_class_type idx_class (void) const { return class_vector; } | idx_class_type idx_class (void) const { return class_vector; } | |||
idx_base_rep *sort_uniq_clone (bool uniq = false); | idx_base_rep *sort_uniq_clone (bool uniq = false); | |||
idx_base_rep *sort_idx (Array<octave_idx_type>&); | idx_base_rep *sort_idx (Array<octave_idx_type>&); | |||
dim_vector orig_dimensions (void) const { return orig_dims; } | dim_vector orig_dimensions (void) const { return orig_dims; } | |||
const octave_idx_type *get_data (void) const { return data; } | const octave_idx_type *get_data (void) const { return data; } | |||
skipping to change at line 369 | skipping to change at line 370 | |||
public: | public: | |||
// Direct constructor. | // Direct constructor. | |||
idx_mask_rep (bool *_data, octave_idx_type _len, | idx_mask_rep (bool *_data, octave_idx_type _len, | |||
octave_idx_type _ext, const dim_vector& od, direct) | octave_idx_type _ext, const dim_vector& od, direct) | |||
: data (_data), len (_len), ext (_ext), lsti (-1), lste (-1), | : data (_data), len (_len), ext (_ext), lsti (-1), lste (-1), | |||
aowner (0), orig_dims (od) { } | aowner (0), orig_dims (od) { } | |||
idx_mask_rep (void) | idx_mask_rep (void) | |||
: data (0), len (0), ext (0), lsti (-1), lste (-1), aowner (0), | : data (0), len (0), ext (0), lsti (-1), lste (-1), aowner (0), | |||
orig_dims () | orig_dims () | |||
{ } | { } | |||
idx_mask_rep (bool); | idx_mask_rep (bool); | |||
idx_mask_rep (const Array<bool>&, octave_idx_type = -1); | idx_mask_rep (const Array<bool>&, octave_idx_type = -1); | |||
~idx_mask_rep (void); | ~idx_mask_rep (void); | |||
octave_idx_type xelem (octave_idx_type i) const; | octave_idx_type xelem (octave_idx_type i) const; | |||
octave_idx_type checkelem (octave_idx_type i) const; | octave_idx_type checkelem (octave_idx_type i) const; | |||
octave_idx_type length (octave_idx_type) const { return len; } | octave_idx_type length (octave_idx_type) const { return len; } | |||
octave_idx_type extent (octave_idx_type n) const | octave_idx_type extent (octave_idx_type n) const | |||
{ return std::max (n, ext); } | { return std::max (n, ext); } | |||
idx_class_type idx_class (void) const { return class_mask; } | idx_class_type idx_class (void) const { return class_mask; } | |||
idx_base_rep *sort_uniq_clone (bool = false) | idx_base_rep *sort_uniq_clone (bool = false) | |||
{ count++; return this; } | { count++; return this; } | |||
idx_base_rep *sort_idx (Array<octave_idx_type>&); | idx_base_rep *sort_idx (Array<octave_idx_type>&); | |||
dim_vector orig_dimensions (void) const { return orig_dims; } | dim_vector orig_dimensions (void) const { return orig_dims; } | |||
bool is_colon_equiv (octave_idx_type n) const | bool is_colon_equiv (octave_idx_type n) const | |||
{ return len == n && ext == n; } | { return len == n && ext == n; } | |||
const bool *get_data (void) const { return data; } | const bool *get_data (void) const { return data; } | |||
std::ostream& print (std::ostream& os) const; | std::ostream& print (std::ostream& os) const; | |||
Array<bool> unconvert (void) const; | Array<bool> unconvert (void) const; | |||
Array<octave_idx_type> as_array (void); | Array<octave_idx_type> as_array (void); | |||
private: | private: | |||
skipping to change at line 440 | skipping to change at line 441 | |||
Array<bool> *aowner; | Array<bool> *aowner; | |||
dim_vector orig_dims; | dim_vector orig_dims; | |||
}; | }; | |||
idx_vector (idx_base_rep *r) : rep (r) { } | idx_vector (idx_base_rep *r) : rep (r) { } | |||
// The shared empty vector representation (for fast default | // The shared empty vector representation (for fast default | |||
// constructor). | // constructor). | |||
static idx_vector_rep *nil_rep (void) | static idx_vector_rep *nil_rep (void) | |||
{ | { | |||
static idx_vector_rep ivr; | static idx_vector_rep ivr; | |||
return &ivr; | return &ivr; | |||
} | } | |||
// The shared empty vector representation with the error flag set. | // The shared empty vector representation with the error flag set. | |||
static idx_vector_rep *err_rep (void) | static idx_vector_rep *err_rep (void) | |||
{ | { | |||
static idx_vector_rep ivr; | static idx_vector_rep ivr; | |||
ivr.err = true; | ivr.err = true; | |||
return &ivr; | return &ivr; | |||
} | } | |||
// If there was an error in constructing the rep, replace it with | // If there was an error in constructing the rep, replace it with | |||
// empty vector for safety. | // empty vector for safety. | |||
void chkerr (void) | void chkerr (void) | |||
{ | { | |||
if (rep->err) | if (rep->err) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = err_rep (); | rep = err_rep (); | |||
rep->count++; | rep->count++; | |||
} | } | |||
} | } | |||
public: | public: | |||
// Fast empty constructor. | // Fast empty constructor. | |||
idx_vector (void) : rep (nil_rep ()) { rep->count++; } | idx_vector (void) : rep (nil_rep ()) { rep->count++; } | |||
// Zero-based constructors (for use from C++). | // Zero-based constructors (for use from C++). | |||
idx_vector (octave_idx_type i) : rep (new idx_scalar_rep (i)) | idx_vector (octave_idx_type i) : rep (new idx_scalar_rep (i)) | |||
{ chkerr (); } | { chkerr (); } | |||
idx_vector (octave_idx_type start, octave_idx_type limit, | idx_vector (octave_idx_type start, octave_idx_type limit, | |||
octave_idx_type step = 1) | octave_idx_type step = 1) | |||
: rep (new idx_range_rep (start, limit, step)) | : rep (new idx_range_rep (start, limit, step)) | |||
{ chkerr (); } | { chkerr (); } | |||
static idx_vector | static idx_vector | |||
make_range (octave_idx_type start, octave_idx_type step, | make_range (octave_idx_type start, octave_idx_type step, | |||
octave_idx_type len) | octave_idx_type len) | |||
{ | { | |||
return idx_vector (new idx_range_rep (start, len, step, DIRECT)); | return idx_vector (new idx_range_rep (start, len, step, DIRECT)); | |||
} | } | |||
idx_vector (const Array<octave_idx_type>& inda) | idx_vector (const Array<octave_idx_type>& inda) | |||
: rep (new idx_vector_rep (inda)) | : rep (new idx_vector_rep (inda)) | |||
{ chkerr (); } | { chkerr (); } | |||
// Directly pass extent, no checking. | // Directly pass extent, no checking. | |||
idx_vector (const Array<octave_idx_type>& inda, octave_idx_type ext) | idx_vector (const Array<octave_idx_type>& inda, octave_idx_type ext) | |||
: rep (new idx_vector_rep (inda, ext, DIRECT)) | : rep (new idx_vector_rep (inda, ext, DIRECT)) | |||
{ } | { } | |||
// Colon is best constructed by simply copying (or referencing) this memb er. | // Colon is best constructed by simply copying (or referencing) this memb er. | |||
static const idx_vector colon; | static const idx_vector colon; | |||
// or passing ':' here | // or passing ':' here | |||
idx_vector (char c) : rep (new idx_colon_rep (c)) { chkerr (); } | idx_vector (char c) : rep (new idx_colon_rep (c)) { chkerr (); } | |||
// Conversion constructors (used by interpreter). | // Conversion constructors (used by interpreter). | |||
template <class T> | template <class T> | |||
skipping to change at line 516 | skipping to change at line 517 | |||
idx_vector (double x) : rep (new idx_scalar_rep (x)) { chkerr (); } | idx_vector (double x) : rep (new idx_scalar_rep (x)) { chkerr (); } | |||
idx_vector (float x) : rep (new idx_scalar_rep (x)) { chkerr (); } | idx_vector (float x) : rep (new idx_scalar_rep (x)) { chkerr (); } | |||
// A scalar bool does not necessarily map to scalar index. | // A scalar bool does not necessarily map to scalar index. | |||
idx_vector (bool x) : rep (new idx_mask_rep (x)) { chkerr (); } | idx_vector (bool x) : rep (new idx_mask_rep (x)) { chkerr (); } | |||
template <class T> | template <class T> | |||
idx_vector (const Array<octave_int<T> >& nda) : rep (new idx_vector_rep ( nda)) | idx_vector (const Array<octave_int<T> >& nda) : rep (new idx_vector_rep ( nda)) | |||
{ chkerr (); } | { chkerr (); } | |||
idx_vector (const Array<double>& nda) : rep (new idx_vector_rep (nda)) | idx_vector (const Array<double>& nda) : rep (new idx_vector_rep (nda)) | |||
{ chkerr (); } | { chkerr (); } | |||
idx_vector (const Array<float>& nda) : rep (new idx_vector_rep (nda)) | idx_vector (const Array<float>& nda) : rep (new idx_vector_rep (nda)) | |||
{ chkerr (); } | { chkerr (); } | |||
idx_vector (const Array<bool>& nda); | idx_vector (const Array<bool>& nda); | |||
idx_vector (const Range& r) | idx_vector (const Range& r) | |||
: rep (new idx_range_rep (r)) | : rep (new idx_range_rep (r)) | |||
{ chkerr (); } | { chkerr (); } | |||
idx_vector (const Sparse<bool>& nda) : rep (new idx_vector_rep (nda)) | idx_vector (const Sparse<bool>& nda) : rep (new idx_vector_rep (nda)) | |||
{ chkerr (); } | { chkerr (); } | |||
idx_vector (const idx_vector& a) : rep (a.rep) { rep->count++; } | idx_vector (const idx_vector& a) : rep (a.rep) { rep->count++; } | |||
~idx_vector (void) | ~idx_vector (void) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
} | } | |||
idx_vector& operator = (const idx_vector& a) | idx_vector& operator = (const idx_vector& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = a.rep; | rep = a.rep; | |||
rep->count++; | rep->count++; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
idx_class_type idx_class (void) const { return rep->idx_class (); } | idx_class_type idx_class (void) const { return rep->idx_class (); } | |||
octave_idx_type length (octave_idx_type n = 0) const | octave_idx_type length (octave_idx_type n = 0) const | |||
{ return rep->length (n); } | { return rep->length (n); } | |||
octave_idx_type extent (octave_idx_type n) const | octave_idx_type extent (octave_idx_type n) const | |||
{ return rep->extent (n); } | { return rep->extent (n); } | |||
octave_idx_type xelem (octave_idx_type n) const | octave_idx_type xelem (octave_idx_type n) const | |||
{ return rep->xelem (n); } | { return rep->xelem (n); } | |||
octave_idx_type checkelem (octave_idx_type n) const | octave_idx_type checkelem (octave_idx_type n) const | |||
{ return rep->checkelem (n); } | { return rep->checkelem (n); } | |||
octave_idx_type operator () (octave_idx_type n) const | octave_idx_type operator () (octave_idx_type n) const | |||
{ | { | |||
#if defined (BOUNDS_CHECKING) | #if defined (BOUNDS_CHECKING) | |||
return rep->checkelem (n); | return rep->checkelem (n); | |||
#else | #else | |||
return rep->xelem (n); | return rep->xelem (n); | |||
#endif | #endif | |||
} | } | |||
operator bool (void) const | operator bool (void) const | |||
{ return ! rep->err; } | { return ! rep->err; } | |||
bool is_colon (void) const | bool is_colon (void) const | |||
{ return rep->idx_class () == class_colon; } | { return rep->idx_class () == class_colon; } | |||
bool is_scalar (void) const | bool is_scalar (void) const | |||
{ return rep->idx_class () == class_scalar; } | { return rep->idx_class () == class_scalar; } | |||
bool is_range (void) const | bool is_range (void) const | |||
{ return rep->idx_class () == class_range; } | { return rep->idx_class () == class_range; } | |||
bool is_colon_equiv (octave_idx_type n) const | bool is_colon_equiv (octave_idx_type n) const | |||
{ return rep->is_colon_equiv (n); } | { return rep->is_colon_equiv (n); } | |||
idx_vector sorted (bool uniq = false) const | idx_vector sorted (bool uniq = false) const | |||
{ return idx_vector (rep->sort_uniq_clone (uniq)); } | { return idx_vector (rep->sort_uniq_clone (uniq)); } | |||
idx_vector sorted (Array<octave_idx_type>& sidx) const | idx_vector sorted (Array<octave_idx_type>& sidx) const | |||
{ return idx_vector (rep->sort_idx (sidx)); } | { return idx_vector (rep->sort_idx (sidx)); } | |||
dim_vector orig_dimensions (void) const { return rep->orig_dimensions (); } | dim_vector orig_dimensions (void) const { return rep->orig_dimensions (); } | |||
octave_idx_type orig_rows (void) const | octave_idx_type orig_rows (void) const | |||
{ return orig_dimensions () (0); } | { return orig_dimensions () (0); } | |||
octave_idx_type orig_columns (void) const | octave_idx_type orig_columns (void) const | |||
{ return orig_dimensions () (1); } | { return orig_dimensions () (1); } | |||
int orig_empty (void) const | int orig_empty (void) const | |||
{ return (! is_colon () && orig_dimensions().any_zero ()); } | { return (! is_colon () && orig_dimensions ().any_zero ()); } | |||
// i/o | // i/o | |||
std::ostream& print (std::ostream& os) const { return rep->print (os); } | std::ostream& print (std::ostream& os) const { return rep->print (os); } | |||
friend std::ostream& operator << (std::ostream& os, const idx_vector& a) | friend std::ostream& operator << (std::ostream& os, const idx_vector& a) | |||
{ return a.print (os); } | { return a.print (os); } | |||
// Slice with specializations. No checking of bounds! | // Slice with specializations. No checking of bounds! | |||
// | // | |||
// This is equivalent to the following loop (but much faster): | // This is equivalent to the following loop (but much faster): | |||
// | // | |||
// for (octave_idx_type i = 0; i < idx->length (n); i++) | // for (octave_idx_type i = 0; i < idx->length (n); i++) | |||
// dest[i] = src[idx(i)]; | // dest[i] = src[idx(i)]; | |||
// return i; | // return i; | |||
// | // | |||
template <class T> | template <class T> | |||
octave_idx_type | octave_idx_type | |||
index (const T *src, octave_idx_type n, T *dest) const | index (const T *src, octave_idx_type n, T *dest) const | |||
{ | { | |||
octave_idx_type len = rep->length (n); | octave_idx_type len = rep->length (n); | |||
switch (rep->idx_class ()) | ||||
{ | ||||
case class_colon: | ||||
copy_or_memcpy (len, src, dest); | ||||
break; | ||||
case class_range: | ||||
{ | ||||
idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); | ||||
octave_idx_type start = r->get_start (), step = r->get_step (); | ||||
const T *ssrc = src + start; | ||||
if (step == 1) | ||||
copy_or_memcpy (len, ssrc, dest); | ||||
else if (step == -1) | ||||
std::reverse_copy (ssrc - len + 1, ssrc + 1, dest); | ||||
else if (step == 0) | ||||
std::fill_n (dest, len, *ssrc); | ||||
else | ||||
{ | ||||
for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) | ||||
dest[i] = ssrc[j]; | ||||
} | ||||
} | ||||
break; | ||||
case class_scalar: | ||||
{ | ||||
idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); | ||||
dest[0] = src[r->get_data ()]; | ||||
} | ||||
break; | ||||
switch (rep->idx_class ()) | case class_vector: | |||
{ | { | |||
case class_colon: | idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); | |||
copy_or_memcpy (len, src, dest); | const octave_idx_type *data = r->get_data (); | |||
break; | for (octave_idx_type i = 0; i < len; i++) | |||
dest[i] = src[data[i]]; | ||||
case class_range: | ||||
{ | ||||
idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); | ||||
octave_idx_type start = r->get_start (), step = r->get_step (); | ||||
const T *ssrc = src + start; | ||||
if (step == 1) | ||||
copy_or_memcpy (len, ssrc, dest); | ||||
else if (step == -1) | ||||
std::reverse_copy (ssrc - len + 1, ssrc + 1, dest); | ||||
else if (step == 0) | ||||
std::fill_n (dest, len, *ssrc); | ||||
else | ||||
{ | ||||
for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) | ||||
dest[i] = ssrc[j]; | ||||
} | ||||
} | ||||
break; | ||||
case class_scalar: | ||||
{ | ||||
idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); | ||||
dest[0] = src[r->get_data ()]; | ||||
} | ||||
break; | ||||
case class_vector: | ||||
{ | ||||
idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); | ||||
const octave_idx_type *data = r->get_data (); | ||||
for (octave_idx_type i = 0; i < len; i++) | ||||
dest[i] = src[data[i]]; | ||||
} | ||||
break; | ||||
case class_mask: | ||||
{ | ||||
idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); | ||||
const bool *data = r->get_data (); | ||||
octave_idx_type ext = r->extent (0); | ||||
for (octave_idx_type i = 0; i < ext; i++) | ||||
if (data[i]) *dest++ = src[i]; | ||||
} | ||||
break; | ||||
default: | ||||
assert (false); | ||||
break; | ||||
} | } | |||
break; | ||||
return len; | case class_mask: | |||
} | { | |||
idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); | ||||
const bool *data = r->get_data (); | ||||
octave_idx_type ext = r->extent (0); | ||||
for (octave_idx_type i = 0; i < ext; i++) | ||||
if (data[i]) *dest++ = src[i]; | ||||
} | ||||
break; | ||||
default: | ||||
assert (false); | ||||
break; | ||||
} | ||||
return len; | ||||
} | ||||
// Slice assignment with specializations. No checking of bounds! | // Slice assignment with specializations. No checking of bounds! | |||
// | // | |||
// This is equivalent to the following loop (but much faster): | // This is equivalent to the following loop (but much faster): | |||
// | // | |||
// for (octave_idx_type i = 0; i < idx->length (n); i++) | // for (octave_idx_type i = 0; i < idx->length (n); i++) | |||
// dest[idx(i)] = src[i]; | // dest[idx(i)] = src[i]; | |||
// return i; | // return i; | |||
// | // | |||
template <class T> | template <class T> | |||
octave_idx_type | octave_idx_type | |||
assign (const T *src, octave_idx_type n, T *dest) const | assign (const T *src, octave_idx_type n, T *dest) const | |||
{ | { | |||
octave_idx_type len = rep->length (n); | octave_idx_type len = rep->length (n); | |||
switch (rep->idx_class ()) | ||||
{ | ||||
case class_colon: | ||||
copy_or_memcpy (len, src, dest); | ||||
break; | ||||
case class_range: | ||||
{ | ||||
idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); | ||||
octave_idx_type start = r->get_start (), step = r->get_step (); | ||||
T *sdest = dest + start; | ||||
if (step == 1) | ||||
copy_or_memcpy (len, src, sdest); | ||||
else if (step == -1) | ||||
std::reverse_copy (src, src + len, sdest - len + 1); | ||||
else | ||||
{ | ||||
for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) | ||||
sdest[j] = src[i]; | ||||
} | ||||
} | ||||
break; | ||||
case class_scalar: | ||||
{ | ||||
idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); | ||||
dest[r->get_data ()] = src[0]; | ||||
} | ||||
break; | ||||
case class_vector: | ||||
{ | ||||
idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); | ||||
const octave_idx_type *data = r->get_data (); | ||||
for (octave_idx_type i = 0; i < len; i++) | ||||
dest[data[i]] = src[i]; | ||||
} | ||||
break; | ||||
switch (rep->idx_class ()) | case class_mask: | |||
{ | { | |||
case class_colon: | idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); | |||
copy_or_memcpy (len, src, dest); | const bool *data = r->get_data (); | |||
break; | octave_idx_type ext = r->extent (0); | |||
for (octave_idx_type i = 0; i < ext; i++) | ||||
case class_range: | if (data[i]) dest[i] = *src++; | |||
{ | ||||
idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); | ||||
octave_idx_type start = r->get_start (), step = r->get_step (); | ||||
T *sdest = dest + start; | ||||
if (step == 1) | ||||
copy_or_memcpy (len, src, sdest); | ||||
else if (step == -1) | ||||
std::reverse_copy (src, src + len, sdest - len + 1); | ||||
else | ||||
{ | ||||
for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) | ||||
sdest[j] = src[i]; | ||||
} | ||||
} | ||||
break; | ||||
case class_scalar: | ||||
{ | ||||
idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); | ||||
dest[r->get_data ()] = src[0]; | ||||
} | ||||
break; | ||||
case class_vector: | ||||
{ | ||||
idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); | ||||
const octave_idx_type *data = r->get_data (); | ||||
for (octave_idx_type i = 0; i < len; i++) | ||||
dest[data[i]] = src[i]; | ||||
} | ||||
break; | ||||
case class_mask: | ||||
{ | ||||
idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); | ||||
const bool *data = r->get_data (); | ||||
octave_idx_type ext = r->extent (0); | ||||
for (octave_idx_type i = 0; i < ext; i++) | ||||
if (data[i]) dest[i] = *src++; | ||||
} | ||||
break; | ||||
default: | ||||
assert (false); | ||||
break; | ||||
} | } | |||
break; | ||||
return len; | default: | |||
} | assert (false); | |||
break; | ||||
} | ||||
return len; | ||||
} | ||||
// Slice fill with specializations. No checking of bounds! | // Slice fill with specializations. No checking of bounds! | |||
// | // | |||
// This is equivalent to the following loop (but much faster): | // This is equivalent to the following loop (but much faster): | |||
// | // | |||
// for (octave_idx_type i = 0; i < idx->length (n); i++) | // for (octave_idx_type i = 0; i < idx->length (n); i++) | |||
// dest[idx(i)] = val; | // dest[idx(i)] = val; | |||
// return i; | // return i; | |||
// | // | |||
template <class T> | template <class T> | |||
octave_idx_type | octave_idx_type | |||
fill (const T& val, octave_idx_type n, T *dest) const | fill (const T& val, octave_idx_type n, T *dest) const | |||
{ | { | |||
octave_idx_type len = rep->length (n); | octave_idx_type len = rep->length (n); | |||
switch (rep->idx_class ()) | ||||
{ | ||||
case class_colon: | ||||
std::fill (dest, dest + len, val); | ||||
break; | ||||
case class_range: | ||||
{ | ||||
idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); | ||||
octave_idx_type start = r->get_start (), step = r->get_step (); | ||||
T *sdest = dest + start; | ||||
if (step == 1) | ||||
std::fill (sdest, sdest + len, val); | ||||
else if (step == -1) | ||||
std::fill (sdest - len + 1, sdest + 1, val); | ||||
else | ||||
{ | ||||
for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) | ||||
sdest[j] = val; | ||||
} | ||||
} | ||||
break; | ||||
case class_scalar: | ||||
{ | ||||
idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); | ||||
dest[r->get_data ()] = val; | ||||
} | ||||
break; | ||||
case class_vector: | ||||
{ | ||||
idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); | ||||
const octave_idx_type *data = r->get_data (); | ||||
for (octave_idx_type i = 0; i < len; i++) | ||||
dest[data[i]] = val; | ||||
} | ||||
break; | ||||
switch (rep->idx_class ()) | case class_mask: | |||
{ | { | |||
case class_colon: | idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); | |||
std::fill (dest, dest + len, val); | const bool *data = r->get_data (); | |||
break; | octave_idx_type ext = r->extent (0); | |||
for (octave_idx_type i = 0; i < ext; i++) | ||||
case class_range: | if (data[i]) dest[i] = val; | |||
{ | ||||
idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); | ||||
octave_idx_type start = r->get_start (), step = r->get_step (); | ||||
T *sdest = dest + start; | ||||
if (step == 1) | ||||
std::fill (sdest, sdest + len, val); | ||||
else if (step == -1) | ||||
std::fill (sdest - len + 1, sdest + 1, val); | ||||
else | ||||
{ | ||||
for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) | ||||
sdest[j] = val; | ||||
} | ||||
} | ||||
break; | ||||
case class_scalar: | ||||
{ | ||||
idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); | ||||
dest[r->get_data ()] = val; | ||||
} | ||||
break; | ||||
case class_vector: | ||||
{ | ||||
idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); | ||||
const octave_idx_type *data = r->get_data (); | ||||
for (octave_idx_type i = 0; i < len; i++) | ||||
dest[data[i]] = val; | ||||
} | ||||
break; | ||||
case class_mask: | ||||
{ | ||||
idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); | ||||
const bool *data = r->get_data (); | ||||
octave_idx_type ext = r->extent (0); | ||||
for (octave_idx_type i = 0; i < ext; i++) | ||||
if (data[i]) dest[i] = val; | ||||
} | ||||
break; | ||||
default: | ||||
assert (false); | ||||
break; | ||||
} | } | |||
break; | ||||
default: | ||||
assert (false); | ||||
break; | ||||
} | ||||
return len; | return len; | |||
} | } | |||
// Generic non-breakable indexed loop. The loop body should be | // Generic non-breakable indexed loop. The loop body should be | |||
// encapsulated in a single functor body. This is equivalent to the | // encapsulated in a single functor body. This is equivalent to the | |||
// following loop (but faster, at least for simple inlined bodies): | // following loop (but faster, at least for simple inlined bodies): | |||
// | // | |||
// for (octave_idx_type i = 0; i < idx->length (n); i++) body (idx(i)); | // for (octave_idx_type i = 0; i < idx->length (n); i++) body (idx(i)); | |||
template <class Functor> | template <class Functor> | |||
void | void | |||
loop (octave_idx_type n, Functor body) const | loop (octave_idx_type n, Functor body) const | |||
{ | { | |||
octave_idx_type len = rep->length (n); | octave_idx_type len = rep->length (n); | |||
switch (rep->idx_class ()) | ||||
{ | ||||
case class_colon: | ||||
for (octave_idx_type i = 0; i < len; i++) body (i); | ||||
break; | ||||
case class_range: | ||||
{ | ||||
idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); | ||||
octave_idx_type start = r->get_start (), step = r->get_step (); | ||||
octave_idx_type i, j; | ||||
if (step == 1) | ||||
for (i = start, j = start + len; i < j; i++) body (i); | ||||
else if (step == -1) | ||||
for (i = start, j = start - len; i > j; i--) body (i); | ||||
else | ||||
for (i = 0, j = start; i < len; i++, j += step) body (j); | ||||
} | ||||
break; | ||||
case class_scalar: | ||||
{ | ||||
idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); | ||||
body (r->get_data ()); | ||||
} | ||||
break; | ||||
switch (rep->idx_class ()) | case class_vector: | |||
{ | { | |||
case class_colon: | idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); | |||
for (octave_idx_type i = 0; i < len; i++) body (i); | const octave_idx_type *data = r->get_data (); | |||
break; | for (octave_idx_type i = 0; i < len; i++) body (data[i]); | |||
case class_range: | ||||
{ | ||||
idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); | ||||
octave_idx_type start = r->get_start (), step = r->get_step (); | ||||
octave_idx_type i, j; | ||||
if (step == 1) | ||||
for (i = start, j = start + len; i < j; i++) body (i); | ||||
else if (step == -1) | ||||
for (i = start, j = start - len; i > j; i--) body (i); | ||||
else | ||||
for (i = 0, j = start; i < len; i++, j += step) body (j); | ||||
} | ||||
break; | ||||
case class_scalar: | ||||
{ | ||||
idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); | ||||
body (r->get_data ()); | ||||
} | ||||
break; | ||||
case class_vector: | ||||
{ | ||||
idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); | ||||
const octave_idx_type *data = r->get_data (); | ||||
for (octave_idx_type i = 0; i < len; i++) body (data[i]); | ||||
} | ||||
break; | ||||
case class_mask: | ||||
{ | ||||
idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); | ||||
const bool *data = r->get_data (); | ||||
octave_idx_type ext = r->extent (0); | ||||
for (octave_idx_type i = 0; i < ext; i++) | ||||
if (data[i]) body (i); | ||||
} | ||||
break; | ||||
default: | ||||
assert (false); | ||||
break; | ||||
} | } | |||
break; | ||||
case class_mask: | ||||
{ | ||||
idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); | ||||
const bool *data = r->get_data (); | ||||
octave_idx_type ext = r->extent (0); | ||||
for (octave_idx_type i = 0; i < ext; i++) | ||||
if (data[i]) body (i); | ||||
} | ||||
break; | ||||
default: | ||||
assert (false); | ||||
break; | ||||
} | ||||
} | } | |||
// Generic breakable indexed loop. The loop body should be | // Generic breakable indexed loop. The loop body should be | |||
// encapsulated in a single functor body. This is equivalent to the | // encapsulated in a single functor body. This is equivalent to the | |||
// following loop (but faster, at least for simple inlined bodies): | // following loop (but faster, at least for simple inlined bodies): | |||
// | // | |||
// for (octave_idx_type i = 0; i < idx->length (n); i++) | // for (octave_idx_type i = 0; i < idx->length (n); i++) | |||
// if (body (idx(i))) break; | // if (body (idx(i))) break; | |||
// return i; | // return i; | |||
// | // | |||
template <class Functor> | template <class Functor> | |||
octave_idx_type | octave_idx_type | |||
bloop (octave_idx_type n, Functor body) const | bloop (octave_idx_type n, Functor body) const | |||
{ | { | |||
octave_idx_type len = rep->length (n), ret; | octave_idx_type len = rep->length (n), ret; | |||
switch (rep->idx_class ()) | ||||
{ | ||||
case class_colon: | ||||
{ | ||||
octave_idx_type i; | ||||
for (i = 0; i < len && body (i); i++) ; | ||||
ret = i; | ||||
} | ||||
break; | ||||
case class_range: | ||||
{ | ||||
idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); | ||||
octave_idx_type start = r->get_start (), step = r->get_step (); | ||||
octave_idx_type i, j; | ||||
if (step == 1) | ||||
for (i = start, j = start + len; i < j && body (i); i++) ; | ||||
else if (step == -1) | ||||
for (i = start, j = start - len; i > j && body (i); i--) ; | ||||
else | ||||
for (i = 0, j = start; i < len && body (j); i++, j += step) ; | ||||
ret = i; | ||||
} | ||||
break; | ||||
case class_scalar: | ||||
{ | ||||
idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); | ||||
ret = body (r->get_data ()) ? 1 : 0; | ||||
} | ||||
break; | ||||
switch (rep->idx_class ()) | case class_vector: | |||
{ | { | |||
case class_colon: | idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); | |||
{ | const octave_idx_type *data = r->get_data (); | |||
octave_idx_type i; | octave_idx_type i; | |||
for (i = 0; i < len && body (i); i++) ; | for (i = 0; i < len && body (data[i]); i++) ; | |||
ret = i; | ret = i; | |||
} | ||||
break; | ||||
case class_range: | ||||
{ | ||||
idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); | ||||
octave_idx_type start = r->get_start (), step = r->get_step (); | ||||
octave_idx_type i, j; | ||||
if (step == 1) | ||||
for (i = start, j = start + len; i < j && body (i); i++) ; | ||||
else if (step == -1) | ||||
for (i = start, j = start - len; i > j && body (i); i--) ; | ||||
else | ||||
for (i = 0, j = start; i < len && body (j); i++, j += step) ; | ||||
ret = i; | ||||
} | ||||
break; | ||||
case class_scalar: | ||||
{ | ||||
idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); | ||||
ret = body (r->get_data ()) ? 1 : 0; | ||||
} | ||||
break; | ||||
case class_vector: | ||||
{ | ||||
idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); | ||||
const octave_idx_type *data = r->get_data (); | ||||
octave_idx_type i; | ||||
for (i = 0; i < len && body (data[i]); i++) ; | ||||
ret = i; | ||||
} | ||||
break; | ||||
case class_mask: | ||||
{ | ||||
idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); | ||||
const bool *data = r->get_data (); | ||||
octave_idx_type ext = r->extent (0), j = 0; | ||||
for (octave_idx_type i = 0; i < ext; i++) | ||||
{ | ||||
if (data[i]) | ||||
{ | ||||
if (body (i)) | ||||
break; | ||||
else | ||||
j++; | ||||
} | ||||
} | ||||
ret = j; | ||||
} | ||||
break; | ||||
default: | ||||
assert (false); | ||||
break; | ||||
} | } | |||
break; | ||||
case class_mask: | ||||
{ | ||||
idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); | ||||
const bool *data = r->get_data (); | ||||
octave_idx_type ext = r->extent (0), j = 0; | ||||
for (octave_idx_type i = 0; i < ext; i++) | ||||
{ | ||||
if (data[i]) | ||||
{ | ||||
if (body (i)) | ||||
break; | ||||
else | ||||
j++; | ||||
} | ||||
} | ||||
ret = j; | ||||
} | ||||
break; | ||||
default: | ||||
assert (false); | ||||
break; | ||||
} | ||||
return ret; | return ret; | |||
} | } | |||
// Rationale: | // Rationale: | |||
// This method is the key to "smart indexing". When indexing cartesian | // This method is the key to "smart indexing". When indexing cartesian | |||
// arrays, sometimes consecutive index vectors can be reduced into a | // arrays, sometimes consecutive index vectors can be reduced into a | |||
// single index. If rows (A) = k and i.maybe_reduce (j) gives k, then | // single index. If rows (A) = k and i.maybe_reduce (j) gives k, then | |||
// A(i,j)(:) is equal to A(k)(:). | // A(i,j)(:) is equal to A(k)(:). | |||
// If the next index can be reduced, returns true and updates this. | // If the next index can be reduced, returns true and updates this. | |||
bool maybe_reduce (octave_idx_type n, const idx_vector& j, | bool maybe_reduce (octave_idx_type n, const idx_vector& j, | |||
octave_idx_type nj); | octave_idx_type nj); | |||
skipping to change at line 1025 | skipping to change at line 1026 | |||
Array<double>& array, Array<bool>& mask) const; | Array<double>& array, Array<bool>& mask) const; | |||
Array<octave_idx_type> as_array (void) const; | Array<octave_idx_type> as_array (void) const; | |||
// Raw pointer to index array. This is non-const because it may be | // Raw pointer to index array. This is non-const because it may be | |||
// necessary to mutate the index. | // necessary to mutate the index. | |||
const octave_idx_type *raw (void); | const octave_idx_type *raw (void); | |||
bool is_vector (void) const; | bool is_vector (void) const; | |||
// FIXME -- these are here for compatibility. They should be removed | // FIXME: these are here for compatibility. They should be removed | |||
// when no longer in use. | // when no longer in use. | |||
octave_idx_type elem (octave_idx_type n) const | octave_idx_type elem (octave_idx_type n) const | |||
{ return (*this) (n); } | { return (*this) (n); } | |||
bool is_colon_equiv (octave_idx_type n, int) const | bool is_colon_equiv (octave_idx_type n, int) const | |||
{ return is_colon_equiv (n); } | { return is_colon_equiv (n); } | |||
octave_idx_type | octave_idx_type | |||
freeze (octave_idx_type z_len, const char *tag, bool resize_ok = false); | freeze (octave_idx_type z_len, const char *tag, bool resize_ok = false); | |||
void sort (bool uniq = false) | void sort (bool uniq = false) | |||
{ *this = sorted (uniq); } | { *this = sorted (uniq); } | |||
octave_idx_type ones_count (void) const; | octave_idx_type ones_count (void) const; | |||
octave_idx_type max (void) const { return extent (1) - 1; } | octave_idx_type max (void) const { return extent (1) - 1; } | |||
private: | private: | |||
idx_base_rep *rep; | idx_base_rep *rep; | |||
}; | }; | |||
End of changes. 80 change blocks. | ||||
380 lines changed or deleted | 381 lines changed or added | |||
input.h | input.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 37 | skipping to change at line 37 | |||
#include <cstdio> | #include <cstdio> | |||
#include <string> | #include <string> | |||
#include "oct-time.h" | #include "oct-time.h" | |||
#include "oct-obj.h" | #include "oct-obj.h" | |||
#include "pager.h" | #include "pager.h" | |||
class octave_value; | class octave_value; | |||
class octave_base_lexer; | ||||
extern OCTINTERP_API int octave_read (char *buf, unsigned max_size); | ||||
extern OCTINTERP_API FILE *get_input_from_file (const std::string& name, in | ||||
t warn = 1); | ||||
extern OCTINTERP_API FILE *get_input_from_stdin (void); | extern OCTINTERP_API FILE *get_input_from_stdin (void); | |||
// Global pointer for eval(). | ||||
extern std::string current_eval_string; | ||||
// TRUE means get input from current_eval_string. | ||||
extern bool get_input_from_eval_string; | ||||
// TRUE means we haven't been asked for the input from | ||||
// current_eval_string yet. | ||||
extern bool input_from_eval_string_pending; | ||||
// TRUE means that input is coming from a file that was named on | ||||
// the command line. | ||||
extern bool input_from_command_line_file; | ||||
// TRUE means that stdin is a terminal, not a pipe or redirected file. | ||||
extern bool stdin_is_tty; | ||||
// TRUE means we're parsing a function file. | ||||
extern bool reading_fcn_file; | ||||
// Simple name of function file we are reading. | ||||
extern std::string curr_fcn_file_name; | ||||
// Full name of file we are reading. | ||||
extern std::string curr_fcn_file_full_name; | ||||
// TRUE means we're parsing a script file. | ||||
extern bool reading_script_file; | ||||
// TRUE means we're parsing a classdef file. | ||||
extern bool reading_classdef_file; | ||||
// If we are reading from an M-file, this is it. | ||||
extern FILE *ff_instream; | ||||
// TRUE means this is an interactive shell. | // TRUE means this is an interactive shell. | |||
extern bool interactive; | extern bool interactive; | |||
// TRUE means the user forced this shell to be interactive (-i). | // TRUE means the user forced this shell to be interactive (-i). | |||
extern bool forced_interactive; | extern bool forced_interactive; | |||
// Should we issue a prompt? | ||||
extern int promptflag; | ||||
// A line of input. | ||||
extern std::string current_input_line; | ||||
// TRUE after a call to completion_matches. | // TRUE after a call to completion_matches. | |||
extern bool octave_completion_matches_called; | extern bool octave_completion_matches_called; | |||
// TRUE if the plotting system has requested a call to drawnow at | // TRUE if the plotting system has requested a call to drawnow at | |||
// the next user prompt. | // the next user prompt. | |||
extern OCTINTERP_API bool Vdrawnow_requested; | extern OCTINTERP_API bool Vdrawnow_requested; | |||
// TRUE if we are in debugging mode. | // TRUE if we are in debugging mode. | |||
extern OCTINTERP_API bool Vdebugging; | extern OCTINTERP_API bool Vdebugging; | |||
extern std::string gnu_readline (const std::string& s, bool force_readline | ||||
= false); | ||||
extern void initialize_command_input (void); | extern void initialize_command_input (void); | |||
extern bool octave_yes_or_no (const std::string& prompt); | extern bool octave_yes_or_no (const std::string& prompt); | |||
extern octave_value do_keyboard (const octave_value_list& args = octave_val | extern octave_value do_keyboard (const octave_value_list& args | |||
ue_list ()); | = octave_value_list ()); | |||
extern void remove_input_event_hook_functions (void); | ||||
extern void set_default_prompts (void); | ||||
extern std::string VPS4; | extern std::string VPS4; | |||
extern char Vfilemarker; | extern char Vfilemarker; | |||
enum echo_state | enum echo_state | |||
{ | { | |||
ECHO_OFF = 0, | ECHO_OFF = 0, | |||
ECHO_SCRIPTS = 1, | ECHO_SCRIPTS = 1, | |||
ECHO_FUNCTIONS = 2, | ECHO_FUNCTIONS = 2, | |||
ECHO_CMD_LINE = 4 | ECHO_CMD_LINE = 4 | |||
}; | }; | |||
extern int Vecho_executing_commands; | extern int Vecho_executing_commands; | |||
extern octave_time Vlast_prompt_time; | extern octave_time Vlast_prompt_time; | |||
class | ||||
octave_base_reader | ||||
{ | ||||
public: | ||||
friend class octave_input_reader; | ||||
octave_base_reader (octave_base_lexer *lxr) | ||||
: count (1), pflag (0), lexer (lxr) | ||||
{ } | ||||
octave_base_reader (const octave_base_reader& x) | ||||
: count (1), pflag (x.pflag), lexer (x.lexer) | ||||
{ } | ||||
virtual ~octave_base_reader (void) { } | ||||
virtual std::string get_input (bool& eof) = 0; | ||||
virtual std::string input_source (void) const { return in_src; } | ||||
void reset (void) { promptflag (1); } | ||||
void increment_promptflag (void) { pflag++; } | ||||
void decrement_promptflag (void) { pflag--; } | ||||
int promptflag (void) const { return pflag; } | ||||
int promptflag (int n) | ||||
{ | ||||
int retval = pflag; | ||||
pflag = n; | ||||
return retval; | ||||
} | ||||
std::string octave_gets (bool& eof); | ||||
virtual bool reading_fcn_file (void) const; | ||||
virtual bool reading_classdef_file (void) const; | ||||
virtual bool reading_script_file (void) const; | ||||
virtual bool input_from_terminal (void) const { return false; } | ||||
virtual bool input_from_file (void) const { return false; } | ||||
virtual bool input_from_eval_string (void) const { return false; } | ||||
private: | ||||
int count; | ||||
int pflag; | ||||
octave_base_lexer *lexer; | ||||
void do_input_echo (const std::string&) const; | ||||
static const std::string in_src; | ||||
}; | ||||
class | ||||
octave_terminal_reader : public octave_base_reader | ||||
{ | ||||
public: | ||||
octave_terminal_reader (octave_base_lexer *lxr = 0) | ||||
: octave_base_reader (lxr) | ||||
{ } | ||||
std::string get_input (bool& eof); | ||||
std::string input_source (void) const { return in_src; } | ||||
bool input_from_terminal (void) const { return true; } | ||||
private: | ||||
static const std::string in_src; | ||||
}; | ||||
class | ||||
octave_file_reader : public octave_base_reader | ||||
{ | ||||
public: | ||||
octave_file_reader (FILE *f_arg, octave_base_lexer *lxr = 0) | ||||
: octave_base_reader (lxr), file (f_arg) { } | ||||
std::string get_input (bool& eof); | ||||
std::string input_source (void) const { return in_src; } | ||||
bool input_from_file (void) const { return true; } | ||||
private: | ||||
FILE *file; | ||||
static const std::string in_src; | ||||
}; | ||||
class | ||||
octave_eval_string_reader : public octave_base_reader | ||||
{ | ||||
public: | ||||
octave_eval_string_reader (const std::string& str, | ||||
octave_base_lexer *lxr = 0) | ||||
: octave_base_reader (lxr), eval_string (str) | ||||
{ } | ||||
std::string get_input (bool& eof); | ||||
std::string input_source (void) const { return in_src; } | ||||
bool input_from_eval_string (void) const { return true; } | ||||
private: | ||||
std::string eval_string; | ||||
static const std::string in_src; | ||||
}; | ||||
class | ||||
octave_input_reader | ||||
{ | ||||
public: | ||||
octave_input_reader (octave_base_lexer *lxr = 0) | ||||
: rep (new octave_terminal_reader (lxr)) | ||||
{ } | ||||
octave_input_reader (FILE *file, octave_base_lexer *lxr = 0) | ||||
: rep (new octave_file_reader (file, lxr)) | ||||
{ } | ||||
octave_input_reader (const std::string& str, octave_base_lexer *lxr = 0) | ||||
: rep (new octave_eval_string_reader (str, lxr)) | ||||
{ } | ||||
octave_input_reader (const octave_input_reader& ir) | ||||
{ | ||||
rep = ir.rep; | ||||
rep->count++; | ||||
} | ||||
octave_input_reader& operator = (const octave_input_reader& ir) | ||||
{ | ||||
if (&ir != this) | ||||
{ | ||||
rep = ir.rep; | ||||
rep->count++; | ||||
} | ||||
return *this; | ||||
} | ||||
~octave_input_reader (void) | ||||
{ | ||||
if (--rep->count == 0) | ||||
delete rep; | ||||
} | ||||
void reset (void) { return rep->reset (); } | ||||
void increment_promptflag (void) { rep->increment_promptflag (); } | ||||
void decrement_promptflag (void) { rep->decrement_promptflag (); } | ||||
int promptflag (void) const { return rep->promptflag (); } | ||||
int promptflag (int n) { return rep->promptflag (n); } | ||||
std::string get_input (bool& eof) | ||||
{ | ||||
return rep->get_input (eof); | ||||
} | ||||
std::string input_source (void) const | ||||
{ | ||||
return rep->input_source (); | ||||
} | ||||
bool input_from_terminal (void) const | ||||
{ | ||||
return rep->input_from_terminal (); | ||||
} | ||||
bool input_from_file (void) const | ||||
{ | ||||
return rep->input_from_file (); | ||||
} | ||||
bool input_from_eval_string (void) const | ||||
{ | ||||
return rep->input_from_eval_string (); | ||||
} | ||||
private: | ||||
octave_base_reader *rep; | ||||
}; | ||||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
50 lines changed or deleted | 214 lines changed or added | |||
int16NDArray.h | int16NDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
int32NDArray.h | int32NDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
int64NDArray.h | int64NDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
int8NDArray.h | int8NDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
intNDArray.cc | intNDArray.cc | |||
---|---|---|---|---|
// N-D Array manipulations. | // N-D Array manipulations. | |||
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
Copyright (C) 2009 VZLU Prague, a.s. | Copyright (C) 2009 VZLU Prague, a.s. | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 72 | skipping to change at line 72 | |||
return false; | return false; | |||
} | } | |||
template <class T> | template <class T> | |||
intNDArray<T> | intNDArray<T> | |||
intNDArray<T>::diag (octave_idx_type k) const | intNDArray<T>::diag (octave_idx_type k) const | |||
{ | { | |||
return MArray<T>::diag (k); | return MArray<T>::diag (k); | |||
} | } | |||
// FIXME -- this is not quite the right thing. | template <class T> | |||
intNDArray<T> | ||||
intNDArray<T>::diag (octave_idx_type m, octave_idx_type n) const | ||||
{ | ||||
return MArray<T>::diag (m, n); | ||||
} | ||||
// FIXME: this is not quite the right thing. | ||||
template <class T> | template <class T> | |||
boolNDArray | boolNDArray | |||
intNDArray<T>::all (int dim) const | intNDArray<T>::all (int dim) const | |||
{ | { | |||
return do_mx_red_op<bool, T > (*this, dim, mx_inline_all); | return do_mx_red_op<bool, T > (*this, dim, mx_inline_all); | |||
} | } | |||
template <class T> | template <class T> | |||
boolNDArray | boolNDArray | |||
intNDArray<T>::any (int dim) const | intNDArray<T>::any (int dim) const | |||
{ | { | |||
return do_mx_red_op<bool, T > (*this, dim, mx_inline_any); | return do_mx_red_op<bool, T > (*this, dim, mx_inline_any); | |||
} | } | |||
template <class T> | template <class T> | |||
void | void | |||
intNDArray<T>::increment_index (Array<octave_idx_type>& ra_idx, | intNDArray<T>::increment_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions, | const dim_vector& dimensions, | |||
int start_dimension) | int start_dimension) | |||
{ | { | |||
::increment_index (ra_idx, dimensions, start_dimension); | ::increment_index (ra_idx, dimensions, start_dimension); | |||
} | } | |||
template <class T> | template <class T> | |||
octave_idx_type | octave_idx_type | |||
intNDArray<T>::compute_index (Array<octave_idx_type>& ra_idx, | intNDArray<T>::compute_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions) | const dim_vector& dimensions) | |||
{ | { | |||
return ::compute_index (ra_idx, dimensions); | return ::compute_index (ra_idx, dimensions); | |||
} | } | |||
template <class T> | template <class T> | |||
intNDArray<T> | intNDArray<T> | |||
intNDArray<T>::concat (const intNDArray<T>& rb, const Array<octave_idx_type | intNDArray<T>::concat (const intNDArray<T>& rb, | |||
>& ra_idx) | const Array<octave_idx_type>& ra_idx) | |||
{ | { | |||
if (rb.numel () > 0) | if (rb.numel () > 0) | |||
insert (rb, ra_idx); | insert (rb, ra_idx); | |||
return *this; | return *this; | |||
} | } | |||
template <class T> | template <class T> | |||
intNDArray<T>& | intNDArray<T>& | |||
intNDArray<T>::insert (const intNDArray<T>& a, octave_idx_type r, octave_id | intNDArray<T>::insert (const intNDArray<T>& a, octave_idx_type r, | |||
x_type c) | octave_idx_type c) | |||
{ | { | |||
Array<T>::insert (a, r, c); | Array<T>::insert (a, r, c); | |||
return *this; | return *this; | |||
} | } | |||
template <class T> | template <class T> | |||
intNDArray<T>& | intNDArray<T>& | |||
intNDArray<T>::insert (const intNDArray<T>& a, const Array<octave_idx_type> | intNDArray<T>::insert (const intNDArray<T>& a, | |||
& ra_idx) | const Array<octave_idx_type>& ra_idx) | |||
{ | { | |||
Array<T>::insert (a, ra_idx); | Array<T>::insert (a, ra_idx); | |||
return *this; | return *this; | |||
} | } | |||
// This contains no information on the array structure !!! | // This contains no information on the array structure !!! | |||
template <class T> | template <class T> | |||
std::ostream& | std::ostream& | |||
operator << (std::ostream& os, const intNDArray<T>& a) | operator << (std::ostream& os, const intNDArray<T>& a) | |||
skipping to change at line 165 | skipping to change at line 175 | |||
{ | { | |||
is >> tmp; | is >> tmp; | |||
if (is) | if (is) | |||
a.elem (i) = tmp; | a.elem (i) = tmp; | |||
else | else | |||
goto done; | goto done; | |||
} | } | |||
} | } | |||
done: | done: | |||
return is; | return is; | |||
} | } | |||
// FIXME -- should abs and signum just be mapper functions? | // FIXME: should abs and signum just be mapper functions? | |||
template <class T> | template <class T> | |||
intNDArray<T> | intNDArray<T> | |||
intNDArray<T>::abs (void) const | intNDArray<T>::abs (void) const | |||
{ | { | |||
octave_idx_type nel = this->nelem (); | octave_idx_type nel = this->nelem (); | |||
intNDArray<T> ret (this->dims ()); | intNDArray<T> ret (this->dims ()); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
{ | { | |||
End of changes. 8 change blocks. | ||||
12 lines changed or deleted | 19 lines changed or added | |||
intNDArray.h | intNDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 57 | skipping to change at line 57 | |||
template <class U> | template <class U> | |||
intNDArray (const Array<U>& a) : MArray<T> (a) { } | intNDArray (const Array<U>& a) : MArray<T> (a) { } | |||
template <class U> | template <class U> | |||
intNDArray (const MArray<U>& a) : MArray<T> (a) { } | intNDArray (const MArray<U>& a) : MArray<T> (a) { } | |||
template <class U> | template <class U> | |||
intNDArray (const intNDArray<U>& a) : MArray<T> (a) { } | intNDArray (const intNDArray<U>& a) : MArray<T> (a) { } | |||
intNDArray& operator = (const intNDArray<T>& a) | intNDArray& operator = (const intNDArray<T>& a) | |||
{ | { | |||
MArray<T>::operator = (a); | MArray<T>::operator = (a); | |||
return *this; | return *this; | |||
} | } | |||
boolNDArray operator ! (void) const; | boolNDArray operator ! (void) const; | |||
bool any_element_is_nan (void) const { return false; } | bool any_element_is_nan (void) const { return false; } | |||
bool any_element_not_one_or_zero (void) const; | bool any_element_not_one_or_zero (void) const; | |||
intNDArray diag (octave_idx_type k = 0) const; | intNDArray diag (octave_idx_type k = 0) const; | |||
intNDArray diag (octave_idx_type m, octave_idx_type n) const; | ||||
intNDArray& changesign (void) | intNDArray& changesign (void) | |||
{ | { | |||
MArray<T>::changesign (); | MArray<T>::changesign (); | |||
return *this; | return *this; | |||
} | } | |||
// FIXME -- this is not quite the right thing. | // FIXME: this is not quite the right thing. | |||
boolNDArray all (int dim = -1) const; | boolNDArray all (int dim = -1) const; | |||
boolNDArray any (int dim = -1) const; | boolNDArray any (int dim = -1) const; | |||
intNDArray max (int dim = -1) const; | intNDArray max (int dim = -1) const; | |||
intNDArray max (Array<octave_idx_type>& index, int dim = -1) const; | intNDArray max (Array<octave_idx_type>& index, int dim = -1) const; | |||
intNDArray min (int dim = -1) const; | intNDArray min (int dim = -1) const; | |||
intNDArray min (Array<octave_idx_type>& index, int dim = -1) const; | intNDArray min (Array<octave_idx_type>& index, int dim = -1) const; | |||
intNDArray cummax (int dim = -1) const; | intNDArray cummax (int dim = -1) const; | |||
skipping to change at line 100 | skipping to change at line 102 | |||
intNDArray sum (int dim) const; | intNDArray sum (int dim) const; | |||
NDArray dsum (int dim) const; | NDArray dsum (int dim) const; | |||
intNDArray cumsum (int dim) const; | intNDArray cumsum (int dim) const; | |||
intNDArray diff (octave_idx_type order = 1, int dim = -1) const; | intNDArray diff (octave_idx_type order = 1, int dim = -1) const; | |||
intNDArray abs (void) const; | intNDArray abs (void) const; | |||
intNDArray signum (void) const; | intNDArray signum (void) const; | |||
intNDArray squeeze (void) const | intNDArray squeeze (void) const | |||
{ return intNDArray<T> (MArray<T>::squeeze ()); } | { return intNDArray<T> (MArray<T>::squeeze ()); } | |||
intNDArray transpose (void) const | intNDArray transpose (void) const | |||
{ return intNDArray<T> (MArray<T>::transpose ()); } | { return intNDArray<T> (MArray<T>::transpose ()); } | |||
intNDArray concat (const intNDArray<T>& rb, const Array<octave_idx_type>& | intNDArray concat (const intNDArray<T>& rb, | |||
ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
intNDArray& insert (const intNDArray<T>& a, octave_idx_type r, octave_idx | intNDArray& insert (const intNDArray<T>& a, | |||
_type c); | octave_idx_type r, octave_idx_type c); | |||
intNDArray& insert (const intNDArray<T>& a, const Array<octave_idx_type>& | intNDArray& insert (const intNDArray<T>& a, | |||
ra_idx); | const Array<octave_idx_type>& ra_idx); | |||
static void increment_index (Array<octave_idx_type>& ra_idx, | static void increment_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions, | const dim_vector& dimensions, | |||
int start_dimension = 0); | int start_dimension = 0); | |||
static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, | |||
const dim_vector& dimensions); | const dim_vector& dimensions); | |||
static T resize_fill_value (void) { return 0; } | ||||
}; | }; | |||
// i/o | // i/o | |||
template <class T> | template <class T> | |||
std::ostream& operator << (std::ostream& os, const intNDArray<T>& a); | std::ostream& operator << (std::ostream& os, const intNDArray<T>& a); | |||
template <class T> | template <class T> | |||
std::istream& operator >> (std::istream& is, intNDArray<T>& a); | std::istream& operator >> (std::istream& is, intNDArray<T>& a); | |||
End of changes. 10 change blocks. | ||||
22 lines changed or deleted | 21 lines changed or added | |||
kpse.cc | kpse.cc | |||
---|---|---|---|---|
// This file is not compiled to a separate object file. It is | // This file is not compiled to a separate object file. It is | |||
// included in pathsearch.cc. | // included in pathsearch.cc. | |||
/* Look up a filename in a path. | /* Look up a filename in a path. | |||
Copyright (C) 2003-2013 John W. Eaton | ||||
Copyright (C) 1993, 94, 95, 96, 97, 98 Karl Berry. | Copyright (C) 1993, 94, 95, 96, 97, 98 Karl Berry. | |||
Copyright (C) 1993, 94, 95, 96, 97 Karl Berry & O. Weber. | Copyright (C) 1993, 94, 95, 96, 97 Karl Berry & O. Weber. | |||
Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc. | Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc. | |||
This library is free software; you can redistribute it and/or | This file is part of Octave. | |||
modify it under the terms of the GNU Library General Public | ||||
License as published by the Free Software Foundation; either | Octave is free software; you can redistribute it and/or modify it | |||
version 2 of the License, or (at your option) any later version. | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | ||||
This library is distributed in the hope that it will be useful, | option) any later version. | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
Library General Public License for more details. | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||||
You should have received a copy of the GNU Library General Public | for more details. | |||
License along with this library; if not, write to the Free Software | ||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | You should have received a copy of the GNU General Public License | |||
02110-1301, USA. */ | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | ||||
*/ | ||||
#if defined (HAVE_CONFIG_H) | #if defined (HAVE_CONFIG_H) | |||
#include <config.h> | #include <config.h> | |||
#endif | #endif | |||
#include <map> | #include <map> | |||
#include <string> | #include <string> | |||
/* System defines are for non-Unix systems only. (Testing for all Unix | /* System defines are for non-Unix systems only. (Testing for all Unix | |||
variations should be done in configure.) Presently the defines used | variations should be done in configure.) Presently the defines used | |||
are: DOS OS2 WIN32. I do not use any of these systems | are: DOS OS2 WIN32. I do not use any of these systems | |||
myself; if you do, I'd be grateful for any changes. --kb@mail.tug.org */ | myself; if you do, I'd be grateful for any changes. --kb@mail.tug.org */ | |||
/* If we have either DOS or OS2, we are DOSISH. */ | /* If we have either DOS or OS2, we are DOSISH. */ | |||
#if defined (DOS) || defined (OS2) || defined (WIN32) || defined(__MSDOS__) | #if defined (DOS) || defined (OS2) || defined (WIN32) || defined (__MSDOS__ ) | |||
#define DOSISH | #define DOSISH | |||
#endif | #endif | |||
#if defined (DOSISH) | #if defined (DOSISH) | |||
#define MONOCASE_FILENAMES /* case-insensitive filename comparisons */ | #define MONOCASE_FILENAMES /* case-insensitive filename comparisons */ | |||
#endif | #endif | |||
extern "C" { | extern "C" { | |||
#if defined(__MINGW32__) | #if defined (__MINGW32__) | |||
#include <windows.h> | #include <windows.h> | |||
#include <fcntl.h> | #include <fcntl.h> | |||
#include <dirent.h> | #include <dirent.h> | |||
#elif defined(WIN32) | #elif defined (WIN32) | |||
#ifndef _MSC_VER | #ifndef _MSC_VER | |||
#define __STDC__ 1 | #define __STDC__ 1 | |||
#include "win32lib.h" | #include "win32lib.h" | |||
#endif | #endif | |||
#endif /* not WIN32 */ | #endif /* not WIN32 */ | |||
#ifdef __DJGPP__ | #ifdef __DJGPP__ | |||
#include <fcntl.h> /* for long filenames' stuff */ | #include <fcntl.h> /* for long filenames' stuff */ | |||
#include <dir.h> /* for 'getdisk' */ | #include <dir.h> /* for 'getdisk' */ | |||
#include <io.h> /* for 'setmode' */ | #include <io.h> /* for 'setmode' */ | |||
skipping to change at line 79 | skipping to change at line 83 | |||
/* System dependencies that are figured out by 'configure'. If we are | /* System dependencies that are figured out by 'configure'. If we are | |||
compiling standalone, we get our c-auto.h. Otherwise, the package | compiling standalone, we get our c-auto.h. Otherwise, the package | |||
containing us must provide this (unless it can somehow generate ours | containing us must provide this (unless it can somehow generate ours | |||
from c-auto.in). We use <...> instead of "..." so that the current | from c-auto.in). We use <...> instead of "..." so that the current | |||
cpp directory (i.e., kpathsea/) won't be searched. */ | cpp directory (i.e., kpathsea/) won't be searched. */ | |||
/* If you want to find subdirectories in a directory with non-Unix | /* If you want to find subdirectories in a directory with non-Unix | |||
semantics (specifically, if a directory with no subdirectories does | semantics (specifically, if a directory with no subdirectories does | |||
not have exactly two links), define this. */ | not have exactly two links), define this. */ | |||
#if defined(__DJGPP__) || ! defined (DOSISH) | #if defined (__DJGPP__) || ! defined (DOSISH) | |||
/* Surprise! DJGPP returns st_nlink exactly like on Unix. */ | /* Surprise! DJGPP returns st_nlink exactly like on Unix. */ | |||
#define ST_NLINK_TRICK | #define ST_NLINK_TRICK | |||
#endif /* either not DOSISH or __DJGPP__ */ | #endif /* either not DOSISH or __DJGPP__ */ | |||
#ifdef OS2 | #ifdef OS2 | |||
#define access ln_access | #define access ln_access | |||
#define fopen ln_fopen | #define fopen ln_fopen | |||
#define rename ln_rename | #define rename ln_rename | |||
#define stat ln_stat | #define stat ln_stat | |||
#endif /* OS2 */ | #endif /* OS2 */ | |||
skipping to change at line 102 | skipping to change at line 106 | |||
filenames and environment variable paths. */ | filenames and environment variable paths. */ | |||
/* What separates filename components? */ | /* What separates filename components? */ | |||
#ifndef DIR_SEP | #ifndef DIR_SEP | |||
#ifdef DOSISH | #ifdef DOSISH | |||
/* Either \'s or 's work. Wayne Sullivan's web2pc prefers /, so we'll | /* Either \'s or 's work. Wayne Sullivan's web2pc prefers /, so we'll | |||
go with that. */ | go with that. */ | |||
#define DIR_SEP '/' | #define DIR_SEP '/' | |||
#define DIR_SEP_STRING "/" | #define DIR_SEP_STRING "/" | |||
#define IS_DEVICE_SEP(ch) ((ch) == ':') | #define IS_DEVICE_SEP(ch) ((ch) == ':') | |||
#define NAME_BEGINS_WITH_DEVICE(name) ((name.length()>0) && IS_DEVICE_SEP(( name)[1])) | #define NAME_BEGINS_WITH_DEVICE(name) ((name.length ()>0) && IS_DEVICE_SEP( (name)[1])) | |||
/* On DOS, it's good to allow both \ and / between directories. */ | /* On DOS, it's good to allow both \ and / between directories. */ | |||
#define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\') | #define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\') | |||
#else | #else | |||
#define DIR_SEP '/' | #define DIR_SEP '/' | |||
#define DIR_SEP_STRING "/" | #define DIR_SEP_STRING "/" | |||
#endif /* not DOSISH */ | #endif /* not DOSISH */ | |||
#endif /* not DIR_SEP */ | #endif /* not DIR_SEP */ | |||
#ifndef IS_DIR_SEP | #ifndef IS_DIR_SEP | |||
#define IS_DIR_SEP(ch) ((ch) == DIR_SEP) | #define IS_DIR_SEP(ch) ((ch) == DIR_SEP) | |||
skipping to change at line 132 | skipping to change at line 136 | |||
#include "oct-env.h" | #include "oct-env.h" | |||
#include "oct-passwd.h" | #include "oct-passwd.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
/* Header files that essentially all of our sources need, and | /* Header files that essentially all of our sources need, and | |||
that all implementations have. We include these first, to help with | that all implementations have. We include these first, to help with | |||
NULL being defined multiple times. */ | NULL being defined multiple times. */ | |||
#include <cstdio> | #include <cstdio> | |||
#include <cstdarg> | #include <cstdarg> | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <climits> | ||||
#include <cerrno> | #include <cerrno> | |||
#include <cassert> | #include <cassert> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <unistd.h> | #include <unistd.h> | |||
#include "sysdir.h" | #include "sysdir.h" | |||
#include "statdefs.h" | #include "statdefs.h" | |||
/* define NAME_MAX, the maximum length of a single | /* define NAME_MAX, the maximum length of a single | |||
skipping to change at line 368 | skipping to change at line 371 | |||
assert (! filename.empty () && mode); | assert (! filename.empty () && mode); | |||
f = gnulib::fopen (filename.c_str (), mode); | f = gnulib::fopen (filename.c_str (), mode); | |||
if (! f) | if (! f) | |||
FATAL_PERROR (filename.c_str ()); | FATAL_PERROR (filename.c_str ()); | |||
if (KPSE_DEBUG_P (KPSE_DEBUG_FOPEN)) | if (KPSE_DEBUG_P (KPSE_DEBUG_FOPEN)) | |||
DEBUGF3 ("fopen (%s, %s) => 0x%lx\n", filename.c_str (), mode, | DEBUGF3 ("fopen (%s, %s) => 0x%lx\n", filename.c_str (), mode, | |||
reinterpret_cast<unsigned long> (f)); | reinterpret_cast<intptr_t> (f)); | |||
return f; | return f; | |||
} | } | |||
/* A single (key,value) pair. */ | /* A single (key,value) pair. */ | |||
struct hash_element_type | struct hash_element_type | |||
{ | { | |||
std::string key; | std::string key; | |||
std::string value; | std::string value; | |||
skipping to change at line 456 | skipping to change at line 459 | |||
{ | { | |||
public: | public: | |||
kpse_path_iterator (const std::string& p) | kpse_path_iterator (const std::string& p) | |||
: path (p), b (0), e (0), len (path.length ()) { set_end (); } | : path (p), b (0), e (0), len (path.length ()) { set_end (); } | |||
kpse_path_iterator (const kpse_path_iterator& pi) | kpse_path_iterator (const kpse_path_iterator& pi) | |||
: path (pi.path), b (pi.b), e (pi.e), len (pi.len) { } | : path (pi.path), b (pi.b), e (pi.e), len (pi.len) { } | |||
kpse_path_iterator operator ++ (int) | kpse_path_iterator operator ++ (int) | |||
{ | { | |||
kpse_path_iterator retval (*this); | kpse_path_iterator retval (*this); | |||
next (); | next (); | |||
return retval; | return retval; | |||
} | } | |||
std::string operator * (void) { return path.substr (b, e-b); } | std::string operator * (void) { return path.substr (b, e-b); } | |||
bool operator != (const size_t sz) { return b != sz; } | bool operator != (const size_t sz) { return b != sz; } | |||
private: | private: | |||
const std::string& path; | const std::string& path; | |||
size_t b; | size_t b; | |||
size_t e; | size_t e; | |||
size_t len; | size_t len; | |||
void set_end (void) | void set_end (void) | |||
{ | { | |||
e = b + 1; | e = b + 1; | |||
if (e == len) | if (e == len) | |||
; /* OK, we have found the last element. */ | ; /* OK, we have found the last element. */ | |||
else if (e > len) | else if (e > len) | |||
b = e = std::string::npos; | b = e = std::string::npos; | |||
else | else | |||
{ | { | |||
/* Find the next colon not enclosed by braces (or the end of | /* Find the next colon not enclosed by braces (or the end of | |||
the path). */ | the path). */ | |||
int brace_level = 0; | int brace_level = 0; | |||
while (e < len && ! (brace_level == 0 && kpse_is_env_sep (path[e] | while (e < len && ! (brace_level == 0 && kpse_is_env_sep (path[e])) | |||
))) | ) | |||
e++; | e++; | |||
} | } | |||
} | } | |||
void next (void) | void next (void) | |||
{ | { | |||
b = e + 1; | b = e + 1; | |||
/* Skip any consecutive colons. */ | /* Skip any consecutive colons. */ | |||
while (b < len && kpse_is_env_sep (path[b])) | while (b < len && kpse_is_env_sep (path[b])) | |||
b++; | b++; | |||
if (b >= len) | if (b >= len) | |||
b = e = std::string::npos; | b = e = std::string::npos; | |||
else | else | |||
set_end (); | set_end (); | |||
} | } | |||
// No assignment. | // No assignment. | |||
kpse_path_iterator& operator = (const kpse_path_iterator&); | kpse_path_iterator& operator = (const kpse_path_iterator&); | |||
}; | }; | |||
/* Here's the simple one, when a program just wants a value. */ | /* Here's the simple one, when a program just wants a value. */ | |||
static std::string | static std::string | |||
kpse_var_value (const std::string& var) | kpse_var_value (const std::string& var) | |||
{ | { | |||
skipping to change at line 648 | skipping to change at line 651 | |||
/* Sorry this is such a system-dependent mess, but I can't see any way | /* Sorry this is such a system-dependent mess, but I can't see any way | |||
to usefully generalize. */ | to usefully generalize. */ | |||
static bool | static bool | |||
kpse_absolute_p (const std::string& filename, int relative_ok) | kpse_absolute_p (const std::string& filename, int relative_ok) | |||
{ | { | |||
size_t len = filename.length (); | size_t len = filename.length (); | |||
int absolute = (len > 0 && IS_DIR_SEP (filename[0])) | int absolute = (len > 0 && IS_DIR_SEP (filename[0])) | |||
#ifdef DOSISH | #ifdef DOSISH | |||
/* Novell allows non-alphanumeric drive letters. */ | /* Novell allows non-alphanumeric drive letters. */ | |||
|| (len > 0 && IS_DEVICE_SEP (filename[1])) | || (len > 0 && IS_DEVICE_SEP (filename[1])) | |||
#endif /* DOSISH */ | #endif /* DOSISH */ | |||
#ifdef WIN32 | #ifdef WIN32 | |||
/* UNC names */ | /* UNC names */ | |||
|| (len > 1 && filename[0] == '\\' && filename[1] == '\\') | || (len > 1 && filename[0] == '\\' && filename[1] == '\\') | |||
#endif | #endif | |||
; | ; | |||
int explicit_relative | int explicit_relative | |||
= relative_ok | = relative_ok | |||
&& (len > 1 | && (len > 1 | |||
&& filename[0] == '.' | && filename[0] == '.' | |||
&& (IS_DIR_SEP (filename[1]) | && (IS_DIR_SEP (filename[1]) | |||
|| (len > 2 && filename[1] == '.' && IS_DIR_SEP (filename[2]) ))); | || (len > 2 && filename[1] == '.' && IS_DIR_SEP (filename[2]) ))); | |||
return absolute || explicit_relative; | return absolute || explicit_relative; | |||
} | } | |||
skipping to change at line 711 | skipping to change at line 714 | |||
if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH) || log_file) | if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH) || log_file) | |||
{ | { | |||
/* FILENAMES should never be null, but safety doesn't hurt. */ | /* FILENAMES should never be null, but safety doesn't hurt. */ | |||
for (int e = 0; e < filenames.length () && ! filenames[e].empty (); e ++) | for (int e = 0; e < filenames.length () && ! filenames[e].empty (); e ++) | |||
{ | { | |||
std::string filename = filenames[e]; | std::string filename = filenames[e]; | |||
/* Only record absolute filenames, for privacy. */ | /* Only record absolute filenames, for privacy. */ | |||
if (log_file && kpse_absolute_p (filename.c_str (), false)) | if (log_file && kpse_absolute_p (filename.c_str (), false)) | |||
gnulib::fprintf (log_file, "%lu %s\n", | gnulib::fprintf (log_file, "%lu %s\n", | |||
static_cast<unsigned long> (time (0)), | static_cast<unsigned long> (time (0)), | |||
filename.c_str ()); | filename.c_str ()); | |||
/* And show them online, if debugging. We've already started | /* And show them online, if debugging. We've already started | |||
the debugging line in 'search', where this is called, so | the debugging line in 'search', where this is called, so | |||
just print the filename here, don't use DEBUGF. */ | just print the filename here, don't use DEBUGF. */ | |||
if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH)) | if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH)) | |||
gnulib::fputs (filename.c_str (), stderr); | gnulib::fputs (filename.c_str (), stderr); | |||
} | } | |||
} | } | |||
} | } | |||
skipping to change at line 826 | skipping to change at line 829 | |||
else | else | |||
{ | { | |||
/* We never want to search the whole disk. */ | /* We never want to search the whole disk. */ | |||
while (elt.length () > 1 | while (elt.length () > 1 | |||
&& IS_DIR_SEP (elt[0]) && IS_DIR_SEP (elt[1])) | && IS_DIR_SEP (elt[0]) && IS_DIR_SEP (elt[1])) | |||
elt = elt.substr (1); | elt = elt.substr (1); | |||
} | } | |||
/* Try ls-R, unless we're searching for texmf.cnf. Our caller | /* Try ls-R, unless we're searching for texmf.cnf. Our caller | |||
(search), also tests first_search, and does the resetting. */ | (search), also tests first_search, and does the resetting. */ | |||
found = first_search | found = first_search ? string_vector () : kpse_db_search (name, elt, | |||
? string_vector () : kpse_db_search (name, elt, all); | all); | |||
/* Search the filesystem if (1) the path spec allows it, and either | /* Search the filesystem if (1) the path spec allows it, and either | |||
(2a) we are searching for texmf.cnf ; or | (2a) we are searching for texmf.cnf ; or | |||
(2b) no db exists; or | (2b) no db exists; or | |||
(2c) no db's are relevant to this elt; or | (2c) no db's are relevant to this elt; or | |||
(3) MUST_EXIST && NAME was not in the db. | (3) MUST_EXIST && NAME was not in the db. | |||
In (2*), 'found' will be NULL. | In (2*), 'found' will be NULL. | |||
In (3), 'found' will be an empty list. */ | In (3), 'found' will be an empty list. */ | |||
if (allow_disk_search && found.empty ()) | if (allow_disk_search && found.empty ()) | |||
skipping to change at line 1019 | skipping to change at line 1021 | |||
const std::string dir = STR_LLIST (*dirs_elt); | const std::string dir = STR_LLIST (*dirs_elt); | |||
int len = names.length (); | int len = names.length (); | |||
for (int i = 0; i < len && !done; i++) | for (int i = 0; i < len && !done; i++) | |||
{ | { | |||
std::string name = names[i]; | std::string name = names[i]; | |||
/* Try ls-R, unless we're searching for texmf.cnf. Our calle r | /* Try ls-R, unless we're searching for texmf.cnf. Our calle r | |||
(find_first_of), also tests first_search, and does the | (find_first_of), also tests first_search, and does the | |||
resetting. */ | resetting. */ | |||
found = first_search | found = first_search ? string_vector () | |||
? string_vector () : kpse_db_search (name, dir.c_str (), al | : kpse_db_search (name, dir.c_str (), al | |||
l); | l); | |||
/* Search the filesystem if (1) the path spec allows it, | /* Search the filesystem if (1) the path spec allows it, | |||
and either | and either | |||
(2a) we are searching for texmf.cnf ; or | (2a) we are searching for texmf.cnf ; or | |||
(2b) no db exists; or | (2b) no db exists; or | |||
(2c) no db's are relevant to this elt; or | (2c) no db's are relevant to this elt; or | |||
(3) MUST_EXIST && NAME was not in the db. | (3) MUST_EXIST && NAME was not in the db. | |||
In (2*), 'found' will be NULL. | In (2*), 'found' will be NULL. | |||
skipping to change at line 1481 | skipping to change at line 1483 | |||
} | } | |||
} | } | |||
if (len > 0) | if (len > 0) | |||
ret.resize (len-1); | ret.resize (len-1); | |||
return ret; | return ret; | |||
} | } | |||
/* braces.c -- code for doing word expansion in curly braces. Taken from | /* braces.c -- code for doing word expansion in curly braces. Taken from | |||
bash 1.14.5. [Ans subsequently modified for kpatshea.] | bash 1.14.5. [And subsequently modified for kpatshea.] | |||
Copyright (C) 1987,1991 Free Software Foundation, Inc. | Copyright (C) 1987,1991 Free Software Foundation, Inc. */ | |||
This program is free software; you can redistribute it and/or modify it | ||||
under the terms of the GNU General Public License as published by | ||||
the Free Software Foundation; either version 1, or (at your option) | ||||
any later version. | ||||
This program is distributed in the hope that it will be useful, but | ||||
WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
General Public License for more details. | ||||
You should have received a copy of the GNU General Public License | ||||
along with this program; see the file COPYING. If not, write to the | ||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||||
MA 02110-1301, USA. */ | ||||
#define brace_whitespace(c) (! (c) || (c) == ' ' || (c) == '\t' || (c) == ' \n') | #define brace_whitespace(c) (! (c) || (c) == ' ' || (c) == '\t' || (c) == ' \n') | |||
/* Basic idea: | /* Basic idea: | |||
Segregate the text into 3 sections: preamble (stuff before an open brace ), | Segregate the text into 3 sections: preamble (stuff before an open brace ), | |||
postamble (stuff after the matching close brace) and amble (stuff after | postamble (stuff after the matching close brace) and amble (stuff after | |||
preamble, and before postamble). Expand amble, and then tack on the | preamble, and before postamble). Expand amble, and then tack on the | |||
expansions to preamble. Expand postamble, and tack on the expansions to | expansions to preamble. Expand postamble, and tack on the expansions to | |||
the result so far. */ | the result so far. */ | |||
skipping to change at line 1676 | skipping to change at line 1663 | |||
{ | { | |||
/* We ignore an open brace surrounded by whitespace, and also | /* We ignore an open brace surrounded by whitespace, and also | |||
an open brace followed immediately by a close brace, that | an open brace followed immediately by a close brace, that | |||
was preceded with whitespace. */ | was preceded with whitespace. */ | |||
if (c == '{' && | if (c == '{' && | |||
((i == 0 || brace_whitespace (text[i-1])) && | ((i == 0 || brace_whitespace (text[i-1])) && | |||
(i+1 < text_len && | (i+1 < text_len && | |||
(brace_whitespace (text[i+1]) || text[i+1] == '}')))) | (brace_whitespace (text[i+1]) || text[i+1] == '}')))) | |||
continue; | continue; | |||
/* If this is being compiled as part of bash, ignore the '{' | /* If this is being compiled as part of bash, ignore the '{' | |||
in a '${}' construct */ | in a '${ }' construct */ | |||
if ((c != '{') || i == 0 || (text[i-1] != '$')) | if ((c != '{') || i == 0 || (text[i-1] != '$')) | |||
break; | break; | |||
} | } | |||
if (c == '{') | if (c == '{') | |||
level++; | level++; | |||
else if (c == '}' && level) | else if (c == '}' && level) | |||
level--; | level--; | |||
} | } | |||
skipping to change at line 1844 | skipping to change at line 1831 | |||
size_t i = 0; | size_t i = 0; | |||
while (! found && db_dir[i] == path_elt[i]) | while (! found && db_dir[i] == path_elt[i]) | |||
{ | { | |||
i++; | i++; | |||
/* If we've matched the entire db directory, it's good. */ | /* If we've matched the entire db directory, it's good. */ | |||
if (i == db_dir_len) | if (i == db_dir_len) | |||
found = true; | found = true; | |||
/* If we've reached the end of PATH_ELT, but not the end of the db | /* If we've reached the end of PATH_ELT, but not the end of the db | |||
directory, it's no good. */ | directory, it's no good. */ | |||
else if (i == path_elt_len) | else if (i == path_elt_len) | |||
break; | break; | |||
} | } | |||
return found; | return found; | |||
} | } | |||
/* Avoid doing anything if this PATH_ELT is irrelevant to the databases. */ | /* Avoid doing anything if this PATH_ELT is irrelevant to the databases. */ | |||
/* Return list of matches for NAME in the ls-R file matching PATH_ELT. If | /* Return list of matches for NAME in the ls-R file matching PATH_ELT. If | |||
skipping to change at line 1936 | skipping to change at line 1923 | |||
and the path looks like .../cx, we don't want the ricoh file. */ | and the path looks like .../cx, we don't want the ricoh file. */ | |||
int db_dirs_len = db_dirs.length (); | int db_dirs_len = db_dirs.length (); | |||
for (int j = 0; j < db_dirs_len && !done; j++) | for (int j = 0; j < db_dirs_len && !done; j++) | |||
{ | { | |||
std::string db_file = db_dirs[j] + atry; | std::string db_file = db_dirs[j] + atry; | |||
bool matched = match (db_file, path_elt); | bool matched = match (db_file, path_elt); | |||
#ifdef KPSE_DEBUG | #ifdef KPSE_DEBUG | |||
if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH)) | if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH)) | |||
DEBUGF3 ("db:match (%s,%s) = %d\n", db_file.c_str (), path_elt. | DEBUGF3 ("db:match (%s,%s) = %d\n", | |||
c_str (), matched); | db_file.c_str (), path_elt.c_str (), matched); | |||
#endif | #endif | |||
/* We got a hit in the database. Now see if the file actually | /* We got a hit in the database. Now see if the file actually | |||
exists, possibly under an alias. */ | exists, possibly under an alias. */ | |||
if (matched) | if (matched) | |||
{ | { | |||
std::string found; | std::string found; | |||
std::string tmp = kpse_readable_file (db_file); | std::string tmp = kpse_readable_file (db_file); | |||
if (! tmp.empty ()) | if (! tmp.empty ()) | |||
found = db_file; | found = db_file; | |||
skipping to change at line 2184 | skipping to change at line 2172 | |||
long ret; | long ret; | |||
if (link_table.find (fn) != link_table.end ()) | if (link_table.find (fn) != link_table.end ()) | |||
ret = link_table[fn]; | ret = link_table[fn]; | |||
else | else | |||
{ | { | |||
struct stat stats; | struct stat stats; | |||
ret = stat (fn.c_str (), &stats) == 0 && S_ISDIR (stats.st_mode) | ret = stat (fn.c_str (), &stats) == 0 && S_ISDIR (stats.st_mode) | |||
? stats.st_nlink : static_cast<unsigned> (-1); | ? stats.st_nlink : static_cast<unsigned> (-1); | |||
link_table[fn] = ret; | link_table[fn] = ret; | |||
#ifdef KPSE_DEBUG | #ifdef KPSE_DEBUG | |||
if (KPSE_DEBUG_P (KPSE_DEBUG_STAT)) | if (KPSE_DEBUG_P (KPSE_DEBUG_STAT)) | |||
DEBUGF2 ("dir_links (%s) => %ld\n", fn.c_str (), ret); | DEBUGF2 ("dir_links (%s) => %ld\n", fn.c_str (), ret); | |||
#endif | #endif | |||
} | } | |||
return ret; | return ret; | |||
skipping to change at line 2496 | skipping to change at line 2484 | |||
/* Find the first unmoved element (to insert before). We're | /* Find the first unmoved element (to insert before). We're | |||
guaranteed this will terminate, since MOVER itself is currently | guaranteed this will terminate, since MOVER itself is currently | |||
unmoved, and it must be in L (by hypothesis). */ | unmoved, and it must be in L (by hypothesis). */ | |||
for (last_moved = 0, unmoved = *l; STR_LLIST_MOVED (*unmoved); | for (last_moved = 0, unmoved = *l; STR_LLIST_MOVED (*unmoved); | |||
last_moved = unmoved, unmoved = STR_LLIST_NEXT (*unmoved)) | last_moved = unmoved, unmoved = STR_LLIST_NEXT (*unmoved)) | |||
; | ; | |||
/* If we are the first unmoved element, nothing to relink. */ | /* If we are the first unmoved element, nothing to relink. */ | |||
if (unmoved != mover) | if (unmoved != mover) | |||
{ /* Remember 'mover's current successor, so we can relink 'mover's | { | |||
/* Remember 'mover's current successor, so we can relink 'mover's | ||||
predecessor to it. */ | predecessor to it. */ | |||
str_llist_elt_type *before_mover; | str_llist_elt_type *before_mover; | |||
str_llist_elt_type *after_mover = STR_LLIST_NEXT (*mover); | str_llist_elt_type *after_mover = STR_LLIST_NEXT (*mover); | |||
/* Find 'mover's predecessor. */ | /* Find 'mover's predecessor. */ | |||
for (before_mover = unmoved; STR_LLIST_NEXT (*before_mover) != mover; | for (before_mover = unmoved; STR_LLIST_NEXT (*before_mover) != mover; | |||
before_mover = STR_LLIST_NEXT (*before_mover)) | before_mover = STR_LLIST_NEXT (*before_mover)) | |||
; | ; | |||
/* 'before_mover' now links to 'after_mover'. */ | /* 'before_mover' now links to 'after_mover'. */ | |||
skipping to change at line 2543 | skipping to change at line 2532 | |||
expanding (const std::string& var, bool xp) | expanding (const std::string& var, bool xp) | |||
{ | { | |||
expansions[var] = xp; | expansions[var] = xp; | |||
} | } | |||
/* Return whether VAR is currently being expanding. */ | /* Return whether VAR is currently being expanding. */ | |||
static bool | static bool | |||
expanding_p (const std::string& var) | expanding_p (const std::string& var) | |||
{ | { | |||
return (expansions.find (var) != expansions.end ()) | return (expansions.find (var) != expansions.end ()) ? expansions[var] : f | |||
? expansions[var] : false; | alse; | |||
} | } | |||
/* Append the result of value of 'var' to EXPANSION, where 'var' begins | /* Append the result of value of 'var' to EXPANSION, where 'var' begins | |||
at START and ends at END. If 'var' is not set, do not complain. | at START and ends at END. If 'var' is not set, do not complain. | |||
This is a subroutine for the more complicated expansion function. */ | This is a subroutine for the more complicated expansion function. */ | |||
static void | static void | |||
expand (std::string &expansion, const std::string& var) | expand (std::string &expansion, const std::string& var) | |||
{ | { | |||
if (expanding_p (var)) | if (expanding_p (var)) | |||
End of changes. 28 change blocks. | ||||
92 lines changed or deleted | 81 lines changed or added | |||
lex.h | lex.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 26 | skipping to change at line 26 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_lex_h) | #if !defined (octave_lex_h) | |||
#define octave_lex_h 1 | #define octave_lex_h 1 | |||
#include <deque> | ||||
#include <limits> | ||||
#include <list> | #include <list> | |||
#include <set> | ||||
#include <stack> | #include <stack> | |||
// FIXME -- these input buffer things should be members of a | #include "comment-list.h" | |||
// parser input stream class. | #include "input.h" | |||
#include "token.h" | ||||
typedef struct yy_buffer_state *YY_BUFFER_STATE; | // Is the given string a keyword? | |||
extern bool is_keyword (const std::string& s); | ||||
// Associate a buffer with a new file to read. | // For communication between the lexer and parser. | |||
extern OCTINTERP_API YY_BUFFER_STATE create_buffer (FILE *f); | ||||
// Report the current buffer. | class | |||
extern OCTINTERP_API YY_BUFFER_STATE current_buffer (void); | lexical_feedback | |||
{ | ||||
public: | ||||
// Connect to new buffer buffer. | // Track symbol table information when parsing functions. | |||
extern OCTINTERP_API void switch_to_buffer (YY_BUFFER_STATE buf); | ||||
// Delete a buffer. | class symbol_table_context | |||
extern OCTINTERP_API void delete_buffer (YY_BUFFER_STATE buf); | { | |||
public: | ||||
extern OCTINTERP_API void clear_all_buffers (void); | symbol_table_context (void) : frame_stack () { } | |||
extern OCTINTERP_API void cleanup_parser (void); | void clear (void) | |||
{ | ||||
while (! frame_stack.empty ()) | ||||
frame_stack.pop (); | ||||
} | ||||
// Is the given string a keyword? | bool empty (void) const { return frame_stack.empty (); } | |||
extern bool is_keyword (const std::string& s); | ||||
extern void prep_lexer_for_script_file (void); | void pop (void) | |||
extern void prep_lexer_for_function_file (void); | { | |||
if (empty ()) | ||||
panic_impossible (); | ||||
// For communication between the lexer and parser. | frame_stack.pop (); | |||
} | ||||
class | void push (symbol_table::scope_id scope = symbol_table::current_scope ( | |||
lexical_feedback | )) | |||
{ | { | |||
public: | frame_stack.push (scope); | |||
} | ||||
lexical_feedback (void) | symbol_table::scope_id curr_scope (void) const | |||
{ | ||||
return empty () ? symbol_table::current_scope () : frame_stack.top () | ||||
; | ||||
} | ||||
private: | ||||
std::stack<symbol_table::scope_id> frame_stack; | ||||
}; | ||||
// Track nesting of square brackets, curly braces, and parentheses. | ||||
class bbp_nesting_level | ||||
{ | ||||
private: | ||||
enum bracket_type | ||||
{ | ||||
BRACKET = 1, | ||||
BRACE = 2, | ||||
PAREN = 3, | ||||
ANON_FCN_BODY = 4 | ||||
}; | ||||
public: | ||||
bbp_nesting_level (void) : context () { } | ||||
bbp_nesting_level (const bbp_nesting_level& nl) : context (nl.context) | ||||
{ } | ||||
bbp_nesting_level& operator = (const bbp_nesting_level& nl) | ||||
{ | ||||
if (&nl != this) | ||||
context = nl.context; | ||||
return *this; | ||||
} | ||||
~bbp_nesting_level (void) { } | ||||
void reset (void) | ||||
{ | ||||
while (! context.empty ()) | ||||
context.pop (); | ||||
} | ||||
void bracket (void) { context.push (BRACKET); } | ||||
bool is_bracket (void) | ||||
{ | ||||
return ! context.empty () && context.top () == BRACKET; | ||||
} | ||||
void brace (void) { context.push (BRACE); } | ||||
bool is_brace (void) | ||||
{ | ||||
return ! context.empty () && context.top () == BRACE; | ||||
} | ||||
void paren (void) { context.push (PAREN); } | ||||
bool is_paren (void) | ||||
{ | ||||
return ! context.empty () && context.top () == PAREN; | ||||
} | ||||
void anon_fcn_body (void) { context.push (ANON_FCN_BODY); } | ||||
bool is_anon_fcn_body (void) | ||||
{ | ||||
return ! context.empty () && context.top () == ANON_FCN_BODY; | ||||
} | ||||
bool is_bracket_or_brace (void) | ||||
{ | ||||
return (! context.empty () | ||||
&& (context.top () == BRACKET || context.top () == BRACE)); | ||||
} | ||||
bool none (void) { return context.empty (); } | ||||
void remove (void) | ||||
{ | ||||
if (! context.empty ()) | ||||
context.pop (); | ||||
} | ||||
void clear (void) | ||||
{ | ||||
while (! context.empty ()) | ||||
context.pop (); | ||||
} | ||||
private: | ||||
std::stack<int> context; | ||||
}; | ||||
class token_cache | ||||
{ | ||||
public: | ||||
// Store an "unlimited" number of tokens. | ||||
token_cache (size_t sz_arg = std::numeric_limits<size_t>::max ()) | ||||
: buffer (), sz (sz_arg) | ||||
{ } | ||||
void push (token *tok) | ||||
{ | ||||
if (buffer.size () == sz) | ||||
pop (); | ||||
buffer.push_front (tok); | ||||
} | ||||
void pop (void) | ||||
{ | ||||
if (! empty ()) | ||||
{ | ||||
delete buffer.back (); | ||||
buffer.pop_back (); | ||||
} | ||||
} | ||||
// Direct access. | ||||
token *at (size_t n) | ||||
{ | ||||
return empty () ? 0 : buffer.at (n); | ||||
} | ||||
const token *at (size_t n) const | ||||
{ | ||||
return empty () ? 0 : buffer.at (n); | ||||
} | ||||
// Most recently pushed. | ||||
token *front (void) | ||||
{ | ||||
return empty () ? 0 : buffer.front (); | ||||
} | ||||
const token *front (void) const | ||||
{ | ||||
return empty () ? 0 : buffer.front (); | ||||
} | ||||
token *back (void) | ||||
{ | ||||
return empty () ? 0 : buffer.back (); | ||||
} | ||||
const token *back (void) const | ||||
{ | ||||
return empty () ? 0 : buffer.back (); | ||||
} | ||||
// Number of elements currently in the buffer, max of sz. | ||||
size_t size (void) const { return buffer.size (); } | ||||
: bracketflag (0), braceflag (0), looping (0), | bool empty (void) const { return buffer.empty (); } | |||
convert_spaces_to_comma (true), at_beginning_of_statement (true), | ||||
defining_func (0), looking_at_function_handle (0), | ||||
looking_at_anon_fcn_args (true), | ||||
looking_at_return_list (false), looking_at_parameter_list (false), | ||||
looking_at_decl_list (false), looking_at_initializer_expression (fals | ||||
e), | ||||
looking_at_matrix_or_assign_lhs (false), looking_at_object_index (), | ||||
looking_for_object_index (false), do_comma_insert (false), | ||||
looking_at_indirect_ref (false), parsed_function_name (), | ||||
parsing_class_method (false), maybe_classdef_get_set_method (false), | ||||
parsing_classdef (false), quote_is_transpose (false), | ||||
pending_local_variables () | ||||
void clear (void) | ||||
{ | { | |||
init (); | while (! empty ()) | |||
pop (); | ||||
} | } | |||
~lexical_feedback (void) { } | private: | |||
std::deque<token *> buffer; | ||||
size_t sz; | ||||
// No copying! | ||||
token_cache (const token_cache&); | ||||
token_cache& operator = (const token_cache&); | ||||
}; | ||||
lexical_feedback (void) | ||||
: end_of_input (false), at_beginning_of_statement (true), | ||||
looking_at_anon_fcn_args (false), looking_at_return_list (false), | ||||
looking_at_parameter_list (false), looking_at_decl_list (false), | ||||
looking_at_initializer_expression (false), | ||||
looking_at_matrix_or_assign_lhs (false), | ||||
looking_for_object_index (false), | ||||
looking_at_indirect_ref (false), parsing_class_method (false), | ||||
maybe_classdef_get_set_method (false), parsing_classdef (false), | ||||
quote_is_transpose (false), force_script (false), | ||||
reading_fcn_file (false), reading_script_file (false), | ||||
reading_classdef_file (false), | ||||
input_line_number (1), current_input_column (1), | ||||
bracketflag (0), braceflag (0), | ||||
looping (0), defining_func (0), looking_at_function_handle (0), | ||||
block_comment_nesting_level (0), token_count (0), | ||||
current_input_line (), comment_text (), help_text (), | ||||
string_text (), string_line (0), string_column (0), | ||||
fcn_file_name (), fcn_file_full_name (), looking_at_object_index (), | ||||
parsed_function_name (), pending_local_variables (), | ||||
symtab_context (), nesting_level (), tokens () | ||||
{ | ||||
init (); | ||||
} | ||||
~lexical_feedback (void); | ||||
void init (void); | void init (void); | |||
// Square bracket level count. | void reset (void); | |||
int bracketflag; | ||||
// Curly brace level count. | int previous_token_value (void) const; | |||
int braceflag; | ||||
// TRUE means we're in the middle of defining a loop. | bool previous_token_value_is (int tok_val) const; | |||
int looping; | ||||
// TRUE means that we should convert spaces to a comma inside a | void mark_previous_token_trailing_space (void); | |||
// matrix definition. | ||||
bool convert_spaces_to_comma; | ||||
// TRUE means we are at the beginning of a statement, where a | bool space_follows_previous_token (void) const; | |||
// command name is possible. | ||||
bool at_beginning_of_statement; | ||||
// Nonzero means we're in the middle of defining a function. | bool previous_token_is_binop (void) const; | |||
int defining_func; | ||||
// Nonzero means we are parsing a function handle. | bool previous_token_is_keyword (void) const; | |||
int looking_at_function_handle; | ||||
bool previous_token_may_be_command (void) const; | ||||
void maybe_mark_previous_token_as_variable (void); | ||||
void mark_as_variable (const std::string& nm); | ||||
void mark_as_variables (const std::list<std::string>& lst); | ||||
// true means that we have encountered eof on the input stream. | ||||
bool end_of_input; | ||||
// true means we are at the beginning of a statement, where a | ||||
// command name is possible. | ||||
bool at_beginning_of_statement; | ||||
// TRUE means we are parsing an anonymous function argument list. | // true means we are parsing an anonymous function argument list. | |||
bool looking_at_anon_fcn_args; | bool looking_at_anon_fcn_args; | |||
// TRUE means we're parsing the return list for a function. | // true means we're parsing the return list for a function. | |||
bool looking_at_return_list; | bool looking_at_return_list; | |||
// TRUE means we're parsing the parameter list for a function. | // true means we're parsing the parameter list for a function. | |||
bool looking_at_parameter_list; | bool looking_at_parameter_list; | |||
// TRUE means we're parsing a declaration list (global or | // true means we're parsing a declaration list (global or | |||
// persistent). | // persistent). | |||
bool looking_at_decl_list; | bool looking_at_decl_list; | |||
// TRUE means we are looking at the initializer expression for a | // true means we are looking at the initializer expression for a | |||
// parameter list element. | // parameter list element. | |||
bool looking_at_initializer_expression; | bool looking_at_initializer_expression; | |||
// TRUE means we're parsing a matrix or the left hand side of | // true means we're parsing a matrix or the left hand side of | |||
// multi-value assignment statement. | // multi-value assignment statement. | |||
bool looking_at_matrix_or_assign_lhs; | bool looking_at_matrix_or_assign_lhs; | |||
// If the front of the list is TRUE, the closest paren, brace, or | // object index not possible until we've seen something. | |||
// bracket nesting is an index for an object. | ||||
std::list<bool> looking_at_object_index; | ||||
// Object index not possible until we've seen something. | ||||
bool looking_for_object_index; | bool looking_for_object_index; | |||
// GAG. Stupid kludge so that [[1,2][3,4]] will work. | // true means we're looking at an indirect reference to a | |||
bool do_comma_insert; | ||||
// TRUE means we're looking at an indirect reference to a | ||||
// structure element. | // structure element. | |||
bool looking_at_indirect_ref; | bool looking_at_indirect_ref; | |||
// If the top of the stack is TRUE, then we've already seen the name | // true means we are parsing a class method in function or classdef file. | |||
// of the current function. Should only matter if | ||||
// current_function_level > 0 | ||||
std::stack<bool> parsed_function_name; | ||||
// TRUE means we are parsing a class method in function or classdef file. | ||||
bool parsing_class_method; | bool parsing_class_method; | |||
// TRUE means we are parsing a class method declaration line in a | // true means we are parsing a class method declaration line in a | |||
// classdef file and can accept a property get or set method name. | // classdef file and can accept a property get or set method name. | |||
// For example, "get.PropertyName" is recognized as a function name. | // for example, "get.propertyname" is recognized as a function name. | |||
bool maybe_classdef_get_set_method; | bool maybe_classdef_get_set_method; | |||
// TRUE means we are parsing a classdef file | // true means we are parsing a classdef file | |||
bool parsing_classdef; | bool parsing_classdef; | |||
// Return transpose or start a string? | // return transpose or start a string? | |||
bool quote_is_transpose; | bool quote_is_transpose; | |||
// Set of identifiers that might be local variable names. | // TRUE means treat the current file as a script even if the first | |||
// token is "function" or "classdef". | ||||
bool force_script; | ||||
// TRUE means we're parsing a function file. | ||||
bool reading_fcn_file; | ||||
// TRUE means we're parsing a script file. | ||||
bool reading_script_file; | ||||
// TRUE means we're parsing a classdef file. | ||||
bool reading_classdef_file; | ||||
// the current input line number. | ||||
int input_line_number; | ||||
// the column of the current token. | ||||
int current_input_column; | ||||
// square bracket level count. | ||||
int bracketflag; | ||||
// curly brace level count. | ||||
int braceflag; | ||||
// true means we're in the middle of defining a loop. | ||||
int looping; | ||||
// nonzero means we're in the middle of defining a function. | ||||
int defining_func; | ||||
// nonzero means we are parsing a function handle. | ||||
int looking_at_function_handle; | ||||
// nestng level for blcok comments. | ||||
int block_comment_nesting_level; | ||||
// Count of tokens recognized by this lexer since initialized or | ||||
// since the last reset. | ||||
size_t token_count; | ||||
// The current line of input. | ||||
std::string current_input_line; | ||||
// The current comment text. | ||||
std::string comment_text; | ||||
// The current help text. | ||||
std::string help_text; | ||||
// The current character string text. | ||||
std::string string_text; | ||||
// The position of the beginning of the current character string. | ||||
int string_line; | ||||
int string_column; | ||||
// Simple name of function file we are reading. | ||||
std::string fcn_file_name; | ||||
// Full name of file we are reading. | ||||
std::string fcn_file_full_name; | ||||
// if the front of the list is true, the closest paren, brace, or | ||||
// bracket nesting is an index for an object. | ||||
std::list<bool> looking_at_object_index; | ||||
// if the top of the stack is true, then we've already seen the name | ||||
// of the current function. should only matter if | ||||
// current_function_level > 0 | ||||
std::stack<bool> parsed_function_name; | ||||
// set of identifiers that might be local variable names. | ||||
std::set<std::string> pending_local_variables; | std::set<std::string> pending_local_variables; | |||
// Track current symbol table scope and context. | ||||
symbol_table_context symtab_context; | ||||
// is the closest nesting level a square bracket, squiggly brace, | ||||
// a paren, or an anonymous function body? | ||||
bbp_nesting_level nesting_level; | ||||
// Tokens generated by the lexer. | ||||
token_cache tokens; | ||||
private: | private: | |||
// No copying! | ||||
lexical_feedback (const lexical_feedback&); | lexical_feedback (const lexical_feedback&); | |||
lexical_feedback& operator = (const lexical_feedback&); | lexical_feedback& operator = (const lexical_feedback&); | |||
}; | }; | |||
// octave_base_lexer inherits from lexical_feedback because we will | ||||
// eventually have several different constructors and it is easier to | ||||
// intialize if everything is grouped in a parent class rather than | ||||
// listing all the members in the octave_base_lexer class. | ||||
class | class | |||
stream_reader | octave_base_lexer : public lexical_feedback | |||
{ | { | |||
public: | public: | |||
virtual int getc (void) = 0; | ||||
virtual int ungetc (int c) = 0; | // Handle buffering of input for lexer. | |||
class input_buffer | ||||
{ | ||||
public: | ||||
input_buffer (void) | ||||
: buffer (), pos (0), chars_left (0), eof (false) | ||||
{ } | ||||
void fill (const std::string& input, bool eof_arg); | ||||
// Copy at most max_size characters to buf. | ||||
int copy_chunk (char *buf, size_t max_size); | ||||
bool empty (void) const { return chars_left == 0; } | ||||
bool at_eof (void) const { return eof; } | ||||
private: | ||||
std::string buffer; | ||||
const char *pos; | ||||
size_t chars_left; | ||||
bool eof; | ||||
}; | ||||
// Collect comment text. | ||||
class | ||||
comment_buffer | ||||
{ | ||||
public: | ||||
comment_buffer (void) : comment_list (0) { } | ||||
~comment_buffer (void) { delete comment_list; } | ||||
void append (const std::string& s, octave_comment_elt::comment_type t) | ||||
{ | ||||
if (! comment_list) | ||||
comment_list = new octave_comment_list (); | ||||
comment_list->append (s, t); | ||||
} | ||||
// Caller is expected to delete the returned value. | ||||
octave_comment_list *get_comment (void) | ||||
{ | ||||
octave_comment_list *retval = comment_list; | ||||
comment_list = 0; | ||||
return retval; | ||||
} | ||||
void reset (void) | ||||
{ | ||||
delete comment_list; | ||||
comment_list = 0; | ||||
} | ||||
private: | ||||
octave_comment_list *comment_list; | ||||
}; | ||||
octave_base_lexer (void) | ||||
: lexical_feedback (), scanner (0), input_buf (), comment_buf () | ||||
{ | ||||
init (); | ||||
} | ||||
virtual ~octave_base_lexer (void); | ||||
void init (void); | ||||
virtual bool is_push_lexer (void) const { return false; } | ||||
virtual void reset (void); | ||||
void prep_for_file (void); | ||||
void begin_string (int state); | ||||
virtual int fill_flex_buffer (char *buf, unsigned int max_size) = 0; | ||||
bool at_end_of_buffer (void) const { return input_buf.empty (); } | ||||
bool at_end_of_file (void) const { return input_buf.at_eof (); } | ||||
int handle_end_of_input (void); | ||||
char *flex_yytext (void); | ||||
int flex_yyleng (void); | ||||
int text_yyinput (void); | ||||
void xunput (char c, char *buf); | ||||
void xunput (char c); | ||||
bool looking_at_space (void); | ||||
bool inside_any_object_index (void); | ||||
bool is_variable (const std::string& name); | ||||
int is_keyword_token (const std::string& s); | ||||
bool whitespace_is_significant (void); | ||||
void handle_number (void); | ||||
void handle_continuation (void); | ||||
void finish_comment (octave_comment_elt::comment_type typ); | ||||
octave_comment_list *get_comment (void) { return comment_buf.get_comment | ||||
(); } | ||||
int handle_close_bracket (int bracket_type); | ||||
bool looks_like_command_arg (void); | ||||
int handle_superclass_identifier (void); | ||||
int handle_meta_identifier (void); | ||||
int handle_identifier (void); | ||||
void maybe_warn_separator_insert (char sep); | ||||
void gripe_single_quote_string (void); | ||||
void gripe_matlab_incompatible (const std::string& msg); | ||||
void maybe_gripe_matlab_incompatible_comment (char c); | ||||
void gripe_matlab_incompatible_continuation (void); | ||||
void gripe_matlab_incompatible_operator (const std::string& op); | ||||
void push_token (token *); | ||||
token *current_token (void); | ||||
void display_token (int tok); | ||||
void fatal_error (const char *msg); | ||||
void lexer_debug (const char *pattern); | ||||
// Internal state of the flex-generated lexer. | ||||
void *scanner; | ||||
// Object that reads and buffers input. | ||||
input_buffer input_buf; | ||||
// Object that collects comment text. | ||||
comment_buffer comment_buf; | ||||
virtual void increment_promptflag (void) = 0; | ||||
virtual void decrement_promptflag (void) = 0; | ||||
virtual int promptflag (void) const = 0; | ||||
virtual int promptflag (int) = 0; | ||||
virtual std::string input_source (void) const { return "unknown"; } | ||||
virtual bool input_from_terminal (void) const { return false; } | ||||
virtual bool input_from_file (void) const { return false; } | ||||
virtual bool input_from_eval_string (void) const { return false; } | ||||
void push_start_state (int state); | ||||
void pop_start_state (void); | ||||
void clear_start_state (void); | ||||
int start_state (void) const { return start_state_stack.top (); } | ||||
void display_start_state (void) const; | ||||
int handle_op (const char *pattern, int tok, bool bos = false); | ||||
int handle_incompatible_op (const char *pattern, int tok, bool bos = fals | ||||
e); | ||||
bool maybe_unput_comma_before_unary_op (int tok); | ||||
int handle_unary_op (int tok, bool bos = false); | ||||
int handle_incompatible_unary_op (int tok, bool bos = false); | ||||
int handle_assign_op (const char *pattern, int tok); | ||||
int handle_incompatible_assign_op (const char *pattern, int tok); | ||||
int handle_op_internal (int tok, bool bos, bool compat); | ||||
int handle_token (const std::string& name, int tok); | ||||
int handle_token (int tok, token *tok_val = 0); | ||||
int count_token (int tok); | ||||
int count_token_internal (int tok); | ||||
int show_token (int tok); | ||||
protected: | protected: | |||
stream_reader (void) { } | ||||
~stream_reader (void) { } | ||||
private: | std::stack<int> start_state_stack; | |||
// No copying! | // No copying! | |||
stream_reader (const stream_reader&); | ||||
stream_reader& operator = (const stream_reader&); | octave_base_lexer (const octave_base_lexer&); | |||
octave_base_lexer& operator = (const octave_base_lexer&); | ||||
}; | }; | |||
extern std::string | class | |||
grab_comment_block (stream_reader& reader, bool at_bol, bool& eof); | octave_lexer : public octave_base_lexer | |||
{ | ||||
public: | ||||
octave_lexer (void) | ||||
: octave_base_lexer (), input_reader (this) | ||||
{ } | ||||
octave_lexer (FILE *file) | ||||
: octave_base_lexer (), input_reader (file, this) | ||||
{ } | ||||
octave_lexer (const std::string& eval_string) | ||||
: octave_base_lexer (), input_reader (eval_string, this) | ||||
{ } | ||||
void reset (void) | ||||
{ | ||||
input_reader.reset (); | ||||
octave_base_lexer::reset (); | ||||
} | ||||
// TRUE means that we have encountered EOF on the input stream. | void increment_promptflag (void) { input_reader.increment_promptflag (); | |||
extern bool parser_end_of_input; | } | |||
// Flags that need to be shared between the lexer and parser. | void decrement_promptflag (void) { input_reader.decrement_promptflag (); | |||
extern lexical_feedback lexer_flags; | } | |||
int promptflag (void) const { return input_reader.promptflag (); } | ||||
int promptflag (int n) { return input_reader.promptflag (n); } | ||||
std::string input_source (void) const | ||||
{ | ||||
return input_reader.input_source (); | ||||
} | ||||
bool input_from_terminal (void) const | ||||
{ | ||||
return input_reader.input_from_terminal (); | ||||
} | ||||
bool input_from_file (void) const | ||||
{ | ||||
return input_reader.input_from_file (); | ||||
} | ||||
bool input_from_eval_string (void) const | ||||
{ | ||||
return input_reader.input_from_eval_string (); | ||||
} | ||||
int fill_flex_buffer (char *buf, unsigned int max_size); | ||||
octave_input_reader input_reader; | ||||
protected: | ||||
// No copying! | ||||
octave_lexer (const octave_lexer&); | ||||
octave_lexer& operator = (const octave_lexer&); | ||||
}; | ||||
class | ||||
octave_push_lexer : public octave_base_lexer | ||||
{ | ||||
public: | ||||
octave_push_lexer (const std::string& input = std::string (), | ||||
bool eof = false) | ||||
: octave_base_lexer (), pflag (1) | ||||
{ | ||||
append_input (input, eof); | ||||
} | ||||
bool is_push_lexer (void) const { return true; } | ||||
void reset (void) | ||||
{ | ||||
promptflag (1); | ||||
octave_base_lexer::reset (); | ||||
} | ||||
void append_input (const std::string& input, bool eof) | ||||
{ | ||||
input_buf.fill (input, eof); | ||||
} | ||||
void increment_promptflag (void) { pflag++; } | ||||
void decrement_promptflag (void) { pflag--; } | ||||
int promptflag (void) const { return pflag; } | ||||
int promptflag (int n) | ||||
{ | ||||
int retval = pflag; | ||||
pflag = n; | ||||
return retval; | ||||
} | ||||
std::string input_source (void) const { return "push buffer"; } | ||||
int fill_flex_buffer (char *buf, unsigned int max_size); | ||||
protected: | ||||
int pflag; | ||||
// No copying! | ||||
octave_push_lexer (const octave_push_lexer&); | ||||
octave_push_lexer& operator = (const octave_push_lexer&); | ||||
}; | ||||
#endif | #endif | |||
End of changes. 52 change blocks. | ||||
95 lines changed or deleted | 706 lines changed or added | |||
lo-array-gripes.h | lo-array-gripes.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2000-2012 John W. Eaton | Copyright (C) 2000-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_liboctave_array_gripes_h) | #if !defined (octave_lo_array_gripes_h) | |||
#define octave_liboctave_array_gripes_h 1 | #define octave_lo_array_gripes_h 1 | |||
#include "dim-vector.h" | #include "dim-vector.h" | |||
extern OCTAVE_API const char *error_id_nonconformant_args; | extern OCTAVE_API const char *error_id_nonconformant_args; | |||
extern OCTAVE_API const char *error_id_index_out_of_bounds; | extern OCTAVE_API const char *error_id_index_out_of_bounds; | |||
extern OCTAVE_API const char *error_id_invalid_index; | extern OCTAVE_API const char *error_id_invalid_index; | |||
extern void OCTAVE_API | extern void OCTAVE_API | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
lo-cutils.h | lo-cutils.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2012 John W. Eaton | Copyright (C) 2012-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_liboctave_cutils_h) | #if !defined (octave_lo_cutils_h) | |||
#define octave_liboctave_cutils_h 1 | #define octave_lo_cutils_h 1 | |||
#include "sys/types.h" | #include <sys/types.h> | |||
#ifdef HAVE_LOADLIBRARY_API | #ifdef HAVE_LOADLIBRARY_API | |||
#define WIN32_LEAN_AND_MEAN | #define WIN32_LEAN_AND_MEAN | |||
#include <windows.h> | #include <windows.h> | |||
#endif | #endif | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
skipping to change at line 55 | skipping to change at line 55 | |||
octave_strncasecmp (const char *s1, const char *s2, size_t n); | octave_strncasecmp (const char *s1, const char *s2, size_t n); | |||
#ifdef HAVE_LOADLIBRARY_API | #ifdef HAVE_LOADLIBRARY_API | |||
OCTAVE_API void * | OCTAVE_API void * | |||
octave_w32_library_search (HINSTANCE handle, const char *name); | octave_w32_library_search (HINSTANCE handle, const char *name); | |||
#endif | #endif | |||
OCTAVE_API pid_t | OCTAVE_API pid_t | |||
octave_waitpid (pid_t pid, int *status, int options); | octave_waitpid (pid_t pid, int *status, int options); | |||
OCTAVE_API int octave_wifexited (int status); | ||||
OCTAVE_API int octave_wexitstatus (int status); | ||||
OCTAVE_API int octave_wifsignaled (int status); | ||||
OCTAVE_API int octave_wtermsig (int status); | ||||
OCTAVE_API int octave_wcoredump (int status); | ||||
OCTAVE_API int octave_wifstopped (int status); | ||||
OCTAVE_API int octave_wstopsig (int status); | ||||
OCTAVE_API int octave_wifcontinued (int status); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 13 lines changed or added | |||
lo-error.h | lo-error.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_liboctave_error_h) | #if !defined (octave_lo_error_h) | |||
#define octave_liboctave_error_h 1 | #define octave_lo_error_h 1 | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
extern void liboctave_fatal (const char *fmt, ...) GCC_ATTR_NORETURN; | extern void liboctave_fatal (const char *fmt, ...) GCC_ATTR_NORETURN; | |||
extern void liboctave_fatal_with_id (const char *id, const char *fmt, ...) GCC_ATTR_NORETURN; | extern void liboctave_fatal_with_id (const char *id, const char *fmt, ...) GCC_ATTR_NORETURN; | |||
extern void liboctave_warning (const char *fmt, ...); | extern void liboctave_warning (const char *fmt, ...); | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
lo-ieee.h | lo-ieee.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_liboctave_ieee_h) | #if !defined (octave_lo_ieee_h) | |||
#define octave_liboctave_ieee_h 1 | #define octave_lo_ieee_h 1 | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/* Octave's idea of infinity. */ | /* Octave's idea of infinity. */ | |||
extern OCTAVE_API double octave_Inf; | extern OCTAVE_API double octave_Inf; | |||
/* Octave's idea of a missing value. */ | /* Octave's idea of a missing value. */ | |||
extern OCTAVE_API double octave_NA; | extern OCTAVE_API double octave_NA; | |||
skipping to change at line 120 | skipping to change at line 120 | |||
#define lo_ieee_isinf(x) (sizeof (x) == sizeof (float) ? \ | #define lo_ieee_isinf(x) (sizeof (x) == sizeof (float) ? \ | |||
__lo_ieee_float_isinf (x) : __lo_ieee_isinf (x)) | __lo_ieee_float_isinf (x) : __lo_ieee_isinf (x)) | |||
#define lo_ieee_is_NA(x) (sizeof (x) == sizeof (float) ? \ | #define lo_ieee_is_NA(x) (sizeof (x) == sizeof (float) ? \ | |||
__lo_ieee_float_is_NA (x) : __lo_ieee_is_NA (x)) | __lo_ieee_float_is_NA (x) : __lo_ieee_is_NA (x)) | |||
#define lo_ieee_is_NaN_or_NA(x) (sizeof (x) == sizeof (float) ? \ | #define lo_ieee_is_NaN_or_NA(x) (sizeof (x) == sizeof (float) ? \ | |||
__lo_ieee_float_is_NaN_or_NA (x) : __lo_ieee_is_N aN_or_NA (x)) | __lo_ieee_float_is_NaN_or_NA (x) : __lo_ieee_is_N aN_or_NA (x)) | |||
#define lo_ieee_signbit(x) (sizeof (x) == sizeof (float) ? \ | #define lo_ieee_signbit(x) (sizeof (x) == sizeof (float) ? \ | |||
__lo_ieee_float_signbit (x) : __lo_ieee_signbit ( x)) | __lo_ieee_float_signbit (x) : __lo_ieee_signbit ( x)) | |||
#ifdef __cplusplus | ||||
template <typename T> | ||||
struct octave_numeric_limits | ||||
{ | ||||
static T NA (void) { return static_cast<T> (0); } | ||||
}; | ||||
template <> | ||||
struct octave_numeric_limits<double> | ||||
{ | ||||
static double NA (void) { return octave_NA; } | ||||
}; | ||||
template <> | ||||
struct octave_numeric_limits<float> | ||||
{ | ||||
static float NA (void) { return octave_Float_NA; } | ||||
}; | ||||
#endif | ||||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 25 lines changed or added | |||
lo-macros.h | lo-macros.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2010-2012 VZLU Prague | Copyright (C) 2010-2013 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_liboctave_macros_h) | #if !defined (octave_lo_macros_h) | |||
#define octave_liboctave_macros_h 1 | #define octave_lo_macros_h 1 | |||
// Core macros. Iteration is supported up to count 10. | // Core macros. Iteration is supported up to count 10. | |||
#define OCT_ITERATE_PARAM_MACRO0(MACRO, PARAM) | #define OCT_ITERATE_PARAM_MACRO0(MACRO, PARAM) | |||
#define OCT_ITERATE_PARAM_MACRO1(MACRO, PARAM) \ | #define OCT_ITERATE_PARAM_MACRO1(MACRO, PARAM) \ | |||
MACRO(0, PARAM) | MACRO(0, PARAM) | |||
#define OCT_ITERATE_PARAM_MACRO2(MACRO, PARAM) \ | #define OCT_ITERATE_PARAM_MACRO2(MACRO, PARAM) \ | |||
MACRO(0, PARAM) MACRO(1, PARAM) | MACRO(0, PARAM) MACRO(1, PARAM) | |||
#define OCT_ITERATE_PARAM_MACRO3(MACRO, PARAM) \ | #define OCT_ITERATE_PARAM_MACRO3(MACRO, PARAM) \ | |||
MACRO(0, PARAM) MACRO(1, PARAM) MACRO(2, PARAM) | MACRO(0, PARAM) MACRO(1, PARAM) MACRO(2, PARAM) | |||
skipping to change at line 95 | skipping to change at line 95 | |||
#define OCT_MAKE_LIST(MACRO, NUM) OCT_ITERATE_PARAM_MACRO(OCT_MAKE_LIST_HEL PER, MACRO, NUM) | #define OCT_MAKE_LIST(MACRO, NUM) OCT_ITERATE_PARAM_MACRO(OCT_MAKE_LIST_HEL PER, MACRO, NUM) | |||
#define OCT_MAKE_DECL_LIST_HELPER(NUM, PREFIX) \ | #define OCT_MAKE_DECL_LIST_HELPER(NUM, PREFIX) \ | |||
OCT_IF_PARAM(NUM,OCT_MAKE_LIST_HELPER1,) OCT_CONCAT2(PREFIX, NUM) | OCT_IF_PARAM(NUM,OCT_MAKE_LIST_HELPER1,) OCT_CONCAT2(PREFIX, NUM) | |||
// expands to TYPE PREFIX0, TYPE PREFIX1, ..., TYPE PREFIX ## (NUM-1) | // expands to TYPE PREFIX0, TYPE PREFIX1, ..., TYPE PREFIX ## (NUM-1) | |||
#define OCT_MAKE_DECL_LIST(TYPE, PREFIX, NUM) \ | #define OCT_MAKE_DECL_LIST(TYPE, PREFIX, NUM) \ | |||
OCT_ITERATE_PARAM_MACRO(OCT_MAKE_DECL_LIST_HELPER, TYPE PREFIX, NUM) | OCT_ITERATE_PARAM_MACRO(OCT_MAKE_DECL_LIST_HELPER, TYPE PREFIX, NUM) | |||
// expands to PREFIX0, PREFIX1, ..., PREFIX ## (NUM-1) | ||||
#define OCT_MAKE_ARG_LIST(PREFIX, NUM) \ | ||||
OCT_ITERATE_PARAM_MACRO(OCT_MAKE_DECL_LIST_HELPER, PREFIX, NUM) | ||||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 7 lines changed or added | |||
lo-mappers.h | lo-mappers.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_liboctave_mappers_h) | #if !defined (octave_lo_mappers_h) | |||
#define octave_liboctave_mappers_h 1 | #define octave_lo_mappers_h 1 | |||
#include <limits> | #include <limits> | |||
#include "oct-cmplx.h" | #include "oct-cmplx.h" | |||
#include "lo-math.h" | #include "lo-math.h" | |||
// Double Precision | // Double Precision | |||
extern OCTAVE_API double xtrunc (double x); | extern OCTAVE_API double xtrunc (double x); | |||
extern OCTAVE_API double xcopysign (double x, double y); | extern OCTAVE_API double xcopysign (double x, double y); | |||
inline double xceil (double x) { return ceil (x); } | inline double xceil (double x) { return ceil (x); } | |||
skipping to change at line 122 | skipping to change at line 122 | |||
extern OCTAVE_API bool octave_is_NA (const Complex& x); | extern OCTAVE_API bool octave_is_NA (const Complex& x); | |||
extern OCTAVE_API bool octave_is_NaN_or_NA (const Complex& x); | extern OCTAVE_API bool octave_is_NaN_or_NA (const Complex& x); | |||
extern OCTAVE_API Complex xmin (const Complex& x, const Complex& y); | extern OCTAVE_API Complex xmin (const Complex& x, const Complex& y); | |||
extern OCTAVE_API Complex xmax (const Complex& x, const Complex& y); | extern OCTAVE_API Complex xmax (const Complex& x, const Complex& y); | |||
// Single Precision | // Single Precision | |||
extern OCTAVE_API float xtrunc (float x); | extern OCTAVE_API float xtrunc (float x); | |||
extern OCTAVE_API float xcopysign (float x, float y); | extern OCTAVE_API float xcopysign (float x, float y); | |||
inline float xceil (float x) { return ceilf (x); } | inline float xceil (float x) { return ceilf (x); } | |||
inline float xfloor (float x) { return floorf (x); } | extern OCTAVE_API float xfloor (float x); | |||
inline float arg (float x) { return atan2f (0.0f, x); } | inline float arg (float x) { return atan2f (0.0f, x); } | |||
inline float conj (float x) { return x; } | inline float conj (float x) { return x; } | |||
inline float fix (float x) { return xtrunc (x); } | inline float fix (float x) { return xtrunc (x); } | |||
inline float imag (float) { return 0.0f; } | inline float imag (float) { return 0.0f; } | |||
inline float real (float x) { return x; } | inline float real (float x) { return x; } | |||
extern OCTAVE_API float xround (float x); | extern OCTAVE_API float xround (float x); | |||
extern OCTAVE_API float xroundb (float x); | extern OCTAVE_API float xroundb (float x); | |||
extern OCTAVE_API float signum (float x); | extern OCTAVE_API float signum (float x); | |||
extern OCTAVE_API float xlog2 (float x); | extern OCTAVE_API float xlog2 (float x); | |||
extern OCTAVE_API FloatComplex xlog2 (const FloatComplex& x); | extern OCTAVE_API FloatComplex xlog2 (const FloatComplex& x); | |||
skipping to change at line 181 | skipping to change at line 181 | |||
extern OCTAVE_API FloatComplex acos (const FloatComplex& x); | extern OCTAVE_API FloatComplex acos (const FloatComplex& x); | |||
extern OCTAVE_API FloatComplex acosh (const FloatComplex& x); | extern OCTAVE_API FloatComplex acosh (const FloatComplex& x); | |||
extern OCTAVE_API FloatComplex asin (const FloatComplex& x); | extern OCTAVE_API FloatComplex asin (const FloatComplex& x); | |||
extern OCTAVE_API FloatComplex asinh (const FloatComplex& x); | extern OCTAVE_API FloatComplex asinh (const FloatComplex& x); | |||
extern OCTAVE_API FloatComplex atan (const FloatComplex& x); | extern OCTAVE_API FloatComplex atan (const FloatComplex& x); | |||
extern OCTAVE_API FloatComplex atanh (const FloatComplex& x); | extern OCTAVE_API FloatComplex atanh (const FloatComplex& x); | |||
extern OCTAVE_API bool octave_is_NA (const FloatComplex& x); | extern OCTAVE_API bool octave_is_NA (const FloatComplex& x); | |||
extern OCTAVE_API bool octave_is_NaN_or_NA (const FloatComplex& x); | extern OCTAVE_API bool octave_is_NaN_or_NA (const FloatComplex& x); | |||
extern OCTAVE_API FloatComplex xmin (const FloatComplex& x, const FloatComp | extern OCTAVE_API FloatComplex xmin (const FloatComplex& x, | |||
lex& y); | const FloatComplex& y); | |||
extern OCTAVE_API FloatComplex xmax (const FloatComplex& x, const FloatComp | extern OCTAVE_API FloatComplex xmax (const FloatComplex& x, | |||
lex& y); | const FloatComplex& y); | |||
// These map reals to Complex. | // These map reals to Complex. | |||
extern OCTAVE_API Complex rc_acos (double); | extern OCTAVE_API Complex rc_acos (double); | |||
extern OCTAVE_API FloatComplex rc_acos (float); | extern OCTAVE_API FloatComplex rc_acos (float); | |||
extern OCTAVE_API Complex rc_acosh (double); | extern OCTAVE_API Complex rc_acosh (double); | |||
extern OCTAVE_API FloatComplex rc_acosh (float); | extern OCTAVE_API FloatComplex rc_acosh (float); | |||
extern OCTAVE_API Complex rc_asin (double); | extern OCTAVE_API Complex rc_asin (double); | |||
extern OCTAVE_API FloatComplex rc_asin (float); | extern OCTAVE_API FloatComplex rc_asin (float); | |||
extern OCTAVE_API Complex rc_atanh (double); | extern OCTAVE_API Complex rc_atanh (double); | |||
skipping to change at line 237 | skipping to change at line 239 | |||
extern OCTAVE_API octave_idx_type NINTbig (double x); | extern OCTAVE_API octave_idx_type NINTbig (double x); | |||
extern OCTAVE_API octave_idx_type NINTbig (float x); | extern OCTAVE_API octave_idx_type NINTbig (float x); | |||
extern OCTAVE_API int NINT (double x); | extern OCTAVE_API int NINT (double x); | |||
extern OCTAVE_API int NINT (float x); | extern OCTAVE_API int NINT (float x); | |||
template <typename T> | template <typename T> | |||
T | T | |||
X_NINT (T x) | X_NINT (T x) | |||
{ | { | |||
return (xisinf (x) || xisnan (x)) ? x : xfloor (x + 0.5); | return (xfinite (x) ? xfloor (x + 0.5) : x); | |||
} | } | |||
inline OCTAVE_API double D_NINT (double x) { return X_NINT (x); } | inline OCTAVE_API double D_NINT (double x) { return X_NINT (x); } | |||
inline OCTAVE_API float F_NINT (float x) { return X_NINT (x); } | inline OCTAVE_API float F_NINT (float x) { return X_NINT (x); } | |||
// Template functions can have either float or double arguments. | // Template functions can have either float or double arguments. | |||
template <typename T> | template <typename T> | |||
bool | bool | |||
xisnan (const std::complex<T>& x) | xisnan (const std::complex<T>& x) | |||
skipping to change at line 404 | skipping to change at line 406 | |||
retval = x - tmp; | retval = x - tmp; | |||
} | } | |||
if (x != y && y != 0 && retval != 0) | if (x != y && y != 0 && retval != 0) | |||
retval = xcopysign (retval, x); | retval = xcopysign (retval, x); | |||
return retval; | return retval; | |||
} | } | |||
template <typename T> | ||||
T | ||||
xsignbit (T x) | ||||
{ | ||||
return signbit (x); | ||||
} | ||||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
9 lines changed or deleted | 16 lines changed or added | |||
lo-math.h | lo-math.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2007-2012 John W. Eaton | Copyright (C) 2007-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_liboctave_math_h) | #if !defined (octave_lo_math_h) | |||
#define octave_liboctave_math_h 1 | #define octave_lo_math_h 1 | |||
#if defined (__cplusplus) | #if defined (__cplusplus) | |||
#include <cmath> | #include <cmath> | |||
// if #undef log2 is missing in cmath, undef it here | // if #undef log2 is missing in cmath, undef it here | |||
#if defined (log2) | #if defined (log2) | |||
#undef log2 | #undef log2 | |||
#endif | #endif | |||
#else | #else | |||
#include <math.h> | #include <math.h> | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
lo-specfun.h | lo-specfun.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_liboctave_specfun_h) | #if !defined (octave_lo_specfun_h) | |||
#define octave_liboctave_specfun_h 1 | #define octave_lo_specfun_h 1 | |||
#include "oct-cmplx.h" | #include "oct-cmplx.h" | |||
#include "Array.h" | #include "Array.h" | |||
class Matrix; | class Matrix; | |||
class ComplexMatrix; | class ComplexMatrix; | |||
class NDArray; | class NDArray; | |||
class ComplexNDArray; | class ComplexNDArray; | |||
class RowVector; | class RowVector; | |||
class ComplexColumnVector; | class ComplexColumnVector; | |||
skipping to change at line 59 | skipping to change at line 59 | |||
extern OCTAVE_API double asinh (double); | extern OCTAVE_API double asinh (double); | |||
#endif | #endif | |||
#if !defined (HAVE_ATANH) | #if !defined (HAVE_ATANH) | |||
extern OCTAVE_API double atanh (double); | extern OCTAVE_API double atanh (double); | |||
#endif | #endif | |||
#if !defined (HAVE_ERF) | #if !defined (HAVE_ERF) | |||
extern OCTAVE_API double erf (double); | extern OCTAVE_API double erf (double); | |||
#endif | #endif | |||
extern OCTAVE_API Complex erf (const Complex& x); | ||||
extern OCTAVE_API FloatComplex erf (const FloatComplex& x); | ||||
#if !defined (HAVE_ERFC) | #if !defined (HAVE_ERFC) | |||
extern OCTAVE_API double erfc (double); | extern OCTAVE_API double erfc (double); | |||
#endif | #endif | |||
extern OCTAVE_API Complex erfc (const Complex& x); | ||||
extern OCTAVE_API FloatComplex erfc (const FloatComplex& x); | ||||
#if !defined (HAVE_ACOSHF) | #if !defined (HAVE_ACOSHF) | |||
extern OCTAVE_API float acoshf (float); | extern OCTAVE_API float acoshf (float); | |||
#endif | #endif | |||
#if !defined (HAVE_ASINHF) | #if !defined (HAVE_ASINHF) | |||
extern OCTAVE_API float asinhf (float); | extern OCTAVE_API float asinhf (float); | |||
#endif | #endif | |||
#if !defined (HAVE_ATANHF) | #if !defined (HAVE_ATANHF) | |||
skipping to change at line 307 | skipping to change at line 311 | |||
extern OCTAVE_API ComplexMatrix | extern OCTAVE_API ComplexMatrix | |||
besselh1 (const RowVector& alpha, const ComplexColumnVector& x, bool scaled , | besselh1 (const RowVector& alpha, const ComplexColumnVector& x, bool scaled , | |||
Array<octave_idx_type>& ierr); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API ComplexMatrix | extern OCTAVE_API ComplexMatrix | |||
besselh2 (const RowVector& alpha, const ComplexColumnVector& x, bool scaled , | besselh2 (const RowVector& alpha, const ComplexColumnVector& x, bool scaled , | |||
Array<octave_idx_type>& ierr); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API FloatComplex | extern OCTAVE_API FloatComplex | |||
besselj (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& | besselj (float alpha, const FloatComplex& x, bool scaled, | |||
ierr); | octave_idx_type& ierr); | |||
extern OCTAVE_API FloatComplex | extern OCTAVE_API FloatComplex | |||
bessely (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& | bessely (float alpha, const FloatComplex& x, bool scaled, | |||
ierr); | octave_idx_type& ierr); | |||
extern OCTAVE_API FloatComplex | extern OCTAVE_API FloatComplex | |||
besseli (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& | besseli (float alpha, const FloatComplex& x, bool scaled, | |||
ierr); | octave_idx_type& ierr); | |||
extern OCTAVE_API FloatComplex | extern OCTAVE_API FloatComplex | |||
besselk (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& | besselk (float alpha, const FloatComplex& x, bool scaled, | |||
ierr); | octave_idx_type& ierr); | |||
extern OCTAVE_API FloatComplex | extern OCTAVE_API FloatComplex | |||
besselh1 (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& | besselh1 (float alpha, const FloatComplex& x, bool scaled, | |||
ierr); | octave_idx_type& ierr); | |||
extern OCTAVE_API FloatComplex | extern OCTAVE_API FloatComplex | |||
besselh2 (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& | besselh2 (float alpha, const FloatComplex& x, bool scaled, | |||
ierr); | octave_idx_type& ierr); | |||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
besselj (float alpha, const FloatComplexMatrix& x, bool scaled, | besselj (float alpha, const FloatComplexMatrix& x, bool scaled, | |||
Array<octave_idx_type>& ierr); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
bessely (float alpha, const FloatComplexMatrix& x, bool scaled, | bessely (float alpha, const FloatComplexMatrix& x, bool scaled, | |||
Array<octave_idx_type>& ierr); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
skipping to change at line 469 | skipping to change at line 479 | |||
extern OCTAVE_API FloatComplexNDArray | extern OCTAVE_API FloatComplexNDArray | |||
besselh1 (const FloatNDArray& alpha, const FloatComplexNDArray& x, bool sca led, | besselh1 (const FloatNDArray& alpha, const FloatComplexNDArray& x, bool sca led, | |||
Array<octave_idx_type>& ierr); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API FloatComplexNDArray | extern OCTAVE_API FloatComplexNDArray | |||
besselh2 (const FloatNDArray& alpha, const FloatComplexNDArray& x, bool sca led, | besselh2 (const FloatNDArray& alpha, const FloatComplexNDArray& x, bool sca led, | |||
Array<octave_idx_type>& ierr); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
besselj (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bo | besselj (const FloatRowVector& alpha, const FloatComplexColumnVector& x, | |||
ol scaled, | bool scaled, Array<octave_idx_type>& ierr); | |||
Array<octave_idx_type>& ierr); | ||||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
bessely (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bo | bessely (const FloatRowVector& alpha, const FloatComplexColumnVector& x, | |||
ol scaled, | bool scaled, Array<octave_idx_type>& ierr); | |||
Array<octave_idx_type>& ierr); | ||||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
besseli (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bo | besseli (const FloatRowVector& alpha, const FloatComplexColumnVector& x, | |||
ol scaled, | bool scaled, Array<octave_idx_type>& ierr); | |||
Array<octave_idx_type>& ierr); | ||||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
besselk (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bo | besselk (const FloatRowVector& alpha, const FloatComplexColumnVector& x, | |||
ol scaled, | bool scaled, Array<octave_idx_type>& ierr); | |||
Array<octave_idx_type>& ierr); | ||||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
besselh1 (const FloatRowVector& alpha, const FloatComplexColumnVector& x, b | besselh1 (const FloatRowVector& alpha, const FloatComplexColumnVector& x, | |||
ool scaled, | bool scaled, Array<octave_idx_type>& ierr); | |||
Array<octave_idx_type>& ierr); | ||||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
besselh2 (const FloatRowVector& alpha, const FloatComplexColumnVector& x, b | besselh2 (const FloatRowVector& alpha, const FloatComplexColumnVector& x, | |||
ool scaled, | bool scaled, Array<octave_idx_type>& ierr); | |||
Array<octave_idx_type>& ierr); | ||||
extern OCTAVE_API Complex | ||||
airy (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr); | ||||
extern OCTAVE_API Complex airy (const Complex& z, bool deriv, bool scaled, | extern OCTAVE_API Complex | |||
octave_idx_type& ierr); | biry (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr); | |||
extern OCTAVE_API Complex biry (const Complex& z, bool deriv, bool scaled, | ||||
octave_idx_type& ierr); | ||||
extern OCTAVE_API ComplexMatrix | extern OCTAVE_API ComplexMatrix | |||
airy (const ComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_typ | airy (const ComplexMatrix& z, bool deriv, bool scaled, | |||
e>& ierr); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API ComplexMatrix | extern OCTAVE_API ComplexMatrix | |||
biry (const ComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_typ | biry (const ComplexMatrix& z, bool deriv, bool scaled, | |||
e>& ierr); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API ComplexNDArray | extern OCTAVE_API ComplexNDArray | |||
airy (const ComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_ty | airy (const ComplexNDArray& z, bool deriv, bool scaled, | |||
pe>& ierr); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API ComplexNDArray | extern OCTAVE_API ComplexNDArray | |||
biry (const ComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_ty | biry (const ComplexNDArray& z, bool deriv, bool scaled, | |||
pe>& ierr); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API FloatComplex airy (const FloatComplex& z, bool deriv, boo | extern OCTAVE_API FloatComplex | |||
l scaled, octave_idx_type& ierr); | airy (const FloatComplex& z, bool deriv, bool scaled, octave_idx_type& ierr | |||
extern OCTAVE_API FloatComplex biry (const FloatComplex& z, bool deriv, boo | ); | |||
l scaled, octave_idx_type& ierr); | ||||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplex | |||
airy (const FloatComplexMatrix& z, bool deriv, bool scaled, Array<octave_id | biry (const FloatComplex& z, bool deriv, bool scaled, octave_idx_type& ierr | |||
x_type>& ierr); | ); | |||
extern OCTAVE_API FloatComplexMatrix | extern OCTAVE_API FloatComplexMatrix | |||
biry (const FloatComplexMatrix& z, bool deriv, bool scaled, Array<octave_id | airy (const FloatComplexMatrix& z, bool deriv, bool scaled, | |||
x_type>& ierr); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API FloatComplexNDArray | ||||
airy (const FloatComplexNDArray& z, bool deriv, bool scaled, Array<octave_i | ||||
dx_type>& ierr); | ||||
extern OCTAVE_API FloatComplexNDArray | extern OCTAVE_API FloatComplexMatrix | |||
biry (const FloatComplexNDArray& z, bool deriv, bool scaled, Array<octave_i | biry (const FloatComplexMatrix& z, bool deriv, bool scaled, | |||
dx_type>& ierr); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API double betainc (double x, double a, double b); | extern OCTAVE_API FloatComplexNDArray | |||
extern OCTAVE_API Matrix betainc (double x, double a, const Matrix& b); | airy (const FloatComplexNDArray& z, bool deriv, bool scaled, | |||
extern OCTAVE_API Matrix betainc (double x, const Matrix& a, double b); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API Matrix betainc (double x, const Matrix& a, const Matrix& | ||||
b); | extern OCTAVE_API FloatComplexNDArray | |||
biry (const FloatComplexNDArray& z, bool deriv, bool scaled, | ||||
extern OCTAVE_API NDArray betainc (double x, double a, const NDArray& b); | Array<octave_idx_type>& ierr); | |||
extern OCTAVE_API NDArray betainc (double x, const NDArray& a, double b); | ||||
extern OCTAVE_API NDArray betainc (double x, const NDArray& a, const NDArra | extern OCTAVE_API double | |||
y& b); | betainc (double x, double a, double b); | |||
extern OCTAVE_API Array<double> | ||||
extern OCTAVE_API Matrix betainc (const Matrix& x, double a, double b); | betainc (double x, double a, const Array<double>& b); | |||
extern OCTAVE_API Matrix betainc (const Matrix& x, double a, const Matrix& | extern OCTAVE_API Array<double> | |||
b); | betainc (double x, const Array<double>& a, double b); | |||
extern OCTAVE_API Matrix betainc (const Matrix& x, const Matrix& a, double | extern OCTAVE_API Array<double> | |||
b); | betainc (double x, const Array<double>& a, const Array<double>& b); | |||
extern OCTAVE_API Matrix betainc (const Matrix& x, const Matrix& a, const M | extern OCTAVE_API Array<double> | |||
atrix& b); | betainc (const Array<double>& x, double a, double b); | |||
extern OCTAVE_API Array<double> | ||||
extern OCTAVE_API NDArray betainc (const NDArray& x, double a, double b); | betainc (const Array<double>& x, double a, double b); | |||
extern OCTAVE_API NDArray betainc (const NDArray& x, double a, const NDArra | extern OCTAVE_API Array<double> | |||
y& b); | betainc (const Array<double>& x, double a, const Array<double>& b); | |||
extern OCTAVE_API NDArray betainc (const NDArray& x, const NDArray& a, doub | extern OCTAVE_API Array<double> | |||
le b); | betainc (const Array<double>& x, const Array<double>& a, double b); | |||
extern OCTAVE_API NDArray betainc (const NDArray& x, const NDArray& a, cons | extern OCTAVE_API Array<double> | |||
t NDArray& b); | betainc (const Array<double>& x, const Array<double>& a, | |||
const Array<double>& b); | ||||
extern OCTAVE_API float betainc (float x, float a, float b); | ||||
extern OCTAVE_API FloatMatrix betainc (float x, float a, const FloatMatrix& | extern OCTAVE_API float | |||
b); | betainc (float x, float a, float b); | |||
extern OCTAVE_API FloatMatrix betainc (float x, const FloatMatrix& a, float | extern OCTAVE_API Array<float> | |||
b); | betainc (float x, float a, const Array<float>& b); | |||
extern OCTAVE_API FloatMatrix betainc (float x, const FloatMatrix& a, const | extern OCTAVE_API Array<float> | |||
FloatMatrix& b); | betainc (float x, const Array<float>& a, float b); | |||
extern OCTAVE_API Array<float> | ||||
extern OCTAVE_API FloatNDArray betainc (float x, float a, const FloatNDArra | betainc (float x, const Array<float>& a, const Array<float>& b); | |||
y& b); | extern OCTAVE_API Array<float> | |||
extern OCTAVE_API FloatNDArray betainc (float x, const FloatNDArray& a, flo | betainc (const Array<float>& x, float a, float b); | |||
at b); | extern OCTAVE_API Array<float> | |||
extern OCTAVE_API FloatNDArray betainc (float x, const FloatNDArray& a, con | betainc (const Array<float>& x, float a, float b); | |||
st FloatNDArray& b); | extern OCTAVE_API Array<float> | |||
betainc (const Array<float>& x, float a, const Array<float>& b); | ||||
extern OCTAVE_API FloatMatrix betainc (const FloatMatrix& x, float a, float | extern OCTAVE_API Array<float> | |||
b); | betainc (const Array<float>& x, const Array<float>& a, float b); | |||
extern OCTAVE_API FloatMatrix betainc (const FloatMatrix& x, float a, const | extern OCTAVE_API Array<float> | |||
FloatMatrix& b); | betainc (const Array<float>& x, const Array<float>& a, const Array<float>& | |||
extern OCTAVE_API FloatMatrix betainc (const FloatMatrix& x, const FloatMat | b); | |||
rix& a, float b); | ||||
extern OCTAVE_API FloatMatrix betainc (const FloatMatrix& x, const FloatMat | ||||
rix& a, const FloatMatrix& b); | ||||
extern OCTAVE_API FloatNDArray betainc (const FloatNDArray& x, float a, flo | ||||
at b); | ||||
extern OCTAVE_API FloatNDArray betainc (const FloatNDArray& x, float a, con | ||||
st FloatNDArray& b); | ||||
extern OCTAVE_API FloatNDArray betainc (const FloatNDArray& x, const FloatN | ||||
DArray& a, float b); | ||||
extern OCTAVE_API FloatNDArray betainc (const FloatNDArray& x, const FloatN | ||||
DArray& a, const FloatNDArray& b); | ||||
extern OCTAVE_API double gammainc (double x, double a, bool& err); | extern OCTAVE_API double gammainc (double x, double a, bool& err); | |||
extern OCTAVE_API Matrix gammainc (double x, const Matrix& a); | extern OCTAVE_API Matrix gammainc (double x, const Matrix& a); | |||
extern OCTAVE_API Matrix gammainc (const Matrix& x, double a); | extern OCTAVE_API Matrix gammainc (const Matrix& x, double a); | |||
extern OCTAVE_API Matrix gammainc (const Matrix& x, const Matrix& a); | extern OCTAVE_API Matrix gammainc (const Matrix& x, const Matrix& a); | |||
extern OCTAVE_API NDArray gammainc (double x, const NDArray& a); | extern OCTAVE_API NDArray gammainc (double x, const NDArray& a); | |||
extern OCTAVE_API NDArray gammainc (const NDArray& x, double a); | extern OCTAVE_API NDArray gammainc (const NDArray& x, double a); | |||
extern OCTAVE_API NDArray gammainc (const NDArray& x, const NDArray& a); | extern OCTAVE_API NDArray gammainc (const NDArray& x, const NDArray& a); | |||
inline double gammainc (double x, double a) | inline double gammainc (double x, double a) | |||
{ | { | |||
bool err; | bool err; | |||
return gammainc (x, a, err); | return gammainc (x, a, err); | |||
} | } | |||
extern OCTAVE_API float gammainc (float x, float a, bool& err); | extern OCTAVE_API float gammainc (float x, float a, bool& err); | |||
extern OCTAVE_API FloatMatrix gammainc (float x, const FloatMatrix& a); | extern OCTAVE_API FloatMatrix gammainc (float x, const FloatMatrix& a); | |||
extern OCTAVE_API FloatMatrix gammainc (const FloatMatrix& x, float a); | extern OCTAVE_API FloatMatrix gammainc (const FloatMatrix& x, float a); | |||
extern OCTAVE_API FloatMatrix gammainc (const FloatMatrix& x, const FloatMa | extern OCTAVE_API FloatMatrix | |||
trix& a); | gammainc (const FloatMatrix& x, const FloatMatrix& a); | |||
extern OCTAVE_API FloatNDArray gammainc (float x, const FloatNDArray& a); | extern OCTAVE_API FloatNDArray gammainc (float x, const FloatNDArray& a); | |||
extern OCTAVE_API FloatNDArray gammainc (const FloatNDArray& x, float a); | extern OCTAVE_API FloatNDArray gammainc (const FloatNDArray& x, float a); | |||
extern OCTAVE_API FloatNDArray gammainc (const FloatNDArray& x, const Float | extern OCTAVE_API FloatNDArray | |||
NDArray& a); | gammainc (const FloatNDArray& x, const FloatNDArray& a); | |||
inline float gammainc (float x, float a) | inline float gammainc (float x, float a) | |||
{ | { | |||
bool err; | bool err; | |||
return gammainc (x, a, err); | return gammainc (x, a, err); | |||
} | } | |||
extern OCTAVE_API Complex rc_log1p (double); | extern OCTAVE_API Complex rc_log1p (double); | |||
extern OCTAVE_API FloatComplex rc_log1p (float); | extern OCTAVE_API FloatComplex rc_log1p (float); | |||
extern OCTAVE_API double erfinv (double x); | extern OCTAVE_API double erfinv (double x); | |||
extern OCTAVE_API float erfinv (float x); | extern OCTAVE_API float erfinv (float x); | |||
extern OCTAVE_API double erfcx (double x); | extern OCTAVE_API double erfcinv (double x); | |||
extern OCTAVE_API float erfcinv (float x); | ||||
extern OCTAVE_API float erfcx (float x); | extern OCTAVE_API float erfcx (float x); | |||
extern OCTAVE_API double erfcx (double x); | ||||
extern OCTAVE_API Complex erfcx (const Complex& x); | ||||
extern OCTAVE_API FloatComplex erfcx (const FloatComplex& x); | ||||
extern OCTAVE_API float erfi (float x); | ||||
extern OCTAVE_API double erfi (double x); | ||||
extern OCTAVE_API Complex erfi (const Complex& x); | ||||
extern OCTAVE_API FloatComplex erfi (const FloatComplex& x); | ||||
extern OCTAVE_API float dawson (float x); | ||||
extern OCTAVE_API double dawson (double x); | ||||
extern OCTAVE_API Complex dawson (const Complex& x); | ||||
extern OCTAVE_API FloatComplex dawson (const FloatComplex& x); | ||||
extern OCTAVE_API double betaincinv (double x, double a, double b); | ||||
extern OCTAVE_API Array<double> | ||||
betaincinv (double x, double a, const Array<double>& b); | ||||
extern OCTAVE_API Array<double> | ||||
betaincinv (double x, const Array<double>& a, double b); | ||||
extern OCTAVE_API Array<double> | ||||
betaincinv (double x, const Array<double>& a, const Array<double>& b); | ||||
extern OCTAVE_API Array<double> | ||||
betaincinv (const Array<double>& x, double a, double b); | ||||
extern OCTAVE_API Array<double> | ||||
betaincinv (const Array<double>& x, double a, double b); | ||||
extern OCTAVE_API Array<double> | ||||
betaincinv (const Array<double>& x, double a, const Array<double>& b); | ||||
extern OCTAVE_API Array<double> | ||||
betaincinv (const Array<double>& x, const Array<double>& a, double b); | ||||
extern OCTAVE_API Array<double> | ||||
betaincinv (const Array<double>& x, const Array<double>& a, | ||||
const Array<double>& b); | ||||
extern OCTAVE_API void | ||||
ellipj (double u, double m, double& sn, double& cn, double& dn, double& err | ||||
); | ||||
extern OCTAVE_API void | ||||
ellipj (const Complex& u, double m, Complex& sn, Complex& cn, Complex& dn, | ||||
double& err); | ||||
#endif | #endif | |||
End of changes. 29 change blocks. | ||||
126 lines changed or deleted | 149 lines changed or added | |||
lo-sysdep.h | lo-sysdep.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_liboctave_sysdep_h) | #if !defined (octave_lo_sysdep_h) | |||
#define octave_liboctave_sysdep_h 1 | #define octave_lo_sysdep_h 1 | |||
#include <string> | #include <string> | |||
#include "lo-ieee.h" | #include "lo-ieee.h" | |||
class string_vector; | class string_vector; | |||
extern std::string octave_getcwd (void); | extern std::string octave_getcwd (void); | |||
extern int octave_chdir (const std::string&); | extern int octave_chdir (const std::string&); | |||
#if defined (__WIN32__) && ! defined (__CYGWIN__) | #if defined (__WIN32__) && ! defined (__CYGWIN__) | |||
extern pid_t octave_popen2 (const std::string&, const string_vector&, | extern pid_t octave_popen2 (const std::string&, const string_vector&, | |||
bool, int *, std::string&); | bool, int *, std::string&); | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
lo-traits.h | lo-traits.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 John W. Eaton | Copyright (C) 2009-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_liboctave_traits_h) | #if !defined (octave_lo_traits_h) | |||
#define octave_liboctave_traits_h 1 | #define octave_lo_traits_h 1 | |||
// Ideas for these classes taken from C++ Templates, The Complete | // Ideas for these classes taken from C++ Templates, The Complete | |||
// Guide by David Vandevoorde and Nicolai M. Josuttis, Addison-Wesley | // Guide by David Vandevoorde and Nicolai M. Josuttis, Addison-Wesley | |||
// (2003). | // (2003). | |||
// Select a type based on the value of a constant expression. | // Select a type based on the value of a constant expression. | |||
template <bool cond, typename T1, typename T2> | template <bool cond, typename T1, typename T2> | |||
class if_then_else; | class if_then_else; | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
lo-utils.h | lo-utils.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_liboctave_utils_h) | #if !defined (octave_lo_utils_h) | |||
#define octave_liboctave_utils_h 1 | #define octave_lo_utils_h 1 | |||
#include <cstdio> | #include <cstdio> | |||
#include <iostream> | #include <iostream> | |||
#include <string> | #include <string> | |||
#include "quit.h" | ||||
#include "lo-cutils.h" | #include "lo-cutils.h" | |||
#include "oct-cmplx.h" | #include "oct-cmplx.h" | |||
// Generic any/all test functionality with arbitrary predicate. | ||||
template <class F, class T, bool zero> | ||||
bool | ||||
any_all_test (F fcn, const T *m, octave_idx_type len) | ||||
{ | ||||
octave_idx_type i; | ||||
for (i = 0; i < len - 3; i += 4) | ||||
{ | ||||
octave_quit (); | ||||
if (fcn (m[i]) != zero | ||||
|| fcn (m[i+1]) != zero | ||||
|| fcn (m[i+2]) != zero | ||||
|| fcn (m[i+3]) != zero) | ||||
return ! zero; | ||||
} | ||||
octave_quit (); | ||||
for (; i < len; i++) | ||||
if (fcn (m[i]) != zero) | ||||
return ! zero; | ||||
return zero; | ||||
} | ||||
extern OCTAVE_API bool xis_int_or_inf_or_nan (double x); | extern OCTAVE_API bool xis_int_or_inf_or_nan (double x); | |||
extern OCTAVE_API bool xis_one_or_zero (double x); | extern OCTAVE_API bool xis_one_or_zero (double x); | |||
extern OCTAVE_API bool xis_zero (double x); | extern OCTAVE_API bool xis_zero (double x); | |||
extern OCTAVE_API bool xtoo_large_for_float (double x); | extern OCTAVE_API bool xtoo_large_for_float (double x); | |||
extern OCTAVE_API bool xtoo_large_for_float (const Complex& x); | ||||
extern OCTAVE_API bool xis_int_or_inf_or_nan (float x); | extern OCTAVE_API bool xis_int_or_inf_or_nan (float x); | |||
extern OCTAVE_API bool xis_one_or_zero (float x); | extern OCTAVE_API bool xis_one_or_zero (float x); | |||
extern OCTAVE_API bool xis_zero (float x); | extern OCTAVE_API bool xis_zero (float x); | |||
extern OCTAVE_API bool xtoo_large_for_float (float x); | extern OCTAVE_API bool xtoo_large_for_float (float x); | |||
extern OCTAVE_API char *strsave (const char *); | extern OCTAVE_API char *strsave (const char *); | |||
extern OCTAVE_API void | extern OCTAVE_API void | |||
octave_putenv (const std::string&, const std::string&); | octave_putenv (const std::string&, const std::string&); | |||
skipping to change at line 106 | skipping to change at line 138 | |||
extern OCTAVE_API void | extern OCTAVE_API void | |||
octave_write_complex (std::ostream& os, const Complex& cval); | octave_write_complex (std::ostream& os, const Complex& cval); | |||
extern OCTAVE_API void | extern OCTAVE_API void | |||
octave_write_float (std::ostream& os, float dval); | octave_write_float (std::ostream& os, float dval); | |||
extern OCTAVE_API void | extern OCTAVE_API void | |||
octave_write_float_complex (std::ostream& os, const FloatComplex& cval); | octave_write_float_complex (std::ostream& os, const FloatComplex& cval); | |||
// Maybe this is overkill, but it allos | ||||
class | ||||
octave_wait | ||||
{ | ||||
public: | ||||
static bool ifexited (int status) | ||||
{ | ||||
return octave_wifexited (status); | ||||
} | ||||
static int exitstatus (int status) | ||||
{ | ||||
return octave_wexitstatus (status); | ||||
} | ||||
static bool ifsignaled (int status) | ||||
{ | ||||
return octave_wifsignaled (status); | ||||
} | ||||
static int termsig (int status) | ||||
{ | ||||
return octave_wtermsig (status); | ||||
} | ||||
static bool coredump (int status) | ||||
{ | ||||
return octave_wcoredump (status); | ||||
} | ||||
static bool ifstopped (int status) | ||||
{ | ||||
return octave_wifstopped (status); | ||||
} | ||||
static int stopsig (int status) | ||||
{ | ||||
return octave_wstopsig (status); | ||||
} | ||||
static bool ifcontinued (int status) | ||||
{ | ||||
return octave_wifcontinued (status); | ||||
} | ||||
}; | ||||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
3 lines changed or deleted | 83 lines changed or added | |||
load-path.h | load-path.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2006-2012 John W. Eaton | Copyright (C) 2006-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 42 | skipping to change at line 42 | |||
#include "pathsearch.h" | #include "pathsearch.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
load_path | load_path | |||
{ | { | |||
protected: | protected: | |||
load_path (void) | load_path (void) | |||
: dir_info_list (), fcn_map (), private_fcn_map (), method_map () { } | : dir_info_list (), fcn_map (), private_fcn_map (), method_map (), | |||
init_dirs () { } | ||||
public: | public: | |||
typedef void (*hook_fcn_ptr) (const std::string& dir); | typedef void (*hook_fcn_ptr) (const std::string& dir); | |||
~load_path (void) { } | ~load_path (void) { } | |||
static void initialize (bool set_initial_path = false) | static void initialize (bool set_initial_path = false) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
skipping to change at line 91 | skipping to change at line 92 | |||
{ | { | |||
return instance_ok () ? instance->do_remove (dir) : false; | return instance_ok () ? instance->do_remove (dir) : false; | |||
} | } | |||
static void update (void) | static void update (void) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_update (); | instance->do_update (); | |||
} | } | |||
static bool contains_canonical (const std::string& dir_name) | ||||
{ | ||||
return instance_ok () ? instance->do_contains_canonical (dir_name) : fa | ||||
lse; | ||||
} | ||||
static std::string find_method (const std::string& class_name, | static std::string find_method (const std::string& class_name, | |||
const std::string& meth, | const std::string& meth, | |||
std::string& dir_name) | std::string& dir_name) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_find_method (class_name, meth, dir_name) : std::string | ? instance->do_find_method (class_name, meth, dir_name) | |||
(); | : std::string (); | |||
} | } | |||
static std::string find_method (const std::string& class_name, | static std::string find_method (const std::string& class_name, | |||
const std::string& meth) | const std::string& meth) | |||
{ | { | |||
std::string dir_name; | std::string dir_name; | |||
return find_method (class_name, meth, dir_name); | return find_method (class_name, meth, dir_name); | |||
} | } | |||
static std::list<std::string> methods (const std::string& class_name) | static std::list<std::string> methods (const std::string& class_name) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_methods (class_name) : std::list<std::string> (); | ? instance->do_methods (class_name) : std::list<std::string> (); | |||
} | } | |||
static std::list<std::string> overloads (const std::string& meth) | static std::list<std::string> overloads (const std::string& meth) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_overloads (meth) : std::list<std::string> (); | ? instance->do_overloads (meth) : std::list<std::string> (); | |||
} | } | |||
static std::string find_fcn (const std::string& fcn, std::string& dir_nam e) | static std::string find_fcn (const std::string& fcn, std::string& dir_nam e) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_find_fcn (fcn, dir_name) : std::string (); | ? instance->do_find_fcn (fcn, dir_name) : std::string (); | |||
} | } | |||
static std::string find_fcn (const std::string& fcn) | static std::string find_fcn (const std::string& fcn) | |||
{ | { | |||
std::string dir_name; | std::string dir_name; | |||
return find_fcn (fcn, dir_name); | return find_fcn (fcn, dir_name); | |||
} | } | |||
static std::string find_private_fcn (const std::string& dir, | static std::string find_private_fcn (const std::string& dir, | |||
const std::string& fcn) | const std::string& fcn) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_find_private_fcn (dir, fcn) : std::string (); | ? instance->do_find_private_fcn (dir, fcn) : std::string (); | |||
} | } | |||
static std::string find_fcn_file (const std::string& fcn) | static std::string find_fcn_file (const std::string& fcn) | |||
{ | { | |||
std::string dir_name; | std::string dir_name; | |||
return instance_ok () ? | return instance_ok () ? | |||
instance->do_find_fcn (fcn, dir_name, M_FILE) : std::string (); | instance->do_find_fcn (fcn, dir_name, M_FILE) : std::string (); | |||
} | } | |||
static std::string find_oct_file (const std::string& fcn) | static std::string find_oct_file (const std::string& fcn) | |||
{ | { | |||
std::string dir_name; | std::string dir_name; | |||
return instance_ok () ? | return instance_ok () ? | |||
instance->do_find_fcn (fcn, dir_name, OCT_FILE) : std::string (); | instance->do_find_fcn (fcn, dir_name, OCT_FILE) : std::string () ; | |||
} | } | |||
static std::string find_mex_file (const std::string& fcn) | static std::string find_mex_file (const std::string& fcn) | |||
{ | { | |||
std::string dir_name; | std::string dir_name; | |||
return instance_ok () ? | return instance_ok () ? | |||
instance->do_find_fcn (fcn, dir_name, MEX_FILE) : std::string (); | instance->do_find_fcn (fcn, dir_name, MEX_FILE) : std::string () ; | |||
} | } | |||
static std::string find_file (const std::string& file) | static std::string find_file (const std::string& file) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_find_file (file) : std::string (); | ? instance->do_find_file (file) : std::string (); | |||
} | } | |||
static std::string find_dir (const std::string& dir) | static std::string find_dir (const std::string& dir) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_find_dir (dir) : std::string (); | ? instance->do_find_dir (dir) : std::string (); | |||
} | } | |||
static string_vector find_matching_dirs (const std::string& dir) | static string_vector find_matching_dirs (const std::string& dir) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_find_matching_dirs (dir) : string_vector (); | ? instance->do_find_matching_dirs (dir) : string_vector (); | |||
} | } | |||
static std::string find_first_of (const string_vector& files) | static std::string find_first_of (const string_vector& files) | |||
{ | { | |||
return instance_ok () ? | return instance_ok () ? | |||
instance->do_find_first_of (files) : std::string (); | instance->do_find_first_of (files) : std::string (); | |||
} | } | |||
static string_vector find_all_first_of (const string_vector& files) | static string_vector find_all_first_of (const string_vector& files) | |||
{ | { | |||
return instance_ok () ? | return instance_ok () ? | |||
instance->do_find_all_first_of (files) : string_vector (); | instance->do_find_all_first_of (files) : string_vector (); | |||
} | } | |||
static string_vector dirs (void) | static string_vector dirs (void) | |||
{ | { | |||
return instance_ok () ? instance->do_dirs () : string_vector (); | return instance_ok () ? instance->do_dirs () : string_vector (); | |||
} | } | |||
static std::list<std::string> dir_list (void) | static std::list<std::string> dir_list (void) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_dir_list () : std::list<std::string> (); | ? instance->do_dir_list () : std::list<std::string> (); | |||
} | } | |||
static string_vector files (const std::string& dir, bool omit_exts = fals e) | static string_vector files (const std::string& dir, bool omit_exts = fals e) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_files (dir, omit_exts) : string_vector (); | ? instance->do_files (dir, omit_exts) : string_vector (); | |||
} | } | |||
static string_vector fcn_names (void) | static string_vector fcn_names (void) | |||
{ | { | |||
return instance_ok () ? instance->do_fcn_names () : string_vector (); | return instance_ok () ? instance->do_fcn_names () : string_vector (); | |||
} | } | |||
static std::string path (void) | static std::string path (void) | |||
{ | { | |||
return instance_ok () ? instance->do_path () : std::string (); | return instance_ok () ? instance->do_path () : std::string (); | |||
skipping to change at line 238 | skipping to change at line 245 | |||
static void set_command_line_path (const std::string& p) | static void set_command_line_path (const std::string& p) | |||
{ | { | |||
if (command_line_path.empty ()) | if (command_line_path.empty ()) | |||
command_line_path = p; | command_line_path = p; | |||
else | else | |||
command_line_path += dir_path::path_sep_str () + p; | command_line_path += dir_path::path_sep_str () + p; | |||
} | } | |||
static std::string get_command_line_path (void) | static std::string get_command_line_path (void) | |||
{ | { | |||
return instance_ok () ? instance->do_get_command_line_path () : std::st | return instance_ok () ? instance->do_get_command_line_path () | |||
ring (); | : std::string (); | |||
} | } | |||
static std::string system_path (void) | static std::string system_path (void) | |||
{ | { | |||
return instance_ok () ? instance->do_system_path () : std::string (); | return instance_ok () ? instance->do_system_path () : std::string (); | |||
} | } | |||
private: | private: | |||
static const int M_FILE = 1; | static const int M_FILE = 1; | |||
skipping to change at line 297 | skipping to change at line 305 | |||
typedef std::map<std::string, class_info> method_file_map_type; | typedef std::map<std::string, class_info> method_file_map_type; | |||
typedef method_file_map_type::const_iterator const_method_file_map_iter ator; | typedef method_file_map_type::const_iterator const_method_file_map_iter ator; | |||
typedef method_file_map_type::iterator method_file_map_iterator; | typedef method_file_map_type::iterator method_file_map_iterator; | |||
// This default constructor is only provided so we can create a | // This default constructor is only provided so we can create a | |||
// std::map of dir_info objects. You should not use this | // std::map of dir_info objects. You should not use this | |||
// constructor for any other purpose. | // constructor for any other purpose. | |||
dir_info (void) | dir_info (void) | |||
: dir_name (), abs_dir_name (), is_relative (false), | : dir_name (), abs_dir_name (), is_relative (false), | |||
dir_mtime (), dir_time_last_checked (), all_files (), | dir_mtime (), dir_time_last_checked (), | |||
fcn_files (), private_file_map (), method_file_map () | all_files (), fcn_files (), private_file_map (), method_file_map () | |||
{ } | { } | |||
dir_info (const std::string& d) | dir_info (const std::string& d) | |||
: dir_name (d), abs_dir_name (), is_relative (false), | : dir_name (d), abs_dir_name (), is_relative (false), | |||
dir_mtime (), dir_time_last_checked (), all_files (), | dir_mtime (), dir_time_last_checked (), | |||
fcn_files (), private_file_map (), method_file_map () | all_files (), fcn_files (), private_file_map (), method_file_map () | |||
{ | { | |||
initialize (); | initialize (); | |||
} | } | |||
dir_info (const dir_info& di) | dir_info (const dir_info& di) | |||
: dir_name (di.dir_name), abs_dir_name (di.abs_dir_name), | : dir_name (di.dir_name), abs_dir_name (di.abs_dir_name), | |||
is_relative (di.is_relative), | is_relative (di.is_relative), | |||
dir_mtime (di.dir_mtime), | dir_mtime (di.dir_mtime), | |||
dir_time_last_checked (di.dir_time_last_checked), | dir_time_last_checked (di.dir_time_last_checked), | |||
all_files (di.all_files), fcn_files (di.fcn_files), | all_files (di.all_files), fcn_files (di.fcn_files), | |||
skipping to change at line 425 | skipping to change at line 433 | |||
typedef file_info_list_type::const_iterator const_file_info_list_iterator ; | typedef file_info_list_type::const_iterator const_file_info_list_iterator ; | |||
typedef file_info_list_type::iterator file_info_list_iterator; | typedef file_info_list_type::iterator file_info_list_iterator; | |||
// <FCN_NAME, FILE_INFO_LIST> | // <FCN_NAME, FILE_INFO_LIST> | |||
typedef std::map<std::string, file_info_list_type> fcn_map_type; | typedef std::map<std::string, file_info_list_type> fcn_map_type; | |||
typedef fcn_map_type::const_iterator const_fcn_map_iterator; | typedef fcn_map_type::const_iterator const_fcn_map_iterator; | |||
typedef fcn_map_type::iterator fcn_map_iterator; | typedef fcn_map_type::iterator fcn_map_iterator; | |||
// <DIR_NAME, <FCN_NAME, TYPE>> | // <DIR_NAME, <FCN_NAME, TYPE>> | |||
typedef std::map<std::string, dir_info::fcn_file_map_type> private_fcn_ma | typedef std::map<std::string, dir_info::fcn_file_map_type> | |||
p_type; | private_fcn_map_type; | |||
typedef private_fcn_map_type::const_iterator const_private_fcn_map_iterat or; | typedef private_fcn_map_type::const_iterator const_private_fcn_map_iterat or; | |||
typedef private_fcn_map_type::iterator private_fcn_map_iterator; | typedef private_fcn_map_type::iterator private_fcn_map_iterator; | |||
// <CLASS_NAME, <FCN_NAME, FILE_INFO_LIST>> | // <CLASS_NAME, <FCN_NAME, FILE_INFO_LIST>> | |||
typedef std::map<std::string, fcn_map_type> method_map_type; | typedef std::map<std::string, fcn_map_type> method_map_type; | |||
typedef method_map_type::const_iterator const_method_map_iterator; | typedef method_map_type::const_iterator const_method_map_iterator; | |||
typedef method_map_type::iterator method_map_iterator; | typedef method_map_type::iterator method_map_iterator; | |||
mutable dir_info_list_type dir_info_list; | mutable dir_info_list_type dir_info_list; | |||
mutable fcn_map_type fcn_map; | mutable fcn_map_type fcn_map; | |||
mutable private_fcn_map_type private_fcn_map; | mutable private_fcn_map_type private_fcn_map; | |||
mutable method_map_type method_map; | mutable method_map_type method_map; | |||
mutable std::set<std::string> init_dirs; | ||||
static load_path *instance; | static load_path *instance; | |||
static void cleanup_instance (void) { delete instance; instance = 0; } | static void cleanup_instance (void) { delete instance; instance = 0; } | |||
static hook_fcn_ptr add_hook; | static hook_fcn_ptr add_hook; | |||
static hook_fcn_ptr remove_hook; | static hook_fcn_ptr remove_hook; | |||
static std::string command_line_path; | static std::string command_line_path; | |||
skipping to change at line 465 | skipping to change at line 476 | |||
static abs_dir_cache_type abs_dir_cache; | static abs_dir_cache_type abs_dir_cache; | |||
static bool instance_ok (void); | static bool instance_ok (void); | |||
const_dir_info_list_iterator find_dir_info (const std::string& dir) const ; | const_dir_info_list_iterator find_dir_info (const std::string& dir) const ; | |||
dir_info_list_iterator find_dir_info (const std::string& dir); | dir_info_list_iterator find_dir_info (const std::string& dir); | |||
bool contains (const std::string& dir) const; | bool contains (const std::string& dir) const; | |||
bool do_contains_canonical (const std::string& dir) const; | ||||
void move_fcn_map (const std::string& dir, | void move_fcn_map (const std::string& dir, | |||
const string_vector& fcn_files, bool at_end); | const string_vector& fcn_files, bool at_end); | |||
void move_method_map (const std::string& dir, bool at_end); | void move_method_map (const std::string& dir, bool at_end); | |||
void move (std::list<dir_info>::iterator i, bool at_end); | void move (std::list<dir_info>::iterator i, bool at_end); | |||
void do_initialize (bool set_initial_path); | void do_initialize (bool set_initial_path); | |||
void do_clear (void); | void do_clear (void); | |||
void do_set (const std::string& p, bool warn); | void do_set (const std::string& p, bool warn, bool is_init = false); | |||
void do_append (const std::string& dir, bool warn); | void do_append (const std::string& dir, bool warn); | |||
void do_prepend (const std::string& dir, bool warn); | void do_prepend (const std::string& dir, bool warn); | |||
void do_add (const std::string& dir, bool at_end, bool warn); | void do_add (const std::string& dir, bool at_end, bool warn); | |||
void remove_fcn_map (const std::string& dir, const string_vector& fcn_fil es); | void remove_fcn_map (const std::string& dir, const string_vector& fcn_fil es); | |||
void remove_private_fcn_map (const std::string& dir); | void remove_private_fcn_map (const std::string& dir); | |||
skipping to change at line 546 | skipping to change at line 559 | |||
friend string_vector get_file_list (const dir_info::fcn_file_map_type& ls t); | friend string_vector get_file_list (const dir_info::fcn_file_map_type& ls t); | |||
friend void | friend void | |||
print_fcn_list (std::ostream& os, const dir_info::fcn_file_map_type& lst) ; | print_fcn_list (std::ostream& os, const dir_info::fcn_file_map_type& lst) ; | |||
void do_display (std::ostream& os) const; | void do_display (std::ostream& os) const; | |||
std::string do_system_path (void) const { return sys_path; } | std::string do_system_path (void) const { return sys_path; } | |||
std::string do_get_command_line_path (void) const { return command_line_p | std::string do_get_command_line_path (void) const | |||
ath; } | { return command_line_path; } | |||
void add_to_fcn_map (const dir_info& di, bool at_end) const; | void add_to_fcn_map (const dir_info& di, bool at_end) const; | |||
void add_to_private_fcn_map (const dir_info& di) const; | void add_to_private_fcn_map (const dir_info& di) const; | |||
void add_to_method_map (const dir_info& di, bool at_end) const; | void add_to_method_map (const dir_info& di, bool at_end) const; | |||
friend dir_info::fcn_file_map_type get_fcn_files (const std::string& d); | friend dir_info::fcn_file_map_type get_fcn_files (const std::string& d); | |||
}; | }; | |||
End of changes. 26 change blocks. | ||||
30 lines changed or deleted | 41 lines changed or added | |||
load-save.h | load-save.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 29 | skipping to change at line 29 | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_load_save_h) | #if !defined (octave_load_save_h) | |||
#define octave_load_save_h 1 | #define octave_load_save_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mach-info.h" | ||||
#include "symtab.h" | ||||
class octave_value; | class octave_value; | |||
// FIXME: maybe MAT5 and MAT7 should be options to MAT_BINARY. | // FIXME: maybe MAT5 and MAT7 should be options to MAT_BINARY. | |||
// Similarly, save_as_floats may be an option for LS_BINARY, LS_HDF5 etc. | // Similarly, save_as_floats may be an option for LS_BINARY, LS_HDF5 etc. | |||
enum load_save_format_type | enum load_save_format_type | |||
{ | { | |||
LS_ASCII, | LS_ASCII, | |||
LS_BINARY, | LS_BINARY, | |||
LS_MAT_ASCII, | LS_MAT_ASCII, | |||
LS_MAT_BINARY, | LS_MAT_BINARY, | |||
LS_MAT5_BINARY, | LS_MAT5_BINARY, | |||
LS_MAT7_BINARY, | LS_MAT7_BINARY, | |||
#ifdef HAVE_HDF5 | #ifdef HAVE_HDF5 | |||
LS_HDF5, | LS_HDF5, | |||
#endif /* HAVE_HDF5 */ | #endif /* HAVE_HDF5 */ | |||
LS_UNKNOWN | LS_UNKNOWN | |||
}; | }; | |||
enum load_save_format_options | enum load_save_format_options | |||
{ | { | |||
// LS_MAT_ASCII options (not exclusive) | // LS_MAT_ASCII options (not exclusive) | |||
LS_MAT_ASCII_LONG = 1, | LS_MAT_ASCII_LONG = 1, | |||
LS_MAT_ASCII_TABS = 2, | LS_MAT_ASCII_TABS = 2, | |||
// LS_MAT_BINARY options | // LS_MAT_BINARY options | |||
LS_MAT_BINARY_V5 = 1, | LS_MAT_BINARY_V5 = 1, | |||
LS_MAT_BINARY_V7, | LS_MAT_BINARY_V7, | |||
// zero means no option. | // zero means no option. | |||
LS_NO_OPTION = 0 | LS_NO_OPTION = 0 | |||
}; | }; | |||
class load_save_format | class load_save_format | |||
{ | { | |||
public: | public: | |||
load_save_format (load_save_format_type t, | load_save_format (load_save_format_type t, | |||
load_save_format_options o = LS_NO_OPTION) | load_save_format_options o = LS_NO_OPTION) | |||
: type (t), opts (o) { } | : type (t), opts (o) { } | |||
operator int (void) const | operator int (void) const | |||
{ return type; } | { return type; } | |||
int type, opts; | int type, opts; | |||
}; | }; | |||
extern void dump_octave_core (void); | extern void dump_octave_core (void); | |||
extern int | extern int | |||
read_binary_file_header (std::istream& is, bool& swap, | read_binary_file_header (std::istream& is, bool& swap, | |||
oct_mach_info::float_format& flt_fmt, | oct_mach_info::float_format& flt_fmt, | |||
bool quiet = false); | bool quiet = false); | |||
extern octave_value | extern octave_value | |||
do_load (std::istream& stream, const std::string& orig_fname, | do_load (std::istream& stream, const std::string& orig_fname, | |||
load_save_format format, oct_mach_info::float_format flt_fmt, | load_save_format format, oct_mach_info::float_format flt_fmt, | |||
bool list_only, bool swap, bool verbose, | bool list_only, bool swap, bool verbose, | |||
const string_vector& argv, int argv_idx, int argc, int nargout); | const string_vector& argv, int argv_idx, int argc, int nargout); | |||
extern OCTINTERP_API bool is_octave_data_file (const std::string& file); | ||||
extern void | extern void | |||
do_save (std::ostream& os, const symbol_table::symbol_record& sr, | do_save (std::ostream& os, const symbol_table::symbol_record& sr, | |||
load_save_format fmt, bool save_as_floats); | load_save_format fmt, bool save_as_floats); | |||
extern void | extern void | |||
write_header (std::ostream& os, load_save_format format); | write_header (std::ostream& os, load_save_format format); | |||
extern void octave_prepare_hdf5 (void); | ||||
extern void octave_finalize_hdf5 (void); | ||||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
12 lines changed or deleted | 21 lines changed or added | |||
ls-ascii-helper.h | ls-ascii-helper.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 Benjamin Lindner | Copyright (C) 2009-2013 Benjamin Lindner | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
ls-hdf5.h | ls-hdf5.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 52 | skipping to change at line 52 | |||
// keep track of current item index in the file | // keep track of current item index in the file | |||
int current_item; | int current_item; | |||
hdf5_fstreambase () : file_id (-1), current_item () { } | hdf5_fstreambase () : file_id (-1), current_item () { } | |||
~hdf5_fstreambase () { close (); } | ~hdf5_fstreambase () { close (); } | |||
hdf5_fstreambase (const char *name, int mode, int /* prot */ = 0) | hdf5_fstreambase (const char *name, int mode, int /* prot */ = 0) | |||
: file_id (-1), current_item (-1) | : file_id (-1), current_item (-1) | |||
{ | { | |||
if (mode & std::ios::in) | if (mode & std::ios::in) | |||
file_id = H5Fopen (name, H5F_ACC_RDONLY, H5P_DEFAULT); | file_id = H5Fopen (name, H5F_ACC_RDONLY, H5P_DEFAULT); | |||
else if (mode & std::ios::out) | else if (mode & std::ios::out) | |||
{ | { | |||
if (mode & std::ios::app && H5Fis_hdf5 (name) > 0) | if (mode & std::ios::app && H5Fis_hdf5 (name) > 0) | |||
file_id = H5Fopen (name, H5F_ACC_RDWR, H5P_DEFAULT); | file_id = H5Fopen (name, H5F_ACC_RDWR, H5P_DEFAULT); | |||
else | else | |||
file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT, | file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT, | |||
H5P_DEFAULT); | H5P_DEFAULT); | |||
} | } | |||
if (file_id < 0) | if (file_id < 0) | |||
std::ios::setstate (std::ios::badbit); | std::ios::setstate (std::ios::badbit); | |||
current_item = 0; | current_item = 0; | |||
} | } | |||
void close () | void close () | |||
{ | { | |||
if (file_id >= 0) | if (file_id >= 0) | |||
{ | { | |||
if (H5Fclose (file_id) < 0) | if (H5Fclose (file_id) < 0) | |||
std::ios::setstate (std::ios::badbit); | std::ios::setstate (std::ios::badbit); | |||
file_id = -1; | file_id = -1; | |||
} | } | |||
} | } | |||
void open (const char *name, int mode, int) | void open (const char *name, int mode, int) | |||
{ | { | |||
clear (); | clear (); | |||
if (mode & std::ios::in) | if (mode & std::ios::in) | |||
file_id = H5Fopen (name, H5F_ACC_RDONLY, H5P_DEFAULT); | file_id = H5Fopen (name, H5F_ACC_RDONLY, H5P_DEFAULT); | |||
else if (mode & std::ios::out) | else if (mode & std::ios::out) | |||
{ | { | |||
if (mode & std::ios::app && H5Fis_hdf5 (name) > 0) | if (mode & std::ios::app && H5Fis_hdf5 (name) > 0) | |||
file_id = H5Fopen (name, H5F_ACC_RDWR, H5P_DEFAULT); | file_id = H5Fopen (name, H5F_ACC_RDWR, H5P_DEFAULT); | |||
else | else | |||
file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT, | file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT, | |||
H5P_DEFAULT); | H5P_DEFAULT); | |||
} | } | |||
if (file_id < 0) | if (file_id < 0) | |||
std::ios::setstate (std::ios::badbit); | std::ios::setstate (std::ios::badbit); | |||
current_item = 0; | current_item = 0; | |||
} | } | |||
}; | }; | |||
// input and output streams, subclassing istream and ostream | // input and output streams, subclassing istream and ostream | |||
// so that we can pass them for stream parameters in the functions below. | // so that we can pass them for stream parameters in the functions below. | |||
class hdf5_ifstream : public hdf5_fstreambase, public std::istream | class hdf5_ifstream : public hdf5_fstreambase, public std::istream | |||
{ | { | |||
public: | public: | |||
hdf5_ifstream () : hdf5_fstreambase (), std::istream (0) { } | hdf5_ifstream () : hdf5_fstreambase (), std::istream (0) { } | |||
hdf5_ifstream (const char *name, int mode = std::ios::in|std::ios::binary , | hdf5_ifstream (const char *name, int mode = std::ios::in|std::ios::binary , | |||
int prot = 0) | int prot = 0) | |||
: hdf5_fstreambase (name, mode, prot), std::istream (0) { } | : hdf5_fstreambase (name, mode, prot), std::istream (0) { } | |||
void open (const char *name, int mode = std::ios::in|std::ios::binary, | void open (const char *name, int mode = std::ios::in|std::ios::binary, | |||
int prot = 0) | int prot = 0) | |||
{ hdf5_fstreambase::open (name, mode, prot); } | { hdf5_fstreambase::open (name, mode, prot); } | |||
}; | }; | |||
class hdf5_ofstream : public hdf5_fstreambase, public std::ostream | class hdf5_ofstream : public hdf5_fstreambase, public std::ostream | |||
{ | { | |||
public: | public: | |||
hdf5_ofstream () : hdf5_fstreambase (), std::ostream (0) { } | hdf5_ofstream () : hdf5_fstreambase (), std::ostream (0) { } | |||
hdf5_ofstream (const char *name, int mode = std::ios::out|std::ios::binar y, | hdf5_ofstream (const char *name, int mode = std::ios::out|std::ios::binar y, | |||
int prot = 0) | int prot = 0) | |||
: hdf5_fstreambase (name, mode, prot), std::ostream (0) { } | : hdf5_fstreambase (name, mode, prot), std::ostream (0) { } | |||
void open (const char *name, int mode = std::ios::out|std::ios::binary, | void open (const char *name, int mode = std::ios::out|std::ios::binary, | |||
int prot = 0) | int prot = 0) | |||
{ hdf5_fstreambase::open (name, mode, prot); } | { hdf5_fstreambase::open (name, mode, prot); } | |||
}; | }; | |||
// Callback data structure for passing data to hdf5_read_next_data, below. | // Callback data structure for passing data to hdf5_read_next_data, below. | |||
struct | struct | |||
hdf5_callback_data | hdf5_callback_data | |||
{ | { | |||
hdf5_callback_data (void) | hdf5_callback_data (void) | |||
: name (), global (false), tc (), doc () { } | : name (), global (false), tc (), doc () { } | |||
skipping to change at line 183 | skipping to change at line 183 | |||
bool mark_as_global, bool save_as_floats); | bool mark_as_global, bool save_as_floats); | |||
extern OCTINTERP_API int | extern OCTINTERP_API int | |||
save_hdf5_empty (hid_t loc_id, const char *name, const dim_vector d); | save_hdf5_empty (hid_t loc_id, const char *name, const dim_vector d); | |||
extern OCTINTERP_API int | extern OCTINTERP_API int | |||
load_hdf5_empty (hid_t loc_id, const char *name, dim_vector &d); | load_hdf5_empty (hid_t loc_id, const char *name, dim_vector &d); | |||
extern OCTINTERP_API std::string | extern OCTINTERP_API std::string | |||
read_hdf5_data (std::istream& is, const std::string& filename, bool& globa l, | read_hdf5_data (std::istream& is, const std::string& filename, bool& globa l, | |||
octave_value& tc, std::string& doc); | octave_value& tc, std::string& doc, | |||
const string_vector& argv, int argv_idx, int argc); | ||||
extern OCTINTERP_API bool | extern OCTINTERP_API bool | |||
save_hdf5_data (std::ostream& os, const octave_value& tc, | save_hdf5_data (std::ostream& os, const octave_value& tc, | |||
const std::string& name, const std::string& doc, | const std::string& name, const std::string& doc, | |||
bool mark_as_global, bool save_as_floats); | bool mark_as_global, bool save_as_floats); | |||
extern OCTINTERP_API bool | extern OCTINTERP_API bool | |||
hdf5_check_attr (hid_t loc_id, const char *attr_name); | hdf5_check_attr (hid_t loc_id, const char *attr_name); | |||
extern OCTINTERP_API bool | extern OCTINTERP_API bool | |||
hdf5_get_scalar_attr (hid_t loc_id, hid_t type_id, const char *attr_name, | hdf5_get_scalar_attr (hid_t loc_id, hid_t type_id, const char *attr_name, | |||
void *buf); | void *buf); | |||
extern OCTINTERP_API herr_t | extern OCTINTERP_API herr_t | |||
hdf5_add_attr (hid_t loc_id, const char *attr_name); | hdf5_add_attr (hid_t loc_id, const char *attr_name); | |||
extern OCTINTERP_API herr_t | extern OCTINTERP_API herr_t | |||
hdf5_add_scalar_attr (hid_t loc_id, hid_t type_id, | hdf5_add_scalar_attr (hid_t loc_id, hid_t type_id, | |||
const char *attr_name, void *buf); | const char *attr_name, void *buf); | |||
#ifdef IDX_TYPE_LONG | #ifdef USE_64_BIT_IDX_T | |||
#define H5T_NATIVE_IDX H5T_NATIVE_LONG | #define H5T_NATIVE_IDX H5T_NATIVE_LONG | |||
#else | #else | |||
#define H5T_NATIVE_IDX H5T_NATIVE_INT | #define H5T_NATIVE_IDX H5T_NATIVE_INT | |||
#endif | #endif | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
44 lines changed or deleted | 45 lines changed or added | |||
ls-mat-ascii.h | ls-mat-ascii.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 34 | skipping to change at line 34 | |||
#define octave_ls_mat_ascii_h 1 | #define octave_ls_mat_ascii_h 1 | |||
extern std::string | extern std::string | |||
read_mat_ascii_data (std::istream& is, const std::string& filename, | read_mat_ascii_data (std::istream& is, const std::string& filename, | |||
octave_value& tc); | octave_value& tc); | |||
extern bool | extern bool | |||
save_mat_ascii_data (std::ostream& os, const octave_value& val_arg, | save_mat_ascii_data (std::ostream& os, const octave_value& val_arg, | |||
int precision, bool tabs = false); | int precision, bool tabs = false); | |||
extern bool looks_like_mat_ascii_file (std::istream& is, | ||||
const std::string& filename); | ||||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 4 lines changed or added | |||
ls-mat4.h | ls-mat4.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
ls-mat5.h | ls-mat5.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 27 | skipping to change at line 27 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ls_mat5_h) | #if !defined (octave_ls_mat5_h) | |||
#define octave_ls_mat5_h 1 | #define octave_ls_mat5_h 1 | |||
enum mat5_data_type | enum mat5_data_type | |||
{ | { | |||
miINT8 = 1, // 8 bit signed | miINT8 = 1, // 8 bit signed | |||
miUINT8, // 8 bit unsigned | miUINT8, // 8 bit unsigned | |||
miINT16, // 16 bit signed | miINT16, // 16 bit signed | |||
miUINT16, // 16 bit unsigned | miUINT16, // 16 bit unsigned | |||
miINT32, // 32 bit signed | miINT32, // 32 bit signed | |||
miUINT32, // 32 bit unsigned | miUINT32, // 32 bit unsigned | |||
miSINGLE, // IEEE 754 single precision float | miSINGLE, // IEEE 754 single precision float | |||
miRESERVE1, | miRESERVE1, | |||
miDOUBLE, // IEEE 754 double precision float | miDOUBLE, // IEEE 754 double precision float | |||
miRESERVE2, | miRESERVE2, | |||
miRESERVE3, | miRESERVE3, | |||
miINT64, // 64 bit signed | miINT64, // 64 bit signed | |||
miUINT64, // 64 bit unsigned | miUINT64, // 64 bit unsigned | |||
miMATRIX, // MATLAB array | miMATRIX, // MATLAB array | |||
miCOMPRESSED, // Compressed data | miCOMPRESSED, // Compressed data | |||
miUTF8, // Unicode UTF-8 Encoded Character Data | miUTF8, // Unicode UTF-8 Encoded Character Data | |||
miUTF16, // Unicode UTF-16 Encoded Character Data | miUTF16, // Unicode UTF-16 Encoded Character Data | |||
miUTF32 // Unicode UTF-32 Encoded Character Data | miUTF32 // Unicode UTF-32 Encoded Character Data | |||
}; | }; | |||
extern int | extern int | |||
read_mat5_binary_file_header (std::istream& is, bool& swap, | read_mat5_binary_file_header (std::istream& is, bool& swap, | |||
bool quiet = false, | bool quiet = false, | |||
const std::string& filename = std::string()); | const std::string& filename = std::string ()) ; | |||
extern std::string | extern std::string | |||
read_mat5_binary_element (std::istream& is, const std::string& filename, | read_mat5_binary_element (std::istream& is, const std::string& filename, | |||
bool swap, bool& global, octave_value& tc); | bool swap, bool& global, octave_value& tc); | |||
extern bool | extern bool | |||
save_mat5_binary_element (std::ostream& os, | save_mat5_binary_element (std::ostream& os, | |||
const octave_value& tc, const std::string& name, | const octave_value& tc, const std::string& name, | |||
bool mark_as_global, bool mat7_format, | bool mark_as_global, bool mat7_format, | |||
bool save_as_floats, bool compressing = false); | bool save_as_floats, bool compressing = false); | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
22 lines changed or deleted | 22 lines changed or added | |||
ls-oct-ascii.h | ls-oct-ascii.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 41 | skipping to change at line 41 | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "ls-ascii-helper.h" | #include "ls-ascii-helper.h" | |||
// Flag for cell elements | // Flag for cell elements | |||
#define CELL_ELT_TAG "<cell-element>" | #define CELL_ELT_TAG "<cell-element>" | |||
// Used when converting Inf to something that gnuplot can read. | // Used when converting Inf to something that gnuplot can read. | |||
#ifndef OCT_RBV | #ifndef OCT_RBV | |||
#define OCT_RBV DBL_MAX / 100.0 | #define OCT_RBV (std::numeric_limits<double>::max () / 100.0) | |||
#endif | #endif | |||
extern OCTINTERP_API std::string | extern OCTINTERP_API std::string | |||
extract_keyword (std::istream& is, const char *keyword, | extract_keyword (std::istream& is, const char *keyword, | |||
const bool next_only = false); | const bool next_only = false); | |||
extern OCTINTERP_API std::string | extern OCTINTERP_API std::string | |||
read_ascii_data (std::istream& is, const std::string& filename, bool& globa l, | read_ascii_data (std::istream& is, const std::string& filename, bool& globa l, | |||
octave_value& tc, octave_idx_type count); | octave_value& tc, octave_idx_type count); | |||
skipping to change at line 77 | skipping to change at line 77 | |||
// Input should look something like: | // Input should look something like: | |||
// | // | |||
// [%#][ \t]*keyword[ \t]*int-value.*\n | // [%#][ \t]*keyword[ \t]*int-value.*\n | |||
template <class T> | template <class T> | |||
bool | bool | |||
extract_keyword (std::istream& is, const char *keyword, T& value, | extract_keyword (std::istream& is, const char *keyword, T& value, | |||
const bool next_only = false) | const bool next_only = false) | |||
{ | { | |||
bool status = false; | bool status = false; | |||
value = T(); | value = T (); | |||
char c; | char c; | |||
while (is.get (c)) | while (is.get (c)) | |||
{ | { | |||
if (c == '%' || c == '#') | if (c == '%' || c == '#') | |||
{ | { | |||
std::ostringstream buf; | std::ostringstream buf; | |||
while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == ' #')) | while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == ' #')) | |||
; // Skip whitespace and comment characters. | ; // Skip whitespace and comment characters. | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ls-oct-binary.h | ls-oct-binary.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
ls-utils.h | ls-utils.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
mach-info.h | mach-info.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 39 | skipping to change at line 39 | |||
OCTAVE_API | OCTAVE_API | |||
oct_mach_info | oct_mach_info | |||
{ | { | |||
protected: | protected: | |||
oct_mach_info (void); | oct_mach_info (void); | |||
public: | public: | |||
enum float_format | enum float_format | |||
{ | { | |||
flt_fmt_unknown, | flt_fmt_unknown, | |||
flt_fmt_ieee_little_endian, | flt_fmt_ieee_little_endian, | |||
flt_fmt_ieee_big_endian, | flt_fmt_ieee_big_endian, | |||
flt_fmt_vax_d, | }; | |||
flt_fmt_vax_g, | ||||
flt_fmt_cray | ||||
}; | ||||
static bool instance_ok (void); | static bool instance_ok (void); | |||
static float_format native_float_format (void); | static float_format native_float_format (void); | |||
static bool words_big_endian (void); | static bool words_big_endian (void); | |||
static bool words_little_endian (void); | static bool words_little_endian (void); | |||
static float_format string_to_float_format (const std::string&); | static float_format string_to_float_format (const std::string&); | |||
End of changes. 2 change blocks. | ||||
9 lines changed or deleted | 6 lines changed or added | |||
mex.h | mex.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2001-2012 Paul Kienzle | Copyright (C) 2001-2013 Paul Kienzle | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 67 | skipping to change at line 67 | |||
#endif | #endif | |||
/* -V4 stuff */ | /* -V4 stuff */ | |||
#if defined (V4) | #if defined (V4) | |||
#define Matrix mxArray | #define Matrix mxArray | |||
#define REAL mxREAL | #define REAL mxREAL | |||
#endif | #endif | |||
#define mxMAXNAME 64 | #define mxMAXNAME 64 | |||
#include "mexproto.h" | ||||
#if defined (__cplusplus) | #if defined (__cplusplus) | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#if defined (V4) | #if defined (V4) | |||
void mexFunction (int nlhs, mxArray* plhs[], int nrhs, mxArray *prhs[]); | void mexFunction (int nlhs, mxArray* plhs[], int nrhs, mxArray *prhs[]); | |||
#else | #else | |||
void mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray *prhs[ ]); | void mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray *prhs[ ]); | |||
#endif | #endif | |||
#include "mexproto.h" | ||||
/* V4 floating point routines renamed in V5. */ | /* V4 floating point routines renamed in V5. */ | |||
#define mexIsNaN mxIsNaN | #define mexIsNaN mxIsNaN | |||
#define mexIsFinite mxIsFinite | #define mexIsFinite mxIsFinite | |||
#define mexIsInf mxIsInf | #define mexIsInf mxIsInf | |||
#define mexGetEps mxGetEps | #define mexGetEps mxGetEps | |||
#define mexGetInf mxGetInf | #define mexGetInf mxGetInf | |||
#define mexGetNaN mxGetNan | #define mexGetNaN mxGetNan | |||
#define mexGetGlobal(nm) mexGetArray (nm, "global") | #define mexGetGlobal(nm) mexGetArray (nm, "global") | |||
#define mexGetMatrix(nm) mexGetArray (nm, "caller") | #define mexGetMatrix(nm) mexGetArray (nm, "caller") | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
mexproto.h | mexproto.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2006-2012 Paul Kienzle | Copyright (C) 2006-2013 Paul Kienzle | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 77 | skipping to change at line 77 | |||
#endif | #endif | |||
#endif | #endif | |||
#define MXARRAY_TYPEDEFS_ONLY | #define MXARRAY_TYPEDEFS_ONLY | |||
#include "mxarray.h" | #include "mxarray.h" | |||
#undef MXARRAY_TYPEDEFS_ONLY | #undef MXARRAY_TYPEDEFS_ONLY | |||
/* Interface to the interpreter. */ | /* Interface to the interpreter. */ | |||
extern OCTINTERP_API const char *mexFunctionName (void); | extern OCTINTERP_API const char *mexFunctionName (void); | |||
extern OCTINTERP_API int mexCallMATLAB (int nargout, mxArray *argout[], int | extern OCTINTERP_API int mexCallMATLAB (int nargout, mxArray *argout[], | |||
nargin, mxArray *argin[], const char *fname); | int nargin, mxArray *argin[], | |||
const char *fname); | ||||
extern OCTINTERP_API void mexSetTrapFlag (int flag); | extern OCTINTERP_API void mexSetTrapFlag (int flag); | |||
extern OCTINTERP_API int mexEvalString (const char *s); | extern OCTINTERP_API int mexEvalString (const char *s); | |||
extern OCTINTERP_API void mexErrMsgTxt (const char *s); | extern OCTINTERP_API void mexErrMsgTxt (const char *s); | |||
extern OCTINTERP_API void mexErrMsgIdAndTxt (const char *id, const char *s, | extern OCTINTERP_API void mexErrMsgIdAndTxt (const char *id, const char *s, | |||
...); | ...); | |||
extern OCTINTERP_API void mexWarnMsgTxt (const char *s); | extern OCTINTERP_API void mexWarnMsgTxt (const char *s); | |||
extern OCTINTERP_API void mexWarnMsgIdAndTxt (const char *id, const char *s | extern OCTINTERP_API void mexWarnMsgIdAndTxt (const char *id, const char *s | |||
, ...); | , | |||
...); | ||||
extern OCTINTERP_API int mexPrintf (const char *fmt, ...); | extern OCTINTERP_API int mexPrintf (const char *fmt, ...); | |||
extern OCTINTERP_API mxArray *mexGetVariable (const char *space, const char | extern OCTINTERP_API mxArray *mexGetVariable (const char *space, | |||
*name); | const char *name); | |||
extern OCTINTERP_API const mxArray *mexGetVariablePtr (const char *space, c | extern OCTINTERP_API const mxArray *mexGetVariablePtr (const char *space, | |||
onst char *name); | const char *name); | |||
extern OCTINTERP_API int mexPutVariable (const char *space, const char *nam | extern OCTINTERP_API int mexPutVariable (const char *space, const char *nam | |||
e, mxArray *ptr); | e, | |||
const mxArray *ptr); | ||||
extern OCTINTERP_API void mexMakeArrayPersistent (mxArray *ptr); | extern OCTINTERP_API void mexMakeArrayPersistent (mxArray *ptr); | |||
extern OCTINTERP_API void mexMakeMemoryPersistent (void *ptr); | extern OCTINTERP_API void mexMakeMemoryPersistent (void *ptr); | |||
extern OCTINTERP_API int mexAtExit (void (*f) (void)); | extern OCTINTERP_API int mexAtExit (void (*f) (void)); | |||
extern OCTINTERP_API const mxArray *mexGet (double handle, const char *prop | extern OCTINTERP_API const mxArray *mexGet (double handle, | |||
erty); | const char *property); | |||
extern OCTINTERP_API int mexIsGlobal (const mxArray *ptr); | extern OCTINTERP_API int mexIsGlobal (const mxArray *ptr); | |||
extern OCTINTERP_API int mexIsLocked (void); | extern OCTINTERP_API int mexIsLocked (void); | |||
extern OCTINTERP_API void mexLock (void); | extern OCTINTERP_API void mexLock (void); | |||
extern OCTINTERP_API int mexSet (double handle, const char *property, mxArr | extern OCTINTERP_API int mexSet (double handle, const char *property, | |||
ay *val); | mxArray *val); | |||
extern OCTINTERP_API void mexUnlock (void); | extern OCTINTERP_API void mexUnlock (void); | |||
/* Floating point predicates. */ | /* Floating point predicates. */ | |||
extern OCTINTERP_API int mxIsFinite (double v); | extern OCTINTERP_API int mxIsFinite (double v); | |||
extern OCTINTERP_API int mxIsInf (double v); | extern OCTINTERP_API int mxIsInf (double v); | |||
extern OCTINTERP_API int mxIsNaN (double v); | extern OCTINTERP_API int mxIsNaN (double v); | |||
/* Floating point values. */ | /* Floating point values. */ | |||
extern OCTINTERP_API double mxGetEps (void); | extern OCTINTERP_API double mxGetEps (void); | |||
extern OCTINTERP_API double mxGetInf (void); | extern OCTINTERP_API double mxGetInf (void); | |||
extern OCTINTERP_API double mxGetNaN (void); | extern OCTINTERP_API double mxGetNaN (void); | |||
/* Memory management. */ | /* Memory management. */ | |||
extern OCTINTERP_API void *mxCalloc (size_t n, size_t size); | extern OCTINTERP_API void *mxCalloc (size_t n, size_t size); | |||
extern OCTINTERP_API void *mxMalloc (size_t n); | extern OCTINTERP_API void *mxMalloc (size_t n); | |||
extern OCTINTERP_API void *mxRealloc (void *ptr, size_t size); | extern OCTINTERP_API void *mxRealloc (void *ptr, size_t size); | |||
extern OCTINTERP_API void mxFree (void *ptr); | extern OCTINTERP_API void mxFree (void *ptr); | |||
/* Constructors. */ | /* Constructors. */ | |||
extern OCTINTERP_API mxArray *mxCreateCellArray (mwSize ndims, const mwSize | extern OCTINTERP_API mxArray *mxCreateCellArray (mwSize ndims, | |||
*dims); | const mwSize *dims); | |||
extern OCTINTERP_API mxArray *mxCreateCellMatrix (mwSize m, mwSize n); | extern OCTINTERP_API mxArray *mxCreateCellMatrix (mwSize m, mwSize n); | |||
extern OCTINTERP_API mxArray *mxCreateCharArray (mwSize ndims, const mwSize | extern OCTINTERP_API mxArray *mxCreateCharArray (mwSize ndims, | |||
*dims); | const mwSize *dims); | |||
extern OCTINTERP_API mxArray *mxCreateCharMatrixFromStrings (mwSize m, cons | extern OCTINTERP_API mxArray *mxCreateCharMatrixFromStrings (mwSize m, | |||
t char **str); | const char **s | |||
extern OCTINTERP_API mxArray *mxCreateDoubleMatrix (mwSize nr, mwSize nc, m | tr); | |||
xComplexity flag); | extern OCTINTERP_API mxArray *mxCreateDoubleMatrix (mwSize nr, mwSize nc, | |||
mxComplexity flag); | ||||
extern OCTINTERP_API mxArray *mxCreateDoubleScalar (double val); | extern OCTINTERP_API mxArray *mxCreateDoubleScalar (double val); | |||
extern OCTINTERP_API mxArray *mxCreateLogicalArray (mwSize ndims, const mwS | extern OCTINTERP_API mxArray *mxCreateLogicalArray (mwSize ndims, | |||
ize *dims); | const mwSize *dims); | |||
extern OCTINTERP_API mxArray *mxCreateLogicalMatrix (mwSize m, mwSize n); | extern OCTINTERP_API mxArray *mxCreateLogicalMatrix (mwSize m, mwSize n); | |||
extern OCTINTERP_API mxArray *mxCreateLogicalScalar (mxLogical val); | extern OCTINTERP_API mxArray *mxCreateLogicalScalar (mxLogical val); | |||
extern OCTINTERP_API mxArray *mxCreateNumericArray (mwSize ndims, const mwS | extern OCTINTERP_API mxArray *mxCreateNumericArray (mwSize ndims, | |||
ize *dims, mxClassID class_id, mxComplexity flag); | const mwSize *dims, | |||
extern OCTINTERP_API mxArray *mxCreateNumericMatrix (mwSize m, mwSize n, mx | mxClassID class_id, | |||
ClassID class_id, mxComplexity flag); | mxComplexity flag); | |||
extern OCTINTERP_API mxArray *mxCreateSparse (mwSize m, mwSize n, mwSize nz | extern OCTINTERP_API mxArray *mxCreateNumericMatrix (mwSize m, mwSize n, | |||
max, mxComplexity flag); | mxClassID class_id, | |||
extern OCTINTERP_API mxArray *mxCreateSparseLogicalMatrix (mwSize m, mwSize | mxComplexity flag); | |||
n, mwSize nzmax); | extern OCTINTERP_API mxArray *mxCreateSparse (mwSize m, mwSize n, mwSize nz | |||
max, | ||||
mxComplexity flag); | ||||
extern OCTINTERP_API mxArray *mxCreateSparseLogicalMatrix (mwSize m, mwSize | ||||
n, | ||||
mwSize nzmax); | ||||
extern OCTINTERP_API mxArray *mxCreateString (const char *str); | extern OCTINTERP_API mxArray *mxCreateString (const char *str); | |||
extern OCTINTERP_API mxArray *mxCreateStructArray (mwSize ndims, const mwSi | extern OCTINTERP_API mxArray *mxCreateStructArray (mwSize ndims, | |||
ze *dims, int num_keys, const char **keys); | const mwSize *dims, | |||
extern OCTINTERP_API mxArray *mxCreateStructMatrix (mwSize rows, mwSize col | int num_keys, | |||
s, int num_keys, const char **keys); | const char **keys); | |||
extern OCTINTERP_API mxArray *mxCreateStructMatrix (mwSize rows, mwSize col | ||||
s, | ||||
int num_keys, | ||||
const char **keys); | ||||
/* Copy constructor. */ | /* Copy constructor. */ | |||
extern OCTINTERP_API mxArray *mxDuplicateArray (const mxArray *v); | extern OCTINTERP_API mxArray *mxDuplicateArray (const mxArray *v); | |||
/* Destructor. */ | /* Destructor. */ | |||
extern OCTINTERP_API void mxDestroyArray (mxArray *v); | extern OCTINTERP_API void mxDestroyArray (mxArray *v); | |||
/* Type Predicates. */ | /* Type Predicates. */ | |||
extern OCTINTERP_API int mxIsCell (const mxArray *ptr); | extern OCTINTERP_API int mxIsCell (const mxArray *ptr); | |||
extern OCTINTERP_API int mxIsChar (const mxArray *ptr); | extern OCTINTERP_API int mxIsChar (const mxArray *ptr); | |||
skipping to change at line 186 | skipping to change at line 212 | |||
/* Dimension extractors. */ | /* Dimension extractors. */ | |||
extern OCTINTERP_API size_t mxGetM (const mxArray *ptr); | extern OCTINTERP_API size_t mxGetM (const mxArray *ptr); | |||
extern OCTINTERP_API size_t mxGetN (const mxArray *ptr); | extern OCTINTERP_API size_t mxGetN (const mxArray *ptr); | |||
extern OCTINTERP_API mwSize *mxGetDimensions (const mxArray *ptr); | extern OCTINTERP_API mwSize *mxGetDimensions (const mxArray *ptr); | |||
extern OCTINTERP_API mwSize mxGetNumberOfDimensions (const mxArray *ptr); | extern OCTINTERP_API mwSize mxGetNumberOfDimensions (const mxArray *ptr); | |||
extern OCTINTERP_API size_t mxGetNumberOfElements (const mxArray *ptr); | extern OCTINTERP_API size_t mxGetNumberOfElements (const mxArray *ptr); | |||
/* Dimension setters. */ | /* Dimension setters. */ | |||
extern OCTINTERP_API void mxSetM (mxArray *ptr, mwSize M); | extern OCTINTERP_API void mxSetM (mxArray *ptr, mwSize M); | |||
extern OCTINTERP_API void mxSetN (mxArray *ptr, mwSize N); | extern OCTINTERP_API void mxSetN (mxArray *ptr, mwSize N); | |||
extern OCTINTERP_API void mxSetDimensions (mxArray *ptr, const mwSize *dims | extern OCTINTERP_API void mxSetDimensions (mxArray *ptr, const mwSize *dims | |||
, mwSize ndims); | , | |||
mwSize ndims); | ||||
/* Data extractors. */ | /* Data extractors. */ | |||
extern OCTINTERP_API double *mxGetPi (const mxArray *ptr); | extern OCTINTERP_API double *mxGetPi (const mxArray *ptr); | |||
extern OCTINTERP_API double *mxGetPr (const mxArray *ptr); | extern OCTINTERP_API double *mxGetPr (const mxArray *ptr); | |||
extern OCTINTERP_API double mxGetScalar (const mxArray *ptr); | extern OCTINTERP_API double mxGetScalar (const mxArray *ptr); | |||
extern OCTINTERP_API mxChar *mxGetChars (const mxArray *ptr); | extern OCTINTERP_API mxChar *mxGetChars (const mxArray *ptr); | |||
extern OCTINTERP_API mxLogical *mxGetLogicals (const mxArray *ptr); | extern OCTINTERP_API mxLogical *mxGetLogicals (const mxArray *ptr); | |||
extern OCTINTERP_API void *mxGetData (const mxArray *ptr); | extern OCTINTERP_API void *mxGetData (const mxArray *ptr); | |||
extern OCTINTERP_API void *mxGetImagData (const mxArray *ptr); | extern OCTINTERP_API void *mxGetImagData (const mxArray *ptr); | |||
skipping to change at line 228 | skipping to change at line 255 | |||
extern OCTINTERP_API void mxSetIr (mxArray *ptr, mwIndex *ir); | extern OCTINTERP_API void mxSetIr (mxArray *ptr, mwIndex *ir); | |||
extern OCTINTERP_API void mxSetJc (mxArray *ptr, mwIndex *jc); | extern OCTINTERP_API void mxSetJc (mxArray *ptr, mwIndex *jc); | |||
extern OCTINTERP_API void mxSetNzmax (mxArray *ptr, mwSize nzmax); | extern OCTINTERP_API void mxSetNzmax (mxArray *ptr, mwSize nzmax); | |||
/* Structure support. */ | /* Structure support. */ | |||
extern OCTINTERP_API int mxAddField (mxArray *ptr, const char *key); | extern OCTINTERP_API int mxAddField (mxArray *ptr, const char *key); | |||
extern OCTINTERP_API void mxRemoveField (mxArray *ptr, int key_num); | extern OCTINTERP_API void mxRemoveField (mxArray *ptr, int key_num); | |||
extern OCTINTERP_API mxArray *mxGetField (const mxArray *ptr, mwIndex index | extern OCTINTERP_API mxArray *mxGetField (const mxArray *ptr, mwIndex index | |||
, const char *key); | , | |||
extern OCTINTERP_API mxArray *mxGetFieldByNumber (const mxArray *ptr, mwInd | const char *key); | |||
ex index, int key_num); | extern OCTINTERP_API mxArray *mxGetFieldByNumber (const mxArray *ptr, | |||
mwIndex index, int key_nu | ||||
extern OCTINTERP_API void mxSetField (mxArray *ptr, mwIndex index, const ch | m); | |||
ar *key, mxArray *val); | ||||
extern OCTINTERP_API void mxSetFieldByNumber (mxArray *ptr, mwIndex index, | extern OCTINTERP_API void mxSetField (mxArray *ptr, mwIndex index, | |||
int key_num, mxArray *val); | const char *key, mxArray *val); | |||
extern OCTINTERP_API void mxSetFieldByNumber (mxArray *ptr, mwIndex index, | ||||
int key_num, mxArray *val); | ||||
extern OCTINTERP_API int mxGetNumberOfFields (const mxArray *ptr); | extern OCTINTERP_API int mxGetNumberOfFields (const mxArray *ptr); | |||
extern OCTINTERP_API const char *mxGetFieldNameByNumber (const mxArray *ptr | extern OCTINTERP_API const char *mxGetFieldNameByNumber (const mxArray *ptr | |||
, int key_num); | , | |||
int key_num); | ||||
extern OCTINTERP_API int mxGetFieldNumber (const mxArray *ptr, const char * key); | extern OCTINTERP_API int mxGetFieldNumber (const mxArray *ptr, const char * key); | |||
extern OCTINTERP_API int mxGetString (const mxArray *ptr, char *buf, mwSize | extern OCTINTERP_API int mxGetString (const mxArray *ptr, char *buf, | |||
buflen); | mwSize buflen); | |||
extern OCTINTERP_API char *mxArrayToString (const mxArray *ptr); | extern OCTINTERP_API char *mxArrayToString (const mxArray *ptr); | |||
/* Miscellaneous. */ | /* Miscellaneous. */ | |||
#ifdef NDEBUG | #ifdef NDEBUG | |||
#define mxAssert(expr, msg) \ | #define mxAssert(expr, msg) \ | |||
do \ | do \ | |||
{ \ | { \ | |||
if (! expr) \ | if (! expr) \ | |||
{ \ | { \ | |||
mexPrintf ("Assertion failed: %s, at line %d of file \"%s\".\n%s\ n", \ | mexPrintf ("Assertion failed: %s, at line %d of file \"%s\".\n%s\ n", \ | |||
skipping to change at line 271 | skipping to change at line 304 | |||
__LINE__, __FILE__, msg); \ | __LINE__, __FILE__, msg); \ | |||
abort (); \ | abort (); \ | |||
} \ | } \ | |||
} \ | } \ | |||
while (0) | while (0) | |||
#else | #else | |||
#define mxAssert(expr, msg) | #define mxAssert(expr, msg) | |||
#define mxAssertS(expr, msg) | #define mxAssertS(expr, msg) | |||
#endif | #endif | |||
extern OCTINTERP_API mwIndex mxCalcSingleSubscript (const mxArray *ptr, mwS | extern OCTINTERP_API mwIndex mxCalcSingleSubscript (const mxArray *ptr, | |||
ize nsubs, mwIndex *subs); | mwSize nsubs, mwIndex * | |||
subs); | ||||
extern OCTINTERP_API size_t mxGetElementSize (const mxArray *ptr); | extern OCTINTERP_API size_t mxGetElementSize (const mxArray *ptr); | |||
#if defined (__cplusplus) | #if defined (__cplusplus) | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 18 change blocks. | ||||
56 lines changed or deleted | 74 lines changed or added | |||
mx-base.h | mx-base.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
mx-defs.h | mx-defs.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
mx-ext.h | mx-ext.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
mx-inlines.cc | mx-inlines.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
Copyright (C) 2009 Jaroslav Hajek | Copyright (C) 2009 Jaroslav Hajek | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
skipping to change at line 65 | skipping to change at line 65 | |||
#define DEFMXUNOPEQ(F, OP) \ | #define DEFMXUNOPEQ(F, OP) \ | |||
template <class R> \ | template <class R> \ | |||
inline void F (size_t n, R *r) throw () \ | inline void F (size_t n, R *r) throw () \ | |||
{ for (size_t i = 0; i < n; i++) r[i] = OP r[i]; } | { for (size_t i = 0; i < n; i++) r[i] = OP r[i]; } | |||
DEFMXUNOPEQ (mx_inline_uminus2, -) | DEFMXUNOPEQ (mx_inline_uminus2, -) | |||
#define DEFMXUNBOOLOP(F, OP) \ | #define DEFMXUNBOOLOP(F, OP) \ | |||
template <class X> \ | template <class X> \ | |||
inline void F (size_t n, bool *r, const X *x) throw () \ | inline void F (size_t n, bool *r, const X *x) throw () \ | |||
{ const X zero = X(); for (size_t i = 0; i < n; i++) r[i] = x[i] OP zero; } | { const X zero = X (); for (size_t i = 0; i < n; i++) r[i] = x[i] OP zero; } | |||
DEFMXUNBOOLOP (mx_inline_iszero, ==) | DEFMXUNBOOLOP (mx_inline_iszero, ==) | |||
DEFMXUNBOOLOP (mx_inline_notzero, !=) | DEFMXUNBOOLOP (mx_inline_notzero, !=) | |||
#define DEFMXBINOP(F, OP) \ | #define DEFMXBINOP(F, OP) \ | |||
template <class R, class X, class Y> \ | template <class R, class X, class Y> \ | |||
inline void F (size_t n, R *r, const X *x, const Y *y) throw () \ | inline void F (size_t n, R *r, const X *x, const Y *y) throw () \ | |||
{ for (size_t i = 0; i < n; i++) r[i] = x[i] OP y[i]; } \ | { for (size_t i = 0; i < n; i++) r[i] = x[i] OP y[i]; } \ | |||
template <class R, class X, class Y> \ | template <class R, class X, class Y> \ | |||
inline void F (size_t n, R *r, const X *x, Y y) throw () \ | inline void F (size_t n, R *r, const X *x, Y y) throw () \ | |||
skipping to change at line 486 | skipping to change at line 486 | |||
inline bool xis_true (const Complex& x) { return ! xisnan (x) && x != 0.0; } | inline bool xis_true (const Complex& x) { return ! xisnan (x) && x != 0.0; } | |||
inline bool xis_false (const Complex& x) { return x == 0.0; } | inline bool xis_false (const Complex& x) { return x == 0.0; } | |||
inline bool xis_true (const FloatComplex& x) { return ! xisnan (x) && x != 0.0f; } | inline bool xis_true (const FloatComplex& x) { return ! xisnan (x) && x != 0.0f; } | |||
inline bool xis_false (const FloatComplex& x) { return x == 0.0f; } | inline bool xis_false (const FloatComplex& x) { return x == 0.0f; } | |||
#define OP_RED_SUM(ac, el) ac += el | #define OP_RED_SUM(ac, el) ac += el | |||
#define OP_RED_PROD(ac, el) ac *= el | #define OP_RED_PROD(ac, el) ac *= el | |||
#define OP_RED_SUMSQ(ac, el) ac += el*el | #define OP_RED_SUMSQ(ac, el) ac += el*el | |||
#define OP_RED_SUMSQC(ac, el) ac += cabsq (el) | #define OP_RED_SUMSQC(ac, el) ac += cabsq (el) | |||
inline void op_dble_sum(double& ac, float el) | inline void op_dble_sum (double& ac, float el) | |||
{ ac += el; } | { ac += el; } | |||
inline void op_dble_sum(Complex& ac, const FloatComplex& el) | inline void op_dble_sum (Complex& ac, const FloatComplex& el) | |||
{ ac += el; } // FIXME: guaranteed? | { ac += el; } // FIXME: guaranteed? | |||
template <class T> | template <class T> | |||
inline void op_dble_sum(double& ac, const octave_int<T>& el) | inline void op_dble_sum (double& ac, const octave_int<T>& el) | |||
{ ac += el.double_value (); } | { ac += el.double_value (); } | |||
// The following two implement a simple short-circuiting. | // The following two implement a simple short-circuiting. | |||
#define OP_RED_ANYC(ac, el) if (xis_true (el)) { ac = true; break; } else c ontinue | #define OP_RED_ANYC(ac, el) if (xis_true (el)) { ac = true; break; } else c ontinue | |||
#define OP_RED_ALLC(ac, el) if (xis_false (el)) { ac = false; break; } else continue | #define OP_RED_ALLC(ac, el) if (xis_false (el)) { ac = false; break; } else continue | |||
#define OP_RED_FCN(F, TSRC, TRES, OP, ZERO) \ | #define OP_RED_FCN(F, TSRC, TRES, OP, ZERO) \ | |||
template <class T> \ | template <class T> \ | |||
inline TRES \ | inline TRES \ | |||
F (const TSRC* v, octave_idx_type n) \ | F (const TSRC* v, octave_idx_type n) \ | |||
skipping to change at line 1055 | skipping to change at line 1055 | |||
T lst = v[1] - v[0]; | T lst = v[1] - v[0]; | |||
for (octave_idx_type i = 0; i < n-2; i++) | for (octave_idx_type i = 0; i < n-2; i++) | |||
{ | { | |||
T dif = v[i+2] - v[i+1]; | T dif = v[i+2] - v[i+1]; | |||
r[i] = dif - lst; | r[i] = dif - lst; | |||
lst = dif; | lst = dif; | |||
} | } | |||
} | } | |||
break; | break; | |||
default: | default: | |||
{ | { | |||
OCTAVE_LOCAL_BUFFER (T, buf, n-1); | OCTAVE_LOCAL_BUFFER (T, buf, n-1); | |||
for (octave_idx_type i = 0; i < n-1; i++) | ||||
buf[i] = v[i+1] - v[i]; | ||||
for (octave_idx_type o = 2; o <= order; o++) | for (octave_idx_type i = 0; i < n-1; i++) | |||
{ | buf[i] = v[i+1] - v[i]; | |||
for (octave_idx_type i = 0; i < n-o; i++) | ||||
buf[i] = buf[i+1] - buf[i]; | ||||
} | ||||
for (octave_idx_type i = 0; i < n-order; i++) | for (octave_idx_type o = 2; o <= order; o++) | |||
r[i] = buf[i]; | { | |||
} | for (octave_idx_type i = 0; i < n-o; i++) | |||
buf[i] = buf[i+1] - buf[i]; | ||||
} | ||||
for (octave_idx_type i = 0; i < n-order; i++) | ||||
r[i] = buf[i]; | ||||
} | ||||
} | } | |||
} | } | |||
template <class T> | template <class T> | |||
void mx_inline_diff (const T *v, T *r, | void mx_inline_diff (const T *v, T *r, | |||
octave_idx_type m, octave_idx_type n, | octave_idx_type m, octave_idx_type n, | |||
octave_idx_type order) | octave_idx_type order) | |||
{ | { | |||
switch (order) | switch (order) | |||
{ | { | |||
skipping to change at line 1092 | skipping to change at line 1092 | |||
r[i] = v[i+m] - v[i]; | r[i] = v[i+m] - v[i]; | |||
break; | break; | |||
case 2: | case 2: | |||
for (octave_idx_type i = 0; i < n-2; i++) | for (octave_idx_type i = 0; i < n-2; i++) | |||
{ | { | |||
for (octave_idx_type j = i*m; j < i*m+m; j++) | for (octave_idx_type j = i*m; j < i*m+m; j++) | |||
r[j] = (v[j+m+m] - v[j+m]) - (v[j+m] - v[j]); | r[j] = (v[j+m+m] - v[j+m]) - (v[j+m] - v[j]); | |||
} | } | |||
break; | break; | |||
default: | default: | |||
{ | { | |||
OCTAVE_LOCAL_BUFFER (T, buf, n-1); | OCTAVE_LOCAL_BUFFER (T, buf, n-1); | |||
for (octave_idx_type j = 0; j < m; j++) | for (octave_idx_type j = 0; j < m; j++) | |||
{ | { | |||
for (octave_idx_type i = 0; i < n-1; i++) | for (octave_idx_type i = 0; i < n-1; i++) | |||
buf[i] = v[i*m+j+m] - v[i*m+j]; | buf[i] = v[i*m+j+m] - v[i*m+j]; | |||
for (octave_idx_type o = 2; o <= order; o++) | for (octave_idx_type o = 2; o <= order; o++) | |||
{ | { | |||
for (octave_idx_type i = 0; i < n-o; i++) | for (octave_idx_type i = 0; i < n-o; i++) | |||
buf[i] = buf[i+1] - buf[i]; | buf[i] = buf[i+1] - buf[i]; | |||
} | } | |||
for (octave_idx_type i = 0; i < n-order; i++) | for (octave_idx_type i = 0; i < n-order; i++) | |||
r[i*m+j] = buf[i]; | r[i*m+j] = buf[i]; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
template <class T> | template <class T> | |||
inline void | inline void | |||
mx_inline_diff (const T *v, T *r, | mx_inline_diff (const T *v, T *r, | |||
octave_idx_type l, octave_idx_type n, octave_idx_type u, | octave_idx_type l, octave_idx_type n, octave_idx_type u, | |||
octave_idx_type order) | octave_idx_type order) | |||
{ | { | |||
if (! n) return; | if (! n) return; | |||
skipping to change at line 1179 | skipping to change at line 1179 | |||
// maybe it can be done without an explicit parameter? | // maybe it can be done without an explicit parameter? | |||
template <class R, class T> | template <class R, class T> | |||
inline Array<R> | inline Array<R> | |||
do_mx_red_op (const Array<T>& src, int dim, | do_mx_red_op (const Array<T>& src, int dim, | |||
void (*mx_red_op) (const T *, R *, octave_idx_type, | void (*mx_red_op) (const T *, R *, octave_idx_type, | |||
octave_idx_type, octave_idx_type)) | octave_idx_type, octave_idx_type)) | |||
{ | { | |||
octave_idx_type l, n, u; | octave_idx_type l, n, u; | |||
dim_vector dims = src.dims (); | dim_vector dims = src.dims (); | |||
// M*b inconsistency: sum([]) = 0 etc. | // M*b inconsistency: sum ([]) = 0 etc. | |||
if (dims.length () == 2 && dims(0) == 0 && dims(1) == 0) | if (dims.length () == 2 && dims(0) == 0 && dims(1) == 0) | |||
dims (1) = 1; | dims (1) = 1; | |||
get_extent_triplet (dims, dim, l, n, u); | get_extent_triplet (dims, dim, l, n, u); | |||
// Reduction operation reduces the array size. | // Reduction operation reduces the array size. | |||
if (dim < dims.length ()) dims(dim) = 1; | if (dim < dims.length ()) dims(dim) = 1; | |||
dims.chop_trailing_singletons (); | dims.chop_trailing_singletons (); | |||
Array<R> ret (dims); | Array<R> ret (dims); | |||
End of changes. 11 change blocks. | ||||
36 lines changed or deleted | 36 lines changed or added | |||
mx-op-decl.h | mx-op-decl.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
Copyright (C) 2009 VZLU Prague, a.s. | Copyright (C) 2009 VZLU Prague, a.s. | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
mx-op-defs.h | mx-op-defs.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
Copyright (C) 2009-2010 VZLU Prague, a.s. | Copyright (C) 2009-2010 VZLU Prague, a.s. | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
skipping to change at line 416 | skipping to change at line 416 | |||
{ \ | { \ | |||
r.resize (m_nr, m_nc); \ | r.resize (m_nr, m_nc); \ | |||
\ | \ | |||
if (m_nr > 0 && m_nc > 0) \ | if (m_nr > 0 && m_nc > 0) \ | |||
{ \ | { \ | |||
r = R (m); \ | r = R (m); \ | |||
\ | \ | |||
octave_idx_type len = dm.length (); \ | octave_idx_type len = dm.length (); \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < len; i++) \ | for (octave_idx_type i = 0; i < len; i++) \ | |||
r.elem(i, i) OPEQ dm.elem(i, i); \ | r.elem (i, i) OPEQ dm.elem (i, i); \ | |||
} \ | } \ | |||
} \ | } \ | |||
\ | \ | |||
return r; \ | return r; \ | |||
} | } | |||
#define MDM_MULTIPLY_OP(R, M, DM, R_ZERO) \ | #define MDM_MULTIPLY_OP(R, M, DM, R_ZERO) \ | |||
R \ | R \ | |||
operator * (const M& m, const DM& dm) \ | operator * (const M& m, const DM& dm) \ | |||
{ \ | { \ | |||
skipping to change at line 486 | skipping to change at line 486 | |||
gripe_nonconformant (#OP, dm_nr, dm_nc, m_nr, m_nc); \ | gripe_nonconformant (#OP, dm_nr, dm_nc, m_nr, m_nc); \ | |||
else \ | else \ | |||
{ \ | { \ | |||
if (m_nr > 0 && m_nc > 0) \ | if (m_nr > 0 && m_nc > 0) \ | |||
{ \ | { \ | |||
r = R (PREOP m); \ | r = R (PREOP m); \ | |||
\ | \ | |||
octave_idx_type len = dm.length (); \ | octave_idx_type len = dm.length (); \ | |||
\ | \ | |||
for (octave_idx_type i = 0; i < len; i++) \ | for (octave_idx_type i = 0; i < len; i++) \ | |||
r.elem(i, i) OPEQ dm.elem(i, i); \ | r.elem (i, i) OPEQ dm.elem (i, i); \ | |||
} \ | } \ | |||
else \ | else \ | |||
r.resize (m_nr, m_nc); \ | r.resize (m_nr, m_nc); \ | |||
} \ | } \ | |||
\ | \ | |||
return r; \ | return r; \ | |||
} | } | |||
#define DMM_MULTIPLY_OP(R, DM, M, R_ZERO) \ | #define DMM_MULTIPLY_OP(R, DM, M, R_ZERO) \ | |||
R \ | R \ | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
mxarray.h | mxarray.h | |||
---|---|---|---|---|
// DO NOT EDIT! Generated automatically from mxarray.in.h by Make. | ||||
/* | /* | |||
Copyright (C) 2001-2012 Paul Kienzle | Copyright (C) 2001-2013 Paul Kienzle | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 50 | skipping to change at line 51 | |||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
SUCH DAMAGE. | SUCH DAMAGE. | |||
*/ | */ | |||
#if ! defined (MXARRAY_H) | #if ! defined (MXARRAY_H) | |||
#define MXARRAY_H | #define MXARRAY_H | |||
typedef enum | typedef enum | |||
{ | { | |||
mxREAL = 0, | mxREAL = 0, | |||
mxCOMPLEX = 1 | mxCOMPLEX = 1 | |||
} | } | |||
mxComplexity; | mxComplexity; | |||
typedef enum | typedef enum | |||
{ | { | |||
mxUNKNOWN_CLASS = 0, | mxUNKNOWN_CLASS = 0, | |||
mxCELL_CLASS, | mxCELL_CLASS, | |||
mxSTRUCT_CLASS, | mxSTRUCT_CLASS, | |||
mxLOGICAL_CLASS, | mxLOGICAL_CLASS, | |||
mxCHAR_CLASS, | mxCHAR_CLASS, | |||
mxUNUSED_CLASS, | mxUNUSED_CLASS, | |||
mxDOUBLE_CLASS, | mxDOUBLE_CLASS, | |||
mxSINGLE_CLASS, | mxSINGLE_CLASS, | |||
mxINT8_CLASS, | mxINT8_CLASS, | |||
mxUINT8_CLASS, | mxUINT8_CLASS, | |||
mxINT16_CLASS, | mxINT16_CLASS, | |||
mxUINT16_CLASS, | mxUINT16_CLASS, | |||
mxINT32_CLASS, | mxINT32_CLASS, | |||
mxUINT32_CLASS, | mxUINT32_CLASS, | |||
mxINT64_CLASS, | mxINT64_CLASS, | |||
mxUINT64_CLASS, | mxUINT64_CLASS, | |||
mxFUNCTION_CLASS | mxFUNCTION_CLASS | |||
} | } | |||
mxClassID; | mxClassID; | |||
typedef unsigned char mxLogical; | typedef unsigned char mxLogical; | |||
/* typedef Uint16 mxChar; */ | /* typedef Uint16 mxChar; */ | |||
typedef char mxChar; | typedef char mxChar; | |||
/* | /* | |||
* FIXME? Mathworks says these should be size_t on 64-bit system and when | * FIXME? Mathworks says these should be size_t on 64-bit system and when | |||
* mex is used with the -largearraydims flag, but why do that? Its better | * mex is used with the -largearraydims flag, but why do that? Its better | |||
* to conform to the same indexing as the rest of Octave | * to conform to the same indexing as the rest of Octave | |||
*/ | */ | |||
typedef int mwSize; | typedef int mwSize; | |||
typedef int mwIndex; | typedef int mwIndex; | |||
typedef int mwSignedIndex; | ||||
#if ! defined (MXARRAY_TYPEDEFS_ONLY) | #if ! defined (MXARRAY_TYPEDEFS_ONLY) | |||
#include <cstring> | #include <cstring> | |||
class octave_value; | class octave_value; | |||
#define DO_MUTABLE_METHOD(RET_T, METHOD_CALL) \ | #define DO_MUTABLE_METHOD(RET_T, METHOD_CALL) \ | |||
RET_T retval = rep->METHOD_CALL; \ | RET_T retval = rep->METHOD_CALL; \ | |||
\ | \ | |||
skipping to change at line 117 | skipping to change at line 119 | |||
#define DO_VOID_MUTABLE_METHOD(METHOD_CALL) \ | #define DO_VOID_MUTABLE_METHOD(METHOD_CALL) \ | |||
rep->METHOD_CALL; \ | rep->METHOD_CALL; \ | |||
\ | \ | |||
if (rep->mutation_needed ()) \ | if (rep->mutation_needed ()) \ | |||
{ \ | { \ | |||
maybe_mutate (); \ | maybe_mutate (); \ | |||
rep->METHOD_CALL; \ | rep->METHOD_CALL; \ | |||
} | } | |||
// This just provides a way to avoid infinite recursion when building | // A class to provide the default implemenation of some of the virtual | |||
// mxArray objects. | // functions declared in the mxArray class. | |||
class mxArray; | ||||
struct | class mxArray_base | |||
xmxArray | ||||
{ | { | |||
xmxArray (void) { } | protected: | |||
mxArray_base (void) { } | ||||
public: | ||||
virtual mxArray_base *dup (void) const = 0; | ||||
virtual mxArray *as_mxArray (void) const { return 0; } | ||||
virtual ~mxArray_base (void) { } | ||||
virtual bool is_octave_value (void) const { return false; } | ||||
virtual int is_cell (void) const = 0; | ||||
virtual int is_char (void) const = 0; | ||||
virtual int is_class (const char *name_arg) const | ||||
{ | ||||
int retval = 0; | ||||
const char *cname = get_class_name (); | ||||
if (cname && name_arg) | ||||
retval = ! strcmp (cname, name_arg); | ||||
return retval; | ||||
} | ||||
virtual int is_complex (void) const = 0; | ||||
virtual int is_double (void) const = 0; | ||||
virtual int is_function_handle (void) const = 0; | ||||
virtual int is_int16 (void) const = 0; | ||||
virtual int is_int32 (void) const = 0; | ||||
virtual int is_int64 (void) const = 0; | ||||
virtual int is_int8 (void) const = 0; | ||||
virtual int is_logical (void) const = 0; | ||||
virtual int is_numeric (void) const = 0; | ||||
virtual int is_single (void) const = 0; | ||||
virtual int is_sparse (void) const = 0; | ||||
virtual int is_struct (void) const = 0; | ||||
virtual int is_uint16 (void) const = 0; | ||||
virtual int is_uint32 (void) const = 0; | ||||
virtual int is_uint64 (void) const = 0; | ||||
virtual int is_uint8 (void) const = 0; | ||||
virtual int is_logical_scalar (void) const | ||||
{ | ||||
return is_logical () && get_number_of_elements () == 1; | ||||
} | ||||
virtual int is_logical_scalar_true (void) const = 0; | ||||
virtual mwSize get_m (void) const = 0; | ||||
virtual mwSize get_n (void) const = 0; | ||||
virtual mwSize *get_dimensions (void) const = 0; | ||||
virtual mwSize get_number_of_dimensions (void) const = 0; | ||||
virtual void set_m (mwSize m) = 0; | ||||
virtual void set_n (mwSize n) = 0; | ||||
virtual void set_dimensions (mwSize *dims_arg, mwSize ndims_arg) = 0; | ||||
virtual mwSize get_number_of_elements (void) const = 0; | ||||
virtual int is_empty (void) const = 0; | ||||
virtual mxClassID get_class_id (void) const = 0; | ||||
virtual const char *get_class_name (void) const = 0; | ||||
virtual void set_class_name (const char *name_arg) = 0; | ||||
virtual mxArray *get_cell (mwIndex /*idx*/) const | ||||
{ | ||||
invalid_type_error (); | ||||
return 0; | ||||
} | ||||
virtual void set_cell (mwIndex idx, mxArray *val) = 0; | ||||
virtual double get_scalar (void) const = 0; | ||||
virtual void *get_data (void) const = 0; | ||||
virtual void *get_imag_data (void) const = 0; | ||||
virtual void set_data (void *pr) = 0; | ||||
virtual void set_imag_data (void *pi) = 0; | ||||
virtual mwIndex *get_ir (void) const = 0; | ||||
virtual mwIndex *get_jc (void) const = 0; | ||||
virtual mwSize get_nzmax (void) const = 0; | ||||
virtual void set_ir (mwIndex *ir) = 0; | ||||
virtual void set_jc (mwIndex *jc) = 0; | ||||
virtual void set_nzmax (mwSize nzmax) = 0; | ||||
virtual int add_field (const char *key) = 0; | ||||
virtual void remove_field (int key_num) = 0; | ||||
virtual mxArray *get_field_by_number (mwIndex index, int key_num) const = | ||||
0; | ||||
virtual void | ||||
set_field_by_number (mwIndex index, int key_num, mxArray *val) = 0; | ||||
virtual int get_number_of_fields (void) const = 0; | ||||
virtual const char *get_field_name_by_number (int key_num) const = 0; | ||||
virtual int get_field_number (const char *key) const = 0; | ||||
virtual int get_string (char *buf, mwSize buflen) const = 0; | ||||
virtual char *array_to_string (void) const = 0; | ||||
virtual mwIndex calc_single_subscript (mwSize nsubs, mwIndex *subs) const | ||||
= 0; | ||||
virtual size_t get_element_size (void) const = 0; | ||||
virtual bool mutation_needed (void) const { return false; } | ||||
virtual mxArray *mutate (void) const { return 0; } | ||||
virtual octave_value as_octave_value (void) const = 0; | ||||
protected: | ||||
mxArray_base (const mxArray_base&) { } | ||||
void invalid_type_error (void) const | ||||
{ | ||||
error ("invalid type for operation"); | ||||
} | ||||
void error (const char *msg) const; | ||||
}; | }; | |||
// The main interface class. The representation can be based on an | // The main interface class. The representation can be based on an | |||
// octave_value object or a separate object that tries to reproduce | // octave_value object or a separate object that tries to reproduce | |||
// the semantics of mxArray objects in Matlab more directly. | // the semantics of mxArray objects in Matlab more directly. | |||
class mxArray | class mxArray | |||
{ | { | |||
public: | public: | |||
skipping to change at line 166 | skipping to change at line 330 | |||
mxArray (const dim_vector& dv, int num_keys, const char **keys); | mxArray (const dim_vector& dv, int num_keys, const char **keys); | |||
mxArray (mwSize m, mwSize n, int num_keys, const char **keys); | mxArray (mwSize m, mwSize n, int num_keys, const char **keys); | |||
mxArray (mwSize ndims, const mwSize *dims); | mxArray (mwSize ndims, const mwSize *dims); | |||
mxArray (const dim_vector& dv); | mxArray (const dim_vector& dv); | |||
mxArray (mwSize m, mwSize n); | mxArray (mwSize m, mwSize n); | |||
virtual mxArray *dup (void) const | mxArray *dup (void) const | |||
{ | { | |||
mxArray *new_rep = rep->dup (); | mxArray *retval = rep->as_mxArray (); | |||
return new mxArray (new_rep, name); | if (retval) | |||
retval->set_name (name); | ||||
else | ||||
{ | ||||
mxArray_base *new_rep = rep->dup (); | ||||
retval = new mxArray (new_rep, name); | ||||
} | ||||
return retval; | ||||
} | } | |||
virtual ~mxArray (void); | ~mxArray (void); | |||
virtual bool is_octave_value (void) const { return rep->is_octave_value ( ); } | bool is_octave_value (void) const { return rep->is_octave_value (); } | |||
virtual int is_cell (void) const { return rep->is_cell (); } | int is_cell (void) const { return rep->is_cell (); } | |||
virtual int is_char (void) const { return rep->is_char (); } | int is_char (void) const { return rep->is_char (); } | |||
virtual int is_class (const char *name_arg) const { return rep->is_class (name_arg); } | int is_class (const char *name_arg) const { return rep->is_class (name_ar g); } | |||
virtual int is_complex (void) const { return rep->is_complex (); } | int is_complex (void) const { return rep->is_complex (); } | |||
virtual int is_double (void) const { return rep->is_double (); } | int is_double (void) const { return rep->is_double (); } | |||
virtual int is_function_handle (void) const { return rep->is_function_han dle (); } | int is_function_handle (void) const { return rep->is_function_handle (); } | |||
virtual int is_int16 (void) const { return rep->is_int16 (); } | int is_int16 (void) const { return rep->is_int16 (); } | |||
virtual int is_int32 (void) const { return rep->is_int32 (); } | int is_int32 (void) const { return rep->is_int32 (); } | |||
virtual int is_int64 (void) const { return rep->is_int64 (); } | int is_int64 (void) const { return rep->is_int64 (); } | |||
virtual int is_int8 (void) const { return rep->is_int8 (); } | int is_int8 (void) const { return rep->is_int8 (); } | |||
virtual int is_logical (void) const { return rep->is_logical (); } | int is_logical (void) const { return rep->is_logical (); } | |||
virtual int is_numeric (void) const { return rep->is_numeric (); } | int is_numeric (void) const { return rep->is_numeric (); } | |||
virtual int is_single (void) const { return rep->is_single (); } | int is_single (void) const { return rep->is_single (); } | |||
virtual int is_sparse (void) const { return rep->is_sparse (); } | int is_sparse (void) const { return rep->is_sparse (); } | |||
virtual int is_struct (void) const { return rep->is_struct (); } | int is_struct (void) const { return rep->is_struct (); } | |||
virtual int is_uint16 (void) const { return rep->is_uint16 (); } | int is_uint16 (void) const { return rep->is_uint16 (); } | |||
virtual int is_uint32 (void) const { return rep->is_uint32 (); } | int is_uint32 (void) const { return rep->is_uint32 (); } | |||
virtual int is_uint64 (void) const { return rep->is_uint64 (); } | int is_uint64 (void) const { return rep->is_uint64 (); } | |||
virtual int is_uint8 (void) const { return rep->is_uint8 (); } | int is_uint8 (void) const { return rep->is_uint8 (); } | |||
virtual int is_logical_scalar (void) const { return rep->is_logical_scala r (); } | int is_logical_scalar (void) const { return rep->is_logical_scalar (); } | |||
virtual int is_logical_scalar_true (void) const { return rep->is_logical_ | int is_logical_scalar_true (void) const | |||
scalar_true (); } | { return rep->is_logical_scalar_true (); } | |||
virtual mwSize get_m (void) const { return rep->get_m (); } | mwSize get_m (void) const { return rep->get_m (); } | |||
virtual mwSize get_n (void) const { return rep->get_n (); } | mwSize get_n (void) const { return rep->get_n (); } | |||
virtual mwSize *get_dimensions (void) const { return rep->get_dimensions (); } | mwSize *get_dimensions (void) const { return rep->get_dimensions (); } | |||
virtual mwSize get_number_of_dimensions (void) const { return rep->get_nu | mwSize get_number_of_dimensions (void) const | |||
mber_of_dimensions (); } | { return rep->get_number_of_dimensions (); } | |||
virtual void set_m (mwSize m) { DO_VOID_MUTABLE_METHOD (set_m (m)); } | void set_m (mwSize m) { DO_VOID_MUTABLE_METHOD (set_m (m)); } | |||
virtual void set_n (mwSize n) { DO_VOID_MUTABLE_METHOD (set_n (n)); } | void set_n (mwSize n) { DO_VOID_MUTABLE_METHOD (set_n (n)); } | |||
virtual void set_dimensions (mwSize *dims_arg, mwSize ndims_arg) { DO_VOI | void set_dimensions (mwSize *dims_arg, mwSize ndims_arg) | |||
D_MUTABLE_METHOD (set_dimensions (dims_arg, ndims_arg)); } | { DO_VOID_MUTABLE_METHOD (set_dimensions (dims_arg, ndims_arg)); } | |||
virtual mwSize get_number_of_elements (void) const { return rep->get_numb | mwSize get_number_of_elements (void) const | |||
er_of_elements (); } | { return rep->get_number_of_elements (); } | |||
virtual int is_empty (void) const { return get_number_of_elements () == 0 ; } | int is_empty (void) const { return get_number_of_elements () == 0; } | |||
const char *get_name (void) const { return name; } | const char *get_name (void) const { return name; } | |||
void set_name (const char *name_arg); | void set_name (const char *name_arg); | |||
virtual mxClassID get_class_id (void) const { return rep->get_class_id () ; } | mxClassID get_class_id (void) const { return rep->get_class_id (); } | |||
virtual const char *get_class_name (void) const { return rep->get_class_n ame (); } | const char *get_class_name (void) const { return rep->get_class_name (); } | |||
virtual void set_class_name (const char *name_arg) { DO_VOID_MUTABLE_METH | void set_class_name (const char *name_arg) | |||
OD (set_class_name (name_arg)); } | { DO_VOID_MUTABLE_METHOD (set_class_name (name_arg)); } | |||
virtual mxArray *get_cell (mwIndex idx) const { DO_MUTABLE_METHOD (mxArra | mxArray *get_cell (mwIndex idx) const | |||
y *, get_cell (idx)); } | { DO_MUTABLE_METHOD (mxArray *, get_cell (idx)); } | |||
virtual void set_cell (mwIndex idx, mxArray *val) { DO_VOID_MUTABLE_METHO | void set_cell (mwIndex idx, mxArray *val) | |||
D (set_cell (idx, val)); } | { DO_VOID_MUTABLE_METHOD (set_cell (idx, val)); } | |||
virtual double get_scalar (void) const { return rep->get_scalar (); } | double get_scalar (void) const { return rep->get_scalar (); } | |||
virtual void *get_data (void) const { DO_MUTABLE_METHOD (void *, get_data ()); } | void *get_data (void) const { DO_MUTABLE_METHOD (void *, get_data ()); } | |||
virtual void *get_imag_data (void) const { DO_MUTABLE_METHOD (void *, get | void *get_imag_data (void) const | |||
_imag_data ()); } | { DO_MUTABLE_METHOD (void *, get_imag_data ()); } | |||
virtual void set_data (void *pr) { DO_VOID_MUTABLE_METHOD (set_data (pr)) ; } | void set_data (void *pr) { DO_VOID_MUTABLE_METHOD (set_data (pr)); } | |||
virtual void set_imag_data (void *pi) { DO_VOID_MUTABLE_METHOD (set_imag_ data (pi)); } | void set_imag_data (void *pi) { DO_VOID_MUTABLE_METHOD (set_imag_data (pi )); } | |||
virtual mwIndex *get_ir (void) const { DO_MUTABLE_METHOD (mwIndex *, get_ ir ()); } | mwIndex *get_ir (void) const { DO_MUTABLE_METHOD (mwIndex *, get_ir ()); } | |||
virtual mwIndex *get_jc (void) const { DO_MUTABLE_METHOD (mwIndex *, get_ jc ()); } | mwIndex *get_jc (void) const { DO_MUTABLE_METHOD (mwIndex *, get_jc ()); } | |||
virtual mwSize get_nzmax (void) const { return rep->get_nzmax (); } | mwSize get_nzmax (void) const { return rep->get_nzmax (); } | |||
virtual void set_ir (mwIndex *ir) { DO_VOID_MUTABLE_METHOD (set_ir (ir)); } | void set_ir (mwIndex *ir) { DO_VOID_MUTABLE_METHOD (set_ir (ir)); } | |||
virtual void set_jc (mwIndex *jc) { DO_VOID_MUTABLE_METHOD (set_jc (jc)); } | void set_jc (mwIndex *jc) { DO_VOID_MUTABLE_METHOD (set_jc (jc)); } | |||
virtual void set_nzmax (mwSize nzmax) { DO_VOID_MUTABLE_METHOD (set_nzmax (nzmax)); } | void set_nzmax (mwSize nzmax) { DO_VOID_MUTABLE_METHOD (set_nzmax (nzmax) ); } | |||
virtual int add_field (const char *key) { DO_MUTABLE_METHOD (int, add_fie ld (key)); } | int add_field (const char *key) { DO_MUTABLE_METHOD (int, add_field (key) ); } | |||
virtual void remove_field (int key_num) { DO_VOID_MUTABLE_METHOD (remove_ | void remove_field (int key_num) | |||
field (key_num)); } | { DO_VOID_MUTABLE_METHOD (remove_field (key_num)); } | |||
virtual mxArray *get_field_by_number (mwIndex index, int key_num) const { | mxArray *get_field_by_number (mwIndex index, int key_num) const | |||
DO_MUTABLE_METHOD (mxArray *, get_field_by_number (index, key_num)); } | { DO_MUTABLE_METHOD (mxArray *, get_field_by_number (index, key_num)); } | |||
virtual void set_field_by_number (mwIndex index, int key_num, mxArray *va | void set_field_by_number (mwIndex index, int key_num, mxArray *val) | |||
l) { DO_VOID_MUTABLE_METHOD (set_field_by_number (index, key_num, val)); } | { DO_VOID_MUTABLE_METHOD (set_field_by_number (index, key_num, val)); } | |||
virtual int get_number_of_fields (void) const { return rep->get_number_of _fields (); } | int get_number_of_fields (void) const { return rep->get_number_of_fields (); } | |||
virtual const char *get_field_name_by_number (int key_num) const { DO_MUT | const char *get_field_name_by_number (int key_num) const | |||
ABLE_METHOD (const char*, get_field_name_by_number (key_num)); } | { DO_MUTABLE_METHOD (const char*, get_field_name_by_number (key_num)); } | |||
virtual int get_field_number (const char *key) const { DO_MUTABLE_METHOD | int get_field_number (const char *key) const | |||
(int, get_field_number (key)); } | { DO_MUTABLE_METHOD (int, get_field_number (key)); } | |||
virtual int get_string (char *buf, mwSize buflen) const { return rep->get | int get_string (char *buf, mwSize buflen) const | |||
_string (buf, buflen); } | { return rep->get_string (buf, buflen); } | |||
virtual char *array_to_string (void) const { return rep->array_to_string (); } | char *array_to_string (void) const { return rep->array_to_string (); } | |||
virtual mwIndex calc_single_subscript (mwSize nsubs, mwIndex *subs) const | mwIndex calc_single_subscript (mwSize nsubs, mwIndex *subs) const | |||
{ return rep->calc_single_subscript (nsubs, subs); } | { return rep->calc_single_subscript (nsubs, subs); } | |||
virtual size_t get_element_size (void) const { return rep->get_element_si ze (); } | size_t get_element_size (void) const { return rep->get_element_size (); } | |||
virtual bool mutation_needed (void) const { return rep->mutation_needed ( ); } | bool mutation_needed (void) const { return rep->mutation_needed (); } | |||
virtual mxArray *mutate (void) const { return rep->mutate (); } | mxArray *mutate (void) const { return rep->mutate (); } | |||
static void *malloc (size_t n); | static void *malloc (size_t n); | |||
static void *calloc (size_t n, size_t t); | static void *calloc (size_t n, size_t t); | |||
static char *strsave (const char *str) | static char *strsave (const char *str) | |||
{ | { | |||
char *retval = 0; | char *retval = 0; | |||
if (str) | if (str) | |||
{ | { | |||
mwSize sz = sizeof (mxChar) * (strlen (str) + 1); | mwSize sz = sizeof (mxChar) * (strlen (str) + 1); | |||
retval = static_cast<char *> (mxArray::malloc (sz)); | retval = static_cast<char *> (mxArray::malloc (sz)); | |||
strcpy (retval, str); | strcpy (retval, str); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
static octave_value as_octave_value (mxArray *ptr); | static octave_value as_octave_value (const mxArray *ptr); | |||
protected: | protected: | |||
virtual octave_value as_octave_value (void) const; | octave_value as_octave_value (void) const; | |||
mxArray (const xmxArray&) : rep (0), name (0) { } | ||||
private: | private: | |||
mutable mxArray *rep; | mutable mxArray_base *rep; | |||
char *name; | char *name; | |||
mxArray (mxArray *r, const char *n) | mxArray (mxArray_base *r, const char *n) | |||
: rep (r), name (strsave (n)) { } | : rep (r), name (mxArray::strsave (n)) { } | |||
void maybe_mutate (void) const; | void maybe_mutate (void) const; | |||
// No copying! | // No copying! | |||
mxArray (const mxArray&); | mxArray (const mxArray&); | |||
mxArray& operator = (const mxArray&); | mxArray& operator = (const mxArray&); | |||
}; | }; | |||
End of changes. 76 change blocks. | ||||
117 lines changed or deleted | 290 lines changed or added | |||
oct-alloc.h | oct-alloc.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
oct-binmap.h | oct-binmap.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2010-2012 VZLU Prague | Copyright (C) 2010-2013 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_binmap_h) | #if !defined (octave_oct_binmap_h) | |||
#define octave_binmap_h 1 | #define octave_oct_binmap_h 1 | |||
#include "Array.h" | #include "Array.h" | |||
#include "Sparse.h" | #include "Sparse.h" | |||
#include "Array-util.h" | #include "Array-util.h" | |||
#include "bsxfun.h" | #include "bsxfun.h" | |||
// This source file implements a general binary maping function for | // This source file implements a general binary maping function for | |||
// arrays. The syntax is binmap<type> (a, b, f, [name]). type denotes | // arrays. The syntax is binmap<type> (a, b, f,[name]). type denotes | |||
// the expected return type of the operation. a, b, should be one of | // the expected return type of the operation. a, b, should be one of | |||
// the 6 combinations: | // the 6 combinations: | |||
// | // | |||
// Array-Array | // Array-Array | |||
// Array-scalar | // Array-scalar | |||
// scalar-Array | // scalar-Array | |||
// Sparse-Sparse | // Sparse-Sparse | |||
// Sparse-scalar | // Sparse-scalar | |||
// scalar-Sparse | // scalar-Sparse | |||
// | // | |||
skipping to change at line 225 | skipping to change at line 225 | |||
// scalar-Sparse | // scalar-Sparse | |||
template <class U, class T, class R, class F> | template <class U, class T, class R, class F> | |||
Sparse<U> | Sparse<U> | |||
binmap (const T& x, const Sparse<R>& ys, F fcn) | binmap (const T& x, const Sparse<R>& ys, F fcn) | |||
{ | { | |||
octave_idx_type nz = ys.nnz (); | octave_idx_type nz = ys.nnz (); | |||
Sparse<U> retval (ys.rows (), ys.cols (), nz); | Sparse<U> retval (ys.rows (), ys.cols (), nz); | |||
for (octave_idx_type i = 0; i < nz; i++) | for (octave_idx_type i = 0; i < nz; i++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
retval.xdata(i) = fcn (x, ys.data(i)); | retval.xdata (i) = fcn (x, ys.data (i)); | |||
} | } | |||
octave_quit (); | octave_quit (); | |||
retval.maybe_compress (); | retval.maybe_compress (); | |||
return retval; | return retval; | |||
} | } | |||
// Sparse-scalar | // Sparse-scalar | |||
template <class U, class T, class R, class F> | template <class U, class T, class R, class F> | |||
Sparse<U> | Sparse<U> | |||
binmap (const Sparse<T>& xs, const R& y, F fcn) | binmap (const Sparse<T>& xs, const R& y, F fcn) | |||
{ | { | |||
octave_idx_type nz = xs.nnz (); | octave_idx_type nz = xs.nnz (); | |||
Sparse<U> retval (xs.rows (), xs.cols (), nz); | Sparse<U> retval (xs.rows (), xs.cols (), nz); | |||
for (octave_idx_type i = 0; i < nz; i++) | for (octave_idx_type i = 0; i < nz; i++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
retval.xdata(i) = fcn (xs.data(i), y); | retval.xdata (i) = fcn (xs.data (i), y); | |||
} | } | |||
octave_quit (); | octave_quit (); | |||
retval.maybe_compress (); | retval.maybe_compress (); | |||
return retval; | return retval; | |||
} | } | |||
// Sparse-Sparse (treats singletons as scalars) | // Sparse-Sparse (treats singletons as scalars) | |||
template <class U, class T, class R, class F> | template <class U, class T, class R, class F> | |||
Sparse<U> | Sparse<U> | |||
skipping to change at line 267 | skipping to change at line 267 | |||
return binmap<U, T, R, F> (xs(0,0), ys, fcn); | return binmap<U, T, R, F> (xs(0,0), ys, fcn); | |||
else if (ys.rows () == 1 && ys.cols () == 1) | else if (ys.rows () == 1 && ys.cols () == 1) | |||
return binmap<U, T, R, F> (xs, ys(0,0), fcn); | return binmap<U, T, R, F> (xs, ys(0,0), fcn); | |||
else if (xs.dims () != ys.dims ()) | else if (xs.dims () != ys.dims ()) | |||
gripe_nonconformant (name, xs.dims (), ys.dims ()); | gripe_nonconformant (name, xs.dims (), ys.dims ()); | |||
T xzero = T (); | T xzero = T (); | |||
R yzero = R (); | R yzero = R (); | |||
U fz = fcn (xzero, yzero); | U fz = fcn (xzero, yzero); | |||
if (fz == U()) | if (fz == U ()) | |||
{ | { | |||
// Sparsity-preserving function. Do it efficiently. | // Sparsity-preserving function. Do it efficiently. | |||
octave_idx_type nr = xs.rows (), nc = xs.cols (); | octave_idx_type nr = xs.rows (), nc = xs.cols (); | |||
Sparse<T> retval (nr, nc); | Sparse<T> retval (nr, nc); | |||
octave_idx_type nz = 0; | octave_idx_type nz = 0; | |||
// Count nonzeros. | // Count nonzeros. | |||
for (octave_idx_type j = 0; j < nc; j++) | for (octave_idx_type j = 0; j < nc; j++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
octave_idx_type ix = xs.cidx(j), iy = ys.cidx(j); | octave_idx_type ix = xs.cidx (j), iy = ys.cidx (j); | |||
octave_idx_type ux = xs.cidx(j+1), uy = ys.cidx(j+1); | octave_idx_type ux = xs.cidx (j+1), uy = ys.cidx (j+1); | |||
while (ix != ux || iy != uy) | while (ix != ux || iy != uy) | |||
{ | { | |||
octave_idx_type rx = xs.ridx(ix), ry = ys.ridx(ix); | octave_idx_type rx = xs.ridx (ix), ry = ys.ridx (ix); | |||
ix += rx <= ry; | ix += rx <= ry; | |||
iy += ry <= rx; | iy += ry <= rx; | |||
nz++; | nz++; | |||
} | } | |||
retval.xcidx(j+1) = nz; | retval.xcidx (j+1) = nz; | |||
} | } | |||
// Allocate space. | // Allocate space. | |||
retval.change_capacity (retval.xcidx(nc)); | retval.change_capacity (retval.xcidx (nc)); | |||
// Fill. | // Fill. | |||
nz = 0; | nz = 0; | |||
for (octave_idx_type j = 0; j < nc; j++) | for (octave_idx_type j = 0; j < nc; j++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
octave_idx_type ix = xs.cidx(j), iy = ys.cidx(j); | octave_idx_type ix = xs.cidx (j), iy = ys.cidx (j); | |||
octave_idx_type ux = xs.cidx(j+1), uy = ys.cidx(j+1); | octave_idx_type ux = xs.cidx (j+1), uy = ys.cidx (j+1); | |||
while (ix != ux || iy != uy) | while (ix != ux || iy != uy) | |||
{ | { | |||
octave_idx_type rx = xs.ridx(ix), ry = ys.ridx(ix); | octave_idx_type rx = xs.ridx (ix), ry = ys.ridx (ix); | |||
if (rx == ry) | if (rx == ry) | |||
{ | { | |||
retval.xridx(nz) = rx; | retval.xridx (nz) = rx; | |||
retval.xdata(nz) = fcn (xs.data(ix), ys.data(iy)); | retval.xdata (nz) = fcn (xs.data (ix), ys.data (iy)); | |||
ix++; | ix++; | |||
iy++; | iy++; | |||
} | } | |||
else if (rx < ry) | else if (rx < ry) | |||
{ | { | |||
retval.xridx(nz) = rx; | retval.xridx (nz) = rx; | |||
retval.xdata(nz) = fcn (xs.data(ix), yzero); | retval.xdata (nz) = fcn (xs.data (ix), yzero); | |||
ix++; | ix++; | |||
} | } | |||
else if (ry < rx) | else if (ry < rx) | |||
{ | { | |||
retval.xridx(nz) = ry; | retval.xridx (nz) = ry; | |||
retval.xdata(nz) = fcn (xzero, ys.data(iy)); | retval.xdata (nz) = fcn (xzero, ys.data (iy)); | |||
iy++; | iy++; | |||
} | } | |||
nz++; | nz++; | |||
} | } | |||
} | } | |||
retval.maybe_compress (); | retval.maybe_compress (); | |||
return retval; | return retval; | |||
} | } | |||
skipping to change at line 342 | skipping to change at line 342 | |||
return Sparse<U> (binmap<U, T, R, F> (xs.array_value (), ys.array_value (), | return Sparse<U> (binmap<U, T, R, F> (xs.array_value (), ys.array_value (), | |||
fcn, name)); | fcn, name)); | |||
} | } | |||
// Overloads for function pointers. | // Overloads for function pointers. | |||
// Signature (T, R) | // Signature (T, R) | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Array<U> | inline Array<U> | |||
binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (T, R), const char | binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (T, R), | |||
*name) | const char *name) | |||
{ return binmap<U, T, R, U (*) (T, R)> (xa, ya, fcn, name); } | { return binmap<U, T, R, U (*) (T, R)> (xa, ya, fcn, name); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Array<U> | inline Array<U> | |||
binmap (const T& x, const Array<R>& ya, U (*fcn) (T, R)) | binmap (const T& x, const Array<R>& ya, U (*fcn) (T, R)) | |||
{ return binmap<U, T, R, U (*) (T, R)> (x, ya, fcn); } | { return binmap<U, T, R, U (*) (T, R)> (x, ya, fcn); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Array<U> | inline Array<U> | |||
binmap (const Array<T>& xa, const R& y, U (*fcn) (T, R)) | binmap (const Array<T>& xa, const R& y, U (*fcn) (T, R)) | |||
{ return binmap<U, T, R, U (*) (T, R)> (xa, y, fcn); } | { return binmap<U, T, R, U (*) (T, R)> (xa, y, fcn); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Sparse<U> | inline Sparse<U> | |||
binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (T, R), const ch | binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (T, R), | |||
ar *name) | const char *name) | |||
{ return binmap<U, T, R, U (*) (T, R)> (xa, ya, fcn, name); } | { return binmap<U, T, R, U (*) (T, R)> (xa, ya, fcn, name); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Sparse<U> | inline Sparse<U> | |||
binmap (const T& x, const Sparse<R>& ya, U (*fcn) (T, R)) | binmap (const T& x, const Sparse<R>& ya, U (*fcn) (T, R)) | |||
{ return binmap<U, T, R, U (*) (T, R)> (x, ya, fcn); } | { return binmap<U, T, R, U (*) (T, R)> (x, ya, fcn); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Sparse<U> | inline Sparse<U> | |||
binmap (const Sparse<T>& xa, const R& y, U (*fcn) (T, R)) | binmap (const Sparse<T>& xa, const R& y, U (*fcn) (T, R)) | |||
{ return binmap<U, T, R, U (*) (T, R)> (xa, y, fcn); } | { return binmap<U, T, R, U (*) (T, R)> (xa, y, fcn); } | |||
// Signature (const T&, const R&) | // Signature (const T&, const R&) | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Array<U> | inline Array<U> | |||
binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (const T&, const R | binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (const T&, const R | |||
&), const char *name) | &), | |||
const char *name) | ||||
{ return binmap<U, T, R, U (*) (const T&, const R&)> (xa, ya, fcn, name); } | { return binmap<U, T, R, U (*) (const T&, const R&)> (xa, ya, fcn, name); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Array<U> | inline Array<U> | |||
binmap (const T& x, const Array<R>& ya, U (*fcn) (const T&, const R&)) | binmap (const T& x, const Array<R>& ya, U (*fcn) (const T&, const R&)) | |||
{ return binmap<U, T, R, U (*) (const T&, const R&)> (x, ya, fcn); } | { return binmap<U, T, R, U (*) (const T&, const R&)> (x, ya, fcn); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Array<U> | inline Array<U> | |||
binmap (const Array<T>& xa, const R& y, U (*fcn) (const T&, const R&)) | binmap (const Array<T>& xa, const R& y, U (*fcn) (const T&, const R&)) | |||
{ return binmap<U, T, R, U (*) (const T&, const R&)> (xa, y, fcn); } | { return binmap<U, T, R, U (*) (const T&, const R&)> (xa, y, fcn); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Sparse<U> | inline Sparse<U> | |||
binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (const T&, const | binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (const T&, const | |||
R&), const char *name) | R&), | |||
const char *name) | ||||
{ return binmap<U, T, R, U (*) (const T&, const R&)> (xa, ya, fcn, name); } | { return binmap<U, T, R, U (*) (const T&, const R&)> (xa, ya, fcn, name); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Sparse<U> | inline Sparse<U> | |||
binmap (const T& x, const Sparse<R>& ya, U (*fcn) (const T&, const R&)) | binmap (const T& x, const Sparse<R>& ya, U (*fcn) (const T&, const R&)) | |||
{ return binmap<U, T, R, U (*) (const T&, const R&)> (x, ya, fcn); } | { return binmap<U, T, R, U (*) (const T&, const R&)> (x, ya, fcn); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Sparse<U> | inline Sparse<U> | |||
binmap (const Sparse<T>& xa, const R& y, U (*fcn) (const T&, const R&)) | binmap (const Sparse<T>& xa, const R& y, U (*fcn) (const T&, const R&)) | |||
{ return binmap<U, T, R, U (*) (const T&, const R&)> (xa, y, fcn); } | { return binmap<U, T, R, U (*) (const T&, const R&)> (xa, y, fcn); } | |||
// Signature (const T&, R) | // Signature (const T&, R) | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Array<U> | inline Array<U> | |||
binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (const T&, R), con | binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (const T&, R), | |||
st char *name) | const char *name) | |||
{ return binmap<U, T, R, U (*) (const T&, R)> (xa, ya, fcn, name); } | { return binmap<U, T, R, U (*) (const T&, R)> (xa, ya, fcn, name); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Array<U> | inline Array<U> | |||
binmap (const T& x, const Array<R>& ya, U (*fcn) (const T&, R)) | binmap (const T& x, const Array<R>& ya, U (*fcn) (const T&, R)) | |||
{ return binmap<U, T, R, U (*) (const T&, R)> (x, ya, fcn); } | { return binmap<U, T, R, U (*) (const T&, R)> (x, ya, fcn); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Array<U> | inline Array<U> | |||
binmap (const Array<T>& xa, const R& y, U (*fcn) (const T&, R)) | binmap (const Array<T>& xa, const R& y, U (*fcn) (const T&, R)) | |||
{ return binmap<U, T, R, U (*) (const T&, R)> (xa, y, fcn); } | { return binmap<U, T, R, U (*) (const T&, R)> (xa, y, fcn); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Sparse<U> | inline Sparse<U> | |||
binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (const T&, R), c | binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (const T&, R), | |||
onst char *name) | const char *name) | |||
{ return binmap<U, T, R, U (*) (const T&, R)> (xa, ya, fcn, name); } | { return binmap<U, T, R, U (*) (const T&, R)> (xa, ya, fcn, name); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Sparse<U> | inline Sparse<U> | |||
binmap (const T& x, const Sparse<R>& ya, U (*fcn) (const T&, R)) | binmap (const T& x, const Sparse<R>& ya, U (*fcn) (const T&, R)) | |||
{ return binmap<U, T, R, U (*) (const T&, R)> (x, ya, fcn); } | { return binmap<U, T, R, U (*) (const T&, R)> (x, ya, fcn); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Sparse<U> | inline Sparse<U> | |||
binmap (const Sparse<T>& xa, const R& y, U (*fcn) (const T&, R)) | binmap (const Sparse<T>& xa, const R& y, U (*fcn) (const T&, R)) | |||
{ return binmap<U, T, R, U (*) (const T&, R)> (xa, y, fcn); } | { return binmap<U, T, R, U (*) (const T&, R)> (xa, y, fcn); } | |||
// Signature (T, const R&) | // Signature (T, const R&) | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Array<U> | inline Array<U> | |||
binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (T, const R&), con | binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (T, const R&), | |||
st char *name) | const char *name) | |||
{ return binmap<U, T, R, U (*) (T, const R&)> (xa, ya, fcn, name); } | { return binmap<U, T, R, U (*) (T, const R&)> (xa, ya, fcn, name); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Array<U> | inline Array<U> | |||
binmap (const T& x, const Array<R>& ya, U (*fcn) (T, const R&)) | binmap (const T& x, const Array<R>& ya, U (*fcn) (T, const R&)) | |||
{ return binmap<U, T, R, U (*) (T, const R&)> (x, ya, fcn); } | { return binmap<U, T, R, U (*) (T, const R&)> (x, ya, fcn); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Array<U> | inline Array<U> | |||
binmap (const Array<T>& xa, const R& y, U (*fcn) (T, const R&)) | binmap (const Array<T>& xa, const R& y, U (*fcn) (T, const R&)) | |||
{ return binmap<U, T, R, U (*) (T, const R&)> (xa, y, fcn); } | { return binmap<U, T, R, U (*) (T, const R&)> (xa, y, fcn); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Sparse<U> | inline Sparse<U> | |||
binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (T, const R&), c | binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (T, const R&), | |||
onst char *name) | const char *name) | |||
{ return binmap<U, T, R, U (*) (T, const R&)> (xa, ya, fcn, name); } | { return binmap<U, T, R, U (*) (T, const R&)> (xa, ya, fcn, name); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Sparse<U> | inline Sparse<U> | |||
binmap (const T& x, const Sparse<R>& ya, U (*fcn) (T, const R&)) | binmap (const T& x, const Sparse<R>& ya, U (*fcn) (T, const R&)) | |||
{ return binmap<U, T, R, U (*) (T, const R&)> (x, ya, fcn); } | { return binmap<U, T, R, U (*) (T, const R&)> (x, ya, fcn); } | |||
template <class U, class T, class R> | template <class U, class T, class R> | |||
inline Sparse<U> | inline Sparse<U> | |||
binmap (const Sparse<T>& xa, const R& y, U (*fcn) (T, const R&)) | binmap (const Sparse<T>& xa, const R& y, U (*fcn) (T, const R&)) | |||
End of changes. 23 change blocks. | ||||
37 lines changed or deleted | 39 lines changed or added | |||
oct-cmplx.h | oct-cmplx.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1995-2012 John W. Eaton | Copyright (C) 1995-2013 John W. Eaton | |||
Copyright (C) 2009 VZLU Prague, a.s. | Copyright (C) 2009 VZLU Prague, a.s. | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 32 | skipping to change at line 32 | |||
*/ | */ | |||
#if !defined (octave_oct_cmplx_h) | #if !defined (octave_oct_cmplx_h) | |||
#define octave_oct_cmplx_h 1 | #define octave_oct_cmplx_h 1 | |||
#include <complex> | #include <complex> | |||
typedef std::complex<double> Complex; | typedef std::complex<double> Complex; | |||
typedef std::complex<float> FloatComplex; | typedef std::complex<float> FloatComplex; | |||
// For complex-complex and complex-real comparisons, we use the following o | // For complex-complex and complex-real comparisons, we use the following | |||
rdering: | // ordering: compare absolute values first; if they match, compare phase an | |||
// compare absolute values first; if they match, compare phase angles. | gles. | |||
// This is partially inconsistent with M*b, which compares complex numbers only | // This is partially inconsistent with M*b, which compares complex numbers only | |||
// by their real parts; OTOH, it uses the same definition for max/min and s ort. | // by their real parts; OTOH, it uses the same definition for max/min and s ort. | |||
// The abs/arg comparison is definitely more useful (the other one is emula | // The abs/arg comparison is definitely more useful (the other one is emula | |||
ted rather | ted | |||
// trivially), so let's be consistent and use that all over. | // rather trivially), so let's be consistent and use that all over. | |||
#define DEF_COMPLEXR_COMP(OP, OPS) \ | #define DEF_COMPLEXR_COMP(OP, OPS) \ | |||
template <class T> \ | template <class T> \ | |||
inline bool operator OP (const std::complex<T>& a, const std::complex<T>& b ) \ | inline bool operator OP (const std::complex<T>& a, const std::complex<T>& b ) \ | |||
{ \ | { \ | |||
FLOAT_TRUNCATE const T ax = std::abs (a), bx = std::abs (b); \ | FLOAT_TRUNCATE const T ax = std::abs (a), bx = std::abs (b); \ | |||
if (ax == bx) \ | if (ax == bx) \ | |||
{ \ | { \ | |||
FLOAT_TRUNCATE const T ay = std::arg (a), by = std::arg (b); \ | FLOAT_TRUNCATE const T ay = std::arg (a), by = std::arg (b); \ | |||
return ay OP by; \ | return ay OP by; \ | |||
End of changes. 3 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
oct-conf.h | oct-conf.h | |||
---|---|---|---|---|
// oct-conf.h.in | // DO NOT EDIT! Generated automatically from oct-conf.in.h by Make. | |||
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 76 | skipping to change at line 76 | |||
#ifndef OCTAVE_CONF_ARPACK_LDFLAGS | #ifndef OCTAVE_CONF_ARPACK_LDFLAGS | |||
#define OCTAVE_CONF_ARPACK_LDFLAGS "" | #define OCTAVE_CONF_ARPACK_LDFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_ARPACK_LIBS | #ifndef OCTAVE_CONF_ARPACK_LIBS | |||
#define OCTAVE_CONF_ARPACK_LIBS "" | #define OCTAVE_CONF_ARPACK_LIBS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_BLAS_LIBS | #ifndef OCTAVE_CONF_BLAS_LIBS | |||
#define OCTAVE_CONF_BLAS_LIBS "" | #define OCTAVE_CONF_BLAS_LIBS "-lblas" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_CAMD_CPPFLAGS | #ifndef OCTAVE_CONF_CAMD_CPPFLAGS | |||
#define OCTAVE_CONF_CAMD_CPPFLAGS "" | #define OCTAVE_CONF_CAMD_CPPFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_CAMD_LDFLAGS | #ifndef OCTAVE_CONF_CAMD_LDFLAGS | |||
#define OCTAVE_CONF_CAMD_LDFLAGS "" | #define OCTAVE_CONF_CAMD_LDFLAGS "" | |||
#endif | #endif | |||
skipping to change at line 99 | skipping to change at line 99 | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_CARBON_LIBS | #ifndef OCTAVE_CONF_CARBON_LIBS | |||
#define OCTAVE_CONF_CARBON_LIBS "" | #define OCTAVE_CONF_CARBON_LIBS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_CC | #ifndef OCTAVE_CONF_CC | |||
#define OCTAVE_CONF_CC "gcc" | #define OCTAVE_CONF_CC "gcc" | |||
#endif | #endif | |||
// FIXME: OCTAVE_CONF_CCC_VERSION is deprecated. Remove in version 3.12 | ||||
#ifndef OCTAVE_CONF_CC_VERSION | #ifndef OCTAVE_CONF_CC_VERSION | |||
#define OCTAVE_CONF_CC_VERSION "4.6.1 20110627 (Mandriva) (GCC) " | #define OCTAVE_CONF_CC_VERSION "4.6.1" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_CCOLAMD_CPPFLAGS | #ifndef OCTAVE_CONF_CCOLAMD_CPPFLAGS | |||
#define OCTAVE_CONF_CCOLAMD_CPPFLAGS "" | #define OCTAVE_CONF_CCOLAMD_CPPFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_CCOLAMD_LDFLAGS | #ifndef OCTAVE_CONF_CCOLAMD_LDFLAGS | |||
#define OCTAVE_CONF_CCOLAMD_LDFLAGS "" | #define OCTAVE_CONF_CCOLAMD_LDFLAGS "" | |||
#endif | #endif | |||
skipping to change at line 180 | skipping to change at line 181 | |||
#ifndef OCTAVE_CONF_CXSPARSE_LIBS | #ifndef OCTAVE_CONF_CXSPARSE_LIBS | |||
#define OCTAVE_CONF_CXSPARSE_LIBS "-lcxsparse" | #define OCTAVE_CONF_CXSPARSE_LIBS "-lcxsparse" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_CXXCPP | #ifndef OCTAVE_CONF_CXXCPP | |||
#define OCTAVE_CONF_CXXCPP "g++ -E" | #define OCTAVE_CONF_CXXCPP "g++ -E" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_CXXFLAGS | #ifndef OCTAVE_CONF_CXXFLAGS | |||
#define OCTAVE_CONF_CXXFLAGS "-g -O2" | #define OCTAVE_CONF_CXXFLAGS "-g -O2 -pthread" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_CXXPICFLAG | #ifndef OCTAVE_CONF_CXXPICFLAG | |||
#define OCTAVE_CONF_CXXPICFLAG "-fPIC" | #define OCTAVE_CONF_CXXPICFLAG "-fPIC" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_CXX | #ifndef OCTAVE_CONF_CXX | |||
#define OCTAVE_CONF_CXX "g++" | #define OCTAVE_CONF_CXX "g++" | |||
#endif | #endif | |||
// FIXME: OCTAVE_CONF_CXX_VERSION is deprecated. Remove in version 3.12 | ||||
#ifndef OCTAVE_CONF_CXX_VERSION | #ifndef OCTAVE_CONF_CXX_VERSION | |||
#define OCTAVE_CONF_CXX_VERSION "4.6.1" | #define OCTAVE_CONF_CXX_VERSION "4.6.1" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_DEFAULT_PAGER | #ifndef OCTAVE_CONF_DEFAULT_PAGER | |||
#define OCTAVE_CONF_DEFAULT_PAGER "less" | #define OCTAVE_CONF_DEFAULT_PAGER "less" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_DEFS | #ifndef OCTAVE_CONF_DEFS | |||
#define OCTAVE_CONF_DEFS "-DPACKAGE_NAME=\"GNU Octave\" -DPACKAGE_TARNAME=\ "octave\" -DPACKAGE_VERSION=\"3.6.4\" -DPACKAGE_STRING=\"GNU Octave 3.6.4\" -DPACKAGE_BUGREPORT=\"http://octave.org/bugs.html\" -DPACKAGE_URL=\"http:/ /www.gnu.org/software/octave/\" -DPACKAGE=\"octave\" -DVERSION=\"3.6.4\" -D OCTAVE_SOURCE=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 - DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DH AVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D__EXTENSIONS__=1 -D_ ALL_SOURCE=1 -D_DARWIN_C_SOURCE=1 -D_GNU_SOURCE=1 -D_POSIX_PTHREAD_SEMANTIC S=1 -D_TANDEM_SOURCE=1 -DSEPCHAR=':' -DSEPCHAR_STR=\":\" -DOCTAVE_IDX_TYPE= int -D__NO_MATH_INLINES=1 -DCXX_NEW_FRIEND_TEMPLATE_DECL=1 -DCXX_ISO_COMPLI ANT_LIBRARY=1 -DHAVE_FSEEKO=1 -D_FILE_OFFSET_BITS=64 -DHAVE_ALLOCA_H=1 -DHA VE_ALLOCA=1 -DHAVE_CANONICALIZE_FILE_NAME=1 -DHAVE_GETCWD=1 -DHAVE_READLINK =1 -DHAVE_REALPATH=1 -DHAVE_FCHDIR=1 -DHAVE_FCNTL=1 -DHAVE_SYMLINK=1 -DHAVE _FDOPENDIR=1 -DHAVE_MEMPCPY=1 -DHAVE_BTOWC=1 -DHAVE_ISBLANK=1 -DHAVE_ISWCTY PE=1 -DHAVE_MBSRTOWCS=1 -DHAVE_WMEMCHR=1 -DHAVE_WMEMCPY=1 -DHAVE_WMEMPCPY=1 -DHAVE___FPURGE=1 -DHAVE___FREADING=1 -DHAVE_FSTATAT=1 -DHAVE_GETDTABLESIZ E=1 -DHAVE_GETLOGIN_R=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_GETPWNAM_R=1 -DHAVE_LI NK=1 -DHAVE_LSTAT=1 -DHAVE_MBSINIT=1 -DHAVE_MBRTOWC=1 -DHAVE_MPROTECT=1 -DH AVE_MKFIFO=1 -DHAVE_MKOSTEMP=1 -DHAVE_MKSTEMP=1 -DHAVE_ALARM=1 -DHAVE_OPENA T=1 -DHAVE_SIGACTION=1 -DHAVE_SIGALTSTACK=1 -DHAVE_SIGINTERRUPT=1 -DHAVE_SL EEP=1 -DHAVE_STRDUP=1 -DHAVE_TZSET=1 -DHAVE_STRPTIME=1 -DHAVE_LOCALTIME_R=1 -DHAVE_TIMES=1 -DHAVE_PIPE=1 -DHAVE_SNPRINTF=1 -DHAVE_ISWCNTRL=1 -DFUNC_RE ALPATH_WORKS=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_DIRENT_H=1 -DHAVE_WCTYPE_H=1 -DHAVE_NETDB_H=1 -DHAVE_GETOPT_H=1 -DH AVE_SYS_TIME_H=1 -DHAVE_SYS_CDEFS_H=1 -DHAVE_MATH_H=1 -DHAVE_SYS_MMAN_H=1 - DHAVE_SYS_SELECT_H=1 -DHAVE_WCHAR_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_SYS_UIO_H=1 -DHAVE_FEATURES _H=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DSTRERROR_R_CHAR_P=1 -DH AVE_DECL_FCHDIR=1 -DHAVE_WORKING_O_NOATIME=1 -DHAVE_WORKING_O_NOFOLLOW=1 -D HAVE_DECL_STRMODE=0 -DHAVE_MBSTATE_T=1 -DHAVE_DECL_FSEEKO=1 -DLSTAT_FOLLOWS _SLASHED_SYMLINK=1 -DHAVE_DECL_FTELLO=1 -DHAVE_DECL_GETCWD=1 -DHAVE_DECL_GE TLOGIN_R=1 -DHAVE_DECL_GETLOGIN=1 -DHAVE_GETOPT_H=1 -DHAVE_GETOPT_LONG_ONLY =1 -D__GETOPT_PREFIX=rpl_ -DHAVE_DECL_GETENV=1 -Drestrict=__restrict -DHAVE _RAW_DECL_GETTIMEOFDAY=1 -DDBL_EXPBIT0_WORD=1 -DDBL_EXPBIT0_BIT=20 -DFLT_EX PBIT0_WORD=0 -DFLT_EXPBIT0_BIT=23 -DHAVE_LANGINFO_CODESET=1 -DHAVE_DECL_GET C_UNLOCKED=1 -DHAVE_STDLIB_H=1 -DMALLOC_0_IS_NONNULL=1 -DHAVE_UNSIGNED_LONG _LONG_INT=1 -DHAVE_LONG_LONG_INT=1 -DHAVE_MAP_ANONYMOUS=1 -DHAVE_DECL_MEMRC HR=1 -DHAVE_RAW_DECL_PSELECT=1 -DHAVE_RAW_DECL_SELECT=1 -DPROMOTED_MODE_T=m ode_t -DHAVE_SIGSET_T=1 -DHAVE__BOOL=1 -DHAVE_WCHAR_T=1 -DHAVE_DECL_STRDUP= 1 -DHAVE_STRUCT_TM_TM_ZONE=1 -DHAVE_TM_ZONE=1 -DHAVE_TM_GMTOFF=1 -DHAVE_RAW _DECL_FFSL=1 -DHAVE_RAW_DECL_FFSLL=1 -DHAVE_RAW_DECL_MEMMEM=1 -DHAVE_RAW_DE CL_MEMPCPY=1 -DHAVE_RAW_DECL_MEMRCHR=1 -DHAVE_RAW_DECL_RAWMEMCHR=1 -DHAVE_R AW_DECL_STPCPY=1 -DHAVE_RAW_DECL_STPNCPY=1 -DHAVE_RAW_DECL_STRCHRNUL=1 -DHA VE_RAW_DECL_STRDUP=1 -DHAVE_RAW_DECL_STRNCAT=1 -DHAVE_RAW_DECL_STRNDUP=1 -D HAVE_RAW_DECL_STRNLEN=1 -DHAVE_RAW_DECL_STRPBRK=1 -DHAVE_RAW_DECL_STRSEP=1 -DHAVE_RAW_DECL_STRCASESTR=1 -DHAVE_RAW_DECL_STRTOK_R=1 -DHAVE_RAW_DECL_STR ERROR_R=1 -DHAVE_RAW_DECL_STRSIGNAL=1 -DHAVE_RAW_DECL_STRVERSCMP=1 -DHAVE_R AW_DECL_FFS=1 -DHAVE_RAW_DECL_STRCASECMP=1 -DHAVE_RAW_DECL_STRNCASECMP=1 -D HAVE_DECL_LOCALTIME_R=0 -DHAVE_WINT_T=1 -DHAVE_INTTYPES_H_WITH_UINTMAX=1 -D HAVE_STDINT_H_WITH_UINTMAX=1 -DHAVE_INTMAX_T=1 -DHAVE_SNPRINTF=1 -DHAVE_STR NLEN=1 -DHAVE_WCSLEN=1 -DHAVE_WCSNLEN=1 -DHAVE_MBRTOWC=1 -DHAVE_WCRTOMB=1 - DHAVE_DECL__SNPRINTF=0 -DHAVE_SNPRINTF_RETVAL_C99=1 -DHAVE_ALLOCA=1 -DGNULI B_CANONICALIZE_LGPL=1 -DGNULIB_TEST_CANONICALIZE_FILE_NAME=1 -DGNULIB_TEST_ REALPATH=1 -DGNULIB_TEST_CHDIR=1 -DGNULIB_TEST_CLOEXEC=1 -DGNULIB_TEST_CLOS E=1 -DHAVE_CLOSEDIR=1 -DGNULIB_TEST_CLOSEDIR=1 -DGNULIB_TEST_COPYSIGN=1 -DG NULIB_TEST_COPYSIGNF=1 -DD_INO_IN_DIRENT=1 -DHAVE_STRUCT_DIRENT_D_TYPE=1 -D HAVE_RAW_DECL_ALPHASORT=1 -DHAVE_RAW_DECL_CLOSEDIR=1 -DHAVE_RAW_DECL_DIRFD= 1 -DHAVE_RAW_DECL_FDOPENDIR=1 -DHAVE_RAW_DECL_OPENDIR=1 -DHAVE_RAW_DECL_REA DDIR=1 -DHAVE_RAW_DECL_REWINDDIR=1 -DHAVE_RAW_DECL_SCANDIR=1 -DHAVE_DIRFD=1 -DHAVE_DECL_DIRFD=1 -DGNULIB_TEST_DIRFD=1 -DGNULIB_TEST_DUP=1 -DHAVE_DUP2= 1 -DGNULIB_TEST_DUP2=1 -DGNULIB_TEST_FCHDIR=1 -DGNULIB_TEST_FCLOSE=1 -DGNUL IB_TEST_FCNTL=1 -DHAVE_RAW_DECL_FCNTL=1 -DHAVE_RAW_DECL_OPENAT=1 -DHAVE_DEC L_FDOPENDIR=1 -DGNULIB_TEST_FDOPENDIR=1 -DGNULIB_FDOPENDIR=1 -DGNULIB_FFLUS H=1 -DGNULIB_TEST_FFLUSH=1 -DGNULIB_TEST_FLOOR=1 -DGNULIB_TEST_FOPEN=1 -DHA VE_DECL_FPURGE=0 -DGNULIB_TEST_FPURGE=1 -DGNULIB_TEST_FSEEK=1 -DGNULIB_TEST _FSEEKO=1 -DGNULIB_TEST_FSTAT=1 -DGNULIB_FSTATAT=1 -DGNULIB_TEST_FSTATAT=1 -DGNULIB_TEST_FTELL=1 -DGNULIB_TEST_FTELLO=1 -DHAVE_GETPAGESIZE=1 -DHAVE_MI NIMALLY_WORKING_GETCWD=1 -DHAVE_PARTLY_WORKING_GETCWD=1 -DGNULIB_GETCWD=1 - DGNULIB_TEST_GETCWD=1 -DGNULIB_TEST_GETCWD=1 -DGNULIB_TEST_GETDTABLESIZE=1 -DHAVE_GETHOSTNAME=1 -DGNULIB_TEST_GETHOSTNAME=1 -DGNULIB_TEST_GETLOGIN_R=1 -DGNULIB_TEST_GETOPT_GNU=1 -D__GETOPT_PREFIX=rpl_ -DGETTIMEOFDAY_TIMEZONE= struct timezone -DGNULIB_TEST_GETTIMEOFDAY=1 -DHAVE_GLOB_H=1 -DGNULIB_TEST_ ISATTY=1 -DHAVE_ISNAND_IN_LIBC=1 -DHAVE_ISNANF_IN_LIBC=1 -DLDBL_EXPBIT0_WOR D=2 -DLDBL_EXPBIT0_BIT=0 -DGNULIB_TEST_LINK=1 -DGNULIB_TEST_LSEEK=1 -DGNULI B_TEST_LSTAT=1 -DHAVE_MALLOC_POSIX=1 -DGNULIB_TEST_MALLOC_POSIX=1 -DHAVE_RA W_DECL_ACOSF=1 -DHAVE_RAW_DECL_ACOSL=1 -DHAVE_RAW_DECL_ASINF=1 -DHAVE_RAW_D ECL_ASINL=1 -DHAVE_RAW_DECL_ATANF=1 -DHAVE_RAW_DECL_ATANL=1 -DHAVE_RAW_DECL _CEILF=1 -DHAVE_RAW_DECL_CEILL=1 -DHAVE_RAW_DECL_COPYSIGN=1 -DHAVE_RAW_DECL _COPYSIGNF=1 -DHAVE_RAW_DECL_COPYSIGNL=1 -DHAVE_RAW_DECL_COSF=1 -DHAVE_RAW_ DECL_COSL=1 -DHAVE_RAW_DECL_COSHF=1 -DHAVE_RAW_DECL_EXPF=1 -DHAVE_RAW_DECL_ EXPL=1 -DHAVE_RAW_DECL_FABSF=1 -DHAVE_RAW_DECL_FLOORF=1 -DHAVE_RAW_DECL_FLO ORL=1 -DHAVE_RAW_DECL_FMA=1 -DHAVE_RAW_DECL_FMAF=1 -DHAVE_RAW_DECL_FMAL=1 - DHAVE_RAW_DECL_FMODF=1 -DHAVE_RAW_DECL_FREXPF=1 -DHAVE_RAW_DECL_FREXPL=1 -D HAVE_RAW_DECL_LDEXPF=1 -DHAVE_RAW_DECL_LDEXPL=1 -DHAVE_RAW_DECL_LOGB=1 -DHA VE_RAW_DECL_LOGF=1 -DHAVE_RAW_DECL_LOGL=1 -DHAVE_RAW_DECL_LOG10F=1 -DHAVE_R AW_DECL_MODFF=1 -DHAVE_RAW_DECL_POWF=1 -DHAVE_RAW_DECL_RINT=1 -DHAVE_RAW_DE CL_RINTF=1 -DHAVE_RAW_DECL_RINTL=1 -DHAVE_RAW_DECL_ROUND=1 -DHAVE_RAW_DECL_ ROUNDF=1 -DHAVE_RAW_DECL_ROUNDL=1 -DHAVE_RAW_DECL_SINF=1 -DHAVE_RAW_DECL_SI NL=1 -DHAVE_RAW_DECL_SINHF=1 -DHAVE_RAW_DECL_SQRTF=1 -DHAVE_RAW_DECL_SQRTL= 1 -DHAVE_RAW_DECL_TANF=1 -DHAVE_RAW_DECL_TANL=1 -DHAVE_RAW_DECL_TANHF=1 -DH AVE_RAW_DECL_TRUNC=1 -DHAVE_RAW_DECL_TRUNCF=1 -DHAVE_RAW_DECL_TRUNCL=1 -DGN ULIB_TEST_MBRTOWC=1 -DGNULIB_TEST_MBSINIT=1 -DGNULIB_TEST_MBSRTOWCS=1 -DGNU LIB_TEST_MEMCHR=1 -DHAVE_MEMPCPY=1 -DGNULIB_TEST_MEMPCPY=1 -DHAVE_MEMRCHR=1 -DGNULIB_TEST_MEMRCHR=1 -DGNULIB_TEST_MKFIFO=1 -DGNULIB_MKOSTEMP=1 -DGNULI B_TEST_MKOSTEMP=1 -DGNULIB_TEST_MKSTEMP=1 -DGNULIB_TEST_MKTIME=1 -DGNULIB_T EST_NANOSLEEP=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_SYSCTL_H=1 -DHAVE_SCHED_GET AFFINITY=1 -DHAVE_SYSCTL=1 -DHAVE_SCHED_GETAFFINITY_LIKE_GLIBC=1 -DGNULIB_T EST_OPEN=1 -DGNULIB_OPENAT=1 -DGNULIB_TEST_OPENAT=1 -DHAVE_OPENDIR=1 -DGNUL IB_TEST_OPENDIR=1 -DHAVE_DECL_PROGRAM_INVOCATION_NAME=1 -DHAVE_DECL_PROGRAM _INVOCATION_SHORT_NAME=1 -DHAVE_RAISE=1 -DGNULIB_TEST_RAISE=1 -DHAVE_READDI R=1 -DGNULIB_TEST_READDIR=1 -DGNULIB_TEST_READLINK=1 -DHAVE_REALLOC_POSIX=1 -DGNULIB_TEST_REALLOC_POSIX=1 -DGNULIB_TEST_RENAME=1 -DHAVE_REWINDDIR=1 -D GNULIB_TEST_REWINDDIR=1 -DGNULIB_TEST_RMDIR=1 -DHAVE_DECL_ROUND=1 -DGNULIB_ TEST_ROUND=1 -DHAVE_DECL_ROUNDF=1 -DGNULIB_TEST_ROUNDF=1 -DGNULIB_TEST_SELE CT=1 -DHAVE_STRUCT_SIGACTION_SA_SIGACTION=1 -DGNULIB_TEST_SIGACTION=1 -DHAV E_RAW_DECL_PTHREAD_SIGMASK=1 -DHAVE_RAW_DECL_SIGACTION=1 -DHAVE_RAW_DECL_SI GADDSET=1 -DHAVE_RAW_DECL_SIGDELSET=1 -DHAVE_RAW_DECL_SIGEMPTYSET=1 -DHAVE_ RAW_DECL_SIGFILLSET=1 -DHAVE_RAW_DECL_SIGISMEMBER=1 -DHAVE_RAW_DECL_SIGPEND ING=1 -DHAVE_RAW_DECL_SIGPROCMASK=1 -DGNULIB_TEST_SIGNBIT=1 -DGNULIB_TEST_S IGPROCMASK=1 -DHAVE_STDINT_H=1 -DHAVE_DECL_SLEEP=1 -DGNULIB_TEST_SLEEP=1 -D GNULIB_TEST_STAT=1 -DHAVE_RAW_DECL_DPRINTF=1 -DHAVE_RAW_DECL_FSEEKO=1 -DHAV E_RAW_DECL_FTELLO=1 -DHAVE_RAW_DECL_GETDELIM=1 -DHAVE_RAW_DECL_GETLINE=1 -D HAVE_RAW_DECL_GETS=1 -DHAVE_RAW_DECL_PCLOSE=1 -DHAVE_RAW_DECL_POPEN=1 -DHAV E_RAW_DECL_RENAMEAT=1 -DHAVE_RAW_DECL_SNPRINTF=1 -DHAVE_RAW_DECL_TMPFILE=1 -DHAVE_RAW_DECL_VDPRINTF=1 -DHAVE_RAW_DECL_VSNPRINTF=1 -DHAVE_RAW_DECL__EXI T=1 -DHAVE_RAW_DECL_ATOLL=1 -DHAVE_RAW_DECL_CANONICALIZE_FILE_NAME=1 -DHAVE _RAW_DECL_GETLOADAVG=1 -DHAVE_RAW_DECL_GETSUBOPT=1 -DHAVE_RAW_DECL_GRANTPT= 1 -DHAVE_RAW_DECL_INITSTATE_R=1 -DHAVE_RAW_DECL_MKDTEMP=1 -DHAVE_RAW_DECL_M KOSTEMP=1 -DHAVE_RAW_DECL_MKOSTEMPS=1 -DHAVE_RAW_DECL_MKSTEMP=1 -DHAVE_RAW_ DECL_MKSTEMPS=1 -DHAVE_RAW_DECL_POSIX_OPENPT=1 -DHAVE_RAW_DECL_PTSNAME=1 -D HAVE_RAW_DECL_PTSNAME_R=1 -DHAVE_RAW_DECL_RANDOM_R=1 -DHAVE_RAW_DECL_REALPA TH=1 -DHAVE_RAW_DECL_RPMATCH=1 -DHAVE_RAW_DECL_SETENV=1 -DHAVE_RAW_DECL_SET STATE_R=1 -DHAVE_RAW_DECL_SRANDOM_R=1 -DHAVE_RAW_DECL_STRTOD=1 -DHAVE_RAW_D ECL_STRTOLL=1 -DHAVE_RAW_DECL_STRTOULL=1 -DHAVE_RAW_DECL_UNLOCKPT=1 -DHAVE_ RAW_DECL_UNSETENV=1 -DHAVE_STRCASECMP=1 -DHAVE_STRNCASECMP=1 -DHAVE_DECL_ST RNCASECMP=1 -DGNULIB_TEST_STRDUP=1 -DGNULIB_STRERROR=1 -DGNULIB_TEST_STRERR OR=1 -Dmy_strftime=nstrftime -DGNULIB_TEST_STRPTIME=1 -DGNULIB_TEST_SYMLINK =1 -DHAVE_RAW_DECL_PSELECT=1 -DHAVE_RAW_DECL_SELECT=1 -DHAVE_SHUTDOWN=1 -DH AVE_STRUCT_SOCKADDR_STORAGE=1 -DHAVE_SA_FAMILY_T=1 -DHAVE_STRUCT_SOCKADDR_S TORAGE_SS_FAMILY=1 -DHAVE_RAW_DECL_SOCKET=1 -DHAVE_RAW_DECL_CONNECT=1 -DHAV E_RAW_DECL_ACCEPT=1 -DHAVE_RAW_DECL_BIND=1 -DHAVE_RAW_DECL_GETPEERNAME=1 -D HAVE_RAW_DECL_GETSOCKNAME=1 -DHAVE_RAW_DECL_GETSOCKOPT=1 -DHAVE_RAW_DECL_LI STEN=1 -DHAVE_RAW_DECL_RECV=1 -DHAVE_RAW_DECL_SEND=1 -DHAVE_RAW_DECL_RECVFR OM=1 -DHAVE_RAW_DECL_SENDTO=1 -DHAVE_RAW_DECL_SETSOCKOPT=1 -DHAVE_RAW_DECL_ SHUTDOWN=1 -DHAVE_RAW_DECL_ACCEPT4=1 -DHAVE_RAW_DECL_FCHMODAT=1 -DHAVE_RAW_ DECL_FSTAT=1 -DHAVE_RAW_DECL_FSTATAT=1 -DHAVE_RAW_DECL_FUTIMENS=1 -DHAVE_RA W_DECL_LCHMOD=1 -DHAVE_RAW_DECL_LSTAT=1 -DHAVE_RAW_DECL_MKDIRAT=1 -DHAVE_RA W_DECL_MKFIFO=1 -DHAVE_RAW_DECL_MKFIFOAT=1 -DHAVE_RAW_DECL_MKNOD=1 -DHAVE_R AW_DECL_MKNODAT=1 -DHAVE_RAW_DECL_STAT=1 -DHAVE_RAW_DECL_UTIMENSAT=1 -DHAVE _STRUCT_TMS=1 -DHAVE_RAW_DECL_TIMES=1 -DGNULIB_TEST_TIME_R=1 -DHAVE___SECUR E_GETENV=1 -DGNULIB_TEST_TMPFILE=1 -DHAVE_DECL_TRUNC=1 -DGNULIB_TEST_TRUNC= 1 -DHAVE_DECL_TRUNCF=1 -DGNULIB_TEST_TRUNCF=1 -DHAVE_RAW_DECL_CHDIR=1 -DHAV E_RAW_DECL_CHOWN=1 -DHAVE_RAW_DECL_DUP=1 -DHAVE_RAW_DECL_DUP2=1 -DHAVE_RAW_ DECL_DUP3=1 -DHAVE_RAW_DECL_ENVIRON=1 -DHAVE_RAW_DECL_EUIDACCESS=1 -DHAVE_R AW_DECL_FACCESSAT=1 -DHAVE_RAW_DECL_FCHDIR=1 -DHAVE_RAW_DECL_FCHOWNAT=1 -DH AVE_RAW_DECL_FDATASYNC=1 -DHAVE_RAW_DECL_FSYNC=1 -DHAVE_RAW_DECL_FTRUNCATE= 1 -DHAVE_RAW_DECL_GETCWD=1 -DHAVE_RAW_DECL_GETDOMAINNAME=1 -DHAVE_RAW_DECL_ GETDTABLESIZE=1 -DHAVE_RAW_DECL_GETGROUPS=1 -DHAVE_RAW_DECL_GETHOSTNAME=1 - DHAVE_RAW_DECL_GETLOGIN=1 -DHAVE_RAW_DECL_GETLOGIN_R=1 -DHAVE_RAW_DECL_GETP AGESIZE=1 -DHAVE_RAW_DECL_GETUSERSHELL=1 -DHAVE_RAW_DECL_SETUSERSHELL=1 -DH AVE_RAW_DECL_ENDUSERSHELL=1 -DHAVE_RAW_DECL_GROUP_MEMBER=1 -DHAVE_RAW_DECL_ ISATTY=1 -DHAVE_RAW_DECL_LCHOWN=1 -DHAVE_RAW_DECL_LINK=1 -DHAVE_RAW_DECL_LI NKAT=1 -DHAVE_RAW_DECL_LSEEK=1 -DHAVE_RAW_DECL_PIPE=1 -DHAVE_RAW_DECL_PIPE2 =1 -DHAVE_RAW_DECL_PREAD=1 -DHAVE_RAW_DECL_PWRITE=1 -DHAVE_RAW_DECL_READLIN K=1 -DHAVE_RAW_DECL_READLINKAT=1 -DHAVE_RAW_DECL_RMDIR=1 -DHAVE_RAW_DECL_SE THOSTNAME=1 -DHAVE_RAW_DECL_SLEEP=1 -DHAVE_RAW_DECL_SYMLINK=1 -DHAVE_RAW_DE CL_SYMLINKAT=1 -DHAVE_RAW_DECL_TTYNAME_R=1 -DHAVE_RAW_DECL_UNLINK=1 -DHAVE_ RAW_DECL_UNLINKAT=1 -DHAVE_RAW_DECL_USLEEP=1 -DGNULIB_TEST_UNLINK=1 -DHAVE_ VASPRINTF=1 -DGNULIB_TEST_VASPRINTF=1 -DHAVE_RAW_DECL_BTOWC=1 -DHAVE_RAW_DE CL_WCTOB=1 -DHAVE_RAW_DECL_MBSINIT=1 -DHAVE_RAW_DECL_MBRTOWC=1 -DHAVE_RAW_D ECL_MBRLEN=1 -DHAVE_RAW_DECL_MBSRTOWCS=1 -DHAVE_RAW_DECL_MBSNRTOWCS=1 -DHAV E_RAW_DECL_WCRTOMB=1 -DHAVE_RAW_DECL_WCSRTOMBS=1 -DHAVE_RAW_DECL_WCSNRTOMBS =1 -DHAVE_RAW_DECL_WCWIDTH=1 -DHAVE_RAW_DECL_WMEMCHR=1 -DHAVE_RAW_DECL_WMEM CMP=1 -DHAVE_RAW_DECL_WMEMCPY=1 -DHAVE_RAW_DECL_WMEMMOVE=1 -DHAVE_RAW_DECL_ WMEMSET=1 -DHAVE_RAW_DECL_WCSLEN=1 -DHAVE_RAW_DECL_WCSNLEN=1 -DHAVE_RAW_DEC L_WCSCPY=1 -DHAVE_RAW_DECL_WCPCPY=1 -DHAVE_RAW_DECL_WCSNCPY=1 -DHAVE_RAW_DE CL_WCPNCPY=1 -DHAVE_RAW_DECL_WCSCAT=1 -DHAVE_RAW_DECL_WCSNCAT=1 -DHAVE_RAW_ DECL_WCSCMP=1 -DHAVE_RAW_DECL_WCSNCMP=1 -DHAVE_RAW_DECL_WCSCASECMP=1 -DHAVE _RAW_DECL_WCSNCASECMP=1 -DHAVE_RAW_DECL_WCSCOLL=1 -DHAVE_RAW_DECL_WCSXFRM=1 -DHAVE_RAW_DECL_WCSDUP=1 -DHAVE_RAW_DECL_WCSCHR=1 -DHAVE_RAW_DECL_WCSRCHR= 1 -DHAVE_RAW_DECL_WCSCSPN=1 -DHAVE_RAW_DECL_WCSSPN=1 -DHAVE_RAW_DECL_WCSPBR K=1 -DHAVE_RAW_DECL_WCSSTR=1 -DHAVE_RAW_DECL_WCSTOK=1 -DHAVE_RAW_DECL_WCSWI DTH=1 -DHAVE_TOWLOWER=1 -DHAVE_RAW_DECL_WCTYPE=1 -DHAVE_RAW_DECL_ISWCTYPE=1 -DHAVE_RAW_DECL_WCTRANS=1 -DHAVE_RAW_DECL_TOWCTRANS=1 -DHAVE_STDINT_H=1 -D HAVE_PTHREAD=1 -DHAVE_X_WINDOWS=1 -DFLOAT_TRUNCATE= -DHAVE_LIBM=1 -DF77_FUN C(name,NAME)=name ## _ -DF77_FUNC_(name,NAME)=name ## _ -DHAVE_IEEE754_DATA _FORMAT=1 -DHAVE_CXX_COMPLEX_SETTERS=1 -DHAVE_CXX_COMPLEX_REFERENCE_ACCESSO RS=1 -DHAVE_PCRE_H=1 -DHAVE_PCRE_COMPILE=1 -DHAVE_ZLIB_H=1 -DHAVE_Z=1 -DHAV E_HDF5_H=1 -DHAVE_HDF5_18=1 -DHAVE_HDF5=1 -DHAVE_FFTW3_H=1 -DHAVE_FFTW3=1 - DHAVE_FFTW3_H=1 -DHAVE_FFTW3F=1 -DHAVE_GLPK_H=1 -DHAVE_GLPK=1 -DHAVE_CURL_C URL_H=1 -DHAVE_CURL=1 -DHAVE_MAGICK=1 -DHAVE_GL_GL_H=1 -DHAVE_GL_GLU_H=1 -D HAVE_OPENGL=1 -DHAVE_FREETYPE=1 -DHAVE_FONTCONFIG=1 -DHAVE_FLTK=1 -DHAVE_DL FCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_QRUPDATE=1 -DHAVE_SUITESPARSE_AMD_H=1 -DHAVE_AMD=1 -DHAVE_SUITESPARSE_CAMD_H=1 -DHAVE_CAMD=1 -DHAVE_SUITESPARSE_ COLAMD_H=1 -DHAVE_COLAMD=1 -DHAVE_SUITESPARSE_CCOLAMD_H=1 -DHAVE_CCOLAMD=1 -DHAVE_SUITESPARSE_CHOLMOD_H=1 -DHAVE_CHOLMOD=1 -DHAVE_SUITESPARSE_CS_H=1 - DHAVE_CXSPARSE=1 -DHAVE_GETPWNAM=1 -DHAVE_DEV_T=1 -DHAVE_INO_T=1 -DHAVE_LON G_LONG_INT=1 -DHAVE_UNSIGNED_LONG_LONG_INT=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT= 4 -DSIZEOF_LONG=4 -DSIZEOF_LONG_LONG=8 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -D HAVE_PLACEMENT_DELETE=1 -DHAVE_DYNAMIC_AUTO_ARRAYS=1 -DHAVE_FAST_INT_OPS=1 -DSIZEOF_LONG_DOUBLE=12 -DHAVE_DIRENT_H=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_CURSES _H=1 -DHAVE_DLFCN_H=1 -DHAVE_GRP_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LOCALE_H=1 -DHAVE_MEMORY_H=1 -DHAVE_NCURSES_H=1 -DHAVE_POLL_H=1 -DHAVE_PTHREAD_H=1 -DH AVE_PWD_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_POLL_H=1 - DHAVE_SYS_RESOURCE_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_UTSNAME_H=1 -DHAVE_ TERMCAP_H=1 -DHAVE_SSTREAM=1 -DHAVE_TR1_UNORDERED_MAP=1 -DUSE_UNORDERED_MAP _WITH_TR1=1 -DHAVE_TERMIOS_H=1 -DHAVE_TERMIO_H=1 -DHAVE_SGTTY_H=1 -DHAVE_FN MATCH_H=1 -DHAVE_BASENAME=1 -DHAVE_CANONICALIZE_FILE_NAME=1 -DHAVE_CHMOD=1 -DHAVE_DUP2=1 -DHAVE_ENDGRENT=1 -DHAVE_ENDPWENT=1 -DHAVE_EXECVP=1 -DHAVE_EX PM1=1 -DHAVE_EXPM1F=1 -DHAVE_FORK=1 -DHAVE_GETEGID=1 -DHAVE_GETEUID=1 -DHAV E_GETGID=1 -DHAVE_GETGRENT=1 -DHAVE_GETGRGID=1 -DHAVE_GETGRNAM=1 -DHAVE_GET PGRP=1 -DHAVE_GETPID=1 -DHAVE_GETPPID=1 -DHAVE_GETPWENT=1 -DHAVE_GETPWUID=1 -DHAVE_GETUID=1 -DHAVE_GETWD=1 -DHAVE_KILL=1 -DHAVE_LGAMMA=1 -DHAVE_LGAMMA F=1 -DHAVE_LGAMMA_R=1 -DHAVE_LGAMMAF_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_LOG1P= 1 -DHAVE_LOG1PF=1 -DHAVE_MKSTEMP=1 -DHAVE_PIPE=1 -DHAVE_PUTENV=1 -DHAVE_REA LPATH=1 -DHAVE_RINDEX=1 -DHAVE_ROUNDL=1 -DHAVE_SELECT=1 -DHAVE_SETGRENT=1 - DHAVE_SETLOCALE=1 -DHAVE_SETPWENT=1 -DHAVE_SETVBUF=1 -DHAVE_SIGLONGJMP=1 -D HAVE_STRSIGNAL=1 -DHAVE_TEMPNAM=1 -DHAVE_TGAMMAF=1 -DHAVE_UMASK=1 -DHAVE_UN AME=1 -DHAVE_UTIME=1 -DHAVE_WAITPID=1 -DHAVE_DECL_EXP2=1 -DHAVE_DECL_ROUND= 1 -DHAVE_DECL_TGAMMA=1 -DHAVE_EXP2=1 -DHAVE_ROUND=1 -DHAVE_TGAMMA=1 -DHAVE_ DLOPEN_API=1 -DENABLE_DYNAMIC_LINKING=1 -DHAVE_CMATH_ISNAN=1 -DHAVE_CMATH_I SNANF=1 -DHAVE_CMATH_ISINF=1 -DHAVE_CMATH_ISINFF=1 -DHAVE_CMATH_ISFINITE=1 -DHAVE_CMATH_ISFINITEF=1 -DHAVE_FINITE=1 -DHAVE_ISNAN=1 -DHAVE_ISINF=1 -DHA VE_DECL_SIGNBIT=1 -DHAVE_ACOSH=1 -DHAVE_ACOSHF=1 -DHAVE_ASINH=1 -DHAVE_ASIN HF=1 -DHAVE_ATANH=1 -DHAVE_ATANHF=1 -DHAVE_ERF=1 -DHAVE_ERFF=1 -DHAVE_ERFC= 1 -DHAVE_ERFCF=1 -DHAVE_EXP2F=1 -DHAVE_LOG2=1 -DHAVE_LOG2F=1 -DHAVE_HYPOTF= 1 -DHAVE_CBRT=1 -DHAVE_CBRTF=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 -DHAVE_STRUC T_STAT_ST_BLOCKS=1 -DHAVE_STRUCT_STAT_ST_RDEV=1 -DHAVE_STRUCT_TM_TM_ZONE=1 -DHAVE_TM_ZONE=1 -DUSE_READLINE=1 -DEXCEPTION_IN_MATH=1 -DHAVE_DECL_SYS_SIG LIST=1 -DHAVE_GETRUSAGE=1 -DYYTEXT_POINTER=1" | #define OCTAVE_CONF_DEFS "-DHAVE_CONFIG_H" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_DL_LD | #ifndef OCTAVE_CONF_DL_LD | |||
#define OCTAVE_CONF_DL_LD "g++" | #define OCTAVE_CONF_DL_LD "g++" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_DL_LDFLAGS | #ifndef OCTAVE_CONF_DL_LDFLAGS | |||
#define OCTAVE_CONF_DL_LDFLAGS "-shared" | #define OCTAVE_CONF_DL_LDFLAGS "-shared" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_DL_LIBS | #ifndef OCTAVE_CONF_DL_LIBS | |||
#define OCTAVE_CONF_DL_LIBS "-ldl" | #define OCTAVE_CONF_DL_LIBS "-ldl" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_ENABLE_DYNAMIC_LINKING | ||||
#define OCTAVE_CONF_ENABLE_DYNAMIC_LINKING "yes" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_EXEEXT | #ifndef OCTAVE_CONF_EXEEXT | |||
#define OCTAVE_CONF_EXEEXT "" | #define OCTAVE_CONF_EXEEXT "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_GCC_VERSION | ||||
#define OCTAVE_CONF_GCC_VERSION "4.6.1" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_GXX_VERSION | ||||
#define OCTAVE_CONF_GXX_VERSION "4.6.1" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_F77 | #ifndef OCTAVE_CONF_F77 | |||
#define OCTAVE_CONF_F77 "gfortran" | #define OCTAVE_CONF_F77 "gfortran" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_F77_FLOAT_STORE_FLAG | #ifndef OCTAVE_CONF_F77_FLOAT_STORE_FLAG | |||
#define OCTAVE_CONF_F77_FLOAT_STORE_FLAG "-ffloat-store" | #define OCTAVE_CONF_F77_FLOAT_STORE_FLAG "-ffloat-store" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_F77_INTEGER_8_FLAG | #ifndef OCTAVE_CONF_F77_INTEGER_8_FLAG | |||
#define OCTAVE_CONF_F77_INTEGER_8_FLAG "" | #define OCTAVE_CONF_F77_INTEGER_8_FLAG "" | |||
skipping to change at line 248 | skipping to change at line 262 | |||
#ifndef OCTAVE_CONF_FFTW3_CPPFLAGSS | #ifndef OCTAVE_CONF_FFTW3_CPPFLAGSS | |||
#define OCTAVE_CONF_FFTW3_CPPFLAGS "" | #define OCTAVE_CONF_FFTW3_CPPFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_FFTW3_LDFLAGSS | #ifndef OCTAVE_CONF_FFTW3_LDFLAGSS | |||
#define OCTAVE_CONF_FFTW3_LDFLAGS "" | #define OCTAVE_CONF_FFTW3_LDFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_FFTW3_LIBS | #ifndef OCTAVE_CONF_FFTW3_LIBS | |||
#define OCTAVE_CONF_FFTW3_LIBS "-lfftw3" | #define OCTAVE_CONF_FFTW3_LIBS "-lfftw3_threads -lfftw3" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_FFTW3F_CPPFLAGSS | #ifndef OCTAVE_CONF_FFTW3F_CPPFLAGSS | |||
#define OCTAVE_CONF_FFTW3F_CPPFLAGS "" | #define OCTAVE_CONF_FFTW3F_CPPFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_FFTW3F_LDFLAGSS | #ifndef OCTAVE_CONF_FFTW3F_LDFLAGSS | |||
#define OCTAVE_CONF_FFTW3F_LDFLAGS "" | #define OCTAVE_CONF_FFTW3F_LDFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_FFTW3F_LIBS | #ifndef OCTAVE_CONF_FFTW3F_LIBS | |||
#define OCTAVE_CONF_FFTW3F_LIBS "-lfftw3f" | #define OCTAVE_CONF_FFTW3F_LIBS "-lfftw3f_threads -lfftw3f" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_FLIBS | #ifndef OCTAVE_CONF_FLIBS | |||
#define OCTAVE_CONF_FLIBS "-L/usr/lib/gcc/i586-mandriva-linux-gnu/4.6.1 -L/ | #define OCTAVE_CONF_FLIBS "-L/usr/lib/gcc/i586-mandriva-linux-gnu/4.6.1 -L/ | |||
usr/lib/gcc/i586-mandriva-linux-gnu/4.6.1/../../.. -llapack -lgfortran -lm | usr/lib/gcc/i586-mandriva-linux-gnu/4.6.1/../../.. -lgfortran -lm -lquadmat | |||
-lquadmath" | h" | |||
#endif | ||||
#ifndef OCTAVE_CONF_FONTCONFIG_CFLAGS | ||||
#define OCTAVE_CONF_FONTCONFIG_CFLAGS "" | ||||
#endif | #endif | |||
#ifndef OCTAVE_CONF_FPICFLAG | #ifndef OCTAVE_CONF_FPICFLAG | |||
#define OCTAVE_CONF_FPICFLAG "-fPIC" | #define OCTAVE_CONF_FPICFLAG "-fPIC" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_FT2_CFLAGS | ||||
#define OCTAVE_CONF_FT2_CFLAGS "-I/usr/include/freetype2 " | ||||
#endif | ||||
#ifndef OCTAVE_CONF_FT2_LIBS | #ifndef OCTAVE_CONF_FT2_LIBS | |||
#define OCTAVE_CONF_FT2_LIBS "-lfreetype " | #define OCTAVE_CONF_FT2_LIBS "-lfreetype " | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_GLPK_CPPFLAGS | #ifndef OCTAVE_CONF_GLPK_CPPFLAGS | |||
#define OCTAVE_CONF_GLPK_CPPFLAGS "" | #define OCTAVE_CONF_GLPK_CPPFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_GLPK_LDFLAGS | #ifndef OCTAVE_CONF_GLPK_LDFLAGS | |||
#define OCTAVE_CONF_GLPK_LDFLAGS "" | #define OCTAVE_CONF_GLPK_LDFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_GLPK_LIBS | #ifndef OCTAVE_CONF_GLPK_LIBS | |||
#define OCTAVE_CONF_GLPK_LIBS "-lglpk" | #define OCTAVE_CONF_GLPK_LIBS "-lglpk" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_GNUPLOT | #ifndef OCTAVE_CONF_GNUPLOT | |||
#define OCTAVE_CONF_GNUPLOT "gnuplot" | #define OCTAVE_CONF_GNUPLOT "gnuplot" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_GRAPHICS_CFLAGS | ||||
#define OCTAVE_CONF_GRAPHICS_CFLAGS "-O2 -g -frecord-gcc-switches -Wstrict- | ||||
aliasing=2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buff | ||||
er-size=4 -fomit-frame-pointer -mtune=generic -march=i586 -fasynchronous-un | ||||
wind-tables" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_GRAPHICS_LIBS | #ifndef OCTAVE_CONF_GRAPHICS_LIBS | |||
#define OCTAVE_CONF_GRAPHICS_LIBS "-L/usr/lib -lfltk_gl -lfltk -lX11 -lXext -lz" | #define OCTAVE_CONF_GRAPHICS_LIBS "-L/usr/lib -lfltk_gl -lfltk -lX11 -lXext -lz" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_HDF5_CPPFLAGS | #ifndef OCTAVE_CONF_HDF5_CPPFLAGS | |||
#define OCTAVE_CONF_HDF5_CPPFLAGS "" | #define OCTAVE_CONF_HDF5_CPPFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_HDF5_LDFLAGS | #ifndef OCTAVE_CONF_HDF5_LDFLAGS | |||
#define OCTAVE_CONF_HDF5_LDFLAGS "" | #define OCTAVE_CONF_HDF5_LDFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_HDF5_LIBS | #ifndef OCTAVE_CONF_HDF5_LIBS | |||
#define OCTAVE_CONF_HDF5_LIBS "-lhdf5" | #define OCTAVE_CONF_HDF5_LIBS "-lhdf5" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_INCFLAGS | #ifndef OCTAVE_CONF_INCFLAGS | |||
#define OCTAVE_CONF_INCFLAGS "" | #define OCTAVE_CONF_INCFLAGS %OCTAVE_CONF_INCFLAGS% | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_INCLUDEDIR | #ifndef OCTAVE_CONF_INCLUDEDIR | |||
#define OCTAVE_CONF_INCLUDEDIR "/home/ut/testing/octave/3.6.4/include" | #define OCTAVE_CONF_INCLUDEDIR "/home/ut/testing/octave/3.8.0/include" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LAPACK_LIBS | #ifndef OCTAVE_CONF_LAPACK_LIBS | |||
#define OCTAVE_CONF_LAPACK_LIBS "" | #define OCTAVE_CONF_LAPACK_LIBS "-llapack" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LDFLAGS | #ifndef OCTAVE_CONF_LDFLAGS | |||
#define OCTAVE_CONF_LDFLAGS "-llapack" | #define OCTAVE_CONF_LDFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LD_CXX | #ifndef OCTAVE_CONF_LD_CXX | |||
#define OCTAVE_CONF_LD_CXX "g++" | #define OCTAVE_CONF_LD_CXX "g++" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LD_STATIC_FLAG | #ifndef OCTAVE_CONF_LD_STATIC_FLAG | |||
#define OCTAVE_CONF_LD_STATIC_FLAG "" | #define OCTAVE_CONF_LD_STATIC_FLAG "" | |||
#endif | #endif | |||
skipping to change at line 343 | skipping to change at line 369 | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LEX | #ifndef OCTAVE_CONF_LEX | |||
#define OCTAVE_CONF_LEX "flex" | #define OCTAVE_CONF_LEX "flex" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LFLAGS | #ifndef OCTAVE_CONF_LFLAGS | |||
#define OCTAVE_CONF_LFLAGS "-I" | #define OCTAVE_CONF_LFLAGS "-I" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LIBCRUFT | ||||
#define OCTAVE_CONF_LIBCRUFT "-lcruft" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_LIBEXT | #ifndef OCTAVE_CONF_LIBEXT | |||
#define OCTAVE_CONF_LIBEXT "a" | #define OCTAVE_CONF_LIBEXT "a" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LIBFLAGS | #ifndef OCTAVE_CONF_LIBFLAGS | |||
#define OCTAVE_CONF_LIBFLAGS "-L.." | #define OCTAVE_CONF_LIBFLAGS "-L.." | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LIBOCTAVE | #ifndef OCTAVE_CONF_LIBOCTAVE | |||
#define OCTAVE_CONF_LIBOCTAVE "-loctave" | #define OCTAVE_CONF_LIBOCTAVE "-loctave" | |||
skipping to change at line 368 | skipping to change at line 390 | |||
#ifndef OCTAVE_CONF_LIBOCTINTERP | #ifndef OCTAVE_CONF_LIBOCTINTERP | |||
#define OCTAVE_CONF_LIBOCTINTERP "-loctinterp" | #define OCTAVE_CONF_LIBOCTINTERP "-loctinterp" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LIBPLPLOT | #ifndef OCTAVE_CONF_LIBPLPLOT | |||
#define OCTAVE_CONF_LIBPLPLOT %OCTAVE_CONF_LIBPLPLOT% | #define OCTAVE_CONF_LIBPLPLOT %OCTAVE_CONF_LIBPLPLOT% | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LIBS | #ifndef OCTAVE_CONF_LIBS | |||
#define OCTAVE_CONF_LIBS "-lm " | #define OCTAVE_CONF_LIBS "-lutil -lm " | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LN_S | #ifndef OCTAVE_CONF_LN_S | |||
#define OCTAVE_CONF_LN_S "ln -s" | #define OCTAVE_CONF_LN_S "ln -s" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_MAGICK_CPPFLAGS | #ifndef OCTAVE_CONF_MAGICK_CPPFLAGS | |||
#define OCTAVE_CONF_MAGICK_CPPFLAGS "-I/usr/include/GraphicsMagick " | #define OCTAVE_CONF_MAGICK_CPPFLAGS "-I/usr/include/GraphicsMagick " | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_MAGICK_LDFLAGS | #ifndef OCTAVE_CONF_MAGICK_LDFLAGS | |||
#define OCTAVE_CONF_MAGICK_LDFLAGS "" | #define OCTAVE_CONF_MAGICK_LDFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_MAGICK_LIBS | #ifndef OCTAVE_CONF_MAGICK_LIBS | |||
#define OCTAVE_CONF_MAGICK_LIBS "-lGraphicsMagick++ -lGraphicsMagick " | #define OCTAVE_CONF_MAGICK_LIBS "-lGraphicsMagick++ -lGraphicsMagick " | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_LLVM_CPPFLAGS | ||||
#define OCTAVE_CONF_LLVM_CPPFLAGS "" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_LLVM_LDFLAGS | ||||
#define OCTAVE_CONF_LLVM_LDFLAGS "" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_LLVM_LIBS | ||||
#define OCTAVE_CONF_LLVM_LIBS "" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS | #ifndef OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS | |||
#define OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS "-shared -Wl,-Bsymbolic" | #define OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS "-shared -Wl,-Bsymbolic" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_OCTAVE_LINK_DEPS | #ifndef OCTAVE_CONF_OCTAVE_LINK_DEPS | |||
#define OCTAVE_CONF_OCTAVE_LINK_DEPS "" | #define OCTAVE_CONF_OCTAVE_LINK_DEPS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_OCTAVE_LINK_OPTS | #ifndef OCTAVE_CONF_OCTAVE_LINK_OPTS | |||
#define OCTAVE_CONF_OCTAVE_LINK_OPTS "" | #define OCTAVE_CONF_OCTAVE_LINK_OPTS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_OCTINCLUDEDIR | #ifndef OCTAVE_CONF_OCTINCLUDEDIR | |||
#define OCTAVE_CONF_OCTINCLUDEDIR "/home/ut/testing/octave/3.6.4/include/oc tave-3.6.4/octave" | #define OCTAVE_CONF_OCTINCLUDEDIR "/home/ut/testing/octave/3.8.0/include/oc tave-3.8.0/octave" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_OCTLIBDIR | #ifndef OCTAVE_CONF_OCTLIBDIR | |||
#define OCTAVE_CONF_OCTLIBDIR "/home/ut/testing/octave/3.6.4/lib/octave/3.6 .4" | #define OCTAVE_CONF_OCTLIBDIR "/home/ut/testing/octave/3.8.0/lib/octave/3.8 .0" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_OCT_LINK_DEPS | #ifndef OCTAVE_CONF_OCT_LINK_DEPS | |||
#define OCTAVE_CONF_OCT_LINK_DEPS "" | #define OCTAVE_CONF_OCT_LINK_DEPS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_OCT_LINK_OPTS | #ifndef OCTAVE_CONF_OCT_LINK_OPTS | |||
#define OCTAVE_CONF_OCT_LINK_OPTS "-llapack " | #define OCTAVE_CONF_OCT_LINK_OPTS " " | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_OPENGL_LIBS | #ifndef OCTAVE_CONF_OPENGL_LIBS | |||
#define OCTAVE_CONF_OPENGL_LIBS "-lfontconfig -lGL -lGLU" | #define OCTAVE_CONF_OPENGL_LIBS "-lfontconfig -lGL -lGLU" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_PCRE_CPPFLAGS | ||||
#define OCTAVE_CONF_PCRE_CPPFLAGS "" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_PCRE_LIBS | ||||
#define OCTAVE_CONF_PCRE_LIBS "-lpcre" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_PREFIX | #ifndef OCTAVE_CONF_PREFIX | |||
#define OCTAVE_CONF_PREFIX "/home/ut/testing/octave/3.6.4" | #define OCTAVE_CONF_PREFIX "/home/ut/testing/octave/3.8.0" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_PTHREAD_CFLAGS | #ifndef OCTAVE_CONF_PTHREAD_CFLAGS | |||
#define OCTAVE_CONF_PTHREAD_CFLAGS "-pthread" | #define OCTAVE_CONF_PTHREAD_CFLAGS "-pthread" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_PTHREAD_LIBS | #ifndef OCTAVE_CONF_PTHREAD_LIBS | |||
#define OCTAVE_CONF_PTHREAD_LIBS "" | #define OCTAVE_CONF_PTHREAD_LIBS "" | |||
#endif | #endif | |||
skipping to change at line 455 | skipping to change at line 497 | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_QRUPDATE_LDFLAGS | #ifndef OCTAVE_CONF_QRUPDATE_LDFLAGS | |||
#define OCTAVE_CONF_QRUPDATE_LDFLAGS "" | #define OCTAVE_CONF_QRUPDATE_LDFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_QRUPDATE_LIBS | #ifndef OCTAVE_CONF_QRUPDATE_LIBS | |||
#define OCTAVE_CONF_QRUPDATE_LIBS "-lqrupdate" | #define OCTAVE_CONF_QRUPDATE_LIBS "-lqrupdate" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_QT_CPPFLAGS | ||||
#define OCTAVE_CONF_QT_CPPFLAGS "-I/usr/include/QtCore -I/usr/include/QtGui | ||||
-I/usr/include/QtNetwork " | ||||
#endif | ||||
#ifndef OCTAVE_CONF_QT_LDFLAGS | ||||
#define OCTAVE_CONF_QT_LDFLAGS "" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_QT_LIBS | ||||
#define OCTAVE_CONF_QT_LIBS "-lQtGui -lQtNetwork -lQtCore " | ||||
#endif | ||||
#ifndef OCTAVE_CONF_RANLIB | #ifndef OCTAVE_CONF_RANLIB | |||
#define OCTAVE_CONF_RANLIB "ranlib" | #define OCTAVE_CONF_RANLIB "ranlib" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_RDYNAMIC_FLAG | #ifndef OCTAVE_CONF_RDYNAMIC_FLAG | |||
#define OCTAVE_CONF_RDYNAMIC_FLAG "-rdynamic" | #define OCTAVE_CONF_RDYNAMIC_FLAG "-rdynamic" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_READLINE_LIBS | #ifndef OCTAVE_CONF_READLINE_LIBS | |||
#define OCTAVE_CONF_READLINE_LIBS "-lreadline" | #define OCTAVE_CONF_READLINE_LIBS "-lreadline" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_REGEX_LIBS | ||||
#define OCTAVE_CONF_REGEX_LIBS "-lpcre" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_SED | #ifndef OCTAVE_CONF_SED | |||
#define OCTAVE_CONF_SED "/bin/sed" | #define OCTAVE_CONF_SED "/bin/sed" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_SHARED_LIBS | #ifndef OCTAVE_CONF_SHARED_LIBS | |||
#define OCTAVE_CONF_SHARED_LIBS "" | #define OCTAVE_CONF_SHARED_LIBS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_SHLEXT | #ifndef OCTAVE_CONF_SHLEXT | |||
#define OCTAVE_CONF_SHLEXT "so" | #define OCTAVE_CONF_SHLEXT "so" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_SHLEXT_VER | #ifndef OCTAVE_CONF_SHLEXT_VER | |||
#define OCTAVE_CONF_SHLEXT_VER "so.3.6.4" | #define OCTAVE_CONF_SHLEXT_VER "so.3.8.0" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_SH_LD | #ifndef OCTAVE_CONF_SH_LD | |||
#define OCTAVE_CONF_SH_LD "g++" | #define OCTAVE_CONF_SH_LD "g++" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_SH_LDFLAGS | #ifndef OCTAVE_CONF_SH_LDFLAGS | |||
#define OCTAVE_CONF_SH_LDFLAGS "-shared" | #define OCTAVE_CONF_SH_LDFLAGS "-shared" | |||
#endif | #endif | |||
skipping to change at line 507 | skipping to change at line 557 | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_STATIC_LIBS | #ifndef OCTAVE_CONF_STATIC_LIBS | |||
#define OCTAVE_CONF_STATIC_LIBS "" | #define OCTAVE_CONF_STATIC_LIBS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_TERM_LIBS | #ifndef OCTAVE_CONF_TERM_LIBS | |||
#define OCTAVE_CONF_TERM_LIBS "-lncurses" | #define OCTAVE_CONF_TERM_LIBS "-lncurses" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_UGLY_DEFS | ||||
#define OCTAVE_CONF_UGLY_DEFS "-DPACKAGE_NAME=\"GNU Octave\" -DPACKAGE_TARN | ||||
AME=\"octave\" -DPACKAGE_VERSION=\"3.6.4\" -DPACKAGE_STRING=\"GNU Octave 3. | ||||
6.4\" -DPACKAGE_BUGREPORT=\"http://octave.org/bugs.html\" -DPACKAGE_URL=\"h | ||||
ttp://www.gnu.org/software/octave/\" -DPACKAGE=\"octave\" -DVERSION=\"3.6.4 | ||||
\" -DOCTAVE_SOURCE=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_ | ||||
H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H= | ||||
1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D__EXTENSIONS__= | ||||
1 -D_ALL_SOURCE=1 -D_DARWIN_C_SOURCE=1 -D_GNU_SOURCE=1 -D_POSIX_PTHREAD_SEM | ||||
ANTICS=1 -D_TANDEM_SOURCE=1 -DSEPCHAR=':' -DSEPCHAR_STR=\":\" -DOCTAVE_IDX_ | ||||
TYPE=int -D__NO_MATH_INLINES=1 -DCXX_NEW_FRIEND_TEMPLATE_DECL=1 -DCXX_ISO_C | ||||
OMPLIANT_LIBRARY=1 -DHAVE_FSEEKO=1 -D_FILE_OFFSET_BITS=64 -DHAVE_ALLOCA_H=1 | ||||
-DHAVE_ALLOCA=1 -DHAVE_CANONICALIZE_FILE_NAME=1 -DHAVE_GETCWD=1 -DHAVE_REA | ||||
DLINK=1 -DHAVE_REALPATH=1 -DHAVE_FCHDIR=1 -DHAVE_FCNTL=1 -DHAVE_SYMLINK=1 - | ||||
DHAVE_FDOPENDIR=1 -DHAVE_MEMPCPY=1 -DHAVE_BTOWC=1 -DHAVE_ISBLANK=1 -DHAVE_I | ||||
SWCTYPE=1 -DHAVE_MBSRTOWCS=1 -DHAVE_WMEMCHR=1 -DHAVE_WMEMCPY=1 -DHAVE_WMEMP | ||||
CPY=1 -DHAVE___FPURGE=1 -DHAVE___FREADING=1 -DHAVE_FSTATAT=1 -DHAVE_GETDTAB | ||||
LESIZE=1 -DHAVE_GETLOGIN_R=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_GETPWNAM_R=1 -DHA | ||||
VE_LINK=1 -DHAVE_LSTAT=1 -DHAVE_MBSINIT=1 -DHAVE_MBRTOWC=1 -DHAVE_MPROTECT= | ||||
1 -DHAVE_MKFIFO=1 -DHAVE_MKOSTEMP=1 -DHAVE_MKSTEMP=1 -DHAVE_ALARM=1 -DHAVE_ | ||||
OPENAT=1 -DHAVE_SIGACTION=1 -DHAVE_SIGALTSTACK=1 -DHAVE_SIGINTERRUPT=1 -DHA | ||||
VE_SLEEP=1 -DHAVE_STRDUP=1 -DHAVE_TZSET=1 -DHAVE_STRPTIME=1 -DHAVE_LOCALTIM | ||||
E_R=1 -DHAVE_TIMES=1 -DHAVE_PIPE=1 -DHAVE_SNPRINTF=1 -DHAVE_ISWCNTRL=1 -DFU | ||||
NC_REALPATH_WORKS=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_SOCKE | ||||
T_H=1 -DHAVE_DIRENT_H=1 -DHAVE_WCTYPE_H=1 -DHAVE_NETDB_H=1 -DHAVE_GETOPT_H= | ||||
1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_CDEFS_H=1 -DHAVE_MATH_H=1 -DHAVE_SYS_MMAN_ | ||||
H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_WCHAR_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS | ||||
_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_SYS_UIO_H=1 -DHAVE_FEA | ||||
TURES_H=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DSTRERROR_R_CHAR_P= | ||||
1 -DHAVE_DECL_FCHDIR=1 -DHAVE_WORKING_O_NOATIME=1 -DHAVE_WORKING_O_NOFOLLOW | ||||
=1 -DHAVE_DECL_STRMODE=0 -DHAVE_MBSTATE_T=1 -DHAVE_DECL_FSEEKO=1 -DLSTAT_FO | ||||
LLOWS_SLASHED_SYMLINK=1 -DHAVE_DECL_FTELLO=1 -DHAVE_DECL_GETCWD=1 -DHAVE_DE | ||||
CL_GETLOGIN_R=1 -DHAVE_DECL_GETLOGIN=1 -DHAVE_GETOPT_H=1 -DHAVE_GETOPT_LONG | ||||
_ONLY=1 -D__GETOPT_PREFIX=rpl_ -DHAVE_DECL_GETENV=1 -Drestrict=__restrict - | ||||
DHAVE_RAW_DECL_GETTIMEOFDAY=1 -DDBL_EXPBIT0_WORD=1 -DDBL_EXPBIT0_BIT=20 -DF | ||||
LT_EXPBIT0_WORD=0 -DFLT_EXPBIT0_BIT=23 -DHAVE_LANGINFO_CODESET=1 -DHAVE_DEC | ||||
L_GETC_UNLOCKED=1 -DHAVE_STDLIB_H=1 -DMALLOC_0_IS_NONNULL=1 -DHAVE_UNSIGNED | ||||
_LONG_LONG_INT=1 -DHAVE_LONG_LONG_INT=1 -DHAVE_MAP_ANONYMOUS=1 -DHAVE_DECL_ | ||||
MEMRCHR=1 -DHAVE_RAW_DECL_PSELECT=1 -DHAVE_RAW_DECL_SELECT=1 -DPROMOTED_MOD | ||||
E_T=mode_t -DHAVE_SIGSET_T=1 -DHAVE__BOOL=1 -DHAVE_WCHAR_T=1 -DHAVE_DECL_ST | ||||
RDUP=1 -DHAVE_STRUCT_TM_TM_ZONE=1 -DHAVE_TM_ZONE=1 -DHAVE_TM_GMTOFF=1 -DHAV | ||||
E_RAW_DECL_FFSL=1 -DHAVE_RAW_DECL_FFSLL=1 -DHAVE_RAW_DECL_MEMMEM=1 -DHAVE_R | ||||
AW_DECL_MEMPCPY=1 -DHAVE_RAW_DECL_MEMRCHR=1 -DHAVE_RAW_DECL_RAWMEMCHR=1 -DH | ||||
AVE_RAW_DECL_STPCPY=1 -DHAVE_RAW_DECL_STPNCPY=1 -DHAVE_RAW_DECL_STRCHRNUL=1 | ||||
-DHAVE_RAW_DECL_STRDUP=1 -DHAVE_RAW_DECL_STRNCAT=1 -DHAVE_RAW_DECL_STRNDUP | ||||
=1 -DHAVE_RAW_DECL_STRNLEN=1 -DHAVE_RAW_DECL_STRPBRK=1 -DHAVE_RAW_DECL_STRS | ||||
EP=1 -DHAVE_RAW_DECL_STRCASESTR=1 -DHAVE_RAW_DECL_STRTOK_R=1 -DHAVE_RAW_DEC | ||||
L_STRERROR_R=1 -DHAVE_RAW_DECL_STRSIGNAL=1 -DHAVE_RAW_DECL_STRVERSCMP=1 -DH | ||||
AVE_RAW_DECL_FFS=1 -DHAVE_RAW_DECL_STRCASECMP=1 -DHAVE_RAW_DECL_STRNCASECMP | ||||
=1 -DHAVE_DECL_LOCALTIME_R=0 -DHAVE_WINT_T=1 -DHAVE_INTTYPES_H_WITH_UINTMAX | ||||
=1 -DHAVE_STDINT_H_WITH_UINTMAX=1 -DHAVE_INTMAX_T=1 -DHAVE_SNPRINTF=1 -DHAV | ||||
E_STRNLEN=1 -DHAVE_WCSLEN=1 -DHAVE_WCSNLEN=1 -DHAVE_MBRTOWC=1 -DHAVE_WCRTOM | ||||
B=1 -DHAVE_DECL__SNPRINTF=0 -DHAVE_SNPRINTF_RETVAL_C99=1 -DHAVE_ALLOCA=1 -D | ||||
GNULIB_CANONICALIZE_LGPL=1 -DGNULIB_TEST_CANONICALIZE_FILE_NAME=1 -DGNULIB_ | ||||
TEST_REALPATH=1 -DGNULIB_TEST_CHDIR=1 -DGNULIB_TEST_CLOEXEC=1 -DGNULIB_TEST | ||||
_CLOSE=1 -DHAVE_CLOSEDIR=1 -DGNULIB_TEST_CLOSEDIR=1 -DGNULIB_TEST_COPYSIGN= | ||||
1 -DGNULIB_TEST_COPYSIGNF=1 -DD_INO_IN_DIRENT=1 -DHAVE_STRUCT_DIRENT_D_TYPE | ||||
=1 -DHAVE_RAW_DECL_ALPHASORT=1 -DHAVE_RAW_DECL_CLOSEDIR=1 -DHAVE_RAW_DECL_D | ||||
IRFD=1 -DHAVE_RAW_DECL_FDOPENDIR=1 -DHAVE_RAW_DECL_OPENDIR=1 -DHAVE_RAW_DEC | ||||
L_READDIR=1 -DHAVE_RAW_DECL_REWINDDIR=1 -DHAVE_RAW_DECL_SCANDIR=1 -DHAVE_DI | ||||
RFD=1 -DHAVE_DECL_DIRFD=1 -DGNULIB_TEST_DIRFD=1 -DGNULIB_TEST_DUP=1 -DHAVE_ | ||||
DUP2=1 -DGNULIB_TEST_DUP2=1 -DGNULIB_TEST_FCHDIR=1 -DGNULIB_TEST_FCLOSE=1 - | ||||
DGNULIB_TEST_FCNTL=1 -DHAVE_RAW_DECL_FCNTL=1 -DHAVE_RAW_DECL_OPENAT=1 -DHAV | ||||
E_DECL_FDOPENDIR=1 -DGNULIB_TEST_FDOPENDIR=1 -DGNULIB_FDOPENDIR=1 -DGNULIB_ | ||||
FFLUSH=1 -DGNULIB_TEST_FFLUSH=1 -DGNULIB_TEST_FLOOR=1 -DGNULIB_TEST_FOPEN=1 | ||||
-DHAVE_DECL_FPURGE=0 -DGNULIB_TEST_FPURGE=1 -DGNULIB_TEST_FSEEK=1 -DGNULIB | ||||
_TEST_FSEEKO=1 -DGNULIB_TEST_FSTAT=1 -DGNULIB_FSTATAT=1 -DGNULIB_TEST_FSTAT | ||||
AT=1 -DGNULIB_TEST_FTELL=1 -DGNULIB_TEST_FTELLO=1 -DHAVE_GETPAGESIZE=1 -DHA | ||||
VE_MINIMALLY_WORKING_GETCWD=1 -DHAVE_PARTLY_WORKING_GETCWD=1 -DGNULIB_GETCW | ||||
D=1 -DGNULIB_TEST_GETCWD=1 -DGNULIB_TEST_GETCWD=1 -DGNULIB_TEST_GETDTABLESI | ||||
ZE=1 -DHAVE_GETHOSTNAME=1 -DGNULIB_TEST_GETHOSTNAME=1 -DGNULIB_TEST_GETLOGI | ||||
N_R=1 -DGNULIB_TEST_GETOPT_GNU=1 -D__GETOPT_PREFIX=rpl_ -DGETTIMEOFDAY_TIME | ||||
ZONE=struct timezone -DGNULIB_TEST_GETTIMEOFDAY=1 -DHAVE_GLOB_H=1 -DGNULIB_ | ||||
TEST_ISATTY=1 -DHAVE_ISNAND_IN_LIBC=1 -DHAVE_ISNANF_IN_LIBC=1 -DLDBL_EXPBIT | ||||
0_WORD=2 -DLDBL_EXPBIT0_BIT=0 -DGNULIB_TEST_LINK=1 -DGNULIB_TEST_LSEEK=1 -D | ||||
GNULIB_TEST_LSTAT=1 -DHAVE_MALLOC_POSIX=1 -DGNULIB_TEST_MALLOC_POSIX=1 -DHA | ||||
VE_RAW_DECL_ACOSF=1 -DHAVE_RAW_DECL_ACOSL=1 -DHAVE_RAW_DECL_ASINF=1 -DHAVE_ | ||||
RAW_DECL_ASINL=1 -DHAVE_RAW_DECL_ATANF=1 -DHAVE_RAW_DECL_ATANL=1 -DHAVE_RAW | ||||
_DECL_CEILF=1 -DHAVE_RAW_DECL_CEILL=1 -DHAVE_RAW_DECL_COPYSIGN=1 -DHAVE_RAW | ||||
_DECL_COPYSIGNF=1 -DHAVE_RAW_DECL_COPYSIGNL=1 -DHAVE_RAW_DECL_COSF=1 -DHAVE | ||||
_RAW_DECL_COSL=1 -DHAVE_RAW_DECL_COSHF=1 -DHAVE_RAW_DECL_EXPF=1 -DHAVE_RAW_ | ||||
DECL_EXPL=1 -DHAVE_RAW_DECL_FABSF=1 -DHAVE_RAW_DECL_FLOORF=1 -DHAVE_RAW_DEC | ||||
L_FLOORL=1 -DHAVE_RAW_DECL_FMA=1 -DHAVE_RAW_DECL_FMAF=1 -DHAVE_RAW_DECL_FMA | ||||
L=1 -DHAVE_RAW_DECL_FMODF=1 -DHAVE_RAW_DECL_FREXPF=1 -DHAVE_RAW_DECL_FREXPL | ||||
=1 -DHAVE_RAW_DECL_LDEXPF=1 -DHAVE_RAW_DECL_LDEXPL=1 -DHAVE_RAW_DECL_LOGB=1 | ||||
-DHAVE_RAW_DECL_LOGF=1 -DHAVE_RAW_DECL_LOGL=1 -DHAVE_RAW_DECL_LOG10F=1 -DH | ||||
AVE_RAW_DECL_MODFF=1 -DHAVE_RAW_DECL_POWF=1 -DHAVE_RAW_DECL_RINT=1 -DHAVE_R | ||||
AW_DECL_RINTF=1 -DHAVE_RAW_DECL_RINTL=1 -DHAVE_RAW_DECL_ROUND=1 -DHAVE_RAW_ | ||||
DECL_ROUNDF=1 -DHAVE_RAW_DECL_ROUNDL=1 -DHAVE_RAW_DECL_SINF=1 -DHAVE_RAW_DE | ||||
CL_SINL=1 -DHAVE_RAW_DECL_SINHF=1 -DHAVE_RAW_DECL_SQRTF=1 -DHAVE_RAW_DECL_S | ||||
QRTL=1 -DHAVE_RAW_DECL_TANF=1 -DHAVE_RAW_DECL_TANL=1 -DHAVE_RAW_DECL_TANHF= | ||||
1 -DHAVE_RAW_DECL_TRUNC=1 -DHAVE_RAW_DECL_TRUNCF=1 -DHAVE_RAW_DECL_TRUNCL=1 | ||||
-DGNULIB_TEST_MBRTOWC=1 -DGNULIB_TEST_MBSINIT=1 -DGNULIB_TEST_MBSRTOWCS=1 | ||||
-DGNULIB_TEST_MEMCHR=1 -DHAVE_MEMPCPY=1 -DGNULIB_TEST_MEMPCPY=1 -DHAVE_MEMR | ||||
CHR=1 -DGNULIB_TEST_MEMRCHR=1 -DGNULIB_TEST_MKFIFO=1 -DGNULIB_MKOSTEMP=1 -D | ||||
GNULIB_TEST_MKOSTEMP=1 -DGNULIB_TEST_MKSTEMP=1 -DGNULIB_TEST_MKTIME=1 -DGNU | ||||
LIB_TEST_NANOSLEEP=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_SYSCTL_H=1 -DHAVE_SCHE | ||||
D_GETAFFINITY=1 -DHAVE_SYSCTL=1 -DHAVE_SCHED_GETAFFINITY_LIKE_GLIBC=1 -DGNU | ||||
LIB_TEST_OPEN=1 -DGNULIB_OPENAT=1 -DGNULIB_TEST_OPENAT=1 -DHAVE_OPENDIR=1 - | ||||
DGNULIB_TEST_OPENDIR=1 -DHAVE_DECL_PROGRAM_INVOCATION_NAME=1 -DHAVE_DECL_PR | ||||
OGRAM_INVOCATION_SHORT_NAME=1 -DHAVE_RAISE=1 -DGNULIB_TEST_RAISE=1 -DHAVE_R | ||||
EADDIR=1 -DGNULIB_TEST_READDIR=1 -DGNULIB_TEST_READLINK=1 -DHAVE_REALLOC_PO | ||||
SIX=1 -DGNULIB_TEST_REALLOC_POSIX=1 -DGNULIB_TEST_RENAME=1 -DHAVE_REWINDDIR | ||||
=1 -DGNULIB_TEST_REWINDDIR=1 -DGNULIB_TEST_RMDIR=1 -DHAVE_DECL_ROUND=1 -DGN | ||||
ULIB_TEST_ROUND=1 -DHAVE_DECL_ROUNDF=1 -DGNULIB_TEST_ROUNDF=1 -DGNULIB_TEST | ||||
_SELECT=1 -DHAVE_STRUCT_SIGACTION_SA_SIGACTION=1 -DGNULIB_TEST_SIGACTION=1 | ||||
-DHAVE_RAW_DECL_PTHREAD_SIGMASK=1 -DHAVE_RAW_DECL_SIGACTION=1 -DHAVE_RAW_DE | ||||
CL_SIGADDSET=1 -DHAVE_RAW_DECL_SIGDELSET=1 -DHAVE_RAW_DECL_SIGEMPTYSET=1 -D | ||||
HAVE_RAW_DECL_SIGFILLSET=1 -DHAVE_RAW_DECL_SIGISMEMBER=1 -DHAVE_RAW_DECL_SI | ||||
GPENDING=1 -DHAVE_RAW_DECL_SIGPROCMASK=1 -DGNULIB_TEST_SIGNBIT=1 -DGNULIB_T | ||||
EST_SIGPROCMASK=1 -DHAVE_STDINT_H=1 -DHAVE_DECL_SLEEP=1 -DGNULIB_TEST_SLEEP | ||||
=1 -DGNULIB_TEST_STAT=1 -DHAVE_RAW_DECL_DPRINTF=1 -DHAVE_RAW_DECL_FSEEKO=1 | ||||
-DHAVE_RAW_DECL_FTELLO=1 -DHAVE_RAW_DECL_GETDELIM=1 -DHAVE_RAW_DECL_GETLINE | ||||
=1 -DHAVE_RAW_DECL_GETS=1 -DHAVE_RAW_DECL_PCLOSE=1 -DHAVE_RAW_DECL_POPEN=1 | ||||
-DHAVE_RAW_DECL_RENAMEAT=1 -DHAVE_RAW_DECL_SNPRINTF=1 -DHAVE_RAW_DECL_TMPFI | ||||
LE=1 -DHAVE_RAW_DECL_VDPRINTF=1 -DHAVE_RAW_DECL_VSNPRINTF=1 -DHAVE_RAW_DECL | ||||
__EXIT=1 -DHAVE_RAW_DECL_ATOLL=1 -DHAVE_RAW_DECL_CANONICALIZE_FILE_NAME=1 - | ||||
DHAVE_RAW_DECL_GETLOADAVG=1 -DHAVE_RAW_DECL_GETSUBOPT=1 -DHAVE_RAW_DECL_GRA | ||||
NTPT=1 -DHAVE_RAW_DECL_INITSTATE_R=1 -DHAVE_RAW_DECL_MKDTEMP=1 -DHAVE_RAW_D | ||||
ECL_MKOSTEMP=1 -DHAVE_RAW_DECL_MKOSTEMPS=1 -DHAVE_RAW_DECL_MKSTEMP=1 -DHAVE | ||||
_RAW_DECL_MKSTEMPS=1 -DHAVE_RAW_DECL_POSIX_OPENPT=1 -DHAVE_RAW_DECL_PTSNAME | ||||
=1 -DHAVE_RAW_DECL_PTSNAME_R=1 -DHAVE_RAW_DECL_RANDOM_R=1 -DHAVE_RAW_DECL_R | ||||
EALPATH=1 -DHAVE_RAW_DECL_RPMATCH=1 -DHAVE_RAW_DECL_SETENV=1 -DHAVE_RAW_DEC | ||||
L_SETSTATE_R=1 -DHAVE_RAW_DECL_SRANDOM_R=1 -DHAVE_RAW_DECL_STRTOD=1 -DHAVE_ | ||||
RAW_DECL_STRTOLL=1 -DHAVE_RAW_DECL_STRTOULL=1 -DHAVE_RAW_DECL_UNLOCKPT=1 -D | ||||
HAVE_RAW_DECL_UNSETENV=1 -DHAVE_STRCASECMP=1 -DHAVE_STRNCASECMP=1 -DHAVE_DE | ||||
CL_STRNCASECMP=1 -DGNULIB_TEST_STRDUP=1 -DGNULIB_STRERROR=1 -DGNULIB_TEST_S | ||||
TRERROR=1 -Dmy_strftime=nstrftime -DGNULIB_TEST_STRPTIME=1 -DGNULIB_TEST_SY | ||||
MLINK=1 -DHAVE_RAW_DECL_PSELECT=1 -DHAVE_RAW_DECL_SELECT=1 -DHAVE_SHUTDOWN= | ||||
1 -DHAVE_STRUCT_SOCKADDR_STORAGE=1 -DHAVE_SA_FAMILY_T=1 -DHAVE_STRUCT_SOCKA | ||||
DDR_STORAGE_SS_FAMILY=1 -DHAVE_RAW_DECL_SOCKET=1 -DHAVE_RAW_DECL_CONNECT=1 | ||||
-DHAVE_RAW_DECL_ACCEPT=1 -DHAVE_RAW_DECL_BIND=1 -DHAVE_RAW_DECL_GETPEERNAME | ||||
=1 -DHAVE_RAW_DECL_GETSOCKNAME=1 -DHAVE_RAW_DECL_GETSOCKOPT=1 -DHAVE_RAW_DE | ||||
CL_LISTEN=1 -DHAVE_RAW_DECL_RECV=1 -DHAVE_RAW_DECL_SEND=1 -DHAVE_RAW_DECL_R | ||||
ECVFROM=1 -DHAVE_RAW_DECL_SENDTO=1 -DHAVE_RAW_DECL_SETSOCKOPT=1 -DHAVE_RAW_ | ||||
DECL_SHUTDOWN=1 -DHAVE_RAW_DECL_ACCEPT4=1 -DHAVE_RAW_DECL_FCHMODAT=1 -DHAVE | ||||
_RAW_DECL_FSTAT=1 -DHAVE_RAW_DECL_FSTATAT=1 -DHAVE_RAW_DECL_FUTIMENS=1 -DHA | ||||
VE_RAW_DECL_LCHMOD=1 -DHAVE_RAW_DECL_LSTAT=1 -DHAVE_RAW_DECL_MKDIRAT=1 -DHA | ||||
VE_RAW_DECL_MKFIFO=1 -DHAVE_RAW_DECL_MKFIFOAT=1 -DHAVE_RAW_DECL_MKNOD=1 -DH | ||||
AVE_RAW_DECL_MKNODAT=1 -DHAVE_RAW_DECL_STAT=1 -DHAVE_RAW_DECL_UTIMENSAT=1 - | ||||
DHAVE_STRUCT_TMS=1 -DHAVE_RAW_DECL_TIMES=1 -DGNULIB_TEST_TIME_R=1 -DHAVE___ | ||||
SECURE_GETENV=1 -DGNULIB_TEST_TMPFILE=1 -DHAVE_DECL_TRUNC=1 -DGNULIB_TEST_T | ||||
RUNC=1 -DHAVE_DECL_TRUNCF=1 -DGNULIB_TEST_TRUNCF=1 -DHAVE_RAW_DECL_CHDIR=1 | ||||
-DHAVE_RAW_DECL_CHOWN=1 -DHAVE_RAW_DECL_DUP=1 -DHAVE_RAW_DECL_DUP2=1 -DHAVE | ||||
_RAW_DECL_DUP3=1 -DHAVE_RAW_DECL_ENVIRON=1 -DHAVE_RAW_DECL_EUIDACCESS=1 -DH | ||||
AVE_RAW_DECL_FACCESSAT=1 -DHAVE_RAW_DECL_FCHDIR=1 -DHAVE_RAW_DECL_FCHOWNAT= | ||||
1 -DHAVE_RAW_DECL_FDATASYNC=1 -DHAVE_RAW_DECL_FSYNC=1 -DHAVE_RAW_DECL_FTRUN | ||||
CATE=1 -DHAVE_RAW_DECL_GETCWD=1 -DHAVE_RAW_DECL_GETDOMAINNAME=1 -DHAVE_RAW_ | ||||
DECL_GETDTABLESIZE=1 -DHAVE_RAW_DECL_GETGROUPS=1 -DHAVE_RAW_DECL_GETHOSTNAM | ||||
E=1 -DHAVE_RAW_DECL_GETLOGIN=1 -DHAVE_RAW_DECL_GETLOGIN_R=1 -DHAVE_RAW_DECL | ||||
_GETPAGESIZE=1 -DHAVE_RAW_DECL_GETUSERSHELL=1 -DHAVE_RAW_DECL_SETUSERSHELL= | ||||
1 -DHAVE_RAW_DECL_ENDUSERSHELL=1 -DHAVE_RAW_DECL_GROUP_MEMBER=1 -DHAVE_RAW_ | ||||
DECL_ISATTY=1 -DHAVE_RAW_DECL_LCHOWN=1 -DHAVE_RAW_DECL_LINK=1 -DHAVE_RAW_DE | ||||
CL_LINKAT=1 -DHAVE_RAW_DECL_LSEEK=1 -DHAVE_RAW_DECL_PIPE=1 -DHAVE_RAW_DECL_ | ||||
PIPE2=1 -DHAVE_RAW_DECL_PREAD=1 -DHAVE_RAW_DECL_PWRITE=1 -DHAVE_RAW_DECL_RE | ||||
ADLINK=1 -DHAVE_RAW_DECL_READLINKAT=1 -DHAVE_RAW_DECL_RMDIR=1 -DHAVE_RAW_DE | ||||
CL_SETHOSTNAME=1 -DHAVE_RAW_DECL_SLEEP=1 -DHAVE_RAW_DECL_SYMLINK=1 -DHAVE_R | ||||
AW_DECL_SYMLINKAT=1 -DHAVE_RAW_DECL_TTYNAME_R=1 -DHAVE_RAW_DECL_UNLINK=1 -D | ||||
HAVE_RAW_DECL_UNLINKAT=1 -DHAVE_RAW_DECL_USLEEP=1 -DGNULIB_TEST_UNLINK=1 -D | ||||
HAVE_VASPRINTF=1 -DGNULIB_TEST_VASPRINTF=1 -DHAVE_RAW_DECL_BTOWC=1 -DHAVE_R | ||||
AW_DECL_WCTOB=1 -DHAVE_RAW_DECL_MBSINIT=1 -DHAVE_RAW_DECL_MBRTOWC=1 -DHAVE_ | ||||
RAW_DECL_MBRLEN=1 -DHAVE_RAW_DECL_MBSRTOWCS=1 -DHAVE_RAW_DECL_MBSNRTOWCS=1 | ||||
-DHAVE_RAW_DECL_WCRTOMB=1 -DHAVE_RAW_DECL_WCSRTOMBS=1 -DHAVE_RAW_DECL_WCSNR | ||||
TOMBS=1 -DHAVE_RAW_DECL_WCWIDTH=1 -DHAVE_RAW_DECL_WMEMCHR=1 -DHAVE_RAW_DECL | ||||
_WMEMCMP=1 -DHAVE_RAW_DECL_WMEMCPY=1 -DHAVE_RAW_DECL_WMEMMOVE=1 -DHAVE_RAW_ | ||||
DECL_WMEMSET=1 -DHAVE_RAW_DECL_WCSLEN=1 -DHAVE_RAW_DECL_WCSNLEN=1 -DHAVE_RA | ||||
W_DECL_WCSCPY=1 -DHAVE_RAW_DECL_WCPCPY=1 -DHAVE_RAW_DECL_WCSNCPY=1 -DHAVE_R | ||||
AW_DECL_WCPNCPY=1 -DHAVE_RAW_DECL_WCSCAT=1 -DHAVE_RAW_DECL_WCSNCAT=1 -DHAVE | ||||
_RAW_DECL_WCSCMP=1 -DHAVE_RAW_DECL_WCSNCMP=1 -DHAVE_RAW_DECL_WCSCASECMP=1 - | ||||
DHAVE_RAW_DECL_WCSNCASECMP=1 -DHAVE_RAW_DECL_WCSCOLL=1 -DHAVE_RAW_DECL_WCSX | ||||
FRM=1 -DHAVE_RAW_DECL_WCSDUP=1 -DHAVE_RAW_DECL_WCSCHR=1 -DHAVE_RAW_DECL_WCS | ||||
RCHR=1 -DHAVE_RAW_DECL_WCSCSPN=1 -DHAVE_RAW_DECL_WCSSPN=1 -DHAVE_RAW_DECL_W | ||||
CSPBRK=1 -DHAVE_RAW_DECL_WCSSTR=1 -DHAVE_RAW_DECL_WCSTOK=1 -DHAVE_RAW_DECL_ | ||||
WCSWIDTH=1 -DHAVE_TOWLOWER=1 -DHAVE_RAW_DECL_WCTYPE=1 -DHAVE_RAW_DECL_ISWCT | ||||
YPE=1 -DHAVE_RAW_DECL_WCTRANS=1 -DHAVE_RAW_DECL_TOWCTRANS=1 -DHAVE_STDINT_H | ||||
=1 -DHAVE_PTHREAD=1 -DHAVE_X_WINDOWS=1 -DFLOAT_TRUNCATE= -DHAVE_LIBM=1 -DF7 | ||||
7_FUNC(name,NAME)=name ## _ -DF77_FUNC_(name,NAME)=name ## _ -DHAVE_IEEE754 | ||||
_DATA_FORMAT=1 -DHAVE_CXX_COMPLEX_SETTERS=1 -DHAVE_CXX_COMPLEX_REFERENCE_AC | ||||
CESSORS=1 -DHAVE_PCRE_H=1 -DHAVE_PCRE_COMPILE=1 -DHAVE_ZLIB_H=1 -DHAVE_Z=1 | ||||
-DHAVE_HDF5_H=1 -DHAVE_HDF5_18=1 -DHAVE_HDF5=1 -DHAVE_FFTW3_H=1 -DHAVE_FFTW | ||||
3=1 -DHAVE_FFTW3_H=1 -DHAVE_FFTW3F=1 -DHAVE_GLPK_H=1 -DHAVE_GLPK=1 -DHAVE_C | ||||
URL_CURL_H=1 -DHAVE_CURL=1 -DHAVE_MAGICK=1 -DHAVE_GL_GL_H=1 -DHAVE_GL_GLU_H | ||||
=1 -DHAVE_OPENGL=1 -DHAVE_FREETYPE=1 -DHAVE_FONTCONFIG=1 -DHAVE_FLTK=1 -DHA | ||||
VE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_QRUPDATE=1 -DHAVE_SUITESPARSE_AM | ||||
D_H=1 -DHAVE_AMD=1 -DHAVE_SUITESPARSE_CAMD_H=1 -DHAVE_CAMD=1 -DHAVE_SUITESP | ||||
ARSE_COLAMD_H=1 -DHAVE_COLAMD=1 -DHAVE_SUITESPARSE_CCOLAMD_H=1 -DHAVE_CCOLA | ||||
MD=1 -DHAVE_SUITESPARSE_CHOLMOD_H=1 -DHAVE_CHOLMOD=1 -DHAVE_SUITESPARSE_CS_ | ||||
H=1 -DHAVE_CXSPARSE=1 -DHAVE_GETPWNAM=1 -DHAVE_DEV_T=1 -DHAVE_INO_T=1 -DHAV | ||||
E_LONG_LONG_INT=1 -DHAVE_UNSIGNED_LONG_LONG_INT=1 -DSIZEOF_SHORT=2 -DSIZEOF | ||||
_INT=4 -DSIZEOF_LONG=4 -DSIZEOF_LONG_LONG=8 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA | ||||
=1 -DHAVE_PLACEMENT_DELETE=1 -DHAVE_DYNAMIC_AUTO_ARRAYS=1 -DHAVE_FAST_INT_O | ||||
PS=1 -DSIZEOF_LONG_DOUBLE=12 -DHAVE_DIRENT_H=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_C | ||||
URSES_H=1 -DHAVE_DLFCN_H=1 -DHAVE_GRP_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LOCALE | ||||
_H=1 -DHAVE_MEMORY_H=1 -DHAVE_NCURSES_H=1 -DHAVE_POLL_H=1 -DHAVE_PTHREAD_H= | ||||
1 -DHAVE_PWD_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_POLL_ | ||||
H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_UTSNAME_H=1 -D | ||||
HAVE_TERMCAP_H=1 -DHAVE_SSTREAM=1 -DHAVE_TR1_UNORDERED_MAP=1 -DUSE_UNORDERE | ||||
D_MAP_WITH_TR1=1 -DHAVE_TERMIOS_H=1 -DHAVE_TERMIO_H=1 -DHAVE_SGTTY_H=1 -DHA | ||||
VE_FNMATCH_H=1 -DHAVE_BASENAME=1 -DHAVE_CANONICALIZE_FILE_NAME=1 -DHAVE_CHM | ||||
OD=1 -DHAVE_DUP2=1 -DHAVE_ENDGRENT=1 -DHAVE_ENDPWENT=1 -DHAVE_EXECVP=1 -DHA | ||||
VE_EXPM1=1 -DHAVE_EXPM1F=1 -DHAVE_FORK=1 -DHAVE_GETEGID=1 -DHAVE_GETEUID=1 | ||||
-DHAVE_GETGID=1 -DHAVE_GETGRENT=1 -DHAVE_GETGRGID=1 -DHAVE_GETGRNAM=1 -DHAV | ||||
E_GETPGRP=1 -DHAVE_GETPID=1 -DHAVE_GETPPID=1 -DHAVE_GETPWENT=1 -DHAVE_GETPW | ||||
UID=1 -DHAVE_GETUID=1 -DHAVE_GETWD=1 -DHAVE_KILL=1 -DHAVE_LGAMMA=1 -DHAVE_L | ||||
GAMMAF=1 -DHAVE_LGAMMA_R=1 -DHAVE_LGAMMAF_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_L | ||||
OG1P=1 -DHAVE_LOG1PF=1 -DHAVE_MKSTEMP=1 -DHAVE_PIPE=1 -DHAVE_PUTENV=1 -DHAV | ||||
E_REALPATH=1 -DHAVE_RINDEX=1 -DHAVE_ROUNDL=1 -DHAVE_SELECT=1 -DHAVE_SETGREN | ||||
T=1 -DHAVE_SETLOCALE=1 -DHAVE_SETPWENT=1 -DHAVE_SETVBUF=1 -DHAVE_SIGLONGJMP | ||||
=1 -DHAVE_STRSIGNAL=1 -DHAVE_TEMPNAM=1 -DHAVE_TGAMMAF=1 -DHAVE_UMASK=1 -DHA | ||||
VE_UNAME=1 -DHAVE_UTIME=1 -DHAVE_WAITPID=1 -DHAVE_DECL_EXP2=1 -DHAVE_DECL_R | ||||
OUND=1 -DHAVE_DECL_TGAMMA=1 -DHAVE_EXP2=1 -DHAVE_ROUND=1 -DHAVE_TGAMMA=1 -D | ||||
HAVE_DLOPEN_API=1 -DENABLE_DYNAMIC_LINKING=1 -DHAVE_CMATH_ISNAN=1 -DHAVE_CM | ||||
ATH_ISNANF=1 -DHAVE_CMATH_ISINF=1 -DHAVE_CMATH_ISINFF=1 -DHAVE_CMATH_ISFINI | ||||
TE=1 -DHAVE_CMATH_ISFINITEF=1 -DHAVE_FINITE=1 -DHAVE_ISNAN=1 -DHAVE_ISINF=1 | ||||
-DHAVE_DECL_SIGNBIT=1 -DHAVE_ACOSH=1 -DHAVE_ACOSHF=1 -DHAVE_ASINH=1 -DHAVE | ||||
_ASINHF=1 -DHAVE_ATANH=1 -DHAVE_ATANHF=1 -DHAVE_ERF=1 -DHAVE_ERFF=1 -DHAVE_ | ||||
ERFC=1 -DHAVE_ERFCF=1 -DHAVE_EXP2F=1 -DHAVE_LOG2=1 -DHAVE_LOG2F=1 -DHAVE_HY | ||||
POTF=1 -DHAVE_CBRT=1 -DHAVE_CBRTF=1 -DHAVE_STRUCT_STAT_ST_BLKSIZE=1 -DHAVE_ | ||||
STRUCT_STAT_ST_BLOCKS=1 -DHAVE_STRUCT_STAT_ST_RDEV=1 -DHAVE_STRUCT_TM_TM_ZO | ||||
NE=1 -DHAVE_TM_ZONE=1 -DUSE_READLINE=1 -DEXCEPTION_IN_MATH=1 -DHAVE_DECL_SY | ||||
S_SIGLIST=1 -DHAVE_GETRUSAGE=1 -DYYTEXT_POINTER=1" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_UMFPACK_CPPFLAGS | #ifndef OCTAVE_CONF_UMFPACK_CPPFLAGS | |||
#define OCTAVE_CONF_UMFPACK_CPPFLAGS "" | #define OCTAVE_CONF_UMFPACK_CPPFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_UMFPACK_LDFLAGS | #ifndef OCTAVE_CONF_UMFPACK_LDFLAGS | |||
#define OCTAVE_CONF_UMFPACK_LDFLAGS "" | #define OCTAVE_CONF_UMFPACK_LDFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_UMFPACK_LIBS | #ifndef OCTAVE_CONF_UMFPACK_LIBS | |||
#define OCTAVE_CONF_UMFPACK_LIBS "" | #define OCTAVE_CONF_UMFPACK_LIBS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_USE_64_BIT_IDX_T | #ifndef OCTAVE_CONF_USE_64_BIT_IDX_T | |||
#define OCTAVE_CONF_USE_64_BIT_IDX_T "false" | #define OCTAVE_CONF_USE_64_BIT_IDX_T "no" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_ENABLE_DYNAMIC_LINKING | #ifndef OCTAVE_CONF_WARN_CFLAGS | |||
#define OCTAVE_CONF_ENABLE_DYNAMIC_LINKING "true" | #define OCTAVE_CONF_WARN_CFLAGS "-Wall -W -Wshadow -Wformat -Wpointer-arith | |||
-Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wcast-align -Wca | ||||
st-qual" | ||||
#endif | ||||
#ifndef OCTAVE_CONF_WARN_CXXFLAGS | ||||
#define OCTAVE_CONF_WARN_CXXFLAGS "-Wall -W -Wshadow -Wold-style-cast -Wfor | ||||
mat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual" | ||||
#endif | #endif | |||
#ifndef OCTAVE_CONF_X11_INCFLAGS | #ifndef OCTAVE_CONF_X11_INCFLAGS | |||
#define OCTAVE_CONF_X11_INCFLAGS "" | #define OCTAVE_CONF_X11_INCFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_X11_LIBS | #ifndef OCTAVE_CONF_X11_LIBS | |||
#define OCTAVE_CONF_X11_LIBS "-lX11" | #define OCTAVE_CONF_X11_LIBS "-lX11" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_XTRA_CFLAGS | #ifndef OCTAVE_CONF_XTRA_CFLAGS | |||
#define OCTAVE_CONF_XTRA_CFLAGS "-mieee-fp" | #define OCTAVE_CONF_XTRA_CFLAGS "-mieee-fp" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_XTRA_CXXFLAGS | #ifndef OCTAVE_CONF_XTRA_CXXFLAGS | |||
#define OCTAVE_CONF_XTRA_CXXFLAGS "-mieee-fp -I/usr/include/freetype2 " | #define OCTAVE_CONF_XTRA_CXXFLAGS "-mieee-fp" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_YACC | #ifndef OCTAVE_CONF_YACC | |||
#define OCTAVE_CONF_YACC "bison -y" | #define OCTAVE_CONF_YACC "bison -y" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_YFLAGS | #ifndef OCTAVE_CONF_YFLAGS | |||
#define OCTAVE_CONF_YFLAGS "" | #define OCTAVE_CONF_YFLAGS "" | |||
#endif | #endif | |||
skipping to change at line 568 | skipping to change at line 618 | |||
#ifndef OCTAVE_CONF_Z_LDFLAGS | #ifndef OCTAVE_CONF_Z_LDFLAGS | |||
#define OCTAVE_CONF_Z_LDFLAGS "" | #define OCTAVE_CONF_Z_LDFLAGS "" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_Z_LIBS | #ifndef OCTAVE_CONF_Z_LIBS | |||
#define OCTAVE_CONF_Z_LIBS "-lz" | #define OCTAVE_CONF_Z_LIBS "-lz" | |||
#endif | #endif | |||
#ifndef OCTAVE_CONF_config_opts | #ifndef OCTAVE_CONF_config_opts | |||
#define OCTAVE_CONF_config_opts "'--prefix=/home/ut/testing/octave/3.6.4' ' LDFLAGS=-llapack'" | #define OCTAVE_CONF_config_opts "'--prefix=/home/ut/testing/octave/3.8.0'" | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 35 change blocks. | ||||
257 lines changed or deleted | 95 lines changed or added | |||
oct-convn.h | oct-convn.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 Jaroslav Hajek | Copyright (C) 2009-2013 Jaroslav Hajek | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_convn_h) | #if !defined (octave_oct_convn_h) | |||
#define octave_convn_h 1 | #define octave_oct_convn_h 1 | |||
#include "dMatrix.h" | #include "dMatrix.h" | |||
#include "fMatrix.h" | #include "fMatrix.h" | |||
#include "CMatrix.h" | #include "CMatrix.h" | |||
#include "fCMatrix.h" | #include "fCMatrix.h" | |||
#include "dNDArray.h" | #include "dNDArray.h" | |||
#include "fNDArray.h" | #include "fNDArray.h" | |||
#include "CNDArray.h" | #include "CNDArray.h" | |||
#include "fCNDArray.h" | #include "fCNDArray.h" | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
oct-env.h | oct-env.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_env_h) | #if !defined (octave_oct_env_h) | |||
#define octave_env_h 1 | #define octave_oct_env_h 1 | |||
#include <string> | #include <string> | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
octave_env | octave_env | |||
{ | { | |||
protected: | protected: | |||
octave_env (void); | octave_env (void); | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
oct-errno.h | oct-errno.h | |||
---|---|---|---|---|
// oct-errno.h.in | // oct-errno.h.in | |||
/* | /* | |||
Copyright (C) 2005-2012 John W. Eaton | Copyright (C) 2005-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_errno_h) | #if !defined (octave_oct_errno_h) | |||
#define octave_errno_h 1 | #define octave_oct_errno_h 1 | |||
#include <cerrno> | #include <cerrno> | |||
#include <map> | #include <map> | |||
#include <string> | #include <string> | |||
#include "oct-map.h" | #include "oct-map.h" | |||
class | class | |||
octave_errno | octave_errno | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
oct-fftw.h | oct-fftw.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2001-2012 John W. Eaton | Copyright (C) 2001-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 70 | skipping to change at line 70 | |||
static fftw_plan | static fftw_plan | |||
create_plan (int dir, const int rank, const dim_vector dims, | create_plan (int dir, const int rank, const dim_vector dims, | |||
octave_idx_type howmany, octave_idx_type stride, | octave_idx_type howmany, octave_idx_type stride, | |||
octave_idx_type dist, const Complex *in, | octave_idx_type dist, const Complex *in, | |||
Complex *out) | Complex *out) | |||
{ | { | |||
static fftw_plan dummy; | static fftw_plan dummy; | |||
return instance_ok () | return instance_ok () | |||
? instance->do_create_plan (dir, rank, dims, howmany, stride, | ? instance->do_create_plan (dir, rank, dims, howmany, stride, | |||
dist, in, out) | dist, in, out) | |||
: dummy; | : dummy; | |||
} | } | |||
static fftw_plan | static fftw_plan | |||
create_plan (const int rank, const dim_vector dims, | create_plan (const int rank, const dim_vector dims, | |||
octave_idx_type howmany, octave_idx_type stride, | octave_idx_type howmany, octave_idx_type stride, | |||
octave_idx_type dist, const double *in, Complex *out) | octave_idx_type dist, const double *in, Complex *out) | |||
{ | { | |||
static fftw_plan dummy; | static fftw_plan dummy; | |||
return instance_ok () | return instance_ok () | |||
? instance->do_create_plan (rank, dims, howmany, stride, dist, in, ou | ? instance->do_create_plan (rank, dims, howmany, stride, dist, | |||
t) | in, out) | |||
: dummy; | : dummy; | |||
} | } | |||
static FftwMethod method (void) | static FftwMethod method (void) | |||
{ | { | |||
static FftwMethod dummy; | static FftwMethod dummy; | |||
return instance_ok () ? instance->do_method () : dummy; | return instance_ok () ? instance->do_method () : dummy; | |||
} | } | |||
static FftwMethod method (FftwMethod _meth) | static FftwMethod method (FftwMethod _meth) | |||
{ | { | |||
static FftwMethod dummy; | static FftwMethod dummy; | |||
return instance_ok () ? instance->do_method (_meth) : dummy; | return instance_ok () ? instance->do_method (_meth) : dummy; | |||
} | } | |||
#if defined (HAVE_FFTW3F_THREADS) | ||||
static void threads (int _nthreads) | ||||
{ | ||||
if (instance_ok () && _nthreads != threads ()) | ||||
{ | ||||
instance->nthreads = _nthreads; | ||||
fftw_plan_with_nthreads (_nthreads); | ||||
//Clear the current plans | ||||
instance->rplan = instance->plan[0] = instance->plan[1] = 0; | ||||
} | ||||
} | ||||
static int threads () | ||||
{ | ||||
return instance_ok () ? instance->nthreads : 0; | ||||
} | ||||
#endif | ||||
private: | private: | |||
// No copying! | // No copying! | |||
octave_fftw_planner (const octave_fftw_planner&); | octave_fftw_planner (const octave_fftw_planner&); | |||
octave_fftw_planner& operator = (const octave_fftw_planner&); | octave_fftw_planner& operator = (const octave_fftw_planner&); | |||
static octave_fftw_planner *instance; | static octave_fftw_planner *instance; | |||
skipping to change at line 130 | skipping to change at line 149 | |||
do_create_plan (const int rank, const dim_vector dims, | do_create_plan (const int rank, const dim_vector dims, | |||
octave_idx_type howmany, octave_idx_type stride, | octave_idx_type howmany, octave_idx_type stride, | |||
octave_idx_type dist, const double *in, Complex *out); | octave_idx_type dist, const double *in, Complex *out); | |||
FftwMethod do_method (void); | FftwMethod do_method (void); | |||
FftwMethod do_method (FftwMethod _meth); | FftwMethod do_method (FftwMethod _meth); | |||
FftwMethod meth; | FftwMethod meth; | |||
// FIXME -- perhaps this should be split into two classes? | // FIXME: perhaps this should be split into two classes? | |||
// Plan for fft and ifft of complex values | // Plan for fft and ifft of complex values | |||
fftw_plan plan[2]; | fftw_plan plan[2]; | |||
// dist | // dist | |||
octave_idx_type d[2]; | octave_idx_type d[2]; | |||
// stride | // stride | |||
octave_idx_type s[2]; | octave_idx_type s[2]; | |||
skipping to change at line 172 | skipping to change at line 191 | |||
// rank | // rank | |||
int rr; | int rr; | |||
// howmany | // howmany | |||
octave_idx_type rh; | octave_idx_type rh; | |||
// dims | // dims | |||
dim_vector rn; | dim_vector rn; | |||
bool rsimd_align; | bool rsimd_align; | |||
#if defined (HAVE_FFTW3_THREADS) | ||||
//number of threads when compiled with Multi-threading support | ||||
int nthreads; | ||||
#endif | ||||
}; | }; | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
octave_float_fftw_planner | octave_float_fftw_planner | |||
{ | { | |||
protected: | protected: | |||
octave_float_fftw_planner (void); | octave_float_fftw_planner (void); | |||
skipping to change at line 207 | skipping to change at line 231 | |||
static fftwf_plan | static fftwf_plan | |||
create_plan (int dir, const int rank, const dim_vector dims, | create_plan (int dir, const int rank, const dim_vector dims, | |||
octave_idx_type howmany, octave_idx_type stride, | octave_idx_type howmany, octave_idx_type stride, | |||
octave_idx_type dist, const FloatComplex *in, | octave_idx_type dist, const FloatComplex *in, | |||
FloatComplex *out) | FloatComplex *out) | |||
{ | { | |||
static fftwf_plan dummy; | static fftwf_plan dummy; | |||
return instance_ok () | return instance_ok () | |||
? instance->do_create_plan (dir, rank, dims, howmany, stride, | ? instance->do_create_plan (dir, rank, dims, howmany, stride, | |||
dist, in, out) | dist, in, out) | |||
: dummy; | : dummy; | |||
} | } | |||
static fftwf_plan | static fftwf_plan | |||
create_plan (const int rank, const dim_vector dims, | create_plan (const int rank, const dim_vector dims, | |||
octave_idx_type howmany, octave_idx_type stride, | octave_idx_type howmany, octave_idx_type stride, | |||
octave_idx_type dist, const float *in, FloatComplex *out) | octave_idx_type dist, const float *in, FloatComplex *out) | |||
{ | { | |||
static fftwf_plan dummy; | static fftwf_plan dummy; | |||
return instance_ok () | return instance_ok () | |||
? instance->do_create_plan (rank, dims, howmany, stride, dist, in, ou | ? instance->do_create_plan (rank, dims, howmany, stride, dist, | |||
t) | in, out) | |||
: dummy; | : dummy; | |||
} | } | |||
static FftwMethod method (void) | static FftwMethod method (void) | |||
{ | { | |||
static FftwMethod dummy; | static FftwMethod dummy; | |||
return instance_ok () ? instance->do_method () : dummy; | return instance_ok () ? instance->do_method () : dummy; | |||
} | } | |||
static FftwMethod method (FftwMethod _meth) | static FftwMethod method (FftwMethod _meth) | |||
{ | { | |||
static FftwMethod dummy; | static FftwMethod dummy; | |||
return instance_ok () ? instance->do_method (_meth) : dummy; | return instance_ok () ? instance->do_method (_meth) : dummy; | |||
} | } | |||
#if defined (HAVE_FFTW3F_THREADS) | ||||
static void threads (int _nthreads) | ||||
{ | ||||
if (instance_ok () && _nthreads != threads ()) | ||||
{ | ||||
instance->nthreads = _nthreads; | ||||
fftwf_plan_with_nthreads (_nthreads); | ||||
//Clear the current plans | ||||
instance->rplan = instance->plan[0] = instance->plan[1] = 0; | ||||
} | ||||
} | ||||
static int threads () | ||||
{ | ||||
return instance_ok () ? instance->nthreads : 0; | ||||
} | ||||
#endif | ||||
private: | private: | |||
// No copying! | // No copying! | |||
octave_float_fftw_planner (const octave_float_fftw_planner&); | octave_float_fftw_planner (const octave_float_fftw_planner&); | |||
octave_float_fftw_planner& operator = (const octave_float_fftw_planner&); | octave_float_fftw_planner& operator = (const octave_float_fftw_planner&); | |||
static octave_float_fftw_planner *instance; | static octave_float_fftw_planner *instance; | |||
skipping to change at line 267 | skipping to change at line 310 | |||
do_create_plan (const int rank, const dim_vector dims, | do_create_plan (const int rank, const dim_vector dims, | |||
octave_idx_type howmany, octave_idx_type stride, | octave_idx_type howmany, octave_idx_type stride, | |||
octave_idx_type dist, const float *in, FloatComplex *out) ; | octave_idx_type dist, const float *in, FloatComplex *out) ; | |||
FftwMethod do_method (void); | FftwMethod do_method (void); | |||
FftwMethod do_method (FftwMethod _meth); | FftwMethod do_method (FftwMethod _meth); | |||
FftwMethod meth; | FftwMethod meth; | |||
// FIXME -- perhaps this should be split into two classes? | // FIXME: perhaps this should be split into two classes? | |||
// Plan for fft and ifft of complex values | // Plan for fft and ifft of complex values | |||
fftwf_plan plan[2]; | fftwf_plan plan[2]; | |||
// dist | // dist | |||
octave_idx_type d[2]; | octave_idx_type d[2]; | |||
// stride | // stride | |||
octave_idx_type s[2]; | octave_idx_type s[2]; | |||
skipping to change at line 309 | skipping to change at line 352 | |||
// rank | // rank | |||
int rr; | int rr; | |||
// howmany | // howmany | |||
octave_idx_type rh; | octave_idx_type rh; | |||
// dims | // dims | |||
dim_vector rn; | dim_vector rn; | |||
bool rsimd_align; | bool rsimd_align; | |||
#if defined (HAVE_FFTW3F_THREADS) | ||||
//number of threads when compiled with Multi-threading support | ||||
int nthreads; | ||||
#endif | ||||
}; | }; | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
octave_fftw | octave_fftw | |||
{ | { | |||
public: | public: | |||
static int fft (const double *in, Complex *out, size_t npts, | static int fft (const double *in, Complex *out, size_t npts, | |||
size_t nsamples = 1, octave_idx_type stride = 1, octave_i | size_t nsamples = 1, octave_idx_type stride = 1, | |||
dx_type dist = -1); | octave_idx_type dist = -1); | |||
static int fft (const Complex *in, Complex *out, size_t npts, | static int fft (const Complex *in, Complex *out, size_t npts, | |||
size_t nsamples = 1, octave_idx_type stride = 1, octave_i | size_t nsamples = 1, octave_idx_type stride = 1, | |||
dx_type dist = -1); | octave_idx_type dist = -1); | |||
static int ifft (const Complex *in, Complex *out, size_t npts, | static int ifft (const Complex *in, Complex *out, size_t npts, | |||
size_t nsamples = 1, octave_idx_type stride = 1, octave_ | size_t nsamples = 1, octave_idx_type stride = 1, | |||
idx_type dist = -1); | octave_idx_type dist = -1); | |||
static int fftNd (const double*, Complex*, const int, const dim_vector &) ; | static int fftNd (const double*, Complex*, const int, const dim_vector &) ; | |||
static int fftNd (const Complex*, Complex*, const int, | static int fftNd (const Complex*, Complex*, const int, | |||
const dim_vector &); | const dim_vector &); | |||
static int ifftNd (const Complex*, Complex*, const int, | static int ifftNd (const Complex*, Complex*, const int, | |||
const dim_vector &); | const dim_vector &); | |||
static int fft (const float *in, FloatComplex *out, size_t npts, | static int fft (const float *in, FloatComplex *out, size_t npts, | |||
size_t nsamples = 1, octave_idx_type stride = 1, octave_i | size_t nsamples = 1, octave_idx_type stride = 1, | |||
dx_type dist = -1); | octave_idx_type dist = -1); | |||
static int fft (const FloatComplex *in, FloatComplex *out, size_t npts, | static int fft (const FloatComplex *in, FloatComplex *out, size_t npts, | |||
size_t nsamples = 1, octave_idx_type stride = 1, octave_i | size_t nsamples = 1, octave_idx_type stride = 1, | |||
dx_type dist = -1); | octave_idx_type dist = -1); | |||
static int ifft (const FloatComplex *in, FloatComplex *out, size_t npts, | static int ifft (const FloatComplex *in, FloatComplex *out, size_t npts, | |||
size_t nsamples = 1, octave_idx_type stride = 1, octave_ | size_t nsamples = 1, octave_idx_type stride = 1, | |||
idx_type dist = -1); | octave_idx_type dist = -1); | |||
static int fftNd (const float*, FloatComplex*, const int, const dim_vecto r &); | static int fftNd (const float*, FloatComplex*, const int, const dim_vecto r &); | |||
static int fftNd (const FloatComplex*, FloatComplex*, const int, | static int fftNd (const FloatComplex*, FloatComplex*, const int, | |||
const dim_vector &); | const dim_vector &); | |||
static int ifftNd (const FloatComplex*, FloatComplex*, const int, | static int ifftNd (const FloatComplex*, FloatComplex*, const int, | |||
const dim_vector &); | const dim_vector &); | |||
private: | private: | |||
octave_fftw (void); | octave_fftw (void); | |||
octave_fftw (const octave_fftw&); | octave_fftw (const octave_fftw&); | |||
End of changes. 17 change blocks. | ||||
27 lines changed or deleted | 73 lines changed or added | |||
oct-fstrm.h | oct-fstrm.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_octave_fstream_h) | #if !defined (octave_oct_fstrm_h) | |||
#define octave_octave_fstream_h 1 | #define octave_oct_fstrm_h 1 | |||
#include <fstream> | #include <fstream> | |||
#include <string> | #include <string> | |||
#include "oct-stream.h" | #include "oct-stream.h" | |||
class | class | |||
octave_fstream : public octave_base_stream | octave_fstream : public octave_base_stream | |||
{ | { | |||
public: | public: | |||
skipping to change at line 49 | skipping to change at line 49 | |||
= oct_mach_info::native_float_format ()); | = oct_mach_info::native_float_format ()); | |||
static octave_stream | static octave_stream | |||
create (const std::string& nm_arg, | create (const std::string& nm_arg, | |||
std::ios::openmode arg_md = std::ios::in|std::ios::out, | std::ios::openmode arg_md = std::ios::in|std::ios::out, | |||
oct_mach_info::float_format flt_fmt | oct_mach_info::float_format flt_fmt | |||
= oct_mach_info::native_float_format ()); | = oct_mach_info::native_float_format ()); | |||
// Position a stream at OFFSET relative to ORIGIN. | // Position a stream at OFFSET relative to ORIGIN. | |||
int seek (long offset, int origin); | int seek (off_t offset, int origin); | |||
// Return current stream position. | // Return current stream position. | |||
long tell (void); | off_t tell (void); | |||
// Return non-zero if EOF has been reached on this stream. | // Return non-zero if EOF has been reached on this stream. | |||
bool eof (void) const; | bool eof (void) const; | |||
void do_close (void); | void do_close (void); | |||
// The name of the file. | // The name of the file. | |||
std::string name (void) const { return nm; } | std::string name (void) const { return nm; } | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
oct-glob.h | oct-glob.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2010-2012 John W. Eaton | Copyright (C) 2010-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_glob_h) | #if !defined (octave_oct_glob_h) | |||
#define octave_glob_h 1 | #define octave_oct_glob_h 1 | |||
#include "str-vec.h" | #include "str-vec.h" | |||
extern bool | extern bool | |||
octave_fnmatch (const string_vector& pat, const std::string& str, | octave_fnmatch (const string_vector& pat, const std::string& str, | |||
int fnmatch_flags); | int fnmatch_flags); | |||
extern string_vector | extern string_vector | |||
octave_glob (const string_vector&); | octave_glob (const string_vector&); | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
oct-gperf.h | oct-gperf.h | |||
---|---|---|---|---|
/* C++ code produced by gperf version 3.0.3 */ | /* C++ code produced by gperf version 3.0.4 */ | |||
/* Command-line: gperf -t -C -D -G -L C++ -Z octave_kw_hash octave.gperf * | /* Command-line: gperf -t -C -D -G -L C++ -Z octave_kw_hash ../../libinterp | |||
/ | /parse-tree/octave.gperf */ | |||
/* Computed positions: -k'1,5' */ | /* Computed positions: -k'1,5' */ | |||
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | |||
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | |||
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | |||
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | |||
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | |||
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | |||
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | |||
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | |||
skipping to change at line 32 | skipping to change at line 32 | |||
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | |||
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | |||
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | |||
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | |||
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | |||
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | |||
/* The character set is not based on ISO-646. */ | /* The character set is not based on ISO-646. */ | |||
#error "gperf generated tables don't work with this execution character set . Please report a bug to <bug-gnu-gperf@gnu.org>." | #error "gperf generated tables don't work with this execution character set . Please report a bug to <bug-gnu-gperf@gnu.org>." | |||
#endif | #endif | |||
#line 1 "octave.gperf" | #line 1 "../../libinterp/parse-tree/octave.gperf" | |||
/* | /* | |||
Copyright (C) 1995-2012 John W. Eaton | Copyright (C) 1995-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at | Free Software Foundation; either version 3 of the License, or (at | |||
your option) any later version. | your option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 95 | skipping to change at line 95 | |||
for_kw, | for_kw, | |||
function_kw, | function_kw, | |||
get_kw, | get_kw, | |||
global_kw, | global_kw, | |||
if_kw, | if_kw, | |||
magic_file_kw, | magic_file_kw, | |||
magic_line_kw, | magic_line_kw, | |||
methods_kw, | methods_kw, | |||
otherwise_kw, | otherwise_kw, | |||
parfor_kw, | parfor_kw, | |||
persistent_kw, | ||||
properties_kw, | properties_kw, | |||
return_kw, | return_kw, | |||
set_kw, | set_kw, | |||
static_kw, | static_kw, | |||
switch_kw, | switch_kw, | |||
try_kw, | try_kw, | |||
until_kw, | until_kw, | |||
unwind_protect_kw, | unwind_protect_kw, | |||
unwind_protect_cleanup_kw, | unwind_protect_cleanup_kw, | |||
while_kw | while_kw | |||
}; | }; | |||
#line 75 "octave.gperf" | #line 76 "../../libinterp/parse-tree/octave.gperf" | |||
struct octave_kw { const char *name; int tok; octave_kw_id kw_id; }; | struct octave_kw { const char *name; int tok; octave_kw_id kw_id; }; | |||
#define TOTAL_KEYWORDS 45 | #define TOTAL_KEYWORDS 45 | |||
#define MIN_WORD_LENGTH 2 | #define MIN_WORD_LENGTH 2 | |||
#define MAX_WORD_LENGTH 22 | #define MAX_WORD_LENGTH 22 | |||
#define MIN_HASH_VALUE 2 | #define MIN_HASH_VALUE 2 | |||
#define MAX_HASH_VALUE 73 | #define MAX_HASH_VALUE 73 | |||
/* maximum key range = 72, duplicates = 0 */ | /* maximum key range = 72, duplicates = 0 */ | |||
class octave_kw_hash | class octave_kw_hash | |||
skipping to change at line 175 | skipping to change at line 176 | |||
case 2: | case 2: | |||
case 1: | case 1: | |||
hval += asso_values[(unsigned char)str[0]]; | hval += asso_values[(unsigned char)str[0]]; | |||
break; | break; | |||
} | } | |||
return hval; | return hval; | |||
} | } | |||
static const struct octave_kw wordlist[] = | static const struct octave_kw wordlist[] = | |||
{ | { | |||
#line 82 "octave.gperf" | #line 83 "../../libinterp/parse-tree/octave.gperf" | |||
{"do", DO, do_kw}, | {"do", DO, do_kw}, | |||
#line 85 "octave.gperf" | #line 86 "../../libinterp/parse-tree/octave.gperf" | |||
{"end", END, end_kw}, | {"end", END, end_kw}, | |||
#line 83 "octave.gperf" | #line 84 "../../libinterp/parse-tree/octave.gperf" | |||
{"else", ELSE, else_kw}, | {"else", ELSE, else_kw}, | |||
#line 77 "octave.gperf" | #line 78 "../../libinterp/parse-tree/octave.gperf" | |||
{"break", BREAK, break_kw}, | {"break", BREAK, break_kw}, | |||
#line 111 "octave.gperf" | #line 112 "../../libinterp/parse-tree/octave.gperf" | |||
{"return", FUNC_RET, return_kw}, | {"return", FUNC_RET, return_kw}, | |||
#line 103 "octave.gperf" | #line 104 "../../libinterp/parse-tree/octave.gperf" | |||
{"get", GET, get_kw}, | {"get", GET, get_kw}, | |||
#line 78 "octave.gperf" | #line 79 "../../libinterp/parse-tree/octave.gperf" | |||
{"case", CASE, case_kw}, | {"case", CASE, case_kw}, | |||
#line 94 "octave.gperf" | #line 95 "../../libinterp/parse-tree/octave.gperf" | |||
{"endmethods", END, endmethods_kw}, | {"endmethods", END, endmethods_kw}, | |||
#line 99 "octave.gperf" | #line 100 "../../libinterp/parse-tree/octave.gperf" | |||
{"enumeration", ENUMERATION, enumeration_kw}, | {"enumeration", ENUMERATION, enumeration_kw}, | |||
#line 105 "octave.gperf" | #line 106 "../../libinterp/parse-tree/octave.gperf" | |||
{"if", IF, if_kw}, | {"if", IF, if_kw}, | |||
#line 96 "octave.gperf" | #line 97 "../../libinterp/parse-tree/octave.gperf" | |||
{"endproperties", END, endproperties_kw}, | {"endproperties", END, endproperties_kw}, | |||
#line 89 "octave.gperf" | #line 90 "../../libinterp/parse-tree/octave.gperf" | |||
{"endenumeration", END, endenumeration_kw}, | {"endenumeration", END, endenumeration_kw}, | |||
#line 110 "octave.gperf" | #line 111 "../../libinterp/parse-tree/octave.gperf" | |||
{"properties", PROPERTIES, properties_kw}, | {"properties", PROPERTIES, properties_kw}, | |||
#line 84 "octave.gperf" | #line 85 "../../libinterp/parse-tree/octave.gperf" | |||
{"elseif", ELSEIF, elseif_kw}, | {"elseif", ELSEIF, elseif_kw}, | |||
#line 112 "octave.gperf" | #line 113 "../../libinterp/parse-tree/octave.gperf" | |||
{"set", SET, set_kw}, | {"set", SET, set_kw}, | |||
#line 90 "octave.gperf" | #line 91 "../../libinterp/parse-tree/octave.gperf" | |||
{"endevents", END, endevents_kw}, | {"endevents", END, endevents_kw}, | |||
#line 119 "octave.gperf" | #line 120 "../../libinterp/parse-tree/octave.gperf" | |||
{"while", WHILE, while_kw}, | {"while", WHILE, while_kw}, | |||
#line 88 "octave.gperf" | #line 89 "../../libinterp/parse-tree/octave.gperf" | |||
{"endclassdef", END, endclassdef_kw }, | {"endclassdef", END, endclassdef_kw }, | |||
#line 81 "octave.gperf" | #line 82 "../../libinterp/parse-tree/octave.gperf" | |||
{"continue", CONTINUE, continue_kw}, | {"continue", CONTINUE, continue_kw}, | |||
#line 97 "octave.gperf" | #line 98 "../../libinterp/parse-tree/octave.gperf" | |||
{"endswitch", END, endswitch_kw}, | {"endswitch", END, endswitch_kw}, | |||
#line 109 "octave.gperf" | #line 110 "../../libinterp/parse-tree/octave.gperf" | |||
{"persistent", STATIC, static_kw}, | {"persistent", PERSISTENT, persistent_kw}, | |||
#line 114 "octave.gperf" | #line 115 "../../libinterp/parse-tree/octave.gperf" | |||
{"switch", SWITCH, switch_kw}, | {"switch", SWITCH, switch_kw}, | |||
#line 80 "octave.gperf" | #line 81 "../../libinterp/parse-tree/octave.gperf" | |||
{"classdef", CLASSDEF, classdef_kw}, | {"classdef", CLASSDEF, classdef_kw}, | |||
#line 113 "octave.gperf" | #line 114 "../../libinterp/parse-tree/octave.gperf" | |||
{"static", STATIC, static_kw}, | {"static", PERSISTENT, static_kw}, | |||
#line 115 "octave.gperf" | #line 116 "../../libinterp/parse-tree/octave.gperf" | |||
{"try", TRY, try_kw}, | {"try", TRY, try_kw}, | |||
#line 100 "octave.gperf" | #line 101 "../../libinterp/parse-tree/octave.gperf" | |||
{"events", EVENTS, events_kw}, | {"events", EVENTS, events_kw}, | |||
#line 101 "octave.gperf" | #line 102 "../../libinterp/parse-tree/octave.gperf" | |||
{"for", FOR, for_kw}, | {"for", FOR, for_kw}, | |||
#line 93 "octave.gperf" | #line 94 "../../libinterp/parse-tree/octave.gperf" | |||
{"endif", END, endif_kw}, | {"endif", END, endif_kw}, | |||
#line 91 "octave.gperf" | #line 92 "../../libinterp/parse-tree/octave.gperf" | |||
{"endfor", END, endfor_kw}, | {"endfor", END, endfor_kw}, | |||
#line 106 "octave.gperf" | #line 107 "../../libinterp/parse-tree/octave.gperf" | |||
{"methods", METHODS, methods_kw}, | {"methods", METHODS, methods_kw}, | |||
#line 86 "octave.gperf" | #line 87 "../../libinterp/parse-tree/octave.gperf" | |||
{"end_try_catch", END, end_try_catch_kw}, | {"end_try_catch", END, end_try_catch_kw}, | |||
#line 107 "octave.gperf" | #line 108 "../../libinterp/parse-tree/octave.gperf" | |||
{"otherwise", OTHERWISE, otherwise_kw}, | {"otherwise", OTHERWISE, otherwise_kw}, | |||
#line 108 "octave.gperf" | #line 109 "../../libinterp/parse-tree/octave.gperf" | |||
{"parfor", PARFOR, parfor_kw}, | {"parfor", PARFOR, parfor_kw}, | |||
#line 98 "octave.gperf" | #line 99 "../../libinterp/parse-tree/octave.gperf" | |||
{"endwhile", END, endwhile_kw}, | {"endwhile", END, endwhile_kw}, | |||
#line 79 "octave.gperf" | #line 80 "../../libinterp/parse-tree/octave.gperf" | |||
{"catch", CATCH, catch_kw}, | {"catch", CATCH, catch_kw}, | |||
#line 92 "octave.gperf" | #line 93 "../../libinterp/parse-tree/octave.gperf" | |||
{"endfunction", END, endfunction_kw}, | {"endfunction", END, endfunction_kw}, | |||
#line 121 "octave.gperf" | #line 122 "../../libinterp/parse-tree/octave.gperf" | |||
{"__LINE__", NUM, magic_line_kw}, | {"__LINE__", NUM, magic_line_kw}, | |||
#line 117 "octave.gperf" | #line 118 "../../libinterp/parse-tree/octave.gperf" | |||
{"unwind_protect", UNWIND, unwind_protect_kw}, | {"unwind_protect", UNWIND, unwind_protect_kw}, | |||
#line 116 "octave.gperf" | #line 117 "../../libinterp/parse-tree/octave.gperf" | |||
{"until", UNTIL, until_kw}, | {"until", UNTIL, until_kw}, | |||
#line 87 "octave.gperf" | #line 88 "../../libinterp/parse-tree/octave.gperf" | |||
{"end_unwind_protect", END, end_unwind_protect_kw}, | {"end_unwind_protect", END, end_unwind_protect_kw}, | |||
#line 95 "octave.gperf" | #line 96 "../../libinterp/parse-tree/octave.gperf" | |||
{"endparfor", END, endparfor_kw}, | {"endparfor", END, endparfor_kw}, | |||
#line 104 "octave.gperf" | #line 105 "../../libinterp/parse-tree/octave.gperf" | |||
{"global", GLOBAL, global_kw}, | {"global", GLOBAL, global_kw}, | |||
#line 118 "octave.gperf" | #line 119 "../../libinterp/parse-tree/octave.gperf" | |||
{"unwind_protect_cleanup", CLEANUP, unwind_protect_cleanup_kw}, | {"unwind_protect_cleanup", CLEANUP, unwind_protect_cleanup_kw}, | |||
#line 120 "octave.gperf" | #line 121 "../../libinterp/parse-tree/octave.gperf" | |||
{"__FILE__", DQ_STRING, magic_file_kw}, | {"__FILE__", DQ_STRING, magic_file_kw}, | |||
#line 102 "octave.gperf" | #line 103 "../../libinterp/parse-tree/octave.gperf" | |||
{"function", FCN, function_kw} | {"function", FCN, function_kw} | |||
}; | }; | |||
static const signed char gperf_lookup[] = | static const signed char gperf_lookup[] = | |||
{ | { | |||
-1, -1, 0, 1, 2, 3, 4, -1, 5, 6, 7, 8, 9, 10, | -1, -1, 0, 1, 2, 3, 4, -1, 5, 6, 7, 8, 9, 10, | |||
11, 12, 13, -1, 14, 15, 16, 17, -1, 18, 19, 20, 21, -1, | 11, 12, 13, -1, 14, 15, 16, 17, -1, 18, 19, 20, 21, -1, | |||
22, -1, -1, 23, -1, 24, -1, -1, 25, -1, 26, -1, 27, 28, | 22, -1, -1, 23, -1, 24, -1, -1, 25, -1, 26, -1, 27, 28, | |||
29, 30, 31, -1, 32, -1, 33, -1, 34, 35, -1, 36, 37, 38, | 29, 30, 31, -1, 32, -1, 33, -1, 34, 35, -1, 36, 37, 38, | |||
-1, -1, 39, 40, -1, 41, 42, 43, -1, -1, -1, -1, -1, -1, | -1, -1, 39, 40, -1, 41, 42, 43, -1, -1, -1, -1, -1, -1, | |||
End of changes. 48 change blocks. | ||||
53 lines changed or deleted | 54 lines changed or added | |||
oct-group.h | oct-group.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_group_h) | #if !defined (octave_oct_group_h) | |||
#define octave_group_h 1 | #define octave_oct_group_h 1 | |||
#include <string> | #include <string> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include "str-vec.h" | #include "str-vec.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
octave_group | octave_group | |||
skipping to change at line 51 | skipping to change at line 51 | |||
octave_group (const octave_group& gr) | octave_group (const octave_group& gr) | |||
: gr_name (gr.gr_name), gr_passwd (gr.gr_passwd), | : gr_name (gr.gr_name), gr_passwd (gr.gr_passwd), | |||
gr_gid (gr.gr_gid), gr_mem (gr.gr_mem), valid (gr.valid) | gr_gid (gr.gr_gid), gr_mem (gr.gr_mem), valid (gr.valid) | |||
{ } | { } | |||
octave_group& operator = (const octave_group& gr) | octave_group& operator = (const octave_group& gr) | |||
{ | { | |||
if (this != &gr) | if (this != &gr) | |||
{ | { | |||
gr_name = gr.gr_name; | gr_name = gr.gr_name; | |||
gr_passwd = gr.gr_passwd; | gr_passwd = gr.gr_passwd; | |||
gr_gid = gr.gr_gid; | gr_gid = gr.gr_gid; | |||
gr_mem = gr.gr_mem; | gr_mem = gr.gr_mem; | |||
valid = gr.valid; | valid = gr.valid; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
std::string name (void) const; | std::string name (void) const; | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
oct-hdf5.h | oct-hdf5.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 John W. Eaton | Copyright (C) 2009-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave__hdf5_h) | #if !defined (octave_oct_hdf5_h) | |||
#define octave_hdf5_h 1 | #define octave_hdf5_h 1 | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
#include <hdf5.h> | #include <hdf5.h> | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
oct-hist.h | oct-hist.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_octave_hist_h) | #if !defined (octave_oct_hist_h) | |||
#define octave_octave_hist_h 1 | #define octave_oct_hist_h 1 | |||
#include <string> | #include <string> | |||
#include "cmd-hist.h" | #include "cmd-hist.h" | |||
extern void initialize_history (bool read_history_file = false); | extern void initialize_history (bool read_history_file = false); | |||
// Write timestamp to history file. | // Write timestamp to history file. | |||
extern void octave_history_write_timestamp (void); | extern void octave_history_write_timestamp (void); | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
oct-inttypes.h | oct-inttypes.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_inttypes_h) | #if !defined (octave_oct_inttypes_h) | |||
#define octave_inttypes_h 1 | #define octave_oct_inttypes_h 1 | |||
#include <climits> | ||||
#include <cstdlib> | #include <cstdlib> | |||
#include <limits> | #include <limits> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "lo-traits.h" | #include "lo-traits.h" | |||
#include "lo-math.h" | #include "lo-math.h" | |||
#include "lo-mappers.h" | #include "lo-mappers.h" | |||
#ifdef OCTAVE_INT_USE_LONG_DOUBLE | #ifdef OCTAVE_INT_USE_LONG_DOUBLE | |||
inline long double xround (long double x) { return roundl (x); } | inline long double xround (long double x) { return roundl (x); } | |||
inline long double xisnan (long double x) { return xisnan (static_cast<doub | inline long double xisnan (long double x) | |||
le> (x)); } | { return xisnan (static_cast<double> (x)); } | |||
#endif | #endif | |||
// FIXME -- we define this by our own because some compilers, such as | // FIXME: we define this by our own because some compilers, such as | |||
// MSVC, do not provide std::abs (int64_t) and std::abs (uint64_t). In | // MSVC, do not provide std::abs (int64_t) and std::abs (uint64_t). In | |||
// the future, it should go away in favor of std::abs. | // the future, it should go away in favor of std::abs. | |||
template <class T> | template <class T> | |||
inline T octave_int_abs (T x) { return x >= 0 ? x : -x; } | inline T octave_int_abs (T x) { return x >= 0 ? x : -x; } | |||
// Query for an integer type of certain sizeof, and signedness. | // Query for an integer type of certain sizeof, and signedness. | |||
template<int qsize, bool qsigned> | template<int qsize, bool qsigned> | |||
struct query_integer_type | struct query_integer_type | |||
{ | { | |||
public: | public: | |||
skipping to change at line 110 | skipping to change at line 110 | |||
// Handles non-homogeneous integer comparisons. Avoids doing useless tests. | // Handles non-homogeneous integer comparisons. Avoids doing useless tests. | |||
class octave_int_cmp_op | class octave_int_cmp_op | |||
{ | { | |||
// This determines a suitable promotion type for T1 when meeting T2 in a | // This determines a suitable promotion type for T1 when meeting T2 in a | |||
// binary relation. If promotion to int or T2 is safe, it is used. Otherw ise, | // binary relation. If promotion to int or T2 is safe, it is used. Otherw ise, | |||
// the signedness of T1 is preserved and it is widened if T2 is wider. | // the signedness of T1 is preserved and it is widened if T2 is wider. | |||
// Notice that if this is applied to both types, they must end up with eq ual | // Notice that if this is applied to both types, they must end up with eq ual | |||
// size. | // size. | |||
template <class T1, class T2> | template <class T1, class T2> | |||
class prom | class prom | |||
{ | { | |||
// Promote to int? | // Promote to int? | |||
static const bool pint = (sizeof (T1) < sizeof (int) | static const bool pint = (sizeof (T1) < sizeof (int) | |||
&& sizeof (T2) < sizeof (int)); | && sizeof (T2) < sizeof (int)); | |||
static const bool t1sig = std::numeric_limits<T1>::is_signed; | static const bool t1sig = std::numeric_limits<T1>::is_signed; | |||
static const bool t2sig = std::numeric_limits<T2>::is_signed; | static const bool t2sig = std::numeric_limits<T2>::is_signed; | |||
static const bool psig = | static const bool psig = | |||
(pint || (sizeof (T2) > sizeof (T1) && t2sig) || t1sig); | (pint || (sizeof (T2) > sizeof (T1) && t2sig) || t1sig); | |||
static const int psize = | static const int psize = | |||
(pint ? sizeof (int) : (sizeof (T2) > sizeof (T1) | (pint ? sizeof (int) : (sizeof (T2) > sizeof (T1) | |||
? sizeof (T2) : sizeof (T1))); | ? sizeof (T2) : sizeof (T1))); | |||
public: | public: | |||
typedef typename query_integer_type<psize, psig>::type type; | typedef typename query_integer_type<psize, psig>::type type; | |||
}; | }; | |||
// Implements comparisons between two types of equal size but | // Implements comparisons between two types of equal size but | |||
// possibly different signedness. | // possibly different signedness. | |||
template<class xop, int size> | template<class xop, int size> | |||
class uiop | class uiop | |||
{ | { | |||
typedef typename query_integer_type<size, false>::type utype; | typedef typename query_integer_type<size, false>::type utype; | |||
typedef typename query_integer_type<size, true>::type stype; | typedef typename query_integer_type<size, true>::type stype; | |||
public: | public: | |||
static bool op (utype x, utype y) | static bool op (utype x, utype y) | |||
{ return xop::op (x, y); } | { return xop::op (x, y); } | |||
static bool op (stype x, stype y) | static bool op (stype x, stype y) | |||
{ return xop::op (x, y); } | { return xop::op (x, y); } | |||
static bool op (stype x, utype y) | static bool op (stype x, utype y) | |||
{ return (x < 0) ? xop::ltval : xop::op (static_cast<utype> (x), y) | { return (x < 0) ? xop::ltval : xop::op (static_cast<utype> (x), y); } | |||
; } | static bool op (utype x, stype y) | |||
static bool op (utype x, stype y) | { return (y < 0) ? xop::gtval : xop::op (x, static_cast<utype> (y)); } | |||
{ return (y < 0) ? xop::gtval : xop::op (x, static_cast<utype> (y)) | }; | |||
; } | ||||
}; | ||||
public: | public: | |||
REGISTER_OCTAVE_CMP_OP (lt, <); | REGISTER_OCTAVE_CMP_OP (lt, <); | |||
REGISTER_OCTAVE_CMP_OP (le, <=); | REGISTER_OCTAVE_CMP_OP (le, <=); | |||
REGISTER_OCTAVE_CMP_OP (gt, >); | REGISTER_OCTAVE_CMP_OP (gt, >); | |||
REGISTER_OCTAVE_CMP_OP (ge, >=); | REGISTER_OCTAVE_CMP_OP (ge, >=); | |||
REGISTER_OCTAVE_CMP_OP (eq, ==); | REGISTER_OCTAVE_CMP_OP (eq, ==); | |||
REGISTER_OCTAVE_CMP_OP (ne, !=); | REGISTER_OCTAVE_CMP_OP (ne, !=); | |||
REGISTER_OCTAVE_CONST_OP (ct, true); | REGISTER_OCTAVE_CONST_OP (ct, true); | |||
REGISTER_OCTAVE_CONST_OP (cf, false); | REGISTER_OCTAVE_CONST_OP (cf, false); | |||
// Universal comparison operation. | // Universal comparison operation. | |||
template<class xop, class T1, class T2> | template<class xop, class T1, class T2> | |||
static bool | static bool | |||
op (T1 x, T2 y) | op (T1 x, T2 y) | |||
{ | { | |||
typedef typename prom<T1, T2>::type PT1; | typedef typename prom<T1, T2>::type PT1; | |||
typedef typename prom<T2, T1>::type PT2; | typedef typename prom<T2, T1>::type PT2; | |||
return uiop<xop, sizeof (PT1)>::op (static_cast<PT1> (x), | return uiop<xop, sizeof (PT1)>::op (static_cast<PT1> (x), | |||
static_cast<PT2> (y)); | static_cast<PT2> (y)); | |||
} | } | |||
public: | public: | |||
// Mixed comparisons | // Mixed comparisons | |||
template <class xop, class T> | template <class xop, class T> | |||
static bool | static bool | |||
mop (T x, double y) | mop (T x, double y) | |||
{ return xop::op (static_cast<double> (x), y); } | { return xop::op (static_cast<double> (x), y); } | |||
template <class xop, class T> | template <class xop, class T> | |||
static bool | static bool | |||
mop (double x, T y) | mop (double x, T y) | |||
{ return xop::op (x, static_cast<double> (y)); } | { return xop::op (x, static_cast<double> (y)); } | |||
// Typecasting to doubles won't work properly for 64-bit integers - they | #ifdef OCTAVE_ENSURE_LONG_DOUBLE_OPERATIONS_ARE_NOT_TRUNCATED | |||
lose precision. | #define DECLARE_EXTERNAL_LONG_DOUBLE_CMP_OPS(T) \ | |||
template <class xop> static OCTAVE_API bool \ | ||||
external_mop (double, T); \ | ||||
template <class xop> static OCTAVE_API bool \ | ||||
external_mop (T, double) | ||||
DECLARE_EXTERNAL_LONG_DOUBLE_CMP_OPS (int64_t); | ||||
DECLARE_EXTERNAL_LONG_DOUBLE_CMP_OPS (uint64_t); | ||||
#endif | ||||
// Typecasting to doubles won't work properly for 64-bit integers -- | ||||
// they lose precision. | ||||
// If we have long doubles, use them... | // If we have long doubles, use them... | |||
#ifdef OCTAVE_INT_USE_LONG_DOUBLE | #ifdef OCTAVE_INT_USE_LONG_DOUBLE | |||
#define DEFINE_LONG_DOUBLE_CMP_OP(T1, T2) \ | #ifdef OCTAVE_ENSURE_LONG_DOUBLE_OPERATIONS_ARE_NOT_TRUNCATED | |||
#define DEFINE_LONG_DOUBLE_CMP_OP(T) \ | ||||
template <class xop> \ | template <class xop> \ | |||
static bool \ | static bool \ | |||
mop (T1 x, T2 y) \ | mop (double x, T y) \ | |||
{ \ | { \ | |||
return xop::op (static_cast<long double> (x), \ | return external_mop<xop> (x, y); \ | |||
static_cast<long double> (y)); \ | } \ | |||
} | template <class xop> \ | |||
static bool \ | ||||
mop (T x, double y) \ | ||||
{ \ | ||||
return external_mop<xop> (x, y); \ | ||||
} | ||||
#else | ||||
#define DEFINE_LONG_DOUBLE_CMP_OP(T) \ | ||||
template <class xop> \ | ||||
static bool \ | ||||
mop (double x, T y) \ | ||||
{ \ | ||||
return xop::op (static_cast<long double> (x), \ | ||||
static_cast<long double> (y)); \ | ||||
} \ | ||||
template <class xop> \ | ||||
static bool \ | ||||
mop (T x, double y) \ | ||||
{ \ | ||||
return xop::op (static_cast<long double> (x), \ | ||||
static_cast<long double> (y)); \ | ||||
} | ||||
#endif | ||||
#else | #else | |||
// ... otherwise, use external handlers | // ... otherwise, use external handlers | |||
// FIXME: We could declare directly the mop methods as external, | // FIXME: We could declare directly the mop methods as external, | |||
// but we can't do this because bugs in gcc (<= 4.3) prevent | // but we can't do this because bugs in gcc (<= 4.3) prevent | |||
// explicit instantiations later in that case. | // explicit instantiations later in that case. | |||
#define DEFINE_LONG_DOUBLE_CMP_OP(T1, T2) \ | #define DEFINE_LONG_DOUBLE_CMP_OP(T) \ | |||
template <class xop> static OCTAVE_API bool \ | template <class xop> static OCTAVE_API bool \ | |||
emulate_mop (T1, T2); \ | emulate_mop (double, T); \ | |||
template <class xop> \ | template <class xop> \ | |||
static bool \ | static bool \ | |||
mop (T1 x, T2 y) \ | mop (double x, T y) \ | |||
{ \ | ||||
return emulate_mop<xop> (x, y); \ | ||||
} \ | ||||
template <class xop> static OCTAVE_API bool \ | ||||
emulate_mop (T, double); \ | ||||
template <class xop> \ | ||||
static bool \ | ||||
mop (T x, double y) \ | ||||
{ \ | { \ | |||
return emulate_mop<xop> (x, y); \ | return emulate_mop<xop> (x, y); \ | |||
} | } | |||
#endif | #endif | |||
DEFINE_LONG_DOUBLE_CMP_OP(double, uint64_t) | DEFINE_LONG_DOUBLE_CMP_OP(int64_t) | |||
DEFINE_LONG_DOUBLE_CMP_OP(double, int64_t) | DEFINE_LONG_DOUBLE_CMP_OP(uint64_t) | |||
DEFINE_LONG_DOUBLE_CMP_OP(int64_t, double) | ||||
DEFINE_LONG_DOUBLE_CMP_OP(uint64_t, double) | ||||
#undef DEFINE_LONG_DOUBLE_CMP_OP | #undef DEFINE_LONG_DOUBLE_CMP_OP | |||
}; | }; | |||
// Base integer class. No data, just conversion methods and exception flags . | // Base integer class. No data, just conversion methods and exception flags . | |||
template <class T> | template <class T> | |||
class octave_int_base | class octave_int_base | |||
{ | { | |||
protected: | public: | |||
static T min_val () { return std::numeric_limits<T>:: min (); } | static T min_val () { return std::numeric_limits<T>:: min (); } | |||
static T max_val () { return std::numeric_limits<T>:: max (); } | static T max_val () { return std::numeric_limits<T>:: max (); } | |||
public: | ||||
// Convert integer value. | // Convert integer value. | |||
template <class S> | template <class S> | |||
static T | static T | |||
truncate_int (const S& value) | truncate_int (const S& value) | |||
{ | { | |||
// An exhaustive test whether the max and/or min check can be omitted | // An exhaustive test whether the max and/or min check can be omitted. | |||
. | static const bool t_is_signed = std::numeric_limits<T>::is_signed; | |||
static const bool t_is_signed = std::numeric_limits<T>::is_signed; | static const bool s_is_signed = std::numeric_limits<S>::is_signed; | |||
static const bool s_is_signed = std::numeric_limits<S>::is_signed; | static const int t_size = sizeof (T), s_size = sizeof (S); | |||
static const int t_size = sizeof (T), s_size = sizeof (S); | static const bool omit_chk_min = | |||
static const bool omit_chk_min = | (! s_is_signed || (t_is_signed && t_size >= s_size)); | |||
(! s_is_signed || (t_is_signed && t_size >= s_size)); | static const bool omit_chk_max = | |||
static const bool omit_chk_max = | (t_size > s_size || (t_size == s_size | |||
(t_size > s_size || (t_size == s_size | && (! t_is_signed || s_is_signed))); | |||
&& (! t_is_signed || s_is_signed))); | // If the check can be omitted, substitute constant false relation. | |||
// If the check can be omitted, substitute constant false relation. | typedef octave_int_cmp_op::cf cf; | |||
typedef octave_int_cmp_op::cf cf; | typedef octave_int_cmp_op::lt lt; | |||
typedef octave_int_cmp_op::lt lt; | typedef octave_int_cmp_op::gt gt; | |||
typedef octave_int_cmp_op::gt gt; | typedef typename if_then_else<omit_chk_min, cf, lt>::result chk_min; | |||
typedef typename if_then_else<omit_chk_min, cf, lt>::result chk_min; | typedef typename if_then_else<omit_chk_max, cf, gt>::result chk_max; | |||
typedef typename if_then_else<omit_chk_max, cf, gt>::result chk_max; | ||||
// Efficiency of the following depends on inlining and dead code | ||||
// Efficiency of the following depends on inlining and dead code | // elimination, but that should be a piece of cake for most compilers. | |||
// elimination, but that should be a piece of cake for most compilers | if (chk_min::op (value, static_cast<S> (min_val ()))) | |||
. | { | |||
if (chk_min::op (value, static_cast<S> (min_val ()))) | return min_val (); | |||
{ | } | |||
return min_val (); | else if (chk_max::op (value, static_cast<S> (max_val ()))) | |||
} | { | |||
else if (chk_max::op (value, static_cast<S> (max_val ()))) | return max_val (); | |||
{ | } | |||
return max_val (); | else | |||
} | return static_cast<T> (value); | |||
else | } | |||
return static_cast<T> (value); | ||||
} | ||||
private: | private: | |||
// Computes a real-valued threshold for a max/min check. | // Computes a real-valued threshold for a max/min check. | |||
template <class S> | template <class S> | |||
static S | static S | |||
compute_threshold (S val, T orig_val) | compute_threshold (S val, T orig_val) | |||
{ | { | |||
val = xround (val); // Fool optimizations (maybe redundant) | val = xround (val); // Fool optimizations (maybe redundant) | |||
// If val is even, but orig_val is odd, we're one unit off. | // If val is even, but orig_val is odd, we're one unit off. | |||
if (orig_val % 2 && val / 2 == xround (val / 2)) | if (orig_val % 2 && val / 2 == xround (val / 2)) | |||
// FIXME -- is this always correct? | // FIXME: is this always correct? | |||
val *= (static_cast<S>(1) - (std::numeric_limits<S>::epsilon () / 2 | val *= (static_cast<S>(1) - (std::numeric_limits<S>::epsilon () / 2)) | |||
)); | ; | |||
return val; | return val; | |||
} | } | |||
public: | public: | |||
// Convert a real number (check NaN and non-int). | // Convert a real number (check NaN and non-int). | |||
template <class S> | template <class S> | |||
static T | static T | |||
convert_real (const S& value) | convert_real (const S& value) | |||
{ | { | |||
// Compute proper thresholds. | // Compute proper thresholds. | |||
static const S thmin = compute_threshold (static_cast<S> (min_val ()) | static const S thmin = compute_threshold (static_cast<S> (min_val ()), | |||
, min_val ()); | min_val ()); | |||
static const S thmax = compute_threshold (static_cast<S> (max_val ()) | static const S thmax = compute_threshold (static_cast<S> (max_val ()), | |||
, max_val ()); | max_val ()); | |||
if (xisnan (value)) | if (xisnan (value)) | |||
{ | { | |||
return static_cast<T> (0); | return static_cast<T> (0); | |||
} | } | |||
else if (value < thmin) | else if (value < thmin) | |||
{ | { | |||
return min_val (); | return min_val (); | |||
} | } | |||
else if (value > thmax) | else if (value > thmax) | |||
{ | { | |||
return max_val (); | return max_val (); | |||
} | } | |||
else | else | |||
{ | { | |||
S rvalue = xround (value); | S rvalue = xround (value); | |||
return static_cast<T> (rvalue); | return static_cast<T> (rvalue); | |||
} | } | |||
} | } | |||
}; | }; | |||
// Saturated (homogeneous) integer arithmetics. The signed and unsigned | // Saturated (homogeneous) integer arithmetics. The signed and unsigned | |||
// implementations are significantly different, so we implement another lay er | // implementations are significantly different, so we implement another lay er | |||
// and completely specialize. Arithmetics inherits from octave_int_base so that | // and completely specialize. Arithmetics inherits from octave_int_base so that | |||
// it can use its exceptions and truncation functions. | // it can use its exceptions and truncation functions. | |||
template <class T, bool is_signed> | template <class T, bool is_signed> | |||
class octave_int_arith_base | class octave_int_arith_base | |||
{ }; | { }; | |||
skipping to change at line 334 | skipping to change at line 375 | |||
// Shifts do not overflow. | // Shifts do not overflow. | |||
static T | static T | |||
rshift (T x, int n) { return x >> n; } | rshift (T x, int n) { return x >> n; } | |||
static T | static T | |||
lshift (T x, int n) { return x << n; } | lshift (T x, int n) { return x << n; } | |||
static T | static T | |||
minus (T) | minus (T) | |||
{ | { | |||
return static_cast<T> (0); | return static_cast<T> (0); | |||
} | } | |||
// the overflow behaviour for unsigned integers is guaranteed by C/C++, | // the overflow behaviour for unsigned integers is guaranteed by C/C++, | |||
// so the following should always work. | // so the following should always work. | |||
static T | static T | |||
add (T x, T y) | add (T x, T y) | |||
{ | { | |||
T u = x + y; | T u = x + y; | |||
if (u < x) | if (u < x) | |||
{ | { | |||
u = octave_int_base<T>::max_val (); | u = octave_int_base<T>::max_val (); | |||
} | } | |||
return u; | return u; | |||
} | } | |||
static T | static T | |||
sub (T x, T y) | sub (T x, T y) | |||
{ | { | |||
T u = x - y; | T u = x - y; | |||
if (u > x) | if (u > x) | |||
{ | { | |||
u = 0; | u = 0; | |||
} | } | |||
return u; | return u; | |||
} | } | |||
// Multiplication is done using promotion to wider integer type. If there is | // Multiplication is done using promotion to wider integer type. If there is | |||
// no suitable promotion type, this operation *MUST* be specialized. | // no suitable promotion type, this operation *MUST* be specialized. | |||
static T mul (T x, T y) { return mul_internal (x, y); } | ||||
static T | static T | |||
mul (T x, T y) | mul_internal (T x, T y) | |||
{ | { | |||
// Promotion type for multiplication (if exists). | // Promotion type for multiplication (if exists). | |||
typedef typename query_integer_type<2*sizeof (T), false>::type mptype | typedef typename query_integer_type<2*sizeof (T), false>::type mptype; | |||
; | return octave_int_base<T>::truncate_int (static_cast<mptype> (x) | |||
return octave_int_base<T>::truncate_int (static_cast<mptype> (x) | * static_cast<mptype> (y)); | |||
* static_cast<mptype> (y)); | } | |||
} | ||||
// Division with rounding to nearest. Note that / and % are probably | // Division with rounding to nearest. Note that / and % are probably | |||
// computed by a single instruction. | // computed by a single instruction. | |||
static T | static T | |||
div (T x, T y) | div (T x, T y) | |||
{ | { | |||
if (y != 0) | if (y != 0) | |||
{ | { | |||
T z = x / y, w = x % y; | T z = x / y, w = x % y; | |||
if (w >= y-w) z += 1; | if (w >= y-w) z += 1; | |||
return z; | return z; | |||
} | } | |||
else | else | |||
{ | { | |||
return x ? octave_int_base<T>::max_val () : 0; | return x ? octave_int_base<T>::max_val () : 0; | |||
} | } | |||
} | } | |||
// Remainder. | // Remainder. | |||
static T | static T | |||
rem (T x, T y) | rem (T x, T y) | |||
{ | { | |||
return y != 0 ? x % y : 0; | return y != 0 ? x % y : 0; | |||
} | } | |||
// Modulus. Note the weird y = 0 case for Matlab compatibility. | // Modulus. Note the weird y = 0 case for Matlab compatibility. | |||
static T | static T | |||
mod (T x, T y) | mod (T x, T y) | |||
{ | { | |||
return y != 0 ? x % y : x; | return y != 0 ? x % y : x; | |||
} | } | |||
}; | }; | |||
#ifdef OCTAVE_INT_USE_LONG_DOUBLE | #ifdef OCTAVE_INT_USE_LONG_DOUBLE | |||
// Handle 64-bit multiply using long double | // Handle 64-bit multiply using long double | |||
#ifdef OCTAVE_ENSURE_LONG_DOUBLE_OPERATIONS_ARE_NOT_TRUNCATED | ||||
extern OCTAVE_API uint64_t | ||||
octave_external_uint64_uint64_mul (uint64_t, uint64_t); | ||||
#endif | ||||
template <> | template <> | |||
inline uint64_t | inline uint64_t | |||
octave_int_arith_base<uint64_t, false>:: mul (uint64_t x, uint64_t y) | octave_int_arith_base<uint64_t, false>::mul_internal (uint64_t x, uint64_t y) | |||
{ | { | |||
uint64_t retval; | ||||
long double p = static_cast<long double> (x) * static_cast<long double> ( y); | long double p = static_cast<long double> (x) * static_cast<long double> ( y); | |||
if (p > static_cast<long double> (octave_int_base<uint64_t>::max_val ())) | if (p > static_cast<long double> (octave_int_base<uint64_t>::max_val ())) | |||
{ | retval = octave_int_base<uint64_t>::max_val (); | |||
return octave_int_base<uint64_t>::max_val (); | ||||
} | ||||
else | else | |||
return static_cast<uint64_t> (p); | retval = static_cast<uint64_t> (p); | |||
return retval; | ||||
} | } | |||
template <> | ||||
inline uint64_t | ||||
octave_int_arith_base<uint64_t, false>::mul (uint64_t x, uint64_t y) | ||||
{ | ||||
#ifdef OCTAVE_ENSURE_LONG_DOUBLE_OPERATIONS_ARE_NOT_TRUNCATED | ||||
return octave_external_uint64_uint64_mul (x, y); | ||||
#else | ||||
return mul_internal (x, y); | ||||
#endif | ||||
} | ||||
#else | #else | |||
// Special handler for 64-bit integer multiply. | // Special handler for 64-bit integer multiply. | |||
template <> | template <> | |||
OCTAVE_API uint64_t | OCTAVE_API uint64_t | |||
octave_int_arith_base<uint64_t, false>::mul (uint64_t, uint64_t); | octave_int_arith_base<uint64_t, false>::mul_internal (uint64_t, uint64_t); | |||
#endif | #endif | |||
// Signed integer arithmetics. | // Signed integer arithmetics. | |||
// Rationale: If HAVE_FAST_INT_OPS is defined, the following conditions | // Rationale: If HAVE_FAST_INT_OPS is defined, the following conditions | |||
// should hold: | // should hold: | |||
// 1. Signed numbers are represented by twos complement | // 1. Signed numbers are represented by twos complement | |||
// (see <http://en.wikipedia.org/wiki/Two%27s_complement>) | // (see <http://en.wikipedia.org/wiki/Two%27s_complement>) | |||
// 2. static_cast to unsigned int counterpart works like interpreting | // 2. static_cast to unsigned int counterpart works like interpreting | |||
// the signed bit pattern as unsigned (and is thus zero-cost). | // the signed bit pattern as unsigned (and is thus zero-cost). | |||
// 3. Signed addition and subtraction yield the same bit results as unsigne d. | // 3. Signed addition and subtraction yield the same bit results as unsigne d. | |||
// (We use casts to prevent optimization interference, so there is no | // (We use casts to prevent optimization interference, so there is no | |||
// need for things like -ftrapv). | // need for things like -ftrapv). | |||
// 4. Bit operations on signed integers work like on unsigned integers, | // 4. Bit operations on signed integers work like on unsigned integers, | |||
// except for the shifts. Shifts are arithmetic. | // except for the shifts. Shifts are arithmetic. | |||
// | // | |||
// The above conditions are satisfied by most modern platforms. If | // The above conditions are satisfied by most modern platforms. If | |||
// HAVE_FAST_INT_OPS is defined, bit tricks and wraparound arithmetics are used | // HAVE_FAST_INT_OPS is defined, bit tricks and wraparound arithmetics are used | |||
// to avoid conditional jumps as much as possible, thus being friendly to m | // to avoid conditional jumps as much as possible, thus being friendly to | |||
odern | // modern pipeline processor architectures. | |||
// pipeline processor architectures. | ||||
// Otherwise, we fall back to a bullet-proof code that only uses assumption s | // Otherwise, we fall back to a bullet-proof code that only uses assumption s | |||
// guaranteed by the standard. | // guaranteed by the standard. | |||
template <class T> | template <class T> | |||
class octave_int_arith_base<T, true> : octave_int_base<T> | class octave_int_arith_base<T, true> : octave_int_base<T> | |||
{ | { | |||
// The corresponding unsigned type. | // The corresponding unsigned type. | |||
typedef typename query_integer_type<sizeof (T), false>::type UT; | typedef typename query_integer_type<sizeof (T), false>::type UT; | |||
public: | public: | |||
// Returns 1 for negative number, 0 otherwise. | // Returns 1 for negative number, 0 otherwise. | |||
static T | static T | |||
__signbit (T x) | __signbit (T x) | |||
{ | { | |||
#ifdef HAVE_FAST_INT_OPS | #ifdef HAVE_FAST_INT_OPS | |||
return static_cast<UT> (x) >> std::numeric_limits<T>::digits; | return static_cast<UT> (x) >> std::numeric_limits<T>::digits; | |||
#else | #else | |||
return (x < 0) ? 1 : 0; | return (x < 0) ? 1 : 0; | |||
#endif | #endif | |||
} | } | |||
static T | static T | |||
abs (T x) | abs (T x) | |||
{ | { | |||
#ifdef HAVE_FAST_INT_OPS | #ifdef HAVE_FAST_INT_OPS | |||
// This is close to how GCC does std::abs, but we can't just use std: | // This is close to how GCC does std::abs, but we can't just use std::a | |||
:abs, | bs, | |||
// because its behaviour for INT_MIN is undefined and the compiler co | // because its behaviour for INT_MIN is undefined and the compiler coul | |||
uld | d | |||
// discard the following test. | // discard the following test. | |||
T m = x >> std::numeric_limits<T>::digits; | T m = x >> std::numeric_limits<T>::digits; | |||
T y = (x ^ m) - m; | T y = (x ^ m) - m; | |||
if (y < 0) | if (y < 0) | |||
{ | { | |||
y = octave_int_base<T>::max_val (); | y = octave_int_base<T>::max_val (); | |||
} | } | |||
return y; | return y; | |||
#else | #else | |||
// -INT_MAX is safe because C++ actually allows only three implementa | // -INT_MAX is safe because C++ actually allows only three implementati | |||
tions | ons | |||
// of integers: sign & magnitude, ones complement and twos complement | // of integers: sign & magnitude, ones complement and twos complement. | |||
. | // The first test will, with modest optimizations, evaluate at compile | |||
// The first test will, with modest optimizations, evaluate at compil | // time, and maybe eliminate the branch completely. | |||
e | T y; | |||
// time, and maybe eliminate the branch completely. | if (octave_int_base<T>::min_val () < -octave_int_base<T>::max_val () | |||
T y; | && x == octave_int_base<T>::min_val ()) | |||
if (octave_int_base<T>::min_val () < -octave_int_base<T>::max_val () | { | |||
&& x == octave_int_base<T>::min_val ()) | y = octave_int_base<T>::max_val (); | |||
{ | } | |||
y = octave_int_base<T>::max_val (); | else | |||
} | y = (x < 0) ? -x : x; | |||
else | return y; | |||
y = (x < 0) ? -x : x; | ||||
return y; | ||||
#endif | #endif | |||
} | } | |||
static T | static T | |||
signum (T x) | signum (T x) | |||
{ | { | |||
// With modest optimizations, this will compile without a jump. | // With modest optimizations, this will compile without a jump. | |||
return ((x > 0) ? 1 : 0) - __signbit (x); | return ((x > 0) ? 1 : 0) - __signbit (x); | |||
} | } | |||
// FIXME -- we do not have an authority what signed shifts should | // FIXME: we do not have an authority what signed shifts should | |||
// exactly do, so we define them the easy way. Note that Matlab does | // exactly do, so we define them the easy way. Note that Matlab does | |||
// not define signed shifts. | // not define signed shifts. | |||
static T | static T | |||
rshift (T x, int n) { return x >> n; } | rshift (T x, int n) { return x >> n; } | |||
static T | static T | |||
lshift (T x, int n) { return x << n; } | lshift (T x, int n) { return x << n; } | |||
// Minus has problems similar to abs. | // Minus has problems similar to abs. | |||
static T | static T | |||
minus (T x) | minus (T x) | |||
{ | { | |||
#ifdef HAVE_FAST_INT_OPS | #ifdef HAVE_FAST_INT_OPS | |||
T y = -x; | T y = -x; | |||
if (y == octave_int_base<T>::min_val ()) | if (y == octave_int_base<T>::min_val ()) | |||
{ | { | |||
--y; | --y; | |||
} | } | |||
return y; | return y; | |||
#else | #else | |||
T y; | T y; | |||
if (octave_int_base<T>::min_val () < -octave_int_base<T>::max_val () | if (octave_int_base<T>::min_val () < -octave_int_base<T>::max_val () | |||
&& x == octave_int_base<T>::min_val ()) | && x == octave_int_base<T>::min_val ()) | |||
{ | { | |||
y = octave_int_base<T>::max_val (); | y = octave_int_base<T>::max_val (); | |||
} | } | |||
else | else | |||
y = -x; | y = -x; | |||
return y; | return y; | |||
#endif | #endif | |||
} | } | |||
static T | static T | |||
add (T x, T y) | add (T x, T y) | |||
{ | { | |||
#ifdef HAVE_FAST_INT_OPS | #ifdef HAVE_FAST_INT_OPS | |||
// The typecasts do nothing, but they are here to prevent an optimizing | // The typecasts do nothing, but they are here to prevent an optimizing | |||
// compiler from interfering. Also, the signed operations on small type s | // compiler from interfering. Also, the signed operations on small type s | |||
// actually return int. | // actually return int. | |||
T u = static_cast<UT> (x) + static_cast<UT> (y); | T u = static_cast<UT> (x) + static_cast<UT> (y); | |||
T ux = u ^ x, uy = u ^ y; | T ux = u ^ x, uy = u ^ y; | |||
if ((ux & uy) < 0) | if ((ux & uy) < 0) | |||
{ | { | |||
u = octave_int_base<T>::max_val () + __signbit (~u); | u = octave_int_base<T>::max_val () + __signbit (~u); | |||
} | } | |||
return u; | return u; | |||
#else | #else | |||
// We shall carefully avoid anything that may overflow. | // We shall carefully avoid anything that may overflow. | |||
T u; | T u; | |||
if (y < 0) | if (y < 0) | |||
{ | { | |||
if (x < octave_int_base<T>::min_val () - y) | if (x < octave_int_base<T>::min_val () - y) | |||
{ | { | |||
u = octave_int_base<T>::min_val (); | u = octave_int_base<T>::min_val (); | |||
} | } | |||
else | else | |||
u = x + y; | u = x + y; | |||
} | } | |||
else | else | |||
{ | { | |||
if (x > octave_int_base<T>::max_val () - y) | if (x > octave_int_base<T>::max_val () - y) | |||
{ | { | |||
u = octave_int_base<T>::max_val (); | u = octave_int_base<T>::max_val (); | |||
} | } | |||
else | else | |||
u = x + y; | u = x + y; | |||
} | } | |||
return u; | return u; | |||
#endif | #endif | |||
} | } | |||
// This is very similar to addition. | // This is very similar to addition. | |||
static T | static T | |||
sub (T x, T y) | sub (T x, T y) | |||
{ | { | |||
#ifdef HAVE_FAST_INT_OPS | #ifdef HAVE_FAST_INT_OPS | |||
// The typecasts do nothing, but they are here to prevent an optimizing | // The typecasts do nothing, but they are here to prevent an optimizing | |||
// compiler from interfering. Also, the signed operations on small type s | // compiler from interfering. Also, the signed operations on small type s | |||
// actually return int. | // actually return int. | |||
T u = static_cast<UT> (x) - static_cast<UT> (y); | T u = static_cast<UT> (x) - static_cast<UT> (y); | |||
T ux = u ^ x, uy = u ^ ~y; | T ux = u ^ x, uy = u ^ ~y; | |||
if ((ux & uy) < 0) | if ((ux & uy) < 0) | |||
{ | { | |||
u = octave_int_base<T>::max_val () + __signbit (~u); | u = octave_int_base<T>::max_val () + __signbit (~u); | |||
} | } | |||
return u; | return u; | |||
#else | #else | |||
// We shall carefully avoid anything that may overflow. | // We shall carefully avoid anything that may overflow. | |||
T u; | T u; | |||
if (y < 0) | if (y < 0) | |||
{ | { | |||
if (x > octave_int_base<T>::max_val () + y) | if (x > octave_int_base<T>::max_val () + y) | |||
{ | { | |||
u = octave_int_base<T>::max_val (); | u = octave_int_base<T>::max_val (); | |||
} | } | |||
else | else | |||
u = x - y; | u = x - y; | |||
} | } | |||
else | else | |||
{ | { | |||
if (x < octave_int_base<T>::min_val () + y) | if (x < octave_int_base<T>::min_val () + y) | |||
{ | { | |||
u = octave_int_base<T>::min_val (); | u = octave_int_base<T>::min_val (); | |||
} | } | |||
else | else | |||
u = x - y; | u = x - y; | |||
} | } | |||
return u; | return u; | |||
#endif | #endif | |||
} | } | |||
// Multiplication is done using promotion to wider integer type. If there is | // Multiplication is done using promotion to wider integer type. If there is | |||
// no suitable promotion type, this operation *MUST* be specialized. | // no suitable promotion type, this operation *MUST* be specialized. | |||
static T mul (T x, T y) { return mul_internal (x, y); } | ||||
static T | static T | |||
mul (T x, T y) | mul_internal (T x, T y) | |||
{ | { | |||
// Promotion type for multiplication (if exists). | // Promotion type for multiplication (if exists). | |||
typedef typename query_integer_type<2*sizeof (T), true>::type mptype; | typedef typename query_integer_type<2*sizeof (T), true>::type mptype; | |||
return octave_int_base<T>::truncate_int (static_cast<mptype> (x) | return octave_int_base<T>::truncate_int (static_cast<mptype> (x) | |||
* static_cast<mptype> (y)); | * static_cast<mptype> (y)); | |||
} | } | |||
// Division. | // Division. | |||
static T | static T | |||
div (T x, T y) | div (T x, T y) | |||
{ | { | |||
T z; | T z; | |||
if (y == 0) | if (y == 0) | |||
{ | { | |||
if (x < 0) | if (x < 0) | |||
z = octave_int_base<T>::min_val (); | z = octave_int_base<T>::min_val (); | |||
else if (x != 0) | else if (x != 0) | |||
z = octave_int_base<T>::max_val (); | ||||
else | ||||
z = 0; | ||||
} | ||||
else if (y < 0) | ||||
{ | ||||
// This is a special case that overflows as well. | ||||
if (y == -1 && x == octave_int_base<T>::min_val ()) | ||||
{ | ||||
z = octave_int_base<T>::max_val (); | z = octave_int_base<T>::max_val (); | |||
else | } | |||
z = 0; | else | |||
} | { | |||
else if (y < 0) | z = x / y; | |||
{ | // Can't overflow, but std::abs (x) can! | |||
// This is a special case that overflows as well. | T w = -octave_int_abs (x % y); | |||
if (y == -1 && x == octave_int_base<T>::min_val ()) | if (w <= y - w) | |||
{ | z -= 1 - (__signbit (x) << 1); | |||
z = octave_int_base<T>::max_val (); | } | |||
} | } | |||
else | else | |||
{ | { | |||
z = x / y; | z = x / y; | |||
T w = -octave_int_abs (x % y); // Can't overflow, but std::ab | // FIXME: this is a workaround due to MSVC's absence of | |||
s (x) can! | // std::abs (int64_t). The call to octave_int_abs can't | |||
if (w <= y - w) | // overflow, but std::abs (x) can! | |||
z -= 1 - (__signbit (x) << 1); | T w = octave_int_abs (x % y); | |||
} | ||||
} | if (w >= y - w) | |||
else | z += 1 - (__signbit (x) << 1); | |||
{ | } | |||
z = x / y; | return z; | |||
// FIXME -- this is a workaround due to MSVC's absence of | } | |||
// std::abs (int64_t). The call to octave_int_abs can't | ||||
// overflow, but std::abs (x) can! | ||||
T w = octave_int_abs (x % y); | ||||
if (w >= y - w) | ||||
z += 1 - (__signbit (x) << 1); | ||||
} | ||||
return z; | ||||
} | ||||
// Remainder. | // Remainder. | |||
static T | static T | |||
rem (T x, T y) | rem (T x, T y) | |||
{ | { | |||
return y != 0 ? x % y : 0; | return y != 0 ? x % y : 0; | |||
} | } | |||
// Modulus. Note the weird y = 0 case for Matlab compatibility. | // Modulus. Note the weird y = 0 case for Matlab compatibility. | |||
static T | static T | |||
mod (T x, T y) | mod (T x, T y) | |||
{ | { | |||
if (y != 0) | if (y != 0) | |||
{ | { | |||
T r = x % y; | T r = x % y; | |||
return ((r < 0) != (y < 0)) ? r + y : r; | return ((r < 0) != (y < 0)) ? r + y : r; | |||
} | } | |||
else | else | |||
return x; | return x; | |||
} | } | |||
}; | }; | |||
#ifdef OCTAVE_INT_USE_LONG_DOUBLE | #ifdef OCTAVE_INT_USE_LONG_DOUBLE | |||
// Handle 64-bit multiply using long double | // Handle 64-bit multiply using long double | |||
#ifdef OCTAVE_ENSURE_LONG_DOUBLE_OPERATIONS_ARE_NOT_TRUNCATED | ||||
extern OCTAVE_API int64_t | ||||
octave_external_int64_int64_mul (int64_t, int64_t); | ||||
#endif | ||||
template <> | template <> | |||
inline int64_t | inline int64_t | |||
octave_int_arith_base<int64_t, true>:: mul (int64_t x, int64_t y) | octave_int_arith_base<int64_t, true>::mul_internal (int64_t x, int64_t y) | |||
{ | { | |||
int64_t retval; | ||||
long double p = static_cast<long double> (x) * static_cast<long double> ( y); | long double p = static_cast<long double> (x) * static_cast<long double> ( y); | |||
// NOTE: We could maybe do it with a single branch if HAVE_FAST_INT_OPS, | ||||
but it | // NOTE: We could maybe do it with a single branch if HAVE_FAST_INT_OPS, | |||
// would require one more runtime conversion, so the question is whether | // but it would require one more runtime conversion, so the question is | |||
it would | // whether it would really be faster. | |||
// really be faster. | ||||
if (p > static_cast<long double> (octave_int_base<int64_t>::max_val ())) | if (p > static_cast<long double> (octave_int_base<int64_t>::max_val ())) | |||
{ | retval = octave_int_base<int64_t>::max_val (); | |||
return octave_int_base<int64_t>::max_val (); | ||||
} | ||||
else if (p < static_cast<long double> (octave_int_base<int64_t>::min_val ())) | else if (p < static_cast<long double> (octave_int_base<int64_t>::min_val ())) | |||
{ | retval = octave_int_base<int64_t>::min_val (); | |||
return octave_int_base<int64_t>::min_val (); | ||||
} | ||||
else | else | |||
return static_cast<int64_t> (p); | retval = static_cast<int64_t> (p); | |||
return retval; | ||||
} | } | |||
template <> | ||||
inline int64_t | ||||
octave_int_arith_base<int64_t, true>::mul (int64_t x, int64_t y) | ||||
{ | ||||
#ifdef OCTAVE_ENSURE_LONG_DOUBLE_OPERATIONS_ARE_NOT_TRUNCATED | ||||
return octave_external_int64_int64_mul (x, y); | ||||
#else | #else | |||
return mul_internal (x, y); | ||||
#endif | ||||
} | ||||
#else | ||||
// Special handler for 64-bit integer multiply. | // Special handler for 64-bit integer multiply. | |||
template <> | template <> | |||
OCTAVE_API int64_t | OCTAVE_API int64_t | |||
octave_int_arith_base<int64_t, true>::mul (int64_t, int64_t); | octave_int_arith_base<int64_t, true>::mul_internal (int64_t, int64_t); | |||
#endif | #endif | |||
// This class simply selects the proper arithmetics. | // This class simply selects the proper arithmetics. | |||
template<class T> | template<class T> | |||
class octave_int_arith | class octave_int_arith | |||
: public octave_int_arith_base<T, std::numeric_limits<T>::is_signed> | : public octave_int_arith_base<T, std::numeric_limits<T>::is_signed> | |||
{}; | { }; | |||
template <class T> | template <class T> | |||
class | class | |||
octave_int : public octave_int_base<T> | octave_int : public octave_int_base<T> | |||
{ | { | |||
public: | public: | |||
typedef T val_type; | typedef T val_type; | |||
octave_int (void) : ival () { } | octave_int (void) : ival () { } | |||
skipping to change at line 787 | skipping to change at line 883 | |||
operator T (void) const { return value (); } | operator T (void) const { return value (); } | |||
// char and bool operators intentionally omitted. | // char and bool operators intentionally omitted. | |||
operator double (void) const { return double_value (); } | operator double (void) const { return double_value (); } | |||
operator float (void) const { return float_value (); } | operator float (void) const { return float_value (); } | |||
octave_int<T> | octave_int<T> | |||
operator + () const | operator + () const | |||
{ return *this; } | { return *this; } | |||
// unary operators & mappers | // unary operators & mappers | |||
#define OCTAVE_INT_UN_OP(OPNAME,NAME) \ | #define OCTAVE_INT_UN_OP(OPNAME,NAME) \ | |||
inline octave_int<T> \ | inline octave_int<T> \ | |||
OPNAME () const \ | OPNAME () const \ | |||
{ return octave_int_arith<T>::NAME (ival); } | { return octave_int_arith<T>::NAME (ival); } | |||
OCTAVE_INT_UN_OP(operator -, minus) | OCTAVE_INT_UN_OP(operator -, minus) | |||
OCTAVE_INT_UN_OP(abs, abs) | OCTAVE_INT_UN_OP(abs, abs) | |||
OCTAVE_INT_UN_OP(signum, signum) | OCTAVE_INT_UN_OP(signum, signum) | |||
skipping to change at line 828 | skipping to change at line 924 | |||
OCTAVE_INT_BIN_OP(<<, lshift, int) | OCTAVE_INT_BIN_OP(<<, lshift, int) | |||
OCTAVE_INT_BIN_OP(>>, rshift, int) | OCTAVE_INT_BIN_OP(>>, rshift, int) | |||
#undef OCTAVE_INT_BIN_OP | #undef OCTAVE_INT_BIN_OP | |||
static octave_int<T> min (void) { return std::numeric_limits<T>::min (); } | static octave_int<T> min (void) { return std::numeric_limits<T>::min (); } | |||
static octave_int<T> max (void) { return std::numeric_limits<T>::max (); } | static octave_int<T> max (void) { return std::numeric_limits<T>::max (); } | |||
static int nbits (void) { return std::numeric_limits<T>::digits; } | static int nbits (void) { return std::numeric_limits<T>::digits; } | |||
static int byte_size (void) { return sizeof(T); } | static int byte_size (void) { return sizeof (T); } | |||
static const char *type_name (); | static const char *type_name (); | |||
// The following are provided for convenience. | // The following are provided for convenience. | |||
static const octave_int zero, one; | static const octave_int zero, one; | |||
// Unsafe. This function exists to support the MEX interface. | // Unsafe. This function exists to support the MEX interface. | |||
// You should not use it anywhere else. | // You should not use it anywhere else. | |||
void *mex_get_data (void) const { return const_cast<T *> (&ival); } | void *mex_get_data (void) const { return const_cast<T *> (&ival); } | |||
skipping to change at line 861 | skipping to change at line 957 | |||
mod (const octave_int<T>& x, const octave_int<T>& y) | mod (const octave_int<T>& x, const octave_int<T>& y) | |||
{ return octave_int_arith<T>::mod (x.value (), y.value ()); } | { return octave_int_arith<T>::mod (x.value (), y.value ()); } | |||
// No mixed integer binary operations! | // No mixed integer binary operations! | |||
template <class T> | template <class T> | |||
inline bool | inline bool | |||
xisnan (const octave_int<T>&) | xisnan (const octave_int<T>&) | |||
{ return false; } | { return false; } | |||
// FIXME -- can/should any of these be inline? | // FIXME: can/should any of these be inline? | |||
template <class T> | template <class T> | |||
extern OCTAVE_API octave_int<T> | extern OCTAVE_API octave_int<T> | |||
pow (const octave_int<T>&, const octave_int<T>&); | pow (const octave_int<T>&, const octave_int<T>&); | |||
template <class T> | template <class T> | |||
extern OCTAVE_API octave_int<T> | extern OCTAVE_API octave_int<T> | |||
pow (const double& a, const octave_int<T>& b); | pow (const double& a, const octave_int<T>& b); | |||
template <class T> | template <class T> | |||
skipping to change at line 968 | skipping to change at line 1064 | |||
typedef octave_int<int8_t> octave_int8; | typedef octave_int<int8_t> octave_int8; | |||
typedef octave_int<int16_t> octave_int16; | typedef octave_int<int16_t> octave_int16; | |||
typedef octave_int<int32_t> octave_int32; | typedef octave_int<int32_t> octave_int32; | |||
typedef octave_int<int64_t> octave_int64; | typedef octave_int<int64_t> octave_int64; | |||
typedef octave_int<uint8_t> octave_uint8; | typedef octave_int<uint8_t> octave_uint8; | |||
typedef octave_int<uint16_t> octave_uint16; | typedef octave_int<uint16_t> octave_uint16; | |||
typedef octave_int<uint32_t> octave_uint32; | typedef octave_int<uint32_t> octave_uint32; | |||
typedef octave_int<uint64_t> octave_uint64; | typedef octave_int<uint64_t> octave_uint64; | |||
#ifdef OCTAVE_ENSURE_LONG_DOUBLE_OPERATIONS_ARE_NOT_TRUNCATED | ||||
#define DECLARE_EXTERNAL_LONG_DOUBLE_OP(T, OP) \ | ||||
extern OCTAVE_API T \ | ||||
external_double_ ## T ## _ ## OP (double x, T y); \ | ||||
extern OCTAVE_API T \ | ||||
external_ ## T ## _double_ ## OP (T x, double y) | ||||
#define DECLARE_EXTERNAL_LONG_DOUBLE_OPS(T) \ | ||||
DECLARE_EXTERNAL_LONG_DOUBLE_OP (T, add); \ | ||||
DECLARE_EXTERNAL_LONG_DOUBLE_OP (T, sub); \ | ||||
DECLARE_EXTERNAL_LONG_DOUBLE_OP (T, mul); \ | ||||
DECLARE_EXTERNAL_LONG_DOUBLE_OP (T, div) | ||||
DECLARE_EXTERNAL_LONG_DOUBLE_OPS (octave_int64); | ||||
DECLARE_EXTERNAL_LONG_DOUBLE_OPS (octave_uint64); | ||||
#endif | ||||
#define OCTAVE_INT_DOUBLE_BIN_OP0(OP) \ | #define OCTAVE_INT_DOUBLE_BIN_OP0(OP) \ | |||
template <class T> \ | template <class T> \ | |||
inline octave_int<T> \ | inline octave_int<T> \ | |||
operator OP (const octave_int<T>& x, const double& y) \ | operator OP (const octave_int<T>& x, const double& y) \ | |||
{ return octave_int<T> (static_cast<double> (x) OP y); } \ | { return octave_int<T> (static_cast<double> (x) OP y); } \ | |||
template <class T> \ | template <class T> \ | |||
inline octave_int<T> \ | inline octave_int<T> \ | |||
operator OP (const double& x, const octave_int<T>& y) \ | operator OP (const double& x, const octave_int<T>& y) \ | |||
{ return octave_int<T> (x OP static_cast<double> (y)); } \ | { return octave_int<T> (x OP static_cast<double> (y)); } \ | |||
#ifdef OCTAVE_INT_USE_LONG_DOUBLE | #ifdef OCTAVE_INT_USE_LONG_DOUBLE | |||
// Handle mixed op using long double | // Handle mixed op using long double | |||
#define OCTAVE_INT_DOUBLE_BIN_OP(OP) \ | #ifdef OCTAVE_ENSURE_LONG_DOUBLE_OPERATIONS_ARE_NOT_TRUNCATED | |||
#define OCTAVE_INT_DOUBLE_BIN_OP(OP, NAME) \ | ||||
OCTAVE_INT_DOUBLE_BIN_OP0(OP) \ | OCTAVE_INT_DOUBLE_BIN_OP0(OP) \ | |||
template <> \ | template <> \ | |||
inline octave_int64 \ | inline octave_int64 \ | |||
operator OP (const double& x, const octave_int64& y) \ | operator OP (const double& x, const octave_int64& y) \ | |||
{ return octave_int64 (x OP static_cast<long double> (y.value ())); } \ | { \ | |||
return external_double_octave_int64_ ## NAME (x, y); \ | ||||
} \ | ||||
template <> \ | template <> \ | |||
inline octave_uint64 \ | inline octave_uint64 \ | |||
operator OP (const double& x, const octave_uint64& y) \ | operator OP (const double& x, const octave_uint64& y) \ | |||
{ return octave_uint64 (x OP static_cast<long double> (y.value ())); } \ | { \ | |||
return external_double_octave_uint64_ ## NAME (x, y); \ | ||||
} \ | ||||
template <> \ | template <> \ | |||
inline octave_int64 \ | inline octave_int64 \ | |||
operator OP (const octave_int64& x, const double& y) \ | operator OP (const octave_int64& x, const double& y) \ | |||
{ return octave_int64 (static_cast<long double> (x.value ()) OP y); } \ | { \ | |||
return external_octave_int64_double_ ## NAME (x, y); \ | ||||
} \ | ||||
template <> \ | template <> \ | |||
inline octave_uint64 \ | inline octave_uint64 \ | |||
operator OP (const octave_uint64& x, const double& y) \ | operator OP (const octave_uint64& x, const double& y) \ | |||
{ return octave_uint64 (static_cast<long double> (x.value ()) OP y); } | { \ | |||
return external_octave_uint64_double_ ## NAME (x, y); \ | ||||
} | ||||
#else | ||||
#define OCTAVE_INT_DOUBLE_BIN_OP(OP, NAME) \ | ||||
OCTAVE_INT_DOUBLE_BIN_OP0(OP) \ | ||||
template <> \ | ||||
inline octave_int64 \ | ||||
operator OP (const double& x, const octave_int64& y) \ | ||||
{ \ | ||||
return octave_int64 (x OP static_cast<long double> (y.value ())); \ | ||||
} \ | ||||
template <> \ | ||||
inline octave_uint64 \ | ||||
operator OP (const double& x, const octave_uint64& y) \ | ||||
{ \ | ||||
return octave_uint64 (x OP static_cast<long double> (y.value ())); \ | ||||
} \ | ||||
template <> \ | ||||
inline octave_int64 \ | ||||
operator OP (const octave_int64& x, const double& y) \ | ||||
{ \ | ||||
return octave_int64 (static_cast<long double> (x.value ()) OP y); \ | ||||
} \ | ||||
template <> \ | ||||
inline octave_uint64 \ | ||||
operator OP (const octave_uint64& x, const double& y) \ | ||||
{ \ | ||||
return octave_uint64 (static_cast<long double> (x.value ()) OP y); \ | ||||
} | ||||
#endif | ||||
#else | #else | |||
// external handlers | // external handlers | |||
#define OCTAVE_INT_DOUBLE_BIN_OP(OP) \ | #define OCTAVE_INT_DOUBLE_BIN_OP(OP, NAME) \ | |||
OCTAVE_INT_DOUBLE_BIN_OP0(OP) \ | OCTAVE_INT_DOUBLE_BIN_OP0(OP) \ | |||
template <> \ | template <> \ | |||
OCTAVE_API octave_int64 \ | OCTAVE_API octave_int64 \ | |||
operator OP (const double&, const octave_int64&); \ | operator OP (const double&, const octave_int64&); \ | |||
template <> \ | template <> \ | |||
OCTAVE_API octave_uint64 \ | OCTAVE_API octave_uint64 \ | |||
operator OP (const double&, const octave_uint64&); \ | operator OP (const double&, const octave_uint64&); \ | |||
template <> \ | template <> \ | |||
OCTAVE_API octave_int64 \ | OCTAVE_API octave_int64 \ | |||
operator OP (const octave_int64&, const double&); \ | operator OP (const octave_int64&, const double&); \ | |||
template <> \ | template <> \ | |||
OCTAVE_API octave_uint64 \ | OCTAVE_API octave_uint64 \ | |||
operator OP (const octave_uint64&, const double&); | operator OP (const octave_uint64&, const double&); | |||
#endif | #endif | |||
OCTAVE_INT_DOUBLE_BIN_OP (+) | OCTAVE_INT_DOUBLE_BIN_OP (+, add) | |||
OCTAVE_INT_DOUBLE_BIN_OP (-) | OCTAVE_INT_DOUBLE_BIN_OP (-, sub) | |||
OCTAVE_INT_DOUBLE_BIN_OP (*) | OCTAVE_INT_DOUBLE_BIN_OP (*, mul) | |||
OCTAVE_INT_DOUBLE_BIN_OP (/) | OCTAVE_INT_DOUBLE_BIN_OP (/, div) | |||
#undef OCTAVE_INT_DOUBLE_BIN_OP0 | #undef OCTAVE_INT_DOUBLE_BIN_OP0 | |||
#undef OCTAVE_INT_DOUBLE_BIN_OP | #undef OCTAVE_INT_DOUBLE_BIN_OP | |||
#undef DECLARE_EXTERNAL_LONG_DOUBLE_OP | ||||
#undef DECLARE_EXTERNAL_LONG_DOUBLE_OPS | ||||
#define OCTAVE_INT_DOUBLE_CMP_OP(OP,NAME) \ | #define OCTAVE_INT_DOUBLE_CMP_OP(OP,NAME) \ | |||
template <class T> \ | template <class T> \ | |||
inline bool \ | inline bool \ | |||
operator OP (const octave_int<T>& x, const double& y) \ | operator OP (const octave_int<T>& x, const double& y) \ | |||
{ return octave_int_cmp_op::mop<octave_int_cmp_op::NAME> (x.value (), y); } \ | { return octave_int_cmp_op::mop<octave_int_cmp_op::NAME> (x.value (), y); } \ | |||
template <class T> \ | template <class T> \ | |||
inline bool \ | inline bool \ | |||
operator OP (const double& x, const octave_int<T>& y) \ | operator OP (const double& x, const octave_int<T>& y) \ | |||
{ return octave_int_cmp_op::mop<octave_int_cmp_op::NAME> (x, y.value ()); } | { return octave_int_cmp_op::mop<octave_int_cmp_op::NAME> (x, y.value ()); } | |||
End of changes. 95 change blocks. | ||||
384 lines changed or deleted | 522 lines changed or added | |||
oct-iostrm.h | oct-iostrm.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_octave_iostream_h) | #if !defined (octave_oct_iostrm_h) | |||
#define octave_octave_iostream_h 1 | #define octave_oct_iostrm_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "oct-stream.h" | #include "oct-stream.h" | |||
class | class | |||
octave_base_iostream : public octave_base_stream | octave_base_iostream : public octave_base_stream | |||
{ | { | |||
public: | public: | |||
octave_base_iostream (const std::string& n = std::string (), | octave_base_iostream (const std::string& n = std::string (), | |||
std::ios::openmode m = std::ios::in|std::ios::out, | std::ios::openmode m = std::ios::in|std::ios::out, | |||
oct_mach_info::float_format ff | oct_mach_info::float_format ff | |||
= oct_mach_info::native_float_format ()) | = oct_mach_info::native_float_format ()) | |||
: octave_base_stream (m, ff), nm (n) { } | : octave_base_stream (m, ff), nm (n) { } | |||
// Position a stream at OFFSET relative to ORIGIN. | // Position a stream at OFFSET relative to ORIGIN. | |||
int seek (long offset, int origin); | int seek (off_t offset, int origin); | |||
// Return current stream position. | // Return current stream position. | |||
long tell (void); | off_t tell (void); | |||
// Return non-zero if EOF has been reached on this stream. | // Return non-zero if EOF has been reached on this stream. | |||
bool eof (void) const; | bool eof (void) const; | |||
// The name of the file. | // The name of the file. | |||
std::string name (void) const { return nm; } | std::string name (void) const { return nm; } | |||
protected: | protected: | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
oct-locbuf.h | oct-locbuf.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_local_buffer_h) | #if !defined (octave_oct_locbuf_h) | |||
#define octave_local_buffer_h 1 | #define octave_oct_locbuf_h 1 | |||
#include <cstddef> | #include <cstddef> | |||
#include "oct-cmplx.h" | #include "oct-cmplx.h" | |||
// The default local buffer simply encapsulates an *array* pointer | // The default local buffer simply encapsulates an *array* pointer | |||
// that gets deleted automatically. For common POD types, we provide | // that gets deleted automatically. For common POD types, we provide | |||
// specializations. | // specializations. | |||
template <class T> | template <class T> | |||
class octave_local_buffer | class octave_local_buffer | |||
{ | { | |||
public: | public: | |||
octave_local_buffer (size_t size) | octave_local_buffer (size_t size) | |||
: data (0) | : data (0) | |||
{ | { | |||
if (size) | if (size) | |||
data = new T[size]; | data = new T [size]; | |||
} | } | |||
~octave_local_buffer (void) { delete [] data; } | ~octave_local_buffer (void) { delete [] data; } | |||
operator T *() const { return data; } | operator T *() const { return data; } | |||
private: | private: | |||
T *data; | T *data; | |||
// No copying! | // No copying! | |||
octave_local_buffer (const octave_local_buffer&); | octave_local_buffer (const octave_local_buffer&); | |||
octave_local_buffer& operator = (const octave_local_buffer&); | octave_local_buffer& operator = (const octave_local_buffer&); | |||
}; | }; | |||
skipping to change at line 146 | skipping to change at line 146 | |||
SPECIALIZE_POD_BUFFER (FloatComplex); | SPECIALIZE_POD_BUFFER (FloatComplex); | |||
// MORE ? | // MORE ? | |||
// All pointers and const pointers are also POD types. | // All pointers and const pointers are also POD types. | |||
template <class T> | template <class T> | |||
class octave_local_buffer<T *> : private octave_chunk_buffer | class octave_local_buffer<T *> : private octave_chunk_buffer | |||
{ | { | |||
public: | public: | |||
octave_local_buffer (size_t size) | octave_local_buffer (size_t size) | |||
: octave_chunk_buffer (size * sizeof (T *)) | : octave_chunk_buffer (size * sizeof (T *)) | |||
{ } | { } | |||
operator T **() const { return reinterpret_cast<T **> (this->data ()); } | operator T **() const { return reinterpret_cast<T **> (this->data ()); } | |||
}; | }; | |||
template <class T> | template <class T> | |||
class octave_local_buffer<const T *> : private octave_chunk_buffer | class octave_local_buffer<const T *> : private octave_chunk_buffer | |||
{ | { | |||
public: | public: | |||
octave_local_buffer (size_t size) | octave_local_buffer (size_t size) | |||
: octave_chunk_buffer (size * sizeof (const T *)) | : octave_chunk_buffer (size * sizeof (const T *)) | |||
{ } | { } | |||
operator const T **() const | operator const T **() const | |||
{ | { | |||
return reinterpret_cast<const T **> (this->data ()); | return reinterpret_cast<const T **> (this->data ()); | |||
} | } | |||
}; | }; | |||
// If the compiler supports dynamic stack arrays, we can use the | // If the compiler supports dynamic stack arrays, we can use the | |||
// attached hack to place small buffer arrays on the stack. It may be | // attached hack to place small buffer arrays on the stack. It may be | |||
// even faster than our obstack-like optimization, but is dangerous | // even faster than our obstack-like optimization, but is dangerous | |||
skipping to change at line 207 | skipping to change at line 207 | |||
#define OCTAVE_LOCAL_BUFFER(T, buf, size) \ | #define OCTAVE_LOCAL_BUFFER(T, buf, size) \ | |||
octave_local_buffer<T> _buffer_ ## buf (size); \ | octave_local_buffer<T> _buffer_ ## buf (size); \ | |||
T *buf = _buffer_ ## buf | T *buf = _buffer_ ## buf | |||
#endif | #endif | |||
// Note: we use weird variables in the for loop to avoid warnings | // Note: we use weird variables in the for loop to avoid warnings | |||
// about shadowed parameters. | // about shadowed parameters. | |||
#define OCTAVE_LOCAL_BUFFER_INIT(T, buf, size, value) \ | #define OCTAVE_LOCAL_BUFFER_INIT(T, buf, size, value) \ | |||
OCTAVE_LOCAL_BUFFER(T, buf, size); \ | OCTAVE_LOCAL_BUFFER (T, buf, size); \ | |||
for (size_t _buf_iter = 0, _buf_size = size; \ | for (size_t _buf_iter = 0, _buf_size = size; \ | |||
_buf_iter < _buf_size; _buf_iter++) \ | _buf_iter < _buf_size; _buf_iter++) \ | |||
buf[_buf_iter] = value | buf[_buf_iter] = value | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
10 lines changed or deleted | 10 lines changed or added | |||
oct-lvalue.h | oct-lvalue.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_lvalue_h) | #if !defined (octave_oct_lvalue_h) | |||
#define octave_lvalue_h 1 | #define octave_oct_lvalue_h 1 | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
#include <string> | #include <string> | |||
#include "oct-obj.h" | #include "oct-obj.h" | |||
#include "pt-idx.h" | #include "pt-idx.h" | |||
#include "symtab.h" | ||||
class | class | |||
octave_lvalue | octave_lvalue | |||
{ | { | |||
public: | public: | |||
octave_lvalue (octave_value *v = 0) | octave_lvalue (const symbol_table::symbol_reference& s | |||
: val (v), type (), idx (), nel (1) | = symbol_table::symbol_reference ()) | |||
{ } | : sym (s), type (), idx (), nel (1) | |||
{ } | ||||
octave_lvalue (const octave_lvalue& vr) | octave_lvalue (const octave_lvalue& vr) | |||
: val (vr.val), type (vr.type), idx (vr.idx), nel (vr.nel) | : sym (vr.sym), type (vr.type), idx (vr.idx), nel (vr.nel) | |||
{ | { } | |||
} | ||||
octave_lvalue& operator = (const octave_lvalue& vr) | octave_lvalue& operator = (const octave_lvalue& vr) | |||
{ | { | |||
if (this != &vr) | if (this != &vr) | |||
{ | { | |||
val = vr.val; | sym = vr.sym; | |||
type = vr.type; | type = vr.type; | |||
idx = vr.idx; | idx = vr.idx; | |||
nel = vr.nel; | nel = vr.nel; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~octave_lvalue (void) { } | ~octave_lvalue (void) { } | |||
bool is_black_hole (void) const { return val == 0; } | bool is_black_hole (void) const { return sym.is_black_hole (); } | |||
bool is_defined (void) const { return val && val->is_defined (); } | bool is_defined (void) const | |||
{ | ||||
return ! is_black_hole () && sym->is_defined (); | ||||
} | ||||
bool is_undefined (void) const | ||||
{ | ||||
return is_black_hole () || sym->is_undefined (); | ||||
} | ||||
bool is_map (void) const | ||||
{ | ||||
return value().is_map (); | ||||
} | ||||
bool is_undefined (void) const { return ! val || val->is_undefined (); } | void define (const octave_value& v) { sym->assign (v); } | |||
bool is_map (void) const { return val && val->is_map (); } | ||||
void define (const octave_value& v) | ||||
{ | ||||
if (val) | ||||
*val = v; | ||||
} | ||||
void assign (octave_value::assign_op, const octave_value&); | void assign (octave_value::assign_op, const octave_value&); | |||
void numel (octave_idx_type n) { nel = n; } | void numel (octave_idx_type n) { nel = n; } | |||
octave_idx_type numel (void) const { return nel; } | octave_idx_type numel (void) const { return nel; } | |||
void set_index (const std::string& t, const std::list<octave_value_list>& i); | void set_index (const std::string& t, const std::list<octave_value_list>& i); | |||
void clear_index (void) { type = std::string (); idx.clear (); } | void clear_index (void) { type = std::string (); idx.clear (); } | |||
void do_unary_op (octave_value::unary_op op); | void do_unary_op (octave_value::unary_op op); | |||
octave_value value (void); | octave_value value (void) const; | |||
const octave_value *object (void) const { return val; } | ||||
private: | private: | |||
octave_value *val; | symbol_table::symbol_reference sym; | |||
std::string type; | std::string type; | |||
std::list<octave_value_list> idx; | std::list<octave_value_list> idx; | |||
octave_idx_type nel; | octave_idx_type nel; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 12 change blocks. | ||||
34 lines changed or deleted | 38 lines changed or added | |||
oct-map.h | oct-map.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 55 | skipping to change at line 55 | |||
octave_refcount<int> count; | octave_refcount<int> count; | |||
private: | private: | |||
fields_rep& operator = (const fields_rep&); // no assignment! | fields_rep& operator = (const fields_rep&); // no assignment! | |||
}; | }; | |||
fields_rep *rep; | fields_rep *rep; | |||
static fields_rep *nil_rep (void) | static fields_rep *nil_rep (void) | |||
{ | { | |||
static fields_rep nr; | static fields_rep nr; | |||
return &nr; | return &nr; | |||
} | } | |||
public: | public: | |||
octave_fields (void) : rep (nil_rep ()) { rep->count++; } | octave_fields (void) : rep (nil_rep ()) { rep->count++; } | |||
octave_fields (const string_vector&); | octave_fields (const string_vector&); | |||
octave_fields (const char * const *); | octave_fields (const char * const *); | |||
~octave_fields (void) | ~octave_fields (void) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
} | } | |||
void make_unique (void) | void make_unique (void) | |||
{ | { | |||
if (rep->count > 1) | if (rep->count > 1) | |||
{ | { | |||
fields_rep *r = new fields_rep (*rep); | fields_rep *r = new fields_rep (*rep); | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = r; | rep = r; | |||
} | } | |||
} | } | |||
octave_fields (const octave_fields& o) : rep (o.rep) { rep->count++; } | octave_fields (const octave_fields& o) : rep (o.rep) { rep->count++; } | |||
octave_fields& | octave_fields& | |||
operator = (const octave_fields& o) | operator = (const octave_fields& o) | |||
{ | { | |||
o.rep->count++; | o.rep->count++; | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = o.rep; | rep = o.rep; | |||
return *this; | return *this; | |||
} | } | |||
// constant iteration support. non-const iteration intentionally unsuppor ted. | // constant iteration support. non-const iteration intentionally unsuppor ted. | |||
typedef std::map<std::string, octave_idx_type>::const_iterator const_iter ator; | typedef std::map<std::string, octave_idx_type>::const_iterator const_iter ator; | |||
typedef const_iterator iterator; | typedef const_iterator iterator; | |||
const_iterator begin (void) const { return rep->begin (); } | const_iterator begin (void) const { return rep->begin (); } | |||
const_iterator end (void) const { return rep->end (); } | const_iterator end (void) const { return rep->end (); } | |||
std::string key (const_iterator p) const { return p->first; } | std::string key (const_iterator p) const { return p->first; } | |||
octave_idx_type index (const_iterator p) const { return p->second; } | octave_idx_type index (const_iterator p) const { return p->second; } | |||
const_iterator seek (const std::string& k) const | const_iterator seek (const std::string& k) const | |||
{ return rep->find (k); } | { return rep->find (k); } | |||
// high-level methods. | // high-level methods. | |||
// number of fields. | // number of fields. | |||
octave_idx_type nfields (void) const { return rep->size (); } | octave_idx_type nfields (void) const { return rep->size (); } | |||
// check whether a field exists. | // check whether a field exists. | |||
bool isfield (const std::string& name) const; | bool isfield (const std::string& name) const; | |||
// get index of field. return -1 if not exist | // get index of field. return -1 if not exist | |||
skipping to change at line 141 | skipping to change at line 141 | |||
// compares two instances for equality up to order of fields. | // compares two instances for equality up to order of fields. | |||
// returns a permutation needed to bring the fields of *other* | // returns a permutation needed to bring the fields of *other* | |||
// into the order of *this*. | // into the order of *this*. | |||
bool equal_up_to_order (const octave_fields& other, | bool equal_up_to_order (const octave_fields& other, | |||
octave_idx_type* perm) const; | octave_idx_type* perm) const; | |||
bool equal_up_to_order (const octave_fields& other, | bool equal_up_to_order (const octave_fields& other, | |||
Array<octave_idx_type>& perm) const; | Array<octave_idx_type>& perm) const; | |||
bool is_same (const octave_fields& other) const | bool is_same (const octave_fields& other) const | |||
{ return rep == other.rep; } | { return rep == other.rep; } | |||
// Returns the fields as a vector of strings. | // Returns the fields as a vector of strings. | |||
string_vector fieldnames (void) const; | string_vector fieldnames (void) const; | |||
void clear (void) | void clear (void) | |||
{ | { | |||
*this = octave_fields (); | *this = octave_fields (); | |||
} | } | |||
}; | }; | |||
class OCTINTERP_API | class OCTINTERP_API | |||
octave_scalar_map | octave_scalar_map | |||
{ | { | |||
public: | public: | |||
octave_scalar_map (const octave_fields& k) | octave_scalar_map (const octave_fields& k) | |||
: xkeys (k), xvals (k.nfields ()) { } | : xkeys (k), xvals (k.nfields ()) { } | |||
octave_scalar_map (void) : xkeys (), xvals () { } | octave_scalar_map (void) : xkeys (), xvals () { } | |||
octave_scalar_map (const string_vector& k) | octave_scalar_map (const string_vector& k) | |||
: xkeys (k), xvals (k.length ()) { } | : xkeys (k), xvals (k.length ()) { } | |||
octave_scalar_map (const octave_scalar_map& m) | octave_scalar_map (const octave_scalar_map& m) | |||
: xkeys (m.xkeys), xvals(m.xvals) { } | : xkeys (m.xkeys), xvals(m.xvals) { } | |||
octave_scalar_map& operator = (const octave_scalar_map& m) | octave_scalar_map& operator = (const octave_scalar_map& m) | |||
{ | { | |||
xkeys = m.xkeys; | xkeys = m.xkeys; | |||
xvals = m.xvals; | xvals = m.xvals; | |||
return *this; | return *this; | |||
} | } | |||
// iteration support. note that both const and non-const iterators are th e | // iteration support. note that both const and non-const iterators are th e | |||
// same. The const/non-const distinction is made by the key & contents me thod. | // same. The const/non-const distinction is made by the key & contents me thod. | |||
typedef octave_fields::const_iterator const_iterator; | typedef octave_fields::const_iterator const_iterator; | |||
typedef const_iterator iterator; | typedef const_iterator iterator; | |||
const_iterator begin (void) const { return xkeys.begin (); } | const_iterator begin (void) const { return xkeys.begin (); } | |||
const_iterator end (void) const { return xkeys.end (); } | const_iterator end (void) const { return xkeys.end (); } | |||
const_iterator seek (const std::string& k) const { return xkeys.seek (k); } | const_iterator seek (const std::string& k) const { return xkeys.seek (k); } | |||
std::string key (const_iterator p) const | std::string key (const_iterator p) const | |||
{ return xkeys.key (p); } | { return xkeys.key (p); } | |||
octave_idx_type index (const_iterator p) const | octave_idx_type index (const_iterator p) const | |||
{ return xkeys.index (p); } | { return xkeys.index (p); } | |||
const octave_value& contents (const_iterator p) const | const octave_value& contents (const_iterator p) const | |||
{ return xvals[xkeys.index (p)]; } | { return xvals[xkeys.index (p)]; } | |||
octave_value& contents (iterator p) | octave_value& contents (iterator p) | |||
{ return xvals[xkeys.index (p)]; } | { return xvals[xkeys.index (p)]; } | |||
const octave_value& contents (octave_idx_type i) const | const octave_value& contents (octave_idx_type i) const | |||
{ return xvals[i]; } | { return xvals[i]; } | |||
octave_value& contents (octave_idx_type i) | octave_value& contents (octave_idx_type i) | |||
{ return xvals[i]; } | { return xvals[i]; } | |||
// number of fields. | // number of fields. | |||
octave_idx_type nfields (void) const { return xkeys.nfields (); } | octave_idx_type nfields (void) const { return xkeys.nfields (); } | |||
// check whether a field exists. | // check whether a field exists. | |||
bool isfield (const std::string& name) const | bool isfield (const std::string& name) const | |||
{ return xkeys.isfield (name); } | { return xkeys.isfield (name); } | |||
bool contains (const std::string& name) const | bool contains (const std::string& name) const | |||
{ return isfield (name); } | { return isfield (name); } | |||
string_vector fieldnames (void) const | string_vector fieldnames (void) const | |||
{ return xkeys.fieldnames (); } | { return xkeys.fieldnames (); } | |||
string_vector keys (void) const | string_vector keys (void) const | |||
{ return fieldnames (); } | { return fieldnames (); } | |||
// get contents of a given field. empty value if not exist. | // get contents of a given field. empty value if not exist. | |||
octave_value getfield (const std::string& key) const; | octave_value getfield (const std::string& key) const; | |||
// set contents of a given field. add if not exist. | // set contents of a given field. add if not exist. | |||
void setfield (const std::string& key, const octave_value& val); | void setfield (const std::string& key, const octave_value& val); | |||
void assign (const std::string& k, const octave_value& val) | void assign (const std::string& k, const octave_value& val) | |||
{ setfield (k, val); } | { setfield (k, val); } | |||
// remove a given field. do nothing if not exist. | // remove a given field. do nothing if not exist. | |||
void rmfield (const std::string& key); | void rmfield (const std::string& key); | |||
void del (const std::string& k) { rmfield (k); } | void del (const std::string& k) { rmfield (k); } | |||
// return a copy with fields ordered, optionally along with permutation. | // return a copy with fields ordered, optionally along with permutation. | |||
octave_scalar_map orderfields (void) const; | octave_scalar_map orderfields (void) const; | |||
octave_scalar_map orderfields (Array<octave_idx_type>& perm) const; | octave_scalar_map orderfields (Array<octave_idx_type>& perm) const; | |||
octave_scalar_map orderfields (const octave_scalar_map& other, | octave_scalar_map orderfields (const octave_scalar_map& other, | |||
Array<octave_idx_type>& perm) const; | Array<octave_idx_type>& perm) const; | |||
// aka getfield/setfield, but the latter returns a reference. | // aka getfield/setfield, but the latter returns a reference. | |||
octave_value contents (const std::string& k) const; | octave_value contents (const std::string& k) const; | |||
octave_value& contents (const std::string& k); | octave_value& contents (const std::string& k); | |||
void clear (void) | void clear (void) | |||
{ | { | |||
xkeys.clear (); | xkeys.clear (); | |||
xvals.clear (); | xvals.clear (); | |||
} | } | |||
friend class octave_map; | friend class octave_map; | |||
private: | private: | |||
octave_fields xkeys; | octave_fields xkeys; | |||
std::vector<octave_value> xvals; | std::vector<octave_value> xvals; | |||
}; | }; | |||
template<> | template<> | |||
inline octave_scalar_map octave_value_extract<octave_scalar_map> (const oct | inline octave_scalar_map | |||
ave_value& v) | octave_value_extract<octave_scalar_map> (const octave_value& v) | |||
{ return v.scalar_map_value (); } | { return v.scalar_map_value (); } | |||
class OCTINTERP_API | class OCTINTERP_API | |||
octave_map | octave_map | |||
{ | { | |||
public: | public: | |||
octave_map (const octave_fields& k) | octave_map (const octave_fields& k) | |||
: xkeys (k), xvals (k.nfields ()), dimensions () { } | : xkeys (k), xvals (k.nfields ()), dimensions () { } | |||
octave_map (const dim_vector& dv, const octave_fields& k) | octave_map (const dim_vector& dv, const octave_fields& k) | |||
skipping to change at line 291 | skipping to change at line 292 | |||
: xkeys (k), xvals (k.length (), Cell (dv)), dimensions (dv) { } | : xkeys (k), xvals (k.length (), Cell (dv)), dimensions (dv) { } | |||
octave_map (const octave_map& m) | octave_map (const octave_map& m) | |||
: xkeys (m.xkeys), xvals (m.xvals), dimensions (m.dimensions) { } | : xkeys (m.xkeys), xvals (m.xvals), dimensions (m.dimensions) { } | |||
octave_map (const octave_scalar_map& m); | octave_map (const octave_scalar_map& m); | |||
octave_map (const Octave_map& m); | octave_map (const Octave_map& m); | |||
octave_map& operator = (const octave_map& m) | octave_map& operator = (const octave_map& m) | |||
{ | { | |||
xkeys = m.xkeys; | xkeys = m.xkeys; | |||
xvals = m.xvals; | xvals = m.xvals; | |||
dimensions = m.dimensions; | dimensions = m.dimensions; | |||
return *this; | return *this; | |||
} | } | |||
// iteration support. note that both const and non-const iterators are th e | // iteration support. note that both const and non-const iterators are th e | |||
// same. The const/non-const distinction is made by the key & contents me thod. | // same. The const/non-const distinction is made by the key & contents me thod. | |||
typedef octave_fields::const_iterator const_iterator; | typedef octave_fields::const_iterator const_iterator; | |||
typedef const_iterator iterator; | typedef const_iterator iterator; | |||
const_iterator begin (void) const { return xkeys.begin (); } | const_iterator begin (void) const { return xkeys.begin (); } | |||
const_iterator end (void) const { return xkeys.end (); } | const_iterator end (void) const { return xkeys.end (); } | |||
const_iterator seek (const std::string& k) const { return xkeys.seek (k); } | const_iterator seek (const std::string& k) const { return xkeys.seek (k); } | |||
std::string key (const_iterator p) const | std::string key (const_iterator p) const | |||
{ return xkeys.key (p); } | { return xkeys.key (p); } | |||
octave_idx_type index (const_iterator p) const | octave_idx_type index (const_iterator p) const | |||
{ return xkeys.index (p); } | { return xkeys.index (p); } | |||
const Cell& contents (const_iterator p) const | const Cell& contents (const_iterator p) const | |||
{ return xvals[xkeys.index (p)]; } | { return xvals[xkeys.index (p)]; } | |||
Cell& contents (iterator p) | Cell& contents (iterator p) | |||
{ return xvals[xkeys.index (p)]; } | { return xvals[xkeys.index (p)]; } | |||
const Cell& contents (octave_idx_type i) const | const Cell& contents (octave_idx_type i) const | |||
{ return xvals[i]; } | { return xvals[i]; } | |||
Cell& contents (octave_idx_type i) | Cell& contents (octave_idx_type i) | |||
{ return xvals[i]; } | { return xvals[i]; } | |||
// number of fields. | // number of fields. | |||
octave_idx_type nfields (void) const { return xkeys.nfields (); } | octave_idx_type nfields (void) const { return xkeys.nfields (); } | |||
// check whether a field exists. | // check whether a field exists. | |||
bool isfield (const std::string& name) const | bool isfield (const std::string& name) const | |||
{ return xkeys.isfield (name); } | { return xkeys.isfield (name); } | |||
bool contains (const std::string& name) const | bool contains (const std::string& name) const | |||
{ return isfield (name); } | { return isfield (name); } | |||
string_vector fieldnames (void) const | string_vector fieldnames (void) const | |||
{ return xkeys.fieldnames (); } | { return xkeys.fieldnames (); } | |||
string_vector keys (void) const | string_vector keys (void) const | |||
{ return fieldnames (); } | { return fieldnames (); } | |||
// get contents of a given field. empty value if not exist. | // get contents of a given field. empty value if not exist. | |||
Cell getfield (const std::string& key) const; | Cell getfield (const std::string& key) const; | |||
// set contents of a given field. add if not exist. checks for | // set contents of a given field. add if not exist. checks for | |||
// correct dimensions. | // correct dimensions. | |||
void setfield (const std::string& key, const Cell& val); | void setfield (const std::string& key, const Cell& val); | |||
void assign (const std::string& k, const Cell& val) | void assign (const std::string& k, const Cell& val) | |||
{ setfield (k, val); } | { setfield (k, val); } | |||
// remove a given field. do nothing if not exist. | // remove a given field. do nothing if not exist. | |||
void rmfield (const std::string& key); | void rmfield (const std::string& key); | |||
void del (const std::string& k) { rmfield (k); } | void del (const std::string& k) { rmfield (k); } | |||
// return a copy with fields ordered, optionally along with permutation. | // return a copy with fields ordered, optionally along with permutation. | |||
octave_map orderfields (void) const; | octave_map orderfields (void) const; | |||
octave_map orderfields (Array<octave_idx_type>& perm) const; | octave_map orderfields (Array<octave_idx_type>& perm) const; | |||
octave_map orderfields (const octave_map& other, | octave_map orderfields (const octave_map& other, | |||
Array<octave_idx_type>& perm) const; | Array<octave_idx_type>& perm) const; | |||
// aka getfield/setfield, but the latter returns a reference. | // aka getfield/setfield, but the latter returns a reference. | |||
Cell contents (const std::string& k) const; | Cell contents (const std::string& k) const; | |||
Cell& contents (const std::string& k); | Cell& contents (const std::string& k); | |||
void clear (void) | void clear (void) | |||
{ | { | |||
xkeys.clear (); | xkeys.clear (); | |||
xvals.clear (); | xvals.clear (); | |||
} | } | |||
// The Array-like methods. | // The Array-like methods. | |||
octave_idx_type numel (void) const { return dimensions.numel (); } | octave_idx_type numel (void) const { return dimensions.numel (); } | |||
octave_idx_type length (void) const { return numel (); } | octave_idx_type length (void) const { return numel (); } | |||
bool is_empty (void) const { return dimensions.any_zero (); } | bool is_empty (void) const { return dimensions.any_zero (); } | |||
octave_idx_type rows (void) const { return dimensions(0); } | octave_idx_type rows (void) const { return dimensions(0); } | |||
octave_idx_type cols (void) const { return dimensions(1); } | octave_idx_type cols (void) const { return dimensions(1); } | |||
octave_idx_type columns (void) const { return dimensions(1); } | octave_idx_type columns (void) const { return dimensions(1); } | |||
// Extract a scalar substructure. | // Extract a scalar substructure. | |||
octave_scalar_map checkelem (octave_idx_type n) const; | octave_scalar_map checkelem (octave_idx_type n) const; | |||
octave_scalar_map checkelem (octave_idx_type i, octave_idx_type j) const; | octave_scalar_map checkelem (octave_idx_type i, octave_idx_type j) const; | |||
octave_scalar_map | octave_scalar_map | |||
checkelem (const Array<octave_idx_type>& ra_idx) const; | checkelem (const Array<octave_idx_type>& ra_idx) const; | |||
octave_scalar_map operator () (octave_idx_type n) const | octave_scalar_map operator () (octave_idx_type n) const | |||
{ return checkelem (n); } | { return checkelem (n); } | |||
octave_scalar_map operator () (octave_idx_type i, octave_idx_type j) cons t | octave_scalar_map operator () (octave_idx_type i, octave_idx_type j) cons t | |||
{ return checkelem (i, j); } | { return checkelem (i, j); } | |||
octave_scalar_map | octave_scalar_map | |||
operator () (const Array<octave_idx_type>& ra_idx) const | operator () (const Array<octave_idx_type>& ra_idx) const | |||
{ return checkelem (ra_idx); } | { return checkelem (ra_idx); } | |||
octave_map squeeze (void) const; | octave_map squeeze (void) const; | |||
octave_map permute (const Array<int>& vec, bool inv = false) const; | octave_map permute (const Array<int>& vec, bool inv = false) const; | |||
dim_vector dims (void) const { return dimensions; } | dim_vector dims (void) const { return dimensions; } | |||
int ndims (void) const { return dimensions.length (); } | int ndims (void) const { return dimensions.length (); } | |||
octave_map transpose (void) const; | octave_map transpose (void) const; | |||
skipping to change at line 448 | skipping to change at line 449 | |||
const Cell& rhs); | const Cell& rhs); | |||
void delete_elements (const idx_vector& i); | void delete_elements (const idx_vector& i); | |||
void delete_elements (int dim, const idx_vector& i); | void delete_elements (int dim, const idx_vector& i); | |||
void delete_elements (const Array<idx_vector>& ia); | void delete_elements (const Array<idx_vector>& ia); | |||
void delete_elements (const octave_value_list&); | void delete_elements (const octave_value_list&); | |||
octave_map concat (const octave_map& rb, const Array<octave_idx_type>& ra | octave_map concat (const octave_map& rb, | |||
_idx); | const Array<octave_idx_type>& ra_idx); | |||
// like checkelem, but no check. | // like checkelem, but no check. | |||
octave_scalar_map fast_elem_extract (octave_idx_type n) const; | octave_scalar_map fast_elem_extract (octave_idx_type n) const; | |||
// element assignment, no bounds check | // element assignment, no bounds check | |||
bool fast_elem_insert (octave_idx_type n, const octave_scalar_map& rhs); | bool fast_elem_insert (octave_idx_type n, const octave_scalar_map& rhs); | |||
private: | private: | |||
octave_fields xkeys; | octave_fields xkeys; | |||
skipping to change at line 473 | skipping to change at line 475 | |||
void extract_scalar (octave_scalar_map& dest, | void extract_scalar (octave_scalar_map& dest, | |||
octave_idx_type index) const; | octave_idx_type index) const; | |||
static void do_cat (int dim, octave_idx_type n, | static void do_cat (int dim, octave_idx_type n, | |||
const octave_scalar_map *map_list, octave_map& retval ); | const octave_scalar_map *map_list, octave_map& retval ); | |||
static void do_cat (int dim, octave_idx_type n, | static void do_cat (int dim, octave_idx_type n, | |||
const octave_map *map_list, octave_map& retval); | const octave_map *map_list, octave_map& retval); | |||
}; | }; | |||
template<> | template<> | |||
inline octave_map octave_value_extract<octave_map> (const octave_value& v) | inline octave_map octave_value_extract<octave_map> (const octave_value& v) | |||
{ return v.map_value (); } | { return v.map_value (); } | |||
// The original Octave_map object. Octave_map and octave_map are convertibl | // The original Octave_map object which is now deprecated. | |||
e to | // It was fully deprecated in version 3.8 and should be removed in 3.12. | |||
// each other. | // Octave_map and octave_map are convertible to each other. | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
Octave_map | Octave_map | |||
{ | { | |||
public: | public: | |||
typedef std::map<std::string, Cell>::iterator iterator; | typedef std::map<std::string, Cell>::iterator iterator; | |||
typedef std::map<std::string, Cell>::const_iterator const_iterator; | typedef std::map<std::string, Cell>::const_iterator const_iterator; | |||
typedef std::list<std::string>::iterator key_list_iterator; | typedef std::list<std::string>::iterator key_list_iterator; | |||
typedef std::list<std::string>::const_iterator const_key_list_iterator; | typedef std::list<std::string>::const_iterator const_key_list_iterator; | |||
// Warning! You should always use at least two dimensions. | // Warning! You should always use at least two dimensions. | |||
Octave_map (const dim_vector& dv = dim_vector (0, 0), | Octave_map (const dim_vector& dv = dim_vector (0, 0), | |||
skipping to change at line 534 | skipping to change at line 537 | |||
map[k] = val_list; | map[k] = val_list; | |||
key_list.push_back (k); | key_list.push_back (k); | |||
} | } | |||
Octave_map (const Octave_map& m) | Octave_map (const Octave_map& m) | |||
: map (m.map), key_list (m.key_list), dimensions (m.dimensions) { } | : map (m.map), key_list (m.key_list), dimensions (m.dimensions) { } | |||
Octave_map (const octave_map& m); | Octave_map (const octave_map& m); | |||
Octave_map& operator = (const Octave_map& m) | Octave_map& operator = (const Octave_map& m) | |||
{ | { | |||
if (this != &m) | if (this != &m) | |||
{ | { | |||
map = m.map; | map = m.map; | |||
key_list = m.key_list; | key_list = m.key_list; | |||
dimensions = m.dimensions; | dimensions = m.dimensions; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~Octave_map (void) { } | ~Octave_map (void) { } | |||
Octave_map squeeze (void) const; | Octave_map squeeze (void) const; | |||
Octave_map permute (const Array<int>& vec, bool inv = false) const; | Octave_map permute (const Array<int>& vec, bool inv = false) const; | |||
// This is the number of keys. | // This is the number of keys. | |||
octave_idx_type nfields (void) const { return map.size (); } | octave_idx_type nfields (void) const { return map.size (); } | |||
void del (const std::string& k) | void del (const std::string& k) | |||
{ | { | |||
iterator p = map.find (k); | iterator p = map.find (k); | |||
if (p != map.end ()) | if (p != map.end ()) | |||
{ | { | |||
map.erase (p); | map.erase (p); | |||
key_list_iterator q | key_list_iterator q | |||
= std::find (key_list.begin (), key_list.end (), k); | = std::find (key_list.begin (), key_list.end (), k); | |||
assert (q != key_list.end ()); | assert (q != key_list.end ()); | |||
key_list.erase (q); | key_list.erase (q); | |||
} | } | |||
} | } | |||
iterator begin (void) { return iterator (map.begin ()); } | iterator begin (void) { return iterator (map.begin ()); } | |||
const_iterator begin (void) const { return const_iterator (map.begin ()); } | const_iterator begin (void) const { return const_iterator (map.begin ()); } | |||
iterator end (void) { return iterator (map.end ()); } | iterator end (void) { return iterator (map.end ()); } | |||
const_iterator end (void) const { return const_iterator (map.end ()); } | const_iterator end (void) const { return const_iterator (map.end ()); } | |||
std::string key (const_iterator p) const { return p->first; } | std::string key (const_iterator p) const { return p->first; } | |||
Cell& contents (const std::string& k); | Cell& contents (const std::string& k); | |||
Cell contents (const std::string& k) const; | Cell contents (const std::string& k) const; | |||
Cell& contents (iterator p) | Cell& contents (iterator p) | |||
{ return p->second; } | { return p->second; } | |||
Cell contents (const_iterator p) const | Cell contents (const_iterator p) const | |||
{ return p->second; } | { return p->second; } | |||
int intfield (const std::string& k, int def_val = 0) const; | int intfield (const std::string& k, int def_val = 0) const; | |||
std::string stringfield (const std::string& k, | std::string stringfield (const std::string& k, | |||
const std::string& def_val = std::string ()) con st; | const std::string& def_val = std::string ()) con st; | |||
iterator seek (const std::string& k) { return map.find (k); } | iterator seek (const std::string& k) { return map.find (k); } | |||
const_iterator seek (const std::string& k) const { return map.find (k); } | const_iterator seek (const std::string& k) const { return map.find (k); } | |||
bool contains (const std::string& k) const | bool contains (const std::string& k) const | |||
{ return (seek (k) != map.end ()); } | { return (seek (k) != map.end ()); } | |||
void clear (void) | void clear (void) | |||
{ | { | |||
map.clear (); | map.clear (); | |||
key_list.clear (); | key_list.clear (); | |||
} | } | |||
string_vector keys (void) const; | string_vector keys (void) const; | |||
octave_idx_type rows (void) const { return dimensions(0); } | octave_idx_type rows (void) const { return dimensions(0); } | |||
octave_idx_type columns (void) const { return dimensions(1); } | octave_idx_type columns (void) const { return dimensions(1); } | |||
dim_vector dims (void) const { return dimensions; } | dim_vector dims (void) const { return dimensions; } | |||
int ndims (void) const { return dimensions.length (); } | int ndims (void) const { return dimensions.length (); } | |||
Octave_map transpose (void) const; | Octave_map transpose (void) const; | |||
Octave_map reshape (const dim_vector& new_dims) const; | Octave_map reshape (const dim_vector& new_dims) const; | |||
void resize (const dim_vector& dv, bool fill = false); | void resize (const dim_vector& dv, bool fill = false); | |||
octave_idx_type numel (void) const { return dimensions.numel (); } | octave_idx_type numel (void) const { return dimensions.numel (); } | |||
Octave_map concat (const Octave_map& rb, const Array<octave_idx_type>& ra | Octave_map concat (const Octave_map& rb, | |||
_idx); | const Array<octave_idx_type>& ra_idx); | |||
Octave_map& maybe_delete_elements (const octave_value_list& idx); | Octave_map& maybe_delete_elements (const octave_value_list& idx); | |||
Octave_map& assign (const octave_value_list& idx, const Octave_map& rhs); | Octave_map& assign (const octave_value_list& idx, const Octave_map& rhs); | |||
Octave_map& assign (const octave_value_list& idx, const std::string& k, | Octave_map& assign (const octave_value_list& idx, const std::string& k, | |||
const Cell& rhs); | const Cell& rhs); | |||
Octave_map& assign (const std::string& k, const octave_value& rhs); | Octave_map& assign (const std::string& k, const octave_value& rhs); | |||
skipping to change at line 652 | skipping to change at line 656 | |||
std::map<std::string, Cell> map; | std::map<std::string, Cell> map; | |||
// An extra list of keys, so we can keep track of the order the keys | // An extra list of keys, so we can keep track of the order the keys | |||
// are added for compatibility with you know what. | // are added for compatibility with you know what. | |||
std::list<std::string> key_list; | std::list<std::string> key_list; | |||
// The current size. | // The current size. | |||
mutable dim_vector dimensions; | mutable dim_vector dimensions; | |||
void maybe_add_to_key_list (const std::string& k) | void maybe_add_to_key_list (const std::string& k) | |||
{ | { | |||
if (! contains (k)) | if (! contains (k)) | |||
key_list.push_back (k); | key_list.push_back (k); | |||
} | } | |||
}; | } GCC_ATTR_DEPRECATED; | |||
#endif | #endif | |||
End of changes. 58 change blocks. | ||||
120 lines changed or deleted | 120 lines changed or added | |||
oct-md5.h | oct-md5.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2007-2012 David Bateman | Copyright (C) 2007-2013 David Bateman | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
oct-mem.h | oct-mem.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 VZLU Prague | Copyright (C) 2009-2013 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_memory_h) | #if !defined (octave_oct_mem_h) | |||
#define octave_memory_h 1 | #define octave_oct_mem_h 1 | |||
#include <cstddef> | #include <cstddef> | |||
#include <cstring> | #include <cstring> | |||
#include <algorithm> | #include <algorithm> | |||
#include "oct-cmplx.h" | #include "oct-cmplx.h" | |||
#include "oct-inttypes.h" | #include "oct-inttypes.h" | |||
// NOTE: These functions are used to optimize stuff where performance is a | // NOTE: These functions are used to optimize stuff where performance is a | |||
// priority. They assume that the std::complex and octave_int can be | // priority. They assume that the std::complex and octave_int can be | |||
skipping to change at line 46 | skipping to change at line 46 | |||
// but not theoretically guaranteed by the C++ standard. In the future, C++ may | // but not theoretically guaranteed by the C++ standard. In the future, C++ may | |||
// provide a better way to accomplish these tasks. | // provide a better way to accomplish these tasks. | |||
inline size_t safe_size_comp (size_t n, size_t size) | inline size_t safe_size_comp (size_t n, size_t size) | |||
{ | { | |||
if (n > static_cast<size_t> (-1) / size) | if (n > static_cast<size_t> (-1) / size) | |||
throw std::bad_alloc (); | throw std::bad_alloc (); | |||
return n * size; | return n * size; | |||
} | } | |||
// Unaliased copy. This boils down to memcpy, even for octave_int and compl | // Unaliased copy. This boils down to memcpy, even for octave_int and | |||
ex types. | // complex types. | |||
template <class T> | template <class T> | |||
inline void copy_or_memcpy (size_t n, const T *src, T *dest) | inline void copy_or_memcpy (size_t n, const T *src, T *dest) | |||
{ std::copy (src, src + n, dest); } | { std::copy (src, src + n, dest); } | |||
#define DEFINE_POD_UCOPY(T) \ | #define DEFINE_POD_UCOPY(T) \ | |||
inline void copy_or_memcpy (size_t n, const T *src, T *dest) \ | inline void copy_or_memcpy (size_t n, const T *src, T *dest) \ | |||
{ std::memcpy (dest, src, n * sizeof (T)); } | { std::memcpy (dest, src, n * sizeof (T)); } | |||
DEFINE_POD_UCOPY (double) | DEFINE_POD_UCOPY (double) | |||
skipping to change at line 82 | skipping to change at line 83 | |||
// Fill by value, with a check for zero. This boils down to memset if value is | // Fill by value, with a check for zero. This boils down to memset if value is | |||
// a POD zero. | // a POD zero. | |||
template <class T> | template <class T> | |||
inline void fill_or_memset (size_t n, const T& value, T *dest) | inline void fill_or_memset (size_t n, const T& value, T *dest) | |||
{ std::fill_n (dest, n, value); } | { std::fill_n (dest, n, value); } | |||
template <class T> | template <class T> | |||
inline bool helper_is_zero_mem (const T& value) | inline bool helper_is_zero_mem (const T& value) | |||
{ | { | |||
typedef typename query_integer_type<sizeof (T), false>::type IT; // get i | // get integer type of the same size. | |||
nteger type of the same size. | typedef typename query_integer_type<sizeof (T), false>::type IT; | |||
return *(reinterpret_cast<const IT *>(&value)) == 0; | return *(reinterpret_cast<const IT *>(&value)) == 0; | |||
} | } | |||
template <class T> | template <class T> | |||
inline bool helper_is_zero_mem (const std::complex<T>& value) | inline bool helper_is_zero_mem (const std::complex<T>& value) | |||
{ | { | |||
return (helper_is_zero_mem (value.real ()) | return (helper_is_zero_mem (value.real ()) | |||
&& helper_is_zero_mem (value.imag ())); | && helper_is_zero_mem (value.imag ())); | |||
} | } | |||
template <class T> | template <class T> | |||
inline bool helper_is_zero_mem (const octave_int<T>& value) | inline bool helper_is_zero_mem (const octave_int<T>& value) | |||
{ return value.value () == T(); } | { return value.value () == T (); } | |||
#define DEFINE_POD_FILL(T) \ | #define DEFINE_POD_FILL(T) \ | |||
inline void fill_or_memset (size_t n, const T& value, T *dest) \ | inline void fill_or_memset (size_t n, const T& value, T *dest) \ | |||
{ \ | { \ | |||
if (helper_is_zero_mem (value)) \ | if (helper_is_zero_mem (value)) \ | |||
std::memset (dest, 0, n * sizeof (T)); \ | std::memset (dest, 0, n * sizeof (T)); \ | |||
else \ | else \ | |||
std::fill_n (dest, n, value); \ | std::fill_n (dest, n, value); \ | |||
} | } | |||
skipping to change at line 123 | skipping to change at line 125 | |||
DEFINE_POD_FILL (unsigned short) | DEFINE_POD_FILL (unsigned short) | |||
DEFINE_POD_FILL (unsigned int) | DEFINE_POD_FILL (unsigned int) | |||
DEFINE_POD_FILL (unsigned long) | DEFINE_POD_FILL (unsigned long) | |||
DEFINE_POD_FILL (Complex) | DEFINE_POD_FILL (Complex) | |||
DEFINE_POD_FILL (FloatComplex) | DEFINE_POD_FILL (FloatComplex) | |||
template <class T> | template <class T> | |||
DEFINE_POD_FILL (octave_int<T>) | DEFINE_POD_FILL (octave_int<T>) | |||
// Uninitialized allocation. Will not initialize memory for complex and oct | // Uninitialized allocation. | |||
ave_int. | // Will not initialize memory for complex and octave_int. | |||
// Memory allocated by octave_new should be freed by octave_delete. | // Memory allocated by octave_new should be freed by octave_delete. | |||
template <class T> | template <class T> | |||
inline T *no_ctor_new (size_t n) | inline T *no_ctor_new (size_t n) | |||
{ | { | |||
// Some systems let us allocate > 2GB memory even though size_t, which is | // Some systems let us allocate > 2GB memory even though size_t, which is | |||
either | // either buggy or completely cuckoo, so let's check here to stay safe. | |||
// buggy or completely cuckoo, so let's check here to stay safe. | ||||
safe_size_comp (n, sizeof (T)); | safe_size_comp (n, sizeof (T)); | |||
return new T[n]; | return new T [n]; | |||
} | } | |||
template <class T> | template <class T> | |||
inline void no_ctor_delete (T *ptr) | inline void no_ctor_delete (T *ptr) | |||
{ delete [] ptr; } | { delete [] ptr; } | |||
#define DEFINE_POD_NEW_DELETE(T) \ | #define DEFINE_POD_NEW_DELETE(T) \ | |||
template <> \ | template <> \ | |||
inline T *no_ctor_new<T > (size_t n) \ | inline T *no_ctor_new<T > (size_t n) \ | |||
{ return reinterpret_cast<T *> (new char[safe_size_comp (n, sizeof (T))]); } \ | { return reinterpret_cast<T *> (new char [safe_size_comp (n, sizeof (T))]); } \ | |||
template <> \ | template <> \ | |||
inline void no_ctor_delete<T > (T *ptr) \ | inline void no_ctor_delete<T > (T *ptr) \ | |||
{ delete [] reinterpret_cast<char *> (ptr); } | { delete [] reinterpret_cast<char *> (ptr); } | |||
DEFINE_POD_NEW_DELETE (Complex) | DEFINE_POD_NEW_DELETE (Complex) | |||
DEFINE_POD_NEW_DELETE (FloatComplex) | DEFINE_POD_NEW_DELETE (FloatComplex) | |||
DEFINE_POD_NEW_DELETE (octave_int8) | DEFINE_POD_NEW_DELETE (octave_int8) | |||
DEFINE_POD_NEW_DELETE (octave_int16) | DEFINE_POD_NEW_DELETE (octave_int16) | |||
DEFINE_POD_NEW_DELETE (octave_int32) | DEFINE_POD_NEW_DELETE (octave_int32) | |||
DEFINE_POD_NEW_DELETE (octave_int64) | DEFINE_POD_NEW_DELETE (octave_int64) | |||
DEFINE_POD_NEW_DELETE (octave_uint8) | DEFINE_POD_NEW_DELETE (octave_uint8) | |||
DEFINE_POD_NEW_DELETE (octave_uint16) | DEFINE_POD_NEW_DELETE (octave_uint16) | |||
DEFINE_POD_NEW_DELETE (octave_uint32) | DEFINE_POD_NEW_DELETE (octave_uint32) | |||
DEFINE_POD_NEW_DELETE (octave_uint64) | DEFINE_POD_NEW_DELETE (octave_uint64) | |||
#endif /* octave_memory_h */ | #endif /* octave_oct_mem_h */ | |||
End of changes. 10 change blocks. | ||||
15 lines changed or deleted | 14 lines changed or added | |||
oct-mutex.h | oct-mutex.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Michael Goffioul | Copyright (C) 2008-2013 Michael Goffioul | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_octave_mutex_h) | #if !defined (octave_oct_mutex_h) | |||
#define octave_octave_mutex_h 1 | #define octave_oct_mutex_h 1 | |||
#include "oct-refcount.h" | #include "oct-refcount.h" | |||
class octave_mutex; | class octave_mutex; | |||
class | class | |||
octave_base_mutex | octave_base_mutex | |||
{ | { | |||
public: | public: | |||
friend class octave_mutex; | friend class octave_mutex; | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
oct-norm.h | oct-norm.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 VZLU Prague, a.s. | Copyright (C) 2008-2013 VZLU Prague, a.s. | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 25 | skipping to change at line 25 | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
// author: Jaroslav Hajek <highegg@gmail.com> | // author: Jaroslav Hajek <highegg@gmail.com> | |||
#if !defined (octave_norm_h) | #if !defined (octave_oct_norm_h) | |||
#define octave_norm_h 1 | #define octave_oct_norm_h 1 | |||
#include "oct-cmplx.h" | #include "oct-cmplx.h" | |||
#define DECLARE_XNORM_FUNCS(PREFIX, RTYPE) \ | #define DECLARE_XNORM_FUNCS(PREFIX, RTYPE) \ | |||
class PREFIX##Matrix; \ | class PREFIX##Matrix; \ | |||
class PREFIX##ColumnVector; \ | class PREFIX##ColumnVector; \ | |||
class PREFIX##RowVector; \ | class PREFIX##RowVector; \ | |||
\ | \ | |||
extern OCTAVE_API RTYPE xnorm (const PREFIX##ColumnVector&, RTYPE p = 2); \ | extern OCTAVE_API RTYPE xnorm (const PREFIX##ColumnVector&, RTYPE p = 2); \ | |||
extern OCTAVE_API RTYPE xnorm (const PREFIX##RowVector&, RTYPE p = 2); \ | extern OCTAVE_API RTYPE xnorm (const PREFIX##RowVector&, RTYPE p = 2); \ | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
oct-obj.h | oct-obj.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 70 | skipping to change at line 70 | |||
octave_value_list (const octave_value_list& obj) | octave_value_list (const octave_value_list& obj) | |||
: data (obj.data), names (obj.names) { } | : data (obj.data), names (obj.names) { } | |||
// Concatenation constructor. | // Concatenation constructor. | |||
octave_value_list (const std::list<octave_value_list>&); | octave_value_list (const std::list<octave_value_list>&); | |||
~octave_value_list (void) { } | ~octave_value_list (void) { } | |||
octave_value_list& operator = (const octave_value_list& obj) | octave_value_list& operator = (const octave_value_list& obj) | |||
{ | { | |||
if (this != &obj) | if (this != &obj) | |||
{ | { | |||
data = obj.data; | data = obj.data; | |||
names = obj.names; | names = obj.names; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
Array<octave_value> array_value (void) const { return data; } | Array<octave_value> array_value (void) const { return data; } | |||
Cell cell_value (void) const { return array_value (); } | Cell cell_value (void) const { return array_value (); } | |||
// Assignment will resize on range errors. | // Assignment will resize on range errors. | |||
octave_value& operator () (octave_idx_type n) { return elem (n); } | octave_value& operator () (octave_idx_type n) { return elem (n); } | |||
const octave_value& operator () (octave_idx_type n) const { return elem ( n); } | const octave_value& operator () (octave_idx_type n) const { return elem ( n); } | |||
octave_idx_type length (void) const { return data.length (); } | octave_idx_type length (void) const { return data.length (); } | |||
bool empty (void) const { return length () == 0; } | bool empty (void) const { return length () == 0; } | |||
void resize (octave_idx_type n, const octave_value& rfv | void resize (octave_idx_type n, const octave_value& rfv = octave_value () | |||
= Array<octave_value>::resize_fill_value ()) | ) | |||
{ | { | |||
data.resize (dim_vector (1, n), rfv); | data.resize (dim_vector (1, n), rfv); | |||
} | } | |||
octave_value_list& prepend (const octave_value& val); | octave_value_list& prepend (const octave_value& val); | |||
octave_value_list& append (const octave_value& val); | octave_value_list& append (const octave_value& val); | |||
octave_value_list& append (const octave_value_list& lst); | octave_value_list& append (const octave_value_list& lst); | |||
octave_value_list& reverse (void); | octave_value_list& reverse (void); | |||
octave_value_list | octave_value_list | |||
slice (octave_idx_type offset, octave_idx_type len, bool tags = false) co nst | slice (octave_idx_type offset, octave_idx_type len, bool tags = false) co nst | |||
{ | { | |||
octave_value_list retval (data.linear_slice (offset, offset + len)); | octave_value_list retval (data.linear_slice (offset, offset + len)); | |||
if (tags && len > 0 && names.length () > 0) | if (tags && len > 0 && names.length () > 0) | |||
retval.names = names.linear_slice (offset, std::min (len, names.len | retval.names = names.linear_slice (offset, | |||
gth ())); | std::min (len, names.length ())); | |||
return retval; | return retval; | |||
} | } | |||
octave_value_list | octave_value_list | |||
splice (octave_idx_type offset, octave_idx_type len, | splice (octave_idx_type offset, octave_idx_type len, | |||
const octave_value_list& lst = octave_value_list ()) const; | const octave_value_list& lst = octave_value_list ()) const; | |||
bool all_strings_p (void) const; | bool all_strings_p (void) const; | |||
bool all_scalars (void) const; | bool all_scalars (void) const; | |||
bool any_cell (void) const; | bool any_cell (void) const; | |||
bool has_magic_colon (void) const; | bool has_magic_colon (void) const; | |||
string_vector make_argv (const std::string& = std::string()) const; | string_vector make_argv (const std::string& = std::string ()) const; | |||
void stash_name_tags (const string_vector& nm) { names = nm; } | void stash_name_tags (const string_vector& nm) { names = nm; } | |||
string_vector name_tags (void) const { return names; } | string_vector name_tags (void) const { return names; } | |||
void make_storable_values (void); | void make_storable_values (void); | |||
octave_value& xelem (octave_idx_type i) | octave_value& xelem (octave_idx_type i) | |||
{ | { | |||
return data.xelem (i); | return data.xelem (i); | |||
} | } | |||
void clear (void) | void clear (void) | |||
{ | { | |||
data.clear (); | data.clear (); | |||
} | } | |||
private: | private: | |||
Array<octave_value> data; | Array<octave_value> data; | |||
// This list of strings can be used to tag each element of data with | // This list of strings can be used to tag each element of data with | |||
// a name. By default, it is empty. | // a name. By default, it is empty. | |||
string_vector names; | string_vector names; | |||
octave_value& elem (octave_idx_type n) | octave_value& elem (octave_idx_type n) | |||
{ | { | |||
if (n >= length ()) | if (n >= length ()) | |||
resize (n + 1); | resize (n + 1); | |||
return data(n); | return data(n); | |||
} | } | |||
const octave_value& elem (octave_idx_type n) const | const octave_value& elem (octave_idx_type n) const | |||
{ return data(n); } | { return data(n); } | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
}; | }; | |||
// Make it easy to build argument lists for built-in functions or for | ||||
// returning values. | ||||
inline octave_value_list | ||||
ovl (const octave_value& a0) | ||||
{ | ||||
octave_value_list retval; | ||||
retval(0) = a0; | ||||
return retval; | ||||
} | ||||
inline octave_value_list | ||||
ovl (const octave_value& a0, const octave_value& a1) | ||||
{ | ||||
octave_value_list retval; | ||||
retval(1) = a1; | ||||
retval(0) = a0; | ||||
return retval; | ||||
} | ||||
inline octave_value_list | ||||
ovl (const octave_value& a0, const octave_value& a1, | ||||
const octave_value& a2) | ||||
{ | ||||
octave_value_list retval; | ||||
retval(2) = a2; | ||||
retval(1) = a1; | ||||
retval(0) = a0; | ||||
return retval; | ||||
} | ||||
inline octave_value_list | ||||
ovl (const octave_value& a0, const octave_value& a1, | ||||
const octave_value& a2, const octave_value& a3) | ||||
{ | ||||
octave_value_list retval; | ||||
retval(3) = a3; | ||||
retval(2) = a2; | ||||
retval(1) = a1; | ||||
retval(0) = a0; | ||||
return retval; | ||||
} | ||||
inline octave_value_list | ||||
ovl (const octave_value& a0, const octave_value& a1, | ||||
const octave_value& a2, const octave_value& a3, | ||||
const octave_value& a4) | ||||
{ | ||||
octave_value_list retval; | ||||
retval(4) = a4; | ||||
retval(3) = a3; | ||||
retval(2) = a2; | ||||
retval(1) = a1; | ||||
retval(0) = a0; | ||||
return retval; | ||||
} | ||||
inline octave_value_list | ||||
ovl (const octave_value& a0, const octave_value& a1, | ||||
const octave_value& a2, const octave_value& a3, | ||||
const octave_value& a4, const octave_value& a5) | ||||
{ | ||||
octave_value_list retval; | ||||
retval(5) = a5; | ||||
retval(4) = a4; | ||||
retval(3) = a3; | ||||
retval(2) = a2; | ||||
retval(1) = a1; | ||||
retval(0) = a0; | ||||
return retval; | ||||
} | ||||
inline octave_value_list | ||||
ovl (const octave_value& a0, const octave_value& a1, | ||||
const octave_value& a2, const octave_value& a3, | ||||
const octave_value& a4, const octave_value& a5, | ||||
const octave_value& a6) | ||||
{ | ||||
octave_value_list retval; | ||||
retval(6) = a6; | ||||
retval(5) = a5; | ||||
retval(4) = a4; | ||||
retval(3) = a3; | ||||
retval(2) = a2; | ||||
retval(1) = a1; | ||||
retval(0) = a0; | ||||
return retval; | ||||
} | ||||
inline octave_value_list | ||||
ovl (const octave_value& a0, const octave_value& a1, | ||||
const octave_value& a2, const octave_value& a3, | ||||
const octave_value& a4, const octave_value& a5, | ||||
const octave_value& a6, const octave_value& a7) | ||||
{ | ||||
octave_value_list retval; | ||||
retval(7) = a7; | ||||
retval(6) = a6; | ||||
retval(5) = a5; | ||||
retval(4) = a4; | ||||
retval(3) = a3; | ||||
retval(2) = a2; | ||||
retval(1) = a1; | ||||
retval(0) = a0; | ||||
return retval; | ||||
} | ||||
inline octave_value_list | ||||
ovl (const octave_value& a0, const octave_value& a1, | ||||
const octave_value& a2, const octave_value& a3, | ||||
const octave_value& a4, const octave_value& a5, | ||||
const octave_value& a6, const octave_value& a7, | ||||
const octave_value& a8) | ||||
{ | ||||
octave_value_list retval; | ||||
retval(8) = a8; | ||||
retval(7) = a7; | ||||
retval(6) = a6; | ||||
retval(5) = a5; | ||||
retval(4) = a4; | ||||
retval(3) = a3; | ||||
retval(2) = a2; | ||||
retval(1) = a1; | ||||
retval(0) = a0; | ||||
return retval; | ||||
} | ||||
inline octave_value_list | ||||
ovl (const octave_value& a0, const octave_value& a1, | ||||
const octave_value& a2, const octave_value& a3, | ||||
const octave_value& a4, const octave_value& a5, | ||||
const octave_value& a6, const octave_value& a7, | ||||
const octave_value& a8, const octave_value& a9) | ||||
{ | ||||
octave_value_list retval; | ||||
retval(9) = a9; | ||||
retval(8) = a8; | ||||
retval(7) = a7; | ||||
retval(6) = a6; | ||||
retval(5) = a5; | ||||
retval(4) = a4; | ||||
retval(3) = a3; | ||||
retval(2) = a2; | ||||
retval(1) = a1; | ||||
retval(0) = a0; | ||||
return retval; | ||||
} | ||||
#endif | #endif | |||
End of changes. 13 change blocks. | ||||
31 lines changed or deleted | 179 lines changed or added | |||
oct-openmp.h | oct-openmp.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2010-2012 David Bateman | Copyright (C) 2010-2013 David Bateman | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_openmp_h) | #if !defined (octave_oct_openmp_h) | |||
#define octave_openmp_h 1 | #define octave_oct_openmp_h 1 | |||
/* A macro to make using OpenMP easier, and easier to disable */ | /* A macro to make using OpenMP easier, and easier to disable */ | |||
#ifdef HAVE_OPENMP | #ifdef HAVE_OPENMP | |||
#include <omp.h> | #include <omp.h> | |||
#define OCTAVE_OMP_PRAGMA(x) _Pragma (#x) | #define OCTAVE_OMP_PRAGMA(x) _Pragma (#x) | |||
#else | #else | |||
#define OCTAVE_OMP_PRAGMA(x) | #define OCTAVE_OMP_PRAGMA(x) | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
oct-passwd.h | oct-passwd.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_passwd_h) | #if !defined (octave_oct_passwd_h) | |||
#define octave_passwd_h 1 | #define octave_oct_passwd_h 1 | |||
#include <string> | #include <string> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
octave_passwd | octave_passwd | |||
{ | { | |||
public: | public: | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
oct-prcstrm.h | oct-prcstrm.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_octave_procstream_h) | #if !defined (octave_oct_prcstrm_h) | |||
#define octave_octave_procstream_h 1 | #define octave_oct_prcstrm_h 1 | |||
#include "oct-stdstrm.h" | #include "oct-stdstrm.h" | |||
// FIXME -- why don't these classes use iprocstream and | // FIXME: why don't these classes use iprocstream and oprocstream, | |||
// oprocstream, which in turn use the octave_procbuf class? | // which in turn use the octave_procbuf class? | |||
class | class | |||
octave_iprocstream : public octave_stdiostream | octave_iprocstream : public octave_stdiostream | |||
{ | { | |||
public: | public: | |||
octave_iprocstream (const std::string& n, | octave_iprocstream (const std::string& n, | |||
std::ios::openmode arg_md = std::ios::in, | std::ios::openmode arg_md = std::ios::in, | |||
oct_mach_info::float_format flt_fmt | oct_mach_info::float_format flt_fmt | |||
= oct_mach_info::native_float_format ()); | = oct_mach_info::native_float_format ()); | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
oct-procbuf.h | oct-procbuf.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 26 | skipping to change at line 26 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
// This class is based on the procbuf class from libg++, written by | // This class is based on the procbuf class from libg++, written by | |||
// Per Bothner, Copyright (C) 1993 Free Software Foundation. | // Per Bothner, Copyright (C) 1993 Free Software Foundation. | |||
#if !defined (octave_octave_procbuf_h) | #if !defined (octave_oct_procbuf_h) | |||
#define octave_octave_procbuf_h 1 | #define octave_oct_procbuf_h 1 | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include "c-file-ptr-stream.h" | #include "c-file-ptr-stream.h" | |||
class | class | |||
octave_procbuf : public c_file_ptr_buf | octave_procbuf : public c_file_ptr_buf | |||
{ | { | |||
public: | public: | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
oct-rand.h | oct-rand.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_rand_h) | #if !defined (octave_oct_rand_h) | |||
#define octave_rand_h 1 | #define octave_oct_rand_h 1 | |||
#include <map> | #include <map> | |||
#include <string> | #include <string> | |||
#include "dColVector.h" | #include "dColVector.h" | |||
#include "dMatrix.h" | ||||
#include "dNDArray.h" | #include "dNDArray.h" | |||
#include "fNDArray.h" | ||||
#include "lo-ieee.h" | #include "lo-ieee.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
octave_rand | octave_rand | |||
{ | { | |||
protected: | protected: | |||
octave_rand (void); | octave_rand (void); | |||
skipping to change at line 139 | skipping to change at line 139 | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_gamma_distribution (); | instance->do_gamma_distribution (); | |||
} | } | |||
// Return the next number from the sequence. | // Return the next number from the sequence. | |||
static double scalar (double a = 1.0) | static double scalar (double a = 1.0) | |||
{ | { | |||
return instance_ok () ? instance->do_scalar (a) : octave_NaN; | return instance_ok () ? instance->do_scalar (a) : octave_NaN; | |||
} | } | |||
// Return a matrix of numbers from the sequence, filled in column | // Return the next number from the sequence. | |||
// major order. | static float float_scalar (float a = 1.0) | |||
static Matrix matrix (octave_idx_type r, octave_idx_type c, double a = 1. | { | |||
0) | return instance_ok () ? instance->do_float_scalar (a) : octave_Float_Na | |||
N; | ||||
} | ||||
// Return an array of numbers from the sequence. | ||||
static Array<double> vector (octave_idx_type n, double a = 1.0) | ||||
{ | ||||
return instance_ok () ? instance->do_vector (n, a) : Array<double> (); | ||||
} | ||||
// Return an array of numbers from the sequence. | ||||
static Array<float> float_vector (octave_idx_type n, float a = 1.0) | ||||
{ | { | |||
return instance_ok () ? instance->do_matrix (r, c, a) : Matrix (); | return instance_ok () ? instance->do_float_vector (n, a) : Array<float> (); | |||
} | } | |||
// Return an N-dimensional array of numbers from the sequence, | // Return an N-dimensional array of numbers from the sequence, | |||
// filled in column major order. | // filled in column major order. | |||
static NDArray nd_array (const dim_vector& dims, double a = 1.0) | static NDArray nd_array (const dim_vector& dims, double a = 1.0) | |||
{ | { | |||
return instance_ok () ? instance->do_nd_array (dims, a) : NDArray (); | return instance_ok () ? instance->do_nd_array (dims, a) : NDArray (); | |||
} | } | |||
// Return an array of numbers from the sequence. | // Return an N-dimensional array of numbers from the sequence, | |||
static Array<double> vector (octave_idx_type n, double a = 1.0) | // filled in column major order. | |||
static FloatNDArray float_nd_array (const dim_vector& dims, float a = 1.0 | ||||
) | ||||
{ | { | |||
return instance_ok () ? instance->do_vector (n, a) : Array<double> (); | return instance_ok () ? instance->do_float_nd_array (dims, a) | |||
: FloatNDArray (); | ||||
} | } | |||
private: | private: | |||
static octave_rand *instance; | static octave_rand *instance; | |||
static void cleanup_instance (void) { delete instance; instance = 0; } | static void cleanup_instance (void) { delete instance; instance = 0; } | |||
enum | enum | |||
{ | { | |||
skipping to change at line 223 | skipping to change at line 236 | |||
void do_exponential_distribution (void); | void do_exponential_distribution (void); | |||
void do_poisson_distribution (void); | void do_poisson_distribution (void); | |||
void do_gamma_distribution (void); | void do_gamma_distribution (void); | |||
// Return the next number from the sequence. | // Return the next number from the sequence. | |||
double do_scalar (double a = 1.); | double do_scalar (double a = 1.); | |||
// Return a matrix of numbers from the sequence, filled in column | // Return the next number from the sequence. | |||
// major order. | float do_float_scalar (float a = 1.); | |||
Matrix do_matrix (octave_idx_type r, octave_idx_type c, double a = 1.); | ||||
// Return an array of numbers from the sequence. | ||||
Array<double> do_vector (octave_idx_type n, double a = 1.); | ||||
// Return an array of numbers from the sequence. | ||||
Array<float> do_float_vector (octave_idx_type n, float a = 1.); | ||||
// Return an N-dimensional array of numbers from the sequence, | // Return an N-dimensional array of numbers from the sequence, | |||
// filled in column major order. | // filled in column major order. | |||
NDArray do_nd_array (const dim_vector& dims, double a = 1.); | NDArray do_nd_array (const dim_vector& dims, double a = 1.); | |||
// Return an array of numbers from the sequence. | // Return an N-dimensional array of numbers from the sequence, | |||
Array<double> do_vector (octave_idx_type n, double a = 1.); | // filled in column major order. | |||
FloatNDArray do_float_nd_array (const dim_vector& dims, float a = 1.); | ||||
// Some helper functions. | // Some helper functions. | |||
void initialize_ranlib_generators (void); | void initialize_ranlib_generators (void); | |||
void initialize_mersenne_twister (void); | void initialize_mersenne_twister (void); | |||
ColumnVector get_internal_state (void); | ColumnVector get_internal_state (void); | |||
void save_state (void); | void save_state (void); | |||
int get_dist_id (const std::string& d); | int get_dist_id (const std::string& d); | |||
void set_internal_state (const ColumnVector& s); | void set_internal_state (const ColumnVector& s); | |||
void switch_to_generator (int dist); | void switch_to_generator (int dist); | |||
void fill (octave_idx_type len, double *v, double a); | void fill (octave_idx_type len, double *v, double a); | |||
void fill (octave_idx_type len, float *v, float a); | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
17 lines changed or deleted | 39 lines changed or added | |||
oct-refcount.h | oct-refcount.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2012 Jaroslav Hajek | Copyright (C) 2012-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_refcount_h) | #if !defined (octave_oct_refcount_h) | |||
#define octave_refcount_h 1 | #define octave_oct_refcount_h 1 | |||
#ifndef OCTAVE_CONFIG_INCLUDED | #ifndef OCTAVE_CONFIG_INCLUDED | |||
# error "The file <octave/config.h> must be included before oct-refcount.h. " | # error "The file <octave/config.h> must be included before oct-refcount.h. " | |||
#endif | #endif | |||
#if defined (USE_ATOMIC_REFCOUNT) && (defined (_MSC_VER) || defined (__GNUC __)) | #if defined (USE_ATOMIC_REFCOUNT) && (defined (_MSC_VER) || defined (__GNUC __)) | |||
# if defined (_MSC_VER) | # if defined (_MSC_VER) | |||
# include <intrin.h> | # include <intrin.h> | |||
# define OCTREFCOUNT_ATOMIC_INCREMENT(x) _InterlockedIncrement((long*)x) | # define OCTREFCOUNT_ATOMIC_INCREMENT(x) _InterlockedIncrement((long*)x) | |||
# define OCTREFCOUNT_ATOMIC_DECREMENT(x) _InterlockedDecrement((long*)x) | # define OCTREFCOUNT_ATOMIC_DECREMENT(x) _InterlockedDecrement((long*)x) | |||
skipping to change at line 57 | skipping to change at line 57 | |||
# define OCTREFCOUNT_ATOMIC_DECREMENT_POST(x) (*(x))-- | # define OCTREFCOUNT_ATOMIC_DECREMENT_POST(x) (*(x))-- | |||
#endif | #endif | |||
// Encapsulates a reference counter. | // Encapsulates a reference counter. | |||
template <class T> | template <class T> | |||
class octave_refcount | class octave_refcount | |||
{ | { | |||
public: | public: | |||
typedef T count_type; | typedef T count_type; | |||
octave_refcount(count_type initial_count) : count(initial_count) {} | octave_refcount(count_type initial_count) : count(initial_count) { } | |||
// Increment/Decrement. int is postfix. | // Increment/Decrement. int is postfix. | |||
count_type operator++(void) | count_type operator++(void) | |||
{ | { | |||
return OCTREFCOUNT_ATOMIC_INCREMENT (&count); | return OCTREFCOUNT_ATOMIC_INCREMENT (&count); | |||
} | } | |||
count_type operator++(int) | count_type operator++(int) | |||
{ | { | |||
return OCTREFCOUNT_ATOMIC_INCREMENT_POST (&count); | return OCTREFCOUNT_ATOMIC_INCREMENT_POST (&count); | |||
} | } | |||
count_type operator--(void) | count_type operator--(void) | |||
{ | { | |||
return OCTREFCOUNT_ATOMIC_DECREMENT (&count); | return OCTREFCOUNT_ATOMIC_DECREMENT (&count); | |||
} | } | |||
count_type operator--(int) | count_type operator--(int) | |||
{ | { | |||
return OCTREFCOUNT_ATOMIC_DECREMENT_POST (&count); | return OCTREFCOUNT_ATOMIC_DECREMENT_POST (&count); | |||
} | } | |||
operator count_type (void) const | operator count_type (void) const | |||
{ | { | |||
return static_cast<count_type const volatile&> (count); | return static_cast<count_type const volatile&> (count); | |||
} | } | |||
count_type *get (void) | ||||
{ | ||||
return &count; | ||||
} | ||||
private: | private: | |||
count_type count; | count_type count; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
19 lines changed or deleted | 24 lines changed or added | |||
oct-rl-edit.h | oct-rl-edit.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2000-2012 John W. Eaton | Copyright (C) 2000-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_rl_edit_h) | #if !defined (octave_oct_rl_edit_h) | |||
#define octave_rl_edit_h 1 | #define octave_oct_rl_edit_h 1 | |||
typedef int (*rl_startup_hook_fcn_ptr) (void); | typedef int (*rl_startup_hook_fcn_ptr) (void); | |||
typedef int (*rl_pre_input_hook_fcn_ptr) (void); | ||||
typedef int (*rl_event_hook_fcn_ptr) (void); | typedef int (*rl_event_hook_fcn_ptr) (void); | |||
typedef int (*rl_fcn_ptr) (int, int); | typedef int (*rl_fcn_ptr) (int, int); | |||
typedef char ** (*rl_attempted_completion_fcn_ptr) (const char *, int, int) ; | typedef char ** (*rl_attempted_completion_fcn_ptr) (const char *, int, int) ; | |||
typedef char * (*rl_completer_fcn_ptr) (const char *, int); | typedef char * (*rl_completer_fcn_ptr) (const char *, int); | |||
typedef char * (*rl_quoting_fcn_ptr) (char *, int, char *); | typedef char * (*rl_quoting_fcn_ptr) (char *, int, char *); | |||
skipping to change at line 49 | skipping to change at line 51 | |||
typedef int (*rl_char_is_quoted_fcn_ptr) (char *, int); | typedef int (*rl_char_is_quoted_fcn_ptr) (char *, int); | |||
typedef int (*rl_command_fcn_ptr) (int, int); | typedef int (*rl_command_fcn_ptr) (int, int); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" | extern "C" | |||
{ | { | |||
#endif | #endif | |||
extern void octave_rl_redisplay (void); | extern void octave_rl_redisplay (void); | |||
extern int octave_rl_screen_height (void); | extern int octave_rl_screen_height (void); | |||
extern int octave_rl_screen_width (void); | extern int octave_rl_screen_width (void); | |||
extern void octave_rl_enable_paren_matching (int); | extern void octave_rl_enable_paren_matching (int); | |||
extern void octave_rl_init (void); | extern void octave_rl_init (void); | |||
extern void octave_rl_clear_screen (void); | extern void octave_rl_clear_screen (int skip_redisplay); | |||
extern void octave_rl_resize_terminal (void); | extern void octave_rl_resize_terminal (void); | |||
extern void octave_rl_restore_terminal_state (void); | extern void octave_rl_restore_terminal_state (void); | |||
extern char *octave_rl_copy_line (void); | ||||
extern void octave_rl_replace_line (const char *s, int clear_undo); | ||||
extern void octave_rl_insert_text (const char *); | extern void octave_rl_insert_text (const char *); | |||
extern int octave_rl_newline (int, int); | extern int octave_rl_newline (int, int); | |||
extern const char *octave_rl_line_buffer (void); | extern const char *octave_rl_line_buffer (void); | |||
extern int octave_rl_do_undo (void); | ||||
extern void octave_rl_clear_undo_list (void); | extern void octave_rl_clear_undo_list (void); | |||
extern void octave_rl_set_name (const char *); | extern void octave_rl_set_name (const char *); | |||
extern char *octave_rl_readline (const char *); | extern char *octave_rl_readline (const char *); | |||
extern void octave_rl_set_input_stream (FILE *); | extern void octave_rl_set_input_stream (FILE *); | |||
extern FILE *octave_rl_get_input_stream (void); | extern FILE *octave_rl_get_input_stream (void); | |||
skipping to change at line 93 | skipping to change at line 101 | |||
extern FILE *octave_rl_get_output_stream (void); | extern FILE *octave_rl_get_output_stream (void); | |||
extern void octave_rl_read_init_file (const char *); | extern void octave_rl_read_init_file (const char *); | |||
extern void octave_rl_re_read_init_file (void); | extern void octave_rl_re_read_init_file (void); | |||
extern int octave_rl_filename_completion_desired (int); | extern int octave_rl_filename_completion_desired (int); | |||
extern int octave_rl_filename_quoting_desired (int); | extern int octave_rl_filename_quoting_desired (int); | |||
extern void octave_rl_done (int); | ||||
extern char *octave_rl_filename_completion_function (const char *, int); | extern char *octave_rl_filename_completion_function (const char *, int); | |||
extern void octave_rl_set_basic_word_break_characters (const char *); | extern void octave_rl_set_basic_word_break_characters (const char *); | |||
extern void octave_rl_set_completer_word_break_characters (const char *); | extern void octave_rl_set_completer_word_break_characters (const char *); | |||
extern void octave_rl_set_basic_quote_characters (const char *); | extern void octave_rl_set_basic_quote_characters (const char *); | |||
extern void octave_rl_set_filename_quote_characters (const char *); | extern void octave_rl_set_filename_quote_characters (const char *); | |||
skipping to change at line 122 | skipping to change at line 132 | |||
extern void | extern void | |||
octave_rl_set_dequoting_function (rl_dequoting_fcn_ptr); | octave_rl_set_dequoting_function (rl_dequoting_fcn_ptr); | |||
extern void octave_rl_set_char_is_quoted_function (rl_char_is_quoted_fcn_pt r); | extern void octave_rl_set_char_is_quoted_function (rl_char_is_quoted_fcn_pt r); | |||
extern void octave_rl_set_startup_hook (rl_startup_hook_fcn_ptr); | extern void octave_rl_set_startup_hook (rl_startup_hook_fcn_ptr); | |||
extern rl_startup_hook_fcn_ptr octave_rl_get_startup_hook (void); | extern rl_startup_hook_fcn_ptr octave_rl_get_startup_hook (void); | |||
extern void octave_rl_set_pre_input_hook (rl_startup_hook_fcn_ptr); | ||||
extern rl_pre_input_hook_fcn_ptr octave_rl_get_pre_input_hook (void); | ||||
extern void octave_rl_set_event_hook (rl_event_hook_fcn_ptr f); | extern void octave_rl_set_event_hook (rl_event_hook_fcn_ptr f); | |||
extern rl_event_hook_fcn_ptr octave_rl_get_event_hook (void); | extern rl_event_hook_fcn_ptr octave_rl_get_event_hook (void); | |||
extern char ** | extern char ** | |||
octave_rl_completion_matches (const char *, rl_completer_fcn_ptr); | octave_rl_completion_matches (const char *, rl_completer_fcn_ptr); | |||
extern char octave_rl_prompt_start_ignore (void); | extern char octave_rl_prompt_start_ignore (void); | |||
extern char octave_rl_prompt_end_ignore (void); | extern char octave_rl_prompt_end_ignore (void); | |||
End of changes. 9 change blocks. | ||||
5 lines changed or deleted | 19 lines changed or added | |||
oct-rl-hist.h | oct-rl-hist.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2000-2012 John W. Eaton | Copyright (C) 2000-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_rl_hist_h) | #if !defined (octave_oct_rl_hist_h) | |||
#define octave_rl_hist_h 1 | #define octave_oct_rl_hist_h 1 | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" | extern "C" | |||
{ | { | |||
#endif | #endif | |||
enum { | enum { | |||
HC_IGNSPACE = 0x01, | HC_IGNSPACE = 0x01, | |||
HC_IGNDUPS = 0x02, | HC_IGNDUPS = 0x02, | |||
HC_ERASEDUPS = 0x04 | HC_ERASEDUPS = 0x04 | |||
skipping to change at line 69 | skipping to change at line 69 | |||
extern int octave_read_history_range (const char *, int, int); | extern int octave_read_history_range (const char *, int, int); | |||
extern int octave_write_history (const char *); | extern int octave_write_history (const char *); | |||
extern int octave_append_history (int, const char *); | extern int octave_append_history (int, const char *); | |||
extern int octave_history_truncate_file (const char *, int); | extern int octave_history_truncate_file (const char *, int); | |||
extern void octave_remove_history (int); | extern void octave_remove_history (int); | |||
extern void octave_clear_history (void); | ||||
extern char *octave_history_goto_mark (int n); | extern char *octave_history_goto_mark (int n); | |||
extern char *octave_history_get (int n); | extern char *octave_history_get (int n); | |||
extern char **octave_history_list (int, int); | extern char **octave_history_list (int, int); | |||
extern void octave_replace_history_entry (int, const char *); | extern void octave_replace_history_entry (int, const char *); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 5 lines changed or added | |||
oct-shlib.h | oct-shlib.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1999-2012 John W. Eaton | Copyright (C) 1999-2013 John W. Eaton | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_shlib_h) | #if !defined (octave_oct_shlib_h) | |||
#define octave_shlib_h 1 | #define octave_oct_shlib_h 1 | |||
#include <string> | #include <string> | |||
#include <map> | #include <map> | |||
#include "oct-time.h" | #include "oct-time.h" | |||
#include "oct-refcount.h" | #include "oct-refcount.h" | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
octave_shlib | octave_shlib | |||
skipping to change at line 56 | skipping to change at line 56 | |||
shlib_rep (void) | shlib_rep (void) | |||
: count (1), file (), tm_loaded (time_t ()), fcn_names () { } | : count (1), file (), tm_loaded (time_t ()), fcn_names () { } | |||
protected: | protected: | |||
shlib_rep (const std::string& f); | shlib_rep (const std::string& f); | |||
public: | public: | |||
virtual ~shlib_rep (void) | virtual ~shlib_rep (void) | |||
{ | { | |||
instances.erase (file); | instances.erase (file); | |||
} | } | |||
virtual bool is_open (void) const | virtual bool is_open (void) const | |||
{ return false; } | { return false; } | |||
virtual void *search (const std::string&, name_mangler = 0) | virtual void *search (const std::string&, name_mangler = 0) | |||
{ return 0; } | { return 0; } | |||
bool is_out_of_date (void) const; | bool is_out_of_date (void) const; | |||
// This method will be overriden conditionally. | // This method will be overriden conditionally. | |||
static shlib_rep *new_instance (const std::string& f); | static shlib_rep *new_instance (const std::string& f); | |||
static shlib_rep *get_instance (const std::string& f, bool fake); | static shlib_rep *get_instance (const std::string& f, bool fake); | |||
octave_time time_loaded (void) const | octave_time time_loaded (void) const | |||
{ return tm_loaded; } | { return tm_loaded; } | |||
std::string file_name (void) const | std::string file_name (void) const | |||
{ return file; } | { return file; } | |||
size_t num_fcn_names (void) const { return fcn_names.size (); } | size_t num_fcn_names (void) const { return fcn_names.size (); } | |||
void add_fcn_name (const std::string&); | void add_fcn_name (const std::string&); | |||
bool remove_fcn_name (const std::string&); | bool remove_fcn_name (const std::string&); | |||
void do_close_hook (close_hook cl_hook); | void do_close_hook (close_hook cl_hook); | |||
public: | public: | |||
skipping to change at line 119 | skipping to change at line 119 | |||
static shlib_rep nil_rep; | static shlib_rep nil_rep; | |||
public: | public: | |||
octave_shlib (void) : rep (&nil_rep) { rep->count++; } | octave_shlib (void) : rep (&nil_rep) { rep->count++; } | |||
octave_shlib (const std::string& f, bool fake = true) | octave_shlib (const std::string& f, bool fake = true) | |||
: rep (shlib_rep::get_instance (f, fake)) { } | : rep (shlib_rep::get_instance (f, fake)) { } | |||
~octave_shlib (void) | ~octave_shlib (void) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
} | } | |||
octave_shlib (const octave_shlib& sl) | octave_shlib (const octave_shlib& sl) | |||
: rep (sl.rep) | : rep (sl.rep) | |||
{ | { | |||
rep->count++; | rep->count++; | |||
} | } | |||
octave_shlib& operator = (const octave_shlib& sl) | octave_shlib& operator = (const octave_shlib& sl) | |||
{ | { | |||
if (rep != sl.rep) | if (rep != sl.rep) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = sl.rep; | ||||
rep->count++; | ||||
} | ||||
return *this; | rep = sl.rep; | |||
} | rep->count++; | |||
} | ||||
return *this; | ||||
} | ||||
bool operator == (const octave_shlib& sl) const | bool operator == (const octave_shlib& sl) const | |||
{ return (rep == sl.rep); } | { return (rep == sl.rep); } | |||
operator bool () const { return rep->is_open (); } | operator bool () const { return rep->is_open (); } | |||
void open (const std::string& f) | void open (const std::string& f) | |||
{ *this = octave_shlib (f); } | { *this = octave_shlib (f); } | |||
void close (close_hook cl_hook = 0) | void close (close_hook cl_hook = 0) | |||
{ | { | |||
if (cl_hook) | if (cl_hook) | |||
rep->do_close_hook (cl_hook); | rep->do_close_hook (cl_hook); | |||
*this = octave_shlib (); | *this = octave_shlib (); | |||
} | } | |||
void *search (const std::string& nm, name_mangler mangler = 0) const | void *search (const std::string& nm, name_mangler mangler = 0) const | |||
{ | { | |||
void *f = rep->search (nm, mangler); | void *f = rep->search (nm, mangler); | |||
if (f) | if (f) | |||
rep->add_fcn_name (nm); | rep->add_fcn_name (nm); | |||
return f; | return f; | |||
} | } | |||
void add (const std::string& name) | void add (const std::string& name) | |||
{ rep->add_fcn_name (name); } | { rep->add_fcn_name (name); } | |||
bool remove (const std::string& name) | bool remove (const std::string& name) | |||
{ return rep->remove_fcn_name (name); } | { return rep->remove_fcn_name (name); } | |||
size_t number_of_functions_loaded (void) const | size_t number_of_functions_loaded (void) const | |||
{ return rep->num_fcn_names (); } | { return rep->num_fcn_names (); } | |||
bool is_out_of_date (void) const | bool is_out_of_date (void) const | |||
{ return rep->is_out_of_date (); } | { return rep->is_out_of_date (); } | |||
std::string file_name (void) const | std::string file_name (void) const | |||
{ return rep->file_name (); } | { return rep->file_name (); } | |||
octave_time time_loaded (void) const | octave_time time_loaded (void) const | |||
{ return rep->time_loaded (); } | { return rep->time_loaded (); } | |||
private: | private: | |||
shlib_rep *rep; | shlib_rep *rep; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 23 change blocks. | ||||
47 lines changed or deleted | 47 lines changed or added | |||
oct-sort.cc | oct-sort.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 David Bateman | Copyright (C) 2003-2013 David Bateman | |||
Copyright (C) 2008-2009 Jaroslav Hajek | Copyright (C) 2008-2009 Jaroslav Hajek | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
skipping to change at line 261 | skipping to change at line 261 | |||
For its intended use in a stable mergesort, the strictness of the defn of | For its intended use in a stable mergesort, the strictness of the defn of | |||
"descending" is needed so that the caller can safely reverse a descending | "descending" is needed so that the caller can safely reverse a descending | |||
sequence without violating stability (strict > ensures there are no equal | sequence without violating stability (strict > ensures there are no equal | |||
elements to get out of order). | elements to get out of order). | |||
Returns -1 in case of error. | Returns -1 in case of error. | |||
*/ | */ | |||
template <class T> | template <class T> | |||
template <class Comp> | template <class Comp> | |||
octave_idx_type | octave_idx_type | |||
octave_sort<T>::count_run (T *lo, octave_idx_type nel, bool& descending, Co | octave_sort<T>::count_run (T *lo, octave_idx_type nel, bool& descending, | |||
mp comp) | Comp comp) | |||
{ | { | |||
octave_idx_type n; | octave_idx_type n; | |||
T *hi = lo + nel; | T *hi = lo + nel; | |||
descending = false; | descending = false; | |||
++lo; | ++lo; | |||
if (lo == hi) | if (lo == hi) | |||
return 1; | return 1; | |||
n = 2; | n = 2; | |||
skipping to change at line 320 | skipping to change at line 321 | |||
pretending that *(a-1) is minus infinity and a[n] is plus infinity. IOW, | pretending that *(a-1) is minus infinity and a[n] is plus infinity. IOW, | |||
key belongs at index k; or, IOW, the first k elements of a should precede | key belongs at index k; or, IOW, the first k elements of a should precede | |||
key, and the last n-k should follow key. | key, and the last n-k should follow key. | |||
Returns -1 on error. See listsort.txt for info on the method. | Returns -1 on error. See listsort.txt for info on the method. | |||
*/ | */ | |||
template <class T> | template <class T> | |||
template <class Comp> | template <class Comp> | |||
octave_idx_type | octave_idx_type | |||
octave_sort<T>::gallop_left (T key, T *a, octave_idx_type n, octave_idx_typ | octave_sort<T>::gallop_left (T key, T *a, octave_idx_type n, | |||
e hint, | octave_idx_type hint, | |||
Comp comp) | Comp comp) | |||
{ | { | |||
octave_idx_type ofs; | octave_idx_type ofs; | |||
octave_idx_type lastofs; | octave_idx_type lastofs; | |||
octave_idx_type k; | octave_idx_type k; | |||
a += hint; | a += hint; | |||
lastofs = 0; | lastofs = 0; | |||
ofs = 1; | ofs = 1; | |||
if (comp (*a, key)) | if (comp (*a, key)) | |||
skipping to change at line 414 | skipping to change at line 416 | |||
or -1 if error. | or -1 if error. | |||
The code duplication is massive, but this is enough different given that | The code duplication is massive, but this is enough different given that | |||
we're sticking to "<" comparisons that it's much harder to follow if | we're sticking to "<" comparisons that it's much harder to follow if | |||
written as one routine with yet another "left or right?" flag. | written as one routine with yet another "left or right?" flag. | |||
*/ | */ | |||
template <class T> | template <class T> | |||
template <class Comp> | template <class Comp> | |||
octave_idx_type | octave_idx_type | |||
octave_sort<T>::gallop_right (T key, T *a, octave_idx_type n, octave_idx_ty | octave_sort<T>::gallop_right (T key, T *a, octave_idx_type n, | |||
pe hint, | octave_idx_type hint, | |||
Comp comp) | Comp comp) | |||
{ | { | |||
octave_idx_type ofs; | octave_idx_type ofs; | |||
octave_idx_type lastofs; | octave_idx_type lastofs; | |||
octave_idx_type k; | octave_idx_type k; | |||
a += hint; | a += hint; | |||
lastofs = 0; | lastofs = 0; | |||
ofs = 1; | ofs = 1; | |||
if (comp (key, *a)) | if (comp (key, *a)) | |||
skipping to change at line 544 | skipping to change at line 547 | |||
{ | { | |||
if (need <= alloced) | if (need <= alloced) | |||
return; | return; | |||
need = roundupsize (need); | need = roundupsize (need); | |||
/* Don't realloc! That can cost cycles to copy the old data, but | /* Don't realloc! That can cost cycles to copy the old data, but | |||
* we don't care what's in the block. | * we don't care what's in the block. | |||
*/ | */ | |||
delete [] a; | delete [] a; | |||
delete [] ia; // Must do this or fool possible next getmemi. | delete [] ia; // Must do this or fool possible next getmemi. | |||
a = new T[need]; | a = new T [need]; | |||
alloced = need; | alloced = need; | |||
} | } | |||
template <class T> | template <class T> | |||
void | void | |||
octave_sort<T>::MergeState::getmemi (octave_idx_type need) | octave_sort<T>::MergeState::getmemi (octave_idx_type need) | |||
{ | { | |||
if (ia && need <= alloced) | if (ia && need <= alloced) | |||
return; | return; | |||
need = roundupsize (need); | need = roundupsize (need); | |||
/* Don't realloc! That can cost cycles to copy the old data, but | /* Don't realloc! That can cost cycles to copy the old data, but | |||
* we don't care what's in the block. | * we don't care what's in the block. | |||
*/ | */ | |||
delete [] a; | delete [] a; | |||
delete [] ia; | delete [] ia; | |||
a = new T[need]; | a = new T [need]; | |||
ia = new octave_idx_type[need]; | ia = new octave_idx_type [need]; | |||
alloced = need; | alloced = need; | |||
} | } | |||
/* Merge the na elements starting at pa with the nb elements starting at pb | /* Merge the na elements starting at pa with the nb elements starting at pb | |||
* in a stable way, in-place. na and nb must be > 0, and pa + na == pb. | * in a stable way, in-place. na and nb must be > 0, and pa + na == pb. | |||
* Must also have that *pb < *pa, that pa[na-1] belongs at the end of the | * Must also have that *pb < *pa, that pa[na-1] belongs at the end of the | |||
* merge, and should have na <= nb. See listsort.txt for more info. | * merge, and should have na <= nb. See listsort.txt for more info. | |||
* Return 0 if successful, -1 if error. | * Return 0 if successful, -1 if error. | |||
*/ | */ | |||
template <class T> | template <class T> | |||
skipping to change at line 693 | skipping to change at line 696 | |||
--na; | --na; | |||
if (na == 1) | if (na == 1) | |||
goto CopyB; | goto CopyB; | |||
} | } | |||
while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); | while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); | |||
++min_gallop; /* penalize it for leaving galloping mode */ | ++min_gallop; /* penalize it for leaving galloping mode */ | |||
ms->min_gallop = min_gallop; | ms->min_gallop = min_gallop; | |||
} | } | |||
Succeed: | Succeed: | |||
result = 0; | result = 0; | |||
Fail: | Fail: | |||
if (na) | if (na) | |||
std::copy (pa, pa + na, dest); | std::copy (pa, pa + na, dest); | |||
return result; | return result; | |||
CopyB: | CopyB: | |||
/* The last element of pa belongs at the end of the merge. */ | /* The last element of pa belongs at the end of the merge. */ | |||
std::copy (pb, pb + nb, dest); | std::copy (pb, pb + nb, dest); | |||
dest[nb] = *pa; | dest[nb] = *pa; | |||
return 0; | return 0; | |||
} | } | |||
template <class T> | template <class T> | |||
template <class Comp> | template <class Comp> | |||
int | int | |||
skipping to change at line 829 | skipping to change at line 832 | |||
--na; | --na; | |||
if (na == 1) | if (na == 1) | |||
goto CopyB; | goto CopyB; | |||
} | } | |||
while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); | while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); | |||
++min_gallop; /* penalize it for leaving galloping mode */ | ++min_gallop; /* penalize it for leaving galloping mode */ | |||
ms->min_gallop = min_gallop; | ms->min_gallop = min_gallop; | |||
} | } | |||
Succeed: | Succeed: | |||
result = 0; | result = 0; | |||
Fail: | Fail: | |||
if (na) | if (na) | |||
{ | { | |||
std::copy (pa, pa + na, dest); | std::copy (pa, pa + na, dest); | |||
std::copy (ipa, ipa + na, idest); | std::copy (ipa, ipa + na, idest); | |||
} | } | |||
return result; | return result; | |||
CopyB: | CopyB: | |||
/* The last element of pa belongs at the end of the merge. */ | /* The last element of pa belongs at the end of the merge. */ | |||
std::copy (pb, pb + nb, dest); | std::copy (pb, pb + nb, dest); | |||
std::copy (ipb, ipb + nb, idest); | std::copy (ipb, ipb + nb, idest); | |||
dest[nb] = *pa; | dest[nb] = *pa; | |||
idest[nb] = *ipa; | idest[nb] = *ipa; | |||
return 0; | return 0; | |||
} | } | |||
/* Merge the na elements starting at pa with the nb elements starting at pb | /* Merge the na elements starting at pa with the nb elements starting at pb | |||
skipping to change at line 1186 | skipping to change at line 1189 | |||
return 0; | return 0; | |||
/* Where does a end in b? Elements in b after that can be | /* Where does a end in b? Elements in b after that can be | |||
* ignored (already in place). | * ignored (already in place). | |||
*/ | */ | |||
nb = gallop_left (pa[na-1], pb, nb, nb-1, comp); | nb = gallop_left (pa[na-1], pb, nb, nb-1, comp); | |||
if (nb <= 0) | if (nb <= 0) | |||
return nb; | return nb; | |||
/* Merge what remains of the runs, using a temp array with | /* Merge what remains of the runs, using a temp array with | |||
* min(na, nb) elements. | * min (na, nb) elements. | |||
*/ | */ | |||
if (na <= nb) | if (na <= nb) | |||
return merge_lo (pa, na, pb, nb, comp); | return merge_lo (pa, na, pb, nb, comp); | |||
else | else | |||
return merge_hi (pa, na, pb, nb, comp); | return merge_hi (pa, na, pb, nb, comp); | |||
} | } | |||
template <class T> | template <class T> | |||
template <class Comp> | template <class Comp> | |||
int | int | |||
skipping to change at line 1240 | skipping to change at line 1243 | |||
return 0; | return 0; | |||
/* Where does a end in b? Elements in b after that can be | /* Where does a end in b? Elements in b after that can be | |||
* ignored (already in place). | * ignored (already in place). | |||
*/ | */ | |||
nb = gallop_left (pa[na-1], pb, nb, nb-1, comp); | nb = gallop_left (pa[na-1], pb, nb, nb-1, comp); | |||
if (nb <= 0) | if (nb <= 0) | |||
return nb; | return nb; | |||
/* Merge what remains of the runs, using a temp array with | /* Merge what remains of the runs, using a temp array with | |||
* min(na, nb) elements. | * min (na, nb) elements. | |||
*/ | */ | |||
if (na <= nb) | if (na <= nb) | |||
return merge_lo (pa, ipa, na, pb, ipb, nb, comp); | return merge_lo (pa, ipa, na, pb, ipb, nb, comp); | |||
else | else | |||
return merge_hi (pa, ipa, na, pb, ipb, nb, comp); | return merge_hi (pa, ipa, na, pb, ipb, nb, comp); | |||
} | } | |||
/* Examine the stack of runs waiting to be merged, merging adjacent runs | /* Examine the stack of runs waiting to be merged, merging adjacent runs | |||
* until the stack invariants are re-established: | * until the stack invariants are re-established: | |||
* | * | |||
skipping to change at line 1415 | skipping to change at line 1418 | |||
{ | { | |||
bool descending; | bool descending; | |||
octave_idx_type n; | octave_idx_type n; | |||
/* Identify next run. */ | /* Identify next run. */ | |||
n = count_run (data + lo, nremaining, descending, comp); | n = count_run (data + lo, nremaining, descending, comp); | |||
if (n < 0) | if (n < 0) | |||
goto fail; | goto fail; | |||
if (descending) | if (descending) | |||
std::reverse (data + lo, data + lo + n); | std::reverse (data + lo, data + lo + n); | |||
/* If short, extend to min(minrun, nremaining). */ | /* If short, extend to min (minrun, nremaining). */ | |||
if (n < minrun) | if (n < minrun) | |||
{ | { | |||
const octave_idx_type force = nremaining <= minrun ? nremaini | const octave_idx_type force = nremaining <= minrun ? nremaini | |||
ng : minrun; | ng | |||
: minrun; | ||||
binarysort (data + lo, force, n, comp); | binarysort (data + lo, force, n, comp); | |||
n = force; | n = force; | |||
} | } | |||
/* Push run onto pending-runs stack, and maybe merge. */ | /* Push run onto pending-runs stack, and maybe merge. */ | |||
assert (ms->n < MAX_MERGE_PENDING); | assert (ms->n < MAX_MERGE_PENDING); | |||
ms->pending[ms->n].base = lo; | ms->pending[ms->n].base = lo; | |||
ms->pending[ms->n].len = n; | ms->pending[ms->n].len = n; | |||
ms->n++; | ms->n++; | |||
if (merge_collapse (data, comp) < 0) | if (merge_collapse (data, comp) < 0) | |||
goto fail; | goto fail; | |||
skipping to change at line 1477 | skipping to change at line 1481 | |||
/* Identify next run. */ | /* Identify next run. */ | |||
n = count_run (data + lo, nremaining, descending, comp); | n = count_run (data + lo, nremaining, descending, comp); | |||
if (n < 0) | if (n < 0) | |||
goto fail; | goto fail; | |||
if (descending) | if (descending) | |||
{ | { | |||
std::reverse (data + lo, data + lo + n); | std::reverse (data + lo, data + lo + n); | |||
std::reverse (idx + lo, idx + lo + n); | std::reverse (idx + lo, idx + lo + n); | |||
} | } | |||
/* If short, extend to min(minrun, nremaining). */ | /* If short, extend to min (minrun, nremaining). */ | |||
if (n < minrun) | if (n < minrun) | |||
{ | { | |||
const octave_idx_type force = nremaining <= minrun ? nremaini | const octave_idx_type force = nremaining <= minrun ? nremaini | |||
ng : minrun; | ng | |||
: minrun; | ||||
binarysort (data + lo, idx + lo, force, n, comp); | binarysort (data + lo, idx + lo, force, n, comp); | |||
n = force; | n = force; | |||
} | } | |||
/* Push run onto pending-runs stack, and maybe merge. */ | /* Push run onto pending-runs stack, and maybe merge. */ | |||
assert (ms->n < MAX_MERGE_PENDING); | assert (ms->n < MAX_MERGE_PENDING); | |||
ms->pending[ms->n].base = lo; | ms->pending[ms->n].base = lo; | |||
ms->pending[ms->n].len = n; | ms->pending[ms->n].len = n; | |||
ms->n++; | ms->n++; | |||
if (merge_collapse (data, idx, comp) < 0) | if (merge_collapse (data, idx, comp) < 0) | |||
goto fail; | goto fail; | |||
skipping to change at line 1516 | skipping to change at line 1521 | |||
octave_sort<T>::sort (T *data, octave_idx_type nel) | octave_sort<T>::sort (T *data, octave_idx_type nel) | |||
{ | { | |||
#ifdef INLINE_ASCENDING_SORT | #ifdef INLINE_ASCENDING_SORT | |||
if (compare == ascending_compare) | if (compare == ascending_compare) | |||
sort (data, nel, std::less<T> ()); | sort (data, nel, std::less<T> ()); | |||
else | else | |||
#endif | #endif | |||
#ifdef INLINE_DESCENDING_SORT | #ifdef INLINE_DESCENDING_SORT | |||
if (compare == descending_compare) | if (compare == descending_compare) | |||
sort (data, nel, std::greater<T> ()); | sort (data, nel, std::greater<T> ()); | |||
else | else | |||
#endif | #endif | |||
if (compare) | if (compare) | |||
sort (data, nel, compare); | sort (data, nel, compare); | |||
} | } | |||
template <class T> | template <class T> | |||
void | void | |||
octave_sort<T>::sort (T *data, octave_idx_type *idx, octave_idx_type nel) | octave_sort<T>::sort (T *data, octave_idx_type *idx, octave_idx_type nel) | |||
{ | { | |||
#ifdef INLINE_ASCENDING_SORT | #ifdef INLINE_ASCENDING_SORT | |||
if (compare == ascending_compare) | if (compare == ascending_compare) | |||
sort (data, idx, nel, std::less<T> ()); | sort (data, idx, nel, std::less<T> ()); | |||
else | else | |||
#endif | #endif | |||
#ifdef INLINE_DESCENDING_SORT | #ifdef INLINE_DESCENDING_SORT | |||
if (compare == descending_compare) | if (compare == descending_compare) | |||
sort (data, idx, nel, std::greater<T> ()); | sort (data, idx, nel, std::greater<T> ()); | |||
else | else | |||
#endif | #endif | |||
if (compare) | if (compare) | |||
sort (data, idx, nel, compare); | sort (data, idx, nel, compare); | |||
} | } | |||
template <class T> template <class Comp> | template <class T> template <class Comp> | |||
bool | bool | |||
octave_sort<T>::is_sorted (const T *data, octave_idx_type nel, Comp comp) | octave_sort<T>::is_sorted (const T *data, octave_idx_type nel, Comp comp) | |||
{ | { | |||
const T *end = data + nel; | const T *end = data + nel; | |||
if (data != end) | if (data != end) | |||
{ | { | |||
const T *next = data; | const T *next = data; | |||
skipping to change at line 1573 | skipping to change at line 1578 | |||
{ | { | |||
bool retval = false; | bool retval = false; | |||
#ifdef INLINE_ASCENDING_SORT | #ifdef INLINE_ASCENDING_SORT | |||
if (compare == ascending_compare) | if (compare == ascending_compare) | |||
retval = is_sorted (data, nel, std::less<T> ()); | retval = is_sorted (data, nel, std::less<T> ()); | |||
else | else | |||
#endif | #endif | |||
#ifdef INLINE_DESCENDING_SORT | #ifdef INLINE_DESCENDING_SORT | |||
if (compare == descending_compare) | if (compare == descending_compare) | |||
retval = is_sorted (data, nel, std::greater<T> ()); | retval = is_sorted (data, nel, std::greater<T> ()); | |||
else | else | |||
#endif | #endif | |||
if (compare) | if (compare) | |||
retval = is_sorted (data, nel, compare); | retval = is_sorted (data, nel, compare); | |||
return retval; | return retval; | |||
} | } | |||
// FIXME: is there really no way to make this local to the following functi on? | // FIXME: is there really no way to make this local to the following functi on? | |||
struct sortrows_run_t | struct sortrows_run_t | |||
{ | { | |||
sortrows_run_t (octave_idx_type c, octave_idx_type o, octave_idx_type n) | sortrows_run_t (octave_idx_type c, octave_idx_type o, octave_idx_type n) | |||
: col (c), ofs (o), nel (n) { } | : col (c), ofs (o), nel (n) { } | |||
octave_idx_type col, ofs, nel; | octave_idx_type col, ofs, nel; | |||
skipping to change at line 1610 | skipping to change at line 1615 | |||
return; | return; | |||
// This is a breadth-first traversal. | // This is a breadth-first traversal. | |||
typedef sortrows_run_t run_t; | typedef sortrows_run_t run_t; | |||
std::stack<run_t> runs; | std::stack<run_t> runs; | |||
runs.push (run_t (0, 0, rows)); | runs.push (run_t (0, 0, rows)); | |||
while (! runs.empty ()) | while (! runs.empty ()) | |||
{ | { | |||
octave_idx_type col = runs.top ().col; | octave_idx_type col = runs.top ().col; | |||
octave_idx_type ofs = runs.top ().ofs; | octave_idx_type ofs = runs.top ().ofs; | |||
octave_idx_type nel = runs.top ().nel; | octave_idx_type nel = runs.top ().nel; | |||
runs.pop (); | runs.pop (); | |||
assert (nel > 1); | assert (nel > 1); | |||
T *lbuf = buf + ofs; | T *lbuf = buf + ofs; | |||
const T *ldata = data + rows*col; | const T *ldata = data + rows*col; | |||
octave_idx_type *lidx = idx + ofs; | octave_idx_type *lidx = idx + ofs; | |||
// Gather. | // Gather. | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
lbuf[i] = ldata[lidx[i]]; | lbuf[i] = ldata[lidx[i]]; | |||
skipping to change at line 1659 | skipping to change at line 1664 | |||
octave_idx_type rows, octave_idx_type cols) | octave_idx_type rows, octave_idx_type cols) | |||
{ | { | |||
#ifdef INLINE_ASCENDING_SORT | #ifdef INLINE_ASCENDING_SORT | |||
if (compare == ascending_compare) | if (compare == ascending_compare) | |||
sort_rows (data, idx, rows, cols, std::less<T> ()); | sort_rows (data, idx, rows, cols, std::less<T> ()); | |||
else | else | |||
#endif | #endif | |||
#ifdef INLINE_DESCENDING_SORT | #ifdef INLINE_DESCENDING_SORT | |||
if (compare == descending_compare) | if (compare == descending_compare) | |||
sort_rows (data, idx, rows, cols, std::greater<T> ()); | sort_rows (data, idx, rows, cols, std::greater<T> ()); | |||
else | else | |||
#endif | #endif | |||
if (compare) | if (compare) | |||
sort_rows (data, idx, rows, cols, compare); | sort_rows (data, idx, rows, cols, compare); | |||
} | } | |||
template <class T> template <class Comp> | template <class T> template <class Comp> | |||
bool | bool | |||
octave_sort<T>::is_sorted_rows (const T *data, octave_idx_type rows, | octave_sort<T>::is_sorted_rows (const T *data, octave_idx_type rows, | |||
octave_idx_type cols, Comp comp) | octave_idx_type cols, Comp comp) | |||
{ | { | |||
if (rows <= 1 || cols == 0) | if (rows <= 1 || cols == 0) | |||
return true; | return true; | |||
skipping to change at line 1695 | skipping to change at line 1700 | |||
if (lo < lastrow) | if (lo < lastrow) | |||
{ | { | |||
// Not the final column. | // Not the final column. | |||
assert (n > 1); | assert (n > 1); | |||
const T *hi = lo + n, *lst = lo; | const T *hi = lo + n, *lst = lo; | |||
for (lo++; lo < hi; lo++) | for (lo++; lo < hi; lo++) | |||
{ | { | |||
if (comp (*lst, *lo)) | if (comp (*lst, *lo)) | |||
{ | { | |||
if (lo > lst + 1) | if (lo > lst + 1) | |||
runs.push (run_t (lst + rows, lo - lst)); | runs.push (run_t (lst + rows, lo - lst)); | |||
lst = lo; | lst = lo; | |||
} | } | |||
else if (comp (*lo, *lst)) | else if (comp (*lo, *lst)) | |||
break; | break; | |||
} | } | |||
if (lo == hi) | if (lo == hi) | |||
{ | { | |||
if (lo > lst + 1) | if (lo > lst + 1) | |||
runs.push (run_t (lst + rows, lo - lst)); | runs.push (run_t (lst + rows, lo - lst)); | |||
skipping to change at line 1736 | skipping to change at line 1741 | |||
bool retval = false; | bool retval = false; | |||
#ifdef INLINE_ASCENDING_SORT | #ifdef INLINE_ASCENDING_SORT | |||
if (compare == ascending_compare) | if (compare == ascending_compare) | |||
retval = is_sorted_rows (data, rows, cols, std::less<T> ()); | retval = is_sorted_rows (data, rows, cols, std::less<T> ()); | |||
else | else | |||
#endif | #endif | |||
#ifdef INLINE_DESCENDING_SORT | #ifdef INLINE_DESCENDING_SORT | |||
if (compare == descending_compare) | if (compare == descending_compare) | |||
retval = is_sorted_rows (data, rows, cols, std::greater<T> ()); | retval = is_sorted_rows (data, rows, cols, std::greater<T> ()); | |||
else | else | |||
#endif | #endif | |||
if (compare) | if (compare) | |||
retval = is_sorted_rows (data, rows, cols, compare); | retval = is_sorted_rows (data, rows, cols, compare); | |||
return retval; | return retval; | |||
} | } | |||
// The simple binary lookup. | // The simple binary lookup. | |||
template <class T> template <class Comp> | template <class T> template <class Comp> | |||
octave_idx_type | octave_idx_type | |||
octave_sort<T>::lookup (const T *data, octave_idx_type nel, | octave_sort<T>::lookup (const T *data, octave_idx_type nel, | |||
const T& value, Comp comp) | const T& value, Comp comp) | |||
skipping to change at line 1780 | skipping to change at line 1785 | |||
octave_idx_type retval = 0; | octave_idx_type retval = 0; | |||
#ifdef INLINE_ASCENDING_SORT | #ifdef INLINE_ASCENDING_SORT | |||
if (compare == ascending_compare) | if (compare == ascending_compare) | |||
retval = lookup (data, nel, value, std::less<T> ()); | retval = lookup (data, nel, value, std::less<T> ()); | |||
else | else | |||
#endif | #endif | |||
#ifdef INLINE_DESCENDING_SORT | #ifdef INLINE_DESCENDING_SORT | |||
if (compare == descending_compare) | if (compare == descending_compare) | |||
retval = lookup (data, nel, value, std::greater<T> ()); | retval = lookup (data, nel, value, std::greater<T> ()); | |||
else | else | |||
#endif | #endif | |||
if (compare) | if (compare) | |||
retval = lookup (data, nel, value, std::ptr_fun (compare)); | retval = lookup (data, nel, value, std::ptr_fun (compare)); | |||
return retval; | return retval; | |||
} | } | |||
template <class T> template <class Comp> | template <class T> template <class Comp> | |||
void | void | |||
octave_sort<T>::lookup (const T *data, octave_idx_type nel, | octave_sort<T>::lookup (const T *data, octave_idx_type nel, | |||
const T *values, octave_idx_type nvalues, | const T *values, octave_idx_type nvalues, | |||
octave_idx_type *idx, Comp comp) | octave_idx_type *idx, Comp comp) | |||
{ | { | |||
skipping to change at line 1815 | skipping to change at line 1820 | |||
octave_idx_type *idx) | octave_idx_type *idx) | |||
{ | { | |||
#ifdef INLINE_ASCENDING_SORT | #ifdef INLINE_ASCENDING_SORT | |||
if (compare == ascending_compare) | if (compare == ascending_compare) | |||
lookup (data, nel, values, nvalues, idx, std::less<T> ()); | lookup (data, nel, values, nvalues, idx, std::less<T> ()); | |||
else | else | |||
#endif | #endif | |||
#ifdef INLINE_DESCENDING_SORT | #ifdef INLINE_DESCENDING_SORT | |||
if (compare == descending_compare) | if (compare == descending_compare) | |||
lookup (data, nel, values, nvalues, idx, std::greater<T> ()); | lookup (data, nel, values, nvalues, idx, std::greater<T> ()); | |||
else | else | |||
#endif | #endif | |||
if (compare) | if (compare) | |||
lookup (data, nel, values, nvalues, idx, std::ptr_fun (compare)); | lookup (data, nel, values, nvalues, idx, std::ptr_fun (compare)); | |||
} | } | |||
template <class T> template <class Comp> | template <class T> template <class Comp> | |||
void | void | |||
octave_sort<T>::lookup_sorted (const T *data, octave_idx_type nel, | octave_sort<T>::lookup_sorted (const T *data, octave_idx_type nel, | |||
const T *values, octave_idx_type nvalues, | const T *values, octave_idx_type nvalues, | |||
octave_idx_type *idx, bool rev, Comp comp) | octave_idx_type *idx, bool rev, Comp comp) | |||
{ | { | |||
if (rev) | if (rev) | |||
{ | { | |||
skipping to change at line 1887 | skipping to change at line 1892 | |||
octave_idx_type *idx, bool rev) | octave_idx_type *idx, bool rev) | |||
{ | { | |||
#ifdef INLINE_ASCENDING_SORT | #ifdef INLINE_ASCENDING_SORT | |||
if (compare == ascending_compare) | if (compare == ascending_compare) | |||
lookup_sorted (data, nel, values, nvalues, idx, rev, std::less<T> ()); | lookup_sorted (data, nel, values, nvalues, idx, rev, std::less<T> ()); | |||
else | else | |||
#endif | #endif | |||
#ifdef INLINE_DESCENDING_SORT | #ifdef INLINE_DESCENDING_SORT | |||
if (compare == descending_compare) | if (compare == descending_compare) | |||
lookup_sorted (data, nel, values, nvalues, idx, rev, std::greater<T> ()); | lookup_sorted (data, nel, values, nvalues, idx, rev, std::greater<T> ()); | |||
else | else | |||
#endif | #endif | |||
if (compare) | if (compare) | |||
lookup_sorted (data, nel, values, nvalues, idx, rev, std::ptr_fun (co | lookup_sorted (data, nel, values, nvalues, idx, rev, | |||
mpare)); | std::ptr_fun (compare)); | |||
} | } | |||
template <class T> template <class Comp> | template <class T> template <class Comp> | |||
void | void | |||
octave_sort<T>::nth_element (T *data, octave_idx_type nel, | octave_sort<T>::nth_element (T *data, octave_idx_type nel, | |||
octave_idx_type lo, octave_idx_type up, | octave_idx_type lo, octave_idx_type up, | |||
Comp comp) | Comp comp) | |||
{ | { | |||
// Simply wrap the STL algorithms. | // Simply wrap the STL algorithms. | |||
// FIXME: this will fail if we attempt to inline <,> for Complex. | // FIXME: this will fail if we attempt to inline <,> for Complex. | |||
skipping to change at line 1934 | skipping to change at line 1940 | |||
if (up < 0) | if (up < 0) | |||
up = lo + 1; | up = lo + 1; | |||
#ifdef INLINE_ASCENDING_SORT | #ifdef INLINE_ASCENDING_SORT | |||
if (compare == ascending_compare) | if (compare == ascending_compare) | |||
nth_element (data, nel, lo, up, std::less<T> ()); | nth_element (data, nel, lo, up, std::less<T> ()); | |||
else | else | |||
#endif | #endif | |||
#ifdef INLINE_DESCENDING_SORT | #ifdef INLINE_DESCENDING_SORT | |||
if (compare == descending_compare) | if (compare == descending_compare) | |||
nth_element (data, nel, lo, up, std::greater<T> ()); | nth_element (data, nel, lo, up, std::greater<T> ()); | |||
else | else | |||
#endif | #endif | |||
if (compare) | if (compare) | |||
nth_element (data, nel, lo, up, std::ptr_fun (compare)); | nth_element (data, nel, lo, up, std::ptr_fun (compare)); | |||
} | } | |||
template <class T> | template <class T> | |||
bool | bool | |||
octave_sort<T>::ascending_compare (typename ref_param<T>::type x, | octave_sort<T>::ascending_compare (typename ref_param<T>::type x, | |||
typename ref_param<T>::type y) | typename ref_param<T>::type y) | |||
{ | { | |||
return x < y; | return x < y; | |||
} | } | |||
End of changes. 38 change blocks. | ||||
56 lines changed or deleted | 58 lines changed or added | |||
oct-sort.h | oct-sort.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 David Bateman | Copyright (C) 2003-2013 David Bateman | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 83 | skipping to change at line 83 | |||
relationship of agency, partnership, or joint venture between PSF and | relationship of agency, partnership, or joint venture between PSF and | |||
Licensee. This License Agreement does not grant permission to use PSF | Licensee. This License Agreement does not grant permission to use PSF | |||
trademarks or trade name in a trademark sense to endorse or promote | trademarks or trade name in a trademark sense to endorse or promote | |||
products or services of Licensee, or any third party. | products or services of Licensee, or any third party. | |||
8. By copying, installing or otherwise using Python 2.3, Licensee | 8. By copying, installing or otherwise using Python 2.3, Licensee | |||
agrees to be bound by the terms and conditions of this License | agrees to be bound by the terms and conditions of this License | |||
Agreement. | Agreement. | |||
*/ | */ | |||
#if !defined (octave_sort_h) | #if !defined (octave_oct_sort_h) | |||
#define octave_sort_h 1 | #define octave_oct_sort_h 1 | |||
#include "lo-traits.h" | #include "lo-traits.h" | |||
// The maximum number of entries in a MergeState's pending-runs stack. | // The maximum number of entries in a MergeState's pending-runs stack. | |||
// This is enough to sort arrays of size up to about | // This is enough to sort arrays of size up to about | |||
// 32 * phi ** MAX_MERGE_PENDING | // 32 * phi ** MAX_MERGE_PENDING | |||
// where phi ~= 1.618. 85 is ridiculously large enough, good for an array | // where phi ~= 1.618. 85 is ridiculously large enough, good for an array | |||
// with 2**64 elements. | // with 2**64 elements. | |||
#define MAX_MERGE_PENDING 85 | #define MAX_MERGE_PENDING 85 | |||
skipping to change at line 187 | skipping to change at line 187 | |||
struct s_slice | struct s_slice | |||
{ | { | |||
octave_idx_type base, len; | octave_idx_type base, len; | |||
}; | }; | |||
struct MergeState | struct MergeState | |||
{ | { | |||
MergeState (void) | MergeState (void) | |||
: min_gallop (), a (0), ia (0), alloced (0), n (0) | : min_gallop (), a (0), ia (0), alloced (0), n (0) | |||
{ reset (); } | { reset (); } | |||
~MergeState (void) | ~MergeState (void) | |||
{ delete [] a; delete [] ia; } | { delete [] a; delete [] ia; } | |||
void reset (void) | void reset (void) | |||
{ min_gallop = MIN_GALLOP; n = 0; } | { min_gallop = MIN_GALLOP; n = 0; } | |||
void getmem (octave_idx_type need); | void getmem (octave_idx_type need); | |||
void getmemi (octave_idx_type need); | void getmemi (octave_idx_type need); | |||
// This controls when we get *into* galloping mode. It's | // This controls when we get *into* galloping mode. It's | |||
// initialized to MIN_GALLOP. merge_lo and merge_hi tend to nudge | // initialized to MIN_GALLOP. merge_lo and merge_hi tend to nudge | |||
// it higher for random data, and lower for highly structured | // it higher for random data, and lower for highly structured | |||
// data. | // data. | |||
octave_idx_type min_gallop; | octave_idx_type min_gallop; | |||
skipping to change at line 235 | skipping to change at line 235 | |||
MergeState& operator = (const MergeState&); | MergeState& operator = (const MergeState&); | |||
}; | }; | |||
compare_fcn_type compare; | compare_fcn_type compare; | |||
MergeState *ms; | MergeState *ms; | |||
template <class Comp> | template <class Comp> | |||
void binarysort (T *data, octave_idx_type nel, | void binarysort (T *data, octave_idx_type nel, | |||
octave_idx_type start, Comp comp); | octave_idx_type start, Comp comp); | |||
template <class Comp> | template <class Comp> | |||
void binarysort (T *data, octave_idx_type *idx, octave_idx_type nel, | void binarysort (T *data, octave_idx_type *idx, octave_idx_type nel, | |||
octave_idx_type start, Comp comp); | octave_idx_type start, Comp comp); | |||
template <class Comp> | template <class Comp> | |||
octave_idx_type count_run (T *lo, octave_idx_type n, bool& descending, Co | octave_idx_type count_run (T *lo, octave_idx_type n, bool& descending, | |||
mp comp); | Comp comp); | |||
template <class Comp> | template <class Comp> | |||
octave_idx_type gallop_left (T key, T *a, octave_idx_type n, octave_idx_t | octave_idx_type gallop_left (T key, T *a, octave_idx_type n, | |||
ype hint, | octave_idx_type hint, Comp comp); | |||
Comp comp); | ||||
template <class Comp> | template <class Comp> | |||
octave_idx_type gallop_right (T key, T *a, octave_idx_type n, octave_idx_ | octave_idx_type gallop_right (T key, T *a, octave_idx_type n, | |||
type hint, | octave_idx_type hint, Comp comp); | |||
Comp comp); | ||||
template <class Comp> | template <class Comp> | |||
int merge_lo (T *pa, octave_idx_type na, | int merge_lo (T *pa, octave_idx_type na, | |||
T *pb, octave_idx_type nb, | T *pb, octave_idx_type nb, | |||
Comp comp); | Comp comp); | |||
template <class Comp> | template <class Comp> | |||
int merge_lo (T *pa, octave_idx_type *ipa, octave_idx_type na, | int merge_lo (T *pa, octave_idx_type *ipa, octave_idx_type na, | |||
T *pb, octave_idx_type *ipb, octave_idx_type nb, | T *pb, octave_idx_type *ipb, octave_idx_type nb, | |||
Comp comp); | Comp comp); | |||
skipping to change at line 273 | skipping to change at line 274 | |||
int merge_hi (T *pa, octave_idx_type na, | int merge_hi (T *pa, octave_idx_type na, | |||
T *pb, octave_idx_type nb, | T *pb, octave_idx_type nb, | |||
Comp comp); | Comp comp); | |||
template <class Comp> | template <class Comp> | |||
int merge_hi (T *pa, octave_idx_type *ipa, octave_idx_type na, | int merge_hi (T *pa, octave_idx_type *ipa, octave_idx_type na, | |||
T *pb, octave_idx_type *ipb, octave_idx_type nb, | T *pb, octave_idx_type *ipb, octave_idx_type nb, | |||
Comp comp); | Comp comp); | |||
template <class Comp> | template <class Comp> | |||
int merge_at (octave_idx_type i, T *data, | int merge_at (octave_idx_type i, T *data, Comp comp); | |||
Comp comp); | ||||
template <class Comp> | template <class Comp> | |||
int merge_at (octave_idx_type i, T *data, octave_idx_type *idx, | int merge_at (octave_idx_type i, T *data, octave_idx_type *idx, Comp comp | |||
Comp comp); | ); | |||
template <class Comp> | template <class Comp> | |||
int merge_collapse (T *data, Comp comp); | int merge_collapse (T *data, Comp comp); | |||
template <class Comp> | template <class Comp> | |||
int merge_collapse (T *data, octave_idx_type *idx, Comp comp); | int merge_collapse (T *data, octave_idx_type *idx, Comp comp); | |||
template <class Comp> | template <class Comp> | |||
int merge_force_collapse (T *data, Comp comp); | int merge_force_collapse (T *data, Comp comp); | |||
End of changes. 12 change blocks. | ||||
20 lines changed or deleted | 17 lines changed or added | |||
oct-sparse.h | oct-sparse.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2005-2012 David Bateman | Copyright (C) 2005-2013 David Bateman | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (oct_sparse_h) | #if !defined (octave_oct_sparse_h) | |||
#define oct_sparse_h 1 | #define octave_oct_sparse_h 1 | |||
#if defined (HAVE_SUITESPARSE_AMD_H) | #if defined (HAVE_SUITESPARSE_AMD_H) | |||
#include <suitesparse/amd.h> | #include <suitesparse/amd.h> | |||
#elif defined (HAVE_UFSPARSE_AMD_H) | #elif defined (HAVE_UFSPARSE_AMD_H) | |||
#include <ufsparse/amd.h> | #include <ufsparse/amd.h> | |||
#elif defined (HAVE_AMD_AMD_H) | #elif defined (HAVE_AMD_AMD_H) | |||
#include <amd/amd.h> | #include <amd/amd.h> | |||
#elif defined (HAVE_AMD_H) | #elif defined (HAVE_AMD_H) | |||
#include <amd.h> | #include <amd.h> | |||
#endif | #endif | |||
skipping to change at line 90 | skipping to change at line 90 | |||
#elif defined (HAVE_CXSPARSE_CS_H) | #elif defined (HAVE_CXSPARSE_CS_H) | |||
#include <cxsparse/cs.h> | #include <cxsparse/cs.h> | |||
#elif defined (HAVE_CS_H) | #elif defined (HAVE_CS_H) | |||
#include <cs.h> | #include <cs.h> | |||
#endif | #endif | |||
#if (defined (HAVE_SUITESPARSE_CHOLMOD_H) \ | #if (defined (HAVE_SUITESPARSE_CHOLMOD_H) \ | |||
|| defined (HAVE_UFSPARSE_CHOLMOD_H) \ | || defined (HAVE_UFSPARSE_CHOLMOD_H) \ | |||
|| defined (HAVE_CHOLMOD_CHOLMOD_H) \ | || defined (HAVE_CHOLMOD_CHOLMOD_H) \ | |||
|| defined (HAVE_CHOLMOD_H)) | || defined (HAVE_CHOLMOD_H)) | |||
#ifdef IDX_TYPE_LONG | #ifdef USE_64_BIT_IDX_T | |||
#define CHOLMOD_NAME(name) cholmod_l_ ## name | #define CHOLMOD_NAME(name) cholmod_l_ ## name | |||
#else | #else | |||
#define CHOLMOD_NAME(name) cholmod_ ## name | #define CHOLMOD_NAME(name) cholmod_ ## name | |||
#endif | #endif | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
oct-spparms.h | oct-spparms.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
oct-stdstrm.h | oct-stdstrm.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_octave_stdiostream_h) | #if !defined (octave_oct_stdstrm_h) | |||
#define octave_octave_stdiostream_h 1 | #define octave_oct_stdstrm_h 1 | |||
#include "oct-stream.h" | #include "oct-stream.h" | |||
#include "c-file-ptr-stream.h" | #include "c-file-ptr-stream.h" | |||
template <typename BUF_T, typename STREAM_T, typename FILE_T> | template <typename BUF_T, typename STREAM_T, typename FILE_T> | |||
class | class | |||
octave_tstdiostream : public octave_base_stream | octave_tstdiostream : public octave_base_stream | |||
{ | { | |||
public: | public: | |||
skipping to change at line 46 | skipping to change at line 46 | |||
std::ios::openmode m = std::ios::in|std::ios::out, | std::ios::openmode m = std::ios::in|std::ios::out, | |||
oct_mach_info::float_format ff | oct_mach_info::float_format ff | |||
= oct_mach_info::native_float_format (), | = oct_mach_info::native_float_format (), | |||
typename BUF_T::close_fcn cf = BUF_T::file_close) | typename BUF_T::close_fcn cf = BUF_T::file_close) | |||
: octave_base_stream (m, ff), nm (n), md (m), | : octave_base_stream (m, ff), nm (n), md (m), | |||
s (f ? new STREAM_T (f, cf) : 0), fnum (fid) | s (f ? new STREAM_T (f, cf) : 0), fnum (fid) | |||
{ } | { } | |||
// Position a stream at OFFSET relative to ORIGIN. | // Position a stream at OFFSET relative to ORIGIN. | |||
int seek (long offset, int origin) | int seek (off_t offset, int origin) | |||
{ return s ? s->seek (offset, origin) : -1; } | { return s ? s->seek (offset, origin) : -1; } | |||
// Return current stream position. | // Return current stream position. | |||
long tell (void) { return s ? s->tell () : -1; } | off_t tell (void) { return s ? s->tell () : -1; } | |||
// Return non-zero if EOF has been reached on this stream. | // Return non-zero if EOF has been reached on this stream. | |||
bool eof (void) const { return s ? s->eof () : true; } | bool eof (void) const { return s ? s->eof () : true; } | |||
// The name of the file. | // The name of the file. | |||
std::string name (void) const { return nm; } | std::string name (void) const { return nm; } | |||
std::istream *input_stream (void) { return (md & std::ios::in) ? s : 0; } | std::istream *input_stream (void) { return (md & std::ios::in) ? s : 0; } | |||
std::ostream *output_stream (void) { return (md & std::ios::out) ? s : 0; } | std::ostream *output_stream (void) { return (md & std::ios::out) ? s : 0; } | |||
// FIXME -- should not have to cast away const here. | // FIXME: should not have to cast away const here. | |||
BUF_T *rdbuf (void) const | BUF_T *rdbuf (void) const | |||
{ return s ? (const_cast<STREAM_T *> (s))->rdbuf () : 0; } | { return s ? (const_cast<STREAM_T *> (s))->rdbuf () : 0; } | |||
int file_number (void) const { return fnum; } | int file_number (void) const { return fnum; } | |||
bool bad (void) const { return s ? s->bad () : true; } | bool bad (void) const { return s ? s->bad () : true; } | |||
void clear (void) { if (s) s->clear (); } | void clear (void) { if (s) s->clear (); } | |||
void do_close (void) { if (s) s->stream_close (); } | void do_close (void) { if (s) s->stream_close (); } | |||
protected: | protected: | |||
skipping to change at line 110 | skipping to change at line 110 | |||
octave_stdiostream | octave_stdiostream | |||
: public octave_tstdiostream<c_file_ptr_buf, io_c_file_ptr_stream, FILE * > | : public octave_tstdiostream<c_file_ptr_buf, io_c_file_ptr_stream, FILE * > | |||
{ | { | |||
public: | public: | |||
octave_stdiostream (const std::string& n, FILE *f = 0, | octave_stdiostream (const std::string& n, FILE *f = 0, | |||
std::ios::openmode m = std::ios::in|std::ios::out, | std::ios::openmode m = std::ios::in|std::ios::out, | |||
oct_mach_info::float_format ff | oct_mach_info::float_format ff | |||
= oct_mach_info::native_float_format (), | = oct_mach_info::native_float_format (), | |||
c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::file_c lose) | c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::file_c lose) | |||
: octave_tstdiostream<c_file_ptr_buf, io_c_file_ptr_stream, FILE *> (n, | : octave_tstdiostream<c_file_ptr_buf, io_c_file_ptr_stream, FILE *> | |||
f, f ? fileno (f) : -1, m, ff, cf) { } | (n, f, f ? fileno (f) : -1, m, ff, cf) { } | |||
static octave_stream | static octave_stream | |||
create (const std::string& n, FILE *f = 0, | create (const std::string& n, FILE *f = 0, | |||
std::ios::openmode m = std::ios::in|std::ios::out, | std::ios::openmode m = std::ios::in|std::ios::out, | |||
oct_mach_info::float_format ff | oct_mach_info::float_format ff | |||
= oct_mach_info::native_float_format (), | = oct_mach_info::native_float_format (), | |||
c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::file_close) | c_file_ptr_buf::close_fcn cf = c_file_ptr_buf::file_close) | |||
{ | { | |||
return octave_stream (new octave_stdiostream (n, f, m, ff, cf)); | return octave_stream (new octave_stdiostream (n, f, m, ff, cf)); | |||
} | } | |||
skipping to change at line 147 | skipping to change at line 148 | |||
class | class | |||
octave_zstdiostream | octave_zstdiostream | |||
: public octave_tstdiostream<c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFi le> | : public octave_tstdiostream<c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFi le> | |||
{ | { | |||
public: | public: | |||
octave_zstdiostream (const std::string& n, gzFile f = 0, int fid = 0, | octave_zstdiostream (const std::string& n, gzFile f = 0, int fid = 0, | |||
std::ios::openmode m = std::ios::in|std::ios::out, | std::ios::openmode m = std::ios::in|std::ios::out, | |||
oct_mach_info::float_format ff | oct_mach_info::float_format ff | |||
= oct_mach_info::native_float_format (), | = oct_mach_info::native_float_format (), | |||
c_zfile_ptr_buf::close_fcn cf = c_zfile_ptr_buf::fil | c_zfile_ptr_buf::close_fcn cf | |||
e_close) | = c_zfile_ptr_buf::file_close) | |||
: octave_tstdiostream<c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile> ( | : octave_tstdiostream<c_zfile_ptr_buf, io_c_zfile_ptr_stream, gzFile> | |||
n, f, fid, m, ff, cf) { } | (n, f, fid, m, ff, cf) { } | |||
static octave_stream | static octave_stream | |||
create (const std::string& n, gzFile f = 0, int fid = 0, | create (const std::string& n, gzFile f = 0, int fid = 0, | |||
std::ios::openmode m = std::ios::in|std::ios::out, | std::ios::openmode m = std::ios::in|std::ios::out, | |||
oct_mach_info::float_format ff | oct_mach_info::float_format ff | |||
= oct_mach_info::native_float_format (), | = oct_mach_info::native_float_format (), | |||
c_zfile_ptr_buf::close_fcn cf = c_zfile_ptr_buf::file_close) | c_zfile_ptr_buf::close_fcn cf = c_zfile_ptr_buf::file_close) | |||
{ | { | |||
return octave_stream (new octave_zstdiostream (n, f, fid, m, ff, cf)); | return octave_stream (new octave_zstdiostream (n, f, fid, m, ff, cf)); | |||
} | } | |||
End of changes. 8 change blocks. | ||||
14 lines changed or deleted | 14 lines changed or added | |||
oct-stream.h | oct-stream.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_octave_stream_h) | #if !defined (octave_oct_stream_h) | |||
#define octave_octave_stream_h 1 | #define octave_oct_stream_h 1 | |||
class Matrix; | class Matrix; | |||
class string_vector; | class string_vector; | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <sstream> | #include <sstream> | |||
#include <string> | #include <string> | |||
#include <list> | ||||
#include <map> | #include <map> | |||
#include "Array.h" | #include "Array.h" | |||
#include "data-conv.h" | #include "data-conv.h" | |||
#include "lo-utils.h" | #include "lo-utils.h" | |||
#include "mach-info.h" | #include "mach-info.h" | |||
#include "oct-locbuf.h" | ||||
#include "oct-refcount.h" | #include "oct-refcount.h" | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
scanf_format_elt | scanf_format_elt | |||
{ | { | |||
public: | public: | |||
enum special_conversion | enum special_conversion | |||
{ | { | |||
whitespace_conversion = 1, | whitespace_conversion = 1, | |||
literal_conversion = 2 | literal_conversion = 2 | |||
}; | }; | |||
scanf_format_elt (const char *txt = 0, int w = 0, bool d = false, | scanf_format_elt (const char *txt = 0, int w = 0, bool d = false, | |||
char typ = '\0', char mod = '\0', | char typ = '\0', char mod = '\0', | |||
const std::string& ch_class = std::string ()) | const std::string& ch_class = std::string ()) | |||
: text (strsave (txt)), width (w), discard (d), type (typ), | : text (strsave (txt)), width (w), discard (d), type (typ), | |||
modifier (mod), char_class (ch_class) { } | modifier (mod), char_class (ch_class) { } | |||
scanf_format_elt (const scanf_format_elt& e) | scanf_format_elt (const scanf_format_elt& e) | |||
: text (strsave (e.text)), width (e.width), discard (e.discard), | : text (strsave (e.text)), width (e.width), discard (e.discard), | |||
type (e.type), modifier (e.modifier), char_class (e.char_class) { } | type (e.type), modifier (e.modifier), char_class (e.char_class) { } | |||
scanf_format_elt& operator = (const scanf_format_elt& e) | scanf_format_elt& operator = (const scanf_format_elt& e) | |||
{ | { | |||
if (this != &e) | if (this != &e) | |||
{ | { | |||
text = strsave (e.text); | text = strsave (e.text); | |||
width = e.width; | width = e.width; | |||
discard = e.discard; | discard = e.discard; | |||
type = e.type; | type = e.type; | |||
modifier = e.modifier; | modifier = e.modifier; | |||
char_class = e.char_class; | char_class = e.char_class; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~scanf_format_elt (void) { delete [] text; } | ~scanf_format_elt (void) { delete [] text; } | |||
// The C-style format string. | // The C-style format string. | |||
const char *text; | const char *text; | |||
// The maximum field width. | // The maximum field width. | |||
int width; | int width; | |||
// TRUE if we are not storing the result of this conversion. | // TRUE if we are not storing the result of this conversion. | |||
skipping to change at line 121 | skipping to change at line 123 | |||
octave_idx_type num_conversions (void) { return nconv; } | octave_idx_type num_conversions (void) { return nconv; } | |||
// The length can be different than the number of conversions. | // The length can be different than the number of conversions. | |||
// For example, "x %d y %d z" has 2 conversions but the length of | // For example, "x %d y %d z" has 2 conversions but the length of | |||
// the list is 3 because of the characters that appear after the | // the list is 3 because of the characters that appear after the | |||
// last conversion. | // last conversion. | |||
octave_idx_type length (void) { return list.length (); } | octave_idx_type length (void) { return list.length (); } | |||
const scanf_format_elt *first (void) | const scanf_format_elt *first (void) | |||
{ | { | |||
curr_idx = 0; | curr_idx = 0; | |||
return current (); | return current (); | |||
} | } | |||
const scanf_format_elt *current (void) const | const scanf_format_elt *current (void) const | |||
{ return list.length () > 0 ? list.elem (curr_idx) : 0; } | { return list.length () > 0 ? list.elem (curr_idx) : 0; } | |||
const scanf_format_elt *next (bool cycle = true) | const scanf_format_elt *next (bool cycle = true) | |||
{ | { | |||
curr_idx++; | curr_idx++; | |||
if (curr_idx >= list.length ()) | if (curr_idx >= list.length ()) | |||
{ | { | |||
if (cycle) | if (cycle) | |||
curr_idx = 0; | curr_idx = 0; | |||
else | else | |||
return 0; | return 0; | |||
} | } | |||
return current (); | return current (); | |||
} | } | |||
void printme (void) const; | void printme (void) const; | |||
bool ok (void) const { return (nconv >= 0); } | bool ok (void) const { return (nconv >= 0); } | |||
operator bool () const { return ok (); } | operator bool () const { return ok (); } | |||
bool all_character_conversions (void); | bool all_character_conversions (void); | |||
bool all_numeric_conversions (void); | bool all_numeric_conversions (void); | |||
private: | private: | |||
// Number of conversions specified by this format string, or -1 if | // Number of conversions specified by this format string, or -1 if | |||
// invalid conversions have been found. | // invalid conversions have been found. | |||
octave_idx_type nconv; | octave_idx_type nconv; | |||
// Index to current element; | // Index to current element; | |||
octave_idx_type curr_idx; | octave_idx_type curr_idx; | |||
// FIXME -- maybe LIST should be a std::list object? | // FIXME: maybe LIST should be a std::list object? | |||
// List of format elements. | // List of format elements. | |||
Array<scanf_format_elt*> list; | Array<scanf_format_elt*> list; | |||
// Temporary buffer. | // Temporary buffer. | |||
std::ostringstream *buf; | std::ostringstream *buf; | |||
void add_elt_to_list (int width, bool discard, char type, char modifier, | void add_elt_to_list (int width, bool discard, char type, char modifier, | |||
octave_idx_type& num_elts, | octave_idx_type& num_elts, | |||
const std::string& char_class = std::string ()); | const std::string& char_class = std::string ()); | |||
skipping to change at line 203 | skipping to change at line 205 | |||
int p = 0, const std::string& f = std::string (), | int p = 0, const std::string& f = std::string (), | |||
char typ = '\0', char mod = '\0') | char typ = '\0', char mod = '\0') | |||
: text (strsave (txt)), args (n), fw (w), prec (p), flags (f), | : text (strsave (txt)), args (n), fw (w), prec (p), flags (f), | |||
type (typ), modifier (mod) { } | type (typ), modifier (mod) { } | |||
printf_format_elt (const printf_format_elt& e) | printf_format_elt (const printf_format_elt& e) | |||
: text (strsave (e.text)), args (e.args), fw (e.fw), prec (e.prec), | : text (strsave (e.text)), args (e.args), fw (e.fw), prec (e.prec), | |||
flags (e.flags), type (e.type), modifier (e.modifier) { } | flags (e.flags), type (e.type), modifier (e.modifier) { } | |||
printf_format_elt& operator = (const printf_format_elt& e) | printf_format_elt& operator = (const printf_format_elt& e) | |||
{ | { | |||
if (this != &e) | if (this != &e) | |||
{ | { | |||
text = strsave (e.text); | text = strsave (e.text); | |||
args = e.args; | args = e.args; | |||
fw = e.fw; | fw = e.fw; | |||
prec = e.prec; | prec = e.prec; | |||
flags = e.flags; | flags = e.flags; | |||
type = e.type; | type = e.type; | |||
modifier = e.modifier; | modifier = e.modifier; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~printf_format_elt (void) { delete [] text; } | ~printf_format_elt (void) { delete [] text; } | |||
// The C-style format string. | // The C-style format string. | |||
const char *text; | const char *text; | |||
// How many args do we expect to consume? | // How many args do we expect to consume? | |||
int args; | int args; | |||
// Field width. | // Field width. | |||
skipping to change at line 256 | skipping to change at line 258 | |||
{ | { | |||
public: | public: | |||
printf_format_list (const std::string& fmt = std::string ()); | printf_format_list (const std::string& fmt = std::string ()); | |||
~printf_format_list (void); | ~printf_format_list (void); | |||
octave_idx_type num_conversions (void) { return nconv; } | octave_idx_type num_conversions (void) { return nconv; } | |||
const printf_format_elt *first (void) | const printf_format_elt *first (void) | |||
{ | { | |||
curr_idx = 0; | curr_idx = 0; | |||
return current (); | return current (); | |||
} | } | |||
const printf_format_elt *current (void) const | const printf_format_elt *current (void) const | |||
{ return list.length () > 0 ? list.elem (curr_idx) : 0; } | { return list.length () > 0 ? list.elem (curr_idx) : 0; } | |||
const printf_format_elt *next (bool cycle = true) | const printf_format_elt *next (bool cycle = true) | |||
{ | { | |||
curr_idx++; | curr_idx++; | |||
if (curr_idx >= list.length ()) | if (curr_idx >= list.length ()) | |||
{ | { | |||
if (cycle) | if (cycle) | |||
curr_idx = 0; | curr_idx = 0; | |||
else | else | |||
return 0; | return 0; | |||
} | } | |||
return current (); | return current (); | |||
} | } | |||
bool last_elt_p (void) { return (curr_idx + 1 == list.length ()); } | bool last_elt_p (void) { return (curr_idx + 1 == list.length ()); } | |||
void printme (void) const; | void printme (void) const; | |||
bool ok (void) const { return (nconv >= 0); } | bool ok (void) const { return (nconv >= 0); } | |||
operator bool () const { return ok (); } | operator bool () const { return ok (); } | |||
private: | private: | |||
// Number of conversions specified by this format string, or -1 if | // Number of conversions specified by this format string, or -1 if | |||
// invalid conversions have been found. | // invalid conversions have been found. | |||
octave_idx_type nconv; | octave_idx_type nconv; | |||
// Index to current element; | // Index to current element; | |||
octave_idx_type curr_idx; | octave_idx_type curr_idx; | |||
// FIXME -- maybe LIST should be a std::list object? | // FIXME: maybe LIST should be a std::list object? | |||
// List of format elements. | // List of format elements. | |||
Array<printf_format_elt*> list; | Array<printf_format_elt*> list; | |||
// Temporary buffer. | // Temporary buffer. | |||
std::ostringstream *buf; | std::ostringstream *buf; | |||
void add_elt_to_list (int args, const std::string& flags, int fw, | void add_elt_to_list (int args, const std::string& flags, int fw, | |||
int prec, char type, char modifier, | int prec, char type, char modifier, | |||
octave_idx_type& num_elts); | octave_idx_type& num_elts); | |||
skipping to change at line 330 | skipping to change at line 332 | |||
printf_format_list& operator = (const printf_format_list&); | printf_format_list& operator = (const printf_format_list&); | |||
}; | }; | |||
// Provide an interface for Octave streams. | // Provide an interface for Octave streams. | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
octave_base_stream | octave_base_stream | |||
{ | { | |||
friend class octave_stream; | friend class octave_stream; | |||
public: | public: | |||
octave_base_stream (std::ios::openmode arg_md = std::ios::in|std::ios::ou t, | octave_base_stream (std::ios::openmode arg_md = std::ios::in|std::ios::ou t, | |||
oct_mach_info::float_format ff | oct_mach_info::float_format ff | |||
= oct_mach_info::native_float_format ()) | = oct_mach_info::native_float_format ()) | |||
: count (0), md (arg_md), flt_fmt (ff), fail (false), open_state (true) , | : count (0), md (arg_md), flt_fmt (ff), fail (false), open_state (true) , | |||
errmsg () | errmsg () | |||
{ } | { } | |||
virtual ~octave_base_stream (void) { } | virtual ~octave_base_stream (void) { } | |||
// The remaining functions are not specific to input or output only, | // The remaining functions are not specific to input or output only, | |||
// and must be provided by the derived classes. | // and must be provided by the derived classes. | |||
// Position a stream at OFFSET relative to ORIGIN. | // Position a stream at OFFSET relative to ORIGIN. | |||
virtual int seek (long offset, int origin) = 0; | virtual int seek (off_t offset, int origin) = 0; | |||
// Return current stream position. | // Return current stream position. | |||
virtual long tell (void) = 0; | virtual off_t tell (void) = 0; | |||
// Return TRUE if EOF has been reached on this stream. | // Return TRUE if EOF has been reached on this stream. | |||
virtual bool eof (void) const = 0; | virtual bool eof (void) const = 0; | |||
// The name of the file. | // The name of the file. | |||
virtual std::string name (void) const = 0; | virtual std::string name (void) const = 0; | |||
// If the derived class provides this function and it returns a | // If the derived class provides this function and it returns a | |||
skipping to change at line 381 | skipping to change at line 383 | |||
virtual std::ostream *output_stream (void) { return 0; } | virtual std::ostream *output_stream (void) { return 0; } | |||
// Return TRUE if this stream is open. | // Return TRUE if this stream is open. | |||
bool is_open (void) const { return open_state; } | bool is_open (void) const { return open_state; } | |||
virtual void do_close (void) { } | virtual void do_close (void) { } | |||
void close (void) | void close (void) | |||
{ | { | |||
if (is_open ()) | if (is_open ()) | |||
{ | { | |||
open_state = false; | open_state = false; | |||
do_close (); | do_close (); | |||
} | } | |||
} | } | |||
virtual int file_number (void) const | virtual int file_number (void) const | |||
{ | { | |||
// Kluge alert! | // Kluge alert! | |||
if (name () == "stdin") | if (name () == "stdin") | |||
return 0; | return 0; | |||
else if (name () == "stdout") | else if (name () == "stdout") | |||
return 1; | return 1; | |||
else if (name () == "stderr") | else if (name () == "stderr") | |||
skipping to change at line 455 | skipping to change at line 457 | |||
// Should contain error message if fail is TRUE. | // Should contain error message if fail is TRUE. | |||
std::string errmsg; | std::string errmsg; | |||
// Functions that are defined for all input streams (input streams | // Functions that are defined for all input streams (input streams | |||
// are those that define is). | // are those that define is). | |||
std::string do_gets (octave_idx_type max_len, bool& err, bool strip_newli ne, | std::string do_gets (octave_idx_type max_len, bool& err, bool strip_newli ne, | |||
const std::string& who /* = "gets" */); | const std::string& who /* = "gets" */); | |||
std::string getl (octave_idx_type max_len, bool& err, const std::string& | std::string getl (octave_idx_type max_len, bool& err, | |||
who /* = "getl" */); | const std::string& who /* = "getl" */); | |||
std::string gets (octave_idx_type max_len, bool& err, const std::string& | std::string gets (octave_idx_type max_len, bool& err, | |||
who /* = "gets" */); | const std::string& who /* = "gets" */); | |||
long skipl (long count, bool& err, const std::string& who /* = "skipl" */ | off_t skipl (off_t count, bool& err, const std::string& who /* = "skipl" | |||
); | */); | |||
octave_value do_scanf (scanf_format_list& fmt_list, octave_idx_type nr, o | octave_value do_scanf (scanf_format_list& fmt_list, octave_idx_type nr, | |||
ctave_idx_type nc, | octave_idx_type nc, | |||
bool one_elt_size_spec, octave_idx_type& count, | bool one_elt_size_spec, octave_idx_type& count, | |||
const std::string& who /* = "scanf" */); | const std::string& who /* = "scanf" */); | |||
octave_value scanf (const std::string& fmt, const Array<double>& size, | octave_value scanf (const std::string& fmt, const Array<double>& size, | |||
octave_idx_type& count, const std::string& who /* = " scanf" */); | octave_idx_type& count, const std::string& who /* = " scanf" */); | |||
bool do_oscanf (const scanf_format_elt *elt, octave_value&, | bool do_oscanf (const scanf_format_elt *elt, octave_value&, | |||
const std::string& who /* = "scanf" */); | const std::string& who /* = "scanf" */); | |||
octave_value_list oscanf (const std::string& fmt, | octave_value_list oscanf (const std::string& fmt, | |||
skipping to change at line 513 | skipping to change at line 518 | |||
octave_stream (octave_base_stream *bs = 0); | octave_stream (octave_base_stream *bs = 0); | |||
~octave_stream (void); | ~octave_stream (void); | |||
octave_stream (const octave_stream&); | octave_stream (const octave_stream&); | |||
octave_stream& operator = (const octave_stream&); | octave_stream& operator = (const octave_stream&); | |||
int flush (void); | int flush (void); | |||
std::string getl (octave_idx_type max_len, bool& err, const std::string& | std::string getl (octave_idx_type max_len, bool& err, | |||
who /* = "getl" */); | const std::string& who /* = "getl" */); | |||
std::string getl (const octave_value& max_len, bool& err, | std::string getl (const octave_value& max_len, bool& err, | |||
const std::string& who /* = "getl" */); | const std::string& who /* = "getl" */); | |||
std::string gets (octave_idx_type max_len, bool& err, const std::string& | std::string gets (octave_idx_type max_len, bool& err, | |||
who /* = "gets" */); | const std::string& who /* = "gets" */); | |||
std::string gets (const octave_value& max_len, bool& err, | std::string gets (const octave_value& max_len, bool& err, | |||
const std::string& who /* = "gets" */); | const std::string& who /* = "gets" */); | |||
long skipl (long count, bool& err, const std::string& who /* = "skipl" */ | off_t skipl (off_t count, bool& err, const std::string& who /* = "skipl" | |||
); | */); | |||
long skipl (const octave_value& count, bool& err, const std::string& who | off_t skipl (const octave_value& count, bool& err, | |||
/* = "skipl" */); | const std::string& who /* = "skipl" */); | |||
int seek (long offset, int origin); | int seek (off_t offset, int origin); | |||
int seek (const octave_value& offset, const octave_value& origin); | int seek (const octave_value& offset, const octave_value& origin); | |||
long tell (void); | off_t tell (void); | |||
int rewind (void); | int rewind (void); | |||
bool is_open (void) const; | bool is_open (void) const; | |||
void close (void); | void close (void); | |||
octave_value read (const Array<double>& size, octave_idx_type block_size, | octave_value read (const Array<double>& size, octave_idx_type block_size, | |||
oct_data_conv::data_type input_type, | oct_data_conv::data_type input_type, | |||
oct_data_conv::data_type output_type, | oct_data_conv::data_type output_type, | |||
octave_idx_type skip, oct_mach_info::float_format flt_ fmt, | octave_idx_type skip, oct_mach_info::float_format flt_ fmt, | |||
octave_idx_type& count); | octave_idx_type& count); | |||
octave_idx_type write (const octave_value& data, octave_idx_type block_si ze, | octave_idx_type write (const octave_value& data, octave_idx_type block_si ze, | |||
oct_data_conv::data_type output_type, | oct_data_conv::data_type output_type, | |||
octave_idx_type skip, oct_mach_info::float_format flt_fmt); | octave_idx_type skip, | |||
oct_mach_info::float_format flt_fmt); | ||||
bool write_bytes (const void *data, size_t n_elts); | ||||
bool skip_bytes (size_t n_elts); | ||||
template <class T> | template <class T> | |||
octave_idx_type write (const Array<T>&, octave_idx_type block_size, | octave_idx_type write (const Array<T>& data, octave_idx_type block_size, | |||
oct_data_conv::data_type output_type, | oct_data_conv::data_type output_type, | |||
octave_idx_type skip, oct_mach_info::float_format flt_fmt); | octave_idx_type skip, | |||
oct_mach_info::float_format flt_fmt); | ||||
octave_value scanf (const std::string& fmt, const Array<double>& size, | octave_value scanf (const std::string& fmt, const Array<double>& size, | |||
octave_idx_type& count, const std::string& who /* = " scanf" */); | octave_idx_type& count, const std::string& who /* = " scanf" */); | |||
octave_value scanf (const octave_value& fmt, const Array<double>& size, | octave_value scanf (const octave_value& fmt, const Array<double>& size, | |||
octave_idx_type& count, const std::string& who /* = " scanf" */); | octave_idx_type& count, const std::string& who /* = " scanf" */); | |||
octave_value_list oscanf (const std::string& fmt, | octave_value_list oscanf (const std::string& fmt, | |||
const std::string& who /* = "scanf" */); | const std::string& who /* = "scanf" */); | |||
skipping to change at line 576 | skipping to change at line 590 | |||
const std::string& who /* = "printf" */); | const std::string& who /* = "printf" */); | |||
int puts (const std::string& s, const std::string& who /* = "puts" */); | int puts (const std::string& s, const std::string& who /* = "puts" */); | |||
int puts (const octave_value& s, const std::string& who /* = "puts" */); | int puts (const octave_value& s, const std::string& who /* = "puts" */); | |||
bool eof (void) const; | bool eof (void) const; | |||
std::string error (bool clear, int& err_num); | std::string error (bool clear, int& err_num); | |||
std::string error (bool clear = false) | std::string error (bool clear = false) | |||
{ | { | |||
int err_num; | int err_num; | |||
return error (clear, err_num); | return error (clear, err_num); | |||
} | } | |||
// Set the error message and state. | // Set the error message and state. | |||
void error (const std::string& msg) | void error (const std::string& msg) | |||
{ | { | |||
if (rep) | if (rep) | |||
rep->error (msg); | rep->error (msg); | |||
} | } | |||
void error (const char *msg) { error (std::string (msg)); } | void error (const char *msg) { error (std::string (msg)); } | |||
int file_number (void) { return rep ? rep->file_number () : -1; } | int file_number (void) { return rep ? rep->file_number () : -1; } | |||
bool is_valid (void) const { return (rep != 0); } | bool is_valid (void) const { return (rep != 0); } | |||
bool ok (void) const { return rep && rep->ok (); } | bool ok (void) const { return rep && rep->ok (); } | |||
operator bool () const { return ok (); } | operator bool () const { return ok (); } | |||
skipping to change at line 625 | skipping to change at line 639 | |||
} | } | |||
void clearerr (void) { if (rep) rep->clearerr (); } | void clearerr (void) { if (rep) rep->clearerr (); } | |||
private: | private: | |||
// The actual representation of this stream. | // The actual representation of this stream. | |||
octave_base_stream *rep; | octave_base_stream *rep; | |||
bool stream_ok (bool clear = true) const | bool stream_ok (bool clear = true) const | |||
{ | { | |||
bool retval = true; | bool retval = true; | |||
if (rep) | if (rep) | |||
{ | { | |||
if (clear) | if (clear) | |||
rep->clear (); | rep->clear (); | |||
} | } | |||
else | else | |||
retval = false; | retval = false; | |||
return retval; | return retval; | |||
} | } | |||
void invalid_operation (const std::string& who, const char *rw) | void invalid_operation (const std::string& who, const char *rw) | |||
{ | { | |||
if (rep) | if (rep) | |||
rep->invalid_operation (who, rw); | rep->invalid_operation (who, rw); | |||
} | } | |||
octave_value | ||||
finalize_read (std::list<void *>& input_buf_list, | ||||
octave_idx_type input_buf_elts, | ||||
octave_idx_type elts_read, | ||||
octave_idx_type nr, octave_idx_type nc, | ||||
oct_data_conv::data_type input_type, | ||||
oct_data_conv::data_type output_type, | ||||
oct_mach_info::float_format ffmt); | ||||
}; | }; | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
octave_stream_list | octave_stream_list | |||
{ | { | |||
protected: | protected: | |||
octave_stream_list (void) : list (), lookup_cache (list.end ()) { } | octave_stream_list (void) : list (), lookup_cache (list.end ()) { } | |||
skipping to change at line 697 | skipping to change at line 720 | |||
ostrl_map list; | ostrl_map list; | |||
mutable ostrl_map::const_iterator lookup_cache; | mutable ostrl_map::const_iterator lookup_cache; | |||
static octave_stream_list *instance; | static octave_stream_list *instance; | |||
static void cleanup_instance (void) { delete instance; instance = 0; } | static void cleanup_instance (void) { delete instance; instance = 0; } | |||
int do_insert (octave_stream& os); | int do_insert (octave_stream& os); | |||
octave_stream do_lookup (int fid, const std::string& who = std::string () | octave_stream do_lookup (int fid, | |||
) const; | const std::string& who = std::string ()) const; | |||
octave_stream do_lookup (const octave_value& fid, | octave_stream do_lookup (const octave_value& fid, | |||
const std::string& who = std::string ()) const; | const std::string& who = std::string ()) const; | |||
int do_remove (int fid, const std::string& who = std::string ()); | int do_remove (int fid, const std::string& who = std::string ()); | |||
int do_remove (const octave_value& fid, const std::string& who = std::str | int do_remove (const octave_value& fid, | |||
ing ()); | const std::string& who = std::string ()); | |||
void do_clear (bool flush = true); | void do_clear (bool flush = true); | |||
string_vector do_get_info (int fid) const; | string_vector do_get_info (int fid) const; | |||
string_vector do_get_info (const octave_value& fid) const; | string_vector do_get_info (const octave_value& fid) const; | |||
std::string do_list_open_files (void) const; | std::string do_list_open_files (void) const; | |||
octave_value do_open_file_numbers (void) const; | octave_value do_open_file_numbers (void) const; | |||
End of changes. 41 change blocks. | ||||
126 lines changed or deleted | 143 lines changed or added | |||
oct-strstrm.h | oct-strstrm.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_octave_strstream_h) | #if !defined (octave_oct_strstrm_h) | |||
#define octave_octave_strstream_h 1 | #define octave_oct_strstrm_h 1 | |||
#include <string> | #include <string> | |||
#include <sstream> | #include <sstream> | |||
#include "oct-stream.h" | #include "oct-stream.h" | |||
class | class | |||
octave_base_strstream : public octave_base_stream | octave_base_strstream : public octave_base_stream | |||
{ | { | |||
public: | public: | |||
octave_base_strstream (std::ios::openmode m = std::ios::out, | octave_base_strstream (std::ios::openmode m = std::ios::out, | |||
oct_mach_info::float_format ff | oct_mach_info::float_format ff | |||
= oct_mach_info::native_float_format ()) | = oct_mach_info::native_float_format ()) | |||
: octave_base_stream (m, ff) { } | : octave_base_stream (m, ff) { } | |||
// Position a stream at OFFSET relative to ORIGIN. | // Position a stream at OFFSET relative to ORIGIN. | |||
int seek (long, int); | int seek (off_t, int); | |||
// Return current stream position. | // Return current stream position. | |||
virtual long tell (void); | virtual off_t tell (void); | |||
// The name of the file. | // The name of the file. | |||
std::string name (void) const { return std::string (); } | std::string name (void) const { return std::string (); } | |||
virtual std::streambuf *rdbuf (void) = 0; | virtual std::streambuf *rdbuf (void) = 0; | |||
virtual bool bad (void) const = 0; | virtual bool bad (void) const = 0; | |||
virtual void clear (void) = 0; | virtual void clear (void) = 0; | |||
skipping to change at line 107 | skipping to change at line 107 | |||
= oct_mach_info::native_float_format ()); | = oct_mach_info::native_float_format ()); | |||
// Return non-zero if EOF has been reached on this stream. | // Return non-zero if EOF has been reached on this stream. | |||
bool eof (void) const { return is.eof (); } | bool eof (void) const { return is.eof (); } | |||
std::istream *input_stream (void) { return &is; } | std::istream *input_stream (void) { return &is; } | |||
std::ostream *output_stream (void) { return 0; } | std::ostream *output_stream (void) { return 0; } | |||
long tell (void) { return is.tellg (); } | off_t tell (void) { return is.tellg (); } | |||
std::streambuf *rdbuf (void) { return is ? is.rdbuf () : 0; } | std::streambuf *rdbuf (void) { return is ? is.rdbuf () : 0; } | |||
bool bad (void) const { return is.bad (); } | bool bad (void) const { return is.bad (); } | |||
void clear (void) { is.clear (); } | void clear (void) { is.clear (); } | |||
protected: | protected: | |||
~octave_istrstream (void) { } | ~octave_istrstream (void) { } | |||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
oct-syscalls.h | oct-syscalls.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_syscalls_h) | #if !defined (octave_oct_syscalls_h) | |||
#define octave_syscalls_h 1 | #define octave_oct_syscalls_h 1 | |||
#include <string> | #include <string> | |||
class string_vector; | class string_vector; | |||
#include <sys/types.h> | #include <sys/types.h> | |||
struct | struct | |||
OCTAVE_API | OCTAVE_API | |||
octave_syscalls | octave_syscalls | |||
skipping to change at line 66 | skipping to change at line 66 | |||
static int pipe (int *); | static int pipe (int *); | |||
static int pipe (int *, std::string&); | static int pipe (int *, std::string&); | |||
static pid_t waitpid (pid_t, int *status, int); | static pid_t waitpid (pid_t, int *status, int); | |||
static pid_t waitpid (pid_t, int *status, int, std::string&); | static pid_t waitpid (pid_t, int *status, int, std::string&); | |||
static int kill (pid_t, int); | static int kill (pid_t, int); | |||
static int kill (pid_t, int, std::string&); | static int kill (pid_t, int, std::string&); | |||
static pid_t popen2 (const std::string&, const string_vector&, bool, int *); | static pid_t popen2 (const std::string&, const string_vector&, bool, int *); | |||
static pid_t popen2 (const std::string&, const string_vector&, bool, int | static pid_t popen2 (const std::string&, const string_vector&, bool, int | |||
*, std::string&); | *, | |||
static pid_t popen2 (const std::string&, const string_vector&, bool, int | std::string&); | |||
*, std::string&, bool &interactive); | static pid_t popen2 (const std::string&, const string_vector&, bool, int | |||
*, | ||||
std::string&, bool &interactive); | ||||
}; | }; | |||
#endif | #endif | |||
extern OCTAVE_API int octave_fcntl (int, int, long); | extern OCTAVE_API int octave_fcntl (int, int, long); | |||
extern OCTAVE_API int octave_fcntl (int, int, long, std::string&); | extern OCTAVE_API int octave_fcntl (int, int, long, std::string&); | |||
End of changes. 3 change blocks. | ||||
7 lines changed or deleted | 9 lines changed or added | |||
oct-time.h | oct-time.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1999-2012 John W. Eaton | Copyright (C) 1999-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_time_h) | #if !defined (octave_oct_time_h) | |||
#define octave_time_h 1 | #define octave_oct_time_h 1 | |||
#include <ctime> | #include <ctime> | |||
#include <string> | #include <string> | |||
#include "lo-math.h" | #include "lo-math.h" | |||
class octave_base_tm; | class octave_base_tm; | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
skipping to change at line 239 | skipping to change at line 239 | |||
octave_base_tm& year (int v); | octave_base_tm& year (int v); | |||
octave_base_tm& wday (int v); | octave_base_tm& wday (int v); | |||
octave_base_tm& yday (int v); | octave_base_tm& yday (int v); | |||
octave_base_tm& isdst (int v); | octave_base_tm& isdst (int v); | |||
octave_base_tm& gmtoff (long v); | octave_base_tm& gmtoff (long v); | |||
octave_base_tm& zone (const std::string& s); | octave_base_tm& zone (const std::string& s); | |||
std::string strftime (const std::string& fmt) const; | std::string strftime (const std::string& fmt) const; | |||
std::string asctime (void) const | std::string asctime (void) const | |||
{ return strftime ("%a %b %d %H:%M:%S %Y\n"); } | { return strftime ("%a %b %d %H:%M:%S %Y\n"); } | |||
protected: | protected: | |||
// Microseconds after the second (0, 999999). | // Microseconds after the second (0, 999999). | |||
int tm_usec; | int tm_usec; | |||
// Seconds after the minute (0, 61). | // Seconds after the minute (0, 61). | |||
int tm_sec; | int tm_sec; | |||
// Minutes after the hour (0, 59). | // Minutes after the hour (0, 59). | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
oct-uname.h | oct-uname.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2005-2012 John W. Eaton | Copyright (C) 2005-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_uame_h) | #if !defined (octave_oct_uname_h) | |||
#define octave_uname_h 1 | #define octave_uname_h 1 | |||
#include <string> | #include <string> | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
octave_uname | octave_uname | |||
{ | { | |||
public: | public: | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
oct.h | oct.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 31 | skipping to change at line 31 | |||
*/ | */ | |||
#if !defined (octave_oct_h) | #if !defined (octave_oct_h) | |||
#define octave_oct_h 1 | #define octave_oct_h 1 | |||
// Things that are often included to create .oct files. | // Things that are often included to create .oct files. | |||
// config.h needs to be first because it includes #defines that can */ | // config.h needs to be first because it includes #defines that can */ | |||
// affect other header files. | // affect other header files. | |||
#include "config.h" | #include <config.h> | |||
#include "Matrix.h" | #include "Matrix.h" | |||
#include "oct-locbuf.h" | #include "oct-locbuf.h" | |||
#include "defun-dld.h" | #include "defun-dld.h" | |||
#include "error.h" | #include "error.h" | |||
#include "gripes.h" | #include "gripes.h" | |||
#include "help.h" | #include "help.h" | |||
#include "oct-obj.h" | #include "oct-obj.h" | |||
#include "pager.h" | #include "pager.h" | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
octave.h | octave.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2002-2012 John W. Eaton | Copyright (C) 2002-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 32 | skipping to change at line 32 | |||
#if !defined (octave_octave_h) | #if !defined (octave_octave_h) | |||
#define octave_octave_h 1 | #define octave_octave_h 1 | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
extern OCTINTERP_API int octave_main (int argc, char **argv, int embedded); | extern OCTINTERP_API int octave_main (int argc, char **argv, int embedded); | |||
extern OCTINTERP_API void octave_process_command_line (int argc, char **arg | ||||
v); | ||||
extern OCTINTERP_API void | ||||
octave_initialize_interpreter (int argc, char **argv, int embedded); | ||||
extern OCTINTERP_API int octave_execute_interpreter (void); | ||||
extern OCTINTERP_API int octave_cmdline_argc; | ||||
extern OCTINTERP_API char **octave_cmdline_argv; | ||||
extern OCTINTERP_API int octave_embedded; | ||||
extern OCTINTERP_API int octave_starting_gui (void); | ||||
extern OCTINTERP_API int octave_fork_gui (void); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 16 lines changed or added | |||
op-dm-template.cc | op-dm-template.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
op-dms-template.cc | op-dms-template.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
op-int.h | op-int.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 634 | skipping to change at line 634 | |||
DEFUNOP (m_transpose, TYPE ## _matrix) \ | DEFUNOP (m_transpose, TYPE ## _matrix) \ | |||
{ \ | { \ | |||
CAST_UNOP_ARG (const octave_ ## TYPE ## _matrix&); \ | CAST_UNOP_ARG (const octave_ ## TYPE ## _matrix&); \ | |||
\ | \ | |||
if (v.ndims () > 2) \ | if (v.ndims () > 2) \ | |||
{ \ | { \ | |||
error ("transpose not defined for N-d objects"); \ | error ("transpose not defined for N-d objects"); \ | |||
return octave_value (); \ | return octave_value (); \ | |||
} \ | } \ | |||
else \ | else \ | |||
return octave_value (v.TYPE ## _array_value().transpose ()); \ | return octave_value (v.TYPE ## _array_value ().transpose ()); \ | |||
} \ | } \ | |||
\ | \ | |||
DEFNCUNOP_METHOD (m_incr, TYPE ## _matrix, increment) \ | DEFNCUNOP_METHOD (m_incr, TYPE ## _matrix, increment) \ | |||
DEFNCUNOP_METHOD (m_decr, TYPE ## _matrix, decrement) \ | DEFNCUNOP_METHOD (m_decr, TYPE ## _matrix, decrement) \ | |||
DEFNCUNOP_METHOD (m_changesign, TYPE ## _matrix, changesign) | DEFNCUNOP_METHOD (m_changesign, TYPE ## _matrix, changesign) | |||
#define OCTAVE_MM_INT_ARITH_OPS(PFX, T1, T2, T3) \ | #define OCTAVE_MM_INT_ARITH_OPS(PFX, T1, T2, T3) \ | |||
/* matrix by matrix ops. */ \ | /* matrix by matrix ops. */ \ | |||
\ | \ | |||
DEFINTNDBINOP_OP (PFX ## _add, T1 ## matrix, T2 ## matrix, T1 ## array, T 2 ## array, +, T3) \ | DEFINTNDBINOP_OP (PFX ## _add, T1 ## matrix, T2 ## matrix, T1 ## array, T 2 ## array, +, T3) \ | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
op-pm-template.cc | op-pm-template.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
ops.h | ops.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009 VZLU Prague, a.s. | Copyright (C) 2009 VZLU Prague, a.s. | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 248 | skipping to change at line 248 | |||
return octave_value (op v.CONCAT2(t, _value) ()); \ | return octave_value (op v.CONCAT2(t, _value) ()); \ | |||
} | } | |||
#define DEFNDUNOP_OP(name, t, e, op) \ | #define DEFNDUNOP_OP(name, t, e, op) \ | |||
UNOPDECL (name, a) \ | UNOPDECL (name, a) \ | |||
{ \ | { \ | |||
CAST_UNOP_ARG (const CONCAT2(octave_, t)&); \ | CAST_UNOP_ARG (const CONCAT2(octave_, t)&); \ | |||
return octave_value (op v.CONCAT2(e, _value) ()); \ | return octave_value (op v.CONCAT2(e, _value) ()); \ | |||
} | } | |||
// FIXME -- in some cases, the constructor isn't necessary. | // FIXME: in some cases, the constructor isn't necessary. | |||
#define DEFUNOP_FN(name, t, f) \ | #define DEFUNOP_FN(name, t, f) \ | |||
UNOPDECL (name, a) \ | UNOPDECL (name, a) \ | |||
{ \ | { \ | |||
CAST_UNOP_ARG (const CONCAT2(octave_, t)&); \ | CAST_UNOP_ARG (const CONCAT2(octave_, t)&); \ | |||
return octave_value (f (v.CONCAT2(t, _value) ())); \ | return octave_value (f (v.CONCAT2(t, _value) ())); \ | |||
} | } | |||
#define DEFNDUNOP_FN(name, t, e, f) \ | #define DEFNDUNOP_FN(name, t, e, f) \ | |||
UNOPDECL (name, a) \ | UNOPDECL (name, a) \ | |||
skipping to change at line 321 | skipping to change at line 321 | |||
} | } | |||
#define DEFNDBINOP_OP(name, t1, t2, e1, e2, op) \ | #define DEFNDBINOP_OP(name, t1, t2, e1, e2, op) \ | |||
BINOPDECL (name, a1, a2) \ | BINOPDECL (name, a1, a2) \ | |||
{ \ | { \ | |||
CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2 )&); \ | CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2 )&); \ | |||
return octave_value \ | return octave_value \ | |||
(v1.CONCAT2(e1, _value) () op v2.CONCAT2(e2, _value) ()); \ | (v1.CONCAT2(e1, _value) () op v2.CONCAT2(e2, _value) ()); \ | |||
} | } | |||
// FIXME -- in some cases, the constructor isn't necessary. | // FIXME: in some cases, the constructor isn't necessary. | |||
#define DEFBINOP_FN(name, t1, t2, f) \ | #define DEFBINOP_FN(name, t1, t2, f) \ | |||
BINOPDECL (name, a1, a2) \ | BINOPDECL (name, a1, a2) \ | |||
{ \ | { \ | |||
CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2 )&); \ | CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2 )&); \ | |||
return octave_value (f (v1.CONCAT2(t1, _value) (), v2.CONCAT2(t2, _valu e) ())); \ | return octave_value (f (v1.CONCAT2(t1, _value) (), v2.CONCAT2(t2, _valu e) ())); \ | |||
} | } | |||
#define DEFNDBINOP_FN(name, t1, t2, e1, e2, f) \ | #define DEFNDBINOP_FN(name, t1, t2, e1, e2, f) \ | |||
BINOPDECL (name, a1, a2) \ | BINOPDECL (name, a1, a2) \ | |||
skipping to change at line 344 | skipping to change at line 344 | |||
return octave_value (f (v1.CONCAT2(e1, _value) (), v2.CONCAT2(e2, _valu e) ())); \ | return octave_value (f (v1.CONCAT2(e1, _value) (), v2.CONCAT2(e2, _valu e) ())); \ | |||
} | } | |||
#define DEFNDCMPLXCMPOP_FN(name, t1, t2, e1, e2, f) \ | #define DEFNDCMPLXCMPOP_FN(name, t1, t2, e1, e2, f) \ | |||
BINOPDECL (name, a1, a2) \ | BINOPDECL (name, a1, a2) \ | |||
{ \ | { \ | |||
CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2 )&); \ | CAST_BINOP_ARGS (const CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2 )&); \ | |||
return octave_value (f (v1.CONCAT2(e1, _value) (), v2.CONCAT2(e2, _valu e) ())); \ | return octave_value (f (v1.CONCAT2(e1, _value) (), v2.CONCAT2(e2, _valu e) ())); \ | |||
} | } | |||
#define BINOP_NONCONFORMANT(msg) \ | ||||
gripe_nonconformant (msg, \ | ||||
a1.rows (), a1.columns (), \ | ||||
a2.rows (), a2.columns ()); \ | ||||
return octave_value () | ||||
#define CATOPDECL(name, a1, a2) \ | #define CATOPDECL(name, a1, a2) \ | |||
static octave_value \ | static octave_value \ | |||
CONCAT2(oct_catop_, name) (octave_base_value& a1, const octave_base_value & a2, \ | CONCAT2(oct_catop_, name) (octave_base_value& a1, const octave_base_value & a2, \ | |||
const Array<octave_idx_type>& ra_idx) | const Array<octave_idx_type>& ra_idx) | |||
#define DEFCATOPX(name, t1, t2) \ | #define DEFCATOPX(name, t1, t2) \ | |||
CATOPDECL (name, , ) | CATOPDECL (name, , ) | |||
#define DEFCATOP(name, t1, t2) \ | #define DEFCATOP(name, t1, t2) \ | |||
CATOPDECL (name, a1, a2) | CATOPDECL (name, a1, a2) | |||
// FIXME -- in some cases, the constructor isn't necessary. | // FIXME: in some cases, the constructor isn't necessary. | |||
#define DEFCATOP_FN(name, t1, t2, f) \ | #define DEFCATOP_FN(name, t1, t2, f) \ | |||
CATOPDECL (name, a1, a2) \ | CATOPDECL (name, a1, a2) \ | |||
{ \ | { \ | |||
CAST_BINOP_ARGS (CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \ | CAST_BINOP_ARGS (CONCAT2(octave_, t1)&, const CONCAT2(octave_, t2)&); \ | |||
return octave_value (v1.CONCAT2(t1, _value) () . f (v2.CONCAT2(t2, _val ue) (), ra_idx)); \ | return octave_value (v1.CONCAT2(t1, _value) () . f (v2.CONCAT2(t2, _val ue) (), ra_idx)); \ | |||
} | } | |||
#define DEFNDCATOP_FN(name, t1, t2, e1, e2, f) \ | #define DEFNDCATOP_FN(name, t1, t2, e1, e2, f) \ | |||
CATOPDECL (name, a1, a2) \ | CATOPDECL (name, a1, a2) \ | |||
End of changes. 5 change blocks. | ||||
10 lines changed or deleted | 4 lines changed or added | |||
ov-base-diag.cc | ov-base-diag.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 32 | skipping to change at line 32 | |||
#ifdef HAVE_CONFIG_H | #ifdef HAVE_CONFIG_H | |||
#include <config.h> | #include <config.h> | |||
#endif | #endif | |||
#include <iostream> | #include <iostream> | |||
#include "mach-info.h" | #include "mach-info.h" | |||
#include "lo-ieee.h" | #include "lo-ieee.h" | |||
#include "mxarray.h" | ||||
#include "ov-base.h" | #include "ov-base.h" | |||
#include "ov-base-mat.h" | #include "ov-base-mat.h" | |||
#include "pr-output.h" | #include "pr-output.h" | |||
#include "error.h" | #include "error.h" | |||
#include "gripes.h" | #include "gripes.h" | |||
#include "oct-stream.h" | #include "oct-stream.h" | |||
#include "ops.h" | #include "ops.h" | |||
#include "ls-oct-ascii.h" | #include "ls-oct-ascii.h" | |||
skipping to change at line 109 | skipping to change at line 110 | |||
octave_value retval; | octave_value retval; | |||
typedef typename DMT::element_type el_type; | typedef typename DMT::element_type el_type; | |||
if (idx.length () == 2 && ! resize_ok) | if (idx.length () == 2 && ! resize_ok) | |||
{ | { | |||
idx_vector idx0 = idx(0).index_vector (); | idx_vector idx0 = idx(0).index_vector (); | |||
idx_vector idx1 = idx(1).index_vector (); | idx_vector idx1 = idx(1).index_vector (); | |||
if (idx0.is_scalar () && idx1.is_scalar ()) | if (idx0.is_scalar () && idx1.is_scalar ()) | |||
{ | { | |||
retval = matrix.elem (idx0(0), idx1(0)); | retval = matrix.checkelem (idx0(0), idx1(0)); | |||
} | } | |||
else | else | |||
{ | { | |||
octave_idx_type m = idx0.length (matrix.rows ()); | octave_idx_type m = idx0.length (matrix.rows ()); | |||
octave_idx_type n = idx1.length (matrix.columns ()); | octave_idx_type n = idx1.length (matrix.columns ()); | |||
if (idx0.is_colon_equiv (m) && idx1.is_colon_equiv (n) | if (idx0.is_colon_equiv (m) && idx1.is_colon_equiv (n) | |||
&& m <= matrix.rows () && n <= matrix.rows ()) | && m <= matrix.rows () && n <= matrix.rows ()) | |||
{ | { | |||
DMT rm (matrix); | DMT rm (matrix); | |||
rm.resize (m, n); | rm.resize (m, n); | |||
skipping to change at line 147 | skipping to change at line 148 | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
switch (type[0]) | switch (type[0]) | |||
{ | { | |||
case '(': | case '(': | |||
{ | { | |||
if (type.length () == 1) | if (type.length () == 1) | |||
{ | { | |||
octave_value_list jdx = idx.front (); | octave_value_list jdx = idx.front (); | |||
// Check for a simple element assignment. That means, if D is a | // Check for a simple element assignment. That means, if D is a | |||
diagonal matrix, | // diagonal matrix, 'D(i,i) = x' will not destroy its diagonali | |||
// 'D(i,i) = x' will not destroy its diagonality (provided i is | ty | |||
a valid index). | // (provided i is a valid index). | |||
if (jdx.length () == 2 && jdx(0).is_scalar_type () && jdx(1).is | if (jdx.length () == 2 | |||
_scalar_type ()) | && jdx(0).is_scalar_type () && jdx(1).is_scalar_type ()) | |||
{ | { | |||
typename DMT::element_type val; | typename DMT::element_type val; | |||
idx_vector i0 = jdx(0).index_vector (), i1 = jdx(1).index_v | idx_vector i0 = jdx(0).index_vector (); | |||
ector (); | idx_vector i1 = jdx(1).index_vector (); | |||
if (! error_state && i0(0) == i1(0) | if (! error_state && i0(0) == i1(0) | |||
&& i0(0) < matrix.rows () && i1(0) < matrix.cols () | && i0(0) < matrix.rows () && i1(0) < matrix.cols () | |||
&& chk_valid_scalar (rhs, val)) | && chk_valid_scalar (rhs, val)) | |||
{ | { | |||
matrix.dgelem (i0(0)) = val; | matrix.dgelem (i0(0)) = val; | |||
retval = this; | retval = this; | |||
this->count++; | this->count++; | |||
// invalidate cache | // invalidate cache | |||
dense_cache = octave_value (); | dense_cache = octave_value (); | |||
} | } | |||
skipping to change at line 224 | skipping to change at line 228 | |||
return retval; | return retval; | |||
} | } | |||
template <class DMT, class MT> | template <class DMT, class MT> | |||
bool | bool | |||
octave_base_diag<DMT, MT>::is_true (void) const | octave_base_diag<DMT, MT>::is_true (void) const | |||
{ | { | |||
return to_dense ().is_true (); | return to_dense ().is_true (); | |||
} | } | |||
// FIXME: this should be achieveable using ::real | // FIXME: This should be achieveable using ::real | |||
template <class T> inline T helper_getreal (T x) { return x; } | template <class T> inline T helper_getreal (T x) { return x; } | |||
template <class T> inline T helper_getreal (std::complex<T> x) { return x.r | template <class T> inline T helper_getreal (std::complex<T> x) | |||
eal (); } | { return x.real (); } | |||
// FIXME: we really need some traits so that ad hoc hooks like this are not | // FIXME: We really need some traits so that ad hoc hooks like this | |||
necessary | // are not necessary. | |||
template <class T> inline T helper_iscomplex (T) { return false; } | template <class T> inline T helper_iscomplex (T) { return false; } | |||
template <class T> inline T helper_iscomplex (std::complex<T>) { return tru e; } | template <class T> inline T helper_iscomplex (std::complex<T>) { return tru e; } | |||
template <class DMT, class MT> | template <class DMT, class MT> | |||
double | double | |||
octave_base_diag<DMT, MT>::double_value (bool force_conversion) const | octave_base_diag<DMT, MT>::double_value (bool force_conversion) const | |||
{ | { | |||
double retval = lo_ieee_nan_value (); | double retval = lo_ieee_nan_value (); | |||
typedef typename DMT::element_type el_type; | typedef typename DMT::element_type el_type; | |||
if (helper_iscomplex (el_type ()) && ! force_conversion) | if (helper_iscomplex (el_type ()) && ! force_conversion) | |||
gripe_implicit_conversion ("Octave:imag-to-real", | gripe_implicit_conversion ("Octave:imag-to-real", | |||
"complex matrix", "real scalar"); | "complex matrix", "real scalar"); | |||
if (numel () > 0) | if (numel () > 0) | |||
{ | { | |||
gripe_implicit_conversion ("Octave:array-as-scalar", | gripe_implicit_conversion ("Octave:array-to-scalar", | |||
type_name (), "real scalar"); | type_name (), "real scalar"); | |||
retval = helper_getreal (el_type (matrix (0, 0))); | retval = helper_getreal (el_type (matrix (0, 0))); | |||
} | } | |||
else | else | |||
gripe_invalid_conversion (type_name (), "real scalar"); | gripe_invalid_conversion (type_name (), "real scalar"); | |||
return retval; | return retval; | |||
} | } | |||
skipping to change at line 268 | skipping to change at line 274 | |||
{ | { | |||
float retval = lo_ieee_float_nan_value (); | float retval = lo_ieee_float_nan_value (); | |||
typedef typename DMT::element_type el_type; | typedef typename DMT::element_type el_type; | |||
if (helper_iscomplex (el_type ()) && ! force_conversion) | if (helper_iscomplex (el_type ()) && ! force_conversion) | |||
gripe_implicit_conversion ("Octave:imag-to-real", | gripe_implicit_conversion ("Octave:imag-to-real", | |||
"complex matrix", "real scalar"); | "complex matrix", "real scalar"); | |||
if (numel () > 0) | if (numel () > 0) | |||
{ | { | |||
gripe_implicit_conversion ("Octave:array-as-scalar", | gripe_implicit_conversion ("Octave:array-to-scalar", | |||
type_name (), "real scalar"); | type_name (), "real scalar"); | |||
retval = helper_getreal (el_type (matrix (0, 0))); | retval = helper_getreal (el_type (matrix (0, 0))); | |||
} | } | |||
else | else | |||
gripe_invalid_conversion (type_name (), "real scalar"); | gripe_invalid_conversion (type_name (), "real scalar"); | |||
return retval; | return retval; | |||
} | } | |||
template <class DMT, class MT> | template <class DMT, class MT> | |||
Complex | Complex | |||
octave_base_diag<DMT, MT>::complex_value (bool) const | octave_base_diag<DMT, MT>::complex_value (bool) const | |||
{ | { | |||
double tmp = lo_ieee_nan_value (); | double tmp = lo_ieee_nan_value (); | |||
Complex retval (tmp, tmp); | Complex retval (tmp, tmp); | |||
if (rows () > 0 && columns () > 0) | if (rows () > 0 && columns () > 0) | |||
{ | { | |||
gripe_implicit_conversion ("Octave:array-as-scalar", | gripe_implicit_conversion ("Octave:array-to-scalar", | |||
type_name (), "complex scalar"); | type_name (), "complex scalar"); | |||
retval = matrix (0, 0); | retval = matrix (0, 0); | |||
} | } | |||
else | else | |||
gripe_invalid_conversion (type_name (), "complex scalar"); | gripe_invalid_conversion (type_name (), "complex scalar"); | |||
return retval; | return retval; | |||
} | } | |||
template <class DMT, class MT> | template <class DMT, class MT> | |||
FloatComplex | FloatComplex | |||
octave_base_diag<DMT, MT>::float_complex_value (bool) const | octave_base_diag<DMT, MT>::float_complex_value (bool) const | |||
{ | { | |||
float tmp = lo_ieee_float_nan_value (); | float tmp = lo_ieee_float_nan_value (); | |||
FloatComplex retval (tmp, tmp); | FloatComplex retval (tmp, tmp); | |||
if (rows () > 0 && columns () > 0) | if (rows () > 0 && columns () > 0) | |||
{ | { | |||
gripe_implicit_conversion ("Octave:array-as-scalar", | gripe_implicit_conversion ("Octave:array-to-scalar", | |||
type_name (), "complex scalar"); | type_name (), "complex scalar"); | |||
retval = matrix (0, 0); | retval = matrix (0, 0); | |||
} | } | |||
else | else | |||
gripe_invalid_conversion (type_name (), "complex scalar"); | gripe_invalid_conversion (type_name (), "complex scalar"); | |||
return retval; | return retval; | |||
} | } | |||
skipping to change at line 414 | skipping to change at line 420 | |||
template <class DMT, class MT> | template <class DMT, class MT> | |||
idx_vector | idx_vector | |||
octave_base_diag<DMT, MT>::index_vector (void) const | octave_base_diag<DMT, MT>::index_vector (void) const | |||
{ | { | |||
return to_dense ().index_vector (); | return to_dense ().index_vector (); | |||
} | } | |||
template <class DMT, class MT> | template <class DMT, class MT> | |||
octave_value | octave_value | |||
octave_base_diag<DMT, MT>::convert_to_str_internal (bool pad, bool force, c | octave_base_diag<DMT, MT>::convert_to_str_internal (bool pad, bool force, | |||
har type) const | char type) const | |||
{ | { | |||
return to_dense ().convert_to_str_internal (pad, force, type); | return to_dense ().convert_to_str_internal (pad, force, type); | |||
} | } | |||
template <class DMT, class MT> | template <class DMT, class MT> | |||
bool | bool | |||
octave_base_diag<DMT, MT>::save_ascii (std::ostream& os) | octave_base_diag<DMT, MT>::save_ascii (std::ostream& os) | |||
{ | { | |||
os << "# rows: " << matrix.rows () << "\n" | os << "# rows: " << matrix.rows () << "\n" | |||
<< "# columns: " << matrix.columns () << "\n"; | << "# columns: " << matrix.columns () << "\n"; | |||
os << matrix.diag (); | os << matrix.extract_diag (); | |||
return true; | return true; | |||
} | } | |||
template <class DMT, class MT> | template <class DMT, class MT> | |||
bool | bool | |||
octave_base_diag<DMT, MT>::load_ascii (std::istream& is) | octave_base_diag<DMT, MT>::load_ascii (std::istream& is) | |||
{ | { | |||
octave_idx_type r = 0, c = 0; | octave_idx_type r = 0, c = 0; | |||
bool success = true; | bool success = true; | |||
skipping to change at line 499 | skipping to change at line 506 | |||
bool | bool | |||
octave_base_diag<DMT, MT>::print_as_scalar (void) const | octave_base_diag<DMT, MT>::print_as_scalar (void) const | |||
{ | { | |||
dim_vector dv = dims (); | dim_vector dv = dims (); | |||
return (dv.all_ones () || dv.any_zero ()); | return (dv.all_ones () || dv.any_zero ()); | |||
} | } | |||
template <class DMT, class MT> | template <class DMT, class MT> | |||
void | void | |||
octave_base_diag<DMT, MT>::print (std::ostream& os, bool pr_as_read_syntax) | octave_base_diag<DMT, MT>::print (std::ostream& os, | |||
const | bool pr_as_read_syntax) const | |||
{ | { | |||
print_raw (os, pr_as_read_syntax); | print_raw (os, pr_as_read_syntax); | |||
newline (os); | newline (os); | |||
} | } | |||
template <class DMT, class MT> | template <class DMT, class MT> | |||
int | int | |||
octave_base_diag<DMT, MT>::write (octave_stream& os, int block_size, | octave_base_diag<DMT, MT>::write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int | oct_data_conv::data_type output_type, | |||
skip, | int skip, | |||
oct_mach_info::float_format flt_fmt) cons t | oct_mach_info::float_format flt_fmt) cons t | |||
{ | { | |||
return to_dense ().write (os, block_size, output_type, skip, flt_fmt); | return to_dense ().write (os, block_size, output_type, skip, flt_fmt); | |||
} | } | |||
template <class DMT, class MT> | template <class DMT, class MT> | |||
void | void | |||
octave_base_diag<DMT, MT>::print_info (std::ostream& os, | octave_base_diag<DMT, MT>::print_info (std::ostream& os, | |||
const std::string& prefix) const | const std::string& prefix) const | |||
{ | { | |||
End of changes. 16 change blocks. | ||||
27 lines changed or deleted | 28 lines changed or added | |||
ov-base-diag.h | ov-base-diag.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_base_diag_h) | #if !defined (octave_ov_base_diag_h) | |||
#define octave_base_diag_h 1 | #define octave_ov_base_diag_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "oct-obj.h" | #include "oct-obj.h" | |||
skipping to change at line 72 | skipping to change at line 72 | |||
octave_value squeeze (void) const { return matrix; } | octave_value squeeze (void) const { return matrix; } | |||
octave_value full_value (void) const { return to_dense (); } | octave_value full_value (void) const { return to_dense (); } | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx); | const std::list<octave_value_list>& idx); | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, int) | const std::list<octave_value_list>& idx, int) | |||
{ return subsref (type, idx); } | { return subsref (type, idx); } | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
octave_value subsasgn (const std::string& type, | octave_value subsasgn (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
const octave_value& rhs); | const octave_value& rhs); | |||
dim_vector dims (void) const { return matrix.dims (); } | dim_vector dims (void) const { return matrix.dims (); } | |||
octave_idx_type nnz (void) const { return to_dense ().nnz (); } | octave_idx_type nnz (void) const { return to_dense ().nnz (); } | |||
octave_value reshape (const dim_vector& new_dims) const | octave_value reshape (const dim_vector& new_dims) const | |||
{ return to_dense ().reshape (new_dims); } | { return to_dense ().reshape (new_dims); } | |||
octave_value permute (const Array<int>& vec, bool inv = false) const | octave_value permute (const Array<int>& vec, bool inv = false) const | |||
{ return to_dense ().permute (vec, inv); } | { return to_dense ().permute (vec, inv); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const; | octave_value resize (const dim_vector& dv, bool fill = false) const; | |||
octave_value all (int dim = 0) const { return MT (matrix).all (dim); } | octave_value all (int dim = 0) const { return MT (matrix).all (dim); } | |||
octave_value any (int dim = 0) const { return MT (matrix).any (dim); } | octave_value any (int dim = 0) const { return MT (matrix).any (dim); } | |||
MatrixType matrix_type (void) const { return MatrixType::Diagonal; } | MatrixType matrix_type (void) const { return MatrixType::Diagonal; } | |||
MatrixType matrix_type (const MatrixType&) const | MatrixType matrix_type (const MatrixType&) const | |||
{ return matrix_type (); } | { return matrix_type (); } | |||
octave_value diag (octave_idx_type k = 0) const; | octave_value diag (octave_idx_type k = 0) const; | |||
octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | |||
{ return to_dense ().sort (dim, mode); } | { return to_dense ().sort (dim, mode); } | |||
octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const | sortmode mode = ASCENDING) const | |||
{ return to_dense ().sort (sidx, dim, mode); } | { return to_dense ().sort (sidx, dim, mode); } | |||
sortmode is_sorted (sortmode mode = UNSORTED) const | sortmode is_sorted (sortmode mode = UNSORTED) const | |||
{ return to_dense ().is_sorted (mode); } | { return to_dense ().is_sorted (mode); } | |||
Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const | Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const | |||
{ return to_dense ().sort_rows_idx (mode); } | { return to_dense ().sort_rows_idx (mode); } | |||
sortmode is_sorted_rows (sortmode mode = UNSORTED) const | sortmode is_sorted_rows (sortmode mode = UNSORTED) const | |||
{ return to_dense ().is_sorted_rows (mode); } | { return to_dense ().is_sorted_rows (mode); } | |||
bool is_matrix_type (void) const { return true; } | bool is_matrix_type (void) const { return true; } | |||
bool is_numeric_type (void) const { return true; } | bool is_numeric_type (void) const { return true; } | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
bool is_constant (void) const { return true; } | bool is_constant (void) const { return true; } | |||
bool is_true (void) const; | bool is_true (void) const; | |||
bool is_diag_matrix (void) const { return true; } | bool is_diag_matrix (void) const { return true; } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
float float_value (bool = false) const; | float float_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
idx_vector index_vector (void) const; | idx_vector index_vector (void) const; | |||
Matrix matrix_value (bool = false) const; | Matrix matrix_value (bool = false) const; | |||
FloatMatrix float_matrix_value (bool = false) const; | FloatMatrix float_matrix_value (bool = false) const; | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
FloatComplex float_complex_value (bool = false) const; | FloatComplex float_complex_value (bool = false) const; | |||
End of changes. 12 change blocks. | ||||
13 lines changed or deleted | 13 lines changed or added | |||
ov-base-int.cc | ov-base-int.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 27 | skipping to change at line 27 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#ifdef HAVE_CONFIG_H | #ifdef HAVE_CONFIG_H | |||
#include <config.h> | #include <config.h> | |||
#endif | #endif | |||
#include <climits> | ||||
#include <iostream> | #include <iostream> | |||
#include <limits> | ||||
#include <vector> | #include <vector> | |||
#include "lo-ieee.h" | #include "lo-ieee.h" | |||
#include "lo-utils.h" | #include "lo-utils.h" | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "quit.h" | #include "quit.h" | |||
#include "oct-locbuf.h" | #include "oct-locbuf.h" | |||
#include "defun.h" | #include "defun.h" | |||
#include "gripes.h" | #include "gripes.h" | |||
skipping to change at line 68 | skipping to change at line 67 | |||
// We have all the machinery below (octave_base_int_helper and | // We have all the machinery below (octave_base_int_helper and | |||
// octave_base_int_helper_traits) to avoid a few warnings from GCC | // octave_base_int_helper_traits) to avoid a few warnings from GCC | |||
// about comparisons always false due to limited range of data types. | // about comparisons always false due to limited range of data types. | |||
// Ugh. The cure may be worse than the disease. | // Ugh. The cure may be worse than the disease. | |||
template <class T, bool is_signed = true, bool can_be_too_big = true> | template <class T, bool is_signed = true, bool can_be_too_big = true> | |||
struct octave_base_int_helper | struct octave_base_int_helper | |||
{ | { | |||
static bool | static bool | |||
char_value_out_of_range (T val) { return val < 0 || val > UCHAR_MAX; } | char_value_out_of_range (T val) | |||
{ | ||||
return val < 0 || val > std::numeric_limits<unsigned char>::max (); | ||||
} | ||||
}; | }; | |||
template <class T> | template <class T> | |||
struct octave_base_int_helper<T, false, false> | struct octave_base_int_helper<T, false, false> | |||
{ | { | |||
static bool char_value_out_of_range (T) { return false; } | static bool char_value_out_of_range (T) { return false; } | |||
}; | }; | |||
template <class T> | template <class T> | |||
struct octave_base_int_helper<T, false, true> | struct octave_base_int_helper<T, false, true> | |||
{ | { | |||
static bool char_value_out_of_range (T val) { return val > UCHAR_MAX; } | static bool char_value_out_of_range (T val) | |||
{ | ||||
return val > std::numeric_limits<unsigned char>::max (); | ||||
} | ||||
}; | }; | |||
template <class T> | template <class T> | |||
struct octave_base_int_helper<T, true, false> | struct octave_base_int_helper<T, true, false> | |||
{ | { | |||
static bool char_value_out_of_range (T val) { return val < 0; } | static bool char_value_out_of_range (T val) { return val < 0; } | |||
}; | }; | |||
// For all types other than char, signed char, and unsigned char, we | // For all types other than char, signed char, and unsigned char, we | |||
// assume that the upper limit for the range of allowable values is | // assume that the upper limit for the range of allowable values is | |||
skipping to change at line 126 | skipping to change at line 131 | |||
static const bool can_be_larger_than_uchar_max = false; | static const bool can_be_larger_than_uchar_max = false; | |||
}; | }; | |||
template <class T> | template <class T> | |||
octave_base_value * | octave_base_value * | |||
octave_base_int_matrix<T>::try_narrowing_conversion (void) | octave_base_int_matrix<T>::try_narrowing_conversion (void) | |||
{ | { | |||
octave_base_value *retval = 0; | octave_base_value *retval = 0; | |||
if (this->matrix.nelem () == 1) | if (this->matrix.nelem () == 1) | |||
retval = new typename octave_value_int_traits<T>::scalar_type (this->ma | retval = new typename octave_value_int_traits<T>::scalar_type | |||
trix (0)); | (this->matrix (0)); | |||
return retval; | return retval; | |||
} | } | |||
template <class T> | template <class T> | |||
octave_value | octave_value | |||
octave_base_int_matrix<T>::convert_to_str_internal (bool, bool, char type) const | octave_base_int_matrix<T>::convert_to_str_internal (bool, bool, char type) const | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
dim_vector dv = this->dims (); | dim_vector dv = this->dims (); | |||
skipping to change at line 160 | skipping to change at line 166 | |||
val_type ival = tmp.value (); | val_type ival = tmp.value (); | |||
static const bool is_signed = std::numeric_limits<val_type>::is_signe d; | static const bool is_signed = std::numeric_limits<val_type>::is_signe d; | |||
static const bool can_be_larger_than_uchar_max | static const bool can_be_larger_than_uchar_max | |||
= octave_base_int_helper_traits<val_type>::can_be_larger_than_uchar _max; | = octave_base_int_helper_traits<val_type>::can_be_larger_than_uchar _max; | |||
if (octave_base_int_helper<val_type, is_signed, | if (octave_base_int_helper<val_type, is_signed, | |||
can_be_larger_than_uchar_max>::char_value_out_of_range (ival)) | can_be_larger_than_uchar_max>::char_value_out_of_range (ival)) | |||
{ | { | |||
// FIXME -- is there something better we could do? | // FIXME: is there something better we could do? | |||
ival = 0; | ival = 0; | |||
if (! warned) | if (! warned) | |||
{ | { | |||
::warning ("range error for conversion to character value"); | ::warning ("range error for conversion to character value"); | |||
warned = true; | warned = true; | |||
} | } | |||
} | } | |||
else | else | |||
skipping to change at line 241 | skipping to change at line 247 | |||
error ("load: failed to extract number of dimensions"); | error ("load: failed to extract number of dimensions"); | |||
return success; | return success; | |||
} | } | |||
template <class T> | template <class T> | |||
bool | bool | |||
octave_base_int_matrix<T>::save_binary (std::ostream& os, bool&) | octave_base_int_matrix<T>::save_binary (std::ostream& os, bool&) | |||
{ | { | |||
dim_vector d = this->dims (); | dim_vector d = this->dims (); | |||
if (d.length() < 1) | if (d.length () < 1) | |||
return false; | return false; | |||
// Use negative value for ndims to differentiate with old format!! | // Use negative value for ndims to differentiate with old format!! | |||
int32_t tmp = - d.length(); | int32_t tmp = - d.length (); | |||
os.write (reinterpret_cast<char *> (&tmp), 4); | os.write (reinterpret_cast<char *> (&tmp), 4); | |||
for (int i=0; i < d.length (); i++) | for (int i=0; i < d.length (); i++) | |||
{ | { | |||
tmp = d(i); | tmp = d(i); | |||
os.write (reinterpret_cast<char *> (&tmp), 4); | os.write (reinterpret_cast<char *> (&tmp), 4); | |||
} | } | |||
os.write (reinterpret_cast<const char *> (this->matrix.data()), this->byt | os.write (reinterpret_cast<const char *> (this->matrix.data ()), | |||
e_size()); | this->byte_size ()); | |||
return true; | return true; | |||
} | } | |||
template <class T> | template <class T> | |||
bool | bool | |||
octave_base_int_matrix<T>::load_binary (std::istream& is, bool swap, | octave_base_int_matrix<T>::load_binary (std::istream& is, bool swap, | |||
oct_mach_info::float_format ) | oct_mach_info::float_format ) | |||
{ | { | |||
int32_t mdims; | int32_t mdims; | |||
skipping to change at line 305 | skipping to change at line 312 | |||
} | } | |||
T m (dv); | T m (dv); | |||
if (! is.read (reinterpret_cast<char *> (m.fortran_vec ()), m.byte_size ( ))) | if (! is.read (reinterpret_cast<char *> (m.fortran_vec ()), m.byte_size ( ))) | |||
return false; | return false; | |||
if (swap) | if (swap) | |||
{ | { | |||
int nel = dv.numel (); | int nel = dv.numel (); | |||
int bytes = nel / m.byte_size(); | int bytes = nel / m.byte_size (); | |||
for (int i = 0; i < nel; i++) | for (int i = 0; i < nel; i++) | |||
switch (bytes) | switch (bytes) | |||
{ | { | |||
case 8: | case 8: | |||
swap_bytes<8> (&m(i)); | swap_bytes<8> (&m(i)); | |||
break; | break; | |||
case 4: | case 4: | |||
swap_bytes<4> (&m(i)); | swap_bytes<4> (&m(i)); | |||
break; | break; | |||
case 2: | case 2: | |||
skipping to change at line 366 | skipping to change at line 373 | |||
data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, | data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, | |||
H5P_DEFAULT); | H5P_DEFAULT); | |||
#endif | #endif | |||
if (data_hid < 0) | if (data_hid < 0) | |||
{ | { | |||
H5Sclose (space_hid); | H5Sclose (space_hid); | |||
return false; | return false; | |||
} | } | |||
retval = H5Dwrite (data_hid, save_type_hid, H5S_ALL, H5S_ALL, | retval = H5Dwrite (data_hid, save_type_hid, H5S_ALL, H5S_ALL, | |||
H5P_DEFAULT, this->matrix.data()) >= 0; | H5P_DEFAULT, this->matrix.data ()) >= 0; | |||
H5Dclose (data_hid); | H5Dclose (data_hid); | |||
H5Sclose (space_hid); | H5Sclose (space_hid); | |||
return retval; | return retval; | |||
} | } | |||
template <class T> | template <class T> | |||
bool | bool | |||
octave_base_int_matrix<T>::load_hdf5 (hid_t loc_id, const char *name) | octave_base_int_matrix<T>::load_hdf5 (hid_t loc_id, const char *name) | |||
{ | { | |||
hid_t save_type_hid = HDF5_SAVE_TYPE; | hid_t save_type_hid = HDF5_SAVE_TYPE; | |||
bool retval = false; | bool retval = false; | |||
dim_vector dv; | dim_vector dv; | |||
int empty = load_hdf5_empty (loc_id, name, dv); | int empty = load_hdf5_empty (loc_id, name, dv); | |||
if (empty > 0) | if (empty > 0) | |||
this->matrix.resize(dv); | this->matrix.resize (dv); | |||
if (empty) | if (empty) | |||
return (empty > 0); | return (empty > 0); | |||
#if HAVE_HDF5_18 | #if HAVE_HDF5_18 | |||
hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT); | hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT); | |||
#else | #else | |||
hid_t data_hid = H5Dopen (loc_id, name); | hid_t data_hid = H5Dopen (loc_id, name); | |||
#endif | #endif | |||
hid_t space_id = H5Dget_space (data_hid); | hid_t space_id = H5Dget_space (data_hid); | |||
hsize_t rank = H5Sget_simple_extent_ndims (space_id); | hsize_t rank = H5Sget_simple_extent_ndims (space_id); | |||
skipping to change at line 424 | skipping to change at line 431 | |||
} | } | |||
else | else | |||
{ | { | |||
dv.resize (rank); | dv.resize (rank); | |||
for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--) | for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--) | |||
dv(j) = hdims[i]; | dv(j) = hdims[i]; | |||
} | } | |||
T m (dv); | T m (dv); | |||
if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL, | if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL, | |||
H5P_DEFAULT, m.fortran_vec()) >= 0) | H5P_DEFAULT, m.fortran_vec ()) >= 0) | |||
{ | { | |||
retval = true; | retval = true; | |||
this->matrix = m; | this->matrix = m; | |||
} | } | |||
H5Sclose (space_id); | H5Sclose (space_id); | |||
H5Dclose (data_hid); | H5Dclose (data_hid); | |||
return retval; | return retval; | |||
} | } | |||
skipping to change at line 466 | skipping to change at line 473 | |||
val_type ival = tmp.value (); | val_type ival = tmp.value (); | |||
static const bool is_signed = std::numeric_limits<val_type>::is_signed; | static const bool is_signed = std::numeric_limits<val_type>::is_signed; | |||
static const bool can_be_larger_than_uchar_max | static const bool can_be_larger_than_uchar_max | |||
= octave_base_int_helper_traits<val_type>::can_be_larger_than_uchar_max ; | = octave_base_int_helper_traits<val_type>::can_be_larger_than_uchar_max ; | |||
if (octave_base_int_helper<val_type, is_signed, | if (octave_base_int_helper<val_type, is_signed, | |||
can_be_larger_than_uchar_max>::char_value_out_of_range (ival)) | can_be_larger_than_uchar_max>::char_value_out_of_range (ival)) | |||
{ | { | |||
// FIXME -- is there something better we could do? | // FIXME: is there something better we could do? | |||
ival = 0; | ival = 0; | |||
::warning ("range error for conversion to character value"); | ::warning ("range error for conversion to character value"); | |||
} | } | |||
else | else | |||
retval = octave_value (std::string (1, static_cast<char> (ival)), type) ; | retval = octave_value (std::string (1, static_cast<char> (ival)), type) ; | |||
return retval; | return retval; | |||
} | } | |||
skipping to change at line 503 | skipping to change at line 510 | |||
error ("load: failed to load scalar constant"); | error ("load: failed to load scalar constant"); | |||
return false; | return false; | |||
} | } | |||
return true; | return true; | |||
} | } | |||
template <class T> | template <class T> | |||
bool | bool | |||
octave_base_int_scalar<T>::save_binary (std::ostream& os, bool&) | octave_base_int_scalar<T>::save_binary (std::ostream& os, bool&) | |||
{ | { | |||
os.write (reinterpret_cast<char *> (&(this->scalar)), this->byte_size()); | os.write (reinterpret_cast<char *> (&(this->scalar)), this->byte_size ()) ; | |||
return true; | return true; | |||
} | } | |||
template <class T> | template <class T> | |||
bool | bool | |||
octave_base_int_scalar<T>::load_binary (std::istream& is, bool swap, | octave_base_int_scalar<T>::load_binary (std::istream& is, bool swap, | |||
oct_mach_info::float_format) | oct_mach_info::float_format) | |||
{ | { | |||
T tmp; | T tmp; | |||
if (! is.read (reinterpret_cast<char *> (&tmp), this->byte_size())) | if (! is.read (reinterpret_cast<char *> (&tmp), this->byte_size ())) | |||
return false; | return false; | |||
if (swap) | if (swap) | |||
switch (this->byte_size()) | switch (this->byte_size ()) | |||
{ | { | |||
case 8: | case 8: | |||
swap_bytes<8> (&tmp); | swap_bytes<8> (&tmp); | |||
break; | break; | |||
case 4: | case 4: | |||
swap_bytes<4> (&tmp); | swap_bytes<4> (&tmp); | |||
break; | break; | |||
case 2: | case 2: | |||
swap_bytes<2> (&tmp); | swap_bytes<2> (&tmp); | |||
break; | break; | |||
End of changes. 19 change blocks. | ||||
21 lines changed or deleted | 26 lines changed or added | |||
ov-base-int.h | ov-base-int.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_base_int_matrix_h) | #if !defined (octave_ov_base_int_h) | |||
#define octave_base_int_matrix_h 1 | #define octave_ov_base_int_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 55 | skipping to change at line 55 | |||
octave_base_int_matrix : public octave_base_matrix<T> | octave_base_int_matrix : public octave_base_matrix<T> | |||
{ | { | |||
public: | public: | |||
octave_base_int_matrix (void) : octave_base_matrix<T> () { } | octave_base_int_matrix (void) : octave_base_matrix<T> () { } | |||
octave_base_int_matrix (const T& nda) : octave_base_matrix<T> (nda) { } | octave_base_int_matrix (const T& nda) : octave_base_matrix<T> (nda) { } | |||
~octave_base_int_matrix (void) { } | ~octave_base_int_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_base_int_matrix | octave_base_value *clone (void) const | |||
(*this); } | { return new octave_base_int_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_base_int_ | ||||
matrix (); } | octave_base_value *empty_clone (void) const | |||
{ return new octave_base_int_matrix (); } | ||||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
// void increment (void) { matrix += 1; } | // void increment (void) { matrix += 1; } | |||
// void decrement (void) { matrix -= 1; } | // void decrement (void) { matrix -= 1; } | |||
void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
skipping to change at line 100 | skipping to change at line 103 | |||
octave_base_int_scalar : public octave_base_scalar<T> | octave_base_int_scalar : public octave_base_scalar<T> | |||
{ | { | |||
public: | public: | |||
octave_base_int_scalar (void) : octave_base_scalar<T> () { } | octave_base_int_scalar (void) : octave_base_scalar<T> () { } | |||
octave_base_int_scalar (const T& s) : octave_base_scalar<T> (s) { } | octave_base_int_scalar (const T& s) : octave_base_scalar<T> (s) { } | |||
~octave_base_int_scalar (void) { } | ~octave_base_int_scalar (void) { } | |||
octave_base_value *clone (void) const { return new octave_base_int_scalar | octave_base_value *clone (void) const | |||
(*this); } | { return new octave_base_int_scalar (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_base_int_ | octave_base_value *empty_clone (void) const | |||
scalar (); } | { return new octave_base_int_scalar (); } | |||
octave_base_value *try_narrowing_conversion (void) { return 0; } | octave_base_value *try_narrowing_conversion (void) { return 0; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
// void increment (void) { scalar += 1; } | // void increment (void) { scalar += 1; } | |||
// void decrement (void) { scalar -= 1; } | // void decrement (void) { scalar -= 1; } | |||
octave_value convert_to_str_internal (bool, bool, char type) const; | octave_value convert_to_str_internal (bool, bool, char type) const; | |||
End of changes. 4 change blocks. | ||||
11 lines changed or deleted | 12 lines changed or added | |||
ov-base-mat.cc | ov-base-mat.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 453 | skipping to change at line 453 | |||
template <class MT> | template <class MT> | |||
void | void | |||
octave_base_matrix<MT>::print_info (std::ostream& os, | octave_base_matrix<MT>::print_info (std::ostream& os, | |||
const std::string& prefix) const | const std::string& prefix) const | |||
{ | { | |||
matrix.print_info (os, prefix); | matrix.print_info (os, prefix); | |||
} | } | |||
template <class MT> | template <class MT> | |||
void | ||||
octave_base_matrix<MT>::short_disp (std::ostream& os) const | ||||
{ | ||||
if (matrix.is_empty ()) | ||||
os << "[]"; | ||||
else if (matrix.ndims () == 2) | ||||
{ | ||||
// FIXME: should this be configurable? | ||||
octave_idx_type max_elts = 10; | ||||
octave_idx_type elts = 0; | ||||
octave_idx_type nel = matrix.numel (); | ||||
octave_idx_type nr = matrix.rows (); | ||||
octave_idx_type nc = matrix.columns (); | ||||
os << "["; | ||||
for (octave_idx_type i = 0; i < nr; i++) | ||||
{ | ||||
for (octave_idx_type j = 0; j < nc; j++) | ||||
{ | ||||
std::ostringstream buf; | ||||
octave_print_internal (buf, matrix(j*nr+i)); | ||||
std::string tmp = buf.str (); | ||||
size_t pos = tmp.find_first_not_of (" "); | ||||
os << tmp.substr (pos); | ||||
if (++elts >= max_elts) | ||||
goto done; | ||||
if (j < nc - 1) | ||||
os << ", "; | ||||
} | ||||
if (i < nr - 1 && elts < max_elts) | ||||
os << "; "; | ||||
} | ||||
done: | ||||
if (nel <= max_elts) | ||||
os << "]"; | ||||
} | ||||
else | ||||
os << "..."; | ||||
} | ||||
template <class MT> | ||||
octave_value | octave_value | |||
octave_base_matrix<MT>::fast_elem_extract (octave_idx_type n) const | octave_base_matrix<MT>::fast_elem_extract (octave_idx_type n) const | |||
{ | { | |||
if (n < matrix.numel ()) | if (n < matrix.numel ()) | |||
return matrix(n); | return matrix(n); | |||
else | else | |||
return octave_value (); | return octave_value (); | |||
} | } | |||
template <class MT> | template <class MT> | |||
skipping to change at line 478 | skipping to change at line 527 | |||
{ | { | |||
// Don't use builtin_type () here to avoid an extra VM call. | // Don't use builtin_type () here to avoid an extra VM call. | |||
typedef typename MT::element_type ET; | typedef typename MT::element_type ET; | |||
const builtin_type_t btyp = class_to_btyp<ET>::btyp; | const builtin_type_t btyp = class_to_btyp<ET>::btyp; | |||
if (btyp == btyp_unknown) // Dead branch? | if (btyp == btyp_unknown) // Dead branch? | |||
return false; | return false; | |||
// Set up the pointer to the proper place. | // Set up the pointer to the proper place. | |||
void *here = reinterpret_cast<void *> (&matrix(n)); | void *here = reinterpret_cast<void *> (&matrix(n)); | |||
// Ask x to store there if it can. | // Ask x to store there if it can. | |||
return x.get_rep().fast_elem_insert_self (here, btyp); | return x.get_rep ().fast_elem_insert_self (here, btyp); | |||
} | } | |||
else | else | |||
return false; | return false; | |||
} | } | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 51 lines changed or added | |||
ov-base-mat.h | ov-base-mat.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1998-2012 John W. Eaton | Copyright (C) 1998-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_base_matrix_h) | #if !defined (octave_ov_base_mat_h) | |||
#define octave_base_matrix_h 1 | #define octave_ov_base_mat_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "MatrixType.h" | #include "MatrixType.h" | |||
skipping to change at line 56 | skipping to change at line 56 | |||
class | class | |||
octave_base_matrix : public octave_base_value | octave_base_matrix : public octave_base_value | |||
{ | { | |||
public: | public: | |||
octave_base_matrix (void) | octave_base_matrix (void) | |||
: octave_base_value (), matrix (), typ (), idx_cache () { } | : octave_base_value (), matrix (), typ (), idx_cache () { } | |||
octave_base_matrix (const MT& m, const MatrixType& t = MatrixType ()) | octave_base_matrix (const MT& m, const MatrixType& t = MatrixType ()) | |||
: octave_base_value (), matrix (m), | : octave_base_value (), matrix (m), | |||
typ (t.is_known () ? new MatrixType(t) : 0), idx_cache () | typ (t.is_known () ? new MatrixType (t) : 0), idx_cache () | |||
{ | { | |||
if (matrix.ndims () == 0) | if (matrix.ndims () == 0) | |||
matrix.resize (dim_vector (0, 0)); | matrix.resize (dim_vector (0, 0)); | |||
} | } | |||
octave_base_matrix (const octave_base_matrix& m) | octave_base_matrix (const octave_base_matrix& m) | |||
: octave_base_value (), matrix (m.matrix), | : octave_base_value (), matrix (m.matrix), | |||
typ (m.typ ? new MatrixType (*m.typ) : 0), | typ (m.typ ? new MatrixType (*m.typ) : 0), | |||
idx_cache (m.idx_cache ? new idx_vector (*m.idx_cache) : 0) | idx_cache (m.idx_cache ? new idx_vector (*m.idx_cache) : 0) | |||
{ } | { } | |||
~octave_base_matrix (void) { clear_cached_info (); } | ~octave_base_matrix (void) { clear_cached_info (); } | |||
size_t byte_size (void) const { return matrix.byte_size (); } | size_t byte_size (void) const { return matrix.byte_size (); } | |||
octave_value squeeze (void) const { return MT (matrix.squeeze ()); } | octave_value squeeze (void) const { return MT (matrix.squeeze ()); } | |||
octave_value full_value (void) const { return matrix; } | octave_value full_value (void) const { return matrix; } | |||
void maybe_economize (void) { matrix.maybe_economize (); } | void maybe_economize (void) { matrix.maybe_economize (); } | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx); | const std::list<octave_value_list>& idx); | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, int) | const std::list<octave_value_list>& idx, int) | |||
{ return subsref (type, idx); } | { return subsref (type, idx); } | |||
octave_value subsasgn (const std::string& type, | octave_value subsasgn (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
const octave_value& rhs); | const octave_value& rhs); | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
octave_value_list do_multi_index_op (int, const octave_value_list& idx) | octave_value_list do_multi_index_op (int, const octave_value_list& idx) | |||
{ return do_index_op (idx); } | { return do_index_op (idx); } | |||
void assign (const octave_value_list& idx, const MT& rhs); | void assign (const octave_value_list& idx, const MT& rhs); | |||
void assign (const octave_value_list& idx, typename MT::element_type rhs) ; | void assign (const octave_value_list& idx, typename MT::element_type rhs) ; | |||
void delete_elements (const octave_value_list& idx); | void delete_elements (const octave_value_list& idx); | |||
dim_vector dims (void) const { return matrix.dims (); } | dim_vector dims (void) const { return matrix.dims (); } | |||
octave_idx_type numel (void) const { return matrix.numel (); } | octave_idx_type numel (void) const { return matrix.numel (); } | |||
int ndims (void) const { return matrix.ndims (); } | int ndims (void) const { return matrix.ndims (); } | |||
octave_idx_type nnz (void) const { return matrix.nnz (); } | octave_idx_type nnz (void) const { return matrix.nnz (); } | |||
octave_value reshape (const dim_vector& new_dims) const | octave_value reshape (const dim_vector& new_dims) const | |||
{ return MT (matrix.reshape (new_dims)); } | { return MT (matrix.reshape (new_dims)); } | |||
octave_value permute (const Array<int>& vec, bool inv = false) const | octave_value permute (const Array<int>& vec, bool inv = false) const | |||
{ return MT (matrix.permute (vec, inv)); } | { return MT (matrix.permute (vec, inv)); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const; | octave_value resize (const dim_vector& dv, bool fill = false) const; | |||
octave_value all (int dim = 0) const { return matrix.all (dim); } | octave_value all (int dim = 0) const { return matrix.all (dim); } | |||
octave_value any (int dim = 0) const { return matrix.any (dim); } | octave_value any (int dim = 0) const { return matrix.any (dim); } | |||
MatrixType matrix_type (void) const { return typ ? *typ : MatrixType (); } | MatrixType matrix_type (void) const { return typ ? *typ : MatrixType (); } | |||
MatrixType matrix_type (const MatrixType& _typ) const; | MatrixType matrix_type (const MatrixType& _typ) const; | |||
octave_value diag (octave_idx_type k = 0) const | octave_value diag (octave_idx_type k = 0) const | |||
{ return octave_value (matrix.diag (k)); } | { return octave_value (matrix.diag (k)); } | |||
octave_value diag (octave_idx_type m, octave_idx_type n) const | ||||
{ return octave_value (matrix.diag (m, n)); } | ||||
octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | |||
{ return octave_value (matrix.sort (dim, mode)); } | { return octave_value (matrix.sort (dim, mode)); } | |||
octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const | sortmode mode = ASCENDING) const | |||
{ return octave_value (matrix.sort (sidx, dim, mode)); } | { return octave_value (matrix.sort (sidx, dim, mode)); } | |||
sortmode is_sorted (sortmode mode = UNSORTED) const | sortmode is_sorted (sortmode mode = UNSORTED) const | |||
{ return matrix.is_sorted (mode); } | { return matrix.is_sorted (mode); } | |||
Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const | Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const | |||
{ return matrix.sort_rows_idx (mode); } | { return matrix.sort_rows_idx (mode); } | |||
sortmode is_sorted_rows (sortmode mode = UNSORTED) const | sortmode is_sorted_rows (sortmode mode = UNSORTED) const | |||
{ return matrix.is_sorted_rows (mode); } | { return matrix.is_sorted_rows (mode); } | |||
bool is_matrix_type (void) const { return true; } | bool is_matrix_type (void) const { return true; } | |||
bool is_numeric_type (void) const { return true; } | bool is_numeric_type (void) const { return true; } | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
bool is_constant (void) const { return true; } | bool is_constant (void) const { return true; } | |||
bool is_true (void) const; | bool is_true (void) const; | |||
bool print_as_scalar (void) const; | bool print_as_scalar (void) const; | |||
void print (std::ostream& os, bool pr_as_read_syntax = false) const; | void print (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
void print_info (std::ostream& os, const std::string& prefix) const; | void print_info (std::ostream& os, const std::string& prefix) const; | |||
void short_disp (std::ostream& os) const; | ||||
MT& matrix_ref (void) | MT& matrix_ref (void) | |||
{ | { | |||
clear_cached_info (); | clear_cached_info (); | |||
return matrix; | return matrix; | |||
} | } | |||
const MT& matrix_ref (void) const | const MT& matrix_ref (void) const | |||
{ | { | |||
return matrix; | return matrix; | |||
} | } | |||
octave_value | octave_value | |||
fast_elem_extract (octave_idx_type n) const; | fast_elem_extract (octave_idx_type n) const; | |||
bool | bool | |||
fast_elem_insert (octave_idx_type n, const octave_value& x); | fast_elem_insert (octave_idx_type n, const octave_value& x); | |||
protected: | protected: | |||
MT matrix; | MT matrix; | |||
idx_vector set_idx_cache (const idx_vector& idx) const | idx_vector set_idx_cache (const idx_vector& idx) const | |||
{ | { | |||
delete idx_cache; | delete idx_cache; | |||
idx_cache = idx ? new idx_vector (idx) : 0; | idx_cache = idx ? new idx_vector (idx) : 0; | |||
return idx; | return idx; | |||
} | } | |||
void clear_cached_info (void) const | void clear_cached_info (void) const | |||
{ | { | |||
delete typ; typ = 0; | delete typ; typ = 0; | |||
delete idx_cache; idx_cache = 0; | delete idx_cache; idx_cache = 0; | |||
} | } | |||
mutable MatrixType *typ; | mutable MatrixType *typ; | |||
mutable idx_vector *idx_cache; | mutable idx_vector *idx_cache; | |||
private: | private: | |||
// No assignment. | // No assignment. | |||
octave_base_matrix& operator = (const octave_base_matrix&); | octave_base_matrix& operator = (const octave_base_matrix&); | |||
}; | }; | |||
End of changes. 19 change blocks. | ||||
31 lines changed or deleted | 36 lines changed or added | |||
ov-base-scalar.cc | ov-base-scalar.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 124 | skipping to change at line 124 | |||
} | } | |||
template <class ST> | template <class ST> | |||
octave_value | octave_value | |||
octave_base_scalar<ST>::diag (octave_idx_type k) const | octave_base_scalar<ST>::diag (octave_idx_type k) const | |||
{ | { | |||
return Array<ST> (dim_vector (1, 1), scalar).diag (k); | return Array<ST> (dim_vector (1, 1), scalar).diag (k); | |||
} | } | |||
template <class ST> | template <class ST> | |||
octave_value | ||||
octave_base_scalar<ST>::diag (octave_idx_type m, octave_idx_type n) const | ||||
{ | ||||
return Array<ST> (dim_vector (1, 1), scalar).diag (m, n); | ||||
} | ||||
template <class ST> | ||||
bool | bool | |||
octave_base_scalar<ST>::is_true (void) const | octave_base_scalar<ST>::is_true (void) const | |||
{ | { | |||
bool retval = false; | bool retval = false; | |||
if (xisnan (scalar)) | if (xisnan (scalar)) | |||
gripe_nan_to_logical_conversion (); | gripe_nan_to_logical_conversion (); | |||
else | else | |||
retval = (scalar != ST ()); | retval = (scalar != ST ()); | |||
skipping to change at line 165 | skipping to change at line 172 | |||
bool | bool | |||
octave_base_scalar<ST>::print_name_tag (std::ostream& os, | octave_base_scalar<ST>::print_name_tag (std::ostream& os, | |||
const std::string& name) const | const std::string& name) const | |||
{ | { | |||
indent (os); | indent (os); | |||
os << name << " = "; | os << name << " = "; | |||
return false; | return false; | |||
} | } | |||
template <class ST> | template <class ST> | |||
void | ||||
octave_base_scalar<ST>::short_disp (std::ostream& os) const | ||||
{ | ||||
std::ostringstream buf; | ||||
octave_print_internal (buf, scalar); | ||||
std::string tmp = buf.str (); | ||||
size_t pos = tmp.find_first_not_of (" "); | ||||
os << tmp.substr (pos); | ||||
} | ||||
template <class ST> | ||||
bool | bool | |||
octave_base_scalar<ST>::fast_elem_insert_self (void *where, builtin_type_t | octave_base_scalar<ST>::fast_elem_insert_self (void *where, | |||
btyp) const | builtin_type_t btyp) const | |||
{ | { | |||
// Don't use builtin_type () here to avoid an extra VM call. | // Don't use builtin_type () here to avoid an extra VM call. | |||
if (btyp == class_to_btyp<ST>::btyp) | if (btyp == class_to_btyp<ST>::btyp) | |||
{ | { | |||
*(reinterpret_cast<ST *>(where)) = scalar; | *(reinterpret_cast<ST *>(where)) = scalar; | |||
return true; | return true; | |||
} | } | |||
else | else | |||
return false; | return false; | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 21 lines changed or added | |||
ov-base-scalar.h | ov-base-scalar.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_base_scalar_h) | #if !defined (octave_ov_base_scalar_h) | |||
#define octave_base_scalar_h 1 | #define octave_ov_base_scalar_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "lo-mappers.h" | #include "lo-mappers.h" | |||
#include "lo-utils.h" | #include "lo-utils.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 68 | skipping to change at line 68 | |||
octave_value squeeze (void) const { return scalar; } | octave_value squeeze (void) const { return scalar; } | |||
octave_value full_value (void) const { return scalar; } | octave_value full_value (void) const { return scalar; } | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx); | const std::list<octave_value_list>& idx); | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, int) | const std::list<octave_value_list>& idx, int) | |||
{ return subsref (type, idx); } | { return subsref (type, idx); } | |||
octave_value subsasgn (const std::string& type, | octave_value subsasgn (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
const octave_value& rhs); | const octave_value& rhs); | |||
octave_value_list do_multi_index_op (int, const octave_value_list& idx) | octave_value_list do_multi_index_op (int, const octave_value_list& idx) | |||
{ return do_index_op (idx); } | { return do_index_op (idx); } | |||
bool is_constant (void) const { return true; } | bool is_constant (void) const { return true; } | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; } | dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; } | |||
octave_idx_type numel (void) const { return 1; } | octave_idx_type numel (void) const { return 1; } | |||
int ndims (void) const { return 2; } | int ndims (void) const { return 2; } | |||
skipping to change at line 101 | skipping to change at line 101 | |||
octave_value reshape (const dim_vector& new_dims) const; | octave_value reshape (const dim_vector& new_dims) const; | |||
size_t byte_size (void) const { return sizeof (ST); } | size_t byte_size (void) const { return sizeof (ST); } | |||
octave_value all (int = 0) const { return (scalar != ST ()); } | octave_value all (int = 0) const { return (scalar != ST ()); } | |||
octave_value any (int = 0) const { return (scalar != ST ()); } | octave_value any (int = 0) const { return (scalar != ST ()); } | |||
octave_value diag (octave_idx_type k = 0) const; | octave_value diag (octave_idx_type k = 0) const; | |||
octave_value diag (octave_idx_type m, octave_idx_type n) const; | ||||
octave_value sort (octave_idx_type, sortmode) const | octave_value sort (octave_idx_type, sortmode) const | |||
{ return octave_value (scalar); } | { return octave_value (scalar); } | |||
octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type, | octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type, | |||
sortmode) const | sortmode) const | |||
{ | { | |||
sidx.resize (dim_vector (1, 1)); | sidx.resize (dim_vector (1, 1)); | |||
sidx(0) = 0; | sidx(0) = 0; | |||
return octave_value (scalar); | return octave_value (scalar); | |||
} | } | |||
sortmode is_sorted (sortmode mode = UNSORTED) const | sortmode is_sorted (sortmode mode = UNSORTED) const | |||
{ return mode ? mode : ASCENDING; } | { return mode ? mode : ASCENDING; } | |||
Array<octave_idx_type> sort_rows_idx (sortmode) const | Array<octave_idx_type> sort_rows_idx (sortmode) const | |||
{ | { | |||
return Array<octave_idx_type> (dim_vector (1, 1), | return Array<octave_idx_type> (dim_vector (1, 1), | |||
static_cast<octave_idx_type> (0)); | static_cast<octave_idx_type> (0)); | |||
} | } | |||
sortmode is_sorted_rows (sortmode mode = UNSORTED) const | sortmode is_sorted_rows (sortmode mode = UNSORTED) const | |||
{ return mode ? mode : ASCENDING; } | { return mode ? mode : ASCENDING; } | |||
MatrixType matrix_type (void) const { return MatrixType::Diagonal; } | MatrixType matrix_type (void) const { return MatrixType::Diagonal; } | |||
MatrixType matrix_type (const MatrixType&) const | MatrixType matrix_type (const MatrixType&) const | |||
{ return matrix_type (); } | { return matrix_type (); } | |||
bool is_scalar_type (void) const { return true; } | bool is_scalar_type (void) const { return true; } | |||
bool is_numeric_type (void) const { return true; } | bool is_numeric_type (void) const { return true; } | |||
bool is_true (void) const; | bool is_true (void) const; | |||
void print (std::ostream& os, bool pr_as_read_syntax = false) const; | void print (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
bool print_name_tag (std::ostream& os, const std::string& name) const; | bool print_name_tag (std::ostream& os, const std::string& name) const; | |||
void short_disp (std::ostream& os) const; | ||||
// Unsafe. This function exists to support the MEX interface. | // Unsafe. This function exists to support the MEX interface. | |||
// You should not use it anywhere else. | // You should not use it anywhere else. | |||
void *mex_get_data (void) const { return const_cast<ST *> (&scalar); } | void *mex_get_data (void) const { return const_cast<ST *> (&scalar); } | |||
const ST& scalar_ref (void) const { return scalar; } | const ST& scalar_ref (void) const { return scalar; } | |||
ST& scalar_ref (void) { return scalar; } | ST& scalar_ref (void) { return scalar; } | |||
bool fast_elem_insert_self (void *where, builtin_type_t btyp) const; | bool fast_elem_insert_self (void *where, builtin_type_t btyp) const; | |||
End of changes. 12 change blocks. | ||||
18 lines changed or deleted | 22 lines changed or added | |||
ov-base-sparse.h | ov-base-sparse.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_base_sparse_h) | #if !defined (octave_ov_base_sparse_h) | |||
#define octave_base_sparse_h 1 | #define octave_ov_base_sparse_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "error.h" | #include "error.h" | |||
#include "oct-obj.h" | #include "oct-obj.h" | |||
skipping to change at line 50 | skipping to change at line 50 | |||
#include "MatrixType.h" | #include "MatrixType.h" | |||
class tree_walker; | class tree_walker; | |||
class octave_sparse_bool_matrix; | class octave_sparse_bool_matrix; | |||
template <class T> | template <class T> | |||
class | class | |||
octave_base_sparse : public octave_base_value | octave_base_sparse : public octave_base_value | |||
{ | { | |||
public: | public: | |||
octave_base_sparse (void) | octave_base_sparse (void) | |||
: octave_base_value (), matrix (), typ (MatrixType ()) | : octave_base_value (), matrix (), typ (MatrixType ()) | |||
{ } | { } | |||
octave_base_sparse (const T& a) : octave_base_value (), matrix (a), | octave_base_sparse (const T& a) | |||
typ (MatrixType ()) | : octave_base_value (), matrix (a), typ (MatrixType ()) | |||
{ | { | |||
if (matrix.ndims () == 0) | if (matrix.ndims () == 0) | |||
matrix.resize (dim_vector (0, 0)); | matrix.resize (dim_vector (0, 0)); | |||
} | } | |||
octave_base_sparse (const T& a, const MatrixType& t) : octave_base_value | octave_base_sparse (const T& a, const MatrixType& t) | |||
(), | : octave_base_value (), matrix (a), typ (t) | |||
matrix (a), typ (t) | ||||
{ | { | |||
if (matrix.ndims () == 0) | if (matrix.ndims () == 0) | |||
matrix.resize (dim_vector (0, 0)); | matrix.resize (dim_vector (0, 0)); | |||
} | } | |||
octave_base_sparse (const octave_base_sparse& a) : | octave_base_sparse (const octave_base_sparse& a) | |||
octave_base_value (), matrix (a.matrix), typ (a.typ) { } | : octave_base_value (), matrix (a.matrix), typ (a.typ) { } | |||
~octave_base_sparse (void) { } | ~octave_base_sparse (void) { } | |||
octave_idx_type numel (void) const { return dims ().safe_numel (); } | ||||
octave_idx_type nnz (void) const { return matrix.nnz (); } | octave_idx_type nnz (void) const { return matrix.nnz (); } | |||
octave_idx_type nzmax (void) const { return matrix.nzmax (); } | octave_idx_type nzmax (void) const { return matrix.nzmax (); } | |||
size_t byte_size (void) const { return matrix.byte_size (); } | size_t byte_size (void) const { return matrix.byte_size (); } | |||
octave_value squeeze (void) const { return matrix.squeeze (); } | octave_value squeeze (void) const { return matrix.squeeze (); } | |||
octave_value full_value (void) const { return matrix.matrix_value (); } | octave_value full_value (void) const { return matrix.matrix_value (); } | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx); | const std::list<octave_value_list>& idx); | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, int) | const std::list<octave_value_list>& idx, int) | |||
{ return subsref (type, idx); } | { return subsref (type, idx); } | |||
octave_value subsasgn (const std::string& type, | octave_value subsasgn (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
const octave_value& rhs); | const octave_value& rhs); | |||
void assign (const octave_value_list& idx, const T& rhs); | void assign (const octave_value_list& idx, const T& rhs); | |||
void delete_elements (const octave_value_list& idx); | void delete_elements (const octave_value_list& idx); | |||
dim_vector dims (void) const { return matrix.dims (); } | dim_vector dims (void) const { return matrix.dims (); } | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
octave_value reshape (const dim_vector& new_dims) const | octave_value reshape (const dim_vector& new_dims) const | |||
{ return T (matrix.reshape (new_dims)); } | { return T (matrix.reshape (new_dims)); } | |||
octave_value permute (const Array<int>& vec, bool inv = false) const | octave_value permute (const Array<int>& vec, bool inv = false) const | |||
{ return T (matrix.permute (vec, inv)); } | { return T (matrix.permute (vec, inv)); } | |||
octave_value resize (const dim_vector& dv, bool = false) const; | octave_value resize (const dim_vector& dv, bool = false) const; | |||
octave_value all (int dim = 0) const { return matrix.all (dim); } | octave_value all (int dim = 0) const { return matrix.all (dim); } | |||
octave_value any (int dim = 0) const { return matrix.any (dim); } | octave_value any (int dim = 0) const { return matrix.any (dim); } | |||
octave_value diag (octave_idx_type k = 0) const | octave_value diag (octave_idx_type k = 0) const | |||
{ return octave_value (matrix.diag (k)); } | { return octave_value (matrix.diag (k)); } | |||
octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | |||
{ return octave_value (matrix.sort (dim, mode)); } | { return octave_value (matrix.sort (dim, mode)); } | |||
octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const | sortmode mode = ASCENDING) const | |||
{ return octave_value (matrix.sort (sidx, dim, mode)); } | { return octave_value (matrix.sort (sidx, dim, mode)); } | |||
sortmode is_sorted (sortmode mode = UNSORTED) const | sortmode is_sorted (sortmode mode = UNSORTED) const | |||
{ return full_value ().is_sorted (mode); } | { return full_value ().is_sorted (mode); } | |||
MatrixType matrix_type (void) const { return typ; } | MatrixType matrix_type (void) const { return typ; } | |||
MatrixType matrix_type (const MatrixType& _typ) const | MatrixType matrix_type (const MatrixType& _typ) const | |||
{ MatrixType ret = typ; typ = _typ; return ret; } | { MatrixType ret = typ; typ = _typ; return ret; } | |||
bool is_matrix_type (void) const { return true; } | bool is_matrix_type (void) const { return true; } | |||
bool is_numeric_type (void) const { return true; } | bool is_numeric_type (void) const { return true; } | |||
bool is_sparse_type (void) const { return true; } | bool is_sparse_type (void) const { return true; } | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
bool is_constant (void) const { return true; } | bool is_constant (void) const { return true; } | |||
End of changes. 15 change blocks. | ||||
19 lines changed or deleted | 20 lines changed or added | |||
ov-base.h | ov-base.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_base_value_h) | #if !defined (octave_ov_base_h) | |||
#define octave_base_value_h 1 | #define octave_ov_base_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <list> | #include <list> | |||
#include <string> | #include <string> | |||
#include "Range.h" | #include "Range.h" | |||
#include "data-conv.h" | #include "data-conv.h" | |||
#include "mxarray.h" | ||||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "error.h" | #include "error.h" | |||
#include "oct-hdf5.h" | #include "oct-hdf5.h" | |||
class Cell; | class Cell; | |||
class mxArray; | ||||
class octave_map; | class octave_map; | |||
class octave_scalar_map; | class octave_scalar_map; | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
class octave_stream; | class octave_stream; | |||
class octave_function; | class octave_function; | |||
class octave_user_function; | class octave_user_function; | |||
class octave_user_script; | class octave_user_script; | |||
class octave_user_code; | class octave_user_code; | |||
class octave_fcn_handle; | class octave_fcn_handle; | |||
skipping to change at line 100 | skipping to change at line 100 | |||
inline bool btyp_isinteger (builtin_type_t btyp) | inline bool btyp_isinteger (builtin_type_t btyp) | |||
{ return btyp >= btyp_int8 && btyp <= btyp_uint64; } | { return btyp >= btyp_int8 && btyp <= btyp_uint64; } | |||
inline bool btyp_isfloat (builtin_type_t btyp) | inline bool btyp_isfloat (builtin_type_t btyp) | |||
{ return btyp <= btyp_float_complex; } | { return btyp <= btyp_float_complex; } | |||
inline bool btyp_isarray (builtin_type_t btyp) | inline bool btyp_isarray (builtin_type_t btyp) | |||
{ return btyp <= btyp_char; } | { return btyp <= btyp_char; } | |||
// Compute a numeric type for a possibly mixed-type operation, using these rules: | // Compute numeric type for a possible mixed-type operation, using these ru les: | |||
// bool -> double | // bool -> double | |||
// single + double -> single | // single + double -> single | |||
// real + complex -> complex | // real + complex -> complex | |||
// integer + real -> integer | // integer + real -> integer | |||
// uint + uint -> uint (the bigger one) | // uint + uint -> uint (the bigger one) | |||
// sint + sint -> sint (the bigger one) | // sint + sint -> sint (the bigger one) | |||
// | // | |||
// failing otherwise. | // failing otherwise. | |||
extern OCTINTERP_API | extern OCTINTERP_API | |||
skipping to change at line 190 | skipping to change at line 190 | |||
octave_base_value | octave_base_value | |||
{ | { | |||
public: | public: | |||
typedef octave_base_value * (*type_conv_fcn) (const octave_base_value&); | typedef octave_base_value * (*type_conv_fcn) (const octave_base_value&); | |||
// type conversion, including result type information | // type conversion, including result type information | |||
class type_conv_info | class type_conv_info | |||
{ | { | |||
public: | public: | |||
type_conv_info (type_conv_fcn f = 0, int t = -1) : _fcn (f), _type_id ( | type_conv_info (type_conv_fcn f = 0, int t = -1) | |||
t) { } | : _fcn (f), _type_id (t) { } | |||
operator type_conv_fcn (void) const { return _fcn; } | operator type_conv_fcn (void) const { return _fcn; } | |||
octave_base_value * operator () (const octave_base_value &v) const | octave_base_value * operator () (const octave_base_value &v) const | |||
{ return (*_fcn) (v); } | { return (*_fcn) (v); } | |||
int type_id (void) const { return _type_id; } | int type_id (void) const { return _type_id; } | |||
private: | private: | |||
type_conv_fcn _fcn; | type_conv_fcn _fcn; | |||
int _type_id; | int _type_id; | |||
}; | }; | |||
friend class octave_value; | friend class octave_value; | |||
skipping to change at line 228 | skipping to change at line 229 | |||
empty_clone (void) const; | empty_clone (void) const; | |||
// Unique clone. Usually clones, but may be overriden to fake the | // Unique clone. Usually clones, but may be overriden to fake the | |||
// cloning when sharing copies is to be controlled from within an | // cloning when sharing copies is to be controlled from within an | |||
// instance (see octave_class). | // instance (see octave_class). | |||
virtual octave_base_value * | virtual octave_base_value * | |||
unique_clone (void) { return clone (); } | unique_clone (void) { return clone (); } | |||
virtual type_conv_info | virtual type_conv_info | |||
numeric_conversion_function (void) const | numeric_conversion_function (void) const | |||
{ return type_conv_info (); } | { return type_conv_info (); } | |||
virtual type_conv_info | virtual type_conv_info | |||
numeric_demotion_function (void) const | numeric_demotion_function (void) const | |||
{ return type_conv_info (); } | { return type_conv_info (); } | |||
virtual octave_value squeeze (void) const; | virtual octave_value squeeze (void) const; | |||
virtual octave_value full_value (void) const; | virtual octave_value full_value (void) const; | |||
virtual octave_base_value *try_narrowing_conversion (void) { return 0; } | virtual octave_base_value *try_narrowing_conversion (void) { return 0; } | |||
virtual void maybe_economize (void) { } | virtual void maybe_economize (void) { } | |||
virtual Matrix size (void); | virtual Matrix size (void); | |||
skipping to change at line 293 | skipping to change at line 294 | |||
virtual octave_value | virtual octave_value | |||
undef_subsasgn (const std::string& type, | undef_subsasgn (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
const octave_value& rhs); | const octave_value& rhs); | |||
virtual idx_vector index_vector (void) const; | virtual idx_vector index_vector (void) const; | |||
virtual dim_vector dims (void) const { return dim_vector (); } | virtual dim_vector dims (void) const { return dim_vector (); } | |||
octave_idx_type rows (void) const | octave_idx_type rows (void) const | |||
{ | { | |||
const dim_vector dv = dims (); | const dim_vector dv = dims (); | |||
return dv(0); | return dv(0); | |||
} | } | |||
octave_idx_type columns (void) const | octave_idx_type columns (void) const | |||
{ | { | |||
const dim_vector dv = dims (); | const dim_vector dv = dims (); | |||
return dv(1); | return dv(1); | |||
} | } | |||
virtual int ndims (void) const | virtual int ndims (void) const | |||
{ return dims ().length (); } | { return dims ().length (); } | |||
virtual octave_idx_type numel (void) const { return dims ().numel (); } | virtual octave_idx_type numel (void) const { return dims ().numel (); } | |||
virtual octave_idx_type capacity (void) const { return numel (); } | virtual octave_idx_type capacity (void) const { return numel (); } | |||
virtual size_t byte_size (void) const { return 0; } | virtual size_t byte_size (void) const { return 0; } | |||
virtual octave_idx_type nnz (void) const; | virtual octave_idx_type nnz (void) const; | |||
virtual octave_idx_type nzmax (void) const; | virtual octave_idx_type nzmax (void) const; | |||
skipping to change at line 333 | skipping to change at line 334 | |||
virtual octave_value permute (const Array<int>& vec, bool = false) const; | virtual octave_value permute (const Array<int>& vec, bool = false) const; | |||
virtual octave_value resize (const dim_vector&, bool fill = false) const; | virtual octave_value resize (const dim_vector&, bool fill = false) const; | |||
virtual MatrixType matrix_type (void) const; | virtual MatrixType matrix_type (void) const; | |||
virtual MatrixType matrix_type (const MatrixType& typ) const; | virtual MatrixType matrix_type (const MatrixType& typ) const; | |||
virtual bool is_defined (void) const { return false; } | virtual bool is_defined (void) const { return false; } | |||
bool is_empty (void) const { return numel () == 0; } | bool is_empty (void) const { return (dims ().any_zero ()); } | |||
virtual bool is_cell (void) const { return false; } | virtual bool is_cell (void) const { return false; } | |||
virtual bool is_cellstr (void) const { return false; } | virtual bool is_cellstr (void) const { return false; } | |||
virtual bool is_real_scalar (void) const { return false; } | virtual bool is_real_scalar (void) const { return false; } | |||
virtual bool is_real_matrix (void) const { return false; } | virtual bool is_real_matrix (void) const { return false; } | |||
virtual bool is_real_nd_array (void) const { return false; } | ||||
virtual bool is_complex_scalar (void) const { return false; } | virtual bool is_complex_scalar (void) const { return false; } | |||
virtual bool is_complex_matrix (void) const { return false; } | virtual bool is_complex_matrix (void) const { return false; } | |||
virtual bool is_bool_scalar (void) const { return false; } | virtual bool is_bool_scalar (void) const { return false; } | |||
virtual bool is_bool_matrix (void) const { return false; } | virtual bool is_bool_matrix (void) const { return false; } | |||
virtual bool is_char_matrix (void) const { return false; } | virtual bool is_char_matrix (void) const { return false; } | |||
skipping to change at line 369 | skipping to change at line 368 | |||
virtual bool is_string (void) const { return false; } | virtual bool is_string (void) const { return false; } | |||
virtual bool is_sq_string (void) const { return false; } | virtual bool is_sq_string (void) const { return false; } | |||
virtual bool is_range (void) const { return false; } | virtual bool is_range (void) const { return false; } | |||
virtual bool is_map (void) const { return false; } | virtual bool is_map (void) const { return false; } | |||
virtual bool is_object (void) const { return false; } | virtual bool is_object (void) const { return false; } | |||
virtual bool is_java (void) const { return false; } | ||||
virtual bool is_cs_list (void) const { return false; } | virtual bool is_cs_list (void) const { return false; } | |||
virtual bool is_magic_colon (void) const { return false; } | virtual bool is_magic_colon (void) const { return false; } | |||
virtual bool is_all_va_args (void) const { return false; } | virtual bool is_all_va_args (void) const { return false; } | |||
virtual octave_value all (int = 0) const; | virtual octave_value all (int = 0) const; | |||
virtual octave_value any (int = 0) const; | virtual octave_value any (int = 0) const; | |||
skipping to change at line 463 | skipping to change at line 464 | |||
virtual int int_value (bool = false, bool = false) const; | virtual int int_value (bool = false, bool = false) const; | |||
virtual unsigned int uint_value (bool = false, bool = false) const; | virtual unsigned int uint_value (bool = false, bool = false) const; | |||
virtual int nint_value (bool = false) const; | virtual int nint_value (bool = false) const; | |||
virtual long int long_value (bool = false, bool = false) const; | virtual long int long_value (bool = false, bool = false) const; | |||
virtual unsigned long int ulong_value (bool = false, bool = false) const; | virtual unsigned long int ulong_value (bool = false, bool = false) const; | |||
virtual int64_t int64_value (bool = false, bool = false) const; | ||||
virtual uint64_t uint64_value (bool = false, bool = false) const; | ||||
virtual double double_value (bool = false) const; | virtual double double_value (bool = false) const; | |||
virtual float float_value (bool = false) const; | virtual float float_value (bool = false) const; | |||
virtual double scalar_value (bool frc_str_conv = false) const | virtual double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
virtual float float_scalar_value (bool frc_str_conv = false) const | virtual float float_scalar_value (bool frc_str_conv = false) const | |||
{ return float_value (frc_str_conv); } | { return float_value (frc_str_conv); } | |||
virtual Cell cell_value (void) const; | virtual Cell cell_value (void) const; | |||
virtual Matrix matrix_value (bool = false) const; | virtual Matrix matrix_value (bool = false) const; | |||
virtual FloatMatrix float_matrix_value (bool = false) const; | virtual FloatMatrix float_matrix_value (bool = false) const; | |||
virtual NDArray array_value (bool = false) const; | virtual NDArray array_value (bool = false) const; | |||
virtual FloatNDArray float_array_value (bool = false) const; | virtual FloatNDArray float_array_value (bool = false) const; | |||
skipping to change at line 517 | skipping to change at line 522 | |||
virtual SparseComplexMatrix sparse_complex_matrix_value (bool = false) co nst; | virtual SparseComplexMatrix sparse_complex_matrix_value (bool = false) co nst; | |||
virtual SparseBoolMatrix sparse_bool_matrix_value (bool = false) const; | virtual SparseBoolMatrix sparse_bool_matrix_value (bool = false) const; | |||
virtual DiagMatrix diag_matrix_value (bool = false) const; | virtual DiagMatrix diag_matrix_value (bool = false) const; | |||
virtual FloatDiagMatrix float_diag_matrix_value (bool = false) const; | virtual FloatDiagMatrix float_diag_matrix_value (bool = false) const; | |||
virtual ComplexDiagMatrix complex_diag_matrix_value (bool = false) const; | virtual ComplexDiagMatrix complex_diag_matrix_value (bool = false) const; | |||
virtual FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = fa | virtual FloatComplexDiagMatrix | |||
lse) const; | float_complex_diag_matrix_value (bool = false) const; | |||
virtual PermMatrix perm_matrix_value (void) const; | virtual PermMatrix perm_matrix_value (void) const; | |||
virtual octave_int8 int8_scalar_value (void) const; | virtual octave_int8 int8_scalar_value (void) const; | |||
virtual octave_int16 int16_scalar_value (void) const; | virtual octave_int16 int16_scalar_value (void) const; | |||
virtual octave_int32 int32_scalar_value (void) const; | virtual octave_int32 int32_scalar_value (void) const; | |||
virtual octave_int64 int64_scalar_value (void) const; | virtual octave_int64 int64_scalar_value (void) const; | |||
skipping to change at line 574 | skipping to change at line 580 | |||
virtual string_vector map_keys (void) const; | virtual string_vector map_keys (void) const; | |||
virtual size_t nparents (void) const; | virtual size_t nparents (void) const; | |||
virtual std::list<std::string> parent_class_name_list (void) const; | virtual std::list<std::string> parent_class_name_list (void) const; | |||
virtual string_vector parent_class_names (void) const; | virtual string_vector parent_class_names (void) const; | |||
virtual octave_base_value *find_parent_class (const std::string&) | virtual octave_base_value *find_parent_class (const std::string&) | |||
{ return 0; } | { return 0; } | |||
virtual octave_base_value *unique_parent_class (const std::string&) | virtual octave_base_value *unique_parent_class (const std::string&) | |||
{ return 0; } | { return 0; } | |||
virtual octave_function *function_value (bool silent = false); | virtual octave_function *function_value (bool silent = false); | |||
virtual octave_user_function *user_function_value (bool silent = false); | virtual octave_user_function *user_function_value (bool silent = false); | |||
virtual octave_user_script *user_script_value (bool silent = false); | virtual octave_user_script *user_script_value (bool silent = false); | |||
virtual octave_user_code *user_code_value (bool silent = false); | virtual octave_user_code *user_code_value (bool silent = false); | |||
virtual octave_fcn_handle *fcn_handle_value (bool silent = false); | virtual octave_fcn_handle *fcn_handle_value (bool silent = false); | |||
skipping to change at line 614 | skipping to change at line 620 | |||
virtual void | virtual void | |||
print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
virtual bool | virtual bool | |||
print_name_tag (std::ostream& os, const std::string& name) const; | print_name_tag (std::ostream& os, const std::string& name) const; | |||
virtual void | virtual void | |||
print_with_name (std::ostream& output_buf, const std::string& name, | print_with_name (std::ostream& output_buf, const std::string& name, | |||
bool print_padding = true); | bool print_padding = true); | |||
virtual void short_disp (std::ostream& os) const { os << "..."; } | ||||
virtual void print_info (std::ostream& os, const std::string& prefix) con st; | virtual void print_info (std::ostream& os, const std::string& prefix) con st; | |||
virtual bool save_ascii (std::ostream& os); | virtual bool save_ascii (std::ostream& os); | |||
virtual bool load_ascii (std::istream& is); | virtual bool load_ascii (std::istream& is); | |||
virtual bool save_binary (std::ostream& os, bool& save_as_floats); | virtual bool save_binary (std::ostream& os, bool& save_as_floats); | |||
virtual bool load_binary (std::istream& is, bool swap, | virtual bool load_binary (std::istream& is, bool swap, | |||
oct_mach_info::float_format fmt); | oct_mach_info::float_format fmt); | |||
skipping to change at line 648 | skipping to change at line 656 | |||
virtual void *mex_get_data (void) const { return 0; } | virtual void *mex_get_data (void) const { return 0; } | |||
virtual octave_idx_type *mex_get_ir (void) const { return 0; } | virtual octave_idx_type *mex_get_ir (void) const { return 0; } | |||
virtual octave_idx_type *mex_get_jc (void) const { return 0; } | virtual octave_idx_type *mex_get_jc (void) const { return 0; } | |||
virtual mxArray *as_mxArray (void) const; | virtual mxArray *as_mxArray (void) const; | |||
virtual octave_value diag (octave_idx_type k = 0) const; | virtual octave_value diag (octave_idx_type k = 0) const; | |||
virtual octave_value diag (octave_idx_type m, octave_idx_type n) const; | ||||
virtual octave_value sort (octave_idx_type dim = 0, | virtual octave_value sort (octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const; | sortmode mode = ASCENDING) const; | |||
virtual octave_value sort (Array<octave_idx_type> &sidx, | virtual octave_value sort (Array<octave_idx_type> &sidx, | |||
octave_idx_type dim = 0, | octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const; | sortmode mode = ASCENDING) const; | |||
virtual sortmode is_sorted (sortmode mode = UNSORTED) const; | virtual sortmode is_sorted (sortmode mode = UNSORTED) const; | |||
virtual Array<octave_idx_type> | virtual Array<octave_idx_type> | |||
sort_rows_idx (sortmode mode = ASCENDING) const; | sort_rows_idx (sortmode mode = ASCENDING) const; | |||
skipping to change at line 671 | skipping to change at line 681 | |||
virtual void lock (void); | virtual void lock (void); | |||
virtual void unlock (void); | virtual void unlock (void); | |||
virtual bool islocked (void) const { return false; } | virtual bool islocked (void) const { return false; } | |||
virtual void dump (std::ostream& os) const; | virtual void dump (std::ostream& os) const; | |||
// Standard mappers. Register new ones here. | // Standard mappers. Register new ones here. | |||
enum unary_mapper_t | enum unary_mapper_t | |||
{ | { | |||
umap_abs, | umap_abs, | |||
umap_acos, | umap_acos, | |||
umap_acosh, | umap_acosh, | |||
umap_angle, | umap_angle, | |||
umap_arg, | umap_arg, | |||
umap_asin, | umap_asin, | |||
umap_asinh, | umap_asinh, | |||
umap_atan, | umap_atan, | |||
umap_atanh, | umap_atanh, | |||
umap_cbrt, | umap_cbrt, | |||
umap_ceil, | umap_ceil, | |||
umap_conj, | umap_conj, | |||
umap_cos, | umap_cos, | |||
umap_cosh, | umap_cosh, | |||
umap_erf, | umap_erf, | |||
umap_erfinv, | umap_erfinv, | |||
umap_erfc, | umap_erfcinv, | |||
umap_erfcx, | umap_erfc, | |||
umap_exp, | umap_erfcx, | |||
umap_expm1, | umap_erfi, | |||
umap_finite, | umap_dawson, | |||
umap_fix, | umap_exp, | |||
umap_floor, | umap_expm1, | |||
umap_gamma, | umap_finite, | |||
umap_imag, | umap_fix, | |||
umap_isinf, | umap_floor, | |||
umap_isna, | umap_gamma, | |||
umap_isnan, | umap_imag, | |||
umap_lgamma, | umap_isinf, | |||
umap_log, | umap_isna, | |||
umap_log2, | umap_isnan, | |||
umap_log10, | umap_lgamma, | |||
umap_log1p, | umap_log, | |||
umap_real, | umap_log2, | |||
umap_round, | umap_log10, | |||
umap_roundb, | umap_log1p, | |||
umap_signum, | umap_real, | |||
umap_sin, | umap_round, | |||
umap_sinh, | umap_roundb, | |||
umap_sqrt, | umap_signum, | |||
umap_tan, | umap_sin, | |||
umap_tanh, | umap_sinh, | |||
umap_xisalnum, | umap_sqrt, | |||
umap_xisalpha, | umap_tan, | |||
umap_xisascii, | umap_tanh, | |||
umap_xiscntrl, | umap_xisalnum, | |||
umap_xisdigit, | umap_xisalpha, | |||
umap_xisgraph, | umap_xisascii, | |||
umap_xislower, | umap_xiscntrl, | |||
umap_xisprint, | umap_xisdigit, | |||
umap_xispunct, | umap_xisgraph, | |||
umap_xisspace, | umap_xislower, | |||
umap_xisupper, | umap_xisprint, | |||
umap_xisxdigit, | umap_xispunct, | |||
umap_xtoascii, | umap_xisspace, | |||
umap_xtolower, | umap_xisupper, | |||
umap_xtoupper, | umap_xisxdigit, | |||
umap_unknown, | umap_xsignbit, | |||
num_unary_mappers = umap_unknown | umap_xtoascii, | |||
}; | umap_xtolower, | |||
umap_xtoupper, | ||||
umap_unknown, | ||||
num_unary_mappers = umap_unknown | ||||
}; | ||||
virtual octave_value map (unary_mapper_t) const; | virtual octave_value map (unary_mapper_t) const; | |||
// These are fast indexing & assignment shortcuts for extracting | // These are fast indexing & assignment shortcuts for extracting | |||
// or inserting a single scalar from/to an array. | // or inserting a single scalar from/to an array. | |||
// Extract the n-th element, aka val(n). Result is undefined if val is no t an | // Extract the n-th element, aka val(n). Result is undefined if val is no t an | |||
// array type or n is out of range. Never error. | // array type or n is out of range. Never error. | |||
virtual octave_value | virtual octave_value | |||
fast_elem_extract (octave_idx_type n) const; | fast_elem_extract (octave_idx_type n) const; | |||
skipping to change at line 755 | skipping to change at line 769 | |||
// Never error. | // Never error. | |||
virtual bool | virtual bool | |||
fast_elem_insert (octave_idx_type n, const octave_value& x); | fast_elem_insert (octave_idx_type n, const octave_value& x); | |||
// This is a helper for the above, to be overriden in scalar types. The | // This is a helper for the above, to be overriden in scalar types. The | |||
// whole point is to handle the insertion efficiently with just *two* VM | // whole point is to handle the insertion efficiently with just *two* VM | |||
// calls, which is basically the theoretical minimum. | // calls, which is basically the theoretical minimum. | |||
virtual bool | virtual bool | |||
fast_elem_insert_self (void *where, builtin_type_t btyp) const; | fast_elem_insert_self (void *where, builtin_type_t btyp) const; | |||
// Grab the reference count. For use by jit. | ||||
void | ||||
grab (void) | ||||
{ | ||||
++count; | ||||
} | ||||
// Release the reference count. For use by jit. | ||||
void | ||||
release (void) | ||||
{ | ||||
if (--count == 0) | ||||
delete this; | ||||
} | ||||
protected: | protected: | |||
// This should only be called for derived types. | // This should only be called for derived types. | |||
octave_value numeric_assign (const std::string& type, | octave_value numeric_assign (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
const octave_value& rhs); | const octave_value& rhs); | |||
void reset_indent_level (void) const | void reset_indent_level (void) const | |||
{ curr_print_indent_level = 0; } | { curr_print_indent_level = 0; } | |||
void increment_indent_level (void) const | void increment_indent_level (void) const | |||
{ curr_print_indent_level += 2; } | { curr_print_indent_level += 2; } | |||
void decrement_indent_level (void) const | void decrement_indent_level (void) const | |||
{ curr_print_indent_level -= 2; } | { curr_print_indent_level -= 2; } | |||
int current_print_indent_level (void) const | int current_print_indent_level (void) const | |||
{ return curr_print_indent_level; } | { return curr_print_indent_level; } | |||
void indent (std::ostream& os) const; | void indent (std::ostream& os) const; | |||
void newline (std::ostream& os) const; | void newline (std::ostream& os) const; | |||
void reset (void) const; | void reset (void) const; | |||
// A reference count. | // A reference count. | |||
// NOTE: the declaration is octave_idx_type because with 64-bit indexing, | // NOTE: the declaration is octave_idx_type because with 64-bit indexing, | |||
// it is well possible to have more than MAX_INT copies of a single value | // it is well possible to have more than MAX_INT copies of a single value | |||
// (think of an empty cell array with >2G elements). | // (think of an empty cell array with >2G elements). | |||
octave_refcount<octave_idx_type> count; | octave_refcount<octave_idx_type> count; | |||
private: | ||||
static const char *get_umap_name (unary_mapper_t); | static const char *get_umap_name (unary_mapper_t); | |||
private: | ||||
static int curr_print_indent_level; | static int curr_print_indent_level; | |||
static bool beginning_of_line; | static bool beginning_of_line; | |||
DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA | |||
}; | }; | |||
// TRUE means to perform automatic sparse to real mutation if there | // TRUE means to perform automatic sparse to real mutation if there | |||
// is memory to be saved | // is memory to be saved | |||
extern OCTINTERP_API bool Vsparse_auto_mutate; | extern OCTINTERP_API bool Vsparse_auto_mutate; | |||
End of changes. 33 change blocks. | ||||
95 lines changed or deleted | 122 lines changed or added | |||
ov-bool-mat.cc | ov-bool-mat.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 37 | skipping to change at line 37 | |||
#include <iostream> | #include <iostream> | |||
#include <vector> | #include <vector> | |||
#include "lo-ieee.h" | #include "lo-ieee.h" | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-locbuf.h" | #include "oct-locbuf.h" | |||
#include "defun.h" | #include "defun.h" | |||
#include "gripes.h" | #include "gripes.h" | |||
#include "mxarray.h" | ||||
#include "oct-obj.h" | #include "oct-obj.h" | |||
#include "ops.h" | #include "ops.h" | |||
#include "ov-base.h" | #include "ov-base.h" | |||
#include "ov-base-mat.h" | #include "ov-base-mat.h" | |||
#include "ov-base-mat.cc" | #include "ov-base-mat.cc" | |||
#include "ov-bool.h" | #include "ov-bool.h" | |||
#include "ov-bool-mat.h" | #include "ov-bool-mat.h" | |||
#include "ov-re-mat.h" | #include "ov-re-mat.h" | |||
#include "pr-output.h" | #include "pr-output.h" | |||
skipping to change at line 100 | skipping to change at line 101 | |||
return retval; | return retval; | |||
} | } | |||
double | double | |||
octave_bool_matrix::double_value (bool) const | octave_bool_matrix::double_value (bool) const | |||
{ | { | |||
double retval = lo_ieee_nan_value (); | double retval = lo_ieee_nan_value (); | |||
if (rows () > 0 && columns () > 0) | if (rows () > 0 && columns () > 0) | |||
{ | { | |||
gripe_implicit_conversion ("Octave:array-as-scalar", | gripe_implicit_conversion ("Octave:array-to-scalar", | |||
"bool matrix", "real scalar"); | "bool matrix", "real scalar"); | |||
retval = matrix (0, 0); | retval = matrix (0, 0); | |||
} | } | |||
else | else | |||
gripe_invalid_conversion ("bool matrix", "real scalar"); | gripe_invalid_conversion ("bool matrix", "real scalar"); | |||
return retval; | return retval; | |||
} | } | |||
float | float | |||
octave_bool_matrix::float_value (bool) const | octave_bool_matrix::float_value (bool) const | |||
{ | { | |||
float retval = lo_ieee_float_nan_value (); | float retval = lo_ieee_float_nan_value (); | |||
if (rows () > 0 && columns () > 0) | if (rows () > 0 && columns () > 0) | |||
{ | { | |||
gripe_implicit_conversion ("Octave:array-as-scalar", | gripe_implicit_conversion ("Octave:array-to-scalar", | |||
"bool matrix", "real scalar"); | "bool matrix", "real scalar"); | |||
retval = matrix (0, 0); | retval = matrix (0, 0); | |||
} | } | |||
else | else | |||
gripe_invalid_conversion ("bool matrix", "real scalar"); | gripe_invalid_conversion ("bool matrix", "real scalar"); | |||
return retval; | return retval; | |||
} | } | |||
Complex | Complex | |||
octave_bool_matrix::complex_value (bool) const | octave_bool_matrix::complex_value (bool) const | |||
{ | { | |||
double tmp = lo_ieee_nan_value (); | double tmp = lo_ieee_nan_value (); | |||
Complex retval (tmp, tmp); | Complex retval (tmp, tmp); | |||
if (rows () > 0 && columns () > 0) | if (rows () > 0 && columns () > 0) | |||
{ | { | |||
gripe_implicit_conversion ("Octave:array-as-scalar", | gripe_implicit_conversion ("Octave:array-to-scalar", | |||
"bool matrix", "complex scalar"); | "bool matrix", "complex scalar"); | |||
retval = matrix (0, 0); | retval = matrix (0, 0); | |||
} | } | |||
else | else | |||
gripe_invalid_conversion ("bool matrix", "complex scalar"); | gripe_invalid_conversion ("bool matrix", "complex scalar"); | |||
return retval; | return retval; | |||
} | } | |||
FloatComplex | FloatComplex | |||
octave_bool_matrix::float_complex_value (bool) const | octave_bool_matrix::float_complex_value (bool) const | |||
{ | { | |||
float tmp = lo_ieee_float_nan_value (); | float tmp = lo_ieee_float_nan_value (); | |||
FloatComplex retval (tmp, tmp); | FloatComplex retval (tmp, tmp); | |||
if (rows () > 0 && columns () > 0) | if (rows () > 0 && columns () > 0) | |||
{ | { | |||
gripe_implicit_conversion ("Octave:array-as-scalar", | gripe_implicit_conversion ("Octave:array-to-scalar", | |||
"bool matrix", "complex scalar"); | "bool matrix", "complex scalar"); | |||
retval = matrix (0, 0); | retval = matrix (0, 0); | |||
} | } | |||
else | else | |||
gripe_invalid_conversion ("bool matrix", "complex scalar"); | gripe_invalid_conversion ("bool matrix", "complex scalar"); | |||
return retval; | return retval; | |||
} | } | |||
skipping to change at line 332 | skipping to change at line 333 | |||
} | } | |||
return success; | return success; | |||
} | } | |||
bool | bool | |||
octave_bool_matrix::save_binary (std::ostream& os, bool& /* save_as_floats */) | octave_bool_matrix::save_binary (std::ostream& os, bool& /* save_as_floats */) | |||
{ | { | |||
dim_vector d = dims (); | dim_vector d = dims (); | |||
if (d.length() < 1) | if (d.length () < 1) | |||
return false; | return false; | |||
// Use negative value for ndims to differentiate with old format!! | // Use negative value for ndims to differentiate with old format!! | |||
int32_t tmp = - d.length(); | int32_t tmp = - d.length (); | |||
os.write (reinterpret_cast<char *> (&tmp), 4); | os.write (reinterpret_cast<char *> (&tmp), 4); | |||
for (int i = 0; i < d.length (); i++) | for (int i = 0; i < d.length (); i++) | |||
{ | { | |||
tmp = d(i); | tmp = d(i); | |||
os.write (reinterpret_cast<char *> (&tmp), 4); | os.write (reinterpret_cast<char *> (&tmp), 4); | |||
} | } | |||
boolNDArray m = bool_array_value (); | boolNDArray m = bool_array_value (); | |||
bool *mtmp = m.fortran_vec (); | bool *mtmp = m.fortran_vec (); | |||
octave_idx_type nel = m.nelem (); | octave_idx_type nel = m.nelem (); | |||
skipping to change at line 472 | skipping to change at line 473 | |||
} | } | |||
bool | bool | |||
octave_bool_matrix::load_hdf5 (hid_t loc_id, const char *name) | octave_bool_matrix::load_hdf5 (hid_t loc_id, const char *name) | |||
{ | { | |||
bool retval = false; | bool retval = false; | |||
dim_vector dv; | dim_vector dv; | |||
int empty = load_hdf5_empty (loc_id, name, dv); | int empty = load_hdf5_empty (loc_id, name, dv); | |||
if (empty > 0) | if (empty > 0) | |||
matrix.resize(dv); | matrix.resize (dv); | |||
if (empty) | if (empty) | |||
return (empty > 0); | return (empty > 0); | |||
#if HAVE_HDF5_18 | #if HAVE_HDF5_18 | |||
hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT); | hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT); | |||
#else | #else | |||
hid_t data_hid = H5Dopen (loc_id, name); | hid_t data_hid = H5Dopen (loc_id, name); | |||
#endif | #endif | |||
hid_t space_id = H5Dget_space (data_hid); | hid_t space_id = H5Dget_space (data_hid); | |||
skipping to change at line 512 | skipping to change at line 513 | |||
} | } | |||
else | else | |||
{ | { | |||
dv.resize (rank); | dv.resize (rank); | |||
for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--) | for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--) | |||
dv(j) = hdims[i]; | dv(j) = hdims[i]; | |||
} | } | |||
octave_idx_type nel = dv.numel (); | octave_idx_type nel = dv.numel (); | |||
OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nel); | OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nel); | |||
if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL, H5P_DEFAULT, h | if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL, H5P_DEFAULT, h | |||
tmp) >= 0) | tmp) | |||
>= 0) | ||||
{ | { | |||
retval = true; | retval = true; | |||
boolNDArray btmp (dv); | boolNDArray btmp (dv); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
btmp.elem (i) = htmp[i]; | btmp.elem (i) = htmp[i]; | |||
matrix = btmp; | matrix = btmp; | |||
} | } | |||
H5Dclose (data_hid); | H5Dclose (data_hid); | |||
return retval; | return retval; | |||
} | } | |||
#endif | #endif | |||
skipping to change at line 548 | skipping to change at line 550 | |||
const bool *p = matrix.data (); | const bool *p = matrix.data (); | |||
for (mwIndex i = 0; i < nel; i++) | for (mwIndex i = 0; i < nel; i++) | |||
pr[i] = p[i]; | pr[i] = p[i]; | |||
return retval; | return retval; | |||
} | } | |||
DEFUN (logical, args, , | DEFUN (logical, args, , | |||
"-*- texinfo -*-\n\ | "-*- texinfo -*-\n\ | |||
@deftypefn {Built-in Function} {} logical (@var{x})\n\ | @deftypefn {Built-in Function} {} logical (@var{x})\n\ | |||
Convert @var{x} to logical type.\n\ | Convert @var{x} to logical type.\n\ | |||
@seealso{double, single, char}\n\ | @seealso{double, single, char}\n\ | |||
@end deftypefn") | @end deftypefn") | |||
{ | { | |||
octave_value retval; | octave_value retval; | |||
if (args.length () == 1) | if (args.length () == 1) | |||
{ | { | |||
octave_value arg = args(0); | octave_value arg = args(0); | |||
skipping to change at line 580 | skipping to change at line 582 | |||
else | else | |||
gripe_wrong_type_arg ("logical", arg); | gripe_wrong_type_arg ("logical", arg); | |||
} | } | |||
else | else | |||
print_usage (); | print_usage (); | |||
return retval; | return retval; | |||
} | } | |||
/* | /* | |||
%!shared m, s, c | %!test | |||
%! m = eye (2) != 0; | %! m = eye (2) != 0; | |||
%! s = !0; | %! s = !0; | |||
%! c = {"double", "single", "int8", "int16", "int32", "int64", "uint8", "ui nt16", "uint32", "uint64", "logical"}; | %! c = {"double", "single", "int8", "int16", "int32", "int64", "uint8", "ui nt16", "uint32", "uint64", "logical"}; | |||
%!test | ||||
%! for i = 1:numel (c) | %! for i = 1:numel (c) | |||
%! assert (logical (eye (2, c{i})), m) | %! assert (logical (eye (2, c{i})), m) | |||
%! assert (logical (eye (1, c{i})), s) | %! assert (logical (eye (1, c{i})), s) | |||
%! endfor | %! endfor | |||
*/ | */ | |||
End of changes. 14 change blocks. | ||||
14 lines changed or deleted | 15 lines changed or added | |||
ov-bool-mat.h | ov-bool-mat.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_bool_matrix_h) | #if !defined (octave_ov_bool_mat_h) | |||
#define octave_bool_matrix_h 1 | #define octave_ov_bool_mat_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "error.h" | #include "error.h" | |||
skipping to change at line 72 | skipping to change at line 72 | |||
: octave_base_matrix<boolNDArray> (bnda) { } | : octave_base_matrix<boolNDArray> (bnda) { } | |||
octave_bool_matrix (const boolMatrix& bm) | octave_bool_matrix (const boolMatrix& bm) | |||
: octave_base_matrix<boolNDArray> (bm) { } | : octave_base_matrix<boolNDArray> (bm) { } | |||
octave_bool_matrix (const boolMatrix& bm, const MatrixType& t) | octave_bool_matrix (const boolMatrix& bm, const MatrixType& t) | |||
: octave_base_matrix<boolNDArray> (bm, t) { } | : octave_base_matrix<boolNDArray> (bm, t) { } | |||
octave_bool_matrix (const boolNDArray& bm, const idx_vector& cache) | octave_bool_matrix (const boolNDArray& bm, const idx_vector& cache) | |||
: octave_base_matrix<boolNDArray> (bm) | : octave_base_matrix<boolNDArray> (bm) | |||
{ | { | |||
set_idx_cache (cache); | set_idx_cache (cache); | |||
} | } | |||
octave_bool_matrix (const octave_bool_matrix& bm) | octave_bool_matrix (const octave_bool_matrix& bm) | |||
: octave_base_matrix<boolNDArray> (bm) { } | : octave_base_matrix<boolNDArray> (bm) { } | |||
~octave_bool_matrix (void) { } | ~octave_bool_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_bool_matrix (*t | octave_base_value *clone (void) const | |||
his); } | { return new octave_bool_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_bool_matr | ||||
ix (); } | octave_base_value *empty_clone (void) const | |||
{ return new octave_bool_matrix (); } | ||||
type_conv_info numeric_conversion_function (void) const; | type_conv_info numeric_conversion_function (void) const; | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
idx_vector index_vector (void) const | idx_vector index_vector (void) const | |||
{ return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); } | { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); } | |||
builtin_type_t builtin_type (void) const { return btyp_bool; } | builtin_type_t builtin_type (void) const { return btyp_bool; } | |||
bool is_bool_matrix (void) const { return true; } | bool is_bool_matrix (void) const { return true; } | |||
bool is_bool_type (void) const { return true; } | bool is_bool_type (void) const { return true; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
bool is_numeric_type (void) const { return false; } | bool is_numeric_type (void) const { return false; } | |||
skipping to change at line 130 | skipping to change at line 133 | |||
uint32_array_value (void) const { return uint32NDArray (matrix); } | uint32_array_value (void) const { return uint32NDArray (matrix); } | |||
uint64NDArray | uint64NDArray | |||
uint64_array_value (void) const { return uint64NDArray (matrix); } | uint64_array_value (void) const { return uint64NDArray (matrix); } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
float float_value (bool = false) const; | float float_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
Matrix matrix_value (bool = false) const | Matrix matrix_value (bool = false) const | |||
{ return Matrix (matrix.matrix_value ()); } | { return Matrix (matrix.matrix_value ()); } | |||
FloatMatrix float_matrix_value (bool = false) const | FloatMatrix float_matrix_value (bool = false) const | |||
{ return FloatMatrix (matrix.matrix_value ()); } | { return FloatMatrix (matrix.matrix_value ()); } | |||
NDArray array_value (bool = false) const | NDArray array_value (bool = false) const | |||
{ return NDArray (matrix); } | { return NDArray (matrix); } | |||
FloatNDArray float_array_value (bool = false) const | FloatNDArray float_array_value (bool = false) const | |||
{ return FloatNDArray (matrix); } | { return FloatNDArray (matrix); } | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
FloatComplex float_complex_value (bool = false) const; | FloatComplex float_complex_value (bool = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const | ComplexMatrix complex_matrix_value (bool = false) const | |||
{ return ComplexMatrix (matrix.matrix_value ( )); } | { return ComplexMatrix (matrix.matrix_value ( )); } | |||
FloatComplexMatrix float_complex_matrix_value (bool = false) const | FloatComplexMatrix float_complex_matrix_value (bool = false) const | |||
{ return FloatComplexMatrix (matrix.matrix_value ( )); } | { return FloatComplexMatrix (matrix.matrix_value ( )); } | |||
ComplexNDArray complex_array_value (bool = false) const | ComplexNDArray complex_array_value (bool = false) const | |||
{ return ComplexNDArray (matrix); } | { return ComplexNDArray (matrix); } | |||
FloatComplexNDArray float_complex_array_value (bool = false) const | FloatComplexNDArray float_complex_array_value (bool = false) const | |||
{ return FloatComplexNDArray (matrix); } | { return FloatComplexNDArray (matrix); } | |||
charNDArray | charNDArray | |||
char_array_value (bool = false) const | char_array_value (bool = false) const | |||
{ | { | |||
charNDArray retval (dims ()); | charNDArray retval (dims ()); | |||
octave_idx_type nel = numel (); | octave_idx_type nel = numel (); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
retval(i) = static_cast<char>(matrix(i)); | retval(i) = static_cast<char>(matrix(i)); | |||
return retval; | return retval; | |||
} | } | |||
boolMatrix bool_matrix_value (bool = false) const | boolMatrix bool_matrix_value (bool = false) const | |||
{ return matrix.matrix_value (); } | { return matrix.matrix_value (); } | |||
boolNDArray bool_array_value (bool = false) const | boolNDArray bool_array_value (bool = false) const | |||
{ return matrix; } | { return matrix; } | |||
SparseMatrix sparse_matrix_value (bool = false) const | SparseMatrix sparse_matrix_value (bool = false) const | |||
{ return SparseMatrix (Matrix (matrix.matrix_value ())); } | { return SparseMatrix (Matrix (matrix.matrix_value ())); } | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |||
{ return SparseComplexMatrix (ComplexMatrix (matrix.matrix_value ())); } | { return SparseComplexMatrix (ComplexMatrix (matrix.matrix_value ())); } | |||
SparseBoolMatrix sparse_bool_matrix_value (bool = false) const | SparseBoolMatrix sparse_bool_matrix_value (bool = false) const | |||
{ return SparseBoolMatrix (matrix.matrix_value ()); } | { return SparseBoolMatrix (matrix.matrix_value ()); } | |||
skipping to change at line 213 | skipping to change at line 216 | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ return os.write (matrix, block_size, output_type, skip, flt_fmt); } | { return os.write (matrix, block_size, output_type, skip, flt_fmt); } | |||
// Unsafe. This function exists to support the MEX interface. | // Unsafe. This function exists to support the MEX interface. | |||
// You should not use it anywhere else. | // You should not use it anywhere else. | |||
void *mex_get_data (void) const { return matrix.mex_get_data (); } | void *mex_get_data (void) const { return matrix.mex_get_data (); } | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
// Mapper functions are converted to double for treatment | // Mapper functions are converted to double for treatment | |||
octave_value map (unary_mapper_t umap) const | octave_value map (unary_mapper_t umap) const | |||
{ | { | |||
octave_matrix m (array_value ()); | octave_matrix m (array_value ()); | |||
return m.map (umap); | return m.map (umap); | |||
} | } | |||
protected: | protected: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 18 change blocks. | ||||
27 lines changed or deleted | 28 lines changed or added | |||
ov-bool-sparse.h | ov-bool-sparse.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_sparse_bool_matrix_h) | #if !defined (octave_ov_bool_sparse_h) | |||
#define octave_sparse_bool_matrix_h 1 | #define octave_ov_bool_sparse_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 79 | skipping to change at line 79 | |||
: octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { } | : octave_base_sparse<SparseBoolMatrix> (SparseBoolMatrix (m)) { } | |||
octave_sparse_bool_matrix (const Sparse<bool>& a) | octave_sparse_bool_matrix (const Sparse<bool>& a) | |||
: octave_base_sparse<SparseBoolMatrix> (a) { } | : octave_base_sparse<SparseBoolMatrix> (a) { } | |||
octave_sparse_bool_matrix (const octave_sparse_bool_matrix& bm) | octave_sparse_bool_matrix (const octave_sparse_bool_matrix& bm) | |||
: octave_base_sparse<SparseBoolMatrix> (bm) { } | : octave_base_sparse<SparseBoolMatrix> (bm) { } | |||
~octave_sparse_bool_matrix (void) { } | ~octave_sparse_bool_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_sparse_bool_mat | octave_base_value *clone (void) const | |||
rix (*this); } | { return new octave_sparse_bool_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_sparse_bo | octave_base_value *empty_clone (void) const | |||
ol_matrix (); } | { return new octave_sparse_bool_matrix (); } | |||
type_conv_info numeric_conversion_function (void) const; | type_conv_info numeric_conversion_function (void) const; | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
// FIXME Adapt idx_vector to allow sparse logical indexing!! | // FIXME Adapt idx_vector to allow sparse logical indexing without overfl ow!! | |||
idx_vector index_vector (void) const | idx_vector index_vector (void) const | |||
{ return idx_vector (bool_array_value ()); } | { return idx_vector (matrix); } | |||
builtin_type_t builtin_type (void) const { return btyp_bool; } | builtin_type_t builtin_type (void) const { return btyp_bool; } | |||
bool is_bool_matrix (void) const { return true; } | bool is_bool_matrix (void) const { return true; } | |||
bool is_bool_type (void) const { return true; } | bool is_bool_type (void) const { return true; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
bool is_numeric_type (void) const { return false; } | bool is_numeric_type (void) const { return false; } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
Matrix matrix_value (bool = false) const; | Matrix matrix_value (bool = false) const; | |||
NDArray array_value (bool = false) const; | NDArray array_value (bool = false) const; | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const; | ComplexMatrix complex_matrix_value (bool = false) const; | |||
ComplexNDArray complex_array_value (bool = false) const; | ComplexNDArray complex_array_value (bool = false) const; | |||
skipping to change at line 126 | skipping to change at line 128 | |||
boolMatrix bool_matrix_value (bool = false) const; | boolMatrix bool_matrix_value (bool = false) const; | |||
boolNDArray bool_array_value (bool = false) const; | boolNDArray bool_array_value (bool = false) const; | |||
SparseMatrix sparse_matrix_value (bool = false) const; | SparseMatrix sparse_matrix_value (bool = false) const; | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; | |||
SparseBoolMatrix sparse_bool_matrix_value (bool = false) const | SparseBoolMatrix sparse_bool_matrix_value (bool = false) const | |||
{ return matrix; } | { return matrix; } | |||
octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | |||
bool save_binary (std::ostream& os, bool& save_as_floats); | bool save_binary (std::ostream& os, bool& save_as_floats); | |||
bool load_binary (std::istream& is, bool swap, | bool load_binary (std::istream& is, bool swap, | |||
oct_mach_info::float_format fmt); | oct_mach_info::float_format fmt); | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
// Mapper functions are converted to double for treatment | // Mapper functions are converted to double for treatment | |||
octave_value map (unary_mapper_t umap) const | octave_value map (unary_mapper_t umap) const | |||
{ | { | |||
octave_sparse_matrix m (sparse_matrix_value ()); | octave_sparse_matrix m (sparse_matrix_value ()); | |||
return m.map (umap); | return m.map (umap); | |||
} | } | |||
protected: | protected: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
15 lines changed or deleted | 15 lines changed or added | |||
ov-bool.h | ov-bool.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_bool_h) | #if !defined (octave_ov_bool_h) | |||
#define octave_bool_h 1 | #define octave_ov_bool_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "lo-utils.h" | #include "lo-utils.h" | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 67 | skipping to change at line 67 | |||
octave_bool (bool b) | octave_bool (bool b) | |||
: octave_base_scalar<bool> (b) { } | : octave_base_scalar<bool> (b) { } | |||
octave_bool (const octave_bool& s) | octave_bool (const octave_bool& s) | |||
: octave_base_scalar<bool> (s) { } | : octave_base_scalar<bool> (s) { } | |||
~octave_bool (void) { } | ~octave_bool (void) { } | |||
octave_base_value *clone (void) const { return new octave_bool (*this); } | octave_base_value *clone (void) const { return new octave_bool (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_bool_matr | octave_base_value *empty_clone (void) const | |||
ix (); } | { return new octave_bool_matrix (); } | |||
type_conv_info numeric_conversion_function (void) const; | type_conv_info numeric_conversion_function (void) const; | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
idx_vector index_vector (void) const { return idx_vector (scalar); } | idx_vector index_vector (void) const { return idx_vector (scalar); } | |||
builtin_type_t builtin_type (void) const { return btyp_bool; } | builtin_type_t builtin_type (void) const { return btyp_bool; } | |||
skipping to change at line 92 | skipping to change at line 93 | |||
bool is_bool_type (void) const { return true; } | bool is_bool_type (void) const { return true; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
bool is_numeric_type (void) const { return false; } | bool is_numeric_type (void) const { return false; } | |||
bool is_true (void) const { return scalar; } | bool is_true (void) const { return scalar; } | |||
int8NDArray | int8NDArray | |||
int8_array_value (void) const | int8_array_value (void) const | |||
{ return int8NDArray (dim_vector (1, 1), scalar); } | { return int8NDArray (dim_vector (1, 1), scalar); } | |||
int16NDArray | int16NDArray | |||
int16_array_value (void) const | int16_array_value (void) const | |||
{ return int16NDArray (dim_vector (1, 1), scalar); } | { return int16NDArray (dim_vector (1, 1), scalar); } | |||
int32NDArray | int32NDArray | |||
int32_array_value (void) const | int32_array_value (void) const | |||
{ return int32NDArray (dim_vector (1, 1), scalar); } | { return int32NDArray (dim_vector (1, 1), scalar); } | |||
int64NDArray | int64NDArray | |||
int64_array_value (void) const | int64_array_value (void) const | |||
{ return int64NDArray (dim_vector (1, 1), scalar); } | { return int64NDArray (dim_vector (1, 1), scalar); } | |||
uint8NDArray | uint8NDArray | |||
uint8_array_value (void) const | uint8_array_value (void) const | |||
{ return uint8NDArray (dim_vector (1, 1), scalar); } | { return uint8NDArray (dim_vector (1, 1), scalar); } | |||
uint16NDArray | uint16NDArray | |||
uint16_array_value (void) const | uint16_array_value (void) const | |||
{ return uint16NDArray (dim_vector (1, 1), scalar); } | { return uint16NDArray (dim_vector (1, 1), scalar); } | |||
uint32NDArray | uint32NDArray | |||
uint32_array_value (void) const | uint32_array_value (void) const | |||
{ return uint32NDArray (dim_vector (1, 1), scalar); } | { return uint32NDArray (dim_vector (1, 1), scalar); } | |||
uint64NDArray | uint64NDArray | |||
uint64_array_value (void) const | uint64_array_value (void) const | |||
{ return uint64NDArray (dim_vector (1, 1), scalar); } | { return uint64NDArray (dim_vector (1, 1), scalar); } | |||
octave_int8 | octave_int8 | |||
int8_scalar_value (void) const { return octave_int8 (scalar); } | int8_scalar_value (void) const { return octave_int8 (scalar); } | |||
octave_int16 | octave_int16 | |||
int16_scalar_value (void) const { return octave_int16 (scalar); } | int16_scalar_value (void) const { return octave_int16 (scalar); } | |||
octave_int32 | octave_int32 | |||
int32_scalar_value (void) const { return octave_int32 (scalar); } | int32_scalar_value (void) const { return octave_int32 (scalar); } | |||
skipping to change at line 155 | skipping to change at line 156 | |||
double double_value (bool = false) const { return scalar; } | double double_value (bool = false) const { return scalar; } | |||
float float_value (bool = false) const { return scalar; } | float float_value (bool = false) const { return scalar; } | |||
double scalar_value (bool = false) const { return scalar; } | double scalar_value (bool = false) const { return scalar; } | |||
float float_scalar_value (bool = false) const { return scalar; } | float float_scalar_value (bool = false) const { return scalar; } | |||
Matrix matrix_value (bool = false) const | Matrix matrix_value (bool = false) const | |||
{ return Matrix (1, 1, scalar); } | { return Matrix (1, 1, scalar); } | |||
FloatMatrix float_matrix_value (bool = false) const | FloatMatrix float_matrix_value (bool = false) const | |||
{ return FloatMatrix (1, 1, scalar); } | { return FloatMatrix (1, 1, scalar); } | |||
NDArray array_value (bool = false) const | NDArray array_value (bool = false) const | |||
{ return NDArray (dim_vector (1, 1), static_cast<double> (scalar)); } | { return NDArray (dim_vector (1, 1), static_cast<double> (scalar)); } | |||
FloatNDArray float_array_value (bool = false) const | FloatNDArray float_array_value (bool = false) const | |||
{ return FloatNDArray (dim_vector (1, 1), static_cast<double> (scalar)) ; } | { return FloatNDArray (dim_vector (1, 1), static_cast<double> (scalar)); } | |||
Complex complex_value (bool = false) const { return scalar; } | Complex complex_value (bool = false) const { return scalar; } | |||
FloatComplex float_complex_value (bool = false) const { return scalar; } | FloatComplex float_complex_value (bool = false) const { return scalar; } | |||
ComplexMatrix complex_matrix_value (bool = false) const | ComplexMatrix complex_matrix_value (bool = false) const | |||
{ return ComplexMatrix (1, 1, Complex (scalar)); } | { return ComplexMatrix (1, 1, Complex (scalar)); } | |||
FloatComplexMatrix float_complex_matrix_value (bool = false) const | FloatComplexMatrix float_complex_matrix_value (bool = false) const | |||
{ return FloatComplexMatrix (1, 1, FloatComplex (scalar)); } | { return FloatComplexMatrix (1, 1, FloatComplex (scalar)); } | |||
ComplexNDArray complex_array_value (bool = false) const | ComplexNDArray complex_array_value (bool = false) const | |||
{ return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); } | { return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); } | |||
FloatComplexNDArray float_complex_array_value (bool = false) const | FloatComplexNDArray float_complex_array_value (bool = false) const | |||
{ return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)) ; } | { return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)); } | |||
SparseMatrix sparse_matrix_value (bool = false) const | SparseMatrix sparse_matrix_value (bool = false) const | |||
{ return SparseMatrix (Matrix (1, 1, scalar)); } | { return SparseMatrix (Matrix (1, 1, scalar)); } | |||
// FIXME Need SparseComplexMatrix (Matrix) constructor!!! | // FIXME Need SparseComplexMatrix (Matrix) constructor!!! | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |||
{ return SparseComplexMatrix (sparse_matrix_value ()); } | { return SparseComplexMatrix (sparse_matrix_value ()); } | |||
SparseBoolMatrix sparse_bool_matrix_value (bool = false) const | SparseBoolMatrix sparse_bool_matrix_value (bool = false) const | |||
{ return SparseBoolMatrix (boolMatrix (1, 1, scalar)); } | { return SparseBoolMatrix (boolMatrix (1, 1, scalar)); } | |||
charNDArray | charNDArray | |||
char_array_value (bool = false) const | char_array_value (bool = false) const | |||
{ | { | |||
charNDArray retval (dim_vector (1, 1)); | charNDArray retval (dim_vector (1, 1)); | |||
retval(0) = static_cast<char> (scalar); | retval(0) = static_cast<char> (scalar); | |||
return retval; | return retval; | |||
} | } | |||
bool bool_value (bool = false) const { return scalar; } | bool bool_value (bool = false) const { return scalar; } | |||
boolMatrix bool_matrix_value (bool = false) const | boolMatrix bool_matrix_value (bool = false) const | |||
{ return boolMatrix (1, 1, scalar); } | { return boolMatrix (1, 1, scalar); } | |||
boolNDArray bool_array_value (bool = false) const | boolNDArray bool_array_value (bool = false) const | |||
{ return boolNDArray (dim_vector (1, 1), scalar); } | { return boolNDArray (dim_vector (1, 1), scalar); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const; | octave_value resize (const dim_vector& dv, bool fill = false) const; | |||
octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | |||
bool save_ascii (std::ostream& os); | bool save_ascii (std::ostream& os); | |||
bool load_ascii (std::istream& is); | bool load_ascii (std::istream& is); | |||
bool save_binary (std::ostream& os, bool& save_as_floats); | bool save_binary (std::ostream& os, bool& save_as_floats); | |||
skipping to change at line 230 | skipping to change at line 231 | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ | { | |||
return os.write (bool_array_value (), block_size, output_type, | return os.write (bool_array_value (), block_size, output_type, | |||
skip, flt_fmt); | skip, flt_fmt); | |||
} | } | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
// Mapper functions are converted to double for treatment | // Mapper functions are converted to double for treatment | |||
octave_value map (unary_mapper_t umap) const | octave_value map (unary_mapper_t umap) const | |||
{ | { | |||
octave_scalar m (scalar_value ()); | octave_scalar m (scalar_value ()); | |||
return m.map (umap); | return m.map (umap); | |||
} | } | |||
private: | private: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 26 change blocks. | ||||
34 lines changed or deleted | 34 lines changed or added | |||
ov-builtin.h | ov-builtin.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_builtin_h) | #if !defined (octave_ov_builtin_h) | |||
#define octave_builtin_h 1 | #define octave_ov_builtin_h 1 | |||
#include <string> | #include <string> | |||
#include "ov-fcn.h" | #include "ov-fcn.h" | |||
#include "ov-typeinfo.h" | #include "ov-typeinfo.h" | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
class jit_type; | ||||
// Builtin functions. | // Builtin functions. | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
octave_builtin : public octave_function | octave_builtin : public octave_function | |||
{ | { | |||
public: | public: | |||
octave_builtin (void) : octave_function (), f (0) { } | octave_builtin (void) : octave_function (), f (0), file (), jtype (0) { } | |||
typedef octave_value_list (*fcn) (const octave_value_list&, int); | typedef octave_value_list (*fcn) (const octave_value_list&, int); | |||
octave_builtin (fcn ff, const std::string& nm = std::string (), | octave_builtin (fcn ff, const std::string& nm = std::string (), | |||
const std::string& ds = std::string ()) | const std::string& ds = std::string ()) | |||
: octave_function (nm, ds), f (ff) { } | : octave_function (nm, ds), f (ff), file (), jtype (0) { } | |||
octave_builtin (fcn ff, const std::string& nm, const std::string& fnm, | ||||
const std::string& ds) | ||||
: octave_function (nm, ds), f (ff), file (fnm), jtype (0) { } | ||||
~octave_builtin (void) { } | ~octave_builtin (void) { } | |||
std::string src_file_name (void) const { return file; } | ||||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx) | const std::list<octave_value_list>& idx) | |||
{ | { | |||
octave_value_list tmp = subsref (type, idx, 1); | octave_value_list tmp = subsref (type, idx, 1); | |||
return tmp.length () > 0 ? tmp(0) : octave_value (); | return tmp.length () > 0 ? tmp(0) : octave_value (); | |||
} | } | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
int nargout); | int nargout); | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
int nargout, const std::list<octave_lvalue>* l | int nargout, | |||
value_list); | const std::list<octave_lvalue>* lvalue_list); | |||
octave_function *function_value (bool = false) { return this; } | octave_function *function_value (bool = false) { return this; } | |||
bool is_builtin_function (void) const { return true; } | bool is_builtin_function (void) const { return true; } | |||
octave_value_list | octave_value_list | |||
do_multi_index_op (int nargout, const octave_value_list& args); | do_multi_index_op (int nargout, const octave_value_list& args); | |||
octave_value_list | octave_value_list | |||
do_multi_index_op (int nargout, const octave_value_list& args, | do_multi_index_op (int nargout, const octave_value_list& args, | |||
const std::list<octave_lvalue>* lvalue_list); | const std::list<octave_lvalue>* lvalue_list); | |||
jit_type *to_jit (void) const; | ||||
void stash_jit (jit_type& type); | ||||
fcn function (void) const; | ||||
static const std::list<octave_lvalue> *curr_lvalue_list; | static const std::list<octave_lvalue> *curr_lvalue_list; | |||
protected: | protected: | |||
// A pointer to the actual function. | // A pointer to the actual function. | |||
fcn f; | fcn f; | |||
// The name of the file where this function was defined. | ||||
std::string file; | ||||
// A pointer to the jit type that represents the function. | ||||
jit_type *jtype; | ||||
private: | private: | |||
// No copying! | // No copying! | |||
octave_builtin (const octave_builtin& ob); | octave_builtin (const octave_builtin& ob); | |||
octave_builtin& operator = (const octave_builtin& ob); | octave_builtin& operator = (const octave_builtin& ob); | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
End of changes. 10 change blocks. | ||||
11 lines changed or deleted | 30 lines changed or added | |||
ov-cell.h | ov-cell.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1999-2012 John W. Eaton | Copyright (C) 1999-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_cell_h) | #if !defined (octave_ov_cell_h) | |||
#define octave_cell_h 1 | #define octave_ov_cell_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include <memory> | #include <memory> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 60 | skipping to change at line 60 | |||
{ | { | |||
public: | public: | |||
octave_cell (void) | octave_cell (void) | |||
: octave_base_matrix<Cell> (), cellstr_cache () { } | : octave_base_matrix<Cell> (), cellstr_cache () { } | |||
octave_cell (const Cell& c) | octave_cell (const Cell& c) | |||
: octave_base_matrix<Cell> (c), cellstr_cache () { } | : octave_base_matrix<Cell> (c), cellstr_cache () { } | |||
octave_cell (const Array<std::string>& str) | octave_cell (const Array<std::string>& str) | |||
: octave_base_matrix<Cell> (Cell (str)), cellstr_cache (new Array<std:: | : octave_base_matrix<Cell> (Cell (str)), | |||
string> (str)) { } | cellstr_cache (new Array<std::string> (str)) { } | |||
octave_cell (const octave_cell& c) | octave_cell (const octave_cell& c) | |||
: octave_base_matrix<Cell> (c), cellstr_cache () { } | : octave_base_matrix<Cell> (c), cellstr_cache () { } | |||
~octave_cell (void) { } | ~octave_cell (void) { } | |||
octave_base_value *clone (void) const { return new octave_cell (*this); } | octave_base_value *clone (void) const { return new octave_cell (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_cell (); } | octave_base_value *empty_clone (void) const { return new octave_cell (); } | |||
#if 0 | #if 0 | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
#endif | #endif | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx) | const std::list<octave_value_list>& idx) | |||
{ | { | |||
octave_value_list tmp = subsref (type, idx, 1); | octave_value_list tmp = subsref (type, idx, 1); | |||
return tmp.length () > 0 ? tmp(0) : octave_value (); | return tmp.length () > 0 ? tmp(0) : octave_value (); | |||
} | } | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, int); | const std::list<octave_value_list>& idx, | |||
int nargout) | ||||
{ | ||||
return subsref (type, idx, nargout, 0); | ||||
} | ||||
octave_value_list subsref (const std::string& type, | ||||
const std::list<octave_value_list>& idx, | ||||
int nargout, | ||||
const std::list<octave_lvalue> *lvalue_list); | ||||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
bool auto_add); | bool auto_add); | |||
octave_value subsasgn (const std::string& type, | octave_value subsasgn (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
const octave_value& rhs); | const octave_value& rhs); | |||
void assign (const octave_value_list& idx, const Cell& rhs); | void assign (const octave_value_list& idx, const Cell& rhs); | |||
skipping to change at line 132 | skipping to change at line 142 | |||
bool is_cellstr (void) const; | bool is_cellstr (void) const; | |||
bool is_true (void) const; | bool is_true (void) const; | |||
Cell cell_value (void) const { return matrix; } | Cell cell_value (void) const { return matrix; } | |||
octave_value_list list_value (void) const; | octave_value_list list_value (void) const; | |||
octave_value convert_to_str_internal (bool pad, bool, char type) const | octave_value convert_to_str_internal (bool pad, bool, char type) const | |||
{ return octave_value (all_strings (pad), type); } | { return octave_value (all_strings (pad), type); } | |||
string_vector all_strings (bool pad = false) const; | string_vector all_strings (bool pad = false) const; | |||
Array<std::string> cellstr_value (void) const; | Array<std::string> cellstr_value (void) const; | |||
bool print_as_scalar (void) const; | bool print_as_scalar (void) const; | |||
void print (std::ostream& os, bool pr_as_read_syntax = false) const; | void print (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
void short_disp (std::ostream& os) const; | ||||
bool save_ascii (std::ostream& os); | bool save_ascii (std::ostream& os); | |||
bool load_ascii (std::istream& is); | bool load_ascii (std::istream& is); | |||
bool save_binary (std::ostream& os, bool& save_as_floats); | bool save_binary (std::ostream& os, bool& save_as_floats); | |||
bool load_binary (std::istream& is, bool swap, | bool load_binary (std::istream& is, bool swap, | |||
oct_mach_info::float_format fmt); | oct_mach_info::float_format fmt); | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
skipping to change at line 170 | skipping to change at line 182 | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
// Unsafe. This function exists to support the MEX interface. | // Unsafe. This function exists to support the MEX interface. | |||
// You should not use it anywhere else. | // You should not use it anywhere else. | |||
void *mex_get_data (void) const; | void *mex_get_data (void) const; | |||
private: | private: | |||
void clear_cellstr_cache (void) const | void clear_cellstr_cache (void) const | |||
{ cellstr_cache.reset (); } | { cellstr_cache.reset (); } | |||
mutable std::auto_ptr<Array<std::string> > cellstr_cache; | mutable std::auto_ptr<Array<std::string> > cellstr_cache; | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
12 lines changed or deleted | 23 lines changed or added | |||
ov-ch-mat.h | ov-ch-mat.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_char_matrix_h) | #if !defined (octave_ov_ch_mat_h) | |||
#define octave_char_matrix_h 1 | #define octave_ov_ch_mat_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 85 | skipping to change at line 85 | |||
octave_char_matrix (const string_vector& s) | octave_char_matrix (const string_vector& s) | |||
: octave_base_matrix<charNDArray> (s) { } | : octave_base_matrix<charNDArray> (s) { } | |||
octave_char_matrix (const octave_char_matrix& chm) | octave_char_matrix (const octave_char_matrix& chm) | |||
: octave_base_matrix<charNDArray> (chm) { } | : octave_base_matrix<charNDArray> (chm) { } | |||
public: | public: | |||
~octave_char_matrix (void) { } | ~octave_char_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_char_matrix (*t | octave_base_value *clone (void) const | |||
his); } | { return new octave_char_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_char_matr | octave_base_value *empty_clone (void) const | |||
ix (); } | { return new octave_char_matrix (); } | |||
idx_vector index_vector (void) const; | idx_vector index_vector (void) const; | |||
builtin_type_t builtin_type (void) const { return btyp_char; } | builtin_type_t builtin_type (void) const { return btyp_char; } | |||
bool is_char_matrix (void) const { return true; } | bool is_char_matrix (void) const { return true; } | |||
bool is_real_matrix (void) const { return true; } | bool is_real_matrix (void) const { return true; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
float float_value (bool = false) const; | float float_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
float float_scalar_value (bool frc_str_conv = false) const | float float_scalar_value (bool frc_str_conv = false) const | |||
{ return float_value (frc_str_conv); } | { return float_value (frc_str_conv); } | |||
Matrix matrix_value (bool = false) const | Matrix matrix_value (bool = false) const | |||
{ return Matrix (matrix.matrix_value ()); } | { return Matrix (matrix.matrix_value ()); } | |||
FloatMatrix float_matrix_value (bool = false) const | FloatMatrix float_matrix_value (bool = false) const | |||
{ return FloatMatrix (matrix.matrix_value ()); } | { return FloatMatrix (matrix.matrix_value ()); } | |||
NDArray array_value (bool = false) const | NDArray array_value (bool = false) const | |||
{ return NDArray (matrix); } | { return NDArray (matrix); } | |||
FloatNDArray float_array_value (bool = false) const | FloatNDArray float_array_value (bool = false) const | |||
{ return FloatNDArray (matrix); } | { return FloatNDArray (matrix); } | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
FloatComplex float_complex_value (bool = false) const; | FloatComplex float_complex_value (bool = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const | ComplexMatrix complex_matrix_value (bool = false) const | |||
{ return ComplexMatrix (matrix.matrix_value ()); } | { return ComplexMatrix (matrix.matrix_value ()); } | |||
FloatComplexMatrix float_complex_matrix_value (bool = false) const | FloatComplexMatrix float_complex_matrix_value (bool = false) const | |||
{ return FloatComplexMatrix (matrix.matrix_value ()); } | { return FloatComplexMatrix (matrix.matrix_value ()); } | |||
ComplexNDArray complex_array_value (bool = false) const | ComplexNDArray complex_array_value (bool = false) const | |||
{ return ComplexNDArray (matrix); } | { return ComplexNDArray (matrix); } | |||
FloatComplexNDArray float_complex_array_value (bool = false) const | FloatComplexNDArray float_complex_array_value (bool = false) const | |||
{ return FloatComplexNDArray (matrix); } | { return FloatComplexNDArray (matrix); } | |||
charMatrix char_matrix_value (bool = false) const | charMatrix char_matrix_value (bool = false) const | |||
{ return matrix.matrix_value (); } | { return matrix.matrix_value (); } | |||
charNDArray char_array_value (bool = false) const | charNDArray char_array_value (bool = false) const | |||
{ return matrix; } | { return matrix; } | |||
octave_value convert_to_str_internal (bool, bool, char type) const | octave_value convert_to_str_internal (bool, bool, char type) const | |||
{ return octave_value (matrix, type); } | { return octave_value (matrix, type); } | |||
void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
// Unsafe. This function exists to support the MEX interface. | // Unsafe. This function exists to support the MEX interface. | |||
// You should not use it anywhere else. | // You should not use it anywhere else. | |||
void *mex_get_data (void) const { return matrix.mex_get_data (); } | void *mex_get_data (void) const { return matrix.mex_get_data (); } | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
octave_value map (unary_mapper_t umap) const; | octave_value map (unary_mapper_t umap) const; | |||
End of changes. 16 change blocks. | ||||
20 lines changed or deleted | 20 lines changed or added | |||
ov-class.h | ov-class.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2007-2012 John W. Eaton | Copyright (C) 2007-2013 John W. Eaton | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_class_h) | #if !defined (octave_ov_class_h) | |||
#define octave_class_h 1 | #define octave_ov_class_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "error.h" | #include "error.h" | |||
skipping to change at line 55 | skipping to change at line 55 | |||
// Data structures. | // Data structures. | |||
class | class | |||
octave_class : public octave_base_value | octave_class : public octave_base_value | |||
{ | { | |||
public: | public: | |||
octave_class (void) | octave_class (void) | |||
: octave_base_value (), map (), c_name (), | : octave_base_value (), map (), c_name (), | |||
parent_list (), obsolete_copies (0) | parent_list (), obsolete_copies (0) | |||
{ } | { } | |||
octave_class (const octave_map& m, const std::string& id, | octave_class (const octave_map& m, const std::string& id, | |||
const std::list<std::string>& plist) | const std::list<std::string>& plist) | |||
: octave_base_value (), map (m), c_name (id), | : octave_base_value (), map (m), c_name (id), | |||
parent_list (plist), obsolete_copies (0) | parent_list (plist), obsolete_copies (0) | |||
{ } | { } | |||
octave_class (const octave_map& m, const std::string& id, | octave_class (const octave_map& m, const std::string& id, | |||
const octave_value_list& parents); | const octave_value_list& parents); | |||
octave_class (const octave_class& s) | octave_class (const octave_class& s) | |||
: octave_base_value (s), map (s.map), c_name (s.c_name), | : octave_base_value (s), map (s.map), c_name (s.c_name), | |||
parent_list (s.parent_list), obsolete_copies (0) { } | parent_list (s.parent_list), obsolete_copies (0) { } | |||
~octave_class (void) { } | ~octave_class (void) { } | |||
skipping to change at line 89 | skipping to change at line 89 | |||
} | } | |||
Cell dotref (const octave_value_list& idx); | Cell dotref (const octave_value_list& idx); | |||
Matrix size (void); | Matrix size (void); | |||
octave_idx_type numel (const octave_value_list&); | octave_idx_type numel (const octave_value_list&); | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx) | const std::list<octave_value_list>& idx) | |||
{ | { | |||
octave_value_list tmp = subsref (type, idx, 1); | octave_value_list tmp = subsref (type, idx, 1); | |||
return tmp.length () > 0 ? tmp(0) : octave_value (); | return tmp.length () > 0 ? tmp(0) : octave_value (); | |||
} | } | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
int nargout); | int nargout); | |||
octave_value_list | octave_value_list | |||
do_multi_index_op (int nargout, const octave_value_list& idx) | do_multi_index_op (int nargout, const octave_value_list& idx) | |||
{ | { | |||
return subsref ("(", std::list<octave_value_list> (1, idx), nargout); | return subsref ("(", std::list<octave_value_list> (1, idx), nargout); | |||
} | } | |||
skipping to change at line 137 | skipping to change at line 137 | |||
{ | { | |||
dim_vector dv = dims (); | dim_vector dv = dims (); | |||
return dv.numel (); | return dv.numel (); | |||
} | } | |||
octave_idx_type nfields (void) const { return map.nfields (); } | octave_idx_type nfields (void) const { return map.nfields (); } | |||
size_t nparents (void) const { return parent_list.size (); } | size_t nparents (void) const { return parent_list.size (); } | |||
octave_value reshape (const dim_vector& new_dims) const | octave_value reshape (const dim_vector& new_dims) const | |||
{ | { | |||
octave_class retval = octave_class (*this); | octave_class retval = octave_class (*this); | |||
retval.map = retval.map_value().reshape (new_dims); | retval.map = retval.map_value ().reshape (new_dims); | |||
return octave_value (new octave_class (retval)); | return octave_value (new octave_class (retval)); | |||
} | } | |||
octave_value resize (const dim_vector& dv, bool = false) const | octave_value resize (const dim_vector& dv, bool = false) const | |||
{ | { | |||
octave_class retval = octave_class (*this); | octave_class retval = octave_class (*this); | |||
retval.map.resize (dv); | retval.map.resize (dv); | |||
return octave_value (new octave_class (retval)); | return octave_value (new octave_class (retval)); | |||
} | } | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
bool is_map (void) const { return false; } | bool is_map (void) const { return false; } | |||
bool is_object (void) const { return true; } | bool is_object (void) const { return true; } | |||
octave_map map_value (void) const { return map; } | octave_map map_value (void) const { return map; } | |||
string_vector map_keys (void) const; | string_vector map_keys (void) const; | |||
std::list<std::string> parent_class_name_list (void) const | std::list<std::string> parent_class_name_list (void) const | |||
{ return parent_list; } | { return parent_list; } | |||
string_vector parent_class_names (void) const | string_vector parent_class_names (void) const | |||
{ return string_vector (parent_list); } | { return string_vector (parent_list); } | |||
octave_base_value *find_parent_class (const std::string&); | octave_base_value *find_parent_class (const std::string&); | |||
octave_base_value *unique_parent_class (const std::string&); | octave_base_value *unique_parent_class (const std::string&); | |||
string_vector all_strings (bool pad) const; | string_vector all_strings (bool pad) const; | |||
void print (std::ostream& os, bool pr_as_read_syntax = false) const; | void print (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
skipping to change at line 281 | skipping to change at line 281 | |||
private: | private: | |||
string_vector field_names; | string_vector field_names; | |||
std::list<std::string> parent_class_names; | std::list<std::string> parent_class_names; | |||
}; | }; | |||
// A map from class names to lists of fields. | // A map from class names to lists of fields. | |||
static std::map<std::string, exemplar_info> exemplar_map; | static std::map<std::string, exemplar_info> exemplar_map; | |||
typedef std::map<std::string, exemplar_info>::iterator exemplar_iterator; | typedef std::map<std::string, exemplar_info>::iterator | |||
typedef std::map<std::string, exemplar_info>::const_iterator exemplar_con | exemplar_iterator; | |||
st_iterator; | typedef std::map<std::string, exemplar_info>::const_iterator | |||
exemplar_const_iterator; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 10 change blocks. | ||||
24 lines changed or deleted | 25 lines changed or added | |||
ov-colon.h | ov-colon.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_magic_colon_h) | #if !defined (octave_ov_colon_h) | |||
#define octave_magic_colon_h 1 | #define octave_ov_colon_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "error.h" | #include "error.h" | |||
skipping to change at line 57 | skipping to change at line 57 | |||
public: | public: | |||
octave_magic_colon (void) | octave_magic_colon (void) | |||
: octave_base_value () { } | : octave_base_value () { } | |||
octave_magic_colon (const octave_magic_colon&) | octave_magic_colon (const octave_magic_colon&) | |||
: octave_base_value () { } | : octave_base_value () { } | |||
~octave_magic_colon (void) { } | ~octave_magic_colon (void) { } | |||
octave_base_value *clone (void) const { return new octave_magic_colon (*t | octave_base_value *clone (void) const | |||
his); } | { return new octave_magic_colon (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_magic_col | octave_base_value *empty_clone (void) const | |||
on (); } | { return new octave_magic_colon (); } | |||
idx_vector index_vector (void) const { return idx_vector (':'); } | idx_vector index_vector (void) const { return idx_vector (':'); } | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
bool is_constant (void) const { return true; } | bool is_constant (void) const { return true; } | |||
bool is_magic_colon (void) const { return true; } | bool is_magic_colon (void) const { return true; } | |||
void print (std::ostream& os, bool pr_as_read_syntax = false) const; | void print (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
End of changes. 3 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
ov-complex.h | ov-complex.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_complex_h) | #if !defined (octave_ov_complex_h) | |||
#define octave_complex_h 1 | #define octave_ov_complex_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "lo-ieee.h" | #include "lo-ieee.h" | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 73 | skipping to change at line 73 | |||
~octave_complex (void) { } | ~octave_complex (void) { } | |||
octave_base_value *clone (void) const { return new octave_complex (*this) ; } | octave_base_value *clone (void) const { return new octave_complex (*this) ; } | |||
// We return an octave_complex_matrix object here instead of an | // We return an octave_complex_matrix object here instead of an | |||
// octave_complex object so that in expressions like A(2,2,2) = 2 | // octave_complex object so that in expressions like A(2,2,2) = 2 | |||
// (for A previously undefined), A will be empty instead of a 1x1 | // (for A previously undefined), A will be empty instead of a 1x1 | |||
// object. | // object. | |||
octave_base_value *empty_clone (void) const | octave_base_value *empty_clone (void) const | |||
{ return new octave_complex_matrix (); } | { return new octave_complex_matrix (); } | |||
type_conv_info numeric_demotion_function (void) const; | type_conv_info numeric_demotion_function (void) const; | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
// Use this to give a more specific error message | // Use this to give a more specific error message | |||
idx_vector index_vector (void) const | idx_vector index_vector (void) const | |||
{ | { | |||
error ( | error ("attempted to use a complex scalar as an index\n" | |||
"attempted to use a complex scalar as an index\n" | ||||
" (forgot to initialize i or j?)"); | " (forgot to initialize i or j?)"); | |||
return idx_vector (); | return idx_vector (); | |||
} | } | |||
octave_value any (int = 0) const | octave_value any (int = 0) const | |||
{ | { | |||
return (scalar != Complex (0, 0) | return (scalar != Complex (0, 0) | |||
&& ! (lo_ieee_isnan (std::real (scalar)) | && ! (lo_ieee_isnan (std::real (scalar)) | |||
|| lo_ieee_isnan (std::imag (scalar)))); | || lo_ieee_isnan (std::imag (scalar)))); | |||
} | } | |||
builtin_type_t builtin_type (void) const { return btyp_complex; } | builtin_type_t builtin_type (void) const { return btyp_complex; } | |||
bool is_complex_scalar (void) const { return true; } | bool is_complex_scalar (void) const { return true; } | |||
bool is_complex_type (void) const { return true; } | bool is_complex_type (void) const { return true; } | |||
bool is_double_type (void) const { return true; } | bool is_double_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
float float_value (bool = false) const; | float float_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
float float_scalar_value (bool frc_str_conv = false) const | float float_scalar_value (bool frc_str_conv = false) const | |||
{ return float_value (frc_str_conv); } | { return float_value (frc_str_conv); } | |||
Matrix matrix_value (bool = false) const; | Matrix matrix_value (bool = false) const; | |||
FloatMatrix float_matrix_value (bool = false) const; | FloatMatrix float_matrix_value (bool = false) const; | |||
NDArray array_value (bool = false) const; | NDArray array_value (bool = false) const; | |||
FloatNDArray float_array_value (bool = false) const; | FloatNDArray float_array_value (bool = false) const; | |||
SparseMatrix sparse_matrix_value (bool = false) const | SparseMatrix sparse_matrix_value (bool = false) const | |||
{ return SparseMatrix (matrix_value ()); } | { return SparseMatrix (matrix_value ()); } | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |||
{ return SparseComplexMatrix (complex_matrix_value ()); } | { return SparseComplexMatrix (complex_matrix_value ()); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const; | octave_value resize (const dim_vector& dv, bool fill = false) const; | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
FloatComplex float_complex_value (bool = false) const; | FloatComplex float_complex_value (bool = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const; | ComplexMatrix complex_matrix_value (bool = false) const; | |||
FloatComplexMatrix float_complex_matrix_value (bool = false) const; | FloatComplexMatrix float_complex_matrix_value (bool = false) const; | |||
skipping to change at line 166 | skipping to change at line 165 | |||
boolNDArray bool_array_value (bool warn = false) const | boolNDArray bool_array_value (bool warn = false) const | |||
{ | { | |||
if (xisnan (scalar)) | if (xisnan (scalar)) | |||
gripe_nan_to_logical_conversion (); | gripe_nan_to_logical_conversion (); | |||
else if (warn && scalar != 0.0 && scalar != 1.0) | else if (warn && scalar != 0.0 && scalar != 1.0) | |||
gripe_logical_conversion (); | gripe_logical_conversion (); | |||
return boolNDArray (dim_vector (1, 1), scalar != 0.0); | return boolNDArray (dim_vector (1, 1), scalar != 0.0); | |||
} | } | |||
octave_value diag (octave_idx_type m, octave_idx_type n) const; | ||||
void increment (void) { scalar += 1.0; } | void increment (void) { scalar += 1.0; } | |||
void decrement (void) { scalar -= 1.0; } | void decrement (void) { scalar -= 1.0; } | |||
bool save_ascii (std::ostream& os); | bool save_ascii (std::ostream& os); | |||
bool load_ascii (std::istream& is); | bool load_ascii (std::istream& is); | |||
bool save_binary (std::ostream& os, bool& save_as_floats); | bool save_binary (std::ostream& os, bool& save_as_floats); | |||
skipping to change at line 188 | skipping to change at line 189 | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ | { | |||
// Yes, for compatibility, we drop the imaginary part here. | // Yes, for compatibility, we drop the imaginary part here. | |||
return os.write (array_value (true), block_size, output_type, | return os.write (array_value (true), block_size, output_type, | |||
skip, flt_fmt); | skip, flt_fmt); | |||
} | } | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
octave_value map (unary_mapper_t umap) const; | octave_value map (unary_mapper_t umap) const; | |||
private: | private: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |||
End of changes. 11 change blocks. | ||||
20 lines changed or deleted | 21 lines changed or added | |||
ov-cs-list.h | ov-cs-list.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2002-2012 John W. Eaton | Copyright (C) 2002-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_cs_list_h) | #if !defined (octave_ov_cs_list_h) | |||
#define octave_cs_list_h 1 | #define octave_ov_cs_list_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "Cell.h" | #include "Cell.h" | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ov-cx-diag.h | ov-cx-diag.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_complex_diag_matrix_h) | #if !defined (octave_ov_cx_diag_h) | |||
#define octave_complex_diag_matrix_h 1 | #define octave_ov_cx_diag_h 1 | |||
#include "ov-base.h" | #include "ov-base.h" | |||
#include "ov-base-diag.h" | #include "ov-base-diag.h" | |||
#include "ov-cx-mat.h" | #include "ov-cx-mat.h" | |||
#include "ov-typeinfo.h" | #include "ov-typeinfo.h" | |||
// Real diagonal matrix values. | // Real diagonal matrix values. | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
skipping to change at line 51 | skipping to change at line 51 | |||
: octave_base_diag<ComplexDiagMatrix, ComplexMatrix> () { } | : octave_base_diag<ComplexDiagMatrix, ComplexMatrix> () { } | |||
octave_complex_diag_matrix (const ComplexDiagMatrix& m) | octave_complex_diag_matrix (const ComplexDiagMatrix& m) | |||
: octave_base_diag<ComplexDiagMatrix, ComplexMatrix> (m) { } | : octave_base_diag<ComplexDiagMatrix, ComplexMatrix> (m) { } | |||
octave_complex_diag_matrix (const octave_complex_diag_matrix& m) | octave_complex_diag_matrix (const octave_complex_diag_matrix& m) | |||
: octave_base_diag<ComplexDiagMatrix, ComplexMatrix> (m) { } | : octave_base_diag<ComplexDiagMatrix, ComplexMatrix> (m) { } | |||
~octave_complex_diag_matrix (void) { } | ~octave_complex_diag_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_complex_diag_ma | octave_base_value *clone (void) const | |||
trix (*this); } | { return new octave_complex_diag_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_complex_d | octave_base_value *empty_clone (void) const | |||
iag_matrix (); } | { return new octave_complex_diag_matrix (); } | |||
type_conv_info numeric_conversion_function (void) const; | type_conv_info numeric_conversion_function (void) const; | |||
type_conv_info numeric_demotion_function (void) const; | type_conv_info numeric_demotion_function (void) const; | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
builtin_type_t builtin_type (void) const { return btyp_complex; } | builtin_type_t builtin_type (void) const { return btyp_complex; } | |||
bool is_complex_matrix (void) const { return true; } | bool is_complex_matrix (void) const { return true; } | |||
End of changes. 3 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
ov-cx-mat.h | ov-cx-mat.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_complex_matrix_h) | #if !defined (octave_ov_cx_mat_h) | |||
#define octave_complex_matrix_h 1 | #define octave_ov_cx_mat_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 85 | skipping to change at line 85 | |||
: octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { } | : octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { } | |||
octave_complex_matrix (const ComplexColumnVector& v) | octave_complex_matrix (const ComplexColumnVector& v) | |||
: octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { } | : octave_base_matrix<ComplexNDArray> (ComplexMatrix (v)) { } | |||
octave_complex_matrix (const octave_complex_matrix& cm) | octave_complex_matrix (const octave_complex_matrix& cm) | |||
: octave_base_matrix<ComplexNDArray> (cm) { } | : octave_base_matrix<ComplexNDArray> (cm) { } | |||
~octave_complex_matrix (void) { } | ~octave_complex_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_complex_matrix | octave_base_value *clone (void) const | |||
(*this); } | { return new octave_complex_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_complex_m | octave_base_value *empty_clone (void) const | |||
atrix (); } | { return new octave_complex_matrix (); } | |||
type_conv_info numeric_demotion_function (void) const; | type_conv_info numeric_demotion_function (void) const; | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
builtin_type_t builtin_type (void) const { return btyp_complex; } | builtin_type_t builtin_type (void) const { return btyp_complex; } | |||
bool is_complex_matrix (void) const { return true; } | bool is_complex_matrix (void) const { return true; } | |||
bool is_complex_type (void) const { return true; } | bool is_complex_type (void) const { return true; } | |||
bool is_double_type (void) const { return true; } | bool is_double_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
float float_value (bool = false) const; | float float_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
float float_scalar_value (bool frc_str_conv = false) const | float float_scalar_value (bool frc_str_conv = false) const | |||
{ return float_value (frc_str_conv); } | { return float_value (frc_str_conv); } | |||
Matrix matrix_value (bool = false) const; | Matrix matrix_value (bool = false) const; | |||
FloatMatrix float_matrix_value (bool = false) const; | FloatMatrix float_matrix_value (bool = false) const; | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
FloatComplex float_complex_value (bool = false) const; | FloatComplex float_complex_value (bool = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const; | ComplexMatrix complex_matrix_value (bool = false) const; | |||
skipping to change at line 138 | skipping to change at line 140 | |||
boolNDArray bool_array_value (bool warn = false) const; | boolNDArray bool_array_value (bool warn = false) const; | |||
charNDArray char_array_value (bool frc_str_conv = false) const; | charNDArray char_array_value (bool frc_str_conv = false) const; | |||
SparseMatrix sparse_matrix_value (bool = false) const; | SparseMatrix sparse_matrix_value (bool = false) const; | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; | |||
octave_value diag (octave_idx_type k = 0) const; | octave_value diag (octave_idx_type k = 0) const; | |||
octave_value diag (octave_idx_type m, octave_idx_type n) const; | ||||
void increment (void) { matrix += Complex (1.0); } | void increment (void) { matrix += Complex (1.0); } | |||
void decrement (void) { matrix -= Complex (1.0); } | void decrement (void) { matrix -= Complex (1.0); } | |||
void changesign (void) { matrix.changesign (); } | void changesign (void) { matrix.changesign (); } | |||
bool save_ascii (std::ostream& os); | bool save_ascii (std::ostream& os); | |||
bool load_ascii (std::istream& is); | bool load_ascii (std::istream& is); | |||
skipping to change at line 162 | skipping to change at line 166 | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ | { | |||
// Yes, for compatibility, we drop the imaginary part here. | // Yes, for compatibility, we drop the imaginary part here. | |||
return os.write (matrix_value (true), block_size, output_type, | return os.write (matrix_value (true), block_size, output_type, | |||
skip, flt_fmt); | skip, flt_fmt); | |||
} | } | |||
void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
octave_value map (unary_mapper_t umap) const; | octave_value map (unary_mapper_t umap) const; | |||
private: | private: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
End of changes. 7 change blocks. | ||||
14 lines changed or deleted | 16 lines changed or added | |||
ov-cx-sparse.h | ov-cx-sparse.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_sparse_complex_matrix_h) | #if !defined (octave_ov_cx_sparse_h) | |||
#define octave_sparse_complex_matrix_h 1 | #define octave_ov_cx_sparse_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 90 | skipping to change at line 90 | |||
: octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m), t) { } | : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m), t) { } | |||
octave_sparse_complex_matrix (const Sparse<Complex>& m) | octave_sparse_complex_matrix (const Sparse<Complex>& m) | |||
: octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { } | : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { } | |||
octave_sparse_complex_matrix (const octave_sparse_complex_matrix& cm) | octave_sparse_complex_matrix (const octave_sparse_complex_matrix& cm) | |||
: octave_base_sparse<SparseComplexMatrix> (cm) { } | : octave_base_sparse<SparseComplexMatrix> (cm) { } | |||
~octave_sparse_complex_matrix (void) { } | ~octave_sparse_complex_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_sparse_complex_ | octave_base_value *clone (void) const | |||
matrix (*this); } | { return new octave_sparse_complex_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_sparse_co | octave_base_value *empty_clone (void) const | |||
mplex_matrix (); } | { return new octave_sparse_complex_matrix (); } | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
builtin_type_t builtin_type (void) const { return btyp_complex; } | builtin_type_t builtin_type (void) const { return btyp_complex; } | |||
bool is_complex_matrix (void) const { return true; } | bool is_complex_matrix (void) const { return true; } | |||
bool is_complex_type (void) const { return true; } | bool is_complex_type (void) const { return true; } | |||
bool is_double_type (void) const { return true; } | bool is_double_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
Matrix matrix_value (bool = false) const; | Matrix matrix_value (bool = false) const; | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const; | ComplexMatrix complex_matrix_value (bool = false) const; | |||
ComplexNDArray complex_array_value (bool = false) const; | ComplexNDArray complex_array_value (bool = false) const; | |||
charNDArray char_array_value (bool frc_str_conv = false) const; | charNDArray char_array_value (bool frc_str_conv = false) const; | |||
SparseMatrix sparse_matrix_value (bool = false) const; | SparseMatrix sparse_matrix_value (bool = false) const; | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |||
{ return matrix; } | { return matrix; } | |||
SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const; | SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const; | |||
#if 0 | #if 0 | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ | { | |||
// Yes, for compatibility, we drop the imaginary part here. | // Yes, for compatibility, we drop the imaginary part here. | |||
return os.write (matrix_value (true), block_size, output_type, | return os.write (matrix_value (true), block_size, output_type, | |||
skip, flt_fmt); | skip, flt_fmt); | |||
} | } | |||
#endif | #endif | |||
bool save_binary (std::ostream& os, bool& save_as_floats); | bool save_binary (std::ostream& os, bool& save_as_floats); | |||
bool load_binary (std::istream& is, bool swap, | bool load_binary (std::istream& is, bool swap, | |||
oct_mach_info::float_format fmt); | oct_mach_info::float_format fmt); | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
End of changes. 6 change blocks. | ||||
14 lines changed or deleted | 14 lines changed or added | |||
ov-dld-fcn.h | ov-dld-fcn.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_dld_function_h) | #if !defined (octave_ov_dld_fcn_h) | |||
#define octave_dld_function_h 1 | #define octave_ov_dld_fcn_h 1 | |||
#include <string> | #include <string> | |||
#include "oct-shlib.h" | #include "oct-shlib.h" | |||
#include "ov-fcn.h" | #include "ov-fcn.h" | |||
#include "ov-builtin.h" | #include "ov-builtin.h" | |||
#include "ov-typeinfo.h" | #include "ov-typeinfo.h" | |||
class octave_shlib; | class octave_shlib; | |||
skipping to change at line 72 | skipping to change at line 72 | |||
octave_time time_checked (void) const { return t_checked; } | octave_time time_checked (void) const { return t_checked; } | |||
bool is_system_fcn_file (void) const { return system_fcn_file; } | bool is_system_fcn_file (void) const { return system_fcn_file; } | |||
bool is_builtin_function (void) const { return false; } | bool is_builtin_function (void) const { return false; } | |||
bool is_dld_function (void) const { return true; } | bool is_dld_function (void) const { return true; } | |||
static octave_dld_function* create (octave_builtin::fcn ff, | static octave_dld_function* create (octave_builtin::fcn ff, | |||
const octave_shlib& shl, | const octave_shlib& shl, | |||
const std::string& nm = std::string (), | const std::string& nm = std::string ( | |||
const std::string& ds = std::string ()); | ), | |||
const std::string& ds = std::string ( | ||||
)); | ||||
octave_shlib get_shlib (void) const | octave_shlib get_shlib (void) const | |||
{ return sh_lib; } | { return sh_lib; } | |||
private: | private: | |||
octave_shlib sh_lib; | octave_shlib sh_lib; | |||
// The time the file was last checked to see if it needs to be | // The time the file was last checked to see if it needs to be | |||
// parsed again. | // parsed again. | |||
mutable octave_time t_checked; | mutable octave_time t_checked; | |||
// True if this function came from a file that is considered to be a | // True if this function came from a file that is considered to be a | |||
End of changes. 4 change blocks. | ||||
7 lines changed or deleted | 9 lines changed or added | |||
ov-fcn-handle.h | ov-fcn-handle.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_fcn_handle_h) | #if !defined (octave_ov_fcn_handle_h) | |||
#define octave_fcn_handle_h 1 | #define octave_ov_fcn_handle_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include <memory> | #include <memory> | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "ov-base.h" | #include "ov-base.h" | |||
#include "ov-base-mat.h" | #include "ov-base-mat.h" | |||
#include "ov-fcn.h" | #include "ov-fcn.h" | |||
skipping to change at line 62 | skipping to change at line 62 | |||
octave_fcn_handle (void) | octave_fcn_handle (void) | |||
: fcn (), nm (), has_overloads (false), overloads () { } | : fcn (), nm (), has_overloads (false), overloads () { } | |||
octave_fcn_handle (const std::string& n) | octave_fcn_handle (const std::string& n) | |||
: fcn (), nm (n), has_overloads (false), overloads () { } | : fcn (), nm (n), has_overloads (false), overloads () { } | |||
octave_fcn_handle (const octave_value& f, const std::string& n = anonymo us); | octave_fcn_handle (const octave_value& f, const std::string& n = anonymo us); | |||
octave_fcn_handle (const octave_fcn_handle& fh) | octave_fcn_handle (const octave_fcn_handle& fh) | |||
: octave_base_value (fh), fcn (fh.fcn), nm (fh.nm), | : octave_base_value (fh), fcn (fh.fcn), nm (fh.nm), | |||
has_overloads (fh.has_overloads), overloads () | has_overloads (fh.has_overloads), overloads () | |||
{ | { | |||
for (int i = 0; i < btyp_num_types; i++) | for (int i = 0; i < btyp_num_types; i++) | |||
builtin_overloads[i] = fh.builtin_overloads[i]; | builtin_overloads[i] = fh.builtin_overloads[i]; | |||
overloads = fh.overloads; | overloads = fh.overloads; | |||
} | } | |||
~octave_fcn_handle (void) { } | ~octave_fcn_handle (void) { } | |||
octave_base_value *clone (void) const { return new octave_fcn_handle (*th | octave_base_value *clone (void) const | |||
is); } | { return new octave_fcn_handle (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_fcn_handl | octave_base_value *empty_clone (void) const | |||
e (); } | { return new octave_fcn_handle (); } | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx) | const std::list<octave_value_list>& idx) | |||
{ | { | |||
octave_value_list tmp = subsref (type, idx, 1); | octave_value_list tmp = subsref (type, idx, 1); | |||
return tmp.length () > 0 ? tmp(0) : octave_value (); | return tmp.length () > 0 ? tmp(0) : octave_value (); | |||
} | } | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
int nargout); | int nargout); | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
int nargout, const std::list<octave_lvalue>* l | int nargout, | |||
value_list); | const std::list<octave_lvalue>* lvalue_list); | |||
octave_value_list | octave_value_list | |||
do_multi_index_op (int nargout, const octave_value_list& args); | do_multi_index_op (int nargout, const octave_value_list& args); | |||
octave_value_list | octave_value_list | |||
do_multi_index_op (int nargout, const octave_value_list& args, | do_multi_index_op (int nargout, const octave_value_list& args, | |||
const std::list<octave_lvalue>* lvalue_list); | const std::list<octave_lvalue>* lvalue_list); | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
bool is_function_handle (void) const { return true; } | bool is_function_handle (void) const { return true; } | |||
builtin_type_t builtin_type (void) const { return btyp_func_handle; } | builtin_type_t builtin_type (void) const { return btyp_func_handle; } | |||
bool is_overloaded (void) const { return has_overloads; } | bool is_overloaded (void) const { return has_overloads; } | |||
dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; } | dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; } | |||
octave_function *function_value (bool = false) | octave_function *function_value (bool = false) | |||
{ return fcn.function_value (); } | { return fcn.function_value (); } | |||
octave_user_function *user_function_value (bool = false) | octave_user_function *user_function_value (bool = false) | |||
{ return fcn.user_function_value (); } | { return fcn.user_function_value (); } | |||
octave_fcn_handle *fcn_handle_value (bool = false) { return this; } | octave_fcn_handle *fcn_handle_value (bool = false) { return this; } | |||
octave_value fcn_val (void) const { return fcn; } | octave_value fcn_val (void) const { return fcn; } | |||
std::string fcn_name (void) const { return nm; } | std::string fcn_name (void) const { return nm; } | |||
void set_overload (builtin_type_t btyp, const octave_value& ov_fcn) | void set_overload (builtin_type_t btyp, const octave_value& ov_fcn) | |||
{ | { | |||
if (btyp != btyp_unknown) | if (btyp != btyp_unknown) | |||
{ | { | |||
has_overloads = true; | has_overloads = true; | |||
builtin_overloads[btyp] = ov_fcn; | builtin_overloads[btyp] = ov_fcn; | |||
} | } | |||
} | } | |||
void set_overload (const std::string& dispatch_type, const octave_value& | void set_overload (const std::string& dispatch_type, | |||
ov_fcn) | const octave_value& ov_fcn) | |||
{ | { | |||
has_overloads = true; | has_overloads = true; | |||
overloads[dispatch_type] = ov_fcn; | overloads[dispatch_type] = ov_fcn; | |||
} | } | |||
bool is_equal_to (const octave_fcn_handle&) const; | bool is_equal_to (const octave_fcn_handle&) const; | |||
bool save_ascii (std::ostream& os); | bool save_ascii (std::ostream& os); | |||
bool load_ascii (std::istream& is); | bool load_ascii (std::istream& is); | |||
bool save_binary (std::ostream& os, bool& save_as_floats); | bool save_binary (std::ostream& os, bool& save_as_floats); | |||
bool load_binary (std::istream& is, bool swap, | bool load_binary (std::istream& is, bool swap, | |||
End of changes. 10 change blocks. | ||||
36 lines changed or deleted | 36 lines changed or added | |||
ov-fcn-inline.h | ov-fcn-inline.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_fcn_inline_h) | #if !defined (octave_ov_fcn_inline_h) | |||
#define octave_fcn_inline_h 1 | #define octave_ov_fcn_inline_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "ov-base.h" | #include "ov-base.h" | |||
#include "ov-base-mat.h" | #include "ov-base-mat.h" | |||
#include "ov-fcn.h" | #include "ov-fcn.h" | |||
#include "ov-typeinfo.h" | #include "ov-typeinfo.h" | |||
skipping to change at line 57 | skipping to change at line 57 | |||
: octave_fcn_handle (), iftext (), ifargs () { } | : octave_fcn_handle (), iftext (), ifargs () { } | |||
octave_fcn_inline (const std::string& f, const string_vector& a, | octave_fcn_inline (const std::string& f, const string_vector& a, | |||
const std::string& n = std::string ()); | const std::string& n = std::string ()); | |||
octave_fcn_inline (const octave_fcn_inline& fi) | octave_fcn_inline (const octave_fcn_inline& fi) | |||
: octave_fcn_handle (fi), iftext (fi.iftext), ifargs (fi.ifargs) { } | : octave_fcn_handle (fi), iftext (fi.iftext), ifargs (fi.ifargs) { } | |||
~octave_fcn_inline (void) { } | ~octave_fcn_inline (void) { } | |||
octave_base_value *clone (void) const { return new octave_fcn_inline (*th | octave_base_value *clone (void) const | |||
is); } | { return new octave_fcn_inline (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_fcn_inlin | octave_base_value *empty_clone (void) const | |||
e (); } | { return new octave_fcn_inline (); } | |||
bool is_inline_function (void) const { return true; } | bool is_inline_function (void) const { return true; } | |||
octave_fcn_inline *fcn_inline_value (bool = false) { return this; } | octave_fcn_inline *fcn_inline_value (bool = false) { return this; } | |||
std::string fcn_text (void) const { return iftext; } | std::string fcn_text (void) const { return iftext; } | |||
string_vector fcn_arg_names (void) const { return ifargs; } | string_vector fcn_arg_names (void) const { return ifargs; } | |||
octave_value convert_to_str_internal (bool, bool, char) const; | octave_value convert_to_str_internal (bool, bool, char) const; | |||
End of changes. 3 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
ov-fcn.h | ov-fcn.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_function_h) | #if !defined (octave_ov_fcn_h) | |||
#define octave_function_h 1 | #define octave_ov_fcn_h 1 | |||
#include <string> | #include <string> | |||
#include "oct-time.h" | #include "oct-time.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "oct-obj.h" | #include "oct-obj.h" | |||
#include "ov-base.h" | #include "ov-base.h" | |||
#include "ov-typeinfo.h" | #include "ov-typeinfo.h" | |||
skipping to change at line 64 | skipping to change at line 64 | |||
octave_base_value *empty_clone (void) const; | octave_base_value *empty_clone (void) const; | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
bool is_function (void) const { return true; } | bool is_function (void) const { return true; } | |||
virtual bool is_system_fcn_file (void) const { return false; } | virtual bool is_system_fcn_file (void) const { return false; } | |||
virtual std::string fcn_file_name (void) const { return std::string (); } | virtual std::string fcn_file_name (void) const { return std::string (); } | |||
virtual std::string src_file_name (void) const { return std::string (); } | ||||
// The name to show in the profiler (also used as map-key). | // The name to show in the profiler (also used as map-key). | |||
virtual std::string profiler_name (void) const { return name (); } | virtual std::string profiler_name (void) const { return name (); } | |||
virtual std::string parent_fcn_name (void) const { return std::string (); } | virtual std::string parent_fcn_name (void) const { return std::string (); } | |||
virtual symbol_table::scope_id parent_fcn_scope (void) const { return -1; } | virtual symbol_table::scope_id parent_fcn_scope (void) const { return -1; } | |||
virtual void mark_fcn_file_up_to_date (const octave_time&) { } | virtual void mark_fcn_file_up_to_date (const octave_time&) { } | |||
virtual symbol_table::scope_id scope (void) { return -1; } | virtual symbol_table::scope_id scope (void) { return -1; } | |||
virtual octave_time time_parsed (void) const | virtual octave_time time_parsed (void) const | |||
{ return octave_time (static_cast<time_t> (0)); } | { return octave_time (static_cast<time_t> (0)); } | |||
virtual octave_time time_checked (void) const | virtual octave_time time_checked (void) const | |||
{ return octave_time (static_cast<time_t> (0)); } | { return octave_time (static_cast<time_t> (0)); } | |||
virtual bool is_subfunction (void) const { return false; } | virtual bool is_subfunction (void) const { return false; } | |||
virtual bool is_class_constructor (const std::string& = std::string ()) c onst | virtual bool is_class_constructor (const std::string& = std::string ()) c onst | |||
{ return false; } | { return false; } | |||
virtual bool is_class_method (const std::string& = std::string ()) const | virtual bool is_class_method (const std::string& = std::string ()) const | |||
{ return false; } | { return false; } | |||
virtual bool takes_varargs (void) const { return false; } | virtual bool takes_varargs (void) const { return false; } | |||
virtual bool takes_var_return (void) const { return false; } | virtual bool takes_var_return (void) const { return false; } | |||
void stash_dispatch_class (const std::string& nm) { xdispatch_class = nm; } | void stash_dispatch_class (const std::string& nm) { xdispatch_class = nm; } | |||
std::string dispatch_class (void) const { return xdispatch_class; } | std::string dispatch_class (void) const { return xdispatch_class; } | |||
virtual void | virtual void | |||
mark_as_private_function (const std::string& cname = std::string ()) | mark_as_private_function (const std::string& cname = std::string ()) | |||
{ | { | |||
private_function = true; | private_function = true; | |||
xdispatch_class = cname; | xdispatch_class = cname; | |||
} | } | |||
bool is_private_function (void) const { return private_function; } | bool is_private_function (void) const { return private_function; } | |||
bool is_private_function_of_class (const std::string& nm) const | bool is_private_function_of_class (const std::string& nm) const | |||
{ return private_function && xdispatch_class == nm; } | { return private_function && xdispatch_class == nm; } | |||
virtual bool | virtual bool | |||
is_anonymous_function_of_class (const std::string& = std::string ()) cons t | is_anonymous_function_of_class (const std::string& = std::string ()) cons t | |||
{ return false; } | { return false; } | |||
std::string dir_name (void) const { return my_dir_name; } | std::string dir_name (void) const { return my_dir_name; } | |||
void stash_dir_name (const std::string& dir) { my_dir_name = dir; } | void stash_dir_name (const std::string& dir) { my_dir_name = dir; } | |||
void lock (void) | void lock (void) | |||
{ | { | |||
this->lock_subfunctions (); | this->lock_subfunctions (); | |||
locked = true; | locked = true; | |||
} | } | |||
skipping to change at line 135 | skipping to change at line 137 | |||
this->unlock_subfunctions (); | this->unlock_subfunctions (); | |||
locked = false; | locked = false; | |||
} | } | |||
bool islocked (void) const { return locked; } | bool islocked (void) const { return locked; } | |||
virtual void lock_subfunctions (void) { } | virtual void lock_subfunctions (void) { } | |||
virtual void unlock_subfunctions (void) { } | virtual void unlock_subfunctions (void) { } | |||
virtual void maybe_relocate_end (void) { } | ||||
// Not valid until after the function is completley parsed. | ||||
virtual bool has_subfunctions (void) const { return false; } | ||||
virtual void stash_subfunction_names (const std::list<std::string>&) { } | ||||
virtual std::list<std::string> subfunction_names (void) const | ||||
{ | ||||
return std::list<std::string> (); | ||||
} | ||||
void mark_relative (void) { relative = true; } | void mark_relative (void) { relative = true; } | |||
bool is_relative (void) const { return relative; } | bool is_relative (void) const { return relative; } | |||
std::string name (void) const { return my_name; } | std::string name (void) const { return my_name; } | |||
void document (const std::string& ds) { doc = ds; } | void document (const std::string& ds) { doc = ds; } | |||
std::string doc_string (void) const { return doc; } | std::string doc_string (void) const { return doc; } | |||
End of changes. 10 change blocks. | ||||
9 lines changed or deleted | 23 lines changed or added | |||
ov-float.h | ov-float.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_float_h) | #if !defined (octave_ov_float_h) | |||
#define octave_float_h 1 | #define octave_ov_float_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "lo-ieee.h" | #include "lo-ieee.h" | |||
#include "lo-mappers.h" | #include "lo-mappers.h" | |||
#include "lo-utils.h" | #include "lo-utils.h" | |||
#include "mx-base.h" | #include "mx-base.h" | |||
skipping to change at line 68 | skipping to change at line 68 | |||
: octave_base_scalar<float> (0.0) { } | : octave_base_scalar<float> (0.0) { } | |||
octave_float_scalar (float d) | octave_float_scalar (float d) | |||
: octave_base_scalar<float> (d) { } | : octave_base_scalar<float> (d) { } | |||
octave_float_scalar (const octave_float_scalar& s) | octave_float_scalar (const octave_float_scalar& s) | |||
: octave_base_scalar<float> (s) { } | : octave_base_scalar<float> (s) { } | |||
~octave_float_scalar (void) { } | ~octave_float_scalar (void) { } | |||
octave_base_value *clone (void) const { return new octave_float_scalar (* | octave_base_value *clone (void) const | |||
this); } | { return new octave_float_scalar (*this); } | |||
// We return an octave_matrix here instead of an octave_float_scalar so | // We return an octave_matrix here instead of an octave_float_scalar so | |||
// that in expressions like A(2,2,2) = 2 (for A previously | // that in expressions like A(2,2,2) = 2 (for A previously | |||
// undefined), A will be empty instead of a 1x1 object. | // undefined), A will be empty instead of a 1x1 object. | |||
octave_base_value *empty_clone (void) const { return new octave_float_mat | octave_base_value *empty_clone (void) const | |||
rix (); } | { return new octave_float_matrix (); } | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
idx_vector index_vector (void) const { return idx_vector (scalar); } | idx_vector index_vector (void) const { return idx_vector (scalar); } | |||
octave_value any (int = 0) const | octave_value any (int = 0) const | |||
{ return (scalar != 0 && ! lo_ieee_isnan (scalar)); } | { return (scalar != 0 && ! lo_ieee_isnan (scalar)); } | |||
builtin_type_t builtin_type (void) const { return btyp_float; } | builtin_type_t builtin_type (void) const { return btyp_float; } | |||
bool is_real_scalar (void) const { return true; } | bool is_real_scalar (void) const { return true; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
bool is_single_type (void) const { return true; } | bool is_single_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
int8NDArray | int8NDArray | |||
int8_array_value (void) const | int8_array_value (void) const | |||
{ return int8NDArray (dim_vector (1, 1), scalar); } | { return int8NDArray (dim_vector (1, 1), scalar); } | |||
int16NDArray | int16NDArray | |||
int16_array_value (void) const | int16_array_value (void) const | |||
{ return int16NDArray (dim_vector (1, 1), scalar); } | { return int16NDArray (dim_vector (1, 1), scalar); } | |||
int32NDArray | int32NDArray | |||
int32_array_value (void) const | int32_array_value (void) const | |||
{ return int32NDArray (dim_vector (1, 1), scalar); } | { return int32NDArray (dim_vector (1, 1), scalar); } | |||
int64NDArray | int64NDArray | |||
int64_array_value (void) const | int64_array_value (void) const | |||
{ return int64NDArray (dim_vector (1, 1), scalar); } | { return int64NDArray (dim_vector (1, 1), scalar); } | |||
uint8NDArray | uint8NDArray | |||
uint8_array_value (void) const | uint8_array_value (void) const | |||
{ return uint8NDArray (dim_vector (1, 1), scalar); } | { return uint8NDArray (dim_vector (1, 1), scalar); } | |||
uint16NDArray | uint16NDArray | |||
uint16_array_value (void) const | uint16_array_value (void) const | |||
{ return uint16NDArray (dim_vector (1, 1), scalar); } | { return uint16NDArray (dim_vector (1, 1), scalar); } | |||
uint32NDArray | uint32NDArray | |||
uint32_array_value (void) const | uint32_array_value (void) const | |||
{ return uint32NDArray (dim_vector (1, 1), scalar); } | { return uint32NDArray (dim_vector (1, 1), scalar); } | |||
uint64NDArray | uint64NDArray | |||
uint64_array_value (void) const | uint64_array_value (void) const | |||
{ return uint64NDArray (dim_vector (1, 1), scalar); } | { return uint64NDArray (dim_vector (1, 1), scalar); } | |||
#define DEFINE_INT_SCALAR_VALUE(TYPE) \ | #define DEFINE_INT_SCALAR_VALUE(TYPE) \ | |||
octave_ ## TYPE \ | octave_ ## TYPE \ | |||
TYPE ## _scalar_value (void) const \ | TYPE ## _scalar_value (void) const \ | |||
{ return octave_ ## TYPE (scalar); } | { return octave_ ## TYPE (scalar); } | |||
DEFINE_INT_SCALAR_VALUE (int8) | DEFINE_INT_SCALAR_VALUE (int8) | |||
DEFINE_INT_SCALAR_VALUE (int16) | DEFINE_INT_SCALAR_VALUE (int16) | |||
DEFINE_INT_SCALAR_VALUE (int32) | DEFINE_INT_SCALAR_VALUE (int32) | |||
DEFINE_INT_SCALAR_VALUE (int64) | DEFINE_INT_SCALAR_VALUE (int64) | |||
DEFINE_INT_SCALAR_VALUE (uint8) | DEFINE_INT_SCALAR_VALUE (uint8) | |||
DEFINE_INT_SCALAR_VALUE (uint16) | DEFINE_INT_SCALAR_VALUE (uint16) | |||
DEFINE_INT_SCALAR_VALUE (uint32) | DEFINE_INT_SCALAR_VALUE (uint32) | |||
DEFINE_INT_SCALAR_VALUE (uint64) | DEFINE_INT_SCALAR_VALUE (uint64) | |||
#undef DEFINE_INT_SCALAR_VALUE | #undef DEFINE_INT_SCALAR_VALUE | |||
double double_value (bool = false) const { return static_cast<double> (sc | double double_value (bool = false) const | |||
alar); } | { return static_cast<double> (scalar); } | |||
float float_value (bool = false) const { return scalar; } | float float_value (bool = false) const { return scalar; } | |||
double scalar_value (bool = false) const { return static_cast<double> (sc | double scalar_value (bool = false) const | |||
alar); } | { return static_cast<double> (scalar); } | |||
float float_scalar_value (bool = false) const { return scalar; } | float float_scalar_value (bool = false) const { return scalar; } | |||
Matrix matrix_value (bool = false) const | Matrix matrix_value (bool = false) const | |||
{ return Matrix (1, 1, scalar); } | { return Matrix (1, 1, scalar); } | |||
FloatMatrix float_matrix_value (bool = false) const | FloatMatrix float_matrix_value (bool = false) const | |||
{ return FloatMatrix (1, 1, scalar); } | { return FloatMatrix (1, 1, scalar); } | |||
NDArray array_value (bool = false) const | NDArray array_value (bool = false) const | |||
{ return NDArray (dim_vector (1, 1), scalar); } | { return NDArray (dim_vector (1, 1), scalar); } | |||
FloatNDArray float_array_value (bool = false) const | FloatNDArray float_array_value (bool = false) const | |||
{ return FloatNDArray (dim_vector (1, 1), scalar); } | { return FloatNDArray (dim_vector (1, 1), scalar); } | |||
SparseMatrix sparse_matrix_value (bool = false) const | SparseMatrix sparse_matrix_value (bool = false) const | |||
{ return SparseMatrix (Matrix (1, 1, scalar)); } | { return SparseMatrix (Matrix (1, 1, scalar)); } | |||
// FIXME Need SparseComplexMatrix (Matrix) constructor!!! | // FIXME Need SparseComplexMatrix (Matrix) constructor!!! | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |||
{ return SparseComplexMatrix (sparse_matrix_value ()); } | { return SparseComplexMatrix (sparse_matrix_value ()); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const; | octave_value resize (const dim_vector& dv, bool fill = false) const; | |||
Complex complex_value (bool = false) const { return scalar; } | Complex complex_value (bool = false) const { return scalar; } | |||
FloatComplex float_complex_value (bool = false) const { return scalar; } | FloatComplex float_complex_value (bool = false) const { return scalar; } | |||
ComplexMatrix complex_matrix_value (bool = false) const | ComplexMatrix complex_matrix_value (bool = false) const | |||
{ return ComplexMatrix (1, 1, Complex (scalar)); } | { return ComplexMatrix (1, 1, Complex (scalar)); } | |||
FloatComplexMatrix float_complex_matrix_value (bool = false) const | FloatComplexMatrix float_complex_matrix_value (bool = false) const | |||
{ return FloatComplexMatrix (1, 1, FloatComplex (scalar)); } | { return FloatComplexMatrix (1, 1, FloatComplex (scalar)); } | |||
ComplexNDArray complex_array_value (bool = false) const | ComplexNDArray complex_array_value (bool = false) const | |||
{ return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); } | { return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); } | |||
FloatComplexNDArray float_complex_array_value (bool = false) const | FloatComplexNDArray float_complex_array_value (bool = false) const | |||
{ return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)) ; } | { return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)); } | |||
charNDArray | charNDArray | |||
char_array_value (bool = false) const | char_array_value (bool = false) const | |||
{ | { | |||
charNDArray retval (dim_vector (1, 1)); | charNDArray retval (dim_vector (1, 1)); | |||
retval(0) = static_cast<char> (scalar); | retval(0) = static_cast<char> (scalar); | |||
return retval; | return retval; | |||
} | } | |||
bool bool_value (bool warn = false) const | bool bool_value (bool warn = false) const | |||
skipping to change at line 214 | skipping to change at line 218 | |||
boolNDArray bool_array_value (bool warn = false) const | boolNDArray bool_array_value (bool warn = false) const | |||
{ | { | |||
if (xisnan (scalar)) | if (xisnan (scalar)) | |||
gripe_nan_to_logical_conversion (); | gripe_nan_to_logical_conversion (); | |||
else if (warn && scalar != 0 && scalar != 1) | else if (warn && scalar != 0 && scalar != 1) | |||
gripe_logical_conversion (); | gripe_logical_conversion (); | |||
return boolNDArray (dim_vector (1, 1), scalar); | return boolNDArray (dim_vector (1, 1), scalar); | |||
} | } | |||
octave_value diag (octave_idx_type m, octave_idx_type n) const; | ||||
octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | |||
void increment (void) { ++scalar; } | void increment (void) { ++scalar; } | |||
void decrement (void) { --scalar; } | void decrement (void) { --scalar; } | |||
bool save_ascii (std::ostream& os); | bool save_ascii (std::ostream& os); | |||
bool load_ascii (std::istream& is); | bool load_ascii (std::istream& is); | |||
skipping to change at line 238 | skipping to change at line 244 | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ | { | |||
return os.write (array_value (), block_size, output_type, | return os.write (array_value (), block_size, output_type, | |||
skip, flt_fmt); | skip, flt_fmt); | |||
} | } | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
octave_value map (unary_mapper_t umap) const; | octave_value map (unary_mapper_t umap) const; | |||
bool fast_elem_insert_self (void *where, builtin_type_t btyp) const; | bool fast_elem_insert_self (void *where, builtin_type_t btyp) const; | |||
private: | private: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
End of changes. 27 change blocks. | ||||
34 lines changed or deleted | 36 lines changed or added | |||
ov-flt-complex.h | ov-flt-complex.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_float_complex_h) | #if !defined (octave_ov_flt_complex_h) | |||
#define octave_float_complex_h 1 | #define octave_ov_flt_complex_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "lo-ieee.h" | #include "lo-ieee.h" | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 66 | skipping to change at line 66 | |||
: octave_base_scalar<FloatComplex> () { } | : octave_base_scalar<FloatComplex> () { } | |||
octave_float_complex (const FloatComplex& c) | octave_float_complex (const FloatComplex& c) | |||
: octave_base_scalar<FloatComplex> (c) { } | : octave_base_scalar<FloatComplex> (c) { } | |||
octave_float_complex (const octave_float_complex& c) | octave_float_complex (const octave_float_complex& c) | |||
: octave_base_scalar<FloatComplex> (c) { } | : octave_base_scalar<FloatComplex> (c) { } | |||
~octave_float_complex (void) { } | ~octave_float_complex (void) { } | |||
octave_base_value *clone (void) const { return new octave_float_complex ( | octave_base_value *clone (void) const | |||
*this); } | { return new octave_float_complex (*this); } | |||
// We return an octave_float_complex_matrix object here instead of an | // We return an octave_float_complex_matrix object here instead of an | |||
// octave_float_complex object so that in expressions like A(2,2,2) = 2 | // octave_float_complex object so that in expressions like A(2,2,2) = 2 | |||
// (for A previously undefined), A will be empty instead of a 1x1 | // (for A previously undefined), A will be empty instead of a 1x1 | |||
// object. | // object. | |||
octave_base_value *empty_clone (void) const | octave_base_value *empty_clone (void) const | |||
{ return new octave_float_complex_matrix (); } | { return new octave_float_complex_matrix (); } | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
octave_value any (int = 0) const | octave_value any (int = 0) const | |||
{ | { | |||
return (scalar != FloatComplex (0, 0) | return (scalar != FloatComplex (0, 0) | |||
&& ! (lo_ieee_isnan (std::real (scalar)) | && ! (lo_ieee_isnan (std::real (scalar)) | |||
|| lo_ieee_isnan (std::imag (scalar)))); | || lo_ieee_isnan (std::imag (scalar)))); | |||
} | } | |||
builtin_type_t builtin_type (void) const { return btyp_float_complex; } | builtin_type_t builtin_type (void) const { return btyp_float_complex; } | |||
bool is_complex_scalar (void) const { return true; } | bool is_complex_scalar (void) const { return true; } | |||
bool is_complex_type (void) const { return true; } | bool is_complex_type (void) const { return true; } | |||
bool is_single_type (void) const { return true; } | bool is_single_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
float float_value (bool = false) const; | float float_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
float float_scalar_value (bool frc_str_conv = false) const | float float_scalar_value (bool frc_str_conv = false) const | |||
{ return float_value (frc_str_conv); } | { return float_value (frc_str_conv); } | |||
Matrix matrix_value (bool = false) const; | Matrix matrix_value (bool = false) const; | |||
FloatMatrix float_matrix_value (bool = false) const; | FloatMatrix float_matrix_value (bool = false) const; | |||
NDArray array_value (bool = false) const; | NDArray array_value (bool = false) const; | |||
FloatNDArray float_array_value (bool = false) const; | FloatNDArray float_array_value (bool = false) const; | |||
SparseMatrix sparse_matrix_value (bool = false) const | SparseMatrix sparse_matrix_value (bool = false) const | |||
{ return SparseMatrix (matrix_value ()); } | { return SparseMatrix (matrix_value ()); } | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |||
{ return SparseComplexMatrix (complex_matrix_value ()); } | { return SparseComplexMatrix (complex_matrix_value ()); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const; | octave_value resize (const dim_vector& dv, bool fill = false) const; | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
FloatComplex float_complex_value (bool = false) const; | FloatComplex float_complex_value (bool = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const; | ComplexMatrix complex_matrix_value (bool = false) const; | |||
FloatComplexMatrix float_complex_matrix_value (bool = false) const; | FloatComplexMatrix float_complex_matrix_value (bool = false) const; | |||
skipping to change at line 155 | skipping to change at line 156 | |||
boolNDArray bool_array_value (bool warn = false) const | boolNDArray bool_array_value (bool warn = false) const | |||
{ | { | |||
if (xisnan (scalar)) | if (xisnan (scalar)) | |||
gripe_nan_to_logical_conversion (); | gripe_nan_to_logical_conversion (); | |||
else if (warn && scalar != 0.0f && scalar != 1.0f) | else if (warn && scalar != 0.0f && scalar != 1.0f) | |||
gripe_logical_conversion (); | gripe_logical_conversion (); | |||
return boolNDArray (dim_vector (1, 1), scalar != 1.0f); | return boolNDArray (dim_vector (1, 1), scalar != 1.0f); | |||
} | } | |||
octave_value diag (octave_idx_type m, octave_idx_type n) const; | ||||
void increment (void) { scalar += 1.0; } | void increment (void) { scalar += 1.0; } | |||
void decrement (void) { scalar -= 1.0; } | void decrement (void) { scalar -= 1.0; } | |||
bool save_ascii (std::ostream& os); | bool save_ascii (std::ostream& os); | |||
bool load_ascii (std::istream& is); | bool load_ascii (std::istream& is); | |||
bool save_binary (std::ostream& os, bool& save_as_floats); | bool save_binary (std::ostream& os, bool& save_as_floats); | |||
skipping to change at line 177 | skipping to change at line 180 | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ | { | |||
// Yes, for compatibility, we drop the imaginary part here. | // Yes, for compatibility, we drop the imaginary part here. | |||
return os.write (array_value (true), block_size, output_type, | return os.write (array_value (true), block_size, output_type, | |||
skip, flt_fmt); | skip, flt_fmt); | |||
} | } | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
octave_value map (unary_mapper_t umap) const; | octave_value map (unary_mapper_t umap) const; | |||
private: | private: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |||
End of changes. 11 change blocks. | ||||
20 lines changed or deleted | 22 lines changed or added | |||
ov-flt-cx-diag.h | ov-flt-cx-diag.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_float_complex_diag_matrix_h) | #if !defined (octave_ov_flt_cx_diag_h) | |||
#define octave_float_complex_diag_matrix_h 1 | #define octave_ov_flt_cx_diag_h 1 | |||
#include "ov-base.h" | #include "ov-base.h" | |||
#include "ov-base-diag.h" | #include "ov-base-diag.h" | |||
#include "ov-flt-cx-mat.h" | #include "ov-flt-cx-mat.h" | |||
#include "ov-typeinfo.h" | #include "ov-typeinfo.h" | |||
// Real diagonal matrix values. | // Real diagonal matrix values. | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
skipping to change at line 51 | skipping to change at line 51 | |||
: octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> () { } | : octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> () { } | |||
octave_float_complex_diag_matrix (const FloatComplexDiagMatrix& m) | octave_float_complex_diag_matrix (const FloatComplexDiagMatrix& m) | |||
: octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> (m) { } | : octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> (m) { } | |||
octave_float_complex_diag_matrix (const octave_float_complex_diag_matrix& m) | octave_float_complex_diag_matrix (const octave_float_complex_diag_matrix& m) | |||
: octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> (m) { } | : octave_base_diag<FloatComplexDiagMatrix, FloatComplexMatrix> (m) { } | |||
~octave_float_complex_diag_matrix (void) { } | ~octave_float_complex_diag_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_float_complex_d | octave_base_value *clone (void) const | |||
iag_matrix (*this); } | { return new octave_float_complex_diag_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_float_com | octave_base_value *empty_clone (void) const | |||
plex_diag_matrix (); } | { return new octave_float_complex_diag_matrix (); } | |||
type_conv_info numeric_conversion_function (void) const; | type_conv_info numeric_conversion_function (void) const; | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
builtin_type_t builtin_type (void) const { return btyp_float_complex; } | builtin_type_t builtin_type (void) const { return btyp_float_complex; } | |||
bool is_complex_matrix (void) const { return true; } | bool is_complex_matrix (void) const { return true; } | |||
bool is_complex_type (void) const { return true; } | bool is_complex_type (void) const { return true; } | |||
bool is_double_type (void) const { return true; } | bool is_single_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
DiagMatrix diag_matrix_value (bool = false) const; | DiagMatrix diag_matrix_value (bool = false) const; | |||
FloatDiagMatrix float_diag_matrix_value (bool = false) const; | FloatDiagMatrix float_diag_matrix_value (bool = false) const; | |||
ComplexDiagMatrix complex_diag_matrix_value (bool = false) const; | ComplexDiagMatrix complex_diag_matrix_value (bool = false) const; | |||
FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) con st; | FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) con st; | |||
End of changes. 4 change blocks. | ||||
8 lines changed or deleted | 8 lines changed or added | |||
ov-flt-cx-mat.h | ov-flt-cx-mat.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_float_complex_matrix_h) | #if !defined (octave_ov_flt_cx_mat_h) | |||
#define octave_float_complex_matrix_h 1 | #define octave_ov_flt_cx_mat_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 85 | skipping to change at line 85 | |||
: octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (v)) { } | : octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (v)) { } | |||
octave_float_complex_matrix (const FloatComplexColumnVector& v) | octave_float_complex_matrix (const FloatComplexColumnVector& v) | |||
: octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (v)) { } | : octave_base_matrix<FloatComplexNDArray> (FloatComplexMatrix (v)) { } | |||
octave_float_complex_matrix (const octave_float_complex_matrix& cm) | octave_float_complex_matrix (const octave_float_complex_matrix& cm) | |||
: octave_base_matrix<FloatComplexNDArray> (cm) { } | : octave_base_matrix<FloatComplexNDArray> (cm) { } | |||
~octave_float_complex_matrix (void) { } | ~octave_float_complex_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_float_complex_m | octave_base_value *clone (void) const | |||
atrix (*this); } | { return new octave_float_complex_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_float_com | octave_base_value *empty_clone (void) const | |||
plex_matrix (); } | { return new octave_float_complex_matrix (); } | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
builtin_type_t builtin_type (void) const { return btyp_float_complex; } | builtin_type_t builtin_type (void) const { return btyp_float_complex; } | |||
bool is_complex_matrix (void) const { return true; } | bool is_complex_matrix (void) const { return true; } | |||
bool is_complex_type (void) const { return true; } | bool is_complex_type (void) const { return true; } | |||
bool is_single_type (void) const { return true; } | bool is_single_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
float float_value (bool = false) const; | float float_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
float float_scalar_value (bool frc_str_conv = false) const | float float_scalar_value (bool frc_str_conv = false) const | |||
{ return float_value (frc_str_conv); } | { return float_value (frc_str_conv); } | |||
Matrix matrix_value (bool = false) const; | Matrix matrix_value (bool = false) const; | |||
FloatMatrix float_matrix_value (bool = false) const; | FloatMatrix float_matrix_value (bool = false) const; | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
FloatComplex float_complex_value (bool = false) const; | FloatComplex float_complex_value (bool = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const; | ComplexMatrix complex_matrix_value (bool = false) const; | |||
skipping to change at line 136 | skipping to change at line 138 | |||
boolNDArray bool_array_value (bool warn = false) const; | boolNDArray bool_array_value (bool warn = false) const; | |||
charNDArray char_array_value (bool frc_str_conv = false) const; | charNDArray char_array_value (bool frc_str_conv = false) const; | |||
SparseMatrix sparse_matrix_value (bool = false) const; | SparseMatrix sparse_matrix_value (bool = false) const; | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; | |||
octave_value diag (octave_idx_type k = 0) const; | octave_value diag (octave_idx_type k = 0) const; | |||
octave_value diag (octave_idx_type m, octave_idx_type n) const; | ||||
void increment (void) { matrix += FloatComplex (1.0); } | void increment (void) { matrix += FloatComplex (1.0); } | |||
void decrement (void) { matrix -= FloatComplex (1.0); } | void decrement (void) { matrix -= FloatComplex (1.0); } | |||
void changesign (void) { matrix.changesign (); } | void changesign (void) { matrix.changesign (); } | |||
bool save_ascii (std::ostream& os); | bool save_ascii (std::ostream& os); | |||
bool load_ascii (std::istream& is); | bool load_ascii (std::istream& is); | |||
skipping to change at line 160 | skipping to change at line 164 | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ | { | |||
// Yes, for compatibility, we drop the imaginary part here. | // Yes, for compatibility, we drop the imaginary part here. | |||
return os.write (matrix_value (true), block_size, output_type, | return os.write (matrix_value (true), block_size, output_type, | |||
skip, flt_fmt); | skip, flt_fmt); | |||
} | } | |||
void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
octave_value map (unary_mapper_t umap) const; | octave_value map (unary_mapper_t umap) const; | |||
private: | private: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
End of changes. 7 change blocks. | ||||
14 lines changed or deleted | 16 lines changed or added | |||
ov-flt-re-diag.h | ov-flt-re-diag.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_float_diag_matrix_h) | #if !defined (octave_ov_flt_re_diag_h) | |||
#define octave_float_diag_matrix_h 1 | #define octave_ov_flt_re_diag_h 1 | |||
#include "ov-base.h" | #include "ov-base.h" | |||
#include "ov-base-diag.h" | #include "ov-base-diag.h" | |||
#include "ov-flt-re-mat.h" | #include "ov-flt-re-mat.h" | |||
#include "ov-typeinfo.h" | #include "ov-typeinfo.h" | |||
// Real diagonal matrix values. | // Real diagonal matrix values. | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
skipping to change at line 51 | skipping to change at line 51 | |||
: octave_base_diag<FloatDiagMatrix, FloatMatrix> () { } | : octave_base_diag<FloatDiagMatrix, FloatMatrix> () { } | |||
octave_float_diag_matrix (const FloatDiagMatrix& m) | octave_float_diag_matrix (const FloatDiagMatrix& m) | |||
: octave_base_diag<FloatDiagMatrix, FloatMatrix> (m) { } | : octave_base_diag<FloatDiagMatrix, FloatMatrix> (m) { } | |||
octave_float_diag_matrix (const octave_float_diag_matrix& m) | octave_float_diag_matrix (const octave_float_diag_matrix& m) | |||
: octave_base_diag<FloatDiagMatrix, FloatMatrix> (m) { } | : octave_base_diag<FloatDiagMatrix, FloatMatrix> (m) { } | |||
~octave_float_diag_matrix (void) { } | ~octave_float_diag_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_float_diag_matr | octave_base_value *clone (void) const | |||
ix (*this); } | { return new octave_float_diag_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_float_dia | octave_base_value *empty_clone (void) const | |||
g_matrix (); } | { return new octave_float_diag_matrix (); } | |||
type_conv_info numeric_conversion_function (void) const; | type_conv_info numeric_conversion_function (void) const; | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
builtin_type_t builtin_type (void) const { return btyp_float; } | builtin_type_t builtin_type (void) const { return btyp_float; } | |||
bool is_real_matrix (void) const { return true; } | bool is_real_matrix (void) const { return true; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
End of changes. 3 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
ov-flt-re-mat.h | ov-flt-re-mat.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_float_matrix_h) | #if !defined (octave_ov_flt_re_mat_h) | |||
#define octave_float_matrix_h 1 | #define octave_ov_flt_re_mat_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 85 | skipping to change at line 85 | |||
: octave_base_matrix<FloatNDArray> (FloatMatrix (v)) { } | : octave_base_matrix<FloatNDArray> (FloatMatrix (v)) { } | |||
octave_float_matrix (const FloatColumnVector& v) | octave_float_matrix (const FloatColumnVector& v) | |||
: octave_base_matrix<FloatNDArray> (FloatMatrix (v)) { } | : octave_base_matrix<FloatNDArray> (FloatMatrix (v)) { } | |||
octave_float_matrix (const octave_float_matrix& m) | octave_float_matrix (const octave_float_matrix& m) | |||
: octave_base_matrix<FloatNDArray> (m) { } | : octave_base_matrix<FloatNDArray> (m) { } | |||
~octave_float_matrix (void) { } | ~octave_float_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_float_matrix (* | octave_base_value *clone (void) const | |||
this); } | { return new octave_float_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_float_mat | octave_base_value *empty_clone (void) const | |||
rix (); } | { return new octave_float_matrix (); } | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
idx_vector index_vector (void) const | idx_vector index_vector (void) const | |||
{ return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); } | { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); } | |||
builtin_type_t builtin_type (void) const { return btyp_float; } | builtin_type_t builtin_type (void) const { return btyp_float; } | |||
bool is_real_matrix (void) const { return true; } | bool is_real_matrix (void) const { return true; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
bool is_single_type (void) const { return true; } | bool is_single_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
skipping to change at line 132 | skipping to change at line 134 | |||
uint32_array_value (void) const { return uint32NDArray (matrix); } | uint32_array_value (void) const { return uint32NDArray (matrix); } | |||
uint64NDArray | uint64NDArray | |||
uint64_array_value (void) const { return uint64NDArray (matrix); } | uint64_array_value (void) const { return uint64NDArray (matrix); } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
float float_value (bool = false) const; | float float_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
float float_scalar_value (bool frc_str_conv = false) const | float float_scalar_value (bool frc_str_conv = false) const | |||
{ return float_value (frc_str_conv); } | { return float_value (frc_str_conv); } | |||
Matrix matrix_value (bool = false) const; | Matrix matrix_value (bool = false) const; | |||
FloatMatrix float_matrix_value (bool = false) const; | FloatMatrix float_matrix_value (bool = false) const; | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
FloatComplex float_complex_value (bool = false) const; | FloatComplex float_complex_value (bool = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const; | ComplexMatrix complex_matrix_value (bool = false) const; | |||
skipping to change at line 167 | skipping to change at line 169 | |||
NDArray array_value (bool = false) const; | NDArray array_value (bool = false) const; | |||
FloatNDArray float_array_value (bool = false) const { return matrix; } | FloatNDArray float_array_value (bool = false) const { return matrix; } | |||
SparseMatrix sparse_matrix_value (bool = false) const; | SparseMatrix sparse_matrix_value (bool = false) const; | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; | |||
octave_value diag (octave_idx_type k = 0) const; | octave_value diag (octave_idx_type k = 0) const; | |||
octave_value diag (octave_idx_type m, octave_idx_type n) const; | ||||
// Use matrix_ref here to clear index cache. | // Use matrix_ref here to clear index cache. | |||
void increment (void) { matrix_ref () += 1.0; } | void increment (void) { matrix_ref () += 1.0; } | |||
void decrement (void) { matrix_ref () -= 1.0; } | void decrement (void) { matrix_ref () -= 1.0; } | |||
void changesign (void) { matrix_ref ().changesign (); } | void changesign (void) { matrix_ref ().changesign (); } | |||
octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | |||
void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
skipping to change at line 196 | skipping to change at line 200 | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ return os.write (matrix, block_size, output_type, skip, flt_fmt); } | { return os.write (matrix, block_size, output_type, skip, flt_fmt); } | |||
// Unsafe. This function exists to support the MEX interface. | // Unsafe. This function exists to support the MEX interface. | |||
// You should not use it anywhere else. | // You should not use it anywhere else. | |||
void *mex_get_data (void) const { return matrix.mex_get_data (); } | void *mex_get_data (void) const { return matrix.mex_get_data (); } | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
octave_value map (unary_mapper_t umap) const; | octave_value map (unary_mapper_t umap) const; | |||
private: | private: | |||
End of changes. 8 change blocks. | ||||
11 lines changed or deleted | 13 lines changed or added | |||
ov-int-traits.h | ov-int-traits.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_value_int_traits_h) | #if !defined (octave_ov_int_traits_h) | |||
#define octave_value_int_traits_h 1 | #define octave_ov_int_traits_h 1 | |||
#include "ov-int8.h" | #include "ov-int8.h" | |||
#include "ov-int16.h" | #include "ov-int16.h" | |||
#include "ov-int32.h" | #include "ov-int32.h" | |||
#include "ov-int64.h" | #include "ov-int64.h" | |||
#include "ov-uint8.h" | #include "ov-uint8.h" | |||
#include "ov-uint16.h" | #include "ov-uint16.h" | |||
#include "ov-uint32.h" | #include "ov-uint32.h" | |||
#include "ov-uint64.h" | #include "ov-uint64.h" | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ov-int16.h | ov-int16.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_int16_h) | #if !defined (octave_ov_int16_h) | |||
#define octave_int16_h 1 | #define octave_ov_int16_h 1 | |||
#define OCTAVE_INT_T octave_int16 | #define OCTAVE_INT_T octave_int16 | |||
#define OCTAVE_VALUE_INT_MATRIX_T octave_int16_matrix | #define OCTAVE_VALUE_INT_MATRIX_T octave_int16_matrix | |||
#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int16_array_value | #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int16_array_value | |||
#define OCTAVE_VALUE_INT_SCALAR_T octave_int16_scalar | #define OCTAVE_VALUE_INT_SCALAR_T octave_int16_scalar | |||
#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int16_scalar_value | #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int16_scalar_value | |||
#define OCTAVE_TYPE_PREDICATE_FUNCTION is_int16_type | #define OCTAVE_TYPE_PREDICATE_FUNCTION is_int16_type | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ov-int32.h | ov-int32.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_int32_h) | #if !defined (octave_ov_int32_h) | |||
#define octave_int32_h 1 | #define octave_ov_int32_h 1 | |||
#define OCTAVE_INT_T octave_int32 | #define OCTAVE_INT_T octave_int32 | |||
#define OCTAVE_VALUE_INT_MATRIX_T octave_int32_matrix | #define OCTAVE_VALUE_INT_MATRIX_T octave_int32_matrix | |||
#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int32_array_value | #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int32_array_value | |||
#define OCTAVE_VALUE_INT_SCALAR_T octave_int32_scalar | #define OCTAVE_VALUE_INT_SCALAR_T octave_int32_scalar | |||
#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int32_scalar_value | #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int32_scalar_value | |||
#define OCTAVE_TYPE_PREDICATE_FUNCTION is_int32_type | #define OCTAVE_TYPE_PREDICATE_FUNCTION is_int32_type | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ov-int64.h | ov-int64.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_int64_h) | #if !defined (octave_ov_int64_h) | |||
#define octave_int64_h 1 | #define octave_ov_int64_h 1 | |||
#define OCTAVE_INT_T octave_int64 | #define OCTAVE_INT_T octave_int64 | |||
#define OCTAVE_VALUE_INT_MATRIX_T octave_int64_matrix | #define OCTAVE_VALUE_INT_MATRIX_T octave_int64_matrix | |||
#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int64_array_value | #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int64_array_value | |||
#define OCTAVE_VALUE_INT_SCALAR_T octave_int64_scalar | #define OCTAVE_VALUE_INT_SCALAR_T octave_int64_scalar | |||
#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int64_scalar_value | #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int64_scalar_value | |||
#define OCTAVE_TYPE_PREDICATE_FUNCTION is_int64_type | #define OCTAVE_TYPE_PREDICATE_FUNCTION is_int64_type | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ov-int8.h | ov-int8.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_int8_h) | #if !defined (octave_ov_int8_h) | |||
#define octave_int8_h 1 | #define octave_ov_int8_h 1 | |||
#define OCTAVE_INT_T octave_int8 | #define OCTAVE_INT_T octave_int8 | |||
#define OCTAVE_VALUE_INT_MATRIX_T octave_int8_matrix | #define OCTAVE_VALUE_INT_MATRIX_T octave_int8_matrix | |||
#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int8_array_value | #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION int8_array_value | |||
#define OCTAVE_VALUE_INT_SCALAR_T octave_int8_scalar | #define OCTAVE_VALUE_INT_SCALAR_T octave_int8_scalar | |||
#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int8_scalar_value | #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION int8_scalar_value | |||
#define OCTAVE_TYPE_PREDICATE_FUNCTION is_int8_type | #define OCTAVE_TYPE_PREDICATE_FUNCTION is_int8_type | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ov-intx.h | ov-intx.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
Copyright (C) 2010 VZLU Prague | Copyright (C) 2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 34 | skipping to change at line 34 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "error.h" | #include "error.h" | |||
#include "mxarray.h" | ||||
#include "oct-stream.h" | #include "oct-stream.h" | |||
#include "ov-base.h" | #include "ov-base.h" | |||
#include "ov-base-int.h" | #include "ov-base-int.h" | |||
#include "ov-typeinfo.h" | #include "ov-typeinfo.h" | |||
#include "gripes.h" | #include "gripes.h" | |||
#include "ov-re-mat.h" | #include "ov-re-mat.h" | |||
#include "ov-scalar.h" | #include "ov-scalar.h" | |||
class | class | |||
skipping to change at line 63 | skipping to change at line 64 | |||
OCTAVE_VALUE_INT_MATRIX_T (const intNDArray<OCTAVE_INT_T>& nda) | OCTAVE_VALUE_INT_MATRIX_T (const intNDArray<OCTAVE_INT_T>& nda) | |||
: octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > (nda) { } | : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > (nda) { } | |||
OCTAVE_VALUE_INT_MATRIX_T (const Array<OCTAVE_INT_T>& nda) | OCTAVE_VALUE_INT_MATRIX_T (const Array<OCTAVE_INT_T>& nda) | |||
: octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > | : octave_base_int_matrix<intNDArray<OCTAVE_INT_T> > | |||
(intNDArray<OCTAVE_INT_T> (nda)) { } | (intNDArray<OCTAVE_INT_T> (nda)) { } | |||
~OCTAVE_VALUE_INT_MATRIX_T (void) { } | ~OCTAVE_VALUE_INT_MATRIX_T (void) { } | |||
octave_base_value *clone (void) const | octave_base_value *clone (void) const | |||
{ return new OCTAVE_VALUE_INT_MATRIX_T (*this); } | { return new OCTAVE_VALUE_INT_MATRIX_T (*this); } | |||
octave_base_value *empty_clone (void) const | octave_base_value *empty_clone (void) const | |||
{ return new OCTAVE_VALUE_INT_MATRIX_T (); } | { return new OCTAVE_VALUE_INT_MATRIX_T (); } | |||
bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; } | bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; } | |||
bool is_integer_type (void) const { return true; } | bool is_integer_type (void) const { return true; } | |||
builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; } | builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; } | |||
public: | public: | |||
int8NDArray | int8NDArray | |||
skipping to change at line 102 | skipping to change at line 103 | |||
uint16_array_value (void) const { return uint16NDArray (matrix); } | uint16_array_value (void) const { return uint16NDArray (matrix); } | |||
uint32NDArray | uint32NDArray | |||
uint32_array_value (void) const { return uint32NDArray (matrix); } | uint32_array_value (void) const { return uint32NDArray (matrix); } | |||
uint64NDArray | uint64NDArray | |||
uint64_array_value (void) const { return uint64NDArray (matrix); } | uint64_array_value (void) const { return uint64NDArray (matrix); } | |||
double | double | |||
double_value (bool = false) const | double_value (bool = false) const | |||
{ | { | |||
double retval = lo_ieee_nan_value (); | double retval = lo_ieee_nan_value (); | |||
if (numel () > 0) | ||||
{ | ||||
gripe_implicit_conversion ("Octave:array-as-scalar", | ||||
type_name (), "real scalar"); | ||||
retval = matrix(0).double_value (); | if (numel () > 0) | |||
} | { | |||
else | gripe_implicit_conversion ("Octave:array-to-scalar", | |||
gripe_invalid_conversion (type_name (), "real scalar"); | type_name (), "real scalar"); | |||
retval = matrix(0).double_value (); | ||||
} | ||||
else | ||||
gripe_invalid_conversion (type_name (), "real scalar"); | ||||
return retval; | return retval; | |||
} | } | |||
float | float | |||
float_value (bool = false) const | float_value (bool = false) const | |||
{ | { | |||
float retval = lo_ieee_float_nan_value (); | float retval = lo_ieee_float_nan_value (); | |||
if (numel () > 0) | ||||
{ | ||||
gripe_implicit_conversion ("Octave:array-as-scalar", | ||||
type_name (), "real scalar"); | ||||
retval = matrix(0).float_value (); | if (numel () > 0) | |||
} | { | |||
else | gripe_implicit_conversion ("Octave:array-to-scalar", | |||
gripe_invalid_conversion (type_name (), "real scalar"); | type_name (), "real scalar"); | |||
retval = matrix(0).float_value (); | ||||
} | ||||
else | ||||
gripe_invalid_conversion (type_name (), "real scalar"); | ||||
return retval; | return retval; | |||
} | } | |||
double scalar_value (bool = false) const { return double_value (); } | double scalar_value (bool = false) const { return double_value (); } | |||
float float_scalar_value (bool = false) const { return float_value (); } | float float_scalar_value (bool = false) const { return float_value (); } | |||
Matrix | Matrix | |||
matrix_value (bool = false) const | matrix_value (bool = false) const | |||
{ | { | |||
Matrix retval; | Matrix retval; | |||
dim_vector dv = dims (); | dim_vector dv = dims (); | |||
if (dv.length () > 2) | if (dv.length () > 2) | |||
error ("invalid conversion of %s to Matrix", type_name().c_str ()); | error ("invalid conversion of %s to Matrix", type_name ().c_str ()); | |||
else | else | |||
{ | { | |||
retval = Matrix (dv(0), dv(1)); | retval = Matrix (dv(0), dv(1)); | |||
double *vec = retval.fortran_vec (); | double *vec = retval.fortran_vec (); | |||
octave_idx_type nel = matrix.numel (); | octave_idx_type nel = matrix.numel (); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
vec[i] = matrix(i).double_value (); | vec[i] = matrix(i).double_value (); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
FloatMatrix | FloatMatrix | |||
float_matrix_value (bool = false) const | float_matrix_value (bool = false) const | |||
{ | { | |||
FloatMatrix retval; | FloatMatrix retval; | |||
dim_vector dv = dims (); | dim_vector dv = dims (); | |||
if (dv.length () > 2) | if (dv.length () > 2) | |||
error ("invalid conversion of %s to FloatMatrix", type_name().c_str | error ("invalid conversion of %s to FloatMatrix", type_name ().c_str | |||
()); | ()); | |||
else | else | |||
{ | { | |||
retval = FloatMatrix (dv(0), dv(1)); | retval = FloatMatrix (dv(0), dv(1)); | |||
float *vec = retval.fortran_vec (); | float *vec = retval.fortran_vec (); | |||
octave_idx_type nel = matrix.numel (); | octave_idx_type nel = matrix.numel (); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
vec[i] = matrix(i).float_value (); | vec[i] = matrix(i).float_value (); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
ComplexMatrix | ComplexMatrix | |||
complex_matrix_value (bool = false) const | complex_matrix_value (bool = false) const | |||
{ | { | |||
ComplexMatrix retval; | ComplexMatrix retval; | |||
dim_vector dv = dims(); | dim_vector dv = dims (); | |||
if (dv.length () > 2) | if (dv.length () > 2) | |||
error ("invalid conversion of %s to Matrix", type_name().c_str ()); | error ("invalid conversion of %s to Matrix", type_name ().c_str ()); | |||
else | else | |||
{ | { | |||
retval = ComplexMatrix (dv(0), dv(1)); | retval = ComplexMatrix (dv(0), dv(1)); | |||
Complex *vec = retval.fortran_vec (); | Complex *vec = retval.fortran_vec (); | |||
octave_idx_type nel = matrix.numel (); | octave_idx_type nel = matrix.numel (); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
vec[i] = Complex (matrix(i).double_value ()); | vec[i] = Complex (matrix(i).double_value ()); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
FloatComplexMatrix | FloatComplexMatrix | |||
float_complex_matrix_value (bool = false) const | float_complex_matrix_value (bool = false) const | |||
{ | { | |||
FloatComplexMatrix retval; | FloatComplexMatrix retval; | |||
dim_vector dv = dims(); | dim_vector dv = dims (); | |||
if (dv.length () > 2) | if (dv.length () > 2) | |||
error ("invalid conversion of %s to FloatMatrix", type_name().c_str | error ("invalid conversion of %s to FloatMatrix", type_name ().c_str | |||
()); | ()); | |||
else | else | |||
{ | { | |||
retval = FloatComplexMatrix (dv(0), dv(1)); | retval = FloatComplexMatrix (dv(0), dv(1)); | |||
FloatComplex *vec = retval.fortran_vec (); | FloatComplex *vec = retval.fortran_vec (); | |||
octave_idx_type nel = matrix.numel (); | octave_idx_type nel = matrix.numel (); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
vec[i] = FloatComplex (matrix(i).float_value ()); | vec[i] = FloatComplex (matrix(i).float_value ()); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
NDArray | NDArray | |||
array_value (bool = false) const | array_value (bool = false) const | |||
{ | { | |||
NDArray retval (matrix.dims ()); | NDArray retval (matrix.dims ()); | |||
double *vec = retval.fortran_vec (); | double *vec = retval.fortran_vec (); | |||
octave_idx_type nel = matrix.numel (); | octave_idx_type nel = matrix.numel (); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
vec[i] = matrix(i).double_value (); | vec[i] = matrix(i).double_value (); | |||
return retval; | return retval; | |||
} | } | |||
FloatNDArray | FloatNDArray | |||
float_array_value (bool = false) const | float_array_value (bool = false) const | |||
{ | { | |||
FloatNDArray retval (matrix.dims ()); | FloatNDArray retval (matrix.dims ()); | |||
float *vec = retval.fortran_vec (); | float *vec = retval.fortran_vec (); | |||
octave_idx_type nel = matrix.numel (); | octave_idx_type nel = matrix.numel (); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
vec[i] = matrix(i).float_value (); | vec[i] = matrix(i).float_value (); | |||
return retval; | return retval; | |||
} | } | |||
ComplexNDArray | ComplexNDArray | |||
complex_array_value (bool = false) const | complex_array_value (bool = false) const | |||
{ | { | |||
ComplexNDArray retval (matrix.dims ()); | ComplexNDArray retval (matrix.dims ()); | |||
Complex *vec = retval.fortran_vec (); | Complex *vec = retval.fortran_vec (); | |||
octave_idx_type nel = matrix.numel (); | octave_idx_type nel = matrix.numel (); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
vec[i] = Complex (matrix(i).double_value ()); | vec[i] = Complex (matrix(i).double_value ()); | |||
return retval; | return retval; | |||
} | } | |||
FloatComplexNDArray | FloatComplexNDArray | |||
float_complex_array_value (bool = false) const | float_complex_array_value (bool = false) const | |||
{ | { | |||
FloatComplexNDArray retval (matrix.dims ()); | FloatComplexNDArray retval (matrix.dims ()); | |||
FloatComplex *vec = retval.fortran_vec (); | FloatComplex *vec = retval.fortran_vec (); | |||
octave_idx_type nel = matrix.numel (); | octave_idx_type nel = matrix.numel (); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
vec[i] = FloatComplex (matrix(i).float_value ()); | vec[i] = FloatComplex (matrix(i).float_value ()); | |||
return retval; | return retval; | |||
} | } | |||
boolNDArray | boolNDArray | |||
bool_array_value (bool warn = false) const | bool_array_value (bool warn = false) const | |||
{ | { | |||
boolNDArray retval (dims ()); | boolNDArray retval (dims ()); | |||
octave_idx_type nel = numel (); | octave_idx_type nel = numel (); | |||
if (warn && matrix.any_element_not_one_or_zero ()) | if (warn && matrix.any_element_not_one_or_zero ()) | |||
gripe_logical_conversion (); | gripe_logical_conversion (); | |||
skipping to change at line 291 | skipping to change at line 292 | |||
char *vec = retval.fortran_vec (); | char *vec = retval.fortran_vec (); | |||
for (octave_idx_type i = 0; i < nel; i++) | for (octave_idx_type i = 0; i < nel; i++) | |||
vec[i] = matrix(i).char_value (); | vec[i] = matrix(i).char_value (); | |||
return retval; | return retval; | |||
} | } | |||
// Use matrix_ref here to clear index cache. | // Use matrix_ref here to clear index cache. | |||
void increment (void) | void increment (void) | |||
{ | { | |||
matrix_ref() += OCTAVE_INT_T (1); | matrix_ref () += OCTAVE_INT_T (1); | |||
} | } | |||
void decrement (void) | void decrement (void) | |||
{ | { | |||
matrix_ref() -= OCTAVE_INT_T (1); | matrix_ref () -= OCTAVE_INT_T (1); | |||
} | } | |||
void changesign (void) | void changesign (void) | |||
{ | { | |||
matrix_ref ().changesign (); | matrix_ref ().changesign (); | |||
} | } | |||
idx_vector index_vector (void) const | idx_vector index_vector (void) const | |||
{ return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); } | { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); } | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ return os.write (matrix, block_size, output_type, skip, flt_fmt); } | { return os.write (matrix, block_size, output_type, skip, flt_fmt); } | |||
// Unsafe. This function exists to support the MEX interface. | // Unsafe. This function exists to support the MEX interface. | |||
// You should not use it anywhere else. | // You should not use it anywhere else. | |||
void *mex_get_data (void) const { return matrix.mex_get_data (); } | void *mex_get_data (void) const { return matrix.mex_get_data (); } | |||
mxArray *as_mxArray (void) const | mxArray *as_mxArray (void) const | |||
{ | { | |||
mxArray *retval = new mxArray (OCTAVE_INT_MX_CLASS, dims (), mxREAL); | mxArray *retval = new mxArray (OCTAVE_INT_MX_CLASS, dims (), mxREAL); | |||
OCTAVE_INT_T::val_type *pr = static_cast<OCTAVE_INT_T::val_type *> (ret | OCTAVE_INT_T::val_type *pr = static_cast<OCTAVE_INT_T::val_type *> | |||
val->get_data ()); | (retval->get_data ()); | |||
mwSize nel = numel (); | mwSize nel = numel (); | |||
const OCTAVE_INT_T *p = matrix.data (); | const OCTAVE_INT_T *p = matrix.data (); | |||
for (mwIndex i = 0; i < nel; i++) | for (mwIndex i = 0; i < nel; i++) | |||
pr[i] = p[i].value (); | pr[i] = p[i].value (); | |||
return retval; | return retval; | |||
} | } | |||
octave_value map (unary_mapper_t umap) const | octave_value map (unary_mapper_t umap) const | |||
{ | { | |||
switch (umap) | switch (umap) | |||
{ | ||||
case umap_abs: | ||||
return matrix.abs (); | ||||
case umap_signum: | ||||
return matrix.signum (); | ||||
case umap_ceil: | ||||
case umap_conj: | ||||
case umap_fix: | ||||
case umap_floor: | ||||
case umap_real: | ||||
case umap_round: | ||||
return matrix; | ||||
case umap_imag: | ||||
return intNDArray<OCTAVE_INT_T> (matrix.dims (), OCTAVE_INT_T ()); | ||||
case umap_isnan: | ||||
case umap_isna: | ||||
case umap_isinf: | ||||
return boolNDArray (matrix.dims (), false); | ||||
case umap_finite: | ||||
return boolNDArray (matrix.dims (), true); | ||||
default: | ||||
{ | { | |||
case umap_abs: | octave_matrix m (array_value ()); | |||
return matrix.abs (); | return m.map (umap); | |||
case umap_signum: | ||||
return matrix.signum (); | ||||
case umap_ceil: | ||||
case umap_conj: | ||||
case umap_fix: | ||||
case umap_floor: | ||||
case umap_real: | ||||
case umap_round: | ||||
return matrix; | ||||
case umap_imag: | ||||
return intNDArray<OCTAVE_INT_T> (matrix.dims (), OCTAVE_INT_T ()) | ||||
; | ||||
case umap_isnan: | ||||
case umap_isna: | ||||
case umap_isinf: | ||||
return boolNDArray (matrix.dims (), false); | ||||
case umap_finite: | ||||
return boolNDArray (matrix.dims (), true); | ||||
default: | ||||
{ | ||||
octave_matrix m (array_value ()); | ||||
return m.map (umap); | ||||
} | ||||
} | } | |||
} | } | |||
} | ||||
private: | private: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |||
}; | }; | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
skipping to change at line 388 | skipping to change at line 390 | |||
OCTAVE_VALUE_INT_SCALAR_T (void) | OCTAVE_VALUE_INT_SCALAR_T (void) | |||
: octave_base_int_scalar<OCTAVE_INT_T> () { } | : octave_base_int_scalar<OCTAVE_INT_T> () { } | |||
OCTAVE_VALUE_INT_SCALAR_T (const OCTAVE_INT_T& nda) | OCTAVE_VALUE_INT_SCALAR_T (const OCTAVE_INT_T& nda) | |||
: octave_base_int_scalar<OCTAVE_INT_T> (nda) { } | : octave_base_int_scalar<OCTAVE_INT_T> (nda) { } | |||
~OCTAVE_VALUE_INT_SCALAR_T (void) { } | ~OCTAVE_VALUE_INT_SCALAR_T (void) { } | |||
octave_base_value *clone (void) const | octave_base_value *clone (void) const | |||
{ return new OCTAVE_VALUE_INT_SCALAR_T (*this); } | { return new OCTAVE_VALUE_INT_SCALAR_T (*this); } | |||
octave_base_value *empty_clone (void) const | octave_base_value *empty_clone (void) const | |||
{ return new OCTAVE_VALUE_INT_MATRIX_T (); } | { return new OCTAVE_VALUE_INT_MATRIX_T (); } | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false) | bool resize_ok = false) | |||
{ | { | |||
// FIXME -- this doesn't solve the problem of | // FIXME: this doesn't solve the problem of | |||
// | // | |||
// a = 1; a([1,1], [1,1], [1,1]) | // a = 1; a([1,1], [1,1], [1,1]) | |||
// | // | |||
// and similar constructions. Hmm... | // and similar constructions. Hmm... | |||
// FIXME -- using this constructor avoids narrowing the | // FIXME: using this constructor avoids narrowing the | |||
// 1x1 matrix back to a scalar value. Need a better solution | // 1x1 matrix back to a scalar value. Need a better solution | |||
// to this problem. | // to this problem. | |||
octave_value tmp | octave_value tmp | |||
(new OCTAVE_VALUE_INT_MATRIX_T | (new OCTAVE_VALUE_INT_MATRIX_T | |||
(OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION ())); | (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION ())); | |||
return tmp.do_index_op (idx, resize_ok); | return tmp.do_index_op (idx, resize_ok); | |||
} | } | |||
bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; } | bool OCTAVE_TYPE_PREDICATE_FUNCTION (void) const { return true; } | |||
bool is_integer_type (void) const { return true; } | bool is_integer_type (void) const { return true; } | |||
builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; } | builtin_type_t builtin_type (void) const { return OCTAVE_INT_BTYP; } | |||
public: | public: | |||
octave_int8 | octave_int8 | |||
skipping to change at line 447 | skipping to change at line 449 | |||
uint16_scalar_value (void) const { return octave_uint16 (scalar); } | uint16_scalar_value (void) const { return octave_uint16 (scalar); } | |||
octave_uint32 | octave_uint32 | |||
uint32_scalar_value (void) const { return octave_uint32 (scalar); } | uint32_scalar_value (void) const { return octave_uint32 (scalar); } | |||
octave_uint64 | octave_uint64 | |||
uint64_scalar_value (void) const { return octave_uint64 (scalar); } | uint64_scalar_value (void) const { return octave_uint64 (scalar); } | |||
int8NDArray | int8NDArray | |||
int8_array_value (void) const | int8_array_value (void) const | |||
{ return int8NDArray (dim_vector (1, 1), int8_scalar_value ()); } | { return int8NDArray (dim_vector (1, 1), int8_scalar_value ()); } | |||
int16NDArray | int16NDArray | |||
int16_array_value (void) const | int16_array_value (void) const | |||
{ return int16NDArray (dim_vector (1, 1), int16_scalar_value ()); } | { return int16NDArray (dim_vector (1, 1), int16_scalar_value ()); } | |||
int32NDArray | int32NDArray | |||
int32_array_value (void) const | int32_array_value (void) const | |||
{ return int32NDArray (dim_vector (1, 1), int32_scalar_value ()); } | { return int32NDArray (dim_vector (1, 1), int32_scalar_value ()); } | |||
int64NDArray | int64NDArray | |||
int64_array_value (void) const | int64_array_value (void) const | |||
{ return int64NDArray (dim_vector (1, 1), int64_scalar_value ()); } | { return int64NDArray (dim_vector (1, 1), int64_scalar_value ()); } | |||
uint8NDArray | uint8NDArray | |||
uint8_array_value (void) const | uint8_array_value (void) const | |||
{ return uint8NDArray (dim_vector (1, 1), uint8_scalar_value ()); } | { return uint8NDArray (dim_vector (1, 1), uint8_scalar_value ()); } | |||
uint16NDArray | uint16NDArray | |||
uint16_array_value (void) const | uint16_array_value (void) const | |||
{ return uint16NDArray (dim_vector (1, 1), uint16_scalar_value ()); } | { return uint16NDArray (dim_vector (1, 1), uint16_scalar_value ()); } | |||
uint32NDArray | uint32NDArray | |||
uint32_array_value (void) const | uint32_array_value (void) const | |||
{ return uint32NDArray (dim_vector (1, 1), uint32_scalar_value ()); } | { return uint32NDArray (dim_vector (1, 1), uint32_scalar_value ()); } | |||
uint64NDArray | uint64NDArray | |||
uint64_array_value (void) const | uint64_array_value (void) const | |||
{ return uint64NDArray (dim_vector (1, 1), uint64_scalar_value ()); } | { return uint64NDArray (dim_vector (1, 1), uint64_scalar_value ()); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const | octave_value resize (const dim_vector& dv, bool fill = false) const | |||
{ | { | |||
if (fill) | if (fill) | |||
{ | { | |||
intNDArray<OCTAVE_INT_T> retval (dv, 0); | intNDArray<OCTAVE_INT_T> retval (dv, 0); | |||
if (dv.numel()) | if (dv.numel ()) | |||
retval(0) = scalar; | retval(0) = scalar; | |||
return retval; | return retval; | |||
} | } | |||
else | else | |||
{ | { | |||
intNDArray<OCTAVE_INT_T> retval (dv); | intNDArray<OCTAVE_INT_T> retval (dv); | |||
if (dv.numel()) | if (dv.numel ()) | |||
retval(0) = scalar; | retval(0) = scalar; | |||
return retval; | return retval; | |||
} | } | |||
} | } | |||
double double_value (bool = false) const { return scalar.double_value (); } | double double_value (bool = false) const { return scalar.double_value (); } | |||
float float_value (bool = false) const { return scalar.float_value (); } | float float_value (bool = false) const { return scalar.float_value (); } | |||
double scalar_value (bool = false) const { return scalar.double_value (); } | double scalar_value (bool = false) const { return scalar.double_value (); } | |||
float float_scalar_value (bool = false) const { return scalar.float_value | float float_scalar_value (bool = false) const | |||
(); } | { return scalar.float_value (); } | |||
Matrix | Matrix | |||
matrix_value (bool = false) const | matrix_value (bool = false) const | |||
{ | { | |||
Matrix retval (1, 1); | Matrix retval (1, 1); | |||
retval(0,0) = scalar.double_value (); | retval(0,0) = scalar.double_value (); | |||
return retval; | return retval; | |||
} | } | |||
FloatMatrix | FloatMatrix | |||
float_matrix_value (bool = false) const | float_matrix_value (bool = false) const | |||
{ | { | |||
FloatMatrix retval (1, 1); | FloatMatrix retval (1, 1); | |||
retval(0,0) = scalar.float_value (); | retval(0,0) = scalar.float_value (); | |||
return retval; | return retval; | |||
} | } | |||
ComplexMatrix | ComplexMatrix | |||
complex_matrix_value (bool = false) const | complex_matrix_value (bool = false) const | |||
{ | { | |||
ComplexMatrix retval (1, 1); | ComplexMatrix retval (1, 1); | |||
retval(0,0) = Complex (scalar.double_value ()); | retval(0,0) = Complex (scalar.double_value ()); | |||
return retval; | return retval; | |||
} | } | |||
FloatComplexMatrix | FloatComplexMatrix | |||
float_complex_matrix_value (bool = false) const | float_complex_matrix_value (bool = false) const | |||
{ | { | |||
FloatComplexMatrix retval (1, 1); | FloatComplexMatrix retval (1, 1); | |||
retval(0,0) = FloatComplex (scalar.float_value ()); | retval(0,0) = FloatComplex (scalar.float_value ()); | |||
return retval; | return retval; | |||
} | } | |||
NDArray | NDArray | |||
array_value (bool = false) const | array_value (bool = false) const | |||
{ | { | |||
NDArray retval (dim_vector (1, 1)); | NDArray retval (dim_vector (1, 1)); | |||
retval(0) = scalar.double_value (); | retval(0) = scalar.double_value (); | |||
return retval; | return retval; | |||
} | } | |||
FloatNDArray | FloatNDArray | |||
float_array_value (bool = false) const | float_array_value (bool = false) const | |||
{ | { | |||
FloatNDArray retval (dim_vector (1, 1)); | FloatNDArray retval (dim_vector (1, 1)); | |||
retval(0) = scalar.float_value (); | retval(0) = scalar.float_value (); | |||
return retval; | return retval; | |||
} | } | |||
ComplexNDArray | ComplexNDArray | |||
complex_array_value (bool = false) const | complex_array_value (bool = false) const | |||
{ | { | |||
ComplexNDArray retval (dim_vector (1, 1)); | ComplexNDArray retval (dim_vector (1, 1)); | |||
retval(0) = FloatComplex (scalar.double_value ()); | retval(0) = FloatComplex (scalar.double_value ()); | |||
return retval; | return retval; | |||
} | } | |||
FloatComplexNDArray | FloatComplexNDArray | |||
float_complex_array_value (bool = false) const | float_complex_array_value (bool = false) const | |||
{ | { | |||
FloatComplexNDArray retval (dim_vector (1, 1)); | FloatComplexNDArray retval (dim_vector (1, 1)); | |||
retval(0) = FloatComplex (scalar.float_value ()); | retval(0) = FloatComplex (scalar.float_value ()); | |||
return retval; | return retval; | |||
} | } | |||
bool bool_value (bool warn = false) const | bool bool_value (bool warn = false) const | |||
{ | { | |||
if (warn && scalar != 0.0 && scalar != 1.0) | if (warn && scalar != 0.0 && scalar != 1.0) | |||
gripe_logical_conversion (); | gripe_logical_conversion (); | |||
return scalar.bool_value (); | return scalar.bool_value (); | |||
} | } | |||
boolNDArray | boolNDArray | |||
skipping to change at line 597 | skipping to change at line 600 | |||
charNDArray | charNDArray | |||
char_array_value (bool = false) const | char_array_value (bool = false) const | |||
{ | { | |||
charNDArray retval (dim_vector (1, 1)); | charNDArray retval (dim_vector (1, 1)); | |||
retval(0) = scalar.char_value (); | retval(0) = scalar.char_value (); | |||
return retval; | return retval; | |||
} | } | |||
void increment (void) | void increment (void) | |||
{ | { | |||
scalar += OCTAVE_INT_T (1); | scalar += OCTAVE_INT_T (1); | |||
} | } | |||
void decrement (void) | void decrement (void) | |||
{ | { | |||
scalar -= OCTAVE_INT_T (1); | scalar -= OCTAVE_INT_T (1); | |||
} | } | |||
idx_vector index_vector (void) const { return idx_vector (scalar); } | idx_vector index_vector (void) const { return idx_vector (scalar); } | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, octave_idx_type skip, | oct_data_conv::data_type output_type, octave_idx_type skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ | { | |||
return os.write (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION (), | return os.write (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION (), | |||
block_size, output_type, skip, flt_fmt); | block_size, output_type, skip, flt_fmt); | |||
} | } | |||
// Unsafe. This function exists to support the MEX interface. | // Unsafe. This function exists to support the MEX interface. | |||
// You should not use it anywhere else. | // You should not use it anywhere else. | |||
void *mex_get_data (void) const { return scalar.mex_get_data (); } | void *mex_get_data (void) const { return scalar.mex_get_data (); } | |||
mxArray *as_mxArray (void) const | mxArray *as_mxArray (void) const | |||
{ | { | |||
mxArray *retval = new mxArray (OCTAVE_INT_MX_CLASS, 1, 1, mxREAL); | mxArray *retval = new mxArray (OCTAVE_INT_MX_CLASS, 1, 1, mxREAL); | |||
OCTAVE_INT_T::val_type *pr = static_cast<OCTAVE_INT_T::val_type *> (ret | OCTAVE_INT_T::val_type *pr = static_cast<OCTAVE_INT_T::val_type *> | |||
val->get_data ()); | (retval->get_data ()); | |||
pr[0] = scalar.value (); | pr[0] = scalar.value (); | |||
return retval; | return retval; | |||
} | } | |||
octave_value map (unary_mapper_t umap) const | octave_value map (unary_mapper_t umap) const | |||
{ | { | |||
switch (umap) | switch (umap) | |||
{ | ||||
case umap_abs: | ||||
return scalar.abs (); | ||||
case umap_signum: | ||||
return scalar.signum (); | ||||
case umap_ceil: | ||||
case umap_conj: | ||||
case umap_fix: | ||||
case umap_floor: | ||||
case umap_real: | ||||
case umap_round: | ||||
return scalar; | ||||
case umap_imag: | ||||
return OCTAVE_INT_T (); | ||||
case umap_isnan: | ||||
case umap_isna: | ||||
case umap_isinf: | ||||
return false; | ||||
case umap_finite: | ||||
return true; | ||||
default: | ||||
{ | { | |||
case umap_abs: | octave_scalar m (scalar_value ()); | |||
return scalar.abs (); | return m.map (umap); | |||
case umap_signum: | ||||
return scalar.signum (); | ||||
case umap_ceil: | ||||
case umap_conj: | ||||
case umap_fix: | ||||
case umap_floor: | ||||
case umap_real: | ||||
case umap_round: | ||||
return scalar; | ||||
case umap_imag: | ||||
return OCTAVE_INT_T (); | ||||
case umap_isnan: | ||||
case umap_isna: | ||||
case umap_isinf: | ||||
return false; | ||||
case umap_finite: | ||||
return true; | ||||
default: | ||||
{ | ||||
octave_scalar m (scalar_value ()); | ||||
return m.map (umap); | ||||
} | ||||
} | } | |||
} | } | |||
} | ||||
private: | private: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |||
}; | }; | |||
End of changes. 58 change blocks. | ||||
289 lines changed or deleted | 289 lines changed or added | |||
ov-lazy-idx.h | ov-lazy-idx.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2010-2012 VZLU Prague | Copyright (C) 2010-2013 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_lazy_idx_h) | #if !defined (octave_ov_lazy_idx_h) | |||
#define octave_lazy_idx_h 1 | #define octave_ov_lazy_idx_h 1 | |||
#include "ov-re-mat.h" | #include "ov-re-mat.h" | |||
// Lazy indices that stay in idx_vector form until the conversion to NDArra y is | // Lazy indices that stay in idx_vector form until the conversion to NDArra y is | |||
// actually needed. | // actually needed. | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
octave_lazy_index : public octave_base_value | octave_lazy_index : public octave_base_value | |||
{ | { | |||
skipping to change at line 48 | skipping to change at line 48 | |||
: octave_base_value (), index (), value () { } | : octave_base_value (), index (), value () { } | |||
octave_lazy_index (const idx_vector& idx) | octave_lazy_index (const idx_vector& idx) | |||
: octave_base_value (), index (idx), value () { } | : octave_base_value (), index (idx), value () { } | |||
octave_lazy_index (const octave_lazy_index& i) | octave_lazy_index (const octave_lazy_index& i) | |||
: octave_base_value (), index (i.index), value (i.value) { } | : octave_base_value (), index (i.index), value (i.value) { } | |||
~octave_lazy_index (void) { } | ~octave_lazy_index (void) { } | |||
octave_base_value *clone (void) const { return new octave_lazy_index (*th | octave_base_value *clone (void) const | |||
is); } | { return new octave_lazy_index (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_matrix () ; } | octave_base_value *empty_clone (void) const { return new octave_matrix () ; } | |||
type_conv_info numeric_conversion_function (void) const; | type_conv_info numeric_conversion_function (void) const; | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
size_t byte_size (void) const { return numel () * sizeof (octave_idx_type ); } | size_t byte_size (void) const { return numel () * sizeof (octave_idx_type ); } | |||
octave_value squeeze (void) const; | octave_value squeeze (void) const; | |||
octave_value full_value (void) const { return make_value (); } | octave_value full_value (void) const { return make_value (); } | |||
idx_vector index_vector (void) const | idx_vector index_vector (void) const | |||
{ return index; } | { return index; } | |||
builtin_type_t builtin_type (void) const { return btyp_double; } | builtin_type_t builtin_type (void) const { return btyp_double; } | |||
bool is_real_matrix (void) const { return true; } | bool is_real_matrix (void) const { return true; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
bool is_double_type (void) const { return true; } | bool is_double_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx) | const std::list<octave_value_list>& idx) | |||
{ return make_value ().subsref (type, idx); } | { return make_value ().subsref (type, idx); } | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, int) | const std::list<octave_value_list>& idx, int) | |||
{ return subsref (type, idx); } | { return subsref (type, idx); } | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false) | bool resize_ok = false) | |||
{ return make_value ().do_index_op (idx, resize_ok); } | { return make_value ().do_index_op (idx, resize_ok); } | |||
dim_vector dims (void) const { return index.orig_dimensions (); } | dim_vector dims (void) const { return index.orig_dimensions (); } | |||
octave_idx_type numel (void) const { return index.length (0); } | octave_idx_type numel (void) const { return index.length (0); } | |||
octave_idx_type nnz (void) const { return numel (); } | octave_idx_type nnz (void) const { return numel (); } | |||
octave_value reshape (const dim_vector& new_dims) const; | octave_value reshape (const dim_vector& new_dims) const; | |||
octave_value permute (const Array<int>& vec, bool inv = false) const; | octave_value permute (const Array<int>& vec, bool inv = false) const; | |||
octave_value resize (const dim_vector& dv, bool fill = false) const | octave_value resize (const dim_vector& dv, bool fill = false) const | |||
{ return make_value ().resize (dv, fill); } | { return make_value ().resize (dv, fill); } | |||
octave_value all (int dim = 0) const { return make_value ().all (dim); } | octave_value all (int dim = 0) const { return make_value ().all (dim); } | |||
octave_value any (int dim = 0) const { return make_value ().any (dim); } | octave_value any (int dim = 0) const { return make_value ().any (dim); } | |||
MatrixType matrix_type (void) const { return make_value ().matrix_type () ; } | MatrixType matrix_type (void) const { return make_value ().matrix_type () ; } | |||
MatrixType matrix_type (const MatrixType& _typ) const | MatrixType matrix_type (const MatrixType& _typ) const | |||
{ return make_value ().matrix_type (_typ); } | { return make_value ().matrix_type (_typ); } | |||
octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst; | octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst; | |||
octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const; | sortmode mode = ASCENDING) const; | |||
sortmode is_sorted (sortmode mode = UNSORTED) const; | sortmode is_sorted (sortmode mode = UNSORTED) const; | |||
Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const; | Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const; | |||
skipping to change at line 126 | skipping to change at line 127 | |||
bool is_matrix_type (void) const { return true; } | bool is_matrix_type (void) const { return true; } | |||
bool is_numeric_type (void) const { return true; } | bool is_numeric_type (void) const { return true; } | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
bool is_constant (void) const { return true; } | bool is_constant (void) const { return true; } | |||
bool is_true (void) const | bool is_true (void) const | |||
{ return make_value ().is_true (); } | { return make_value ().is_true (); } | |||
bool print_as_scalar (void) const | bool print_as_scalar (void) const | |||
{ return make_value ().print_as_scalar (); } | { return make_value ().print_as_scalar (); } | |||
void print (std::ostream& os, bool pr_as_read_syntax = false) const | void print (std::ostream& os, bool pr_as_read_syntax = false) const | |||
{ make_value ().print (os, pr_as_read_syntax); } | { make_value ().print (os, pr_as_read_syntax); } | |||
void print_info (std::ostream& os, const std::string& prefix) const | void print_info (std::ostream& os, const std::string& prefix) const | |||
{ make_value ().print_info (os, prefix); } | { make_value ().print_info (os, prefix); } | |||
#define FORWARD_VALUE_QUERY(TYPE,NAME) \ | #define FORWARD_VALUE_QUERY(TYPE,NAME) \ | |||
TYPE \ | TYPE \ | |||
NAME (void) const { return make_value ().NAME (); } | NAME (void) const { return make_value ().NAME (); } | |||
FORWARD_VALUE_QUERY (int8NDArray, int8_array_value) | FORWARD_VALUE_QUERY (int8NDArray, int8_array_value) | |||
FORWARD_VALUE_QUERY (int16NDArray, int16_array_value) | FORWARD_VALUE_QUERY (int16NDArray, int16_array_value) | |||
FORWARD_VALUE_QUERY (int32NDArray, int32_array_value) | FORWARD_VALUE_QUERY (int32NDArray, int32_array_value) | |||
FORWARD_VALUE_QUERY (int64NDArray, int64_array_value) | FORWARD_VALUE_QUERY (int64NDArray, int64_array_value) | |||
FORWARD_VALUE_QUERY (uint8NDArray, uint8_array_value) | FORWARD_VALUE_QUERY (uint8NDArray, uint8_array_value) | |||
skipping to change at line 189 | skipping to change at line 190 | |||
FORWARD_VALUE_QUERY1 (NDArray, array_value) | FORWARD_VALUE_QUERY1 (NDArray, array_value) | |||
FORWARD_VALUE_QUERY1 (FloatNDArray, float_array_value) | FORWARD_VALUE_QUERY1 (FloatNDArray, float_array_value) | |||
FORWARD_VALUE_QUERY1 (SparseMatrix, sparse_matrix_value) | FORWARD_VALUE_QUERY1 (SparseMatrix, sparse_matrix_value) | |||
FORWARD_VALUE_QUERY1 (SparseComplexMatrix, sparse_complex_matrix_value) | FORWARD_VALUE_QUERY1 (SparseComplexMatrix, sparse_complex_matrix_value) | |||
octave_value diag (octave_idx_type k = 0) const | octave_value diag (octave_idx_type k = 0) const | |||
{ return make_value ().diag (k); } | { return make_value ().diag (k); } | |||
octave_value convert_to_str_internal (bool pad, bool force, char type) co nst | octave_value convert_to_str_internal (bool pad, bool force, char type) co nst | |||
{ return make_value ().convert_to_str_internal (pad, force, type); } | { return make_value ().convert_to_str_internal (pad, force, type); } | |||
void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const | void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const | |||
{ return make_value ().print_raw (os, pr_as_read_syntax); } | { return make_value ().print_raw (os, pr_as_read_syntax); } | |||
bool save_ascii (std::ostream& os); | bool save_ascii (std::ostream& os); | |||
bool load_ascii (std::istream& is); | bool load_ascii (std::istream& is); | |||
bool save_binary (std::ostream& os, bool& save_as_floats); | bool save_binary (std::ostream& os, bool& save_as_floats); | |||
bool load_binary (std::istream& is, bool swap, | bool load_binary (std::istream& is, bool swap, | |||
oct_mach_info::float_format fmt); | oct_mach_info::float_format fmt); | |||
// HDF5 functions not defined. | // HDF5 functions not defined. | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ return make_value ().write (os, block_size, output_type, skip, flt_fm t); } | { return make_value ().write (os, block_size, output_type, skip, flt_fmt) ; } | |||
// Unsafe. This function exists to support the MEX interface. | // Unsafe. This function exists to support the MEX interface. | |||
// You should not use it anywhere else. | // You should not use it anywhere else. | |||
void *mex_get_data (void) const | void *mex_get_data (void) const | |||
{ return make_value ().mex_get_data (); } | { return make_value ().mex_get_data (); } | |||
mxArray *as_mxArray (void) const | mxArray *as_mxArray (void) const | |||
{ return make_value ().as_mxArray (); } | { return make_value ().as_mxArray (); } | |||
octave_value map (unary_mapper_t umap) const | octave_value map (unary_mapper_t umap) const | |||
{ return make_value ().map (umap); } | { return make_value ().map (umap); } | |||
private: | private: | |||
const octave_value& make_value (void) const | const octave_value& make_value (void) const | |||
{ | { | |||
if (value.is_undefined ()) | if (value.is_undefined ()) | |||
value = octave_value (index, false); | value = octave_value (index, false); | |||
return value; | return value; | |||
} | } | |||
octave_value& make_value (void) | octave_value& make_value (void) | |||
{ | { | |||
if (value.is_undefined ()) | if (value.is_undefined ()) | |||
value = octave_value (index, false); | value = octave_value (index, false); | |||
return value; | return value; | |||
} | } | |||
idx_vector index; | idx_vector index; | |||
mutable octave_value value; | mutable octave_value value; | |||
static octave_base_value *numeric_conversion_function (const octave_base_ | static octave_base_value * | |||
value&); | numeric_conversion_function (const octave_base_value&); | |||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 25 change blocks. | ||||
34 lines changed or deleted | 34 lines changed or added | |||
ov-mex-fcn.h | ov-mex-fcn.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_mex_function_h) | #if !defined (octave_ov_mex_fcn_h) | |||
#define octave_mex_function_h 1 | #define octave_ov_mex_fcn_h 1 | |||
#include <string> | #include <string> | |||
#include "oct-shlib.h" | #include "oct-shlib.h" | |||
#include "ov-fcn.h" | #include "ov-fcn.h" | |||
#include "ov-builtin.h" | #include "ov-builtin.h" | |||
#include "ov-typeinfo.h" | #include "ov-typeinfo.h" | |||
class octave_shlib; | class octave_shlib; | |||
skipping to change at line 57 | skipping to change at line 57 | |||
: mex_fcn_ptr (), exit_fcn_ptr (), have_fmex (), sh_lib (), | : mex_fcn_ptr (), exit_fcn_ptr (), have_fmex (), sh_lib (), | |||
t_checked (), system_fcn_file () { } | t_checked (), system_fcn_file () { } | |||
octave_mex_function (void *fptr, bool fmex, const octave_shlib& shl, | octave_mex_function (void *fptr, bool fmex, const octave_shlib& shl, | |||
const std::string& nm = std::string ()); | const std::string& nm = std::string ()); | |||
~octave_mex_function (void); | ~octave_mex_function (void); | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx) | const std::list<octave_value_list>& idx) | |||
{ | { | |||
octave_value_list tmp = subsref (type, idx, 1); | octave_value_list tmp = subsref (type, idx, 1); | |||
return tmp.length () > 0 ? tmp(0) : octave_value (); | return tmp.length () > 0 ? tmp(0) : octave_value (); | |||
} | } | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
int nargout); | int nargout); | |||
octave_function *function_value (bool = false) { return this; } | octave_function *function_value (bool = false) { return this; } | |||
const octave_function *function_value (bool = false) const { return this; } | const octave_function *function_value (bool = false) const { return this; } | |||
void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; } | void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; } | |||
skipping to change at line 90 | skipping to change at line 90 | |||
bool is_builtin_function (void) const { return false; } | bool is_builtin_function (void) const { return false; } | |||
bool is_mex_function (void) const { return true; } | bool is_mex_function (void) const { return true; } | |||
octave_value_list | octave_value_list | |||
do_multi_index_op (int nargout, const octave_value_list& args); | do_multi_index_op (int nargout, const octave_value_list& args); | |||
void atexit (void (*fcn) (void)) { exit_fcn_ptr = fcn; } | void atexit (void (*fcn) (void)) { exit_fcn_ptr = fcn; } | |||
octave_shlib get_shlib (void) const | octave_shlib get_shlib (void) const | |||
{ return sh_lib; } | { return sh_lib; } | |||
private: | private: | |||
void *mex_fcn_ptr; | void *mex_fcn_ptr; | |||
void (*exit_fcn_ptr) (void); | void (*exit_fcn_ptr) (void); | |||
bool have_fmex; | bool have_fmex; | |||
octave_shlib sh_lib; | octave_shlib sh_lib; | |||
End of changes. 4 change blocks. | ||||
8 lines changed or deleted | 8 lines changed or added | |||
ov-null-mat.h | ov-null-mat.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_null_matrix_h) | #if !defined (octave_ov_null_mat_h) | |||
#define octave_null_matrix_h 1 | #define octave_ov_null_mat_h 1 | |||
#include "ov.h" | #include "ov.h" | |||
#include "ov-re-mat.h" | #include "ov-re-mat.h" | |||
#include "ov-str-mat.h" | #include "ov-str-mat.h" | |||
// Design rationale: | // Design rationale: | |||
// The constructors are hidden. There is only one null matrix (or null stri | // The constructors are hidden. There is only one null matrix (or null str | |||
ng) object, | ing) | |||
// that can have shallow copies. Cloning the object returns just a normal e | // object, that can have shallow copies. Cloning the object returns just a | |||
mpty matrix, | // normal empty matrix, so all the shallow copies are, in fact, read-only. | |||
// so all the shallow copies are, in fact, read-only. This conveniently ens | This | |||
ures that any | // conveniently ensures that any attempt to fiddle with the null matrix | |||
// attempt to fiddle with the null matrix destroys its special status. | // destroys its special status. | |||
// The special [] value. | // The special [] value. | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
octave_null_matrix : public octave_matrix | octave_null_matrix : public octave_matrix | |||
{ | { | |||
octave_null_matrix (void) : octave_matrix () { } | octave_null_matrix (void) : octave_matrix () { } | |||
public: | public: | |||
End of changes. 3 change blocks. | ||||
10 lines changed or deleted | 10 lines changed or added | |||
ov-oncleanup.h | ov-oncleanup.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2010-2012 VZLU Prague | Copyright (C) 2010-2013 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
ov-perm.h | ov-perm.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_perm_matrix_h) | #if !defined (octave_ov_perm_h) | |||
#define octave_perm_matrix_h 1 | #define octave_ov_perm_h 1 | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "ov-base.h" | #include "ov-base.h" | |||
#include "ov-typeinfo.h" | #include "ov-typeinfo.h" | |||
#include "oct-obj.h" | #include "oct-obj.h" | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
octave_perm_matrix : public octave_base_value | octave_perm_matrix : public octave_base_value | |||
{ | { | |||
public: | public: | |||
octave_perm_matrix (void) : matrix (), dense_cache () { } | octave_perm_matrix (void) : matrix (), dense_cache () { } | |||
octave_perm_matrix (const PermMatrix& p) : matrix (p), dense_cache () { } | octave_perm_matrix (const PermMatrix& p) : matrix (p), dense_cache () { } | |||
octave_base_value *clone (void) const { return new octave_perm_matrix (*t | octave_base_value *clone (void) const | |||
his); } | { return new octave_perm_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_perm_matr | octave_base_value *empty_clone (void) const | |||
ix (); } | { return new octave_perm_matrix (); } | |||
type_conv_info numeric_conversion_function (void) const; | type_conv_info numeric_conversion_function (void) const; | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
size_t byte_size (void) const { return matrix.byte_size (); } | size_t byte_size (void) const { return matrix.byte_size (); } | |||
octave_value squeeze (void) const { return matrix; } | octave_value squeeze (void) const { return matrix; } | |||
octave_value full_value (void) const { return to_dense (); } | octave_value full_value (void) const { return to_dense (); } | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx); | const std::list<octave_value_list>& idx); | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, int) | const std::list<octave_value_list>& idx, int) | |||
{ return subsref (type, idx); } | { return subsref (type, idx); } | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
dim_vector dims (void) const { return matrix.dims (); } | dim_vector dims (void) const { return matrix.dims (); } | |||
octave_idx_type nnz (void) const { return matrix.rows (); } | octave_idx_type nnz (void) const { return matrix.rows (); } | |||
octave_value reshape (const dim_vector& new_dims) const | octave_value reshape (const dim_vector& new_dims) const | |||
{ return to_dense ().reshape (new_dims); } | { return to_dense ().reshape (new_dims); } | |||
octave_value permute (const Array<int>& vec, bool inv = false) const | octave_value permute (const Array<int>& vec, bool inv = false) const | |||
{ return to_dense ().permute (vec, inv); } | { return to_dense ().permute (vec, inv); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const | octave_value resize (const dim_vector& dv, bool fill = false) const | |||
{ return to_dense ().resize (dv, fill); } | { return to_dense ().resize (dv, fill); } | |||
octave_value all (int dim = 0) const { return to_dense ().all (dim); } | octave_value all (int dim = 0) const { return to_dense ().all (dim); } | |||
octave_value any (int dim = 0) const { return to_dense ().any (dim); } | octave_value any (int dim = 0) const { return to_dense ().any (dim); } | |||
MatrixType matrix_type (void) const { return MatrixType::Permuted_Diagona l; } | MatrixType matrix_type (void) const { return MatrixType::Permuted_Diagona l; } | |||
MatrixType matrix_type (const MatrixType&) const | MatrixType matrix_type (const MatrixType&) const | |||
{ return matrix_type (); } | { return matrix_type (); } | |||
octave_value diag (octave_idx_type k = 0) const | octave_value diag (octave_idx_type k = 0) const | |||
{ return to_dense () .diag (k); } | { return to_dense () .diag (k); } | |||
octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | |||
{ return to_dense ().sort (dim, mode); } | { return to_dense ().sort (dim, mode); } | |||
octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const | sortmode mode = ASCENDING) const | |||
{ return to_dense ().sort (sidx, dim, mode); } | { return to_dense ().sort (sidx, dim, mode); } | |||
sortmode is_sorted (sortmode mode = UNSORTED) const | sortmode is_sorted (sortmode mode = UNSORTED) const | |||
{ return to_dense ().is_sorted (mode); } | { return to_dense ().is_sorted (mode); } | |||
Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const | Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const | |||
{ return to_dense ().sort_rows_idx (mode); } | { return to_dense ().sort_rows_idx (mode); } | |||
sortmode is_sorted_rows (sortmode mode = UNSORTED) const | sortmode is_sorted_rows (sortmode mode = UNSORTED) const | |||
{ return to_dense ().is_sorted_rows (mode); } | { return to_dense ().is_sorted_rows (mode); } | |||
builtin_type_t builtin_type (void) const { return btyp_double; } | builtin_type_t builtin_type (void) const { return btyp_double; } | |||
bool is_perm_matrix (void) const { return true; } | bool is_perm_matrix (void) const { return true; } | |||
bool is_matrix_type (void) const { return true; } | bool is_matrix_type (void) const { return true; } | |||
bool is_numeric_type (void) const { return true; } | bool is_numeric_type (void) const { return true; } | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
skipping to change at line 130 | skipping to change at line 132 | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
bool is_true (void) const; | bool is_true (void) const; | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
float float_value (bool = false) const; | float float_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
idx_vector index_vector (void) const; | idx_vector index_vector (void) const; | |||
PermMatrix perm_matrix_value (void) const | PermMatrix perm_matrix_value (void) const | |||
{ return matrix; } | { return matrix; } | |||
Matrix matrix_value (bool = false) const; | Matrix matrix_value (bool = false) const; | |||
FloatMatrix float_matrix_value (bool = false) const; | FloatMatrix float_matrix_value (bool = false) const; | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
FloatComplex float_complex_value (bool = false) const; | FloatComplex float_complex_value (bool = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const; | ComplexMatrix complex_matrix_value (bool = false) const; | |||
skipping to change at line 217 | skipping to change at line 219 | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
bool print_as_scalar (void) const; | bool print_as_scalar (void) const; | |||
void print (std::ostream& os, bool pr_as_read_syntax = false) const; | void print (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
void print_info (std::ostream& os, const std::string& prefix) const; | void print_info (std::ostream& os, const std::string& prefix) const; | |||
octave_value map (unary_mapper_t umap) const | octave_value map (unary_mapper_t umap) const | |||
{ return to_dense ().map (umap); } | { return to_dense ().map (umap); } | |||
protected: | protected: | |||
PermMatrix matrix; | PermMatrix matrix; | |||
virtual octave_value to_dense (void) const; | virtual octave_value to_dense (void) const; | |||
mutable octave_value dense_cache; | mutable octave_value dense_cache; | |||
private: | private: | |||
End of changes. 17 change blocks. | ||||
21 lines changed or deleted | 21 lines changed or added | |||
ov-range.h | ov-range.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_range_h) | #if !defined (octave_ov_range_h) | |||
#define octave_range_h 1 | #define octave_ov_range_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "Range.h" | #include "Range.h" | |||
#include "lo-mappers.h" | #include "lo-mappers.h" | |||
#include "lo-utils.h" | #include "lo-utils.h" | |||
skipping to change at line 61 | skipping to change at line 61 | |||
class | class | |||
octave_range : public octave_base_value | octave_range : public octave_base_value | |||
{ | { | |||
public: | public: | |||
octave_range (void) | octave_range (void) | |||
: octave_base_value (), range (), idx_cache () { } | : octave_base_value (), range (), idx_cache () { } | |||
octave_range (double base, double limit, double inc) | octave_range (double base, double limit, double inc) | |||
: octave_base_value (), range (base, limit, inc), idx_cache () | : octave_base_value (), range (base, limit, inc), idx_cache () | |||
{ | { | |||
if (range.nelem () < 0) | if (range.nelem () < 0) | |||
::error ("invalid range"); | ::error ("invalid range"); | |||
} | } | |||
octave_range (const Range& r) | octave_range (const Range& r) | |||
: octave_base_value (), range (r), idx_cache () | : octave_base_value (), range (r), idx_cache () | |||
{ | { | |||
if (range.nelem () < 0 && range.nelem () != -2) | if (range.nelem () < 0 && range.nelem () != -2) | |||
::error ("invalid range"); | ::error ("invalid range"); | |||
} | } | |||
octave_range (const octave_range& r) | octave_range (const octave_range& r) | |||
: octave_base_value (), range (r.range), | : octave_base_value (), range (r.range), | |||
idx_cache (r.idx_cache ? new idx_vector (*r.idx_cache) : 0) | idx_cache (r.idx_cache ? new idx_vector (*r.idx_cache) : 0) | |||
{ } | { } | |||
octave_range (const Range& r, const idx_vector& cache) | octave_range (const Range& r, const idx_vector& cache) | |||
: octave_base_value (), range (r), idx_cache () | : octave_base_value (), range (r), idx_cache () | |||
{ | { | |||
set_idx_cache (cache); | set_idx_cache (cache); | |||
} | } | |||
~octave_range (void) { clear_cached_info (); } | ~octave_range (void) { clear_cached_info (); } | |||
octave_base_value *clone (void) const { return new octave_range (*this); } | octave_base_value *clone (void) const { return new octave_range (*this); } | |||
// A range is really just a special kind of real matrix object. In | // A range is really just a special kind of real matrix object. In | |||
// the places where we need to call empty_clone, it makes more sense | // the places where we need to call empty_clone, it makes more sense | |||
// to create an empty matrix (0x0) instead of an empty range (1x0). | // to create an empty matrix (0x0) instead of an empty range (1x0). | |||
octave_base_value *empty_clone (void) const { return new octave_matrix () ; } | octave_base_value *empty_clone (void) const { return new octave_matrix () ; } | |||
type_conv_info numeric_conversion_function (void) const; | type_conv_info numeric_conversion_function (void) const; | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx); | const std::list<octave_value_list>& idx); | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, int) | const std::list<octave_value_list>& idx, int) | |||
{ return subsref (type, idx); } | { return subsref (type, idx); } | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
idx_vector index_vector (void) const; | idx_vector index_vector (void) const; | |||
dim_vector dims (void) const | dim_vector dims (void) const | |||
{ | { | |||
octave_idx_type n = range.nelem (); | octave_idx_type n = range.nelem (); | |||
return dim_vector (n > 0, n); | return dim_vector (n > 0, n); | |||
} | } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const; | octave_value resize (const dim_vector& dv, bool fill = false) const; | |||
size_t byte_size (void) const { return 3 * sizeof (double); } | size_t byte_size (void) const { return 3 * sizeof (double); } | |||
octave_value reshape (const dim_vector& new_dims) const | octave_value reshape (const dim_vector& new_dims) const | |||
{ return NDArray (array_value().reshape (new_dims)); } | { return NDArray (array_value ().reshape (new_dims)); } | |||
octave_value permute (const Array<int>& vec, bool inv = false) const | octave_value permute (const Array<int>& vec, bool inv = false) const | |||
{ return NDArray (array_value().permute (vec, inv)); } | { return NDArray (array_value ().permute (vec, inv)); } | |||
octave_value squeeze (void) const { return range; } | octave_value squeeze (void) const { return range; } | |||
octave_value full_value (void) const { return range.matrix_value (); } | octave_value full_value (void) const { return range.matrix_value (); } | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
bool is_constant (void) const { return true; } | bool is_constant (void) const { return true; } | |||
bool is_range (void) const { return true; } | bool is_range (void) const { return true; } | |||
octave_value all (int dim = 0) const; | octave_value all (int dim = 0) const; | |||
octave_value any (int dim = 0) const; | octave_value any (int dim = 0) const; | |||
octave_value diag (octave_idx_type k = 0) const; | octave_value diag (octave_idx_type k = 0) const; | |||
octave_value diag (octave_idx_type m, octave_idx_type n) const; | ||||
octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | |||
{ return range.sort (dim, mode); } | { return range.sort (dim, mode); } | |||
octave_value sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0, | octave_value sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const | sortmode mode = ASCENDING) const | |||
{ return range.sort (sidx, dim, mode); } | { return range.sort (sidx, dim, mode); } | |||
sortmode is_sorted (sortmode mode = UNSORTED) const | sortmode is_sorted (sortmode mode = UNSORTED) const | |||
{ return range.is_sorted (mode); } | { return range.is_sorted (mode); } | |||
Array<octave_idx_type> sort_rows_idx (sortmode) const | Array<octave_idx_type> sort_rows_idx (sortmode) const | |||
{ return Array<octave_idx_type> (dim_vector (1, 0)); } | { return Array<octave_idx_type> (dim_vector (1, 0)); } | |||
sortmode is_sorted_rows (sortmode mode = UNSORTED) const | sortmode is_sorted_rows (sortmode mode = UNSORTED) const | |||
{ return mode ? mode : ASCENDING; } | { return mode ? mode : ASCENDING; } | |||
builtin_type_t builtin_type (void) const { return btyp_double; } | builtin_type_t builtin_type (void) const { return btyp_double; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
bool is_double_type (void) const { return true; } | bool is_double_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
bool is_numeric_type (void) const { return true; } | bool is_numeric_type (void) const { return true; } | |||
bool is_true (void) const; | bool is_true (void) const; | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
float float_value (bool = false) const; | float float_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
float float_scalar_value (bool frc_str_conv = false) const | float float_scalar_value (bool frc_str_conv = false) const | |||
{ return float_value (frc_str_conv); } | { return float_value (frc_str_conv); } | |||
Matrix matrix_value (bool = false) const | Matrix matrix_value (bool = false) const | |||
{ return range.matrix_value (); } | { return range.matrix_value (); } | |||
FloatMatrix float_matrix_value (bool = false) const | FloatMatrix float_matrix_value (bool = false) const | |||
{ return range.matrix_value (); } | { return range.matrix_value (); } | |||
NDArray array_value (bool = false) const | NDArray array_value (bool = false) const | |||
{ return range.matrix_value (); } | { return range.matrix_value (); } | |||
FloatNDArray float_array_value (bool = false) const | FloatNDArray float_array_value (bool = false) const | |||
{ return FloatMatrix (range.matrix_value ()); } | { return FloatMatrix (range.matrix_value ()); } | |||
charNDArray char_array_value (bool = false) const; | charNDArray char_array_value (bool = false) const; | |||
// FIXME -- it would be better to have Range::intXNDArray_value | // FIXME: it would be better to have Range::intXNDArray_value | |||
// functions to avoid the intermediate conversion to a matrix | // functions to avoid the intermediate conversion to a matrix | |||
// object. | // object. | |||
int8NDArray | int8NDArray | |||
int8_array_value (void) const { return int8NDArray (array_value ()); } | int8_array_value (void) const { return int8NDArray (array_value ()); } | |||
int16NDArray | int16NDArray | |||
int16_array_value (void) const { return int16NDArray (array_value ()); } | int16_array_value (void) const { return int16NDArray (array_value ()); } | |||
int32NDArray | int32NDArray | |||
skipping to change at line 222 | skipping to change at line 224 | |||
uint16NDArray | uint16NDArray | |||
uint16_array_value (void) const { return uint16NDArray (array_value ()); } | uint16_array_value (void) const { return uint16NDArray (array_value ()); } | |||
uint32NDArray | uint32NDArray | |||
uint32_array_value (void) const { return uint32NDArray (array_value ()); } | uint32_array_value (void) const { return uint32NDArray (array_value ()); } | |||
uint64NDArray | uint64NDArray | |||
uint64_array_value (void) const { return uint64NDArray (array_value ()); } | uint64_array_value (void) const { return uint64NDArray (array_value ()); } | |||
SparseMatrix sparse_matrix_value (bool = false) const | SparseMatrix sparse_matrix_value (bool = false) const | |||
{ return SparseMatrix (range.matrix_value ()); } | { return SparseMatrix (range.matrix_value ()); } | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |||
{ return SparseComplexMatrix (sparse_matrix_value ()); } | { return SparseComplexMatrix (sparse_matrix_value ()); } | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
FloatComplex float_complex_value (bool = false) const; | FloatComplex float_complex_value (bool = false) const; | |||
boolNDArray bool_array_value (bool warn = false) const; | boolNDArray bool_array_value (bool warn = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const | ComplexMatrix complex_matrix_value (bool = false) const | |||
{ return ComplexMatrix (range.matrix_value ()); } | { return ComplexMatrix (range.matrix_value ()); } | |||
FloatComplexMatrix float_complex_matrix_value (bool = false) const | FloatComplexMatrix float_complex_matrix_value (bool = false) const | |||
{ return FloatComplexMatrix (range.matrix_value ()); } | { return FloatComplexMatrix (range.matrix_value ()); } | |||
ComplexNDArray complex_array_value (bool = false) const | ComplexNDArray complex_array_value (bool = false) const | |||
{ return ComplexMatrix (range.matrix_value ()); } | { return ComplexMatrix (range.matrix_value ()); } | |||
FloatComplexNDArray float_complex_array_value (bool = false) const | FloatComplexNDArray float_complex_array_value (bool = false) const | |||
{ return FloatComplexMatrix (range.matrix_value ()); } | { return FloatComplexMatrix (range.matrix_value ()); } | |||
Range range_value (void) const { return range; } | Range range_value (void) const { return range; } | |||
octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | |||
void print (std::ostream& os, bool pr_as_read_syntax = false) const; | void print (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
bool print_name_tag (std::ostream& os, const std::string& name) const; | bool print_name_tag (std::ostream& os, const std::string& name) const; | |||
void short_disp (std::ostream& os) const; | ||||
bool save_ascii (std::ostream& os); | bool save_ascii (std::ostream& os); | |||
bool load_ascii (std::istream& is); | bool load_ascii (std::istream& is); | |||
bool save_binary (std::ostream& os, bool& save_as_floats); | bool save_binary (std::ostream& os, bool& save_as_floats); | |||
bool load_binary (std::istream& is, bool swap, | bool load_binary (std::istream& is, bool swap, | |||
oct_mach_info::float_format fmt); | oct_mach_info::float_format fmt); | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ | { | |||
// FIXME -- could be more memory efficient by having a | // FIXME: could be more memory efficient by having a | |||
// special case of the octave_stream::write method for ranges. | // special case of the octave_stream::write method for ranges. | |||
return os.write (matrix_value (), block_size, output_type, skip, | return os.write (matrix_value (), block_size, output_type, skip, flt_fm | |||
flt_fmt); | t); | |||
} | } | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
octave_value map (unary_mapper_t umap) const | octave_value map (unary_mapper_t umap) const | |||
{ | { | |||
octave_matrix m (matrix_value ()); | octave_matrix m (matrix_value ()); | |||
return m.map (umap); | return m.map (umap); | |||
} | } | |||
private: | private: | |||
Range range; | Range range; | |||
idx_vector set_idx_cache (const idx_vector& idx) const | idx_vector set_idx_cache (const idx_vector& idx) const | |||
{ | { | |||
delete idx_cache; | delete idx_cache; | |||
idx_cache = idx ? new idx_vector (idx) : 0; | idx_cache = idx ? new idx_vector (idx) : 0; | |||
return idx; | return idx; | |||
} | } | |||
void clear_cached_info (void) const | void clear_cached_info (void) const | |||
{ | { | |||
delete idx_cache; idx_cache = 0; | delete idx_cache; idx_cache = 0; | |||
} | } | |||
mutable idx_vector *idx_cache; | mutable idx_vector *idx_cache; | |||
// No assignment. | // No assignment. | |||
octave_range& operator = (const octave_range&); | octave_range& operator = (const octave_range&); | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |||
End of changes. 34 change blocks. | ||||
59 lines changed or deleted | 63 lines changed or added | |||
ov-re-diag.h | ov-re-diag.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_diag_matrix_h) | #if !defined (octave_ov_re_diag_h) | |||
#define octave_diag_matrix_h 1 | #define octave_ov_re_diag_h 1 | |||
#include "ov-base.h" | #include "ov-base.h" | |||
#include "ov-base-diag.h" | #include "ov-base-diag.h" | |||
#include "ov-re-mat.h" | #include "ov-re-mat.h" | |||
#include "ov-typeinfo.h" | #include "ov-typeinfo.h" | |||
// Real diagonal matrix values. | // Real diagonal matrix values. | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
skipping to change at line 51 | skipping to change at line 51 | |||
: octave_base_diag<DiagMatrix, Matrix> () { } | : octave_base_diag<DiagMatrix, Matrix> () { } | |||
octave_diag_matrix (const DiagMatrix& m) | octave_diag_matrix (const DiagMatrix& m) | |||
: octave_base_diag<DiagMatrix, Matrix> (m) { } | : octave_base_diag<DiagMatrix, Matrix> (m) { } | |||
octave_diag_matrix (const octave_diag_matrix& m) | octave_diag_matrix (const octave_diag_matrix& m) | |||
: octave_base_diag<DiagMatrix, Matrix> (m) { } | : octave_base_diag<DiagMatrix, Matrix> (m) { } | |||
~octave_diag_matrix (void) { } | ~octave_diag_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_diag_matrix (*t | octave_base_value *clone (void) const | |||
his); } | { return new octave_diag_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_diag_matr | octave_base_value *empty_clone (void) const | |||
ix (); } | { return new octave_diag_matrix (); } | |||
type_conv_info numeric_conversion_function (void) const; | type_conv_info numeric_conversion_function (void) const; | |||
type_conv_info numeric_demotion_function (void) const; | type_conv_info numeric_demotion_function (void) const; | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
End of changes. 3 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
ov-re-mat.h | ov-re-mat.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_matrix_h) | #if !defined (octave_ov_re_mat_h) | |||
#define octave_matrix_h 1 | #define octave_ov_re_mat_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 86 | skipping to change at line 86 | |||
octave_matrix (const ColumnVector& v) | octave_matrix (const ColumnVector& v) | |||
: octave_base_matrix<NDArray> (Matrix (v)) { } | : octave_base_matrix<NDArray> (Matrix (v)) { } | |||
octave_matrix (const octave_matrix& m) | octave_matrix (const octave_matrix& m) | |||
: octave_base_matrix<NDArray> (m) { } | : octave_base_matrix<NDArray> (m) { } | |||
octave_matrix (const Array<octave_idx_type>& idx, | octave_matrix (const Array<octave_idx_type>& idx, | |||
bool zero_based = false, bool cache_index = false) | bool zero_based = false, bool cache_index = false) | |||
: octave_base_matrix<NDArray> (NDArray (idx, zero_based)) | : octave_base_matrix<NDArray> (NDArray (idx, zero_based)) | |||
{ | { | |||
// Auto-create cache to speed up subsequent indexing. | // Auto-create cache to speed up subsequent indexing. | |||
if (zero_based && cache_index) | if (zero_based && cache_index) | |||
set_idx_cache (idx_vector (idx)); | set_idx_cache (idx_vector (idx)); | |||
} | } | |||
octave_matrix (const NDArray& nda, const idx_vector& cache) | octave_matrix (const NDArray& nda, const idx_vector& cache) | |||
: octave_base_matrix<NDArray> (nda) | : octave_base_matrix<NDArray> (nda) | |||
{ | { | |||
set_idx_cache (cache); | set_idx_cache (cache); | |||
} | } | |||
~octave_matrix (void) { } | ~octave_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_matrix (*this); } | octave_base_value *clone (void) const { return new octave_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_matrix () ; } | octave_base_value *empty_clone (void) const { return new octave_matrix () ; } | |||
type_conv_info numeric_demotion_function (void) const; | type_conv_info numeric_demotion_function (void) const; | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
idx_vector index_vector (void) const | idx_vector index_vector (void) const | |||
{ return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); } | { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); } | |||
builtin_type_t builtin_type (void) const { return btyp_double; } | builtin_type_t builtin_type (void) const { return btyp_double; } | |||
bool is_real_matrix (void) const { return true; } | bool is_real_matrix (void) const { return true; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
bool is_double_type (void) const { return true; } | bool is_double_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
skipping to change at line 149 | skipping to change at line 149 | |||
uint32_array_value (void) const { return uint32NDArray (matrix); } | uint32_array_value (void) const { return uint32NDArray (matrix); } | |||
uint64NDArray | uint64NDArray | |||
uint64_array_value (void) const { return uint64NDArray (matrix); } | uint64_array_value (void) const { return uint64NDArray (matrix); } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
float float_value (bool = false) const; | float float_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
Matrix matrix_value (bool = false) const; | Matrix matrix_value (bool = false) const; | |||
FloatMatrix float_matrix_value (bool = false) const; | FloatMatrix float_matrix_value (bool = false) const; | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
FloatComplex float_complex_value (bool = false) const; | FloatComplex float_complex_value (bool = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const; | ComplexMatrix complex_matrix_value (bool = false) const; | |||
skipping to change at line 181 | skipping to change at line 181 | |||
NDArray array_value (bool = false) const { return matrix; } | NDArray array_value (bool = false) const { return matrix; } | |||
FloatNDArray float_array_value (bool = false) const { return matrix; } | FloatNDArray float_array_value (bool = false) const { return matrix; } | |||
SparseMatrix sparse_matrix_value (bool = false) const; | SparseMatrix sparse_matrix_value (bool = false) const; | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; | |||
octave_value diag (octave_idx_type k = 0) const; | octave_value diag (octave_idx_type k = 0) const; | |||
octave_value diag (octave_idx_type m, octave_idx_type n) const; | ||||
octave_value reshape (const dim_vector& new_dims) const; | octave_value reshape (const dim_vector& new_dims) const; | |||
octave_value squeeze (void) const; | octave_value squeeze (void) const; | |||
octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst; | octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst; | |||
octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const; | sortmode mode = ASCENDING) const; | |||
sortmode is_sorted (sortmode mode = UNSORTED) const; | sortmode is_sorted (sortmode mode = UNSORTED) const; | |||
skipping to change at line 224 | skipping to change at line 226 | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ return os.write (matrix, block_size, output_type, skip, flt_fmt); } | { return os.write (matrix, block_size, output_type, skip, flt_fmt); } | |||
// Unsafe. This function exists to support the MEX interface. | // Unsafe. This function exists to support the MEX interface. | |||
// You should not use it anywhere else. | // You should not use it anywhere else. | |||
void *mex_get_data (void) const { return matrix.mex_get_data (); } | void *mex_get_data (void) const { return matrix.mex_get_data (); } | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
octave_value map (unary_mapper_t umap) const; | octave_value map (unary_mapper_t umap) const; | |||
private: | private: | |||
End of changes. 8 change blocks. | ||||
14 lines changed or deleted | 16 lines changed or added | |||
ov-re-sparse.h | ov-re-sparse.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_sparse_matrix_h) | #if !defined (octave_ov_re_sparse_h) | |||
#define octave_sparse_matrix_h 1 | #define octave_ov_re_sparse_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
skipping to change at line 88 | skipping to change at line 88 | |||
: octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | : octave_base_sparse<SparseMatrix> (SparseMatrix (m)) { } | |||
octave_sparse_matrix (const Sparse<double>& m, const MatrixType& t) | octave_sparse_matrix (const Sparse<double>& m, const MatrixType& t) | |||
: octave_base_sparse<SparseMatrix> (SparseMatrix (m), t) { } | : octave_base_sparse<SparseMatrix> (SparseMatrix (m), t) { } | |||
octave_sparse_matrix (const octave_sparse_matrix& m) | octave_sparse_matrix (const octave_sparse_matrix& m) | |||
: octave_base_sparse<SparseMatrix> (m) { } | : octave_base_sparse<SparseMatrix> (m) { } | |||
~octave_sparse_matrix (void) { } | ~octave_sparse_matrix (void) { } | |||
octave_base_value *clone (void) const { return new octave_sparse_matrix ( | octave_base_value *clone (void) const | |||
*this); } | { return new octave_sparse_matrix (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_sparse_ma | octave_base_value *empty_clone (void) const | |||
trix (); } | { return new octave_sparse_matrix (); } | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
idx_vector index_vector (void) const; | idx_vector index_vector (void) const; | |||
builtin_type_t builtin_type (void) const { return btyp_double; } | builtin_type_t builtin_type (void) const { return btyp_double; } | |||
bool is_real_matrix (void) const { return true; } | bool is_real_matrix (void) const { return true; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
bool is_double_type (void) const { return true; } | bool is_double_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return double_value (frc_str_conv); } | { return double_value (frc_str_conv); } | |||
Matrix matrix_value (bool = false) const; | Matrix matrix_value (bool = false) const; | |||
Complex complex_value (bool = false) const; | Complex complex_value (bool = false) const; | |||
boolNDArray bool_array_value (bool warn = false) const; | boolNDArray bool_array_value (bool warn = false) const; | |||
charNDArray char_array_value (bool = false) const; | charNDArray char_array_value (bool = false) const; | |||
ComplexMatrix complex_matrix_value (bool = false) const; | ComplexMatrix complex_matrix_value (bool = false) const; | |||
ComplexNDArray complex_array_value (bool = false) const; | ComplexNDArray complex_array_value (bool = false) const; | |||
NDArray array_value (bool = false) const; | NDArray array_value (bool = false) const; | |||
SparseMatrix sparse_matrix_value (bool = false) const | SparseMatrix sparse_matrix_value (bool = false) const | |||
{ return matrix; } | { return matrix; } | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |||
{ return SparseComplexMatrix (matrix); } | { return SparseComplexMatrix (matrix); } | |||
SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const; | SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const; | |||
octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | |||
#if 0 | #if 0 | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ return os.write (matrix, block_size, output_type, skip, flt_fmt); } | { return os.write (matrix, block_size, output_type, skip, flt_fmt); } | |||
#endif | #endif | |||
bool save_binary (std::ostream& os, bool& save_as_floats); | bool save_binary (std::ostream& os, bool& save_as_floats); | |||
bool load_binary (std::istream& is, bool swap, | bool load_binary (std::istream& is, bool swap, | |||
oct_mach_info::float_format fmt); | oct_mach_info::float_format fmt); | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
End of changes. 7 change blocks. | ||||
11 lines changed or deleted | 11 lines changed or added | |||
ov-scalar.h | ov-scalar.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_scalar_h) | #if !defined (octave_ov_scalar_h) | |||
#define octave_scalar_h 1 | #define octave_ov_scalar_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "lo-ieee.h" | #include "lo-ieee.h" | |||
#include "lo-mappers.h" | #include "lo-mappers.h" | |||
#include "lo-utils.h" | #include "lo-utils.h" | |||
#include "mx-base.h" | #include "mx-base.h" | |||
skipping to change at line 82 | skipping to change at line 82 | |||
octave_base_value *empty_clone (void) const { return new octave_matrix () ; } | octave_base_value *empty_clone (void) const { return new octave_matrix () ; } | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
type_conv_info numeric_demotion_function (void) const; | type_conv_info numeric_demotion_function (void) const; | |||
idx_vector index_vector (void) const { return idx_vector (scalar); } | idx_vector index_vector (void) const { return idx_vector (scalar); } | |||
octave_value any (int = 0) const | octave_value any (int = 0) const | |||
{ return (scalar != 0 && ! lo_ieee_isnan (scalar)); } | { return (scalar != 0 && ! lo_ieee_isnan (scalar)); } | |||
builtin_type_t builtin_type (void) const { return btyp_double; } | builtin_type_t builtin_type (void) const { return btyp_double; } | |||
bool is_real_scalar (void) const { return true; } | bool is_real_scalar (void) const { return true; } | |||
bool is_real_type (void) const { return true; } | bool is_real_type (void) const { return true; } | |||
bool is_double_type (void) const { return true; } | bool is_double_type (void) const { return true; } | |||
bool is_float_type (void) const { return true; } | bool is_float_type (void) const { return true; } | |||
int8NDArray | int8NDArray | |||
int8_array_value (void) const | int8_array_value (void) const | |||
{ return int8NDArray (dim_vector (1, 1), scalar); } | { return int8NDArray (dim_vector (1, 1), scalar); } | |||
int16NDArray | int16NDArray | |||
int16_array_value (void) const | int16_array_value (void) const | |||
{ return int16NDArray (dim_vector (1, 1), scalar); } | { return int16NDArray (dim_vector (1, 1), scalar); } | |||
int32NDArray | int32NDArray | |||
int32_array_value (void) const | int32_array_value (void) const | |||
{ return int32NDArray (dim_vector (1, 1), scalar); } | { return int32NDArray (dim_vector (1, 1), scalar); } | |||
int64NDArray | int64NDArray | |||
int64_array_value (void) const | int64_array_value (void) const | |||
{ return int64NDArray (dim_vector (1, 1), scalar); } | { return int64NDArray (dim_vector (1, 1), scalar); } | |||
uint8NDArray | uint8NDArray | |||
uint8_array_value (void) const | uint8_array_value (void) const | |||
{ return uint8NDArray (dim_vector (1, 1), scalar); } | { return uint8NDArray (dim_vector (1, 1), scalar); } | |||
uint16NDArray | uint16NDArray | |||
uint16_array_value (void) const | uint16_array_value (void) const | |||
{ return uint16NDArray (dim_vector (1, 1), scalar); } | { return uint16NDArray (dim_vector (1, 1), scalar); } | |||
uint32NDArray | uint32NDArray | |||
uint32_array_value (void) const | uint32_array_value (void) const | |||
{ return uint32NDArray (dim_vector (1, 1), scalar); } | { return uint32NDArray (dim_vector (1, 1), scalar); } | |||
uint64NDArray | uint64NDArray | |||
uint64_array_value (void) const | uint64_array_value (void) const | |||
{ return uint64NDArray (dim_vector (1, 1), scalar); } | { return uint64NDArray (dim_vector (1, 1), scalar); } | |||
#define DEFINE_INT_SCALAR_VALUE(TYPE) \ | #define DEFINE_INT_SCALAR_VALUE(TYPE) \ | |||
octave_ ## TYPE \ | octave_ ## TYPE \ | |||
TYPE ## _scalar_value (void) const \ | TYPE ## _scalar_value (void) const \ | |||
{ return octave_ ## TYPE (scalar); } | { return octave_ ## TYPE (scalar); } | |||
DEFINE_INT_SCALAR_VALUE (int8) | DEFINE_INT_SCALAR_VALUE (int8) | |||
DEFINE_INT_SCALAR_VALUE (int16) | DEFINE_INT_SCALAR_VALUE (int16) | |||
DEFINE_INT_SCALAR_VALUE (int32) | DEFINE_INT_SCALAR_VALUE (int32) | |||
DEFINE_INT_SCALAR_VALUE (int64) | DEFINE_INT_SCALAR_VALUE (int64) | |||
DEFINE_INT_SCALAR_VALUE (uint8) | DEFINE_INT_SCALAR_VALUE (uint8) | |||
DEFINE_INT_SCALAR_VALUE (uint16) | DEFINE_INT_SCALAR_VALUE (uint16) | |||
DEFINE_INT_SCALAR_VALUE (uint32) | DEFINE_INT_SCALAR_VALUE (uint32) | |||
DEFINE_INT_SCALAR_VALUE (uint64) | DEFINE_INT_SCALAR_VALUE (uint64) | |||
#undef DEFINE_INT_SCALAR_VALUE | #undef DEFINE_INT_SCALAR_VALUE | |||
double double_value (bool = false) const { return scalar; } | double double_value (bool = false) const { return scalar; } | |||
float float_value (bool = false) const { return static_cast<float> (scala | float float_value (bool = false) const | |||
r); } | { return static_cast<float> (scalar); } | |||
double scalar_value (bool = false) const { return scalar; } | double scalar_value (bool = false) const { return scalar; } | |||
float float_scalar_value (bool = false) const { return static_cast<float> | float float_scalar_value (bool = false) const | |||
(scalar); } | { return static_cast<float> (scalar); } | |||
Matrix matrix_value (bool = false) const | Matrix matrix_value (bool = false) const | |||
{ return Matrix (1, 1, scalar); } | { return Matrix (1, 1, scalar); } | |||
FloatMatrix float_matrix_value (bool = false) const | FloatMatrix float_matrix_value (bool = false) const | |||
{ return FloatMatrix (1, 1, scalar); } | { return FloatMatrix (1, 1, scalar); } | |||
NDArray array_value (bool = false) const | NDArray array_value (bool = false) const | |||
{ return NDArray (dim_vector (1, 1), scalar); } | { return NDArray (dim_vector (1, 1), scalar); } | |||
FloatNDArray float_array_value (bool = false) const | FloatNDArray float_array_value (bool = false) const | |||
{ return FloatNDArray (dim_vector (1, 1), scalar); } | { return FloatNDArray (dim_vector (1, 1), scalar); } | |||
SparseMatrix sparse_matrix_value (bool = false) const | SparseMatrix sparse_matrix_value (bool = false) const | |||
{ return SparseMatrix (Matrix (1, 1, scalar)); } | { return SparseMatrix (Matrix (1, 1, scalar)); } | |||
// FIXME Need SparseComplexMatrix (Matrix) constructor!!! | // FIXME Need SparseComplexMatrix (Matrix) constructor!!! | |||
SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | SparseComplexMatrix sparse_complex_matrix_value (bool = false) const | |||
{ return SparseComplexMatrix (sparse_matrix_value ()); } | { return SparseComplexMatrix (sparse_matrix_value ()); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const; | octave_value resize (const dim_vector& dv, bool fill = false) const; | |||
Complex complex_value (bool = false) const { return scalar; } | Complex complex_value (bool = false) const { return scalar; } | |||
FloatComplex float_complex_value (bool = false) const { return scalar; } | FloatComplex float_complex_value (bool = false) const { return scalar; } | |||
ComplexMatrix complex_matrix_value (bool = false) const | ComplexMatrix complex_matrix_value (bool = false) const | |||
{ return ComplexMatrix (1, 1, Complex (scalar)); } | { return ComplexMatrix (1, 1, Complex (scalar)); } | |||
FloatComplexMatrix float_complex_matrix_value (bool = false) const | FloatComplexMatrix float_complex_matrix_value (bool = false) const | |||
{ return FloatComplexMatrix (1, 1, FloatComplex (scalar)); } | { return FloatComplexMatrix (1, 1, FloatComplex (scalar)); } | |||
ComplexNDArray complex_array_value (bool = false) const | ComplexNDArray complex_array_value (bool = false) const | |||
{ return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); } | { return ComplexNDArray (dim_vector (1, 1), Complex (scalar)); } | |||
FloatComplexNDArray float_complex_array_value (bool = false) const | FloatComplexNDArray float_complex_array_value (bool = false) const | |||
{ return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)) ; } | { return FloatComplexNDArray (dim_vector (1, 1), FloatComplex (scalar)); } | |||
charNDArray | charNDArray | |||
char_array_value (bool = false) const | char_array_value (bool = false) const | |||
{ | { | |||
charNDArray retval (dim_vector (1, 1)); | charNDArray retval (dim_vector (1, 1)); | |||
retval(0) = static_cast<char> (scalar); | retval(0) = static_cast<char> (scalar); | |||
return retval; | return retval; | |||
} | } | |||
bool bool_value (bool warn = false) const | bool bool_value (bool warn = false) const | |||
skipping to change at line 215 | skipping to change at line 217 | |||
boolNDArray bool_array_value (bool warn = false) const | boolNDArray bool_array_value (bool warn = false) const | |||
{ | { | |||
if (xisnan (scalar)) | if (xisnan (scalar)) | |||
gripe_nan_to_logical_conversion (); | gripe_nan_to_logical_conversion (); | |||
else if (warn && scalar != 0 && scalar != 1) | else if (warn && scalar != 0 && scalar != 1) | |||
gripe_logical_conversion (); | gripe_logical_conversion (); | |||
return boolNDArray (dim_vector (1, 1), scalar); | return boolNDArray (dim_vector (1, 1), scalar); | |||
} | } | |||
octave_value diag (octave_idx_type m, octave_idx_type n) const; | ||||
octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | octave_value convert_to_str_internal (bool pad, bool force, char type) co nst; | |||
void increment (void) { ++scalar; } | void increment (void) { ++scalar; } | |||
void decrement (void) { --scalar; } | void decrement (void) { --scalar; } | |||
bool save_ascii (std::ostream& os); | bool save_ascii (std::ostream& os); | |||
bool load_ascii (std::istream& is); | bool load_ascii (std::istream& is); | |||
skipping to change at line 239 | skipping to change at line 243 | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ | { | |||
return os.write (array_value (), block_size, output_type, | return os.write (array_value (), block_size, output_type, | |||
skip, flt_fmt); | skip, flt_fmt); | |||
} | } | |||
mxArray *as_mxArray (void) const; | mxArray *as_mxArray (void) const; | |||
octave_value map (unary_mapper_t umap) const; | octave_value map (unary_mapper_t umap) const; | |||
bool fast_elem_insert_self (void *where, builtin_type_t btyp) const; | bool fast_elem_insert_self (void *where, builtin_type_t btyp) const; | |||
private: | private: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
End of changes. 25 change blocks. | ||||
30 lines changed or deleted | 32 lines changed or added | |||
ov-str-mat.h | ov-str-mat.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_char_matrix_str_h) | #if !defined (octave_ov_str_mat_h) | |||
#define octave_char_matrix_str_h 1 | #define octave_ov_str_mat_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "error.h" | #include "error.h" | |||
skipping to change at line 87 | skipping to change at line 87 | |||
: octave_char_matrix (s) { } | : octave_char_matrix (s) { } | |||
octave_char_matrix_str (const octave_char_matrix& chm) | octave_char_matrix_str (const octave_char_matrix& chm) | |||
: octave_char_matrix (chm) { } | : octave_char_matrix (chm) { } | |||
octave_char_matrix_str (const octave_char_matrix_str& chms) | octave_char_matrix_str (const octave_char_matrix_str& chms) | |||
: octave_char_matrix (chms) { } | : octave_char_matrix (chms) { } | |||
~octave_char_matrix_str (void) { } | ~octave_char_matrix_str (void) { } | |||
octave_base_value *clone (void) const { return new octave_char_matrix_str | octave_base_value *clone (void) const | |||
(*this); } | { return new octave_char_matrix_str (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_char_matr | octave_base_value *empty_clone (void) const | |||
ix_str (); } | { return new octave_char_matrix_str (); } | |||
type_conv_info numeric_conversion_function (void) const; | type_conv_info numeric_conversion_function (void) const; | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false) | bool resize_ok = false) | |||
{ return do_index_op_internal (idx, resize_ok); } | { return do_index_op_internal (idx, resize_ok); } | |||
octave_value squeeze (void) const | octave_value squeeze (void) const | |||
{ return octave_value (charNDArray (matrix.squeeze ())); } | { return octave_value (charNDArray (matrix.squeeze ())); } | |||
octave_value reshape (const dim_vector& new_dims) const | octave_value reshape (const dim_vector& new_dims) const | |||
{ return octave_value (charNDArray (matrix.reshape (new_dims))); } | { return octave_value (charNDArray (matrix.reshape (new_dims))); } | |||
octave_value permute (const Array<int>& vec, bool inv = false) const | octave_value permute (const Array<int>& vec, bool inv = false) const | |||
{ return octave_value (charNDArray (matrix.permute (vec, inv))); } | { return octave_value (charNDArray (matrix.permute (vec, inv))); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const; | octave_value resize (const dim_vector& dv, bool fill = false) const; | |||
octave_value diag (octave_idx_type k = 0) const | octave_value diag (octave_idx_type k = 0) const | |||
{ return octave_value (matrix.diag (k)); } | { return octave_value (matrix.diag (k)); } | |||
bool is_string (void) const { return true; } | bool is_string (void) const { return true; } | |||
bool is_numeric_type (void) const { return false; } | bool is_numeric_type (void) const { return false; } | |||
double double_value (bool = false) const; | double double_value (bool = false) const; | |||
Matrix matrix_value (bool = false) const; | Matrix matrix_value (bool = false) const; | |||
NDArray array_value (bool = false) const; | NDArray array_value (bool = false) const; | |||
skipping to change at line 133 | skipping to change at line 135 | |||
ComplexNDArray complex_array_value (bool = false) const; | ComplexNDArray complex_array_value (bool = false) const; | |||
string_vector all_strings (bool pad = false) const; | string_vector all_strings (bool pad = false) const; | |||
std::string string_value (bool force = false) const; | std::string string_value (bool force = false) const; | |||
Array<std::string> cellstr_value (void) const; | Array<std::string> cellstr_value (void) const; | |||
octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | |||
{ return octave_value (matrix.sort (dim, mode)); } | { return octave_value (matrix.sort (dim, mode)); } | |||
octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const | sortmode mode = ASCENDING) const | |||
{ return octave_value (matrix.sort (sidx, dim, mode)); } | { return octave_value (matrix.sort (sidx, dim, mode)); } | |||
bool print_as_scalar (void) const { return (rows () <= 1); } | bool print_as_scalar (void) const { return (rows () <= 1); } | |||
void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; | |||
void short_disp (std::ostream& os) const; | ||||
bool save_ascii (std::ostream& os); | bool save_ascii (std::ostream& os); | |||
bool load_ascii (std::istream& is); | bool load_ascii (std::istream& is); | |||
bool save_binary (std::ostream& os, bool& save_as_floats); | bool save_binary (std::ostream& os, bool& save_as_floats); | |||
bool load_binary (std::istream& is, bool swap, | bool load_binary (std::istream& is, bool swap, | |||
oct_mach_info::float_format fmt); | oct_mach_info::float_format fmt); | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |||
bool load_hdf5 (hid_t loc_id, const char *name); | bool load_hdf5 (hid_t loc_id, const char *name); | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const | oct_mach_info::float_format flt_fmt) const | |||
{ return os.write (matrix, block_size, output_type, skip, flt_fmt); } | { return os.write (matrix, block_size, output_type, skip, flt_fmt); } | |||
protected: | protected: | |||
octave_value do_index_op_internal (const octave_value_list& idx, | octave_value do_index_op_internal (const octave_value_list& idx, | |||
bool resize_ok, char type = '"'); | bool resize_ok, char type = '"'); | |||
private: | private: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
skipping to change at line 214 | skipping to change at line 218 | |||
: octave_char_matrix_str (s) { } | : octave_char_matrix_str (s) { } | |||
octave_char_matrix_sq_str (const octave_char_matrix_str& chm) | octave_char_matrix_sq_str (const octave_char_matrix_str& chm) | |||
: octave_char_matrix_str (chm) { } | : octave_char_matrix_str (chm) { } | |||
octave_char_matrix_sq_str (const octave_char_matrix_sq_str& chms) | octave_char_matrix_sq_str (const octave_char_matrix_sq_str& chms) | |||
: octave_char_matrix_str (chms) { } | : octave_char_matrix_str (chms) { } | |||
~octave_char_matrix_sq_str (void) { } | ~octave_char_matrix_sq_str (void) { } | |||
octave_base_value *clone (void) const { return new octave_char_matrix_sq_ | octave_base_value *clone (void) const | |||
str (*this); } | { return new octave_char_matrix_sq_str (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_char_matr | octave_base_value *empty_clone (void) const | |||
ix_sq_str (); } | { return new octave_char_matrix_sq_str (); } | |||
octave_value squeeze (void) const | octave_value squeeze (void) const | |||
{ return octave_value (charNDArray (matrix.squeeze ()), '\''); } | { return octave_value (charNDArray (matrix.squeeze ()), '\''); } | |||
octave_value reshape (const dim_vector& new_dims) const | octave_value reshape (const dim_vector& new_dims) const | |||
{ return octave_value (charNDArray (matrix.reshape (new_dims)), '\''); } | { return octave_value (charNDArray (matrix.reshape (new_dims)), '\''); } | |||
octave_value permute (const Array<int>& vec, bool inv = false) const | octave_value permute (const Array<int>& vec, bool inv = false) const | |||
{ return octave_value (charNDArray (matrix.permute (vec, inv)), '\''); } | { return octave_value (charNDArray (matrix.permute (vec, inv)), '\''); } | |||
octave_value resize (const dim_vector& dv, bool = false) const | octave_value resize (const dim_vector& dv, bool = false) const | |||
{ | { | |||
charNDArray retval (matrix); | charNDArray retval (matrix); | |||
retval.resize (dv); | retval.resize (dv); | |||
return octave_value (retval, '\''); | return octave_value (retval, '\''); | |||
} | } | |||
octave_value diag (octave_idx_type k = 0) const | octave_value diag (octave_idx_type k = 0) const | |||
{ return octave_value (matrix.diag (k), '\''); } | { return octave_value (matrix.diag (k), '\''); } | |||
bool is_sq_string (void) const { return true; } | bool is_sq_string (void) const { return true; } | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false) | bool resize_ok = false) | |||
{ return do_index_op_internal (idx, resize_ok, '\''); } | { return do_index_op_internal (idx, resize_ok, '\''); } | |||
octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | |||
{ return octave_value (matrix.sort (dim, mode), '\''); } | { return octave_value (matrix.sort (dim, mode), '\''); } | |||
octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const | sortmode mode = ASCENDING) const | |||
{ return octave_value (matrix.sort (sidx, dim, mode), '\''); } | { return octave_value (matrix.sort (sidx, dim, mode), '\''); } | |||
private: | private: | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 21 change blocks. | ||||
31 lines changed or deleted | 33 lines changed or added | |||
ov-struct.h | ov-struct.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_struct_h) | #if !defined (octave_ov_struct_h) | |||
#define octave_struct_h 1 | #define octave_ov_struct_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "error.h" | #include "error.h" | |||
skipping to change at line 71 | skipping to change at line 71 | |||
octave_base_value *clone (void) const { return new octave_struct (*this); } | octave_base_value *clone (void) const { return new octave_struct (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_struct () ; } | octave_base_value *empty_clone (void) const { return new octave_struct () ; } | |||
octave_base_value *try_narrowing_conversion (void); | octave_base_value *try_narrowing_conversion (void); | |||
Cell dotref (const octave_value_list& idx, bool auto_add = false); | Cell dotref (const octave_value_list& idx, bool auto_add = false); | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx) | const std::list<octave_value_list>& idx) | |||
{ | { | |||
octave_value_list tmp = subsref (type, idx, 1); | octave_value_list tmp = subsref (type, idx, 1); | |||
return tmp.length () > 0 ? tmp(0) : octave_value (); | return tmp.length () > 0 ? tmp(0) : octave_value (); | |||
} | } | |||
octave_value_list subsref (const std::string&, | octave_value_list subsref (const std::string&, | |||
const std::list<octave_value_list>&, int); | const std::list<octave_value_list>&, int); | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
bool auto_add); | bool auto_add); | |||
static octave_value numeric_conv (const octave_value& val, | static octave_value numeric_conv (const octave_value& val, | |||
const std::string& type); | const std::string& type); | |||
octave_value subsasgn (const std::string& type, | octave_value subsasgn (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
const octave_value& rhs); | const octave_value& rhs); | |||
octave_value squeeze (void) const { return map.squeeze (); } | octave_value squeeze (void) const { return map.squeeze (); } | |||
octave_value permute (const Array<int>& vec, bool inv = false) const | octave_value permute (const Array<int>& vec, bool inv = false) const | |||
{ return map.permute (vec, inv); } | { return map.permute (vec, inv); } | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
dim_vector dims (void) const { return map.dims (); } | dim_vector dims (void) const { return map.dims (); } | |||
size_t byte_size (void) const; | size_t byte_size (void) const; | |||
// This is the number of elements in each field. The total number | // This is the number of elements in each field. The total number | |||
// of elements is numel () * nfields (). | // of elements is numel () * nfields (). | |||
octave_idx_type numel (void) const | octave_idx_type numel (void) const | |||
{ | { | |||
return map.numel (); | return map.numel (); | |||
} | } | |||
octave_idx_type nfields (void) const { return map.nfields (); } | octave_idx_type nfields (void) const { return map.nfields (); } | |||
octave_value reshape (const dim_vector& new_dims) const | octave_value reshape (const dim_vector& new_dims) const | |||
{ return map.reshape (new_dims); } | { return map.reshape (new_dims); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const | octave_value resize (const dim_vector& dv, bool fill = false) const | |||
{ octave_map tmap = map; tmap.resize (dv, fill); return tmap; } | { octave_map tmap = map; tmap.resize (dv, fill); return tmap; } | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
bool is_constant (void) const { return true; } | bool is_constant (void) const { return true; } | |||
bool is_map (void) const { return true; } | bool is_map (void) const { return true; } | |||
builtin_type_t builtin_type (void) const { return btyp_struct; } | builtin_type_t builtin_type (void) const { return btyp_struct; } | |||
octave_map map_value (void) const { return map; } | octave_map map_value (void) const { return map; } | |||
skipping to change at line 186 | skipping to change at line 186 | |||
: octave_base_value (), map () { } | : octave_base_value (), map () { } | |||
octave_scalar_struct (const octave_scalar_map& m) | octave_scalar_struct (const octave_scalar_map& m) | |||
: octave_base_value (), map (m) { } | : octave_base_value (), map (m) { } | |||
octave_scalar_struct (const octave_scalar_struct& s) | octave_scalar_struct (const octave_scalar_struct& s) | |||
: octave_base_value (), map (s.map) { } | : octave_base_value (), map (s.map) { } | |||
~octave_scalar_struct (void) { } | ~octave_scalar_struct (void) { } | |||
octave_base_value *clone (void) const { return new octave_scalar_struct ( | octave_base_value *clone (void) const | |||
*this); } | { return new octave_scalar_struct (*this); } | |||
octave_base_value *empty_clone (void) const { return new octave_scalar_st | octave_base_value *empty_clone (void) const | |||
ruct (); } | { return new octave_scalar_struct (); } | |||
octave_value dotref (const octave_value_list& idx, bool auto_add = false) ; | octave_value dotref (const octave_value_list& idx, bool auto_add = false) ; | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx); | const std::list<octave_value_list>& idx); | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, int); | const std::list<octave_value_list>& idx, int); | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
skipping to change at line 211 | skipping to change at line 213 | |||
static octave_value numeric_conv (const octave_value& val, | static octave_value numeric_conv (const octave_value& val, | |||
const std::string& type); | const std::string& type); | |||
octave_value subsasgn (const std::string& type, | octave_value subsasgn (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
const octave_value& rhs); | const octave_value& rhs); | |||
octave_value squeeze (void) const { return map; } | octave_value squeeze (void) const { return map; } | |||
octave_value permute (const Array<int>& vec, bool inv = false) const | octave_value permute (const Array<int>& vec, bool inv = false) const | |||
{ return octave_map (map).permute (vec, inv); } | { return octave_map (map).permute (vec, inv); } | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false); | bool resize_ok = false); | |||
dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; } | dim_vector dims (void) const { static dim_vector dv (1, 1); return dv; } | |||
size_t byte_size (void) const; | size_t byte_size (void) const; | |||
// This is the number of elements in each field. The total number | // This is the number of elements in each field. The total number | |||
// of elements is numel () * nfields (). | // of elements is numel () * nfields (). | |||
octave_idx_type numel (void) const | octave_idx_type numel (void) const | |||
{ | { | |||
return 1; | return 1; | |||
} | } | |||
octave_idx_type nfields (void) const { return map.nfields (); } | octave_idx_type nfields (void) const { return map.nfields (); } | |||
octave_value reshape (const dim_vector& new_dims) const | octave_value reshape (const dim_vector& new_dims) const | |||
{ return octave_map (map).reshape (new_dims); } | { return octave_map (map).reshape (new_dims); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const | octave_value resize (const dim_vector& dv, bool fill = false) const | |||
{ octave_map tmap = map; tmap.resize (dv, fill); return tmap; } | { octave_map tmap = map; tmap.resize (dv, fill); return tmap; } | |||
bool is_defined (void) const { return true; } | bool is_defined (void) const { return true; } | |||
bool is_constant (void) const { return true; } | bool is_constant (void) const { return true; } | |||
bool is_map (void) const { return true; } | bool is_map (void) const { return true; } | |||
builtin_type_t builtin_type (void) const { return btyp_struct; } | builtin_type_t builtin_type (void) const { return btyp_struct; } | |||
octave_map map_value (void) const { return map; } | octave_map map_value (void) const { return map; } | |||
End of changes. 10 change blocks. | ||||
17 lines changed or deleted | 17 lines changed or added | |||
ov-type-conv.h | ov-type-conv.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 28 | skipping to change at line 28 | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_ov_type_conv_h) | #if !defined (octave_ov_type_conv_h) | |||
#define octave_ov_type_conv_h 1 | #define octave_ov_type_conv_h 1 | |||
static | static | |||
octave_value | octave_value | |||
octave_type_conv_body (const octave_value &arg, const std::string& name, in | octave_type_conv_body (const octave_value &arg, const std::string& name, | |||
t t_result) | int t_result) | |||
{ | { | |||
int t_arg = arg.type_id (); | int t_arg = arg.type_id (); | |||
octave_value retval; | octave_value retval; | |||
if (t_arg == t_result || arg.class_name () == name) | if (t_arg == t_result || arg.class_name () == name) | |||
{ | { | |||
retval = arg; | retval = arg; | |||
} | } | |||
else | else | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ov-typeinfo.h | ov-typeinfo.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_value_typeinfo_h) | #if !defined (octave_ov_typeinfo_h) | |||
#define octave_value_typeinfo_h 1 | #define octave_ov_typeinfo_h 1 | |||
#include <string> | #include <string> | |||
#include "Array.h" | #include "Array.h" | |||
#include "ov.h" | #include "ov.h" | |||
class string_vector; | class string_vector; | |||
class | class | |||
skipping to change at line 304 | skipping to change at line 304 | |||
non_const_unary_op_fcn do_lookup_non_const_unary_op | non_const_unary_op_fcn do_lookup_non_const_unary_op | |||
(octave_value::unary_op, int); | (octave_value::unary_op, int); | |||
binary_class_op_fcn do_lookup_binary_class_op (octave_value::binary_op); | binary_class_op_fcn do_lookup_binary_class_op (octave_value::binary_op); | |||
binary_op_fcn do_lookup_binary_op (octave_value::binary_op, int, int); | binary_op_fcn do_lookup_binary_op (octave_value::binary_op, int, int); | |||
binary_class_op_fcn do_lookup_binary_class_op (octave_value::compound_bin ary_op); | binary_class_op_fcn do_lookup_binary_class_op (octave_value::compound_bin ary_op); | |||
binary_op_fcn do_lookup_binary_op (octave_value::compound_binary_op, int, | binary_op_fcn do_lookup_binary_op (octave_value::compound_binary_op, | |||
int); | int, int); | |||
cat_op_fcn do_lookup_cat_op (int, int); | cat_op_fcn do_lookup_cat_op (int, int); | |||
assign_op_fcn do_lookup_assign_op (octave_value::assign_op, int, int); | assign_op_fcn do_lookup_assign_op (octave_value::assign_op, int, int); | |||
assignany_op_fcn do_lookup_assignany_op (octave_value::assign_op, int); | assignany_op_fcn do_lookup_assignany_op (octave_value::assign_op, int); | |||
int do_lookup_pref_assign_conv (int, int); | int do_lookup_pref_assign_conv (int, int); | |||
octave_base_value::type_conv_fcn do_lookup_type_conv_op (int, int); | octave_base_value::type_conv_fcn do_lookup_type_conv_op (int, int); | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
ov-uint16.h | ov-uint16.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_uint16_h) | #if !defined (octave_ov_uint16_h) | |||
#define octave_uint16_h 1 | #define octave_ov_uint16_h 1 | |||
#define OCTAVE_INT_T octave_uint16 | #define OCTAVE_INT_T octave_uint16 | |||
#define OCTAVE_VALUE_INT_MATRIX_T octave_uint16_matrix | #define OCTAVE_VALUE_INT_MATRIX_T octave_uint16_matrix | |||
#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint16_array_value | #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint16_array_value | |||
#define OCTAVE_VALUE_INT_SCALAR_T octave_uint16_scalar | #define OCTAVE_VALUE_INT_SCALAR_T octave_uint16_scalar | |||
#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint16_scalar_value | #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint16_scalar_value | |||
#define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint16_type | #define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint16_type | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ov-uint32.h | ov-uint32.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_uint32_h) | #if !defined (octave_ov_uint32_h) | |||
#define octave_uint32_h 1 | #define octave_ov_uint32_h 1 | |||
#define OCTAVE_INT_T octave_uint32 | #define OCTAVE_INT_T octave_uint32 | |||
#define OCTAVE_VALUE_INT_MATRIX_T octave_uint32_matrix | #define OCTAVE_VALUE_INT_MATRIX_T octave_uint32_matrix | |||
#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint32_array_value | #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint32_array_value | |||
#define OCTAVE_VALUE_INT_SCALAR_T octave_uint32_scalar | #define OCTAVE_VALUE_INT_SCALAR_T octave_uint32_scalar | |||
#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint32_scalar_value | #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint32_scalar_value | |||
#define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint32_type | #define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint32_type | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ov-uint64.h | ov-uint64.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_uint64_h) | #if !defined (octave_ov_uint64_h) | |||
#define octave_uint64_h 1 | #define octave_ov_uint64_h 1 | |||
#define OCTAVE_INT_T octave_uint64 | #define OCTAVE_INT_T octave_uint64 | |||
#define OCTAVE_VALUE_INT_MATRIX_T octave_uint64_matrix | #define OCTAVE_VALUE_INT_MATRIX_T octave_uint64_matrix | |||
#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint64_array_value | #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint64_array_value | |||
#define OCTAVE_VALUE_INT_SCALAR_T octave_uint64_scalar | #define OCTAVE_VALUE_INT_SCALAR_T octave_uint64_scalar | |||
#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint64_scalar_value | #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint64_scalar_value | |||
#define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint64_type | #define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint64_type | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ov-uint8.h | ov-uint8.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_uint8_h) | #if !defined (octave_ov_uint8_h) | |||
#define octave_uint8_h 1 | #define octave_ov_uint8_h 1 | |||
#define OCTAVE_INT_T octave_uint8 | #define OCTAVE_INT_T octave_uint8 | |||
#define OCTAVE_VALUE_INT_MATRIX_T octave_uint8_matrix | #define OCTAVE_VALUE_INT_MATRIX_T octave_uint8_matrix | |||
#define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint8_array_value | #define OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION uint8_array_value | |||
#define OCTAVE_VALUE_INT_SCALAR_T octave_uint8_scalar | #define OCTAVE_VALUE_INT_SCALAR_T octave_uint8_scalar | |||
#define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint8_scalar_value | #define OCTAVE_VALUE_INT_SCALAR_EXTRACTOR_FUNCTION uint8_scalar_value | |||
#define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint8_type | #define OCTAVE_TYPE_PREDICATE_FUNCTION is_uint8_type | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
ov-usr-fcn.h | ov-usr-fcn.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_user_function_h) | #if !defined (octave_ov_usr_fcn_h) | |||
#define octave_user_function_h 1 | #define octave_ov_usr_fcn_h 1 | |||
#include <ctime> | #include <ctime> | |||
#include <string> | #include <string> | |||
#include <stack> | #include <stack> | |||
#include "comment-list.h" | #include "comment-list.h" | |||
#include "oct-obj.h" | #include "oct-obj.h" | |||
#include "ov-fcn.h" | #include "ov-fcn.h" | |||
#include "ov-typeinfo.h" | #include "ov-typeinfo.h" | |||
#include "symtab.h" | #include "symtab.h" | |||
#include "unwind-prot.h" | #include "unwind-prot.h" | |||
class string_vector; | class string_vector; | |||
class octave_value; | class octave_value; | |||
class tree_parameter_list; | class tree_parameter_list; | |||
class tree_statement_list; | class tree_statement_list; | |||
class tree_va_return_list; | class tree_va_return_list; | |||
class tree_expression; | ||||
class tree_walker; | class tree_walker; | |||
#ifdef HAVE_LLVM | ||||
class jit_function_info; | ||||
#endif | ||||
class | class | |||
octave_user_code : public octave_function | octave_user_code : public octave_function | |||
{ | { | |||
public: | public: | |||
octave_user_code (void) | octave_user_code (void) | |||
: octave_function () { } | : octave_function () { } | |||
~octave_user_code (void) { } | ~octave_user_code (void) { } | |||
bool is_user_code (void) const { return true; } | bool is_user_code (void) const { return true; } | |||
virtual std::map<std::string, octave_value> subfunctions (void) const; | ||||
virtual tree_statement_list *body (void) = 0; | virtual tree_statement_list *body (void) = 0; | |||
protected: | protected: | |||
octave_user_code (const std::string& nm, | octave_user_code (const std::string& nm, | |||
const std::string& ds = std::string ()) | const std::string& ds = std::string ()) | |||
: octave_function (nm, ds) { } | : octave_function (nm, ds) { } | |||
private: | private: | |||
skipping to change at line 108 | skipping to change at line 115 | |||
// Scripts and user functions are both considered "scripts" because | // Scripts and user functions are both considered "scripts" because | |||
// they are written in Octave's scripting language. | // they are written in Octave's scripting language. | |||
bool is_user_script (void) const { return true; } | bool is_user_script (void) const { return true; } | |||
void stash_fcn_file_name (const std::string& nm) { file_name = nm; } | void stash_fcn_file_name (const std::string& nm) { file_name = nm; } | |||
void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; } | void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; } | |||
void stash_fcn_file_time (const octave_time& t) | void stash_fcn_file_time (const octave_time& t) | |||
{ | { | |||
t_parsed = t; | t_parsed = t; | |||
mark_fcn_file_up_to_date (t); | mark_fcn_file_up_to_date (t); | |||
} | } | |||
std::string fcn_file_name (void) const { return file_name; } | std::string fcn_file_name (void) const { return file_name; } | |||
octave_time time_parsed (void) const { return t_parsed; } | octave_time time_parsed (void) const { return t_parsed; } | |||
octave_time time_checked (void) const { return t_checked; } | octave_time time_checked (void) const { return t_checked; } | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx) | const std::list<octave_value_list>& idx) | |||
{ | { | |||
octave_value_list tmp = subsref (type, idx, 1); | octave_value_list tmp = subsref (type, idx, 1); | |||
return tmp.length () > 0 ? tmp(0) : octave_value (); | return tmp.length () > 0 ? tmp(0) : octave_value (); | |||
} | } | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
int nargout); | int nargout); | |||
octave_value_list | octave_value_list | |||
do_multi_index_op (int nargout, const octave_value_list& args); | do_multi_index_op (int nargout, const octave_value_list& args); | |||
tree_statement_list *body (void) { return cmd_list; } | tree_statement_list *body (void) { return cmd_list; } | |||
skipping to change at line 180 | skipping to change at line 187 | |||
{ | { | |||
public: | public: | |||
octave_user_function (symbol_table::scope_id sid = -1, | octave_user_function (symbol_table::scope_id sid = -1, | |||
tree_parameter_list *pl = 0, | tree_parameter_list *pl = 0, | |||
tree_parameter_list *rl = 0, | tree_parameter_list *rl = 0, | |||
tree_statement_list *cl = 0); | tree_statement_list *cl = 0); | |||
~octave_user_function (void); | ~octave_user_function (void); | |||
symbol_table::context_id active_context () const | ||||
{ | ||||
return is_anonymous_function () | ||||
? 0 : static_cast<symbol_table::context_id>(call_depth); | ||||
} | ||||
octave_function *function_value (bool = false) { return this; } | octave_function *function_value (bool = false) { return this; } | |||
octave_user_function *user_function_value (bool = false) { return this; } | octave_user_function *user_function_value (bool = false) { return this; } | |||
octave_user_code *user_code_value (bool = false) { return this; } | octave_user_code *user_code_value (bool = false) { return this; } | |||
octave_user_function *define_param_list (tree_parameter_list *t); | octave_user_function *define_param_list (tree_parameter_list *t); | |||
octave_user_function *define_ret_list (tree_parameter_list *t); | octave_user_function *define_ret_list (tree_parameter_list *t); | |||
void stash_fcn_file_name (const std::string& nm); | void stash_fcn_file_name (const std::string& nm); | |||
void stash_fcn_location (int line, int col) | void stash_fcn_location (int line, int col) | |||
{ | { | |||
location_line = line; | location_line = line; | |||
location_column = col; | location_column = col; | |||
} | } | |||
int beginning_line (void) const { return location_line; } | ||||
int beginning_column (void) const { return location_column; } | ||||
void stash_fcn_end_location (int line, int col) | ||||
{ | ||||
end_location_line = line; | ||||
end_location_column = col; | ||||
} | ||||
int ending_line (void) const { return end_location_line; } | ||||
int ending_column (void) const { return end_location_column; } | ||||
void maybe_relocate_end (void); | ||||
void stash_parent_fcn_name (const std::string& p) { parent_name = p; } | void stash_parent_fcn_name (const std::string& p) { parent_name = p; } | |||
void stash_parent_fcn_scope (symbol_table::scope_id ps) { parent_scope = ps; } | void stash_parent_fcn_scope (symbol_table::scope_id ps) { parent_scope = ps; } | |||
void stash_leading_comment (octave_comment_list *lc) { lead_comm = lc; } | void stash_leading_comment (octave_comment_list *lc) { lead_comm = lc; } | |||
void stash_trailing_comment (octave_comment_list *tc) { trail_comm = tc; } | void stash_trailing_comment (octave_comment_list *tc) { trail_comm = tc; } | |||
void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; } | void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; } | |||
void stash_fcn_file_time (const octave_time& t) | void stash_fcn_file_time (const octave_time& t) | |||
{ | { | |||
t_parsed = t; | t_parsed = t; | |||
mark_fcn_file_up_to_date (t); | mark_fcn_file_up_to_date (t); | |||
} | } | |||
std::string fcn_file_name (void) const { return file_name; } | std::string fcn_file_name (void) const { return file_name; } | |||
std::string profiler_name (void) const; | std::string profiler_name (void) const; | |||
std::string parent_fcn_name (void) const { return parent_name; } | std::string parent_fcn_name (void) const { return parent_name; } | |||
symbol_table::scope_id parent_fcn_scope (void) const { return parent_scop e; } | symbol_table::scope_id parent_fcn_scope (void) const { return parent_scop e; } | |||
symbol_table::scope_id scope (void) { return local_scope; } | symbol_table::scope_id scope (void) { return local_scope; } | |||
skipping to change at line 235 | skipping to change at line 262 | |||
octave_time time_checked (void) const { return t_checked; } | octave_time time_checked (void) const { return t_checked; } | |||
void mark_as_system_fcn_file (void); | void mark_as_system_fcn_file (void); | |||
bool is_system_fcn_file (void) const { return system_fcn_file; } | bool is_system_fcn_file (void) const { return system_fcn_file; } | |||
bool is_user_function (void) const { return true; } | bool is_user_function (void) const { return true; } | |||
void erase_subfunctions (void) | void erase_subfunctions (void) | |||
{ | { | |||
symbol_table::erase_subfunctions_in_scope (local_scope); | symbol_table::erase_subfunctions_in_scope (local_scope); | |||
} | } | |||
bool takes_varargs (void) const; | bool takes_varargs (void) const; | |||
bool takes_var_return (void) const; | bool takes_var_return (void) const; | |||
void mark_as_private_function (const std::string& cname = std::string ()) | void mark_as_private_function (const std::string& cname = std::string ()) | |||
{ | { | |||
symbol_table::mark_subfunctions_in_scope_as_private (local_scope, cna | symbol_table::mark_subfunctions_in_scope_as_private (local_scope, cname | |||
me); | ); | |||
octave_function::mark_as_private_function (cname); | octave_function::mark_as_private_function (cname); | |||
} | } | |||
void lock_subfunctions (void); | void lock_subfunctions (void); | |||
void unlock_subfunctions (void); | void unlock_subfunctions (void); | |||
std::map<std::string, octave_value> subfunctions (void) const; | ||||
bool has_subfunctions (void) const; | ||||
void stash_subfunction_names (const std::list<std::string>& names); | ||||
std::list<std::string> subfunction_names (void) const | ||||
{ | ||||
return subfcn_names; | ||||
} | ||||
octave_value_list all_va_args (const octave_value_list& args); | octave_value_list all_va_args (const octave_value_list& args); | |||
void stash_function_name (const std::string& s) { my_name = s; } | void stash_function_name (const std::string& s) { my_name = s; } | |||
void mark_as_subfunction (void) { subfunction = true; } | void mark_as_subfunction (void) { subfunction = true; } | |||
bool is_subfunction (void) const { return subfunction; } | bool is_subfunction (void) const { return subfunction; } | |||
void mark_as_inline_function (void) { inline_function = true; } | void mark_as_inline_function (void) { inline_function = true; } | |||
bool is_inline_function (void) const { return inline_function; } | bool is_inline_function (void) const { return inline_function; } | |||
void mark_as_anonymous_function (void) { anonymous_function = true; } | void mark_as_anonymous_function (void) { anonymous_function = true; } | |||
bool is_anonymous_function (void) const { return anonymous_function; } | bool is_anonymous_function (void) const { return anonymous_function; } | |||
bool is_anonymous_function_of_class | bool is_anonymous_function_of_class | |||
(const std::string& cname = std::string ()) const | (const std::string& cname = std::string ()) const | |||
{ | { | |||
return anonymous_function | return anonymous_function | |||
? (cname.empty () | ? (cname.empty () | |||
? (! dispatch_class().empty ()) | ? (! dispatch_class ().empty ()) | |||
: cname == dispatch_class ()) | : cname == dispatch_class ()) | |||
: false; | : false; | |||
} | } | |||
// If we are a special expression, then the function body consists of exa | ||||
ctly | ||||
// one expression. The expression's result is the return value of the | ||||
// function. | ||||
bool is_special_expr (void) const | ||||
{ | ||||
return is_inline_function () || is_anonymous_function (); | ||||
} | ||||
bool is_nested_function (void) const { return nested_function; } | ||||
void mark_as_nested_function (void) { nested_function = true; } | ||||
void mark_as_class_constructor (void) { class_constructor = true; } | void mark_as_class_constructor (void) { class_constructor = true; } | |||
bool is_class_constructor (const std::string& cname = std::string ()) con st | bool is_class_constructor (const std::string& cname = std::string ()) con st | |||
{ | { | |||
return class_constructor | return class_constructor | |||
? (cname.empty () ? true : cname == dispatch_class ()) : false; | ? (cname.empty () ? true : cname == dispatch_class ()) : false; | |||
} | } | |||
void mark_as_class_method (void) { class_method = true; } | void mark_as_class_method (void) { class_method = true; } | |||
bool is_class_method (const std::string& cname = std::string ()) const | bool is_class_method (const std::string& cname = std::string ()) const | |||
{ | { | |||
return class_method | return class_method | |||
? (cname.empty () ? true : cname == dispatch_class ()) : false; | ? (cname.empty () ? true : cname == dispatch_class ()) : false; | |||
} | } | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx) | const std::list<octave_value_list>& idx) | |||
{ | { | |||
octave_value_list tmp = subsref (type, idx, 1); | octave_value_list tmp = subsref (type, idx, 1); | |||
return tmp.length () > 0 ? tmp(0) : octave_value (); | return tmp.length () > 0 ? tmp(0) : octave_value (); | |||
} | } | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
int nargout); | int nargout); | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
int nargout, const std::list<octave_lvalue>* l | int nargout, | |||
value_list); | const std::list<octave_lvalue>* lvalue_list); | |||
octave_value_list | octave_value_list | |||
do_multi_index_op (int nargout, const octave_value_list& args); | do_multi_index_op (int nargout, const octave_value_list& args); | |||
octave_value_list | octave_value_list | |||
do_multi_index_op (int nargout, const octave_value_list& args, | do_multi_index_op (int nargout, const octave_value_list& args, | |||
const std::list<octave_lvalue>* lvalue_list); | const std::list<octave_lvalue>* lvalue_list); | |||
tree_parameter_list *parameter_list (void) { return param_list; } | tree_parameter_list *parameter_list (void) { return param_list; } | |||
tree_parameter_list *return_list (void) { return ret_list; } | tree_parameter_list *return_list (void) { return ret_list; } | |||
tree_statement_list *body (void) { return cmd_list; } | tree_statement_list *body (void) { return cmd_list; } | |||
octave_comment_list *leading_comment (void) { return lead_comm; } | octave_comment_list *leading_comment (void) { return lead_comm; } | |||
octave_comment_list *trailing_comment (void) { return trail_comm; } | octave_comment_list *trailing_comment (void) { return trail_comm; } | |||
// If is_special_expr is true, retrieve the sigular expression that forms | ||||
the | ||||
// body. May be null (even if is_special_expr is true). | ||||
tree_expression *special_expr (void); | ||||
bool subsasgn_optimization_ok (void); | bool subsasgn_optimization_ok (void); | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
template <class T> | template <class T> | |||
bool local_protect (T& variable) | bool local_protect (T& variable) | |||
{ | { | |||
if (curr_unwind_protect_frame) | if (curr_unwind_protect_frame) | |||
{ | { | |||
curr_unwind_protect_frame->protect_var (variable); | curr_unwind_protect_frame->protect_var (variable); | |||
return true; | return true; | |||
} | } | |||
else | else | |||
return false; | return false; | |||
} | } | |||
#ifdef HAVE_LLVM | ||||
jit_function_info *get_info (void) { return jit_info; } | ||||
void stash_info (jit_function_info *info) { jit_info = info; } | ||||
#endif | ||||
#if 0 | #if 0 | |||
void print_symtab_info (std::ostream& os) const; | void print_symtab_info (std::ostream& os) const; | |||
#endif | #endif | |||
private: | private: | |||
// List of arguments for this function. These are local variables. | // List of arguments for this function. These are local variables. | |||
tree_parameter_list *param_list; | tree_parameter_list *param_list; | |||
skipping to change at line 372 | skipping to change at line 433 | |||
// The comments preceding the ENDFUNCTION token. | // The comments preceding the ENDFUNCTION token. | |||
octave_comment_list *trail_comm; | octave_comment_list *trail_comm; | |||
// The name of the file we parsed. | // The name of the file we parsed. | |||
std::string file_name; | std::string file_name; | |||
// Location where this function was defined. | // Location where this function was defined. | |||
int location_line; | int location_line; | |||
int location_column; | int location_column; | |||
int end_location_line; | ||||
int end_location_column; | ||||
// The name of the parent function, if any. | // The name of the parent function, if any. | |||
std::string parent_name; | std::string parent_name; | |||
// The list of subfunctions (if any) in the order they appear in the | ||||
// file. | ||||
std::list<std::string> subfcn_names; | ||||
// The time the file was parsed. | // The time the file was parsed. | |||
octave_time t_parsed; | octave_time t_parsed; | |||
// The time the file was last checked to see if it needs to be | // The time the file was last checked to see if it needs to be | |||
// parsed again. | // parsed again. | |||
octave_time t_checked; | octave_time t_checked; | |||
// True if this function came from a file that is considered to be a | // True if this function came from a file that is considered to be a | |||
// system function. This affects whether we check the time stamp | // system function. This affects whether we check the time stamp | |||
// on the file to see if it has changed. | // on the file to see if it has changed. | |||
skipping to change at line 403 | skipping to change at line 470 | |||
// TRUE means this subfunction of a primary function. | // TRUE means this subfunction of a primary function. | |||
bool subfunction; | bool subfunction; | |||
// TRUE means this is an inline function. | // TRUE means this is an inline function. | |||
bool inline_function; | bool inline_function; | |||
// TRUE means this is an anonymous function. | // TRUE means this is an anonymous function. | |||
bool anonymous_function; | bool anonymous_function; | |||
// TRUE means this is a nested function. (either a child or parent) | ||||
bool nested_function; | ||||
// TRUE means this function is the constructor for class object. | // TRUE means this function is the constructor for class object. | |||
bool class_constructor; | bool class_constructor; | |||
// TRUE means this function is a method for a class. | // TRUE means this function is a method for a class. | |||
bool class_method; | bool class_method; | |||
// The scope of the parent function, if any. | // The scope of the parent function, if any. | |||
symbol_table::scope_id parent_scope; | symbol_table::scope_id parent_scope; | |||
symbol_table::scope_id local_scope; | symbol_table::scope_id local_scope; | |||
// pointer to the current unwind_protect frame of this function. | // pointer to the current unwind_protect frame of this function. | |||
unwind_protect *curr_unwind_protect_frame; | unwind_protect *curr_unwind_protect_frame; | |||
#if 0 | #ifdef HAVE_LLVM | |||
// The symbol record for argn in the local symbol table. | jit_function_info *jit_info; | |||
octave_value& argn_varref; | ||||
// The symbol record for nargin in the local symbol table. | ||||
octave_value& nargin_varref; | ||||
// The symbol record for nargout in the local symbol table. | ||||
octave_value& nargout_varref; | ||||
// The symbol record for varargin in the local symbol table. | ||||
octave_value& varargin_varref; | ||||
#endif | #endif | |||
void maybe_relocate_end_internal (void); | ||||
void print_code_function_header (void); | void print_code_function_header (void); | |||
void print_code_function_trailer (void); | void print_code_function_trailer (void); | |||
void bind_automatic_vars (const string_vector& arg_names, int nargin, | void bind_automatic_vars (const string_vector& arg_names, int nargin, | |||
int nargout, const octave_value_list& va_args, | int nargout, const octave_value_list& va_args, | |||
const std::list<octave_lvalue> *lvalue_list); | const std::list<octave_lvalue> *lvalue_list); | |||
void restore_warning_states (void); | ||||
// No copying! | // No copying! | |||
octave_user_function (const octave_user_function& fn); | octave_user_function (const octave_user_function& fn); | |||
octave_user_function& operator = (const octave_user_function& fn); | octave_user_function& operator = (const octave_user_function& fn); | |||
DECLARE_OCTAVE_ALLOCATOR | DECLARE_OCTAVE_ALLOCATOR | |||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |||
}; | }; | |||
End of changes. 29 change blocks. | ||||
67 lines changed or deleted | 132 lines changed or added | |||
ov.h | ov.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_value_h) | #if !defined (octave_ov_h) | |||
#define octave_value_h 1 | #define octave_ov_h 1 | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include <list> | #include <list> | |||
#include "Range.h" | #include "Range.h" | |||
#include "data-conv.h" | #include "data-conv.h" | |||
#include "idx-vector.h" | #include "idx-vector.h" | |||
#include "mach-info.h" | #include "mach-info.h" | |||
#include "mxarray.h" | ||||
#include "mx-base.h" | #include "mx-base.h" | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
#include "oct-time.h" | #include "oct-time.h" | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "oct-hdf5.h" | #include "oct-hdf5.h" | |||
#include "oct-sort.h" | #include "oct-sort.h" | |||
class Cell; | class Cell; | |||
class mxArray; | ||||
class octave_map; | class octave_map; | |||
class octave_scalar_map; | class octave_scalar_map; | |||
class Octave_map; | class Octave_map; | |||
class octave_stream; | class octave_stream; | |||
class octave_function; | class octave_function; | |||
class octave_user_function; | class octave_user_function; | |||
class octave_fcn_handle; | class octave_fcn_handle; | |||
class octave_fcn_inline; | class octave_fcn_inline; | |||
class octave_value_list; | class octave_value_list; | |||
class octave_lvalue; | class octave_lvalue; | |||
skipping to change at line 148 | skipping to change at line 148 | |||
op_el_mul_eq, | op_el_mul_eq, | |||
op_el_div_eq, | op_el_div_eq, | |||
op_el_ldiv_eq, | op_el_ldiv_eq, | |||
op_el_pow_eq, | op_el_pow_eq, | |||
op_el_and_eq, | op_el_and_eq, | |||
op_el_or_eq, | op_el_or_eq, | |||
num_assign_ops, | num_assign_ops, | |||
unknown_assign_op | unknown_assign_op | |||
}; | }; | |||
static binary_op assign_op_to_binary_op (assign_op); | ||||
static assign_op binary_op_to_assign_op (binary_op); | static assign_op binary_op_to_assign_op (binary_op); | |||
static std::string unary_op_as_string (unary_op); | static std::string unary_op_as_string (unary_op); | |||
static std::string unary_op_fcn_name (unary_op); | static std::string unary_op_fcn_name (unary_op); | |||
static std::string binary_op_as_string (binary_op); | static std::string binary_op_as_string (binary_op); | |||
static std::string binary_op_fcn_name (binary_op); | static std::string binary_op_fcn_name (binary_op); | |||
static std::string binary_op_fcn_name (compound_binary_op); | static std::string binary_op_fcn_name (compound_binary_op); | |||
static std::string assign_op_as_string (assign_op); | static std::string assign_op_as_string (assign_op); | |||
static octave_value empty_conv (const std::string& type, | static octave_value empty_conv (const std::string& type, | |||
const octave_value& rhs = octave_value () ); | const octave_value& rhs = octave_value () ); | |||
enum magic_colon { magic_colon_t }; | enum magic_colon { magic_colon_t }; | |||
octave_value (void) | octave_value (void) | |||
{ | { | |||
static octave_base_value nil_rep; | static octave_base_value nil_rep; | |||
rep = &nil_rep; | rep = &nil_rep; | |||
rep->count++; | rep->count++; | |||
} | } | |||
octave_value (short int i); | octave_value (short int i); | |||
octave_value (unsigned short int i); | octave_value (unsigned short int i); | |||
octave_value (int i); | octave_value (int i); | |||
octave_value (unsigned int i); | octave_value (unsigned int i); | |||
octave_value (long int i); | octave_value (long int i); | |||
octave_value (unsigned long int i); | octave_value (unsigned long int i); | |||
// FIXME -- these are kluges. They turn into doubles | // FIXME: these are kluges. They turn into doubles | |||
// internally, which will break for very large values. We just use | // internally, which will break for very large values. We just use | |||
// them to store things like 64-bit ino_t, etc, and hope that those | // them to store things like 64-bit ino_t, etc, and hope that those | |||
// values are never actually larger than can be represented exactly | // values are never actually larger than can be represented exactly | |||
// in a double. | // in a double. | |||
#if defined (HAVE_LONG_LONG_INT) | #if defined (HAVE_LONG_LONG_INT) | |||
octave_value (long long int i); | octave_value (long long int i); | |||
#endif | #endif | |||
#if defined (HAVE_UNSIGNED_LONG_LONG_INT) | #if defined (HAVE_UNSIGNED_LONG_LONG_INT) | |||
octave_value (unsigned long long int i); | octave_value (unsigned long long int i); | |||
#endif | #endif | |||
octave_value (octave_time t); | octave_value (octave_time t); | |||
octave_value (double d); | octave_value (double d); | |||
octave_value (float d); | octave_value (float d); | |||
octave_value (const Array<octave_value>& a, bool is_cs_list = false); | octave_value (const Array<octave_value>& a, bool is_cs_list = false); | |||
octave_value (const Cell& c, bool is_cs_list = false); | octave_value (const Cell& c, bool is_cs_list = false); | |||
octave_value (const Matrix& m, const MatrixType& t = MatrixType()); | octave_value (const Matrix& m, const MatrixType& t = MatrixType ()); | |||
octave_value (const FloatMatrix& m, const MatrixType& t = MatrixType()); | octave_value (const FloatMatrix& m, const MatrixType& t = MatrixType ()); | |||
octave_value (const NDArray& nda); | octave_value (const NDArray& nda); | |||
octave_value (const FloatNDArray& nda); | octave_value (const FloatNDArray& nda); | |||
octave_value (const Array<double>& m); | octave_value (const Array<double>& m); | |||
octave_value (const Array<float>& m); | octave_value (const Array<float>& m); | |||
octave_value (const DiagMatrix& d); | octave_value (const DiagMatrix& d); | |||
octave_value (const DiagArray2<double>& d); | octave_value (const DiagArray2<double>& d); | |||
octave_value (const DiagArray2<float>& d); | octave_value (const DiagArray2<float>& d); | |||
octave_value (const DiagArray2<Complex>& d); | octave_value (const DiagArray2<Complex>& d); | |||
octave_value (const DiagArray2<FloatComplex>& d); | octave_value (const DiagArray2<FloatComplex>& d); | |||
octave_value (const FloatDiagMatrix& d); | octave_value (const FloatDiagMatrix& d); | |||
octave_value (const RowVector& v); | octave_value (const RowVector& v); | |||
octave_value (const FloatRowVector& v); | octave_value (const FloatRowVector& v); | |||
octave_value (const ColumnVector& v); | octave_value (const ColumnVector& v); | |||
octave_value (const FloatColumnVector& v); | octave_value (const FloatColumnVector& v); | |||
octave_value (const Complex& C); | octave_value (const Complex& C); | |||
octave_value (const FloatComplex& C); | octave_value (const FloatComplex& C); | |||
octave_value (const ComplexMatrix& m, const MatrixType& t = MatrixType()) | octave_value (const ComplexMatrix& m, const MatrixType& t = MatrixType () | |||
; | ); | |||
octave_value (const FloatComplexMatrix& m, const MatrixType& t = MatrixTy | octave_value (const FloatComplexMatrix& m, | |||
pe()); | const MatrixType& t = MatrixType ()); | |||
octave_value (const ComplexNDArray& cnda); | octave_value (const ComplexNDArray& cnda); | |||
octave_value (const FloatComplexNDArray& cnda); | octave_value (const FloatComplexNDArray& cnda); | |||
octave_value (const Array<Complex>& m); | octave_value (const Array<Complex>& m); | |||
octave_value (const Array<FloatComplex>& m); | octave_value (const Array<FloatComplex>& m); | |||
octave_value (const ComplexDiagMatrix& d); | octave_value (const ComplexDiagMatrix& d); | |||
octave_value (const FloatComplexDiagMatrix& d); | octave_value (const FloatComplexDiagMatrix& d); | |||
octave_value (const ComplexRowVector& v); | octave_value (const ComplexRowVector& v); | |||
octave_value (const FloatComplexRowVector& v); | octave_value (const FloatComplexRowVector& v); | |||
octave_value (const ComplexColumnVector& v); | octave_value (const ComplexColumnVector& v); | |||
octave_value (const FloatComplexColumnVector& v); | octave_value (const FloatComplexColumnVector& v); | |||
octave_value (const PermMatrix& p); | octave_value (const PermMatrix& p); | |||
octave_value (bool b); | octave_value (bool b); | |||
octave_value (const boolMatrix& bm, const MatrixType& t = MatrixType()); | octave_value (const boolMatrix& bm, const MatrixType& t = MatrixType ()); | |||
octave_value (const boolNDArray& bnda); | octave_value (const boolNDArray& bnda); | |||
octave_value (const Array<bool>& bnda); | octave_value (const Array<bool>& bnda); | |||
octave_value (char c, char type = '\''); | octave_value (char c, char type = '\''); | |||
octave_value (const char *s, char type = '\''); | octave_value (const char *s, char type = '\''); | |||
octave_value (const std::string& s, char type = '\''); | octave_value (const std::string& s, char type = '\''); | |||
octave_value (const string_vector& s, char type = '\''); | octave_value (const string_vector& s, char type = '\''); | |||
octave_value (const charMatrix& chm, char type = '\''); | octave_value (const charMatrix& chm, char type = '\''); | |||
octave_value (const charNDArray& chnda, char type = '\''); | octave_value (const charNDArray& chnda, char type = '\''); | |||
octave_value (const Array<char>& chnda, char type = '\''); | octave_value (const Array<char>& chnda, char type = '\''); | |||
octave_value (const charMatrix& chm, bool is_string, | octave_value (const charMatrix& chm, bool is_string, | |||
skipping to change at line 297 | skipping to change at line 300 | |||
const std::list<std::string>& plist); | const std::list<std::string>& plist); | |||
octave_value (const octave_value_list& m, bool = false); | octave_value (const octave_value_list& m, bool = false); | |||
octave_value (octave_value::magic_colon); | octave_value (octave_value::magic_colon); | |||
octave_value (octave_base_value *new_rep, bool borrow = false); | octave_value (octave_base_value *new_rep, bool borrow = false); | |||
octave_value (octave_base_value *new_rep, int xcount) GCC_ATTR_DEPRECATED ; | octave_value (octave_base_value *new_rep, int xcount) GCC_ATTR_DEPRECATED ; | |||
// Copy constructor. | // Copy constructor. | |||
octave_value (const octave_value& a) | octave_value (const octave_value& a) | |||
{ | { | |||
rep = a.rep; | rep = a.rep; | |||
rep->count++; | rep->count++; | |||
} | } | |||
// This should only be called for derived types. | // This should only be called for derived types. | |||
octave_base_value *clone (void) const; | octave_base_value *clone (void) const; | |||
octave_base_value *empty_clone (void) const | octave_base_value *empty_clone (void) const | |||
{ return rep->empty_clone (); } | { return rep->empty_clone (); } | |||
// Delete the representation of this constant if the count drops to | // Delete the representation of this constant if the count drops to | |||
// zero. | // zero. | |||
~octave_value (void) | ~octave_value (void) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
} | } | |||
void make_unique (void) | void make_unique (void) | |||
{ | { | |||
if (rep->count > 1) | if (rep->count > 1) | |||
{ | { | |||
octave_base_value *r = rep->unique_clone (); | octave_base_value *r = rep->unique_clone (); | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = r; | rep = r; | |||
} | } | |||
} | } | |||
// This uniquifies the value if it is referenced by more than a certain | // This uniquifies the value if it is referenced by more than a certain | |||
// number of shallow copies. This is useful for optimizations where we | // number of shallow copies. This is useful for optimizations where we | |||
// know a certain copy, typically within a cell array, to be obsolete. | // know a certain copy, typically within a cell array, to be obsolete. | |||
void make_unique (int obsolete_copies) | void make_unique (int obsolete_copies) | |||
{ | { | |||
if (rep->count > obsolete_copies + 1) | if (rep->count > obsolete_copies + 1) | |||
{ | { | |||
octave_base_value *r = rep->unique_clone (); | octave_base_value *r = rep->unique_clone (); | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = r; | rep = r; | |||
} | } | |||
} | } | |||
// Simple assignment. | // Simple assignment. | |||
octave_value& operator = (const octave_value& a) | octave_value& operator = (const octave_value& a) | |||
{ | { | |||
if (rep != a.rep) | if (rep != a.rep) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = a.rep; | rep = a.rep; | |||
rep->count++; | rep->count++; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
octave_idx_type get_count (void) const { return rep->count; } | octave_idx_type get_count (void) const { return rep->count; } | |||
octave_base_value::type_conv_info numeric_conversion_function (void) cons t | octave_base_value::type_conv_info numeric_conversion_function (void) cons t | |||
{ return rep->numeric_conversion_function (); } | { return rep->numeric_conversion_function (); } | |||
octave_base_value::type_conv_info numeric_demotion_function (void) const | octave_base_value::type_conv_info numeric_demotion_function (void) const | |||
{ return rep->numeric_demotion_function (); } | { return rep->numeric_demotion_function (); } | |||
void maybe_mutate (void); | void maybe_mutate (void); | |||
octave_value squeeze (void) const | octave_value squeeze (void) const | |||
{ return rep->squeeze (); } | { return rep->squeeze (); } | |||
// The result of full(). | // The result of full(). | |||
octave_value full_value (void) const | octave_value full_value (void) const | |||
{ return rep->full_value (); } | { return rep->full_value (); } | |||
octave_base_value *try_narrowing_conversion (void) | octave_base_value *try_narrowing_conversion (void) | |||
{ return rep->try_narrowing_conversion (); } | { return rep->try_narrowing_conversion (); } | |||
// Close to dims (), but can be overloaded for classes. | // Close to dims (), but can be overloaded for classes. | |||
Matrix size (void) | Matrix size (void) | |||
{ return rep->size (); } | { return rep->size (); } | |||
octave_idx_type numel (const octave_value_list& idx) | octave_idx_type numel (const octave_value_list& idx) | |||
{ return rep->numel (idx); } | { return rep->numel (idx); } | |||
octave_value single_subsref (const std::string& type, | octave_value single_subsref (const std::string& type, | |||
const octave_value_list& idx); | const octave_value_list& idx); | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx) | const std::list<octave_value_list>& idx) | |||
{ return rep->subsref (type, idx); } | { return rep->subsref (type, idx); } | |||
octave_value subsref (const std::string& type, | octave_value subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
bool auto_add) | bool auto_add) | |||
{ return rep->subsref (type, idx, auto_add); } | { return rep->subsref (type, idx, auto_add); } | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
int nargout); | int nargout); | |||
octave_value_list subsref (const std::string& type, | octave_value_list subsref (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
int nargout, | int nargout, | |||
const std::list<octave_lvalue> *lvalue_list); | const std::list<octave_lvalue> *lvalue_list); | |||
octave_value next_subsref (const std::string& type, const | octave_value next_subsref (const std::string& type, const | |||
std::list<octave_value_list>& idx, | std::list<octave_value_list>& idx, | |||
size_t skip = 1); | size_t skip = 1); | |||
octave_value_list next_subsref (int nargout, | octave_value_list next_subsref (int nargout, | |||
const std::string& type, const | const std::string& type, const | |||
std::list<octave_value_list>& idx, | std::list<octave_value_list>& idx, | |||
size_t skip = 1); | size_t skip = 1); | |||
octave_value_list next_subsref (int nargout, | ||||
const std::string& type, const | ||||
std::list<octave_value_list>& idx, | ||||
const std::list<octave_lvalue> *lvalue_li | ||||
st, | ||||
size_t skip = 1); | ||||
octave_value next_subsref (bool auto_add, const std::string& type, const | octave_value next_subsref (bool auto_add, const std::string& type, const | |||
std::list<octave_value_list>& idx, | std::list<octave_value_list>& idx, | |||
size_t skip = 1); | size_t skip = 1); | |||
octave_value do_index_op (const octave_value_list& idx, | octave_value do_index_op (const octave_value_list& idx, | |||
bool resize_ok = false) | bool resize_ok = false) | |||
{ return rep->do_index_op (idx, resize_ok); } | { return rep->do_index_op (idx, resize_ok); } | |||
octave_value_list | octave_value_list | |||
do_multi_index_op (int nargout, const octave_value_list& idx); | do_multi_index_op (int nargout, const octave_value_list& idx); | |||
octave_value_list | octave_value_list | |||
do_multi_index_op (int nargout, const octave_value_list& idx, | do_multi_index_op (int nargout, const octave_value_list& idx, | |||
const std::list<octave_lvalue> *lvalue_list); | const std::list<octave_lvalue> *lvalue_list); | |||
octave_value subsasgn (const std::string& type, | octave_value subsasgn (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
const octave_value& rhs); | const octave_value& rhs); | |||
octave_value undef_subsasgn (const std::string& type, | octave_value undef_subsasgn (const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
const octave_value& rhs); | const octave_value& rhs); | |||
octave_value& assign (assign_op op, const std::string& type, | octave_value& assign (assign_op op, const std::string& type, | |||
const std::list<octave_value_list>& idx, | const std::list<octave_value_list>& idx, | |||
const octave_value& rhs); | const octave_value& rhs); | |||
octave_value& assign (assign_op, const octave_value& rhs); | octave_value& assign (assign_op, const octave_value& rhs); | |||
idx_vector index_vector (void) const | idx_vector index_vector (void) const | |||
{ return rep->index_vector (); } | { return rep->index_vector (); } | |||
// Size. | // Size. | |||
dim_vector dims (void) const | dim_vector dims (void) const | |||
{ return rep->dims (); } | { return rep->dims (); } | |||
octave_idx_type rows (void) const { return rep->rows (); } | octave_idx_type rows (void) const { return rep->rows (); } | |||
octave_idx_type columns (void) const { return rep->columns (); } | octave_idx_type columns (void) const { return rep->columns (); } | |||
octave_idx_type length (void) const; | octave_idx_type length (void) const; | |||
int ndims (void) const { return rep->ndims (); } | int ndims (void) const { return rep->ndims (); } | |||
bool all_zero_dims (void) const { return dims().all_zero (); } | bool all_zero_dims (void) const { return dims ().all_zero (); } | |||
octave_idx_type numel (void) const | octave_idx_type numel (void) const | |||
{ return rep->numel (); } | { return rep->numel (); } | |||
octave_idx_type capacity (void) const | octave_idx_type capacity (void) const | |||
{ return rep->capacity (); } | { return rep->capacity (); } | |||
size_t byte_size (void) const | size_t byte_size (void) const | |||
{ return rep->byte_size (); } | { return rep->byte_size (); } | |||
octave_idx_type nnz (void) const { return rep->nnz (); } | octave_idx_type nnz (void) const { return rep->nnz (); } | |||
octave_idx_type nzmax (void) const { return rep->nzmax (); } | octave_idx_type nzmax (void) const { return rep->nzmax (); } | |||
octave_idx_type nfields (void) const { return rep->nfields (); } | octave_idx_type nfields (void) const { return rep->nfields (); } | |||
octave_value reshape (const dim_vector& dv) const | octave_value reshape (const dim_vector& dv) const | |||
{ return rep->reshape (dv); } | { return rep->reshape (dv); } | |||
octave_value permute (const Array<int>& vec, bool inv = false) const | octave_value permute (const Array<int>& vec, bool inv = false) const | |||
{ return rep->permute (vec, inv); } | { return rep->permute (vec, inv); } | |||
octave_value ipermute (const Array<int>& vec) const | octave_value ipermute (const Array<int>& vec) const | |||
{ return rep->permute (vec, true); } | { return rep->permute (vec, true); } | |||
octave_value resize (const dim_vector& dv, bool fill = false) const | octave_value resize (const dim_vector& dv, bool fill = false) const | |||
{ return rep->resize (dv, fill);} | { return rep->resize (dv, fill);} | |||
MatrixType matrix_type (void) const | MatrixType matrix_type (void) const | |||
{ return rep->matrix_type (); } | { return rep->matrix_type (); } | |||
MatrixType matrix_type (const MatrixType& typ) const | MatrixType matrix_type (const MatrixType& typ) const | |||
{ return rep->matrix_type (typ); } | { return rep->matrix_type (typ); } | |||
// Does this constant have a type? Both of these are provided since | // Does this constant have a type? Both of these are provided since | |||
// it is sometimes more natural to write is_undefined() instead of | // it is sometimes more natural to write is_undefined() instead of | |||
// ! is_defined(). | // ! is_defined(). | |||
bool is_defined (void) const | bool is_defined (void) const | |||
{ return rep->is_defined (); } | { return rep->is_defined (); } | |||
bool is_undefined (void) const | bool is_undefined (void) const | |||
{ return ! is_defined (); } | { return ! is_defined (); } | |||
bool is_empty (void) const | bool is_empty (void) const | |||
{ return rep->is_empty (); } | { return rep->is_empty (); } | |||
bool is_cell (void) const | bool is_cell (void) const | |||
{ return rep->is_cell (); } | { return rep->is_cell (); } | |||
bool is_cellstr (void) const | bool is_cellstr (void) const | |||
{ return rep->is_cellstr (); } | { return rep->is_cellstr (); } | |||
bool is_real_scalar (void) const | bool is_real_scalar (void) const | |||
{ return rep->is_real_scalar (); } | { return rep->is_real_scalar (); } | |||
bool is_real_matrix (void) const | bool is_real_matrix (void) const | |||
{ return rep->is_real_matrix (); } | { return rep->is_real_matrix (); } | |||
bool is_real_nd_array (void) const | ||||
{ return rep->is_real_nd_array (); } | ||||
bool is_complex_scalar (void) const | bool is_complex_scalar (void) const | |||
{ return rep->is_complex_scalar (); } | { return rep->is_complex_scalar (); } | |||
bool is_complex_matrix (void) const | bool is_complex_matrix (void) const | |||
{ return rep->is_complex_matrix (); } | { return rep->is_complex_matrix (); } | |||
bool is_bool_scalar (void) const | bool is_bool_scalar (void) const | |||
{ return rep->is_bool_scalar (); } | { return rep->is_bool_scalar (); } | |||
bool is_bool_matrix (void) const | bool is_bool_matrix (void) const | |||
{ return rep->is_bool_matrix (); } | { return rep->is_bool_matrix (); } | |||
bool is_char_matrix (void) const | bool is_char_matrix (void) const | |||
{ return rep->is_char_matrix (); } | { return rep->is_char_matrix (); } | |||
bool is_diag_matrix (void) const | bool is_diag_matrix (void) const | |||
{ return rep->is_diag_matrix (); } | { return rep->is_diag_matrix (); } | |||
bool is_perm_matrix (void) const | bool is_perm_matrix (void) const | |||
{ return rep->is_perm_matrix (); } | { return rep->is_perm_matrix (); } | |||
bool is_string (void) const | bool is_string (void) const | |||
{ return rep->is_string (); } | { return rep->is_string (); } | |||
bool is_sq_string (void) const | bool is_sq_string (void) const | |||
{ return rep->is_sq_string (); } | { return rep->is_sq_string (); } | |||
bool is_dq_string (void) const | bool is_dq_string (void) const | |||
{ return rep->is_string () && ! rep->is_sq_string (); } | { return rep->is_string () && ! rep->is_sq_string (); } | |||
bool is_range (void) const | bool is_range (void) const | |||
{ return rep->is_range (); } | { return rep->is_range (); } | |||
bool is_map (void) const | bool is_map (void) const | |||
{ return rep->is_map (); } | { return rep->is_map (); } | |||
bool is_object (void) const | bool is_object (void) const | |||
{ return rep->is_object (); } | { return rep->is_object (); } | |||
bool is_java (void) const | ||||
{ return rep->is_java (); } | ||||
bool is_cs_list (void) const | bool is_cs_list (void) const | |||
{ return rep->is_cs_list (); } | { return rep->is_cs_list (); } | |||
bool is_magic_colon (void) const | bool is_magic_colon (void) const | |||
{ return rep->is_magic_colon (); } | { return rep->is_magic_colon (); } | |||
bool is_null_value (void) const | bool is_null_value (void) const | |||
{ return rep->is_null_value (); } | { return rep->is_null_value (); } | |||
// Are any or all of the elements in this constant nonzero? | // Are any or all of the elements in this constant nonzero? | |||
octave_value all (int dim = 0) const | octave_value all (int dim = 0) const | |||
{ return rep->all (dim); } | { return rep->all (dim); } | |||
octave_value any (int dim = 0) const | octave_value any (int dim = 0) const | |||
{ return rep->any (dim); } | { return rep->any (dim); } | |||
builtin_type_t builtin_type (void) const | builtin_type_t builtin_type (void) const | |||
{ return rep->builtin_type (); } | { return rep->builtin_type (); } | |||
// Floating point types. | // Floating point types. | |||
bool is_double_type (void) const | bool is_double_type (void) const | |||
{ return rep->is_double_type (); } | { return rep->is_double_type (); } | |||
bool is_single_type (void) const | bool is_single_type (void) const | |||
{ return rep->is_single_type (); } | { return rep->is_single_type (); } | |||
bool is_float_type (void) const | bool is_float_type (void) const | |||
{ return rep->is_float_type (); } | { return rep->is_float_type (); } | |||
// Integer types. | // Integer types. | |||
bool is_int8_type (void) const | bool is_int8_type (void) const | |||
{ return rep->is_int8_type (); } | { return rep->is_int8_type (); } | |||
bool is_int16_type (void) const | bool is_int16_type (void) const | |||
{ return rep->is_int16_type (); } | { return rep->is_int16_type (); } | |||
bool is_int32_type (void) const | bool is_int32_type (void) const | |||
{ return rep->is_int32_type (); } | { return rep->is_int32_type (); } | |||
bool is_int64_type (void) const | bool is_int64_type (void) const | |||
{ return rep->is_int64_type (); } | { return rep->is_int64_type (); } | |||
bool is_uint8_type (void) const | bool is_uint8_type (void) const | |||
{ return rep->is_uint8_type (); } | { return rep->is_uint8_type (); } | |||
bool is_uint16_type (void) const | bool is_uint16_type (void) const | |||
{ return rep->is_uint16_type (); } | { return rep->is_uint16_type (); } | |||
bool is_uint32_type (void) const | bool is_uint32_type (void) const | |||
{ return rep->is_uint32_type (); } | { return rep->is_uint32_type (); } | |||
bool is_uint64_type (void) const | bool is_uint64_type (void) const | |||
{ return rep->is_uint64_type (); } | { return rep->is_uint64_type (); } | |||
// Other type stuff. | // Other type stuff. | |||
bool is_bool_type (void) const | bool is_bool_type (void) const | |||
{ return rep->is_bool_type (); } | { return rep->is_bool_type (); } | |||
bool is_integer_type (void) const | bool is_integer_type (void) const | |||
{ return rep->is_integer_type (); } | { return rep->is_integer_type (); } | |||
bool is_real_type (void) const | bool is_real_type (void) const | |||
{ return rep->is_real_type (); } | { return rep->is_real_type (); } | |||
bool is_complex_type (void) const | bool is_complex_type (void) const | |||
{ return rep->is_complex_type (); } | { return rep->is_complex_type (); } | |||
bool is_scalar_type (void) const | bool is_scalar_type (void) const | |||
{ return rep->is_scalar_type (); } | { return rep->is_scalar_type (); } | |||
bool is_matrix_type (void) const | bool is_matrix_type (void) const | |||
{ return rep->is_matrix_type (); } | { return rep->is_matrix_type (); } | |||
bool is_numeric_type (void) const | bool is_numeric_type (void) const | |||
{ return rep->is_numeric_type (); } | { return rep->is_numeric_type (); } | |||
bool is_sparse_type (void) const | bool is_sparse_type (void) const | |||
{ return rep->is_sparse_type (); } | { return rep->is_sparse_type (); } | |||
// Does this constant correspond to a truth value? | // Does this constant correspond to a truth value? | |||
bool is_true (void) const | bool is_true (void) const | |||
{ return rep->is_true (); } | { return rep->is_true (); } | |||
// Do two constants match (in a switch statement)? | // Do two constants match (in a switch statement)? | |||
bool is_equal (const octave_value&) const; | bool is_equal (const octave_value&) const; | |||
// Are the dimensions of this constant zero by zero? | // Are the dimensions of this constant zero by zero? | |||
bool is_zero_by_zero (void) const | bool is_zero_by_zero (void) const | |||
{ return (rows () == 0 && columns () == 0); } | { return (rows () == 0 && columns () == 0); } | |||
bool is_constant (void) const | bool is_constant (void) const | |||
{ return rep->is_constant (); } | { return rep->is_constant (); } | |||
bool is_function_handle (void) const | bool is_function_handle (void) const | |||
{ return rep->is_function_handle (); } | { return rep->is_function_handle (); } | |||
bool is_anonymous_function (void) const | bool is_anonymous_function (void) const | |||
{ return rep->is_anonymous_function (); } | { return rep->is_anonymous_function (); } | |||
bool is_inline_function (void) const | bool is_inline_function (void) const | |||
{ return rep->is_inline_function (); } | { return rep->is_inline_function (); } | |||
bool is_function (void) const | bool is_function (void) const | |||
{ return rep->is_function (); } | { return rep->is_function (); } | |||
bool is_user_script (void) const | bool is_user_script (void) const | |||
{ return rep->is_user_script (); } | { return rep->is_user_script (); } | |||
bool is_user_function (void) const | bool is_user_function (void) const | |||
{ return rep->is_user_function (); } | { return rep->is_user_function (); } | |||
bool is_user_code (void) const | bool is_user_code (void) const | |||
{ return rep->is_user_code (); } | { return rep->is_user_code (); } | |||
bool is_builtin_function (void) const | bool is_builtin_function (void) const | |||
{ return rep->is_builtin_function (); } | { return rep->is_builtin_function (); } | |||
bool is_dld_function (void) const | bool is_dld_function (void) const | |||
{ return rep->is_dld_function (); } | { return rep->is_dld_function (); } | |||
bool is_mex_function (void) const | bool is_mex_function (void) const | |||
{ return rep->is_mex_function (); } | { return rep->is_mex_function (); } | |||
void erase_subfunctions (void) { rep->erase_subfunctions (); } | void erase_subfunctions (void) { rep->erase_subfunctions (); } | |||
// Values. | // Values. | |||
octave_value eval (void) { return *this; } | octave_value eval (void) { return *this; } | |||
short int | short int | |||
short_value (bool req_int = false, bool frc_str_conv = false) const | short_value (bool req_int = false, bool frc_str_conv = false) const | |||
{ return rep->short_value (req_int, frc_str_conv); } | { return rep->short_value (req_int, frc_str_conv); } | |||
unsigned short int | unsigned short int | |||
ushort_value (bool req_int = false, bool frc_str_conv = false) const | ushort_value (bool req_int = false, bool frc_str_conv = false) const | |||
{ return rep->ushort_value (req_int, frc_str_conv); } | { return rep->ushort_value (req_int, frc_str_conv); } | |||
int int_value (bool req_int = false, bool frc_str_conv = false) const | int int_value (bool req_int = false, bool frc_str_conv = false) const | |||
{ return rep->int_value (req_int, frc_str_conv); } | { return rep->int_value (req_int, frc_str_conv); } | |||
unsigned int | unsigned int | |||
uint_value (bool req_int = false, bool frc_str_conv = false) const | uint_value (bool req_int = false, bool frc_str_conv = false) const | |||
{ return rep->uint_value (req_int, frc_str_conv); } | { return rep->uint_value (req_int, frc_str_conv); } | |||
int nint_value (bool frc_str_conv = false) const | int nint_value (bool frc_str_conv = false) const | |||
{ return rep->nint_value (frc_str_conv); } | { return rep->nint_value (frc_str_conv); } | |||
long int | long int | |||
long_value (bool req_int = false, bool frc_str_conv = false) const | long_value (bool req_int = false, bool frc_str_conv = false) const | |||
{ return rep->long_value (req_int, frc_str_conv); } | { return rep->long_value (req_int, frc_str_conv); } | |||
unsigned long int | unsigned long int | |||
ulong_value (bool req_int = false, bool frc_str_conv = false) const | ulong_value (bool req_int = false, bool frc_str_conv = false) const | |||
{ return rep->ulong_value (req_int, frc_str_conv); } | { return rep->ulong_value (req_int, frc_str_conv); } | |||
int64_t | ||||
int64_value (bool req_int = false, bool frc_str_conv = false) const | ||||
{ return rep->int64_value (req_int, frc_str_conv); } | ||||
uint64_t | ||||
uint64_value (bool req_int = false, bool frc_str_conv = false) const | ||||
{ return rep->uint64_value (req_int, frc_str_conv); } | ||||
octave_idx_type | octave_idx_type | |||
idx_type_value (bool req_int = false, bool frc_str_conv = false) const; | idx_type_value (bool req_int = false, bool frc_str_conv = false) const; | |||
double double_value (bool frc_str_conv = false) const | double double_value (bool frc_str_conv = false) const | |||
{ return rep->double_value (frc_str_conv); } | { return rep->double_value (frc_str_conv); } | |||
float float_value (bool frc_str_conv = false) const | float float_value (bool frc_str_conv = false) const | |||
{ return rep->float_value (frc_str_conv); } | { return rep->float_value (frc_str_conv); } | |||
double scalar_value (bool frc_str_conv = false) const | double scalar_value (bool frc_str_conv = false) const | |||
{ return rep->scalar_value (frc_str_conv); } | { return rep->scalar_value (frc_str_conv); } | |||
float float_scalar_value (bool frc_str_conv = false) const | float float_scalar_value (bool frc_str_conv = false) const | |||
{ return rep->float_scalar_value (frc_str_conv); } | { return rep->float_scalar_value (frc_str_conv); } | |||
Cell cell_value (void) const; | Cell cell_value (void) const; | |||
Matrix matrix_value (bool frc_str_conv = false) const | Matrix matrix_value (bool frc_str_conv = false) const | |||
{ return rep->matrix_value (frc_str_conv); } | { return rep->matrix_value (frc_str_conv); } | |||
FloatMatrix float_matrix_value (bool frc_str_conv = false) const | FloatMatrix float_matrix_value (bool frc_str_conv = false) const | |||
{ return rep->float_matrix_value (frc_str_conv); } | { return rep->float_matrix_value (frc_str_conv); } | |||
NDArray array_value (bool frc_str_conv = false) const | NDArray array_value (bool frc_str_conv = false) const | |||
{ return rep->array_value (frc_str_conv); } | { return rep->array_value (frc_str_conv); } | |||
FloatNDArray float_array_value (bool frc_str_conv = false) const | FloatNDArray float_array_value (bool frc_str_conv = false) const | |||
{ return rep->float_array_value (frc_str_conv); } | { return rep->float_array_value (frc_str_conv); } | |||
Complex complex_value (bool frc_str_conv = false) const | Complex complex_value (bool frc_str_conv = false) const | |||
{ return rep->complex_value (frc_str_conv); } | { return rep->complex_value (frc_str_conv); } | |||
FloatComplex float_complex_value (bool frc_str_conv = false) const | FloatComplex float_complex_value (bool frc_str_conv = false) const | |||
{ return rep->float_complex_value (frc_str_conv); } | { return rep->float_complex_value (frc_str_conv); } | |||
ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const | ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const | |||
{ return rep->complex_matrix_value (frc_str_conv); } | { return rep->complex_matrix_value (frc_str_conv); } | |||
FloatComplexMatrix float_complex_matrix_value (bool frc_str_conv = false) | FloatComplexMatrix | |||
const | float_complex_matrix_value (bool frc_str_conv = false) const | |||
{ return rep->float_complex_matrix_value (frc_str_conv); } | { return rep->float_complex_matrix_value (frc_str_conv); } | |||
ComplexNDArray complex_array_value (bool frc_str_conv = false) const | ComplexNDArray complex_array_value (bool frc_str_conv = false) const | |||
{ return rep->complex_array_value (frc_str_conv); } | { return rep->complex_array_value (frc_str_conv); } | |||
FloatComplexNDArray float_complex_array_value (bool frc_str_conv = false) | FloatComplexNDArray | |||
const | float_complex_array_value (bool frc_str_conv = false) const | |||
{ return rep->float_complex_array_value (frc_str_conv); } | { return rep->float_complex_array_value (frc_str_conv); } | |||
bool bool_value (bool warn = false) const | bool bool_value (bool warn = false) const | |||
{ return rep->bool_value (warn); } | { return rep->bool_value (warn); } | |||
boolMatrix bool_matrix_value (bool warn = false) const | boolMatrix bool_matrix_value (bool warn = false) const | |||
{ return rep->bool_matrix_value (warn); } | { return rep->bool_matrix_value (warn); } | |||
boolNDArray bool_array_value (bool warn = false) const | boolNDArray bool_array_value (bool warn = false) const | |||
{ return rep->bool_array_value (warn); } | { return rep->bool_array_value (warn); } | |||
charMatrix char_matrix_value (bool frc_str_conv = false) const | charMatrix char_matrix_value (bool frc_str_conv = false) const | |||
{ return rep->char_matrix_value (frc_str_conv); } | { return rep->char_matrix_value (frc_str_conv); } | |||
charNDArray char_array_value (bool frc_str_conv = false) const | charNDArray char_array_value (bool frc_str_conv = false) const | |||
{ return rep->char_array_value (frc_str_conv); } | { return rep->char_array_value (frc_str_conv); } | |||
SparseMatrix sparse_matrix_value (bool frc_str_conv = false) const | SparseMatrix sparse_matrix_value (bool frc_str_conv = false) const | |||
{ return rep->sparse_matrix_value (frc_str_conv); } | { return rep->sparse_matrix_value (frc_str_conv); } | |||
SparseComplexMatrix sparse_complex_matrix_value (bool frc_str_conv = fals | SparseComplexMatrix | |||
e) const | sparse_complex_matrix_value (bool frc_str_conv = false) const | |||
{ return rep->sparse_complex_matrix_value (frc_str_conv); } | { return rep->sparse_complex_matrix_value (frc_str_conv); } | |||
SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const | SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const | |||
{ return rep->sparse_bool_matrix_value (warn); } | { return rep->sparse_bool_matrix_value (warn); } | |||
DiagMatrix diag_matrix_value (bool force = false) const | DiagMatrix diag_matrix_value (bool force = false) const | |||
{ return rep->diag_matrix_value (force); } | { return rep->diag_matrix_value (force); } | |||
FloatDiagMatrix float_diag_matrix_value (bool force = false) const | FloatDiagMatrix float_diag_matrix_value (bool force = false) const | |||
{ return rep->float_diag_matrix_value (force); } | { return rep->float_diag_matrix_value (force); } | |||
ComplexDiagMatrix complex_diag_matrix_value (bool force = false) const | ComplexDiagMatrix complex_diag_matrix_value (bool force = false) const | |||
{ return rep->complex_diag_matrix_value (force); } | { return rep->complex_diag_matrix_value (force); } | |||
FloatComplexDiagMatrix float_complex_diag_matrix_value (bool force = fals | FloatComplexDiagMatrix | |||
e) const | float_complex_diag_matrix_value (bool force = false) const | |||
{ return rep->float_complex_diag_matrix_value (force); } | { return rep->float_complex_diag_matrix_value (force); } | |||
PermMatrix perm_matrix_value (void) const | PermMatrix perm_matrix_value (void) const | |||
{ return rep->perm_matrix_value (); } | { return rep->perm_matrix_value (); } | |||
octave_int8 int8_scalar_value (void) const | octave_int8 int8_scalar_value (void) const | |||
{ return rep->int8_scalar_value (); } | { return rep->int8_scalar_value (); } | |||
octave_int16 int16_scalar_value (void) const | octave_int16 int16_scalar_value (void) const | |||
{ return rep->int16_scalar_value (); } | { return rep->int16_scalar_value (); } | |||
octave_int32 int32_scalar_value (void) const | octave_int32 int32_scalar_value (void) const | |||
{ return rep->int32_scalar_value (); } | { return rep->int32_scalar_value (); } | |||
octave_int64 int64_scalar_value (void) const | octave_int64 int64_scalar_value (void) const | |||
{ return rep->int64_scalar_value (); } | { return rep->int64_scalar_value (); } | |||
octave_uint8 uint8_scalar_value (void) const | octave_uint8 uint8_scalar_value (void) const | |||
{ return rep->uint8_scalar_value (); } | { return rep->uint8_scalar_value (); } | |||
octave_uint16 uint16_scalar_value (void) const | octave_uint16 uint16_scalar_value (void) const | |||
{ return rep->uint16_scalar_value (); } | { return rep->uint16_scalar_value (); } | |||
octave_uint32 uint32_scalar_value (void) const | octave_uint32 uint32_scalar_value (void) const | |||
{ return rep->uint32_scalar_value (); } | { return rep->uint32_scalar_value (); } | |||
octave_uint64 uint64_scalar_value (void) const | octave_uint64 uint64_scalar_value (void) const | |||
{ return rep->uint64_scalar_value (); } | { return rep->uint64_scalar_value (); } | |||
int8NDArray int8_array_value (void) const | int8NDArray int8_array_value (void) const | |||
{ return rep->int8_array_value (); } | { return rep->int8_array_value (); } | |||
int16NDArray int16_array_value (void) const | int16NDArray int16_array_value (void) const | |||
{ return rep->int16_array_value (); } | { return rep->int16_array_value (); } | |||
int32NDArray int32_array_value (void) const | int32NDArray int32_array_value (void) const | |||
{ return rep->int32_array_value (); } | { return rep->int32_array_value (); } | |||
int64NDArray int64_array_value (void) const | int64NDArray int64_array_value (void) const | |||
{ return rep->int64_array_value (); } | { return rep->int64_array_value (); } | |||
uint8NDArray uint8_array_value (void) const | uint8NDArray uint8_array_value (void) const | |||
{ return rep->uint8_array_value (); } | { return rep->uint8_array_value (); } | |||
uint16NDArray uint16_array_value (void) const | uint16NDArray uint16_array_value (void) const | |||
{ return rep->uint16_array_value (); } | { return rep->uint16_array_value (); } | |||
uint32NDArray uint32_array_value (void) const | uint32NDArray uint32_array_value (void) const | |||
{ return rep->uint32_array_value (); } | { return rep->uint32_array_value (); } | |||
uint64NDArray uint64_array_value (void) const | uint64NDArray uint64_array_value (void) const | |||
{ return rep->uint64_array_value (); } | { return rep->uint64_array_value (); } | |||
string_vector all_strings (bool pad = false) const | string_vector all_strings (bool pad = false) const | |||
{ return rep->all_strings (pad); } | { return rep->all_strings (pad); } | |||
std::string string_value (bool force = false) const | std::string string_value (bool force = false) const | |||
{ return rep->string_value (force); } | { return rep->string_value (force); } | |||
Array<std::string> cellstr_value (void) const | Array<std::string> cellstr_value (void) const | |||
{ return rep->cellstr_value (); } | { return rep->cellstr_value (); } | |||
Range range_value (void) const | Range range_value (void) const | |||
{ return rep->range_value (); } | { return rep->range_value (); } | |||
octave_map map_value (void) const; | octave_map map_value (void) const; | |||
octave_scalar_map scalar_map_value (void) const; | octave_scalar_map scalar_map_value (void) const; | |||
string_vector map_keys (void) const | string_vector map_keys (void) const | |||
{ return rep->map_keys (); } | { return rep->map_keys (); } | |||
size_t nparents (void) const | size_t nparents (void) const | |||
{ return rep->nparents (); } | { return rep->nparents (); } | |||
std::list<std::string> parent_class_name_list (void) const | std::list<std::string> parent_class_name_list (void) const | |||
{ return rep->parent_class_name_list (); } | { return rep->parent_class_name_list (); } | |||
string_vector parent_class_names (void) const | string_vector parent_class_names (void) const | |||
{ return rep->parent_class_names (); } | { return rep->parent_class_names (); } | |||
octave_base_value * | octave_base_value * | |||
find_parent_class (const std::string& parent_class_name) | find_parent_class (const std::string& parent_class_name) | |||
{ return rep->find_parent_class (parent_class_name); } | { return rep->find_parent_class (parent_class_name); } | |||
octave_function *function_value (bool silent = false) const; | octave_function *function_value (bool silent = false) const; | |||
octave_user_function *user_function_value (bool silent = false) const; | octave_user_function *user_function_value (bool silent = false) const; | |||
octave_user_script *user_script_value (bool silent = false) const; | octave_user_script *user_script_value (bool silent = false) const; | |||
octave_user_code *user_code_value (bool silent = false) const; | octave_user_code *user_code_value (bool silent = false) const; | |||
octave_fcn_handle *fcn_handle_value (bool silent = false) const; | octave_fcn_handle *fcn_handle_value (bool silent = false) const; | |||
octave_fcn_inline *fcn_inline_value (bool silent = false) const; | octave_fcn_inline *fcn_inline_value (bool silent = false) const; | |||
octave_value_list list_value (void) const; | octave_value_list list_value (void) const; | |||
ColumnVector column_vector_value (bool frc_str_conv = false, | ColumnVector column_vector_value (bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
ComplexColumnVector | ComplexColumnVector | |||
complex_column_vector_value (bool frc_str_conv = false, | complex_column_vector_value (bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
RowVector row_vector_value (bool frc_str_conv = false, | RowVector row_vector_value (bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
ComplexRowVector | ComplexRowVector | |||
complex_row_vector_value (bool frc_str_conv = false, | complex_row_vector_value (bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
FloatColumnVector float_column_vector_value (bool frc_str_conv = false, | FloatColumnVector float_column_vector_value (bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) c onst; | |||
FloatComplexColumnVector | FloatComplexColumnVector | |||
float_complex_column_vector_value (bool frc_str_conv = false, | float_complex_column_vector_value (bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
FloatRowVector float_row_vector_value (bool frc_str_conv = false, | FloatRowVector float_row_vector_value (bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
FloatComplexRowVector | FloatComplexRowVector | |||
float_complex_row_vector_value (bool frc_str_conv = false, | float_complex_row_vector_value (bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
Array<int> int_vector_value (bool req_int = false, | Array<int> int_vector_value (bool req_int = false, | |||
bool frc_str_conv = false, | bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
Array<octave_idx_type> | Array<octave_idx_type> | |||
octave_idx_type_vector_value (bool req_int = false, | octave_idx_type_vector_value (bool req_int = false, | |||
bool frc_str_conv = false, | bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
Array<double> vector_value (bool frc_str_conv = false, | Array<double> vector_value (bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
Array<Complex> complex_vector_value (bool frc_str_conv = false, | Array<Complex> complex_vector_value (bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
Array<float> float_vector_value (bool frc_str_conv = false, | Array<float> float_vector_value (bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
Array<FloatComplex> float_complex_vector_value (bool frc_str_conv = false | Array<FloatComplex> | |||
, | float_complex_vector_value (bool frc_str_conv = false, | |||
bool frc_vec_conv = false) const; | bool frc_vec_conv = false) const; | |||
// Possibly economize a lazy-indexed value. | // Possibly economize a lazy-indexed value. | |||
void maybe_economize (void) | void maybe_economize (void) | |||
{ rep->maybe_economize (); } | { rep->maybe_economize (); } | |||
// The following two hook conversions are called on any octave_value prio r to | // The following two hook conversions are called on any octave_value prio r to | |||
// storing it to a "permanent" location, like a named variable, a cell or a | // storing it to a "permanent" location, like a named variable, a cell or a | |||
// struct component, or a return value of a function. | // struct component, or a return value of a function. | |||
octave_value storable_value (void) const; | octave_value storable_value (void) const; | |||
// Ditto, but in place, i.e. equivalent to *this = this->storable_value ( ), | // Ditto, but in place, i.e. equivalent to *this = this->storable_value ( ), | |||
// but possibly more efficient. | // but possibly more efficient. | |||
void make_storable_value (void); | void make_storable_value (void); | |||
// Conversions. These should probably be private. If a user of this | // Conversions. These should probably be private. If a user of this | |||
// class wants a certain kind of constant, he should simply ask for | // class wants a certain kind of constant, he should simply ask for | |||
// it, and we should convert it if possible. | // it, and we should convert it if possible. | |||
octave_value convert_to_str (bool pad = false, bool force = false, | octave_value convert_to_str (bool pad = false, bool force = false, | |||
char type = '\'') const | char type = '\'') const | |||
{ return rep->convert_to_str (pad, force, type); } | { return rep->convert_to_str (pad, force, type); } | |||
octave_value | octave_value | |||
convert_to_str_internal (bool pad, bool force, char type) const | convert_to_str_internal (bool pad, bool force, char type) const | |||
{ return rep->convert_to_str_internal (pad, force, type); } | { return rep->convert_to_str_internal (pad, force, type); } | |||
void convert_to_row_or_column_vector (void) | void convert_to_row_or_column_vector (void) | |||
{ rep->convert_to_row_or_column_vector (); } | { rep->convert_to_row_or_column_vector (); } | |||
bool print_as_scalar (void) const | bool print_as_scalar (void) const | |||
{ return rep->print_as_scalar (); } | { return rep->print_as_scalar (); } | |||
void print (std::ostream& os, bool pr_as_read_syntax = false) const | void print (std::ostream& os, bool pr_as_read_syntax = false) const | |||
{ rep->print (os, pr_as_read_syntax); } | { rep->print (os, pr_as_read_syntax); } | |||
void print_raw (std::ostream& os, | void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const | |||
bool pr_as_read_syntax = false) const | { rep->print_raw (os, pr_as_read_syntax); } | |||
{ rep->print_raw (os, pr_as_read_syntax); } | ||||
bool print_name_tag (std::ostream& os, const std::string& name) const | bool print_name_tag (std::ostream& os, const std::string& name) const | |||
{ return rep->print_name_tag (os, name); } | { return rep->print_name_tag (os, name); } | |||
void print_with_name (std::ostream& os, const std::string& name) const | void print_with_name (std::ostream& os, const std::string& name) const | |||
{ rep->print_with_name (os, name, true); } | { rep->print_with_name (os, name, true); } | |||
void short_disp (std::ostream& os) const { rep->short_disp (os); } | ||||
int type_id (void) const { return rep->type_id (); } | int type_id (void) const { return rep->type_id (); } | |||
std::string type_name (void) const { return rep->type_name (); } | std::string type_name (void) const { return rep->type_name (); } | |||
std::string class_name (void) const { return rep->class_name (); } | std::string class_name (void) const { return rep->class_name (); } | |||
// Unary and binary operations. | // Unary and binary operations. | |||
friend OCTINTERP_API octave_value do_unary_op (unary_op op, | friend OCTINTERP_API octave_value do_unary_op (unary_op op, | |||
const octave_value& a); | const octave_value& a); | |||
octave_value& do_non_const_unary_op (unary_op op); | octave_value& do_non_const_unary_op (unary_op op); | |||
octave_value& do_non_const_unary_op (unary_op op, const std::string& type , | octave_value& do_non_const_unary_op (unary_op op, const std::string& type , | |||
const std::list<octave_value_list>& i dx); | const std::list<octave_value_list>& idx); | |||
friend OCTINTERP_API octave_value do_binary_op (binary_op op, | friend OCTINTERP_API octave_value do_binary_op (binary_op op, | |||
const octave_value& a, | const octave_value& a, | |||
const octave_value& b); | const octave_value& b); | |||
friend OCTINTERP_API octave_value do_binary_op (compound_binary_op op, | friend OCTINTERP_API octave_value do_binary_op (compound_binary_op op, | |||
const octave_value& a, | const octave_value& a, | |||
const octave_value& b); | const octave_value& b); | |||
friend OCTINTERP_API octave_value do_cat_op (const octave_value& a, | friend OCTINTERP_API octave_value do_cat_op (const octave_value& a, | |||
const octave_value& b, | const octave_value& b, | |||
const Array<octave_idx_type>& ra_idx); | const Array<octave_idx_type> | |||
& ra_idx); | ||||
const octave_base_value& get_rep (void) const { return *rep; } | const octave_base_value& get_rep (void) const { return *rep; } | |||
bool is_copy_of (const octave_value &val) const { return rep == val.rep; } | bool is_copy_of (const octave_value &val) const { return rep == val.rep; } | |||
void print_info (std::ostream& os, | void print_info (std::ostream& os, | |||
const std::string& prefix = std::string ()) cons t; | const std::string& prefix = std::string ()) const; | |||
bool save_ascii (std::ostream& os) { return rep->save_ascii (os); } | bool save_ascii (std::ostream& os) { return rep->save_ascii (os); } | |||
bool load_ascii (std::istream& is) { return rep->load_ascii (is); } | bool load_ascii (std::istream& is) { return rep->load_ascii (is); } | |||
bool save_binary (std::ostream& os, bool& save_as_floats) | bool save_binary (std::ostream& os, bool& save_as_floats) | |||
{ return rep->save_binary (os, save_as_floats); } | { return rep->save_binary (os, save_as_floats); } | |||
bool load_binary (std::istream& is, bool swap, | bool load_binary (std::istream& is, bool swap, | |||
oct_mach_info::float_format fmt) | oct_mach_info::float_format fmt) | |||
{ return rep->load_binary (is, swap, fmt); } | { return rep->load_binary (is, swap, fmt); } | |||
#if defined (HAVE_HDF5) | #if defined (HAVE_HDF5) | |||
bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats) | bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats) | |||
{ return rep->save_hdf5 (loc_id, name, save_as_floats); } | { return rep->save_hdf5 (loc_id, name, save_as_floats); } | |||
bool load_hdf5 (hid_t loc_id, const char *name) | bool load_hdf5 (hid_t loc_id, const char *name) | |||
{ return rep->load_hdf5 (loc_id, name); } | { return rep->load_hdf5 (loc_id, name); } | |||
#endif | #endif | |||
int write (octave_stream& os, int block_size, | int write (octave_stream& os, int block_size, | |||
oct_data_conv::data_type output_type, int skip, | oct_data_conv::data_type output_type, int skip, | |||
oct_mach_info::float_format flt_fmt) const; | oct_mach_info::float_format flt_fmt) const; | |||
octave_base_value *internal_rep (void) const { return rep; } | octave_base_value *internal_rep (void) const { return rep; } | |||
// Unsafe. These functions exist to support the MEX interface. | // Unsafe. These functions exist to support the MEX interface. | |||
// You should not use them anywhere else. | // You should not use them anywhere else. | |||
void *mex_get_data (void) const { return rep->mex_get_data (); } | void *mex_get_data (void) const { return rep->mex_get_data (); } | |||
octave_idx_type *mex_get_ir (void) const { return rep->mex_get_ir (); } | octave_idx_type *mex_get_ir (void) const { return rep->mex_get_ir (); } | |||
octave_idx_type *mex_get_jc (void) const { return rep->mex_get_jc (); } | octave_idx_type *mex_get_jc (void) const { return rep->mex_get_jc (); } | |||
mxArray *as_mxArray (void) const { return rep->as_mxArray (); } | mxArray *as_mxArray (void) const { return rep->as_mxArray (); } | |||
octave_value diag (octave_idx_type k = 0) const | octave_value diag (octave_idx_type k = 0) const | |||
{ return rep->diag (k); } | { return rep->diag (k); } | |||
octave_value diag (octave_idx_type m, octave_idx_type n) const | ||||
{ return rep->diag (m, n); } | ||||
octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) co nst | |||
{ return rep->sort (dim, mode); } | { return rep->sort (dim, mode); } | |||
octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |||
sortmode mode = ASCENDING) const | sortmode mode = ASCENDING) const | |||
{ return rep->sort (sidx, dim, mode); } | { return rep->sort (sidx, dim, mode); } | |||
sortmode is_sorted (sortmode mode = UNSORTED) const | sortmode is_sorted (sortmode mode = UNSORTED) const | |||
{ return rep->is_sorted (mode); } | { return rep->is_sorted (mode); } | |||
Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const | Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const | |||
{ return rep->sort_rows_idx (mode); } | { return rep->sort_rows_idx (mode); } | |||
sortmode is_sorted_rows (sortmode mode = UNSORTED) const | sortmode is_sorted_rows (sortmode mode = UNSORTED) const | |||
{ return rep->is_sorted_rows (mode); } | { return rep->is_sorted_rows (mode); } | |||
void lock (void) { rep->lock (); } | void lock (void) { rep->lock (); } | |||
void unlock (void) { rep->unlock (); } | void unlock (void) { rep->unlock (); } | |||
bool islocked (void) const { return rep->islocked (); } | bool islocked (void) const { return rep->islocked (); } | |||
void dump (std::ostream& os) const { rep->dump (os); } | void dump (std::ostream& os) const { rep->dump (os); } | |||
#define MAPPER_FORWARD(F) \ | #define MAPPER_FORWARD(F) \ | |||
skipping to change at line 1120 | skipping to change at line 1146 | |||
MAPPER_FORWARD (asinh) | MAPPER_FORWARD (asinh) | |||
MAPPER_FORWARD (atan) | MAPPER_FORWARD (atan) | |||
MAPPER_FORWARD (atanh) | MAPPER_FORWARD (atanh) | |||
MAPPER_FORWARD (cbrt) | MAPPER_FORWARD (cbrt) | |||
MAPPER_FORWARD (ceil) | MAPPER_FORWARD (ceil) | |||
MAPPER_FORWARD (conj) | MAPPER_FORWARD (conj) | |||
MAPPER_FORWARD (cos) | MAPPER_FORWARD (cos) | |||
MAPPER_FORWARD (cosh) | MAPPER_FORWARD (cosh) | |||
MAPPER_FORWARD (erf) | MAPPER_FORWARD (erf) | |||
MAPPER_FORWARD (erfinv) | MAPPER_FORWARD (erfinv) | |||
MAPPER_FORWARD (erfcinv) | ||||
MAPPER_FORWARD (erfc) | MAPPER_FORWARD (erfc) | |||
MAPPER_FORWARD (erfcx) | MAPPER_FORWARD (erfcx) | |||
MAPPER_FORWARD (erfi) | ||||
MAPPER_FORWARD (dawson) | ||||
MAPPER_FORWARD (exp) | MAPPER_FORWARD (exp) | |||
MAPPER_FORWARD (expm1) | MAPPER_FORWARD (expm1) | |||
MAPPER_FORWARD (finite) | MAPPER_FORWARD (finite) | |||
MAPPER_FORWARD (fix) | MAPPER_FORWARD (fix) | |||
MAPPER_FORWARD (floor) | MAPPER_FORWARD (floor) | |||
MAPPER_FORWARD (gamma) | MAPPER_FORWARD (gamma) | |||
MAPPER_FORWARD (imag) | MAPPER_FORWARD (imag) | |||
MAPPER_FORWARD (isinf) | MAPPER_FORWARD (isinf) | |||
MAPPER_FORWARD (isna) | MAPPER_FORWARD (isna) | |||
MAPPER_FORWARD (isnan) | MAPPER_FORWARD (isnan) | |||
skipping to change at line 1162 | skipping to change at line 1191 | |||
MAPPER_FORWARD (xisascii) | MAPPER_FORWARD (xisascii) | |||
MAPPER_FORWARD (xiscntrl) | MAPPER_FORWARD (xiscntrl) | |||
MAPPER_FORWARD (xisdigit) | MAPPER_FORWARD (xisdigit) | |||
MAPPER_FORWARD (xisgraph) | MAPPER_FORWARD (xisgraph) | |||
MAPPER_FORWARD (xislower) | MAPPER_FORWARD (xislower) | |||
MAPPER_FORWARD (xisprint) | MAPPER_FORWARD (xisprint) | |||
MAPPER_FORWARD (xispunct) | MAPPER_FORWARD (xispunct) | |||
MAPPER_FORWARD (xisspace) | MAPPER_FORWARD (xisspace) | |||
MAPPER_FORWARD (xisupper) | MAPPER_FORWARD (xisupper) | |||
MAPPER_FORWARD (xisxdigit) | MAPPER_FORWARD (xisxdigit) | |||
MAPPER_FORWARD (xsignbit) | ||||
MAPPER_FORWARD (xtoascii) | MAPPER_FORWARD (xtoascii) | |||
MAPPER_FORWARD (xtolower) | MAPPER_FORWARD (xtolower) | |||
MAPPER_FORWARD (xtoupper) | MAPPER_FORWARD (xtoupper) | |||
#undef MAPPER_FORWARD | #undef MAPPER_FORWARD | |||
octave_value map (octave_base_value::unary_mapper_t umap) const | octave_value map (octave_base_value::unary_mapper_t umap) const | |||
{ return rep->map (umap); } | { return rep->map (umap); } | |||
// Extract the n-th element, aka val(n). Result is undefined if val is no t an | // Extract the n-th element, aka val(n). Result is undefined if val is no t an | |||
// array type or n is out of range. Never error. | // array type or n is out of range. Never error. | |||
octave_value | octave_value | |||
fast_elem_extract (octave_idx_type n) const | fast_elem_extract (octave_idx_type n) const | |||
{ return rep->fast_elem_extract (n); } | { return rep->fast_elem_extract (n); } | |||
// Assign the n-th element, aka val(n) = x. Returns false if val is not a n | // Assign the n-th element, aka val(n) = x. Returns false if val is not a n | |||
// array type, x is not a matching scalar type, or n is out of range. | // array type, x is not a matching scalar type, or n is out of range. | |||
// Never error. | // Never error. | |||
virtual bool | virtual bool | |||
fast_elem_insert (octave_idx_type n, const octave_value& x) | fast_elem_insert (octave_idx_type n, const octave_value& x) | |||
{ | { | |||
make_unique (); | make_unique (); | |||
return rep->fast_elem_insert (n, x); | return rep->fast_elem_insert (n, x); | |||
} | } | |||
protected: | protected: | |||
// The real representation. | // The real representation. | |||
octave_base_value *rep; | octave_base_value *rep; | |||
private: | private: | |||
assign_op unary_op_to_assign_op (unary_op op); | assign_op unary_op_to_assign_op (unary_op op); | |||
skipping to change at line 1315 | skipping to change at line 1345 | |||
// This will eventually go away, but for now it can be used to | // This will eventually go away, but for now it can be used to | |||
// simplify the transition to the new octave_value class hierarchy, | // simplify the transition to the new octave_value class hierarchy, | |||
// which uses octave_base_value instead of octave_value for the type | // which uses octave_base_value instead of octave_value for the type | |||
// of octave_value::rep. | // of octave_value::rep. | |||
#define OV_REP_TYPE octave_base_value | #define OV_REP_TYPE octave_base_value | |||
// Templated value extractors. | // Templated value extractors. | |||
template<class Value> | template<class Value> | |||
inline Value octave_value_extract (const octave_value&) | inline Value octave_value_extract (const octave_value&) | |||
{ assert (false); } | { assert (false); } | |||
#define DEF_VALUE_EXTRACTOR(VALUE,MPREFIX) \ | #define DEF_VALUE_EXTRACTOR(VALUE,MPREFIX) \ | |||
template<> \ | template<> \ | |||
inline VALUE octave_value_extract<VALUE> (const octave_value& v) \ | inline VALUE octave_value_extract<VALUE> (const octave_value& v) \ | |||
{ return v.MPREFIX ## _value (); } | { return v.MPREFIX ## _value (); } | |||
DEF_VALUE_EXTRACTOR (double, scalar) | DEF_VALUE_EXTRACTOR (double, scalar) | |||
DEF_VALUE_EXTRACTOR (float, float_scalar) | DEF_VALUE_EXTRACTOR (float, float_scalar) | |||
DEF_VALUE_EXTRACTOR (Complex, complex) | DEF_VALUE_EXTRACTOR (Complex, complex) | |||
DEF_VALUE_EXTRACTOR (FloatComplex, float_complex) | DEF_VALUE_EXTRACTOR (FloatComplex, float_complex) | |||
End of changes. 196 change blocks. | ||||
255 lines changed or deleted | 281 lines changed or added | |||
pager.h | pager.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
parse.h | parse.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 31 | skipping to change at line 31 | |||
*/ | */ | |||
#if !defined (octave_parse_h) | #if !defined (octave_parse_h) | |||
#define octave_parse_h 1 | #define octave_parse_h 1 | |||
#include <cstdio> | #include <cstdio> | |||
#include <string> | #include <string> | |||
#include <stack> | #include <stack> | |||
#include <vector> | ||||
#include <map> | ||||
extern void reset_parser (void); | #include "lex.h" | |||
extern int octave_lex (void); | #include "symtab.h" | |||
extern int octave_parse (void); | #include "token.h" | |||
class octave_comment_list; | ||||
class octave_function; | ||||
class octave_user_function; | ||||
class tree; | class tree; | |||
class tree_matrix; | class tree_anon_fcn_handle; | |||
class tree_argument_list; | ||||
class tree_array_list; | ||||
class tree_cell; | ||||
class tree_colon_expression; | ||||
class tree_command; | ||||
class tree_constant; | ||||
class tree_decl_command; | ||||
class tree_decl_init_list; | ||||
class tree_expression; | ||||
class tree_fcn_handle; | ||||
class tree_function_def; | ||||
class tree_identifier; | class tree_identifier; | |||
class tree_if_clause; | ||||
class tree_if_command; | ||||
class tree_if_command_list; | ||||
class tree_index_expression; | ||||
class tree_matrix; | ||||
class tree_matrix; | ||||
class tree_parameter_list; | ||||
class tree_statement; | ||||
class tree_statement_list; | class tree_statement_list; | |||
class octave_function; | class tree_statement_listtree_statement; | |||
class tree_switch_case; | ||||
class tree_switch_case_list; | ||||
class tree_switch_command; | ||||
#include "oct-obj.h" | #include "oct-obj.h" | |||
// Nonzero means print parser debugging info (-d). | // Nonzero means print parser debugging info (-d). | |||
extern int octave_debug; | extern int octave_debug; | |||
// The current input line number. | ||||
extern int input_line_number; | ||||
// The column of the current token. | ||||
extern int current_input_column; | ||||
// Buffer for help text snagged from function files. | ||||
extern std::stack<std::string> help_buf; | ||||
// TRUE means we are using readline. | ||||
extern bool line_editing; | ||||
// TRUE means we printed messages about reading startup files. | // TRUE means we printed messages about reading startup files. | |||
extern bool reading_startup_message_printed; | extern bool reading_startup_message_printed; | |||
// TRUE means input is coming from startup file. | ||||
extern bool input_from_startup_file; | ||||
// Keep track of symbol table information when parsing functions. | ||||
extern std::stack<symbol_table::scope_id> symtab_context; | ||||
// Name of the current class when we are parsing class methods or | ||||
// constructors. | ||||
extern std::string current_class_name; | ||||
extern OCTINTERP_API std::string | extern OCTINTERP_API std::string | |||
get_help_from_file (const std::string& nm, bool& symbol_found, | get_help_from_file (const std::string& nm, bool& symbol_found, | |||
std::string& file); | std::string& file); | |||
extern OCTINTERP_API std::string | extern OCTINTERP_API std::string | |||
get_help_from_file (const std::string& nm, bool& symbol_found); | get_help_from_file (const std::string& nm, bool& symbol_found); | |||
extern OCTINTERP_API std::string lookup_autoload (const std::string& nm); | extern OCTINTERP_API std::string lookup_autoload (const std::string& nm); | |||
extern OCTINTERP_API string_vector autoloaded_functions (void); | extern OCTINTERP_API string_vector autoloaded_functions (void); | |||
extern OCTINTERP_API string_vector reverse_lookup_autoload (const std::stri | extern OCTINTERP_API string_vector | |||
ng& nm); | reverse_lookup_autoload (const std::string& nm); | |||
extern OCTINTERP_API octave_function * | extern OCTINTERP_API octave_function * | |||
load_fcn_from_file (const std::string& file_name, | load_fcn_from_file (const std::string& file_name, | |||
const std::string& dir_name = std::string (), | const std::string& dir_name = std::string (), | |||
const std::string& dispatch_type = std::string (), | const std::string& dispatch_type = std::string (), | |||
const std::string& fcn_name = std::string (), | const std::string& fcn_name = std::string (), | |||
bool autoload = false); | bool autoload = false); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
source_file (const std::string& file_name, | source_file (const std::string& file_name, | |||
skipping to change at line 119 | skipping to change at line 125 | |||
feval (const octave_value_list& args, int nargout = 0); | feval (const octave_value_list& args, int nargout = 0); | |||
extern OCTINTERP_API octave_value_list | extern OCTINTERP_API octave_value_list | |||
eval_string (const std::string&, bool silent, int& parse_status, int hargou t); | eval_string (const std::string&, bool silent, int& parse_status, int hargou t); | |||
extern OCTINTERP_API octave_value | extern OCTINTERP_API octave_value | |||
eval_string (const std::string&, bool silent, int& parse_status); | eval_string (const std::string&, bool silent, int& parse_status); | |||
extern OCTINTERP_API void cleanup_statement_list (tree_statement_list **lst ); | extern OCTINTERP_API void cleanup_statement_list (tree_statement_list **lst ); | |||
// Global access to currently active lexer. | ||||
// FIXME: to be removed after more parser+lexer refactoring. | ||||
extern octave_base_lexer *LEXER; | ||||
class | ||||
octave_base_parser | ||||
{ | ||||
public: | ||||
octave_base_parser (octave_base_lexer& lxr) | ||||
: endfunction_found (false), | ||||
autoloading (false), fcn_file_from_relative_lookup (false), | ||||
parsing_subfunctions (false), max_fcn_depth (0), | ||||
curr_fcn_depth (0), primary_fcn_scope (-1), | ||||
curr_class_name (), function_scopes (), primary_fcn_ptr (0), | ||||
subfunction_names (), stmt_list (0), | ||||
lexer (lxr) | ||||
{ } | ||||
~octave_base_parser (void); | ||||
void reset (void); | ||||
// Error mesages for mismatched end tokens. | ||||
void end_error (const char *type, token::end_tok_type ettype, int l, int | ||||
c); | ||||
// Check to see that end tokens are properly matched. | ||||
bool end_token_ok (token *tok, token::end_tok_type expected); | ||||
// Maybe print a warning if an assignment expression is used as the | ||||
// test in a logical expression. | ||||
void maybe_warn_assign_as_truth_value (tree_expression *expr); | ||||
// Maybe print a warning about switch labels that aren't constants. | ||||
void maybe_warn_variable_switch_label (tree_expression *expr); | ||||
// Finish building a range. | ||||
tree_expression *finish_colon_expression (tree_colon_expression *e); | ||||
// Build a constant. | ||||
tree_constant *make_constant (int op, token *tok_val); | ||||
// Build a function handle. | ||||
tree_fcn_handle *make_fcn_handle (token *tok_val); | ||||
// Build an anonymous function handle. | ||||
tree_anon_fcn_handle * | ||||
make_anon_fcn_handle (tree_parameter_list *param_list, tree_statement *st | ||||
mt); | ||||
// Build a binary expression. | ||||
tree_expression * | ||||
make_binary_op (int op, tree_expression *op1, token *tok_val, | ||||
tree_expression *op2); | ||||
// Build a boolean expression. | ||||
tree_expression * | ||||
make_boolean_op (int op, tree_expression *op1, token *tok_val, | ||||
tree_expression *op2); | ||||
// Build a prefix expression. | ||||
tree_expression * | ||||
make_prefix_op (int op, tree_expression *op1, token *tok_val); | ||||
// Build a postfix expression. | ||||
tree_expression * | ||||
make_postfix_op (int op, tree_expression *op1, token *tok_val); | ||||
// Build an unwind-protect command. | ||||
tree_command * | ||||
make_unwind_command (token *unwind_tok, tree_statement_list *body, | ||||
tree_statement_list *cleanup, token *end_tok, | ||||
octave_comment_list *lc, octave_comment_list *mc); | ||||
// Build a try-catch command. | ||||
tree_command * | ||||
make_try_command (token *try_tok, tree_statement_list *body, | ||||
char catch_sep, tree_statement_list *cleanup, | ||||
token *end_tok, octave_comment_list *lc, | ||||
octave_comment_list *mc); | ||||
// Build a while command. | ||||
tree_command * | ||||
make_while_command (token *while_tok, tree_expression *expr, | ||||
tree_statement_list *body, token *end_tok, | ||||
octave_comment_list *lc); | ||||
// Build a do-until command. | ||||
tree_command * | ||||
make_do_until_command (token *until_tok, tree_statement_list *body, | ||||
tree_expression *expr, octave_comment_list *lc); | ||||
// Build a for command. | ||||
tree_command * | ||||
make_for_command (int tok_id, token *for_tok, tree_argument_list *lhs, | ||||
tree_expression *expr, tree_expression *maxproc, | ||||
tree_statement_list *body, token *end_tok, | ||||
octave_comment_list *lc); | ||||
// Build a break command. | ||||
tree_command *make_break_command (token *break_tok); | ||||
// Build a continue command. | ||||
tree_command *make_continue_command (token *continue_tok); | ||||
// Build a return command. | ||||
tree_command *make_return_command (token *return_tok); | ||||
// Start an if command. | ||||
tree_if_command_list * | ||||
start_if_command (tree_expression *expr, tree_statement_list *list); | ||||
// Finish an if command. | ||||
tree_if_command * | ||||
finish_if_command (token *if_tok, tree_if_command_list *list, | ||||
token *end_tok, octave_comment_list *lc); | ||||
// Build an elseif clause. | ||||
tree_if_clause * | ||||
make_elseif_clause (token *elseif_tok, tree_expression *expr, | ||||
tree_statement_list *list, octave_comment_list *lc); | ||||
// Finish a switch command. | ||||
tree_switch_command * | ||||
finish_switch_command (token *switch_tok, tree_expression *expr, | ||||
tree_switch_case_list *list, token *end_tok, | ||||
octave_comment_list *lc); | ||||
// Build a switch case. | ||||
tree_switch_case * | ||||
make_switch_case (token *case_tok, tree_expression *expr, | ||||
tree_statement_list *list, octave_comment_list *lc); | ||||
// Build an assignment to a variable. | ||||
tree_expression * | ||||
make_assign_op (int op, tree_argument_list *lhs, token *eq_tok, | ||||
tree_expression *rhs); | ||||
// Define a script. | ||||
void make_script (tree_statement_list *cmds, tree_statement *end_script); | ||||
// Begin defining a function. | ||||
octave_user_function * | ||||
start_function (tree_parameter_list *param_list, tree_statement_list *bod | ||||
y, | ||||
tree_statement *end_function); | ||||
// Create a no-op statement for end_function. | ||||
tree_statement *make_end (const std::string& type, bool eof, int l, int c | ||||
); | ||||
// Do most of the work for defining a function. | ||||
octave_user_function * | ||||
frob_function (const std::string& fname, octave_user_function *fcn); | ||||
// Finish defining a function. | ||||
tree_function_def * | ||||
finish_function (tree_parameter_list *ret_list, | ||||
octave_user_function *fcn, octave_comment_list *lc, | ||||
int l, int c); | ||||
// Reset state after parsing function. | ||||
void | ||||
recover_from_parsing_function (void); | ||||
// Make an index expression. | ||||
tree_index_expression * | ||||
make_index_expression (tree_expression *expr, | ||||
tree_argument_list *args, char type); | ||||
// Make an indirect reference expression. | ||||
tree_index_expression * | ||||
make_indirect_ref (tree_expression *expr, const std::string&); | ||||
// Make an indirect reference expression with dynamic field name. | ||||
tree_index_expression * | ||||
make_indirect_ref (tree_expression *expr, tree_expression *field); | ||||
// Make a declaration command. | ||||
tree_decl_command * | ||||
make_decl_command (int tok, token *tok_val, tree_decl_init_list *lst); | ||||
// Validate matrix or cell | ||||
bool validate_array_list (tree_expression *e); | ||||
// Validate matrix object used in "[lhs] = ..." assignments. | ||||
tree_argument_list *validate_matrix_for_assignment (tree_expression *e); | ||||
// Finish building an array_list (common action for finish_matrix | ||||
// and finish_cell). | ||||
tree_expression *finish_array_list (tree_array_list *a); | ||||
// Finish building a matrix list. | ||||
tree_expression *finish_matrix (tree_matrix *m); | ||||
// Finish building a cell list. | ||||
tree_expression *finish_cell (tree_cell *c); | ||||
// Maybe print a warning. Duh. | ||||
void maybe_warn_missing_semi (tree_statement_list *); | ||||
// Set the print flag for a statement based on the separator type. | ||||
tree_statement_list * | ||||
set_stmt_print_flag (tree_statement_list *, char, bool); | ||||
// Finish building a statement. | ||||
template <class T> | ||||
tree_statement *make_statement (T *arg); | ||||
// Create a statement list. | ||||
tree_statement_list *make_statement_list (tree_statement *stmt); | ||||
// Append a statement to an existing statement list. | ||||
tree_statement_list * | ||||
append_statement_list (tree_statement_list *list, char sep, | ||||
tree_statement *stmt, bool warn_missing_semi); | ||||
// Generic error messages. | ||||
void bison_error (const char *s); | ||||
// Have we found an explicit end to a function? | ||||
bool endfunction_found; | ||||
// TRUE means we are in the process of autoloading a function. | ||||
bool autoloading; | ||||
// TRUE means the current function file was found in a relative path | ||||
// element. | ||||
bool fcn_file_from_relative_lookup; | ||||
// FALSE if we are still at the primary function. Subfunctions can | ||||
// only be declared inside function files. | ||||
bool parsing_subfunctions; | ||||
// Maximum function depth detected. Used to determine whether | ||||
// we have nested functions or just implicitly ended subfunctions. | ||||
int max_fcn_depth; | ||||
// = 0 currently outside any function. | ||||
// = 1 inside the primary function or a subfunction. | ||||
// > 1 means we are looking at a function definition that seems to be | ||||
// inside a function. Note that the function still might not be a | ||||
// nested function. | ||||
int curr_fcn_depth; | ||||
// Scope where we install all subfunctions and nested functions. Only | ||||
// used while reading function files. | ||||
symbol_table::scope_id primary_fcn_scope; | ||||
// Name of the current class when we are parsing class methods or | ||||
// constructors. | ||||
std::string curr_class_name; | ||||
// A stack holding the nested function scopes being parsed. | ||||
// We don't use std::stack, because we want the clear method. Also, we | ||||
// must access one from the top | ||||
std::vector<symbol_table::scope_id> function_scopes; | ||||
// Pointer to the primary user function or user script function. | ||||
octave_function *primary_fcn_ptr; | ||||
// List of subfunction names, initially in the order they are | ||||
// installed in the symbol table, then ordered as they appear in the | ||||
// file. Eventually stashed in the primary function object. | ||||
std::list<std::string> subfunction_names; | ||||
// Result of parsing input. | ||||
tree_statement_list *stmt_list; | ||||
// State of the lexer. | ||||
octave_base_lexer& lexer; | ||||
private: | ||||
// No copying! | ||||
octave_base_parser (const octave_base_parser&); | ||||
octave_base_parser& operator = (const octave_base_parser&); | ||||
}; | ||||
class | ||||
octave_parser : public octave_base_parser | ||||
{ | ||||
public: | ||||
octave_parser (void) | ||||
: octave_base_parser (*(new octave_lexer ())) | ||||
{ } | ||||
octave_parser (FILE *file) | ||||
: octave_base_parser (*(new octave_lexer (file))) | ||||
{ } | ||||
octave_parser (const std::string& eval_string) | ||||
: octave_base_parser (*(new octave_lexer (eval_string))) | ||||
{ } | ||||
octave_parser (octave_lexer& lxr) | ||||
: octave_base_parser (lxr) | ||||
{ } | ||||
~octave_parser (void) { } | ||||
int run (void); | ||||
private: | ||||
// No copying! | ||||
octave_parser (const octave_parser&); | ||||
octave_parser& operator = (const octave_parser&); | ||||
}; | ||||
class | ||||
octave_push_parser : public octave_base_parser | ||||
{ | ||||
public: | ||||
octave_push_parser (void) | ||||
: octave_base_parser (*(new octave_push_lexer ())), parser_state (0) | ||||
{ | ||||
init (); | ||||
} | ||||
~octave_push_parser (void); | ||||
void init (void); | ||||
int run (const std::string& input, bool eof); | ||||
private: | ||||
// Internal state of the Bison parser. | ||||
void *parser_state; | ||||
// No copying! | ||||
octave_push_parser (const octave_push_parser&); | ||||
octave_push_parser& operator = (const octave_push_parser&); | ||||
}; | ||||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
30 lines changed or deleted | 380 lines changed or added | |||
pathlen.h | pathlen.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
pathsearch.h | pathsearch.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 39 | skipping to change at line 39 | |||
class | class | |||
OCTAVE_API | OCTAVE_API | |||
dir_path | dir_path | |||
{ | { | |||
public: | public: | |||
dir_path (const std::string& s = std::string (), | dir_path (const std::string& s = std::string (), | |||
const std::string& d = std::string ()) | const std::string& d = std::string ()) | |||
: p_orig (s), p_default (d), initialized (false), p (), pv () | : p_orig (s), p_default (d), initialized (false), p (), pv () | |||
{ | { | |||
if (! p_orig.empty ()) | if (! p_orig.empty ()) | |||
init (); | init (); | |||
} | } | |||
dir_path (const dir_path& dp) | dir_path (const dir_path& dp) | |||
: p_orig (dp.p_orig), p_default (dp.p_default), | : p_orig (dp.p_orig), p_default (dp.p_default), | |||
initialized (dp.initialized), p (dp.p), pv (dp.pv) | initialized (dp.initialized), p (dp.p), pv (dp.pv) | |||
{ } | { } | |||
dir_path& operator = (const dir_path& dp) | dir_path& operator = (const dir_path& dp) | |||
{ | { | |||
p_orig = dp.p_orig; | p_orig = dp.p_orig; | |||
p_default = dp.p_default; | p_default = dp.p_default; | |||
initialized = dp.initialized; | initialized = dp.initialized; | |||
p = dp.p; | p = dp.p; | |||
pv = dp.pv; | pv = dp.pv; | |||
return *this; | return *this; | |||
} | } | |||
~dir_path (void) { } | ~dir_path (void) { } | |||
void set (const std::string& s) | void set (const std::string& s) | |||
{ | { | |||
initialized = false; | initialized = false; | |||
p_orig = s; | p_orig = s; | |||
init (); | init (); | |||
} | } | |||
string_vector elements (void); | string_vector elements (void); | |||
string_vector all_directories (void); | string_vector all_directories (void); | |||
std::string find_first (const std::string&); | std::string find_first (const std::string&); | |||
std::string find (const std::string& nm) { return find_first (nm); } | std::string find (const std::string& nm) { return find_first (nm); } | |||
string_vector find_all (const std::string&); | string_vector find_all (const std::string&); | |||
std::string find_first_of (const string_vector& names); | std::string find_first_of (const string_vector& names); | |||
string_vector find_all_first_of (const string_vector& names); | string_vector find_all_first_of (const string_vector& names); | |||
void rehash (void) | void rehash (void) | |||
{ | { | |||
initialized = false; | initialized = false; | |||
init (); | init (); | |||
} | } | |||
static char path_sep_char (void) | static char path_sep_char (void) | |||
{ | { | |||
return static_members::path_sep_char (); | return static_members::path_sep_char (); | |||
} | } | |||
static void path_sep_char (char c) | static void path_sep_char (char c) | |||
{ | { | |||
static_members::path_sep_char (c); | static_members::path_sep_char (c); | |||
} | } | |||
End of changes. 5 change blocks. | ||||
22 lines changed or deleted | 22 lines changed or added | |||
pr-output.h | pr-output.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 50 | skipping to change at line 50 | |||
class FloatDiagMatrix; | class FloatDiagMatrix; | |||
class NDArray; | class NDArray; | |||
class FloatNDArray; | class FloatNDArray; | |||
class Range; | class Range; | |||
class boolMatrix; | class boolMatrix; | |||
class boolNDArray; | class boolNDArray; | |||
class charMatrix; | class charMatrix; | |||
class charNDArray; | class charNDArray; | |||
class PermMatrix; | class PermMatrix; | |||
class Cell; | class Cell; | |||
class octave_value; | ||||
#include "intNDArray.h" | #include "intNDArray.h" | |||
#include "oct-inttypes.h" | #include "oct-inttypes.h" | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
octave_print_internal (std::ostream& os, bool d, | octave_print_internal (std::ostream& os, bool d, | |||
bool pr_as_read_syntax = false); | bool pr_as_read_syntax = false); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
octave_print_internal (std::ostream& os, char c, | ||||
bool pr_as_read_syntax = false); | ||||
extern OCTINTERP_API void | ||||
octave_print_internal (std::ostream& os, double d, | octave_print_internal (std::ostream& os, double d, | |||
bool pr_as_read_syntax = false); | bool pr_as_read_syntax = false); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
octave_print_internal (std::ostream& os, float d, | octave_print_internal (std::ostream& os, float d, | |||
bool pr_as_read_syntax = false); | bool pr_as_read_syntax = false); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
octave_print_internal (std::ostream& os, const Matrix& m, | octave_print_internal (std::ostream& os, const Matrix& m, | |||
bool pr_as_read_syntax = false, | bool pr_as_read_syntax = false, | |||
skipping to change at line 254 | skipping to change at line 259 | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
octave_print_internal (std::ostream& os, const octave_int<uint64_t>& sa, | octave_print_internal (std::ostream& os, const octave_int<uint64_t>& sa, | |||
bool pr_as_read_syntax = false); | bool pr_as_read_syntax = false); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
octave_print_internal (std::ostream& os, const Cell& cell, | octave_print_internal (std::ostream& os, const Cell& cell, | |||
bool pr_as_read_syntax = false, | bool pr_as_read_syntax = false, | |||
int extra_indent = 0, | int extra_indent = 0, | |||
bool pr_as_string = false); | bool pr_as_string = false); | |||
extern OCTINTERP_API void | ||||
octave_print_internal (std::ostream& os, const octave_value& ov, | ||||
bool pr_as_read_syntax = false); | ||||
// TRUE means that the dimensions of empty objects should be printed | // TRUE means that the dimensions of empty objects should be printed | |||
// like this: x = [](2x0). | // like this: x = [](2x0). | |||
extern bool Vprint_empty_dimensions; | extern bool Vprint_empty_dimensions; | |||
// TRUE means don't put empty lines in output | // TRUE means don't put empty lines in output | |||
extern bool Vcompact_format; | extern bool Vcompact_format; | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 10 lines changed or added | |||
procstream.h | procstream.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 48 | skipping to change at line 48 | |||
procstreambase (void) : pb () { pb_init (); } | procstreambase (void) : pb () { pb_init (); } | |||
procstreambase (const std::string& name, int mode); | procstreambase (const std::string& name, int mode); | |||
procstreambase (const char *name, int mode); | procstreambase (const char *name, int mode); | |||
~procstreambase (void) { close (); } | ~procstreambase (void) { close (); } | |||
void open (const std::string& name, int mode) | void open (const std::string& name, int mode) | |||
{ open (name.c_str (), mode); } | { open (name.c_str (), mode); } | |||
void open (const char *name, int mode); | void open (const char *name, int mode); | |||
int is_open (void) const { return pb.is_open (); } | int is_open (void) const { return pb.is_open (); } | |||
int close (void); | int close (void); | |||
pid_t pid (void) const { return pb.pid (); } | pid_t pid (void) const { return pb.pid (); } | |||
int file_number (void) const { return pb.file_number (); } | int file_number (void) const { return pb.file_number (); } | |||
skipping to change at line 89 | skipping to change at line 89 | |||
iprocstream (const std::string& name, int mode = std::ios::in) | iprocstream (const std::string& name, int mode = std::ios::in) | |||
: std::istream (0), procstreambase (name, mode) { } | : std::istream (0), procstreambase (name, mode) { } | |||
iprocstream (const char *name, int mode = std::ios::in) | iprocstream (const char *name, int mode = std::ios::in) | |||
: std::istream (0), procstreambase (name, mode) { } | : std::istream (0), procstreambase (name, mode) { } | |||
~iprocstream (void) { } | ~iprocstream (void) { } | |||
void open (const std::string& name, int mode = std::ios::in) | void open (const std::string& name, int mode = std::ios::in) | |||
{ procstreambase::open (name, mode); } | { procstreambase::open (name, mode); } | |||
void open (const char *name, int mode = std::ios::in) | void open (const char *name, int mode = std::ios::in) | |||
{ procstreambase::open (name, mode); } | { procstreambase::open (name, mode); } | |||
private: | private: | |||
iprocstream (const iprocstream&); | iprocstream (const iprocstream&); | |||
iprocstream& operator = (const iprocstream&); | iprocstream& operator = (const iprocstream&); | |||
}; | }; | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
oprocstream : public std::ostream, public procstreambase | oprocstream : public std::ostream, public procstreambase | |||
// oprocstream : public procstreambase, public std::ostream | // oprocstream : public procstreambase, public std::ostream | |||
{ | { | |||
public: | public: | |||
oprocstream (void) : std::ostream (0), procstreambase () { } | oprocstream (void) : std::ostream (0), procstreambase () { } | |||
oprocstream (const std::string& name, int mode = std::ios::out) | oprocstream (const std::string& name, int mode = std::ios::out) | |||
: std::ostream (0), procstreambase(name, mode) { } | : std::ostream (0), procstreambase (name, mode) { } | |||
oprocstream (const char *name, int mode = std::ios::out) | oprocstream (const char *name, int mode = std::ios::out) | |||
: std::ostream (0), procstreambase(name, mode) { } | : std::ostream (0), procstreambase (name, mode) { } | |||
~oprocstream (void) { } | ~oprocstream (void) { } | |||
void open (const std::string& name, int mode = std::ios::out) | void open (const std::string& name, int mode = std::ios::out) | |||
{ procstreambase::open (name, mode); } | { procstreambase::open (name, mode); } | |||
void open (const char *name, int mode = std::ios::out) | void open (const char *name, int mode = std::ios::out) | |||
{ procstreambase::open (name, mode); } | { procstreambase::open (name, mode); } | |||
private: | private: | |||
oprocstream (const oprocstream&); | oprocstream (const oprocstream&); | |||
oprocstream& operator = (const oprocstream&); | oprocstream& operator = (const oprocstream&); | |||
}; | }; | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
skipping to change at line 149 | skipping to change at line 149 | |||
procstream (const std::string& name, int mode) | procstream (const std::string& name, int mode) | |||
: std::iostream (0), procstreambase (name, mode) { } | : std::iostream (0), procstreambase (name, mode) { } | |||
procstream (const char *name, int mode) | procstream (const char *name, int mode) | |||
: std::iostream (0), procstreambase (name, mode) { } | : std::iostream (0), procstreambase (name, mode) { } | |||
~procstream (void) { } | ~procstream (void) { } | |||
void open (const std::string& name, int mode) | void open (const std::string& name, int mode) | |||
{ procstreambase::open (name, mode); } | { procstreambase::open (name, mode); } | |||
void open (const char *name, int mode) | void open (const char *name, int mode) | |||
{ procstreambase::open (name, mode); } | { procstreambase::open (name, mode); } | |||
private: | private: | |||
procstream (const procstream&); | procstream (const procstream&); | |||
procstream& operator = (const procstream&); | procstream& operator = (const procstream&); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 10 change blocks. | ||||
10 lines changed or deleted | 10 lines changed or added | |||
profiler.h | profiler.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2012 Daniel Kraft | Copyright (C) 2012-2013 Daniel Kraft | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 121 | skipping to change at line 121 | |||
// Exit function. As a sanity-check, it is verified that the currently | // Exit function. As a sanity-check, it is verified that the currently | |||
// active function actually is the one handed in here. Returned is the | // active function actually is the one handed in here. Returned is the | |||
// then-active node, which is our parent. | // then-active node, which is our parent. | |||
tree_node* exit (octave_idx_type); | tree_node* exit (octave_idx_type); | |||
void build_flat (flat_profile&) const; | void build_flat (flat_profile&) const; | |||
// Get the hierarchical profile for this node and its children. If tot al | // Get the hierarchical profile for this node and its children. If tot al | |||
// is set, accumulate total time of the subtree in that variable as | // is set, accumulate total time of the subtree in that variable as | |||
// additional return value. | // additional return value. | |||
octave_value get_hierarchical (double* total = NULL) const; | octave_value get_hierarchical (double* total = 0) const; | |||
private: | private: | |||
tree_node* parent; | tree_node* parent; | |||
octave_idx_type fcn_id; | octave_idx_type fcn_id; | |||
typedef std::map<octave_idx_type, tree_node*> child_map; | typedef std::map<octave_idx_type, tree_node*> child_map; | |||
child_map children; | child_map children; | |||
// This is only time spent *directly* on this level, excluding children ! | // This is only time spent *directly* on this level, excluding children ! | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
pt-all.h | pt-all.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_all_h) | #if !defined (octave_pt_all_h) | |||
#define octave_tree_all_h 1 | #define octave_pt_all_h 1 | |||
#include "pt.h" | #include "pt.h" | |||
#include "pt-arg-list.h" | #include "pt-arg-list.h" | |||
#include "pt-assign.h" | #include "pt-assign.h" | |||
#include "pt-bp.h" | #include "pt-bp.h" | |||
#include "pt-binop.h" | #include "pt-binop.h" | |||
#include "pt-cbinop.h" | #include "pt-cbinop.h" | |||
#include "pt-check.h" | #include "pt-check.h" | |||
#include "pt-cmd.h" | #include "pt-cmd.h" | |||
#include "pt-colon.h" | #include "pt-colon.h" | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
pt-arg-list.h | pt-arg-list.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_arg_list_h) | #if !defined (octave_pt_arg_list_h) | |||
#define octave_tree_arg_list_h 1 | #define octave_pt_arg_list_h 1 | |||
#include <list> | #include <list> | |||
class octave_value_list; | class octave_value_list; | |||
class octave_lvalue; | class octave_lvalue; | |||
class tree_expression; | class tree_expression; | |||
class tree_walker; | class tree_walker; | |||
#include "str-vec.h" | #include "str-vec.h" | |||
#include "base-list.h" | #include "base-list.h" | |||
#include "symtab.h" | ||||
// Argument lists. Used to hold the list of expressions that are the | // Argument lists. Used to hold the list of expressions that are the | |||
// arguments in a function call or index expression. | // arguments in a function call or index expression. | |||
class | class | |||
tree_argument_list : public octave_base_list<tree_expression *> | tree_argument_list : public octave_base_list<tree_expression *> | |||
{ | { | |||
public: | public: | |||
typedef tree_expression* element_type; | typedef tree_expression* element_type; | |||
tree_argument_list (void) | tree_argument_list (void) | |||
: list_includes_magic_end (false), list_includes_magic_tilde (false), | : list_includes_magic_end (false), list_includes_magic_tilde (false), | |||
simple_assign_lhs (false) { } | simple_assign_lhs (false) { } | |||
tree_argument_list (tree_expression *t) | tree_argument_list (tree_expression *t) | |||
: list_includes_magic_end (false), list_includes_magic_tilde (false), | : list_includes_magic_end (false), list_includes_magic_tilde (false), | |||
simple_assign_lhs (false) | simple_assign_lhs (false) | |||
{ append (t); } | { append (t); } | |||
~tree_argument_list (void); | ~tree_argument_list (void); | |||
bool has_magic_end (void) const; | bool has_magic_end (void) const; | |||
bool has_magic_tilde (void) const | bool has_magic_tilde (void) const | |||
{ return list_includes_magic_tilde; } | { return list_includes_magic_tilde; } | |||
tree_expression *remove_front (void) | tree_expression *remove_front (void) | |||
{ | { | |||
iterator p = begin (); | iterator p = begin (); | |||
tree_expression *retval = *p; | tree_expression *retval = *p; | |||
erase (p); | erase (p); | |||
return retval; | return retval; | |||
} | } | |||
void append (const element_type& s); | void append (const element_type& s); | |||
void mark_as_simple_assign_lhs (void) { simple_assign_lhs = true; } | void mark_as_simple_assign_lhs (void) { simple_assign_lhs = true; } | |||
bool is_simple_assign_lhs (void) { return simple_assign_lhs; } | bool is_simple_assign_lhs (void) { return simple_assign_lhs; } | |||
bool all_elements_are_constant (void) const; | bool all_elements_are_constant (void) const; | |||
bool is_valid_lvalue_list (void) const; | ||||
octave_value_list convert_to_const_vector (const octave_value *object = 0 ); | octave_value_list convert_to_const_vector (const octave_value *object = 0 ); | |||
std::list<octave_lvalue> lvalue_list (void); | std::list<octave_lvalue> lvalue_list (void); | |||
string_vector get_arg_names (void) const; | string_vector get_arg_names (void) const; | |||
std::list<std::string> variable_names (void) const; | ||||
tree_argument_list *dup (symbol_table::scope_id scope, | tree_argument_list *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
private: | private: | |||
bool list_includes_magic_end; | bool list_includes_magic_end; | |||
bool list_includes_magic_tilde; | bool list_includes_magic_tilde; | |||
End of changes. 9 change blocks. | ||||
12 lines changed or deleted | 17 lines changed or added | |||
pt-assign.h | pt-assign.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_assign_h) | #if !defined (octave_pt_assign_h) | |||
#define octave_tree_assign_h 1 | #define octave_pt_assign_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
class tree_argument_list; | class tree_argument_list; | |||
class tree_walker; | class tree_walker; | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
class octave_lvalue; | class octave_lvalue; | |||
skipping to change at line 50 | skipping to change at line 50 | |||
// Simple assignment expressions. | // Simple assignment expressions. | |||
class | class | |||
tree_simple_assignment : public tree_expression | tree_simple_assignment : public tree_expression | |||
{ | { | |||
public: | public: | |||
tree_simple_assignment (bool plhs = false, int l = -1, int c = -1, | tree_simple_assignment (bool plhs = false, int l = -1, int c = -1, | |||
octave_value::assign_op t = octave_value::op_asn_ eq) | octave_value::assign_op t = octave_value::op_asn_ eq) | |||
: tree_expression (l, c), lhs (0), rhs (0), preserve (plhs), ans_ass () , | : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs), ans_ass () , | |||
etype (t), first_execution (true) { } | etype (t) { } | |||
tree_simple_assignment (tree_expression *le, tree_expression *re, | tree_simple_assignment (tree_expression *le, tree_expression *re, | |||
bool plhs = false, int l = -1, int c = -1, | bool plhs = false, int l = -1, int c = -1, | |||
octave_value::assign_op t = octave_value::op_asn_ eq); | octave_value::assign_op t = octave_value::op_asn_ eq); | |||
~tree_simple_assignment (void); | ~tree_simple_assignment (void); | |||
bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); } | bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); } | |||
bool rvalue_ok (void) const { return true; } | bool rvalue_ok (void) const { return true; } | |||
skipping to change at line 103 | skipping to change at line 103 | |||
// True if we should not delete the lhs. | // True if we should not delete the lhs. | |||
bool preserve; | bool preserve; | |||
// True if this is an assignment to the automatic variable ans. | // True if this is an assignment to the automatic variable ans. | |||
bool ans_ass; | bool ans_ass; | |||
// The type of the expression. | // The type of the expression. | |||
octave_value::assign_op etype; | octave_value::assign_op etype; | |||
// true only on first rvalue() call. | ||||
bool first_execution; | ||||
// No copying! | // No copying! | |||
tree_simple_assignment (const tree_simple_assignment&); | tree_simple_assignment (const tree_simple_assignment&); | |||
tree_simple_assignment& operator = (const tree_simple_assignment&); | tree_simple_assignment& operator = (const tree_simple_assignment&); | |||
}; | }; | |||
// Multi-valued assignment expressions. | // Multi-valued assignment expressions. | |||
class | class | |||
tree_multi_assignment : public tree_expression | tree_multi_assignment : public tree_expression | |||
{ | { | |||
public: | public: | |||
tree_multi_assignment (bool plhs = false, int l = -1, int c = -1) | tree_multi_assignment (bool plhs = false, int l = -1, int c = -1) | |||
: tree_expression (l, c), lhs (0), rhs (0), preserve (plhs), | : tree_expression (l, c), lhs (0), rhs (0), preserve (plhs) { } | |||
first_execution (true) { } | ||||
tree_multi_assignment (tree_argument_list *lst, tree_expression *r, | tree_multi_assignment (tree_argument_list *lst, tree_expression *r, | |||
bool plhs = false, int l = -1, int c = -1); | bool plhs = false, int l = -1, int c = -1); | |||
~tree_multi_assignment (void); | ~tree_multi_assignment (void); | |||
bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); } | bool has_magic_end (void) const { return (rhs && rhs->has_magic_end ()); } | |||
bool is_assignment_expression (void) const { return true; } | bool is_assignment_expression (void) const { return true; } | |||
skipping to change at line 150 | skipping to change at line 146 | |||
tree_argument_list *left_hand_side (void) { return lhs; } | tree_argument_list *left_hand_side (void) { return lhs; } | |||
tree_expression *right_hand_side (void) { return rhs; } | tree_expression *right_hand_side (void) { return rhs; } | |||
tree_expression *dup (symbol_table::scope_id scope, | tree_expression *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
octave_value::assign_op op_type (void) const { return octave_value::op_as | octave_value::assign_op op_type (void) const | |||
n_eq; } | { return octave_value::op_asn_eq; } | |||
private: | private: | |||
// The left hand side of the assignment. | // The left hand side of the assignment. | |||
tree_argument_list *lhs; | tree_argument_list *lhs; | |||
// The right hand side of the assignment. | // The right hand side of the assignment. | |||
tree_expression *rhs; | tree_expression *rhs; | |||
// True if we should not delete the lhs. | // True if we should not delete the lhs. | |||
bool preserve; | bool preserve; | |||
// true only on first rvalue() call. | ||||
bool first_execution; | ||||
// No copying! | // No copying! | |||
tree_multi_assignment (const tree_multi_assignment&); | tree_multi_assignment (const tree_multi_assignment&); | |||
tree_multi_assignment& operator = (const tree_multi_assignment&); | tree_multi_assignment& operator = (const tree_multi_assignment&); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
14 lines changed or deleted | 7 lines changed or added | |||
pt-binop.h | pt-binop.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_binop_h) | #if !defined (octave_pt_binop_h) | |||
#define octave_tree_binop_h 1 | #define octave_pt_binop_h 1 | |||
#include <string> | #include <string> | |||
class tree_walker; | class tree_walker; | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
class octave_lvalue; | class octave_lvalue; | |||
#include "ov.h" | #include "ov.h" | |||
skipping to change at line 59 | skipping to change at line 59 | |||
eligible_for_braindead_shortcircuit (false) { } | eligible_for_braindead_shortcircuit (false) { } | |||
tree_binary_expression (tree_expression *a, tree_expression *b, | tree_binary_expression (tree_expression *a, tree_expression *b, | |||
int l = -1, int c = -1, | int l = -1, int c = -1, | |||
octave_value::binary_op t | octave_value::binary_op t | |||
= octave_value::unknown_binary_op) | = octave_value::unknown_binary_op) | |||
: tree_expression (l, c), op_lhs (a), op_rhs (b), etype (t), | : tree_expression (l, c), op_lhs (a), op_rhs (b), etype (t), | |||
eligible_for_braindead_shortcircuit (false) { } | eligible_for_braindead_shortcircuit (false) { } | |||
~tree_binary_expression (void) | ~tree_binary_expression (void) | |||
{ | { | |||
delete op_lhs; | delete op_lhs; | |||
delete op_rhs; | delete op_rhs; | |||
} | } | |||
void mark_braindead_shortcircuit (const std::string& file) | void mark_braindead_shortcircuit (const std::string& file) | |||
{ | { | |||
if (etype == octave_value::op_el_and | if (etype == octave_value::op_el_and || etype == octave_value::op_el_or | |||
|| etype == octave_value::op_el_or) | ) | |||
{ | { | |||
if (file.empty ()) | if (file.empty ()) | |||
warning_with_id ("Octave:possible-matlab-short-circuit-operator | warning_with_id ("Octave:possible-matlab-short-circuit-operator", | |||
", | "possible Matlab-style short-circuit operator at | |||
"possible Matlab-style short-circuit operator | line %d, column %d", | |||
at line %d, column %d", | line (), column ()); | |||
line (), column ()); | else | |||
else | warning_with_id ("Octave:possible-matlab-short-circuit-operator", | |||
warning_with_id ("Octave:possible-matlab-short-circuit-operator | "%s: possible Matlab-style short-circuit operato | |||
", | r at line %d, column %d", | |||
"%s: possible Matlab-style short-circuit opera | file.c_str (), line (), column ()); | |||
tor at line %d, column %d", | ||||
file.c_str (), line (), column ()); | eligible_for_braindead_shortcircuit = true; | |||
eligible_for_braindead_shortcircuit = true; | op_lhs->mark_braindead_shortcircuit (file); | |||
op_rhs->mark_braindead_shortcircuit (file); | ||||
op_lhs->mark_braindead_shortcircuit (file); | } | |||
op_rhs->mark_braindead_shortcircuit (file); | } | |||
} | ||||
} | ||||
bool has_magic_end (void) const | bool has_magic_end (void) const | |||
{ | { | |||
return ((op_lhs && op_lhs->has_magic_end ()) | return ((op_lhs && op_lhs->has_magic_end ()) | |||
|| (op_rhs && op_rhs->has_magic_end ())); | || (op_rhs && op_rhs->has_magic_end ())); | |||
} | } | |||
bool is_binary_expression (void) const { return true; } | bool is_binary_expression (void) const { return true; } | |||
bool rvalue_ok (void) const { return true; } | bool rvalue_ok (void) const { return true; } | |||
octave_value rvalue1 (int nargout = 1); | octave_value rvalue1 (int nargout = 1); | |||
octave_value_list rvalue (int nargout); | octave_value_list rvalue (int nargout); | |||
std::string oper (void) const; | std::string oper (void) const; | |||
skipping to change at line 141 | skipping to change at line 140 | |||
}; | }; | |||
// Boolean expressions. | // Boolean expressions. | |||
class | class | |||
tree_boolean_expression : public tree_binary_expression | tree_boolean_expression : public tree_binary_expression | |||
{ | { | |||
public: | public: | |||
enum type | enum type | |||
{ | { | |||
unknown, | unknown, | |||
bool_and, | bool_and, | |||
bool_or | bool_or | |||
}; | }; | |||
tree_boolean_expression (int l = -1, int c = -1, type t = unknown) | tree_boolean_expression (int l = -1, int c = -1, type t = unknown) | |||
: tree_binary_expression (l, c), etype (t) { } | : tree_binary_expression (l, c), etype (t) { } | |||
tree_boolean_expression (tree_expression *a, tree_expression *b, | tree_boolean_expression (tree_expression *a, tree_expression *b, | |||
int l = -1, int c = -1, type t = unknown) | int l = -1, int c = -1, type t = unknown) | |||
: tree_binary_expression (a, b, l, c), etype (t) { } | : tree_binary_expression (a, b, l, c), etype (t) { } | |||
~tree_boolean_expression (void) { } | ~tree_boolean_expression (void) { } | |||
End of changes. 6 change blocks. | ||||
39 lines changed or deleted | 37 lines changed or added | |||
pt-bp.h | pt-bp.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2001-2012 Ben Sapp | Copyright (C) 2001-2013 Ben Sapp | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_bp_h) | #if !defined (octave_pt_bp_h) | |||
#define octave_tree_bp_h 1 | #define octave_pt_bp_h 1 | |||
#include "input.h" | #include "input.h" | |||
#include "ov-usr-fcn.h" | #include "ov-usr-fcn.h" | |||
#include "pt-walk.h" | #include "pt-walk.h" | |||
#include "pt-pr-code.h" | #include "pt-pr-code.h" | |||
#include "toplev.h" | #include "toplev.h" | |||
class tree; | class tree; | |||
class tree_decl_command; | class tree_decl_command; | |||
class | class | |||
tree_breakpoint : public tree_walker | tree_breakpoint : public tree_walker | |||
{ | { | |||
public: | public: | |||
enum action { set = 1, clear = 2, list = 3 }; | enum action { set = 1, clear = 2, list = 3 }; | |||
tree_breakpoint (int l, action a) | tree_breakpoint (int l, action a) | |||
: line (l), act (a), found (false), bp_list () { } | : line (l), act (a), found (false), bp_list () { } | |||
~tree_breakpoint (void) { } | ~tree_breakpoint (void) { } | |||
bool success (void) const { return found; } | bool success (void) const { return found; } | |||
skipping to change at line 61 | skipping to change at line 61 | |||
void visit_binary_expression (tree_binary_expression&); | void visit_binary_expression (tree_binary_expression&); | |||
void visit_break_command (tree_break_command&); | void visit_break_command (tree_break_command&); | |||
void visit_colon_expression (tree_colon_expression&); | void visit_colon_expression (tree_colon_expression&); | |||
void visit_continue_command (tree_continue_command&); | void visit_continue_command (tree_continue_command&); | |||
void visit_global_command (tree_global_command&); | void visit_global_command (tree_global_command&); | |||
void visit_static_command (tree_static_command&); | void visit_persistent_command (tree_persistent_command&); | |||
void visit_decl_elt (tree_decl_elt&); | void visit_decl_elt (tree_decl_elt&); | |||
void visit_decl_init_list (tree_decl_init_list&); | void visit_decl_init_list (tree_decl_init_list&); | |||
void visit_while_command (tree_while_command&); | void visit_while_command (tree_while_command&); | |||
void visit_do_until_command (tree_do_until_command&); | void visit_do_until_command (tree_do_until_command&); | |||
void visit_simple_for_command (tree_simple_for_command&); | void visit_simple_for_command (tree_simple_for_command&); | |||
skipping to change at line 137 | skipping to change at line 137 | |||
void visit_switch_case_list (tree_switch_case_list&); | void visit_switch_case_list (tree_switch_case_list&); | |||
void visit_switch_command (tree_switch_command&); | void visit_switch_command (tree_switch_command&); | |||
void visit_try_catch_command (tree_try_catch_command&); | void visit_try_catch_command (tree_try_catch_command&); | |||
void visit_unwind_protect_command (tree_unwind_protect_command&); | void visit_unwind_protect_command (tree_unwind_protect_command&); | |||
octave_value_list get_list (void) { return bp_list; } | octave_value_list get_list (void) { return bp_list; } | |||
int get_line (void) { return line; } | int get_line (void) { return found ? line : 0; } | |||
private: | private: | |||
void do_decl_command (tree_decl_command&); | void do_decl_command (tree_decl_command&); | |||
void take_action (tree& tr); | void take_action (tree& tr); | |||
void take_action (tree_statement& stmt); | void take_action (tree_statement& stmt); | |||
// Statement line number we are looking for. | // Statement line number we are looking for. | |||
int line; | int line; | |||
End of changes. 6 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
pt-cbinop.h | pt-cbinop.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 Jaroslav Hajek | Copyright (C) 2008-2013 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_cbinop_h) | #if !defined (octave_pt_cbinop_h) | |||
#define octave_tree_cbinop_h 1 | #define octave_pt_cbinop_h 1 | |||
#include <string> | #include <string> | |||
class tree_walker; | class tree_walker; | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
class octave_lvalue; | class octave_lvalue; | |||
#include "ov.h" | #include "ov.h" | |||
skipping to change at line 53 | skipping to change at line 53 | |||
public: | public: | |||
tree_compound_binary_expression (tree_expression *a, tree_expression *b, | tree_compound_binary_expression (tree_expression *a, tree_expression *b, | |||
int l, int c, | int l, int c, | |||
octave_value::binary_op t, | octave_value::binary_op t, | |||
tree_expression *ca, tree_expression *cb , | tree_expression *ca, tree_expression *cb , | |||
octave_value::compound_binary_op ct) | octave_value::compound_binary_op ct) | |||
: tree_binary_expression (a, b, l, c, t), op_lhs (ca), op_rhs (cb), | : tree_binary_expression (a, b, l, c, t), op_lhs (ca), op_rhs (cb), | |||
etype (ct) { } | etype (ct) { } | |||
octave_value rvalue1 (int nargout = 1); | ||||
octave_value::compound_binary_op cop_type (void) const { return etype; } | octave_value::compound_binary_op cop_type (void) const { return etype; } | |||
private: | private: | |||
tree_expression *op_lhs; | tree_expression *op_lhs; | |||
tree_expression *op_rhs; | tree_expression *op_rhs; | |||
octave_value::compound_binary_op etype; | octave_value::compound_binary_op etype; | |||
// No copying! | // No copying! | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 3 lines changed or added | |||
pt-cell.h | pt-cell.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1999-2012 John W. Eaton | Copyright (C) 1999-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_cell_h) | #if !defined (octave_pt_cell_h) | |||
#define octave_tree_cell_h 1 | #define octave_pt_cell_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
class tree_argument_list; | class tree_argument_list; | |||
class tree_walker; | class tree_walker; | |||
#include "pt-mat.h" | #include "pt-mat.h" | |||
#include "symtab.h" | #include "symtab.h" | |||
// General cells. | // General cells. | |||
class | class | |||
tree_cell : public tree_matrix | tree_cell : public tree_array_list | |||
{ | { | |||
public: | public: | |||
tree_cell (tree_argument_list *row = 0, int l = -1, int c = -1) | tree_cell (tree_argument_list *row = 0, int l = -1, int c = -1) | |||
: tree_matrix (row, l, c) { } | : tree_array_list (row, l, c) | |||
{ } | ||||
~tree_cell (void) { } | ~tree_cell (void) { } | |||
bool is_cell (void) const { return true; } | ||||
bool rvalue_ok (void) const { return true; } | bool rvalue_ok (void) const { return true; } | |||
octave_value rvalue1 (int nargout = 1); | octave_value rvalue1 (int nargout = 1); | |||
octave_value_list rvalue (int); | octave_value_list rvalue (int); | |||
tree_expression *dup (symbol_table::scope_id scope, | tree_expression *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 8 lines changed or added | |||
pt-check.h | pt-check.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_checker_h) | #if !defined (octave_pt_check_h) | |||
#define octave_tree_checker_h 1 | #define octave_pt_check_h 1 | |||
#include "pt-walk.h" | #include "pt-walk.h" | |||
class tree_decl_command; | class tree_decl_command; | |||
// How to check the semantics of the code that the parse trees represent. | // How to check the semantics of the code that the parse trees represent. | |||
class | class | |||
tree_checker : public tree_walker | tree_checker : public tree_walker | |||
{ | { | |||
public: | public: | |||
tree_checker (void) | tree_checker (void) | |||
: do_lvalue_check (false) { } | : do_lvalue_check (false), file_name () { } | |||
~tree_checker (void) { } | ~tree_checker (void) { } | |||
void visit_argument_list (tree_argument_list&); | void visit_argument_list (tree_argument_list&); | |||
void visit_binary_expression (tree_binary_expression&); | void visit_binary_expression (tree_binary_expression&); | |||
void visit_break_command (tree_break_command&); | void visit_break_command (tree_break_command&); | |||
void visit_colon_expression (tree_colon_expression&); | void visit_colon_expression (tree_colon_expression&); | |||
void visit_continue_command(tree_continue_command&); | void visit_continue_command(tree_continue_command&); | |||
void visit_global_command (tree_global_command&); | void visit_global_command (tree_global_command&); | |||
void visit_static_command (tree_static_command&); | void visit_persistent_command (tree_persistent_command&); | |||
void visit_decl_elt (tree_decl_elt&); | void visit_decl_elt (tree_decl_elt&); | |||
void visit_decl_init_list (tree_decl_init_list&); | void visit_decl_init_list (tree_decl_init_list&); | |||
void visit_simple_for_command (tree_simple_for_command&); | void visit_simple_for_command (tree_simple_for_command&); | |||
void visit_complex_for_command (tree_complex_for_command&); | void visit_complex_for_command (tree_complex_for_command&); | |||
void visit_octave_user_script (octave_user_script&); | void visit_octave_user_script (octave_user_script&); | |||
skipping to change at line 128 | skipping to change at line 128 | |||
void visit_unwind_protect_command (tree_unwind_protect_command&); | void visit_unwind_protect_command (tree_unwind_protect_command&); | |||
void visit_while_command (tree_while_command&); | void visit_while_command (tree_while_command&); | |||
void visit_do_until_command (tree_do_until_command&); | void visit_do_until_command (tree_do_until_command&); | |||
private: | private: | |||
bool do_lvalue_check; | bool do_lvalue_check; | |||
std::string file_name; | ||||
void do_decl_command (tree_decl_command&); | void do_decl_command (tree_decl_command&); | |||
void gripe (const std::string& msg, int line); | void gripe (const std::string& msg, int line); | |||
// No copying! | // No copying! | |||
tree_checker (const tree_checker&); | tree_checker (const tree_checker&); | |||
tree_checker& operator = (const tree_checker&); | tree_checker& operator = (const tree_checker&); | |||
}; | }; | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 7 lines changed or added | |||
pt-cmd.h | pt-cmd.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_cmd_h) | #if !defined (octave_pt_cmd_h) | |||
#define octave_tree_cmd_h 1 | #define octave_pt_cmd_h 1 | |||
#include <string> | #include <string> | |||
class tree_walker; | class tree_walker; | |||
#include "ov-fcn.h" | #include "ov-fcn.h" | |||
#include "pt.h" | #include "pt.h" | |||
#include "pt-bp.h" | #include "pt-bp.h" | |||
#include "symtab.h" | #include "symtab.h" | |||
skipping to change at line 66 | skipping to change at line 66 | |||
tree_command& operator = (const tree_command&); | tree_command& operator = (const tree_command&); | |||
}; | }; | |||
// No-op. | // No-op. | |||
class | class | |||
tree_no_op_command : public tree_command | tree_no_op_command : public tree_command | |||
{ | { | |||
public: | public: | |||
tree_no_op_command (const std::string& cmd = "no_op", int l = -1, int c = | tree_no_op_command (const std::string& cmd = "no_op", bool e = false, | |||
-1) | int l = -1, int c = -1) | |||
: tree_command (l, c), eof (cmd == "endfunction" || cmd == "endscript") | : tree_command (l, c), eof (e), orig_cmd (cmd) { } | |||
, | ||||
orig_cmd (cmd) { } | ||||
~tree_no_op_command (void) { } | ~tree_no_op_command (void) { } | |||
tree_command *dup (symbol_table::scope_id scope, | tree_command *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
bool is_end_of_fcn_or_script (void) const { return eof; } | bool is_end_of_fcn_or_script (void) const | |||
{ | ||||
return (orig_cmd == "endfunction" || orig_cmd == "endscript"); | ||||
} | ||||
bool is_end_of_file (void) const { return eof; } | ||||
std::string original_command (void) { return orig_cmd; } | std::string original_command (void) { return orig_cmd; } | |||
private: | private: | |||
bool eof; | bool eof; | |||
std::string orig_cmd; | std::string orig_cmd; | |||
// No copying! | // No copying! | |||
End of changes. 4 change blocks. | ||||
9 lines changed or deleted | 12 lines changed or added | |||
pt-colon.h | pt-colon.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_colon_h) | #if !defined (octave_pt_colon_h) | |||
#define octave_tree_colon 1 | #define octave_tree_colon 1 | |||
#include <string> | #include <string> | |||
class tree_walker; | class tree_walker; | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
class octave_lvalue; | class octave_lvalue; | |||
skipping to change at line 58 | skipping to change at line 58 | |||
tree_colon_expression (tree_expression *e, int l = -1, int c = -1) | tree_colon_expression (tree_expression *e, int l = -1, int c = -1) | |||
: tree_expression (l, c), op_base (e), op_limit (0), | : tree_expression (l, c), op_base (e), op_limit (0), | |||
op_increment (0), save_base (false) { } | op_increment (0), save_base (false) { } | |||
tree_colon_expression (tree_expression *bas, tree_expression *lim, | tree_colon_expression (tree_expression *bas, tree_expression *lim, | |||
tree_expression *inc, int l = -1, int c = -1) | tree_expression *inc, int l = -1, int c = -1) | |||
: tree_expression (l, c), op_base (bas), op_limit (lim), | : tree_expression (l, c), op_base (bas), op_limit (lim), | |||
op_increment (inc), save_base (false) { } | op_increment (inc), save_base (false) { } | |||
~tree_colon_expression (void) | ~tree_colon_expression (void) | |||
{ | { | |||
if (! save_base) | if (! save_base) | |||
delete op_base; | delete op_base; | |||
delete op_limit; | delete op_limit; | |||
delete op_increment; | delete op_increment; | |||
} | } | |||
bool has_magic_end (void) const | bool has_magic_end (void) const | |||
{ | { | |||
return ((op_base && op_base->has_magic_end ()) | return ((op_base && op_base->has_magic_end ()) | |||
|| (op_limit && op_limit->has_magic_end ()) | || (op_limit && op_limit->has_magic_end ()) | |||
|| (op_increment && op_increment->has_magic_end ())); | || (op_increment && op_increment->has_magic_end ())); | |||
} | } | |||
void preserve_base (void) { save_base = true; } | void preserve_base (void) { save_base = true; } | |||
tree_colon_expression *append (tree_expression *t); | tree_colon_expression *append (tree_expression *t); | |||
bool rvalue_ok (void) const { return true; } | bool rvalue_ok (void) const { return true; } | |||
octave_value rvalue1 (int nargout = 1); | octave_value rvalue1 (int nargout = 1); | |||
octave_value_list rvalue (int nargout); | octave_value_list rvalue (int nargout); | |||
End of changes. 4 change blocks. | ||||
14 lines changed or deleted | 14 lines changed or added | |||
pt-const.h | pt-const.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_const_h) | #if !defined (octave_pt_const_h) | |||
#define octave_tree_const_h 1 | #define octave_pt_const_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "oct-alloc.h" | #include "oct-alloc.h" | |||
class octave_value_list; | class octave_value_list; | |||
class tree_walker; | class tree_walker; | |||
#include "ov.h" | #include "ov.h" | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
pt-decl.h | pt-decl.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_decl_h) | #if !defined (octave_pt_decl_h) | |||
#define octave_tree_decl_h 1 | #define octave_pt_decl_h 1 | |||
class tree_expression; | class tree_expression; | |||
class tree_identifier; | class tree_identifier; | |||
class tree_walker; | class tree_walker; | |||
#include <string> | #include <string> | |||
#include "base-list.h" | #include "base-list.h" | |||
#include "oct-lvalue.h" | #include "oct-lvalue.h" | |||
skipping to change at line 87 | skipping to change at line 87 | |||
else | else | |||
retval = rvalue1 (nargout); | retval = rvalue1 (nargout); | |||
return retval; | return retval; | |||
} | } | |||
octave_lvalue lvalue (void) { return id ? id->lvalue () : octave_lvalue ( ); } | octave_lvalue lvalue (void) { return id ? id->lvalue () : octave_lvalue ( ); } | |||
tree_identifier *ident (void) { return id; } | tree_identifier *ident (void) { return id; } | |||
std::string name (void) { return id ? id->name () : ""; } | ||||
tree_expression *expression (void) { return expr; } | tree_expression *expression (void) { return expr; } | |||
tree_decl_elt *dup (symbol_table::scope_id scope, | tree_decl_elt *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
private: | private: | |||
// An identifier to tag with the declared property. | // An identifier to tag with the declared property. | |||
skipping to change at line 119 | skipping to change at line 121 | |||
class | class | |||
tree_decl_init_list : public octave_base_list<tree_decl_elt *> | tree_decl_init_list : public octave_base_list<tree_decl_elt *> | |||
{ | { | |||
public: | public: | |||
tree_decl_init_list (void) { } | tree_decl_init_list (void) { } | |||
tree_decl_init_list (tree_decl_elt *t) { append (t); } | tree_decl_init_list (tree_decl_elt *t) { append (t); } | |||
~tree_decl_init_list (void) | ~tree_decl_init_list (void) | |||
{ | { | |||
while (! empty ()) | while (! empty ()) | |||
{ | { | |||
iterator p = begin (); | iterator p = begin (); | |||
delete *p; | delete *p; | |||
erase (p); | erase (p); | |||
} | } | |||
} | } | |||
tree_decl_init_list *dup (symbol_table::scope_id scope, | tree_decl_init_list *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
private: | private: | |||
// No copying! | // No copying! | |||
skipping to change at line 210 | skipping to change at line 212 | |||
static void do_init (tree_decl_elt& elt); | static void do_init (tree_decl_elt& elt); | |||
// No copying! | // No copying! | |||
tree_global_command (const tree_global_command&); | tree_global_command (const tree_global_command&); | |||
tree_global_command& operator = (const tree_global_command&); | tree_global_command& operator = (const tree_global_command&); | |||
}; | }; | |||
// Static. | // Persistent. | |||
class | class | |||
tree_static_command : public tree_decl_command | tree_persistent_command : public tree_decl_command | |||
{ | { | |||
public: | public: | |||
tree_static_command (int l = -1, int c = -1) | tree_persistent_command (int l = -1, int c = -1) | |||
: tree_decl_command ("static", l, c) { } | : tree_decl_command ("persistent", l, c) { } | |||
tree_static_command (tree_decl_init_list *t, int l = -1, int c = -1) | tree_persistent_command (tree_decl_init_list *t, int l = -1, int c = -1) | |||
: tree_decl_command ("static", t, l, c) { } | : tree_decl_command ("persistent", t, l, c) { } | |||
~tree_static_command (void) { } | ~tree_persistent_command (void) { } | |||
tree_command *dup (symbol_table::scope_id scope, | tree_command *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
private: | private: | |||
static void do_init (tree_decl_elt& elt); | static void do_init (tree_decl_elt& elt); | |||
// No copying! | // No copying! | |||
tree_static_command (const tree_static_command&); | tree_persistent_command (const tree_persistent_command&); | |||
tree_static_command& operator = (const tree_static_command&); | tree_persistent_command& operator = (const tree_persistent_command&); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
20 lines changed or deleted | 22 lines changed or added | |||
pt-eval.h | pt-eval.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 John W. Eaton | Copyright (C) 2009-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_eval_h) | #if !defined (octave_pt_eval_h) | |||
#define octave_tree_eval_h 1 | #define octave_pt_eval_h 1 | |||
#include <stack> | #include <stack> | |||
#include <string> | #include <string> | |||
#include "comment-list.h" | #include "comment-list.h" | |||
#include "oct-obj.h" | #include "oct-obj.h" | |||
#include "pt-walk.h" | #include "pt-walk.h" | |||
class tree_expression; | class tree_expression; | |||
skipping to change at line 63 | skipping to change at line 63 | |||
void visit_binary_expression (tree_binary_expression&); | void visit_binary_expression (tree_binary_expression&); | |||
void visit_break_command (tree_break_command&); | void visit_break_command (tree_break_command&); | |||
void visit_colon_expression (tree_colon_expression&); | void visit_colon_expression (tree_colon_expression&); | |||
void visit_continue_command (tree_continue_command&); | void visit_continue_command (tree_continue_command&); | |||
void visit_global_command (tree_global_command&); | void visit_global_command (tree_global_command&); | |||
void visit_static_command (tree_static_command&); | void visit_persistent_command (tree_persistent_command&); | |||
void visit_decl_elt (tree_decl_elt&); | void visit_decl_elt (tree_decl_elt&); | |||
void visit_decl_init_list (tree_decl_init_list&); | void visit_decl_init_list (tree_decl_init_list&); | |||
void visit_simple_for_command (tree_simple_for_command&); | void visit_simple_for_command (tree_simple_for_command&); | |||
void visit_complex_for_command (tree_complex_for_command&); | void visit_complex_for_command (tree_complex_for_command&); | |||
void visit_octave_user_script (octave_user_script&); | void visit_octave_user_script (octave_user_script&); | |||
skipping to change at line 139 | skipping to change at line 139 | |||
void do_unwind_protect_cleanup_code (tree_statement_list *list); | void do_unwind_protect_cleanup_code (tree_statement_list *list); | |||
void visit_unwind_protect_command (tree_unwind_protect_command&); | void visit_unwind_protect_command (tree_unwind_protect_command&); | |||
void visit_while_command (tree_while_command&); | void visit_while_command (tree_while_command&); | |||
void visit_do_until_command (tree_do_until_command&); | void visit_do_until_command (tree_do_until_command&); | |||
static void reset_debug_state (void); | static void reset_debug_state (void); | |||
static bool statement_printing_enabled (void); | ||||
// If > 0, stop executing at the (N-1)th stopping point, counting | // If > 0, stop executing at the (N-1)th stopping point, counting | |||
// from the the current execution point in the current frame. | // from the the current execution point in the current frame. | |||
// | // | |||
// If < 0, stop executing at the next possible stopping point. | // If < 0, stop executing at the next possible stopping point. | |||
static int dbstep_flag; | static int dbstep_flag; | |||
// The number of the stack frame we are currently debugging. | // The number of the stack frame we are currently debugging. | |||
static size_t current_frame; | static size_t current_frame; | |||
static bool debug_mode; | static bool debug_mode; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 6 lines changed or added | |||
pt-except.h | pt-except.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_except_h) | #if !defined (octave_pt_except_h) | |||
#define octave_tree_except_h 1 | #define octave_pt_except_h 1 | |||
class tree_statement_list; | class tree_statement_list; | |||
class tree_walker; | class tree_walker; | |||
#include "comment-list.h" | #include "comment-list.h" | |||
#include "pt-cmd.h" | #include "pt-cmd.h" | |||
#include "pt-id.h" | ||||
#include "symtab.h" | #include "symtab.h" | |||
// Simple exception handling. | // Simple exception handling. | |||
class | class | |||
tree_try_catch_command : public tree_command | tree_try_catch_command : public tree_command | |||
{ | { | |||
public: | public: | |||
tree_try_catch_command (int l = -1, int c = -1) | tree_try_catch_command (int l = -1, int c = -1) | |||
: tree_command (l, c), try_code (0), catch_code (0), lead_comm (0), | : tree_command (l, c), try_code (0), catch_code (0), expr_id (0), | |||
mid_comm (0), trail_comm (0) { } | lead_comm (0), mid_comm (0), trail_comm (0) { } | |||
tree_try_catch_command (tree_statement_list *tc, tree_statement_list *cc, | tree_try_catch_command (tree_statement_list *tc, tree_statement_list *cc, | |||
tree_identifier *id, | ||||
octave_comment_list *cl = 0, | octave_comment_list *cl = 0, | |||
octave_comment_list *cm = 0, | octave_comment_list *cm = 0, | |||
octave_comment_list *ct = 0, | octave_comment_list *ct = 0, | |||
int l = -1, int c = -1) | int l = -1, int c = -1) | |||
: tree_command (l, c), try_code (tc), catch_code (cc), | : tree_command (l, c), try_code (tc), catch_code (cc), expr_id (id), | |||
lead_comm (cl), mid_comm (cm), trail_comm (ct) { } | lead_comm (cl), mid_comm (cm), trail_comm (ct) { } | |||
~tree_try_catch_command (void); | ~tree_try_catch_command (void); | |||
tree_identifier *identifier (void) { return expr_id; } | ||||
tree_statement_list *body (void) { return try_code; } | tree_statement_list *body (void) { return try_code; } | |||
tree_statement_list *cleanup (void) { return catch_code; } | tree_statement_list *cleanup (void) { return catch_code; } | |||
octave_comment_list *leading_comment (void) { return lead_comm; } | octave_comment_list *leading_comment (void) { return lead_comm; } | |||
octave_comment_list *middle_comment (void) { return mid_comm; } | octave_comment_list *middle_comment (void) { return mid_comm; } | |||
octave_comment_list *trailing_comment (void) { return trail_comm; } | octave_comment_list *trailing_comment (void) { return trail_comm; } | |||
skipping to change at line 78 | skipping to change at line 82 | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
private: | private: | |||
// The first block of code to attempt to execute. | // The first block of code to attempt to execute. | |||
tree_statement_list *try_code; | tree_statement_list *try_code; | |||
// The code to execute if an error occurs in the first block. | // The code to execute if an error occurs in the first block. | |||
tree_statement_list *catch_code; | tree_statement_list *catch_code; | |||
// Identifier to modify. | ||||
tree_identifier *expr_id; | ||||
// Comment preceding TRY token. | // Comment preceding TRY token. | |||
octave_comment_list *lead_comm; | octave_comment_list *lead_comm; | |||
// Comment preceding CATCH token. | // Comment preceding CATCH token. | |||
octave_comment_list *mid_comm; | octave_comment_list *mid_comm; | |||
// Comment preceding END_TRY_CATCH token. | // Comment preceding END_TRY_CATCH token. | |||
octave_comment_list *trail_comm; | octave_comment_list *trail_comm; | |||
// No copying! | // No copying! | |||
skipping to change at line 140 | skipping to change at line 147 | |||
private: | private: | |||
// The first body of code to attempt to execute. | // The first body of code to attempt to execute. | |||
tree_statement_list *unwind_protect_code; | tree_statement_list *unwind_protect_code; | |||
// The body of code to execute no matter what happens in the first | // The body of code to execute no matter what happens in the first | |||
// body of code. | // body of code. | |||
tree_statement_list *cleanup_code; | tree_statement_list *cleanup_code; | |||
// Comment preceding TRY token. | // Comment preceding UNWIND_PROTECT token. | |||
octave_comment_list *lead_comm; | octave_comment_list *lead_comm; | |||
// Comment preceding CATCH token. | // Comment preceding UNWIND_PROTECT_CLEANUP token. | |||
octave_comment_list *mid_comm; | octave_comment_list *mid_comm; | |||
// Comment preceding END_TRY_CATCH token. | // Comment preceding END_UNWIND_PROTECT token. | |||
octave_comment_list *trail_comm; | octave_comment_list *trail_comm; | |||
// No copying! | // No copying! | |||
tree_unwind_protect_command (const tree_unwind_protect_command&); | tree_unwind_protect_command (const tree_unwind_protect_command&); | |||
tree_unwind_protect_command& operator = (const tree_unwind_protect_comman d&); | tree_unwind_protect_command& operator = (const tree_unwind_protect_comman d&); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
9 lines changed or deleted | 16 lines changed or added | |||
pt-exp.h | pt-exp.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_expr_h) | #if !defined (octave_pt_exp_h) | |||
#define octave_tree_expr_h 1 | #define octave_pt_exp_h 1 | |||
#include <string> | #include <string> | |||
#include <list> | #include <list> | |||
class octave_value; | class octave_value; | |||
class octave_lvalue; | class octave_lvalue; | |||
#include "pt.h" | #include "pt.h" | |||
#include "symtab.h" | #include "symtab.h" | |||
skipping to change at line 55 | skipping to change at line 55 | |||
virtual ~tree_expression (void) { } | virtual ~tree_expression (void) { } | |||
virtual bool has_magic_end (void) const = 0; | virtual bool has_magic_end (void) const = 0; | |||
virtual tree_expression *dup (symbol_table::scope_id, | virtual tree_expression *dup (symbol_table::scope_id, | |||
symbol_table::context_id context) const = 0 ; | symbol_table::context_id context) const = 0 ; | |||
virtual bool is_constant (void) const { return false; } | virtual bool is_constant (void) const { return false; } | |||
virtual bool is_matrix_constant (void) const { return false; } | virtual bool is_matrix (void) const { return false; } | |||
virtual bool is_cell (void) const { return false; } | ||||
virtual bool is_identifier (void) const { return false; } | virtual bool is_identifier (void) const { return false; } | |||
virtual bool is_index_expression (void) const { return false; } | virtual bool is_index_expression (void) const { return false; } | |||
virtual bool is_assignment_expression (void) const { return false; } | virtual bool is_assignment_expression (void) const { return false; } | |||
virtual bool is_prefix_expression (void) const { return false; } | virtual bool is_prefix_expression (void) const { return false; } | |||
virtual bool is_unary_expression (void) const { return false; } | virtual bool is_unary_expression (void) const { return false; } | |||
skipping to change at line 81 | skipping to change at line 83 | |||
virtual bool is_logically_true (const char *); | virtual bool is_logically_true (const char *); | |||
virtual bool lvalue_ok (void) const { return false; } | virtual bool lvalue_ok (void) const { return false; } | |||
virtual bool rvalue_ok (void) const { return false; } | virtual bool rvalue_ok (void) const { return false; } | |||
virtual octave_value rvalue1 (int nargout = 1); | virtual octave_value rvalue1 (int nargout = 1); | |||
virtual octave_value_list rvalue (int nargout); | virtual octave_value_list rvalue (int nargout); | |||
virtual octave_value_list rvalue (int nargout, | virtual octave_value_list | |||
const std::list<octave_lvalue> *lvalue_ | rvalue (int nargout, const std::list<octave_lvalue> *lvalue_list); | |||
list); | ||||
virtual octave_lvalue lvalue (void); | virtual octave_lvalue lvalue (void); | |||
int paren_count (void) const { return num_parens; } | int paren_count (void) const { return num_parens; } | |||
bool is_postfix_indexed (void) const { return postfix_indexed; } | bool is_postfix_indexed (void) const { return postfix_indexed; } | |||
// Check if the result of the expression should be printed. | ||||
// Should normally be used in conjunction with | ||||
// tree_evaluator::statement_printing_enabled. | ||||
bool print_result (void) const { return print_flag; } | bool print_result (void) const { return print_flag; } | |||
virtual std::string oper (void) const { return "<unknown>"; } | virtual std::string oper (void) const { return "<unknown>"; } | |||
virtual std::string name (void) const { return "<unknown>"; } | virtual std::string name (void) const { return "<unknown>"; } | |||
virtual std::string original_text (void) const; | virtual std::string original_text (void) const; | |||
virtual void mark_braindead_shortcircuit (const std::string&) { } | virtual void mark_braindead_shortcircuit (const std::string&) { } | |||
tree_expression *mark_in_parens (void) | tree_expression *mark_in_parens (void) | |||
{ | { | |||
num_parens++; | num_parens++; | |||
return this; | return this; | |||
} | } | |||
tree_expression *mark_postfix_indexed (void) | tree_expression *mark_postfix_indexed (void) | |||
{ | { | |||
postfix_indexed = true; | postfix_indexed = true; | |||
return this; | return this; | |||
} | } | |||
tree_expression *set_print_flag (bool print) | tree_expression *set_print_flag (bool print) | |||
{ | { | |||
print_flag = print; | print_flag = print; | |||
return this; | return this; | |||
} | } | |||
virtual void copy_base (const tree_expression& e) | virtual void copy_base (const tree_expression& e) | |||
{ | { | |||
num_parens = e.num_parens; | num_parens = e.num_parens; | |||
postfix_indexed = e.postfix_indexed; | postfix_indexed = e.postfix_indexed; | |||
print_flag = e.print_flag; | print_flag = e.print_flag; | |||
} | } | |||
protected: | protected: | |||
// A count of the number of times this expression appears directly | // A count of the number of times this expression appears directly | |||
// inside a set of parentheses. | // inside a set of parentheses. | |||
// | // | |||
// (((e1)) + e2) ==> 2 for expression e1 | // (((e1)) + e2) ==> 2 for expression e1 | |||
// ==> 1 for expression ((e1)) + e2 | // ==> 1 for expression ((e1)) + e2 | |||
// ==> 0 for expression e2 | // ==> 0 for expression e2 | |||
int num_parens; | int num_parens; | |||
End of changes. 9 change blocks. | ||||
24 lines changed or deleted | 28 lines changed or added | |||
pt-fcn-handle.h | pt-fcn-handle.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2003-2012 John W. Eaton | Copyright (C) 2003-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_fcn_handle_h) | #if !defined (octave_pt_fcn_handle_h) | |||
#define octave_fcn_handle_h 1 | #define octave_fcn_handle_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
#include "pt-bp.h" | #include "pt-bp.h" | |||
#include "pt-exp.h" | #include "pt-exp.h" | |||
#include "pt-misc.h" | #include "pt-misc.h" | |||
#include "pt-stmt.h" | #include "pt-stmt.h" | |||
#include "symtab.h" | #include "symtab.h" | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
pt-id.h | pt-id.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_identifier_h) | #if !defined (octave_pt_id_h) | |||
#define octave_tree_identifier_h 1 | #define octave_pt_id_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include <string> | #include <string> | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
class octave_function; | class octave_function; | |||
class tree_walker; | class tree_walker; | |||
skipping to change at line 49 | skipping to change at line 49 | |||
// Symbols from the symbol table. | // Symbols from the symbol table. | |||
class | class | |||
tree_identifier : public tree_expression | tree_identifier : public tree_expression | |||
{ | { | |||
friend class tree_index_expression; | friend class tree_index_expression; | |||
public: | public: | |||
tree_identifier (int l = -1, int c = -1) | tree_identifier (int l = -1, int c = -1) | |||
: tree_expression (l, c), sym (), scope (-1) { } | : tree_expression (l, c) { } | |||
tree_identifier (const symbol_table::symbol_record& s, | tree_identifier (const symbol_table::symbol_record& s, | |||
int l = -1, int c = -1, | int l = -1, int c = -1, | |||
symbol_table::scope_id sc = symbol_table::current_scope ()) | symbol_table::scope_id sc = symbol_table::current_scope ()) | |||
: tree_expression (l, c), sym (s), scope (sc) { } | : tree_expression (l, c), sym (s, sc) { } | |||
~tree_identifier (void) { } | ~tree_identifier (void) { } | |||
bool has_magic_end (void) const { return (name () == "__end__"); } | bool has_magic_end (void) const { return (name () == "end"); } | |||
bool is_identifier (void) const { return true; } | bool is_identifier (void) const { return true; } | |||
// The name doesn't change with scope, so use sym instead of | // The name doesn't change with scope, so use sym instead of | |||
// accessing it through sym so that this function may remain const. | // accessing it through sym so that this function may remain const. | |||
std::string name (void) const { return sym.name (); } | std::string name (void) const { return sym.name (); } | |||
bool is_defined (void) { return xsym().is_defined (); } | bool is_defined (void) { return sym->is_defined (); } | |||
virtual bool is_variable (void) { return xsym().is_variable (); } | virtual bool is_variable (void) { return sym->is_variable (); } | |||
virtual bool is_black_hole (void) { return false; } | virtual bool is_black_hole (void) { return false; } | |||
// Try to find a definition for an identifier. Here's how: | // Try to find a definition for an identifier. Here's how: | |||
// | // | |||
// * If the identifier is already defined and is a function defined | // * If the identifier is already defined and is a function defined | |||
// in an function file that has been modified since the last time | // in an function file that has been modified since the last time | |||
// we parsed it, parse it again. | // we parsed it, parse it again. | |||
// | // | |||
// * If the identifier is not defined, try to find a builtin | // * If the identifier is not defined, try to find a builtin | |||
skipping to change at line 90 | skipping to change at line 90 | |||
// | // | |||
// * If the identifier is still undefined, try looking for an | // * If the identifier is still undefined, try looking for an | |||
// function file to parse. | // function file to parse. | |||
// | // | |||
// * On systems that support dynamic linking, we prefer .oct files, | // * On systems that support dynamic linking, we prefer .oct files, | |||
// then .mex files, then .m files. | // then .mex files, then .m files. | |||
octave_value | octave_value | |||
do_lookup (const octave_value_list& args = octave_value_list ()) | do_lookup (const octave_value_list& args = octave_value_list ()) | |||
{ | { | |||
return xsym().find (args); | return sym->find (args); | |||
} | } | |||
void mark_global (void) { xsym().mark_global (); } | void mark_global (void) { sym->mark_global (); } | |||
void mark_as_static (void) { xsym().init_persistent (); } | void mark_as_static (void) { sym->init_persistent (); } | |||
void mark_as_formal_parameter (void) { xsym().mark_formal (); } | void mark_as_formal_parameter (void) { sym->mark_formal (); } | |||
// We really need to know whether this symbol referst to a variable | // We really need to know whether this symbol referst to a variable | |||
// or a function, but we may not know that yet. | // or a function, but we may not know that yet. | |||
bool lvalue_ok (void) const { return true; } | bool lvalue_ok (void) const { return true; } | |||
octave_value rvalue1 (int nargout = 1); | octave_value rvalue1 (int nargout = 1); | |||
octave_value_list rvalue (int nargout); | octave_value_list rvalue (int nargout) | |||
{ | ||||
return rvalue (nargout, 0); | ||||
} | ||||
octave_value_list rvalue (int nargout, | ||||
const std::list<octave_lvalue> *lvalue_list); | ||||
octave_lvalue lvalue (void); | octave_lvalue lvalue (void); | |||
void eval_undefined_error (void); | void eval_undefined_error (void); | |||
void static_workspace_error (void) | ||||
{ | ||||
::error ("can not add variable \"%s\" to a static workspace", | ||||
name ().c_str ()); | ||||
} | ||||
tree_identifier *dup (symbol_table::scope_id scope, | tree_identifier *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
private: | symbol_table::symbol_reference symbol (void) const | |||
// The symbol record that this identifier references. | ||||
symbol_table::symbol_record sym; | ||||
symbol_table::scope_id scope; | ||||
// A script may be executed in multiple scopes. If the last one was | ||||
// different from the one we are in now, update sym to be from the | ||||
// new scope. | ||||
symbol_table::symbol_record& xsym (void) | ||||
{ | { | |||
symbol_table::scope_id curr_scope = symbol_table::current_scope (); | ||||
if (scope != curr_scope) | ||||
{ | ||||
scope = curr_scope; | ||||
sym = symbol_table::insert (sym.name ()); | ||||
} | ||||
return sym; | return sym; | |||
} | } | |||
private: | ||||
// The symbol record that this identifier references. | ||||
symbol_table::symbol_reference sym; | ||||
// No copying! | // No copying! | |||
tree_identifier (const tree_identifier&); | tree_identifier (const tree_identifier&); | |||
tree_identifier& operator = (const tree_identifier&); | tree_identifier& operator = (const tree_identifier&); | |||
}; | }; | |||
class tree_black_hole : public tree_identifier | class tree_black_hole : public tree_identifier | |||
{ | { | |||
skipping to change at line 161 | skipping to change at line 159 | |||
tree_black_hole (int l = -1, int c = -1) | tree_black_hole (int l = -1, int c = -1) | |||
: tree_identifier (l, c) { } | : tree_identifier (l, c) { } | |||
std::string name (void) const { return "~"; } | std::string name (void) const { return "~"; } | |||
bool is_variable (void) { return false; } | bool is_variable (void) { return false; } | |||
bool is_black_hole (void) { return true; } | bool is_black_hole (void) { return true; } | |||
tree_black_hole *dup (void) const | tree_black_hole *dup (void) const | |||
{ return new tree_black_hole; } | { return new tree_black_hole; } | |||
octave_lvalue lvalue (void) | octave_lvalue lvalue (void) | |||
{ | { | |||
return octave_lvalue (0); // black hole lvalue | return octave_lvalue (); // black hole lvalue | |||
} | } | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 18 change blocks. | ||||
36 lines changed or deleted | 34 lines changed or added | |||
pt-idx.h | pt-idx.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_index_h) | #if !defined (octave_pt_idx_h) | |||
#define octave_tree_index_h 1 | #define octave_pt_idx_h 1 | |||
#include <list> | #include <list> | |||
class tree_argument_list; | class tree_argument_list; | |||
class tree_walker; | class tree_walker; | |||
class octave_map; | class octave_map; | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
skipping to change at line 88 | skipping to change at line 88 | |||
std::list<string_vector> arg_names (void) { return arg_nm; } | std::list<string_vector> arg_names (void) { return arg_nm; } | |||
bool lvalue_ok (void) const { return expr->lvalue_ok (); } | bool lvalue_ok (void) const { return expr->lvalue_ok (); } | |||
bool rvalue_ok (void) const { return true; } | bool rvalue_ok (void) const { return true; } | |||
octave_value rvalue1 (int nargout = 1); | octave_value rvalue1 (int nargout = 1); | |||
octave_value_list rvalue (int nargout); | octave_value_list rvalue (int nargout); | |||
octave_value_list rvalue (int nargout, const std::list<octave_lvalue> *lv | octave_value_list rvalue (int nargout, | |||
alue_list); | const std::list<octave_lvalue> *lvalue_list); | |||
octave_lvalue lvalue (void); | octave_lvalue lvalue (void); | |||
tree_index_expression *dup (symbol_table::scope_id scope, | tree_index_expression *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
private: | private: | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
pt-jump.h | pt-jump.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_jump_h) | #if !defined (octave_pt_jump_h) | |||
#define octave_tree_jump_h 1 | #define octave_pt_jump_h 1 | |||
class tree_walker; | class tree_walker; | |||
#include "pt-cmd.h" | #include "pt-cmd.h" | |||
#include "symtab.h" | #include "symtab.h" | |||
// Break. | // Break. | |||
class | class | |||
tree_break_command : public tree_command | tree_break_command : public tree_command | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
pt-loop.h | pt-loop.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_loop_h) | #if !defined (octave_pt_loop_h) | |||
#define octave_tree_loop_h 1 | #define octave_pt_loop_h 1 | |||
class octave_value; | class octave_value; | |||
class octave_lvalue; | class octave_lvalue; | |||
class tree_argument_list; | class tree_argument_list; | |||
class tree_expression; | class tree_expression; | |||
class tree_statement_list; | class tree_statement_list; | |||
class tree_walker; | class tree_walker; | |||
#include "comment-list.h" | #include "comment-list.h" | |||
#include "pt-cmd.h" | #include "pt-cmd.h" | |||
#include "symtab.h" | #include "symtab.h" | |||
class jit_info; | ||||
// While. | // While. | |||
class | class | |||
tree_while_command : public tree_command | tree_while_command : public tree_command | |||
{ | { | |||
public: | public: | |||
tree_while_command (int l = -1, int c = -1) | tree_while_command (int l = -1, int c = -1) | |||
: tree_command (l, c), expr (0), list (0), lead_comm (0), | : tree_command (l, c), expr (0), list (0), lead_comm (0), | |||
trail_comm (0) { } | trail_comm (0) | |||
#ifdef HAVE_LLVM | ||||
, compiled (0) | ||||
#endif | ||||
{ } | ||||
tree_while_command (tree_expression *e, | tree_while_command (tree_expression *e, | |||
octave_comment_list *lc = 0, | octave_comment_list *lc = 0, | |||
octave_comment_list *tc = 0, | octave_comment_list *tc = 0, | |||
int l = -1, int c = -1) | int l = -1, int c = -1) | |||
: tree_command (l, c), expr (e), list (0), lead_comm (lc), | : tree_command (l, c), expr (e), list (0), lead_comm (lc), | |||
trail_comm (tc) { } | trail_comm (tc) | |||
#ifdef HAVE_LLVM | ||||
, compiled (0) | ||||
#endif | ||||
{ } | ||||
tree_while_command (tree_expression *e, tree_statement_list *lst, | tree_while_command (tree_expression *e, tree_statement_list *lst, | |||
octave_comment_list *lc = 0, | octave_comment_list *lc = 0, | |||
octave_comment_list *tc = 0, | octave_comment_list *tc = 0, | |||
int l = -1, int c = -1) | int l = -1, int c = -1) | |||
: tree_command (l, c), expr (e), list (lst), lead_comm (lc), | : tree_command (l, c), expr (e), list (lst), lead_comm (lc), | |||
trail_comm (tc) { } | trail_comm (tc) | |||
#ifdef HAVE_LLVM | ||||
, compiled (0) | ||||
#endif | ||||
{ } | ||||
~tree_while_command (void); | ~tree_while_command (void); | |||
tree_expression *condition (void) { return expr; } | tree_expression *condition (void) { return expr; } | |||
tree_statement_list *body (void) { return list; } | tree_statement_list *body (void) { return list; } | |||
octave_comment_list *leading_comment (void) { return lead_comm; } | octave_comment_list *leading_comment (void) { return lead_comm; } | |||
octave_comment_list *trailing_comment (void) { return trail_comm; } | octave_comment_list *trailing_comment (void) { return trail_comm; } | |||
tree_command *dup (symbol_table::scope_id scope, | tree_command *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
#ifdef HAVE_LLVM | ||||
// some functions use by tree_jit | ||||
jit_info *get_info (void) const | ||||
{ | ||||
return compiled; | ||||
} | ||||
void stash_info (jit_info *jinfo) | ||||
{ | ||||
compiled = jinfo; | ||||
} | ||||
#endif | ||||
protected: | protected: | |||
// Expression to test. | // Expression to test. | |||
tree_expression *expr; | tree_expression *expr; | |||
// List of commands to execute. | // List of commands to execute. | |||
tree_statement_list *list; | tree_statement_list *list; | |||
// Comment preceding WHILE token. | // Comment preceding WHILE token. | |||
octave_comment_list *lead_comm; | octave_comment_list *lead_comm; | |||
// Comment preceding ENDWHILE token. | // Comment preceding ENDWHILE token. | |||
octave_comment_list *trail_comm; | octave_comment_list *trail_comm; | |||
private: | private: | |||
#ifdef HAVE_LLVM | ||||
// compiled version of the loop | ||||
jit_info *compiled; | ||||
#endif | ||||
// No copying! | // No copying! | |||
tree_while_command (const tree_while_command&); | tree_while_command (const tree_while_command&); | |||
tree_while_command& operator = (const tree_while_command&); | tree_while_command& operator = (const tree_while_command&); | |||
}; | }; | |||
// Do-Until. | // Do-Until. | |||
class | class | |||
skipping to change at line 149 | skipping to change at line 181 | |||
// For. | // For. | |||
class | class | |||
tree_simple_for_command : public tree_command | tree_simple_for_command : public tree_command | |||
{ | { | |||
public: | public: | |||
tree_simple_for_command (int l = -1, int c = -1) | tree_simple_for_command (int l = -1, int c = -1) | |||
: tree_command (l, c), parallel (false), lhs (0), expr (0), | : tree_command (l, c), parallel (false), lhs (0), expr (0), | |||
maxproc (0), list (0), lead_comm (0), trail_comm (0) { } | maxproc (0), list (0), lead_comm (0), trail_comm (0) | |||
#ifdef HAVE_LLVM | ||||
, compiled (0) | ||||
#endif | ||||
{ } | ||||
tree_simple_for_command (bool parallel_arg, tree_expression *le, | tree_simple_for_command (bool parallel_arg, tree_expression *le, | |||
tree_expression *re, | tree_expression *re, | |||
tree_expression *maxproc_arg, | tree_expression *maxproc_arg, | |||
tree_statement_list *lst, | tree_statement_list *lst, | |||
octave_comment_list *lc = 0, | octave_comment_list *lc = 0, | |||
octave_comment_list *tc = 0, | octave_comment_list *tc = 0, | |||
int l = -1, int c = -1) | int l = -1, int c = -1) | |||
: tree_command (l, c), parallel (parallel_arg), lhs (le), | : tree_command (l, c), parallel (parallel_arg), lhs (le), | |||
expr (re), maxproc (maxproc_arg), list (lst), | expr (re), maxproc (maxproc_arg), list (lst), | |||
lead_comm (lc), trail_comm (tc) { } | lead_comm (lc), trail_comm (tc) | |||
#ifdef HAVE_LLVM | ||||
, compiled (0) | ||||
#endif | ||||
{ } | ||||
~tree_simple_for_command (void); | ~tree_simple_for_command (void); | |||
bool in_parallel (void) { return parallel; } | bool in_parallel (void) { return parallel; } | |||
tree_expression *left_hand_side (void) { return lhs; } | tree_expression *left_hand_side (void) { return lhs; } | |||
tree_expression *control_expr (void) { return expr; } | tree_expression *control_expr (void) { return expr; } | |||
tree_expression *maxproc_expr (void) { return maxproc; } | tree_expression *maxproc_expr (void) { return maxproc; } | |||
skipping to change at line 183 | skipping to change at line 223 | |||
octave_comment_list *leading_comment (void) { return lead_comm; } | octave_comment_list *leading_comment (void) { return lead_comm; } | |||
octave_comment_list *trailing_comment (void) { return trail_comm; } | octave_comment_list *trailing_comment (void) { return trail_comm; } | |||
tree_command *dup (symbol_table::scope_id scope, | tree_command *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
private: | #ifdef HAVE_LLVM | |||
// some functions use by tree_jit | ||||
jit_info *get_info (void) const | ||||
{ | ||||
return compiled; | ||||
} | ||||
void stash_info (jit_info *jinfo) | ||||
{ | ||||
compiled = jinfo; | ||||
} | ||||
#endif | ||||
private: | ||||
// TRUE means operate in parallel (subject to the value of the | // TRUE means operate in parallel (subject to the value of the | |||
// maxproc expression). | // maxproc expression). | |||
bool parallel; | bool parallel; | |||
// Expression to modify. | // Expression to modify. | |||
tree_expression *lhs; | tree_expression *lhs; | |||
// Expression to evaluate. | // Expression to evaluate. | |||
tree_expression *expr; | tree_expression *expr; | |||
skipping to change at line 208 | skipping to change at line 260 | |||
// List of commands to execute. | // List of commands to execute. | |||
tree_statement_list *list; | tree_statement_list *list; | |||
// Comment preceding FOR token. | // Comment preceding FOR token. | |||
octave_comment_list *lead_comm; | octave_comment_list *lead_comm; | |||
// Comment preceding ENDFOR token. | // Comment preceding ENDFOR token. | |||
octave_comment_list *trail_comm; | octave_comment_list *trail_comm; | |||
// compiled version of the loop | ||||
jit_info *compiled; | ||||
// No copying! | // No copying! | |||
tree_simple_for_command (const tree_simple_for_command&); | tree_simple_for_command (const tree_simple_for_command&); | |||
tree_simple_for_command& operator = (const tree_simple_for_command&); | tree_simple_for_command& operator = (const tree_simple_for_command&); | |||
}; | }; | |||
class | class | |||
tree_complex_for_command : public tree_command | tree_complex_for_command : public tree_command | |||
{ | { | |||
End of changes. 13 change blocks. | ||||
9 lines changed or deleted | 64 lines changed or added | |||
pt-mat.h | pt-mat.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_mat_h) | #if !defined (octave_pt_mat_h) | |||
#define octave_tree_mat_h 1 | #define octave_pt_mat_h 1 | |||
#include <iosfwd> | #include <iosfwd> | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
class tree_argument_list; | class tree_argument_list; | |||
class tree_walker; | class tree_walker; | |||
#include "base-list.h" | #include "base-list.h" | |||
#include "pt-array-list.h" | ||||
#include "pt-exp.h" | #include "pt-exp.h" | |||
#include "symtab.h" | #include "symtab.h" | |||
// General matrices. This allows us to construct matrices from | // General matrices. This allows us to construct matrices from | |||
// other matrices, variables, and functions. | // other matrices, variables, and functions. | |||
class | class | |||
tree_matrix : public tree_expression, | tree_matrix : public tree_array_list | |||
public octave_base_list<tree_argument_list *> | ||||
{ | { | |||
public: | public: | |||
tree_matrix (tree_argument_list *row = 0, int l = -1, int c = -1) | tree_matrix (tree_argument_list *row = 0, int l = -1, int c = -1) | |||
: tree_expression (l, c) | : tree_array_list (row, l, c) | |||
{ | { } | |||
if (row) | ||||
append (row); | ||||
} | ||||
~tree_matrix (void); | ~tree_matrix (void) { } | |||
bool has_magic_end (void) const; | bool is_matrix (void) const { return true; } | |||
bool all_elements_are_constant (void) const; | ||||
bool rvalue_ok (void) const { return true; } | bool rvalue_ok (void) const { return true; } | |||
octave_value rvalue1 (int nargout = 1); | octave_value rvalue1 (int nargout = 1); | |||
octave_value_list rvalue (int nargout); | octave_value_list rvalue (int nargout); | |||
tree_expression *dup (symbol_table::scope_id scope, | tree_expression *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
End of changes. 7 change blocks. | ||||
14 lines changed or deleted | 9 lines changed or added | |||
pt-misc.h | pt-misc.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1994-2012 John W. Eaton | Copyright (C) 1994-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_misc_h) | #if !defined (octave_pt_misc_h) | |||
#define octave_tree_misc_h 1 | #define octave_pt_misc_h 1 | |||
class Cell; | class Cell; | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
class tree_identifier; | class tree_identifier; | |||
class tree_index_expression; | class tree_index_expression; | |||
class tree_va_return_list; | class tree_va_return_list; | |||
skipping to change at line 51 | skipping to change at line 51 | |||
// Parameter lists. Used to hold the list of input and output | // Parameter lists. Used to hold the list of input and output | |||
// parameters in a function definition. Elements are identifiers | // parameters in a function definition. Elements are identifiers | |||
// only. | // only. | |||
class | class | |||
tree_parameter_list : public octave_base_list<tree_decl_elt *> | tree_parameter_list : public octave_base_list<tree_decl_elt *> | |||
{ | { | |||
public: | public: | |||
enum in_or_out | enum in_or_out | |||
{ | { | |||
in = 1, | in = 1, | |||
out = 2 | out = 2 | |||
}; | }; | |||
tree_parameter_list (void) | tree_parameter_list (void) | |||
: marked_for_varargs (0) { } | : marked_for_varargs (0) { } | |||
tree_parameter_list (tree_decl_elt *t) | tree_parameter_list (tree_decl_elt *t) | |||
: marked_for_varargs (0) { append (t); } | : marked_for_varargs (0) { append (t); } | |||
tree_parameter_list (tree_identifier *id) | ||||
: marked_for_varargs (0) { append (new tree_decl_elt (id)); } | ||||
~tree_parameter_list (void); | ~tree_parameter_list (void); | |||
void mark_as_formal_parameters (void); | void mark_as_formal_parameters (void); | |||
bool validate (in_or_out type); | bool validate (in_or_out type); | |||
bool takes_varargs (void) const { return marked_for_varargs != 0; } | bool takes_varargs (void) const { return marked_for_varargs != 0; } | |||
bool varargs_only (void) { return (marked_for_varargs < 0); } | bool varargs_only (void) { return (marked_for_varargs < 0); } | |||
void initialize_undefined_elements (const std::string& warnfor, | void initialize_undefined_elements (const std::string& warnfor, | |||
int nargout, const octave_value& val) ; | int nargout, const octave_value& val) ; | |||
void define_from_arg_vector (const octave_value_list& args); | void define_from_arg_vector (const octave_value_list& args); | |||
void undefine (void); | void undefine (void); | |||
bool is_defined (void); | bool is_defined (void); | |||
octave_value_list convert_to_const_vector (int nargout, const Cell& varar | std::list<std::string> variable_names (void) const; | |||
gout); | ||||
octave_value_list convert_to_const_vector (int nargout, | ||||
const Cell& varargout); | ||||
tree_parameter_list *dup (symbol_table::scope_id scope, | tree_parameter_list *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
private: | private: | |||
int marked_for_varargs; | int marked_for_varargs; | |||
End of changes. 5 change blocks. | ||||
9 lines changed or deleted | 14 lines changed or added | |||
pt-pr-code.h | pt-pr-code.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_print_code_h) | #if !defined (octave_pt_pr_code_h) | |||
#define octave_tree_print_code_h 1 | #define octave_pt_pr_code_h 1 | |||
#include <stack> | #include <stack> | |||
#include <string> | #include <string> | |||
#include "comment-list.h" | #include "comment-list.h" | |||
#include "pt-walk.h" | #include "pt-walk.h" | |||
class tree_decl_command; | class tree_decl_command; | |||
class tree_expression; | class tree_expression; | |||
skipping to change at line 70 | skipping to change at line 70 | |||
void visit_binary_expression (tree_binary_expression&); | void visit_binary_expression (tree_binary_expression&); | |||
void visit_break_command (tree_break_command&); | void visit_break_command (tree_break_command&); | |||
void visit_colon_expression (tree_colon_expression&); | void visit_colon_expression (tree_colon_expression&); | |||
void visit_continue_command (tree_continue_command&); | void visit_continue_command (tree_continue_command&); | |||
void visit_global_command (tree_global_command&); | void visit_global_command (tree_global_command&); | |||
void visit_static_command (tree_static_command&); | void visit_persistent_command (tree_persistent_command&); | |||
void visit_decl_elt (tree_decl_elt&); | void visit_decl_elt (tree_decl_elt&); | |||
void visit_decl_init_list (tree_decl_init_list&); | void visit_decl_init_list (tree_decl_init_list&); | |||
void visit_simple_for_command (tree_simple_for_command&); | void visit_simple_for_command (tree_simple_for_command&); | |||
void visit_complex_for_command (tree_complex_for_command&); | void visit_complex_for_command (tree_complex_for_command&); | |||
void visit_octave_user_script (octave_user_script&); | void visit_octave_user_script (octave_user_script&); | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
pt-select.h | pt-select.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_select_h) | #if !defined (octave_pt_select_h) | |||
#define octave_tree_select_h 1 | #define octave_pt_select_h 1 | |||
class expression; | class expression; | |||
class tree_statement_list; | class tree_statement_list; | |||
class tree_walker; | class tree_walker; | |||
#include "base-list.h" | #include "base-list.h" | |||
#include "comment-list.h" | #include "comment-list.h" | |||
#include "pt-cmd.h" | #include "pt-cmd.h" | |||
#include "symtab.h" | #include "symtab.h" | |||
skipping to change at line 98 | skipping to change at line 98 | |||
class | class | |||
tree_if_command_list : public octave_base_list<tree_if_clause *> | tree_if_command_list : public octave_base_list<tree_if_clause *> | |||
{ | { | |||
public: | public: | |||
tree_if_command_list (void) { } | tree_if_command_list (void) { } | |||
tree_if_command_list (tree_if_clause *t) { append (t); } | tree_if_command_list (tree_if_clause *t) { append (t); } | |||
~tree_if_command_list (void) | ~tree_if_command_list (void) | |||
{ | { | |||
while (! empty ()) | while (! empty ()) | |||
{ | { | |||
iterator p = begin (); | iterator p = begin (); | |||
delete *p; | delete *p; | |||
erase (p); | erase (p); | |||
} | } | |||
} | } | |||
tree_if_command_list *dup (symbol_table::scope_id scope, | tree_if_command_list *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
private: | private: | |||
// No copying! | // No copying! | |||
skipping to change at line 228 | skipping to change at line 228 | |||
class | class | |||
tree_switch_case_list : public octave_base_list<tree_switch_case *> | tree_switch_case_list : public octave_base_list<tree_switch_case *> | |||
{ | { | |||
public: | public: | |||
tree_switch_case_list (void) { } | tree_switch_case_list (void) { } | |||
tree_switch_case_list (tree_switch_case *t) { append (t); } | tree_switch_case_list (tree_switch_case *t) { append (t); } | |||
~tree_switch_case_list (void) | ~tree_switch_case_list (void) | |||
{ | { | |||
while (! empty ()) | while (! empty ()) | |||
{ | { | |||
iterator p = begin (); | iterator p = begin (); | |||
delete *p; | delete *p; | |||
erase (p); | erase (p); | |||
} | } | |||
} | } | |||
tree_switch_case_list *dup (symbol_table::scope_id scope, | tree_switch_case_list *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
private: | private: | |||
// No copying! | // No copying! | |||
End of changes. 4 change blocks. | ||||
19 lines changed or deleted | 19 lines changed or added | |||
pt-stmt.h | pt-stmt.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_stmt_h) | #if !defined (octave_pt_stmt_h) | |||
#define octave_tree_stmt_h 1 | #define octave_pt_stmt_h 1 | |||
class octave_value_list; | class octave_value_list; | |||
class tree_command; | class tree_command; | |||
class tree_expression; | class tree_expression; | |||
class tree_walker; | class tree_walker; | |||
#include <deque> | #include <deque> | |||
#include "base-list.h" | #include "base-list.h" | |||
#include "comment-list.h" | #include "comment-list.h" | |||
#include "debug.h" | ||||
#include "symtab.h" | #include "symtab.h" | |||
#include "pt.h" | ||||
// A statement is either a command to execute or an expression to | // A statement is either a command to execute or an expression to | |||
// evaluate. | // evaluate. | |||
class | class | |||
tree_statement | tree_statement : public tree | |||
{ | { | |||
public: | public: | |||
tree_statement (void) | tree_statement (void) | |||
: cmd (0), expr (0), comm (0) { } | : cmd (0), expr (0), comm (0) { } | |||
tree_statement (tree_command *c, octave_comment_list *cl) | tree_statement (tree_command *c, octave_comment_list *cl) | |||
: cmd (c), expr (0), comm (cl) { } | : cmd (c), expr (0), comm (cl) { } | |||
tree_statement (tree_expression *e, octave_comment_list *cl) | tree_statement (tree_expression *e, octave_comment_list *cl) | |||
skipping to change at line 75 | skipping to change at line 77 | |||
void set_breakpoint (void); | void set_breakpoint (void); | |||
void delete_breakpoint (void); | void delete_breakpoint (void); | |||
bool is_breakpoint (void) const; | bool is_breakpoint (void) const; | |||
int line (void) const; | int line (void) const; | |||
int column (void) const; | int column (void) const; | |||
void set_location (int l, int c); | ||||
void echo_code (void); | void echo_code (void); | |||
tree_command *command (void) { return cmd; } | tree_command *command (void) { return cmd; } | |||
tree_expression *expression (void) { return expr; } | tree_expression *expression (void) { return expr; } | |||
octave_comment_list *comment_text (void) { return comm; } | octave_comment_list *comment_text (void) { return comm; } | |||
bool is_null_statement (void) const { return ! (cmd || expr || comm); } | bool is_null_statement (void) const { return ! (cmd || expr || comm); } | |||
bool is_end_of_fcn_or_script (void) const; | bool is_end_of_fcn_or_script (void) const; | |||
bool is_end_of_file (void) const; | ||||
// Allow modification of this statement. Note that there is no | // Allow modification of this statement. Note that there is no | |||
// checking. If you use these, are you sure you knwo what you are | // checking. If you use these, are you sure you knwo what you are | |||
// doing? | // doing? | |||
void set_command (tree_command *c) { cmd = c; } | void set_command (tree_command *c) { cmd = c; } | |||
void set_expression (tree_expression *e) { expr = e; } | void set_expression (tree_expression *e) { expr = e; } | |||
tree_statement *dup (symbol_table::scope_id scope, | tree_statement *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
skipping to change at line 135 | skipping to change at line 141 | |||
tree_statement_list (void) | tree_statement_list (void) | |||
: function_body (false), anon_function_body (false), | : function_body (false), anon_function_body (false), | |||
script_body (false) { } | script_body (false) { } | |||
tree_statement_list (tree_statement *s) | tree_statement_list (tree_statement *s) | |||
: function_body (false), anon_function_body (false), | : function_body (false), anon_function_body (false), | |||
script_body (false) { append (s); } | script_body (false) { append (s); } | |||
~tree_statement_list (void) | ~tree_statement_list (void) | |||
{ | { | |||
while (! empty ()) | while (! empty ()) | |||
{ | { | |||
iterator p = begin (); | iterator p = begin (); | |||
delete *p; | delete *p; | |||
erase (p); | erase (p); | |||
} | } | |||
} | } | |||
void mark_as_function_body (void) { function_body = true; } | void mark_as_function_body (void) { function_body = true; } | |||
void mark_as_anon_function_body (void) { anon_function_body = true; } | void mark_as_anon_function_body (void) { anon_function_body = true; } | |||
void mark_as_script_body (void) { script_body = true; } | void mark_as_script_body (void) { script_body = true; } | |||
bool is_function_body (void) const { return function_body; } | bool is_function_body (void) const { return function_body; } | |||
bool is_anon_function_body (void) const { return anon_function_body; } | bool is_anon_function_body (void) const { return anon_function_body; } | |||
bool is_script_body (void) const { return script_body; } | bool is_script_body (void) const { return script_body; } | |||
int set_breakpoint (int line); | int set_breakpoint (int line); | |||
void delete_breakpoint (int line); | void delete_breakpoint (int line); | |||
octave_value_list list_breakpoints (void); | octave_value_list list_breakpoints (void); | |||
bp_table::intmap add_breakpoint (const std::string& file, | ||||
const bp_table::intmap& line); | ||||
bp_table::intmap remove_all_breakpoints (const std::string& file); | ||||
tree_statement_list *dup (symbol_table::scope_id scope, | tree_statement_list *dup (symbol_table::scope_id scope, | |||
symbol_table::context_id context) const; | symbol_table::context_id context) const; | |||
void accept (tree_walker& tw); | void accept (tree_walker& tw); | |||
private: | private: | |||
// Does this list of statements make up the body of a function? | // Does this list of statements make up the body of a function? | |||
bool function_body; | bool function_body; | |||
End of changes. 9 change blocks. | ||||
12 lines changed or deleted | 23 lines changed or added | |||
pt-unop.h | pt-unop.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_unop_h) | #if !defined (octave_pt_unop_h) | |||
#define octave_tree_unop_h 1 | #define octave_pt_unop_h 1 | |||
#include <string> | #include <string> | |||
class tree_walker; | class tree_walker; | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
class octave_lvalue; | class octave_lvalue; | |||
#include "pt-exp.h" | #include "pt-exp.h" | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
pt-walk.h | pt-walk.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_walker_h) | #if !defined (octave_pt_walk_h) | |||
#define octave_tree_walker_h 1 | #define octave_pt_walk_h 1 | |||
class tree_anon_fcn_handle; | class tree_anon_fcn_handle; | |||
class tree_argument_list; | class tree_argument_list; | |||
class tree_binary_expression; | class tree_binary_expression; | |||
class tree_break_command; | class tree_break_command; | |||
class tree_colon_expression; | class tree_colon_expression; | |||
class tree_continue_command; | class tree_continue_command; | |||
class tree_global_command; | class tree_global_command; | |||
class tree_static_command; | class tree_persistent_command; | |||
class tree_decl_elt; | class tree_decl_elt; | |||
class tree_decl_init_list; | class tree_decl_init_list; | |||
class tree_simple_for_command; | class tree_simple_for_command; | |||
class tree_complex_for_command; | class tree_complex_for_command; | |||
class octave_user_script; | class octave_user_script; | |||
class octave_user_function; | class octave_user_function; | |||
class tree_function_def; | class tree_function_def; | |||
class tree_identifier; | class tree_identifier; | |||
class tree_if_clause; | class tree_if_clause; | |||
class tree_if_command; | class tree_if_command; | |||
skipping to change at line 95 | skipping to change at line 95 | |||
virtual void | virtual void | |||
visit_colon_expression (tree_colon_expression&) = 0; | visit_colon_expression (tree_colon_expression&) = 0; | |||
virtual void | virtual void | |||
visit_continue_command (tree_continue_command&) = 0; | visit_continue_command (tree_continue_command&) = 0; | |||
virtual void | virtual void | |||
visit_global_command (tree_global_command&) = 0; | visit_global_command (tree_global_command&) = 0; | |||
virtual void | virtual void | |||
visit_static_command (tree_static_command&) = 0; | visit_persistent_command (tree_persistent_command&) = 0; | |||
virtual void | virtual void | |||
visit_decl_elt (tree_decl_elt&) = 0; | visit_decl_elt (tree_decl_elt&) = 0; | |||
virtual void | virtual void | |||
visit_decl_init_list (tree_decl_init_list&) = 0; | visit_decl_init_list (tree_decl_init_list&) = 0; | |||
virtual void | virtual void | |||
visit_simple_for_command (tree_simple_for_command&) = 0; | visit_simple_for_command (tree_simple_for_command&) = 0; | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
pt.h | pt.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |||
for more details. | for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_tree_h) | #if !defined (octave_pt_h) | |||
#define octave_tree_h 1 | #define octave_pt_h 1 | |||
#include <string> | #include <string> | |||
#include <iosfwd> | #include <iosfwd> | |||
class octave_function; | class octave_function; | |||
class tree_walker; | class tree_walker; | |||
// Base class for the parse tree. | // Base class for the parse tree. | |||
skipping to change at line 53 | skipping to change at line 53 | |||
virtual ~tree (void) { } | virtual ~tree (void) { } | |||
virtual int line (void) const { return line_num; } | virtual int line (void) const { return line_num; } | |||
virtual int column (void) const { return column_num; } | virtual int column (void) const { return column_num; } | |||
void line (int l) { line_num = l; } | void line (int l) { line_num = l; } | |||
void column (int c) { column_num = c; } | void column (int c) { column_num = c; } | |||
void set_location (int l, int c) | ||||
{ | ||||
line_num = l; | ||||
column_num = c; | ||||
} | ||||
virtual void set_breakpoint (void) { bp = true; } | virtual void set_breakpoint (void) { bp = true; } | |||
virtual void delete_breakpoint (void) { bp = false; } | virtual void delete_breakpoint (void) { bp = false; } | |||
bool is_breakpoint (void) const { return bp; } | bool is_breakpoint (void) const { return bp; } | |||
std::string str_print_code (void); | std::string str_print_code (void); | |||
virtual void accept (tree_walker& tw) = 0; | virtual void accept (tree_walker& tw) = 0; | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 9 lines changed or added | |||
quit.h | quit.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2002-2012 John W. Eaton | Copyright (C) 2002-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
randgamma.h | randgamma.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2006-2012 John W. Eaton | Copyright (C) 2006-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 35 | skipping to change at line 35 | |||
#ifndef _RANDGAMMA_H | #ifndef _RANDGAMMA_H | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
extern OCTAVE_API double oct_randg (double a); | extern OCTAVE_API double oct_randg (double a); | |||
extern OCTAVE_API void oct_fill_randg (double a, octave_idx_type n, double *p); | extern OCTAVE_API void oct_fill_randg (double a, octave_idx_type n, double *p); | |||
extern OCTAVE_API float oct_float_randg (float a); | ||||
extern OCTAVE_API void oct_fill_float_randg (float a, octave_idx_type n, | ||||
float *p); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
randmtzig.h | randmtzig.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2006-2012 John W. Eaton | Copyright (C) 2006-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 85 | skipping to change at line 85 | |||
extern OCTAVE_API void oct_init_by_array (uint32_t init_key[], int key_leng th); | extern OCTAVE_API void oct_init_by_array (uint32_t init_key[], int key_leng th); | |||
extern OCTAVE_API void oct_init_by_entropy (void); | extern OCTAVE_API void oct_init_by_entropy (void); | |||
extern OCTAVE_API void oct_set_state (uint32_t save[]); | extern OCTAVE_API void oct_set_state (uint32_t save[]); | |||
extern OCTAVE_API void oct_get_state (uint32_t save[]); | extern OCTAVE_API void oct_get_state (uint32_t save[]); | |||
/* === Array generators === */ | /* === Array generators === */ | |||
extern OCTAVE_API double oct_randu (void); | extern OCTAVE_API double oct_randu (void); | |||
extern OCTAVE_API double oct_randn (void); | extern OCTAVE_API double oct_randn (void); | |||
extern OCTAVE_API double oct_rande (void); | extern OCTAVE_API double oct_rande (void); | |||
extern OCTAVE_API float oct_float_randu (void); | ||||
extern OCTAVE_API float oct_float_randn (void); | ||||
extern OCTAVE_API float oct_float_rande (void); | ||||
/* === Array generators === */ | /* === Array generators === */ | |||
extern OCTAVE_API void oct_fill_randu (octave_idx_type n, double *p); | extern OCTAVE_API void oct_fill_randu (octave_idx_type n, double *p); | |||
extern OCTAVE_API void oct_fill_randn (octave_idx_type n, double *p); | extern OCTAVE_API void oct_fill_randn (octave_idx_type n, double *p); | |||
extern OCTAVE_API void oct_fill_rande (octave_idx_type n, double *p); | extern OCTAVE_API void oct_fill_rande (octave_idx_type n, double *p); | |||
extern OCTAVE_API void oct_fill_float_randu (octave_idx_type n, float *p); | ||||
extern OCTAVE_API void oct_fill_float_randn (octave_idx_type n, float *p); | ||||
extern OCTAVE_API void oct_fill_float_rande (octave_idx_type n, float *p); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 9 lines changed or added | |||
randpoisson.h | randpoisson.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2006-2012 John W. Eaton | Copyright (C) 2006-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 35 | skipping to change at line 35 | |||
#ifndef _RANDPOISSON_H | #ifndef _RANDPOISSON_H | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
extern OCTAVE_API double oct_randp (double L); | extern OCTAVE_API double oct_randp (double L); | |||
extern OCTAVE_API void oct_fill_randp (double L, octave_idx_type n, double *p); | extern OCTAVE_API void oct_fill_randp (double L, octave_idx_type n, double *p); | |||
extern OCTAVE_API float oct_float_randp (float L); | ||||
extern OCTAVE_API void oct_fill_float_randp (float L, octave_idx_type n, | ||||
float *p); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
sighandlers.h | sighandlers.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 48 | skipping to change at line 48 | |||
#include <signal.h> | #include <signal.h> | |||
#include "syswait.h" | #include "syswait.h" | |||
#include "siglist.h" | #include "siglist.h" | |||
#include "base-list.h" | #include "base-list.h" | |||
typedef void sig_handler (int); | typedef void sig_handler (int); | |||
// FIXME -- the data should probably be private... | // FIXME: the data should probably be private... | |||
struct | struct | |||
octave_interrupt_handler | octave_interrupt_handler | |||
{ | { | |||
#ifdef SIGINT | #ifdef SIGINT | |||
sig_handler *int_handler; | sig_handler *int_handler; | |||
#endif | #endif | |||
#ifdef SIGBREAK | #ifdef SIGBREAK | |||
sig_handler *brk_handler; | sig_handler *brk_handler; | |||
#endif | #endif | |||
}; | }; | |||
// Nonzero means we have already printed a message for this series of | // Nonzero means we have already printed a message for this series of | |||
// SIGPIPES. We assume that the writer will eventually give up. | // SIGPIPES. We assume that the writer will eventually give up. | |||
extern int pipe_handler_error_count; | extern int pipe_handler_error_count; | |||
// TRUE means we can be interrupted. | // TRUE means we can be interrupted. | |||
extern OCTINTERP_API bool can_interrupt; | extern OCTINTERP_API bool can_interrupt; | |||
extern OCTINTERP_API sig_handler *octave_set_signal_handler (int, sig_handl | extern OCTINTERP_API | |||
er *, | sig_handler *octave_set_signal_handler (int, sig_handler *, | |||
bool restart_syscalls = true | bool restart_syscalls = true); | |||
); | ||||
extern OCTINTERP_API void install_signal_handlers (void); | extern OCTINTERP_API void install_signal_handlers (void); | |||
extern OCTINTERP_API void octave_signal_handler (void); | extern OCTINTERP_API void octave_signal_handler (void); | |||
extern OCTINTERP_API octave_interrupt_handler octave_catch_interrupts (void ); | extern OCTINTERP_API octave_interrupt_handler octave_catch_interrupts (void ); | |||
extern OCTINTERP_API octave_interrupt_handler octave_ignore_interrupts (voi d); | extern OCTINTERP_API octave_interrupt_handler octave_ignore_interrupts (voi d); | |||
extern OCTINTERP_API octave_interrupt_handler | extern OCTINTERP_API octave_interrupt_handler | |||
octave_set_interrupt_handler (const volatile octave_interrupt_handler&, | octave_set_interrupt_handler (const volatile octave_interrupt_handler&, | |||
bool restart_syscalls = true); | bool restart_syscalls = true); | |||
#if defined (__WIN32__) && ! defined (__CYGWIN__) | ||||
extern OCTINTERP_API void w32_raise_sigint (void); | ||||
#endif | ||||
// extern void ignore_sigchld (void); | // extern void ignore_sigchld (void); | |||
// Maybe this should be in a separate file? | // Maybe this should be in a separate file? | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
octave_child | octave_child | |||
{ | { | |||
public: | public: | |||
skipping to change at line 110 | skipping to change at line 115 | |||
typedef bool (*child_event_handler) (pid_t, int); | typedef bool (*child_event_handler) (pid_t, int); | |||
octave_child (pid_t id = -1, child_event_handler f = 0) | octave_child (pid_t id = -1, child_event_handler f = 0) | |||
: pid (id), handler (f), have_status (0), status (0) { } | : pid (id), handler (f), have_status (0), status (0) { } | |||
octave_child (const octave_child& oc) | octave_child (const octave_child& oc) | |||
: pid (oc.pid), handler (oc.handler), | : pid (oc.pid), handler (oc.handler), | |||
have_status (oc.have_status), status (oc.status) { } | have_status (oc.have_status), status (oc.status) { } | |||
octave_child& operator = (const octave_child& oc) | octave_child& operator = (const octave_child& oc) | |||
{ | { | |||
if (&oc != this) | if (&oc != this) | |||
{ | { | |||
pid = oc.pid; | pid = oc.pid; | |||
handler = oc.handler; | handler = oc.handler; | |||
have_status = oc.have_status; | have_status = oc.have_status; | |||
status = oc.status; | status = oc.status; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
~octave_child (void) { } | ~octave_child (void) { } | |||
// The process id of this child. | // The process id of this child. | |||
pid_t pid; | pid_t pid; | |||
// The function we call if an event happens for this child. | // The function we call if an event happens for this child. | |||
child_event_handler handler; | child_event_handler handler; | |||
// Nonzero if this child has stopped or terminated. | // Nonzero if this child has stopped or terminated. | |||
skipping to change at line 177 | skipping to change at line 182 | |||
private: | private: | |||
static bool instance_ok (void); | static bool instance_ok (void); | |||
static octave_child_list_rep *instance; | static octave_child_list_rep *instance; | |||
static void cleanup_instance (void) { delete instance; instance = 0; } | static void cleanup_instance (void) { delete instance; instance = 0; } | |||
}; | }; | |||
// TRUE means we should try to enter the debugger on SIGINT. | ||||
extern OCTINTERP_API bool Vdebug_on_interrupt; | ||||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
16 lines changed or deleted | 22 lines changed or added | |||
siglist.h | siglist.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2000-2012 John W. Eaton | Copyright (C) 2000-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
sparse-base-chol.cc | sparse-base-chol.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2005-2012 David Bateman | Copyright (C) 2005-2013 David Bateman | |||
Copyright (C) 1998-2005 Andy Adler | Copyright (C) 1998-2005 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 59 | skipping to change at line 59 | |||
return; | return; | |||
Sp = static_cast<octave_idx_type *>(S->p); | Sp = static_cast<octave_idx_type *>(S->p); | |||
Si = static_cast<octave_idx_type *>(S->i); | Si = static_cast<octave_idx_type *>(S->i); | |||
Sx = static_cast<chol_elt *>(S->x); | Sx = static_cast<chol_elt *>(S->x); | |||
pdest = 0; | pdest = 0; | |||
ncol = S->ncol; | ncol = S->ncol; | |||
for (k = 0; k < ncol; k++) | for (k = 0; k < ncol; k++) | |||
{ | { | |||
p = Sp [k]; | p = Sp[k]; | |||
pend = Sp [k+1]; | pend = Sp[k+1]; | |||
Sp [k] = pdest; | Sp[k] = pdest; | |||
for (; p < pend; p++) | for (; p < pend; p++) | |||
{ | { | |||
sik = Sx [p]; | sik = Sx[p]; | |||
if (CHOLMOD_IS_NONZERO (sik)) | if (CHOLMOD_IS_NONZERO (sik)) | |||
{ | { | |||
if (p != pdest) | if (p != pdest) | |||
{ | { | |||
Si [pdest] = Si [p]; | Si[pdest] = Si[p]; | |||
Sx [pdest] = sik; | Sx[pdest] = sik; | |||
} | } | |||
pdest++; | pdest++; | |||
} | } | |||
} | } | |||
} | } | |||
Sp [ncol] = pdest; | Sp[ncol] = pdest; | |||
} | } | |||
#endif | #endif | |||
template <class chol_type, class chol_elt, class p_type> | template <class chol_type, class chol_elt, class p_type> | |||
octave_idx_type | octave_idx_type | |||
sparse_base_chol<chol_type, chol_elt, p_type>::sparse_base_chol_rep::init | sparse_base_chol<chol_type, chol_elt, p_type>::sparse_base_chol_rep::init | |||
(const chol_type& a, bool natural) | (const chol_type& a, bool natural, bool force) | |||
{ | { | |||
volatile octave_idx_type info = 0; | volatile octave_idx_type info = 0; | |||
#ifdef HAVE_CHOLMOD | #ifdef HAVE_CHOLMOD | |||
octave_idx_type a_nr = a.rows (); | octave_idx_type a_nr = a.rows (); | |||
octave_idx_type a_nc = a.cols (); | octave_idx_type a_nc = a.cols (); | |||
if (a_nr != a_nc) | if (a_nr != a_nc) | |||
{ | { | |||
(*current_liboctave_error_handler) | (*current_liboctave_error_handler) | |||
("SparseCHOL requires square matrix"); | ("SparseCHOL requires square matrix"); | |||
return -1; | return -1; | |||
} | } | |||
skipping to change at line 132 | skipping to change at line 133 | |||
cm->final_pack = true; | cm->final_pack = true; | |||
cm->final_monotonic = true; | cm->final_monotonic = true; | |||
cm->final_resymbol = false; | cm->final_resymbol = false; | |||
cholmod_sparse A; | cholmod_sparse A; | |||
cholmod_sparse *ac = &A; | cholmod_sparse *ac = &A; | |||
double dummy; | double dummy; | |||
ac->nrow = a_nr; | ac->nrow = a_nr; | |||
ac->ncol = a_nc; | ac->ncol = a_nc; | |||
ac->p = a.cidx(); | ac->p = a.cidx (); | |||
ac->i = a.ridx(); | ac->i = a.ridx (); | |||
ac->nzmax = a.nnz(); | ac->nzmax = a.nnz (); | |||
ac->packed = true; | ac->packed = true; | |||
ac->sorted = true; | ac->sorted = true; | |||
ac->nz = 0; | ac->nz = 0; | |||
#ifdef IDX_TYPE_LONG | #ifdef USE_64_BIT_IDX_T | |||
ac->itype = CHOLMOD_LONG; | ac->itype = CHOLMOD_LONG; | |||
#else | #else | |||
ac->itype = CHOLMOD_INT; | ac->itype = CHOLMOD_INT; | |||
#endif | #endif | |||
ac->dtype = CHOLMOD_DOUBLE; | ac->dtype = CHOLMOD_DOUBLE; | |||
ac->stype = 1; | ac->stype = 1; | |||
#ifdef OCTAVE_CHOLMOD_TYPE | #ifdef OCTAVE_CHOLMOD_TYPE | |||
ac->xtype = OCTAVE_CHOLMOD_TYPE; | ac->xtype = OCTAVE_CHOLMOD_TYPE; | |||
#else | #else | |||
ac->xtype = CHOLMOD_REAL; | ac->xtype = CHOLMOD_REAL; | |||
#endif | #endif | |||
if (a_nr < 1) | if (a_nr < 1) | |||
ac->x = &dummy; | ac->x = &dummy; | |||
else | else | |||
ac->x = a.data(); | ac->x = a.data (); | |||
// use natural ordering if no q output parameter | // use natural ordering if no q output parameter | |||
if (natural) | if (natural) | |||
{ | { | |||
cm->nmethods = 1 ; | cm->nmethods = 1 ; | |||
cm->method [0].ordering = CHOLMOD_NATURAL ; | cm->method[0].ordering = CHOLMOD_NATURAL ; | |||
cm->postorder = false ; | cm->postorder = false ; | |||
} | } | |||
cholmod_factor *Lfactor; | cholmod_factor *Lfactor; | |||
BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | |||
Lfactor = CHOLMOD_NAME(analyze) (ac, cm); | Lfactor = CHOLMOD_NAME(analyze) (ac, cm); | |||
CHOLMOD_NAME(factorize) (ac, Lfactor, cm); | CHOLMOD_NAME(factorize) (ac, Lfactor, cm); | |||
END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | |||
is_pd = cm->status == CHOLMOD_OK; | is_pd = cm->status == CHOLMOD_OK; | |||
info = (is_pd ? 0 : cm->status); | info = (is_pd ? 0 : cm->status); | |||
if (is_pd) | if (is_pd || force) | |||
{ | { | |||
BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | |||
cond = CHOLMOD_NAME(rcond) (Lfactor, cm); | cond = CHOLMOD_NAME(rcond) (Lfactor, cm); | |||
END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | |||
minor_p = Lfactor->minor; | minor_p = Lfactor->minor; | |||
BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | |||
Lsparse = CHOLMOD_NAME(factor_to_sparse) (Lfactor, cm); | Lsparse = CHOLMOD_NAME(factor_to_sparse) (Lfactor, cm); | |||
END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | |||
skipping to change at line 227 | skipping to change at line 228 | |||
("Missing CHOLMOD. Sparse cholesky factorization disabled"); | ("Missing CHOLMOD. Sparse cholesky factorization disabled"); | |||
#endif | #endif | |||
return info; | return info; | |||
} | } | |||
template <class chol_type, class chol_elt, class p_type> | template <class chol_type, class chol_elt, class p_type> | |||
chol_type | chol_type | |||
sparse_base_chol<chol_type, chol_elt, p_type>::L (void) const | sparse_base_chol<chol_type, chol_elt, p_type>::L (void) const | |||
{ | { | |||
#ifdef HAVE_CHOLMOD | #ifdef HAVE_CHOLMOD | |||
cholmod_sparse *m = rep->L(); | cholmod_sparse *m = rep->L (); | |||
octave_idx_type nc = m->ncol; | octave_idx_type nc = m->ncol; | |||
octave_idx_type nnz = m->nzmax; | octave_idx_type nnz = m->nzmax; | |||
chol_type ret (m->nrow, nc, nnz); | chol_type ret (m->nrow, nc, nnz); | |||
for (octave_idx_type j = 0; j < nc+1; j++) | for (octave_idx_type j = 0; j < nc+1; j++) | |||
ret.xcidx(j) = static_cast<octave_idx_type *>(m->p)[j]; | ret.xcidx (j) = static_cast<octave_idx_type *>(m->p)[j]; | |||
for (octave_idx_type i = 0; i < nnz; i++) | for (octave_idx_type i = 0; i < nnz; i++) | |||
{ | { | |||
ret.xridx(i) = static_cast<octave_idx_type *>(m->i)[i]; | ret.xridx (i) = static_cast<octave_idx_type *>(m->i)[i]; | |||
ret.xdata(i) = static_cast<chol_elt *>(m->x)[i]; | ret.xdata (i) = static_cast<chol_elt *>(m->x)[i]; | |||
} | } | |||
return ret; | return ret; | |||
#else | #else | |||
return chol_type(); | return chol_type (); | |||
#endif | #endif | |||
} | } | |||
template <class chol_type, class chol_elt, class p_type> | template <class chol_type, class chol_elt, class p_type> | |||
p_type | p_type | |||
sparse_base_chol<chol_type, chol_elt, p_type>:: | sparse_base_chol<chol_type, chol_elt, p_type>:: | |||
sparse_base_chol_rep::Q (void) const | sparse_base_chol_rep::Q (void) const | |||
{ | { | |||
#ifdef HAVE_CHOLMOD | #ifdef HAVE_CHOLMOD | |||
octave_idx_type n = Lsparse->nrow; | octave_idx_type n = Lsparse->nrow; | |||
p_type p (n, n, n); | p_type p (n, n, n); | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
{ | { | |||
p.xcidx(i) = i; | p.xcidx (i) = i; | |||
p.xridx(i) = static_cast<octave_idx_type>(perms(i)); | p.xridx (i) = static_cast<octave_idx_type>(perms (i)); | |||
p.xdata(i) = 1; | p.xdata (i) = 1; | |||
} | } | |||
p.xcidx(n) = n; | p.xcidx (n) = n; | |||
return p; | return p; | |||
#else | #else | |||
return p_type(); | return p_type (); | |||
#endif | #endif | |||
} | } | |||
template <class chol_type, class chol_elt, class p_type> | template <class chol_type, class chol_elt, class p_type> | |||
chol_type | chol_type | |||
sparse_base_chol<chol_type, chol_elt, p_type>::inverse (void) const | sparse_base_chol<chol_type, chol_elt, p_type>::inverse (void) const | |||
{ | { | |||
chol_type retval; | chol_type retval; | |||
#ifdef HAVE_CHOLMOD | #ifdef HAVE_CHOLMOD | |||
cholmod_sparse *m = rep->L(); | cholmod_sparse *m = rep->L (); | |||
octave_idx_type n = m->ncol; | octave_idx_type n = m->ncol; | |||
ColumnVector perms = rep->perm(); | ColumnVector perms = rep->perm (); | |||
chol_type ret; | chol_type ret; | |||
double rcond2; | double rcond2; | |||
octave_idx_type info; | octave_idx_type info; | |||
MatrixType mattype (MatrixType::Upper); | MatrixType mattype (MatrixType::Upper); | |||
chol_type linv = L().hermitian().inverse(mattype, info, rcond2, 1, 0); | chol_type linv = L ().hermitian ().inverse (mattype, info, rcond2, 1, 0); | |||
if (perms.length() == n) | if (perms.length () == n) | |||
{ | { | |||
p_type Qc = Q(); | p_type Qc = Q (); | |||
retval = Qc * linv * linv.hermitian() * Qc.transpose(); | retval = Qc * linv * linv.hermitian () * Qc.transpose (); | |||
} | } | |||
else | else | |||
retval = linv * linv.hermitian (); | retval = linv * linv.hermitian (); | |||
#endif | #endif | |||
return retval; | return retval; | |||
} | } | |||
End of changes. 24 change blocks. | ||||
32 lines changed or deleted | 33 lines changed or added | |||
sparse-base-chol.h | sparse-base-chol.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2005-2012 David Bateman | Copyright (C) 2005-2013 David Bateman | |||
Copyright (C) 1998-2005 Andy Adler | Copyright (C) 1998-2005 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 42 | skipping to change at line 42 | |||
sparse_base_chol | sparse_base_chol | |||
{ | { | |||
protected: | protected: | |||
#ifdef HAVE_CHOLMOD | #ifdef HAVE_CHOLMOD | |||
class sparse_base_chol_rep | class sparse_base_chol_rep | |||
{ | { | |||
public: | public: | |||
sparse_base_chol_rep (void) | sparse_base_chol_rep (void) | |||
: count (1), Lsparse (0), Common (), is_pd (false), minor_p (0), | : count (1), Lsparse (0), Common (), is_pd (false), minor_p (0), | |||
perms (), cond (0) | perms (), cond (0) | |||
{ } | { } | |||
sparse_base_chol_rep (const chol_type& a, const bool natural) | sparse_base_chol_rep (const chol_type& a, bool natural, bool force) | |||
: count (1), Lsparse (0), Common (), is_pd (false), minor_p (0), | : count (1), Lsparse (0), Common (), is_pd (false), minor_p (0), | |||
perms (), cond (0) | perms (), cond (0) | |||
{ | { | |||
init (a, natural); | init (a, natural, force); | |||
} | } | |||
sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, | sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, | |||
const bool natural) | bool natural, bool force) | |||
: count (1), Lsparse (0), Common (), is_pd (false), minor_p (0), | : count (1), Lsparse (0), Common (), is_pd (false), minor_p (0), | |||
perms (), cond (0) | perms (), cond (0) | |||
{ | { | |||
info = init (a, natural); | info = init (a, natural, force); | |||
} | } | |||
~sparse_base_chol_rep (void) | ~sparse_base_chol_rep (void) | |||
{ | { | |||
if (is_pd) | if (is_pd) | |||
CHOLMOD_NAME (free_sparse) (&Lsparse, &Common); | CHOLMOD_NAME (free_sparse) (&Lsparse, &Common); | |||
} | } | |||
cholmod_sparse * L (void) const { return Lsparse; } | cholmod_sparse * L (void) const { return Lsparse; } | |||
octave_idx_type P (void) const | octave_idx_type P (void) const | |||
{ | { | |||
return (minor_p == static_cast<octave_idx_type>(Lsparse->ncol) ? | return (minor_p == static_cast<octave_idx_type>(Lsparse->ncol) ? | |||
0 : minor_p + 1); | 0 : minor_p + 1); | |||
} | } | |||
ColumnVector perm (void) const { return perms + 1; } | ColumnVector perm (void) const { return perms + 1; } | |||
p_type Q (void) const; | p_type Q (void) const; | |||
bool is_positive_definite (void) const { return is_pd; } | bool is_positive_definite (void) const { return is_pd; } | |||
double rcond (void) const { return cond; } | double rcond (void) const { return cond; } | |||
octave_refcount<int> count; | octave_refcount<int> count; | |||
skipping to change at line 96 | skipping to change at line 96 | |||
cholmod_common Common; | cholmod_common Common; | |||
bool is_pd; | bool is_pd; | |||
octave_idx_type minor_p; | octave_idx_type minor_p; | |||
ColumnVector perms; | ColumnVector perms; | |||
double cond; | double cond; | |||
octave_idx_type init (const chol_type& a, bool natural = true); | octave_idx_type init (const chol_type& a, bool natural, bool force); | |||
void drop_zeros (const cholmod_sparse* S); | void drop_zeros (const cholmod_sparse* S); | |||
// No copying! | // No copying! | |||
sparse_base_chol_rep (const sparse_base_chol_rep&); | sparse_base_chol_rep (const sparse_base_chol_rep&); | |||
sparse_base_chol_rep& operator = (const sparse_base_chol_rep&); | sparse_base_chol_rep& operator = (const sparse_base_chol_rep&); | |||
}; | }; | |||
#else | #else | |||
class sparse_base_chol_rep | class sparse_base_chol_rep | |||
{ | { | |||
public: | public: | |||
sparse_base_chol_rep (void) | sparse_base_chol_rep (void) | |||
: count (1), is_pd (false), minor_p (0), perms (), cond (0) { } | : count (1), is_pd (false), minor_p (0), perms (), cond (0) { } | |||
sparse_base_chol_rep (const chol_type& a, | sparse_base_chol_rep (const chol_type& a, bool natural, bool force) | |||
const bool natural) | ||||
: count (1), is_pd (false), minor_p (0), perms (), cond (0) | : count (1), is_pd (false), minor_p (0), perms (), cond (0) | |||
{ init (a, natural); } | { | |||
init (a, natural, force); | ||||
} | ||||
sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, | sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, | |||
const bool natural) | bool natural, bool force) | |||
: count (1), is_pd (false), minor_p (0), perms (), cond (0) | : count (1), is_pd (false), minor_p (0), perms (), cond (0) | |||
{ info = init (a, natural); } | { | |||
info = init (a, natural, force); | ||||
} | ||||
~sparse_base_chol_rep (void) { } | ~sparse_base_chol_rep (void) { } | |||
octave_idx_type P (void) const { return 0; } | octave_idx_type P (void) const { return 0; } | |||
ColumnVector perm (void) const { return perms + 1; } | ColumnVector perm (void) const { return perms + 1; } | |||
p_type Q (void) const; | p_type Q (void) const; | |||
bool is_positive_definite (void) const { return is_pd; } | bool is_positive_definite (void) const { return is_pd; } | |||
skipping to change at line 146 | skipping to change at line 149 | |||
private: | private: | |||
bool is_pd; | bool is_pd; | |||
octave_idx_type minor_p; | octave_idx_type minor_p; | |||
ColumnVector perms; | ColumnVector perms; | |||
double cond; | double cond; | |||
octave_idx_type init (const chol_type& a, bool natural = true); | octave_idx_type init (const chol_type& a, bool natural, bool force); | |||
// No copying! | // No copying! | |||
sparse_base_chol_rep (const sparse_base_chol_rep&); | sparse_base_chol_rep (const sparse_base_chol_rep&); | |||
sparse_base_chol_rep& operator = (const sparse_base_chol_rep&); | sparse_base_chol_rep& operator = (const sparse_base_chol_rep&); | |||
}; | }; | |||
#endif | #endif | |||
private: | private: | |||
sparse_base_chol_rep *rep; | sparse_base_chol_rep *rep; | |||
public: | public: | |||
sparse_base_chol (void) | sparse_base_chol (void) | |||
: rep (new typename | : rep (new typename | |||
sparse_base_chol<chol_type, chol_elt, p_type>::sparse_base_chol_ | sparse_base_chol<chol_type, chol_elt, p_type> | |||
rep ()) | ::sparse_base_chol_rep ()) | |||
{ } | { } | |||
sparse_base_chol (const chol_type& a, const bool n) | sparse_base_chol (const chol_type& a, bool natural, bool force) | |||
: rep (new typename | : rep (new typename | |||
sparse_base_chol<chol_type, chol_elt, p_type>::sparse_base_chol_ | sparse_base_chol<chol_type, chol_elt, p_type> | |||
rep (a, n)) | ::sparse_base_chol_rep (a, natural, force)) | |||
{ } | { } | |||
sparse_base_chol (const chol_type& a, octave_idx_type& info, const bool n | sparse_base_chol (const chol_type& a, octave_idx_type& info, | |||
) | bool natural, bool force) | |||
: rep (new typename sparse_base_chol<chol_type, chol_elt, p_type>::spar | : rep (new typename | |||
se_base_chol_rep (a, info, n)) | sparse_base_chol<chol_type, chol_elt, p_type> | |||
{ } | ::sparse_base_chol_rep (a, info, natural, force)) | |||
{ } | ||||
sparse_base_chol (const sparse_base_chol<chol_type, chol_elt, p_type>& a) | sparse_base_chol (const sparse_base_chol<chol_type, chol_elt, p_type>& a) | |||
: rep (a.rep) | : rep (a.rep) | |||
{ rep->count++; } | { rep->count++; } | |||
virtual ~sparse_base_chol (void) | virtual ~sparse_base_chol (void) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
} | } | |||
sparse_base_chol& operator = (const sparse_base_chol& a) | sparse_base_chol& operator = (const sparse_base_chol& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
rep = a.rep; | ||||
rep->count++; | ||||
} | ||||
return *this; | rep = a.rep; | |||
} | rep->count++; | |||
} | ||||
return *this; | ||||
} | ||||
chol_type L (void) const; | chol_type L (void) const; | |||
chol_type R (void) const { return L().hermitian (); } | chol_type R (void) const { return L ().hermitian (); } | |||
octave_idx_type P (void) const { return rep->P(); } | octave_idx_type P (void) const { return rep->P (); } | |||
ColumnVector perm (void) const { return rep->perm(); } | ColumnVector perm (void) const { return rep->perm (); } | |||
p_type Q (void) const { return rep->Q(); } | p_type Q (void) const { return rep->Q (); } | |||
bool is_positive_definite (void) const | bool is_positive_definite (void) const | |||
{ return rep->is_positive_definite(); } | { return rep->is_positive_definite (); } | |||
double rcond (void) const { return rep->rcond(); } | double rcond (void) const { return rep->rcond (); } | |||
chol_type inverse (void) const; | chol_type inverse (void) const; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 29 change blocks. | ||||
60 lines changed or deleted | 64 lines changed or added | |||
sparse-base-lu.cc | sparse-base-lu.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 38 | skipping to change at line 38 | |||
#include "sparse-base-lu.h" | #include "sparse-base-lu.h" | |||
template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> | template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> | |||
lu_type | lu_type | |||
sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Y (void) const | sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Y (void) const | |||
{ | { | |||
octave_idx_type nr = Lfact.rows (); | octave_idx_type nr = Lfact.rows (); | |||
octave_idx_type nc = Ufact.rows (); | octave_idx_type nc = Ufact.rows (); | |||
octave_idx_type rcmin = (nr > nc ? nr : nc); | octave_idx_type rcmin = (nr > nc ? nr : nc); | |||
lu_type Yout (nr, nc, Lfact.nnz() + Ufact.nnz()); | lu_type Yout (nr, nc, Lfact.nnz () + Ufact.nnz ()); | |||
octave_idx_type ii = 0; | octave_idx_type ii = 0; | |||
Yout.xcidx(0) = 0; | Yout.xcidx (0) = 0; | |||
for (octave_idx_type j = 0; j < nc; j++) | for (octave_idx_type j = 0; j < nc; j++) | |||
{ | { | |||
for (octave_idx_type i = Ufact.cidx (j); i < Ufact.cidx(j + 1); i++) | for (octave_idx_type i = Ufact.cidx (j); i < Ufact.cidx (j + 1); i++) | |||
{ | { | |||
Yout.xridx (ii) = Ufact.ridx(i); | Yout.xridx (ii) = Ufact.ridx (i); | |||
Yout.xdata (ii++) = Ufact.data(i); | Yout.xdata (ii++) = Ufact.data (i); | |||
} | } | |||
if (j < rcmin) | if (j < rcmin) | |||
{ | { | |||
// Note the +1 skips the 1.0 on the diagonal | // Note the +1 skips the 1.0 on the diagonal | |||
for (octave_idx_type i = Lfact.cidx (j) + 1; | for (octave_idx_type i = Lfact.cidx (j) + 1; | |||
i < Lfact.cidx(j +1); i++) | i < Lfact.cidx (j +1); i++) | |||
{ | { | |||
Yout.xridx (ii) = Lfact.ridx(i); | Yout.xridx (ii) = Lfact.ridx (i); | |||
Yout.xdata (ii++) = Lfact.data(i); | Yout.xdata (ii++) = Lfact.data (i); | |||
} | } | |||
} | } | |||
Yout.xcidx(j + 1) = ii; | Yout.xcidx (j + 1) = ii; | |||
} | } | |||
return Yout; | return Yout; | |||
} | } | |||
template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> | template <class lu_type, class lu_elt_type, class p_type, class p_elt_type> | |||
p_type | p_type | |||
sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Pr (void) cons t | sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Pr (void) cons t | |||
{ | { | |||
End of changes. 8 change blocks. | ||||
10 lines changed or deleted | 10 lines changed or added | |||
sparse-base-lu.h | sparse-base-lu.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 41 | skipping to change at line 41 | |||
class | class | |||
sparse_base_lu | sparse_base_lu | |||
{ | { | |||
public: | public: | |||
sparse_base_lu (void) | sparse_base_lu (void) | |||
: Lfact (), Ufact (), Rfact (), cond (0), P (), Q () { } | : Lfact (), Ufact (), Rfact (), cond (0), P (), Q () { } | |||
sparse_base_lu (const sparse_base_lu& a) | sparse_base_lu (const sparse_base_lu& a) | |||
: Lfact (a.Lfact), Ufact (a.Ufact), Rfact (), cond (a.cond), | : Lfact (a.Lfact), Ufact (a.Ufact), Rfact (), cond (a.cond), | |||
P (a.P), Q (a.Q) | P (a.P), Q (a.Q) | |||
{ } | { } | |||
sparse_base_lu& operator = (const sparse_base_lu& a) | sparse_base_lu& operator = (const sparse_base_lu& a) | |||
{ | { | |||
if (this != &a) | if (this != &a) | |||
{ | { | |||
Lfact = a.Lfact; | Lfact = a.Lfact; | |||
Ufact = a.Ufact; | Ufact = a.Ufact; | |||
cond = a.cond; | cond = a.cond; | |||
P = a.P; | P = a.P; | |||
Q = a.Q; | Q = a.Q; | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
virtual ~sparse_base_lu (void) { } | virtual ~sparse_base_lu (void) { } | |||
lu_type L (void) const { return Lfact; } | lu_type L (void) const { return Lfact; } | |||
lu_type U (void) const { return Ufact; } | lu_type U (void) const { return Ufact; } | |||
SparseMatrix R (void) const { return Rfact; } | SparseMatrix R (void) const { return Rfact; } | |||
lu_type Y (void) const; | lu_type Y (void) const; | |||
End of changes. 3 change blocks. | ||||
14 lines changed or deleted | 14 lines changed or added | |||
sparse-dmsolve.cc | sparse-dmsolve.cc | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2006-2012 David Bateman | Copyright (C) 2006-2013 David Bateman | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 41 | skipping to change at line 41 | |||
#include "SparseQR.h" | #include "SparseQR.h" | |||
#include "SparseCmplxQR.h" | #include "SparseCmplxQR.h" | |||
#include "MatrixType.h" | #include "MatrixType.h" | |||
#include "oct-sort.h" | #include "oct-sort.h" | |||
#include "oct-locbuf.h" | #include "oct-locbuf.h" | |||
#include "oct-inttypes.h" | #include "oct-inttypes.h" | |||
template <class T> | template <class T> | |||
static MSparse<T> | static MSparse<T> | |||
dmsolve_extract (const MSparse<T> &A, const octave_idx_type *Pinv, | dmsolve_extract (const MSparse<T> &A, const octave_idx_type *Pinv, | |||
const octave_idx_type *Q, octave_idx_type rst, | const octave_idx_type *Q, octave_idx_type rst, | |||
octave_idx_type rend, octave_idx_type cst, | octave_idx_type rend, octave_idx_type cst, | |||
octave_idx_type cend, octave_idx_type maxnz = -1, | octave_idx_type cend, octave_idx_type maxnz = -1, | |||
bool lazy = false) | bool lazy = false) | |||
{ | { | |||
octave_idx_type nr = rend - rst, nc = cend - cst; | octave_idx_type nr = rend - rst, nc = cend - cst; | |||
maxnz = (maxnz < 0 ? A.nnz () : maxnz); | maxnz = (maxnz < 0 ? A.nnz () : maxnz); | |||
octave_idx_type nz; | octave_idx_type nz; | |||
// Cast to uint64 to handle overflow in this multiplication | // Cast to uint64 to handle overflow in this multiplication | |||
if (octave_uint64 (nr)*octave_uint64 (nc) < octave_uint64 (maxnz)) | if (octave_uint64 (nr)*octave_uint64 (nc) < octave_uint64 (maxnz)) | |||
nz = nr*nc; | nz = nr*nc; | |||
else | else | |||
nz = maxnz; | nz = maxnz; | |||
skipping to change at line 66 | skipping to change at line 66 | |||
MSparse<T> B (nr, nc, (nz < maxnz ? nz : maxnz)); | MSparse<T> B (nr, nc, (nz < maxnz ? nz : maxnz)); | |||
// Some sparse functions can support lazy indexing (where elements | // Some sparse functions can support lazy indexing (where elements | |||
// in the row are in no particular order), even though octave in | // in the row are in no particular order), even though octave in | |||
// general can't. For those functions that can using it is a big | // general can't. For those functions that can using it is a big | |||
// win here in terms of speed. | // win here in terms of speed. | |||
if (lazy) | if (lazy) | |||
{ | { | |||
nz = 0; | nz = 0; | |||
for (octave_idx_type j = cst ; j < cend ; j++) | for (octave_idx_type j = cst ; j < cend ; j++) | |||
{ | { | |||
octave_idx_type qq = (Q ? Q [j] : j); | octave_idx_type qq = (Q ? Q[j] : j); | |||
B.xcidx (j - cst) = nz; | B.xcidx (j - cst) = nz; | |||
for (octave_idx_type p = A.cidx(qq) ; p < A.cidx (qq+1) ; p++) | for (octave_idx_type p = A.cidx (qq) ; p < A.cidx (qq+1) ; p++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
octave_idx_type r = (Pinv ? Pinv [A.ridx (p)] : A.ridx (p)); | octave_idx_type r = (Pinv ? Pinv[A.ridx (p)] : A.ridx (p)); | |||
if (r >= rst && r < rend) | if (r >= rst && r < rend) | |||
{ | { | |||
B.xdata (nz) = A.data (p); | B.xdata (nz) = A.data (p); | |||
B.xridx (nz++) = r - rst ; | B.xridx (nz++) = r - rst ; | |||
} | } | |||
} | } | |||
} | } | |||
B.xcidx (cend - cst) = nz ; | B.xcidx (cend - cst) = nz ; | |||
} | } | |||
else | else | |||
{ | { | |||
OCTAVE_LOCAL_BUFFER (T, X, rend - rst); | OCTAVE_LOCAL_BUFFER (T, X, rend - rst); | |||
octave_sort<octave_idx_type> sort; | octave_sort<octave_idx_type> sort; | |||
octave_idx_type *ri = B.xridx(); | octave_idx_type *ri = B.xridx (); | |||
nz = 0; | nz = 0; | |||
for (octave_idx_type j = cst ; j < cend ; j++) | for (octave_idx_type j = cst ; j < cend ; j++) | |||
{ | { | |||
octave_idx_type qq = (Q ? Q [j] : j); | octave_idx_type qq = (Q ? Q[j] : j); | |||
B.xcidx (j - cst) = nz; | B.xcidx (j - cst) = nz; | |||
for (octave_idx_type p = A.cidx(qq) ; p < A.cidx (qq+1) ; p++) | for (octave_idx_type p = A.cidx (qq) ; p < A.cidx (qq+1) ; p++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
octave_idx_type r = (Pinv ? Pinv [A.ridx (p)] : A.ridx (p)); | octave_idx_type r = (Pinv ? Pinv[A.ridx (p)] : A.ridx (p)); | |||
if (r >= rst && r < rend) | if (r >= rst && r < rend) | |||
{ | { | |||
X [r-rst] = A.data (p); | X[r-rst] = A.data (p); | |||
B.xridx (nz++) = r - rst ; | B.xridx (nz++) = r - rst ; | |||
} | } | |||
} | } | |||
sort.sort (ri + B.xcidx (j - cst), nz - B.xcidx (j - cst)); | sort.sort (ri + B.xcidx (j - cst), nz - B.xcidx (j - cst)); | |||
for (octave_idx_type p = B.cidx (j - cst); p < nz; p++) | for (octave_idx_type p = B.cidx (j - cst); p < nz; p++) | |||
B.xdata (p) = X [B.xridx (p)]; | B.xdata (p) = X[B.xridx (p)]; | |||
} | } | |||
B.xcidx (cend - cst) = nz ; | B.xcidx (cend - cst) = nz ; | |||
} | } | |||
return B; | return B; | |||
} | } | |||
#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | |||
static MSparse<double> | static MSparse<double> | |||
dmsolve_extract (const MSparse<double> &A, const octave_idx_type *Pinv, | dmsolve_extract (const MSparse<double> &A, const octave_idx_type *Pinv, | |||
const octave_idx_type *Q, octave_idx_type rst, | const octave_idx_type *Q, octave_idx_type rst, | |||
octave_idx_type rend, octave_idx_type cst, | octave_idx_type rend, octave_idx_type cst, | |||
octave_idx_type cend, octave_idx_type maxnz, | octave_idx_type cend, octave_idx_type maxnz, | |||
bool lazy); | bool lazy); | |||
static MSparse<Complex> | static MSparse<Complex> | |||
dmsolve_extract (const MSparse<Complex> &A, const octave_idx_type *Pinv, | dmsolve_extract (const MSparse<Complex> &A, const octave_idx_type *Pinv, | |||
const octave_idx_type *Q, octave_idx_type rst, | const octave_idx_type *Q, octave_idx_type rst, | |||
octave_idx_type rend, octave_idx_type cst, | octave_idx_type rend, octave_idx_type cst, | |||
octave_idx_type cend, octave_idx_type maxnz, | octave_idx_type cend, octave_idx_type maxnz, | |||
bool lazy); | bool lazy); | |||
#endif | #endif | |||
template <class T> | template <class T> | |||
static MArray<T> | static MArray<T> | |||
dmsolve_extract (const MArray<T> &m, const octave_idx_type *, | dmsolve_extract (const MArray<T> &m, const octave_idx_type *, | |||
const octave_idx_type *, octave_idx_type r1, | const octave_idx_type *, octave_idx_type r1, | |||
octave_idx_type r2, octave_idx_type c1, | octave_idx_type r2, octave_idx_type c1, | |||
octave_idx_type c2) | octave_idx_type c2) | |||
{ | { | |||
r2 -= 1; | r2 -= 1; | |||
c2 -= 1; | c2 -= 1; | |||
if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } | if (r1 > r2) { std::swap (r1, r2); } | |||
if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } | if (c1 > c2) { std::swap (c1, c2); } | |||
octave_idx_type new_r = r2 - r1 + 1; | octave_idx_type new_r = r2 - r1 + 1; | |||
octave_idx_type new_c = c2 - c1 + 1; | octave_idx_type new_c = c2 - c1 + 1; | |||
MArray<T> result (dim_vector (new_r, new_c)); | MArray<T> result (dim_vector (new_r, new_c)); | |||
for (octave_idx_type j = 0; j < new_c; j++) | for (octave_idx_type j = 0; j < new_c; j++) | |||
for (octave_idx_type i = 0; i < new_r; i++) | for (octave_idx_type i = 0; i < new_r; i++) | |||
result.xelem (i, j) = m.elem (r1+i, c1+j); | result.xelem (i, j) = m.elem (r1+i, c1+j); | |||
skipping to change at line 168 | skipping to change at line 168 | |||
static MArray<Complex> | static MArray<Complex> | |||
dmsolve_extract (const MArray<Complex> &m, const octave_idx_type *, | dmsolve_extract (const MArray<Complex> &m, const octave_idx_type *, | |||
const octave_idx_type *, octave_idx_type r1, | const octave_idx_type *, octave_idx_type r1, | |||
octave_idx_type r2, octave_idx_type c1, | octave_idx_type r2, octave_idx_type c1, | |||
octave_idx_type c2) | octave_idx_type c2) | |||
#endif | #endif | |||
template <class T> | template <class T> | |||
static void | static void | |||
dmsolve_insert (MArray<T> &a, const MArray<T> &b, const octave_idx_type *Q, | dmsolve_insert (MArray<T> &a, const MArray<T> &b, const octave_idx_type *Q, | |||
octave_idx_type r, octave_idx_type c) | octave_idx_type r, octave_idx_type c) | |||
{ | { | |||
T *ax = a.fortran_vec(); | T *ax = a.fortran_vec (); | |||
const T *bx = b.fortran_vec(); | const T *bx = b.fortran_vec (); | |||
octave_idx_type anr = a.rows(); | octave_idx_type anr = a.rows (); | |||
octave_idx_type nr = b.rows(); | octave_idx_type nr = b.rows (); | |||
octave_idx_type nc = b.cols(); | octave_idx_type nc = b.cols (); | |||
for (octave_idx_type j = 0; j < nc; j++) | for (octave_idx_type j = 0; j < nc; j++) | |||
{ | { | |||
octave_idx_type aoff = (c + j) * anr; | octave_idx_type aoff = (c + j) * anr; | |||
octave_idx_type boff = j * nr; | octave_idx_type boff = j * nr; | |||
for (octave_idx_type i = 0; i < nr; i++) | for (octave_idx_type i = 0; i < nr; i++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
ax [Q [r + i] + aoff] = bx [i + boff]; | ax[Q[r + i] + aoff] = bx[i + boff]; | |||
} | } | |||
} | } | |||
} | } | |||
#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | |||
static void | static void | |||
dmsolve_insert (MArray<double> &a, const MArray<double> &b, | dmsolve_insert (MArray<double> &a, const MArray<double> &b, | |||
const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); | const octave_idx_type *Q, octave_idx_type r, octave_idx_typ e c); | |||
static void | static void | |||
dmsolve_insert (MArray<Complex> &a, const MArray<Complex> &b, | dmsolve_insert (MArray<Complex> &a, const MArray<Complex> &b, | |||
const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); | const octave_idx_type *Q, octave_idx_type r, octave_idx_typ e c); | |||
#endif | #endif | |||
template <class T> | template <class T> | |||
static void | static void | |||
dmsolve_insert (MSparse<T> &a, const MSparse<T> &b, const octave_idx_type * Q, | dmsolve_insert (MSparse<T> &a, const MSparse<T> &b, const octave_idx_type * Q, | |||
octave_idx_type r, octave_idx_type c) | octave_idx_type r, octave_idx_type c) | |||
{ | { | |||
octave_idx_type b_rows = b.rows (); | octave_idx_type b_rows = b.rows (); | |||
octave_idx_type b_cols = b.cols (); | octave_idx_type b_cols = b.cols (); | |||
octave_idx_type nr = a.rows (); | octave_idx_type nr = a.rows (); | |||
octave_idx_type nc = a.cols (); | octave_idx_type nc = a.cols (); | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, Qinv, nr); | OCTAVE_LOCAL_BUFFER (octave_idx_type, Qinv, nr); | |||
for (octave_idx_type i = 0; i < nr; i++) | for (octave_idx_type i = 0; i < nr; i++) | |||
Qinv [Q [i]] = i; | Qinv[Q[i]] = i; | |||
// First count the number of elements in the final array | // First count the number of elements in the final array | |||
octave_idx_type nel = a.xcidx(c) + b.nnz (); | octave_idx_type nel = a.xcidx (c) + b.nnz (); | |||
if (c + b_cols < nc) | if (c + b_cols < nc) | |||
nel += a.xcidx(nc) - a.xcidx(c + b_cols); | nel += a.xcidx (nc) - a.xcidx (c + b_cols); | |||
for (octave_idx_type i = c; i < c + b_cols; i++) | for (octave_idx_type i = c; i < c + b_cols; i++) | |||
for (octave_idx_type j = a.xcidx(i); j < a.xcidx(i+1); j++) | for (octave_idx_type j = a.xcidx (i); j < a.xcidx (i+1); j++) | |||
if (Qinv [a.xridx(j)] < r || Qinv [a.xridx(j)] >= r + b_rows) | if (Qinv[a.xridx (j)] < r || Qinv[a.xridx (j)] >= r + b_rows) | |||
nel++; | nel++; | |||
OCTAVE_LOCAL_BUFFER (T, X, nr); | OCTAVE_LOCAL_BUFFER (T, X, nr); | |||
octave_sort<octave_idx_type> sort; | octave_sort<octave_idx_type> sort; | |||
MSparse<T> tmp (a); | MSparse<T> tmp (a); | |||
a = MSparse<T> (nr, nc, nel); | a = MSparse<T> (nr, nc, nel); | |||
octave_idx_type *ri = a.xridx(); | octave_idx_type *ri = a.xridx (); | |||
for (octave_idx_type i = 0; i < tmp.cidx(c); i++) | for (octave_idx_type i = 0; i < tmp.cidx (c); i++) | |||
{ | { | |||
a.xdata(i) = tmp.xdata(i); | a.xdata (i) = tmp.xdata (i); | |||
a.xridx(i) = tmp.xridx(i); | a.xridx (i) = tmp.xridx (i); | |||
} | } | |||
for (octave_idx_type i = 0; i < c + 1; i++) | for (octave_idx_type i = 0; i < c + 1; i++) | |||
a.xcidx(i) = tmp.xcidx(i); | a.xcidx (i) = tmp.xcidx (i); | |||
octave_idx_type ii = a.xcidx(c); | octave_idx_type ii = a.xcidx (c); | |||
for (octave_idx_type i = c; i < c + b_cols; i++) | for (octave_idx_type i = c; i < c + b_cols; i++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
for (octave_idx_type j = tmp.xcidx(i); j < tmp.xcidx(i+1); j++) | for (octave_idx_type j = tmp.xcidx (i); j < tmp.xcidx (i+1); j++) | |||
if (Qinv [tmp.xridx(j)] < r || Qinv [tmp.xridx(j)] >= r + b_rows) | if (Qinv[tmp.xridx (j)] < r || Qinv[tmp.xridx (j)] >= r + b_rows) | |||
{ | { | |||
X [tmp.xridx(j)] = tmp.xdata(j); | X[tmp.xridx (j)] = tmp.xdata (j); | |||
a.xridx(ii++) = tmp.xridx(j); | a.xridx (ii++) = tmp.xridx (j); | |||
} | } | |||
octave_quit (); | octave_quit (); | |||
for (octave_idx_type j = b.cidx(i-c); j < b.cidx(i-c+1); j++) | for (octave_idx_type j = b.cidx (i-c); j < b.cidx (i-c+1); j++) | |||
{ | { | |||
X [Q [r + b.ridx(j)]] = b.data(j); | X[Q[r + b.ridx (j)]] = b.data (j); | |||
a.xridx(ii++) = Q [r + b.ridx(j)]; | a.xridx (ii++) = Q[r + b.ridx (j)]; | |||
} | } | |||
sort.sort (ri + a.xcidx (i), ii - a.xcidx (i)); | sort.sort (ri + a.xcidx (i), ii - a.xcidx (i)); | |||
for (octave_idx_type p = a.xcidx (i); p < ii; p++) | for (octave_idx_type p = a.xcidx (i); p < ii; p++) | |||
a.xdata (p) = X [a.xridx (p)]; | a.xdata (p) = X[a.xridx (p)]; | |||
a.xcidx(i+1) = ii; | a.xcidx (i+1) = ii; | |||
} | } | |||
for (octave_idx_type i = c + b_cols; i < nc; i++) | for (octave_idx_type i = c + b_cols; i < nc; i++) | |||
{ | { | |||
for (octave_idx_type j = tmp.xcidx(i); j < tmp.cidx(i+1); j++) | for (octave_idx_type j = tmp.xcidx (i); j < tmp.cidx (i+1); j++) | |||
{ | { | |||
a.xdata(ii) = tmp.xdata(j); | a.xdata (ii) = tmp.xdata (j); | |||
a.xridx(ii++) = tmp.xridx(j); | a.xridx (ii++) = tmp.xridx (j); | |||
} | } | |||
a.xcidx(i+1) = ii; | a.xcidx (i+1) = ii; | |||
} | } | |||
} | } | |||
#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | |||
static void | static void | |||
dmsolve_insert (MSparse<double> &a, const SparseMatrix &b, | dmsolve_insert (MSparse<double> &a, const SparseMatrix &b, | |||
const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); | const octave_idx_type *Q, octave_idx_type r, octave_idx_typ e c); | |||
static void | static void | |||
dmsolve_insert (MSparse<Complex> &a, const MSparse<Complex> &b, | dmsolve_insert (MSparse<Complex> &a, const MSparse<Complex> &b, | |||
const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); | const octave_idx_type *Q, octave_idx_type r, octave_idx_typ e c); | |||
#endif | #endif | |||
template <class T, class RT> | template <class T, class RT> | |||
static void | static void | |||
dmsolve_permute (MArray<RT> &a, const MArray<T>& b, const octave_idx_type * p) | dmsolve_permute (MArray<RT> &a, const MArray<T>& b, const octave_idx_type * p) | |||
{ | { | |||
octave_idx_type b_nr = b.rows (); | octave_idx_type b_nr = b.rows (); | |||
octave_idx_type b_nc = b.cols (); | octave_idx_type b_nc = b.cols (); | |||
const T *Bx = b.fortran_vec(); | const T *Bx = b.fortran_vec (); | |||
a.resize (dim_vector (b_nr, b_nc)); | a.resize (dim_vector (b_nr, b_nc)); | |||
RT *Btx = a.fortran_vec(); | RT *Btx = a.fortran_vec (); | |||
for (octave_idx_type j = 0; j < b_nc; j++) | for (octave_idx_type j = 0; j < b_nc; j++) | |||
{ | { | |||
octave_idx_type off = j * b_nr; | octave_idx_type off = j * b_nr; | |||
for (octave_idx_type i = 0; i < b_nr; i++) | for (octave_idx_type i = 0; i < b_nr; i++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
Btx [p [i] + off] = Bx [ i + off]; | Btx[p[i] + off] = Bx[ i + off]; | |||
} | } | |||
} | } | |||
} | } | |||
#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | |||
static void | static void | |||
dmsolve_permute (MArray<double> &a, const MArray<double>& b, | dmsolve_permute (MArray<double> &a, const MArray<double>& b, | |||
const octave_idx_type *p); | const octave_idx_type *p); | |||
static void | static void | |||
skipping to change at line 328 | skipping to change at line 328 | |||
template <class T, class RT> | template <class T, class RT> | |||
static void | static void | |||
dmsolve_permute (MSparse<RT> &a, const MSparse<T>& b, const octave_idx_type *p) | dmsolve_permute (MSparse<RT> &a, const MSparse<T>& b, const octave_idx_type *p) | |||
{ | { | |||
octave_idx_type b_nr = b.rows (); | octave_idx_type b_nr = b.rows (); | |||
octave_idx_type b_nc = b.cols (); | octave_idx_type b_nc = b.cols (); | |||
octave_idx_type b_nz = b.nnz (); | octave_idx_type b_nz = b.nnz (); | |||
octave_idx_type nz = 0; | octave_idx_type nz = 0; | |||
a = MSparse<RT> (b_nr, b_nc, b_nz); | a = MSparse<RT> (b_nr, b_nc, b_nz); | |||
octave_sort<octave_idx_type> sort; | octave_sort<octave_idx_type> sort; | |||
octave_idx_type *ri = a.xridx(); | octave_idx_type *ri = a.xridx (); | |||
OCTAVE_LOCAL_BUFFER (RT, X, b_nr); | OCTAVE_LOCAL_BUFFER (RT, X, b_nr); | |||
a.xcidx(0) = 0; | a.xcidx (0) = 0; | |||
for (octave_idx_type j = 0; j < b_nc; j++) | for (octave_idx_type j = 0; j < b_nc; j++) | |||
{ | { | |||
for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) | for (octave_idx_type i = b.cidx (j); i < b.cidx (j+1); i++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
octave_idx_type r = p [b.ridx (i)]; | octave_idx_type r = p[b.ridx (i)]; | |||
X [r] = b.data (i); | X[r] = b.data (i); | |||
a.xridx(nz++) = p [b.ridx (i)]; | a.xridx (nz++) = p[b.ridx (i)]; | |||
} | } | |||
sort.sort (ri + a.xcidx (j), nz - a.xcidx (j)); | sort.sort (ri + a.xcidx (j), nz - a.xcidx (j)); | |||
for (octave_idx_type i = a.cidx (j); i < nz; i++) | for (octave_idx_type i = a.cidx (j); i < nz; i++) | |||
{ | { | |||
octave_quit (); | octave_quit (); | |||
a.xdata (i) = X [a.xridx (i)]; | a.xdata (i) = X[a.xridx (i)]; | |||
} | } | |||
a.xcidx(j+1) = nz; | a.xcidx (j+1) = nz; | |||
} | } | |||
} | } | |||
#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | |||
static void | static void | |||
dmsolve_permute (MSparse<double> &a, const MSparse<double>& b, | dmsolve_permute (MSparse<double> &a, const MSparse<double>& b, | |||
const octave_idx_type *p); | const octave_idx_type *p); | |||
static void | static void | |||
dmsolve_permute (MSparse<Complex> &a, const MSparse<double>& b, | dmsolve_permute (MSparse<Complex> &a, const MSparse<double>& b, | |||
skipping to change at line 401 | skipping to change at line 401 | |||
csm.m = nr; | csm.m = nr; | |||
csm.n = nc; | csm.n = nc; | |||
csm.x = 0; | csm.x = 0; | |||
csm.nz = -1; | csm.nz = -1; | |||
csm.nzmax = a.nnz (); | csm.nzmax = a.nnz (); | |||
// Cast away const on A, with full knowledge that CSparse won't touch it. | // Cast away const on A, with full knowledge that CSparse won't touch it. | |||
// Prevents the methods below making a copy of the data. | // Prevents the methods below making a copy of the data. | |||
csm.p = const_cast<octave_idx_type *>(a.cidx ()); | csm.p = const_cast<octave_idx_type *>(a.cidx ()); | |||
csm.i = const_cast<octave_idx_type *>(a.ridx ()); | csm.i = const_cast<octave_idx_type *>(a.ridx ()); | |||
#if defined(CS_VER) && (CS_VER >= 2) | #if defined (CS_VER) && (CS_VER >= 2) | |||
CXSPARSE_DNAME (d) *dm = CXSPARSE_DNAME(_dmperm) (&csm, 0); | CXSPARSE_DNAME (d) *dm = CXSPARSE_DNAME(_dmperm) (&csm, 0); | |||
octave_idx_type *p = dm->p; | octave_idx_type *p = dm->p; | |||
octave_idx_type *q = dm->q; | octave_idx_type *q = dm->q; | |||
#else | #else | |||
CXSPARSE_DNAME (d) *dm = CXSPARSE_DNAME(_dmperm) (&csm); | CXSPARSE_DNAME (d) *dm = CXSPARSE_DNAME(_dmperm) (&csm); | |||
octave_idx_type *p = dm->P; | octave_idx_type *p = dm->P; | |||
octave_idx_type *q = dm->Q; | octave_idx_type *q = dm->Q; | |||
#endif | #endif | |||
OCTAVE_LOCAL_BUFFER (octave_idx_type, pinv, nr); | OCTAVE_LOCAL_BUFFER (octave_idx_type, pinv, nr); | |||
for (octave_idx_type i = 0; i < nr; i++) | for (octave_idx_type i = 0; i < nr; i++) | |||
pinv [p [i]] = i; | pinv[p[i]] = i; | |||
RT btmp; | RT btmp; | |||
dmsolve_permute (btmp, b, pinv); | dmsolve_permute (btmp, b, pinv); | |||
info = 0; | info = 0; | |||
retval.resize (nc, b_nc); | retval.resize (nc, b_nc); | |||
// Leading over-determined block | // Leading over-determined block | |||
if (dm->rr [2] < nr && dm->cc [3] < nc) | if (dm->rr[2] < nr && dm->cc[3] < nc) | |||
{ | { | |||
ST m = dmsolve_extract (a, pinv, q, dm->rr [2], nr, dm->cc [3], n c, | ST m = dmsolve_extract (a, pinv, q, dm->rr[2], nr, dm->cc[3], nc, | |||
nnz_remaining, true); | nnz_remaining, true); | |||
nnz_remaining -= m.nnz(); | nnz_remaining -= m.nnz (); | |||
RT mtmp = | RT mtmp = | |||
qrsolve (m, dmsolve_extract (btmp, 0, 0, dm->rr[2], b_nr, 0, | qrsolve (m, dmsolve_extract (btmp, 0, 0, dm->rr[2], b_nr, 0, | |||
b_nc), info); | b_nc), info); | |||
dmsolve_insert (retval, mtmp, q, dm->cc [3], 0); | dmsolve_insert (retval, mtmp, q, dm->cc[3], 0); | |||
if (dm->rr [2] > 0 && !info) | if (dm->rr[2] > 0 && !info) | |||
{ | { | |||
m = dmsolve_extract (a, pinv, q, 0, dm->rr [2], | m = dmsolve_extract (a, pinv, q, 0, dm->rr[2], | |||
dm->cc [3], nc, nnz_remaining, true); | dm->cc[3], nc, nnz_remaining, true); | |||
nnz_remaining -= m.nnz(); | nnz_remaining -= m.nnz (); | |||
RT ctmp = dmsolve_extract (btmp, 0, 0, 0, | RT ctmp = dmsolve_extract (btmp, 0, 0, 0, | |||
dm->rr[2], 0, b_nc); | dm->rr[2], 0, b_nc); | |||
btmp.insert (ctmp - m * mtmp, 0, 0); | btmp.insert (ctmp - m * mtmp, 0, 0); | |||
} | } | |||
} | } | |||
// Structurally non-singular blocks | // Structurally non-singular blocks | |||
// FIXME Should use fine Dulmange-Mendelsohn decomposition here. | // FIXME: Should use fine Dulmange-Mendelsohn decomposition here. | |||
if (dm->rr [1] < dm->rr [2] && dm->cc [2] < dm->cc [3] && !info) | if (dm->rr[1] < dm->rr[2] && dm->cc[2] < dm->cc[3] && !info) | |||
{ | { | |||
ST m = dmsolve_extract (a, pinv, q, dm->rr [1], dm->rr [2], | ST m = dmsolve_extract (a, pinv, q, dm->rr[1], dm->rr[2], | |||
dm->cc [2], dm->cc [3], nnz_remaining, fa | dm->cc[2], dm->cc[3], nnz_remaining, fals | |||
lse); | e); | |||
nnz_remaining -= m.nnz(); | nnz_remaining -= m.nnz (); | |||
RT btmp2 = dmsolve_extract (btmp, 0, 0, dm->rr [1], dm->rr [2], | RT btmp2 = dmsolve_extract (btmp, 0, 0, dm->rr[1], dm->rr[2], | |||
0, b_nc); | 0, b_nc); | |||
double rcond = 0.0; | double rcond = 0.0; | |||
MatrixType mtyp (MatrixType::Full); | MatrixType mtyp (MatrixType::Full); | |||
RT mtmp = m.solve (mtyp, btmp2, info, rcond, | RT mtmp = m.solve (mtyp, btmp2, info, rcond, | |||
solve_singularity_warning, false); | solve_singularity_warning, false); | |||
if (info != 0) | if (info != 0) | |||
{ | { | |||
info = 0; | info = 0; | |||
mtmp = qrsolve (m, btmp2, info); | mtmp = qrsolve (m, btmp2, info); | |||
} | } | |||
dmsolve_insert (retval, mtmp, q, dm->cc [2], 0); | dmsolve_insert (retval, mtmp, q, dm->cc[2], 0); | |||
if (dm->rr [1] > 0 && !info) | if (dm->rr[1] > 0 && !info) | |||
{ | { | |||
m = dmsolve_extract (a, pinv, q, 0, dm->rr [1], dm->cc [2], | m = dmsolve_extract (a, pinv, q, 0, dm->rr[1], dm->cc[2], | |||
dm->cc [3], nnz_remaining, true); | dm->cc[3], nnz_remaining, true); | |||
nnz_remaining -= m.nnz(); | nnz_remaining -= m.nnz (); | |||
RT ctmp = dmsolve_extract (btmp, 0, 0, 0, | RT ctmp = dmsolve_extract (btmp, 0, 0, 0, | |||
dm->rr[1], 0, b_nc); | dm->rr[1], 0, b_nc); | |||
btmp.insert (ctmp - m * mtmp, 0, 0); | btmp.insert (ctmp - m * mtmp, 0, 0); | |||
} | } | |||
} | } | |||
// Trailing under-determined block | // Trailing under-determined block | |||
if (dm->rr [1] > 0 && dm->cc [2] > 0 && !info) | if (dm->rr[1] > 0 && dm->cc[2] > 0 && !info) | |||
{ | { | |||
ST m = dmsolve_extract (a, pinv, q, 0, dm->rr [1], 0, | ST m = dmsolve_extract (a, pinv, q, 0, dm->rr[1], 0, | |||
dm->cc [2], nnz_remaining, true); | dm->cc[2], nnz_remaining, true); | |||
RT mtmp = | RT mtmp = | |||
qrsolve (m, dmsolve_extract(btmp, 0, 0, 0, dm->rr [1] , 0, | qrsolve (m, dmsolve_extract (btmp, 0, 0, 0, dm->rr[1] , 0, | |||
b_nc), info); | b_nc), info); | |||
dmsolve_insert (retval, mtmp, q, 0, 0); | dmsolve_insert (retval, mtmp, q, 0, 0); | |||
} | } | |||
CXSPARSE_DNAME (_dfree) (dm); | CXSPARSE_DNAME (_dfree) (dm); | |||
} | } | |||
return retval; | return retval; | |||
#else | #else | |||
(*current_liboctave_error_handler) | ||||
("CXSPARSE unavailable; cannot solve minimum norm problem"); | ||||
return RT (); | return RT (); | |||
#endif | #endif | |||
} | } | |||
#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) | |||
extern Matrix | extern Matrix | |||
dmsolve (const SparseMatrix &a, const Matrix &b, | dmsolve (const SparseMatrix &a, const Matrix &b, | |||
octave_idx_type &info); | octave_idx_type &info); | |||
extern ComplexMatrix | extern ComplexMatrix | |||
End of changes. 64 change blocks. | ||||
100 lines changed or deleted | 102 lines changed or added | |||
sparse-sort.h | sparse-sort.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
sparse-util.h | sparse-util.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2005-2012 David Bateman | Copyright (C) 2005-2013 David Bateman | |||
Copyright (C) 1998-2005 Andy Adler | Copyright (C) 1998-2005 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 27 | skipping to change at line 27 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_sparse_util_h) | #if !defined (octave_sparse_util_h) | |||
#define octave_sparse_util_h 1 | #define octave_sparse_util_h 1 | |||
#ifdef HAVE_CHOLMOD | ||||
// FIXME this overload is here due to API change in SuiteSparse (3.1 -> 3.2 ) | // FIXME this overload is here due to API change in SuiteSparse (3.1 -> 3.2 ) | |||
extern OCTAVE_API void SparseCholError (int status, char *file, | extern OCTAVE_API void SparseCholError (int status, char *file, | |||
int line, char *message); | int line, char *message); | |||
extern OCTAVE_API void SparseCholError (int status, const char *file, | extern OCTAVE_API void SparseCholError (int status, const char *file, | |||
int line, const char *message); | int line, const char *message); | |||
extern OCTAVE_API int SparseCholPrint (const char *fmt, ...); | extern OCTAVE_API int SparseCholPrint (const char *fmt, ...); | |||
#endif //HAVE_CHOLMOD | ||||
extern OCTAVE_API bool | extern OCTAVE_API bool | |||
sparse_indices_ok (octave_idx_type *r, octave_idx_type *c, | sparse_indices_ok (octave_idx_type *r, octave_idx_type *c, | |||
octave_idx_type nrows, octave_idx_type ncols, | octave_idx_type nrows, octave_idx_type ncols, | |||
octave_idx_type nnz); | octave_idx_type nnz); | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
sparse-xdiv.h | sparse-xdiv.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 79 | skipping to change at line 79 | |||
extern ComplexMatrix xleftdiv (const SparseMatrix& a, const ComplexMatrix& b, | extern ComplexMatrix xleftdiv (const SparseMatrix& a, const ComplexMatrix& b, | |||
MatrixType &typ); | MatrixType &typ); | |||
extern ComplexMatrix xleftdiv (const SparseComplexMatrix& a, const Matrix& b, | extern ComplexMatrix xleftdiv (const SparseComplexMatrix& a, const Matrix& b, | |||
MatrixType &typ); | MatrixType &typ); | |||
extern ComplexMatrix xleftdiv (const SparseComplexMatrix& a, | extern ComplexMatrix xleftdiv (const SparseComplexMatrix& a, | |||
const ComplexMatrix& b, MatrixType &typ); | const ComplexMatrix& b, MatrixType &typ); | |||
extern SparseMatrix xleftdiv (const SparseMatrix& a, const SparseMatrix& b, | extern SparseMatrix xleftdiv (const SparseMatrix& a, const SparseMatrix& b, | |||
MatrixType &typ); | MatrixType &typ); | |||
extern SparseComplexMatrix xleftdiv (const SparseMatrix& a, | extern SparseComplexMatrix xleftdiv (const SparseMatrix& a, | |||
const SparseComplexMatrix& b, MatrixTy | const SparseComplexMatrix& b, | |||
pe &typ); | MatrixType &typ); | |||
extern SparseComplexMatrix xleftdiv (const SparseComplexMatrix& a, | extern SparseComplexMatrix xleftdiv (const SparseComplexMatrix& a, | |||
const SparseMatrix& b, MatrixType &typ ); | const SparseMatrix& b, MatrixType &typ ); | |||
extern SparseComplexMatrix xleftdiv (const SparseComplexMatrix& a, | extern SparseComplexMatrix xleftdiv (const SparseComplexMatrix& a, | |||
const SparseComplexMatrix& b, MatrixTy | const SparseComplexMatrix& b, | |||
pe &typ); | MatrixType &typ); | |||
extern SparseMatrix xleftdiv (const DiagMatrix&, const SparseMatrix&, Matri | extern SparseMatrix xleftdiv (const DiagMatrix&, const SparseMatrix&, | |||
xType&); | MatrixType&); | |||
extern SparseComplexMatrix xleftdiv (const ComplexDiagMatrix&, const Sparse | extern SparseComplexMatrix xleftdiv (const ComplexDiagMatrix&, | |||
Matrix&, | const SparseMatrix&, | |||
MatrixType&); | MatrixType&); | |||
extern SparseComplexMatrix xleftdiv (const DiagMatrix&, const SparseComplex | extern SparseComplexMatrix xleftdiv (const DiagMatrix&, | |||
Matrix&, | const SparseComplexMatrix&, | |||
MatrixType&); | MatrixType&); | |||
extern SparseComplexMatrix xleftdiv (const ComplexDiagMatrix&, const Sparse | extern SparseComplexMatrix xleftdiv (const ComplexDiagMatrix&, | |||
ComplexMatrix&, | const SparseComplexMatrix&, | |||
MatrixType&); | MatrixType&); | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
13 lines changed or deleted | 13 lines changed or added | |||
sparse-xpow.h | sparse-xpow.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 David Bateman | Copyright (C) 2004-2013 David Bateman | |||
Copyright (C) 1998-2004 Andy Adler | Copyright (C) 1998-2004 Andy Adler | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
statdefs.h | statdefs.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
str-vec.h | str-vec.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 82 | skipping to change at line 82 | |||
bool empty (void) const { return length () == 0; } | bool empty (void) const { return length () == 0; } | |||
octave_idx_type max_length (void) const | octave_idx_type max_length (void) const | |||
{ | { | |||
octave_idx_type n = length (); | octave_idx_type n = length (); | |||
octave_idx_type longest = 0; | octave_idx_type longest = 0; | |||
for (octave_idx_type i = 0; i < n; i++) | for (octave_idx_type i = 0; i < n; i++) | |||
{ | { | |||
octave_idx_type tmp = elem(i).length (); | octave_idx_type tmp = elem (i).length (); | |||
if (tmp > longest) | if (tmp > longest) | |||
longest = tmp; | longest = tmp; | |||
} | } | |||
return longest; | return longest; | |||
} | } | |||
void resize (octave_idx_type n, const std::string& rfv = resize_fill_valu e ()) | void resize (octave_idx_type n, const std::string& rfv = std::string ()) | |||
{ | { | |||
Array<std::string>::resize (dim_vector (n, 1), rfv); | Array<std::string>::resize (dim_vector (n, 1), rfv); | |||
} | } | |||
std::string& operator[] (octave_idx_type i) { return Array<std::string>:: | std::string& operator[] (octave_idx_type i) | |||
elem (i); } | { return Array<std::string>::elem (i); } | |||
std::string operator[] (octave_idx_type i) const { return Array<std::stri | std::string operator[] (octave_idx_type i) const | |||
ng>::elem (i); } | { return Array<std::string>::elem (i); } | |||
string_vector& sort (bool make_uniq = false); | string_vector& sort (bool make_uniq = false); | |||
string_vector& uniq (void); | string_vector& uniq (void); | |||
string_vector& append (const std::string& s); | string_vector& append (const std::string& s); | |||
string_vector& append (const string_vector& sv); | string_vector& append (const string_vector& sv); | |||
std::string join (const std::string& sep = std::string ()) const; | std::string join (const std::string& sep = std::string ()) const; | |||
char **c_str_vec (void) const; | char **c_str_vec (void) const; | |||
static void delete_c_str_vec (const char * const*); | static void delete_c_str_vec (const char * const*); | |||
std::ostream& list_in_columns (std::ostream&, int width = 0) const; | std::ostream& | |||
list_in_columns (std::ostream&, int width = 0, | ||||
const std::string& prefix = std::string ()) const; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
8 lines changed or deleted | 10 lines changed or added | |||
sun-utils.h | sun-utils.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
symtab.h | symtab.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
Copyright (C) 2009 VZLU Prague | Copyright (C) 2009 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 34 | skipping to change at line 34 | |||
#if !defined (octave_symtab_h) | #if !defined (octave_symtab_h) | |||
#define octave_symtab_h 1 | #define octave_symtab_h 1 | |||
#include <deque> | #include <deque> | |||
#include <list> | #include <list> | |||
#include <map> | #include <map> | |||
#include <set> | #include <set> | |||
#include <string> | #include <string> | |||
#include "glob-match.h" | #include "glob-match.h" | |||
#include "regexp.h" | #include "lo-regexp.h" | |||
class tree_argument_list; | class tree_argument_list; | |||
class octave_user_function; | class octave_user_function; | |||
#include "oct-obj.h" | #include "oct-obj.h" | |||
#include "workspace-element.h" | ||||
#include "oct-refcount.h" | #include "oct-refcount.h" | |||
#include "ov.h" | #include "ov.h" | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
symbol_table | symbol_table | |||
{ | { | |||
public: | public: | |||
typedef int scope_id; | typedef int scope_id; | |||
skipping to change at line 199 | skipping to change at line 200 | |||
// inherited from parent scope; not cleared at function exit | // inherited from parent scope; not cleared at function exit | |||
static const unsigned int inherited = 16; | static const unsigned int inherited = 16; | |||
// global (redirects to global scope) | // global (redirects to global scope) | |||
static const unsigned int global = 32; | static const unsigned int global = 32; | |||
// not cleared at function exit | // not cleared at function exit | |||
static const unsigned int persistent = 64; | static const unsigned int persistent = 64; | |||
// temporary variables forced into symbol table for parsing | // this symbol may NOT become a variable. | |||
static const unsigned int forced = 128; | // (symbol added to a static workspace) | |||
static const unsigned int added_static = 128; | ||||
private: | private: | |||
class | class | |||
symbol_record_rep | symbol_record_rep | |||
{ | { | |||
public: | public: | |||
symbol_record_rep (const std::string& nm, const octave_value& v, | symbol_record_rep (scope_id s, const std::string& nm, | |||
unsigned int sc) | const octave_value& v, unsigned int sc) | |||
: name (nm), value_stack (), storage_class (sc), finfo (), count (1 | : decl_scope (s), curr_fcn (0), name (nm), value_stack (), | |||
) | storage_class (sc), finfo (), valid (true), count (1) | |||
{ | { | |||
value_stack.push_back (v); | value_stack.push_back (v); | |||
} | } | |||
void force_variable (context_id context) | void assign (const octave_value& value, | |||
context_id context = xdefault_context) | ||||
{ | { | |||
octave_value& val = varref (context); | varref (context) = value; | |||
} | ||||
void assign (octave_value::assign_op op, | ||||
const std::string& type, | ||||
const std::list<octave_value_list>& idx, | ||||
const octave_value& value, | ||||
context_id context = xdefault_context) | ||||
{ | ||||
varref(context).assign (op, type, idx, value); | ||||
} | ||||
void assign (octave_value::assign_op op, const octave_value& value, | ||||
context_id context = xdefault_context) | ||||
{ | ||||
varref(context).assign (op, value); | ||||
} | ||||
if (! val.is_defined ()) | void do_non_const_unary_op (octave_value::unary_op op, | |||
mark_forced (); | context_id context = xdefault_context) | |||
{ | ||||
varref(context).do_non_const_unary_op (op); | ||||
} | } | |||
octave_value& varref (context_id context) | void do_non_const_unary_op (octave_value::unary_op op, | |||
const std::string& type, | ||||
const std::list<octave_value_list>& idx, | ||||
context_id context = xdefault_context) | ||||
{ | { | |||
varref(context).do_non_const_unary_op (op, type, idx); | ||||
} | ||||
octave_value& varref (context_id context = xdefault_context) | ||||
{ | ||||
// We duplicate global_varref and persistent_varref here to | ||||
// avoid calling deprecated functions. | ||||
if (is_global ()) | if (is_global ()) | |||
return symbol_table::global_varref (name); | { | |||
symbol_table::global_table_iterator p | ||||
= symbol_table::global_table.find (name); | ||||
return (p == symbol_table::global_table.end ()) | ||||
? symbol_table::global_table[name] : p->second; | ||||
} | ||||
else if (is_persistent ()) | else if (is_persistent ()) | |||
return symbol_table::persistent_varref (name); | { | |||
static octave_value foobar; | ||||
symbol_table *inst | ||||
= symbol_table::get_instance (symbol_table::current_scope ()) | ||||
; | ||||
return inst ? inst->do_persistent_varref (name) : foobar; | ||||
} | ||||
else | else | |||
{ | { | |||
if (context == xdefault_context) | ||||
context = active_context (); | ||||
context_id n = value_stack.size (); | context_id n = value_stack.size (); | |||
while (n++ <= context) | while (n++ <= context) | |||
value_stack.push_back (octave_value ()); | value_stack.push_back (octave_value ()); | |||
return value_stack[context]; | return value_stack[context]; | |||
} | } | |||
} | } | |||
octave_value varval (context_id context) const | octave_value varval (context_id context = xdefault_context) const | |||
{ | { | |||
if (is_global ()) | if (is_global ()) | |||
return symbol_table::global_varval (name); | return symbol_table::global_varval (name); | |||
else if (is_persistent ()) | else if (is_persistent ()) | |||
return symbol_table::persistent_varval (name); | return symbol_table::persistent_varval (name); | |||
else | else | |||
{ | { | |||
if (context == xdefault_context) | ||||
context = active_context (); | ||||
if (context < value_stack.size ()) | if (context < value_stack.size ()) | |||
return value_stack[context]; | return value_stack[context]; | |||
else | else | |||
return octave_value (); | return octave_value (); | |||
} | } | |||
} | } | |||
void push_context (void) | void push_context (scope_id s) | |||
{ | { | |||
if (! (is_persistent () || is_global ())) | if (! (is_persistent () || is_global ()) | |||
&& s == scope ()) | ||||
value_stack.push_back (octave_value ()); | value_stack.push_back (octave_value ()); | |||
} | } | |||
// If pop_context returns 0, we are out of values and this element | // If pop_context returns 0, we are out of values and this element | |||
// of the symbol table should be deleted. This can happen for | // of the symbol table should be deleted. This can happen for | |||
// functions like | // functions like | |||
// | // | |||
// function foo (n) | // function foo (n) | |||
// if (n > 0) | // if (n > 0) | |||
// foo (n-1); | // foo (n-1); | |||
// else | // else | |||
// eval ("x = 1"); | // eval ("x = 1"); | |||
// endif | // endif | |||
// endfunction | // endfunction | |||
// | // | |||
// Here, X should only exist in the final stack frame. | // Here, X should only exist in the final stack frame. | |||
size_t pop_context (void) | size_t pop_context (scope_id s) | |||
{ | { | |||
size_t retval = 1; | size_t retval = 1; | |||
if (! (is_persistent () || is_global ())) | if (! (is_persistent () || is_global ()) | |||
&& s == scope ()) | ||||
{ | { | |||
value_stack.pop_back (); | value_stack.pop_back (); | |||
retval = value_stack.size (); | retval = value_stack.size (); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
void clear (void) | void clear (void) { clear (scope ()); } | |||
void clear (scope_id s) | ||||
{ | { | |||
if (! (is_hidden () || is_inherited ())) | if (! (is_hidden () || is_inherited ()) | |||
&& s == scope ()) | ||||
{ | { | |||
if (is_global ()) | if (is_global ()) | |||
unmark_global (); | unmark_global (); | |||
if (is_persistent ()) | if (is_persistent ()) | |||
{ | { | |||
symbol_table::persistent_varref (name) | symbol_table::persistent_assign (name, varval ()); | |||
= varval (xcurrent_context); | ||||
unmark_persistent (); | unmark_persistent (); | |||
} | } | |||
varref (xcurrent_context) = octave_value (); | assign (octave_value ()); | |||
} | } | |||
} | } | |||
bool is_defined (context_id context) const | bool is_defined (context_id context = xdefault_context) const | |||
{ | { | |||
if (context == xdefault_context) | ||||
context = active_context (); | ||||
return varval (context).is_defined (); | return varval (context).is_defined (); | |||
} | } | |||
bool is_valid (void) const | ||||
{ | ||||
return valid; | ||||
} | ||||
bool is_variable (context_id context) const | bool is_variable (context_id context) const | |||
{ | { | |||
return (! is_local () || is_defined (context) || is_forced ()); | if (context == xdefault_context) | |||
context = active_context (); | ||||
return (! is_local () || is_defined (context)); | ||||
} | } | |||
bool is_local (void) const { return storage_class & local; } | bool is_local (void) const { return storage_class & local; } | |||
bool is_automatic (void) const { return storage_class & automatic; } | bool is_automatic (void) const { return storage_class & automatic; } | |||
bool is_formal (void) const { return storage_class & formal; } | bool is_formal (void) const { return storage_class & formal; } | |||
bool is_hidden (void) const { return storage_class & hidden; } | bool is_hidden (void) const { return storage_class & hidden; } | |||
bool is_inherited (void) const { return storage_class & inherited; } | bool is_inherited (void) const { return storage_class & inherited; } | |||
bool is_global (void) const { return storage_class & global; } | bool is_global (void) const { return storage_class & global; } | |||
bool is_persistent (void) const { return storage_class & persistent; } | bool is_persistent (void) const { return storage_class & persistent; } | |||
bool is_forced (void) const { return storage_class & forced; } | bool is_added_static (void) const {return storage_class & added_stati c; } | |||
void mark_local (void) { storage_class |= local; } | void mark_local (void) { storage_class |= local; } | |||
void mark_automatic (void) { storage_class |= automatic; } | void mark_automatic (void) { storage_class |= automatic; } | |||
void mark_formal (void) { storage_class |= formal; } | void mark_formal (void) { storage_class |= formal; } | |||
void mark_hidden (void) { storage_class |= hidden; } | void mark_hidden (void) { storage_class |= hidden; } | |||
void mark_inherited (void) { storage_class |= inherited; } | void mark_inherited (void) { storage_class |= inherited; } | |||
void mark_global (void) | void mark_global (void) | |||
{ | { | |||
if (is_persistent ()) | if (is_persistent ()) | |||
error ("can't make persistent variable %s global", name.c_str ()) ; | error ("can't make persistent variable %s global", name.c_str ()) ; | |||
else | else | |||
storage_class |= global; | storage_class |= global; | |||
} | } | |||
void mark_persistent (void) | void mark_persistent (void) | |||
{ | { | |||
if (is_global ()) | if (is_global ()) | |||
error ("can't make global variable %s persistent", name.c_str ()) ; | error ("can't make global variable %s persistent", name.c_str ()) ; | |||
else | else | |||
storage_class |= persistent; | storage_class |= persistent; | |||
} | } | |||
void mark_forced (void) { storage_class |= forced; } | void mark_added_static (void) { storage_class |= added_static; } | |||
void unmark_local (void) { storage_class &= ~local; } | void unmark_local (void) { storage_class &= ~local; } | |||
void unmark_automatic (void) { storage_class &= ~automatic; } | void unmark_automatic (void) { storage_class &= ~automatic; } | |||
void unmark_formal (void) { storage_class &= ~formal; } | void unmark_formal (void) { storage_class &= ~formal; } | |||
void unmark_hidden (void) { storage_class &= ~hidden; } | void unmark_hidden (void) { storage_class &= ~hidden; } | |||
void unmark_inherited (void) { storage_class &= ~inherited; } | void unmark_inherited (void) { storage_class &= ~inherited; } | |||
void unmark_global (void) { storage_class &= ~global; } | void unmark_global (void) { storage_class &= ~global; } | |||
void unmark_persistent (void) { storage_class &= ~persistent; } | void unmark_persistent (void) { storage_class &= ~persistent; } | |||
void unmark_forced (void) { storage_class &= ~forced; } | void unmark_added_static (void) { storage_class &= ~added_static; } | |||
void init_persistent (void) | void init_persistent (void) | |||
{ | { | |||
if (! is_defined (xcurrent_context)) | if (! is_defined ()) | |||
{ | { | |||
mark_persistent (); | mark_persistent (); | |||
varref (xcurrent_context) = symbol_table::persistent_varval (na me); | assign (symbol_table::persistent_varval (name)); | |||
} | } | |||
// FIXME -- this causes trouble with recursive calls. | // FIXME: this causes trouble with recursive calls. | |||
// else | // else | |||
// error ("unable to declare existing variable persistent"); | // error ("unable to declare existing variable persistent"); | |||
} | } | |||
void invalidate (void) | ||||
{ | ||||
valid = false; | ||||
} | ||||
void erase_persistent (void) | void erase_persistent (void) | |||
{ | { | |||
unmark_persistent (); | unmark_persistent (); | |||
symbol_table::erase_persistent (name); | symbol_table::erase_persistent (name); | |||
} | } | |||
symbol_record_rep *dup (void) const | OCTINTERP_API context_id active_context (void) const; | |||
scope_id scope (void) const { return decl_scope; } | ||||
void set_curr_fcn (octave_user_function *fcn) | ||||
{ | { | |||
return new symbol_record_rep (name, varval (xcurrent_context), | curr_fcn = fcn; | |||
} | ||||
symbol_record_rep *dup (scope_id new_scope) const | ||||
{ | ||||
return new symbol_record_rep (new_scope, name, varval (), | ||||
storage_class); | storage_class); | |||
} | } | |||
void dump (std::ostream& os, const std::string& prefix) const; | void dump (std::ostream& os, const std::string& prefix) const; | |||
scope_id decl_scope; | ||||
octave_user_function* curr_fcn; | ||||
std::string name; | std::string name; | |||
std::deque<octave_value> value_stack; | std::deque<octave_value> value_stack; | |||
unsigned int storage_class; | unsigned int storage_class; | |||
fcn_info *finfo; | fcn_info *finfo; | |||
bool valid; | ||||
octave_refcount<size_t> count; | octave_refcount<size_t> count; | |||
private: | private: | |||
// No copying! | // No copying! | |||
symbol_record_rep (const symbol_record_rep& ov); | symbol_record_rep (const symbol_record_rep& ov); | |||
symbol_record_rep& operator = (const symbol_record_rep&); | symbol_record_rep& operator = (const symbol_record_rep&); | |||
}; | }; | |||
public: | public: | |||
symbol_record (const std::string& nm = std::string (), | symbol_record (scope_id s = xcurrent_scope, | |||
const std::string& nm = std::string (), | ||||
const octave_value& v = octave_value (), | const octave_value& v = octave_value (), | |||
unsigned int sc = local) | unsigned int sc = local) | |||
: rep (new symbol_record_rep (nm, v, sc)) { } | : rep (new symbol_record_rep (s, nm, v, sc)) { } | |||
symbol_record (const symbol_record& sr) | symbol_record (const symbol_record& sr) | |||
: rep (sr.rep) | : rep (sr.rep) | |||
{ | { | |||
rep->count++; | rep->count++; | |||
} | } | |||
symbol_record& operator = (const symbol_record& sr) | symbol_record& operator = (const symbol_record& sr) | |||
{ | { | |||
if (this != &sr) | if (this != &sr) | |||
skipping to change at line 435 | skipping to change at line 523 | |||
return *this; | return *this; | |||
} | } | |||
~symbol_record (void) | ~symbol_record (void) | |||
{ | { | |||
if (--rep->count == 0) | if (--rep->count == 0) | |||
delete rep; | delete rep; | |||
} | } | |||
symbol_record dup (void) const { return symbol_record (rep->dup ()); } | symbol_record dup (scope_id new_scope) const | |||
{ | ||||
return symbol_record (rep->dup (new_scope)); | ||||
} | ||||
const std::string& name (void) const { return rep->name; } | ||||
void rename (const std::string& new_name) { rep->name = new_name; } | ||||
octave_value | ||||
find (const octave_value_list& args = octave_value_list ()) const; | ||||
void assign (const octave_value& value, | ||||
context_id context = xdefault_context) | ||||
{ | ||||
rep->assign (value, context); | ||||
} | ||||
void assign (octave_value::assign_op op, | ||||
const std::string& type, | ||||
const std::list<octave_value_list>& idx, | ||||
const octave_value& value, | ||||
context_id context = xdefault_context) | ||||
{ | ||||
rep->assign (op, type, idx, value, context); | ||||
} | ||||
std::string name (void) const { return rep->name; } | void assign (octave_value::assign_op op, const octave_value& value, | |||
context_id context = xdefault_context) | ||||
{ | ||||
rep->assign (op, value, context); | ||||
} | ||||
octave_value find (const octave_value_list& args = octave_value_list () | void do_non_const_unary_op (octave_value::unary_op op) | |||
) const; | { | |||
rep->do_non_const_unary_op (op); | ||||
} | ||||
void force_variable (context_id context = xcurrent_context) | void do_non_const_unary_op (octave_value::unary_op op, | |||
const std::string& type, | ||||
const std::list<octave_value_list>& idx) | ||||
{ | { | |||
rep->force_variable (context); | rep->do_non_const_unary_op (op, type, idx); | |||
} | } | |||
octave_value& varref (context_id context = xcurrent_context) | // Delete when deprecated varref functions are removed. | |||
octave_value& varref (context_id context = xdefault_context) | ||||
{ | { | |||
return rep->varref (context); | return rep->varref (context); | |||
} | } | |||
octave_value varval (context_id context = xcurrent_context) const | octave_value varval (context_id context = xdefault_context) const | |||
{ | { | |||
return rep->varval (context); | return rep->varval (context); | |||
} | } | |||
void push_context (void) { rep->push_context (); } | void push_context (scope_id s) { rep->push_context (s); } | |||
size_t pop_context (void) { return rep->pop_context (); } | size_t pop_context (scope_id s) { return rep->pop_context (s); } | |||
void clear (void) { rep->clear (); } | void clear (void) { rep->clear (); } | |||
bool is_defined (context_id context = xcurrent_context) const | void clear (scope_id s) { rep->clear (s); } | |||
bool is_defined (context_id context = xdefault_context) const | ||||
{ | { | |||
return rep->is_defined (context); | return rep->is_defined (context); | |||
} | } | |||
bool is_variable (context_id context = xcurrent_context) const | bool is_undefined (context_id context = xdefault_context) const | |||
{ | ||||
return ! rep->is_defined (context); | ||||
} | ||||
bool is_valid (void) const | ||||
{ | ||||
return rep->is_valid (); | ||||
} | ||||
bool is_variable (context_id context = xdefault_context) const | ||||
{ | { | |||
return rep->is_variable (context); | return rep->is_variable (context); | |||
} | } | |||
bool is_local (void) const { return rep->is_local (); } | bool is_local (void) const { return rep->is_local (); } | |||
bool is_automatic (void) const { return rep->is_automatic (); } | bool is_automatic (void) const { return rep->is_automatic (); } | |||
bool is_formal (void) const { return rep->is_formal (); } | bool is_formal (void) const { return rep->is_formal (); } | |||
bool is_global (void) const { return rep->is_global (); } | bool is_global (void) const { return rep->is_global (); } | |||
bool is_hidden (void) const { return rep->is_hidden (); } | bool is_hidden (void) const { return rep->is_hidden (); } | |||
bool is_inherited (void) const { return rep->is_inherited (); } | bool is_inherited (void) const { return rep->is_inherited (); } | |||
bool is_persistent (void) const { return rep->is_persistent (); } | bool is_persistent (void) const { return rep->is_persistent (); } | |||
bool is_forced (void) const { return rep->is_forced (); } | bool is_added_static (void) const { return rep->is_added_static (); } | |||
void mark_local (void) { rep->mark_local (); } | void mark_local (void) { rep->mark_local (); } | |||
void mark_automatic (void) { rep->mark_automatic (); } | void mark_automatic (void) { rep->mark_automatic (); } | |||
void mark_formal (void) { rep->mark_formal (); } | void mark_formal (void) { rep->mark_formal (); } | |||
void mark_hidden (void) { rep->mark_hidden (); } | void mark_hidden (void) { rep->mark_hidden (); } | |||
void mark_inherited (void) { rep->mark_inherited (); } | void mark_inherited (void) { rep->mark_inherited (); } | |||
void mark_global (void) { rep->mark_global (); } | void mark_global (void) { rep->mark_global (); } | |||
void mark_persistent (void) { rep->mark_persistent (); } | void mark_persistent (void) { rep->mark_persistent (); } | |||
void mark_forced (void) { rep->mark_forced (); } | void mark_added_static (void) { rep->mark_added_static (); } | |||
void unmark_local (void) { rep->unmark_local (); } | void unmark_local (void) { rep->unmark_local (); } | |||
void unmark_automatic (void) { rep->unmark_automatic (); } | void unmark_automatic (void) { rep->unmark_automatic (); } | |||
void unmark_formal (void) { rep->unmark_formal (); } | void unmark_formal (void) { rep->unmark_formal (); } | |||
void unmark_hidden (void) { rep->unmark_hidden (); } | void unmark_hidden (void) { rep->unmark_hidden (); } | |||
void unmark_inherited (void) { rep->unmark_inherited (); } | void unmark_inherited (void) { rep->unmark_inherited (); } | |||
void unmark_global (void) { rep->unmark_global (); } | void unmark_global (void) { rep->unmark_global (); } | |||
void unmark_persistent (void) { rep->unmark_persistent (); } | void unmark_persistent (void) { rep->unmark_persistent (); } | |||
void unmark_forced (void) { rep->unmark_forced (); } | void unmark_added_static (void) { rep->unmark_added_static (); } | |||
void init_persistent (void) { rep->init_persistent (); } | void init_persistent (void) { rep->init_persistent (); } | |||
void erase_persistent (void) { rep->erase_persistent (); } | void erase_persistent (void) { rep->erase_persistent (); } | |||
void invalidate (void) { rep->invalidate (); } | ||||
context_id active_context (void) const { return rep->active_context (); | ||||
} | ||||
scope_id scope (void) const { return rep->scope (); } | ||||
unsigned int xstorage_class (void) const { return rep->storage_class; } | unsigned int xstorage_class (void) const { return rep->storage_class; } | |||
void set_curr_fcn (octave_user_function *fcn) { rep->set_curr_fcn (fcn) | ||||
; } | ||||
void | void | |||
dump (std::ostream& os, const std::string& prefix = std::string ()) con st | dump (std::ostream& os, const std::string& prefix = std::string ()) con st | |||
{ | { | |||
rep->dump (os, prefix); | rep->dump (os, prefix); | |||
} | } | |||
private: | private: | |||
symbol_record_rep *rep; | symbol_record_rep *rep; | |||
symbol_record (symbol_record_rep *new_rep) : rep (new_rep) { } | symbol_record (symbol_record_rep *new_rep) : rep (new_rep) { } | |||
}; | }; | |||
// Always access a symbol from the current scope. | ||||
// Useful for scripts, as they may be executed in more than one scope. | ||||
class | ||||
symbol_reference | ||||
{ | ||||
public: | ||||
symbol_reference (void) : scope (-1) { } | ||||
symbol_reference (const symbol_record& record, | ||||
scope_id curr_scope = symbol_table::current_scope ()) | ||||
: scope (curr_scope), sym (record) | ||||
{ } | ||||
symbol_reference (const symbol_reference& ref) | ||||
: scope (ref.scope), sym (ref.sym) | ||||
{ } | ||||
symbol_reference& operator = (const symbol_reference& ref) | ||||
{ | ||||
if (this != &ref) | ||||
{ | ||||
scope = ref.scope; | ||||
sym = ref.sym; | ||||
} | ||||
return *this; | ||||
} | ||||
bool is_black_hole (void) const { return scope < 0; } | ||||
// The name is the same regardless of scope. | ||||
const std::string& name (void) const { return sym.name (); } | ||||
symbol_record *operator-> (void) | ||||
{ | ||||
update (); | ||||
return &sym; | ||||
} | ||||
symbol_record *operator-> (void) const | ||||
{ | ||||
update (); | ||||
return &sym; | ||||
} | ||||
// can be used to place symbol_reference in maps, we don't overload < a | ||||
s | ||||
// it doesn't make any sense for symbol_reference | ||||
struct comparator | ||||
{ | ||||
bool operator ()(const symbol_reference& lhs, | ||||
const symbol_reference& rhs) const | ||||
{ | ||||
return lhs.name () < rhs.name (); | ||||
} | ||||
}; | ||||
private: | ||||
void update (void) const | ||||
{ | ||||
scope_id curr_scope = symbol_table::current_scope (); | ||||
if (scope != curr_scope || ! sym.is_valid ()) | ||||
{ | ||||
scope = curr_scope; | ||||
sym = symbol_table::insert (sym.name ()); | ||||
} | ||||
} | ||||
mutable scope_id scope; | ||||
mutable symbol_record sym; | ||||
}; | ||||
class | class | |||
fcn_info | fcn_info | |||
{ | { | |||
public: | public: | |||
typedef std::map<std::string, std::string> dispatch_map_type; | typedef std::map<std::string, std::string> dispatch_map_type; | |||
typedef std::map<scope_id, octave_value>::const_iterator scope_val_cons | typedef std::map<scope_id, octave_value>::const_iterator | |||
t_iterator; | scope_val_const_iterator; | |||
typedef std::map<scope_id, octave_value>::iterator scope_val_iterator; | typedef std::map<scope_id, octave_value>::iterator scope_val_iterator; | |||
typedef std::map<std::string, octave_value>::const_iterator str_val_con | typedef std::map<std::string, octave_value>::const_iterator | |||
st_iterator; | str_val_const_iterator; | |||
typedef std::map<std::string, octave_value>::iterator str_val_iterator; | typedef std::map<std::string, octave_value>::iterator str_val_iterator; | |||
typedef dispatch_map_type::const_iterator dispatch_map_const_iterator; | typedef dispatch_map_type::const_iterator dispatch_map_const_iterator; | |||
typedef dispatch_map_type::iterator dispatch_map_iterator; | typedef dispatch_map_type::iterator dispatch_map_iterator; | |||
private: | private: | |||
class | class | |||
fcn_info_rep | fcn_info_rep | |||
{ | { | |||
skipping to change at line 568 | skipping to change at line 785 | |||
octave_value find_autoload (void); | octave_value find_autoload (void); | |||
octave_value find_user_function (void); | octave_value find_user_function (void); | |||
bool is_user_function_defined (void) const | bool is_user_function_defined (void) const | |||
{ | { | |||
return function_on_path.is_defined (); | return function_on_path.is_defined (); | |||
} | } | |||
octave_value find_function (const octave_value_list& args, bool local | octave_value find_function (const octave_value_list& args, | |||
_funcs) | bool local_funcs) | |||
{ | { | |||
return find (args, local_funcs); | return find (args, local_funcs); | |||
} | } | |||
void lock_subfunction (scope_id scope) | void lock_subfunction (scope_id scope) | |||
{ | { | |||
scope_val_iterator p = subfunctions.find (scope); | scope_val_iterator p = subfunctions.find (scope); | |||
if (p != subfunctions.end ()) | if (p != subfunctions.end ()) | |||
p->second.lock (); | p->second.lock (); | |||
skipping to change at line 595 | skipping to change at line 813 | |||
if (p != subfunctions.end ()) | if (p != subfunctions.end ()) | |||
p->second.unlock (); | p->second.unlock (); | |||
} | } | |||
std::pair<std::string, octave_value> | std::pair<std::string, octave_value> | |||
subfunction_defined_in_scope (scope_id scope) const | subfunction_defined_in_scope (scope_id scope) const | |||
{ | { | |||
scope_val_const_iterator p = subfunctions.find (scope); | scope_val_const_iterator p = subfunctions.find (scope); | |||
return p == subfunctions.end () | return p == subfunctions.end () | |||
? std::pair<std::string, octave_value> () | ? std::pair<std::string, octave_value> () | |||
: std::pair<std::string, octave_value> (name, p->second); | : std::pair<std::string, octave_value> (name, p->second); | |||
} | } | |||
void erase_subfunction (scope_id scope) | void erase_subfunction (scope_id scope) | |||
{ | { | |||
scope_val_iterator p = subfunctions.find (scope); | scope_val_iterator p = subfunctions.find (scope); | |||
if (p != subfunctions.end ()) | if (p != subfunctions.end ()) | |||
subfunctions.erase (p); | subfunctions.erase (p); | |||
} | } | |||
skipping to change at line 632 | skipping to change at line 850 | |||
function_on_path = f; | function_on_path = f; | |||
} | } | |||
void install_built_in_function (const octave_value& f) | void install_built_in_function (const octave_value& f) | |||
{ | { | |||
built_in_function = f; | built_in_function = f; | |||
} | } | |||
template <class T> | template <class T> | |||
void | void | |||
clear_unlocked (std::map<T, octave_value>& map) | clear_map (std::map<T, octave_value>& map, bool force = false) | |||
{ | { | |||
typename std::map<T, octave_value>::iterator p = map.begin (); | typename std::map<T, octave_value>::iterator p = map.begin (); | |||
while (p != map.end ()) | while (p != map.end ()) | |||
{ | { | |||
if (p->second.islocked ()) | if (force || ! p->second.islocked ()) | |||
p++; | ||||
else | ||||
map.erase (p++); | map.erase (p++); | |||
else | ||||
p++; | ||||
} | } | |||
} | } | |||
void clear_cmdline_function (void) | void clear_autoload_function (bool force = false) | |||
{ | { | |||
if (! cmdline_function.islocked ()) | if (force || ! autoload_function.islocked ()) | |||
cmdline_function = octave_value (); | ||||
} | ||||
void clear_autoload_function (void) | ||||
{ | ||||
if (! autoload_function.islocked ()) | ||||
autoload_function = octave_value (); | autoload_function = octave_value (); | |||
} | } | |||
// FIXME -- should this also clear the cmdline and other "user | // We also clear command line functions here, as these are both | |||
// defined" functions? | // "user defined" | |||
void clear_user_function (void) | void clear_user_function (bool force = false) | |||
{ | { | |||
if (! function_on_path.islocked ()) | if (force || ! function_on_path.islocked ()) | |||
{ | function_on_path = octave_value (); | |||
function_on_path.erase_subfunctions (); | ||||
function_on_path = octave_value (); | if (force || ! cmdline_function.islocked ()) | |||
} | cmdline_function = octave_value (); | |||
} | } | |||
void clear_mex_function (void) | void clear_mex_function (void) | |||
{ | { | |||
if (function_on_path.is_mex_function ()) | if (function_on_path.is_mex_function ()) | |||
clear_user_function (); | clear_user_function (); | |||
} | } | |||
void clear (void) | void clear (bool force = false) | |||
{ | { | |||
clear_unlocked (subfunctions); | clear_map (subfunctions, force); | |||
clear_unlocked (private_functions); | clear_map (private_functions, force); | |||
clear_unlocked (class_constructors); | clear_map (class_constructors, force); | |||
clear_unlocked (class_methods); | clear_map (class_methods, force); | |||
clear_cmdline_function (); | ||||
clear_autoload_function (); | clear_autoload_function (force); | |||
clear_user_function (); | clear_user_function (force); | |||
} | } | |||
void add_dispatch (const std::string& type, const std::string& fname) | void add_dispatch (const std::string& type, const std::string& fname) | |||
{ | { | |||
dispatch_map[type] = fname; | dispatch_map[type] = fname; | |||
} | } | |||
void clear_dispatch (const std::string& type) | void clear_dispatch (const std::string& type) | |||
{ | { | |||
dispatch_map_iterator p = dispatch_map.find (type); | dispatch_map_iterator p = dispatch_map.find (type); | |||
skipping to change at line 818 | skipping to change at line 1029 | |||
octave_value find_user_function (void) | octave_value find_user_function (void) | |||
{ | { | |||
return rep->find_user_function (); | return rep->find_user_function (); | |||
} | } | |||
bool is_user_function_defined (void) const | bool is_user_function_defined (void) const | |||
{ | { | |||
return rep->is_user_function_defined (); | return rep->is_user_function_defined (); | |||
} | } | |||
octave_value find_function (const octave_value_list& args = octave_valu | octave_value find_function (const octave_value_list& args | |||
e_list (), | = octave_value_list (), | |||
bool local_funcs = true) | bool local_funcs = true) | |||
{ | { | |||
return rep->find_function (args, local_funcs); | return rep->find_function (args, local_funcs); | |||
} | } | |||
void lock_subfunction (scope_id scope) | void lock_subfunction (scope_id scope) | |||
{ | { | |||
rep->lock_subfunction (scope); | rep->lock_subfunction (scope); | |||
} | } | |||
skipping to change at line 871 | skipping to change at line 1083 | |||
void install_user_function (const octave_value& f) | void install_user_function (const octave_value& f) | |||
{ | { | |||
rep->install_user_function (f); | rep->install_user_function (f); | |||
} | } | |||
void install_built_in_function (const octave_value& f) | void install_built_in_function (const octave_value& f) | |||
{ | { | |||
rep->install_built_in_function (f); | rep->install_built_in_function (f); | |||
} | } | |||
void clear (void) { rep->clear (); } | void clear (bool force = false) { rep->clear (force); } | |||
void clear_user_function (void) { rep->clear_user_function (); } | void clear_user_function (bool force = false) | |||
{ | ||||
rep->clear_user_function (force); | ||||
} | ||||
void clear_autoload_function (void) { rep->clear_autoload_function (); | void clear_autoload_function (bool force = false) | |||
} | { | |||
rep->clear_autoload_function (force); | ||||
} | ||||
void clear_mex_function (void) { rep->clear_mex_function (); } | void clear_mex_function (void) { rep->clear_mex_function (); } | |||
void add_dispatch (const std::string& type, const std::string& fname) | void add_dispatch (const std::string& type, const std::string& fname) | |||
{ | { | |||
rep->add_dispatch (type, fname); | rep->add_dispatch (type, fname); | |||
} | } | |||
void clear_dispatch (const std::string& type) | void clear_dispatch (const std::string& type) | |||
{ | { | |||
rep->clear_dispatch (type); | rep->clear_dispatch (type); | |||
} | } | |||
void print_dispatch (std::ostream& os) const | void print_dispatch (std::ostream& os) const | |||
{ | { | |||
rep->print_dispatch (os); | rep->print_dispatch (os); | |||
} | } | |||
std::string help_for_dispatch (void) const { return rep->help_for_dispa | std::string help_for_dispatch (void) const | |||
tch (); } | { return rep->help_for_dispatch (); } | |||
dispatch_map_type get_dispatch (void) const | dispatch_map_type get_dispatch (void) const | |||
{ | { | |||
return rep->get_dispatch (); | return rep->get_dispatch (); | |||
} | } | |||
void | void | |||
dump (std::ostream& os, const std::string& prefix = std::string ()) con st | dump (std::ostream& os, const std::string& prefix = std::string ()) con st | |||
{ | { | |||
rep->dump (os, prefix); | rep->dump (os, prefix); | |||
skipping to change at line 931 | skipping to change at line 1150 | |||
static void set_scope (scope_id scope) | static void set_scope (scope_id scope) | |||
{ | { | |||
if (scope == xglobal_scope) | if (scope == xglobal_scope) | |||
error ("can't set scope to global"); | error ("can't set scope to global"); | |||
else if (scope != xcurrent_scope) | else if (scope != xcurrent_scope) | |||
{ | { | |||
all_instances_iterator p = all_instances.find (scope); | all_instances_iterator p = all_instances.find (scope); | |||
if (p == all_instances.end ()) | if (p == all_instances.end ()) | |||
{ | { | |||
symbol_table *inst = new symbol_table (); | symbol_table *inst = new symbol_table (scope); | |||
if (inst) | if (inst) | |||
all_instances[scope] = instance = inst; | all_instances[scope] = instance = inst; | |||
} | } | |||
else | else | |||
instance = p->second; | instance = p->second; | |||
xcurrent_scope = scope; | xcurrent_scope = scope; | |||
xcurrent_context = 0; | xcurrent_context = 0; | |||
} | } | |||
skipping to change at line 974 | skipping to change at line 1193 | |||
} | } | |||
else | else | |||
xcurrent_context = context; | xcurrent_context = context; | |||
} | } | |||
} | } | |||
static void erase_scope (scope_id scope) | static void erase_scope (scope_id scope) | |||
{ | { | |||
assert (scope != xglobal_scope); | assert (scope != xglobal_scope); | |||
erase_subfunctions_in_scope (scope); | ||||
all_instances_iterator p = all_instances.find (scope); | all_instances_iterator p = all_instances.find (scope); | |||
if (p != all_instances.end ()) | if (p != all_instances.end ()) | |||
{ | { | |||
delete p->second; | delete p->second; | |||
all_instances.erase (p); | all_instances.erase (p); | |||
free_scope (scope); | free_scope (scope); | |||
} | } | |||
} | } | |||
static void erase_subfunctions_in_scope (scope_id scope) | static void erase_subfunctions_in_scope (scope_id scope) | |||
{ | { | |||
for (fcn_table_iterator q = fcn_table.begin (); | for (fcn_table_iterator q = fcn_table.begin (); q != fcn_table.end (); | |||
q != fcn_table.end (); q++) | q++) | |||
q->second.erase_subfunction (scope); | q->second.erase_subfunction (scope); | |||
} | } | |||
static void | static void | |||
mark_subfunctions_in_scope_as_private (scope_id scope, | mark_subfunctions_in_scope_as_private (scope_id scope, | |||
const std::string& class_name) | const std::string& class_name) | |||
{ | { | |||
for (fcn_table_iterator q = fcn_table.begin (); | for (fcn_table_iterator q = fcn_table.begin (); q != fcn_table.end (); | |||
q != fcn_table.end (); q++) | q++) | |||
q->second.mark_subfunction_in_scope_as_private (scope, class_name); | q->second.mark_subfunction_in_scope_as_private (scope, class_name); | |||
} | } | |||
static scope_id dup_scope (scope_id scope) | static scope_id dup_scope (scope_id scope) | |||
{ | { | |||
scope_id retval = -1; | scope_id retval = -1; | |||
symbol_table *inst = get_instance (scope); | symbol_table *inst = get_instance (scope); | |||
if (inst) | if (inst) | |||
{ | { | |||
scope_id new_scope = alloc_scope (); | scope_id new_scope = alloc_scope (); | |||
symbol_table *new_symbol_table = new symbol_table (); | symbol_table *new_symbol_table = new symbol_table (scope); | |||
if (new_symbol_table) | if (new_symbol_table) | |||
{ | { | |||
all_instances[new_scope] = new_symbol_table; | all_instances[new_scope] = new_symbol_table; | |||
inst->do_dup_scope (*new_symbol_table); | inst->do_dup_scope (*new_symbol_table); | |||
retval = new_scope; | retval = new_scope; | |||
} | } | |||
} | } | |||
skipping to change at line 1037 | skipping to change at line 1256 | |||
static std::list<scope_id> scopes (void) | static std::list<scope_id> scopes (void) | |||
{ | { | |||
return scope_id_cache::scopes (); | return scope_id_cache::scopes (); | |||
} | } | |||
static symbol_record | static symbol_record | |||
find_symbol (const std::string& name, scope_id scope = xcurrent_scope) | find_symbol (const std::string& name, scope_id scope = xcurrent_scope) | |||
{ | { | |||
symbol_table *inst = get_instance (scope); | symbol_table *inst = get_instance (scope); | |||
return inst ? inst->do_find_symbol (name) : symbol_record (); | return inst ? inst->do_find_symbol (name) : | |||
symbol_record (scope); | ||||
} | } | |||
static void | static void | |||
inherit (scope_id scope, scope_id donor_scope, context_id donor_context) | inherit (scope_id scope, scope_id donor_scope, context_id donor_context) | |||
{ | { | |||
symbol_table *inst = get_instance (scope); | symbol_table *inst = get_instance (scope); | |||
if (inst) | if (inst) | |||
{ | { | |||
symbol_table *donor_symbol_table = get_instance (donor_scope); | symbol_table *donor_symbol_table = get_instance (donor_scope); | |||
skipping to change at line 1066 | skipping to change at line 1286 | |||
// Find a value corresponding to the given name in the table. | // Find a value corresponding to the given name in the table. | |||
static octave_value | static octave_value | |||
find (const std::string& name, | find (const std::string& name, | |||
const octave_value_list& args = octave_value_list (), | const octave_value_list& args = octave_value_list (), | |||
bool skip_variables = false, | bool skip_variables = false, | |||
bool local_funcs = true); | bool local_funcs = true); | |||
static octave_value builtin_find (const std::string& name); | static octave_value builtin_find (const std::string& name); | |||
// Insert a new name in the table. | // Insert a new name in the table. | |||
static symbol_record& insert (const std::string& name) | static symbol_record& insert (const std::string& name, | |||
scope_id scope = xcurrent_scope) | ||||
{ | { | |||
static symbol_record foobar; | static symbol_record foobar; | |||
symbol_table *inst = get_instance (xcurrent_scope); | symbol_table *inst = get_instance (scope); | |||
return inst ? inst->do_insert (name) : foobar; | return inst ? inst->do_insert (name) : foobar; | |||
} | } | |||
static void force_variable (const std::string& name, | static void rename (const std::string& old_name, | |||
scope_id scope = xcurrent_scope, | const std::string& new_name, | |||
context_id context = xcurrent_context) | scope_id scope = xcurrent_scope) | |||
{ | { | |||
symbol_table *inst = get_instance (scope); | symbol_table *inst = get_instance (scope); | |||
if (inst) | if (inst) | |||
inst->do_force_variable (name, context); | inst->do_rename (old_name, new_name); | |||
} | ||||
static void assign (const std::string& name, | ||||
const octave_value& value = octave_value (), | ||||
scope_id scope = xcurrent_scope, | ||||
context_id context = xdefault_context, | ||||
bool force_add = false) | ||||
{ | ||||
static octave_value foobar; | ||||
symbol_table *inst = get_instance (scope); | ||||
if (inst) | ||||
inst->do_assign (name, value, context, force_add); | ||||
} | } | |||
static octave_value& varref (const std::string& name, | // Use assign (name, value, scope, context, force_add) instead. | |||
scope_id scope = xcurrent_scope, | static octave_value& | |||
context_id context = xcurrent_context) | varref (const std::string& name, scope_id scope = xcurrent_scope, | |||
context_id context = xdefault_context, bool force_add = false) | ||||
GCC_ATTR_DEPRECATED | ||||
{ | ||||
static octave_value foobar; | ||||
symbol_table *inst = get_instance (scope); | ||||
return inst ? inst->do_varref (name, context, force_add) : foobar; | ||||
} | ||||
// Convenience function to simplify | ||||
// octave_user_function::bind_automatic_vars | ||||
static void force_assign (const std::string& name, | ||||
const octave_value& value = octave_value (), | ||||
scope_id scope = xcurrent_scope, | ||||
context_id context = xdefault_context) | ||||
{ | ||||
assign (name, value, scope, context, true); | ||||
} | ||||
// Use force_assign (name, value, scope, context) instead. | ||||
static octave_value& | ||||
force_varref (const std::string& name, scope_id scope = xcurrent_scope, | ||||
context_id context = xdefault_context) GCC_ATTR_DEPRECATED | ||||
{ | { | |||
static octave_value foobar; | static octave_value foobar; | |||
symbol_table *inst = get_instance (scope); | symbol_table *inst = get_instance (scope); | |||
return inst ? inst->do_varref (name, context) : foobar; | return inst ? inst->do_varref (name, context, true) : foobar; | |||
} | } | |||
static octave_value varval (const std::string& name, | static octave_value varval (const std::string& name, | |||
scope_id scope = xcurrent_scope, | scope_id scope = xcurrent_scope, | |||
context_id context = xcurrent_context) | context_id context = xdefault_context) | |||
{ | { | |||
symbol_table *inst = get_instance (scope); | symbol_table *inst = get_instance (scope); | |||
return inst ? inst->do_varval (name, context) : octave_value (); | return inst ? inst->do_varval (name, context) : octave_value (); | |||
} | } | |||
static void | ||||
global_assign (const std::string& name, | ||||
const octave_value& value = octave_value ()) | ||||
{ | ||||
global_table_iterator p = global_table.find (name); | ||||
if (p == global_table.end ()) | ||||
global_table[name] = value; | ||||
else | ||||
p->second = value; | ||||
} | ||||
// Use global_assign (name, value) instead. | ||||
static octave_value& | static octave_value& | |||
global_varref (const std::string& name) | global_varref (const std::string& name) GCC_ATTR_DEPRECATED | |||
{ | { | |||
global_table_iterator p = global_table.find (name); | global_table_iterator p = global_table.find (name); | |||
return (p == global_table.end ()) ? global_table[name] : p->second; | return (p == global_table.end ()) ? global_table[name] : p->second; | |||
} | } | |||
static octave_value | static octave_value | |||
global_varval (const std::string& name) | global_varval (const std::string& name) | |||
{ | { | |||
global_table_const_iterator p = global_table.find (name); | global_table_const_iterator p = global_table.find (name); | |||
return (p != global_table.end ()) ? p->second : octave_value (); | return (p != global_table.end ()) ? p->second : octave_value (); | |||
} | } | |||
static void | ||||
top_level_assign (const std::string& name, | ||||
const octave_value& value = octave_value ()) | ||||
{ | ||||
assign (name, value, top_scope (), 0); | ||||
} | ||||
// Use top_level_assign (name, value) instead. | ||||
static octave_value& | static octave_value& | |||
top_level_varref (const std::string& name) | top_level_varref (const std::string& name) GCC_ATTR_DEPRECATED | |||
{ | { | |||
return varref (name, top_scope (), 0); | static octave_value foobar; | |||
symbol_table *inst = get_instance (top_scope ()); | ||||
return inst ? inst->do_varref (name, 0, true) : foobar; | ||||
} | } | |||
static octave_value | static octave_value | |||
top_level_varval (const std::string& name) | top_level_varval (const std::string& name) | |||
{ | { | |||
return varval (name, top_scope (), 0); | return varval (name, top_scope (), 0); | |||
} | } | |||
static void | ||||
persistent_assign (const std::string& name, | ||||
const octave_value& value = octave_value ()) | ||||
{ | ||||
symbol_table *inst = get_instance (xcurrent_scope); | ||||
if (inst) | ||||
inst->do_persistent_assign (name, value); | ||||
} | ||||
// Use persistent_assign (name, value) instead. | ||||
static octave_value& persistent_varref (const std::string& name) | static octave_value& persistent_varref (const std::string& name) | |||
GCC_ATTR_DEPRECATED | ||||
{ | { | |||
static octave_value foobar; | static octave_value foobar; | |||
symbol_table *inst = get_instance (xcurrent_scope); | symbol_table *inst = get_instance (xcurrent_scope); | |||
return inst ? inst->do_persistent_varref (name) : foobar; | return inst ? inst->do_persistent_varref (name) : foobar; | |||
} | } | |||
static octave_value persistent_varval (const std::string& name) | static octave_value persistent_varval (const std::string& name) | |||
{ | { | |||
skipping to change at line 1198 | skipping to change at line 1497 | |||
return fcn; | return fcn; | |||
} | } | |||
} | } | |||
static octave_value | static octave_value | |||
find_built_in_function (const std::string& name) | find_built_in_function (const std::string& name) | |||
{ | { | |||
fcn_table_const_iterator p = fcn_table.find (name); | fcn_table_const_iterator p = fcn_table.find (name); | |||
return (p != fcn_table.end ()) | return (p != fcn_table.end ()) | |||
? p->second.find_built_in_function () : octave_value (); | ? p->second.find_built_in_function () : octave_value (); | |||
} | } | |||
static octave_value | static octave_value | |||
find_autoload (const std::string& name) | find_autoload (const std::string& name) | |||
{ | { | |||
fcn_table_iterator p = fcn_table.find (name); | fcn_table_iterator p = fcn_table.find (name); | |||
return (p != fcn_table.end ()) | return (p != fcn_table.end ()) | |||
? p->second.find_autoload () : octave_value (); | ? p->second.find_autoload () : octave_value (); | |||
} | } | |||
static octave_value | static octave_value | |||
find_function (const std::string& name, | find_function (const std::string& name, | |||
const octave_value_list& args = octave_value_list (), | const octave_value_list& args = octave_value_list (), | |||
bool local_funcs = true); | bool local_funcs = true); | |||
static octave_value find_user_function (const std::string& name) | static octave_value find_user_function (const std::string& name) | |||
{ | { | |||
fcn_table_iterator p = fcn_table.find (name); | fcn_table_iterator p = fcn_table.find (name); | |||
return (p != fcn_table.end ()) | return (p != fcn_table.end ()) | |||
? p->second.find_user_function () : octave_value (); | ? p->second.find_user_function () : octave_value (); | |||
} | } | |||
static void install_cmdline_function (const std::string& name, | static void install_cmdline_function (const std::string& name, | |||
const octave_value& fcn) | const octave_value& fcn) | |||
{ | { | |||
fcn_table_iterator p = fcn_table.find (name); | fcn_table_iterator p = fcn_table.find (name); | |||
if (p != fcn_table.end ()) | if (p != fcn_table.end ()) | |||
{ | { | |||
fcn_info& finfo = p->second; | fcn_info& finfo = p->second; | |||
skipping to change at line 1244 | skipping to change at line 1543 | |||
else | else | |||
{ | { | |||
fcn_info finfo (name); | fcn_info finfo (name); | |||
finfo.install_cmdline_function (fcn); | finfo.install_cmdline_function (fcn); | |||
fcn_table[name] = finfo; | fcn_table[name] = finfo; | |||
} | } | |||
} | } | |||
// Install subfunction FCN named NAME. SCOPE is the scope of the | ||||
// primary function corresponding to this subfunction. | ||||
static void install_subfunction (const std::string& name, | static void install_subfunction (const std::string& name, | |||
const octave_value& fcn, | const octave_value& fcn, | |||
scope_id scope) | scope_id scope) | |||
{ | { | |||
fcn_table_iterator p = fcn_table.find (name); | fcn_table_iterator p = fcn_table.find (name); | |||
if (p != fcn_table.end ()) | if (p != fcn_table.end ()) | |||
{ | { | |||
fcn_info& finfo = p->second; | fcn_info& finfo = p->second; | |||
skipping to change at line 1266 | skipping to change at line 1568 | |||
else | else | |||
{ | { | |||
fcn_info finfo (name); | fcn_info finfo (name); | |||
finfo.install_subfunction (fcn, scope); | finfo.install_subfunction (fcn, scope); | |||
fcn_table[name] = finfo; | fcn_table[name] = finfo; | |||
} | } | |||
} | } | |||
static void install_nestfunction (const std::string& name, | ||||
const octave_value& fcn, | ||||
scope_id parent_scope); | ||||
static void update_nest (scope_id scope) | ||||
{ | ||||
symbol_table *inst = get_instance (scope); | ||||
if (inst) | ||||
inst->do_update_nest (); | ||||
} | ||||
static void install_user_function (const std::string& name, | static void install_user_function (const std::string& name, | |||
const octave_value& fcn) | const octave_value& fcn) | |||
{ | { | |||
fcn_table_iterator p = fcn_table.find (name); | fcn_table_iterator p = fcn_table.find (name); | |||
if (p != fcn_table.end ()) | if (p != fcn_table.end ()) | |||
{ | { | |||
fcn_info& finfo = p->second; | fcn_info& finfo = p->second; | |||
finfo.install_user_function (fcn); | finfo.install_user_function (fcn); | |||
skipping to change at line 1313 | skipping to change at line 1626 | |||
fcn_table[name] = finfo; | fcn_table[name] = finfo; | |||
} | } | |||
} | } | |||
static void clear (const std::string& name) | static void clear (const std::string& name) | |||
{ | { | |||
clear_variable (name); | clear_variable (name); | |||
} | } | |||
static void clear_all (void) | static void clear_all (bool force = false) | |||
{ | { | |||
clear_variables (); | clear_variables (); | |||
clear_global_pattern ("*"); | clear_global_pattern ("*"); | |||
clear_functions (); | clear_functions (force); | |||
} | } | |||
static void clear_variables (scope_id scope) | static void clear_variables (scope_id scope) | |||
{ | { | |||
symbol_table *inst = get_instance (scope); | symbol_table *inst = get_instance (scope); | |||
if (inst) | if (inst) | |||
inst->do_clear_variables (); | inst->do_clear_variables (); | |||
} | } | |||
skipping to change at line 1344 | skipping to change at line 1657 | |||
} | } | |||
static void clear_objects (scope_id scope = xcurrent_scope) | static void clear_objects (scope_id scope = xcurrent_scope) | |||
{ | { | |||
symbol_table *inst = get_instance (scope); | symbol_table *inst = get_instance (scope); | |||
if (inst) | if (inst) | |||
inst->do_clear_objects (); | inst->do_clear_objects (); | |||
} | } | |||
static void unmark_forced_variables (scope_id scope = xcurrent_scope) | static void clear_functions (bool force = false) | |||
{ | ||||
symbol_table *inst = get_instance (scope); | ||||
if (inst) | ||||
inst->do_unmark_forced_variables (); | ||||
} | ||||
static void clear_functions (void) | ||||
{ | { | |||
for (fcn_table_iterator p = fcn_table.begin (); p != fcn_table.end (); p++) | for (fcn_table_iterator p = fcn_table.begin (); p != fcn_table.end (); p++) | |||
p->second.clear (); | p->second.clear (force); | |||
} | } | |||
static void clear_function (const std::string& name) | static void clear_function (const std::string& name) | |||
{ | { | |||
clear_user_function (name); | clear_user_function (name); | |||
} | } | |||
static void clear_global (const std::string& name) | static void clear_global (const std::string& name) | |||
{ | { | |||
symbol_table *inst = get_instance (xcurrent_scope); | symbol_table *inst = get_instance (xcurrent_scope); | |||
skipping to change at line 1381 | skipping to change at line 1686 | |||
static void clear_variable (const std::string& name) | static void clear_variable (const std::string& name) | |||
{ | { | |||
symbol_table *inst = get_instance (xcurrent_scope); | symbol_table *inst = get_instance (xcurrent_scope); | |||
if (inst) | if (inst) | |||
inst->do_clear_variable (name); | inst->do_clear_variable (name); | |||
} | } | |||
static void clear_symbol (const std::string& name) | static void clear_symbol (const std::string& name) | |||
{ | { | |||
// FIXME -- are we supposed to do both here? | // FIXME: are we supposed to do both here? | |||
clear_variable (name); | clear_variable (name); | |||
clear_function (name); | clear_function (name); | |||
} | } | |||
static void clear_function_pattern (const std::string& pat) | static void clear_function_pattern (const std::string& pat) | |||
{ | { | |||
glob_match pattern (pat); | glob_match pattern (pat); | |||
for (fcn_table_iterator p = fcn_table.begin (); p != fcn_table.end (); p++) | for (fcn_table_iterator p = fcn_table.begin (); p != fcn_table.end (); p++) | |||
skipping to change at line 1424 | skipping to change at line 1729 | |||
static void clear_variable_regexp (const std::string& pat) | static void clear_variable_regexp (const std::string& pat) | |||
{ | { | |||
symbol_table *inst = get_instance (xcurrent_scope); | symbol_table *inst = get_instance (xcurrent_scope); | |||
if (inst) | if (inst) | |||
inst->do_clear_variable_regexp (pat); | inst->do_clear_variable_regexp (pat); | |||
} | } | |||
static void clear_symbol_pattern (const std::string& pat) | static void clear_symbol_pattern (const std::string& pat) | |||
{ | { | |||
// FIXME -- are we supposed to do both here? | // FIXME: are we supposed to do both here? | |||
clear_variable_pattern (pat); | clear_variable_pattern (pat); | |||
clear_function_pattern (pat); | clear_function_pattern (pat); | |||
} | } | |||
static void clear_user_function (const std::string& name) | static void clear_user_function (const std::string& name) | |||
{ | { | |||
fcn_table_iterator p = fcn_table.find (name); | fcn_table_iterator p = fcn_table.find (name); | |||
if (p != fcn_table.end ()) | if (p != fcn_table.end ()) | |||
{ | { | |||
fcn_info& finfo = p->second; | fcn_info& finfo = p->second; | |||
finfo.clear_user_function (); | finfo.clear_user_function (); | |||
} | } | |||
// FIXME -- is this necessary, or even useful? | // FIXME: is this necessary, or even useful? | |||
// else | // else | |||
// error ("clear: no such function '%s'", name.c_str ()); | // error ("clear: no such function '%s'", name.c_str ()); | |||
} | } | |||
// This clears oct and mex files, incl. autoloads. | // This clears oct and mex files, incl. autoloads. | |||
static void clear_dld_function (const std::string& name) | static void clear_dld_function (const std::string& name) | |||
{ | { | |||
fcn_table_iterator p = fcn_table.find (name); | fcn_table_iterator p = fcn_table.find (name); | |||
if (p != fcn_table.end ()) | if (p != fcn_table.end ()) | |||
skipping to change at line 1621 | skipping to change at line 1926 | |||
} | } | |||
static void mark_global (const std::string& name) | static void mark_global (const std::string& name) | |||
{ | { | |||
symbol_table *inst = get_instance (xcurrent_scope); | symbol_table *inst = get_instance (xcurrent_scope); | |||
if (inst) | if (inst) | |||
inst->do_mark_global (name); | inst->do_mark_global (name); | |||
} | } | |||
// exclude: Storage classes to exclude, you can OR them together | ||||
static std::list<symbol_record> | static std::list<symbol_record> | |||
all_variables (scope_id scope = xcurrent_scope, | all_variables (scope_id scope = xcurrent_scope, | |||
context_id context = xcurrent_context, | context_id context = xdefault_context, | |||
bool defined_only = true) | bool defined_only = true, | |||
unsigned int exclude = symbol_record::hidden) | ||||
{ | { | |||
symbol_table *inst = get_instance (scope); | symbol_table *inst = get_instance (scope); | |||
return inst | return inst | |||
? inst->do_all_variables (context, defined_only) : std::list<symbol_r | ? inst->do_all_variables (context, defined_only, exclude) | |||
ecord> (); | : std::list<symbol_record> (); | |||
} | } | |||
static std::list<symbol_record> glob (const std::string& pattern) | static std::list<symbol_record> glob (const std::string& pattern) | |||
{ | { | |||
symbol_table *inst = get_instance (xcurrent_scope); | symbol_table *inst = get_instance (xcurrent_scope); | |||
return inst ? inst->do_glob (pattern) : std::list<symbol_record> (); | return inst ? inst->do_glob (pattern) : std::list<symbol_record> (); | |||
} | } | |||
static std::list<symbol_record> regexp (const std::string& pattern) | static std::list<symbol_record> regexp (const std::string& pattern) | |||
skipping to change at line 1675 | skipping to change at line 1983 | |||
glob_match pat (pattern); | glob_match pat (pattern); | |||
for (global_table_const_iterator p = global_table.begin (); | for (global_table_const_iterator p = global_table.begin (); | |||
p != global_table.end (); p++) | p != global_table.end (); p++) | |||
{ | { | |||
// We generate a list of symbol_record objects so that | // We generate a list of symbol_record objects so that | |||
// the results from glob_variables and glob_global_variables | // the results from glob_variables and glob_global_variables | |||
// may be handled the same way. | // may be handled the same way. | |||
if (pat.match (p->first)) | if (pat.match (p->first)) | |||
retval.push_back (symbol_record (p->first, p->second, | retval.push_back (symbol_record (xglobal_scope, | |||
p->first, p->second, | ||||
symbol_record::global)); | symbol_record::global)); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
static std::list<symbol_record> | static std::list<symbol_record> | |||
regexp_global_variables (const std::string& pattern) | regexp_global_variables (const std::string& pattern) | |||
{ | { | |||
std::list<symbol_record> retval; | std::list<symbol_record> retval; | |||
skipping to change at line 1697 | skipping to change at line 2006 | |||
::regexp pat (pattern); | ::regexp pat (pattern); | |||
for (global_table_const_iterator p = global_table.begin (); | for (global_table_const_iterator p = global_table.begin (); | |||
p != global_table.end (); p++) | p != global_table.end (); p++) | |||
{ | { | |||
// We generate a list of symbol_record objects so that | // We generate a list of symbol_record objects so that | |||
// the results from regexp_variables and regexp_global_variables | // the results from regexp_variables and regexp_global_variables | |||
// may be handled the same way. | // may be handled the same way. | |||
if (pat.is_match (p->first)) | if (pat.is_match (p->first)) | |||
retval.push_back (symbol_record (p->first, p->second, | retval.push_back (symbol_record (xglobal_scope, | |||
p->first, p->second, | ||||
symbol_record::global)); | symbol_record::global)); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
static std::list<symbol_record> glob_variables (const string_vector& patt erns) | static std::list<symbol_record> glob_variables (const string_vector& patt erns) | |||
{ | { | |||
std::list<symbol_record> retval; | std::list<symbol_record> retval; | |||
skipping to change at line 1843 | skipping to change at line 2153 | |||
if (xcurrent_scope == xglobal_scope) | if (xcurrent_scope == xglobal_scope) | |||
return true; | return true; | |||
else | else | |||
{ | { | |||
symbol_table *inst = get_instance (xcurrent_scope); | symbol_table *inst = get_instance (xcurrent_scope); | |||
return inst ? inst->do_is_global (name) : false; | return inst ? inst->do_is_global (name) : false; | |||
} | } | |||
} | } | |||
static std::list<workspace_element> workspace_info (void) | ||||
{ | ||||
symbol_table *inst = get_instance (xcurrent_scope); | ||||
return inst | ||||
? inst->do_workspace_info () : std::list<workspace_element> (); | ||||
} | ||||
static void dump (std::ostream& os, scope_id scope = xcurrent_scope); | static void dump (std::ostream& os, scope_id scope = xcurrent_scope); | |||
static void dump_global (std::ostream& os); | static void dump_global (std::ostream& os); | |||
static void dump_functions (std::ostream& os); | static void dump_functions (std::ostream& os); | |||
static void cache_name (scope_id scope, const std::string& name) | static void cache_name (scope_id scope, const std::string& name) | |||
{ | { | |||
symbol_table *inst = get_instance (scope, false); | symbol_table *inst = get_instance (scope, false); | |||
skipping to change at line 1871 | skipping to change at line 2189 | |||
p->second.lock_subfunction (scope); | p->second.lock_subfunction (scope); | |||
} | } | |||
static void unlock_subfunctions (scope_id scope = xcurrent_scope) | static void unlock_subfunctions (scope_id scope = xcurrent_scope) | |||
{ | { | |||
for (fcn_table_iterator p = fcn_table.begin (); | for (fcn_table_iterator p = fcn_table.begin (); | |||
p != fcn_table.end (); p++) | p != fcn_table.end (); p++) | |||
p->second.unlock_subfunction (scope); | p->second.unlock_subfunction (scope); | |||
} | } | |||
static std::map<std::string, octave_value> | ||||
subfunctions_defined_in_scope (scope_id scope = xcurrent_scope) | ||||
{ | ||||
std::map<std::string, octave_value> retval; | ||||
for (fcn_table_const_iterator p = fcn_table.begin (); | ||||
p != fcn_table.end (); p++) | ||||
{ | ||||
std::pair<std::string, octave_value> tmp | ||||
= p->second.subfunction_defined_in_scope (scope); | ||||
std::string nm = tmp.first; | ||||
if (! nm.empty ()) | ||||
retval[nm] = tmp.second; | ||||
} | ||||
return retval; | ||||
} | ||||
static void free_scope (scope_id scope) | static void free_scope (scope_id scope) | |||
{ | { | |||
if (scope == xglobal_scope || scope == xtop_scope) | if (scope == xglobal_scope || scope == xtop_scope) | |||
error ("can't free global or top-level scopes!"); | error ("can't free global or top-level scopes!"); | |||
else | else | |||
symbol_table::scope_id_cache::free (scope); | symbol_table::scope_id_cache::free (scope); | |||
} | } | |||
static void stash_dir_name_for_subfunctions (scope_id scope, | static void stash_dir_name_for_subfunctions (scope_id scope, | |||
const std::string& dir_name) ; | const std::string& dir_name) ; | |||
skipping to change at line 1903 | skipping to change at line 2241 | |||
const_parent_map_iterator it = parent_map.find (dispatch_type); | const_parent_map_iterator it = parent_map.find (dispatch_type); | |||
if (it != parent_map.end ()) | if (it != parent_map.end ()) | |||
retval = it->second; | retval = it->second; | |||
for (std::list<std::string>::const_iterator lit = retval.begin (); | for (std::list<std::string>::const_iterator lit = retval.begin (); | |||
lit != retval.end (); lit++) | lit != retval.end (); lit++) | |||
{ | { | |||
// Search for parents of parents and append them to the list. | // Search for parents of parents and append them to the list. | |||
// FIXME -- should we worry about a circular inheritance graph? | // FIXME: should we worry about a circular inheritance graph? | |||
std::list<std::string> parents = parent_classes (*lit); | std::list<std::string> parents = parent_classes (*lit); | |||
if (! parents.empty ()) | if (! parents.empty ()) | |||
retval.insert (retval.end (), parents.begin (), parents.end ()); | retval.insert (retval.end (), parents.begin (), parents.end ()); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
static octave_user_function *get_curr_fcn (scope_id scope = xcurrent_scop e) | static octave_user_function *get_curr_fcn (scope_id scope = xcurrent_scop e) | |||
{ | { | |||
symbol_table *inst = get_instance (scope); | symbol_table *inst = get_instance (scope); | |||
return inst->curr_fcn; | return inst->curr_fcn; | |||
} | } | |||
static void set_curr_fcn (octave_user_function *curr_fcn, | static void set_curr_fcn (octave_user_function *curr_fcn, | |||
scope_id scope = xcurrent_scope) | scope_id scope = xcurrent_scope) | |||
{ | { | |||
assert (scope != xtop_scope && scope != xglobal_scope); | assert (scope != xtop_scope && scope != xglobal_scope); | |||
symbol_table *inst = get_instance (scope); | symbol_table *inst = get_instance (scope); | |||
// FIXME: normally, functions should not usurp each other's scope. | // FIXME: normally, functions should not usurp each other's scope. | |||
// If for any incredible reason this is needed, call | // If for any incredible reason this is needed, call | |||
// set_user_function (0, scope) first. | // set_user_function (0, scope) first. This may cause problems with | |||
assert (inst->curr_fcn == 0 || curr_fcn == 0); | // nested functions, as the curr_fcn of symbol_records must be updated. | |||
inst->curr_fcn = curr_fcn; | assert (inst->curr_fcn == 0 || curr_fcn == 0); | |||
} | inst->curr_fcn = curr_fcn; | |||
} | ||||
static void cleanup (void); | static void cleanup (void); | |||
private: | private: | |||
// No copying! | // No copying! | |||
symbol_table (const symbol_table&); | symbol_table (const symbol_table&); | |||
symbol_table& operator = (const symbol_table&); | symbol_table& operator = (const symbol_table&); | |||
typedef std::map<std::string, symbol_record>::const_iterator table_const_ | typedef std::map<std::string, symbol_record>::const_iterator | |||
iterator; | table_const_iterator; | |||
typedef std::map<std::string, symbol_record>::iterator table_iterator; | typedef std::map<std::string, symbol_record>::iterator | |||
table_iterator; | ||||
typedef std::map<std::string, octave_value>::const_iterator global_table_ | ||||
const_iterator; | typedef std::map<std::string, octave_value>::const_iterator | |||
typedef std::map<std::string, octave_value>::iterator global_table_iterat | global_table_const_iterator; | |||
or; | typedef std::map<std::string, octave_value>::iterator | |||
global_table_iterator; | ||||
typedef std::map<std::string, octave_value>::const_iterator persistent_ta | ||||
ble_const_iterator; | typedef std::map<std::string, octave_value>::const_iterator | |||
typedef std::map<std::string, octave_value>::iterator persistent_table_it | persistent_table_const_iterator; | |||
erator; | typedef std::map<std::string, octave_value>::iterator | |||
persistent_table_iterator; | ||||
typedef std::map<scope_id, symbol_table*>::const_iterator | ||||
all_instances_const_iterator; | ||||
typedef std::map<scope_id, symbol_table*>::iterator | ||||
all_instances_iterator; | ||||
typedef std::map<std::string, fcn_info>::const_iterator | ||||
fcn_table_const_iterator; | ||||
typedef std::map<std::string, fcn_info>::iterator | ||||
fcn_table_iterator; | ||||
typedef std::map<scope_id, symbol_table*>::const_iterator all_instances_c | // The scope of this symbol table. | |||
onst_iterator; | scope_id my_scope; | |||
typedef std::map<scope_id, symbol_table*>::iterator all_instances_iterato | ||||
r; | ||||
typedef std::map<std::string, fcn_info>::const_iterator fcn_table_const_i | ||||
terator; | ||||
typedef std::map<std::string, fcn_info>::iterator fcn_table_iterator; | ||||
// Name for this table (usually the file name of the function | // Name for this table (usually the file name of the function | |||
// corresponding to the scope); | // corresponding to the scope); | |||
std::string table_name; | std::string table_name; | |||
// Map from symbol names to symbol info. | // Map from symbol names to symbol info. | |||
std::map<std::string, symbol_record> table; | std::map<std::string, symbol_record> table; | |||
// Child nested functions. | ||||
std::vector<symbol_table*> nest_children; | ||||
// Parent nested function (may be null). | ||||
symbol_table *nest_parent; | ||||
// The associated user code (may be null). | // The associated user code (may be null). | |||
octave_user_function *curr_fcn; | octave_user_function *curr_fcn; | |||
// If true then no variables can be added. | ||||
bool static_workspace; | ||||
// Map from names of global variables to values. | // Map from names of global variables to values. | |||
static std::map<std::string, octave_value> global_table; | static std::map<std::string, octave_value> global_table; | |||
// Map from names of persistent variables to values. | // Map from names of persistent variables to values. | |||
std::map<std::string, octave_value> persistent_table; | std::map<std::string, octave_value> persistent_table; | |||
// Pointer to symbol table for current scope (variables only). | // Pointer to symbol table for current scope (variables only). | |||
static symbol_table *instance; | static symbol_table *instance; | |||
// Map from scope id to symbol table instances. | // Map from scope id to symbol table instances. | |||
static std::map<scope_id, symbol_table*> all_instances; | static std::map<scope_id, symbol_table*> all_instances; | |||
// Map from function names to function info (subfunctions, private | // Map from function names to function info (subfunctions, private | |||
// functions, class constructors, class methods, etc.) | // functions, class constructors, class methods, etc.) | |||
static std::map<std::string, fcn_info> fcn_table; | static std::map<std::string, fcn_info> fcn_table; | |||
// Mape from class names to set of classes that have lower | // Mape from class names to set of classes that have lower | |||
// precedence. | // precedence. | |||
static std::map<std::string, std::set<std::string> > class_precedence_tab le; | static std::map<std::string, std::set<std::string> > class_precedence_tab le; | |||
typedef std::map<std::string, std::set<std::string> >::const_iterator cla | typedef std::map<std::string, std::set<std::string> >::const_iterator | |||
ss_precedence_table_const_iterator; | class_precedence_table_const_iterator; | |||
typedef std::map<std::string, std::set<std::string> >::iterator class_pre | typedef std::map<std::string, std::set<std::string> >::iterator | |||
cedence_table_iterator; | class_precedence_table_iterator; | |||
// Map from class names to parent class names. | // Map from class names to parent class names. | |||
static std::map<std::string, std::list<std::string> > parent_map; | static std::map<std::string, std::list<std::string> > parent_map; | |||
typedef std::map<std::string, std::list<std::string> >::const_iterator co | typedef std::map<std::string, std::list<std::string> >::const_iterator | |||
nst_parent_map_iterator; | const_parent_map_iterator; | |||
typedef std::map<std::string, std::list<std::string> >::iterator parent_m | typedef std::map<std::string, std::list<std::string> >::iterator | |||
ap_iterator; | parent_map_iterator; | |||
static const scope_id xglobal_scope; | static const scope_id xglobal_scope; | |||
static const scope_id xtop_scope; | static const scope_id xtop_scope; | |||
static scope_id xcurrent_scope; | static scope_id xcurrent_scope; | |||
static context_id xcurrent_context; | static context_id xcurrent_context; | |||
symbol_table (void) | static const context_id xdefault_context = static_cast<context_id> (-1); | |||
: table_name (), table (), curr_fcn (0), persistent_table () { } | ||||
symbol_table (scope_id scope) | ||||
: my_scope (scope), table_name (), table (), nest_children (), | ||||
nest_parent (0), curr_fcn (0), static_workspace (false), | ||||
persistent_table () { } | ||||
~symbol_table (void) { } | ~symbol_table (void) { } | |||
static symbol_table *get_instance (scope_id scope, bool create = true) | static symbol_table *get_instance (scope_id scope, bool create = true) | |||
{ | { | |||
symbol_table *retval = 0; | symbol_table *retval = 0; | |||
bool ok = true; | bool ok = true; | |||
if (scope != xglobal_scope) | if (scope != xglobal_scope) | |||
{ | { | |||
if (scope == xcurrent_scope) | if (scope == xcurrent_scope) | |||
{ | { | |||
if (! instance && create) | if (! instance && create) | |||
{ | { | |||
symbol_table *inst = new symbol_table (); | symbol_table *inst = new symbol_table (scope); | |||
if (inst) | if (inst) | |||
{ | { | |||
all_instances[scope] = instance = inst; | all_instances[scope] = instance = inst; | |||
if (scope == xtop_scope) | if (scope == xtop_scope) | |||
instance->do_cache_name ("top-level"); | instance->do_cache_name ("top-level"); | |||
} | } | |||
} | } | |||
skipping to change at line 2044 | skipping to change at line 2413 | |||
retval = instance; | retval = instance; | |||
} | } | |||
else | else | |||
{ | { | |||
all_instances_iterator p = all_instances.find (scope); | all_instances_iterator p = all_instances.find (scope); | |||
if (p == all_instances.end ()) | if (p == all_instances.end ()) | |||
{ | { | |||
if (create) | if (create) | |||
{ | { | |||
retval = new symbol_table (); | retval = new symbol_table (scope); | |||
if (retval) | if (retval) | |||
all_instances[scope] = retval; | all_instances[scope] = retval; | |||
else | else | |||
ok = false; | ok = false; | |||
} | } | |||
else | else | |||
ok = false; | ok = false; | |||
} | } | |||
else | else | |||
skipping to change at line 2066 | skipping to change at line 2435 | |||
} | } | |||
} | } | |||
if (! ok) | if (! ok) | |||
error ("unable to %s symbol_table object for scope %d!", | error ("unable to %s symbol_table object for scope %d!", | |||
create ? "create" : "find", scope); | create ? "create" : "find", scope); | |||
return retval; | return retval; | |||
} | } | |||
void add_nest_child (symbol_table& st) | ||||
{ | ||||
assert (!st.nest_parent); | ||||
nest_children.push_back (&st); | ||||
st.nest_parent = this; | ||||
} | ||||
void insert_symbol_record (const symbol_record& sr) | void insert_symbol_record (const symbol_record& sr) | |||
{ | { | |||
table[sr.name ()] = sr; | table[sr.name ()] = sr; | |||
} | } | |||
void | void | |||
do_dup_scope (symbol_table& new_symbol_table) const | do_dup_scope (symbol_table& new_symbol_table) const | |||
{ | { | |||
for (table_const_iterator p = table.begin (); p != table.end (); p++) | for (table_const_iterator p = table.begin (); p != table.end (); p++) | |||
new_symbol_table.insert_symbol_record (p->second.dup ()); | new_symbol_table.insert_symbol_record (p->second.dup (new_symbol_tabl | |||
e | ||||
.my_scope)); | ||||
} | } | |||
symbol_record do_find_symbol (const std::string& name) | symbol_record do_find_symbol (const std::string& name) | |||
{ | { | |||
table_iterator p = table.find (name); | table_iterator p = table.find (name); | |||
if (p == table.end ()) | if (p == table.end ()) | |||
return do_insert (name); | return do_insert (name); | |||
else | else | |||
return p->second; | return p->second; | |||
skipping to change at line 2104 | skipping to change at line 2481 | |||
if (! (sr.is_automatic () || sr.is_formal ())) | if (! (sr.is_automatic () || sr.is_formal ())) | |||
{ | { | |||
std::string nm = sr.name (); | std::string nm = sr.name (); | |||
if (nm != "__retval__") | if (nm != "__retval__") | |||
{ | { | |||
octave_value val = donor_table.do_varval (nm, donor_context ); | octave_value val = donor_table.do_varval (nm, donor_context ); | |||
if (val.is_defined ()) | if (val.is_defined ()) | |||
{ | { | |||
sr.varref (0) = val; | sr.assign (val, 0); | |||
sr.mark_inherited (); | sr.mark_inherited (); | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
static fcn_info *get_fcn_info (const std::string& name) | static fcn_info *get_fcn_info (const std::string& name) | |||
{ | { | |||
fcn_table_iterator p = fcn_table.find (name); | fcn_table_iterator p = fcn_table.find (name); | |||
return p != fcn_table.end () ? &p->second : 0; | return p != fcn_table.end () ? &p->second : 0; | |||
} | } | |||
octave_value | octave_value | |||
do_find (const std::string& name, const octave_value_list& args, | do_find (const std::string& name, const octave_value_list& args, | |||
bool skip_variables, bool local_funcs); | bool skip_variables, bool local_funcs); | |||
octave_value do_builtin_find (const std::string& name); | octave_value do_builtin_find (const std::string& name); | |||
symbol_record& do_insert (const std::string& name) | symbol_record& do_insert (const std::string& name, bool force_add = false ) | |||
{ | { | |||
table_iterator p = table.find (name); | table_iterator p = table.find (name); | |||
return p == table.end () | if (p == table.end ()) | |||
? (table[name] = symbol_record (name)) : p->second; | { | |||
symbol_record ret (my_scope, name); | ||||
if (nest_parent && nest_parent->look_nonlocal (name, ret)) | ||||
return table[name] = ret; | ||||
else | ||||
{ | ||||
if (static_workspace && ! force_add) | ||||
ret.mark_added_static (); | ||||
return table[name] = ret; | ||||
} | ||||
} | ||||
else | ||||
return p->second; | ||||
} | } | |||
void do_force_variable (const std::string& name, context_id context) | void do_rename (const std::string& old_name, const std::string& new_name) | |||
{ | ||||
table_iterator p = table.find (old_name); | ||||
if (p != table.end ()) | ||||
{ | ||||
symbol_record sr = p->second; | ||||
sr.rename (new_name); | ||||
table.erase (p); | ||||
table[new_name] = sr; | ||||
} | ||||
} | ||||
void do_assign (const std::string& name, const octave_value& value, | ||||
context_id context, bool force_add) | ||||
{ | { | |||
table_iterator p = table.find (name); | table_iterator p = table.find (name); | |||
if (p == table.end ()) | if (p == table.end ()) | |||
{ | { | |||
symbol_record& sr = do_insert (name); | symbol_record& sr = do_insert (name, force_add); | |||
sr.force_variable (context); | sr.assign (value, context); | |||
} | } | |||
else | else | |||
p->second.force_variable (context); | p->second.assign (value, context); | |||
} | } | |||
octave_value& do_varref (const std::string& name, context_id context) | // Use do_assign (name, value, context, force_add) instead. | |||
// Delete when deprecated varref functions are removed. | ||||
octave_value& do_varref (const std::string& name, context_id context, | ||||
bool force_add) | ||||
{ | { | |||
table_iterator p = table.find (name); | table_iterator p = table.find (name); | |||
if (p == table.end ()) | if (p == table.end ()) | |||
{ | { | |||
symbol_record& sr = do_insert (name); | symbol_record& sr = do_insert (name, force_add); | |||
return sr.varref (context); | return sr.varref (context); | |||
} | } | |||
else | else | |||
return p->second.varref (context); | return p->second.varref (context); | |||
} | } | |||
octave_value do_varval (const std::string& name, context_id context) cons t | octave_value do_varval (const std::string& name, context_id context) cons t | |||
{ | { | |||
table_const_iterator p = table.find (name); | table_const_iterator p = table.find (name); | |||
return (p != table.end ()) ? p->second.varval (context) : octave_value (); | return (p != table.end ()) ? p->second.varval (context) : octave_value (); | |||
} | } | |||
void do_persistent_assign (const std::string& name, const octave_value& v | ||||
alue) | ||||
{ | ||||
persistent_table_iterator p = persistent_table.find (name); | ||||
if (p == persistent_table.end ()) | ||||
persistent_table[name] = value; | ||||
else | ||||
p->second = value; | ||||
} | ||||
// Use do_persistent_assign (name, value) instead. | ||||
// Delete when deprecated varref functions are removed. | ||||
octave_value& do_persistent_varref (const std::string& name) | octave_value& do_persistent_varref (const std::string& name) | |||
{ | { | |||
persistent_table_iterator p = persistent_table.find (name); | persistent_table_iterator p = persistent_table.find (name); | |||
return (p == persistent_table.end ()) | return (p == persistent_table.end ()) | |||
? persistent_table[name] : p->second; | ? persistent_table[name] : p->second; | |||
} | } | |||
octave_value do_persistent_varval (const std::string& name) | octave_value do_persistent_varval (const std::string& name) | |||
{ | { | |||
persistent_table_const_iterator p = persistent_table.find (name); | persistent_table_const_iterator p = persistent_table.find (name); | |||
return (p != persistent_table.end ()) ? p->second : octave_value (); | return (p != persistent_table.end ()) ? p->second : octave_value (); | |||
} | } | |||
void do_erase_persistent (const std::string& name) | void do_erase_persistent (const std::string& name) | |||
skipping to change at line 2210 | skipping to change at line 2633 | |||
retval = sr.is_variable (); | retval = sr.is_variable (); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
void do_push_context (void) | void do_push_context (void) | |||
{ | { | |||
for (table_iterator p = table.begin (); p != table.end (); p++) | for (table_iterator p = table.begin (); p != table.end (); p++) | |||
p->second.push_context (); | p->second.push_context (my_scope); | |||
} | } | |||
void do_pop_context (void) | void do_pop_context (void) | |||
{ | { | |||
for (table_iterator p = table.begin (); p != table.end (); ) | table_iterator p = table.begin (); | |||
while (p != table.end ()) | ||||
{ | { | |||
if (p->second.pop_context () == 0) | if (p->second.pop_context (my_scope) == 0) | |||
table.erase (p++); | table.erase (p++); | |||
else | else | |||
p++; | p++; | |||
} | } | |||
} | } | |||
void do_clear_variables (void) | void do_clear_variables (void) | |||
{ | { | |||
for (table_iterator p = table.begin (); p != table.end (); p++) | for (table_iterator p = table.begin (); p != table.end (); p++) | |||
p->second.clear (); | p->second.clear (my_scope); | |||
} | } | |||
void do_clear_objects (void) | void do_clear_objects (void) | |||
{ | { | |||
for (table_iterator p = table.begin (); p != table.end (); p++) | for (table_iterator p = table.begin (); p != table.end (); p++) | |||
{ | { | |||
symbol_record& sr = p->second; | symbol_record& sr = p->second; | |||
octave_value& val = sr.varref (); | octave_value val = sr.varval (); | |||
if (val.is_object()) | if (val.is_object ()) | |||
p->second.clear (); | p->second.clear (my_scope); | |||
} | } | |||
} | } | |||
void do_unmark_forced_variables (void) | ||||
{ | ||||
for (table_iterator p = table.begin (); p != table.end (); p++) | ||||
p->second.unmark_forced (); | ||||
} | ||||
void do_clear_global (const std::string& name) | void do_clear_global (const std::string& name) | |||
{ | { | |||
table_iterator p = table.find (name); | table_iterator p = table.find (name); | |||
if (p != table.end ()) | if (p != table.end ()) | |||
{ | { | |||
symbol_record& sr = p->second; | symbol_record& sr = p->second; | |||
if (sr.is_global ()) | if (sr.is_global ()) | |||
sr.unmark_global (); | sr.unmark_global (); | |||
skipping to change at line 2271 | skipping to change at line 2690 | |||
if (q != global_table.end ()) | if (q != global_table.end ()) | |||
global_table.erase (q); | global_table.erase (q); | |||
} | } | |||
void do_clear_variable (const std::string& name) | void do_clear_variable (const std::string& name) | |||
{ | { | |||
table_iterator p = table.find (name); | table_iterator p = table.find (name); | |||
if (p != table.end ()) | if (p != table.end ()) | |||
p->second.clear (); | p->second.clear (my_scope); | |||
} | } | |||
void do_clear_global_pattern (const std::string& pat) | void do_clear_global_pattern (const std::string& pat) | |||
{ | { | |||
glob_match pattern (pat); | glob_match pattern (pat); | |||
for (table_iterator p = table.begin (); p != table.end (); p++) | for (table_iterator p = table.begin (); p != table.end (); p++) | |||
{ | { | |||
symbol_record& sr = p->second; | symbol_record& sr = p->second; | |||
if (sr.is_global () && pattern.match (sr.name ())) | if (sr.is_global () && pattern.match (sr.name ())) | |||
sr.unmark_global (); | sr.unmark_global (); | |||
} | } | |||
for (global_table_iterator q = global_table.begin (); | global_table_iterator q = global_table.begin (); | |||
q != global_table.end ();) | ||||
while (q != global_table.end ()) | ||||
{ | { | |||
if (pattern.match (q->first)) | if (pattern.match (q->first)) | |||
global_table.erase (q++); //Gotta be careful to not | global_table.erase (q++); | |||
//invalidate iterators | ||||
else | else | |||
q++; | q++; | |||
} | } | |||
} | } | |||
void do_clear_variable_pattern (const std::string& pat) | void do_clear_variable_pattern (const std::string& pat) | |||
{ | { | |||
glob_match pattern (pat); | glob_match pattern (pat); | |||
for (table_iterator p = table.begin (); p != table.end (); p++) | for (table_iterator p = table.begin (); p != table.end (); p++) | |||
{ | { | |||
symbol_record& sr = p->second; | symbol_record& sr = p->second; | |||
if (sr.is_defined () || sr.is_global ()) | if (sr.is_defined () || sr.is_global ()) | |||
{ | { | |||
if (pattern.match (sr.name ())) | if (pattern.match (sr.name ())) | |||
sr.clear (); | sr.clear (my_scope); | |||
} | } | |||
} | } | |||
} | } | |||
void do_clear_variable_regexp (const std::string& pat) | void do_clear_variable_regexp (const std::string& pat) | |||
{ | { | |||
::regexp pattern (pat); | ::regexp pattern (pat); | |||
for (table_iterator p = table.begin (); p != table.end (); p++) | for (table_iterator p = table.begin (); p != table.end (); p++) | |||
{ | { | |||
symbol_record& sr = p->second; | symbol_record& sr = p->second; | |||
if (sr.is_defined () || sr.is_global ()) | if (sr.is_defined () || sr.is_global ()) | |||
{ | { | |||
if (pattern.is_match (sr.name ())) | if (pattern.is_match (sr.name ())) | |||
sr.clear (); | sr.clear (my_scope); | |||
} | } | |||
} | } | |||
} | } | |||
void do_mark_automatic (const std::string& name) | void do_mark_automatic (const std::string& name) | |||
{ | { | |||
do_insert (name).mark_automatic (); | do_insert (name).mark_automatic (); | |||
} | } | |||
void do_mark_hidden (const std::string& name) | void do_mark_hidden (const std::string& name) | |||
{ | { | |||
do_insert (name).mark_hidden (); | do_insert (name).mark_hidden (); | |||
} | } | |||
void do_mark_global (const std::string& name) | void do_mark_global (const std::string& name) | |||
{ | { | |||
do_insert (name).mark_global (); | do_insert (name).mark_global (); | |||
} | } | |||
std::list<symbol_record> | std::list<symbol_record> | |||
do_all_variables (context_id context, bool defined_only) const | do_all_variables (context_id context, bool defined_only, | |||
unsigned int exclude) const | ||||
{ | { | |||
std::list<symbol_record> retval; | std::list<symbol_record> retval; | |||
for (table_const_iterator p = table.begin (); p != table.end (); p++) | for (table_const_iterator p = table.begin (); p != table.end (); p++) | |||
{ | { | |||
const symbol_record& sr = p->second; | const symbol_record& sr = p->second; | |||
if (defined_only && ! sr.is_defined (context)) | if ((defined_only && ! sr.is_defined (context)) | |||
|| (sr.xstorage_class () & exclude)) | ||||
continue; | continue; | |||
retval.push_back (sr); | retval.push_back (sr); | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
std::list<symbol_record> do_glob (const std::string& pattern, | std::list<symbol_record> do_glob (const std::string& pattern, | |||
bool vars_only = false) const | bool vars_only = false) const | |||
skipping to change at line 2424 | skipping to change at line 2845 | |||
{ | { | |||
if (p->second.is_variable ()) | if (p->second.is_variable ()) | |||
retval.push_back (p->first); | retval.push_back (p->first); | |||
} | } | |||
retval.sort (); | retval.sort (); | |||
return retval; | return retval; | |||
} | } | |||
static std::map<std::string, octave_value> | ||||
subfunctions_defined_in_scope (scope_id scope = xcurrent_scope) | ||||
{ | ||||
std::map<std::string, octave_value> retval; | ||||
for (fcn_table_const_iterator p = fcn_table.begin (); | ||||
p != fcn_table.end (); p++) | ||||
{ | ||||
std::pair<std::string, octave_value> tmp | ||||
= p->second.subfunction_defined_in_scope (scope); | ||||
std::string nm = tmp.first; | ||||
if (! nm.empty ()) | ||||
retval[nm] = tmp.second; | ||||
} | ||||
return retval; | ||||
} | ||||
bool do_is_local_variable (const std::string& name) const | bool do_is_local_variable (const std::string& name) const | |||
{ | { | |||
table_const_iterator p = table.find (name); | table_const_iterator p = table.find (name); | |||
return (p != table.end () | return (p != table.end () | |||
&& ! p->second.is_global () | && ! p->second.is_global () | |||
&& p->second.is_defined ()); | && p->second.is_defined ()); | |||
} | } | |||
bool do_is_global (const std::string& name) const | bool do_is_global (const std::string& name) const | |||
{ | { | |||
table_const_iterator p = table.find (name); | table_const_iterator p = table.find (name); | |||
return p != table.end () && p->second.is_global (); | return p != table.end () && p->second.is_global (); | |||
} | } | |||
std::list<workspace_element> do_workspace_info (void) const; | ||||
void do_dump (std::ostream& os); | void do_dump (std::ostream& os); | |||
void do_cache_name (const std::string& name) { table_name = name; } | void do_cache_name (const std::string& name) { table_name = name; } | |||
void do_update_nest (void); | ||||
bool look_nonlocal (const std::string& name, symbol_record& result) | ||||
{ | ||||
table_iterator p = table.find (name); | ||||
if (p == table.end ()) | ||||
{ | ||||
if (nest_parent) | ||||
return nest_parent->look_nonlocal (name, result); | ||||
} | ||||
else if (! p->second.is_automatic ()) | ||||
{ | ||||
result = p->second; | ||||
return true; | ||||
} | ||||
return false; | ||||
} | ||||
}; | }; | |||
extern bool out_of_date_check (octave_value& function, | extern bool out_of_date_check (octave_value& function, | |||
const std::string& dispatch_type = std::stri ng (), | const std::string& dispatch_type = std::stri ng (), | |||
bool check_relative = true); | bool check_relative = true); | |||
extern OCTINTERP_API std::string | extern OCTINTERP_API std::string | |||
get_dispatch_type (const octave_value_list& args); | get_dispatch_type (const octave_value_list& args); | |||
extern OCTINTERP_API std::string | extern OCTINTERP_API std::string | |||
get_dispatch_type (const octave_value_list& args, builtin_type_t& builtin_t ype); | get_dispatch_type (const octave_value_list& args, builtin_type_t& builtin_t ype); | |||
End of changes. 157 change blocks. | ||||
246 lines changed or deleted | 655 lines changed or added | |||
sysdep.h | sysdep.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 33 | skipping to change at line 33 | |||
#if !defined (octave_sysdep_h) | #if !defined (octave_sysdep_h) | |||
#define octave_sysdep_h 1 | #define octave_sysdep_h 1 | |||
#include <cstdio> | #include <cstdio> | |||
#include <string> | #include <string> | |||
#include "lo-ieee.h" | #include "lo-ieee.h" | |||
#include "lo-sysdep.h" | #include "lo-sysdep.h" | |||
extern void sysdep_init (void); | extern OCTINTERP_API void sysdep_init (void); | |||
extern void sysdep_cleanup (void); | extern OCTINTERP_API void sysdep_cleanup (void); | |||
extern OCTINTERP_API void raw_mode (bool, bool wait = true); | extern OCTINTERP_API void raw_mode (bool, bool wait = true); | |||
extern OCTINTERP_API FILE *octave_popen (const char *command, const char *m ode); | extern OCTINTERP_API FILE *octave_popen (const char *command, const char *m ode); | |||
extern OCTINTERP_API int octave_pclose (FILE *f); | extern OCTINTERP_API int octave_pclose (FILE *f); | |||
extern OCTINTERP_API int octave_kbhit (bool wait = true); | extern OCTINTERP_API int octave_kbhit (bool wait = true); | |||
extern OCTINTERP_API std::string get_P_tmpdir (void); | extern OCTINTERP_API std::string get_P_tmpdir (void); | |||
extern void w32_set_quiet_shutdown (void); | extern void w32_set_quiet_shutdown (void); | |||
#if defined (__WIN32__) && ! defined (_POSIX_VERSION) | #if defined (__WIN32__) && ! defined (_POSIX_VERSION) | |||
extern void MINGW_signal_cleanup (void); | extern void MINGW_signal_cleanup (void); | |||
#define USE_W32_SIGINT 1 | ||||
#define MINGW_SIGNAL_CLEANUP() MINGW_signal_cleanup () | #define MINGW_SIGNAL_CLEANUP() MINGW_signal_cleanup () | |||
#else | #else | |||
#define MINGW_SIGNAL_CLEANUP() do { } while (0) | #define MINGW_SIGNAL_CLEANUP() do { } while (0) | |||
#endif | #endif | |||
extern OCTINTERP_API bool same_file_internal (const std::string&, const std | extern OCTINTERP_API bool same_file_internal (const std::string&, | |||
::string&); | const std::string&); | |||
#endif | #endif | |||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 5 lines changed or added | |||
sysdir.h | sysdir.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1995-2012 John W. Eaton | Copyright (C) 1995-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
syswait.h | syswait.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1996-2012 John W. Eaton | Copyright (C) 1996-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
token.h | token.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 28 | skipping to change at line 28 | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_token_h) | #if !defined (octave_token_h) | |||
#define octave_token_h 1 | #define octave_token_h 1 | |||
#include <string> | #include <string> | |||
#include "symtab.h" | ||||
class | class | |||
token | token | |||
{ | { | |||
public: | public: | |||
enum token_type | enum token_type | |||
{ | { | |||
generic_token, | generic_token, | |||
string_token, | keyword_token, | |||
double_token, | string_token, | |||
ettype_token, | double_token, | |||
sym_rec_token, | ettype_token, | |||
scls_rec_token, | sym_rec_token, | |||
meta_rec_token | scls_rec_token, | |||
}; | meta_rec_token | |||
}; | ||||
enum end_tok_type | enum end_tok_type | |||
{ | { | |||
simple_end, | simple_end, | |||
classdef_end, | classdef_end, | |||
enumeration_end, | enumeration_end, | |||
events_end, | events_end, | |||
for_end, | for_end, | |||
function_end, | function_end, | |||
if_end, | if_end, | |||
methods_end, | methods_end, | |||
parfor_end, | parfor_end, | |||
properties_end, | properties_end, | |||
switch_end, | switch_end, | |||
while_end, | while_end, | |||
try_catch_end, | try_catch_end, | |||
unwind_protect_end | unwind_protect_end | |||
}; | }; | |||
token (int l = -1, int c = -1); | token (int tv, int l = -1, int c = -1); | |||
token (const std::string& s, int l = -1, int c = -1); | token (int tv, bool is_keyword, int l = -1, int c = -1); | |||
token (double d, const std::string& s = std::string (), | token (int tv, const std::string& s, int l = -1, int c = -1); | |||
token (int tv, double d, const std::string& s = std::string (), | ||||
int l = -1, int c = -1); | int l = -1, int c = -1); | |||
token (end_tok_type t, int l = -1, int c = -1); | token (int tv, end_tok_type t, int l = -1, int c = -1); | |||
token (symbol_table::symbol_record *s, int l = -1, int c = -1); | token (int tv, symbol_table::symbol_record *s, int l = -1, int c = -1); | |||
token (symbol_table::symbol_record *cls, | token (int tv, symbol_table::symbol_record *cls, | |||
symbol_table::symbol_record *pkg, int l = -1, int c = -1); | symbol_table::symbol_record *pkg, int l = -1, int c = -1); | |||
token (symbol_table::symbol_record *mth, | token (int tv, symbol_table::symbol_record *mth, | |||
symbol_table::symbol_record *cls, | symbol_table::symbol_record *cls, | |||
symbol_table::symbol_record *pkg, int l = -1, int c = -1); | symbol_table::symbol_record *pkg, int l = -1, int c = -1); | |||
~token (void); | ~token (void); | |||
int line (void) { return line_num; } | void mark_may_be_command (void) { maybe_cmd = true; } | |||
int column (void) { return column_num; } | bool may_be_command (void) const { return maybe_cmd; } | |||
std::string text (void); | void mark_trailing_space (void) { tspc = true; } | |||
double number (void); | bool space_follows_token (void) const { return tspc; } | |||
end_tok_type ettype (void); | ||||
int token_value (void) const { return tok_val; } | ||||
bool token_value_is (int tv) const { return tv == tok_val; } | ||||
int line (void) const { return line_num; } | ||||
int column (void) const { return column_num; } | ||||
bool is_keyword (void) const | ||||
{ | ||||
return type_tag == keyword_token || type_tag == ettype_token; | ||||
} | ||||
bool is_symbol (void) const | ||||
{ | ||||
return type_tag == sym_rec_token; | ||||
} | ||||
std::string text (void) const; | ||||
std::string symbol_name (void) const; | ||||
double number (void) const; | ||||
token_type ttype (void) const; | ||||
end_tok_type ettype (void) const; | ||||
symbol_table::symbol_record *sym_rec (void); | symbol_table::symbol_record *sym_rec (void); | |||
symbol_table::symbol_record *method_rec (void); | symbol_table::symbol_record *method_rec (void); | |||
symbol_table::symbol_record *class_rec (void); | symbol_table::symbol_record *class_rec (void); | |||
symbol_table::symbol_record *package_rec (void); | symbol_table::symbol_record *package_rec (void); | |||
symbol_table::symbol_record *meta_class_rec (void); | symbol_table::symbol_record *meta_class_rec (void); | |||
symbol_table::symbol_record *meta_package_rec (void); | symbol_table::symbol_record *meta_package_rec (void); | |||
std::string text_rep (void); | std::string text_rep (void); | |||
private: | private: | |||
// No copying! | // No copying! | |||
token (const token& tok); | token (const token& tok); | |||
token& operator = (const token& tok); | token& operator = (const token& tok); | |||
bool maybe_cmd; | ||||
bool tspc; | ||||
int line_num; | int line_num; | |||
int column_num; | int column_num; | |||
int tok_val; | ||||
token_type type_tag; | token_type type_tag; | |||
union | union | |||
{ | ||||
std::string *str; | ||||
double num; | ||||
end_tok_type et; | ||||
symbol_table::symbol_record *sr; | ||||
struct | ||||
{ | ||||
symbol_table::symbol_record *mr; | ||||
symbol_table::symbol_record *cr; | ||||
symbol_table::symbol_record *pr; | ||||
} sc; | ||||
struct | ||||
{ | { | |||
std::string *str; | symbol_table::symbol_record *cr; | |||
double num; | symbol_table::symbol_record *pr; | |||
end_tok_type et; | } mc; | |||
symbol_table::symbol_record *sr; | }; | |||
struct | ||||
{ | ||||
symbol_table::symbol_record *mr; | ||||
symbol_table::symbol_record *cr; | ||||
symbol_table::symbol_record *pr; | ||||
} sc; | ||||
struct | ||||
{ | ||||
symbol_table::symbol_record *cr; | ||||
symbol_table::symbol_record *pr; | ||||
} mc; | ||||
}; | ||||
std::string orig_text; | std::string orig_text; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 12 change blocks. | ||||
55 lines changed or deleted | 83 lines changed or added | |||
toplev.h | toplev.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 43 | skipping to change at line 43 | |||
class octave_function; | class octave_function; | |||
class octave_user_script; | class octave_user_script; | |||
class tree_statement; | class tree_statement; | |||
class tree_statement_list; | class tree_statement_list; | |||
class charMatrix; | class charMatrix; | |||
#include "quit.h" | #include "quit.h" | |||
#include "input.h" | #include "input.h" | |||
#include "oct-map.h" | #include "oct-map.h" | |||
#include "symtab.h" | ||||
typedef void (*octave_exit_func) (int); | typedef void (*octave_exit_func) (int); | |||
extern OCTINTERP_API octave_exit_func octave_exit; | extern OCTINTERP_API octave_exit_func octave_exit; | |||
extern OCTINTERP_API bool quit_allowed; | extern OCTINTERP_API bool quit_allowed; | |||
extern OCTINTERP_API bool quitting_gracefully; | extern OCTINTERP_API bool quitting_gracefully; | |||
extern OCTINTERP_API int exit_status; | extern OCTINTERP_API int exit_status; | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
clean_up_and_exit (int); | clean_up_and_exit (int status, bool safe_to_return = false); | |||
extern OCTINTERP_API void recover_from_exception (void); | extern OCTINTERP_API void recover_from_exception (void); | |||
extern OCTINTERP_API int main_loop (void); | extern OCTINTERP_API int main_loop (void); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
do_octave_atexit (void); | ||||
extern OCTINTERP_API void | ||||
octave_add_atexit_function (const std::string& fname); | octave_add_atexit_function (const std::string& fname); | |||
extern OCTINTERP_API bool | extern OCTINTERP_API bool | |||
octave_remove_atexit_function (const std::string& fname); | octave_remove_atexit_function (const std::string& fname); | |||
// Current command to execute. | ||||
extern OCTINTERP_API tree_statement_list *global_command; | ||||
// TRUE means we are ready to interpret commands, but not everything | // TRUE means we are ready to interpret commands, but not everything | |||
// is ready for interactive use. | // is ready for interactive use. | |||
extern OCTINTERP_API bool octave_interpreter_ready; | extern OCTINTERP_API bool octave_interpreter_ready; | |||
// TRUE means we've processed all the init code and we are good to go. | // TRUE means we've processed all the init code and we are good to go. | |||
extern OCTINTERP_API bool octave_initialized; | extern OCTINTERP_API bool octave_initialized; | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
octave_call_stack | octave_call_stack | |||
{ | { | |||
private: | private: | |||
struct call_stack_elt | struct call_stack_elt | |||
{ | { | |||
call_stack_elt (octave_function *f, symbol_table::scope_id s, | call_stack_elt (octave_function *f, symbol_table::scope_id s, | |||
symbol_table::context_id c, size_t p = 0) | symbol_table::context_id c, size_t p = 0) | |||
: fcn (f), stmt (0), scope (s), context (c), prev (p) { } | : fcn (f), line (-1), column (-1), scope (s), context (c), prev (p) | |||
{ } | ||||
call_stack_elt (const call_stack_elt& elt) | call_stack_elt (const call_stack_elt& elt) | |||
: fcn (elt.fcn), stmt (elt.stmt), scope (elt.scope), | : fcn (elt.fcn), line (elt.line), column (elt.column), | |||
context (elt.context), prev (elt.prev) { } | scope (elt.scope), context (elt.context), prev (elt.prev) | |||
{ } | ||||
octave_function *fcn; | octave_function *fcn; | |||
tree_statement *stmt; | int line; | |||
int column; | ||||
symbol_table::scope_id scope; | symbol_table::scope_id scope; | |||
symbol_table::context_id context; | symbol_table::context_id context; | |||
size_t prev; | size_t prev; | |||
}; | }; | |||
protected: | protected: | |||
octave_call_stack (void) : cs (), curr_frame (0) { } | octave_call_stack (void) : cs (), curr_frame (0) { } | |||
public: | public: | |||
typedef std::deque<call_stack_elt>::iterator iterator; | typedef std::deque<call_stack_elt>::iterator iterator; | |||
typedef std::deque<call_stack_elt>::const_iterator const_iterator; | typedef std::deque<call_stack_elt>::const_iterator const_iterator; | |||
typedef std::deque<call_stack_elt>::reverse_iterator reverse_iterator; | typedef std::deque<call_stack_elt>::reverse_iterator | |||
typedef std::deque<call_stack_elt>::const_reverse_iterator const_reverse_ | reverse_iterator; | |||
iterator; | typedef std::deque<call_stack_elt>::const_reverse_iterator | |||
const_reverse_iterator; | ||||
static void create_instance (void); | static void create_instance (void); | |||
static bool instance_ok (void) | static bool instance_ok (void) | |||
{ | { | |||
bool retval = true; | bool retval = true; | |||
if (! instance) | if (! instance) | |||
create_instance (); | create_instance (); | |||
skipping to change at line 139 | skipping to change at line 139 | |||
return retval; | return retval; | |||
} | } | |||
// Current function (top of stack). | // Current function (top of stack). | |||
static octave_function *current (void) | static octave_function *current (void) | |||
{ | { | |||
return instance_ok () ? instance->do_current () : 0; | return instance_ok () ? instance->do_current () : 0; | |||
} | } | |||
// Current statement (top of stack). | ||||
static tree_statement *current_statement (void) | ||||
{ | ||||
return instance_ok () ? instance->do_current_statement () : 0; | ||||
} | ||||
// Current line in current function. | // Current line in current function. | |||
static int current_line (void) | static int current_line (void) | |||
{ | { | |||
return instance_ok () ? instance->do_current_line () : -1; | return instance_ok () ? instance->do_current_line () : -1; | |||
} | } | |||
// Current column in current function. | // Current column in current function. | |||
static int current_column (void) | static int current_column (void) | |||
{ | { | |||
return instance_ok () ? instance->do_current_column () : -1; | return instance_ok () ? instance->do_current_column () : -1; | |||
skipping to change at line 188 | skipping to change at line 182 | |||
} | } | |||
static size_t size (void) | static size_t size (void) | |||
{ | { | |||
return instance_ok () ? instance->do_size () : 0; | return instance_ok () ? instance->do_size () : 0; | |||
} | } | |||
static size_t num_user_code_frames (octave_idx_type& curr_user_frame) | static size_t num_user_code_frames (octave_idx_type& curr_user_frame) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_num_user_code_frames (curr_user_frame) : 0; | ? instance->do_num_user_code_frames (curr_user_frame) : 0; | |||
} | } | |||
static symbol_table::scope_id current_scope (void) | static symbol_table::scope_id current_scope (void) | |||
{ | { | |||
return instance_ok () ? instance->do_current_scope () : 0; | return instance_ok () ? instance->do_current_scope () : 0; | |||
} | } | |||
static symbol_table::context_id current_context (void) | static symbol_table::context_id current_context (void) | |||
{ | { | |||
return instance_ok () ? instance->do_current_context () : 0; | return instance_ok () ? instance->do_current_context () : 0; | |||
skipping to change at line 231 | skipping to change at line 225 | |||
} | } | |||
static void | static void | |||
push (symbol_table::scope_id scope = symbol_table::current_scope (), | push (symbol_table::scope_id scope = symbol_table::current_scope (), | |||
symbol_table::context_id context = symbol_table::current_context () ) | symbol_table::context_id context = symbol_table::current_context () ) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_push (0, scope, context); | instance->do_push (0, scope, context); | |||
} | } | |||
static void set_statement (tree_statement *s) | static void set_location (int l, int c) | |||
{ | ||||
if (instance_ok ()) | ||||
instance->do_set_location (l, c); | ||||
} | ||||
static void set_line (int l) | ||||
{ | ||||
if (instance_ok ()) | ||||
instance->do_set_line (l); | ||||
} | ||||
static void set_column (int c) | ||||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_set_statement (s); | instance->do_set_column (c); | |||
} | } | |||
static bool goto_frame (size_t n = 0, bool verbose = false) | static bool goto_frame (size_t n = 0, bool verbose = false) | |||
{ | { | |||
return instance_ok () ? instance->do_goto_frame (n, verbose) : false; | return instance_ok () ? instance->do_goto_frame (n, verbose) : false; | |||
} | } | |||
static void restore_frame (size_t n) | static void restore_frame (size_t n) | |||
{ | { | |||
goto_frame (n); | goto_frame (n); | |||
} | } | |||
static bool goto_frame_relative (int n, bool verbose = false) | static bool goto_frame_relative (int n, bool verbose = false) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_goto_frame_relative (n, verbose) : false; | ? instance->do_goto_frame_relative (n, verbose) : false; | |||
} | } | |||
static void goto_caller_frame (void) | static void goto_caller_frame (void) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_goto_caller_frame (); | instance->do_goto_caller_frame (); | |||
} | } | |||
static void goto_base_frame (void) | static void goto_base_frame (void) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_goto_base_frame (); | instance->do_goto_base_frame (); | |||
} | } | |||
static octave_map backtrace (size_t nskip, octave_idx_type& curr_user_fra me) | static octave_map backtrace (size_t nskip, octave_idx_type& curr_user_fra me) | |||
{ | { | |||
return instance_ok () | return instance_ok () | |||
? instance->do_backtrace (nskip, curr_user_frame) : octave_map (); | ? instance->do_backtrace (nskip, curr_user_frame) : octave_map ( ); | |||
} | } | |||
static octave_map empty_backtrace (void); | static octave_map empty_backtrace (void); | |||
static void pop (void) | static void pop (void) | |||
{ | { | |||
if (instance_ok ()) | if (instance_ok ()) | |||
instance->do_pop (); | instance->do_pop (); | |||
} | } | |||
skipping to change at line 324 | skipping to change at line 330 | |||
size_t do_current_frame (void) { return curr_frame; } | size_t do_current_frame (void) { return curr_frame; } | |||
size_t do_size (void) { return cs.size (); } | size_t do_size (void) { return cs.size (); } | |||
size_t do_num_user_code_frames (octave_idx_type& curr_user_frame) const; | size_t do_num_user_code_frames (octave_idx_type& curr_user_frame) const; | |||
symbol_table::scope_id do_current_scope (void) const | symbol_table::scope_id do_current_scope (void) const | |||
{ | { | |||
return curr_frame > 0 && curr_frame < cs.size () | return curr_frame > 0 && curr_frame < cs.size () | |||
? cs[curr_frame].scope : 0; | ? cs[curr_frame].scope : 0; | |||
} | } | |||
symbol_table::context_id do_current_context (void) const | symbol_table::context_id do_current_context (void) const | |||
{ | { | |||
return curr_frame > 0 && curr_frame < cs.size () | return curr_frame > 0 && curr_frame < cs.size () | |||
? cs[curr_frame].context : 0; | ? cs[curr_frame].context : 0; | |||
} | } | |||
octave_function *do_element (size_t n) | octave_function *do_element (size_t n) | |||
{ | { | |||
octave_function *retval = 0; | octave_function *retval = 0; | |||
if (cs.size () > n) | if (cs.size () > n) | |||
{ | { | |||
call_stack_elt& elt = cs[n]; | call_stack_elt& elt = cs[n]; | |||
retval = elt.fcn; | retval = elt.fcn; | |||
skipping to change at line 370 | skipping to change at line 376 | |||
if (! cs.empty ()) | if (! cs.empty ()) | |||
{ | { | |||
const call_stack_elt& elt = cs[curr_frame]; | const call_stack_elt& elt = cs[curr_frame]; | |||
retval = elt.fcn; | retval = elt.fcn; | |||
} | } | |||
return retval; | return retval; | |||
} | } | |||
tree_statement *do_current_statement (void) const | void do_set_location (int l, int c) | |||
{ | { | |||
tree_statement *retval = 0; | ||||
if (! cs.empty ()) | if (! cs.empty ()) | |||
{ | { | |||
const call_stack_elt& elt = cs[curr_frame]; | call_stack_elt& elt = cs.back (); | |||
retval = elt.stmt; | ||||
elt.line = l; | ||||
elt.column = c; | ||||
} | } | |||
} | ||||
return retval; | void do_set_line (int l) | |||
{ | ||||
if (! cs.empty ()) | ||||
{ | ||||
call_stack_elt& elt = cs.back (); | ||||
elt.line = l; | ||||
} | ||||
} | } | |||
void do_set_statement (tree_statement *s) | void do_set_column (int c) | |||
{ | { | |||
if (! cs.empty ()) | if (! cs.empty ()) | |||
{ | { | |||
call_stack_elt& elt = cs.back (); | call_stack_elt& elt = cs.back (); | |||
elt.stmt = s; | ||||
elt.column = c; | ||||
} | } | |||
} | } | |||
octave_map do_backtrace (size_t nskip, | octave_map do_backtrace (size_t nskip, | |||
octave_idx_type& curr_user_frame) const; | octave_idx_type& curr_user_frame) const; | |||
bool do_goto_frame (size_t n, bool verbose); | bool do_goto_frame (size_t n, bool verbose); | |||
bool do_goto_frame_relative (int n, bool verbose); | bool do_goto_frame_relative (int n, bool verbose); | |||
End of changes. 24 change blocks. | ||||
36 lines changed or deleted | 50 lines changed or added | |||
txt-eng-ft.h | txt-eng-ft.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 Michael Goffioul | Copyright (C) 2009-2013 Michael Goffioul | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 28 | skipping to change at line 28 | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if ! defined (txt_eng_ft_h) | #if ! defined (txt_eng_ft_h) | |||
#define txt_eng_ft_h 1 | #define txt_eng_ft_h 1 | |||
#if HAVE_FREETYPE | #if HAVE_FREETYPE | |||
#include <list> | ||||
#include <vector> | #include <vector> | |||
#include <ft2build.h> | #include <ft2build.h> | |||
#include FT_FREETYPE_H | #include FT_FREETYPE_H | |||
#include <dMatrix.h> | #include <dMatrix.h> | |||
#include <uint8NDArray.h> | #include <uint8NDArray.h> | |||
#include "txt-eng.h" | #include "txt-eng.h" | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
ft_render : public text_processor | ft_render : public text_processor | |||
{ | { | |||
public: | public: | |||
enum { | enum | |||
MODE_BBOX = 0, | { | |||
MODE_RENDER = 1 | MODE_BBOX = 0, | |||
MODE_RENDER = 1 | ||||
}; | }; | |||
enum { | enum | |||
ROTATION_0 = 0, | { | |||
ROTATION_90 = 1, | ROTATION_0 = 0, | |||
ROTATION_180 = 2, | ROTATION_90 = 1, | |||
ROTATION_270 = 3 | ROTATION_180 = 2, | |||
ROTATION_270 = 3 | ||||
}; | }; | |||
public: | public: | |||
ft_render (void); | ft_render (void); | |||
~ft_render (void); | ~ft_render (void); | |||
void visit (text_element_string& e); | void visit (text_element_string& e); | |||
void visit (text_element_list& e); | ||||
void visit (text_element_subscript& e); | ||||
void visit (text_element_superscript& e); | ||||
void visit (text_element_color& e); | ||||
void visit (text_element_fontsize& e); | ||||
void visit (text_element_fontname& e); | ||||
void visit (text_element_fontstyle& e); | ||||
void visit (text_element_symbol& e); | ||||
void visit (text_element_combined& e); | ||||
void reset (void); | void reset (void); | |||
uint8NDArray get_pixels (void) const { return pixels; } | uint8NDArray get_pixels (void) const { return pixels; } | |||
Matrix get_boundingbox (void) const { return bbox; } | Matrix get_boundingbox (void) const { return bbox; } | |||
uint8NDArray render (text_element* elt, Matrix& box, | uint8NDArray render (text_element* elt, Matrix& box, | |||
int rotation = ROTATION_0); | int rotation = ROTATION_0); | |||
Matrix get_extent (text_element *elt, double rotation = 0.0); | Matrix get_extent (text_element *elt, double rotation = 0.0); | |||
Matrix get_extent (const std::string& txt, double rotation = 0.0); | Matrix get_extent (const std::string& txt, double rotation = 0.0, | |||
const caseless_str& interpreter = "tex"); | ||||
void set_font (const std::string& name, const std::string& weight, | void set_font (const std::string& name, const std::string& weight, | |||
const std::string& angle, double size); | const std::string& angle, double size); | |||
void set_color (Matrix c); | void set_color (Matrix c); | |||
void set_mode (int m); | void set_mode (int m); | |||
void text_to_pixels (const std::string& txt, | void text_to_pixels (const std::string& txt, | |||
uint8NDArray& pixels_, Matrix& bbox, | uint8NDArray& pixels_, Matrix& bbox, | |||
int halign, int valign, double rotation); | int halign, int valign, double rotation, | |||
const caseless_str& interpreter = "tex"); | ||||
private: | private: | |||
int rotation_to_mode (double rotation) const; | int rotation_to_mode (double rotation) const; | |||
// No copying! | // No copying! | |||
ft_render (const ft_render&); | ft_render (const ft_render&); | |||
ft_render& operator = (const ft_render&); | ft_render& operator = (const ft_render&); | |||
// Class to hold information about fonts and a strong | ||||
// reference to the font objects loaded by freetype. | ||||
class ft_font | ||||
{ | ||||
public: | ||||
ft_font (void) | ||||
: name (), weight (), angle (), size (0), face (0) { } | ||||
ft_font (const std::string& nm, const std::string& wt, | ||||
const std::string& ang, double sz, FT_Face f = 0) | ||||
: name (nm), weight (wt), angle (ang), size (sz), face (f) { } | ||||
ft_font (const ft_font& ft); | ||||
~ft_font (void) | ||||
{ | ||||
if (face) | ||||
FT_Done_Face (face); | ||||
} | ||||
ft_font& operator = (const ft_font& ft); | ||||
bool is_valid (void) const { return get_face (); } | ||||
std::string get_name (void) const { return name; } | ||||
std::string get_weight (void) const { return weight; } | ||||
std::string get_angle (void) const { return angle; } | ||||
double get_size (void) const { return size; } | ||||
FT_Face get_face (void) const; | ||||
private: | ||||
std::string name; | ||||
std::string weight; | ||||
std::string angle; | ||||
double size; | ||||
mutable FT_Face face; | ||||
}; | ||||
void push_new_line (void); | ||||
void update_line_bbox (void); | ||||
void compute_bbox (void); | ||||
int compute_line_xoffset (const Matrix& lb) const; | ||||
FT_UInt process_character (FT_ULong code, FT_UInt previous = 0); | ||||
private: | private: | |||
FT_Face face; | // The current font used by the renderer. | |||
ft_font font; | ||||
// Used to stored the bounding box corresponding to the rendered text. | ||||
// The bounding box has the form [x, y, w, h] where x and y represent the | ||||
// coordinates of the bottom left corner relative to the anchor point of | ||||
// the text (== start of text on the baseline). Due to font descent or | ||||
// multiple lines, the value y is usually negative. | ||||
Matrix bbox; | Matrix bbox; | |||
// Used to stored the rendered text. It's a 3D matrix with size MxNx4 | ||||
// where M and N are the width and height of the bounding box. | ||||
uint8NDArray pixels; | uint8NDArray pixels; | |||
// Used to store the bounding box of each line. This is used to layout | ||||
// multiline text properly. | ||||
std::list<Matrix> line_bbox; | ||||
// The current horizontal alignment. This is used to align multi-line tex | ||||
t. | ||||
int halign; | ||||
// The X offset for the next glyph. | ||||
int xoffset; | int xoffset; | |||
// The Y offset of the baseline for the current line. | ||||
int line_yoffset; | ||||
// The Y offset of the baseline for the next glyph. The offset is relativ | ||||
e | ||||
// to line_yoffset. The total Y offset is computed with: | ||||
// line_yoffset + yoffset. | ||||
int yoffset; | int yoffset; | |||
int multiline_halign; | ||||
std::vector<int> multiline_align_xoffsets; | // The current mode of the rendering process (box computing or rendering) | |||
. | ||||
int mode; | int mode; | |||
uint8_t red, green, blue; | ||||
// The base color of the rendered text. | ||||
uint8NDArray color; | ||||
}; | }; | |||
#endif // HAVE_FREETYPE | #endif // HAVE_FREETYPE | |||
#endif | #endif | |||
End of changes. 14 change blocks. | ||||
15 lines changed or deleted | 121 lines changed or added | |||
txt-eng.h | txt-eng.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2009-2012 Michael Goffioul | Copyright (C) 2009-2013 Michael Goffioul | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 26 | skipping to change at line 26 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if ! defined (txt_eng_h) | #if ! defined (txt_eng_h) | |||
#define txt_eng_h 1 | #define txt_eng_h 1 | |||
#include <memory> | ||||
#include <string> | ||||
#include "base-list.h" | #include "base-list.h" | |||
#include "caseless-str.h" | ||||
#include "dMatrix.h" | ||||
class text_element; | class text_element; | |||
class text_element_string; | class text_element_string; | |||
class text_element_symbol; | ||||
class text_element_list; | class text_element_list; | |||
class text_subscript_element; | class text_element_subscript; | |||
class text_superscript_element; | class text_element_superscript; | |||
class text_element_combined; | ||||
class text_element_fontname; | ||||
class text_element_fontsize; | ||||
class text_element_fontstyle; | ||||
class text_element_color; | ||||
class text_processor; | class text_processor; | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
text_element | text_element | |||
{ | { | |||
public: | public: | |||
text_element (void) { } | text_element (void) { } | |||
skipping to change at line 57 | skipping to change at line 68 | |||
private: | private: | |||
text_element (const text_element&); | text_element (const text_element&); | |||
}; | }; | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
text_element_string : public text_element | text_element_string : public text_element | |||
{ | { | |||
public: | public: | |||
text_element_string (const std::string& s = "") | text_element_string (const std::string& s = "") | |||
: text_element (), str (s) { } | : text_element (), str (s) { } | |||
~text_element_string (void) { } | ~text_element_string (void) { } | |||
std::string string_value (void) const { return str; } | std::string string_value (void) const { return str; } | |||
void accept (text_processor& p); | void accept (text_processor& p); | |||
private: | private: | |||
std::string str; | std::string str; | |||
private: | private: | |||
text_element_string (const text_element_string &); | text_element_string (const text_element_string &); | |||
}; | }; | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
text_element_list : | text_element_symbol : public text_element | |||
public text_element, | { | |||
public octave_base_list<text_element *> | public: | |||
enum { invalid_code = 0xFFFFFFFFU }; | ||||
public: | ||||
text_element_symbol (int sym) | ||||
: text_element (), symbol (sym) { } | ||||
~text_element_symbol (void) { } | ||||
int get_symbol (void) const { return symbol; } | ||||
uint32_t get_symbol_code (void) const; | ||||
void accept (text_processor& p); | ||||
private: | ||||
int symbol; | ||||
}; | ||||
class | ||||
OCTINTERP_API | ||||
text_element_list | ||||
: public text_element, public octave_base_list<text_element *> | ||||
{ | { | |||
public: | public: | |||
text_element_list (void) | text_element_list (void) | |||
: text_element (), octave_base_list<text_element*> () { } | : text_element (), octave_base_list<text_element*> () { } | |||
text_element_list (text_element* e) | ||||
: text_element (), octave_base_list<text_element*> () | ||||
{ push_back (e); } | ||||
~text_element_list (void) | ~text_element_list (void) | |||
{ | { | |||
while (! empty ()) | while (! empty ()) | |||
{ | { | |||
iterator it = begin (); | iterator it = begin (); | |||
delete (*it); | delete (*it); | |||
erase (it); | erase (it); | |||
} | } | |||
} | } | |||
void accept (text_processor& p); | ||||
}; | ||||
class | ||||
OCTINTERP_API | ||||
text_element_subscript : public text_element | ||||
{ | ||||
public: | ||||
text_element_subscript (text_element* e) | ||||
: text_element (), elem (e) { } | ||||
text_element_subscript (char c) | ||||
: text_element () | ||||
{ elem = new text_element_string (std::string (1, c)); } | ||||
~text_element_subscript (void) | ||||
{ delete elem; } | ||||
void accept (text_processor& p); | ||||
text_element* get_element (void) { return elem; } | ||||
private: | ||||
text_element* elem; | ||||
private: | ||||
text_element_subscript (void); | ||||
}; | ||||
class | ||||
OCTINTERP_API | ||||
text_element_superscript : public text_element | ||||
{ | ||||
public: | ||||
text_element_superscript (text_element* e) | ||||
: text_element (), elem (e) { } | ||||
text_element_superscript (char c) | ||||
: text_element () | ||||
{ elem = new text_element_string (std::string (1, c)); } | ||||
~text_element_superscript (void) | ||||
{ delete elem; } | ||||
void accept (text_processor& p); | void accept (text_processor& p); | |||
text_element* get_element (void) { return elem; } | ||||
private: | ||||
text_element* elem; | ||||
private: | ||||
text_element_superscript (void); | ||||
}; | }; | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
text_subscript_element : public text_element_list | text_element_combined : public text_element_list | |||
{ | { | |||
public: | public: | |||
text_subscript_element (void) | text_element_combined (text_element* e) | |||
: text_element_list () { } | : text_element_list (e) { } | |||
~text_subscript_element (void) { } | text_element_combined (text_element* e1, text_element* e2) | |||
: text_element_list(e1) | ||||
{ push_back (e2); } | ||||
void accept (text_processor& p); | void accept (text_processor& p); | |||
}; | }; | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
text_superscript_element : public text_element_list | text_element_fontstyle : public text_element | |||
{ | { | |||
public: | public: | |||
text_superscript_element (void) | enum fontstyle | |||
: text_element_list () { } | { | |||
normal, | ||||
bold, | ||||
italic, | ||||
oblique | ||||
}; | ||||
~text_superscript_element (void) { } | text_element_fontstyle (fontstyle st) | |||
: text_element (), style (st) { } | ||||
~text_element_fontstyle (void) { } | ||||
fontstyle get_fontstyle (void) const { return style; } | ||||
void accept (text_processor& p); | void accept (text_processor& p); | |||
private: | ||||
fontstyle style; | ||||
private: | ||||
text_element_fontstyle (void); | ||||
}; | ||||
class | ||||
OCTINTERP_API | ||||
text_element_fontname : public text_element | ||||
{ | ||||
public: | ||||
text_element_fontname (const std::string& fname) | ||||
: text_element (), name (fname) { } | ||||
~text_element_fontname (void) { } | ||||
const std::string& get_fontname (void) const { return name; } | ||||
void accept (text_processor& p); | ||||
private: | ||||
std::string name; | ||||
private: | ||||
text_element_fontname (void); | ||||
}; | ||||
class | ||||
OCTINTERP_API | ||||
text_element_fontsize : public text_element | ||||
{ | ||||
public: | ||||
text_element_fontsize (double fsize) | ||||
: text_element (), size (fsize) { } | ||||
~text_element_fontsize (void) { } | ||||
double get_fontsize (void) const { return size; } | ||||
void accept (text_processor& p); | ||||
private: | ||||
double size; | ||||
private: | ||||
text_element_fontsize (void); | ||||
}; | ||||
class | ||||
OCTINTERP_API | ||||
text_element_color : public text_element | ||||
{ | ||||
public: | ||||
text_element_color (double r, double g, double b) | ||||
: text_element (), rgb (1, 3, 0.0) | ||||
{ | ||||
rgb(0) = r; | ||||
rgb(1) = g; | ||||
rgb(2) = b; | ||||
} | ||||
text_element_color (const std::string& cname) | ||||
: text_element (), rgb (1, 3, 0.0) | ||||
{ | ||||
#define ASSIGN_COLOR(r,g,b) { rgb(0) = r; rgb(1) = g; rgb(2) = b; } | ||||
if (cname == "red") ASSIGN_COLOR(1, 0, 0) | ||||
else if (cname == "green") ASSIGN_COLOR(0, 1, 0) | ||||
else if (cname == "yellow") ASSIGN_COLOR(1, 1, 0) | ||||
else if (cname == "magenta") ASSIGN_COLOR(1, 0, 1) | ||||
else if (cname == "blue") ASSIGN_COLOR(0, 0, 1) | ||||
else if (cname == "black") ASSIGN_COLOR(0, 0, 0) | ||||
else if (cname == "white") ASSIGN_COLOR(1, 1, 1) | ||||
else if (cname == "gray") ASSIGN_COLOR(.5, .5, .5) | ||||
else if (cname == "darkGreen") ASSIGN_COLOR(0, .5, 0) | ||||
else if (cname == "orange") ASSIGN_COLOR(1, .65, 0) | ||||
else if (cname == "lightBlue") ASSIGN_COLOR(0.68, . | ||||
85, .9) | ||||
#undef ASSIGN_COLOR | ||||
} | ||||
~text_element_color (void) { } | ||||
Matrix get_color (void) { return rgb; } | ||||
void accept (text_processor& p); | ||||
private: | ||||
Matrix rgb; | ||||
}; | }; | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
text_processor | text_processor | |||
{ | { | |||
public: | public: | |||
virtual void visit (text_element_string& e) = 0; | virtual void visit (text_element_string& e) = 0; | |||
virtual void visit (text_element_symbol&) { } | ||||
virtual void visit (text_element_list& e) | virtual void visit (text_element_list& e) | |||
{ | { | |||
for (text_element_list::iterator it = e.begin (); | for (text_element_list::iterator it = e.begin (); | |||
it != e.end (); ++it) | it != e.end (); ++it) | |||
{ | { | |||
(*it)->accept (*this); | (*it)->accept (*this); | |||
} | } | |||
} | } | |||
virtual void visit (text_element_subscript& e) | ||||
{ e.get_element ()->accept (*this); } | ||||
virtual void visit (text_element_superscript& e) | ||||
{ e.get_element ()->accept (*this); } | ||||
virtual void visit (text_element_combined&) { } | ||||
virtual void visit (text_subscript_element& e) | virtual void visit (text_element_fontstyle&) { } | |||
{ visit (dynamic_cast<text_element_list&> (e)); } | ||||
virtual void visit (text_superscript_element& e) | virtual void visit (text_element_fontname&) { } | |||
{ visit (dynamic_cast<text_element_list&> (e)); } | ||||
virtual void visit (text_element_fontsize&) { } | ||||
virtual void visit (text_element_color&) { } | ||||
virtual void reset (void) { } | virtual void reset (void) { } | |||
protected: | protected: | |||
text_processor (void) { } | text_processor (void) { } | |||
virtual ~text_processor (void) { } | virtual ~text_processor (void) { } | |||
}; | }; | |||
#define TEXT_ELEMENT_ACCEPT(cls) \ | #define TEXT_ELEMENT_ACCEPT(cls) \ | |||
inline void \ | inline void \ | |||
cls::accept (text_processor& p) \ | cls::accept (text_processor& p) \ | |||
{ p.visit (*this); } | { p.visit (*this); } | |||
TEXT_ELEMENT_ACCEPT(text_element_string) | TEXT_ELEMENT_ACCEPT(text_element_string) | |||
TEXT_ELEMENT_ACCEPT(text_element_symbol) | ||||
TEXT_ELEMENT_ACCEPT(text_element_list) | TEXT_ELEMENT_ACCEPT(text_element_list) | |||
TEXT_ELEMENT_ACCEPT(text_subscript_element) | TEXT_ELEMENT_ACCEPT(text_element_subscript) | |||
TEXT_ELEMENT_ACCEPT(text_superscript_element) | TEXT_ELEMENT_ACCEPT(text_element_superscript) | |||
TEXT_ELEMENT_ACCEPT(text_element_combined) | ||||
TEXT_ELEMENT_ACCEPT(text_element_fontstyle) | ||||
TEXT_ELEMENT_ACCEPT(text_element_fontname) | ||||
TEXT_ELEMENT_ACCEPT(text_element_fontsize) | ||||
TEXT_ELEMENT_ACCEPT(text_element_color) | ||||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
text_parser | text_parser | |||
{ | { | |||
public: | public: | |||
text_parser (void) { } | text_parser (void) { } | |||
virtual ~text_parser (void) { } | virtual ~text_parser (void) { } | |||
virtual text_element* parse (const std::string& s) = 0; | virtual text_element* parse (const std::string& s) = 0; | |||
public: | ||||
static text_element* parse (const std::string& s, | ||||
const caseless_str& interpreter); | ||||
}; | }; | |||
class | class | |||
OCTINTERP_API | OCTINTERP_API | |||
text_parser_none : public text_parser | text_parser_none : public text_parser | |||
{ | { | |||
public: | public: | |||
text_parser_none (void) : text_parser () { } | text_parser_none (void) : text_parser () { } | |||
~text_parser_none (void) { } | ~text_parser_none (void) { } | |||
// FIXME: is it possible to use reference counting to manage the | // FIXME: is it possible to use reference counting to manage the | |||
// memory for the object returned by the text parser? That would be | // memory for the object returned by the text parser? That would be | |||
// preferable to having to know when and where to delete the object it | // preferable to having to know when and where to delete the object it | |||
// creates... | // creates... | |||
text_element* parse (const std::string& s) | text_element* parse (const std::string& s) | |||
{ | { | |||
return new text_element_string (s); | return new text_element_string (s); | |||
} | } | |||
}; | ||||
class | ||||
OCTINTERP_API | ||||
text_parser_tex : public text_parser | ||||
{ | ||||
public: | ||||
text_parser_tex (void) | ||||
: text_parser (), scanner (0), buffer_state (0), result (0) | ||||
{ } | ||||
~text_parser_tex (void) | ||||
{ destroy_lexer (); } | ||||
text_element* parse (const std::string& s); | ||||
void* get_scanner (void) { return scanner; } | ||||
void set_parse_result (text_element* e) { result = e; } | ||||
text_element* get_parse_result (void) { return result; } | ||||
private: | ||||
bool init_lexer (const std::string& s); | ||||
void destroy_lexer (void); | ||||
private: | ||||
void* scanner; | ||||
void* buffer_state; | ||||
text_element* result; | ||||
}; | }; | |||
inline text_element* | ||||
text_parser::parse (const std::string& s, const caseless_str& interpreter) | ||||
{ | ||||
std::auto_ptr<text_parser> parser; | ||||
if (interpreter.compare ("tex")) | ||||
parser.reset (new text_parser_tex ()); | ||||
else | ||||
parser.reset (new text_parser_none ()); | ||||
return parser->parse (s); | ||||
} | ||||
#endif | #endif | |||
End of changes. 26 change blocks. | ||||
40 lines changed or deleted | 299 lines changed or added | |||
uint16NDArray.h | uint16NDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
uint32NDArray.h | uint32NDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
uint64NDArray.h | uint64NDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
uint8NDArray.h | uint8NDArray.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2004-2012 John W. Eaton | Copyright (C) 2004-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
unwind-prot.h | unwind-prot.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
Copyright (C) 2009-2010 VZLU Prague | Copyright (C) 2009-2010 VZLU Prague | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 29 | skipping to change at line 29 | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_unwind_prot_h) | #if !defined (octave_unwind_prot_h) | |||
#define octave_unwind_prot_h 1 | #define octave_unwind_prot_h 1 | |||
#include <cstddef> | #include <cstddef> | |||
#include <string> | #include <stack> | |||
#include <memory> | #include <memory> | |||
// This class allows registering cleanup actions. | #include "action-container.h" | |||
class | class | |||
OCTINTERP_API | OCTAVE_API | |||
unwind_protect | unwind_protect : public action_container | |||
{ | { | |||
public: | public: | |||
// A generic unwind_protect element. Knows how to run itself and discard | unwind_protect (void) : lifo () { } | |||
itself. | ||||
// Also, contains a pointer to the next element. | ||||
class elem | ||||
{ | ||||
elem *next; | ||||
public: | ||||
elem (void) : next (0) { } | ||||
virtual void run (void) { } | ||||
virtual ~elem (void) { } | ||||
friend class unwind_protect; | ||||
private: | ||||
// No copying! | ||||
elem (const elem&); | ||||
elem& operator = (const elem&); | ||||
}; | ||||
// An element that merely runs a void (*)(void) function. | ||||
class fcn_elem : public elem | // Destructor should not raise an exception, so all actions | |||
{ | // registered should be exception-safe (but setting error_state is | |||
public: | // allowed). If you're not sure, see unwind_protect_safe. | |||
fcn_elem (void (*fptr) (void)) | ||||
: e_fptr (fptr) { } | ||||
void run (void) { e_fptr (); } | ||||
private: | ||||
void (*e_fptr) (void); | ||||
}; | ||||
// An element that stores a variable of type T along with a void (*) (T) | ~unwind_protect (void) { run (); } | |||
// function pointer, and calls the function with the parameter. | ||||
template <class T> | virtual void add (elem *new_elem) | |||
class fcn_arg_elem : public elem | ||||
{ | { | |||
public: | lifo.push (new_elem); | |||
fcn_arg_elem (void (*fcn) (T), T arg) | } | |||
: e_fcn (fcn), e_arg (arg) { } | ||||
void run (void) { e_fcn (e_arg); } | ||||
private: | ||||
// No copying! | ||||
fcn_arg_elem (const fcn_arg_elem&); | void add (void (*fcn) (void *), void *ptr = 0) GCC_ATTR_DEPRECATED | |||
fcn_arg_elem& operator = (const fcn_arg_elem&); | ||||
void (*e_fcn) (T); | ||||
T e_arg; | ||||
}; | ||||
// An element that stores a variable of type T along with a void (*) (con | ||||
st T&) | ||||
// function pointer, and calls the function with the parameter. | ||||
template <class T> | ||||
class fcn_crefarg_elem : public elem | ||||
{ | { | |||
public: | add (new fcn_arg_elem<void *> (fcn, ptr)); | |||
fcn_crefarg_elem (void (*fcn) (const T&), T arg) | } | |||
: e_fcn (fcn), e_arg (arg) { } | ||||
void run (void) { e_fcn (e_arg); } | ||||
private: | operator bool (void) const { return ! empty (); } | |||
void (*e_fcn) (const T&); | ||||
T e_arg; | ||||
}; | ||||
// An element for calling a member function. | void run_top (void) GCC_ATTR_DEPRECATED { run_first (); } | |||
template <class T> | void run_first (void) | |||
class method_elem : public elem | ||||
{ | { | |||
public: | if (! empty ()) | |||
method_elem (T *obj, void (T::*method) (void)) | { | |||
: e_obj (obj), e_method (method) { } | // No leak on exception! | |||
std::auto_ptr<elem> ptr (lifo.top ()); | ||||
lifo.pop (); | ||||
ptr->run (); | ||||
} | ||||
} | ||||
void run (void) { (e_obj->*e_method) (); } | void run_top (int num) GCC_ATTR_DEPRECATED { run (num); } | |||
private: | void discard_top (void) GCC_ATTR_DEPRECATED { discard_first (); } | |||
T *e_obj; | void discard_first (void) | |||
void (T::*e_method) (void); | ||||
// No copying! | ||||
method_elem (const method_elem&); | ||||
method_elem operator = (const method_elem&); | ||||
}; | ||||
// An element that stores arbitrary variable, and restores it. | ||||
template <class T> | ||||
class restore_var_elem : public elem | ||||
{ | { | |||
public: | if (! empty ()) | |||
restore_var_elem (T& ref, const T& val) | { | |||
: e_ptr (&ref), e_val (val) { } | elem *ptr = lifo.top (); | |||
lifo.pop (); | ||||
void run (void) { *e_ptr = e_val; } | delete ptr; | |||
} | ||||
} | ||||
private: | void discard_top (int num) GCC_ATTR_DEPRECATED { discard (num); } | |||
// No copying! | size_t size (void) const { return lifo.size (); } | |||
restore_var_elem (const restore_var_elem&); | protected: | |||
restore_var_elem& operator = (const restore_var_elem&); | std::stack<elem *> lifo; | |||
T *e_ptr, e_val; | ||||
}; | ||||
// Deletes a class allocated using new. | ||||
template <class T> | ||||
class delete_ptr_elem : public elem | ||||
{ | ||||
public: | ||||
delete_ptr_elem (T *ptr) | ||||
: e_ptr (ptr) { } | ||||
void run (void) { delete e_ptr; } | ||||
private: | ||||
T *e_ptr; | ||||
// No copying! | ||||
delete_ptr_elem (const delete_ptr_elem&); | ||||
delete_ptr_elem operator = (const delete_ptr_elem&); | ||||
}; | ||||
unwind_protect (void) : head () { } | ||||
void add (elem *new_elem) | ||||
{ | ||||
new_elem->next = head; | ||||
head = new_elem; | ||||
} | ||||
// For backward compatibility. | ||||
void add (void (*fcn) (void *), void *ptr = 0) | ||||
{ | ||||
add (new fcn_arg_elem<void *> (fcn, ptr)); | ||||
} | ||||
// Call to void func (void). | ||||
void add_fcn (void (*fcn) (void)) | ||||
{ | ||||
add (new fcn_elem (fcn)); | ||||
} | ||||
// Call to void func (T). | ||||
template <class T> | ||||
void add_fcn (void (*action) (T), T val) | ||||
{ | ||||
add (new fcn_arg_elem<T> (action, val)); | ||||
} | ||||
// Call to void func (const T&). | ||||
template <class T> | ||||
void add_fcn (void (*action) (const T&), T val) | ||||
{ | ||||
add (new fcn_crefarg_elem<T> (action, val)); | ||||
} | ||||
// Call to T::method (void). | ||||
template <class T> | ||||
void add_method (T *obj, void (T::*method) (void)) | ||||
{ | ||||
add (new method_elem<T> (obj, method)); | ||||
} | ||||
// Call to delete (T*). | ||||
template <class T> | ||||
void add_delete (T *obj) | ||||
{ | ||||
add (new delete_ptr_elem<T> (obj)); | ||||
} | ||||
// Protect any variable. | ||||
template <class T> | ||||
void protect_var (T& var) | ||||
{ | ||||
add (new restore_var_elem<T> (var, var)); | ||||
} | ||||
// Protect any variable, value given. | ||||
template <class T> | ||||
void protect_var (T& var, const T& val) | ||||
{ | ||||
add (new restore_var_elem<T> (var, val)); | ||||
} | ||||
operator bool (void) const | ||||
{ | ||||
return head != 0; | ||||
} | ||||
void run_top (void) | ||||
{ | ||||
if (head) | ||||
{ | ||||
// No leak on exception! | ||||
std::auto_ptr<elem> ptr (head); | ||||
head = ptr->next; | ||||
ptr->run (); | ||||
} | ||||
} | ||||
void run_top (int num) | ||||
{ | ||||
while (num-- > 0) | ||||
run_top (); | ||||
} | ||||
void discard_top (void) | ||||
{ | ||||
if (head) | ||||
{ | ||||
elem *ptr = head; | ||||
head = ptr->next; | ||||
delete ptr; | ||||
} | ||||
} | ||||
void discard_top (int num) | ||||
{ | ||||
while (num-- > 0) | ||||
discard_top (); | ||||
} | ||||
void run (void) | ||||
{ | ||||
while (head) | ||||
run_top (); | ||||
} | ||||
void discard (void) | ||||
{ | ||||
while (head) | ||||
discard_top (); | ||||
} | ||||
// Destructor should not raise an exception, so all actions registered sh | ||||
ould | ||||
// be exception-safe (but setting error_state is allowed). If you're not | ||||
sure, | ||||
// see unwind_protect_safe. | ||||
~unwind_protect (void) | ||||
{ | ||||
run (); | ||||
} | ||||
private: | private: | |||
elem *head; | ||||
// No copying! | // No copying! | |||
unwind_protect (const unwind_protect&); | unwind_protect (const unwind_protect&); | |||
unwind_protect& operator = (const unwind_protect&); | unwind_protect& operator = (const unwind_protect&); | |||
}; | }; | |||
// Like unwind_protect, but this one will guard against the possibility of | // Like unwind_protect, but this one will guard against the | |||
seeing | // possibility of seeing an exception (or interrupt) in the cleanup | |||
// an exception (or interrupt) in the cleanup actions. Not that we can do m | // actions. Not that we can do much about it, but at least we won't | |||
uch about | // crash. | |||
// it, but at least we won't crash. | ||||
class | class | |||
OCTINTERP_API | OCTAVE_API | |||
unwind_protect_safe : public unwind_protect | unwind_protect_safe : public unwind_protect | |||
{ | { | |||
private: | ||||
static void gripe_exception (void); | static void gripe_exception (void); | |||
public: | public: | |||
unwind_protect_safe (void) : unwind_protect () { } | ||||
~unwind_protect_safe (void) | ~unwind_protect_safe (void) | |||
{ | { | |||
while (*this) | while (! empty ()) | |||
{ | { | |||
try | try | |||
{ | { | |||
run_top (); | run_first (); | |||
} | } | |||
catch (...) // Yes, the black hole. Remember we're in a dtor. | catch (...) // Yes, the black hole. Remember we're in a dtor. | |||
{ | { | |||
gripe_exception (); | gripe_exception (); | |||
} | } | |||
} | } | |||
} | } | |||
private: | ||||
// No copying! | ||||
unwind_protect_safe (const unwind_protect_safe&); | ||||
unwind_protect_safe& operator = (const unwind_protect_safe&); | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 29 change blocks. | ||||
278 lines changed or deleted | 73 lines changed or added | |||
utils.h | utils.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 130 | skipping to change at line 130 | |||
octave_value_list | octave_value_list | |||
do_simple_cellfun (octave_value_list (*fun) (const octave_value_list&, int) , | do_simple_cellfun (octave_value_list (*fun) (const octave_value_list&, int) , | |||
const char *fun_name, const octave_value_list& args, | const char *fun_name, const octave_value_list& args, | |||
int nargout); | int nargout); | |||
extern OCTINTERP_API | extern OCTINTERP_API | |||
octave_value | octave_value | |||
do_simple_cellfun (octave_value_list (*fun) (const octave_value_list&, int) , | do_simple_cellfun (octave_value_list (*fun) (const octave_value_list&, int) , | |||
const char *fun_name, const octave_value_list& args); | const char *fun_name, const octave_value_list& args); | |||
class | ||||
octave_preserve_stream_state | ||||
{ | ||||
public: | ||||
octave_preserve_stream_state (std::ios& s) | ||||
: stream (s), oflags (s.flags ()), oprecision (s.precision ()), | ||||
owidth (s.width ()), ofill (s.fill ()) | ||||
{ } | ||||
~octave_preserve_stream_state (void); | ||||
private: | ||||
std::ios& stream; | ||||
std::ios::fmtflags oflags; | ||||
std::streamsize oprecision; | ||||
int owidth; | ||||
char ofill; | ||||
}; | ||||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 22 lines changed or added | |||
variables.h | variables.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 35 | skipping to change at line 35 | |||
class octave_function; | class octave_function; | |||
class octave_user_function; | class octave_user_function; | |||
class tree_identifier; | class tree_identifier; | |||
class octave_value; | class octave_value; | |||
class octave_value_list; | class octave_value_list; | |||
class octave_builtin; | class octave_builtin; | |||
class string_vector; | class string_vector; | |||
#include <climits> | ||||
#include <cfloat> | #include <cfloat> | |||
#include <limits> | ||||
#include <string> | #include <string> | |||
#include "lo-ieee.h" | ||||
#include "ov.h" | #include "ov.h" | |||
#include "ov-builtin.h" | #include "ov-builtin.h" | |||
#include "symtab.h" | #include "symtab.h" | |||
extern OCTINTERP_API void clear_mex_functions (void); | extern OCTINTERP_API void clear_mex_functions (void); | |||
extern OCTINTERP_API octave_function * | extern OCTINTERP_API octave_function * | |||
is_valid_function (const octave_value&, const std::string& = std::string () , | is_valid_function (const octave_value&, const std::string& = std::string () , | |||
bool warn = false); | bool warn = false); | |||
skipping to change at line 75 | skipping to change at line 77 | |||
extern OCTINTERP_API bool | extern OCTINTERP_API bool | |||
looks_like_struct (const std::string& text); | looks_like_struct (const std::string& text); | |||
extern OCTINTERP_API int | extern OCTINTERP_API int | |||
symbol_exist (const std::string& name, const std::string& type = "any"); | symbol_exist (const std::string& name, const std::string& type = "any"); | |||
extern OCTINTERP_API std::string | extern OCTINTERP_API std::string | |||
unique_symbol_name (const std::string& basename); | unique_symbol_name (const std::string& basename); | |||
extern OCTINTERP_API octave_value lookup_function_handle (const std::string | extern OCTINTERP_API octave_value | |||
& nm); | lookup_function_handle (const std::string& nm); | |||
extern OCTINTERP_API octave_value | extern OCTINTERP_API octave_value | |||
get_global_value (const std::string& nm, bool silent = false); | get_global_value (const std::string& nm, bool silent = false); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
set_global_value (const std::string& nm, const octave_value& val); | set_global_value (const std::string& nm, const octave_value& val); | |||
extern OCTINTERP_API octave_value | extern OCTINTERP_API octave_value | |||
get_top_level_value (const std::string& nm, bool silent = false); | get_top_level_value (const std::string& nm, bool silent = false); | |||
skipping to change at line 100 | skipping to change at line 103 | |||
set_internal_variable (bool& var, const octave_value_list& args, | set_internal_variable (bool& var, const octave_value_list& args, | |||
int nargout, const char *nm); | int nargout, const char *nm); | |||
extern OCTINTERP_API octave_value | extern OCTINTERP_API octave_value | |||
set_internal_variable (char& var, const octave_value_list& args, | set_internal_variable (char& var, const octave_value_list& args, | |||
int nargout, const char *nm); | int nargout, const char *nm); | |||
extern OCTINTERP_API octave_value | extern OCTINTERP_API octave_value | |||
set_internal_variable (int& var, const octave_value_list& args, | set_internal_variable (int& var, const octave_value_list& args, | |||
int nargout, const char *nm, | int nargout, const char *nm, | |||
int minval = INT_MIN, int maxval = INT_MAX); | int minval = std::numeric_limits<int>::min (), | |||
int maxval = std::numeric_limits<int>::max ()); | ||||
extern OCTINTERP_API octave_value | extern OCTINTERP_API octave_value | |||
set_internal_variable (double& var, const octave_value_list& args, | set_internal_variable (double& var, const octave_value_list& args, | |||
int nargout, const char *nm, | int nargout, const char *nm, | |||
double minval = DBL_MIN, double maxval = DBL_MAX); | double minval = -octave_Inf, | |||
double maxval = octave_Inf); | ||||
extern OCTINTERP_API octave_value | extern OCTINTERP_API octave_value | |||
set_internal_variable (std::string& var, const octave_value_list& args, | set_internal_variable (std::string& var, const octave_value_list& args, | |||
int nargout, const char *nm, bool empty_ok = true); | int nargout, const char *nm, bool empty_ok = true); | |||
extern OCTINTERP_API octave_value | extern OCTINTERP_API octave_value | |||
set_internal_variable (int& var, const octave_value_list& args, | set_internal_variable (int& var, const octave_value_list& args, | |||
int nargout, const char *nm, const char **choices); | int nargout, const char *nm, const char **choices); | |||
#define SET_INTERNAL_VARIABLE(NM) \ | #define SET_INTERNAL_VARIABLE(NM) \ | |||
skipping to change at line 129 | skipping to change at line 134 | |||
set_internal_variable (V ## NM, args, nargout, #NM, false) | set_internal_variable (V ## NM, args, nargout, #NM, false) | |||
#define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL) \ | #define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL) \ | |||
set_internal_variable (V ## NM, args, nargout, #NM, MINVAL, MAXVAL) | set_internal_variable (V ## NM, args, nargout, #NM, MINVAL, MAXVAL) | |||
// in the following, CHOICES must be a C string array terminated by null. | // in the following, CHOICES must be a C string array terminated by null. | |||
#define SET_INTERNAL_VARIABLE_CHOICES(NM, CHOICES) \ | #define SET_INTERNAL_VARIABLE_CHOICES(NM, CHOICES) \ | |||
set_internal_variable (V ## NM, args, nargout, #NM, CHOICES) | set_internal_variable (V ## NM, args, nargout, #NM, CHOICES) | |||
extern OCTINTERP_API std::string builtin_string_variable (const std::string &); | extern OCTINTERP_API std::string builtin_string_variable (const std::string &); | |||
extern OCTINTERP_API int builtin_real_scalar_variable (const std::string&, | extern OCTINTERP_API int builtin_real_scalar_variable (const std::string&, | |||
double&); | double&); | |||
extern OCTINTERP_API octave_value builtin_any_variable (const std::string&) ; | extern OCTINTERP_API octave_value builtin_any_variable (const std::string&) ; | |||
extern OCTINTERP_API void bind_ans (const octave_value& val, bool print); | extern OCTINTERP_API void bind_ans (const octave_value& val, bool print); | |||
extern OCTINTERP_API void | extern OCTINTERP_API void | |||
bind_internal_variable (const std::string& fname, const octave_value& val); | bind_internal_variable (const std::string& fname, | |||
const octave_value& val) GCC_ATTR_DEPRECATED; | ||||
extern OCTINTERP_API void mlock (void); | extern OCTINTERP_API void mlock (void); | |||
extern OCTINTERP_API void munlock (const std::string&); | extern OCTINTERP_API void munlock (const std::string&); | |||
extern OCTINTERP_API bool mislocked (const std::string&); | extern OCTINTERP_API bool mislocked (const std::string&); | |||
extern OCTINTERP_API void clear_function (const std::string& nm); | extern OCTINTERP_API void clear_function (const std::string& nm); | |||
extern OCTINTERP_API void clear_variable (const std::string& nm); | extern OCTINTERP_API void clear_variable (const std::string& nm); | |||
extern OCTINTERP_API void clear_symbol (const std::string& nm); | extern OCTINTERP_API void clear_symbol (const std::string& nm); | |||
extern OCTINTERP_API void maybe_missing_function_hook (const std::string& n ame); | extern OCTINTERP_API void maybe_missing_function_hook (const std::string& n ame); | |||
End of changes. 9 change blocks. | ||||
9 lines changed or deleted | 14 lines changed or added | |||
version.h | version.h | |||
---|---|---|---|---|
// DO NOT EDIT! Generated automatically from version.in.h by Make. | ||||
/* | /* | |||
Copyright (C) 1992-2012 John W. Eaton | Copyright (C) 1992-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 26 | skipping to change at line 27 | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with Octave; see the file COPYING. If not, see | along with Octave; see the file COPYING. If not, see | |||
<http://www.gnu.org/licenses/>. | <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#if !defined (octave_version_h) | #if !defined (octave_version_h) | |||
#define octave_version_h 1 | #define octave_version_h 1 | |||
#define OCTAVE_VERSION "3.6.4" | #define OCTAVE_VERSION "3.8.0" | |||
#define OCTAVE_API_VERSION_NUMBER 48 | #define OCTAVE_API_VERSION "api-v49+" | |||
#define OCTAVE_API_VERSION "api-v48+" | #define OCTAVE_RELEASE_DATE "2013-12-27" | |||
#define OCTAVE_RELEASE_DATE "2013-02-21" | ||||
#define OCTAVE_COPYRIGHT "Copyright (C) 2013 John W. Eaton and others." | #define OCTAVE_COPYRIGHT "Copyright (C) 2013 John W. Eaton and others." | |||
// This is the first line printed by --version. The GNU coding | #include <string> | |||
// standards say that the version number should follow the last space | ||||
// on the line. | ||||
#define OCTAVE_NAME_AND_VERSION "GNU Octave, version " OCTAVE_VERSION | ||||
#define OCTAVE_CONFIG_STATEMENT \ | ||||
"Octave was configured for \"" OCTAVE_CANONICAL_HOST_TYPE "\"." | ||||
#define OCTAVE_COPYING_STATEMENT \ | ||||
"This is free software; see the source code for copying conditions." | ||||
#define X_OCTAVE_WARRANTY_STATEMENT(ARG) \ | ||||
"There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or\n\ | ||||
FITNESS FOR A PARTICULAR PURPOSE." ARG | ||||
#define OCTAVE_WARRANTY_STATEMENT \ | ||||
X_OCTAVE_WARRANTY_STATEMENT ("") | ||||
#define OCTAVE_WWW_STATEMENT \ | ||||
"Additional information about Octave is available at http://www.octave.or | ||||
g." | ||||
#define OCTAVE_CONTRIB_STATEMENT \ | extern OCTINTERP_API std::string octave_www_statement (bool html = false); | |||
"Please contribute if you find this software useful.\n\ | ||||
For more information, visit http://www.octave.org/get-involved.html" | ||||
#define OCTAVE_BUGS_STATEMENT \ | extern OCTINTERP_API std::string octave_contrib_statement (bool html = fals | |||
"Read http://www.octave.org/bugs.html to learn how to submit bug reports. | e); | |||
" | ||||
#define OCTAVE_NAME_VERSION_AND_COPYRIGHT \ | extern OCTINTERP_API std::string octave_bugs_statement (bool html = false); | |||
OCTAVE_NAME_AND_VERSION "\n" \ | ||||
OCTAVE_COPYRIGHT | ||||
#define OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY \ | extern OCTINTERP_API std::string octave_name_version_and_copyright (void); | |||
X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY("") \ | ||||
#define X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY(ARG) \ | extern OCTINTERP_API std::string | |||
OCTAVE_NAME_VERSION_AND_COPYRIGHT "\n" \ | octave_name_version_copyright_copying_and_warranty | |||
OCTAVE_COPYING_STATEMENT "\n" \ | (bool html = false, const std::string& extra_info = std::string ()); | |||
X_OCTAVE_WARRANTY_STATEMENT (ARG) "\n\n" \ | ||||
OCTAVE_CONFIG_STATEMENT | ||||
#define X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS(ARG) \ | extern OCTINTERP_API std::string | |||
X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_AND_WARRANTY(ARG) "\n\n" \ | octave_name_version_copyright_copying_warranty_and_bugs | |||
OCTAVE_WWW_STATEMENT "\n\n" \ | (bool html = false, const std::string& extra_info = std::string ()); | |||
OCTAVE_CONTRIB_STATEMENT "\n\n" \ | ||||
OCTAVE_BUGS_STATEMENT | ||||
#define OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS \ | extern OCTINTERP_API std::string octave_startup_message (bool html = false) | |||
X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS ("") | ; | |||
#define OCTAVE_STARTUP_MESSAGE \ | ||||
X_OCTAVE_NAME_VERSION_COPYRIGHT_COPYING_WARRANTY_AND_BUGS \ | ||||
(" For details, type `warranty'.") "\n\n" \ | ||||
"For information about changes from previous versions, type `news'." | ||||
#endif | #endif | |||
End of changes. 14 change blocks. | ||||
55 lines changed or deleted | 19 lines changed or added | |||
xdiv.h | xdiv.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
Copyright (C) 2008 Jaroslav Hajek | Copyright (C) 2008 Jaroslav Hajek | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
skipping to change at line 51 | skipping to change at line 51 | |||
extern ComplexMatrix x_el_div (const Complex a, const ComplexMatrix& b); | extern ComplexMatrix x_el_div (const Complex a, const ComplexMatrix& b); | |||
extern NDArray x_el_div (double a, const NDArray& b); | extern NDArray x_el_div (double a, const NDArray& b); | |||
extern ComplexNDArray x_el_div (double a, const ComplexNDArray& b); | extern ComplexNDArray x_el_div (double a, const ComplexNDArray& b); | |||
extern ComplexNDArray x_el_div (const Complex a, const NDArray& b); | extern ComplexNDArray x_el_div (const Complex a, const NDArray& b); | |||
extern ComplexNDArray x_el_div (const Complex a, const ComplexNDArray& b); | extern ComplexNDArray x_el_div (const Complex a, const ComplexNDArray& b); | |||
extern Matrix xleftdiv (const Matrix& a, const Matrix& b, MatrixType &typ, | extern Matrix xleftdiv (const Matrix& a, const Matrix& b, MatrixType &typ, | |||
blas_trans_type transt = blas_no_trans); | blas_trans_type transt = blas_no_trans); | |||
extern ComplexMatrix xleftdiv (const Matrix& a, const ComplexMatrix& b, | extern ComplexMatrix xleftdiv (const Matrix& a, const ComplexMatrix& b, | |||
MatrixType &typ, blas_trans_type transt = bl | MatrixType &typ, | |||
as_no_trans); | blas_trans_type transt = blas_no_trans); | |||
extern ComplexMatrix xleftdiv (const ComplexMatrix& a, const Matrix& b, | extern ComplexMatrix xleftdiv (const ComplexMatrix& a, const Matrix& b, | |||
MatrixType &typ, blas_trans_type transt = bl | MatrixType &typ, | |||
as_no_trans); | blas_trans_type transt = blas_no_trans); | |||
extern ComplexMatrix xleftdiv (const ComplexMatrix& a, const ComplexMatrix& b, | extern ComplexMatrix xleftdiv (const ComplexMatrix& a, const ComplexMatrix& b, | |||
MatrixType &typ, blas_trans_type transt = bl | MatrixType &typ, | |||
as_no_trans); | blas_trans_type transt = blas_no_trans); | |||
extern FloatMatrix xdiv (const FloatMatrix& a, const FloatMatrix& b, Matrix | extern FloatMatrix xdiv (const FloatMatrix& a, const FloatMatrix& b, | |||
Type &typ); | MatrixType &typ); | |||
extern FloatComplexMatrix xdiv (const FloatMatrix& a, const FloatComplexMat | extern FloatComplexMatrix xdiv (const FloatMatrix& a, | |||
rix& b, | const FloatComplexMatrix& b, | |||
MatrixType &typ); | MatrixType &typ); | |||
extern FloatComplexMatrix xdiv (const FloatComplexMatrix& a, const FloatMat | extern FloatComplexMatrix xdiv (const FloatComplexMatrix& a, | |||
rix& b, | const FloatMatrix& b, | |||
MatrixType &typ); | MatrixType &typ); | |||
extern FloatComplexMatrix xdiv (const FloatComplexMatrix& a, const FloatCom | extern FloatComplexMatrix xdiv (const FloatComplexMatrix& a, | |||
plexMatrix& b, | const FloatComplexMatrix& b, | |||
MatrixType &typ); | MatrixType &typ); | |||
extern FloatMatrix x_el_div (float a, const FloatMatrix& b); | extern FloatMatrix x_el_div (float a, const FloatMatrix& b); | |||
extern FloatComplexMatrix x_el_div (float a, const FloatComplexMatrix& b); | extern FloatComplexMatrix x_el_div (float a, const FloatComplexMatrix& b); | |||
extern FloatComplexMatrix x_el_div (const FloatComplex a, const FloatMatrix & b); | extern FloatComplexMatrix x_el_div (const FloatComplex a, const FloatMatrix & b); | |||
extern FloatComplexMatrix x_el_div (const FloatComplex a, const FloatComple | extern FloatComplexMatrix x_el_div (const FloatComplex a, | |||
xMatrix& b); | const FloatComplexMatrix& b); | |||
extern FloatNDArray x_el_div (float a, const FloatNDArray& b); | extern FloatNDArray x_el_div (float a, const FloatNDArray& b); | |||
extern FloatComplexNDArray x_el_div (float a, const FloatComplexNDArray& b) ; | extern FloatComplexNDArray x_el_div (float a, const FloatComplexNDArray& b) ; | |||
extern FloatComplexNDArray x_el_div (const FloatComplex a, const FloatNDArr | extern FloatComplexNDArray x_el_div (const FloatComplex a, | |||
ay& b); | const FloatNDArray& b); | |||
extern FloatComplexNDArray x_el_div (const FloatComplex a, const FloatCompl | extern FloatComplexNDArray x_el_div (const FloatComplex a, | |||
exNDArray& b); | const FloatComplexNDArray& b); | |||
extern FloatMatrix xleftdiv (const FloatMatrix& a, const FloatMatrix& b, Ma | extern FloatMatrix xleftdiv (const FloatMatrix& a, const FloatMatrix& b, | |||
trixType &typ, | MatrixType &typ, | |||
blas_trans_type transt = blas_no_trans); | blas_trans_type transt = blas_no_trans); | |||
extern FloatComplexMatrix xleftdiv (const FloatMatrix& a, const FloatComple | extern FloatComplexMatrix xleftdiv (const FloatMatrix& a, | |||
xMatrix& b, | const FloatComplexMatrix& b, | |||
MatrixType &typ, blas_trans_type transt = bl | MatrixType &typ, | |||
as_no_trans); | blas_trans_type transt = blas_no_trans) | |||
extern FloatComplexMatrix xleftdiv (const FloatComplexMatrix& a, const Floa | ; | |||
tMatrix& b, | extern FloatComplexMatrix xleftdiv (const FloatComplexMatrix& a, | |||
MatrixType &typ, blas_trans_type transt = bl | const FloatMatrix& b, | |||
as_no_trans); | MatrixType &typ, | |||
extern FloatComplexMatrix xleftdiv (const FloatComplexMatrix& a, const Floa | blas_trans_type transt = blas_no_trans) | |||
tComplexMatrix& b, | ; | |||
MatrixType &typ, blas_trans_type transt = bl | extern FloatComplexMatrix xleftdiv (const FloatComplexMatrix& a, | |||
as_no_trans); | const FloatComplexMatrix& b, | |||
MatrixType &typ, | ||||
blas_trans_type transt = blas_no_trans) | ||||
; | ||||
extern Matrix xdiv (const Matrix& a, const DiagMatrix& b); | extern Matrix xdiv (const Matrix& a, const DiagMatrix& b); | |||
extern ComplexMatrix xdiv (const ComplexMatrix& a, const DiagMatrix& b); | extern ComplexMatrix xdiv (const ComplexMatrix& a, const DiagMatrix& b); | |||
extern ComplexMatrix xdiv (const ComplexMatrix& a, const ComplexDiagMatrix& b); | extern ComplexMatrix xdiv (const ComplexMatrix& a, const ComplexDiagMatrix& b); | |||
extern DiagMatrix xdiv (const DiagMatrix& a, const DiagMatrix& b); | extern DiagMatrix xdiv (const DiagMatrix& a, const DiagMatrix& b); | |||
extern ComplexDiagMatrix xdiv (const ComplexDiagMatrix& a, const DiagMatrix & b); | extern ComplexDiagMatrix xdiv (const ComplexDiagMatrix& a, const DiagMatrix & b); | |||
extern ComplexDiagMatrix xdiv (const ComplexDiagMatrix& a, const ComplexDia | extern ComplexDiagMatrix xdiv (const ComplexDiagMatrix& a, | |||
gMatrix& b); | const ComplexDiagMatrix& b); | |||
extern FloatMatrix xdiv (const FloatMatrix& a, const FloatDiagMatrix& b); | extern FloatMatrix xdiv (const FloatMatrix& a, const FloatDiagMatrix& b); | |||
extern FloatComplexMatrix xdiv (const FloatComplexMatrix& a, | extern FloatComplexMatrix xdiv (const FloatComplexMatrix& a, | |||
const FloatDiagMatrix& b); | const FloatDiagMatrix& b); | |||
extern FloatComplexMatrix xdiv (const FloatMatrix& a, | extern FloatComplexMatrix xdiv (const FloatMatrix& a, | |||
const FloatComplexDiagMatrix& b); | const FloatComplexDiagMatrix& b); | |||
extern FloatComplexMatrix xdiv (const FloatComplexMatrix& a, | extern FloatComplexMatrix xdiv (const FloatComplexMatrix& a, | |||
const FloatComplexDiagMatrix& b); | const FloatComplexDiagMatrix& b); | |||
extern FloatDiagMatrix xdiv (const FloatDiagMatrix& a, const FloatDiagMatri | extern FloatDiagMatrix xdiv (const FloatDiagMatrix& a, | |||
x& b); | const FloatDiagMatrix& b); | |||
extern FloatComplexDiagMatrix xdiv (const FloatComplexDiagMatrix& a, | extern FloatComplexDiagMatrix xdiv (const FloatComplexDiagMatrix& a, | |||
const FloatDiagMatrix& b); | const FloatDiagMatrix& b); | |||
extern FloatComplexDiagMatrix xdiv (const FloatComplexDiagMatrix& a, | extern FloatComplexDiagMatrix xdiv (const FloatComplexDiagMatrix& a, | |||
const FloatComplexDiagMatrix& b); | const FloatComplexDiagMatrix& b); | |||
extern Matrix xleftdiv (const DiagMatrix& a, const Matrix& b); | extern Matrix xleftdiv (const DiagMatrix& a, const Matrix& b); | |||
extern ComplexMatrix xleftdiv (const DiagMatrix& a, const ComplexMatrix& b) ; | extern ComplexMatrix xleftdiv (const DiagMatrix& a, const ComplexMatrix& b) ; | |||
extern ComplexMatrix xleftdiv (const ComplexDiagMatrix& a, const ComplexMat | extern ComplexMatrix xleftdiv (const ComplexDiagMatrix& a, | |||
rix& b); | const ComplexMatrix& b); | |||
extern DiagMatrix xleftdiv (const DiagMatrix& a, const DiagMatrix& b); | extern DiagMatrix xleftdiv (const DiagMatrix& a, const DiagMatrix& b); | |||
extern ComplexDiagMatrix xleftdiv (const DiagMatrix& a, const ComplexDiagMa | extern ComplexDiagMatrix xleftdiv (const DiagMatrix& a, | |||
trix& b); | const ComplexDiagMatrix& b); | |||
extern ComplexDiagMatrix xleftdiv (const ComplexDiagMatrix& a, const Comple | extern ComplexDiagMatrix xleftdiv (const ComplexDiagMatrix& a, | |||
xDiagMatrix& b); | const ComplexDiagMatrix& b); | |||
extern FloatMatrix xleftdiv (const FloatDiagMatrix& a, | extern FloatMatrix xleftdiv (const FloatDiagMatrix& a, | |||
const FloatMatrix& b); | const FloatMatrix& b); | |||
extern FloatComplexMatrix xleftdiv (const FloatDiagMatrix& a, | extern FloatComplexMatrix xleftdiv (const FloatDiagMatrix& a, | |||
const FloatComplexMatrix& b); | const FloatComplexMatrix& b); | |||
extern FloatComplexMatrix xleftdiv (const FloatComplexDiagMatrix& a, | extern FloatComplexMatrix xleftdiv (const FloatComplexDiagMatrix& a, | |||
const FloatComplexMatrix& b); | const FloatComplexMatrix& b); | |||
extern FloatDiagMatrix xleftdiv (const FloatDiagMatrix& a, | extern FloatDiagMatrix xleftdiv (const FloatDiagMatrix& a, | |||
const FloatDiagMatrix& b); | const FloatDiagMatrix& b); | |||
End of changes. 13 change blocks. | ||||
48 lines changed or deleted | 51 lines changed or added | |||
xnorm.h | xnorm.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2008-2012 VZLU Prague, a.s. | Copyright (C) 2008-2013 VZLU Prague, a.s. | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 32 | skipping to change at line 32 | |||
// author: Jaroslav Hajek <highegg@gmail.com> | // author: Jaroslav Hajek <highegg@gmail.com> | |||
#if !defined (octave_xnorm_h) | #if !defined (octave_xnorm_h) | |||
#define octave_xnorm_h 1 | #define octave_xnorm_h 1 | |||
#include "oct-norm.h" | #include "oct-norm.h" | |||
class octave_value; | class octave_value; | |||
extern OCTINTERP_API octave_value xnorm (const octave_value& x, const octav | extern OCTINTERP_API octave_value | |||
e_value& p); | xnorm (const octave_value& x, const octave_value& p); | |||
extern OCTINTERP_API octave_value xcolnorms (const octave_value& x, const o | ||||
ctave_value& p); | extern OCTINTERP_API octave_value | |||
extern OCTINTERP_API octave_value xrownorms (const octave_value& x, const o | xcolnorms (const octave_value& x, const octave_value& p); | |||
ctave_value& p); | ||||
extern OCTINTERP_API octave_value xfrobnorm (const octave_value& x); | extern OCTINTERP_API octave_value | |||
xrownorms (const octave_value& x, const octave_value& p); | ||||
extern OCTINTERP_API octave_value | ||||
xfrobnorm (const octave_value& x); | ||||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
8 lines changed or deleted | 12 lines changed or added | |||
xpow.h | xpow.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 1993-2012 John W. Eaton | Copyright (C) 1993-2013 John W. Eaton | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 60 | skipping to change at line 60 | |||
extern OCTINTERP_API octave_value xpow (const Matrix& a, const Complex& b); | extern OCTINTERP_API octave_value xpow (const Matrix& a, const Complex& b); | |||
extern OCTINTERP_API octave_value xpow (const DiagMatrix& a, double b); | extern OCTINTERP_API octave_value xpow (const DiagMatrix& a, double b); | |||
extern OCTINTERP_API octave_value xpow (const DiagMatrix& a, const Complex& b); | extern OCTINTERP_API octave_value xpow (const DiagMatrix& a, const Complex& b); | |||
extern OCTINTERP_API octave_value xpow (const PermMatrix& a, double b); | extern OCTINTERP_API octave_value xpow (const PermMatrix& a, double b); | |||
extern OCTINTERP_API octave_value xpow (const Complex& a, double b); | extern OCTINTERP_API octave_value xpow (const Complex& a, double b); | |||
extern OCTINTERP_API octave_value xpow (const Complex& a, const Matrix& b); | extern OCTINTERP_API octave_value xpow (const Complex& a, const Matrix& b); | |||
extern OCTINTERP_API octave_value xpow (const Complex& a, const Complex& b) ; | extern OCTINTERP_API octave_value xpow (const Complex& a, const Complex& b) ; | |||
extern OCTINTERP_API octave_value xpow (const Complex& a, const ComplexMatr | extern OCTINTERP_API octave_value xpow (const Complex& a, | |||
ix& b); | const ComplexMatrix& b); | |||
extern OCTINTERP_API octave_value xpow (const ComplexMatrix& a, double b); | extern OCTINTERP_API octave_value xpow (const ComplexMatrix& a, double b); | |||
extern OCTINTERP_API octave_value xpow (const ComplexMatrix& a, const Compl | extern OCTINTERP_API octave_value xpow (const ComplexMatrix& a, | |||
ex& b); | const Complex& b); | |||
extern OCTINTERP_API octave_value xpow (const ComplexDiagMatrix& a, double b); | extern OCTINTERP_API octave_value xpow (const ComplexDiagMatrix& a, double b); | |||
extern OCTINTERP_API octave_value xpow (const ComplexDiagMatrix& a, const C | extern OCTINTERP_API octave_value xpow (const ComplexDiagMatrix& a, | |||
omplex& b); | const Complex& b); | |||
extern OCTINTERP_API octave_value elem_xpow (double a, const Matrix& b); | extern OCTINTERP_API octave_value elem_xpow (double a, const Matrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (double a, const ComplexMatrix& b); | extern OCTINTERP_API octave_value elem_xpow (double a, const ComplexMatrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (double a, const Range& r); | extern OCTINTERP_API octave_value elem_xpow (double a, const Range& r); | |||
extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, double b); | extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, double b); | |||
extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, const Matrix& b); | extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, const Matrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, const Complex & b); | extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, const Complex & b); | |||
extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, const Complex | extern OCTINTERP_API octave_value elem_xpow (const Matrix& a, | |||
Matrix& b); | const ComplexMatrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const Matrix & b); | extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const Matrix & b); | |||
extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const Comple | extern OCTINTERP_API octave_value elem_xpow (const Complex& a, | |||
xMatrix& b); | const ComplexMatrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const Range& r); | extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const Range& r); | |||
extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, double b); | extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, double b); | |||
extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, const | extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, | |||
Matrix& b); | const Matrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, const | extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, | |||
Complex& b); | const Complex& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, const | extern OCTINTERP_API octave_value elem_xpow (const ComplexMatrix& a, | |||
ComplexMatrix& b); | const ComplexMatrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (double a, const NDArray& b); | extern OCTINTERP_API octave_value elem_xpow (double a, const NDArray& b); | |||
extern OCTINTERP_API octave_value elem_xpow (double a, const ComplexNDArray & b); | extern OCTINTERP_API octave_value elem_xpow (double a, const ComplexNDArray & b); | |||
extern OCTINTERP_API octave_value elem_xpow (const NDArray& a, double b); | extern OCTINTERP_API octave_value elem_xpow (const NDArray& a, double b); | |||
extern OCTINTERP_API octave_value elem_xpow (const NDArray& a, const NDArra | extern OCTINTERP_API octave_value elem_xpow (const NDArray& a, | |||
y& b); | const NDArray& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const NDArray& a, const Comple | extern OCTINTERP_API octave_value elem_xpow (const NDArray& a, | |||
x& b); | const Complex& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const NDArray& a, const Comple | extern OCTINTERP_API octave_value elem_xpow (const NDArray& a, | |||
xNDArray& b); | const ComplexNDArray& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const NDArra | extern OCTINTERP_API octave_value elem_xpow (const Complex& a, | |||
y& b); | const NDArray& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const Complex& a, const Comple | extern OCTINTERP_API octave_value elem_xpow (const Complex& a, | |||
xNDArray& b); | const ComplexNDArray& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const ComplexNDArray& a, doubl | extern OCTINTERP_API octave_value elem_xpow (const ComplexNDArray& a, | |||
e b); | double b); | |||
extern OCTINTERP_API octave_value elem_xpow (const ComplexNDArray& a, const | extern OCTINTERP_API octave_value elem_xpow (const ComplexNDArray& a, | |||
NDArray& b); | const NDArray& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const ComplexNDArray& a, const | extern OCTINTERP_API octave_value elem_xpow (const ComplexNDArray& a, | |||
Complex& b); | const Complex& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const ComplexNDArray& a, const | extern OCTINTERP_API octave_value elem_xpow (const ComplexNDArray& a, | |||
ComplexNDArray& b); | const ComplexNDArray& b); | |||
extern OCTINTERP_API octave_value xpow (float a, float b); | extern OCTINTERP_API octave_value xpow (float a, float b); | |||
extern OCTINTERP_API octave_value xpow (float a, const FloatMatrix& b); | extern OCTINTERP_API octave_value xpow (float a, const FloatMatrix& b); | |||
extern OCTINTERP_API octave_value xpow (float a, const FloatComplex& b); | extern OCTINTERP_API octave_value xpow (float a, const FloatComplex& b); | |||
extern OCTINTERP_API octave_value xpow (float a, const FloatComplexMatrix& b); | extern OCTINTERP_API octave_value xpow (float a, const FloatComplexMatrix& b); | |||
extern OCTINTERP_API octave_value xpow (const FloatMatrix& a, float b); | extern OCTINTERP_API octave_value xpow (const FloatMatrix& a, float b); | |||
extern OCTINTERP_API octave_value xpow (const FloatMatrix& a, const FloatCo | extern OCTINTERP_API octave_value xpow (const FloatMatrix& a, | |||
mplex& b); | const FloatComplex& b); | |||
extern OCTINTERP_API octave_value xpow (const FloatDiagMatrix& a, float b); | extern OCTINTERP_API octave_value xpow (const FloatDiagMatrix& a, float b); | |||
extern OCTINTERP_API octave_value xpow (const FloatDiagMatrix& a, const Flo | extern OCTINTERP_API octave_value xpow (const FloatDiagMatrix& a, | |||
atComplex& b); | const FloatComplex& b); | |||
extern OCTINTERP_API octave_value xpow (const FloatComplex& a, float b); | extern OCTINTERP_API octave_value xpow (const FloatComplex& a, float b); | |||
extern OCTINTERP_API octave_value xpow (const FloatComplex& a, const FloatM | extern OCTINTERP_API octave_value xpow (const FloatComplex& a, | |||
atrix& b); | const FloatMatrix& b); | |||
extern OCTINTERP_API octave_value xpow (const FloatComplex& a, const FloatC | extern OCTINTERP_API octave_value xpow (const FloatComplex& a, | |||
omplex& b); | const FloatComplex& b); | |||
extern OCTINTERP_API octave_value xpow (const FloatComplex& a, const FloatC | extern OCTINTERP_API octave_value xpow (const FloatComplex& a, | |||
omplexMatrix& b); | const FloatComplexMatrix& b); | |||
extern OCTINTERP_API octave_value xpow (const FloatComplexMatrix& a, float b); | extern OCTINTERP_API octave_value xpow (const FloatComplexMatrix& a, float b); | |||
extern OCTINTERP_API octave_value xpow (const FloatComplexMatrix& a, const | extern OCTINTERP_API octave_value xpow (const FloatComplexMatrix& a, | |||
FloatComplex& b); | const FloatComplex& b); | |||
extern OCTINTERP_API octave_value xpow (const FloatComplexDiagMatrix& a, fl | extern OCTINTERP_API octave_value xpow (const FloatComplexDiagMatrix& a, | |||
oat b); | float b); | |||
extern OCTINTERP_API octave_value xpow (const FloatComplexDiagMatrix& a, co | extern OCTINTERP_API octave_value xpow (const FloatComplexDiagMatrix& a, | |||
nst FloatComplex& b); | const FloatComplex& b); | |||
extern OCTINTERP_API octave_value elem_xpow (float a, const FloatMatrix& b) ; | extern OCTINTERP_API octave_value elem_xpow (float a, const FloatMatrix& b) ; | |||
extern OCTINTERP_API octave_value elem_xpow (float a, const FloatComplexMat | extern OCTINTERP_API octave_value elem_xpow (float a, | |||
rix& b); | const FloatComplexMatrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatMatrix& a, float b) ; | extern OCTINTERP_API octave_value elem_xpow (const FloatMatrix& a, float b) ; | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatMatrix& a, const Fl | extern OCTINTERP_API octave_value elem_xpow (const FloatMatrix& a, | |||
oatMatrix& b); | const FloatMatrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatMatrix& a, const Fl | extern OCTINTERP_API octave_value elem_xpow (const FloatMatrix& a, | |||
oatComplex& b); | const FloatComplex& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatMatrix& a, const Fl | extern OCTINTERP_API octave_value elem_xpow (const FloatMatrix& a, | |||
oatComplexMatrix& b); | const FloatComplexMatrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatComplex& a, const F | extern OCTINTERP_API octave_value elem_xpow (const FloatComplex& a, | |||
loatMatrix& b); | const FloatMatrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatComplex& a, const F | extern OCTINTERP_API octave_value elem_xpow (const FloatComplex& a, | |||
loatComplexMatrix& b); | const FloatComplexMatrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatComplexMatrix& a, f | extern OCTINTERP_API octave_value elem_xpow (const FloatComplexMatrix& a, | |||
loat b); | float b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatComplexMatrix& a, c | extern OCTINTERP_API octave_value elem_xpow (const FloatComplexMatrix& a, | |||
onst FloatMatrix& b); | const FloatMatrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatComplexMatrix& a, c | extern OCTINTERP_API octave_value elem_xpow (const FloatComplexMatrix& a, | |||
onst FloatComplex& b); | const FloatComplex& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatComplexMatrix& a, c | extern OCTINTERP_API octave_value elem_xpow (const FloatComplexMatrix& a, | |||
onst FloatComplexMatrix& b); | const FloatComplexMatrix& b); | |||
extern OCTINTERP_API octave_value elem_xpow (float a, const FloatNDArray& b ); | extern OCTINTERP_API octave_value elem_xpow (float a, const FloatNDArray& b ); | |||
extern OCTINTERP_API octave_value elem_xpow (float a, const FloatComplexNDA | extern OCTINTERP_API octave_value elem_xpow (float a, | |||
rray& b); | const FloatComplexNDArray& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatNDArray& a, float b ); | extern OCTINTERP_API octave_value elem_xpow (const FloatNDArray& a, float b ); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatNDArray& a, const F | extern OCTINTERP_API octave_value elem_xpow (const FloatNDArray& a, | |||
loatNDArray& b); | const FloatNDArray& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatNDArray& a, const F | extern OCTINTERP_API octave_value elem_xpow (const FloatNDArray& a, | |||
loatComplex& b); | const FloatComplex& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatNDArray& a, const F | extern OCTINTERP_API octave_value elem_xpow (const FloatNDArray& a, | |||
loatComplexNDArray& b); | const FloatComplexNDArray& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatComplex& a, const F | extern OCTINTERP_API octave_value elem_xpow (const FloatComplex& a, | |||
loatNDArray& b); | const FloatNDArray& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatComplex& a, const F | extern OCTINTERP_API octave_value elem_xpow (const FloatComplex& a, | |||
loatComplexNDArray& b); | const FloatComplexNDArray& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatComplexNDArray& a, | extern OCTINTERP_API octave_value elem_xpow (const FloatComplexNDArray& a, | |||
float b); | float b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatComplexNDArray& a, | extern OCTINTERP_API octave_value elem_xpow (const FloatComplexNDArray& a, | |||
const FloatNDArray& b); | const FloatNDArray& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatComplexNDArray& a, | extern OCTINTERP_API octave_value elem_xpow (const FloatComplexNDArray& a, | |||
const FloatComplex& b); | const FloatComplex& b); | |||
extern OCTINTERP_API octave_value elem_xpow (const FloatComplexNDArray& a, | extern OCTINTERP_API octave_value elem_xpow (const FloatComplexNDArray& a, | |||
const FloatComplexNDArray& b); | const FloatComplexNDArray& b); | |||
#endif | #endif | |||
End of changes. 17 change blocks. | ||||
97 lines changed or deleted | 97 lines changed or added | |||
zfstream.h | zfstream.h | |||
---|---|---|---|---|
/* | /* | |||
Copyright (C) 2005-2012 Ludwig Schwardt, Kevin Ruland | Copyright (C) 2005-2013 Ludwig Schwardt, Kevin Ruland | |||
This file is part of Octave. | This file is part of Octave. | |||
Octave is free software; you can redistribute it and/or modify it | Octave is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the | under the terms of the GNU General Public License as published by the | |||
Free Software Foundation; either version 3 of the License, or (at your | Free Software Foundation; either version 3 of the License, or (at your | |||
option) any later version. | option) any later version. | |||
Octave is distributed in the hope that it will be useful, but WITHOUT | Octave is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
skipping to change at line 47 | skipping to change at line 47 | |||
#include <iosfwd> | #include <iosfwd> | |||
#include "zlib.h" | #include "zlib.h" | |||
/************************************************************************** ***/ | /************************************************************************** ***/ | |||
/** | /** | |||
* @brief Gzipped file stream buffer class. | * @brief Gzipped file stream buffer class. | |||
* | * | |||
* This class implements basic_filebuf for gzipped files. It doesn't yet s | * This class implements basic_filebuf for gzipped files. It doesn't yet | |||
upport | * support seeking (allowed by zlib but slow/limited), putback and read/wr | |||
* seeking (allowed by zlib but slow/limited), putback and read/write acce | ite | |||
ss | * access * (tricky). Otherwise, it attempts to be a drop-in replacement | |||
* (tricky). Otherwise, it attempts to be a drop-in replacement for the st | for | |||
andard | * the standard file streambuf. | |||
* file streambuf. | ||||
*/ | */ | |||
class gzfilebuf : public std::streambuf | class gzfilebuf : public std::streambuf | |||
{ | { | |||
public: | public: | |||
// Default constructor. | // Default constructor. | |||
gzfilebuf(); | gzfilebuf (); | |||
// Destructor. | // Destructor. | |||
virtual | virtual | |||
~gzfilebuf(); | ~gzfilebuf (); | |||
/** | /** | |||
* @brief Set compression level and strategy on the fly. | * @brief Set compression level and strategy on the fly. | |||
* @param comp_level Compression level (see zlib.h for allowed values) | * @param comp_level Compression level (see zlib.h for allowed values) | |||
* @param comp_strategy Compression strategy (see zlib.h for allowed v alues) | * @param comp_strategy Compression strategy (see zlib.h for allowed v alues) | |||
* @return Z_OK on success, Z_STREAM_ERROR otherwise. | * @return Z_OK on success, Z_STREAM_ERROR otherwise. | |||
* | * | |||
* Unfortunately, these parameters cannot be modified separately, as the | * Unfortunately, these parameters cannot be modified separately, as the | |||
* previous zfstream version assumed. Since the strategy is seldom chang ed, | * previous zfstream version assumed. Since the strategy is seldom chang ed, | |||
* it can default and setcompression(level) then becomes like the old | * it can default and setcompression(level) then becomes like the old | |||
* setcompressionlevel(level). | * setcompressionlevel(level). | |||
*/ | */ | |||
int | int | |||
setcompression(int comp_level, | setcompression (int comp_level, | |||
int comp_strategy = Z_DEFAULT_STRATEGY); | int comp_strategy = Z_DEFAULT_STRATEGY); | |||
/** | /** | |||
* @brief Check if file is open. | * @brief Check if file is open. | |||
* @return True if file is open. | * @return True if file is open. | |||
*/ | */ | |||
bool | bool | |||
is_open() const { return (file != 0); } | is_open () const { return (file != 0); } | |||
/** | /** | |||
* @brief Open gzipped file. | * @brief Open gzipped file. | |||
* @param name File name. | * @param name File name. | |||
* @param mode Open mode flags. | * @param mode Open mode flags. | |||
* @return @c this on success, NULL on failure. | * @return @c this on success, NULL on failure. | |||
*/ | */ | |||
gzfilebuf* | gzfilebuf* | |||
open(const char* name, | open (const char* name, | |||
std::ios_base::openmode mode); | std::ios_base::openmode mode); | |||
/** | /** | |||
* @brief Attach to already open gzipped file. | * @brief Attach to already open gzipped file. | |||
* @param fd File descriptor. | * @param fd File descriptor. | |||
* @param mode Open mode flags. | * @param mode Open mode flags. | |||
* @return @c this on success, NULL on failure. | * @return @c this on success, NULL on failure. | |||
*/ | */ | |||
gzfilebuf* | gzfilebuf* | |||
attach(int fd, | attach (int fd, | |||
std::ios_base::openmode mode); | std::ios_base::openmode mode); | |||
/** | /** | |||
* @brief Close gzipped file. | * @brief Close gzipped file. | |||
* @return @c this on success, NULL on failure. | * @return @c this on success, NULL on failure. | |||
*/ | */ | |||
gzfilebuf* | gzfilebuf* | |||
close(); | close (); | |||
protected: | protected: | |||
/** | /** | |||
* @brief Convert ios open mode int to mode string used by zlib. | * @brief Convert ios open mode int to mode string used by zlib. | |||
* @return True if valid mode flag combination. | * @return True if valid mode flag combination. | |||
*/ | */ | |||
bool | bool | |||
open_mode(std::ios_base::openmode mode, | open_mode (std::ios_base::openmode mode, | |||
char* c_mode) const; | char* c_mode) const; | |||
/** | /** | |||
* @brief Number of characters available in stream buffer. | * @brief Number of characters available in stream buffer. | |||
* @return Number of characters. | * @return Number of characters. | |||
* | * | |||
* This indicates number of characters in get area of stream buffer. | * This indicates number of characters in get area of stream buffer. | |||
* These characters can be read without accessing the gzipped file. | * These characters can be read without accessing the gzipped file. | |||
*/ | */ | |||
virtual std::streamsize | virtual std::streamsize | |||
showmanyc(); | showmanyc (); | |||
/** | /** | |||
* @brief Fill get area from gzipped file. | * @brief Fill get area from gzipped file. | |||
* @return First character in get area on success, EOF on error. | * @return First character in get area on success, EOF on error. | |||
* | * | |||
* This actually reads characters from gzipped file to stream | * This actually reads characters from gzipped file to stream | |||
* buffer. Always buffered. | * buffer. Always buffered. | |||
*/ | */ | |||
virtual int_type | virtual int_type | |||
underflow(); | underflow (); | |||
/** | /** | |||
* @brief Write put area to gzipped file. | * @brief Write put area to gzipped file. | |||
* @param c Extra character to add to buffer contents. | * @param c Extra character to add to buffer contents. | |||
* @return Non-EOF on success, EOF on error. | * @return Non-EOF on success, EOF on error. | |||
* | * | |||
* This actually writes characters in stream buffer to | * This actually writes characters in stream buffer to | |||
* gzipped file. With unbuffered output this is done one | * gzipped file. With unbuffered output this is done one | |||
* character at a time. | * character at a time. | |||
*/ | */ | |||
virtual int_type | virtual int_type | |||
overflow(int_type c = traits_type::eof()); | overflow (int_type c = traits_type::eof ()); | |||
/** | /** | |||
* @brief Installs external stream buffer. | * @brief Installs external stream buffer. | |||
* @param p Pointer to char buffer. | * @param p Pointer to char buffer. | |||
* @param n Size of external buffer. | * @param n Size of external buffer. | |||
* @return @c this on success, NULL on failure. | * @return @c this on success, NULL on failure. | |||
* | * | |||
* Call setbuf(0,0) to enable unbuffered output. | * Call setbuf(0,0) to enable unbuffered output. | |||
*/ | */ | |||
virtual std::streambuf* | virtual std::streambuf* | |||
setbuf(char_type* p, | setbuf (char_type* p, | |||
std::streamsize n); | std::streamsize n); | |||
/** | /** | |||
* @brief Flush stream buffer to file. | * @brief Flush stream buffer to file. | |||
* @return 0 on success, -1 on error. | * @return 0 on success, -1 on error. | |||
* | * | |||
* This calls underflow(EOF) to do the job. | * This calls underflow(EOF) to do the job. | |||
*/ | */ | |||
virtual int | virtual int | |||
sync(); | sync (); | |||
/** | /** | |||
* @brief Alters the stream positions. | * @brief Alters the stream positions. | |||
* | * | |||
* Each derived class provides its own appropriate behavior. | * Each derived class provides its own appropriate behavior. | |||
*/ | */ | |||
virtual pos_type | virtual pos_type | |||
seekoff(off_type off, std::ios_base::seekdir way, | seekoff (off_type off, std::ios_base::seekdir way, | |||
std::ios_base::openmode mode = | std::ios_base::openmode mode = | |||
std::ios_base::in|std::ios_base::out); | std::ios_base::in|std::ios_base::out); | |||
/** | /** | |||
* @brief Alters the stream positions. | * @brief Alters the stream positions. | |||
* | * | |||
* Each derived class provides its own appropriate behavior. | * Each derived class provides its own appropriate behavior. | |||
*/ | */ | |||
virtual pos_type | virtual pos_type | |||
seekpos(pos_type sp, std::ios_base::openmode mode = | seekpos (pos_type sp, std::ios_base::openmode mode = | |||
std::ios_base::in|std::ios_base::out); | std::ios_base::in|std::ios_base::out); | |||
virtual int_type | virtual int_type | |||
pbackfail (int_type c = traits_type::eof()); | pbackfail (int_type c = traits_type::eof ()); | |||
// | // | |||
// Some future enhancements | // Some future enhancements | |||
// | // | |||
// virtual int_type uflow(); | // virtual int_type uflow(); | |||
// virtual int_type pbackfail(int_type c = traits_type::eof()); | // virtual int_type pbackfail(int_type c = traits_type::eof()); | |||
private: | private: | |||
// No copying! | // No copying! | |||
skipping to change at line 218 | skipping to change at line 218 | |||
/** | /** | |||
* @brief Allocate internal buffer. | * @brief Allocate internal buffer. | |||
* | * | |||
* This function is safe to call multiple times. It will ensure | * This function is safe to call multiple times. It will ensure | |||
* that a proper internal buffer exists if it is required. If the | * that a proper internal buffer exists if it is required. If the | |||
* buffer already exists or is external, the buffer pointers will be | * buffer already exists or is external, the buffer pointers will be | |||
* reset to their original state. | * reset to their original state. | |||
*/ | */ | |||
void | void | |||
enable_buffer(); | enable_buffer (); | |||
/** | /** | |||
* @brief Destroy internal buffer. | * @brief Destroy internal buffer. | |||
* | * | |||
* This function is safe to call multiple times. It will ensure | * This function is safe to call multiple times. It will ensure | |||
* that the internal buffer is deallocated if it exists. In any | * that the internal buffer is deallocated if it exists. In any | |||
* case, it will also reset the buffer pointers. | * case, it will also reset the buffer pointers. | |||
*/ | */ | |||
void | void | |||
disable_buffer(); | disable_buffer (); | |||
/** | /** | |||
* Underlying file pointer. | * Underlying file pointer. | |||
*/ | */ | |||
gzFile file; | gzFile file; | |||
/** | /** | |||
* Mode in which file was opened. | * Mode in which file was opened. | |||
*/ | */ | |||
std::ios_base::openmode io_mode; | std::ios_base::openmode io_mode; | |||
skipping to change at line 285 | skipping to change at line 285 | |||
/** | /** | |||
* @brief Gzipped file input stream class. | * @brief Gzipped file input stream class. | |||
* | * | |||
* This class implements ifstream for gzipped files. Seeking and putback | * This class implements ifstream for gzipped files. Seeking and putback | |||
* is not supported yet. | * is not supported yet. | |||
*/ | */ | |||
class gzifstream : public std::istream | class gzifstream : public std::istream | |||
{ | { | |||
public: | public: | |||
// Default constructor | // Default constructor | |||
gzifstream(); | gzifstream (); | |||
/** | /** | |||
* @brief Construct stream on gzipped file to be opened. | * @brief Construct stream on gzipped file to be opened. | |||
* @param name File name. | * @param name File name. | |||
* @param mode Open mode flags (forced to contain ios::in). | * @param mode Open mode flags (forced to contain ios::in). | |||
*/ | */ | |||
explicit | explicit | |||
gzifstream(const char* name, | gzifstream (const char* name, | |||
std::ios_base::openmode mode = std::ios_base::in); | std::ios_base::openmode mode = std::ios_base::in); | |||
/** | /** | |||
* @brief Construct stream on already open gzipped file. | * @brief Construct stream on already open gzipped file. | |||
* @param fd File descriptor. | * @param fd File descriptor. | |||
* @param mode Open mode flags (forced to contain ios::in). | * @param mode Open mode flags (forced to contain ios::in). | |||
*/ | */ | |||
explicit | explicit | |||
gzifstream(int fd, | gzifstream (int fd, | |||
std::ios_base::openmode mode = std::ios_base::in); | std::ios_base::openmode mode = std::ios_base::in); | |||
/** | /** | |||
* Obtain underlying stream buffer. | * Obtain underlying stream buffer. | |||
*/ | */ | |||
gzfilebuf* | gzfilebuf* | |||
rdbuf() const | rdbuf () const | |||
{ return const_cast<gzfilebuf*>(&sb); } | { return const_cast<gzfilebuf*>(&sb); } | |||
/** | /** | |||
* @brief Check if file is open. | * @brief Check if file is open. | |||
* @return True if file is open. | * @return True if file is open. | |||
*/ | */ | |||
bool | bool | |||
is_open() { return sb.is_open(); } | is_open () { return sb.is_open (); } | |||
/** | /** | |||
* @brief Open gzipped file. | * @brief Open gzipped file. | |||
* @param name File name. | * @param name File name. | |||
* @param mode Open mode flags (forced to contain ios::in). | * @param mode Open mode flags (forced to contain ios::in). | |||
* | * | |||
* Stream will be in state good() if file opens successfully; | * Stream will be in state good() if file opens successfully; | |||
* otherwise in state fail(). This differs from the behavior of | * otherwise in state fail(). This differs from the behavior of | |||
* ifstream, which never sets the state to good() and therefore | * ifstream, which never sets the state to good() and therefore | |||
* won't allow you to reuse the stream for a second file unless | * won't allow you to reuse the stream for a second file unless | |||
* you manually clear() the state. The choice is a matter of | * you manually clear() the state. The choice is a matter of | |||
* convenience. | * convenience. | |||
*/ | */ | |||
void | void | |||
open(const char* name, | open (const char* name, | |||
std::ios_base::openmode mode = std::ios_base::in); | std::ios_base::openmode mode = std::ios_base::in); | |||
/** | /** | |||
* @brief Attach to already open gzipped file. | * @brief Attach to already open gzipped file. | |||
* @param fd File descriptor. | * @param fd File descriptor. | |||
* @param mode Open mode flags (forced to contain ios::in). | * @param mode Open mode flags (forced to contain ios::in). | |||
* | * | |||
* Stream will be in state good() if attach succeeded; otherwise | * Stream will be in state good() if attach succeeded; otherwise | |||
* in state fail(). | * in state fail(). | |||
*/ | */ | |||
void | void | |||
attach(int fd, | attach (int fd, | |||
std::ios_base::openmode mode = std::ios_base::in); | std::ios_base::openmode mode = std::ios_base::in); | |||
/** | /** | |||
* @brief Close gzipped file. | * @brief Close gzipped file. | |||
* | * | |||
* Stream will be in state fail() if close failed. | * Stream will be in state fail() if close failed. | |||
*/ | */ | |||
void | void | |||
close(); | close (); | |||
private: | private: | |||
/** | /** | |||
* Underlying stream buffer. | * Underlying stream buffer. | |||
*/ | */ | |||
gzfilebuf sb; | gzfilebuf sb; | |||
}; | }; | |||
/************************************************************************** ***/ | /************************************************************************** ***/ | |||
/** | /** | |||
* @brief Gzipped file output stream class. | * @brief Gzipped file output stream class. | |||
* | * | |||
* This class implements ofstream for gzipped files. Seeking and putback | * This class implements ofstream for gzipped files. Seeking and putback | |||
* is not supported yet. | * is not supported yet. | |||
*/ | */ | |||
class gzofstream : public std::ostream | class gzofstream : public std::ostream | |||
{ | { | |||
public: | public: | |||
// Default constructor | // Default constructor | |||
gzofstream(); | gzofstream (); | |||
/** | /** | |||
* @brief Construct stream on gzipped file to be opened. | * @brief Construct stream on gzipped file to be opened. | |||
* @param name File name. | * @param name File name. | |||
* @param mode Open mode flags (forced to contain ios::out). | * @param mode Open mode flags (forced to contain ios::out). | |||
*/ | */ | |||
explicit | explicit | |||
gzofstream(const char* name, | gzofstream (const char* name, | |||
std::ios_base::openmode mode = std::ios_base::out); | std::ios_base::openmode mode = std::ios_base::out); | |||
/** | /** | |||
* @brief Construct stream on already open gzipped file. | * @brief Construct stream on already open gzipped file. | |||
* @param fd File descriptor. | * @param fd File descriptor. | |||
* @param mode Open mode flags (forced to contain ios::out). | * @param mode Open mode flags (forced to contain ios::out). | |||
*/ | */ | |||
explicit | explicit | |||
gzofstream(int fd, | gzofstream (int fd, | |||
std::ios_base::openmode mode = std::ios_base::out); | std::ios_base::openmode mode = std::ios_base::out); | |||
/** | /** | |||
* Obtain underlying stream buffer. | * Obtain underlying stream buffer. | |||
*/ | */ | |||
gzfilebuf* | gzfilebuf* | |||
rdbuf() const | rdbuf () const | |||
{ return const_cast<gzfilebuf*>(&sb); } | { return const_cast<gzfilebuf*>(&sb); } | |||
/** | /** | |||
* @brief Check if file is open. | * @brief Check if file is open. | |||
* @return True if file is open. | * @return True if file is open. | |||
*/ | */ | |||
bool | bool | |||
is_open() { return sb.is_open(); } | is_open () { return sb.is_open (); } | |||
/** | /** | |||
* @brief Open gzipped file. | * @brief Open gzipped file. | |||
* @param name File name. | * @param name File name. | |||
* @param mode Open mode flags (forced to contain ios::out). | * @param mode Open mode flags (forced to contain ios::out). | |||
* | * | |||
* Stream will be in state good() if file opens successfully; | * Stream will be in state good() if file opens successfully; | |||
* otherwise in state fail(). This differs from the behavior of | * otherwise in state fail(). This differs from the behavior of | |||
* ofstream, which never sets the state to good() and therefore | * ofstream, which never sets the state to good() and therefore | |||
* won't allow you to reuse the stream for a second file unless | * won't allow you to reuse the stream for a second file unless | |||
* you manually clear() the state. The choice is a matter of | * you manually clear() the state. The choice is a matter of | |||
* convenience. | * convenience. | |||
*/ | */ | |||
void | void | |||
open(const char* name, | open (const char* name, | |||
std::ios_base::openmode mode = std::ios_base::out); | std::ios_base::openmode mode = std::ios_base::out); | |||
/** | /** | |||
* @brief Attach to already open gzipped file. | * @brief Attach to already open gzipped file. | |||
* @param fd File descriptor. | * @param fd File descriptor. | |||
* @param mode Open mode flags (forced to contain ios::out). | * @param mode Open mode flags (forced to contain ios::out). | |||
* | * | |||
* Stream will be in state good() if attach succeeded; otherwise | * Stream will be in state good() if attach succeeded; otherwise | |||
* in state fail(). | * in state fail(). | |||
*/ | */ | |||
void | void | |||
attach(int fd, | attach (int fd, | |||
std::ios_base::openmode mode = std::ios_base::out); | std::ios_base::openmode mode = std::ios_base::out); | |||
/** | /** | |||
* @brief Close gzipped file. | * @brief Close gzipped file. | |||
* | * | |||
* Stream will be in state fail() if close failed. | * Stream will be in state fail() if close failed. | |||
*/ | */ | |||
void | void | |||
close(); | close (); | |||
private: | private: | |||
/** | /** | |||
* Underlying stream buffer. | * Underlying stream buffer. | |||
*/ | */ | |||
gzfilebuf sb; | gzfilebuf sb; | |||
}; | }; | |||
/************************************************************************** ***/ | /************************************************************************** ***/ | |||
/** | /** | |||
* @brief Gzipped file output stream manipulator class. | * @brief Gzipped file output stream manipulator class. | |||
* | * | |||
* This class defines a two-argument manipulator for gzofstream. It is use d | * This class defines a two-argument manipulator for gzofstream. It is use d | |||
* as base for the setcompression(int,int) manipulator. | * as base for the setcompression(int,int) manipulator. | |||
*/ | */ | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
class gzomanip2 | class gzomanip2 | |||
{ | { | |||
public: | public: | |||
// Allows insertor to peek at internals | // Allows insertor to peek at internals | |||
template <typename Ta, typename Tb> | template <typename Ta, typename Tb> | |||
friend gzofstream& | friend gzofstream& | |||
operator<<(gzofstream&, | operator<<(gzofstream&, | |||
const gzomanip2<Ta,Tb>&); | const gzomanip2<Ta,Tb>&); | |||
// Constructor | // Constructor | |||
gzomanip2(gzofstream& (*f)(gzofstream&, T1, T2), | gzomanip2 (gzofstream& (*f)(gzofstream&, T1, T2), | |||
T1 v1, | T1 v1, | |||
T2 v2); | T2 v2); | |||
private: | private: | |||
// Underlying manipulator function | // Underlying manipulator function | |||
gzofstream& | gzofstream& | |||
(*func)(gzofstream&, T1, T2); | (*func)(gzofstream&, T1, T2); | |||
// Arguments for manipulator function | // Arguments for manipulator function | |||
T1 val1; | T1 val1; | |||
T2 val2; | T2 val2; | |||
}; | }; | |||
/************************************************************************** ***/ | /************************************************************************** ***/ | |||
// Manipulator function thunks through to stream buffer | // Manipulator function thunks through to stream buffer | |||
inline gzofstream& | inline gzofstream& | |||
setcompression(gzofstream &gzs, int l, int s = Z_DEFAULT_STRATEGY) | setcompression (gzofstream &gzs, int l, int s = Z_DEFAULT_STRATEGY) | |||
{ | { | |||
(gzs.rdbuf())->setcompression(l, s); | (gzs.rdbuf ())->setcompression (l, s); | |||
return gzs; | return gzs; | |||
} | } | |||
// Manipulator constructor stores arguments | // Manipulator constructor stores arguments | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
gzomanip2<T1,T2>::gzomanip2(gzofstream &(*f)(gzofstream &, T1, T2), | gzomanip2<T1,T2>::gzomanip2 (gzofstream &(*f)(gzofstream &, T1, T2), | |||
T1 v1, | T1 v1, | |||
T2 v2) | T2 v2) | |||
: func(f), val1(v1), val2(v2) | : func(f), val1(v1), val2(v2) | |||
{ } | { } | |||
// Insertor applies underlying manipulator function to stream | // Insertor applies underlying manipulator function to stream | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline gzofstream& | inline gzofstream& | |||
operator<<(gzofstream& s, const gzomanip2<T1,T2>& m) | operator<<(gzofstream& s, const gzomanip2<T1,T2>& m) | |||
{ return (*m.func)(s, m.val1, m.val2); } | { return (*m.func)(s, m.val1, m.val2); } | |||
// Insert this onto stream to simplify setting of compression level | // Insert this onto stream to simplify setting of compression level | |||
inline gzomanip2<int,int> | inline gzomanip2<int,int> | |||
setcompression(int l, int s = Z_DEFAULT_STRATEGY) | setcompression (int l, int s = Z_DEFAULT_STRATEGY) | |||
{ return gzomanip2<int,int>(&setcompression, l, s); } | { return gzomanip2<int,int>(&setcompression, l, s); } | |||
#endif // HAVE_ZLIB | #endif // HAVE_ZLIB | |||
#endif // ZFSTREAM_H | #endif // ZFSTREAM_H | |||
End of changes. 43 change blocks. | ||||
91 lines changed or deleted | 90 lines changed or added | |||