LaIndex Class Reference

Matrix index class. More...

#include <laindex.h>

List of all members.

Public Member Functions

 LaIndex ()
 LaIndex (int start)
 LaIndex (int start, int end)
 LaIndex (int start, int end, int increment)
 LaIndex (const LaIndex &s)
int start () const
int inc () const
int end () const
int length () const
bool null () const
LaIndexset (int start, int end)
LaIndexset (int start, int end, int increment)
LaIndexoperator+ (int i)
LaIndexoperator= (const LaIndex &i)
bool operator== (const LaIndex &s)
bool operator!= (const LaIndex &s)

Protected Member Functions

int & start ()
int & inc ()
int & end ()
LaIndexoperator() (int start, int end)

Friends

class LaGenMatDouble
class LaGenMatFloat
class LaGenMatInt
class LaGenMatLongInt
class LaGenMatComplex


Detailed Description

Matrix index class.

This index class is used to adress submatrices of other matrices, without actually copying any matrix elements in memory.

Note that we name it "LaIndex" to avoid confusion with the "index()" string function in C, or other generic Index() functions.


Constructor & Destructor Documentation

LaIndex::LaIndex (  )  [inline]

Construct a null index. Start, Increment, and End are zero. null() will return true.

When used for addressing in one of the matrix classes, a null index like this is equivalent to adressing "all elements". To get the first row of a matrix A, you could therefore write A( LaIndex(0), LaIndex() ). This corresponds to the MATLAB notation of a single : (colon).

LaIndex::LaIndex ( int  start  )  [inline]

Construct an index that points only to one element, specified by the given argument.

Start and End is the given argument; Increment is unity but has no effect.

LaIndex::LaIndex ( int  start,
int  end 
)

Construct an index that points to a range of elements, starting from the first argument and ending at the second argument. The element at the starting index and the element at the ending index are both included. This corresponds to the MATLAB notation start:end.

start and end are given by the two arguments. Increment is unity. end has to be greater or equal to start .

LaIndex::LaIndex ( int  start,
int  end,
int  increment 
)

Construct an index that points to a range of elements with a given increment. The element at the starting index is included; the element at the ending index is included if its difference to the starting index is an integer multiple of the increment. This corresponds to the MATLAB notation start:increment:end, but note the different order of arguments in this constructor.

The increment has to be nonzero. The end has to be greater or equal to start if increment is positive. If increment is negative, then end has to be lesser or equal to start . Please watch out with negative increments: The respective matrix functions may or may not be correctly implemented for negative increments. If in doubt, use only positive increments.

Start, End, and Increment are given by the three arguments. (We apologize for the confusing order of the arguments.)

LaIndex::LaIndex ( const LaIndex s  )  [inline]

Copy constructor


Member Function Documentation

int& LaIndex::start (  )  [inline, protected]

Returns the start index by-reference. That is, the index of the first indexed element.

DEPRECATED. Use the set() methods instead.

int& LaIndex::inc (  )  [inline, protected]

Returns the increment by-reference

DEPRECATED. Use the set() methods instead.

int& LaIndex::end (  )  [inline, protected]

Returns the end index by-reference. That is, the index of the last indexed element. (Not to be confused with the index of the one-after-the-last element!)

DEPRECATED. Use the set() methods instead.

int LaIndex::start (  )  const [inline]

Returns the start index. That is, the index of the first indexed element.

int LaIndex::inc (  )  const [inline]

Returns the increment. It is guaranteed to be nonzero.

int LaIndex::end (  )  const [inline]

Returns the end index. That is, the index of the last indexed element.

(Not to be confused with the index of the one-after-the-last element!) To be more precise, the element at this ending index is being used if and only if its difference to the starting index is an integer multiple of the increment.

int LaIndex::length (  )  const [inline]

Returns the number of elements that are indexed by this object.

bool LaIndex::null (  )  const [inline]

Returns true if this is a null index which cannot be used for indexing.

LaIndex& LaIndex::operator() ( int  start,
int  end 
) [inline, protected]

DEPRECATED. Changes this index so that it points to a range of elements, starting from the first argument and ending at the second argument.

Start and End are given by the two arguments. Increment will be set to unity.

Deprecated. Use the set() method instead. Defining such an operator() which is an assignment instead of a value retrieval makes the indexing operations quite hard to read. Instead, use the set() method.

LaIndex& LaIndex::set ( int  start,
int  end 
) [inline]

Changes this index so that it points to a range of elements, starting from the first argument and ending at the second argument. The element at the starting index and the element at the ending index are both included. This corresponds to the MATLAB notation start:end.

Start and End are given by the two arguments. Increment will be set to unity.

LaIndex& LaIndex::set ( int  start,
int  end,
int  increment 
)

Changes this index so that it points to a range of elements with a given increment. The element at the starting index is included; the element at the ending index is included if its difference to the starting index is an integer multiple of the increment. The increment argument has to be nonzero. This corresponds to the MATLAB notation start:increment:end, but note the different order of arguments in this constructor.

The increment has to be nonzero. The end has to be greater or equal to start if increment is positive. If increment is negative, then end has to be lesser or equal to start . Please watch out with negative increments: The respective matrix functions may or may not be correctly implemented for negative increments. If in doubt, use only positive increments.

Start, End, and Increment are given by the three arguments. (We apologize for the confusing order of the arguments, but this follows the three-valued constructor.)

LaIndex& LaIndex::operator+ ( int  i  )  [inline]

Shifts this index by the given argument.

The given argument is added to the Start and End indices. Increment is unchanged.

LaIndex& LaIndex::operator= ( const LaIndex i  )  [inline]

Copy assignment

bool LaIndex::operator== ( const LaIndex s  )  [inline]

Equality predicate

bool LaIndex::operator!= ( const LaIndex s  )  [inline]

Inequality predicate. (New in lapackpp-2.4.5)


Friends And Related Function Documentation

friend class LaGenMatDouble [friend]

friend class LaGenMatFloat [friend]

friend class LaGenMatInt [friend]

friend class LaGenMatLongInt [friend]

friend class LaGenMatComplex [friend]


Generated on Sat Jul 14 11:40:37 2007 for Lapack++ by  doxygen 1.5.0