1 /*
 2  *   Copyright (c) 2007, Michael Lehn
 3  *
 4  *   All rights reserved.
 5  *
 6  *   Redistribution and use in source and binary forms, with or without
 7  *   modification, are permitted provided that the following conditions
 8  *   are met:
 9  *
10  *   1) Redistributions of source code must retain the above copyright
11  *      notice, this list of conditions and the following disclaimer.
12  *   2) Redistributions in binary form must reproduce the above copyright
13  *      notice, this list of conditions and the following disclaimer in
14  *      the documentation and/or other materials provided with the
15  *      distribution.
16  *   3) Neither the name of the FLENS development group nor the names of
17  *      its contributors may be used to endorse or promote products derived
18  *      from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef FLENS_BLAS_CLOSURES_DEBUGCLOSURE_H
34 #define FLENS_BLAS_CLOSURES_DEBUGCLOSURE_H 1
35 
36 #include <flens/storage/fullstorage/hasfullstorage.h>
37 
38 namespace flens {
39 
40 //
41 //  If you implement a new matrix/vector type that supports views you might
42 //  need to specialize the following function
43 //
44 
45 namespace DEBUGCLOSURE {
46 
47     template <typename X, typename Y>
48         typename RestrictTo<!HasFullStorage<X>::value
49                          || !HasFullStorage<Y>::value,
50                  bool>::Type
51         identical(const X &x, const Y &y);
52 
53     template <typename VX, typename VY>
54         bool
55         identical(const DenseVector<VX> &x, const DenseVector<VY> &y);
56 
57     template <typename MA, typename MB>
58         typename RestrictTo<HasFullStorage<MA>::value
59                          && HasFullStorage<MB>::value,
60                  bool>::Type
61         identical(const MA &A, const MB &B);
62 
63 // namespace DEBUGCLOSURE
64 
65 
66 struct DebugClosure
67 {
68     template <typename X, typename Y>
69         static bool
70         search(const X &x, const Y &y);
71 
72     template <typename Op, typename L, typename R, typename Y>
73         static bool
74         search(const VectorClosure<Op, L, R> &closure, const Y &y);
75 
76     template <typename Op, typename L, typename R, typename Y>
77         static bool
78         search(const MatrixClosure<Op, L, R> &closure, const Y &y);
79 
80 };
81 
82 // namespace flens
83 
84 #endif // FLENS_BLAS_CLOSURES_DEBUGCLOSURE_H