35 #ifndef _BLAZE_MATH_DENSE_UNIFORMVECTOR_H_ 36 #define _BLAZE_MATH_DENSE_UNIFORMVECTOR_H_ 168 template<
typename Type
169 ,
bool TF = defaultTransposeFlag >
171 :
public Expression< DenseVector< UniformVector<Type,TF>, TF > >
196 template<
typename NewType >
205 template<
size_t NewN >
231 explicit inline constexpr
UniformVector(
size_t n, const Type& init );
233 template< typename VT >
251 inline constexpr
ConstReference operator[](
size_t index ) const noexcept;
264 inline constexpr
UniformVector& operator=( const Type& rhs );
275 template< typename ST >
278 template< typename ST >
286 inline constexpr
size_t size() const noexcept;
287 inline constexpr
size_t spacing() const noexcept;
288 inline constexpr
size_t capacity() const noexcept;
290 inline constexpr
void reset();
291 inline constexpr
void clear();
292 inline constexpr
void resize(
size_t n,
bool preserve=true );
293 inline constexpr
void extend(
size_t n,
bool preserve=true );
301 template< typename Other > inline
UniformVector& scale( const Other& scalar );
315 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
316 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
359 template< typename Type
373 template<
typename Type
390 template<
typename Type
408 template<
typename Type
410 template<
typename VT >
412 : size_ ( (~v).
size() )
415 if( !IsUniform_v<VT> && !
isUniform( ~v ) ) {
443 template<
typename Type
467 template<
typename Type
472 if( index >= size_ ) {
476 return (*
this)[index];
489 template<
typename Type
504 template<
typename Type
519 template<
typename Type
534 template<
typename Type
549 template<
typename Type
573 template<
typename Type
593 template<
typename Type
595 template<
typename VT >
598 if( !IsUniform_v<VT> && !
isUniform( ~rhs ) ) {
602 size_ = (~rhs).
size();
604 if( (~rhs).size() > 0UL ) {
605 value_ = (~rhs)[0UL];
624 template<
typename Type
626 template<
typename VT >
629 if( (~rhs).
size() != size_ ) {
633 if( !IsUniform_v<VT> && !
isUniform( ~rhs ) ) {
637 if( (~rhs).
size() > 0UL ) {
638 value_ += (~rhs)[0UL];
657 template<
typename Type
659 template<
typename VT >
662 if( (~rhs).
size() != size_ ) {
666 if( !IsUniform_v<VT> && !
isUniform( ~rhs ) ) {
670 if( (~rhs).
size() > 0UL ) {
671 value_ -= (~rhs)[0UL];
691 template<
typename Type
693 template<
typename VT >
696 if( (~rhs).
size() != size_ ) {
700 if( !IsUniform_v<VT> && !
isUniform( ~rhs ) ) {
704 if( (~rhs).
size() > 0UL ) {
705 value_ *= (~rhs)[0UL];
724 template<
typename Type
726 template<
typename VT >
729 if( (~rhs).
size() != size_ ) {
733 if( !IsUniform_v<VT> && !
isUniform( ~rhs ) ) {
737 if( (~rhs).
size() > 0UL ) {
738 value_ /= (~rhs)[0UL];
753 template<
typename Type
755 template<
typename ST >
775 template<
typename Type
777 template<
typename ST >
803 template<
typename Type
820 template<
typename Type
834 template<
typename Type
851 template<
typename Type
855 if( size_ == 0UL ||
isDefault( value_ ) )
868 template<
typename Type
886 template<
typename Type
907 template<
typename Type
929 template<
typename Type
933 resize( size_+n, preserve );
944 template<
typename Type
950 swap( size_, v.size_ );
951 swap( value_, v.value_ );
981 template<
typename Type
983 template<
typename Other >
1013 template<
typename Type
1015 template<
typename Other >
1018 return static_cast<const void*>(
this ) == static_cast<const void*>( alias );
1033 template<
typename Type
1035 template<
typename Other >
1038 return static_cast<const void*>(
this ) == static_cast<const void*>( alias );
1052 template<
typename Type
1071 template<
typename Type
1075 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1092 template<
typename Type
1097 return loada( index );
1115 template<
typename Type
1128 return set( value_ );
1146 template<
typename Type
1158 return set( value_ );
1174 template<
typename Type,
bool TF >
1177 template<
typename Type,
bool TF >
1180 template<
bool RF,
typename Type,
bool TF >
1183 template<
typename Type,
bool TF >
1186 template<
typename Type,
bool TF >
1199 template<
typename Type
1215 template<
typename Type
1253 return ( v.size() == 0UL );
1276 template<
typename Type
1295 template<
typename Type
1338 template<
bool TF = defaultTransposeFlag,
typename T >
1339 inline constexpr decltype(
auto)
uniform(
size_t n, T&& init )
1356 template<
typename Type,
bool TF >
1357 struct IsUniform< UniformVector<Type,TF> >
1374 template<
typename Type,
bool TF >
1375 struct IsAligned< UniformVector<Type,TF> >
1392 template<
typename Type,
bool TF >
1393 struct IsResizable< UniformVector<Type,TF> >
1410 template<
typename T1,
typename T2 >
1411 struct AddTraitEval1< T1, T2
1414 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1415 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1417 using ET1 = ElementType_t<T1>;
1418 using ET2 = ElementType_t<T2>;
1420 using Type = UniformVector< AddTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
1436 template<
typename T1,
typename T2 >
1437 struct SubTraitEval1< T1, T2
1440 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1441 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1443 using ET1 = ElementType_t<T1>;
1444 using ET2 = ElementType_t<T2>;
1446 using Type = UniformVector< SubTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
1462 template<
typename T1,
typename T2 >
1463 struct MultTraitEval1< T1, T2
1466 IsUniform_v<T1> && !IsZero_v<T1> > >
1468 using ET1 = ElementType_t<T1>;
1470 using Type = UniformVector< MultTrait_t<ET1,T2>, TransposeFlag_v<T1> >;
1473 template<
typename T1,
typename T2 >
1474 struct MultTraitEval1< T1, T2
1477 IsUniform_v<T2> && !IsZero_v<T2> > >
1479 using ET2 = ElementType_t<T2>;
1481 using Type = UniformVector< MultTrait_t<T1,ET2>, TransposeFlag_v<T2> >;
1484 template<
typename T1,
typename T2 >
1485 struct MultTraitEval1< T1, T2
1487 ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
1488 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1489 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1491 using ET1 = ElementType_t<T1>;
1492 using ET2 = ElementType_t<T2>;
1494 using Type = UniformVector< MultTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
1497 template<
typename T1,
typename T2 >
1498 struct MultTraitEval1< T1, T2
1500 IsColumnVector_v<T2> &&
1502 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1504 using ET1 = ElementType_t<T1>;
1505 using ET2 = ElementType_t<T2>;
1507 using Type = UniformVector< MultTrait_t<ET1,ET2>,
false >;
1510 template<
typename T1,
typename T2 >
1511 struct MultTraitEval1< T1, T2
1515 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1517 using ET1 = ElementType_t<T1>;
1518 using ET2 = ElementType_t<T2>;
1520 using Type = UniformVector< MultTrait_t<ET1,ET2>,
true >;
1536 template<
typename T1,
typename T2 >
1537 struct KronTraitEval1< T1, T2
1540 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1541 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1543 using ET1 = ElementType_t<T1>;
1544 using ET2 = ElementType_t<T2>;
1546 using Type = UniformVector< MultTrait_t<ET1,ET2>, TransposeFlag_v<T2> >;
1562 template<
typename T1,
typename T2 >
1563 struct DivTraitEval1< T1, T2
1566 IsUniform_v<T1> && !IsZero_v<T1> > >
1568 using ET1 = ElementType_t<T1>;
1570 using Type = UniformVector< DivTrait_t<ET1,T2>, TransposeFlag_v<T1> >;
1573 template<
typename T1,
typename T2 >
1574 struct DivTraitEval1< T1, T2
1576 ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
1577 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1578 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1580 using ET1 = ElementType_t<T1>;
1581 using ET2 = ElementType_t<T2>;
1583 using Type = UniformVector< DivTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
1599 template<
typename T,
typename OP >
1600 struct UnaryMapTraitEval1< T, OP
1602 YieldsUniform_v<OP,T> &&
1603 !YieldsZero_v<OP,T> > >
1605 using ET = ElementType_t<T>;
1607 using Type = UniformVector< MapTrait_t<ET,OP>, TransposeFlag_v<T> >;
1615 template<
typename T1,
typename T2,
typename OP >
1616 struct BinaryMapTraitEval1< T1, T2, OP
1619 YieldsUniform_v<OP,T1,T2> &&
1620 !YieldsZero_v<OP,T1,T2> > >
1622 using ET1 = ElementType_t<T1>;
1623 using ET2 = ElementType_t<T2>;
1625 using Type = UniformVector< MapTrait_t<ET1,ET2,OP>, TransposeFlag_v<T1> >;
1641 template<
typename T,
typename OP,
size_t RF >
1642 struct PartialReduceTraitEval1< T, OP, RF
1645 using ET = ElementType_t<T>;
1646 using RT = decltype( std::declval<OP>()( std::declval<ET>(), std::declval<ET>() ) );
1648 static constexpr
bool TF = ( RF == 0UL );
1650 using Type = UniformVector<RT,TF>;
1666 template<
typename T1,
bool TF,
typename T2 >
1667 struct HighType< UniformVector<T1,TF>, UniformVector<T2,TF> >
1669 using Type = UniformVector< typename HighType<T1,T2>::Type, TF >;
1685 template<
typename T1,
bool TF,
typename T2 >
1686 struct LowType< UniformVector<T1,TF>, UniformVector<T2,TF> >
1688 using Type = UniformVector< typename LowType<T1,T2>::Type, TF >;
1704 template<
typename VT,
size_t I,
size_t N >
1705 struct SubvectorTraitEval1< VT, I, N
1708 using Type = UniformVector< RemoveConst_t< ElementType_t<VT> >, TransposeFlag_v<VT> >;
1724 template<
typename VT,
size_t N >
1725 struct ElementsTraitEval1< VT, N
1728 using Type = UniformVector< RemoveConst_t< ElementType_t<VT> >, TransposeFlag_v<VT> >;
1744 template<
typename MT,
size_t I >
1745 struct RowTraitEval1< MT, I
1748 using Type = UniformVector< RemoveConst_t< ElementType_t<MT> >,
true >;
1764 template<
typename MT,
size_t I >
1765 struct ColumnTraitEval1< MT, I
1768 using Type = UniformVector< RemoveConst_t< ElementType_t<MT> >,
false >;
1784 template<
typename MT, ptrdiff_t I >
1785 struct BandTraitEval1< MT, I
1788 using Type = UniformVector< RemoveConst_t< ElementType_t<MT> >, defaultTransposeFlag >;
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type,...
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:138
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
Header file for the alignment flag values.
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the row trait.
constexpr bool IsRowVector_v
Auxiliary variable template for the IsRowVector type trait.The IsRowVector_v variable template provid...
Definition: IsRowVector.h:142
Header file for the YieldsZero type trait.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
Header file for the RemoveCVRef type trait.
Header file for the IsRowVector type trait.
typename SIMDTrait< T >::Type SIMDTrait_t
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_t alias declaration provid...
Definition: SIMDTrait.h:315
Header file for the DenseVector base class.
Header file for the MAYBE_UNUSED function template.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type,...
Definition: Volatile.h:79
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: IntegralConstant.h:132
Header file for the reduce trait.
Header file for the elements trait.
Header file for the band trait.
Constraint on the data type.
Header file for the IsMatrix type trait.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Header file for the LowType type trait.
Header file for the multiplication trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Header file for the IsSMPAssignable type trait.
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the subvector trait.
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Header file for all SIMD functionality.
Constraint on the data type.
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsAligned type trait.
Header file for the Kron product trait.
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a vectorizable data type,...
Definition: Vectorizable.h:61
Header file for the TransposeFlag type trait.
Header file for the exception macros of the math module.
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
bool isUniform(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a uniform matrix.
Definition: DenseMatrix.h:1638
Header file for the IsVector type trait.
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
Header file for the IsVectorizable type trait.
Header file for the IsNumeric type trait.
Header file for the RemoveConst type trait.
Header file for run time assertion macros.
Header file for the addition trait.
Header file for the division trait.
Constraint on the data type.
Header file for the IsZero type trait.
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.The IsVector_v variable template provides a c...
Definition: IsVector.h:139
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type,...
Definition: Reference.h:79
Header file for the column trait.
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:282
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:198
Header file for the default transpose flag for all vectors of the Blaze library.
Header file for the IntegralConstant class template.
Header file for the map trait.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
Header file for the IsColumnVector type trait.
constexpr bool IsUniform_v
Auxiliary variable template for the IsUniform type trait.The IsUniform_v variable template provides a...
Definition: IsUniform.h:164
Header file for the IsResizable type trait.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
Header file for the Expression base class.
Header file for the HighType type trait.
Header file for the clear shim.