[221] | 1 | /*
|
---|
| 2 | * $Id: vecall.cc,v 1.1.1.1 1999-04-09 17:59:01 ansari Exp $
|
---|
| 3 | *
|
---|
| 4 | * Copyright (C) 1997 Todd Veldhuizen <tveldhui@seurat.uwaterloo.ca>
|
---|
| 5 | * All rights reserved. Please see <blitz/blitz.h> for terms and
|
---|
| 6 | * conditions of use.
|
---|
| 7 | *
|
---|
| 8 | * $Log: not supported by cvs2svn $
|
---|
| 9 | * Revision 1.2 1998/03/14 00:04:47 tveldhui
|
---|
| 10 | * 0.2-alpha-05
|
---|
| 11 | *
|
---|
| 12 | * Revision 1.1 1997/07/16 14:51:20 tveldhui
|
---|
| 13 | * Update: Alpha release 0.2 (Arrays)
|
---|
| 14 | *
|
---|
| 15 | * Revision 1.2 1997/01/24 14:42:00 tveldhui
|
---|
| 16 | * Periodic RCS update
|
---|
| 17 | *
|
---|
| 18 | */
|
---|
| 19 |
|
---|
| 20 | #ifndef BZ_VECALL_CC
|
---|
| 21 | #define BZ_VECALL_CC
|
---|
| 22 |
|
---|
| 23 | #ifndef BZ_VECGLOBS_H
|
---|
| 24 | #error <blitz/vecall.cc> must be included via <blitz/vecglobs.h>
|
---|
| 25 | #endif
|
---|
| 26 |
|
---|
| 27 | BZ_NAMESPACE(blitz)
|
---|
| 28 |
|
---|
| 29 | template<class P_expr>
|
---|
| 30 | inline _bz_bool _bz_vec_all(P_expr vector)
|
---|
| 31 | {
|
---|
| 32 | int length = vector._bz_suggestLength();
|
---|
| 33 |
|
---|
| 34 | if (vector._bz_hasFastAccess())
|
---|
| 35 | {
|
---|
| 36 | for (int i=0; i < length; ++i)
|
---|
| 37 | if (!vector._bz_fastAccess(i))
|
---|
| 38 | return _bz_false;
|
---|
| 39 | }
|
---|
| 40 | else {
|
---|
| 41 | for (int i=0; i < length; ++i)
|
---|
| 42 | if (!vector[i])
|
---|
| 43 | return _bz_false;
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | return _bz_true;
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | template<class P_numtype>
|
---|
| 50 | inline _bz_bool all(const Vector<P_numtype>& x)
|
---|
| 51 | {
|
---|
| 52 | return _bz_vec_all(x._bz_asVecExpr());
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | template<class P_expr>
|
---|
| 56 | inline _bz_bool all(_bz_VecExpr<P_expr> expr)
|
---|
| 57 | {
|
---|
| 58 | return _bz_vec_all(expr);
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | template<class P_numtype>
|
---|
| 62 | inline _bz_bool all(const VectorPick<P_numtype>& x)
|
---|
| 63 | {
|
---|
| 64 | return _bz_vec_all(x._bz_asVecExpr());
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | template<class P_numtype, int N_dimensions>
|
---|
| 68 | inline _bz_bool all(const TinyVector<P_numtype, N_dimensions>& x)
|
---|
| 69 | {
|
---|
| 70 | return _bz_vec_all(x._bz_asVecExpr());
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | BZ_NAMESPACE_END
|
---|
| 74 |
|
---|
| 75 | #endif // BZ_VECALL_CC
|
---|
| 76 |
|
---|