BoolArray | |
BoolVec | c++ standard template library (STL) vector of type ‘bool’ |
ComplexArray | |
ComplexVec | c++ standard template library (STL) vector of type ‘complex’ |
CoordinateTypes | |
FFTWPlanManyDft | |
FFTWPlanManyDftC2r | |
FFTWPlanManyDftR2c | |
FloatArray | |
FloatVec | c++ standard template library (STL) vector of type ‘float’ |
IntArray | |
IntVec | c++ standard template library (STL) vector of type ‘int’ |
StringArray | |
StringVec | c++ standard template library (STL) vector of type ‘str’ |
TBB2Data | |
TBBData | |
TYPE | |
VecToString(self[, maxlen]) | see help of ‘hPrettyString’ |
Vec_add(vec1, val) | Provides the + operator for adding two vectors or a vector and a scalar. |
Vec_div(vec1, val) | Provides the / operator for dividing two vectors or a vector by a scalar. |
Vec_iadd(vec1, vec2) | Provides the += operator for adding two vectors in place. |
Vec_idiv(vec1, vec2) | Provides the /= operator for adding two vectors in place. |
Vec_imul(vec1, vec2) | Provides the *= operator for addig two vectors in place. |
Vec_isub(vec1, vec2) | Provides the -= operator for adding two vectors in place. |
Vec_mul(vec1, val) | Provides the * operator for multiplying two vectors or a vector and a scalar. |
Vec_neg(vec1) | Provides the - operator for a vector. |
Vec_pos(vec1) | Provides the + operator for a vector (which is its identity: +vec = vec). |
Vec_pow(vec1, val) | Provides the ** operator for raising a vector to a power. |
Vec_rdiv(vec1, val) | Provides the / operator for dividing two vectors or a vector by a scalar. |
Vec_rsub(vec1, val) | Provides the - operator for subtracting two vectors or a vector and a scalar. |
Vec_sub(vec1, val) | Provides the - operator for subtracting two vectors or a vector and a scalar. |
Vector([Type, size, fill, copy, properties]) | The basic Boost Python STL vector constructor takes no arguments and hence is a litte cumbersome to use. |
asval(self) | Return the argument as a single value. |
asvec(self) | Return the argument as a vector, if possible, otherwise as list. |
atype | |
basetype((IntVec) -> <type >) | basetype(FloatArray) -> <type ‘float’> |
btype | str(object=’‘) -> string |
extendflat(self, l) | Appending all elements in a list of lists to a one-dimensional vector with a flat data structure (just 1D). |
fftw_flags | |
fftw_sign | |
hVector_getinitargs(self) | Get arguments for hVector constructor. |
hVector_getstate(self) | Get current state of hVector object for pickling. |
hVector_list(self) | Retrieve the STL vector as a python list. |
hVector_repr(self[, maxlen]) | Returns a human readable string representation of the vector. |
hVector_setstate(self, state) | Restore state of hVector object for unpickling. |
hVector_val(self) | Retrieve the contents of the vector as python values: either as a single value, if the vector just contains a single value, or otherwise return a python list. |
hVector_vec(self) | Convenience method that allows one to treat hArrays and hVectors in the same way, i.e. |
hWEIGHTS | |
isVector(vec) | Returns true if the argument is one of the standard c++ vectors i.e. |
multiply_list(l) | Multiplies all elements of a list with each other and returns the result. |
type2array((float) -> Vec(0)=[]) | Creates an array with elements of type ‘basetype’. |
type2vector((float) -> Vec(0)=[]) | Creates a vector with elements of type ‘basetype’. |
typename(btype) | basetype(float) -> “float” |
v | |
vtype | c++ standard template library (STL) vector of type ‘str’ |
Basic types for Vectors and hArrays.
see help of ‘hPrettyString’
Provides the + operator for adding two vectors or a vector and a scalar. The result will be a new vector.
Provides the / operator for dividing two vectors or a vector by a scalar. The result will be a new vector.
Provides the += operator for adding two vectors in place. vec1 += vec2 will add all elements in vec2 to the corresponding elements in vec1 and store the result in vec1.
Provides the /= operator for adding two vectors in place. vec1 /= vec2 will divide all elements in vec1 by the corresponding elements in vec2 and store the result in vec1.
Provides the *= operator for addig two vectors in place. vec1 *= vec2 will multiply all elements in vec1 with the corresponding elements in vec2 and store the result in vec1.
Provides the -= operator for adding two vectors in place. vec1 -= vec2 will subtract all elements in vec2 from the corresponding elements in vec1 and store the result in vec1.
Provides the * operator for multiplying two vectors or a vector and a scalar. The result will be a new vector.
Provides the - operator for a vector. Will return a copy of the vector where all elmements are multiplied by -1.
Provides the + operator for a vector (which is its identity: +vec = vec).
Provides the ** operator for raising a vector to a power. Returns a new vector.
Provides the / operator for dividing two vectors or a vector by a scalar. The result will be a new vector.
Provides the - operator for subtracting two vectors or a vector and a scalar. The result will be a new vector.
Provides the - operator for subtracting two vectors or a vector and a scalar. The result will be a new vector.
The basic Boost Python STL vector constructor takes no arguments and hence is a litte cumbersome to use. Here we provide a wrapper function that is useful for interactive use. If speed is of the essence, use the original vector constructors: BoolVec(), IntVec(), FloatVec(), ComplexVec(), StringVec()
Type - type of vector (int, float,complex,bool, str) or an array/vector/list where they type can be deduced from.
size - length of the vector
fill - a value or vector/list that is used to fill the vector with
copy - a vector which is used to copy content and properties from (other keywords have priority though)
properties - assume the properties of this vector if provided (other keywords have priority though)
Usage:
Vector() defaults to a float vector.
Note, that size and fill take precedence over the list and tuple input. Hence if you create a vector with Vector([1,2,3],size=2) it will contain only [1,2]. Vector([1,2,3],size=2,fill=4) will give [4,4].
Example:
v = Vector(int,10,fill=range(10)) -> v = Vector(int, 10, fill=[0,1,2,3,4,5,6,7,8,9]) vv = Vector(copy=v) -> vv = Vector(int, 10, fill=[0,1,2,3,4,5,6,7,8,9])
Return the argument as a single value. If it is a list/tuple/vector/array, return the first element.
Return the argument as a vector, if possible, otherwise as list. If None, return None.
Appending all elements in a list of lists to a one-dimensional vector with a flat data structure (just 1D).
>>> vector.extendflat([[e1-1,e1-2,...],[e2-1,e2-2,...],..])
-> [e1-1,e1-2,...,e2-1,e2-2,...]
Get arguments for hVector constructor.
Warning
This is not the hVector factory function but the constructor for the actual type. E.g. IntArray.__init__()
Get current state of hVector object for pickling.
Retrieve the STL vector as a python list.
Usage:
>>> vec.list()
-> [x1,x2,x3, ...]
Returns a human readable string representation of the vector.
Restore state of hVector object for unpickling.
Retrieve the contents of the vector as python values: either as a single value, if the vector just contains a single value, or otherwise return a python list.
Usage:
>>> vec.val()
-> a (if length == 1)
>>> vec.val()
-> [a,b,c,...] (if length > 1)
Convenience method that allows one to treat hArrays and hVectors in the same way, i.e. using the vec() method returns the intrinsic vector for both.
>>> vector.vec()
-> vector
Returns true if the argument is one of the standard c++ vectors i.e. those listed in hAllVectorTypes.
>>> isVector(vec)
-> True or False
Multiplies all elements of a list with each other and returns the result.
Usage:
>>> multiply_list([n1,n2,...])
-> n1*n2*n3 ....