58 static inline boost::shared_ptr<CORE_Vector<T> >
New(
const boost::shared_ptr<
CORE_Vector<T> >& v ) {
79 if (v!=
null) p->copy(*v);
84 static inline boost::shared_ptr<CORE_Vector<T> >
New() {
92 static inline boost::shared_ptr<CORE_Vector<T> >
New(
const int& dim) {
117 inline boost::shared_ptr<CORE_Vector<T> > getThis() {
118 boost::shared_ptr<CORE_Vector<T> > p;
124 inline boost::shared_ptr<const CORE_Vector<T> > getThis()
const {
125 boost::shared_ptr<const CORE_Vector<T> > p;
138 return mVector[(int)i];
148 return mVector[(int)i];
174 int n=mVector.size();
175 for(
int i=0;i<n;i++) mVector[i]=v;
181 for(
int i=0;i<dim;i++) mVector[i]/=v;
187 for(
int i=0;i<dim;i++) mVector[i]*=v;
194 void addAfterIndex(
const int& index,
const T& v);
213 if (n>0) divideBy(n);
218 int n=mVector.size();
221 for(
int i=0;i<dim;i++) mVector[i]+=f*v[i];
232 int n=mVector.size();
235 for(
int i=0;i<dim;i++) mVector[i]=u[i]-v[i];
240 int n=mVector.size();
243 for(
int i=0;i<dim;i++) mVector[i]-=f*v[i];
250 for (
int i=0;i<n;i++) mVector[i]=(T) array[i];
255 if (array!=
null) copy(*array);
265 template<
class Y>
void setValues(
const vector<Y>& array) {
268 for (
int i=0;i<n;i++) mVector[i]=(T) array[i];
272 template<
class Y>
void setValues(
const Y* array,
const int& n) {
274 for (
int i=0;i<n;i++) mVector[i]=(T) array[i];
284 tBoolean insert(
int i,
const T& obj);
292 int insertInOrder(
const T& obj,
const tBoolean& evenIfEqual);
299 return insertInOrder(obj,
false);
306 mVector.push_back(obj);
329 static void sort(vector<T>& items,
340 tBoolean removeAtIndex(
const int& i);
346 return remove(size()-1);
360 return mVector[mVector.size()-1];
367 inline const T&
get(
int i)
const {
377 inline T&
get(
int i) {
384 inline int size()
const {
return mVector.size();};
387 inline int getSize()
const {
return mVector.size();};
395 inline const T&
getValue(
const int& i)
const {
return mVector[i];};
399 inline const vector<T>&
getValues()
const {
return mVector;};
407 tBoolean exists(
const T& obj)
const;
422 static int search(
const vector<T>& values,
423 const T& value,
const tString& order);
428 return search(mVector,value,order);
436 void permute(
const int& i,
const int&j);
452 return (mIterator<mVector.size());
457 T& ret=mVector[mIterator];
473 for (
int i=0;i<p;i++) {
474 t=((T)a[i])-mVector[i];
483 return sqrt(distance2(a));
493 for (
int i=0;i<p;i++)
494 s+=((T)a[i])*mVector[i];
501 if (a!=
null)
return scalarProduct(*a);
512 int dim=(dim_a<dim_b)?dim_a:dim_b;
515 res[0]=a[1]*b[2]-a[2]*b[1];
516 res[1]=a[2]*b[0]-a[0]*b[2];
517 res[2]=a[0]*b[1]-a[1]*b[0];
520 for (
int i=0;i<dim;i++) res[i]=0;
528 crossProduct(*
this,a,res);
534 if (getSize()<3) setSize(3);
535 tReal v1= mVector[1]*cos(alpha) + mVector[2]*sin(alpha);
536 mVector[2] = - mVector[1]*sin(alpha) + mVector[2]*cos(alpha);
543 if (getSize()<2) setSize(2);
544 tReal v0 = mVector[0]*cos(gamma) + mVector[1]*sin(gamma) ;
545 mVector[1] =-mVector[0]*sin(gamma) + mVector[1]*cos(gamma) ;
554 for (
int i=0;i<p;i++) {
555 d+=mVector[i]*mVector[i];
563 return sqrt(norm2());
568 tString ret=getIdentityString()+
"(";
569 for (
int i=0;i<n;i++)
void begin()
put the iterator on begin
Definition: CORE_Vector.h:445
CORE_Vector< tBoolean > CORE_BooleanVector
Definition: CORE_Vector.h:581
void crossProduct(const CORE_Vector< Q > &a, CORE_Vector< Q > &res) const
return the cross product of the vector with the a vector
Definition: CORE_Vector.h:526
void sort(const tString &order)
sort the vector decreasing order < increasing order
Definition: CORE_Vector.h:323
const vector< T > & getVector() const
get vector
Definition: CORE_Vector.h:416
tString toString() const
return the string associated to the string
Definition: CORE_String.h:150
virtual tString toString() const
return the string representation of the object node
Definition: CORE_Vector.h:566
const T & operator[](int i) const
get the i-th element ASSERT_IN(i>-1); ASSERT_IN(i<((int)mVector.size()));
Definition: CORE_Vector.h:135
static boost::shared_ptr< CORE_Vector< T > > New(const boost::shared_ptr< CORE_Vector< T > > &v)
create a shared pointer of vector which is a copy of vector v
Definition: CORE_Vector.h:58
this class describes an array
Definition: CORE_Vector.h:18
class CORE_SharedPointersList is a list of shared pointers
Definition: CORE_SharedPointersList.h:11
void add(const T &obj)
add an element at the end
Definition: CORE_Vector.h:305
CORE_Vector< tComplex > CORE_ComplexVector
Definition: CORE_Vector.h:585
void multiplyBy(const tReal &v)
multiplied by value v
Definition: CORE_Vector.h:185
this class describes a list
Definition: CORE_List.h:12
T & next()
return the next element
Definition: CORE_Vector.h:456
void add(const tReal &f, const CORE_Vector< T > &v)
init the value to v
Definition: CORE_Vector.h:217
tReal norm() const
return the norm of the vector
Definition: CORE_Vector.h:562
void copy(const CORE_Vector< Y > *array)
copy
Definition: CORE_Vector.h:254
tBoolean hasNext() const
return true if the array has next element
Definition: CORE_Vector.h:451
tReal scalarProduct(const CORE_Vector< Q > &a) const
return the scalar product of the vector with the a vector
Definition: CORE_Vector.h:488
#define tBoolean
Definition: types.h:35
const vector< T > & getValues() const
get values
Definition: CORE_Vector.h:399
vector< T > & getValues()
get values
Definition: CORE_Vector.h:402
CORE_Vector< tFlag > CORE_FlagVector
Definition: CORE_Vector.h:586
void add(const CORE_Vector< T > &v)
init the value to v
Definition: CORE_Vector.h:206
CORE_Vector< tInteger > CORE_IntegerVector
Definition: CORE_Vector.h:589
tReal norm2() const
return the squared norm of the vector
Definition: CORE_Vector.h:551
T & operator[](int i)
get the i-th element ASSERT_IN(i>-1); ASSERT_IN(i<((int)mVector.size()));
Definition: CORE_Vector.h:145
int insert(const T &obj)
insert T
Definition: CORE_Vector.h:298
#define null
Definition: types.h:13
void getSharedPointer(boost::shared_ptr< CORE_Vector< T > > &p)
get the shared pointer into P
Definition: CORE_Vector.h:102
CORE_Vector< tCharacter > CORE_CharacterVector
Definition: CORE_Vector.h:582
CORE_Vector< int > CORE_IntVector
Definition: CORE_Vector.h:583
int getDimension() const
return the dimension of the vector
Definition: CORE_Vector.h:390
CORE_Vector< tRelativeInteger > CORE_RelativeIntegerVector
Definition: CORE_Vector.h:590
void rotZ(const tReal &gamma)
rotate the vector among z-axes with angle gamma
Definition: CORE_Vector.h:542
const T & getValue(const int &i) const
get value
Definition: CORE_Vector.h:395
void rotX(const tReal &alpha)
rotate the vector among x-axes with angle alpha
Definition: CORE_Vector.h:533
void sub(const CORE_Vector< T > &v)
init the value to v
Definition: CORE_Vector.h:226
T & getLastElement()
get last element pointer
Definition: CORE_Vector.h:358
CORE_Vector< tReal > CORE_RealVector
Definition: CORE_Vector.h:584
void sub(const tReal &f, const CORE_Vector< T > &v)
init the value to v
Definition: CORE_Vector.h:239
void divideBy(const tReal &v)
divide by value v
Definition: CORE_Vector.h:179
void initValues(const T &v)
init the value to v
Definition: CORE_Vector.h:173
void copy(const boost::shared_ptr< CORE_Vector< T > > &array)
copy
Definition: CORE_Vector.h:260
void getSharedPointer(SP::CORE_Object &p)
get the shared pointer of this class into p
Definition: CORE_Object.h:65
int size() const
return the size of the vector
Definition: CORE_Vector.h:384
void getSharedPointer(boost::shared_ptr< const CORE_Vector< T > > &p) const
get the shared pointer into P
Definition: CORE_Vector.h:109
void setValue(const int &i, const T &v)
set value
Definition: CORE_Vector.h:156
int getSize() const
return the size of the vector
Definition: CORE_Vector.h:387
void setCapacity(const int &n)
set the size of the array
Definition: CORE_Vector.h:167
static void crossProduct(const CORE_Vector< Q > &a, const CORE_Vector< Q > &b, CORE_Vector< Q > &res)
return the cross product of the vector with the a vector
Definition: CORE_Vector.h:507
#define tString
Definition: types.h:36
CORE_Vector< tString > CORE_StringVector
Definition: CORE_Vector.h:588
static boost::shared_ptr< CORE_Vector< T > > New()
create a shared pointer of vector
Definition: CORE_Vector.h:84
static boost::shared_ptr< CORE_Vector< T > > New(const CORE_Vector< T > &v)
create a shared pointer of vector which is a copy of vector v
Definition: CORE_Vector.h:67
CORE_Vector< tShort > CORE_ShortVector
Definition: CORE_Vector.h:587
static boost::shared_ptr< CORE_Vector< T > > New(const int &dim)
create a shared pointer of vector of size dim
Definition: CORE_Vector.h:92
tReal scalarProduct(const CORE_Vector< Q > *a) const
return the scalar product of the vector with the a vector
Definition: CORE_Vector.h:500
tReal distance(const CORE_Vector< Q > &a) const
return the distance of the vector with the a vector
Definition: CORE_Vector.h:482
void setSize(const int &n)
set the size of the array
Definition: CORE_Vector.h:162
virtual void addInList(const T &obj)
add a core object
Definition: CORE_Vector.h:311
vector< T > & getVector()
get vector
Definition: CORE_Vector.h:411
void sub(const CORE_Vector< T > &u, const CORE_Vector< T > &v)
init the value to u-v
Definition: CORE_Vector.h:231
void setValues(const Y *array, const int &n)
copy
Definition: CORE_Vector.h:272
static boost::shared_ptr< CORE_Vector< T > > New(const CORE_Vector< T > *v)
create a shared pointer of vector which is a copy of vector v
Definition: CORE_Vector.h:76
int search(const T &value, const tString &order)
search the value in values vector ordered in order
Definition: CORE_Vector.h:427
TYPEDEF_SPTR(CORE_BooleanVector)
void clear()
clear the array
Definition: CORE_Vector.h:350
#define tReal
Definition: types.h:18
tReal distance2(const CORE_Vector< Q > &a) const
return the squared distance of the vector with the a vector
Definition: CORE_Vector.h:467
#define ASSERT_IN(a)
Definition: types.h:82
void copy(const CORE_Vector< Y > &array)
copy
Definition: CORE_Vector.h:247
void normalize()
normalize
Definition: CORE_Vector.h:211
void setValues(const vector< Y > &array)
copy
Definition: CORE_Vector.h:265
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106