43template<
class Type_>
class Variable;
172 template<
class OtherArray>
238 std::pair< typename std::map<Type_, int>::iterator,
bool>
ret;
241 if (
ret.second==
true) {
code++;}
295 , std::ios_base& (*
f)(std::ios_base&) = std::dec
308 for (
int i=this->begin();
i<this->end();
i++)
317{
int first = this->end(), end = first+n;
318 this->insertElt(this->end(), n);
319 for (
int i=first;
i<end;
i++)
328 int first = this->end(), end = first+n;
329 this->insertElt(this->end(), n);
330 for (
int i=first;
i<end;
i++)
341 , std::ios_base& (*
f)(std::ios_base&)
343{ *
this = V;
return V.size();}
352 , std::ios_base& (*
f)(std::ios_base&)
355 this->resize(V.range());
356 this->setName(V.name());
358 for (
int i=V.begin();
i<V.end();
i++)
377 V.resize(this->range());
378 V.setName(this->name());
379 for (
int i=this->begin();
i<=this->lastIdx();
i++)
389 this->resize(V.range());
390 this->setName(V.name());
391 for (
int i=V.begin();
i<V.end();
i++) this->elt(
i) = V[
i];
401 this->resize(V.range());
402 this->setName(V.name());
403 for (
int i=V.begin(); i<V.end(); i++) this->elt(i) = stringToType<Type_>(V[i]);
412 V.resize(this->range());
413 V.setName(this->name());
414 for (
int i=this->begin();
i<this->end();
i++) V[
i] = this->elt(
i);
423 V.resize(this->range());
424 V.setName(this->name());
429template<
typename Type_>
432 s << V.name() <<
_T(
"\n");
Interface base class for the Array1D, this is an internal header file, included by other Containers l...
Define the Interface base class of all types of Variables.
#define _T(x)
Let x unmodified.
template one dimensional Array.
Variable< Type_ > & popBack(int n=1)
Delete last elts of the container.
Variable< Type_ > & setValue(Type const &value)
set a value to this container.
Variable< Type_ > & assign(IArray1D const &src)
overwrite this with src.
Variable< Type_ > & erase(int pos, int n=1)
Delete n elements at the pos index to the container.
Variable< Type_ > & pushBack(int n=1)
Add n Elements to the end of the container.
void clear()
Clear the object.
Variable< Type_ > & insertElt(int pos, int n=1)
Insert n elements at the position pos of the container.
RowRange const & range() const
void move(Variable< Type_ > const &T)
move T to this.
Derived & resize(Range const &I=RowRange())
IVariable is an Interface class for all Variables classes.
String name_
Name of the variable.
String const & name() const
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Index sub-vector region: Specialization when the size is unknown.
Variable is an implementation of the Base class IVariable using The Array1D class for storing the dat...
int importFromString(Variable< String > const &V, std::ios_base &(*f)(std::ios_base &)=std::dec)
overwrite the Variable by converting the strings contained in V into the Type_.
virtual Variable & operator<<(Variable< String > const &V)
Operator << : overwrite the Variable by converting the Strings contained in V into the Type_.
virtual void exportAsString(Variable< String > &V) const
Overwrite the variable V by converting the data into strings.
Variable(Range const &I, String const &name=stringNa)
Default constructor.
virtual void clear()
clear Container from all elements and memory allocated.
virtual Variable< Type_ > const & operator>>(Variable< String > &V) const
Operator >> : convert the Variable V into strings.
hidden::Traits< Variable< Type_ > >::Type Type
Variable & operator=(Type_ const &v)
set the container to a constant value.
Variable< Type_ > & resize1D(Range const &I)
Resize the container.
Variable(Variable const &V, bool ref=false)
copy/reference constructor.
virtual void erase(int pos, int n=1)
Delete n elements at the pos index from the container.
Variable(String const &name=stringNa)
default constructor
int maxLength(bool with_name) const
Variable< Type_ > SubArray
void insertElt(int pos, int n=1)
Insert n elements at the position pos of the container.
void push_back(Type_ const &v)
Add an element to the container.
void encode()
encode values as ints.
Variable< Type_ > SubVector
hidden::Traits< Variable< Type_ > >::Allocator Allocator
void move(Variable const &V)
move the variable in this
IArray1D< Variable< Type_ > > Base
virtual void pushBackNAValues(int n=1)
push back n NA values.
virtual void popBack(int n=1)
remove n elements to the end of the container
std::map< Type_, int > coding_
store the map String <-> int
virtual void shift(int beg)
New first index for the object.
Variable(Variable const &V, Range const &I, bool ref=true)
reference constructor
Variable & operator=(Variable const &V)
operator = : overwrite the CArray with the Right hand side T.
hidden::Traits< Variable< Type_ > >::TypeConst TypeConst
Variable(int size, String const &name=stringNa)
constructor
virtual Variable * clone(bool ref=false) const
clone return a ptr on a copy of the Object.
void pushBack(int n=1)
Add n elements to the container.
Variable(Range const &I, Type_ const &v, String const &name)
constructor with specified initial value
Variable(IArray1D< OtherArray > const &T)
constructor by reference, ref_=1.
void shift1D(int rbeg)
New first index for the object.
ostream & out1D(ostream &os, ITContainer1D< Array > const &V)
Method for displaying any one dimensional Array.
ostream & operator<<(ostream &s, const CAllocator< Type, SizeRows_, SizeCols_, Orient_ > &V)
output stream for CAllocator.
@ dense_
dense matrix/vector/array/expression
@ vector_
column oriented vector/array/expression
@ by_col_
storage by column
String stringNa
Representation of a Not Available value.
std::basic_string< Char > String
STK fundamental type of a String.
const int UnknownSize
This value means that an integer is not known at compile-time, and that instead the value is stored i...
const int baseIdx
base index of the containers created in STK++.
std::basic_ostream< Char > ostream
ostream for Char
The namespace STK is the main domain space of the Statistical ToolKit project.
Arithmetic properties of STK fundamental types.
static Type NA()
Adding a Non Available (NA) special number.
Implementation of the return type.
Variable< Type_ > SubVector
ConstDenseRandomIterator< Variable< Type_ > > ConstIterator
std::reverse_iterator< ConstIterator > ConstReverseIterator
Variable< Type_ > SubArray
DenseRandomIterator< Variable< Type_ > > Iterator
MemAllocator< Type_, UnknownSize > Allocator
RemoveConst< Type_ >::Type const & TypeConst
std::reverse_iterator< Iterator > ReverseIterator