34 #include "compose.hpp"
42 template <
int D,
class T>
45 template <
int D,
class T>
46 std::ostream & operator<<(std::ostream & os, const Position<D,T> & pos);
48 template <
int D,
class T=
double_t>
52 template<
int OD,
class OT>
68 Position(
const T&,
const T&,
const T&);
91 operator std::vector<T>()
const;
262 operator std::string()
const;
273 void print(std::ostream& out,
char sep =
' ')
const;
278 friend std::ostream & operator<< <>(std::ostream & os,
const Position<D,T> & pos);
322 for(
int i=0;i<D;++i) {
354 template <
int D,
class T>
362 template <
int D,
class T>
371 template <
int D,
class T>
381 template <
int D,
class T>
389 template <
int D,
class T>
394 throw BadProperty(String::compose(
"Expected a %1-dimensional position.", D));
396 std::copy(y.begin(), y.end(), x_);
399 template <
int D,
class T>
407 template <
int D,
class T>
416 template <
int D,
class T>
419 std::vector<double_t> result;
422 result.push_back(x_[i]);
427 template <
int D,
class T>
434 template <
int D,
class T>
441 template <
int D,
class T>
444 std::vector<T> result = std::vector<T>(*this);
446 return Token(result);
449 template <
int D,
class T>
459 template <
int D,
class T>
469 template <
int D,
class T>
478 template <
int D,
class T>
488 template <
int D,
class T>
498 template <
int D,
class T>
507 template <
int D,
class T>
516 template <
int D,
class T>
525 template <
int D,
class T>
534 template <
int D,
class T>
540 x_[i] += other.
x_[i];
544 template <
int D,
class T>
550 x_[i] -= other.
x_[i];
554 template <
int D,
class T>
560 x_[i] *= other.
x_[i];
564 template <
int D,
class T>
570 x_[i] /= other.
x_[i];
574 template <
int D,
class T>
583 template <
int D,
class T>
592 template <
int D,
class T>
601 template <
int D,
class T>
610 template <
int D,
class T>
614 for(
int i=0;i<D;++i) {
615 if (x_[i] != y.
x_[i])
return false;
620 template <
int D,
class T>
624 for(
int i=0;i<D;++i) {
625 if (x_[i] != y.
x_[i])
return true;
630 template <
int D,
class T>
634 for(
int i=0;i<D;++i) {
635 if (x_[i] >= y.
x_[i])
return false;
640 template <
int D,
class T>
644 for(
int i=0;i<D;++i) {
645 if (x_[i] <= y.
x_[i])
return false;
650 template <
int D,
class T>
654 for(
int i=0;i<D;++i) {
655 if (x_[i] > y.
x_[i])
return false;
660 template <
int D,
class T>
664 for(
int i=0;i<D;++i) {
665 if (x_[i] < y.
x_[i])
return false;
670 template <
int D,
class T>
675 lensq += x_[i]*x_[i];
676 return std::sqrt(lensq);
679 template <
int D,
class T>
682 std::stringstream ss;
687 template <
int D,
class T>
695 template <
int D,
class T>
696 std::ostream & operator<<(std::ostream & os, const Position<D,T> & pos)
702 os <<
", " << pos.x_[i];
Definition: position.h:43
Box(const Position< D > &ll, const Position< D > &ur)
Definition: position.h:292
An index into a multidimensional array.
Definition: position.h:304
Position()
Default constructor, initializing all coordinates to zero.
Definition: position.h:356
MultiIndex(const Position< D, int > &ll, const Position< D, int > &ur)
Definition: position.h:314
MultiIndex()
Definition: position.h:306
void print(std::ostream &out, char sep= ' ') const
Print position to output stream.
Definition: position.h:688
Position operator*(const Position< D, OT > &other) const
Elementwise multiplication.
MultiIndex(const Position< D, int > &ur)
Definition: position.h:310
Position< D, int > get_lower_left() const
Definition: position.h:343
Position operator/(const Position< D, OT > &other) const
Elementwise division.
const Name a("a")
Specific to Brette & Gerstner 2005 (aeif_cond-*)
Definition: nest_names.h:41
bool operator>(const Position &y) const
Definition: position.h:642
Position< D, int > lower_left_
Definition: position.h:349
Position< D, int > upper_right_
Definition: position.h:350
T x_[D]
Definition: position.h:281
const Name y("y")
Definition: topology_names.h:52
const Name other("other")
Node type.
Definition: nest_names.h:216
MultiIndex & operator++()
Definition: position.h:318
A box is defined by the lower left corner (minimum coordinates) and the upper right corner (maximum c...
Definition: position.h:289
bool operator==(const Position &y) const
Definition: position.h:612
bool operator<=(const Position &y) const
Definition: position.h:652
Position & operator*=(const Position< D, OT > &)
In-place elementwise multiplication.
const Name x("x")
current scaling factor of the synaptic weight [0...1] (Tsodyks2_connection)
Definition: nest_names.h:356
Exception to be thrown if a status parameter is incomplete or inconsistent.
Definition: exceptions.h:420
Position< D > upper_right
Definition: position.h:297
T & operator[](int i)
Definition: position.h:429
Position & operator+=(const Position< D, OT > &)
In-place elementwise addition.
bool operator!=(const Position &y) const
Definition: position.h:622
Position & operator/=(const Position< D, OT > &)
In-place elementwise division.
MultiIndex operator++(int)
Definition: position.h:336
Position operator+(const Position< D, OT > &other) const
Elementwise addition.
Position< D > lower_left
Definition: position.h:296
bool operator<(const Position &y) const
Definition: position.h:632
Default types used by the NEST kernel.
Position operator-() const
Unary minus.
Definition: position.h:471
A type-independent container for C++-types.
Definition: token.h:68
T length() const
Length of Position vector.
Definition: position.h:671
const Name p("p")
current release probability (Tsodyks2_connection)
Definition: nest_names.h:218
Position< D, int > get_upper_right() const
Definition: position.h:345
Position & operator-=(const Position< D, OT > &)
In-place elementwise subtraction.
bool operator>=(const Position &y) const
Definition: position.h:662
Box()
Definition: position.h:291
Token getToken() const
Moves Position variables into an array.
Definition: position.h:442