2 #ifndef vnl_vector_fixed_ref_hxx_ 3 #define vnl_vector_fixed_ref_hxx_ 13 # include <vcl_msvc_warnings.h> 20 template<
class T,
unsigned int n>
26 ret[i] = f( data_block()[i] );
30 template<
class T,
unsigned int n>
36 ret[i] = f( data_block()[i] );
41 template<
class T,
unsigned int n>
45 assert( start < n && start + len <= n );
49 template<
class T,
unsigned int n>
56 this->data_block()[i] =
v[i-start];
60 template <
class T,
unsigned int n>
64 for (
unsigned int i=0; 2*i+1 < n; ++i )
65 std::swap( data_block()[i], data_block()[n-1-i] );
69 template <
class T,
unsigned int n>
73 for (
size_type i = 0; i < this->size(); ++i )
81 template <
class T,
unsigned int n>
86 for (
size_type i = 0; i < this->size(); ++i )
87 if ( !( (*
this)[i] == zero) )
94 template <
class T,
unsigned int n>
98 for (
unsigned i = 0; i < this->size(); ++i)
101 return s.good() || s.eof();
104 template <
class T,
unsigned int n>
108 if (this->is_finite())
111 std::cerr << __FILE__
": *** NAN FEVER **\n" << *
this;
115 template <
class T,
unsigned int n>
119 if ( this->size() > 0 )
121 for (
size_type i = 1; i < this->size(); ++i )
122 s <<
' ' << (*
this)[i];
127 #define VNL_VECTOR_FIXED_REF_INSTANTIATE(T,n) \ 128 template class vnl_vector_fixed_ref<T, n >; \ 129 template class vnl_vector_fixed_ref_const<T, n > 131 #endif // vnl_vector_fixed_ref_hxx_
bool read_ascii(std::istream &s) const
Read from text stream.
void swap(double &a, double &b)
Fixed size vnl_vector using user-supplied storage See vnl_matrix_fixed_ref for rationale.
vnl_vector< T > extract(unsigned int len, unsigned int start=0) const
Returns a subvector specified by the start index and length. O(n).
vnl_vector_fixed_ref const & update(vnl_vector< T > const &, unsigned int start=0) const
Replaces elements with index beginning at start, by values of v. O(n).
bool is_finite() const
Return true if it's finite.
Namespace with standard math functions.
vnl_vector_fixed_ref const & flip() const
bool is_zero() const
Return true iff all the entries are zero.
bool isfinite(vnl_bignum const &x)
vnl_vector_fixed< T, n > apply(T(*f)(T)) const
Apply f to each element.
Mathematical vector class, templated by type of element.
Fixed length stack-stored, space-efficient vector.
void assert_finite_internal() const
void print(std::ostream &s) const
Display the vector.