> next up previous contents index
: Discrete real types : Discrete types : Integer Types   目次   索引

Sparse Type

A Sparse sequence type $X=<v_0,v_1,...,v_{m-1}>$ or sparse type for short, consist in a collection of $m$ sorted real values where the distance between two consecutive values is not necessarily constant. Sparse types are defined by means of a plFloat array or a plFloat STL2.1 vector. Some examples of sparse types constructions are the followings:

  plFloat rates[6]={0.79, 1.96, 2.20, 6.56, 13.73, 166.39};
  plSparseType exchange_rate(6,rates);

  vector <plFloat> prime;
  prime.push_back(2);
  prime.push_back(3);
  prime.push_back(5);
  prime.push_back(7);
  prime.push_back(11);
  prime.push_back(13);
  plSparseType first_primes(prime);

Note that, when constructing a sparse type with a plFloat array the number of values in the sequence must be provided (first parameter), while when using a STL vector it is not required. Indeed, in the second case the number of elements in the type will be set equal to the vector size.



Juan-Manuel Ahuactzin 平成17年3月31日