31 # error: "need right C-Library: Your C-Library doesn't have memset() function"
34 # error: "need right C-Library: Your C-Library doesn't have memcpy() function"
82 inline SgVector(
unsigned int N,
bool IsNeedClear);
95 inline void reSize(
unsigned int n);
102 inline unsigned int n()
const;
113 inline void setElement(
unsigned int i,
double d);
118 inline double getElement(
unsigned int i)
const;
126 inline double module()
const;
285 B_ =
new double[
N_=N];
296 memcpy((
void*)
B_, (
const void*)V.
B_,
N_*
sizeof(
double));
317 B_ =
new double[
N_=
n];
339 std::cerr <<
"WARNING: double& SgVector::operator()(unsigned int i) :"
340 <<
" incompatible index of the vector (" << i <<
"), greater than " <<
N_ <<
"\n";
342 return (i<
N_)?*(
B_+i):*
B_;
352 std::cerr <<
"WARNING: double& SgVector::setElement(unsigned int i, double d) :"
353 <<
" incompatible index of the vector (" << i <<
"), greater than " <<
N_ <<
"\n";
366 std::cerr <<
"WARNING: double& SgVector::getElement(unsigned int i) const :"
367 <<
" incompatible index of the vector (" << i <<
"), greater than " <<
N_ <<
"\n";
369 return (i<
N_)?*(
B_+i):0.0;
381 for(
unsigned int i=0; i<
N_; i++,b++)
391 memset((
void*)
B_, 0,
sizeof(
double)*
N_);
409 memcpy((
void*)
B_, (
const void*)V.
B_,
N_*
sizeof(
double));
419 for(
unsigned int i=0; i<
N_; i++)
431 std::cerr <<
"WARNING: double& SgVector::operator+=(const SgVector& V) :"
432 <<
" the dimensions of vectors ( " <<
N_ <<
" and " << V.
N_ <<
" ) are different.\n";
434 double *b=
B_, *v=V.
B_;
435 unsigned int N=std::min(
N_, V.
N_);
436 for(
unsigned int i=0; i<N; i++)
448 std::cerr <<
"WARNING: double& SgVector::operator-=(const SgVector& V) :"
449 <<
" the dimensions of vectors ( " <<
N_ <<
" and " << V.
N_ <<
" ) are different.\n";
451 double *b=
B_, *v=V.
B_;
452 unsigned int N=std::min(
N_, V.
N_);
453 for(
unsigned int i=0; i<N; i++)
464 for(
unsigned int i=0; i<
N_; i++)
475 for(
unsigned int i=0; i<
N_; i++)
489 double *b=
B_, *v=V.
B_;
491 while (i++<
N_ && (IsEqual = IsEqual && *b++==*v++)) ;
558 std::cerr <<
"WARNING: double operator*(const SgVector& V1, const SgVector& V2) :"
559 <<
" the dimensions of vectors ( " << V1.
N_ <<
" and " << V2.
N_
560 <<
" ) are different.\n";
562 double *v1=V1.
B_, *v2=V2.
B_, d=0.0;
563 unsigned int N=std::min(V1.
N_, V2.
N_);
564 for(
unsigned int i=0; i<N; i++)
std::ostream & operator<<(std::ostream &s, const SgVector &V)
SgVector operator/(const SgVector &V, double d)
SgVector operator*(const SgVector &V, double d)
SgVector operator+(const SgVector &V1, const SgVector &V2)
SgVector operator-(const SgVector &V)
bool operator!=(const SgVector &V) const
double * B_
A pointer on a first element of the vector.
double & operator()(unsigned int i)
SgVector & operator-=(const SgVector &V)
friend SgVector calcProduct_matT_x_vec(const SgUtMatrix &, const SgVector &)
SgVector & operator=(const SgVector &V)
const double * base_c() const
void setElement(unsigned int i, double d)
void reSize(unsigned int n)
friend SgVector operator/(const SgVector &V, double d)
friend SgVector operator*(const SgVector &V, double d)
friend SgVector operator+(const SgVector &V1, const SgVector &V2)
SgVector & operator/=(double d)
SgVector & operator*=(double d)
bool operator==(const SgVector &V) const
friend SgVector operator-(const SgVector &V)
SgVector & operator+=(const SgVector &V)
friend SgVector calcProduct_matT_x_vec(const SgMatrix &, const SgVector &)
double getElement(unsigned int i) const
unsigned int N_
An number of elements in a vector (dimension).