source: Sophya/trunk/SophyaExt/Blitz/blitz/vecany.cc@ 3452

Last change on this file since 3452 was 221, checked in by ansari, 26 years ago

Creation module DPC/Blitz (blitz 0.4) Reza 09/04/99

File size: 1.6 KB
Line 
1/*
2 * $Id: vecany.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_VECANY_CC
21#define BZ_VECANY_CC
22
23#ifndef BZ_VECGLOBS_H
24 #error <blitz/vecany.cc> must be included via <blitz/vecglobs.h>
25#endif
26
27BZ_NAMESPACE(blitz)
28
29template<class P_expr>
30inline _bz_bool _bz_vec_any(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_true;
39 }
40 else {
41 for (int i=0; i < length; ++i)
42 if (vector[i])
43 return _bz_true;
44 }
45
46 return _bz_false;
47}
48
49template<class P_numtype>
50inline _bz_bool any(const Vector<P_numtype>& x)
51{
52 return _bz_vec_any(x._bz_asVecExpr());
53}
54
55template<class P_expr>
56inline _bz_bool any(_bz_VecExpr<P_expr> expr)
57{
58 return _bz_vec_any(expr);
59}
60
61template<class P_numtype>
62inline _bz_bool any(const VectorPick<P_numtype>& x)
63{
64 return _bz_vec_any(x._bz_asVecExpr());
65}
66
67template<class P_numtype, int N_dimensions>
68inline _bz_bool any(const TinyVector<P_numtype, N_dimensions>& x)
69{
70 return _bz_vec_any(x._bz_asVecExpr());
71}
72
73BZ_NAMESPACE_END
74
75#endif // BZ_VECANY_CC
76
Note: See TracBrowser for help on using the repository browser.