// This may look like C code, but it is really -*- C++ -*- /* Copyright (C) 1988 Free Software Foundation written by Doug Lea (dl@rocky.oswego.edu) This file is part of the GNU C++ Library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _AVec_h #ifdef __GNUG__ #pragma interface #endif #define _AVec_h 1 #include ".Vec.h" class AVec : public Vec { protected: void check_len(int l); * vec(); const * vec() const; AVec(int l, * d); public: AVec (); AVec (int l); AVec (int l, fill_value); AVec (AVec&); ~AVec (); AVec& operator = (const AVec& a); AVec& operator = ( fill_value); // vector by scalar -> vector operations friend AVec operator + (AVec& a, b); friend AVec operator - (AVec& a, b); friend AVec operator * (AVec& a, b); friend AVec operator / (AVec& a, b); AVec& operator += ( b); AVec& operator -= ( b); AVec& operator *= ( b); AVec& operator /= ( b); // vector by vector -> vector operations friend AVec operator + (AVec& a, AVec& b); friend AVec operator - (AVec& a, AVec& b); AVec& operator += (AVec& b); AVec& operator -= (AVec& b); AVec operator - (); friend AVec product(AVec& a, AVec& b); AVec& product(AVec& b); friend AVec quotient(AVec& a, AVec& b); AVec& quotient(AVec& b); // vector -> scalar operations friend operator * (AVec& a, AVec& b); sum(); min(); max(); sumsq(); // indexing int min_index(); int max_index(); // redundant but necesssary friend AVec concat(AVec& a, AVec& b); friend AVec map(Mapper f, AVec& a); friend AVec merge(AVec& a, AVec& b, Comparator f); friend AVec combine(Combiner f, AVec& a, AVec& b); friend AVec reverse(AVec& a); AVec at(int from = 0, int n = -1); }; inline AVec::AVec() {} inline AVec::AVec(int l) :Vec(l) {} inline AVec::AVec(int l, fill_value) : Vec (l, fill_value) {} inline AVec::AVec(AVec& v) :Vec(v) {} inline AVec::AVec(int l, * d) :Vec(l, d) {} inline AVec::~AVec() {} inline * AVec::vec() { return s; } inline const * AVec::vec() const { return s; } inline void AVec::check_len(int l) { if (l != len) error("nonconformant vectors."); } #endif