Skip to content

Commit

Permalink
Merge topic 'VXL_20160629_Update'
Browse files Browse the repository at this point in the history
15fe928 Merge branch 'upstream-vnl' into VXL_20160629_Update
2e6150e VNL 2016-06-29 (d62a2d70)
  • Loading branch information
thewtex authored and kwrobot committed Jun 29, 2016
2 parents 997bd3d + 15fe928 commit 7fd4103
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 92 deletions.
8 changes: 7 additions & 1 deletion Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.hxx
Expand Up @@ -390,7 +390,13 @@ void
vnl_matrix_fixed<T,nrows,ncols>
::swap(vnl_matrix_fixed<T,nrows,ncols> &that)
{
std::swap(this->data_, that.data_);
for (unsigned int r = 0; r < nrows; ++r)
{
for (unsigned int c = 0; c < ncols; ++c)
{
std::swap(this->data_[r][c], that.data_[r][c]);
}
}
}

//: Returns a copy of n rows, starting from "row"
Expand Down
50 changes: 25 additions & 25 deletions Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_vector.h
Expand Up @@ -84,18 +84,18 @@ class VNL_EXPORT vnl_vector
vnl_vector() : num_elmts(0) , data(VXL_NULLPTR) {}

//: Creates a vector containing n uninitialized elements.
explicit vnl_vector(unsigned int len);
explicit vnl_vector(size_t len);

//: Creates a vector containing n elements, all set to v0.
vnl_vector(unsigned int len, T const& v0);
vnl_vector(size_t len, T const& v0);

//: Creates a vector containing len elements, with the first n
// elements taken from the array values[]. O(n).
vnl_vector(unsigned int len, int n, T const values[]);
vnl_vector(size_t len, size_t n, T const values[]);

//: Creates a vector containing len elements, initialized with values from
// a data block.
vnl_vector(T const* data_block,unsigned int n);
vnl_vector(T const* data_block,size_t n);

//: Copy constructor.
vnl_vector(vnl_vector<T> const&);
Expand All @@ -105,19 +105,19 @@ class VNL_EXPORT vnl_vector
// Requires that len==2.
// Consider using vnl_vector_fixed<T,2> instead!
// \deprecated
vnl_vector(unsigned len, T const& px, T const& py);
vnl_vector(size_t len, T const& px, T const& py);

//: Creates a vector of length 3 and initializes with the arguments, px,py,pz.
// Requires that len==3.
// Consider using vnl_vector_fixed<T,3> instead!
// \deprecated
vnl_vector(unsigned len, T const& px, T const& py, T const& pz);
vnl_vector(size_t len, T const& px, T const& py, T const& pz);

//: Creates a vector of length 4 and initializes with the arguments.
// Requires that len==4.
// Consider using vnl_vector_fixed<T,4> instead!
// \deprecated
vnl_vector(unsigned len, T const& px, T const& py, T const& pz, T const& pw);
vnl_vector(size_t len, T const& px, T const& py, T const& pz, T const& pw);
#endif

#ifndef VXL_DOXYGEN_SHOULD_SKIP_THIS
Expand Down Expand Up @@ -147,13 +147,13 @@ class VNL_EXPORT vnl_vector
~vnl_vector();

//: Return the length, number of elements, dimension of this vector.
unsigned int size() const { return this->num_elmts; }
size_t size() const { return this->num_elmts; }

//: Put value at given position in vector.
inline void put(unsigned int i, T const& v);
inline void put(size_t i, T const& v);

//: Get value at element i
inline T get(unsigned int i) const;
inline T get(size_t i) const;

//: Set all values to v
vnl_vector& fill(T const& v);
Expand All @@ -172,7 +172,7 @@ class VNL_EXPORT vnl_vector

//: Return reference to the element at specified index.
// There are assert style boundary checks - #define NDEBUG to turn them off.
T & operator()(unsigned int i)
T & operator()(size_t i)
{
#if VNL_CONFIG_CHECK_BOUNDS
assert(i<size()); // Check the index is valid.
Expand All @@ -181,7 +181,7 @@ class VNL_EXPORT vnl_vector
}
//: Return reference to the element at specified index. No range checking.
// There are assert style boundary checks - #define NDEBUG to turn them off.
T const & operator()(unsigned int i) const
T const & operator()(size_t i) const
{
#if VNL_CONFIG_CHECK_BOUNDS
assert(i<size()); // Check the index is valid
Expand All @@ -190,9 +190,9 @@ class VNL_EXPORT vnl_vector
}

//: Return reference to the element at specified index. No range checking.
T & operator[](unsigned int i) { return data[i]; }
T & operator[](size_t i) { return data[i]; }
//: Return reference to the element at specified index. No range checking.
T const & operator[](unsigned int i) const { return data[i]; }
T const & operator[](size_t i) const { return data[i]; }

//: Set all elements to value v
vnl_vector<T>& operator=(T const&v) { fill(v); return *this; }
Expand Down Expand Up @@ -291,10 +291,10 @@ class VNL_EXPORT vnl_vector
vnl_vector<T> apply(T (*f)(T const&)) const;

//: Returns a subvector specified by the start index and length. O(n).
vnl_vector<T> extract(unsigned int len, unsigned int start=0) const;
vnl_vector<T> extract(size_t len, size_t start=0) const;

//: Replaces elements with index beginning at start, by values of v. O(n).
vnl_vector<T>& update(vnl_vector<T> const&, unsigned int start=0);
vnl_vector<T>& update(vnl_vector<T> const&, size_t start=0);

// norms etc
typedef typename vnl_c_vector<T>::abs_t abs_t;
Expand Down Expand Up @@ -330,10 +330,10 @@ class VNL_EXPORT vnl_vector
T max_value() const { return vnl_c_vector<T>::max_value(begin(), size()); }

//: Location of smallest value
unsigned arg_min() const { return vnl_c_vector<T>::arg_min(begin(), size()); }
size_t arg_min() const { return vnl_c_vector<T>::arg_min(begin(), size()); }

//: Location of largest value
unsigned arg_max() const { return vnl_c_vector<T>::arg_max(begin(), size()); }
size_t arg_max() const { return vnl_c_vector<T>::arg_max(begin(), size()); }

//: Mean of values in vector
T mean() const { return vnl_c_vector<T>::mean(begin(), size()); }
Expand All @@ -347,7 +347,7 @@ class VNL_EXPORT vnl_vector

//: Reverse the order of the elements from index b to 1-e, inclusive.
// When b = 0 and e = size(), this is equivalent to flip();
vnl_vector<T>& flip(const unsigned int &b, const unsigned int &e);
vnl_vector<T>& flip(const size_t &b, const size_t &e);

//: Roll the vector forward by the specified shift.
// The shift is cyclical, such that the elements which
Expand Down Expand Up @@ -395,7 +395,7 @@ class VNL_EXPORT vnl_vector

//: Check that size()==sz if not, abort();
// This function does or tests nothing if NDEBUG is defined
void assert_size(unsigned VXL_USED_IN_DEBUG(sz) ) const {
void assert_size(size_t VXL_USED_IN_DEBUG(sz) ) const {
#ifndef NDEBUG
assert_size_internal(sz);
#endif
Expand Down Expand Up @@ -433,7 +433,7 @@ class VNL_EXPORT vnl_vector
//: Resize to n elements.
// This is a destructive resize, in that the old data is lost if size() != \a n before the call.
// If size() is already \a n, this is a null operation.
bool set_size(unsigned n);
bool set_size(size_t n);

//: Make the vector as if it had been default-constructed.
void clear();
Expand All @@ -445,7 +445,7 @@ class VNL_EXPORT vnl_vector
static vnl_vector<T> read(std::istream& s);

protected:
unsigned num_elmts; // Number of elements (length)
size_t num_elmts; // Number of elements (length)
T* data; // Pointer to the actual data

#if VCL_HAS_SLICED_DESTRUCTOR_BUG
Expand All @@ -454,7 +454,7 @@ class VNL_EXPORT vnl_vector
char vnl_vector_own_data;
#endif

void assert_size_internal(unsigned sz) const;
void assert_size_internal(size_t sz) const;
void assert_finite_internal() const;

void destroy();
Expand Down Expand Up @@ -493,7 +493,7 @@ class VNL_EXPORT vnl_vector

template <class T>
inline T vnl_vector<T>
::get(unsigned int i) const
::get(size_t i) const
{
#if VNL_CONFIG_CHECK_BOUNDS
if (i >= this->size()) // If invalid index specified
Expand All @@ -507,7 +507,7 @@ ::get(unsigned int i) const

template <class T>
inline void vnl_vector<T>
::put(unsigned int i, T const& v)
::put(size_t i, T const& v)
{
#if VNL_CONFIG_CHECK_BOUNDS
if (i >= this->size()) // If invalid index specified
Expand Down

0 comments on commit 7fd4103

Please sign in to comment.