source: XMLIO_V2/external/include/blitz/tvcross.h @ 80

Last change on this file since 80 was 80, checked in by ymipsl, 14 years ago

ajout lib externe

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1/***************************************************************************
2 * blitz/tvcross.h      Cross product of TinyVector<N,3>'s
3 *
4 * $Id: tvcross.h,v 1.4 2003/12/11 03:44:22 julianc Exp $
5 *
6 * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * Suggestions:          blitz-dev@oonumerics.org
19 * Bugs:                 blitz-bugs@oonumerics.org
20 *
21 * For more information, please see the Blitz++ Home Page:
22 *    http://oonumerics.org/blitz/
23 *
24 ***************************************************************************/
25
26#ifndef BZ_TVCROSS_H
27#define BZ_TVCROSS_H
28
29#ifndef BZ_TINYVEC_H
30 #error <blitz/tvcross.h> must be included via <blitz/tinyvec.h>
31#endif
32
33BZ_NAMESPACE(blitz)
34
35/*
36 * cross product.
37 *
38 * NEEDS_WORK: - cross product of two different vector types
39 *             - cross product involving expressions
40 */
41
42template<typename T_numtype>
43TinyVector<T_numtype,3> cross(const TinyVector<T_numtype,3>& x, 
44    const TinyVector<T_numtype,3>& y)
45{
46    return TinyVector<T_numtype,3>(x[1]*y[2] - y[1]*x[2],
47        y[0]*x[2] - x[0]*y[2], x[0]*y[1] - y[0]*x[1]);
48}
49
50
51BZ_NAMESPACE_END
52
53#endif // BZ_TVCROSS_H
Note: See TracBrowser for help on using the repository browser.