40 #include "subscript.h"
47 #include <Base/Math/Utils.hh>
48 #include <Base/Debug/Error.hh>
85 BIASASSERT(
v_ == NULL);
87 BIASASSERT(
v_ != NULL);
97 #ifdef TNT_UNROLL_LOOPS
101 for (i=0; i<N4; i+=4)
109 for (i=N4; i< N; i++)
123 #ifdef TNT_UNROLL_LOOPS
127 for (i=0; i<N4; i+=4)
135 for (i=N4; i< N; i++)
154 delete [] (
v_);
v_ = NULL;
210 std::istringstream ins(s);
222 if (
n_ == N)
return *
this;
270 #ifdef TNT_BOUNDS_CHECK
272 BIASASSERT(i <=
n_) ;
279 #ifdef TNT_BOUNDS_CHECK
281 BIASASSERT(i <=
n_) ;
288 #ifdef TNT_BOUNDS_CHECK
297 #ifdef TNT_BOUNDS_CHECK
310 std::ostream& operator<<(std::ostream &s, const Vector<char> &A)
312 std::ios_base::fmtflags oldFlags = s.flags();
315 s<<std::setprecision( std::numeric_limits<Subscript>::digits10 +1 );
317 const unsigned int dig = BIAS::DecimalsToStore<char>();
320 s<<std::setprecision( dig );
321 s<<(int)A[i]<<
" " << std::endl;
330 std::ostream& operator<<(std::ostream &s, const Vector<unsigned char> &A)
332 std::ios_base::fmtflags oldFlags = s.flags();
335 s<<std::setprecision( std::numeric_limits<Subscript>::digits10 +1 );
337 const unsigned int dig = BIAS::DecimalsToStore<unsigned char>();
340 s<<std::setprecision( dig );
341 s<<(int)A[i]<<
" " << std::endl;
352 std::ostream& operator<<(std::ostream &s, const Vector<T> &A)
354 std::ios_base::fmtflags oldFlags = s.flags();
357 s<<std::setprecision( std::numeric_limits<Subscript>::digits10 +1 );
359 const unsigned int dig = BIAS::DecimalsToStore<T>();
362 s<<std::setprecision( dig );
363 s<<A[i]<<
" " << std::endl;
383 if ( !(N == A.
size() ))
390 BIASASSERT(tmp>=std::numeric_limits<char>::min() );
391 BIASASSERT(tmp<=std::numeric_limits<char>::max() );
403 if ( !(N == A.
size() ))
410 BIASASSERT(tmp>=std::numeric_limits<unsigned char>::min() );
411 BIASASSERT(tmp<=std::numeric_limits<unsigned char>::max() );
412 A[i]=(
unsigned char)tmp;
424 if ( !(N == A.
size() ))
442 BIASASSERT(N==B.
dim());
448 tmp[i] = A[i] + B[i];
459 BIASASSERT(N==B.
dim());
465 tmp[i] = A[i] - B[i];
476 BIASASSERT(N==B.
dim());
482 tmp[i] = A[i] * B[i];
492 BIASASSERT(N == B.
dim());
Vector< T > & operator=(const Vector< T > &A)
reference operator[](Subscript i)
std::istream & operator>>(std::istream &s, Fortran_Matrix< T > &A)
const_reference operator[](Subscript i) const
Fortran_Matrix< T > operator-(const Fortran_Matrix< T > &A, const Fortran_Matrix< T > &B)
T dot_prod(const Vector< T > &A, const Vector< T > &B)
TNT_SUBSCRIPT_TYPE Subscript
Vector(Subscript N, const T *v)
Vector< T > & newsize(Subscript N)
Vector(const Subscript N, const std::string &s)
Vector(Subscript N, const T &value=T())
const iterator begin() const
reference operator()(Subscript i)
Vector< T > & operator=(const T &scalar)
Fortran_Matrix< T > operator*(const Fortran_Matrix< T > &A, const Fortran_Matrix< T > &B)
void initialize(Subscript N)
Fortran_Matrix< T > operator+(const Fortran_Matrix< T > &A, const Fortran_Matrix< T > &B)
const iterator end() const
Vector(const Vector< T > &A)
const T & const_reference