tnt_array2d_utils.h Source File

Main Page Namespace List Compound List File List Namespace Members Compound Members File Members

# tnt_array2d_utils.h

Go to the documentation of this file.

    00001 /*
    00002 *
    00003 * Template Numerical Toolkit (TNT)
    00004 *
    00005 * Mathematical and Computational Sciences Division
    00006 * National Institute of Technology,
    00007 * Gaithersburg, MD USA
    00008 *
    00009 *
    00010 * This software was developed at the National Institute of Standards and
    00011 * Technology (NIST) by employees of the Federal Government in the course
    00012 * of their official duties. Pursuant to title 17 Section 105 of the
    00013 * United States Code, this software is not subject to copyright protection
    00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
    00015 * its use by other parties, and makes no guarantees, expressed or implied,
    00016 * about its quality, reliability, or any other characteristic.
    00017 *
    00018 */
    00019
    00020
    00021 #ifndef TNT_ARRAY2D_UTILS_H
    00022 #define TNT_ARRAY2D_UTILS_H
    00023
    00024 #include <cstdlib>
    00025 #include <cassert>
    00026
    00027 namespace TNT
    00028 {
    00029
    00030
    00038 template <class T>
    00039 std::ostream& operator<<(std::ostream &s, const Array2D<T> &A)
    00040 {
    00041     int M=A.dim1();
    00042     int N=A.dim2();
    00043
    00044     s << M << " " << N << "\n";
    00045
    00046     for (int i=0; i<M; i++)
    00047     {
    00048         for (int j=0; j<N; j++)
    00049         {
    00050             s << A[i][j] << " ";
    00051         }
    00052         s << "\n";
    00053     }
    00054
    00055
    00056     return s;
    00057 }
    00058
    00075 template <class T>
    00076 std::istream& operator>>(std::istream &s, Array2D<T> &A);
    00077
    00089 template <class T>
    00090 Array2D<T> operator+(const Array2D<T> &A, const Array2D<T> &B);
    00091
    00103 template <class T>
    00104 Array2D<T> operator-(const Array2D<T> &A, const Array2D<T> &B);
    00105
    00118 template <class T>
    00119 Array2D<T> operator*(const Array2D<T> &A, const Array2D<T> &B);
    00120
    00121
    00122
    00134 template <class T>
    00135 Array2D<T> operator/(const Array2D<T> &A, const Array2D<T> &B);
    00136
    00137
    00138
    00139
    00140
    00152 template <class T>
    00153 Array2D<T>&  operator+=(Array2D<T> &A, const Array2D<T> &B);
    00154
    00155
    00156
    00168 template <class T>
    00169 Array2D<T>&  operator-=(Array2D<T> &A, const Array2D<T> &B);
    00170
    00171
    00172
    00184 template <class T>
    00185 Array2D<T>&  operator*=(Array2D<T> &A, const Array2D<T> &B);
    00186
    00187
    00188
    00189
    00190
    00202 template <class T>
    00203 Array2D<T>&  operator/=(Array2D<T> &A, const Array2D<T> &B);
    00204
    00218 template <class T>
    00219 Array2D<T> matmult(const Array2D<T> &A, const Array2D<T> &B);
    00220
    00221 } // namespace TNT
    00222
    00223 #endif