File: vector2.h

package info (click to toggle)
blitz%2B%2B 1%3A0.10-3.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,276 kB
  • ctags: 12,037
  • sloc: cpp: 70,465; sh: 11,116; fortran: 1,510; python: 1,246; f90: 852; makefile: 701
file content (109 lines) | stat: -rw-r--r-- 3,716 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// -*- C++ -*-
/***************************************************************************
 * blitz/vector.h      Declaration of the Vector<P_numtype> class
 *
 * $Id$
 *
 * Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
 *
 * This file is a part of Blitz.
 *
 * Blitz is free software: you can redistribute it and/or modify 
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 *
 * Blitz is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public 
 * License along with Blitz.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Suggestions:          blitz-devel@lists.sourceforge.net
 * Bugs:                 blitz-support@lists.sourceforge.net    
 *
 * For more information, please see the Blitz++ Home Page:
 *    https://sourceforge.net/projects/blitz/
 *
 ****************************************************************************/

/*
 * KNOWN BUGS
 *
 * 1. operator[](Vector<int>) won't match; compiler complains of no
 *       suitable copy constructor for VectorPick<T>
 * 2. Vector<T>(_bz_VecExpr<E>) constructor generates warning
 * 3. operator+=,-=,..etc.(Random<D>) won't match; compiler complains of
 *       no suitable copy constructor for _bz_VecExpr(...).
 */

#ifndef BZ_VECTOR_H
#define BZ_VECTOR_H

#include <blitz/blitz.h>
#include <blitz/array.h>

BZ_NAMESPACE(blitz)

// Forward declarations
// template<typename P_numtype> class VectorIter;
// template<typename P_numtype> class VectorIterConst;
// template<typename P_expr>    class _bz_VecExpr;       
// template<typename P_numtype> class VectorPick;
// template<typename P_numtype> class Random;

// Declaration of class Vector<P_numtype>, which just is a rank-1 array.

template<typename P_numtype>
class Vector : public Array<P_numtype,1>
{
 public:
    typedef Array<P_numtype,1> T_base;
    typedef typename T_base::T_numtype T_numtype;
    typedef typename T_base::T_index T_index;
    typedef typename T_base::T_array T_array;
    typedef typename T_base::T_iterator T_iterator;
    typedef typename T_base::iterator iterator;
    typedef typename T_base::const_iterator const_iterator;

    using T_base::rank_;

    template<typename T_expr>
      explicit Vector(_bz_ArrayExpr<T_expr> expr) :
      T_base(expr) {};

    // forward constructors

    explicit Vector(int length0, 
		    GeneralArrayStorage<rank_> storage = GeneralArrayStorage<rank_>()) :
      T_base(length0, storage) {};

  Vector(GeneralArrayStorage<rank_> storage = GeneralArrayStorage<rank_>()) :
      T_base(storage) {};

    Vector(T_numtype* restrict dataFirst, TinyVector<int, rank_> shape,
	   GeneralArrayStorage<rank_> storage = GeneralArrayStorage<rank_>()) :
      T_base(dataFirst, shape, storage) {};

    Vector(Range r0, 
	   GeneralArrayStorage<rank_> storage = GeneralArrayStorage<rank_>()) :
      T_base(r0, storage) {};
  
    Vector(const Array<T_numtype, rank_>& array) : T_base(array) {};

    template<int N_rank2, typename R0, typename R1, typename R2, typename R3, typename R4,
	     typename R5, typename R6, typename R7, typename R8, typename R9, typename R10>
      Vector(Array<T_numtype,N_rank2>& array, R0 r0, R1 r1, R2 r2,
	     R3 r3, R4 r4, R5 r5, R6 r6, R7 r7, R8 r8, R9 r9, R10 r10) :
      T_base(array, r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10) {};

  using T_base::operator=;

};


BZ_NAMESPACE_END

#endif // BZ_VECTOR_H