Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Examples  

vector Class Template Reference

Implementation of a vector with entries of type T. More...

#include <matrices.h>

List of all members.

Public Methods

 vector (index n_init=0, index n_delta_init=2)
 vector (index n_init, T *a, index n_delta_init=2)
 vector (const vector< T > &x)
vector< T > & operator= (const vector< T > &x)
 ~vector (void)
index get_n (void) const
T & operator[] (index j)
at (index j) const
access (index j) const
void resize (index new_n=0)
void ins_item (index j, T item=0)
void join (T item)
int member (T item) const
index index_of_item (T item) const
void del_item (index j)
take_item (index j)
void swap_items (index j1, index j2)
vector< T > & operator+= (const vector< T > &x)
vector< T > & operator-= (const vector< T > &x)

Friends

ostream & operator<< (ostream &s, const vector< T > &x)
istream & operator>> (istream &s, vector< T > &x)
vector< T > operator+ (const vector< T > &a, const vector< T > &b)
vector< T > operator- (const vector< T > &a, const vector< T > &b)
vector< T > operator * (const T alpha, const vector< T > &a)
operator * (const vector< T > &a, const vector< T > &b)
int operator== (const vector< T > &a, const vector< T > &b)
int operator!= (const vector< T > &a, const vector< T > &b)
void pretty (ostr &s, const vector< T > &A)
istream & operator>> (istream &s, vector< T > &x)

Related Functions

(Note that these are not member functions.)

void mesh_grid (vector< T > &v, T begin, T end, T step)


Detailed Description

template<class T>
class vector< T >

Implementation of a vector with entries of type T.

Definition at line 115 of file matrices.h.


Constructor & Destructor Documentation

template<class T>
vector< T >::vector index n_init = 0,
index n_delta_init = 2
 

v is initialized to the vector of undefined entries of size n_init, n_delta_init is the increasing step.

Definition at line 552 of file matrices.h.

template<class T>
vector< T >::vector index n_init,
T * a,
index n_delta_init = 2
 

v is initialized to the vector of size n_init with enties stored in a, n_delta_init is the increasing step.

Definition at line 562 of file matrices.h.

template<class T>
vector< T >::vector const vector< T > & x
 

Constructor.

Definition at line 579 of file matrices.h.

template<class T>
vector< T >::~vector void
 

Destructor.

Definition at line 616 of file matrices.h.


Member Function Documentation

template<class T>
T vector< T >::access index j const [inline]
 

Returns the j-th entry of v. Only for reading. Without bounds checking.

Definition at line 911 of file matrices.h.

template<class T>
T vector< T >::at index j const [inline]
 

Returns the j-th entry of v. Only for reading.

Definition at line 631 of file matrices.h.

Referenced by matrix::diag(), gcd(), and pretty().

template<class T>
void vector< T >::del_item index j
 

Deletes item from the vector.

Definition at line 756 of file matrices.h.

template<class T>
index vector< T >::get_n void const [inline]
 

Returns the number of entries.

Definition at line 143 of file matrices.h.

Referenced by matrix::cols(), matrix::del_cols(), matrix::del_rows(), matrix::diag(), gcd(), matrix::ins_col(), matrix::ins_row(), join(), operator *(), operator+(), operator+=(), operator-(), operator-=(), operator=(), operator==(), operator>>(), pretty(), matrix::rows(), matrix::sumbatrix(), matrix::take_rows(), and vector().

template<class T>
index vector< T >::index_of_item T item const
 

Returns (the first) index of item or -1 if item is not in a vector.

Definition at line 747 of file matrices.h.

Referenced by member(), and matrix::take_rows().

template<class T>
void vector< T >::ins_item index j,
T item = 0
 

Inserts item in the position j.

Definition at line 691 of file matrices.h.

Referenced by join().

template<class T>
void vector< T >::join T item
 

Joins item to the end of a vector.

x.ins_item(x.get_n(), item) makes the same

Definition at line 732 of file matrices.h.

template<class T>
int vector< T >::member T item const
 

Returns 1 if item is in a vector.

Definition at line 738 of file matrices.h.

template<class T>
vector< T > & vector< T >::operator+= const vector< T > & x
 

Combined assignment-addition operator.

Definition at line 835 of file matrices.h.

template<class T>
vector< T > & vector< T >::operator-= const vector< T > & x
 

Combined assignment-subtraction operator.

Definition at line 851 of file matrices.h.

template<class T>
vector< T > & vector< T >::operator= const vector< T > & x
 

Assignment.

Definition at line 591 of file matrices.h.

template<class T>
T & vector< T >::operator[] index j [inline]
 

Returns the j-th entry of v.

Definition at line 622 of file matrices.h.

template<class T>
void vector< T >::resize index new_n = 0
 

Transforms a vector to a vector of size new_n.

New entries are undefined

Definition at line 643 of file matrices.h.

Referenced by matrix::col(), mesh_grid(), operator *(), operator+(), operator-(), operator=(), operator>>(), matrix::row(), simplex_table::simplex_table(), and vector().

template<class T>
void vector< T >::swap_items index j1,
index j2
 

Swap items.

Definition at line 785 of file matrices.h.

template<class T>
T vector< T >::take_item index j
 

Deletes item from the vector and returns its value.

Definition at line 769 of file matrices.h.


Friends And Related Function Documentation

template<class T>
void mesh_grid vector< T > & v,
T begin,
T end,
T step
[related]
 

Returns a vector (begin, begin + step, begin + 2 * step, ...) the last component is less than or equal to end.

Definition at line 1862 of file matrices.h.

template<class T>
T operator * const vector< T > & a,
const vector< T > & b
[friend]
 

Inner product.

Definition at line 879 of file matrices.h.

template<class T>
vector<T> operator * const T alpha,
const vector< T > & a
[friend]
 

Component multiplication with number alpha.

Definition at line 867 of file matrices.h.

template<class T>
int operator!= const vector< T > & a,
const vector< T > & b
[friend]
 

Test for inequality.

Definition at line 899 of file matrices.h.

template<class T>
vector<T> operator+ const vector< T > & a,
const vector< T > & b
[friend]
 

Addition.

Definition at line 799 of file matrices.h.

template<class T>
vector<T> operator- const vector< T > & a,
const vector< T > & b
[friend]
 

Subtraction.

Definition at line 817 of file matrices.h.

template<class T>
ostream& operator<< ostream & s,
const vector< T > & x
[friend]
 

Output stream operator.

First, writes the number of entries. Then writes entries

Definition at line 665 of file matrices.h.

template<class T>
int operator== const vector< T > & a,
const vector< T > & b
[friend]
 

Test for equality.

Definition at line 888 of file matrices.h.

template<class T>
istream& operator>> istream & s,
vector< T > & x
[friend]
 

First, writes the number of entries. Then writes entries

Definition at line 677 of file matrices.h.

template<class T>
istream& operator>> istream & s,
vector< T > & x
[friend]
 

Input stream operator.

First, writes the number of entries. Then writes entries

Definition at line 677 of file matrices.h.

template<class T>
void pretty ostr & s,
const vector< T > & v
[friend]
 

Outputs a vector using latex notation.

Definition at line 1874 of file matrices.h.


The documentation for this class was generated from the following file:
Generated at Tue Jan 22 20:37:04 2002 for Arageli by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001