/* * * Template Numerical Toolkit (TNT) * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef IMPALGEBRA_TNT_ARRAY_1D_UTILS_H #define IMPALGEBRA_TNT_ARRAY_1D_UTILS_H #include #include #include IMPALGEBRA_BEGIN_INTERNAL_NAMESPACE namespace TNT { using namespace std; template inline std::ostream& operator<<(std::ostream &s, const Array1D &A) { int N=A.dim1(); #ifdef TNT_DEBUG s << "addr: " << (void *) &A[0] << "\n"; #endif s << N << "\n"; for (int j=0; j inline std::istream& operator>>(std::istream &s, Array1D &A) { int N; s >> N; Array1D B(N); for (int i=0; i> B[i]; A = B; return s; } template inline Array1D operator+(const Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() != n ) return Array1D(); else { Array1D C(n); for (int i=0; i inline Array1D operator-(const Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() != n ) return Array1D(); else { Array1D C(n); for (int i=0; i inline Array1D operator*(const Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() != n ) return Array1D(); else { Array1D C(n); for (int i=0; i inline Array1D operator/(const Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() != n ) return Array1D(); else { Array1D C(n); for (int i=0; i inline Array1D& operator+=(Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() == n) { for (int i=0; i inline Array1D& operator-=(Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() == n) { for (int i=0; i inline Array1D& operator*=(Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() == n) { for (int i=0; i inline Array1D& operator/=(Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() == n) { for (int i=0; i