35#ifndef _BLAZE_MATH_DENSE_UNIFORMVECTOR_H_
36#define _BLAZE_MATH_DENSE_UNIFORMVECTOR_H_
181template<
typename Type
185 :
public Expression< DenseVector< UniformVector<Type,TF,Tag>, TF > >
216 template<
typename NewType >
225 template<
size_t NewN >
253 template< typename VT >
271 constexpr
ConstReference operator[](
size_t index ) const noexcept;
295 template< typename ST >
298 template< typename ST >
306 constexpr
size_t size() const noexcept;
307 constexpr
size_t spacing() const noexcept;
308 constexpr
size_t capacity() const noexcept;
310 constexpr
void reset();
311 constexpr
void clear();
312 constexpr
void resize(
size_t n,
bool preserve=true );
313 constexpr
void extend(
size_t n,
bool preserve=true );
321 template< typename Other > inline
UniformVector& scale( const Other& scalar );
335 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
336 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
379template< typename Type
394template<
typename Type
412template<
typename Type
431template<
typename Type
434template<
typename VT >
436 : size_ ( (*v).
size() )
441 if( !IsUniform_v<VT> && !
isUniform( *v ) ) {
469template<
typename Type
494template<
typename Type
500 if( index >= size_ ) {
504 return (*
this)[index];
517template<
typename Type
533template<
typename Type
549template<
typename Type
565template<
typename Type
581template<
typename Type
606template<
typename Type
628template<
typename Type
631template<
typename VT >
637 if( !IsUniform_v<VT> && !
isUniform( *rhs ) ) {
641 size_ = (*rhs).size();
643 if( (*rhs).size() > 0UL ) {
644 value_ = (*rhs)[0UL];
663template<
typename Type
666template<
typename VT >
672 if( (*rhs).size() != size_ ) {
676 if( !IsUniform_v<VT> && !
isUniform( *rhs ) ) {
680 if( (*rhs).size() > 0UL ) {
681 value_ += (*rhs)[0UL];
700template<
typename Type
703template<
typename VT >
709 if( (*rhs).size() != size_ ) {
713 if( !IsUniform_v<VT> && !
isUniform( *rhs ) ) {
717 if( (*rhs).size() > 0UL ) {
718 value_ -= (*rhs)[0UL];
738template<
typename Type
741template<
typename VT >
747 if( (*rhs).size() != size_ ) {
751 if( !IsUniform_v<VT> && !
isUniform( *rhs ) ) {
755 if( (*rhs).size() > 0UL ) {
756 value_ *= (*rhs)[0UL];
775template<
typename Type
778template<
typename VT >
784 if( (*rhs).size() != size_ ) {
788 if( !IsUniform_v<VT> && !
isUniform( *rhs ) ) {
792 if( (*rhs).size() > 0UL ) {
793 value_ /= (*rhs)[0UL];
808template<
typename Type
811template<
typename ST >
831template<
typename Type
834template<
typename ST >
860template<
typename Type
878template<
typename Type
893template<
typename Type
912template<
typename Type
917 if( size_ == 0UL || isDefault<strict>( value_ ) )
930template<
typename Type
949template<
typename Type
971template<
typename Type
994template<
typename Type
999 resize( size_+n, preserve );
1010template<
typename Type
1017 swap( size_, v.size_ );
1018 swap( value_, v.value_ );
1048template<
typename Type
1051template<
typename Other >
1081template<
typename Type
1084template<
typename Other >
1087 return static_cast<const void*
>( this ) ==
static_cast<const void*
>( alias );
1102template<
typename Type
1105template<
typename Other >
1108 return static_cast<const void*
>( this ) ==
static_cast<const void*
>( alias );
1122template<
typename Type
1142template<
typename Type
1147 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1164template<
typename Type
1170 return loada( index );
1188template<
typename Type
1202 return set( value_ );
1220template<
typename Type
1233 return set( value_ );
1249template< RelaxationFlag RF,
typename Type,
bool TF,
typename Tag >
1252template<
typename Type,
bool TF,
typename Tag >
1255template<
typename Type,
bool TF,
typename Tag >
1291 return ( v.
size() == 0UL );
1314template<
typename Type
1334template<
typename Type
1378template<
bool TF = defaultTransposeFlag,
typename T >
1379constexpr decltype(
auto)
uniform(
size_t n, T&& init )
1396template<
typename Type,
bool TF,
typename Tag >
1397struct IsUniform< UniformVector<Type,TF,Tag> >
1414template<
typename Type,
bool TF,
typename Tag >
1415struct IsAligned< UniformVector<Type,TF,Tag> >
1432template<
typename T1,
typename T2 >
1433struct AddTraitEval1< T1, T2
1436 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1437 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1439 using Type = UniformVector< AddTrait_t< ElementType_t<T1>, ElementType_t<T2> >
1440 , TransposeFlag_v<T1>
1441 , AddTrait_t< TagType_t<T1>, TagType_t<T2> > >;
1457template<
typename T1,
typename T2 >
1458struct SubTraitEval1< T1, T2
1461 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1462 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1464 using Type = UniformVector< SubTrait_t< ElementType_t<T1>, ElementType_t<T2> >
1465 , TransposeFlag_v<T1>
1466 , SubTrait_t< TagType_t<T1>, TagType_t<T2> > >;
1482template<
typename T1,
typename T2 >
1483struct MultTraitEval1< T1, T2
1486 IsUniform_v<T1> && !IsZero_v<T1> > >
1488 using Type = UniformVector< MultTrait_t< ElementType_t<T1>, T2 >
1489 , TransposeFlag_v<T1>
1490 , MultTrait_t< TagType_t<T1>, T2 > >;
1493template<
typename T1,
typename T2 >
1494struct MultTraitEval1< T1, T2
1497 IsUniform_v<T2> && !IsZero_v<T2> > >
1499 using Type = UniformVector< MultTrait_t< T1, ElementType_t<T2> >
1500 , TransposeFlag_v<T2>
1501 , MultTrait_t< T1, TagType_t<T2> > >;
1504template<
typename T1,
typename T2 >
1505struct MultTraitEval1< T1, T2
1507 ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
1508 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1509 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1511 using Type = UniformVector< MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >
1512 , TransposeFlag_v<T1>
1513 , MultTrait_t< TagType_t<T1>, TagType_t<T2> > >;
1516template<
typename T1,
typename T2 >
1517struct MultTraitEval1< T1, T2
1519 IsColumnVector_v<T2> &&
1521 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1523 using MultType = MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >;
1524 using MultTag = MultTrait_t< TagType_t<T1>, TagType_t<T2> >;
1526 using Type = UniformVector< AddTrait_t<MultType,MultType>
1528 , AddTrait_t<MultTag,MultTag> >;
1531template<
typename T1,
typename T2 >
1532struct MultTraitEval1< T1, T2
1536 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1538 using MultType = MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >;
1539 using MultTag = MultTrait_t< TagType_t<T1>, TagType_t<T2> >;
1541 using Type = UniformVector< AddTrait_t<MultType,MultType>
1543 , AddTrait_t<MultTag,MultTag> >;
1559template<
typename T1,
typename T2 >
1560struct KronTraitEval1< T1, T2
1563 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1564 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1566 using Type = UniformVector< MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >
1567 , TransposeFlag_v<T2>
1568 , MultTrait_t< TagType_t<T1>, TagType_t<T2> > >;
1584template<
typename T1,
typename T2 >
1585struct DivTraitEval1< T1, T2
1588 IsUniform_v<T1> && !IsZero_v<T1> > >
1590 using Type = UniformVector< DivTrait_t< ElementType_t<T1>, T2 >
1591 , TransposeFlag_v<T1>
1592 , DivTrait_t< TagType_t<T1>, T2 > >;
1595template<
typename T1,
typename T2 >
1596struct DivTraitEval1< T1, T2
1598 ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
1599 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1600 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1602 using Type = UniformVector< DivTrait_t< ElementType_t<T1>, ElementType_t<T2> >
1603 , TransposeFlag_v<T1>
1604 , DivTrait_t< TagType_t<T1>, TagType_t<T2> > >;
1620template<
typename T,
typename OP >
1621struct UnaryMapTraitEval1< T, OP
1623 YieldsUniform_v<OP,T> &&
1624 !YieldsZero_v<OP,T> > >
1626 using ElementType =
decltype( std::declval<OP>()( std::declval< ElementType_t<T> >() ) );
1628 using Type = UniformVector< EvaluateTrait_t<ElementType>
1629 , TransposeFlag_v<T>
1630 , MapTrait_t< TagType_t<T>, OP > >;
1638template<
typename T1,
typename T2,
typename OP >
1639struct BinaryMapTraitEval1< T1, T2, OP
1641 ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
1642 YieldsUniform_v<OP,T1,T2> &&
1643 !YieldsZero_v<OP,T1,T2> > >
1645 using ElementType =
decltype( std::declval<OP>()( std::declval< ElementType_t<T1> >()
1646 , std::declval< ElementType_t<T2> >() ) );
1648 using Type = UniformVector< EvaluateTrait_t<ElementType>
1649 , TransposeFlag_v<T1>
1650 , MapTrait_t< TagType_t<T1>, TagType_t<T2>, OP > >;
1666template<
typename T,
typename OP, ReductionFlag RF >
1667struct PartialReduceTraitEval1< T, OP, RF
1669 ( IsUniform_v<T> || IsIdentity_v<T> ) > >
1671 using ET = ElementType_t<T>;
1673 using Type = UniformVector< decltype( std::declval<OP>()( std::declval<ET>(), std::declval<ET>() ) )
1691template<
typename T,
size_t R0 >
1692struct RepeatTraitEval1< T, R0,
inf,
inf
1694 IsUniform_v<T> && !IsZero_v<T> > >
1696 using Type = UniformVector< ElementType_t<T>
1697 , TransposeFlag_v<T>
1714template<
typename T1,
bool TF,
typename Tag,
typename T2 >
1715struct HighType< UniformVector<T1,TF,Tag>, UniformVector<T2,TF,Tag> >
1717 using Type = UniformVector< typename HighType<T1,T2>::Type, TF, Tag >;
1733template<
typename T1,
bool TF,
typename Tag,
typename T2 >
1734struct LowType< UniformVector<T1,TF,Tag>, UniformVector<T2,TF,Tag> >
1736 using Type = UniformVector< typename LowType<T1,T2>::Type, TF, Tag >;
1752template<
typename VT,
size_t I,
size_t N >
1753struct SubvectorTraitEval1< VT, I, N
1756 using Type = UniformVector< RemoveConst_t< ElementType_t<VT> >
1757 , TransposeFlag_v<VT>
1774template<
typename VT,
size_t N >
1775struct ElementsTraitEval1< VT, N
1778 using Type = UniformVector< RemoveConst_t< ElementType_t<VT> >
1779 , TransposeFlag_v<VT>
1796template<
typename MT,
size_t I >
1797struct RowTraitEval1< MT, I
1800 using Type = UniformVector< RemoveConst_t< ElementType_t<MT> >
1818template<
typename MT,
size_t I >
1819struct ColumnTraitEval1< MT, I
1822 using Type = UniformVector< RemoveConst_t< ElementType_t<MT> >
1840template<
typename MT, ptrdiff_t I >
1841struct BandTraitEval1< MT, I
1844 using Type = UniformVector< RemoveConst_t< ElementType_t<MT> >
Header file for the addition trait.
Header file for auxiliary alias declarations.
typename ResultType_t< T >::TagType TagType_t
Alias declaration for nested TagType type definitions.
Definition: Aliases.h:530
Header file for the alignment flag enumeration.
Header file for run time assertion macros.
Header file for the band trait.
Header file for the column trait.
Constraint on the data type.
Header file for the division trait.
Header file for the elements trait.
Header file for the EnableIf class template.
Header file for the EvaluateTrait class template.
Header file for the HighType type trait.
Header file for the IntegralConstant class template.
Header file for the IsAligned type trait.
Header file for the IsColumnVector type trait.
Header file for the isDefault shim.
Header file for the IsIdentity type trait.
Header file for the IsMatrix type trait.
Header file for the IsRowVector type trait.
Header file for the IsSMPAssignable type trait.
Header file for the IsScalar type trait.
Header file for the IsVector type trait.
Header file for the IsVectorizable type trait.
Header file for the Kron product trait.
Header file for the LowType type trait.
Header file for the map trait.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Constraint on the data type.
Header file for the reduce trait.
Header file for the reduction flags.
constexpr ReductionFlag columnwise
Reduction flag for column-wise reduction operations.
Definition: ReductionFlag.h:97
Constraint on the data type.
Header file for the relaxation flag enumeration.
Header file for the RemoveCVRef type trait.
Header file for the RemoveConst type trait.
Header file for the repeat trait.
Header file for the row trait.
Header file for all SIMD functionality.
Header file for the subtraction trait.
Header file for the subvector trait.
Constraint on the data type.
Constraint on the data type.
Header file for the YieldsZero type trait.
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
SIMD characteristics of data types.
Definition: SIMDTrait.h:297
Base class for N-dimensional vectors.
Definition: Vector.h:82
Header file for the DenseVector base class.
Header file for the Expression base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.
Definition: Volatile.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.
Definition: Pointer.h:79
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.
Definition: Vectorizable.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.
Definition: Const.h:79
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TAG(A, B)
Data type constraint.
Definition: SameTag.h:68
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition: Reference.h:79
bool isUniform(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a uniform matrix.
Definition: DenseMatrix.h:1766
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.
Definition: MapTrait.h:131
constexpr bool IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition: IsScalar.h:104
constexpr bool IsUniform_v
Auxiliary variable template for the IsUniform type trait.
Definition: IsUniform.h:164
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.
Definition: IsVector.h:125
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.
Definition: IsMatrix.h:124
constexpr bool IsRowVector_v
Auxiliary variable template for the IsRowVector type trait.
Definition: IsRowVector.h:126
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition: RelaxationFlag.h:66
constexpr Infinity inf
Global Infinity instance.
Definition: Infinity.h:1080
constexpr void clear(Matrix< MT, SO > &matrix)
Clearing the given matrix.
Definition: Matrix.h:960
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:1108
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition: Assert.h:117
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
typename SIMDTrait< T >::Type SIMDTrait_t
Auxiliary alias declaration for the SIMDTrait class template.
Definition: SIMDTrait.h:315
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
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
constexpr bool defaultTransposeFlag
The default transpose flag for all vectors of the Blaze library.
Definition: TransposeFlag.h:75
BoolConstant< true > TrueType
Type traits base class.
Definition: IntegralConstant.h:132
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
Header file for the exception macros of the math module.
Header file for all forward declarations for dense vectors and matrices.
Header file for the TransposeFlag type trait.
Header file for the clear shim.
Base class for all expression templates.
Definition: Expression.h:60
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for the default transpose flag for all vectors of the Blaze library.
Header file for the IsZero type trait.
Header file for basic type definitions.