![]() |
Reference to a specific column of a dense matrix.The DenseColumn template represents a reference to a specific column of a dense matrix primitive. The type of the dense matrix is specified via the first template parameter: More...
#include <DenseColumn.h>
Inherits blaze::DenseVector< DenseColumn< MT, SO >, false >, and blaze::View.
Public Types | |
enum | { vectorizable = MT::vectorizable } |
Compilation switch for the expression template evaluation strategy. | |
enum | { smpAssignable = 0 } |
Compilation switch for the expression template assignment strategy. | |
typedef DenseColumn< MT, SO > | This |
Type of this DenseColumn instance. | |
typedef ColumnTrait< MT >::Type | ResultType |
Result type for expression template evaluations. | |
typedef ResultType::TransposeType | TransposeType |
Transpose type for expression template evaluations. | |
typedef MT::ElementType | ElementType |
Type of the column elements. | |
typedef IT::Type | IntrinsicType |
Intrinsic type of the column elements. | |
typedef MT::ReturnType | ReturnType |
Return type for expression template evaluations. | |
typedef const DenseColumn & | CompositeType |
Data type for composite expression templates. | |
typedef MT::ConstReference | ConstReference |
Reference to a constant column value. | |
typedef SelectType< useConst, ConstReference, typename MT::Reference >::Type | Reference |
Reference to a non-constant column value. | |
typedef const ElementType * | ConstPointer |
Pointer to a constant row value. | |
typedef SelectType< useConst, ConstPointer, ElementType * > ::Type | Pointer |
Pointer to a constant row value. | |
typedef MT::ConstIterator | ConstIterator |
Iterator over constant elements. | |
typedef SelectType< useConst, ConstIterator, typename MT::Iterator >::Type | Iterator |
Iterator over non-constant elements. | |
typedef VT | VectorType |
Type of the vector. | |
Public Member Functions | |
template<typename VT > | |
DenseColumn< MT, SO > & | operator= (const Vector< VT, false > &rhs) |
Assignment operator for different vectors. More... | |
template<typename VT > | |
DenseColumn< MT, SO > & | operator+= (const Vector< VT, false > &rhs) |
Addition assignment operator for the addition of a vector ( ![]() | |
template<typename VT > | |
DenseColumn< MT, SO > & | operator-= (const Vector< VT, false > &rhs) |
Subtraction assignment operator for the subtraction of a vector ( ![]() | |
template<typename VT > | |
DenseColumn< MT, SO > & | operator*= (const Vector< VT, false > &rhs) |
Multiplication assignment operator for the multiplication of a vector ( ![]() | |
template<typename Other > | |
EnableIf< IsNumeric< Other > , DenseColumn< MT, SO > >::Type & | operator*= (Other rhs) |
Multiplication assignment operator for the multiplication between a vector and a scalar value ( ![]() | |
template<typename Other > | |
EnableIf< IsNumeric< Other > , DenseColumn< MT, SO > >::Type & | operator/= (Other rhs) |
Division assignment operator for the division of a vector by a scalar value ( ![]() | |
template<typename Other > | |
DenseColumn< MT, SO > & | scale (const Other &scalar) |
Scaling of the column by the scalar value scalar ( ![]() | |
template<typename VT > | |
DisableIf< typename DenseColumn< MT, SO > ::BLAZE_TEMPLATE VectorizedAssign< VT > >::Type | assign (const DenseVector< VT, false > &rhs) |
Default implementation of the assignment of a dense vector. More... | |
template<typename VT > | |
EnableIf< typename DenseColumn < MT, SO >::BLAZE_TEMPLATE VectorizedAssign< VT > >::Type | assign (const DenseVector< VT, false > &rhs) |
Intrinsic optimized implementation of the assignment of a dense vector. More... | |
template<typename VT > | |
DisableIf< typename DenseColumn< MT, SO > ::BLAZE_TEMPLATE VectorizedAddAssign< VT > >::Type | addAssign (const DenseVector< VT, false > &rhs) |
Default implementation of the addition assignment of a dense vector. More... | |
template<typename VT > | |
EnableIf< typename DenseColumn < MT, SO >::BLAZE_TEMPLATE VectorizedAddAssign< VT > >::Type | addAssign (const DenseVector< VT, false > &rhs) |
Intrinsic optimized implementation of the addition assignment of a dense vector. More... | |
template<typename VT > | |
DisableIf< typename DenseColumn< MT, SO > ::BLAZE_TEMPLATE VectorizedSubAssign< VT > >::Type | subAssign (const DenseVector< VT, false > &rhs) |
Default implementation of the subtraction assignment of a dense vector. More... | |
template<typename VT > | |
EnableIf< typename DenseColumn < MT, SO >::BLAZE_TEMPLATE VectorizedSubAssign< VT > >::Type | subAssign (const DenseVector< VT, false > &rhs) |
Intrinsic optimized implementation of the subtraction assignment of a dense vector. More... | |
template<typename VT > | |
DisableIf< typename DenseColumn< MT, SO > ::BLAZE_TEMPLATE VectorizedMultAssign< VT > >::Type | multAssign (const DenseVector< VT, false > &rhs) |
Default implementation of the multiplication assignment of a dense vector. More... | |
template<typename VT > | |
EnableIf< typename DenseColumn < MT, SO >::BLAZE_TEMPLATE VectorizedMultAssign< VT > >::Type | multAssign (const DenseVector< VT, false > &rhs) |
Intrinsic optimized implementation of the multiplication assignment of a dense vector. More... | |
VectorType & | operator~ () |
Conversion operator for non-constant vectors. More... | |
const VectorType & | operator~ () const |
Conversion operator for constant vectors. More... | |
Constructors | |
DenseColumn (MT &matrix, size_t index) | |
The constructor for DenseColumn. More... | |
Data access functions | |
Reference | operator[] (size_t index) |
Subscript operator for the direct access to the column elements. More... | |
ConstReference | operator[] (size_t index) const |
Subscript operator for the direct access to the column elements. More... | |
Pointer | data () |
Low-level data access to the column elements. More... | |
ConstPointer | data () const |
Low-level data access to the column elements. More... | |
Iterator | begin () |
Returns an iterator to the first element of the column. More... | |
ConstIterator | begin () const |
Returns an iterator to the first element of the column. More... | |
ConstIterator | cbegin () const |
Returns an iterator to the first element of the column. More... | |
Iterator | end () |
Returns an iterator just past the last element of the column. More... | |
ConstIterator | end () const |
Returns an iterator just past the last element of the column. More... | |
ConstIterator | cend () const |
Returns an iterator just past the last element of the column. More... | |
Assignment operators | |
DenseColumn & | operator= (const ElementType &rhs) |
Homogenous assignment to all column elements. More... | |
DenseColumn & | operator= (const DenseColumn &rhs) |
Copy assignment operator for DenseColumn. More... | |
template<typename VT > | |
DenseColumn & | operator= (const Vector< VT, false > &rhs) |
template<typename VT > | |
DenseColumn & | operator+= (const Vector< VT, false > &rhs) |
template<typename VT > | |
DenseColumn & | operator-= (const Vector< VT, false > &rhs) |
template<typename VT > | |
DenseColumn & | operator*= (const Vector< VT, false > &rhs) |
template<typename Other > | |
EnableIf< IsNumeric< Other > , DenseColumn >::Type & | operator*= (Other rhs) |
template<typename Other > | |
EnableIf< IsNumeric< Other > , DenseColumn >::Type & | operator/= (Other rhs) |
Utility functions | |
size_t | size () const |
Returns the current size/dimension of the column. More... | |
size_t | capacity () const |
Returns the maximum capacity of the dense column. More... | |
size_t | nonZeros () const |
Returns the number of non-zero elements in the column. More... | |
void | reset () |
Reset to the default initial values. More... | |
template<typename Other > | |
DenseColumn & | scale (const Other &scalar) |
Expression template evaluation functions | |
template<typename Other > | |
bool | canAlias (const Other *alias) const |
Returns whether the dense column can alias with the given address alias. More... | |
template<typename Other > | |
bool | isAliased (const Other *alias) const |
Returns whether the dense column is aliased with the given address alias. More... | |
IntrinsicType | load (size_t index) const |
Aligned load of an intrinsic element of the dense column. More... | |
IntrinsicType | loadu (size_t index) const |
Unaligned load of an intrinsic element of the dense column. More... | |
void | store (size_t index, const IntrinsicType &value) |
Aligned store of an intrinsic element of the dense column. More... | |
void | storeu (size_t index, const IntrinsicType &value) |
Unaligned store of an intrinsic element of the dense column. More... | |
void | stream (size_t index, const IntrinsicType &value) |
Aligned, non-temporal store of an intrinsic element of the dense column. More... | |
template<typename VT > | |
DisableIf< VectorizedAssign < VT > >::Type | assign (const DenseVector< VT, false > &rhs) |
template<typename VT > | |
EnableIf< VectorizedAssign< VT > >::Type | assign (const DenseVector< VT, false > &rhs) |
template<typename VT > | |
void | assign (const SparseVector< VT, false > &rhs) |
Default implementation of the assignment of a sparse vector. More... | |
template<typename VT > | |
DisableIf< VectorizedAddAssign < VT > >::Type | addAssign (const DenseVector< VT, false > &rhs) |
template<typename VT > | |
EnableIf< VectorizedAddAssign < VT > >::Type | addAssign (const DenseVector< VT, false > &rhs) |
template<typename VT > | |
void | addAssign (const SparseVector< VT, false > &rhs) |
Default implementation of the addition assignment of a sparse vector. More... | |
template<typename VT > | |
DisableIf< VectorizedSubAssign < VT > >::Type | subAssign (const DenseVector< VT, false > &rhs) |
template<typename VT > | |
EnableIf< VectorizedSubAssign < VT > >::Type | subAssign (const DenseVector< VT, false > &rhs) |
template<typename VT > | |
void | subAssign (const SparseVector< VT, false > &rhs) |
Default implementation of the subtraction assignment of a sparse vector. More... | |
template<typename VT > | |
DisableIf < VectorizedMultAssign< VT > >::Type | multAssign (const DenseVector< VT, false > &rhs) |
template<typename VT > | |
EnableIf< VectorizedMultAssign < VT > >::Type | multAssign (const DenseVector< VT, false > &rhs) |
template<typename VT > | |
void | multAssign (const SparseVector< VT, false > &rhs) |
Default implementation of the multiplication assignment of a sparse vector. More... | |
Private Types | |
enum | { useConst = IsConst<MT>::value } |
Compilation switch for the non-const reference and iterator types. More... | |
typedef SelectType < IsExpression< MT >::value, MT, MT & >::Type | Operand |
Composite data type of the dense matrix expression. | |
typedef IntrinsicTrait < typename MT::ElementType > | IT |
Intrinsic trait for the column element type. | |
Private Attributes | |
Member variables | |
Operand | matrix_ |
The dense matrix containing the column. | |
const size_t | col_ |
The index of the column in the matrix. | |
Reference to a specific column of a dense matrix.
The DenseColumn template represents a reference to a specific column of a dense matrix primitive. The type of the dense matrix is specified via the first template parameter:
A reference to a dense column can be created very conveniently via the column()
function. This reference can be treated as any other column vector, i.e. it can be assigned to, it can be copied from, and it can be used in arithmetic operations. The reference can also be used on both sides of an assignment: The column can either be used as an alias to grant write access to a specific column of a matrix primitive on the left-hand side of an assignment or to grant read-access to a specific column of a matrix primitive or expression on the right-hand side of an assignment. The following example demonstrates this in detail:
A dense column can be used like any other column vector. For instance, the elements of the dense column can be directly accessed with the subscript operator.
The numbering of the column elements is
where N is the number of rows of the referenced matrix. Alternatively, the elements of a column can be traversed via iterators. Just as with vectors, in case of non-const rows, begin()
and end()
return an Iterator, which allows a manipulation of the non-zero values, in case of constant columns a ConstIterator is returned:
The current number of column 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 columns are references to specific columns of a matrix, several operations are not possible on views, such as resizing and swapping:
The following example gives an impression of the use of DenseColumn 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:
It is especially noteworthy that column views can be created for both row-major and column-major matrices. Whereas the interface of a row-major matrix only allows to traverse a row directly and the interface of a column-major matrix only allows to traverse a column, via views it is also possible to traverse a column of a row-major matrix. For instance:
However, please note that creating a column view on a matrix stored in a row-major fashion can result in a considerable performance decrease in comparison to a column view on a matrix with column-major storage format. This is due to the non-contiguous storage of the matrix elements. Therefore care has to be taken in the choice of the most suitable storage order:
Although Blaze performs the resulting matrix/vector multiplication as efficiently as possible using a column-major storage order for matrix A would result in a more efficient evaluation.
|
private |
Compilation switch for the non-const reference and iterator types.
The useConst compile time constant expression represents a compilation switch for the non-const reference and iterator types. In case the given dense matrix of type MT is const qualified, useConst will be set to 1 and the dense column will return references and iterators to const. Otherwise useConst will be set to 0 and the dense column will offer write access to the dense matrix elements both via the subscript operator and iterators.
|
inlineexplicit |
The constructor for DenseColumn.
matrix | The matrix containing the column. |
index | The index of the column. |
std::invalid_argument | Invalid column access index. |
|
inline |
Default implementation of the addition assignment of a sparse vector.
rhs | The right-hand side sparse vector to be added. |
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.
|
inline |
Default implementation of the addition assignment of a dense vector.
rhs | The right-hand side dense vector to be added. |
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.
|
inline |
Intrinsic optimized implementation of the addition assignment of a dense vector.
rhs | The right-hand side dense vector to be added. |
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.
|
inline |
Default implementation of the assignment of a sparse vector.
rhs | The right-hand side sparse vector to be assigned. |
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.
|
inline |
Default implementation of the assignment of a dense vector.
rhs | The right-hand side dense vector to be assigned. |
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.
|
inline |
Intrinsic optimized implementation of the assignment of a dense vector.
rhs | The right-hand side dense vector to be assigned. |
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.
|
inline |
Returns an iterator to the first element of the column.
This function returns an iterator to the first element of the column.
|
inline |
Returns an iterator to the first element of the column.
This function returns an iterator to the first element of the column.
|
inline |
Returns whether the dense column can alias with the given address alias.
alias | The alias to be checked. |
This function returns whether the given address can alias with the dense column. In contrast to the isAliased() function this function is allowed to use compile time expressions to optimize the evaluation.
|
inline |
Returns the maximum capacity of the dense column.
|
inline |
Returns an iterator to the first element of the column.
This function returns an iterator to the first element of the column.
|
inline |
Returns an iterator just past the last element of the column.
This function returns an iterator just past the last element of the column.
|
inline |
Low-level data access to the column elements.
This function returns a pointer to the internal storage of the dense column.
|
inline |
Low-level data access to the column elements.
This function returns a pointer to the internal storage of the dense column.
|
inline |
Returns an iterator just past the last element of the column.
This function returns an iterator just past the last element of the column.
|
inline |
Returns an iterator just past the last element of the column.
This function returns an iterator just past the last element of the column.
|
inline |
Returns whether the dense column is aliased with the given address alias.
alias | The alias to be checked. |
This function returns whether the given address is aliased with the dense column. In contrast to the canAlias() function this function is not allowed to use compile time expressions to optimize the evaluation.
|
inline |
Aligned load of an intrinsic element of the dense column.
index | Access index. The index must be smaller than the number of matrix rows. |
This function performs an aligned load of a specific intrinsic element of the dense column. The index must be smaller than the number of matrix rows. 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.
|
inline |
Unaligned load of an intrinsic element of the dense column.
index | Access index. The index must be smaller than the number of matrix rows. |
This function performs an unaligned load of a specific intrinsic element of the dense column. The index must be smaller than the number of matrix rows. 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.
|
inline |
Default implementation of the multiplication assignment of a sparse vector.
rhs | The right-hand side sparse vector to be multiplied. |
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.
|
inline |
Default implementation of the multiplication assignment of a dense vector.
rhs | The right-hand side dense vector to be multiplied. |
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.
|
inline |
Intrinsic optimized implementation of the multiplication assignment of a dense vector.
rhs | The right-hand side dense vector to be multiplied. |
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.
|
inline |
Returns the number of non-zero elements in the column.
Note that the number of non-zero elements is always less than or equal to the current number of rows of the matrix containing the column.
|
inline |
Multiplication assignment operator for the multiplication of a vector ( ).
rhs | The right-hand side vector to be multiplied with the dense column. |
std::invalid_argument | Vector sizes do not match. |
In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.
|
inline |
Multiplication assignment operator for the multiplication between a vector and a scalar value ( ).
rhs | The right-hand side scalar value for the multiplication. |
|
inline |
Addition assignment operator for the addition of a vector ( ).
rhs | The right-hand side vector to be added to the dense column. |
std::invalid_argument | Vector sizes do not match. |
In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.
|
inline |
Subtraction assignment operator for the subtraction of a vector ( ).
rhs | The right-hand side vector to be subtracted from the dense column. |
std::invalid_argument | Vector sizes do not match. |
In case the current sizes of the two vectors don't match, a std::invalid_argument exception is thrown.
|
inline |
Division assignment operator for the division of a vector by a scalar value ( ).
rhs | The right-hand side scalar value for the division. |
Note: A division by zero is only checked by an user assert.
|
inline |
Homogenous assignment to all column elements.
rhs | Scalar value to be assigned to all column elements. |
|
inline |
Copy assignment operator for DenseColumn.
rhs | Dense column to be copied. |
std::invalid_argument | Column sizes do not match. |
In case the current sizes of the two columns don't match, a std::invalid_argument exception is thrown.
|
inline |
|
inline |
Subscript operator for the direct access to the column elements.
index | Access index. The index must be smaller than the number of matrix rows. |
|
inline |
Subscript operator for the direct access to the column elements.
index | Access index. The index must be smaller than the number of matrix rows. |
|
inlineinherited |
Conversion operator for non-constant vectors.
|
inlineinherited |
Conversion operator for constant vectors.
|
inline |
Reset to the default initial values.
|
inline |
Scaling of the column by the scalar value scalar ( ).
scalar | The scalar value for the column scaling. |
|
inline |
Returns the current size/dimension of the column.
|
inline |
Aligned store of an intrinsic element of the dense column.
index | Access index. The index must be smaller than the number of matrix rows. |
value | The intrinsic element to be stored. |
This function performs an aligned store a specific intrinsic element of the dense column. The index must be smaller than the number of matrix rows. 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.
|
inline |
Unaligned store of an intrinsic element of the dense column.
index | Access index. The index must be smaller than the number of matrix rows. |
value | The intrinsic element to be stored. |
This function performs an unaligned store a specific intrinsic element of the dense column. The index must be smaller than the number of matrix rows. 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.
|
inline |
Aligned, non-temporal store of an intrinsic element of the dense column.
index | Access index. The index must be smaller than the number of matrix rows. |
value | The intrinsic element to be stored. |
This function performs an aligned, non-temporal store a specific intrinsic element of the dense column. The index must be smaller than the number of matrix rows. 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.
|
inline |
Default implementation of the subtraction assignment of a sparse vector.
rhs | The right-hand side sparse vector to be subtracted. |
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.
|
inline |
Default implementation of the subtraction assignment of a dense vector.
rhs | The right-hand side dense vector to be subtracted. |
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.
|
inline |
Intrinsic optimized implementation of the subtraction assignment of a dense vector.
rhs | The right-hand side dense vector to be subtracted. |
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.