From Jason Turner

[numarray]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpkqwmksqc/{from.md → to.md} +17 -17
tmp/tmpkqwmksqc/{from.md → to.md} RENAMED
@@ -1,11 +1,11 @@
1
  ## Numeric arrays <a id="numarray">[[numarray]]</a>
2
 
3
  ### Header `<valarray>` synopsis <a id="valarray.syn">[[valarray.syn]]</a>
4
 
5
  ``` cpp
6
- #include <initializer_list>
7
 
8
  namespace std {
9
  template<class T> class valarray; // An array of type T
10
  class slice; // a BLAS-like slice out of an array
11
  template<class T> class slice_array;
@@ -164,11 +164,11 @@ aliasing, thus allowing operations on these classes to be optimized.
164
 
165
  Any function returning a `valarray<T>` is permitted to return an object
166
  of another type, provided all the const member functions of
167
  `valarray<T>` are also applicable to this type. This return type shall
168
  not add more than two levels of template nesting over the most deeply
169
- nested argument type.[^7]
170
 
171
  Implementations introducing such replacement types shall provide
172
  additional functions and operators as follows:
173
 
174
  - for every function taking a `const valarray<T>&` other than `begin`
@@ -289,19 +289,19 @@ elements numbered sequentially from zero. It is a representation of the
289
  mathematical concept of an ordered set of values. For convenience, an
290
  object of type `valarray<T>` is referred to as an “array” throughout the
291
  remainder of  [[numarray]]. The illusion of higher dimensionality may be
292
  produced by the familiar idiom of computed indices, together with the
293
  powerful subsetting capabilities provided by the generalized subscript
294
- operators.[^8]
295
 
296
  #### Constructors <a id="valarray.cons">[[valarray.cons]]</a>
297
 
298
  ``` cpp
299
  valarray();
300
  ```
301
 
302
- *Effects:* Constructs a `valarray` that has zero length.[^9]
303
 
304
  ``` cpp
305
  explicit valarray(size_t n);
306
  ```
307
 
@@ -321,19 +321,19 @@ valarray(const T* p, size_t n);
321
 
322
  *Preconditions:* \[`p`, `p + n`) is a valid range.
323
 
324
  *Effects:* Constructs a `valarray` that has length `n`. The values of
325
  the elements of the array are initialized with the first `n` values
326
- pointed to by the first argument.[^10]
327
 
328
  ``` cpp
329
  valarray(const valarray& v);
330
  ```
331
 
332
  *Effects:* Constructs a `valarray` that has the same length as `v`. The
333
  elements are initialized with the values of the corresponding elements
334
- of `v`.[^11]
335
 
336
  ``` cpp
337
  valarray(valarray&& v) noexcept;
338
  ```
339
 
@@ -444,12 +444,12 @@ evaluates to `true` for all `size_t i` and `size_t j` such that
444
 
445
  The expression `addressof(a[i]) != addressof(b[j])` evaluates to `true`
446
  for any two arrays `a` and `b` and for any `size_t i` and `size_t j`
447
  such that `i < a.size()` and `j < b.size()`.
448
 
449
- [*Note 2*: This property indicates an absence of aliasing and may be
450
- used to advantage by optimizing compilers. Compilers may take advantage
451
  of inlining, constant propagation, loop fusion, tracking of pointers
452
  obtained from `operator new`, and other techniques to generate efficient
453
  `valarray`s. — *end note*]
454
 
455
  The reference returned by the subscript operator for an array shall be
@@ -757,12 +757,12 @@ is `(*this)[`*`I`*` + n]` if *`I`*` + n` is non-negative and less than
757
  value of `n` shifts the elements left `n` places, with zero
758
  fill. — *end note*]
759
 
760
  [*Example 1*: If the argument has the value -2, the first two elements
761
  of the result will be value-initialized [[dcl.init]]; the third element
762
- of the result will be assigned the value of the first element of the
763
- argument; etc. — *end example*]
764
 
765
  ``` cpp
766
  valarray cshift(int n) const;
767
  ```
768
 
@@ -982,10 +982,11 @@ template<class T> void swap(valarray<T>& x, valarray<T>& y) noexcept;
982
  namespace std {
983
  class slice {
984
  public:
985
  slice();
986
  slice(size_t, size_t, size_t);
 
987
 
988
  size_t start() const;
989
  size_t size() const;
990
  size_t stride() const;
991
 
@@ -993,18 +994,17 @@ namespace std {
993
  };
994
  }
995
  ```
996
 
997
  The `slice` class represents a BLAS-like slice from an array. Such a
998
- slice is specified by a starting index, a length, and a stride.[^12]
999
 
1000
  #### Constructors <a id="cons.slice">[[cons.slice]]</a>
1001
 
1002
  ``` cpp
1003
  slice();
1004
  slice(size_t start, size_t length, size_t stride);
1005
- slice(const slice&);
1006
  ```
1007
 
1008
  The default constructor is equivalent to `slice(0, 0, 0)`. A default
1009
  constructor is provided only to permit the declaration of arrays of
1010
  slices. The constructor with arguments for a slice takes a start,
@@ -1189,11 +1189,10 @@ of `operator[](const gslice&)`, the behavior is undefined.
1189
 
1190
  ``` cpp
1191
  gslice();
1192
  gslice(size_t start, const valarray<size_t>& lengths,
1193
  const valarray<size_t>& strides);
1194
- gslice(const gslice&);
1195
  ```
1196
 
1197
  The default constructor is equivalent to
1198
  `gslice(0, valarray<size_t>(), valarray<size_t>())`. The constructor
1199
  with arguments builds a `gslice` based on a specification of start,
@@ -1331,11 +1330,11 @@ namespace std {
1331
  ```
1332
 
1333
  This template is a helper template used by the mask subscript operator:
1334
 
1335
  ``` cpp
1336
- mask_array<T> valarray<T>::operator[](const valarray<bool>&).
1337
  ```
1338
 
1339
  It has reference semantics to a subset of an array specified by a
1340
  boolean mask. Thus, the expression `a[mask] = b;` has the effect of
1341
  assigning the elements of `b` to the masked elements in `a` (those for
@@ -1348,11 +1347,11 @@ void operator=(const valarray<T>&) const;
1348
  const mask_array& operator=(const mask_array&) const;
1349
  ```
1350
 
1351
  These assignment operators have reference semantics, assigning the
1352
  values of the argument array elements to selected elements of the
1353
- `valarray<T>` object to which it refers.
1354
 
1355
  #### Compound assignment <a id="mask.array.comp.assign">[[mask.array.comp.assign]]</a>
1356
 
1357
  ``` cpp
1358
  void operator*= (const valarray<T>&) const;
@@ -1367,11 +1366,12 @@ void operator<<=(const valarray<T>&) const;
1367
  void operator>>=(const valarray<T>&) const;
1368
  ```
1369
 
1370
  These compound assignments have reference semantics, applying the
1371
  indicated operation to the elements of the argument array and selected
1372
- elements of the `valarray<T>` object to which the mask object refers.
 
1373
 
1374
  #### Fill function <a id="mask.array.fill">[[mask.array.fill]]</a>
1375
 
1376
  ``` cpp
1377
  void operator=(const T&) const;
@@ -1415,11 +1415,11 @@ namespace std {
1415
 
1416
  This template is a helper template used by the indirect subscript
1417
  operator
1418
 
1419
  ``` cpp
1420
- indirect_array<T> valarray<T>::operator[](const valarray<size_t>&).
1421
  ```
1422
 
1423
  It has reference semantics to a subset of an array specified by an
1424
  `indirect_array`. Thus, the expression `a[{}indirect] = b;` has the
1425
  effect of assigning the elements of `b` to the elements in `a` whose
 
1
  ## Numeric arrays <a id="numarray">[[numarray]]</a>
2
 
3
  ### Header `<valarray>` synopsis <a id="valarray.syn">[[valarray.syn]]</a>
4
 
5
  ``` cpp
6
+ #include <initializer_list> // see [initializer.list.syn]
7
 
8
  namespace std {
9
  template<class T> class valarray; // An array of type T
10
  class slice; // a BLAS-like slice out of an array
11
  template<class T> class slice_array;
 
164
 
165
  Any function returning a `valarray<T>` is permitted to return an object
166
  of another type, provided all the const member functions of
167
  `valarray<T>` are also applicable to this type. This return type shall
168
  not add more than two levels of template nesting over the most deeply
169
+ nested argument type.[^8]
170
 
171
  Implementations introducing such replacement types shall provide
172
  additional functions and operators as follows:
173
 
174
  - for every function taking a `const valarray<T>&` other than `begin`
 
289
  mathematical concept of an ordered set of values. For convenience, an
290
  object of type `valarray<T>` is referred to as an “array” throughout the
291
  remainder of  [[numarray]]. The illusion of higher dimensionality may be
292
  produced by the familiar idiom of computed indices, together with the
293
  powerful subsetting capabilities provided by the generalized subscript
294
+ operators.[^9]
295
 
296
  #### Constructors <a id="valarray.cons">[[valarray.cons]]</a>
297
 
298
  ``` cpp
299
  valarray();
300
  ```
301
 
302
+ *Effects:* Constructs a `valarray` that has zero length.[^10]
303
 
304
  ``` cpp
305
  explicit valarray(size_t n);
306
  ```
307
 
 
321
 
322
  *Preconditions:* \[`p`, `p + n`) is a valid range.
323
 
324
  *Effects:* Constructs a `valarray` that has length `n`. The values of
325
  the elements of the array are initialized with the first `n` values
326
+ pointed to by the first argument.[^11]
327
 
328
  ``` cpp
329
  valarray(const valarray& v);
330
  ```
331
 
332
  *Effects:* Constructs a `valarray` that has the same length as `v`. The
333
  elements are initialized with the values of the corresponding elements
334
+ of `v`.[^12]
335
 
336
  ``` cpp
337
  valarray(valarray&& v) noexcept;
338
  ```
339
 
 
444
 
445
  The expression `addressof(a[i]) != addressof(b[j])` evaluates to `true`
446
  for any two arrays `a` and `b` and for any `size_t i` and `size_t j`
447
  such that `i < a.size()` and `j < b.size()`.
448
 
449
+ [*Note 2*: This property indicates an absence of aliasing and can be
450
+ used to advantage by optimizing compilers. Compilers can take advantage
451
  of inlining, constant propagation, loop fusion, tracking of pointers
452
  obtained from `operator new`, and other techniques to generate efficient
453
  `valarray`s. — *end note*]
454
 
455
  The reference returned by the subscript operator for an array shall be
 
757
  value of `n` shifts the elements left `n` places, with zero
758
  fill. — *end note*]
759
 
760
  [*Example 1*: If the argument has the value -2, the first two elements
761
  of the result will be value-initialized [[dcl.init]]; the third element
762
+ of the result will be assigned the value of the first element of
763
+ `*this`; etc. — *end example*]
764
 
765
  ``` cpp
766
  valarray cshift(int n) const;
767
  ```
768
 
 
982
  namespace std {
983
  class slice {
984
  public:
985
  slice();
986
  slice(size_t, size_t, size_t);
987
+ slice(const slice&);
988
 
989
  size_t start() const;
990
  size_t size() const;
991
  size_t stride() const;
992
 
 
994
  };
995
  }
996
  ```
997
 
998
  The `slice` class represents a BLAS-like slice from an array. Such a
999
+ slice is specified by a starting index, a length, and a stride.[^13]
1000
 
1001
  #### Constructors <a id="cons.slice">[[cons.slice]]</a>
1002
 
1003
  ``` cpp
1004
  slice();
1005
  slice(size_t start, size_t length, size_t stride);
 
1006
  ```
1007
 
1008
  The default constructor is equivalent to `slice(0, 0, 0)`. A default
1009
  constructor is provided only to permit the declaration of arrays of
1010
  slices. The constructor with arguments for a slice takes a start,
 
1189
 
1190
  ``` cpp
1191
  gslice();
1192
  gslice(size_t start, const valarray<size_t>& lengths,
1193
  const valarray<size_t>& strides);
 
1194
  ```
1195
 
1196
  The default constructor is equivalent to
1197
  `gslice(0, valarray<size_t>(), valarray<size_t>())`. The constructor
1198
  with arguments builds a `gslice` based on a specification of start,
 
1330
  ```
1331
 
1332
  This template is a helper template used by the mask subscript operator:
1333
 
1334
  ``` cpp
1335
+ mask_array<T> valarray<T>::operator[](const valarray<bool>&);
1336
  ```
1337
 
1338
  It has reference semantics to a subset of an array specified by a
1339
  boolean mask. Thus, the expression `a[mask] = b;` has the effect of
1340
  assigning the elements of `b` to the masked elements in `a` (those for
 
1347
  const mask_array& operator=(const mask_array&) const;
1348
  ```
1349
 
1350
  These assignment operators have reference semantics, assigning the
1351
  values of the argument array elements to selected elements of the
1352
+ `valarray<T>` object to which the `mask_array` object refers.
1353
 
1354
  #### Compound assignment <a id="mask.array.comp.assign">[[mask.array.comp.assign]]</a>
1355
 
1356
  ``` cpp
1357
  void operator*= (const valarray<T>&) const;
 
1366
  void operator>>=(const valarray<T>&) const;
1367
  ```
1368
 
1369
  These compound assignments have reference semantics, applying the
1370
  indicated operation to the elements of the argument array and selected
1371
+ elements of the `valarray<T>` object to which the `mask_array` object
1372
+ refers.
1373
 
1374
  #### Fill function <a id="mask.array.fill">[[mask.array.fill]]</a>
1375
 
1376
  ``` cpp
1377
  void operator=(const T&) const;
 
1415
 
1416
  This template is a helper template used by the indirect subscript
1417
  operator
1418
 
1419
  ``` cpp
1420
+ indirect_array<T> valarray<T>::operator[](const valarray<size_t>&);
1421
  ```
1422
 
1423
  It has reference semantics to a subset of an array specified by an
1424
  `indirect_array`. Thus, the expression `a[{}indirect] = b;` has the
1425
  effect of assigning the elements of `b` to the elements in `a` whose