Index: arrays.xml
===================================================================
RCS file: /home/pooma/Repository/r2/docs/manual/arrays.xml,v
retrieving revision 1.6
diff -c -p -r1.6 arrays.xml
*** arrays.xml 2002/01/30 23:09:06 1.6
--- arrays.xml 2002/01/30 23:47:30
***************
*** 79,85 ****
objects so they can be used
more easily than built-in &cc; arrays. For example, &array;s can
be used as operands and in assignment statements. The statement
! a = a + b; adds corresponding values of
&array;s a and b, assigning
the sums to the &array; a. The statement
treats each array as an object, rather than requiring the use of
--- 79,85 ----
objects so they can be used
more easily than built-in &cc; arrays. For example, &array;s can
be used as operands and in assignment statements. The statement
! a = a + b; adds corresponding values of
&array;s a and b, assigning
the sums to the &array; a. The statement
treats each array as an object, rather than requiring the use of
***************
*** 87,94 ****
statements such as this are further discussed in . &array;s also handle their own
memory allocation and deallocation. For example, the &array;
! declaration Array<2, double, Brick>
! a(vertDomain) creates an
&array; a, allocating whatever memory it
needs. When a goes out of scope, it and its
memory are automatically deallocated. Automatic memory allocation
--- 87,94 ----
statements such as this are further discussed in . &array;s also handle their own
memory allocation and deallocation. For example, the &array;
! declaration Array<2, double, Brick>
! a(vertDomain) creates an
&array; a, allocating whatever memory it
needs. When a goes out of scope, it and its
memory are automatically deallocated. Automatic memory allocation
***************
*** 96,102 ****
Individual &array; values can be accessed using parentheses,
not square brackets, as for &cc; arrays. For example,
! a(3,4) yields the value at position (3,4)
of a's two-dimensional domain.
--- 96,102 ----
Individual &array; values can be accessed using parentheses,
not square brackets, as for &cc; arrays. For example,
! a(3,4) yields the value at position (3,4)
of a's two-dimensional domain.
***************
*** 179,188 ****
All the &domain; categories listed above except &grid; can
be represented using domain triplet notation. Since the triplet
[7:7:1] represents {7}, or more simply 7, it can also
! represent the one-dimensional Loc<1>(7).
Multidimensional &loc;s are similarly represented. For example,
[0:0:1,10:10:1,2:2:1] represents
! Loc<3>(0,10,2), but it is frequently
abbreviated as [0,10,2]. An &interval; [a,b] has unit stride:
[a:b:1], while a ⦥ has specific stride s, e.g.,
[a:b:s].
--- 179,188 ----
All the &domain; categories listed above except &grid; can
be represented using domain triplet notation. Since the triplet
[7:7:1] represents {7}, or more simply 7, it can also
! represent the one-dimensional Loc<1>(7).
Multidimensional &loc;s are similarly represented. For example,
[0:0:1,10:10:1,2:2:1] represents
! Loc<3>(0,10,2), but it is frequently
abbreviated as [0,10,2]. An &interval; [a,b] has unit stride:
[a:b:1], while a ⦥ has specific stride s, e.g.,
[a:b:s].
***************
*** 192,199 ****
&interval; is the direct product of two one-dimensional
&interval;s, it can be specified using two one-dimensional
&interval;s. For example,
! Interval<2>(Interval<1>(2,3),
! Interval<1>(4,5)) creates a [2:3:1,4:5:1]
&domain;. The resulting dimensionality equals the sum of the
components' dimensions. For example, a four-dimension &loc; can
be specified using three- and one-dimension &loc;s or using four
--- 192,199 ----
&interval; is the direct product of two one-dimensional
&interval;s, it can be specified using two one-dimensional
&interval;s. For example,
! Interval<2>(Interval<1>(2,3),
! Interval<1>(4,5)) creates a [2:3:1,4:5:1]
&domain;. The resulting dimensionality equals the sum of the
components' dimensions. For example, a four-dimension &loc; can
be specified using three- and one-dimension &loc;s or using four
***************
*** 206,217 ****
different types. A &loc; object can be constructed from other
&loc; objects and integers. &interval;s, ⦥s, and &grid;s
can be constructed using any of these types, &loc;s, and integers.
! For example, Interval<3> a(Loc<2>(1,2),
! Interval<1>(3,5)) uses a two-dimensional &loc;
and a one-dimensional &interval; to create a [1:1:1,2:2:1,3:5:1]
&domain;. During creation of a &domain;, the type of each object
is changed to the &domain;'s type. In the example,
! Loc<2>(1,2) is first converted to an
&interval;.
&domain;s can participate in some arithmetic and comparison
--- 206,217 ----
different types. A &loc; object can be constructed from other
&loc; objects and integers. &interval;s, ⦥s, and &grid;s
can be constructed using any of these types, &loc;s, and integers.
! For example, Interval<3> a(Loc<2>(1,2),
! Interval<1>(3,5)) uses a two-dimensional &loc;
and a one-dimensional &interval; to create a [1:1:1,2:2:1,3:5:1]
&domain;. During creation of a &domain;, the type of each object
is changed to the &domain;'s type. In the example,
! Loc<2>(1,2) is first converted to an
&interval;.&domain;s can participate in some arithmetic and comparison
***************
*** 293,317 ****
! Loc<1>()indicates zero.
! Loc<1>(const Pooma::NoInit& no)creates an uninitialized &locone;, to be assigned a value later.
! Loc<1>(const &domaintemplate;1& t1)creates a &locone; with the integer converted from t1.
! Loc<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates a &locone; with the integer converted from
t1. t2 must equal
t1.
! Loc<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates a &locone; with the integer converted from
t1. t2 must equal
t1, and t3 is
--- 293,317 ----
! Loc<1>()indicates zero.
! Loc<1>(const Pooma::NoInit& no)creates an uninitialized &locone;, to be assigned a value later.
! Loc<1>(const &domaintemplate;1& t1)creates a &locone; with the integer converted from t1.
! Loc<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates a &locone; with the integer converted from
t1. t2 must equal
t1.
! Loc<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates a &locone; with the integer converted from
t1. t2 must equal
t1, and t3 is
***************
*** 360,405 ****
! Loc<&dim;>()indicates zero.
! Loc<&dim;>(const Pooma::NoInit& no)creates an uninitialized &loc;, to be assigned a value later.
! Loc<&dim;>(const &domaintemplate;1& t1)creates a &loc; using the given &domain; object.
! Loc<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates a &loc; using the given &domain; objects.
! Loc<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates a &loc; using the given &domain; objects.
! Loc<&dim;>(const &domaintemplate;1& t1, const
! &domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4)creates a &loc; using the given &domain; objects.
! Loc<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5)creates a &loc; using the given &domain; objects.
! Loc<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6)creates a &loc; using the given &domain; objects.
! Loc<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6, const &domaintemplate;7& t7)creates a &loc; using the given &domain; objects.
--- 360,405 ----
! Loc<&dim;>()indicates zero.
! Loc<&dim;>(const Pooma::NoInit& no)creates an uninitialized &loc;, to be assigned a value later.
! Loc<&dim;>(const &domaintemplate;1& t1)creates a &loc; using the given &domain; object.
! Loc<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates a &loc; using the given &domain; objects.
! Loc<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates a &loc; using the given &domain; objects.
! Loc<&dim;>(const &domaintemplate;1& t1, const
! &domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4)creates a &loc; using the given &domain; objects.
! Loc<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5)creates a &loc; using the given &domain; objects.
! Loc<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6)creates a &loc; using the given &domain; objects.
! Loc<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6, const &domaintemplate;7& t7)creates a &loc; using the given &domain; objects.
***************
*** 418,425 ****
to a multidimensional &domain; object that itself can be converted
into a &loc;. The total dimensionality of all the arguments'
types should be at most &dim;. For example,
! Loc<5>(Range<1>(2,2,2), Loc<2>(2,3),
! Interval<1>(4,4)) creates a five-dimensional &loc;
[2,2,3,4,1] using a one-dimensional ⦥, a two-dimensional
&loc;, and a one-dimensional &interval;. The final fifth
dimension has an unspecified value, in this case 1. The
--- 418,425 ----
to a multidimensional &domain; object that itself can be converted
into a &loc;. The total dimensionality of all the arguments'
types should be at most &dim;. For example,
! Loc<5>(Range<1>(2,2,2), Loc<2>(2,3),
! Interval<1>(4,4)) creates a five-dimensional &loc;
[2,2,3,4,1] using a one-dimensional ⦥, a two-dimensional
&loc;, and a one-dimensional &interval;. The final fifth
dimension has an unspecified value, in this case 1. The
***************
*** 466,489 ****
! Interval<1>()creates an empty, uninitialized interval.
! Interval<1>(const Pooma::NoInit& no)creates an uninitialized &intervalone;, to be assigned a value later.
! Interval<1>(const &domaintemplate;1& t1)creates an &intervalone;. See the text for an explanation.
! Interval<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates an &intervalone; with the integers converted from
t1 and t2.
! Interval<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates an &intervalone; with the integers converted from
t1 and t2.
t3 must equal 1.
--- 466,489 ----
! Interval<1>()creates an empty, uninitialized interval.
! Interval<1>(const Pooma::NoInit& no)creates an uninitialized &intervalone;, to be assigned a value later.
! Interval<1>(const &domaintemplate;1& t1)creates an &intervalone;. See the text for an explanation.
! Interval<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates an &intervalone; with the integers converted from
t1 and t2.
! Interval<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates an &intervalone; with the integers converted from
t1 and t2.
t3 must equal 1.
***************
*** 532,577 ****
! Interval<&dim;>()creates an empty, uninitialized &interval;, to be assigned a value later.
! Interval<&dim;>(const Pooma::NoInit& no)creates an empty, uninitialized &interval;, to be assigned a value later.
! Interval<&dim;>(const &domaintemplate;1& t1)creates an &interval; using the given &domain; object.
! Interval<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates an &interval; using the given &domain; objects.
! Interval<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates an &interval; using the given &domain; objects.
! Interval<&dim;>(const &domaintemplate;1& t1, const
! &domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4)creates an &interval; using the given &domain; objects.
! Interval<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5)creates an &interval; using the given &domain; objects.
! Interval<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6)creates an &interval; using the given &domain; objects.
! Interval<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6, const &domaintemplate;7& t7)creates an &interval; using the given &domain; objects.
--- 532,577 ----
! Interval<&dim;>()creates an empty, uninitialized &interval;, to be assigned a value later.
! Interval<&dim;>(const Pooma::NoInit& no)creates an empty, uninitialized &interval;, to be assigned a value later.
! Interval<&dim;>(const &domaintemplate;1& t1)creates an &interval; using the given &domain; object.
! Interval<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates an &interval; using the given &domain; objects.
! Interval<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates an &interval; using the given &domain; objects.
! Interval<&dim;>(const &domaintemplate;1& t1, const
! &domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4)creates an &interval; using the given &domain; objects.
! Interval<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5)creates an &interval; using the given &domain; objects.
! Interval<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6)creates an &interval; using the given &domain; objects.
! Interval<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6, const &domaintemplate;7& t7)creates an &interval; using the given &domain; objects.
***************
*** 637,661 ****
! Range<1>()creates an empty, uninitialized range.
! Range<1>(const Pooma::NoInit& no)creates an uninitialized &rangeone;, to be assigned a value later.
! Range<1>(const &domaintemplate;1& t1)creates a &rangeone;. See the text for an explanation.
! Range<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates a &rangeone; with an interval specified by the
integers converted from t1 and
t2.
! Range<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates a &rangeone; by converting the arguments to
integers i1, i2, and
i3 and then making a range [i1:i2:i3].
--- 637,661 ----
! Range<1>()creates an empty, uninitialized range.
! Range<1>(const Pooma::NoInit& no)creates an uninitialized &rangeone;, to be assigned a value later.
! Range<1>(const &domaintemplate;1& t1)creates a &rangeone;. See the text for an explanation.
! Range<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates a &rangeone; with an interval specified by the
integers converted from t1 and
t2.
! Range<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates a &rangeone; by converting the arguments to
integers i1, i2, and
i3 and then making a range [i1:i2:i3].
***************
*** 702,747 ****
! Range<&dim;>()creates an empty, uninitialized ⦥, to be assigned a value later.
! Range<&dim;>(const Pooma::NoInit& no)creates an empty, uninitialized ⦥, to be assigned a value later.
! Range<&dim;>(const &domaintemplate;1& t1)creates a ⦥ using the given &domain; object.
! Range<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates a ⦥ using the given &domain; objects.
! Range<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates a ⦥ using the given &domain; objects.
! Range<&dim;>(const &domaintemplate;1& t1, const
! &domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4)creates a ⦥ using the given &domain; objects.
! Range<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5)creates a ⦥ using the given &domain; objects.
! Range<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6)creates a ⦥ using the given &domain; objects.
! Range<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6, const &domaintemplate;7& t7)creates a ⦥ using the given &domain; objects.
--- 702,747 ----
! Range<&dim;>()creates an empty, uninitialized ⦥, to be assigned a value later.
! Range<&dim;>(const Pooma::NoInit& no)creates an empty, uninitialized ⦥, to be assigned a value later.
! Range<&dim;>(const &domaintemplate;1& t1)creates a ⦥ using the given &domain; object.
! Range<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates a ⦥ using the given &domain; objects.
! Range<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates a ⦥ using the given &domain; objects.
! Range<&dim;>(const &domaintemplate;1& t1, const
! &domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4)creates a ⦥ using the given &domain; objects.
! Range<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5)creates a ⦥ using the given &domain; objects.
! Range<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6)creates a ⦥ using the given &domain; objects.
! Range<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6, const &domaintemplate;7& t7)creates a ⦥ using the given &domain; objects.
***************
*** 811,831 ****
! Grid<1>()creates an empty, uninitialized grid.
! Grid<1>(const &domaintemplate;1& t1)creates a &gridone;. See the text for an explanation.
! Grid<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates a &gridone; from the interval specified by the
integers converted from t1 and
t2.
! Grid<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates a &gridone; from the domain triplet specified
by the integers converted from t1,
t2, and t3.
--- 811,831 ----
! Grid<1>()creates an empty, uninitialized grid.
! Grid<1>(const &domaintemplate;1& t1)creates a &gridone;. See the text for an explanation.
! Grid<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates a &gridone; from the interval specified by the
integers converted from t1 and
t2.
! Grid<1>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates a &gridone; from the domain triplet specified
by the integers converted from t1,
t2, and t3.
*************** Grid<1> g(list);
*** 889,930 ****
! Grid<&dim;>()creates an empty, uninitialized &grid;, to be assigned a value later.
! Grid<&dim;>(const &domaintemplate;1& t1)creates a &grid; using the given &domain; object.
! Grid<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates a &grid; using the given &domain; objects.
! Grid<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates a &grid; using the given &domain; objects.
! Grid<&dim;>(const &domaintemplate;1& t1, const
! &domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4)creates a &grid; using the given &domain; objects.
! Grid<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5)creates a &grid; using the given &domain; objects.
! Grid<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6)creates a &grid; using the given &domain; objects.
! Grid<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6, const &domaintemplate;7& t7)creates a &grid; using the given &domain; objects.
--- 889,930 ----
! Grid<&dim;>()creates an empty, uninitialized &grid;, to be assigned a value later.
! Grid<&dim;>(const &domaintemplate;1& t1)creates a &grid; using the given &domain; object.
! Grid<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2)creates a &grid; using the given &domain; objects.
! Grid<&dim;>(const &domaintemplate;1& t1, const &domaintemplate;2& t2, const &domaintemplate;3& t3)creates a &grid; using the given &domain; objects.
! Grid<&dim;>(const &domaintemplate;1& t1, const
! &domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4)creates a &grid; using the given &domain; objects.
! Grid<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5)creates a &grid; using the given &domain; objects.
! Grid<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6)creates a &grid; using the given &domain; objects.
! Grid<&dim;>(const &domaintemplate;1& t1, const
&domaintemplate;2& t2, const &domaintemplate;3& t3, const &domaintemplate;4& t4, const &domaintemplate;5&
! t5, const &domaintemplate;6& t6, const &domaintemplate;7& t7)creates a &grid; using the given &domain; objects.
*************** Grid<1> g(list);
*** 995,1009 ****
Multidimensional &domain; Accessors
! long size()returns the total number of indices.
! bool empty()returns &true; if and only if the &domain; has no indices.
! D<1> operator[](int dimension)returns the one-dimensional &domain; for the specified
dimension. The return type is a one-dimensional version of
the &domain;.
--- 995,1009 ----
Multidimensional &domain; Accessors
! long size()returns the total number of indices.
! bool empty()returns &true; if and only if the &domain; has no indices.
! D<1> operator[](int dimension)returns the one-dimensional &domain; for the specified
dimension. The return type is a one-dimensional version of
the &domain;.
*************** Grid<1> g(list);
*** 1012,1043 ****
One-dimensional &domain; Accessors
! long length()returns the number of indices.
! int first()returns the beginning of the domain.
! int last()returns the ending of the domain.
! int min()returns the minimum index in the domain.
! int max()returns the maximum index in the domain.
! D<1>::iterator begin()returns a forward iterator pointing to the
beginning domain index.
! D<1>::iterator end()returns a forward iterator pointing to the ending
domain index.
--- 1012,1043 ----
One-dimensional &domain; Accessors
! long length()returns the number of indices.
! int first()returns the beginning of the domain.
! int last()returns the ending of the domain.
! int min()returns the minimum index in the domain.
! int max()returns the maximum index in the domain.
! D<1>::iterator begin()returns a forward iterator pointing to the
beginning domain index.
! D<1>::iterator end()returns a forward iterator pointing to the ending
domain index.
*************** Grid<1> g(list);
*** 1049,1087 ****
linkend="arrays-domains-use-table">. Functions applicable
to both one-dimensional and multidimensional &domain;s are listed
before functions that only applicable to one-dimensional
! &domain;s. The size member function
yields the total number of indices in a given &domain;. If and
! only if this number is zero, empty will
yield &true;. A multidimensional
domain<&dim;> is the direct product of &dim;
! one-dimensional &domain;s. The operator[](int
! dimension) operator extracts the one-dimensional
&domain; corresponding to its parameter. For example, the three
one-dimensional Range<1> &domain;s can be
extracted from a Range<3>
object r using
! r[0], r[1], and
! r[2].
&domain; accessors applicable only to one-dimensional
&domain;s are listed in the second half of . The
! length member function, analogous to the
! multidimensional size function, returns
the number of indices in the &domain;. The
! first and last
member functions return the domain's beginning and ending
! indices. The begin and
! end member functions return forward
iterators pointing to these respective locations. They have type
D<1>::iterator, where D
abbreviates the &domain;'s type, e.g., &interval; or &grid;.
The min and
! max member functions return the minimum
and maximum indices in the &domain; object, respectively. For
&locone; and &intervalone;, these yield the same values as
! first and last,
but &rangeone; and &gridone; can have their numerically largest
index at the beginning of their &domain;s.
--- 1049,1087 ----
linkend="arrays-domains-use-table">. Functions applicable
to both one-dimensional and multidimensional &domain;s are listed
before functions that only applicable to one-dimensional
! &domain;s. The size member function
yields the total number of indices in a given &domain;. If and
! only if this number is zero, empty will
yield &true;. A multidimensional
domain<&dim;> is the direct product of &dim;
! one-dimensional &domain;s. The operator[](int
! dimension) operator extracts the one-dimensional
&domain; corresponding to its parameter. For example, the three
one-dimensional Range<1> &domain;s can be
extracted from a Range<3>
object r using
! r[0], r[1], and
! r[2].
&domain; accessors applicable only to one-dimensional
&domain;s are listed in the second half of . The
! length member function, analogous to the
! multidimensional size function, returns
the number of indices in the &domain;. The
! first and last
member functions return the domain's beginning and ending
! indices. The begin and
! end member functions return forward
iterators pointing to these respective locations. They have type
D<1>::iterator, where D
abbreviates the &domain;'s type, e.g., &interval; or &grid;.
The min and
! max member functions return the minimum
and maximum indices in the &domain; object, respectively. For
&locone; and &intervalone;, these yield the same values as
! first and last,
but &rangeone; and &gridone; can have their numerically largest
index at the beginning of their &domain;s.
*************** Grid<1> g(list);
*** 1204,1210 ****
…, DT7. The first constructor, with no
domain arguments, creates an empty, uninitialized &array; for
which a domain must be specified before it is used. Specify the
! array's domain using its initialize
function. The next seven constructors combine their domain
arguments to compute the resulting &array;'s domain. These are
combined in the same way that multidimensional &interval;s are
--- 1204,1210 ----
…, DT7. The first constructor, with no
domain arguments, creates an empty, uninitialized &array; for
which a domain must be specified before it is used. Specify the
! array's domain using its initialize
function. The next seven constructors combine their domain
arguments to compute the resulting &array;'s domain. These are
combined in the same way that multidimensional &interval;s are
*************** Grid<1> g(list);
*** 1259,1358 ****
! Array<&dim;,T,E>()creates an empty, uninitialized &array; which must be
! initialize()d before use.
! Array<&dim;,T,E>(const DT1& t1)creates an &array; using the given &domain; object or integer.
! Array<&dim;,T,E>(const DT1& t1, const DT2& t2)creates an &array; using the given &domain; objects and integers.
! Array<&dim;,T,E>(const DT1& t1, const DT2& t2, const DT3& t3)creates an &array; using the given &domain; objects and integers.
! Array<&dim;,T,E>(const DT1& t1, const
! DT2& t2, const DT3& t3, const DT4& t4)creates an &array; using the given &domain; objects and integers.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
! t5)creates an &array; using the given &domain; objects and integers.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
! t5, const DT6& t6)creates an &array; using the given &domain; objects and integers.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
! t5, const DT6& t6, const DT7& t7)creates an &array; using the given &domain; objects and integers.
! Array<&dim;,T,E>(const DT1& t1,
! const ModelElement<T>& model)creates an &array; using the given &domain; object or
integer and
then initializes all entries using model.
! Array<&dim;,T,E>(const DT1& t1, const DT2& t2,
! const ModelElement<T>& model)creates an &array; using the given &domain; objects and
integers and
then initializes all entries using model.
! Array<&dim;,T,E>(const DT1& t1, const DT2& t2, const DT3& t3,
! const ModelElement<T>& model)creates an &array; using the given &domain; objects and
integers and
then initializes all entries using model.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4,
! const ModelElement<T>& model)creates an &array; using the given &domain; objects and
integers and
then initializes all entries using model.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
t5,
! const ModelElement<T>& model)creates an &array; using the given &domain; objects and
integers and
then initializes all entries using model.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
t5, const DT6& t6,
! const ModelElement<T>& model)creates an &array; using the given &domain; objects and
integers and
then initializes all entries using model.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
t5, const DT6& t6, const DT7& t7,
! const ModelElement<T>& model)creates an &array; using the given &domain; objects and
integers and
then initializes all entries using model.
--- 1259,1358 ----
! Array<&dim;,T,E>()creates an empty, uninitialized &array; which must be
! initialize()d before use.
! Array<&dim;,T,E>(const DT1& t1)creates an &array; using the given &domain; object or integer.
! Array<&dim;,T,E>(const DT1& t1, const DT2& t2)creates an &array; using the given &domain; objects and integers.
! Array<&dim;,T,E>(const DT1& t1, const DT2& t2, const DT3& t3)creates an &array; using the given &domain; objects and integers.
! Array<&dim;,T,E>(const DT1& t1, const
! DT2& t2, const DT3& t3, const DT4& t4)creates an &array; using the given &domain; objects and integers.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
! t5)creates an &array; using the given &domain; objects and integers.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
! t5, const DT6& t6)creates an &array; using the given &domain; objects and integers.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
! t5, const DT6& t6, const DT7& t7)creates an &array; using the given &domain; objects and integers.
! Array<&dim;,T,E>(const DT1& t1,
! const ModelElement<T>& model)creates an &array; using the given &domain; object or
integer and
then initializes all entries using model.
! Array<&dim;,T,E>(const DT1& t1, const DT2& t2,
! const ModelElement<T>& model)creates an &array; using the given &domain; objects and
integers and
then initializes all entries using model.
! Array<&dim;,T,E>(const DT1& t1, const DT2& t2, const DT3& t3,
! const ModelElement<T>& model)creates an &array; using the given &domain; objects and
integers and
then initializes all entries using model.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4,
! const ModelElement<T>& model)creates an &array; using the given &domain; objects and
integers and
then initializes all entries using model.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
t5,
! const ModelElement<T>& model)creates an &array; using the given &domain; objects and
integers and
then initializes all entries using model.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
t5, const DT6& t6,
! const ModelElement<T>& model)creates an &array; using the given &domain; objects and
integers and
then initializes all entries using model.
! Array<&dim;,T,E>(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
t5, const DT6& t6, const DT7& t7,
! const ModelElement<T>& model)creates an &array; using the given &domain; objects and
integers and
then initializes all entries using model.
*************** Array<3> b(2,3,1);
*** 1389,1395 ****
Array<2,bool> c(2,3);
To specify a default &array; value of &true;, use
! ModelElement<bool>(true):
Array<2,bool> c(2,3, ModelElement<bool>(true));.
To create a one-dimensional &array; containing
--- 1389,1395 ----
Array<2,bool> c(2,3);
To specify a default &array; value of &true;, use
! ModelElement<bool>(true):
Array<2,bool> c(2,3, ModelElement<bool>(true));.
To create a one-dimensional &array; containing
*************** Array<1,double,CompressibleBrick>
*** 1407,1416 ****
constructor, must have a specified domain before it can be used.
For example, one must use the parameter-less &array; constructor
when creating an array of &array;s using
! new so their domains must be specified.
(It would probably be better to create an &array; of &array;s
since memory allocation and deallocation would automatically be
! handled.) &array;'s initialize functions
accept the same set of domain object specifications and model
elements that the &array; constructors do, creating the specified
domain. See new so their domains must be specified.
(It would probably be better to create an &array; of &array;s
since memory allocation and deallocation would automatically be
! handled.) &array;'s initialize functions
accept the same set of domain object specifications and model
elements that the &array; constructors do, creating the specified
domain. See a(Interval<1>(2,7),
*** 1426,1432 ****
// its domain.
Array<2,float,Brick> b();
b.initialize(Interval<1>(2,7), Interval<1>(-2,4));.
! Invoking initialize on an
&array; with an existing domain yields unspecified behavior. All
&array; values may be lost and memory may be leaked.
--- 1426,1432 ----
// its domain.
Array<2,float,Brick> b();
b.initialize(Interval<1>(2,7), Interval<1>(-2,4));.
! Invoking initialize on an
&array; with an existing domain yields unspecified behavior. All
&array; values may be lost and memory may be leaked.
*************** b.initialize(Interval<1>(2,7), Interval<
*** 1437,1448 ****
! An &array;'s initialize member
functions sets its domain and should be invoked only for an
array created without a domain. It returns nothing.
! initialize declarationresult
--- 1437,1448 ----
! An &array;'s initialize member
functions sets its domain and should be invoked only for an
array created without a domain. It returns nothing.
! initialize declarationresult
*************** b.initialize(Interval<1>(2,7), Interval<
*** 1457,1546 ****
! initialize(const DT1& t1)creates the &array;'s domain using the given &domain;
object or integer.
! initialize(const DT1& t1, const DT2& t2)creates the &array;'s domain using the given &domain; objects and integers.
! initialize(const DT1& t1, const DT2& t2, const DT3& t3)creates the &array;'s domain using the given &domain; objects and integers.
! initialize(const DT1& t1, const
! DT2& t2, const DT3& t3, const DT4& t4)creates the &array;'s domain using the given &domain; objects and integers.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
! t5)creates the &array;'s domain using the given &domain; objects and integers.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
! t5, const DT6& t6)creates the &array;'s domain using the given &domain; objects and integers.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
! t5, const DT6& t6, const DT7& t7)creates the &array;'s domain using the given &domain; objects and integers.
! initialize(const DT1& t1,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain;
object or integer and
then initializes all entries using model.
! initialize(const DT1& t1, const DT2& t2,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain;
objects and integers and
then initializes all entries using model.
! initialize(const DT1& t1, const DT2& t2, const DT3& t3,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain;
objects and integers and
then initializes all entries using model.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain; objects and integers and
then initializes all entries using model.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
t5,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain; objects and integers and
then initializes all entries using model.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
t5, const DT6& t6,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain; objects and integers and
then initializes all entries using model.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
t5, const DT6& t6, const DT7& t7,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain; objects and integers and
then initializes all entries using model.
--- 1457,1546 ----
! initialize(const DT1& t1)creates the &array;'s domain using the given &domain;
object or integer.
! initialize(const DT1& t1, const DT2& t2)creates the &array;'s domain using the given &domain; objects and integers.
! initialize(const DT1& t1, const DT2& t2, const DT3& t3)creates the &array;'s domain using the given &domain; objects and integers.
! initialize(const DT1& t1, const
! DT2& t2, const DT3& t3, const DT4& t4)creates the &array;'s domain using the given &domain; objects and integers.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
! t5)creates the &array;'s domain using the given &domain; objects and integers.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
! t5, const DT6& t6)creates the &array;'s domain using the given &domain; objects and integers.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
! t5, const DT6& t6, const DT7& t7)creates the &array;'s domain using the given &domain; objects and integers.
! initialize(const DT1& t1,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain;
object or integer and
then initializes all entries using model.
! initialize(const DT1& t1, const DT2& t2,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain;
objects and integers and
then initializes all entries using model.
! initialize(const DT1& t1, const DT2& t2, const DT3& t3,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain;
objects and integers and
then initializes all entries using model.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain; objects and integers and
then initializes all entries using model.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
t5,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain; objects and integers and
then initializes all entries using model.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
t5, const DT6& t6,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain; objects and integers and
then initializes all entries using model.
! initialize(const DT1& t1, const
DT2& t2, const DT3& t3, const DT4& t4, const DT5&
t5, const DT6& t6, const DT7& t7,
! const ModelElement<T>& model)creates the &array;'s domain using the given &domain; objects and integers and
then initializes all entries using model.
*************** std::cout &openopen; a(2,-2) &openopen;
*** 1583,1593 ****
numbers.
For read-only access to a value, use the
! read member function, which takes the
same index notation as its nameless read-write counterpart:
std::cout &openopen; a.read(2,-2) &openopen; std::endl;
! Using read sometimes
permits the optimizer to produce faster executing code.Copying &array;s requires little execution time because
--- 1583,1593 ----
numbers.For read-only access to a value, use the
! read member function, which takes the
same index notation as its nameless read-write counterpart:
std::cout &openopen; a.read(2,-2) &openopen; std::endl;
! Using read sometimes
permits the optimizer to produce faster executing code.Copying &array;s requires little execution time because
*************** std::cout &openopen; a.read(2,-2) &openo
*** 1622,1628 ****
Destruction is similarly inexpensive.Array assignment does not have reference semantics. Thus,
! the assignment a = b ensures that all of
a's values are the same as b
at the time of assignment only. Subsequent changes to
a's values do not change b's
--- 1622,1628 ----
Destruction is similarly inexpensive.Array assignment does not have reference semantics. Thus,
! the assignment a = b ensures that all of
a's values are the same as b
at the time of assignment only. Subsequent changes to
a's values do not change b's
*************** std::cout &openopen; a.read(2,-2) &openo
*** 1637,1645 ****
constants useful for both compile-time and run-time computations.
See .
These may be accessed using the &array;'s type and the scope
! resolution operator (::). The table begins
with a list of internal type definitions, e.g.,
! Array<&dim;,T,E>::This_t. A
layout maps a
domain index to a particular processor and memory used to compute
the associated value. The last two functions return the
--- 1708,1727 ----
returning the &array;'s domain, which has type
Array<&dim;,T,E>::Domain_t (abbreviated
Domain_t in the table). The next seven functions
! query the domain. first,
! last, and length
return the first index, last index, and number of indices for the
specified dimension. The domain's dimensions are numbered 0, 1,
…,
! Array<&dim;,T,E>::dimensions-1. If
these values are needed for all dimensions, use
! firsts, lasts,
! and lengths. The returned
Loc<&dim;>s have &dim; entries, one for each
! dimension. size returns the total number
of indices in the entire domain. This is the product of all the
! dimensions' lengths. The
! layout member function returns the
&array;'s layout, which specifies the mapping of indices to
processors and memory. The last two functions return the
*************** std::cout &openopen; a.read(2,-2) &openo
*** 1742,1807 ****
Internal type definitions, e.g., Domain_t,
are listed here without the class type prefix
! Array<&dim;,T,E>::.
! Domain_t domain()returns the &array;'s domain.
! Domain_t physicalDomain()returns the &array;'s domain.
! Domain_t totalDomain()returns the &array;'s domain.
! int first(int dim)returns the first index value for the specified
dimension.
! int last(int dim)returns the last index value for the specified
dimension.
! int length(int dim)returns the number of indices (including endpoints) for
the specified dimension.
! Loc<Dim> firsts()returns the first index values for all the
dimensions.
! Loc<Dim> lasts()returns the last index values for all the specified
dimensions.
! Loc<Dim> lengths()returns the numbers of indices (including endpoints)
for all the specified dimensions.
! long size()returns the total number of indices in the domain.
! Layout_t layout()returns the &array;'s layout.
! Engine_t engine()returns the &array;'s engine.
! const Engine_t engine()returns the &array;'s engine.
--- 1742,1807 ----
Internal type definitions, e.g., Domain_t,
are listed here without the class type prefix
! Array<&dim;,T,E>::.
! Domain_t domain()returns the &array;'s domain.
! Domain_t physicalDomain()returns the &array;'s domain.
! Domain_t totalDomain()returns the &array;'s domain.
! int first(int dim)returns the first index value for the specified
dimension.
! int last(int dim)returns the last index value for the specified
dimension.
! int length(int dim)returns the number of indices (including endpoints) for
the specified dimension.
! Loc<Dim> firsts()returns the first index values for all the
dimensions.
! Loc<Dim> lasts()returns the last index values for all the specified
dimensions.
! Loc<Dim> lengths()returns the numbers of indices (including endpoints)
for all the specified dimensions.
! long size()returns the total number of indices in the domain.
! Layout_t layout()returns the &array;'s layout.
! Engine_t engine()returns the &array;'s engine.
! const Engine_t engine()returns the &array;'s engine.
*************** std::cout &openopen; a.read(2,-2) &openo
*** 1811,1819 ****
We illustrate using &array; member functions in . The program
computes the total number of &array;'s indices, comparing the
! result with invoking its size method.
Since the &array;'s name is a,
! a.size() returns its size. The
computeArraySize function also computes the
&array;'s size. This templated function uses its three template
parameters to accept any &array;, regardless of its dimension,
--- 1811,1819 ----
We illustrate using &array; member functions in . The program
computes the total number of &array;'s indices, comparing the
! result with invoking its size method.
Since the &array;'s name is a,
! a.size() returns its size. The
computeArraySize function also computes the
&array;'s size. This templated function uses its three template
parameters to accept any &array;, regardless of its dimension,
*************** std::cout &openopen; a.read(2,-2) &openo
*** 1823,1832 ****
illustrates using member functions. The domain's size is the
product of the length of each dimension. Since the lengths are
stored in the Loc<&dim>
! lens, lens[d] is a
Loc<1>, for which its
! first member function extracts the
! length. The length &array; member
function is used in the PAssert.
--- 1823,1832 ----
illustrates using member functions. The domain's size is the
product of the length of each dimension. Since the lengths are
stored in the Loc<&dim>
! lens, lens[d] is a
Loc<1>, for which its
! first member function extracts the
! length. The length &array; member
function is used in the PAssert.
*************** std::cout &openopen; a.read(2,-2) &openo
*** 1844,1853 ****
functions' names. These functions return &loc;s.
! lens[d] returns a
Loc<1> for
dimension d's length. Invoking
! Loc<1>first method
yields its value.
--- 1844,1853 ----
functions' names. These functions return &loc;s.
! lens[d] returns a
Loc<1> for
dimension d's length. Invoking
! Loc<1>first method
yields its value.
*************** std::cout &openopen; a.read(2,-2) &openo
*** 1855,1861 ****
using member functions.
! The size is invoked by
prepending the &array;'s name followed by a period. This
assertion is unnecessary, but the
computeArraySize function further
--- 1855,1861 ----
using member functions.
! The size is invoked by
prepending the &array;'s name followed by a period. This
assertion is unnecessary, but the
computeArraySize function further
*************** std::cout &openopen; a.read(2,-2) &openo
*** 1890,1905 ****
&dynamic; &engine; is analogous to a one-dimensional &brick;
&engine; supporting a dynamically-resizable domain. It is also
usually the default value for this tag. For example,
! DynamicArray<> d0(1);,
! DynamicArray<double> d1(1);, and
! DynamicArray<double, Dynamic> d2(1);
all declare the same &dynamicarray;s explicitly storing one
&double; value. A &dynamicarray; automatically allocates its
initial memory and deallocates its final memory, just as an
&array; does.
! The create and
! destroy member functions permit changing
a &dynamicarray;'s domain. lists these member
functions but omits functions exclusively used in distributed
--- 1890,1905 ----
&dynamic; &engine; is analogous to a one-dimensional &brick;
&engine; supporting a dynamically-resizable domain. It is also
usually the default value for this tag. For example,
! DynamicArray<> d0(1);,
! DynamicArray<double> d1(1);, and
! DynamicArray<double, Dynamic> d2(1);
all declare the same &dynamicarray;s explicitly storing one
&double; value. A &dynamicarray; automatically allocates its
initial memory and deallocates its final memory, just as an
&array; does.
! The create and
! destroy member functions permit changing
a &dynamicarray;'s domain. lists these member
functions but omits functions exclusively used in distributed
*************** std::cout &openopen; a.read(2,-2) &openo
*** 1927,1945 ****
! void create(int num)extend the current domain by the requested number of
elements.
! void destroy(const Dom& killList)remove the values specified by the indices in the given
&domain; argument. The Backfill method moves
values from the end of the domain to replace the deleted
values.
! void destroy(Iter killBegin, Iter killEnd)remove the values specified by the indices in the
container range [begin,end) specified by the random-access
iterators. The Backfill method moves values
--- 1927,1945 ----
! void create(int num)extend the current domain by the requested number of
elements.
! void destroy(const Dom& killList)remove the values specified by the indices in the given
&domain; argument. The Backfill method moves
values from the end of the domain to replace the deleted
values.
! void destroy(Iter killBegin, Iter killEnd)remove the values specified by the indices in the
container range [begin,end) specified by the random-access
iterators. The Backfill method moves values
*************** std::cout &openopen; a.read(2,-2) &openo
*** 1947,1954 ****
values.
! void destroy(const Dom& killList, const
! DeleteMethod& method)remove the values specified by the indices in the
given &domain; argument. Deleted values can be replaced by
--- 1947,1954 ----
values.
! void destroy(const Dom& killList, const
! DeleteMethod& method)remove the values specified by the indices in the
given &domain; argument. Deleted values can be replaced by
*************** std::cout &openopen; a.read(2,-2) &openo
*** 1958,1965 ****
ordering.
! void destroy(Iter killBegin, Iter killEnd,
! const DeleteMethod& method)remove the values specified by the indices in the
container range [begin,end) specified by the random-access
iterators. Deleted values can be replaced by
--- 1958,1965 ----
ordering.
! void destroy(Iter killBegin, Iter killEnd,
! const DeleteMethod& method)remove the values specified by the indices in the
container range [begin,end) specified by the random-access
iterators. Deleted values can be replaced by
*************** std::cout &openopen; a.read(2,-2) &openo
*** 1972,1985 ****
! The destroy member function deletes
the specified indices. The indices may be specified using either
a &domain; object (Interval<1>,
Range<1>, or IndirectionList) or
by random-access iterators pointing into a container. For
example, every other value from a ten-value
array d might be removed using
! Range<1>(0,9,2). Alternatively,
int killList[] = {0, 2, 4, 6, 8};
d.destroy(killList, killList+5);
--- 1972,1985 ----
! The destroy member function deletes
the specified indices. The indices may be specified using either
a &domain; object (Interval<1>,
Range<1>, or IndirectionList) or
by random-access iterators pointing into a container. For
example, every other value from a ten-value
array d might be removed using
! Range<1>(0,9,2). Alternatively,
int killList[] = {0, 2, 4, 6, 8};
d.destroy(killList, killList+5);
*************** d.destroy(killList, killList+5);
*** 2002,2012 ****
0 1 2 3
! destroy using BackFill:3 1 2
! destroy using ShiftUp:1 2 3
--- 2002,2012 ----
0 1 2 3
! destroy using BackFill:3 1 2
! destroy using ShiftUp:1 2 3
*************** d.destroy(killList, killList+5);
*** 2025,2032 ****
original indices of 0 1 2 3. Removing 2 yields 0 1 3 because 3 is
moved into 2's position. Removing 0 yields 3 1 because 3 is again
moved. Use an object with the desired type to indicate which fill
! method is desired, i.e., BackFill() or
! ShiftUp().We illustrate &dynamicarray; resizing in . &dynamicarray;s
--- 2025,2032 ----
original indices of 0 1 2 3. Removing 2 yields 0 1 3 because 3 is
moved into 2's position. Removing 0 yields 3 1 because 3 is again
moved. Use an object with the desired type to indicate which fill
! method is desired, i.e., BackFill() or
! ShiftUp().We illustrate &dynamicarray; resizing in . &dynamicarray;s
*************** d.destroy(killList, killList+5);
*** 2037,2055 ****
be one-dimensional. The three arrays, each having one &double;
value, are equivalent. (The &poomatoolkit; can be configured to
support different default template values.) Invoking
! d0's create with an
argument of five increases its domain size from one to six. The
additional indices are added to the end of the domain so the value
at index 0 is not changed. To illustrate which indices are
removed and which indices are reordered, the program first sets
all values equal to their indices. This illustrates that
&dynamicarray; values are accessed the same way as &array; values.
! For example, d0(i) accesses the
ith value. The
! destroy member function removes every
other index from the array because the one-dimensional ⦥
specifies the domain's entire interval with a stride of 2.
! The BackFill function call creates a
BackFill object indicating the BackFill
method should be used. We illustrate the steps of this method:
d0's create with an
argument of five increases its domain size from one to six. The
additional indices are added to the end of the domain so the value
at index 0 is not changed. To illustrate which indices are
removed and which indices are reordered, the program first sets
all values equal to their indices. This illustrates that
&dynamicarray; values are accessed the same way as &array; values.
! For example, d0(i) accesses the
ith value. The
! destroy member function removes every
other index from the array because the one-dimensional ⦥
specifies the domain's entire interval with a stride of 2.
! The BackFill function call creates a
BackFill object indicating the BackFill
method should be used. We illustrate the steps of this method:
destroy. Since this &dynamicarray;'s
indices are specified using ∫s, the
killList explicitly lists the indices to
! remove. The destroy call uses pointers
to the beginning and end of the killList array
to specify which of its indices to use. Since no replacement
method is specified, the default BackFill method is
--- 2081,2090 ----
originally at 5 is again moved into 2's position. Finally,
index 0 is replaced by index 3. The rest of the program
repeats the computation, using the random-access iterator version
! of destroy. Since this &dynamicarray;'s
indices are specified using ∫s, the
killList explicitly lists the indices to
! remove. The destroy call uses pointers
to the beginning and end of the killList array
to specify which of its indices to use. Since no replacement
method is specified, the default BackFill method is
*************** d.destroy(killList, killList+5);
*** 2104,2110 ****
&dynamicarray;s, storing one &double; value.
! This create member function call
adds five indices to the end of the domain.
--- 2104,2110 ----
&dynamicarray;s, storing one &double; value.
! This create member function call
adds five indices to the end of the domain.
*************** d.destroy(killList, killList+5);
*** 2113,2124 ****
The ⦥ object specifies that every other index
! should be removed. The BackFill()
object is unnecessary since it is the default replacement
method.
! This destroy call is equivalent
to the previous one but uses iterators.
--- 2113,2124 ----
The ⦥ object specifies that every other index
! should be removed. The BackFill()
object is unnecessary since it is the default replacement
method.
! This destroy call is equivalent
to the previous one but uses iterators.
Index: concepts.xml
===================================================================
RCS file: /home/pooma/Repository/r2/docs/manual/concepts.xml,v
retrieving revision 1.11
diff -c -p -r1.11 concepts.xml
*** concepts.xml 2002/01/30 23:09:06 1.11
--- concepts.xml 2002/01/30 23:47:30
***************
*** 251,258 ****
versa. While users sometimes explicitly create views, they are
perhaps more frequently created as temporaries in expressions. For
example, if A is an &array; and
! I is a domain, A(I) -
! A(I-1) uses two views to form the difference between
adjacent values.
--- 251,258 ----
versa. While users sometimes explicitly create views, they are
perhaps more frequently created as temporaries in expressions. For
example, if A is an &array; and
! I is a domain, A(I) -
! A(I-1) uses two views to form the difference between
adjacent values.
***************
*** 523,530 ****
computation accesses individual container values through explicit
notation. For example, values in a two-dimensional
container &container; might be referenced as
! &container(3,4) or
! &container(i,j+1). This is the usual
notation for non-object-oriented languages such as &c;.
&container(3,4) or
! &container(i,j+1). This is the usual
notation for non-object-oriented languages such as &c;.,
! a(I,J) represents the subset of &array;
a's values having coordinates in the domain
specified by the direct product of one-dimensional &interval;s
I and J. Using
--- 532,538 ----
computation uses expressions to access subsets of a container's
values. For example, in ,
! a(I,J) represents the subset of &array;
a's values having coordinates in the domain
specified by the direct product of one-dimensional &interval;s
I and J. Using
Index: data-parallel.xml
===================================================================
RCS file: /home/pooma/Repository/r2/docs/manual/data-parallel.xml,v
retrieving revision 1.5
diff -c -p -r1.5 data-parallel.xml
*** data-parallel.xml 2002/01/30 23:09:06 1.5
--- data-parallel.xml 2002/01/30 23:47:31
***************
*** 83,94 ****
The data-parallel operators operate element-wise on
containers' values. For example, if A is a
one-dimensional array,
! -A is a one-dimensional
array with the same size such that the value at the
ith position equals -A(i). If
A and B are two-dimensional
&array;s on the same domain,
! A+B
is an array on the same domain with values equaling the sum of
corresponding values in A and
B.
--- 83,94 ----
The data-parallel operators operate element-wise on
containers' values. For example, if A is a
one-dimensional array,
! -A is a one-dimensional
array with the same size such that the value at the
ith position equals -A(i). If
A and B are two-dimensional
&array;s on the same domain,
! A+B
is an array on the same domain with values equaling the sum of
corresponding values in A and
B.
***************
*** 103,110 ****
with a one-dimensional interval [0,3]. Its first and last
entries equal A's first and last entries, while
its middle two entries are the sums
! A(1)+B(1) and
! A(2)+B(2). We assume zero is the default
value for the type of values stored in B.
A more complicated example of adding two &array;s with different
domains is illustrated in A's first and last entries, while
its middle two entries are the sums
! A(1)+B(1) and
! A(2)+B(2). We assume zero is the default
value for the type of values stored in B.
A more complicated example of adding two &array;s with different
domains is illustrated in A(I,I), B(J,H);
*** 143,155 ****
their domains' extent differ, as indicated by the solid lines in
the figure. The sum has domain equal to the left operand's
domain. Values with the same indices are added. For example,
! A(2,2) and B(2,2)
are added. B's domain does not include index
! (1,1) so, when adding A(1,1) and
! B(1,1), the default value for
B's value type is used. Usually this
! is 0. Thus, A(1,1) + B(1,1) equals
! 9 + 0.
Operations with both &array;s and scalar values are
supported. Conceptually, a scalar value can be thought of as an
--- 143,155 ----
their domains' extent differ, as indicated by the solid lines in
the figure. The sum has domain equal to the left operand's
domain. Values with the same indices are added. For example,
! A(2,2) and B(2,2)
are added. B's domain does not include index
! (1,1) so, when adding A(1,1) and
! B(1,1), the default value for
B's value type is used. Usually this
! is 0. Thus, A(1,1) + B(1,1) equals
! 9 + 0.Operations with both &array;s and scalar values are
supported. Conceptually, a scalar value can be thought of as an
*************** Array<2, double, Brick> A(I,I), B(J,H);
*** 158,171 ****
Array<1, double, Brick> D(Interval<1>(7,10));
D += 2*D + 7;
! 2*D obeys the guidelines
! because the scalar 2 can be thought of as
an array with the same domain as D. It has the
! same value 2 everywhere. Likewise the
! conceptual domain for the scalar 7 is the
! same as 2*D's domain. Thus,
! 2*D(i) + 7 is added to
! D(i) wherever index i is in
D's domain. In practice, the &toolkit; does
not first convert scalar values to arrays but instead uses them
directly in expressions.
--- 158,171 ----
Array<1, double, Brick> D(Interval<1>(7,10));
D += 2*D + 7;
! 2*D obeys the guidelines
! because the scalar 2 can be thought of as
an array with the same domain as D. It has the
! same value 2 everywhere. Likewise the
! conceptual domain for the scalar 7 is the
! same as 2*D's domain. Thus,
! 2*D(i) + 7 is added to
! D(i) wherever index i is in
D's domain. In practice, the &toolkit; does
not first convert scalar values to arrays but instead uses them
directly in expressions.
*************** Array<2, double, Brick> A(I,I), B(H,J),
*** 201,215 ****
Array<1, double, Brick> A(Interval<1>(0,1));
Array<1, double, Brick> B(Interval<1>(1,2));
A = B;
! A(0) is assigned
! B(1) and A(1) is
! assigned B(2).
Assigning a scalar value to an &array; also is supported,
but assigning an &array; to a scalar is not. A scalar value is
conformable to any domain because, conceptually it can be viewed
as an &array; with any desired domain and having the same value
! everywhere. Thus, the assignment B = 3
ensures every value in B equals 3. Even
though a scalar value is conformable to any &array;, it is not an
l-value so it cannot appear on the left-hand side of an
--- 201,215 ----
Array<1, double, Brick> A(Interval<1>(0,1));
Array<1, double, Brick> B(Interval<1>(1,2));
A = B;
! A(0) is assigned
! B(1) and A(1) is
! assigned B(2).Assigning a scalar value to an &array; also is supported,
but assigning an &array; to a scalar is not. A scalar value is
conformable to any domain because, conceptually it can be viewed
as an &array; with any desired domain and having the same value
! everywhere. Thus, the assignment B = 3
ensures every value in B equals 3. Even
though a scalar value is conformable to any &array;, it is not an
l-value so it cannot appear on the left-hand side of an
*************** A = B;
*** 217,225 ****
Data-parallel expressions can involve typical mathematical
functions and output operations. For example,
! sin(A) yields an &array; with values equal
to the sine of each of &array; A's values.
! dot(A,B) has values equaling the dot
product of corresponding values in &array;s A
and B. The contents of an entire &array; can
be easily printed to standard output. For example, the program
--- 217,225 ----
Data-parallel expressions can involve typical mathematical
functions and output operations. For example,
! sin(A) yields an &array; with values equal
to the sine of each of &array; A's values.
! dot(A,B) has values equaling the dot
product of corresponding values in &array;s A
and B. The contents of an entire &array; can
be easily printed to standard output. For example, the program
*************** std::cout &openopen; A-B &openopen; std:
*** 234,240 ****
(000:002:001) = 1 -1 -1. The initial
(000:002:001) indicates the
&array;'s domain ranges from 0 to 2 with a stride of 1. The
! three values in A-B follow.The following four tables list the data-parallel operators
that operate on &array;s. . The initial
(000:002:001) indicates the
&array;'s domain ranges from 0 to 2 with a stride of 1. The
! three values in A-B follow.The following four tables list the data-parallel operators
that operate on &array;s. ! can
take an Array<bool>,
Array<int>, Array<long>, or
! any other value type to which ! can be
applied. The result is an Array<bool>. Each
binary operator also returns an &array;. When specifying two
&array;s or an &array; and a scalar value, a full set of operators
is supported. When specifying an &array; and a &tensor;,
&matrix;, or &vector;, a more limited set of operators is
! supported. For example, == can take two
&array;s, an &array; and a scalar value, or a scalar value and an
&array;. If given two &array;s, corresponding values are used.
If an argument is a scalar value, its same value is the used with
! each &array; value. The + supports the same
set of parameters but also supports adding an &array; and a
&tensor;, an &array; and a &matrix;, an &array; and a &vector;, a
&tensor; and an &array;, a &matrix; and an &array;, and a &vector;
--- 242,261 ----
&cc; operators that can be applied to &array;s and also scalar
values if appropriate. Each unary operator takes an &array;
parameter and returns an &array;. The types of the two &array;s
! need not be the same. For example, ! can
take an Array<bool>,
Array<int>, Array<long>, or
! any other value type to which ! can be
applied. The result is an Array<bool>. Each
binary operator also returns an &array;. When specifying two
&array;s or an &array; and a scalar value, a full set of operators
is supported. When specifying an &array; and a &tensor;,
&matrix;, or &vector;, a more limited set of operators is
! supported. For example, == can take two
&array;s, an &array; and a scalar value, or a scalar value and an
&array;. If given two &array;s, corresponding values are used.
If an argument is a scalar value, its same value is the used with
! each &array; value. The + supports the same
set of parameters but also supports adding an &array; and a
&tensor;, an &array; and a &matrix;, an &array; and a &vector;, a
&tensor; and an &array;, a &matrix; and an &array;, and a &vector;
*************** std::cout &openopen; A-B &openopen; std:
*** 277,297 ****
unary operators
! +, -, ~, !binary operators with at least one &array; and at most
one scalar value
! +, -, *, /, %, &, |, ^, <, <=, >=, >, ==, !=, &&, ||, &openopen;, &closeclose;binary operators with at least one &array; and at most
one &tensor;, &matrix;, or &vector;
! +, -,
! *, /,
! %, &,
! |, ^,
! ==, !=
--- 277,297 ----
unary operators
! +, -, ~, !binary operators with at least one &array; and at most
one scalar value
! +, -, *, /, %, &, |, ^, <, <=, >=, >, ==, !=, &&, ||, &openopen;, &closeclose;binary operators with at least one &array; and at most
one &tensor;, &matrix;, or &vector;
! +, -,
! *, /,
! %, &,
! |, ^,
! ==, !=
*************** std::cout &openopen; A-B &openopen; std:
*** 361,445 ****
Trigonometric and Hyperbolic Functions
! #include <math.h>
! Array<T> cos (const Array<T>& A)Returns the cosines of the &array;'s values.
! Array<T> sin (const Array<T>& A)Returns the sines of the &array;'s values.
! Array<T> tan (const Array<T>& A)Returns the tangents of the &array;'s values.
! Array<T> acos (const Array<T1>& A)Returns the arc cosines of the &array;'s values.
! Array<T> asin (const Array<T1>& A)Returns the arc sines of the &array;'s values.
! Array<T> atan (const Array<T1>& A)Returns the arc tangents of the &array;'s values.
! Array<T> atan2 (const Array<T1>& A, const Array<T2>& B)Computes the arc tangents of the values from the division
of elements in B by the elements
in A. The resulting values are the
signed angles in the range -π to π, inclusive.
! Array<T> atan2 (const Array<T1>& A, const T2& r)Computes the arc tangents of the values from the division
of r by the elements
in A. The resulting values are the
signed angles in the range -π to π, inclusive.
! Array<T> atan2 (const T1& l, const Array<T2>& B)Computes the arc tangents of the values from the division
of elements in B by l. The resulting values are the
signed angles in the range -π to π, inclusive.
! Array<T> cosh (const Array<T>& A)Returns the hyperbolic cosines of the &array;'s values.
! Array<T> sinh (const Array<T>& A)Returns the hyperbolic sines of the &array;'s values.
! Array<T> tanh (const Array<T>& A)Returns the hyperbolic tangents of the &array;'s values.Absolute Value, Rounding, and Modulus Functions
! #include <math.h>
! Array<T> fabs (const Array<T1>& A)Returns the absolute values of the floating point
numbers in the &array;.
! Array<T> ceil (const Array<T1>& A)For each of the &array;'s values, return the integer
larger than or equal to it (as a floating point number).
! Array<T> floor (const Array<T1>& A)For each of the &array;'s values, return the integer
smaller than or equal to it (as a floating point number).
! Array<T> fmod (const Array<T1>& A, const Array<T2>& B)Computes the floating-point modulus (remainder) of
A's values with the corresponding value
in B. The results have the same signs
--- 361,445 ----
Trigonometric and Hyperbolic Functions
! #include <math.h>
! Array<T> cos (const Array<T>& A)Returns the cosines of the &array;'s values.
! Array<T> sin (const Array<T>& A)Returns the sines of the &array;'s values.
! Array<T> tan (const Array<T>& A)Returns the tangents of the &array;'s values.
! Array<T> acos (const Array<T1>& A)Returns the arc cosines of the &array;'s values.
! Array<T> asin (const Array<T1>& A)Returns the arc sines of the &array;'s values.
! Array<T> atan (const Array<T1>& A)Returns the arc tangents of the &array;'s values.
! Array<T> atan2 (const Array<T1>& A, const Array<T2>& B)Computes the arc tangents of the values from the division
of elements in B by the elements
in A. The resulting values are the
signed angles in the range -π to π, inclusive.
! Array<T> atan2 (const Array<T1>& A, const T2& r)Computes the arc tangents of the values from the division
of r by the elements
in A. The resulting values are the
signed angles in the range -π to π, inclusive.
! Array<T> atan2 (const T1& l, const Array<T2>& B)Computes the arc tangents of the values from the division
of elements in B by l. The resulting values are the
signed angles in the range -π to π, inclusive.
! Array<T> cosh (const Array<T>& A)Returns the hyperbolic cosines of the &array;'s values.
! Array<T> sinh (const Array<T>& A)Returns the hyperbolic sines of the &array;'s values.
! Array<T> tanh (const Array<T>& A)Returns the hyperbolic tangents of the &array;'s values.Absolute Value, Rounding, and Modulus Functions
! #include <math.h>
! Array<T> fabs (const Array<T1>& A)Returns the absolute values of the floating point
numbers in the &array;.
! Array<T> ceil (const Array<T1>& A)For each of the &array;'s values, return the integer
larger than or equal to it (as a floating point number).
! Array<T> floor (const Array<T1>& A)For each of the &array;'s values, return the integer
smaller than or equal to it (as a floating point number).
! Array<T> fmod (const Array<T1>& A, const Array<T2>& B)Computes the floating-point modulus (remainder) of
A's values with the corresponding value
in B. The results have the same signs
*************** std::cout &openopen; A-B &openopen; std:
*** 447,460 ****
absolute values of B.
! Array<T> fmod (const Array<T1>& A, const T2& r)Computes the floating-point modulus (remainder) of
A's values with r. The results have the same signs
as A and absolute values less than the
absolute value of r.
! Array<T> fmod (const T1& l, const Array<T2>& B)Computes the floating-point modulus (remainder) of
l with the values
in B. The results have the same signs
--- 447,460 ----
absolute values of B.
! Array<T> fmod (const Array<T1>& A, const T2& r)Computes the floating-point modulus (remainder) of
A's values with r. The results have the same signs
as A and absolute values less than the
absolute value of r.
! Array<T> fmod (const T1& l, const Array<T2>& B)Computes the floating-point modulus (remainder) of
l with the values
in B. The results have the same signs
*************** std::cout &openopen; A-B &openopen; std:
*** 463,618 ****
Powers, Exponentiation, and Logarithmic Functions
! #include <math.h>
! Array<T> PETE_identity (const Array<T>& A)Returns the &array;. That is, it applies the identity operation.
! Array<T> sqrt (const Array<T>& A)Returns the square roots of the &array;'s values.
! Array<T> pow (const Array<T1>& A, const Array<T2>& B)Raises A's values by the
corresponding power in B.
! Array<T> pow (const Array<T1>& A, const T2& r)Raises A's values by the power r.
! Array<T> pow (const T1& l, const Array<T2>& B)Raises l by the powers
in B.
! Array<T> pow2 (const Array<T>& A)Returns the squares of A's values.
! Array<T> pow3 (const Array<T>& A)Returns the cubes of A's values.
! Array<T> pow4 (const Array<T>& A)Returns the fourth powers of A's values.
! Array<T> ldexp (const Array<T1>& A, const Array<int>& B)Multiplies A's values by two raised
to the corresponding value in B.
! Array<T> ldexp (const Array<T1>& A, int r)Multiplies A's values by two raised
to the rth
power.
! Array<T> ldexp (const T1& l, const Array<int>& B)Multiplies l by two raised
to the values in B.
! Array<T> exp (const Array<T>& A)Returns the exponentiations of the &array;'s values.
! Array<T> log (const Array<T>& A)Returns the natural logarithms of the &array;'s values.
! Array<T> log10 (const Array<T>& A)Returns the base-10 logarithms of the &array;'s values.Functions Involving Complex Numbers
! #include <complex>
! Array<T> real (const Array<complex<T&closeclose;& A)Returns the real parts of A's complex numbers.
! Array<T> imag (const Array<complex<T&closeclose;& A)Returns the imaginary parts of A's complex numbers.
! Array<T> abs (const Array<complex<T&closeclose;& A)Returns the absolute values (magnitudes) of
A's complex numbers.
! Array<T> abs (const Array<T>& A)Returns the absolute values of A's values.
! Array<T> arg (const Array<complex<T&closeclose;& A)Returns the angle representations (in radians) of the
polar representations of A's complex
numbers.
! Array<T> norm (const Array<complex<T&closeclose;& A)Returns the squared absolute values of
A's complex numbers.
! Array<complex<T&closeclose; conj (const Array<complex<T&closeclose;& A)Returns the complex conjugates of
A's complex numbers.
! Array<complex<T&closeclose; polar (const Array<T1>& A, const Array<T2>& B)Returns the complex numbers created from polar
coordinates (magnitudes and phase angles) in corresponding
&array;s.
! Array<complex<T&closeclose; polar (const T1& l, const Array<T2>& A)Returns the complex numbers created from polar
coordinates with magnitude l and
phase angles in the &array;.
! Array<complex<T&closeclose; polar (const Array<T1>& A, const T2& r)Returns the complex numbers created from polar
coordinates with magnitudes in the &array; and phase
angle r.Functions Involving Matrices and Tensors
! #include "Pooma/Tiny.h"
! T trace (const Array<T>& A)Returns the sum of the A's diagonal
entries, viewed as a matrix.
! T det (const Array<T>& A)Returns the determinant of A, viewed as a matrix.
! Array<T> transpose (const Array<T>& A)Returns the transpose of A, viewed as a matrix.
! Array<T> symmetrize (const Array<T>& A)Returns the tensors of A with the
requested output symmetry.
! Array<T> dot (const Array<T1>& A, const Array<T2>& B)Returns the dot products of values in the two &array;s.
Value type T equals the type of the
dot operating on T1
and T2.
! Array<T> dot (const Array<T1>& A, const T2& r)Returns the dot products of values in the &array;
with r.
Value type T equals the type of the
--- 463,618 ----
Powers, Exponentiation, and Logarithmic Functions
! #include <math.h>
! Array<T> PETE_identity (const Array<T>& A)Returns the &array;. That is, it applies the identity operation.
! Array<T> sqrt (const Array<T>& A)Returns the square roots of the &array;'s values.
! Array<T> pow (const Array<T1>& A, const Array<T2>& B)Raises A's values by the
corresponding power in B.
! Array<T> pow (const Array<T1>& A, const T2& r)Raises A's values by the power r.
! Array<T> pow (const T1& l, const Array<T2>& B)Raises l by the powers
in B.
! Array<T> pow2 (const Array<T>& A)Returns the squares of A's values.
! Array<T> pow3 (const Array<T>& A)Returns the cubes of A's values.
! Array<T> pow4 (const Array<T>& A)Returns the fourth powers of A's values.
! Array<T> ldexp (const Array<T1>& A, const Array<int>& B)Multiplies A's values by two raised
to the corresponding value in B.
! Array<T> ldexp (const Array<T1>& A, int r)Multiplies A's values by two raised
to the rth
power.
! Array<T> ldexp (const T1& l, const Array<int>& B)Multiplies l by two raised
to the values in B.
! Array<T> exp (const Array<T>& A)Returns the exponentiations of the &array;'s values.
! Array<T> log (const Array<T>& A)Returns the natural logarithms of the &array;'s values.
! Array<T> log10 (const Array<T>& A)Returns the base-10 logarithms of the &array;'s values.Functions Involving Complex Numbers
! #include <complex>
! Array<T> real (const Array<complex<T&closeclose;& A)Returns the real parts of A's complex numbers.
! Array<T> imag (const Array<complex<T&closeclose;& A)Returns the imaginary parts of A's complex numbers.
! Array<T> abs (const Array<complex<T&closeclose;& A)Returns the absolute values (magnitudes) of
A's complex numbers.
! Array<T> abs (const Array<T>& A)Returns the absolute values of A's values.
! Array<T> arg (const Array<complex<T&closeclose;& A)Returns the angle representations (in radians) of the
polar representations of A's complex
numbers.
! Array<T> norm (const Array<complex<T&closeclose;& A)Returns the squared absolute values of
A's complex numbers.
! Array<complex<T&closeclose; conj (const Array<complex<T&closeclose;& A)Returns the complex conjugates of
A's complex numbers.
! Array<complex<T&closeclose; polar (const Array<T1>& A, const Array<T2>& B)Returns the complex numbers created from polar
coordinates (magnitudes and phase angles) in corresponding
&array;s.
! Array<complex<T&closeclose; polar (const T1& l, const Array<T2>& A)Returns the complex numbers created from polar
coordinates with magnitude l and
phase angles in the &array;.
! Array<complex<T&closeclose; polar (const Array<T1>& A, const T2& r)Returns the complex numbers created from polar
coordinates with magnitudes in the &array; and phase
angle r.Functions Involving Matrices and Tensors
! #include "Pooma/Tiny.h"
! T trace (const Array<T>& A)Returns the sum of the A's diagonal
entries, viewed as a matrix.
! T det (const Array<T>& A)Returns the determinant of A, viewed as a matrix.
! Array<T> transpose (const Array<T>& A)Returns the transpose of A, viewed as a matrix.
! Array<T> symmetrize (const Array<T>& A)Returns the tensors of A with the
requested output symmetry.
! Array<T> dot (const Array<T1>& A, const Array<T2>& B)Returns the dot products of values in the two &array;s.
Value type T equals the type of the
dot operating on T1
and T2.
! Array<T> dot (const Array<T1>& A, const T2& r)Returns the dot products of values in the &array;
with r.
Value type T equals the type of the
*************** std::cout &openopen; A-B &openopen; std:
*** 620,633 ****
and T2.
! Array<T> dot (const T1& l, const Array<T2>& A)Returns the dot products of l with
values in the &array;. Value type T equals the type of the
dot operating on T1
and T2.
! Array<Tensor<T&closeclose; outerProduct (const Array<T1>& A, const Array<T2>& B)Returns tensors created by computing the outer product
of corresponding vectors in the two &array;s. Value
type T equals the type of the product of
--- 620,633 ----
and T2.
! Array<T> dot (const T1& l, const Array<T2>& A)Returns the dot products of l with
values in the &array;. Value type T equals the type of the
dot operating on T1
and T2.
! Array<Tensor<T&closeclose; outerProduct (const Array<T1>& A, const Array<T2>& B)Returns tensors created by computing the outer product
of corresponding vectors in the two &array;s. Value
type T equals the type of the product of
*************** std::cout &openopen; A-B &openopen; std:
*** 635,641 ****
must have the same length.
! Array<Tensor<T&closeclose; outerProduct (const T1& l, const Array<T2>& A)Returns tensors created by computing the outer product
of l with the vectors in the &array;. Value
type T equals the type of the product of
--- 635,641 ----
must have the same length.
! Array<Tensor<T&closeclose; outerProduct (const T1& l, const Array<T2>& A)Returns tensors created by computing the outer product
of l with the vectors in the &array;. Value
type T equals the type of the product of
*************** std::cout &openopen; A-B &openopen; std:
*** 643,649 ****
must have the same length.
! Array<Tensor<T&closeclose; outerProduct (const Array<T1>& A, const T2& r)Returns tensors created by computing the outer product
of vectors in the &array; with r. Value
type T equals the type of the product of
--- 643,649 ----
must have the same length.
! Array<Tensor<T&closeclose; outerProduct (const Array<T1>& A, const T2& r)Returns tensors created by computing the outer product
of vectors in the &array; with r. Value
type T equals the type of the product of
*************** std::cout &openopen; A-B &openopen; std:
*** 651,658 ****
must have the same length.
! TinyMatrix<T> outerProductAsTinyMatrix (const Array<T1>& A, const
! Array<T2>& B)Returns matrices created by computing the outer product
of corresponding vectors in the two &array;s. Value
type T equals the type of the product of
--- 651,658 ----
must have the same length.
! TinyMatrix<T> outerProductAsTinyMatrix (const Array<T1>& A, const
! Array<T2>& B)Returns matrices created by computing the outer product
of corresponding vectors in the two &array;s. Value
type T equals the type of the product of
*************** std::cout &openopen; A-B &openopen; std:
*** 660,667 ****
the same length.
! TinyMatrix<T> outerProductAsTinyMatrix (const T1& l, const
! Array<T2>& A)Returns matrices created by computing the outer
product of l with the vectors in the &array;. Value
type T equals the type of the product of
--- 660,667 ----
the same length.
! TinyMatrix<T> outerProductAsTinyMatrix (const T1& l, const
! Array<T2>& A)Returns matrices created by computing the outer
product of l with the vectors in the &array;. Value
type T equals the type of the product of
*************** std::cout &openopen; A-B &openopen; std:
*** 669,676 ****
have the same length.
! TinyMatrix<T> outerProductAsTinyMatrix (const
! Array<T1>& A, const T2& r)Returns matrices created by computing the outer
product of the vectors in the &array;
with r. Value
--- 669,676 ----
have the same length.
! TinyMatrix<T> outerProductAsTinyMatrix (const
! Array<T1>& A, const T2& r)Returns matrices created by computing the outer
product of the vectors in the &array;
with r. Value
*************** std::cout &openopen; A-B &openopen; std:
*** 687,694 ****
max and min functions
supplement named comparison functions. For example,
LT and LE compute the
! same thing as the < and
! <= operators.
--- 687,694 ----
max and min functions
supplement named comparison functions. For example,
LT and LE compute the
! same thing as the < and
! <= operators.
*************** std::cout &openopen; A-B &openopen; std:
*** 703,826 ****
! Array<T> max (const Array<T1>& A, const Array<T2>& B)Returns the maximum of corresponding &array; values.
! Array<T> max (const T1& l, const Array<T2>& A)Returns the maximums of l with the &array;'s values.
! Array<T> max (const Array<T1>& A, const T2& r)Returns the maximums of the &array;'s values with r.
! Array<T> min (const Array<T1>& A, const Array<T2>& B)Returns the minimum of corresponding &array; values.
! Array<T> min (const T1& l, const Array<T2>& A)Returns the minimums of l with the &array;'s values.
! Array<T> min (const Array<T1>& A, const T2& r)Returns the minimums of the &array;'s values with r.
! Array<bool> LT (const Array<T1>& A, const Array<T2>& B)Returns booleans from using the less-than
! operator < to compare corresponding &array; values in
A and B.
! Array<bool> LT (const T1& r, const Array<T2>& A)Returns booleans from using the less-than
! operator < to compare l with the &array;'s
values.
! Array<bool> LT (const Array<T1>& A, const T2& r)Returns booleans from using the less-than
! operator < to compare the &array;'s
values with r.
! Array<bool> LE (const Array<T1>& A, const Array<T2>& B)Returns booleans from using the less-than-or-equal
! operator <= to compare &array; values in
A and B.
! Array<bool> LE (const T1& l, const Array<T2>& A)Returns booleans from using the less-than-or-equal
! operator <= to compare l with the &array;'s values.
! Array<bool> LE (const Array<T1>& A, const T2& r)Returns booleans from using the less-than-or-equal
! operator <= to compare the &array;'s values
with r.
! Array<bool> GE (const Array<T1>& A, const Array<T2>& B)Returns booleans from using the greater-than-or-equal
! operator >= to compare &array; values in
A and B.
! Array<bool> GE (const T1& l, const Array<T2>& A)Returns booleans from using the greater-than-or-equal
! operator >= to compare l with the &array;'s values.
! Array<bool> GE (const Array<T1>& A, const T2& r)Returns booleans from using the greater-than-or-equal
! operator >= to compare the &array;'s values with r.
! Array<bool> GT (const Array<T1>& A, const Array<T2>& B)Returns booleans from using the greater-than
! operator > to compare &array; values in
A and B.
! Array<bool> GT (const T1& l, const Array<T2>& A)Returns booleans from using the greater-than
! operator > to compare l with the &array;'s values.
! Array<bool> GT (const Array<T1>& A, const T2& r)Returns booleans from using the greater-than
! operator > to compare the &array;'s values with r.
! Array<bool> EQ (const Array<T1>& A, const Array<T2>& B)Returns booleans from determining whether
corresponding &array; values in A and
B are equal.
! Array<bool> EQ (const T1& l, const Array<T2>& A)Returns booleans from determining whether
l equals the &array;'s values.
! Array<bool> EQ (const Array<T1>& A, const T2& r)Returns booleans from determining whether the &array;'s values equal r.
! Array<bool> NE (const Array<T1>& A, const Array<T2>& B)Returns booleans from determining whether
corresponding &array; values in A and
B are not equal.
! Array<bool> NE (const T1& l, const Array<T2>& A)Returns booleans from determining whether
l does not equal the &array;'s values.
! Array<bool> NE (const Array<T1>& A, const T2& r)Returns booleans from determining whether the
&array;'s values are not equal to r.
--- 703,826 ----
! Array<T> max (const Array<T1>& A, const Array<T2>& B)Returns the maximum of corresponding &array; values.
! Array<T> max (const T1& l, const Array<T2>& A)Returns the maximums of l with the &array;'s values.
! Array<T> max (const Array<T1>& A, const T2& r)Returns the maximums of the &array;'s values with r.
! Array<T> min (const Array<T1>& A, const Array<T2>& B)Returns the minimum of corresponding &array; values.
! Array<T> min (const T1& l, const Array<T2>& A)Returns the minimums of l with the &array;'s values.
! Array<T> min (const Array<T1>& A, const T2& r)Returns the minimums of the &array;'s values with r.
! Array<bool> LT (const Array<T1>& A, const Array<T2>& B)Returns booleans from using the less-than
! operator < to compare corresponding &array; values in
A and B.
! Array<bool> LT (const T1& r, const Array<T2>& A)Returns booleans from using the less-than
! operator < to compare l with the &array;'s
values.
! Array<bool> LT (const Array<T1>& A, const T2& r)Returns booleans from using the less-than
! operator < to compare the &array;'s
values with r.
! Array<bool> LE (const Array<T1>& A, const Array<T2>& B)Returns booleans from using the less-than-or-equal
! operator <= to compare &array; values in
A and B.
! Array<bool> LE (const T1& l, const Array<T2>& A)Returns booleans from using the less-than-or-equal
! operator <= to compare l with the &array;'s values.
! Array<bool> LE (const Array<T1>& A, const T2& r)Returns booleans from using the less-than-or-equal
! operator <= to compare the &array;'s values
with r.
! Array<bool> GE (const Array<T1>& A, const Array<T2>& B)Returns booleans from using the greater-than-or-equal
! operator >= to compare &array; values in
A and B.
! Array<bool> GE (const T1& l, const Array<T2>& A)Returns booleans from using the greater-than-or-equal
! operator >= to compare l with the &array;'s values.
! Array<bool> GE (const Array<T1>& A, const T2& r)Returns booleans from using the greater-than-or-equal
! operator >= to compare the &array;'s values with r.
! Array<bool> GT (const Array<T1>& A, const Array<T2>& B)Returns booleans from using the greater-than
! operator > to compare &array; values in
A and B.
! Array<bool> GT (const T1& l, const Array<T2>& A)Returns booleans from using the greater-than
! operator > to compare l with the &array;'s values.
! Array<bool> GT (const Array<T1>& A, const T2& r)Returns booleans from using the greater-than
! operator > to compare the &array;'s values with r.
! Array<bool> EQ (const Array<T1>& A, const Array<T2>& B)Returns booleans from determining whether
corresponding &array; values in A and
B are equal.
! Array<bool> EQ (const T1& l, const Array<T2>& A)Returns booleans from determining whether
l equals the &array;'s values.
! Array<bool> EQ (const Array<T1>& A, const T2& r)Returns booleans from determining whether the &array;'s values equal r.
! Array<bool> NE (const Array<T1>& A, const Array<T2>& B)Returns booleans from determining whether
corresponding &array; values in A and
B are not equal.
! Array<bool> NE (const T1& l, const Array<T2>& A)Returns booleans from determining whether
l does not equal the &array;'s values.
! Array<bool> NE (const Array<T1>& A, const T2& r)Returns booleans from determining whether the
&array;'s values are not equal to r.
*************** std::cout &openopen; A-B &openopen; std:
*** 834,840 ****
two functions. peteCast casts all values in
an &array; to the type specified by its first parameter. The
where function generalizes the trinary
! ?: operator. Using its first &array;
argument as boolean values, it returns an &array; of just two
values: t and f.
--- 834,840 ----
two functions. peteCast casts all values in
an &array; to the type specified by its first parameter. The
where function generalizes the trinary
! ?: operator. Using its first &array;
argument as boolean values, it returns an &array; of just two
values: t and f.
*************** std::cout &openopen; A-B &openopen; std:
*** 851,862 ****
! Array<T> peteCast (const T1&, const Array<T>& A)Returns the casting of the &array;'s values to type T1.
! Array<T> where (const Array<T1>& A, const T2& t, const T3& f)
! Generalizes the ?: operator,
returning an &array; of t and
f values depending on whether
A's values are true or false,
--- 851,862 ----
! Array<T> peteCast (const T1&, const Array<T>& A)Returns the casting of the &array;'s values to type T1.
! Array<T> where (const Array<T1>& A, const T2& t, const T3& f)
! Generalizes the ?: operator,
returning an &array; of t and
f values depending on whether
A's values are true or false,
*************** B = 2.0;
*** 926,932 ****
A += -A + 2*B;
std::cout &openopen; A &openopen; std::endl;
Our goal is to transform the data-parallel
! statement A += -A + 2*B into a single
loop, preferably without using intermediary containers. To
simplify notation, let Ar abbreviate the type
Array<1, double, Brick>.
--- 926,932 ----
A += -A + 2*B;
std::cout &openopen; A &openopen; std::endl;
Our goal is to transform the data-parallel
! statement A += -A + 2*B into a single
loop, preferably without using intermediary containers. To
simplify notation, let Ar abbreviate the type
Array<1, double, Brick>.
*************** std::cout &openopen; A &openopen; std::e
*** 934,945 ****
Using overloaded arithmetic operators would require using
intermediate containers to evaluate the statement. For example,
the sum's left operand -A
! would be computed by the overloaded unary operator Ar
! operator-(const Ar&), which would produce an
! intermediate &array;. Ar operator*(double,
! const Ar&) would produce another intermediate
! &array; holding 2*B. Yet another
intermediate container would hold their sum, all before
performing the assignment. Thus, three intermediate containers
would be created and destroyed. Below, we show these are
--- 934,945 ----
Using overloaded arithmetic operators would require using
intermediate containers to evaluate the statement. For example,
the sum's left operand -A
! would be computed by the overloaded unary operator Ar
! operator-(const Ar&), which would produce an
! intermediate &array;. Ar operator*(double,
! const Ar&) would produce another intermediate
! &array; holding 2*B. Yet another
intermediate container would hold their sum, all before
performing the assignment. Thus, three intermediate containers
would be created and destroyed. Below, we show these are
*************** std::cout &openopen; A &openopen; std::e
*** 965,976 ****
intermediate loops or temporary values are needed.Before explaining the implementation, let us illustrate
! using our example statement A += -A + 2*B.
Evaluating the right-hand side creates a parse tree similar to
the one in .
For example, the overloaded unary minus operator yields a tree
! node representing -A, having a unary-minus
function object, and having type
Expression<UnaryNode<OpMinus,Ar&closeclose;
--- 965,976 ----
intermediate loops or temporary values are needed.Before explaining the implementation, let us illustrate
! using our example statement A += -A + 2*B.
Evaluating the right-hand side creates a parse tree similar to
the one in .
For example, the overloaded unary minus operator yields a tree
! node representing -A, having a unary-minus
function object, and having type
Expression<UnaryNode<OpMinus,Ar&closeclose;
*************** Expression<BinaryNode<OpAdd,
*** 984,990 ****
representing A.
! Finally, the assignment operator +=
calls the evaluate function corresponding to
the left-hand side's type. At compile time, it produces the code
for the computation. Since this templated function is
--- 996,1009 ----
A parse tree for the statement is produced.
! The parse tree for -A + 2*B with
type annotations. The complete type of a node equals the
concatenation of the preorder traversal of annotated types.
! Finally, the assignment operator +=
calls the evaluate function corresponding to
the left-hand side's type. At compile time, it produces the code
for the computation. Since this templated function is
*************** Expression<BinaryNode<OpAdd,
*** 1033,1039 ****
the three things it must store:
! Opthe type of the node's operation. For example, the
OpAdd type represents adding two operands
--- 1033,1039 ----
the three things it must store:
! Opthe type of the node's operation. For example, the
OpAdd type represents adding two operands
*************** Expression<BinaryNode<OpAdd,
*** 1041,1053 ****
! Leftthe type of the left child.
! Rightthe type of the right child.
--- 1041,1053 ----
! Leftthe type of the left child.
! Rightthe type of the right child.
*************** struct CreateLeaf
*** 1096,1102 ****
};
The Scalar class stores the scalar
value. The CreateLeaf's Leaf_t type
! indicates its type. The staticmake function is invoked by an overloaded
operator function when creating its children.
--- 1096,1102 ----
};
The Scalar class stores the scalar
value. The CreateLeaf's Leaf_t type
! indicates its type. The staticmake function is invoked by an overloaded
operator function when creating its children.
*************** CreateLeaf<Array<D1,T1,E1> >
*** 1149,1155 ****
programmers to store trees in different formats. The &pooma;
implementation stores them as Expressions. The
function's return type is similar to the
! return statement except it extracts the
type from Expression's internal
Expression_t type.
--- 1149,1155 ----
programmers to store trees in different formats. The &pooma;
implementation stores them as Expressions. The
function's return type is similar to the
! return statement except it extracts the
type from Expression's internal
Expression_t type.
*************** classes
*** 1171,1178 ****
Inside the &array; class definition, each such operator just
invokes the assign function with a
corresponding function object. For example,
! operator+= invokes assign(*this,
! rhs, OpAddAssign()). rhs is the
parse tree object for the right-hand side. Calling this function
invokes evaluate, which begins the
evaluation.
--- 1171,1178 ----
Inside the &array; class definition, each such operator just
invokes the assign function with a
corresponding function object. For example,
! operator+= invokes assign(*this,
! rhs, OpAddAssign()). rhs is the
parse tree object for the right-hand side. Calling this function
invokes evaluate, which begins the
evaluation.
*************** for (int i = a's domain[0].first(); i <
*** 1204,1210 ****
assignment operation, and rhs is the right-hand
side's parse tree.
! Evaluating rhs.read(i) inlines into a
call to the forEach function. This function
performs a compile-time post-order parse-tree
traversal. Its general form is
--- 1204,1210 ----
assignment operation, and rhs is the right-hand
side's parse tree.
! Evaluating rhs.read(i) inlines into a
call to the forEach function. This function
performs a compile-time post-order parse-tree
traversal. Its general form is
*************** struct ForEach<UnaryNode<Op, A>
*** 1249,1255 ****
};
Since this structure is specialized for
UnaryNodes, the first parameter of its
! static apply function
is a UnaryNode. After recursively calling its child,
it invokes the combination function indicated by the
Combine1 traits class. In our example, the
--- 1249,1255 ----
};
Since this structure is specialized for
UnaryNodes, the first parameter of its
! static apply function
is a UnaryNode. After recursively calling its child,
it invokes the combination function indicated by the
Combine1 traits class. In our example, the
Index: glossary.xml
===================================================================
RCS file: /home/pooma/Repository/r2/docs/manual/glossary.xml,v
retrieving revision 1.9
diff -c -p -r1.9 glossary.xml
*** glossary.xml 2002/01/25 02:28:26 1.9
--- glossary.xml 2002/01/30 23:47:32
***************
*** 227,233 ****
describes an expression involving a (non-singleton) subset
of a container's values. For example,
! sin(&container;) is an expression
indicating that the sin is applied to each
value in container &container;.element wise
--- 227,233 ----
describes an expression involving a (non-singleton) subset
of a container's values. For example,
! sin(&container;) is an expression
indicating that the sin is applied to each
value in container &container;.element wise
***************
*** 305,311 ****
element wisedescribes accesses to individual values within a container.
! For example, &container(-4,3) represents one
particular value in the container &container;.data parallelrelation
--- 305,311 ----
element wisedescribes accesses to individual values within a container.
! For example, &container(-4,3) represents one
particular value in the container &container;.data parallelrelation
***************
*** 413,419 ****
object that can behave as a function. The object can store
values that the function uses. If its function is called
! operator(), the object can be invoked as
a function.
--- 413,419 ----
object that can behave as a function. The object can store
values that the function uses. If its function is called
! operator(), the object can be invoked as
a function.
*************** guard layer
*** 602,608 ****
function defining a function invoked using a &cc; operator. For
example, the operator+ function defines the
! result of using the +.
--- 602,608 ----
function defining a function invoked using a &cc; operator. For
example, the operator+ function defines the
! result of using the +.
*************** guard layer
*** 814,822 ****
template instantiation
applying a template class to template parameter arguments to create a
! type. For example, foo<double,3>
! instantiates template <typename T, int n> class
! foo with the type &double; and the constant
integer 3. Template instantiation is analogous to applying a
function to function arguments.
template
--- 814,822 ----
template instantiation
applying a template class to template parameter arguments to create a
! type. For example, foo<double,3>
! instantiates template <typename T, int n> class
! foo with the type &double; and the constant
integer 3. Template instantiation is analogous to applying a
function to function arguments.
template
Index: introduction.xml
===================================================================
RCS file: /home/pooma/Repository/r2/docs/manual/introduction.xml,v
retrieving revision 1.6
diff -c -p -r1.6 introduction.xml
*** introduction.xml 2002/01/30 23:09:06 1.6
--- introduction.xml 2002/01/30 23:47:32
*************** A += -B + 2 * C;
*** 298,305 ****
where A and C are
vector<double>s and B is a
vector<int>. &naivecap; evaluation might introduce
! intermediaries for -B,
! 2*C, and their sum. The presence of these
intermediaries in inner loops can measurably slow performance. To
produce a loop without intermediaries, &pete; stores each expression
as a parse tree. Using its templates, the parse tree is
--- 298,305 ----
where A and C are
vector<double>s and B is a
vector<int>. &naivecap; evaluation might introduce
! intermediaries for -B,
! 2*C, and their sum. The presence of these
intermediaries in inner loops can measurably slow performance. To
produce a loop without intermediaries, &pete; stores each expression
as a parse tree. Using its templates, the parse tree is
Index: manual.xml
===================================================================
RCS file: /home/pooma/Repository/r2/docs/manual/manual.xml,v
retrieving revision 1.12
diff -c -p -r1.12 manual.xml
*** manual.xml 2002/01/30 23:09:06 1.12
--- manual.xml 2002/01/30 23:47:35
***************
*** 108,114 ****
Engine">
! false">
Field">
--- 108,114 ----
Engine">
! false">
Field">
***************
*** 157,163 ****
Tensor">
! true">
Vector">
--- 157,163 ----
Tensor">
! true">
Vector">
***************
*** 446,454 ****
and accessor functions returning individual elements. The &pooma;
&engine; class and its specializations implement the engine
concept. Given an index within the domain, an &engine;'s
! operator() function returns the
associated value, which can be used or changed. Its
! read member function returns the same
value but permitting only use, not modification. The acceptable
indices are determined by each &engine;. Most accept indices
specified using ∫ and Loc<&dim;>
--- 446,454 ----
and accessor functions returning individual elements. The &pooma;
&engine; class and its specializations implement the engine
concept. Given an index within the domain, an &engine;'s
! operator() function returns the
associated value, which can be used or changed. Its
! read member function returns the same
value but permitting only use, not modification. The acceptable
indices are determined by each &engine;. Most accept indices
specified using ∫ and Loc<&dim;>
***************
*** 499,505 ****
Thus, copying an &engine; or a container requires little execution
time. If an &engine; has the same data as another &engine; but it
needs its own data to modify, the
! makeOwnCopy member function creates such
a copy.
&engine;s are rarely explicitly declared. Instead a
--- 499,505 ----
Thus, copying an &engine; or a container requires little execution
time. If an &engine; has the same data as another &engine; but it
needs its own data to modify, the
! makeOwnCopy member function creates such
a copy.&engine;s are rarely explicitly declared. Instead a
***************
*** 517,524 ****
&brick; &engine; tag indicates a &brick; &engine; should be used.
Some &engine;s, such as CompFwd, are rarely declared
even using &engine; tags. Instead the &array;'s
! comp and
! readComp member functions return views of
containers using CompFwd &engine;s.
--- 517,524 ----
&brick; &engine; tag indicates a &brick; &engine; should be used.
Some &engine;s, such as CompFwd, are rarely declared
even using &engine; tags. Instead the &array;'s
! comp and
! readComp member functions return views of
containers using CompFwd &engine;s.
***************
*** 569,575 ****
CompFwdextracts specified components of an engine's vectors,
tensors, arrays, etc.; usually created using the
! comp container function.ConstantFunction
--- 569,575 ----
CompFwdextracts specified components of an engine's vectors,
tensors, arrays, etc.; usually created using the
! comp container function.ConstantFunction
***************
*** 644,652 ****
value, not every value. Using less storage space may also permit
more useful values to be stored in cache, improving cache
performance. Reading a value in a compressed &engine; using the
! read member function is as fast as
reading a value in a &brick; &engine;, but writing a value always
! requires executing an additional if
conditional. Thus, if an &engine; infrequently has multiple
different values during its life time, a &compressiblebrick;
&engine; may be faster than a &brick; &engine;. If an &engine; is
--- 644,652 ----
value, not every value. Using less storage space may also permit
more useful values to be stored in cache, improving cache
performance. Reading a value in a compressed &engine; using the
! read member function is as fast as
reading a value in a &brick; &engine;, but writing a value always
! requires executing an additional if
conditional. Thus, if an &engine; infrequently has multiple
different values during its life time, a &compressiblebrick;
&engine; may be faster than a &brick; &engine;. If an &engine; is
***************
*** 664,683 ****
distributed computing.
Both &brick; and &compressiblebrick; &engine;s have
! read and
! operator() member functions taking ∫
and &loc; parameters. The parameters should match the &array;'s
dimensionality. For example, if &array; a has
dimensionality 3, a.read(int, int, int)
and a(int, int, int) should be used. The
former returns a value that cannot be modified, while the latter
! can be changed. Using the read member
function can lead to faster code. Alternatively, an index can be
specified using a &loc;. For example,
! a.read(Loc<3>(1,-2,5)) and
! a(Loc<3>(1,-2,5)) are equivalent to
! a.read(1,-2,5)) and
! a(1,-2,5).The &dynamic; &engine; supports changing domain sizes while
a program is executing. It is basically a one-dimensional
--- 664,683 ----
distributed computing.Both &brick; and &compressiblebrick; &engine;s have
! read and
! operator() member functions taking ∫
and &loc; parameters. The parameters should match the &array;'s
dimensionality. For example, if &array; a has
dimensionality 3, a.read(int, int, int)
and a(int, int, int) should be used. The
former returns a value that cannot be modified, while the latter
! can be changed. Using the read member
function can lead to faster code. Alternatively, an index can be
specified using a &loc;. For example,
! a.read(Loc<3>(1,-2,5)) and
! a(Loc<3>(1,-2,5)) are equivalent to
! a.read(1,-2,5)) and
! a(1,-2,5).The &dynamic; &engine; supports changing domain sizes while
a program is executing. It is basically a one-dimensional
***************
*** 685,695 ****
order of stored values to change. Thus, it supports the same
interface as &brick; except that all member functions are
restricted to their one-dimensional versions. For example,
! read and
! operator() take Loc<1>
or one ∫ parameter. In addition, the one-dimensional domain
! can be dynamically resized using create
! and destroy.
read and
! operator() take Loc<1>
or one ∫ parameter. In addition, the one-dimensional domain
! can be dynamically resized using create
! and destroy.
The last statement creates ten views. For example,
! a(I,J) creates a view of
a using the smaller domain specified by
I and J. This omits the
outermost rows of columns of a. The views
of b illustrate the use of views in
! data-parallel statements. b(I-1,J-1) has a
subset shifted up one row and left one column compared with
! b(I,J).
]]>
Be sure to list the various arithmetic operations on domains
--- 809,822 ----
b(I-1,J+1) + b(I-1,J ) + b(I-1,J-1));
The last statement creates ten views. For example,
! a(I,J) creates a view of
a using the smaller domain specified by
I and J. This omits the
outermost rows of columns of a. The views
of b illustrate the use of views in
! data-parallel statements. b(I-1,J-1) has a
subset shifted up one row and left one column compared with
! b(I,J).
]]>
Be sure to list the various arithmetic operations on domains
*************** UNFINISHED
*** 1601,1607 ****
where A, B and
C are &array;s and foo is
a function taking an &array; as an argument. The expression
! A*B+C
will only be evaluated by the expression engine as needed by
foo.
--- 1601,1607 ----
where A, B and
C are &array;s and foo is
a function taking an &array; as an argument. The expression
! A*B+C
will only be evaluated by the expression engine as needed by
foo.
*************** UNFINISHED
*** 1718,1724 ****
incorrect. To help diagnose if calls to
Pooma::blockAndEvaluate are missing, invoke
a &pooma; executable with the
! &dashdash;pooma-blocking-expressions option.
This automatically causes
Pooma::blockAndEvaluate to be called after
each statement. Doing so ensures program correctness, but it
--- 1718,1724 ----
incorrect. To help diagnose if calls to
Pooma::blockAndEvaluate are missing, invoke
a &pooma; executable with the
! &dashdash;pooma-blocking-expressions option.
This automatically causes
Pooma::blockAndEvaluate to be called after
each statement. Doing so ensures program correctness, but it
*************** UNFINISHED
*** 1728,1741 ****
important than execution speed.
If using
! &dashdash;pooma-blocking-expressions changes a
program's output, it is missing one or more calls to
Pooma::blockAndEvaluate. To narrow the
region with a missing call, surround the region in question with
! calls to Pooma::blockingExpressions(true)
! and Pooma::blockingExpressions(false),
but do not use the
! &dashdash;pooma-blocking-expressions option.
Within the region, Pooma::blockAndEvaluate
will be invoked after each statement. Repeatedly reducing the
region's size should reveal where calls are missing.
--- 1728,1741 ----
important than execution speed.
If using
! &dashdash;pooma-blocking-expressions changes a
program's output, it is missing one or more calls to
Pooma::blockAndEvaluate. To narrow the
region with a missing call, surround the region in question with
! calls to Pooma::blockingExpressions(true)
! and Pooma::blockingExpressions(false),
but do not use the
! &dashdash;pooma-blocking-expressions option.
Within the region, Pooma::blockAndEvaluate
will be invoked after each statement. Repeatedly reducing the
region's size should reveal where calls are missing.
*************** UNFINISHED
*** 1767,1773 ****
class="libraryfile">.cmpl.cpp, .mk, .conf. Should we also explain use
! of inline even when necessary and the template
model, e.g., including .cpp files.
--- 1767,1773 ----
class="libraryfile">.cmpl.cpp, .mk, .conf. Should we also explain use
! of inline even when necessary and the template
model, e.g., including .cpp files.
*************** UNFINISHED
*** 2090,2096 ****
! Array
--- 2090,2096 ----
! Array
*************** UNFINISHED
*** 2100,2106 ****
! ArrayconstEngine_t&engine
--- 2100,2106 ----
! ArrayconstEngine_t&engine
*************** UNFINISHED
*** 2114,2120 ****
! Arrayconst Engine<Dim2, T2, EngineTag2>&
--- 2114,2120 ----
! Arrayconst Engine<Dim2, T2, EngineTag2>&
*************** UNFINISHED
*** 2162,2168 ****
! Element_tread
--- 2162,2168 ----
! Element_tread
*************** UNFINISHED
*** 2171,2177 ****
! Element_treadconstSub1&s1
--- 2171,2177 ----
! Element_treadconstSub1&s1
*************** UNFINISHED
*** 2189,2195 ****
! Element_toperator()constSub1&s1
--- 2189,2195 ----
! Element_toperator()constSub1&s1
*************** UNFINISHED
*** 2200,2207 ****
! How does this differ from read(const
! Sub1& s1, const Sub2& s2)? ADD ALL reads and
--- 2200,2207 ----
! How does this differ from read(const
! Sub1& s1, const Sub2& s2)? ADD ALL reads and
*************** UNFINISHED
*** 2218,2231 ****
When an array stores elements having components, e.g., an
array of vectors, tensors, or arrays, the
! comp returns an array consisting of the
specified components. The original and component array share the
same engine so changing the values in one affects values in the
other.For example, if &n; × &n; array a
consists of three-dimensional real-valued vectors,
! a.comp(1) returns a &n; × &n;
real-valued array of all the middle vector components. Assigning
to the component array will also modify the middle components of
the vectors in a.
--- 2218,2231 ----
When an array stores elements having components, e.g., an
array of vectors, tensors, or arrays, the
! comp returns an array consisting of the
specified components. The original and component array share the
same engine so changing the values in one affects values in the
other.For example, if &n; × &n; array a
consists of three-dimensional real-valued vectors,
! a.comp(1) returns a &n; × &n;
real-valued array of all the middle vector components. Assigning
to the component array will also modify the middle components of
the vectors in a.
*************** UNFINISHED
*** 2245,2251 ****
! UNKNOWN compute thiscompconstint&
--- 2245,2251 ----
! UNKNOWN compute thiscompconstint&
*************** UNFINISHED
*** 2256,2262 ****
unknown: See line 1989.
! ADD ALL comps.
--- 2256,2262 ----
unknown: See line 1989.
! ADD ALL comps.
*************** UNFINISHED
*** 2281,2287 ****
! intfirstintd
--- 2281,2287 ----
! intfirstintd
*************** UNFINISHED
*** 2292,2298 ****
ADD ALL other accessor methods, including
! engine.
--- 2292,2298 ----
ADD ALL other accessor methods, including
! engine.
*************** UNFINISHED
*** 2327,2333 ****
! voidmakeOwnCopy
--- 2327,2333 ----
! voidmakeOwnCopy
*************** UNFINISHED
*** 2346,2353 ****
Implementation DetailsAs a container, an &array;'s implementation is quite
! simple. Its privatedata consists of
! an engine, and it has no private
functions.
Implementation Details
As a container, an &array;'s implementation is quite
! simple. Its privatedata consists of
! an engine, and it has no private
functions.
*** 2406,2413 ****
Implementation DetailsDynamicArray has no
! protected or
! private members.
--- 2406,2413 ----
Implementation DetailsDynamicArray has no
! protected or
! private members.
*************** UNFINISHED
*** 2456,2462 ****
In &pooma;, expressions may contain entire &array;s. That
is, &array;s are first-class objects with respect to expressions.
For example, given &array;s a and
! b, the expression a + b
is equivalent to an array containing the element-wise sum of the
two arrays.
--- 2456,2462 ----
In &pooma;, expressions may contain entire &array;s. That
is, &array;s are first-class objects with respect to expressions.
For example, given &array;s a and
! b, the expression a + b
is equivalent to an array containing the element-wise sum of the
two arrays.
*************** UNFINISHED
*** 2696,2702 ****
Element AccessADD: a table ala &array;. Be sure to include
! all.
--- 2696,2702 ----
Element AccessADD: a table ala &array;. Be sure to include
! all.
*************** UNFINISHED
*** 2718,2726 ****
See src/Field/Field.h's
! operator[],
! subField, …,
! material.
--- 2718,2726 ----
See src/Field/Field.h's
! operator[],
! subField, …,
! material.
*************** UNFINISHED
*** 2728,2737 ****
Supporting RelationsADD: a table with the member functions including
! addRelation,
! removeRelations,
! applyRelations, and
! setDirty.
--- 2728,2737 ----
Supporting RelationsADD: a table with the member functions including
! addRelation,
! removeRelations,
! applyRelations, and
! setDirty.
*************** UNFINISHED
*** 2747,2753 ****
Utility MethodsADD: a table including
! makeOwnCopy.
--- 2747,2753 ----
Utility MethodsADD: a table including
! makeOwnCopy.
*************** UNFINISHED
*** 2767,2773 ****
Be sure to relate to &array; views. Note only three
dimensions are supported.
! Be sure to describe f[i]. Does this
refer to a particular material or a particular value within a
cell? I do not remember. See SubFieldView in
src/Field/Field.h.
--- 2767,2773 ----
Be sure to relate to &array; views. Note only three
dimensions are supported.
! Be sure to describe f[i]. Does this
refer to a particular material or a particular value within a
cell? I do not remember. See SubFieldView in
src/Field/Field.h.
*************** UNFINISHED
*** 3180,3187 ****
Element Access
! ADD: a table with read and
! operator().
--- 3180,3187 ----
Element Access
! ADD: a table with read and
! operator().
*************** UNFINISHED
*** 3204,3213 ****
Utility MethodsADD: a table including
! makeOwnCopy.
! QUESTION: What are dataObject,
! isShared, and related methods?
--- 3204,3213 ----
Utility MethodsADD: a table including
! makeOwnCopy.
! QUESTION: What are dataObject,
! isShared, and related methods?
*************** UNFINISHED
*** 3226,3232 ****
ADD: description of what a brick means. ADD: whatever
specializations the class has, e.g.,
! offset.QUESTION: What does DoubleSliceHelper do?
--- 3226,3232 ----
ADD: description of what a brick means. ADD: whatever
specializations the class has, e.g.,
! offset.QUESTION: What does DoubleSliceHelper do?
*************** UNFINISHED
*** 3375,3381 ****
created by Pooma::initialize, storing
run-time configurable values found in argv.
Default options are found in
! Options::usage.
See src/Utilities/Options.h and
--- 3375,3381 ----
created by Pooma::initialize, storing
run-time configurable values found in argv.
Default options are found in
! Options::usage.See src/Utilities/Options.h and
*************** UNFINISHED
*** 3593,3599 ****
class="headerfile">src/Utilities/DerefIterator.h:
DerefIterator<T> and
ConstDerefIterator<T> automatically
! dereference themselves to maintain const
correctness.
--- 3593,3599 ----
class="headerfile">src/Utilities/DerefIterator.h:
DerefIterator<T> and
ConstDerefIterator<T> automatically
! dereference themselves to maintain const
correctness.
*************** UNFINISHED
*** 3896,3902 ****
modification. However, if you are using &mm;, ensure
shmem_default_dir specifies its location.
For example, the &author; modified the value to
! "/home/oldham/pooma/mm-1.1.3".
Prepare to compile the source code by configuring it
--- 3896,3902 ----
modification. However, if you are using &mm;, ensure
shmem_default_dir specifies its location.
For example, the &author; modified the value to
! "/home/oldham/pooma/mm-1.1.3".Prepare to compile the source code by configuring it
Index: template.xml
===================================================================
RCS file: /home/pooma/Repository/r2/docs/manual/template.xml,v
retrieving revision 1.4
diff -c -p -r1.4 template.xml
*** template.xml 2002/01/30 23:09:06 1.4
--- template.xml 2002/01/30 23:47:36
***************
*** 95,101 ****
its dimension, the type of its values, and its &engine; type. To
use this, a programmer specifies values for the template
parameters:
! Array<2,double,Brick>
specifies a dimension of 2, a value type of &double;, and the
&brick; &engine; type. At compile time, the compiler creates a
type definition by substituting the values for the template
--- 95,101 ----
its dimension, the type of its values, and its &engine; type. To
use this, a programmer specifies values for the template
parameters:
! Array<2,double,Brick>
specifies a dimension of 2, a value type of &double;, and the
&brick; &engine; type. At compile time, the compiler creates a
type definition by substituting the values for the template
***************
*** 195,201 ****
these concrete types with a template
parameter T. We
precede, not follow, the class definition
! with template <typename T>. The
constructor's parameters' types are changed
to T, as are the data members'
types.
--- 195,201 ----
these concrete types with a template
parameter T. We
precede, not follow, the class definition
! with template <typename T>. The
constructor's parameters' types are changed
to T, as are the data members'
types.
***************
*** 223,236 ****
arearefs="template_programming-template_use-templated_pair_program-use">
To use a templated class, specify the template
parameter's argument after the class's name and surrounded by
! angle brackets (<>).To use a template class definition, template arguments
follow the class name surrounded by angle
! brackets (<>). For example,
pair<int>instantiates
--- 223,236 ----
arearefs="template_programming-template_use-templated_pair_program-use">
To use a templated class, specify the template
parameter's argument after the class's name and surrounded by
! angle brackets (<>).To use a template class definition, template arguments
follow the class name surrounded by angle
! brackets (<>). For example,
pair<int>instantiates
***************
*** 242,249 ****
creates a definition for pair<int> by copying
pair's template definition and substituting
∫ for each occurrence of T. The copy
! omits the template parameter declaration template
! <typename T> at the beginning of its definition.
The result is a definition exactly the same as
pairOfInts.
--- 242,249 ----
creates a definition for pair<int> by copying
pair's template definition and substituting
∫ for each occurrence of T. The copy
! omits the template parameter declaration template
! <typename T> at the beginning of its definition.
The result is a definition exactly the same as
pairOfInts.
***************
*** 273,279 ****
compile-time operations use these types. For both run-time and
compile-time programming, &cc; defines default sets of values that
all conforming compilers must support. For example,
! 3 and 6.022e+23 are
run-time values that any &cc; compiler must accept. It must also
accept the ∫, &bool;, and int* types.
--- 273,279 ----
compile-time operations use these types. For both run-time and
compile-time programming, &cc; defines default sets of values that
all conforming compilers must support. For example,
! 3 and 6.022e+23 are
run-time values that any &cc; compiler must accept. It must also
accept the ∫, &bool;, and int* types.
*************** maxOut(0, 3);
*** 422,450 ****
with the templated class in .
Note the notation for the template class parameters.
! template <typename T>precedes the class definition. The keyword
! typename
! typename
indicates the template
parameter is a type. T is the template
parameter's name. (We could have used any other identifier such
as pairElementType or foo.)
! Note that using class
! class
is equivalent to
! using typename so template
! <class T> is equivalent to template
! <typename T>. While declaring a template class
requires prefix notation, using a templated class requires postfix
notation. The class's name precedes angle
brackets (<>) surrounding specific values, i.e., types,
for its parameters. As we showed above,
! pair<int>instantiatestemplate
--- 422,450 ----
with the templated class in .
Note the notation for the template class parameters.
! template <typename T>precedes the class definition. The keyword
! typename
! typename
indicates the template
parameter is a type. T is the template
parameter's name. (We could have used any other identifier such
as pairElementType or foo.)
! Note that using class
! class
is equivalent to
! using typename so template
! <class T> is equivalent to template
! <typename T>. While declaring a template class
requires prefix notation, using a templated class requires postfix
notation. The class's name precedes angle
brackets (<>) surrounding specific values, i.e., types,
for its parameters. As we showed above,
! pair<int>instantiatestemplate
*************** maxOut(0, 3);
*** 471,479 ****
domain:
typedef typename Engine_t::Domain_t Domain_t;
! This typedef,
! typedeftype, definition.
--- 471,479 ----
domain:
typedef typename Engine_t::Domain_t Domain_t;
! This typedef,
! typedeftype, definition.
*************** typedef typename Engine_t::Domain_t Doma
*** 483,491 ****
i.e., type
definition, defines the type Domain_t as equivalent
to Engine_t::Domain_t. The
! :: operator
! :: operator
selects the Domain_t nested type from inside the
Engine_t type. This illustrates how to access
--- 483,491 ----
i.e., type
definition, defines the type Domain_t as equivalent
to Engine_t::Domain_t. The
! :: operator
! :: operator
selects the Domain_t nested type from inside the
Engine_t type. This illustrates how to access
*************** typedef typename Engine_t::Domain_t Doma
*** 544,557 ****
operations on values
! Integral values support +,
! -, >,
! ==, …. String values support
! [], ==, ….Types may be declared and used. Constant integral and
! enumeration values can be combined using +,
! -, >,
! ==, …. There are no permitted
operations on code.
--- 544,557 ----
operations on values
! Integral values support +,
! -, >,
! ==, …. String values support
! [], ==, ….Types may be declared and used. Constant integral and
! enumeration values can be combined using +,
! -, >,
! ==, …. There are no permitted
operations on code.
*************** typedef typename Engine_t::Domain_t Doma
*** 572,586 ****
extracting values from collectionsAn object's named values are extracted using the
! . operator.
! . operatorA class's nested types and classes are extracted using
! the :: operator.
! :: operator
--- 572,586 ----
extracting values from collectionsAn object's named values are extracted using the
! . operator.
! . operatorA class's nested types and classes are extracted using
! the :: operator.
! :: operator
*************** typedef typename Engine_t::Domain_t Doma
*** 590,596 ****
control flow
to choose among operations
! if, while, goto, …template class specializations with pattern matching
--- 590,596 ----
control flow
to choose among operations
! if, while, goto, …template class specializations with pattern matching
*************** typedef typename Engine_t::Domain_t Doma
*** 609,615 ****
The only compile-time values described in the previous
section were types, but any compile-time constant can also be used.
! Integral literals, const variables, and
other constructs can be used, but the main use is enumerations.
An enumeration
--- 609,615 ----
The only compile-time values described in the previous
section were types, but any compile-time constant can also be used.
! Integral literals, const variables, and
other constructs can be used, but the main use is enumerations.
An enumeration
*************** struct usuallySimpleClass {
*** 741,747 ****
should be true only if the constructor must perform some very
complicated, time-expensive computation. When instantiated with
&false;, the compiler substitutes this value into the template
! class definition. Since the if
statement's conditional is false, the compiler optimizer can
eliminate the statement, yielding internal code similar to
--- 741,747 ----
should be true only if the constructor must perform some very
complicated, time-expensive computation. When instantiated with
&false;, the compiler substitutes this value into the template
! class definition. Since the if
statement's conditional is false, the compiler optimizer can
eliminate the statement, yielding internal code similar to
*************** struct usuallySimpleClass<false> {
*** 774,791 ****
Each category of values supports a
distinct set of operations. For example, the run-time category of
! integer values supports combination using +
! and - and comparison using
! > and ==. At run
time, the category of strings can be compared using
! == and characters can be extracted using
! subscripts with the [] operator. Compile-time
operations are more limited. Types may be declared and used. The
! sizeof operator yields the number of
bytes to represent an object of the specified type. Enumerations,
! constant integers, sizeof expressions,
and simple arithmetic and comparison operators such as
! + and == can form
constant expressions that can be used at compile time. These
values can initialize enumerations and integer constants and be
used as template arguments. At compile time, pointers and
--- 774,791 ----
Each category of values supports a
distinct set of operations. For example, the run-time category of
! integer values supports combination using +
! and - and comparison using
! > and ==. At run
time, the category of strings can be compared using
! == and characters can be extracted using
! subscripts with the [] operator. Compile-time
operations are more limited. Types may be declared and used. The
! sizeof operator yields the number of
bytes to represent an object of the specified type. Enumerations,
! constant integers, sizeof expressions,
and simple arithmetic and comparison operators such as
! + and == can form
constant expressions that can be used at compile time. These
values can initialize enumerations and integer constants and be
used as template arguments. At compile time, pointers and
*************** struct usuallySimpleClass<false> {
*** 809,822 ****
can store multiple values, each
having its own name. For example, a pair<int>
object p stores two ∫s named
! left_ and
! right_. The .
operator
! . operator
extracts a named member from an object:
! p.left_. At compile time, a class can
store multiple values, each having its own name. These are
sometimes called traits
--- 809,822 ----
can store multiple values, each
having its own name. For example, a pair<int>
object p stores two ∫s named
! left_ and
! right_. The .
operator
! . operator
extracts a named member from an object:
! p.left_. At compile time, a class can
store multiple values, each having its own name. These are
sometimes called traits
*************** struct ExpressionTraits<BinaryNode<
*** 848,863 ****
! :: operator
! The example also illustrates using the ::
operator to extract a member of a traits class. The type
ExpressionTraits<Left> contains an internal
type definition of Type_t. Using the
! :: operator extracts it:
! ExpressionTraits<Left>::Type_t.
Enumerations and other values can also be extracted. For example,
! Array<2, int, Brick>::dimensions
yields the dimension of the array's domain.
--- 848,863 ----
! :: operator
! The example also illustrates using the ::
operator to extract a member of a traits class. The type
ExpressionTraits<Left> contains an internal
type definition of Type_t. Using the
! :: operator extracts it:
! ExpressionTraits<Left>::Type_t.
Enumerations and other values can also be extracted. For example,
! Array<2, int, Brick>::dimensions
yields the dimension of the array's domain.
*************** struct ExpressionTraits<BinaryNode<
*** 869,877 ****
control flow
Control flow determines which code is used. At run time,
! control-flow statements such as if,
! while, and
! goto determine which statements to
execute. Template programming uses two mechanisms: template class
specializations and pattern matching. These are similar to
control flow in functional programming languages. A control flow
Control flow determines which code is used. At run time,
! control-flow statements such as if,
! while, and
! goto determine which statements to
execute. Template programming uses two mechanisms: template class
specializations and pattern matching. These are similar to
control flow in functional programming languages. A Expression<int>.Control flow using template specializations and pattern
! matching is similar to switch
statements.
! switch
! A switch statement has a
condition and one or more pairs of case labels and associated
code. The code associated with the the case label whose value
matches the condition is executed. If no case label matches the
--- 932,943 ----
Expression<int>.Control flow using template specializations and pattern
! matching is similar to switch
statements.
! switch
! A switch statement has a
condition and one or more pairs of case labels and associated
code. The code associated with the the case label whose value
matches the condition is executed. If no case label matches the
*************** CreateLeaf<Expression<int&closeclo
*** 949,959 ****
the condition. The set of template parameters for the indicated
template class, e.g., CreateLeaf, are analogous to
the case labels, and each has an associated definition. In our
! example, the set of template parameters are <class
! T> and <Expression<class
! T&closeclose;. The best match, if any,
indicates the matching code that will be used. In our example,
! the <class T> parameter serves as the
default label since it matches any arguments. If no set of
template parameters match (which is impossible for our example) or
if more than one set are best matches, the code is
--- 949,959 ----
the condition. The set of template parameters for the indicated
template class, e.g., CreateLeaf, are analogous to
the case labels, and each has an associated definition. In our
! example, the set of template parameters are <class
! T> and <Expression<class
! T&closeclose;. The best match, if any,
indicates the matching code that will be used. In our example,
! the <class T> parameter serves as the
default label since it matches any arguments. If no set of
template parameters match (which is impossible for our example) or
if more than one set are best matches, the code is
*************** class F {
*** 1012,1018 ****
Both the templated class and the templated function
take the same template arguments, but the class uses a static
member function. Thus, the notation to invoke it is slightly more
! verbose: F<T>::f(t).
--- 1012,1018 ----
Both the templated class and the templated function
take the same template arguments, but the class uses a static
member function. Thus, the notation to invoke it is slightly more
! verbose: F<T>::f(t).
*************** class F {
*** 1025,1031 ****
The advantage of a function template is that it can be overloaded,
particularly operator functions. For example, the
! + operator is overloaded to add two &array;s,
which require template parameters to specify:
template <int D1,class T1,class E1,
--- 1025,1031 ----
The advantage of a function template is that it can be overloaded,
particularly operator functions. For example, the
! + operator is overloaded to add two &array;s,
which require template parameters to specify:
template <int D1,class T1,class E1,
*************** template <int D1,class T1,class E1,
*** 1034,1041 ****
operator+(const Array<D1,T1,E1> & l,
const Array<D2,T2,E2> & r);
Without using function templates, it would not be
! possible to write expressions such as a1 +
! a2. Member functions can also be templated. This
permits, for example, overloading of assignment operators defined
within templated classes.
--- 1034,1041 ----
operator+(const Array<D1,T1,E1> & l,
const Array<D2,T2,E2> & r);
Without using function templates, it would not be
! possible to write expressions such as a1 +
! a2. Member functions can also be templated. This
permits, for example, overloading of assignment operators defined
within templated classes.
Index: tutorial.xml
===================================================================
RCS file: /home/pooma/Repository/r2/docs/manual/tutorial.xml,v
retrieving revision 1.9
diff -c -p -r1.9 tutorial.xml
*** tutorial.xml 2002/01/30 23:09:06 1.9
--- tutorial.xml 2002/01/30 23:47:37
***************
*** 215,221 ****
value is assigned the average of its corresponding value in
b and the latter's neighbors. Values in the
two-dimensional grids are accessed using two sets of brackets, e.g.,
! a[i][j]. After assigning values to
a, a second averaging reads values in
a, writing values in b.
--- 215,221 ----
value is assigned the average of its corresponding value in
b and the latter's neighbors. Values in the
two-dimensional grids are accessed using two sets of brackets, e.g.,
! a[i][j]. After assigning values to
a, a second averaging reads values in
a, writing values in b.
***************
*** 250,256 ****
Initially, all grid values are zero except for the one
nonzero value at the center of the second array. Array
positions are indicated using two brackets, e.g.,
! a[i][j]. A better implementation might
initialize only the outermost values of the
a array.
--- 250,256 ----
Initially, all grid values are zero except for the one
nonzero value at the center of the second array. Array
positions are indicated using two brackets, e.g.,
! a[i][j]. A better implementation might
initialize only the outermost values of the
a array.
***************
*** 335,342 ****
its value type, and how the values will be stored or computed.
The &brick; &engine; type indicates values will be directly
stored. It is responsible for allocating and deallocating
! storage so new and
! delete statements are not necessary.
The vertDomain specifies the array index
domain.
--- 335,342 ----
its value type, and how the values will be stored or computed.
The &brick; &engine; type indicates values will be directly
stored. It is responsible for allocating and deallocating
! storage so new and
! delete statements are not necessary.
The vertDomain specifies the array index
domain.
***************
*** 345,351 ****
same scalar value. The second statement
illustrates assigning one &array; value. Indices, separated by
commas, are surrounded by parentheses rather than surrounded by
! square brackets ([]).
&array; element access uses parentheses, rather than
--- 345,351 ----
same scalar value. The second statement
illustrates assigning one &array; value. Indices, separated by
commas, are surrounded by parentheses rather than surrounded by
! square brackets ([]).&array; element access uses parentheses, rather than
***************
*** 394,413 ****
&array;s support both element-wise access and scalar
assignment. Element-wise access uses parentheses, not square
! brackets. For example, b(n/2,n/2)
! specifies the central element. The scalar assignment b
! = 0.0 assigns the same 0.0 value to all array
elements. This is possible because the array knows the extent of
its domain. We illustrate these data-parallel statements in the
next section.Any program using the &poomatoolkit; must initialize the
&toolkit;'s data structures using
! Pooma::initialize(argc,argv). This extracts
&pooma;-specific command-line options from the program's
command-line arguments and initializes the interprocessor
communication and other data structures. When finished,
! Pooma::finalize() ensures all computation and
communication has finished and the data structures are
destructed.
--- 394,413 ----
&array;s support both element-wise access and scalar
assignment. Element-wise access uses parentheses, not square
! brackets. For example, b(n/2,n/2)
! specifies the central element. The scalar assignment b
! = 0.0 assigns the same 0.0 value to all array
elements. This is possible because the array knows the extent of
its domain. We illustrate these data-parallel statements in the
next section.Any program using the &poomatoolkit; must initialize the
&toolkit;'s data structures using
! Pooma::initialize(argc,argv). This extracts
&pooma;-specific command-line options from the program's
command-line arguments and initializes the interprocessor
communication and other data structures. When finished,
! Pooma::finalize() ensures all computation and
communication has finished and the data structures are
destructed.
***************
*** 443,449 ****
Data-parallel expressions replace nested loops and array
! element accesses. For example, a(I,J)
represents the subset of the a array having
a domain equal to the Cartesian product of I
and J. Intervals can shifted by an additive
--- 443,449 ----
Data-parallel expressions replace nested loops and array
! element accesses. For example, a(I,J)
represents the subset of the a array having
a domain equal to the Cartesian product of I
and J. Intervals can shifted by an additive
***************
*** 454,483 ****
Data-parallel expressions use containers and domain objects to
indicate a set of parallel expressions. For example, in the program
! listed above, a(I,J) specifies the subset of
a array omitting the outermost elements. The
array's vertDomain domain consists of the
Cartesian product of {0, 1, 2, …, n-1} with itself, while
I and J each specify {1, 2,
! …, n-2}. Thus, a(I,J) is the subset
with a domain of the Cartesian product of {1, 2, …, n-2} with
itself. It is called a view of an array. It
is itself an &array;, with a domain and supporting element access, but
its storage is the same as a's. Changing a value
! in a(I,J) also changes the same value in
a. Changing a value in the latter also changes
the former if the value is not one of a's
outermost elements. The expression
! b(I+1,J+1) indicates the subset of
b with a domain consisting of the Cartesian
product of {2, 3, …, n-1}, i.e., the same domain as
! a(I,J) but shifted up one unit and to the
right one unit. Only an &interval;'s value, not its name, is
important so all uses of J in this program
could be replaced by I without changing the
semantics.
! The statement assigning to a(I,J)
illustrates that &array;s may participate in expressions. Each
addend is a view of an array, which is itself an array. The views'
indices are zero-based so their sum can be formed by adding
--- 454,483 ----
Data-parallel expressions use containers and domain objects to
indicate a set of parallel expressions. For example, in the program
! listed above, a(I,J) specifies the subset of
a array omitting the outermost elements. The
array's vertDomain domain consists of the
Cartesian product of {0, 1, 2, …, n-1} with itself, while
I and J each specify {1, 2,
! …, n-2}. Thus, a(I,J) is the subset
with a domain of the Cartesian product of {1, 2, …, n-2} with
itself. It is called a view of an array. It
is itself an &array;, with a domain and supporting element access, but
its storage is the same as a's. Changing a value
! in a(I,J) also changes the same value in
a. Changing a value in the latter also changes
the former if the value is not one of a's
outermost elements. The expression
! b(I+1,J+1) indicates the subset of
b with a domain consisting of the Cartesian
product of {2, 3, …, n-1}, i.e., the same domain as
! a(I,J) but shifted up one unit and to the
right one unit. Only an &interval;'s value, not its name, is
important so all uses of J in this program
could be replaced by I without changing the
semantics.
! The statement assigning to a(I,J)
illustrates that &array;s may participate in expressions. Each
addend is a view of an array, which is itself an array. The views'
indices are zero-based so their sum can be formed by adding
***************
*** 581,587 ****
Applying the stencil's function call operator()
yields the computed value. To compute multiple &array; values,
apply a stencil to the array and a domain object:
! stencil(b, interiorDomain). This applies the
stencil to each position in the domain. The user must ensure that
applying the stencil does not access nonexistent &array;
values.
--- 581,587 ----
Applying the stencil's function call operator()
yields the computed value. To compute multiple &array; values,
apply a stencil to the array and a domain object:
! stencil(b, interiorDomain). This applies the
stencil to each position in the domain. The user must ensure that
applying the stencil does not access nonexistent &array;
values.
***************
*** 611,632 ****
To create a stencil object, apply the &stencil; type to a
function object class. For example,
! Stencil<DoofNinePt> stencil declares
the stencil object. The function object class
must define a function call operator() with a
container parameter and index parameters. The number of index
parameters, indicating the stencil's center, must equal the
container's dimension. For example, DoofNinePt defines
! operator()(const C& c, int i, int j). We
templated the container type C although this is
not strictly necessary. The two index parameters
i and j ensure the stencil
works with two-dimensional containers. The
! lowerExtent function indicates how far to
the left (or below) the stencil extends beyond its center. Its
parameter indicates a particular dimension. Index parameters
i and j are in dimension 0
! and 1. upperExtent serves an
analogous purpose. The &poomatoolkit; uses these functions when
distributing computation among various processors, but it does not
use these functions to ensure nonexistent &array; values are not
--- 611,632 ----
To create a stencil object, apply the &stencil; type to a
function object class. For example,
! Stencil<DoofNinePt> stencil declares
the stencil object. The function object class
must define a function call operator() with a
container parameter and index parameters. The number of index
parameters, indicating the stencil's center, must equal the
container's dimension. For example, DoofNinePt defines
! operator()(const C& c, int i, int j). We
templated the container type C although this is
not strictly necessary. The two index parameters
i and j ensure the stencil
works with two-dimensional containers. The
! lowerExtent function indicates how far to
the left (or below) the stencil extends beyond its center. Its
parameter indicates a particular dimension. Index parameters
i and j are in dimension 0
! and 1. upperExtent serves an
analogous purpose. The &poomatoolkit; uses these functions when
distributing computation among various processors, but it does not
use these functions to ensure nonexistent &array; values are not