mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-08 09:49:03 +08:00
Fix std::fill_n reference.
This commit is contained in:
parent
9836e8d035
commit
ad13df7ea4
@ -78,7 +78,7 @@ template <typename Xpr>
|
||||
struct eigen_fill_impl<Xpr, /*use_fill*/ true> {
|
||||
using Scalar = typename Xpr::Scalar;
|
||||
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Xpr& dst, const Scalar& val) {
|
||||
EIGEN_USING_STD(fill_n);
|
||||
using std::fill_n;
|
||||
fill_n(dst.data(), dst.size(), val);
|
||||
}
|
||||
template <typename SrcXpr>
|
||||
|
@ -302,9 +302,10 @@ class SparseMatrix : public SparseCompressedBase<SparseMatrix<Scalar_, Options_,
|
||||
*/
|
||||
inline void setZero() {
|
||||
m_data.clear();
|
||||
std::fill_n(m_outerIndex, m_outerSize + 1, StorageIndex(0));
|
||||
using std::fill_n;
|
||||
fill_n(m_outerIndex, m_outerSize + 1, StorageIndex(0));
|
||||
if (m_innerNonZeros) {
|
||||
std::fill_n(m_innerNonZeros, m_outerSize, StorageIndex(0));
|
||||
fill_n(m_innerNonZeros, m_outerSize, StorageIndex(0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,7 +507,7 @@ class SparseMatrix : public SparseCompressedBase<SparseMatrix<Scalar_, Options_,
|
||||
|
||||
// insert empty outer vectors at indices j, j+1 ... j+num-1 and resize the matrix
|
||||
void insertEmptyOuterVectors(Index j, Index num = 1) {
|
||||
EIGEN_USING_STD(fill_n);
|
||||
using std::fill_n;
|
||||
eigen_assert(num >= 0 && j >= 0 && j < m_outerSize && "Invalid parameters");
|
||||
|
||||
const Index newRows = IsRowMajor ? m_outerSize + num : rows();
|
||||
@ -621,11 +622,13 @@ class SparseMatrix : public SparseCompressedBase<SparseMatrix<Scalar_, Options_,
|
||||
void uncompress() {
|
||||
if (!isCompressed()) return;
|
||||
m_innerNonZeros = internal::conditional_aligned_new_auto<StorageIndex, true>(m_outerSize);
|
||||
if (m_outerIndex[m_outerSize] == 0)
|
||||
std::fill_n(m_innerNonZeros, m_outerSize, StorageIndex(0));
|
||||
else
|
||||
if (m_outerIndex[m_outerSize] == 0) {
|
||||
using std::fill_n;
|
||||
fill_n(m_innerNonZeros, m_outerSize, StorageIndex(0));
|
||||
} else {
|
||||
for (Index j = 0; j < m_outerSize; j++) m_innerNonZeros[j] = m_outerIndex[j + 1] - m_outerIndex[j];
|
||||
}
|
||||
}
|
||||
|
||||
/** Suppresses all nonzeros which are \b much \b smaller \b than \a reference under the tolerance \a epsilon */
|
||||
void prune(const Scalar& reference, const RealScalar& epsilon = NumTraits<RealScalar>::dummy_precision()) {
|
||||
@ -695,9 +698,10 @@ class SparseMatrix : public SparseCompressedBase<SparseMatrix<Scalar_, Options_,
|
||||
|
||||
if (outerChange > 0) {
|
||||
StorageIndex lastIdx = m_outerSize == 0 ? StorageIndex(0) : m_outerIndex[m_outerSize];
|
||||
std::fill_n(m_outerIndex + m_outerSize, outerChange + 1, lastIdx);
|
||||
using std::fill_n;
|
||||
fill_n(m_outerIndex + m_outerSize, outerChange + 1, lastIdx);
|
||||
|
||||
if (!isCompressed()) std::fill_n(m_innerNonZeros + m_outerSize, outerChange, StorageIndex(0));
|
||||
if (!isCompressed()) fill_n(m_innerNonZeros + m_outerSize, outerChange, StorageIndex(0));
|
||||
}
|
||||
}
|
||||
m_outerSize = newOuterSize;
|
||||
@ -741,7 +745,8 @@ class SparseMatrix : public SparseCompressedBase<SparseMatrix<Scalar_, Options_,
|
||||
internal::conditional_aligned_delete_auto<StorageIndex, true>(m_innerNonZeros, m_outerSize);
|
||||
m_innerNonZeros = 0;
|
||||
|
||||
std::fill_n(m_outerIndex, m_outerSize + 1, StorageIndex(0));
|
||||
using std::fill_n;
|
||||
fill_n(m_outerIndex, m_outerSize + 1, StorageIndex(0));
|
||||
}
|
||||
|
||||
/** \internal
|
||||
@ -843,7 +848,8 @@ class SparseMatrix : public SparseCompressedBase<SparseMatrix<Scalar_, Options_,
|
||||
m_data.squeeze();
|
||||
std::iota(m_outerIndex, m_outerIndex + m_outerSize + 1, StorageIndex(0));
|
||||
std::iota(innerIndexPtr(), innerIndexPtr() + m_outerSize, StorageIndex(0));
|
||||
std::fill_n(valuePtr(), m_outerSize, Scalar(1));
|
||||
using std::fill_n;
|
||||
fill_n(valuePtr(), m_outerSize, Scalar(1));
|
||||
}
|
||||
|
||||
inline SparseMatrix& operator=(const SparseMatrix& other) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user