Classes | Public Types | Public Member Functions | Private Types | List of all members
blaze::DenseSubvector< VT, AF, TF > Class Template Reference

View on a specific subvector of a dense vector.The DenseSubvector template represents a view on a specific subvector of a dense vector primitive. The type of the dense vector is specified via the first template parameter: More...

#include <DenseSubvector.h>

Inherits blaze::DenseVector< DenseSubvector< VT, AF, TF >, TF >, and blaze::Subvector.

Classes

class  SubvectorIterator
 Iterator over the elements of the sparse subvector. More...
 

Public Types

enum  { vectorizable = VT::vectorizable }
 Compilation switch for the expression template evaluation strategy.
 
enum  { smpAssignable = VT::smpAssignable }
 Compilation switch for the expression template assignment strategy.
 
typedef DenseSubvector< VT, AF, TF > This
 Type of this DenseSubvector instance.
 
typedef SubvectorTrait< VT >::Type ResultType
 Result type for expression template evaluations.
 
typedef ResultType::TransposeType TransposeType
 Transpose type for expression template evaluations.
 
typedef VT::ElementType ElementType
 Type of the subvector elements.
 
typedef IT::Type IntrinsicType
 Intrinsic type of the subvector elements.
 
typedef VT::ReturnType ReturnType
 Return type for expression template evaluations.
 
typedef const DenseSubvectorCompositeType
 Data type for composite expression templates.
 
typedef VT::ConstReference ConstReference
 Reference to a constant subvector value.
 
typedef IfTrue< useConst, ConstReference, typename VT::Reference >::Type Reference
 Reference to a non-constant subvector value.
 
typedef const ElementTypeConstPointer
 Pointer to a constant subvector value.
 
typedef IfTrue< useConst, ConstPointer, ElementType * >::Type Pointer
 Pointer to a non-constant subvector value.
 
typedef SubvectorIterator< typename VT::ConstIterator > ConstIterator
 Iterator over constant elements.
 
typedef IfTrue< useConst, ConstIterator, SubvectorIterator< typename VT::Iterator > >::Type Iterator
 Iterator over non-constant elements.
 
typedef VT VectorType
 Type of the vector.
 

Public Member Functions

template<typename VT2 >
DenseSubvector< VT, AF, TF > & operator= (const Vector< VT2, TF > &rhs)
 Assignment operator for different vectors. More...
 
template<typename VT2 >
DenseSubvector< VT, AF, TF > & operator+= (const Vector< VT2, TF > &rhs)
 Addition assignment operator for the addition of a vector ( $ \vec{a}+=\vec{b} $). More...
 
template<typename VT2 >
DenseSubvector< VT, AF, TF > & operator-= (const Vector< VT2, TF > &rhs)
 Subtraction assignment operator for the subtraction of a vector ( $ \vec{a}-=\vec{b} $). More...
 
template<typename VT2 >
DenseSubvector< VT, AF, TF > & operator*= (const Vector< VT2, TF > &rhs)
 Multiplication assignment operator for the multiplication of a vector ( $ \vec{a}*=\vec{b} $). More...
 
template<typename Other >
EnableIf< IsNumeric< Other >, DenseSubvector< VT, AF, TF > >::Type & operator*= (Other rhs)
 Multiplication assignment operator for the multiplication between a subvector and a scalar value ( $ \vec{a}*=s $). More...
 
template<typename Other >
EnableIf< IsNumeric< Other >, DenseSubvector< VT, AF, TF > >::Type & operator/= (Other rhs)
 Division assignment operator for the division of a subvector by a scalar value ( $ \vec{a}/=s $). More...
 
template<typename Other >
DenseSubvector< VT, AF, TF > & scale (const Other &scalar)
 Scaling of the dense subvector by the scalar value scalar ( $ \vec{a}=\vec{b}*s $). More...
 
template<typename VT2 >
DisableIf< typename DenseSubvector< VT, AF, TF >::BLAZE_TEMPLATE VectorizedAssign< VT2 > >::Type assign (const DenseVector< VT2, TF > &rhs)
 Default implementation of the assignment of a dense vector. More...
 
template<typename VT2 >
EnableIf< typename DenseSubvector< VT, AF, TF >::BLAZE_TEMPLATE VectorizedAssign< VT2 > >::Type assign (const DenseVector< VT2, TF > &rhs)
 Intrinsic optimized implementation of the assignment of a dense vector. More...
 
template<typename VT2 >
DisableIf< typename DenseSubvector< VT, AF, TF >::BLAZE_TEMPLATE VectorizedAddAssign< VT2 > >::Type addAssign (const DenseVector< VT2, TF > &rhs)
 Default implementation of the addition assignment of a dense vector. More...
 
template<typename VT2 >
EnableIf< typename DenseSubvector< VT, AF, TF >::BLAZE_TEMPLATE VectorizedAddAssign< VT2 > >::Type addAssign (const DenseVector< VT2, TF > &rhs)
 Intrinsic optimized implementation of the addition assignment of a dense vector. More...
 
template<typename VT2 >
DisableIf< typename DenseSubvector< VT, AF, TF >::BLAZE_TEMPLATE VectorizedSubAssign< VT2 > >::Type subAssign (const DenseVector< VT2, TF > &rhs)
 Default implementation of the subtraction assignment of a dense vector. More...
 
template<typename VT2 >
EnableIf< typename DenseSubvector< VT, AF, TF >::BLAZE_TEMPLATE VectorizedSubAssign< VT2 > >::Type subAssign (const DenseVector< VT2, TF > &rhs)
 Intrinsic optimized implementation of the subtraction assignment of a dense vector. More...
 
template<typename VT2 >
DisableIf< typename DenseSubvector< VT, AF, TF >::BLAZE_TEMPLATE VectorizedMultAssign< VT2 > >::Type multAssign (const DenseVector< VT2, TF > &rhs)
 Default implementation of the multiplication assignment of a dense vector. More...
 
template<typename VT2 >
EnableIf< typename DenseSubvector< VT, AF, TF >::BLAZE_TEMPLATE VectorizedMultAssign< VT2 > >::Type multAssign (const DenseVector< VT2, TF > &rhs)
 Intrinsic optimized implementation of the multiplication assignment of a dense vector. More...
 
BLAZE_ALWAYS_INLINE VectorTypeoperator~ ()
 Conversion operator for non-constant vectors. More...
 
BLAZE_ALWAYS_INLINE const VectorTypeoperator~ () const
 Conversion operator for constant vectors. More...
 
Constructors
 DenseSubvector (Operand vector, size_t index, size_t n)
 The constructor for DenseSubvector. More...
 
Data access functions
Reference operator[] (size_t index)
 Subscript operator for the direct access to the subvector elements. More...
 
ConstReference operator[] (size_t index) const
 Subscript operator for the direct access to the subvector elements. More...
 
Pointer data ()
 Low-level data access to the subvector elements. More...
 
ConstPointer data () const
 Low-level data access to the subvector elements. More...
 
Iterator begin ()
 Returns an iterator to the first element of the subvector. More...
 
ConstIterator begin () const
 Returns an iterator to the first element of the subvector. More...
 
ConstIterator cbegin () const
 Returns an iterator to the first element of the subvector. More...
 
Iterator end ()
 Returns an iterator just past the last element of the subvector. More...
 
ConstIterator end () const
 Returns an iterator just past the last element of the subvector. More...
 
ConstIterator cend () const
 Returns an iterator just past the last element of the subvector. More...
 
Assignment operators
DenseSubvectoroperator= (const ElementType &rhs)
 Homogenous assignment to all subvector elements. More...
 
DenseSubvectoroperator= (const DenseSubvector &rhs)
 Copy assignment operator for DenseSubvector. More...
 
template<typename VT2 >
DenseSubvectoroperator= (const Vector< VT2, TF > &rhs)
 
template<typename VT2 >
DenseSubvectoroperator+= (const Vector< VT2, TF > &rhs)
 
template<typename VT2 >
DenseSubvectoroperator-= (const Vector< VT2, TF > &rhs)
 
template<typename VT2 >
DenseSubvectoroperator*= (const Vector< VT2, TF > &rhs)
 
template<typename Other >
EnableIf< IsNumeric< Other >, DenseSubvector >::Type & operator*= (Other rhs)
 
template<typename Other >
EnableIf< IsNumeric< Other >, DenseSubvector >::Type & operator/= (Other rhs)
 
Utility functions
size_t size () const
 Returns the current size/dimension of the dense subvector. More...
 
size_t capacity () const
 Returns the maximum capacity of the dense subvector. More...
 
size_t nonZeros () const
 Returns the number of non-zero elements in the subvector. More...
 
void reset ()
 Reset to the default initial values. More...
 
template<typename Other >
DenseSubvectorscale (const Other &scalar)
 
Expression template evaluation functions
template<typename Other >
bool canAlias (const Other *alias) const
 Returns whether the dense subvector can alias with the given address alias. More...
 
template<typename VT2 , bool AF2, bool TF2>
bool canAlias (const DenseSubvector< VT2, AF2, TF2 > *alias) const
 Returns whether the dense subvector can alias with the given dense subvector alias. More...
 
template<typename Other >
bool isAliased (const Other *alias) const
 Returns whether the dense subvector is aliased with the given address alias. More...
 
template<typename VT2 , bool AF2, bool TF2>
bool isAliased (const DenseSubvector< VT2, AF2, TF2 > *alias) const
 Returns whether the dense subvector is aliased with the given dense subvector alias. More...
 
bool isAligned () const
 Returns whether the subvector is properly aligned in memory. More...
 
bool canSMPAssign () const
 Returns whether the subvector can be used in SMP assignments. More...
 
IntrinsicType load (size_t index) const
 Aligned load of an intrinsic element of the dense subvector. More...
 
IntrinsicType loadu (size_t index) const
 Unaligned load of an intrinsic element of the dense subvector. More...
 
void store (size_t index, const IntrinsicType &value)
 Aligned store of an intrinsic element of the subvector. More...
 
void storeu (size_t index, const IntrinsicType &value)
 Unaligned store of an intrinsic element of the subvector. More...
 
void stream (size_t index, const IntrinsicType &value)
 Aligned, non-temporal store of an intrinsic element of the subvector. More...
 
template<typename VT2 >
DisableIf< VectorizedAssign< VT2 > >::Type assign (const DenseVector< VT2, TF > &rhs)
 
template<typename VT2 >
EnableIf< VectorizedAssign< VT2 > >::Type assign (const DenseVector< VT2, TF > &rhs)
 
template<typename VT2 >
void assign (const SparseVector< VT2, TF > &rhs)
 Default implementation of the assignment of a sparse vector. More...
 
template<typename VT2 >
DisableIf< VectorizedAddAssign< VT2 > >::Type addAssign (const DenseVector< VT2, TF > &rhs)
 
template<typename VT2 >
EnableIf< VectorizedAddAssign< VT2 > >::Type addAssign (const DenseVector< VT2, TF > &rhs)
 
template<typename VT2 >
void addAssign (const SparseVector< VT2, TF > &rhs)
 Default implementation of the addition assignment of a sparse vector. More...
 
template<typename VT2 >
DisableIf< VectorizedSubAssign< VT2 > >::Type subAssign (const DenseVector< VT2, TF > &rhs)
 
template<typename VT2 >
EnableIf< VectorizedSubAssign< VT2 > >::Type subAssign (const DenseVector< VT2, TF > &rhs)
 
template<typename VT2 >
void subAssign (const SparseVector< VT2, TF > &rhs)
 Default implementation of the subtraction assignment of a sparse vector. More...
 
template<typename VT2 >
DisableIf< VectorizedMultAssign< VT2 > >::Type multAssign (const DenseVector< VT2, TF > &rhs)
 
template<typename VT2 >
EnableIf< VectorizedMultAssign< VT2 > >::Type multAssign (const DenseVector< VT2, TF > &rhs)
 
template<typename VT2 >
void multAssign (const SparseVector< VT2, TF > &rhs)
 Default implementation of the multiplication assignment of a sparse vector. More...
 

Private Types

enum  { useConst = IsConst<VT>::value }
 Compilation switch for the non-const reference and iterator types. More...
 
typedef If< IsExpression< VT >, VT, VT & >::Type Operand
 Composite data type of the dense vector expression.
 
typedef IntrinsicTrait< typename VT::ElementType > IT
 Intrinsic trait for the vector element type.
 

Private Attributes

Member variables
Operand vector_
 The dense vector containing the subvector.
 
const size_t offset_
 The offset of the subvector within the dense vector.
 
const size_t size_
 The size of the subvector.
 
const size_t rest_
 The number of remaining elements in an unaligned intrinsic operation.
 
const size_t final_
 The final index for unaligned intrinsic operations. More...
 
const bool isAligned_
 Memory alignment flag. More...
 

Detailed Description

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
class blaze::DenseSubvector< VT, AF, TF >

View on a specific subvector of a dense vector.

The DenseSubvector template represents a view on a specific subvector of a dense vector primitive. The type of the dense vector is specified via the first template parameter:

template< typename VT, bool AF, bool TF >


Setup of Dense Subvectors

A view on a dense subvector can be created very conveniently via the subvector() function:

DenseVectorType x;
// ... Resizing and initialization
// Create a subvector from index 8 with a size of 16 (i.e. in the range [8..23])

This view can be treated as any other dense vector, i.e. it can be assigned to, it can be copied from, and it can be used in arithmetic operations. The view can also be used on both sides of an assignment: The subvector can either be used as an alias to grant write access to a specific subvector of a dense vector primitive on the left-hand side of an assignment or to grant read-access to a specific subvector of a dense vector primitive or expression on the right-hand side of an assignment. The following example demonstrates this in detail:

DenseVectorType x;
SparseVectorType y;
DenseMatrixType A;
// ... Resizing and initialization
// Create a subvector from index 0 with a size of 10 (i.e. in the range [0..9])
// Setting the first ten elements of x to the 2nd row of matrix A
sv = row( A, 2UL );
// Setting the second ten elements of x to y
subvector( x, 10UL, 10UL ) = y;
// Setting the 3rd row of A to a subvector of x
row( A, 3UL ) = subvector( x, 3UL, 10UL );
// Setting x to a subvector of the result of the addition between y and the 1st row of A
x = subvector( y + row( A, 1UL ), 2UL, 5UL )


Element access

A dense subvector can be used like any other dense vector. For instance, the elements of the dense subvector can be directly accessed with the subscript operator.

VectorType v;
// ... Resizing and initialization
// Creating an 8-dimensional subvector, starting from index 4
// Setting the 1st element of the subvector, which corresponds to
// the element at index 5 in vector v
sv[1] = 2.0;

The numbering of the subvector elements is

\[\left(\begin{array}{*{5}{c}} 0 & 1 & 2 & \cdots & N-1 \\ \end{array}\right),\]

where N is the specified size of the subvector. Alternatively, the elements of a subvector can be traversed via iterators. Just as with vectors, in case of non-const subvectors, begin() and end() return an Iterator, which allows a manipulation of the non-zero values, in case of constant subvectors a ConstIterator is returned:

typedef blaze::DenseSubvector<VectorType> SubvectorType;
VectorType v( 256UL );
// ... Resizing and initialization
// Creating a reference to a specific subvector of vector v
SubvectorType sv = subvector( v, 16UL, 64UL );
for( SubvectorType::Iterator it=sv.begin(); it!=sv.end(); ++it ) {
*it = ...; // OK: Write access to the dense subvector value.
... = *it; // OK: Read access to the dense subvector value.
}
for( SubvectorType::ConstIterator it=sv.begin(); it!=sv.end(); ++it ) {
*it = ...; // Compilation error: Assignment to the value via a ConstIterator is invalid.
... = *it; // OK: Read access to the dense subvector value.
}


Common Operations

The current number of subvector elements can be obtained via the size() function, the current capacity via the capacity() function, and the number of non-zero elements via the nonZeros() function. However, since subvector are views on a specific subvector of a vector, several operations are not possible on views, such as resizing and swapping:

typedef blaze::DenseSubvector<VectorType> SubvectorType;
VectorType v( 42UL );
// ... Resizing and initialization
// Creating a view on the range [5..15] of vector v
SubvectorType sv = subvector( v, 5UL, 10UL );
sv.size(); // Returns the number of elements in the subvector
sv.capacity(); // Returns the capacity of the subvector
sv.nonZeros(); // Returns the number of non-zero elements contained in the subvector
sv.resize( 84UL ); // Compilation error: Cannot resize a subvector of a vector
SubvectorType sv2 = subvector( v, 15UL, 10UL );
swap( sv, sv2 ); // Compilation error: Swap operation not allowed


Arithmetic Operations

The following example gives an impression of the use of DenseSubvector within arithmetic operations. All operations (addition, subtraction, multiplication, scaling, ...) can be performed on all possible combinations of dense and sparse vectors with fitting element types:

DenseVectorType d1, d2, d3;
SparseVectorType s1, s2;
// ... Resizing and initialization
DenseMatrixType A;
SubvectorType sv( subvector( d1, 0UL, 10UL ) ); // View on the range [0..9] of vector d1
sv = d2; // Dense vector initialization of the range [0..9]
subvector( d1, 10UL, 10UL ) = s1; // Sparse vector initialization of the range [10..19]
d3 = sv + d2; // Dense vector/dense vector addition
s2 = s1 + subvector( d1, 10UL, 10UL ); // Sparse vector/dense vector addition
d2 = sv * subvector( d1, 20UL, 10UL ); // Component-wise vector multiplication
subvector( d1, 3UL, 4UL ) *= 2.0; // In-place scaling of the range [3..6]
d2 = subvector( d1, 7UL, 3UL ) * 2.0; // Scaling of the range [7..9]
d2 = 2.0 * subvector( d1, 7UL, 3UL ); // Scaling of the range [7..9]
subvector( d1, 0UL , 10UL ) += d2; // Addition assignment
subvector( d1, 10UL, 10UL ) -= s2; // Subtraction assignment
subvector( d1, 20UL, 10UL ) *= sv; // Multiplication assignment
double scalar = subvector( d1, 5UL, 10UL ) * trans( s1 ); // Scalar/dot/inner product between two vectors
A = trans( s1 ) * subvector( d1, 4UL, 16UL ); // Outer product between two vectors


Aligned Subvectors

Usually subvectors can be defined anywhere within a vector. They may start at any position and may have an arbitrary size (only restricted by the size of the underlying vector). However, in contrast to vectors themselves, which are always properly aligned in memory and therefore can provide maximum performance, this means that subvectors in general have to be considered to be unaligned. This can be made explicit by the blaze::unaligned flag:

DenseVectorType x;
// ... Resizing and initialization
// Identical creations of an unaligned subvector in the range [8..23]
blaze::DenseSubvector<DenseVectorType> sv2 = subvector<unaligned>( x, 8UL, 16UL );
blaze::DenseSubvector<DenseVectorType,unaligned> sv4 = subvector<unaligned>( x, 8UL, 16UL );

All of these calls to the subvector() function are identical. Whether the alignment flag is explicitly specified or not, it always returns an unaligned subvector. Whereas this may provide full flexibility in the creation of subvectors, this might result in performance restrictions (even in case the specified subvector could be aligned). However, it is also possible to create aligned subvectors. Aligned subvectors are identical to unaligned subvectors in all aspects, except that they may pose additional alignment restrictions and therefore have less flexibility during creation, but don't suffer from performance penalties and provide the same performance as the underlying vector. Aligned subvectors are created by explicitly specifying the blaze::aligned flag:

// Creating an aligned subvector in the range [8..23]
blaze::DenseSubvector<DenseVectorType,aligned> sv = subvector<aligned>( x, 8UL, 16UL );

The alignment restrictions refer to system dependent address restrictions for the used element type and the available vectorization mode (SSE, AVX, ...). The following source code gives some examples for a double precision dense vector, assuming that AVX is available, which packs 4 double values into an intrinsic vector:

VectorType d( 17UL );
// ... Resizing and initialization
// OK: Starts at the beginning and the size is a multiple of 4
SubvectorType dsv1 = subvector<aligned>( d, 0UL, 12UL );
// OK: Start index and the size are both a multiple of 4
SubvectorType dsv2 = subvector<aligned>( d, 4UL, 8UL );
// OK: The start index is a multiple of 4 and the subvector includes the last element
SubvectorType dsv3 = subvector<aligned>( d, 8UL, 9UL );
// Error: Start index is not a multiple of 4
SubvectorType dsv4 = subvector<aligned>( d, 5UL, 8UL );
// Error: Size is not a multiple of 4 and the subvector does not include the last element
SubvectorType dsv5 = subvector<aligned>( d, 8UL, 5UL );


Subvectors on Subvectors

It is also possible to create a subvector view on another subvector. In this context it is important to remember that the type returned by the subvector() function is the same type as the type of the given subvector, since the view on a subvector is just another view on the underlying dense vector:

typedef blaze::DenseSubvector<VectorType> SubvectorType;
VectorType d1;
// ... Resizing and initialization
// Creating a subvector view on the dense vector d1
SubvectorType sv1 = subvector( d1, 5UL, 10UL );
// Creating a subvector view on the dense subvector sv1
SubvectorType sv2 = subvector( sv1, 1UL, 5UL );

Constructor & Destructor Documentation

template<typename VT , bool AF, bool TF>
blaze::DenseSubvector< VT, AF, TF >::DenseSubvector ( Operand  vector,
size_t  index,
size_t  n 
)
inlineexplicit

The constructor for DenseSubvector.

Parameters
vectorThe dense vector containing the subvector.
indexThe first index of the subvector in the given vector.
nThe size of the subvector.
Exceptions
std::invalid_argumentInvalid subvector specification.

In case the subvector is not properly specified (i.e. if the specified first index is larger than the size of the given vector or the subvector is specified beyond the size of the vector) a std::invalid_argument exception is thrown.

Member Function Documentation

template<typename VT , bool AF, bool TF>
template<typename VT2 >
void blaze::DenseSubvector< VT, AF, TF >::addAssign ( const SparseVector< VT2, TF > &  rhs)
inline

Default implementation of the addition assignment of a sparse vector.

Parameters
rhsThe right-hand side sparse vector to be added.
Returns
void

This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename VT2 >
DisableIf< typename DenseSubvector<VT,AF,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT2> >::Type blaze::DenseSubvector< VT, AF, TF >::addAssign ( const DenseVector< VT2, TF > &  rhs)
inline

Default implementation of the addition assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector to be added.
Returns
void

This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename VT2 >
EnableIf< typename DenseSubvector<VT,AF,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT2> >::Type blaze::DenseSubvector< VT, AF, TF >::addAssign ( const DenseVector< VT2, TF > &  rhs)
inline

Intrinsic optimized implementation of the addition assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector to be added.
Returns
void

This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

template<typename VT , bool AF, bool TF>
template<typename VT2 >
void blaze::DenseSubvector< VT, AF, TF >::assign ( const SparseVector< VT2, TF > &  rhs)
inline

Default implementation of the assignment of a sparse vector.

Parameters
rhsThe right-hand side sparse vector to be assigned.
Returns
void

This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename VT2 >
DisableIf< typename DenseSubvector<VT,AF,TF>::BLAZE_TEMPLATE VectorizedAssign<VT2> >::Type blaze::DenseSubvector< VT, AF, TF >::assign ( const DenseVector< VT2, TF > &  rhs)
inline

Default implementation of the assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector to be assigned.
Returns
void

This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename VT2 >
EnableIf< typename DenseSubvector<VT,AF,TF>::BLAZE_TEMPLATE VectorizedAssign<VT2> >::Type blaze::DenseSubvector< VT, AF, TF >::assign ( const DenseVector< VT2, TF > &  rhs)
inline

Intrinsic optimized implementation of the assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector to be assigned.
Returns
void

This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF >::Iterator blaze::DenseSubvector< VT, AF, TF >::begin ( )
inline

Returns an iterator to the first element of the subvector.

Returns
Iterator to the first element of the subvector.

This function returns an iterator to the first element of the subvector.

template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF >::ConstIterator blaze::DenseSubvector< VT, AF, TF >::begin ( ) const
inline

Returns an iterator to the first element of the subvector.

Returns
Iterator to the first element of the subvector.

This function returns an iterator to the first element of the subvector.

template<typename VT , bool AF, bool TF>
template<typename Other >
bool blaze::DenseSubvector< VT, AF, TF >::canAlias ( const Other *  alias) const
inline

Returns whether the dense subvector can alias with the given address alias.

Parameters
aliasThe alias to be checked.
Returns
true in case the alias corresponds to this dense subvector, false if not.

This function returns whether the given address can alias with the dense subvector. In contrast to the isAliased() function this function is allowed to use compile time expressions to optimize the evaluation.

template<typename VT , bool AF, bool TF>
template<typename VT2 , bool AF2, bool TF2>
bool blaze::DenseSubvector< VT, AF, TF >::canAlias ( const DenseSubvector< VT2, AF2, TF2 > *  alias) const
inline

Returns whether the dense subvector can alias with the given dense subvector alias.

Parameters
aliasThe alias to be checked.
Returns
true in case the alias corresponds to this dense subvector, false if not.

This function returns whether the given address can alias with the dense subvector. In contrast to the isAliased() function this function is allowed to use compile time expressions to optimize the evaluation.

template<typename VT , bool AF, bool TF>
bool blaze::DenseSubvector< VT, AF, TF >::canSMPAssign ( ) const
inline

Returns whether the subvector can be used in SMP assignments.

Returns
true in case the subvector can be used in SMP assignments, false if not.

This function returns whether the subvector can be used in SMP assignments. In contrast to the smpAssignable member enumeration, which is based solely on compile time information, this function additionally provides runtime information (as for instance the current size of the subvector).

template<typename VT , bool AF, bool TF>
size_t blaze::DenseSubvector< VT, AF, TF >::capacity ( ) const
inline

Returns the maximum capacity of the dense subvector.

Returns
The capacity of the dense subvector.
template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF >::ConstIterator blaze::DenseSubvector< VT, AF, TF >::cbegin ( ) const
inline

Returns an iterator to the first element of the subvector.

Returns
Iterator to the first element of the subvector.

This function returns an iterator to the first element of the subvector.

template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF >::ConstIterator blaze::DenseSubvector< VT, AF, TF >::cend ( ) const
inline

Returns an iterator just past the last element of the subvector.

Returns
Iterator just past the last element of the subvector.

This function returns an iterator just past the last element of the subvector.

template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF >::Pointer blaze::DenseSubvector< VT, AF, TF >::data ( )
inline

Low-level data access to the subvector elements.

Returns
Pointer to the internal element storage.

This function returns a pointer to the internal storage of the dense subvector.

template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF >::ConstPointer blaze::DenseSubvector< VT, AF, TF >::data ( ) const
inline

Low-level data access to the subvector elements.

Returns
Pointer to the internal element storage.

This function returns a pointer to the internal storage of the dense subvector.

template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF >::Iterator blaze::DenseSubvector< VT, AF, TF >::end ( )
inline

Returns an iterator just past the last element of the subvector.

Returns
Iterator just past the last element of the subvector.

This function returns an iterator just past the last element of the subvector.

template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF >::ConstIterator blaze::DenseSubvector< VT, AF, TF >::end ( ) const
inline

Returns an iterator just past the last element of the subvector.

Returns
Iterator just past the last element of the subvector.

This function returns an iterator just past the last element of the subvector.

template<typename VT , bool AF, bool TF>
template<typename Other >
bool blaze::DenseSubvector< VT, AF, TF >::isAliased ( const Other *  alias) const
inline

Returns whether the dense subvector is aliased with the given address alias.

Parameters
aliasThe alias to be checked.
Returns
true in case the alias corresponds to this dense subvector, false if not.

This function returns whether the given address is aliased with the dense subvector. In contrast to the canAlias() function this function is not allowed to use compile time expressions to optimize the evaluation.

template<typename VT , bool AF, bool TF>
template<typename VT2 , bool AF2, bool TF2>
bool blaze::DenseSubvector< VT, AF, TF >::isAliased ( const DenseSubvector< VT2, AF2, TF2 > *  alias) const
inline

Returns whether the dense subvector is aliased with the given dense subvector alias.

Parameters
aliasThe alias to be checked.
Returns
true in case the alias corresponds to this dense subvector, false if not.

This function returns whether the given address is aliased with the dense subvector. In contrast to the canAlias() function this function is not allowed to use compile time expressions to optimize the evaluation.

template<typename VT , bool AF, bool TF>
bool blaze::DenseSubvector< VT, AF, TF >::isAligned ( ) const
inline

Returns whether the subvector is properly aligned in memory.

Returns
true in case the subvector is aligned, false if not.

This function returns whether the subvector is guaranteed to be properly aligned in memory, i.e. whether the beginning and the end of the subvector are guaranteed to conform to the alignment restrictions of the underlying element type.

template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF >::IntrinsicType blaze::DenseSubvector< VT, AF, TF >::load ( size_t  index) const
inline

Aligned load of an intrinsic element of the dense subvector.

Parameters
indexAccess index. The index must be smaller than the number of subvector elements.
Returns
The loaded intrinsic element.

This function performs an aligned load of a specific intrinsic element of the dense subvector. The index must be smaller than the number of subvector elements and it must be a multiple of the number of values inside the intrinsic element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.

template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF >::IntrinsicType blaze::DenseSubvector< VT, AF, TF >::loadu ( size_t  index) const
inline

Unaligned load of an intrinsic element of the dense subvector.

Parameters
indexAccess index. The index must be smaller than the number of subvector elements.
Returns
The loaded intrinsic element.

This function performs an unaligned load of a specific intrinsic element of the dense subvector. The index must be smaller than the number of subvector elements and it must be a multiple of the number of values inside the intrinsic element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.

template<typename VT , bool AF, bool TF>
template<typename VT2 >
void blaze::DenseSubvector< VT, AF, TF >::multAssign ( const SparseVector< VT2, TF > &  rhs)
inline

Default implementation of the multiplication assignment of a sparse vector.

Parameters
rhsThe right-hand side sparse vector to be multiplied.
Returns
void

This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename VT2 >
DisableIf< typename DenseSubvector<VT,AF,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT2> >::Type blaze::DenseSubvector< VT, AF, TF >::multAssign ( const DenseVector< VT2, TF > &  rhs)
inline

Default implementation of the multiplication assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector to be multiplied.
Returns
void

This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename VT2 >
EnableIf< typename DenseSubvector<VT,AF,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT2> >::Type blaze::DenseSubvector< VT, AF, TF >::multAssign ( const DenseVector< VT2, TF > &  rhs)
inline

Intrinsic optimized implementation of the multiplication assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector to be multiplied.
Returns
void

This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

template<typename VT , bool AF, bool TF>
size_t blaze::DenseSubvector< VT, AF, TF >::nonZeros ( ) const
inline

Returns the number of non-zero elements in the subvector.

Returns
The number of non-zero elements in the subvector.

Note that the number of non-zero elements is always less than or equal to the current size of the subvector.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename VT2 >
DenseSubvector<VT,AF,TF>& blaze::DenseSubvector< VT, AF, TF >::operator*= ( const Vector< VT2, TF > &  rhs)
inline

Multiplication assignment operator for the multiplication of a vector ( $ \vec{a}*=\vec{b} $).

Parameters
rhsThe right-hand side vector to be multiplied with the dense subvector.
Returns
Reference to the assigned subvector.
Exceptions
std::invalid_argumentVector sizes do not match.

In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename Other >
EnableIf< IsNumeric<Other>, DenseSubvector<VT,AF,TF> >::Type& blaze::DenseSubvector< VT, AF, TF >::operator*= ( Other  rhs)
inline

Multiplication assignment operator for the multiplication between a subvector and a scalar value ( $ \vec{a}*=s $).

Parameters
rhsThe right-hand side scalar value for the multiplication.
Returns
Reference to the assigned subvector.
template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename VT2 >
DenseSubvector<VT,AF,TF>& blaze::DenseSubvector< VT, AF, TF >::operator+= ( const Vector< VT2, TF > &  rhs)
inline

Addition assignment operator for the addition of a vector ( $ \vec{a}+=\vec{b} $).

Parameters
rhsThe right-hand side vector to be added to the dense subvector.
Returns
Reference to the assigned subvector.
Exceptions
std::invalid_argumentVector sizes do not match.

In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename VT2 >
DenseSubvector<VT,AF,TF>& blaze::DenseSubvector< VT, AF, TF >::operator-= ( const Vector< VT2, TF > &  rhs)
inline

Subtraction assignment operator for the subtraction of a vector ( $ \vec{a}-=\vec{b} $).

Parameters
rhsThe right-hand side vector to be subtracted from the dense subvector.
Returns
Reference to the assigned subvector.
Exceptions
std::invalid_argumentVector sizes do not match.

In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename Other >
EnableIf< IsNumeric<Other>, DenseSubvector<VT,AF,TF> >::Type& blaze::DenseSubvector< VT, AF, TF >::operator/= ( Other  rhs)
inline

Division assignment operator for the division of a subvector by a scalar value ( $ \vec{a}/=s $).

Parameters
rhsThe right-hand side scalar value for the division.
Returns
Reference to the assigned subvector.

Note: A division by zero is only checked by an user assert.

template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF > & blaze::DenseSubvector< VT, AF, TF >::operator= ( const ElementType rhs)
inline

Homogenous assignment to all subvector elements.

Parameters
rhsScalar value to be assigned to all subvector elements.
Returns
Reference to the assigned subvector.
template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF > & blaze::DenseSubvector< VT, AF, TF >::operator= ( const DenseSubvector< VT, AF, TF > &  rhs)
inline

Copy assignment operator for DenseSubvector.

Parameters
rhsDense subvector to be copied.
Returns
Reference to the assigned subvector.
Exceptions
std::invalid_argumentSubvector sizes do not match.

In case the current sizes of the two subvectors don't match, a std::invalid_argument exception is thrown.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename VT2 >
DenseSubvector<VT,AF,TF>& blaze::DenseSubvector< VT, AF, TF >::operator= ( const Vector< VT2, TF > &  rhs)
inline

Assignment operator for different vectors.

Parameters
rhsVector to be assigned.
Returns
Reference to the assigned subvector.
Exceptions
std::invalid_argumentVector sizes do not match.

In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.

template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF >::Reference blaze::DenseSubvector< VT, AF, TF >::operator[] ( size_t  index)
inline

Subscript operator for the direct access to the subvector elements.

Parameters
indexAccess index. The index must be smaller than the number of subvector elements.
Returns
Reference to the accessed value.
template<typename VT , bool AF, bool TF>
DenseSubvector< VT, AF, TF >::ConstReference blaze::DenseSubvector< VT, AF, TF >::operator[] ( size_t  index) const
inline

Subscript operator for the direct access to the subvector elements.

Parameters
indexAccess index. The index must be smaller than the number of subvector columns.
Returns
Reference to the accessed value.
template<typename VT, bool TF>
BLAZE_ALWAYS_INLINE VectorType& blaze::Vector< VT, TF >::operator~ ( )
inlineinherited

Conversion operator for non-constant vectors.

Returns
Reference of the actual type of the vector.
template<typename VT, bool TF>
BLAZE_ALWAYS_INLINE const VectorType& blaze::Vector< VT, TF >::operator~ ( ) const
inlineinherited

Conversion operator for constant vectors.

Returns
Const reference of the actual type of the vector.
template<typename VT , bool AF, bool TF>
void blaze::DenseSubvector< VT, AF, TF >::reset ( )
inline

Reset to the default initial values.

Returns
void
template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename Other >
DenseSubvector<VT,AF,TF>& blaze::DenseSubvector< VT, AF, TF >::scale ( const Other &  scalar)
inline

Scaling of the dense subvector by the scalar value scalar ( $ \vec{a}=\vec{b}*s $).

Parameters
scalarThe scalar value for the subvector scaling.
Returns
Reference to the dense subvector.
template<typename VT , bool AF, bool TF>
size_t blaze::DenseSubvector< VT, AF, TF >::size ( ) const
inline

Returns the current size/dimension of the dense subvector.

Returns
The size of the dense subvector.
template<typename VT , bool AF, bool TF>
void blaze::DenseSubvector< VT, AF, TF >::store ( size_t  index,
const IntrinsicType value 
)
inline

Aligned store of an intrinsic element of the subvector.

Parameters
indexAccess index. The index must be smaller than the number of subvector elements.
valueThe intrinsic element to be stored.
Returns
void

This function performs an aligned store a specific intrinsic element of the dense subvector. The index must be smaller than the number of subvector elements and it must be a multiple of the number of values inside the intrinsic element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.

template<typename VT , bool AF, bool TF>
void blaze::DenseSubvector< VT, AF, TF >::storeu ( size_t  index,
const IntrinsicType value 
)
inline

Unaligned store of an intrinsic element of the subvector.

Parameters
indexAccess index. The index must be smaller than the number of subvector elements.
valueThe intrinsic element to be stored.
Returns
void

This function performs an unaligned store a specific intrinsic element of the dense subvector. The index must be smaller than the number of subvector elements and it must be a multiple of the number of values inside the intrinsic element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.

template<typename VT , bool AF, bool TF>
void blaze::DenseSubvector< VT, AF, TF >::stream ( size_t  index,
const IntrinsicType value 
)
inline

Aligned, non-temporal store of an intrinsic element of the subvector.

Parameters
indexAccess index. The index must be smaller than the number of subvector elements.
valueThe intrinsic element to be stored.
Returns
void

This function performs an aligned, non-temporal store a specific intrinsic element of the dense subvector. The index must be smaller than the number of subvector elements and it must be a multiple of the number of values inside the intrinsic element. This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors.

template<typename VT , bool AF, bool TF>
template<typename VT2 >
void blaze::DenseSubvector< VT, AF, TF >::subAssign ( const SparseVector< VT2, TF > &  rhs)
inline

Default implementation of the subtraction assignment of a sparse vector.

Parameters
rhsThe right-hand side sparse vector to be subtracted.
Returns
void

This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename VT2 >
DisableIf< typename DenseSubvector<VT,AF,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT2> >::Type blaze::DenseSubvector< VT, AF, TF >::subAssign ( const DenseVector< VT2, TF > &  rhs)
inline

Default implementation of the subtraction assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector to be subtracted.
Returns
void

This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
template<typename VT2 >
EnableIf< typename DenseSubvector<VT,AF,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT2> >::Type blaze::DenseSubvector< VT, AF, TF >::subAssign ( const DenseVector< VT2, TF > &  rhs)
inline

Intrinsic optimized implementation of the subtraction assignment of a dense vector.

Parameters
rhsThe right-hand side dense vector to be subtracted.
Returns
void

This function must NOT be called explicitly! It is used internally for the performance optimized evaluation of expression templates. Calling this function explicitly might result in erroneous results and/or in compilation errors. Instead of using this function use the assignment operator.

Member Data Documentation

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
const size_t blaze::DenseSubvector< VT, AF, TF >::final_
private

The final index for unaligned intrinsic operations.

In case the subvector is not fully aligned and the subvector is involved in a vectorized operation, the final index indicates at which index a special treatment for the remaining elements is required.

template<typename VT, bool AF = unaligned, bool TF = IsRowVector<VT>::value>
const bool blaze::DenseSubvector< VT, AF, TF >::isAligned_
private

Memory alignment flag.

The alignment flag indicates whether the subvector is fully aligned. In case the subvector is fully aligned, no special handling has to be used for the last elements of the subvector in a vectorized operation. In order to be aligned, the following conditions must hold for the subvector:

  • The first element of the subvector must be aligned
  • The subvector must be at the end of the given vector or
  • The size of the subvector must be a multiple of the number of values per intrinsic element.

The documentation for this class was generated from the following file: