Blaze 3.9
Vector/Vector Division


Componentwise Division


Dividing a vector by a dense vector with the same transpose flag (i.e. either blaze::columnVector or blaze::rowVector) via the division operator results in a componentwise division:

CompressedVector<int,columnVector> v1( 17UL );
DynamicVector<int,columnVector> v2( 17UL );
StaticVector<double,10UL,rowVector> v3;
DynamicVector<double,rowVector> v4( 10UL );
// ... Initialization of the vectors
CompressedVector<int,columnVector> v5( v1 / v2 ); // Componentwise division of a sparse and a
// dense column vector. The result is a sparse
// column vector.
DynamicVector<double,rowVector> v6( v3 / v4 ); // Componentwise division of two dense row
// vectors. The result is a dense row vector.
CompressedVector<int,columnVector> v7( div( v1, v2 ) ); // Alternative syntax
DynamicVector<double,rowVector> v8( div( v3, v4 ) ); // Alternative syntax
Efficient implementation of an arbitrary sized sparse vector.
Definition: CompressedVector.h:220
Efficient implementation of an arbitrary sized vector.
Definition: DynamicVector.h:223
BLAZE_ALWAYS_INLINE constexpr decltype(auto) div(T1 &&lhs, T2 &&rhs) noexcept(noexcept(lhs/rhs))
Division of the two given arguments.
Definition: Div.h:66

Note that all values of the divisor must be non-zero and that no checks are performed to assert this precondition!


Outer Quotient


The division between a column vector and a row vector results in the outer quotient of the two vectors:

// Results in the matrix
//
// ( -2 0.4 -1 0.5 )
// A = ( -5 1 -2.5 1.25 )
// ( 1 -0.2 0.5 -0.25 )
//
blaze::StaticMatrix<int,3UL,4UL> M1 = v1 / v2; // Outer quotient
blaze::StaticMatrix<int,3UL,4UL> M2 = div( v1, v2 ); // Alternative syntax
Efficient implementation of a fixed-sized matrix.
Definition: StaticMatrix.h:249
Efficient implementation of a fixed-sized vector.
Definition: StaticVector.h:230

The trans() function can be used to transpose a vector as necessary:

decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766

Note that all values of the divisor must be non-zero and that no checks are performed to assert this precondition!


Previous: Vector/Vector Multiplication     Next: Matrix/Vector Multiplication