New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
concepts.hpp in vendors/XIOS/current/extern/boost/include/boost/numeric/ublas/detail – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/numeric/ublas/detail/concepts.hpp @ 3408

Last change on this file since 3408 was 3408, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

  • Property svn:keywords set to Id
File size: 71.3 KB
Line 
1//
2//  Copyright (c) 2000-2002
3//  Joerg Walter, Mathias Koch
4//
5//  Distributed under the Boost Software License, Version 1.0. (See
6//  accompanying file LICENSE_1_0.txt or copy at
7//  http://www.boost.org/LICENSE_1_0.txt)
8//
9//  The authors gratefully acknowledge the support of
10//  GeNeSys mbH & Co. KG in producing this work.
11//
12
13#ifndef _BOOST_UBLAS_CONCEPTS_
14#define _BOOST_UBLAS_CONCEPTS_
15
16#include <boost/concept_check.hpp>
17
18// Concept checks based on ideas of Jeremy Siek
19
20namespace boost { namespace numeric { namespace ublas {
21
22
23    template<class I>
24    struct Indexed1DIteratorConcept {
25        typedef I iterator_type;
26
27        void constraints () {
28            iterator_type it = iterator_type ();
29            // Index
30            it.index ();
31        }
32    };
33
34    template<class I>
35    struct IndexedBidirectional1DIteratorConcept {
36        typedef I iterator_type;
37
38        void constraints () {
39            function_requires< BidirectionalIteratorConcept<iterator_type> >();
40            function_requires< Indexed1DIteratorConcept<iterator_type> >();
41        }
42    };
43
44    template<class I>
45    struct Mutable_IndexedBidirectional1DIteratorConcept {
46        typedef I iterator_type;
47
48        void constraints () {
49            function_requires< Mutable_BidirectionalIteratorConcept<iterator_type> >();
50            function_requires< Indexed1DIteratorConcept<iterator_type> >();
51        }
52    };
53
54    template<class I>
55    struct IndexedRandomAccess1DIteratorConcept {
56        typedef I iterator_type;
57
58        void constraints () {
59            function_requires< RandomAccessIteratorConcept<iterator_type> >();
60            function_requires< Indexed1DIteratorConcept<iterator_type> >();
61        }
62    };
63
64    template<class I>
65    struct Mutable_IndexedRandomAccess1DIteratorConcept {
66        typedef I iterator_type;
67
68        void constraints () {
69            function_requires< Mutable_RandomAccessIteratorConcept<iterator_type> >();
70            function_requires< Indexed1DIteratorConcept<iterator_type> >();
71        }
72    };
73
74    template<class I>
75    struct Indexed2DIteratorConcept {
76        typedef I iterator_type;
77        typedef typename I::dual_iterator_type dual_iterator_type;
78        typedef typename I::dual_reverse_iterator_type dual_reverse_iterator_type;
79
80        void constraints () {
81            iterator_type it = iterator_type ();
82            // Indices
83            it.index1 ();
84            it.index2 ();
85            // Iterator begin/end
86            dual_iterator_type it_begin (it.begin ());
87            dual_iterator_type it_end (it.end ());
88            // Reverse iterator begin/end
89            dual_reverse_iterator_type it_rbegin (it.rbegin ());
90            dual_reverse_iterator_type it_rend (it.rend ());
91            ignore_unused_variable_warning (it_begin);
92            ignore_unused_variable_warning (it_end);
93            ignore_unused_variable_warning (it_rbegin);
94            ignore_unused_variable_warning (it_rend);
95        }
96    };
97
98    template<class I1, class I2>
99    struct IndexedBidirectional2DIteratorConcept {
100        typedef I1 subiterator1_type;
101        typedef I2 subiterator2_type;
102
103        void constraints () {
104            function_requires< BidirectionalIteratorConcept<subiterator1_type> >();
105            function_requires< BidirectionalIteratorConcept<subiterator2_type> >();
106            function_requires< Indexed2DIteratorConcept<subiterator1_type> >();
107            function_requires< Indexed2DIteratorConcept<subiterator2_type> >();
108        }
109    };
110
111    template<class I1, class I2>
112    struct Mutable_IndexedBidirectional2DIteratorConcept {
113        typedef I1 subiterator1_type;
114        typedef I2 subiterator2_type;
115
116        void constraints () {
117            function_requires< Mutable_BidirectionalIteratorConcept<subiterator1_type> >();
118            function_requires< Mutable_BidirectionalIteratorConcept<subiterator2_type> >();
119            function_requires< Indexed2DIteratorConcept<subiterator1_type> >();
120            function_requires< Indexed2DIteratorConcept<subiterator2_type> >();
121        }
122    };
123
124    template<class I1, class I2>
125    struct IndexedRandomAccess2DIteratorConcept {
126        typedef I1 subiterator1_type;
127        typedef I2 subiterator2_type;
128
129        void constraints () {
130            function_requires< RandomAccessIteratorConcept<subiterator1_type> >();
131            function_requires< RandomAccessIteratorConcept<subiterator2_type> >();
132            function_requires< Indexed2DIteratorConcept<subiterator1_type> >();
133            function_requires< Indexed2DIteratorConcept<subiterator2_type> >();
134        }
135    };
136
137    template<class I1, class I2>
138    struct Mutable_IndexedRandomAccess2DIteratorConcept {
139        typedef I1 subiterator1_type;
140        typedef I2 subiterator2_type;
141
142        void constraints () {
143            function_requires< Mutable_RandomAccessIteratorConcept<subiterator1_type> >();
144            function_requires< Mutable_RandomAccessIteratorConcept<subiterator2_type> >();
145            function_requires< Indexed2DIteratorConcept<subiterator1_type> >();
146            function_requires< Indexed2DIteratorConcept<subiterator2_type> >();
147        }
148    };
149
150    template<class C>
151    struct StorageArrayConcept {
152        typedef C container_type;
153        typedef typename C::size_type size_type;
154        typedef typename C::value_type value_type;
155
156        void constraints () {
157            function_requires< RandomAccessContainerConcept<container_type> >();
158            size_type n (0);
159            // Sizing constructor
160            container_type c = container_type (n);
161            // Initialised sizing constructor
162            container_type (n, value_type (5));
163            ignore_unused_variable_warning (c);
164        }
165    };
166
167    template<class C>
168    struct Mutable_StorageArrayConcept {
169        typedef C container_type;
170        typedef typename C::size_type size_type;
171        typedef typename C::value_type value_type;
172        typedef typename C::iterator iterator_type;
173
174        void constraints () {
175            function_requires< Mutable_RandomAccessContainerConcept<container_type> > ();
176            size_type n (0);
177            // Sizing constructor
178            container_type c = container_type (n);
179            // Initialised sizing constructor
180            c = container_type (n, value_type (3));
181            // Resize
182            c.resize (n, value_type (5));
183            // Resize - none preserving
184            c.resize (n);
185        }
186    };
187
188    template<class C>
189    struct StorageSparseConcept {
190        typedef C container_type;
191        typedef typename C::size_type size_type;
192
193        void constraints () {
194            function_requires< ReversibleContainerConcept<container_type> > ();
195        }
196    };
197
198    template<class C>
199    struct Mutable_StorageSparseConcept {
200        typedef C container_type;
201        typedef typename C::size_type size_type;
202        typedef typename C::value_type value_type;
203        typedef typename C::iterator iterator_type;
204
205        void constraints () {
206            // NOTE - Not Mutable_ReversibleContainerConcept
207            function_requires< ReversibleContainerConcept<container_type> >();
208            container_type c = container_type ();
209            value_type t = value_type ();
210            iterator_type it = iterator_type (), it1 = iterator_type (), it2 = iterator_type ();
211            // Insert
212            c.insert (it, t);
213            // Erase
214            c.erase (it);
215            // Range erase
216            c.erase (it1, it2);
217            // Clear
218            c.clear ();
219        }
220    };
221
222    template<class G>
223    struct IndexSetConcept {
224        typedef G generator_type;
225        typedef typename G::size_type size_type;
226        typedef typename G::value_type value_type;
227
228        void constraints () {
229            function_requires< AssignableConcept<generator_type> >();
230            function_requires< ReversibleContainerConcept<generator_type> >();
231            generator_type g = generator_type ();
232            size_type n (0);
233            value_type t;
234            // Element access
235            t = g (n);
236            ignore_unused_variable_warning (t);
237        }
238    };
239
240    /** \brief Scalar expression concept.
241     *
242     * requirements
243     * \li \c SE::value_type is the type of the scalar expression
244     * \li \c SE must be convertable to \c SE::value_type
245     * \li the constant \c SE::complexity must exist
246     *
247     * \param SE the type of the scalar expression
248     */
249    template<class SE>
250    struct ScalarExpressionConcept {
251        typedef SE scalar_expression_type;
252        typedef typename SE::value_type value_type;
253
254        static const unsigned complexity = SE::complexity;
255
256        void constraints () {
257            scalar_expression_type *sp;
258            scalar_expression_type s = *sp;
259            value_type t;
260            // Conversion
261            t = s;
262            ignore_unused_variable_warning (t);
263        }
264    };
265
266    /** \brief Vector expression concept.
267     *
268     * requirements
269     * \li \c VE::value_type is the type of the elements
270     * \li \c VE::const_reference The return type when accessing an element of a constant vector
271     * expression. Must be convertable to a \c value_type.
272     * \li \c VE::size_type is the (unsigned) type of the indices
273     * \li \c VE::difference_type is the (signed) type of distances between indices
274     * \li \c VE::category
275     *
276     * \li the constant \c SE::complexity must exist
277     *
278     * \param SE the type of the scalar expression
279     */
280    template<class VE>
281    struct VectorExpressionConcept {
282        typedef VE vector_expression_type;
283        typedef typename VE::type_category type_category;
284        typedef typename VE::size_type size_type;
285        typedef typename VE::difference_type difference_type;
286        typedef typename VE::value_type value_type;
287        typedef typename VE::const_reference const_reference;
288        typedef typename VE::const_iterator const_iterator_type;
289        typedef typename VE::const_reverse_iterator const_reverse_iterator_type;
290
291        void constraints () {
292            vector_expression_type *vp;
293            const vector_expression_type *cvp;
294            vector_expression_type v = *vp;
295            const vector_expression_type cv = *cvp;
296            size_type n (0), i (0);
297            value_type t;
298            // Find (internal?)
299            const_iterator_type cit (v.find (i));
300            // Beginning of range
301            const_iterator_type cit_begin (v.begin ());
302            // End of range
303            const_iterator_type cit_end (v.end ());
304            // Size
305            n = v.size ();
306            // Beginning of reverse range
307            const_reverse_iterator_type crit_begin (cv.rbegin ());
308            // End of reverse range
309            const_reverse_iterator_type crit_end (cv.rend ());
310            // Element access
311            t = v (i);
312            ignore_unused_variable_warning (n);
313            ignore_unused_variable_warning (cit);
314            ignore_unused_variable_warning (cit_begin);
315            ignore_unused_variable_warning (cit_end);
316            ignore_unused_variable_warning (crit_begin);
317            ignore_unused_variable_warning (crit_end);
318            ignore_unused_variable_warning (t);
319        }
320    };
321
322    template<class VE>
323    struct Mutable_VectorExpressionConcept {
324        typedef VE vector_expression_type;
325        typedef typename VE::size_type size_type;
326        typedef typename VE::value_type value_type;
327        typedef typename VE::iterator iterator_type;
328        typedef typename VE::reverse_iterator reverse_iterator_type;
329
330        void constraints () {
331            function_requires< AssignableConcept<vector_expression_type> >();
332            function_requires< VectorExpressionConcept<vector_expression_type> >();
333            vector_expression_type *vp;
334            vector_expression_type v = *vp, v1 = *vp, v2 = *vp;
335            size_type i (0);
336            value_type t = value_type ();
337            // Find (internal?)
338            iterator_type it (v.find (i));
339            // Beginning of range
340            iterator_type it_begin (v.begin ());
341            // End of range
342            iterator_type it_end (v.end ());
343            // Swap
344            v1.swap (v2);
345            // Beginning of reverse range
346            reverse_iterator_type rit_begin (v.rbegin ());
347            // End of reverse range
348            reverse_iterator_type rit_end (v.rend ());
349            // Assignments
350            v2 = v1;
351            v2.assign (v1);
352            v2 += v1;
353            v2.plus_assign (v1);
354            v2 -= v1;
355            v2.minus_assign (v1);
356            v *= t;
357            ignore_unused_variable_warning (it);
358            ignore_unused_variable_warning (it_begin);
359            ignore_unused_variable_warning (it_end);
360            ignore_unused_variable_warning (rit_begin);
361            ignore_unused_variable_warning (rit_end);
362        }
363    };
364
365    template<class ME>
366    struct MatrixExpressionConcept {
367        typedef ME matrix_expression_type;
368        typedef typename ME::type_category type_category;
369        typedef typename ME::size_type size_type;
370        typedef typename ME::value_type value_type;
371        typedef typename ME::const_iterator1 const_subiterator1_type;
372        typedef typename ME::const_iterator2 const_subiterator2_type;
373        typedef typename ME::const_reverse_iterator1 const_reverse_subiterator1_type;
374        typedef typename ME::const_reverse_iterator2 const_reverse_subiterator2_type;
375
376        void constraints () {
377            matrix_expression_type *mp;
378            const matrix_expression_type *cmp;
379            matrix_expression_type m = *mp;
380            const matrix_expression_type cm = *cmp;
381            size_type n (0), i (0), j (0);
382            value_type t;
383            // Find (internal?)
384            const_subiterator1_type cit1 (m.find1 (0, i, j));
385            const_subiterator2_type cit2 (m.find2 (0, i, j));
386            // Beginning of range
387            const_subiterator1_type cit1_begin (m.begin1 ());
388            const_subiterator2_type cit2_begin (m.begin2 ());
389            // End of range
390            const_subiterator1_type cit1_end (m.end1 ());
391            const_subiterator2_type cit2_end (m.end2 ());
392            // Size
393            n = m.size1 ();
394            n = m.size2 ();
395            // Beginning of reverse range
396            const_reverse_subiterator1_type crit1_begin (cm.rbegin1 ());
397            const_reverse_subiterator2_type crit2_begin (cm.rbegin2 ());
398            // End of reverse range
399            const_reverse_subiterator1_type crit1_end (cm.rend1 ());
400            const_reverse_subiterator2_type crit2_end (cm.rend2 ());
401            // Element access
402            t = m (i, j);
403            ignore_unused_variable_warning (n);
404            ignore_unused_variable_warning (cit1);
405            ignore_unused_variable_warning (cit2);
406            ignore_unused_variable_warning (cit1_begin);
407            ignore_unused_variable_warning (cit2_begin);
408            ignore_unused_variable_warning (cit1_end);
409            ignore_unused_variable_warning (cit2_end);
410            ignore_unused_variable_warning (crit1_begin);
411            ignore_unused_variable_warning (crit2_begin);
412            ignore_unused_variable_warning (crit1_end);
413            ignore_unused_variable_warning (crit2_end);
414            ignore_unused_variable_warning (t);
415        }
416    };
417
418    template<class ME>
419    struct Mutable_MatrixExpressionConcept {
420        typedef ME matrix_expression_type;
421        typedef typename ME::size_type size_type;
422        typedef typename ME::value_type value_type;
423        typedef typename ME::iterator1 subiterator1_type;
424        typedef typename ME::iterator2 subiterator2_type;
425        typedef typename ME::reverse_iterator1 reverse_subiterator1_type;
426        typedef typename ME::reverse_iterator2 reverse_subiterator2_type;
427
428        void constraints () {
429            function_requires< AssignableConcept<matrix_expression_type> >();
430            function_requires< MatrixExpressionConcept<matrix_expression_type> >();
431            matrix_expression_type *mp;
432            matrix_expression_type m = *mp, m1 = *mp, m2 = *mp;
433            size_type i (0), j (0);
434            value_type t = value_type ();
435            // Find (internal?)
436            subiterator1_type it1 (m.find1 (0, i, j));
437            subiterator2_type it2 (m.find2 (0, i, j));
438            // Beginning of range
439            subiterator1_type it1_begin (m.begin1 ());
440            subiterator2_type it2_begin (m.begin2 ());
441            // End of range
442            subiterator1_type it1_end (m.end1 ());
443            subiterator2_type it2_end (m.end2 ());
444            // Swap
445            m1.swap (m2);
446            // Beginning of reverse range
447            reverse_subiterator1_type rit1_begin (m.rbegin1 ());
448            reverse_subiterator2_type rit2_begin (m.rbegin2 ());
449            // End of reverse range
450            reverse_subiterator1_type rit1_end (m.rend1 ());
451            reverse_subiterator2_type rit2_end (m.rend2 ());
452            // Assignments
453            m2 = m1;
454            m2.assign (m1);
455            m2 += m1;
456            m2.plus_assign (m1);
457            m2 -= m1;
458            m2.minus_assign (m1);
459            m *= t;
460            ignore_unused_variable_warning (it1);
461            ignore_unused_variable_warning (it2);
462            ignore_unused_variable_warning (it1_begin);
463            ignore_unused_variable_warning (it2_begin);
464            ignore_unused_variable_warning (it1_end);
465            ignore_unused_variable_warning (it2_end);
466            ignore_unused_variable_warning (rit1_begin);
467            ignore_unused_variable_warning (rit2_begin);
468            ignore_unused_variable_warning (rit1_end);
469            ignore_unused_variable_warning (rit2_end);
470        }
471    };
472
473    template<class V>
474    struct VectorConcept {
475        typedef V vector_type;
476        typedef typename V::size_type size_type;
477        typedef typename V::value_type value_type;
478        typedef const value_type *const_pointer;
479
480        void constraints () {
481            function_requires< VectorExpressionConcept<vector_type> >();
482            size_type n (0);
483            size_type i (0);
484            // Sizing constructor
485            vector_type v (n);
486            // Element support
487            const_pointer p = v.find_element (i);
488
489            ignore_unused_variable_warning (p);
490        }
491    };
492
493    template<class V>
494    struct Mutable_VectorConcept {
495        typedef V vector_type;
496        typedef typename V::size_type size_type;
497        typedef typename V::value_type value_type;
498        typedef value_type *pointer;
499
500        void constraints () {
501            function_requires< VectorConcept<vector_type> >();
502            function_requires< DefaultConstructible<vector_type> >();
503            function_requires< Mutable_VectorExpressionConcept<vector_type> >();
504            size_type n (0);
505            value_type t = value_type ();
506            size_type i (0);
507            vector_type v;
508            // Element support
509            pointer p = v.find_element (i);
510            // Element assignment
511            value_type r = v.insert_element (i, t);
512            v.insert_element (i, t) = r;
513            // Zeroing
514            v.clear ();
515            // Resize
516            v.resize (n);
517
518            ignore_unused_variable_warning (p);
519            ignore_unused_variable_warning (r);
520        }
521    };
522
523    template<class V>
524    struct SparseVectorConcept {
525        typedef V vector_type;
526        typedef typename V::size_type size_type;
527
528        void constraints () {
529            function_requires< VectorConcept<vector_type> >();
530        }
531    };
532
533    template<class V>
534    struct Mutable_SparseVectorConcept {
535        typedef V vector_type;
536        typedef typename V::size_type size_type;
537        typedef typename V::value_type value_type;
538
539        void constraints () {
540            function_requires< SparseVectorConcept<vector_type> >();
541            function_requires< Mutable_VectorConcept<vector_type> >();
542            size_type i (0);
543            vector_type v;
544            // Element erasure
545            v.erase_element (i);
546        }
547    };
548
549    template<class M>
550    struct MatrixConcept {
551        typedef M matrix_type;
552        typedef typename M::size_type size_type;
553        typedef typename M::value_type value_type;
554        typedef const value_type *const_pointer;
555
556        void constraints () {
557            function_requires< MatrixExpressionConcept<matrix_type> >();
558            size_type n (0);
559            size_type i (0), j (0);
560            // Sizing constructor
561            matrix_type m (n, n);
562            // Element support
563#ifndef SKIP_BAD
564            const_pointer p = m.find_element (i, j);
565#else
566            const_pointer p;
567            ignore_unused_variable_warning (i);
568            ignore_unused_variable_warning (j);
569#endif
570            ignore_unused_variable_warning (p);
571        }
572    };
573
574    template<class M>
575    struct Mutable_MatrixConcept {
576        typedef M matrix_type;
577        typedef typename M::size_type size_type;
578        typedef typename M::value_type value_type;
579        typedef value_type *pointer;
580
581        void constraints () {
582            function_requires< MatrixConcept<matrix_type> >();
583            function_requires< DefaultConstructible<matrix_type> >();
584            function_requires< Mutable_MatrixExpressionConcept<matrix_type> >();
585            size_type n (0);
586            value_type t = value_type ();
587            size_type i (0), j (0);
588            matrix_type m;
589            // Element support
590#ifndef SKIP_BAD
591            pointer p = m.find_element (i, j);
592            ignore_unused_variable_warning (i);
593            ignore_unused_variable_warning (j);
594#else
595            pointer p;
596#endif
597            // Element assigment
598            value_type r = m.insert_element (i, j, t);
599            m.insert_element (i, j, t) = r;
600            // Zeroing
601            m.clear ();
602            // Resize
603            m.resize (n, n);
604            m.resize (n, n, false);
605
606            ignore_unused_variable_warning (p);
607            ignore_unused_variable_warning (r);
608        }
609    };
610
611    template<class M>
612    struct SparseMatrixConcept {
613        typedef M matrix_type;
614        typedef typename M::size_type size_type;
615
616        void constraints () {
617            function_requires< MatrixConcept<matrix_type> >();
618        }
619    };
620
621    template<class M>
622    struct Mutable_SparseMatrixConcept {
623        typedef M matrix_type;
624        typedef typename M::size_type size_type;
625        typedef typename M::value_type value_type;
626
627        void constraints () {
628            function_requires< SparseMatrixConcept<matrix_type> >();
629            function_requires< Mutable_MatrixConcept<matrix_type> >();
630            size_type i (0), j (0);
631            matrix_type m;
632            // Elemnent erasure
633            m.erase_element (i, j);
634        }
635    };
636
637    /** introduce anonymous namespace to make following functions
638     * local to the current compilation unit.
639     */
640    namespace {
641
642    template<class T>
643    T
644    ZeroElement (T);
645    template<>
646    float
647    ZeroElement (float) {
648        return 0.f;
649    }
650    template<>
651    double
652    ZeroElement (double) {
653        return 0.;
654    }
655    template<>
656    vector<float>
657    ZeroElement (vector<float>) {
658        return zero_vector<float> ();
659    }
660    template<>
661    vector<double>
662    ZeroElement (vector<double>) {
663        return zero_vector<double> ();
664    }
665    template<>
666    matrix<float>
667    ZeroElement (matrix<float>) {
668        return zero_matrix<float> ();
669    }
670    template<>
671    matrix<double>
672    ZeroElement (matrix<double>) {
673        return zero_matrix<double> ();
674    }
675    template<>
676    std::complex<float>
677    ZeroElement (std::complex<float>) {
678        return std::complex<float> (0.f);
679    }
680    template<>
681    std::complex<double>
682    ZeroElement (std::complex<double>) {
683        return std::complex<double> (0.);
684    }
685    template<>
686    vector<std::complex<float> >
687    ZeroElement (vector<std::complex<float> >) {
688        return zero_vector<std::complex<float> > ();
689    }
690    template<>
691    vector<std::complex<double> >
692    ZeroElement (vector<std::complex<double> >) {
693        return zero_vector<std::complex<double> > ();
694    }
695    template<>
696    matrix<std::complex<float> >
697    ZeroElement (matrix<std::complex<float> >) {
698        return zero_matrix<std::complex<float> > ();
699    }
700    template<>
701    matrix<std::complex<double> >
702    ZeroElement (matrix<std::complex<double> >) {
703        return zero_matrix<std::complex<double> > ();
704    }
705
706    template<class T>
707    T
708    OneElement (T);
709    template<>
710    float
711    OneElement (float) {
712        return 1.f;
713    }
714    template<>
715    double
716    OneElement (double) {
717        return 1.;
718    }
719    template<>
720    matrix<float>
721    OneElement (matrix<float>) {
722        return identity_matrix<float> ();
723    }
724    template<>
725    matrix<double>
726    OneElement (matrix<double>) {
727        return identity_matrix<double> ();
728    }
729    template<>
730    std::complex<float>
731    OneElement (std::complex<float>) {
732        return std::complex<float> (1.f);
733    }
734    template<>
735    std::complex<double>
736    OneElement (std::complex<double>) {
737        return std::complex<double> (1.);
738    }
739    template<>
740    matrix<std::complex<float> >
741    OneElement (matrix<std::complex<float> >) {
742        return identity_matrix<std::complex<float> > ();
743    }
744    template<>
745    matrix<std::complex<double> >
746    OneElement (matrix<std::complex<double> >) {
747        return identity_matrix<std::complex<double> > ();
748    }
749
750    template<class E1, class E2>
751    bool
752    operator == (const vector_expression<E1> &e1, const vector_expression<E2> &e2) {
753        typedef typename promote_traits<typename E1::value_type,
754                                                    typename E2::value_type>::promote_type value_type;
755        typedef typename type_traits<value_type>::real_type real_type;
756        return norm_inf (e1 - e2) == real_type/*zero*/();
757    }
758    template<class E1, class E2>
759    bool
760    operator == (const matrix_expression<E1> &e1, const matrix_expression<E2> &e2) {
761        typedef typename promote_traits<typename E1::value_type,
762                                                    typename E2::value_type>::promote_type value_type;
763        typedef typename type_traits<value_type>::real_type real_type;
764        return norm_inf (e1 - e2) == real_type/*zero*/();
765    }
766
767    template<class T>
768    struct AdditiveAbelianGroupConcept {
769        typedef T value_type;
770
771        void constraints () {
772            bool r;
773            value_type a = value_type (), b = value_type (), c = value_type ();
774            r = (a + b) + c == a + (b + c);
775            r = ZeroElement (value_type ()) + a == a;
776            r = a + ZeroElement (value_type ()) == a;
777            r = a + (- a) == ZeroElement (value_type ());
778            r = (- a) + a == ZeroElement (value_type ());
779            r = a + b == b + a;
780            ignore_unused_variable_warning (r);
781        }
782    };
783
784    template<class T>
785    struct MultiplicativeAbelianGroupConcept {
786        typedef T value_type;
787
788        void constraints () {
789            bool r;
790            value_type a = value_type (), b = value_type (), c = value_type ();
791            r = (a * b) * c == a * (b * c);
792            r = OneElement (value_type ()) * a == a;
793            r = a * OneElement (value_type ()) == a;
794            r = a * (OneElement (value_type ()) / a) == a;
795            r = (OneElement (value_type ()) / a) * a == a;
796            r = a * b == b * a;
797            ignore_unused_variable_warning (r);
798        }
799    };
800
801    template<class T>
802    struct RingWithIdentityConcept {
803        typedef T value_type;
804
805        void constraints () {
806            function_requires< AdditiveAbelianGroupConcept<value_type> >();
807            bool r;
808            value_type a = value_type (), b = value_type (), c = value_type ();
809            r = (a * b) * c == a * (b * c);
810            r = (a + b) * c == a * c + b * c;
811            r = OneElement (value_type ()) * a == a;
812            r = a * OneElement (value_type ()) == a;
813            ignore_unused_variable_warning (r);
814        }
815    };
816
817    template<class T>
818    struct Prod_RingWithIdentityConcept {
819        typedef T value_type;
820
821        void constraints () {
822            function_requires< AdditiveAbelianGroupConcept<value_type> >();
823            bool r;
824            value_type a = value_type (), b = value_type (), c = value_type ();
825            r = prod (T (prod (a, b)), c) == prod (a, T (prod (b, c)));
826            r = prod (a + b, c) == prod (a, c) + prod (b, c);
827            r = prod (OneElement (value_type ()), a) == a;
828            r = prod (a, OneElement (value_type ())) == a;
829            ignore_unused_variable_warning (r);
830        }
831    };
832
833    template<class T>
834    struct CommutativeRingWithIdentityConcept {
835        typedef T value_type;
836
837        void constraints () {
838            function_requires< RingWithIdentityConcept<value_type> >();
839            bool r;
840            value_type a = value_type (), b = value_type ();
841            r = a * b == b * a;
842            ignore_unused_variable_warning (r);
843        }
844    };
845
846    template<class T>
847    struct FieldConcept {
848        typedef T value_type;
849
850        void constraints () {
851            function_requires< CommutativeRingWithIdentityConcept<value_type> >();
852            bool r;
853            value_type a = value_type ();
854            r = a == ZeroElement (value_type ()) || a * (OneElement (value_type ()) / a) == a;
855            r = a == ZeroElement (value_type ()) || (OneElement (value_type ()) / a) * a == a;
856            ignore_unused_variable_warning (r);
857        }
858    };
859
860    template<class T, class V>
861    struct VectorSpaceConcept {
862        typedef T value_type;
863        typedef V vector_type;
864
865        void constraints () {
866            function_requires< FieldConcept<value_type> >();
867            function_requires< AdditiveAbelianGroupConcept<vector_type> >();
868            bool r;
869            value_type alpha = value_type (), beta = value_type ();
870            vector_type a = vector_type (), b = vector_type ();
871            r = alpha * (a + b) == alpha * a + alpha * b;
872            r = (alpha + beta) * a == alpha * a + beta * a;
873            r = (alpha * beta) * a == alpha * (beta * a);
874            r = OneElement (value_type ()) * a == a;
875            ignore_unused_variable_warning (r);
876        }
877    };
878
879    template<class T, class V, class M>
880    struct LinearOperatorConcept {
881        typedef T value_type;
882        typedef V vector_type;
883        typedef M matrix_type;
884
885        void constraints () {
886            function_requires< VectorSpaceConcept<value_type, vector_type> >();
887            bool r;
888            value_type alpha = value_type (), beta = value_type ();
889            vector_type a = vector_type (), b = vector_type ();
890            matrix_type A = matrix_type ();
891            r = prod (A, alpha * a + beta * b) == alpha * prod (A, a) + beta * prod (A, b);
892            ignore_unused_variable_warning (r);
893        }
894    };
895
896    void concept_checks () {
897
898        // Allow tests to be group to keep down compiler storage requirement
899#ifdef INTERAL
900#define INTERNAL_STORAGE
901#define INTERNAL_VECTOR
902#define INTERNAL_MATRIX
903#define INTERNAL_SPECIAL
904#define INTERNAL_SPARSE
905#define INTERNAL_EXPRESSION
906#endif
907
908        // TODO enable this for development
909        // #define VIEW_CONCEPTS
910
911        // Element value type for tests
912        typedef float T;
913
914        // Storage Array
915#if defined (INTERNAL_STORAGE) || defined (INTERNAL_STORAGE_DENSE)
916        {
917            typedef std::vector<T> container_model;
918            function_requires< Mutable_StorageArrayConcept<container_model> >();
919            function_requires< RandomAccessIteratorConcept<container_model::const_iterator> >();
920            function_requires< Mutable_RandomAccessIteratorConcept<container_model::iterator> >();
921        }
922
923        {
924            typedef bounded_array<T, 1> container_model;
925            function_requires< Mutable_StorageArrayConcept<container_model> >();
926            function_requires< RandomAccessIteratorConcept<container_model::const_iterator> >();
927            function_requires< Mutable_RandomAccessIteratorConcept<container_model::iterator> >();
928        }
929
930        {
931            typedef unbounded_array<T> container_model;
932            function_requires< Mutable_StorageArrayConcept<container_model> >();
933            function_requires< RandomAccessIteratorConcept<container_model::const_iterator> >();
934            function_requires< Mutable_RandomAccessIteratorConcept<container_model::iterator> >();
935        }
936
937/* FIXME array_adaptors are in progress
938        {
939            typedef array_adaptor<T> container_model;
940            function_requires< Mutable_StorageArrayConcept<container_model> >();
941            function_requires< RandomAccessIteratorConcept<container_model::const_iterator> >();
942            function_requires< Mutable_RandomAccessIteratorConcept<container_model::iterator> >();
943        }
944*/
945
946        {
947            typedef range container_model;
948            function_requires< IndexSetConcept<range> >();
949            function_requires< RandomAccessIteratorConcept<range::const_iterator> >();
950        }
951
952        {
953            typedef slice container_model;
954            function_requires< IndexSetConcept<range> >();
955            function_requires< RandomAccessIteratorConcept<range::const_iterator> >();
956        }
957
958        {
959            typedef indirect_array<> container_model;
960            function_requires< IndexSetConcept<range> >();
961            function_requires< RandomAccessIteratorConcept<range::const_iterator> >();
962        }
963#endif
964
965        // Storage Sparse
966#if defined (INTERNAL_STORAGE) || defined (INTERNAL_STORAGE_SPARSE)
967        {
968           typedef map_array<std::size_t, T> container_model;
969           function_requires< Mutable_StorageSparseConcept<container_model> >();
970           function_requires< RandomAccessIteratorConcept<container_model::const_iterator> >();
971           function_requires< RandomAccessIteratorConcept<container_model::iterator> >();
972        }
973
974        {
975           typedef std::map<std::size_t, T> container_model;
976           function_requires< Mutable_StorageSparseConcept<container_model > >();
977           function_requires< BidirectionalIteratorConcept<container_model::const_iterator> >();
978           function_requires< BidirectionalIteratorConcept<container_model::iterator> >();
979        }
980#endif
981
982#ifdef VIEW_CONCEPTS
983        // read only vectors
984        {
985           typedef vector_view<T> container_model;
986           function_requires< RandomAccessContainerConcept<container_model> >();
987           function_requires< VectorConcept<container_model> >();
988           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
989           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
990        }
991#endif
992
993        // Vector
994#if defined (INTERNAL_VECTOR) || defined (INTERNAL_VECTOR_DENSE)
995        {
996           typedef vector<T> container_model;
997           function_requires< RandomAccessContainerConcept<container_model> >();
998           function_requires< Mutable_VectorConcept<container_model> >();
999           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
1000           function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::iterator> >();
1001           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
1002           function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::reverse_iterator> >();
1003        }
1004
1005        {
1006           typedef zero_vector<T> container_model;
1007           function_requires< VectorConcept<container_model> >();
1008           function_requires< IndexedBidirectional1DIteratorConcept<container_model::const_iterator> >();
1009           function_requires< IndexedBidirectional1DIteratorConcept<container_model::const_reverse_iterator> >();
1010        }
1011
1012        {
1013           typedef unit_vector<T> container_model;
1014           function_requires< VectorConcept<container_model> >();
1015           function_requires< IndexedBidirectional1DIteratorConcept<container_model::const_iterator> >();
1016           function_requires< IndexedBidirectional1DIteratorConcept<container_model::const_reverse_iterator> >();
1017        }
1018
1019        {
1020           typedef scalar_vector<T> container_model;
1021           function_requires< VectorConcept<container_model> >();
1022           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
1023           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
1024        }
1025
1026        {
1027           typedef c_vector<T, 1> container_model;
1028           function_requires< Mutable_VectorConcept<container_model> >();
1029           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
1030           function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::iterator> >();
1031           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
1032           function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::reverse_iterator> >();
1033        }
1034#endif
1035
1036        // Vector Proxies
1037#if defined (INTERNAL_VECTOR) || defined (INTERNAL_VECTOR_PROXY)
1038        {
1039           typedef vector_range<vector<T> > container_model;
1040           function_requires< Mutable_VectorExpressionConcept<container_model> >();
1041           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
1042           function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::iterator> >();
1043           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
1044           function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::reverse_iterator> >();
1045        }
1046
1047        {
1048           typedef vector_slice<vector<T> > container_model;
1049           function_requires< Mutable_VectorExpressionConcept<container_model> >();
1050           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
1051           function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::iterator> >();
1052           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
1053           function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::reverse_iterator> >();
1054        }
1055
1056        {
1057           typedef vector_indirect<vector<T> > container_model;
1058           function_requires< Mutable_VectorExpressionConcept<container_model> >();
1059           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
1060           function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::iterator> >();
1061           function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
1062           function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::reverse_iterator> >();
1063        }
1064#endif
1065
1066        // Sparse Vector
1067#if defined (INTERNAL_SPARSE) || defined (INTERNAL_VECTOR_SPARSE)
1068        {
1069            typedef mapped_vector<T> container_model;
1070            function_requires< Mutable_SparseVectorConcept<container_model> >();
1071            function_requires< IndexedBidirectional1DIteratorConcept<container_model::const_iterator> >();
1072            function_requires< Mutable_IndexedBidirectional1DIteratorConcept<container_model::iterator> >();
1073            function_requires< IndexedBidirectional1DIteratorConcept<container_model::const_reverse_iterator> >();
1074            function_requires< Mutable_IndexedBidirectional1DIteratorConcept<container_model::reverse_iterator> >();
1075        }
1076
1077        {
1078            typedef compressed_vector<T> container_model;
1079            function_requires< Mutable_SparseVectorConcept<container_model> >();
1080            function_requires< IndexedBidirectional1DIteratorConcept<container_model::const_iterator> >();
1081            function_requires< Mutable_IndexedBidirectional1DIteratorConcept<container_model::iterator> >();
1082            function_requires< IndexedBidirectional1DIteratorConcept<container_model::const_reverse_iterator> >();
1083            function_requires< Mutable_IndexedBidirectional1DIteratorConcept<container_model::reverse_iterator> >();
1084        }
1085
1086        {
1087            typedef coordinate_vector<T> container_model;
1088            function_requires< Mutable_SparseVectorConcept<container_model> >();
1089            function_requires< IndexedBidirectional1DIteratorConcept<container_model::const_iterator> >();
1090            function_requires< Mutable_IndexedBidirectional1DIteratorConcept<container_model::iterator> >();
1091            function_requires< IndexedBidirectional1DIteratorConcept<container_model::const_reverse_iterator> >();
1092            function_requires< Mutable_IndexedBidirectional1DIteratorConcept<container_model::reverse_iterator> >();
1093        }
1094#endif
1095
1096        // Matrix
1097#if defined (INTERNAL_MATRIX) || defined (INTERNAL_MATRIX_DENSE)
1098        {
1099            typedef matrix<T> container_model;
1100            function_requires< Mutable_MatrixConcept<matrix<T> > >();
1101            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1102            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1103            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1104            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1105        }
1106
1107        {
1108            typedef vector_of_vector<T> container_model;
1109            function_requires< Mutable_MatrixConcept<matrix<T> > >();
1110            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1111            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1112            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1113            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1114        }
1115
1116        {
1117            typedef zero_matrix<T> container_model;
1118            function_requires< Mutable_MatrixConcept<matrix<T> > >();
1119            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1120            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1121        }
1122
1123        {
1124            typedef identity_matrix<T> container_model;
1125            function_requires< Mutable_MatrixConcept<matrix<T> > >();
1126            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1127            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1128        }
1129
1130        {
1131            typedef scalar_matrix<T> container_model;
1132            function_requires< Mutable_MatrixConcept<matrix<T> > >();
1133            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1134            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1135        }
1136
1137        {
1138            typedef c_matrix<T, 1, 1> container_model;
1139            function_requires< Mutable_MatrixConcept<matrix<T> > >();
1140            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1141            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1142            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1143            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1144        }
1145#endif
1146
1147        // Matrix Proxies
1148#if defined (INTERNAL_MATRIX) || defined (INTERNAL_MATRIX_PROXY)
1149        {
1150            typedef matrix_row<matrix<T> > container_model;
1151            function_requires< Mutable_VectorExpressionConcept<container_model> >();
1152            function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
1153            function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::iterator> >();
1154            function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
1155            function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::reverse_iterator> >();
1156        }
1157
1158        {
1159            typedef matrix_column<matrix<T> > container_model;
1160            function_requires< Mutable_VectorExpressionConcept<container_model> >();
1161            function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
1162            function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::iterator> >();
1163            function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
1164            function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::reverse_iterator> >();
1165        }
1166
1167        {
1168            typedef matrix_vector_range<matrix<T> > container_model;
1169            function_requires< Mutable_VectorExpressionConcept<container_model> >();
1170            function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
1171            function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::iterator> >();
1172            function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
1173            function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::reverse_iterator> >();
1174        }
1175
1176        {
1177            typedef matrix_vector_slice<matrix<T> > container_model;
1178            function_requires< Mutable_VectorExpressionConcept<container_model> >();
1179            function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
1180            function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::iterator> >();
1181            function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
1182            function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::reverse_iterator> >();
1183        }
1184
1185        {
1186            typedef matrix_vector_indirect<matrix<T> > container_model;
1187            function_requires< Mutable_VectorExpressionConcept<container_model> >();
1188            function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_iterator> >();
1189            function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::iterator> >();
1190            function_requires< IndexedRandomAccess1DIteratorConcept<container_model::const_reverse_iterator> >();
1191            function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<container_model::reverse_iterator> >();
1192        }
1193
1194        {
1195            typedef matrix_range<matrix<T> > container_model;
1196            function_requires< Mutable_MatrixExpressionConcept<container_model> >();
1197            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1198            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1199            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1200            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1201        }
1202
1203        {
1204            typedef matrix_slice<matrix<T> > container_model;
1205            function_requires< Mutable_MatrixExpressionConcept<container_model> >();
1206            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1207            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1208            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1209            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1210        }
1211
1212        {
1213            typedef matrix_indirect<matrix<T> > container_model;
1214            function_requires< Mutable_MatrixExpressionConcept<container_model> >();
1215            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1216            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1217            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1218            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1219        }
1220#endif
1221
1222        // Banded Matrix
1223#if defined (INTERNAL_SPECIAL) || defined (INTERNAL_BANDED)
1224        {
1225            typedef banded_matrix<T> container_model;
1226            function_requires< Mutable_MatrixConcept<container_model> >();
1227            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1228            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1229            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1230            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1231        }
1232
1233        {
1234            typedef banded_adaptor<matrix<T> > container_model;
1235            function_requires< Mutable_MatrixExpressionConcept<container_model> >();
1236            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1237            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1238            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1239            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1240        }
1241#endif
1242
1243        // Triangular Matrix
1244#if defined (INTERNAL_SPECIAL) || defined (INTERNAL_TRIANGULAR)
1245        {
1246            typedef triangular_matrix<T> container_model;
1247            function_requires< Mutable_MatrixConcept<container_model> >();
1248            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1249            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1250            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1251            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1252        }
1253
1254        {
1255            typedef triangular_adaptor<matrix<T> > container_model;
1256            function_requires< Mutable_MatrixExpressionConcept<container_model> >();
1257            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1258            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1259            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1260            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1261        }
1262#endif
1263
1264        // Symmetric Matrix
1265#if defined (INTERNA_SPECIAL) || defined (INTERNAL_SYMMETRIC)
1266        {
1267            typedef symmetric_matrix<T> container_model;
1268            function_requires< Mutable_MatrixConcept<container_model> >();
1269            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1270            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1271            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1272            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1273        }
1274
1275        {
1276            typedef banded_adaptor<matrix<T> > container_model;
1277#ifndef SKIP_BAD
1278           // const_iterator (iterator) constructor is bad
1279            function_requires< Mutable_MatrixExpressionConcept<container_model> >();
1280#endif
1281            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1282            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1283            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1284            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1285        }
1286#endif
1287
1288        // Hermitian Matrix
1289#if defined (INTERNAL_SPECIAL) || defined (INTERNAL_HERMITIAN)
1290        {
1291            typedef hermitian_matrix<T> container_model;
1292            function_requires< Mutable_MatrixConcept<container_model> >();
1293            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1294            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1295            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1296            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1297        }
1298       
1299        {
1300            typedef hermitian_adaptor<matrix<T> > container_model;
1301#ifndef SKIP_BAD
1302           // const_iterator (iterator) constructor is bad
1303            function_requires< Mutable_MatrixExpressionConcept<container_model> >();
1304#endif
1305            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1306            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1307            function_requires< IndexedRandomAccess2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1308            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1309        }
1310#endif
1311
1312        // Sparse Matrix
1313#if defined (INTERNAL_SPARSE) || defined (INTERNAL_MATRIX_SPARSE)
1314        {
1315            typedef mapped_matrix<T> container_model;
1316            function_requires< Mutable_SparseMatrixConcept<container_model> >();
1317            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1318            function_requires< Mutable_IndexedBidirectional2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1319            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1320            function_requires< Mutable_IndexedBidirectional2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1321        }
1322        {
1323            typedef mapped_vector_of_mapped_vector<T> container_model;
1324            function_requires< Mutable_SparseMatrixConcept<container_model> >();
1325            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1326            function_requires< Mutable_IndexedBidirectional2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1327            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1328            function_requires< Mutable_IndexedBidirectional2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1329        }
1330        {
1331            typedef compressed_matrix<T> container_model;
1332            function_requires< Mutable_SparseMatrixConcept<container_model> >();
1333            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1334            function_requires< Mutable_IndexedBidirectional2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1335            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1336            function_requires< Mutable_IndexedBidirectional2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1337        }
1338        {
1339            typedef coordinate_matrix<T> container_model;
1340            function_requires< Mutable_SparseMatrixConcept<container_model> >();
1341            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1342            function_requires< Mutable_IndexedBidirectional2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1343            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1344            function_requires< Mutable_IndexedBidirectional2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1345        }
1346        {
1347            typedef generalized_vector_of_vector<T, row_major, vector< coordinate_vector<T> > > container_model;
1348            function_requires< Mutable_SparseMatrixConcept<container_model> >();
1349            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_iterator1, container_model::const_iterator2> >();
1350            function_requires< Mutable_IndexedBidirectional2DIteratorConcept<container_model::iterator1, container_model::iterator2> >();
1351            function_requires< IndexedBidirectional2DIteratorConcept<container_model::const_reverse_iterator1, container_model::const_reverse_iterator2> >();
1352            function_requires< Mutable_IndexedBidirectional2DIteratorConcept<container_model::reverse_iterator1, container_model::reverse_iterator2> >();
1353        }
1354
1355#endif
1356
1357        // Scalar Expressions
1358#if defined (INTERNAL_EXPRESSION) || defined (INTERNAL_VECTOR_EXPRESSION)
1359        function_requires< ScalarExpressionConcept<scalar_value<T> > >();
1360        function_requires< ScalarExpressionConcept<scalar_reference<T> > >();
1361
1362        // Vector Expressions
1363        {
1364            typedef vector_reference<vector<T> > expression_model;
1365            function_requires< VectorExpressionConcept<expression_model> >();
1366            function_requires< Mutable_VectorExpressionConcept<expression_model> >();
1367            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_iterator> >();
1368            function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<expression_model::iterator> >();
1369            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_reverse_iterator> >();
1370            function_requires< Mutable_IndexedRandomAccess1DIteratorConcept<expression_model::reverse_iterator> >();
1371        }
1372
1373        {
1374            typedef vector_unary<vector<T>, scalar_identity<T> > expression_model;
1375            function_requires< VectorExpressionConcept<expression_model> >();
1376            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_iterator> >();
1377            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_reverse_iterator> >();
1378        }
1379
1380        {
1381            typedef vector_binary<vector<T>, vector<T>, scalar_plus<T, T> > expression_model;
1382            function_requires< VectorExpressionConcept<expression_model> >();
1383            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_iterator> >();
1384            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_reverse_iterator> >();
1385        }
1386
1387        {
1388            typedef vector_binary_scalar1<T, vector<T>, scalar_multiplies<T, T> > expression_model;
1389            function_requires< VectorExpressionConcept<expression_model> >();
1390            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_iterator> >();
1391            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_reverse_iterator> >();
1392        }
1393
1394        {
1395            typedef vector_binary_scalar2<vector<T>, scalar_value<T>, scalar_multiplies<T, T> > expression_model;
1396            function_requires< VectorExpressionConcept<expression_model> >();
1397            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_iterator> >();
1398            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_reverse_iterator> >();
1399        }
1400
1401        {
1402            typedef vector_binary_scalar1<scalar_value<T>, vector<T>, scalar_multiplies<T, T> > expression_model;
1403            function_requires< VectorExpressionConcept<expression_model> >();
1404            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_iterator> >();
1405            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_reverse_iterator> >();
1406        }
1407
1408        {
1409            typedef vector_binary_scalar2<vector<T>, scalar_value<T>, scalar_multiplies<T, T> > expression_model;
1410            function_requires< VectorExpressionConcept<expression_model> >();
1411            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_iterator> >();
1412            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_reverse_iterator> >();
1413        }
1414
1415        function_requires< ScalarExpressionConcept<vector_scalar_unary<vector<T>, vector_sum<vector<T> > > > >();
1416        function_requires< ScalarExpressionConcept<vector_scalar_unary<vector<T>, vector_norm_1<vector<T> > > > >();
1417        function_requires< ScalarExpressionConcept<vector_scalar_unary<vector<T>, vector_norm_2<vector<T> > > > >();
1418        function_requires< ScalarExpressionConcept<vector_scalar_unary<vector<T>, vector_norm_inf<vector<T> > > > >();
1419
1420        function_requires< ScalarExpressionConcept<vector_scalar_binary<vector<T>, vector<T>, vector_inner_prod<vector<T>, vector<T>, T> > > >();
1421#endif
1422
1423        // Matrix Expressions
1424#if defined (INTERNAL_EXPRESSION) || defined (INTERNAL_MATRIX_EXPRESSION)
1425        {
1426            typedef matrix_reference<matrix<T> > expression_model;
1427            function_requires< MatrixExpressionConcept<expression_model> >();
1428            function_requires< Mutable_MatrixExpressionConcept<expression_model> >();
1429            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_iterator1, expression_model::const_iterator2> >();
1430            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<expression_model::iterator1, expression_model::iterator2> >();
1431            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_reverse_iterator1, expression_model::const_reverse_iterator2> >();
1432            function_requires< Mutable_IndexedRandomAccess2DIteratorConcept<expression_model::reverse_iterator1, expression_model::reverse_iterator2> >();
1433        }
1434
1435        {
1436            typedef vector_matrix_binary<vector<T>, vector<T>, scalar_multiplies<T, T> > expression_model;
1437            function_requires< MatrixExpressionConcept<expression_model> >();
1438            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_iterator1, expression_model::const_iterator2> >();
1439            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_reverse_iterator1, expression_model::const_reverse_iterator2> >();
1440        }
1441
1442        {
1443            typedef matrix_unary1<matrix<T>, scalar_identity<T> > expression_model;
1444            function_requires< MatrixExpressionConcept<expression_model> >();
1445            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_iterator1, expression_model::const_iterator2> >();
1446            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_reverse_iterator1, expression_model::const_reverse_iterator2> >();
1447        }
1448
1449        {
1450            typedef matrix_unary2<matrix<T>, scalar_identity<T> > expression_model;
1451            function_requires< MatrixExpressionConcept<expression_model> >();
1452            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_iterator1, expression_model::const_iterator2> >();
1453            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_reverse_iterator1, expression_model::const_reverse_iterator2> >();
1454        }
1455
1456        {
1457            typedef matrix_binary<matrix<T>, matrix<T>, scalar_plus<T, T> > expression_model;
1458            function_requires< MatrixExpressionConcept<expression_model> >();
1459            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_iterator1, expression_model::const_iterator2> >();
1460            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_reverse_iterator1, expression_model::const_reverse_iterator2> >();
1461        }
1462
1463        {
1464            typedef matrix_binary_scalar1<T, matrix<T>, scalar_multiplies<T, T> > expression_model;
1465            function_requires< MatrixExpressionConcept<expression_model> >();
1466            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_iterator1, expression_model::const_iterator2> >();
1467            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_reverse_iterator1, expression_model::const_reverse_iterator2> >();
1468        }
1469
1470        {
1471            typedef matrix_binary_scalar2<matrix<T>, T, scalar_multiplies<T, T> > expression_model;
1472            function_requires< MatrixExpressionConcept<expression_model> >();
1473            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_iterator1, expression_model::const_iterator2> >();
1474            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_reverse_iterator1, expression_model::const_reverse_iterator2> >();
1475        }
1476
1477        {
1478            typedef matrix_binary_scalar1<scalar_value<T>, matrix<T>, scalar_multiplies<T, T> > expression_model;
1479            function_requires< MatrixExpressionConcept<expression_model> >();
1480            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_iterator1, expression_model::const_iterator2> >();
1481            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_reverse_iterator1, expression_model::const_reverse_iterator2> >();
1482        }
1483
1484        {
1485            typedef matrix_binary_scalar2<matrix<T>, scalar_value<T>, scalar_multiplies<T, T> > expression_model;
1486            function_requires< MatrixExpressionConcept<expression_model> >();
1487            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_iterator1, expression_model::const_iterator2> >();
1488            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_reverse_iterator1, expression_model::const_reverse_iterator2> >();
1489        }
1490
1491        {
1492            typedef matrix_vector_binary1<matrix<T>, vector<T>, matrix_vector_prod1<matrix<T>, vector<T>, T> > expression_model;
1493            function_requires< VectorExpressionConcept<expression_model> >();
1494            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_iterator> >();
1495            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_reverse_iterator> >();
1496        }
1497
1498        {
1499            typedef matrix_vector_binary2<vector<T>, matrix<T>, matrix_vector_prod2<matrix<T>, vector<T>, T > > expression_model;
1500            function_requires< VectorExpressionConcept<expression_model> >();
1501            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_iterator> >();
1502            function_requires< IndexedRandomAccess1DIteratorConcept<expression_model::const_reverse_iterator> >();
1503        }
1504
1505        {
1506            typedef matrix_matrix_binary<matrix<T>, matrix<T>, matrix_matrix_prod<matrix<T>, matrix<T>, T > > expression_model;
1507            function_requires< MatrixExpressionConcept<expression_model> >();
1508            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_iterator1, expression_model::const_iterator2> >();
1509            function_requires< IndexedRandomAccess2DIteratorConcept<expression_model::const_reverse_iterator1, expression_model::const_reverse_iterator2> >();
1510        }
1511
1512        function_requires< ScalarExpressionConcept<matrix_scalar_unary<matrix<T>, matrix_norm_1<vector<T> > > > >();
1513        function_requires< ScalarExpressionConcept<matrix_scalar_unary<matrix<T>, matrix_norm_frobenius<vector<T> > > > >();
1514        function_requires< ScalarExpressionConcept<matrix_scalar_unary<matrix<T>, matrix_norm_inf<vector<T> > > > >();
1515#endif
1516
1517#ifdef EXTERNAL
1518        function_requires< AdditiveAbelianGroupConcept<float> >();
1519        function_requires< CommutativeRingWithIdentityConcept<float> >();
1520        function_requires< FieldConcept<float> >();
1521        function_requires< VectorSpaceConcept<float, vector<float> > >();
1522        function_requires< Prod_RingWithIdentityConcept<matrix<float> > >();
1523        function_requires< VectorSpaceConcept<float, matrix<float> > >();
1524        function_requires< LinearOperatorConcept<float, vector<float>, matrix<float> > >();
1525
1526        function_requires< AdditiveAbelianGroupConcept<std::complex<float> > >();
1527        function_requires< CommutativeRingWithIdentityConcept<std::complex<float> > >();
1528        function_requires< FieldConcept<std::complex<float> > >();
1529        function_requires< VectorSpaceConcept<std::complex<float>, vector<std::complex<float> > > >();
1530        function_requires< Prod_RingWithIdentityConcept<matrix<std::complex<float> > > >();
1531        function_requires< VectorSpaceConcept<std::complex<float>, matrix<std::complex<float> > > >();
1532        function_requires< LinearOperatorConcept<std::complex<float>, vector<std::complex<float> >, matrix<std::complex<float> > > >();
1533#endif
1534    }
1535
1536    } // end of anonymous namespace
1537
1538}}}
1539
1540#endif
Note: See TracBrowser for help on using the repository browser.