GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Range Class Reference

#include "Range.h"

Collaboration diagram for Range:

Public Member Functions

 Range (const Range &r)=default
 
 Range (double b, double i, octave_idx_type n)
 
 Range (double b, double l)
 
 Range (double b, double l, double i)
 
 Range (void)
 
 ~Range (void)=default
 
bool all_elements_are_ints (void) const
 
double base (void) const
 
double checkelem (octave_idx_type i) const
 
double checkelem (octave_idx_type i, octave_idx_type j) const
 
octave_idx_type cols (void) const
 
octave_idx_type columns (void) const
 
Matrix diag (octave_idx_type k=0) const
 
dim_vector dims (void) const
 
double elem (octave_idx_type i) const
 
double elem (octave_idx_type, octave_idx_type j) const
 
double inc (void) const
 
Array< double > index (const idx_vector &i) const
 
bool isempty (void) const
 
sortmode issorted (sortmode mode=ASCENDING) const
 
double limit (void) const
 
Matrix matrix_value (void) const
 
double max (void) const
 
double min (void) const
 
octave_idx_type nnz (void) const
 
octave_idx_type numel (void) const
 
double operator() (octave_idx_type i) const
 
double operator() (octave_idx_type i, octave_idx_type j) const
 
Rangeoperator= (const Range &r)=default
 
octave_idx_type rows (void) const
 
void set_base (double b)
 
void set_inc (double i)
 
void set_limit (double l)
 
Range sort (Array< octave_idx_type > &sidx, octave_idx_type dim=0, sortmode mode=ASCENDING) const
 
Range sort (octave_idx_type dim=0, sortmode mode=ASCENDING) const
 
void sort_internal (Array< octave_idx_type > &sidx, bool ascending=true)
 
void sort_internal (bool ascending=true)
 

Protected Member Functions

 Range (double b, double l, double i, octave_idx_type n)
 

Private Member Functions

void clear_cache (void) const
 
void init (void)
 
double limit_internal (void) const
 
octave_idx_type numel_internal (void) const
 

Private Attributes

Matrix cache
 
double rng_base
 
double rng_inc
 
double rng_limit
 
octave_idx_type rng_numel
 

Friends

OCTAVE_API Range operator* (const Range &r, double x)
 
OCTAVE_API Range operator* (double x, const Range &r)
 
OCTAVE_API Range operator+ (const Range &r, double x)
 
OCTAVE_API Range operator+ (double x, const Range &r)
 
OCTAVE_API Range operator- (const Range &r)
 
OCTAVE_API Range operator- (const Range &r, double x)
 
OCTAVE_API Range operator- (double x, const Range &r)
 
OCTAVE_API std::ostream & operator<< (std::ostream &os, const Range &r)
 
OCTAVE_API std::istream & operator>> (std::istream &is, Range &r)
 

Detailed Description

Definition at line 37 of file Range.h.

Constructor & Destructor Documentation

◆ Range() [1/6]

Range::Range ( void  )
inline

Definition at line 43 of file Range.h.

◆ Range() [2/6]

Range::Range ( const Range r)
default

◆ ~Range()

Range::~Range ( void  )
default

◆ Range() [3/6]

Range::Range ( double  b,
double  l 
)
inline

Definition at line 52 of file Range.h.

◆ Range() [4/6]

Range::Range ( double  b,
double  l,
double  i 
)
inline

Definition at line 59 of file Range.h.

◆ Range() [5/6]

Range::Range ( double  b,
double  i,
octave_idx_type  n 
)
inline

Definition at line 67 of file Range.h.

References octave::math::isfinite().

◆ Range() [6/6]

Range::Range ( double  b,
double  l,
double  i,
octave_idx_type  n 
)
inlineprotected

Definition at line 172 of file Range.h.

References octave::math::isfinite().

Member Function Documentation

◆ all_elements_are_ints()

bool Range::all_elements_are_ints ( void  ) const

◆ base()

◆ checkelem() [1/2]

double Range::checkelem ( octave_idx_type  i) const

Definition at line 113 of file Range.cc.

References dims(), octave::err_index_out_of_range(), rng_base, rng_inc, rng_limit, and rng_numel.

Referenced by checkelem().

◆ checkelem() [2/2]

double Range::checkelem ( octave_idx_type  i,
octave_idx_type  j 
) const

Definition at line 127 of file Range.cc.

References checkelem(), dims(), octave::err_index_out_of_range(), and rng_numel.

◆ clear_cache()

void Range::clear_cache ( void  ) const
inlineprivate

Definition at line 167 of file Range.h.

References Matrix::resize().

Referenced by init(), and sort_internal().

◆ cols()

octave_idx_type Range::cols ( void  ) const
inline

Definition at line 93 of file Range.h.

References numel().

◆ columns()

octave_idx_type Range::columns ( void  ) const
inline

Definition at line 94 of file Range.h.

References numel().

◆ diag()

Matrix Range::diag ( octave_idx_type  k = 0) const

Definition at line 295 of file Range.cc.

References Matrix::diag(), and matrix_value().

Referenced by octave_range::diag().

◆ dims()

dim_vector Range::dims ( void  ) const
inline

Definition at line 89 of file Range.h.

Referenced by checkelem(), and index().

◆ elem() [1/2]

◆ elem() [2/2]

double Range::elem ( octave_idx_type  ,
octave_idx_type  j 
) const
inline

Definition at line 124 of file Range.h.

References elem.

◆ inc()

double Range::inc ( void  ) const
inline

Definition at line 85 of file Range.h.

Referenced by image_region::image_region(), do_minmax_body(), and octave_range::short_disp().

◆ index()

◆ init()

void Range::init ( void  )
private

Definition at line 620 of file Range.cc.

References clear_cache(), limit_internal(), numel_internal(), rng_limit, and rng_numel.

Referenced by set_base(), set_inc(), and set_limit().

◆ isempty()

bool Range::isempty ( void  ) const
inline

Definition at line 96 of file Range.h.

References numel().

Referenced by octave_range::is_true(), and nnz().

◆ issorted()

sortmode Range::issorted ( sortmode  mode = ASCENDING) const

Definition at line 338 of file Range.cc.

References ASCENDING, DESCENDING, rng_inc, rng_numel, and UNSORTED.

◆ limit()

double Range::limit ( void  ) const
inline

Definition at line 84 of file Range.h.

Referenced by octave_range::short_disp().

◆ limit_internal()

double Range::limit_internal ( void  ) const
private

Definition at line 603 of file Range.cc.

References all_elements_are_ints(), max(), min(), rng_inc, and octave::math::round().

Referenced by init().

◆ matrix_value()

◆ max()

double Range::max ( void  ) const

Definition at line 230 of file Range.cc.

References retval, rng_base, rng_inc, rng_limit, and rng_numel.

Referenced by image_region::image_region(), do_minmax_body(), and limit_internal().

◆ min()

double Range::min ( void  ) const

Definition at line 209 of file Range.cc.

References retval, rng_base, rng_inc, rng_limit, and rng_numel.

Referenced by do_minmax_body(), and limit_internal().

◆ nnz()

octave_idx_type Range::nnz ( void  ) const

Definition at line 55 of file Range.cc.

References octave::math::floor(), isempty(), retval, rng_base, rng_inc, rng_limit, and rng_numel.

◆ numel()

◆ numel_internal()

octave_idx_type Range::numel_internal ( void  ) const
private

Definition at line 559 of file Range.cc.

References max(), retval, rng_base, rng_inc, rng_limit, teq(), and tfloor().

Referenced by init().

◆ operator()() [1/2]

double Range::operator() ( octave_idx_type  i) const
inline

Definition at line 127 of file Range.h.

References elem.

◆ operator()() [2/2]

double Range::operator() ( octave_idx_type  i,
octave_idx_type  j 
) const
inline

Definition at line 128 of file Range.h.

References elem.

◆ operator=()

Range& Range::operator= ( const Range r)
default

◆ rows()

octave_idx_type Range::rows ( void  ) const
inline

Definition at line 91 of file Range.h.

◆ set_base()

void Range::set_base ( double  b)

Definition at line 351 of file Range.cc.

References init(), and rng_base.

◆ set_inc()

void Range::set_inc ( double  i)

Definition at line 373 of file Range.cc.

References init(), and rng_inc.

◆ set_limit()

void Range::set_limit ( double  l)

Definition at line 362 of file Range.cc.

References init(), and rng_limit.

◆ sort() [1/2]

Range Range::sort ( Array< octave_idx_type > &  sidx,
octave_idx_type  dim = 0,
sortmode  mode = ASCENDING 
) const

Definition at line 319 of file Range.cc.

References ASCENDING, DESCENDING, and retval.

◆ sort() [2/2]

Range Range::sort ( octave_idx_type  dim = 0,
sortmode  mode = ASCENDING 
) const

Definition at line 301 of file Range.cc.

References ASCENDING, DESCENDING, and retval.

◆ sort_internal() [1/2]

void Range::sort_internal ( Array< octave_idx_type > &  sidx,
bool  ascending = true 
)

◆ sort_internal() [2/2]

void Range::sort_internal ( bool  ascending = true)

Definition at line 256 of file Range.cc.

References clear_cache(), rng_base, rng_inc, and rng_limit.

Friends And Related Function Documentation

◆ operator* [1/2]

OCTAVE_API Range operator* ( const Range r,
double  x 
)
friend

Definition at line 477 of file Range.cc.

◆ operator* [2/2]

OCTAVE_API Range operator* ( double  x,
const Range r 
)
friend

Definition at line 468 of file Range.cc.

◆ operator+ [1/2]

OCTAVE_API Range operator+ ( const Range r,
double  x 
)
friend

Definition at line 441 of file Range.cc.

◆ operator+ [2/2]

OCTAVE_API Range operator+ ( double  x,
const Range r 
)
friend

Definition at line 429 of file Range.cc.

◆ operator- [1/3]

OCTAVE_API Range operator- ( const Range r)
friend

Definition at line 424 of file Range.cc.

◆ operator- [2/3]

OCTAVE_API Range operator- ( const Range r,
double  x 
)
friend

Definition at line 459 of file Range.cc.

◆ operator- [3/3]

OCTAVE_API Range operator- ( double  x,
const Range r 
)
friend

Definition at line 450 of file Range.cc.

◆ operator<<

OCTAVE_API std::ostream& operator<< ( std::ostream &  os,
const Range r 
)
friend

Definition at line 383 of file Range.cc.

◆ operator>>

OCTAVE_API std::istream& operator>> ( std::istream &  is,
Range r 
)
friend

Definition at line 405 of file Range.cc.

Member Data Documentation

◆ cache

Matrix Range::cache
mutableprivate

Definition at line 159 of file Range.h.

Referenced by matrix_value().

◆ rng_base

double Range::rng_base
private

◆ rng_inc

double Range::rng_inc
private

◆ rng_limit

double Range::rng_limit
private

◆ rng_numel

octave_idx_type Range::rng_numel
private

Definition at line 157 of file Range.h.

Referenced by all_elements_are_ints(), checkelem(), elem(), index(), init(), issorted(), matrix_value(), max(), min(), and nnz().


The documentation for this class was generated from the following files: