# Couenne::CouenneSparseBndVec< T > Class Template Reference

`#include <CouenneSparseBndVec.hpp>`

List of all members.

## Public Member Functions
| CouenneSparseBndVec (unsigned int size)
| Constructor.
| CouenneSparseBndVec (CouenneSparseBndVec &src)
| Copy constructor.
| ~CouenneSparseBndVec ()
| Destructor.
void | reset ()
| Reset (eeeeasy!).
T & | operator[] (register unsigned int index)
| Access -- the only chance for garbage to be returned (and for valgrind to complain) is when object[ind] is READ without making sure it has been written.
T * | data ()
| Return data in DENSE format -- use with care.
unsigned int * | indices ()
| Return indices in DENSE format -- for use with data().
unsigned int | nElements ()
| Return current size.
void | resize (unsigned int newsize)
| Resize.
## Private Attributes
unsigned int | size_
| Implements a fast sparse+dense vector data structure, with a size of n and a number k of nonzero elements.
unsigned int | n_
| current number of elements
unsigned int * | dInd_
| indices vector, dense (garbage exists past n_)
unsigned int * | sInd_
| indices vector, sparse (lots of garbage in between entries)
T * | data_
| data vector, sparse (lots of garbage in between entries)

## Detailed Description

### template<class T>
class Couenne::CouenneSparseBndVec< T >

Definition at line 16 of file CouenneSparseBndVec.hpp.

## Constructor & Destructor Documentation

template<class T >

Couenne::CouenneSparseBndVec< T >::CouenneSparseBndVec | ( | unsigned int | size | ) | `[inline]`

Constructor.

Definition at line 51 of file CouenneSparseBndVec.hpp.

References Couenne::CouenneSparseBndVec< T >::data_, Couenne::CouenneSparseBndVec< T >::dInd_, Couenne::CouenneSparseBndVec< T >::sInd_, and Couenne::CouenneSparseBndVec< T >::size_.

template<class T >

Couenne::CouenneSparseBndVec< T >::CouenneSparseBndVec | ( | CouenneSparseBndVec< T > & | src | ) | `[inline]`

Copy constructor.

assert: src.sInd [ind] == i

Definition at line 62 of file CouenneSparseBndVec.hpp.

References Couenne::CouenneSparseBndVec< T >::data_, Couenne::CouenneSparseBndVec< T >::dInd_, Couenne::CouenneSparseBndVec< T >::n_, and Couenne::CouenneSparseBndVec< T >::sInd_.

template<class T >

Couenne::CouenneSparseBndVec< T >::~CouenneSparseBndVec | ( |  | ) | `[inline]`

Destructor.

Definition at line 76 of file CouenneSparseBndVec.hpp.

References Couenne::CouenneSparseBndVec< T >::data_, Couenne::CouenneSparseBndVec< T >::dInd_, and Couenne::CouenneSparseBndVec< T >::sInd_.

## Member Function Documentation

template<class T >

void Couenne::CouenneSparseBndVec< T >::reset | ( |  | ) | `[inline]`

Reset (eeeeasy!).

Definition at line 83 of file CouenneSparseBndVec.hpp.

References Couenne::CouenneSparseBndVec< T >::n_.

template<class T >

T& Couenne::CouenneSparseBndVec< T >::operator[] | ( | register unsigned int | index | ) | `[inline]`

Access -- the only chance for garbage to be returned (and for valgrind to complain) is when object[ind] is READ without making sure it has been written.

This should not happen to the end user as read operations are only performed on the dense structure, after this object has been populated.

Definition at line 91 of file CouenneSparseBndVec.hpp.

References Couenne::CouenneSparseBndVec< T >::data_, Couenne::CouenneSparseBndVec< T >::dInd_, Couenne::CouenneSparseBndVec< T >::n_, and Couenne::CouenneSparseBndVec< T >::sInd_.

template<class T >

T* Couenne::CouenneSparseBndVec< T >::data | ( |  | ) | `[inline]`

Return data in DENSE format -- use with care.

Definition at line 103 of file CouenneSparseBndVec.hpp.

References Couenne::CouenneSparseBndVec< T >::data_.

template<class T >

unsigned int* Couenne::CouenneSparseBndVec< T >::indices | ( |  | ) | `[inline]`

Return indices in DENSE format -- for use with data().

Definition at line 107 of file CouenneSparseBndVec.hpp.

References Couenne::CouenneSparseBndVec< T >::dInd_.

template<class T >

unsigned int Couenne::CouenneSparseBndVec< T >::nElements | ( |  | ) | `[inline]`

Return current size.

Definition at line 111 of file CouenneSparseBndVec.hpp.

References Couenne::CouenneSparseBndVec< T >::n_.

template<class T >

void Couenne::CouenneSparseBndVec< T >::resize | ( | unsigned int | newsize | ) | `[inline]`

Resize.

Definition at line 115 of file CouenneSparseBndVec.hpp.

References Couenne::CouenneSparseBndVec< T >::size_.

## Member Data Documentation

template<class T >

unsigned int Couenne::CouenneSparseBndVec< T >::size_`[private]`

Implements a fast sparse+dense vector data structure, with a size of n and a number k of nonzero elements.

Usually, k<<n as happens in FBBT where k is the number of tightened variables and n is the number of variables. The main purpose is that of having a vector with

1) no O(n) initialization;

2) easy scan of the list of nonzero elements, i.e., O(k) rather than O(n).

Implemented based on the (simple but beautiful) idea found at

http://research.swtch.com/2008/03/using-uninitialized-memory-for-fun-and.html

which in turn refers to a paper by Briggs and Torczon:

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.30.7319

NOTE: This will make valgrind complain on every assignment to non-previously-assigned entries. Get over it. maximum size

Definition at line 42 of file CouenneSparseBndVec.hpp.

Referenced by Couenne::CouenneSparseBndVec< T >::CouenneSparseBndVec(), and Couenne::CouenneSparseBndVec< T >::resize().

template<class T >

unsigned int Couenne::CouenneSparseBndVec< T >::n_`[private]`

current number of elements

Definition at line 43 of file CouenneSparseBndVec.hpp.

Referenced by Couenne::CouenneSparseBndVec< T >::CouenneSparseBndVec(), Couenne::CouenneSparseBndVec< T >::nElements(), Couenne::CouenneSparseBndVec< T >::operator[](), and Couenne::CouenneSparseBndVec< T >::reset().

template<class T >

unsigned int* Couenne::CouenneSparseBndVec< T >::dInd_`[private]`

indices vector, dense (garbage exists past n_)

Definition at line 44 of file CouenneSparseBndVec.hpp.

Referenced by Couenne::CouenneSparseBndVec< T >::CouenneSparseBndVec(), Couenne::CouenneSparseBndVec< T >::indices(), Couenne::CouenneSparseBndVec< T >::operator[](), and Couenne::CouenneSparseBndVec< T >::~CouenneSparseBndVec().

template<class T >

unsigned int* Couenne::CouenneSparseBndVec< T >::sInd_`[private]`

indices vector, sparse (lots of garbage in between entries)

Definition at line 45 of file CouenneSparseBndVec.hpp.

Referenced by Couenne::CouenneSparseBndVec< T >::CouenneSparseBndVec(), Couenne::CouenneSparseBndVec< T >::operator[](), and Couenne::CouenneSparseBndVec< T >::~CouenneSparseBndVec().

template<class T >

T* Couenne::CouenneSparseBndVec< T >::data_`[private]`

data vector, sparse (lots of garbage in between entries)

Definition at line 46 of file CouenneSparseBndVec.hpp.

Referenced by Couenne::CouenneSparseBndVec< T >::CouenneSparseBndVec(), Couenne::CouenneSparseBndVec< T >::data(), Couenne::CouenneSparseBndVec< T >::operator[](), and Couenne::CouenneSparseBndVec< T >::~CouenneSparseBndVec().

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

- CouenneSparseBndVec.hpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines