Wrapper class for GSL integer vctor routines. More...
#include <src/gsl_wrappers/gsl_vector_integer.h>
Public Member Functions | |
vector_int () | |
Class constructor without specified vector dimensions. | |
vector_int (const size_t &n, bool clear=true) | |
Class constructor with specified vector size. | |
~vector_int () | |
Class destructor. | |
vector_int (const vector_int &other) | |
Copy constructor for the vector_int class. | |
void | copy (const vector_int &other) |
Function copies the contents of a vector_int. | |
void | resize (size_t n) |
Function that resizes a vector_int. | |
bool | is_set () const |
Function that checks if a vector_int is set. | |
size_t | size () const |
Function that returns the size of the vector. | |
gsl_vector_int * | gslobj () |
Vector integer object for interfacing with BLAS and/or GSL C libraies. | |
const gsl_vector_int * | gslobj () const |
Const vector integer object for interfacing with BLAS and/or GSL C libraies. | |
int | get (size_t i) const |
Function that returns an inetger stored in a vector entry. | |
void | set (size_t i, int x) |
Function that assigns an integer to a vector_int entry. | |
int & | operator[] (size_t i) |
The function returns a pointer to the i-th element of a vector_int v using []. | |
const int & | operator[] (size_t i) const |
The function returns a pointer to the i-th element of a vector_int v declared as const using []. | |
int & | operator() (size_t i) |
The function returns a pointer to the i-th element of a vector_int v using (). | |
const int & | operator() (size_t i) const |
The function returns a pointer to the i-th element of a vector_int v declared as const using (). | |
int | fprintf (FILE *stream, const char *format) const |
Function that prints the contents of the vector. | |
int | fscanf (FILE *stream) |
Function that reads contents and assigns them to a vector. | |
void | set_all (int x) |
Function that sets all vector entries to a given integer. | |
void | set_zero () |
Function that sets all vector entries to zero. | |
int | set_basis (size_t i) |
Function that creates unit basis vectors for R^n. | |
vector_int & | operator= (const vector_int &other) |
Function that copies the elements of one vector src into another. | |
int | swap_elements (size_t i, size_t j) |
Function that exchanges the i-th and j-th elements of the vector v in-place. | |
int | reverse () |
Function that reverses the order of the elements of the vector v. | |
int | operator+= (const vector_int &other) |
Function to add to a vctor another vector. | |
int | operator-= (const vector_int &other) |
Function to subtract a vector from another vector. | |
int | operator*= (const vector_int &other) |
Function to multiply two vectors. | |
int | operator/= (const vector_int &other) |
Function to divide vectors. | |
int | operator*= (int x) |
Function to scale a vector by a constant integer factor. | |
int | operator+= (int x) |
Function to add to a vector a constant integer factor. | |
int | operator/= (int x) |
Function to divide by a vector by an integer. | |
bool | operator== (const vector_int &other) const |
Function that checks if two vectors are equivalent. | |
bool | operator!= (const vector_int &other) const |
Function that checks if two vectors are not equivalent. | |
int | sum () const |
Function that computes the sum of all entries of a vector. | |
double | max () const |
Function that returns the maximum valued entry of a vector. | |
double | min () const |
Function that returns the minimum valued entry of a vector. | |
size_t | max_index () |
Function that returns the index of the maximum value in the vector. | |
bool | isnull () |
Function that returns 1 if all the elements of the vector v are zero, and 0 otherwise. | |
void | load (const char *filename) |
Function to load a vector from an external file. | |
void | save (const char *filename) const |
Function to save the vector to a file. | |
vector_int | glex () const |
Function advances a vector according to the glex sequence. | |
vector_int | advance_cartesian_product (size_t num_points) const |
Function advances a vector to get the next vector in the cartesian product set. | |
Private Member Functions | |
void | alloc (size_t n) |
Function to intitialize a vector by allocating memory. | |
void | calloc (size_t n) |
Function that does the same as alloc with calloc. | |
Private Attributes | |
gsl_vector_int * | gsldata |
GSL vector of integers object. |
Wrapper class for GSL integer vctor routines.
This header file includes the C++ wrapper for gsl vectors of the datatype 'integer', i.e vectors with integer elements. Much of the routines are taken from the GSLwrap project. The oblective is to use special features of C++ such as operator overloading to enable a Matlab-like environment for development. The core GSLwrap libraries are freely available from http://sourceforge.net/projects/gslwrap/files/0.2/shrinkwrap/gslwrap-0.2.tar.gz/download Additional information on GSLwrap is available from http://gslwrap.sourceforge.net/ We include the files with this distribution as some additions have been made to the files from GSLwrap for additional functionality.