VSIPL++ Vector objects represent one-dimensional sets of data. The type of values stored in the vector is given by the first template argument.
A = 0
A = value
value.A = ramp(init, step, size)
nth of
element of A is set to init + n *
step.
The following elementwise unary operations can be performed on vectors, producing a vector result:
acos(A)
arg(A)
asin(A)
atan(A)
bnot(A)
ceil(A)
conj(A)
cos(A)
cosh(A)
euler(A)
exp(A)
exp10(A)
floor(A)
imag(A)
is_finite(A)
is_nan(A)
is_normal(A)
lnot(A)
log(A)
log10(A)
mag(A)
magsq(A)
neg(A)
real(A)
recip(A)
rsqrt(A)
sin(A)
sinh(A)
sq(A)
sqrt(A)
tan(A)
tanh(A)
The following elementwise binary operations can be performed on vectors, producing a vector result:
add(A)
atan2(A)
band(A)
bor(A)
bxor(A)
div(A)
eq(A)
fmod(A)
ge(A)
gt(A)
hypot(A)
jmul(A)
land(A)
le(A)
lor(A)
lt(A)
lxor(A)
max(A)
maxmg(A)
maxmgsq(A)
min(A)
minmg(A)
minmgsq(A)
mul(A)
ne(A)
pow(A)
sub(A)
The following elementwise ternary operations can be performed on vectors, producing a vector result:
am(A)
expoavg(A)
ite(A)
ma(A)
msb(A)
sbm(A)
A vector with one type of values can be converted a vector with
another type of values using view_cast.
For example, to convert a vector of floats A into
a vector of ints Z:
Vector<float> A(size); Vector<int> Z(size); Z = view_cast<int>(A)
The following arithmetic elementwise binary operations and functions are available on vectors:
Z = add(A, B)
Z(n) = A(n) + B(n)(section 4.2.2)Z = div(A, B)
Z(n) = A(n) / B(n)(section 4.2.16)Z = max(A, B)
A(n) and
B(n)Z = min(A, B)
A(n) and
B(n)Z = mul(A, B)
Z(n) = A(n) * B(n)(section 4.2.51)Z = sub(A, B)
Z(n) = A(n) - B(n)(section 4.2.63)Addition, subtraction, multiplication, and division can also be written in operator form:
Z = A + B
Z = add(A, B)Z = A - B
Z = sub(A, B)Z = A * B
Z = mul(A, B)Z = A / B
Z = div(A, B)In all the preceding functions and operations, either of the vector operands can be replaced with scalar operands.
For example, to perform a scalar-vector multiply:
Z = a * B;
or
Z = mul(a, B);
Z = eq(A, B)
Z(n) = A(n) == B(n)Z = gt(A, B)
Z(n) = A(n) > B(n)Z = gte(A, B)
Z(n) = A(n) >= B(n)Z = lt(A, B)
Z(n) = A(n) < B(n)Z = lte(A, B)
Z(n) = A(n) <= B(n)Z = ne(A, B)
Z(n) = A(n) != B(n)
The following arithmetic elementwise ternary operations and functions are available on vectors:
Z = ma(A, B, C)
Z(n) = A(n) * B(n) +
C(n)Z = am(A, B, C)
Z(n) = A(n) + B(n) *
C(n)In all the preceding functions and operations, one or more of the vector operands can be replaced with scalar operands.
For example, to scale a vector, then apply an offset:
Z = scale * A + offset;
or
Z = ma(scale, A, offset);
(where scale and offset are
scalar values)
Z = ite(bool_vector, A, B)
Z, sets value to nth
element ofA if nth element of bool_vector is true,
otherwise sets value to the nth element of
B.Notionally equivalent to C ?:
operator.(Foreach n) Z[n] = bool_vector[n] ? A[n] :
B[n]
In all the preceding functions and operations, one or more of the vector operands can be replaced with scalar operands.
For example, the apply a scalar threshold b to a
vector:
Z = ite(A > b, A, b);
The following functions reduce a vector to a single value:
z = alltrue(A)
A is bool,
the function returns true if all
the elements are true;
otherwise false. When the element type
is something else,
see (section 4.3.1) for more information.
z = anytrue(A)
A is bool,
the function returns true if any
elements are true;
otherwise false. When the element type
is something else,
see (section 4.3.2) for more information.
z = sumval(A)
A's values.z = sumsqval(A)
A's values.z = meanval(A)
z = meansqval(A)
The following functions reduce a vector to a single value that corresponds to an element within the vector.
z = maxval(A, idx)
A.
Set idx to the index of this element
(A.get(idx) == z).z = maxmgval(A, idx)
A. Set idx to the index of
this element (mag(A.get(idx)) ==
z).z = maxmgsqval(A, idx)
A. Set idx to the index of
this element (magsq(A.get(idx)) ==
z).z = minval(A, idx)
A.
Set idx to the index of this element
(A.get(idx) == z).z = minmgval(A, idx)
A. Set idx to the index of
this element (mag(A.get(idx)) ==
z).z = minmgsqval(A, idx)
A. Set idx to the index of
this element (magsq(A.get(idx)) ==
z).
z = cvjdot(A, B)
Z = kron(A, B)
z = dot(A, B)
Z = outer(A, B)
Z = blackman(len)
len. (section 4.7.1)Z = cheby(len, ripple)
ripple and having
length len. (section 4.7.2)Z = hanning(len)
len. (section 4.7.4)Z = kaiser(len, beta)
beta and having length
len. (section 4.7.5)
VSIPL++ provides facilities to perform convolutions on
vectors through the class template Convolution
(section 4.8.1). Once constructed with compile-time selections, a convolution
object can be applied to an input vector to produce results in an
output vector.
VSIPL++ provides facilities to perform correlations on
vectors through the class template Correlation
(section 4.8.2). Once constructed with compile-time selections, a correlation
object can be applied to an input vector and a kernel vector to
produce results in an output vector.
VSIPL++ provides facilities to perform an FIR filter on
vectors through the class template Fir (section 4.8.3). Once constructed with compile-time selections, an FIR object
can be applied to an input vector to produce results in an output
vector.
VSIPL++ provides facilities to perform an histogram on vectors
through the class template Histogram. Once constructed
with compile-time selections, a histogram object can be applied to an input
vector to produce results in an output vector.
VSIPL++ provides facilities to generate vectors of random number through the class template Rand. Once constructed with compile-time selections, a Rand object can generate a vector of random numbers through the invocation of one of its member functions..
VSIPL++ provides a function freqswap to swap
halves of vectors. (section 4.7.3)
VSIPL++ allows subviews of vectors to be created. A subview represents a subset of the original vector. The subview aliases the original vector, that is changes to the subview will be reflected in the original vector, and visa versa.
A(Domain<1>(start, stride, size))
vector. Subview is of
sizesize.The nth element of the subview refers to
thestart + n*stride element
ofA.To represent a vector subview in a variable, it is necessary to use the correct block type. Otherwise the variable will copy the values in the subview.
Vector<T>::subview_type A = view(Domain<1>(f, s, l));
real(A)
imag(A)
User-defined functions that accept a vector as a parameter should use a template parameter to represent the vector's block type. This allows vectors with different block types, such as those created by subview operators, to be handled by the function.
For example, to write a function that accepts a vector of floating-point values:
template <typename BlockT>
...
function(Vector<float, BlockT> vector)
{
...
}
If the function can handle different value types (such as single- and double-precision), the value type can also be made a template parameter:
template <typename, T
typename BlockT>
...
function(Vector<T, BlockT> vector)
{
...
}