d2::align: Make a structure for follow semantics variables, and use a static instance...
[Ale.git] / d2 / filter / mult.h
blobd670b5cc4185c303c6b33ffffc8009d23df8465c
1 // Copyright 2004 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@ugcs.caltech.edu>
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __mult_h__
22 #define __mult_h__
25 * A class for pointwise multiplication of filters.
28 class mult : public filter {
29 private:
30 ale_real _support;
31 filter *f1, *f2;
32 public:
35 * Size of filter support, in number of half-cycles to each side of the
36 * filter center.
38 virtual ale_real support() const {
39 return _support;
42 virtual int equals(const filter *f) const {
43 if (typeid(*f) != typeid(*this))
44 return 0;
46 const mult *m = (const mult *)f;
49 * XXX: if we wished, we could recognize commutativity.
51 return (m->f1->equals(f1)
52 && m->f2->equals(f2));
56 * Response of filter at point p
58 virtual ale_real response(point p) const {
59 return f1->response(p) * f2->response(p);
62 mult(filter *f1, filter *f2) {
63 this->f1 = f1;
64 this->f2 = f2;
65 assert (f1 != NULL);
66 assert (f2 != NULL);
68 _support = f1->support();
70 if (f2->support() < _support)
71 _support = f2->support();
75 #endif