version 0.4.1
eigensparseaddon.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2021-2024 The Ikarus Developers mueller@ibb.uni-stuttgart.de
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
9#pragma once
10
19inline Index getLinearIndex(Index row, Index col) const {
20 eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols());
21
22 const Index outer = IsRowMajor ? row : col;
23 const Index inner = IsRowMajor ? col : row;
24
25 Index start = m_outerIndex[outer];
26 Index end = m_innerNonZeros ? m_outerIndex[outer] + m_innerNonZeros[outer] : m_outerIndex[outer + 1];
27 eigen_assert(end >= start && "you probably called coeffRef on a non finalized matrix");
28
29 Index p = m_data.searchLowerIndex(start, end - 1, StorageIndex(inner));
30 return p;
31}
Index getLinearIndex(Index row, Index col) const
Get the linear index corresponding to the given row and column indices.
Definition: eigensparseaddon.hh:19