35 #ifndef _BLAZE_MATH_DENSE_UNIFORMVECTOR_H_ 36 #define _BLAZE_MATH_DENSE_UNIFORMVECTOR_H_ 164 template<
typename Type
165 ,
bool TF = defaultTransposeFlag >
167 :
public DenseVector< UniformVector<Type,TF>, TF >
192 template<
typename NewType >
201 template<
size_t NewN >
227 explicit inline constexpr
UniformVector(
size_t n, const Type& init );
229 template< typename VT >
247 inline constexpr
ConstReference operator[](
size_t index ) const noexcept;
260 inline constexpr
UniformVector& operator=( const Type& rhs );
271 template< typename ST >
274 template< typename ST >
282 inline constexpr
size_t size() const noexcept;
283 inline constexpr
size_t spacing() const noexcept;
284 inline constexpr
size_t capacity() const noexcept;
286 inline constexpr
void reset();
287 inline constexpr
void clear();
288 inline constexpr
void resize(
size_t n,
bool preserve=true );
289 inline constexpr
void extend(
size_t n,
bool preserve=true );
297 template< typename Other > inline
UniformVector& scale( const Other& scalar );
311 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
312 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
355 template< typename Type
369 template<
typename Type
386 template<
typename Type
404 template<
typename Type
406 template<
typename VT >
408 : size_ ( (~v).
size() )
411 if( !IsUniform_v<VT> && !
isUniform( ~v ) ) {
439 template<
typename Type
463 template<
typename Type
468 if( index >= size_ ) {
472 return (*
this)[index];
485 template<
typename Type
500 template<
typename Type
515 template<
typename Type
530 template<
typename Type
545 template<
typename Type
569 template<
typename Type
589 template<
typename Type
591 template<
typename VT >
594 if( !IsUniform_v<VT> && !
isUniform( ~rhs ) ) {
598 size_ = (~rhs).
size();
600 if( (~rhs).size() > 0UL ) {
601 value_ = (~rhs)[0UL];
620 template<
typename Type
622 template<
typename VT >
625 if( (~rhs).
size() != size_ ) {
629 if( !IsUniform_v<VT> && !
isUniform( ~rhs ) ) {
633 if( (~rhs).
size() > 0UL ) {
634 value_ += (~rhs)[0UL];
653 template<
typename Type
655 template<
typename VT >
658 if( (~rhs).
size() != size_ ) {
662 if( !IsUniform_v<VT> && !
isUniform( ~rhs ) ) {
666 if( (~rhs).
size() > 0UL ) {
667 value_ -= (~rhs)[0UL];
687 template<
typename Type
689 template<
typename VT >
692 if( (~rhs).
size() != size_ ) {
696 if( !IsUniform_v<VT> && !
isUniform( ~rhs ) ) {
700 if( (~rhs).
size() > 0UL ) {
701 value_ *= (~rhs)[0UL];
720 template<
typename Type
722 template<
typename VT >
725 if( (~rhs).
size() != size_ ) {
729 if( !IsUniform_v<VT> && !
isUniform( ~rhs ) ) {
733 if( (~rhs).
size() > 0UL ) {
734 value_ /= (~rhs)[0UL];
749 template<
typename Type
751 template<
typename ST >
771 template<
typename Type
773 template<
typename ST >
799 template<
typename Type
816 template<
typename Type
830 template<
typename Type
847 template<
typename Type
851 if( size_ == 0UL ||
isDefault( value_ ) )
864 template<
typename Type
882 template<
typename Type
903 template<
typename Type
925 template<
typename Type
929 resize( size_+n, preserve );
940 template<
typename Type
946 swap( size_, v.size_ );
947 swap( value_, v.value_ );
977 template<
typename Type
979 template<
typename Other >
1009 template<
typename Type
1011 template<
typename Other >
1014 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1029 template<
typename Type
1031 template<
typename Other >
1034 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1048 template<
typename Type
1067 template<
typename Type
1071 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1088 template<
typename Type
1093 return loada( index );
1111 template<
typename Type
1124 return set( value_ );
1142 template<
typename Type
1154 return set( value_ );
1170 template<
typename Type,
bool TF >
1173 template<
typename Type,
bool TF >
1176 template<
bool RF,
typename Type,
bool TF >
1179 template<
typename Type,
bool TF >
1182 template<
typename Type,
bool TF >
1195 template<
typename Type
1211 template<
typename Type
1249 return ( v.size() == 0UL );
1272 template<
typename Type
1291 template<
typename Type
1310 template<
typename Type,
bool TF >
1311 struct IsUniform< UniformVector<Type,TF> >
1328 template<
typename Type,
bool TF >
1329 struct IsAligned< UniformVector<Type,TF> >
1346 template<
typename Type,
bool TF >
1347 struct IsResizable< UniformVector<Type,TF> >
1364 template<
typename T1,
typename T2 >
1365 struct AddTraitEval1< T1, T2
1368 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1369 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1371 using ET1 = ElementType_t<T1>;
1372 using ET2 = ElementType_t<T2>;
1374 using Type = UniformVector< AddTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
1390 template<
typename T1,
typename T2 >
1391 struct SubTraitEval1< T1, T2
1394 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1395 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1397 using ET1 = ElementType_t<T1>;
1398 using ET2 = ElementType_t<T2>;
1400 using Type = UniformVector< SubTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
1416 template<
typename T1,
typename T2 >
1417 struct MultTraitEval1< T1, T2
1420 IsUniform_v<T1> && !IsZero_v<T1> > >
1422 using ET1 = ElementType_t<T1>;
1424 using Type = UniformVector< MultTrait_t<ET1,T2>, TransposeFlag_v<T1> >;
1427 template<
typename T1,
typename T2 >
1428 struct MultTraitEval1< T1, T2
1431 IsUniform_v<T2> && !IsZero_v<T2> > >
1433 using ET2 = ElementType_t<T2>;
1435 using Type = UniformVector< MultTrait_t<T1,ET2>, TransposeFlag_v<T2> >;
1438 template<
typename T1,
typename T2 >
1439 struct MultTraitEval1< T1, T2
1441 ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
1442 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1443 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1445 using ET1 = ElementType_t<T1>;
1446 using ET2 = ElementType_t<T2>;
1448 using Type = UniformVector< MultTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
1451 template<
typename T1,
typename T2 >
1452 struct MultTraitEval1< T1, T2
1454 IsColumnVector_v<T2> &&
1456 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1458 using ET1 = ElementType_t<T1>;
1459 using ET2 = ElementType_t<T2>;
1461 using Type = UniformVector< MultTrait_t<ET1,ET2>,
false >;
1464 template<
typename T1,
typename T2 >
1465 struct MultTraitEval1< T1, T2
1469 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1471 using ET1 = ElementType_t<T1>;
1472 using ET2 = ElementType_t<T2>;
1474 using Type = UniformVector< MultTrait_t<ET1,ET2>,
true >;
1490 template<
typename T1,
typename T2 >
1491 struct DivTraitEval1< T1, T2
1494 IsUniform_v<T1> && !IsZero_v<T1> > >
1496 using ET1 = ElementType_t<T1>;
1498 using Type = UniformVector< DivTrait_t<ET1,T2>, TransposeFlag_v<T1> >;
1501 template<
typename T1,
typename T2 >
1502 struct DivTraitEval1< T1, T2
1504 ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
1505 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1506 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1508 using ET1 = ElementType_t<T1>;
1509 using ET2 = ElementType_t<T2>;
1511 using Type = UniformVector< DivTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
1527 template<
typename T,
typename OP >
1528 struct UnaryMapTraitEval1< T, OP
1530 YieldsUniform_v<OP,T> &&
1531 !YieldsZero_v<OP,T> > >
1533 using ET = ElementType_t<T>;
1535 using Type = UniformVector< MapTrait_t<ET,OP>, TransposeFlag_v<T> >;
1543 template<
typename T1,
typename T2,
typename OP >
1544 struct BinaryMapTraitEval1< T1, T2, OP
1547 YieldsUniform_v<OP,T1,T2> &&
1548 !YieldsZero_v<OP,T1,T2> > >
1550 using ET1 = ElementType_t<T1>;
1551 using ET2 = ElementType_t<T2>;
1553 using Type = UniformVector< MapTrait_t<ET1,ET2,OP>, TransposeFlag_v<T1> >;
1569 template<
typename T,
typename OP,
size_t RF >
1570 struct PartialReduceTraitEval1< T, OP, RF
1573 static constexpr
bool TF = ( RF == 0UL );
1575 using Type = UniformVector< ElementType_t<T>, TF >;
1591 template<
typename T1,
bool TF,
typename T2 >
1592 struct HighType< UniformVector<T1,TF>, UniformVector<T2,TF> >
1594 using Type = UniformVector< typename HighType<T1,T2>::Type, TF >;
1610 template<
typename T1,
bool TF,
typename T2 >
1611 struct LowType< UniformVector<T1,TF>, UniformVector<T2,TF> >
1613 using Type = UniformVector< typename LowType<T1,T2>::Type, TF >;
1629 template<
typename VT,
size_t I,
size_t N >
1630 struct SubvectorTraitEval1< VT, I, N
1633 using Type = UniformVector< RemoveConst_t< ElementType_t<VT> >, TransposeFlag_v<VT> >;
1649 template<
typename VT,
size_t N >
1650 struct ElementsTraitEval1< VT, N
1653 using Type = UniformVector< RemoveConst_t< ElementType_t<VT> >, TransposeFlag_v<VT> >;
1669 template<
typename MT,
size_t I >
1670 struct RowTraitEval1< MT, I
1673 using Type = UniformVector< RemoveConst_t< ElementType_t<MT> >,
true >;
1689 template<
typename MT,
size_t I >
1690 struct ColumnTraitEval1< MT, I
1693 using Type = UniformVector< RemoveConst_t< ElementType_t<MT> >,
false >;
1709 template<
typename MT, ptrdiff_t I >
1710 struct BandTraitEval1< MT, I
1713 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, a compilation error is created.
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.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the alignment flag values.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
Header file for basic type definitions.
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:139
Header file for the row trait.
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:591
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.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
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: TrueType.h:61
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
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
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5907
#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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
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
Header file for the IsAligned 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:140
#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:849
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:611
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.
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, a compilation error is created.
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:281
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
constexpr bool IsRowVector_v
Auxiliary variable template for the IsRowVector type trait.The IsRowVector_v variable template provid...
Definition: IsRowVector.h:143
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:186
Header file for the default transpose flag for all vectors of the Blaze library.
constexpr bool IsUniform_v
Auxiliary variable template for the IsUniform type trait.The IsUniform_v variable template provides a...
Definition: IsUniform.h:163
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:263
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
Header file for the IsColumnVector type trait.
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, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the HighType type trait.
Header file for the clear shim.