Blaze
3.9
Toggle main menu visibility
Loading...
Searching...
No Matches
blaze
math
InitializerList.h
Go to the documentation of this file.
1
//=================================================================================================
33
//=================================================================================================
34
35
#ifndef _BLAZE_MATH_INITIALIZERLIST_H_
36
#define _BLAZE_MATH_INITIALIZERLIST_H_
37
38
39
//*************************************************************************************************
40
// Includes
41
//*************************************************************************************************
42
43
#include <
blaze/math/shims/IsDefault.h
>
44
#include <
blaze/util/algorithms/Max.h
>
45
#include <
blaze/util/InitializerList.h
>
46
47
48
namespace
blaze {
49
50
//=================================================================================================
51
//
52
// UTILITY FUNCTIONS
53
//
54
//=================================================================================================
55
56
//*************************************************************************************************
63
template
<
typename
Type >
64
inline
size_t
nonZeros
(
initializer_list<Type>
list )
noexcept
65
{
66
size_t
nonzeros( 0UL );
67
68
for
(
const
Type
& element : list ) {
69
if
( !
isDefault<strict>
( element ) )
70
++nonzeros;
71
}
72
73
return
nonzeros;
74
}
75
//*************************************************************************************************
76
77
78
//*************************************************************************************************
85
template
<
typename
Type >
86
inline
size_t
nonZeros
(
initializer_list
<
initializer_list<Type>
> list )
noexcept
87
{
88
size_t
nonzeros( 0UL );
89
90
for
(
const
auto
& rowList : list ) {
91
nonzeros +=
nonZeros
( rowList );
92
}
93
94
return
nonzeros;
95
}
96
//*************************************************************************************************
97
98
99
//*************************************************************************************************
106
template
<
typename
Type >
107
constexpr
size_t
determineColumns
(
initializer_list
<
initializer_list<Type>
> list )
noexcept
108
{
109
size_t
cols( 0UL );
110
111
for
(
const
auto
& rowList : list )
112
cols =
max
( cols, rowList.size() );
113
114
return
cols;
115
}
116
//*************************************************************************************************
117
118
}
// namespace blaze
119
120
#endif
IsDefault.h
Header file for the isDefault shim.
blaze::Type
initializer_list
Initializer list type of the Blaze library.
blaze::max
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition
DMatDMatMapExpr.h:1375
blaze::isDefault
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition
DiagonalMatrix.h:169
blaze::determineColumns
constexpr size_t determineColumns(initializer_list< initializer_list< Type > > list) noexcept
Determines the maximum number of columns specified by the given initializer list.
Definition
InitializerList.h:107
blaze::nonZeros
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition
Matrix.h:730
InitializerList.h
Header file for the initializer_list template.
Max.h
Header file for the generic max algorithm.
Generated by
1.18.0