vector.h revision d8fa3c4faade9a5a8e7f79450544b1925e1ade41
#ifndef _NL_VECTOR_H_
#define _NL_VECTOR_H_
#include <cassert>
#include <utility>
#include <gsl/gsl_vector.h>
{
: m_size(n)
{
m_vector = gsl_vector_alloc(n);
}
: m_size(n)
{
m_vector = gsl_vector_alloc(n);
}
// create a vector with n elements all set to zero
// but the i-th that is set to 1
: m_size(n)
{
m_vector = gsl_vector_alloc(n);
}
{
}
{
}
{
}
void set_all(double x = 0)
{
}
{
}
{
return *gsl_vector_const_ptr(m_vector, i);
}
{
return *gsl_vector_ptr(m_vector, i);
}
{
return m_vector;
}
{
gsl_vector_swap_elements(m_vector, i, j);
}
void reverse()
{
}
{
gsl_vector_scale(m_vector, x);
return (*this);
}
{
return (*this);
}
{
return (*this);
}
{
return (*this);
}
bool is_zero() const
{
return gsl_vector_isnull(m_vector);
}
bool is_positive() const
{
return gsl_vector_ispos(m_vector);
}
bool is_negative() const
{
return gsl_vector_isneg(m_vector);
}
bool is_non_negative() const
{
{
if ( (*this)[i] < 0 ) return false;
}
return true;
}
double max() const
{
return gsl_vector_max(m_vector);
}
double min() const
{
return gsl_vector_min(m_vector);
}
{
return gsl_vector_max_index(m_vector);
}
{
return gsl_vector_min_index(m_vector);
}
{
return m_size;
}
};
{
}
} } // end namespaces
#endif /*_NL_VECTOR_H_*/