gdb.printers.EigenSparseMatrixPrinter._Iterator Class Reference
+ Inheritance diagram for gdb.printers.EigenSparseMatrixPrinter._Iterator:

Public Member Functions

def __init__ (self, rows, cols, val, row_major)
 
def __next__ (self)
 
- Public Member Functions inherited from gdb.printers._MatrixEntryIterator
def __init__ (self, rows, cols, row_major)
 
def __iter__ (self)
 
def next (self)
 

Public Attributes

 val
 
- Public Attributes inherited from gdb.printers._MatrixEntryIterator
 rows
 
 cols
 
 currentRow
 
 currentCol
 
 rowMajor
 

Constructor & Destructor Documentation

◆ __init__()

def gdb.printers.EigenSparseMatrixPrinter._Iterator.__init__ (   self,
  rows,
  cols,
  val,
  row_major 
)
174  def __init__(self, rows, cols, val, row_major):
175  super(EigenSparseMatrixPrinter._Iterator, self).__init__(rows, cols, row_major)
176 
177  self.val = val
178 

Member Function Documentation

◆ __next__()

def gdb.printers.EigenSparseMatrixPrinter._Iterator.__next__ (   self)

Reimplemented from gdb.printers._MatrixEntryIterator.

179  def __next__(self):
180  row, col = super(EigenSparseMatrixPrinter._Iterator, self).__next__()
181 
182  # repeat calculations from SparseMatrix.h:
183  outer = row if self.rowMajor else col
184  inner = col if self.rowMajor else row
185  start = self.val['m_outerIndex'][outer]
186  end = (
187  (start + self.val['m_innerNonZeros'][outer])
188  if self.val['m_innerNonZeros'] else self.val['m_outerIndex'][outer+1]
189  )
190 
191  # and from CompressedStorage.h:
192  data = self.val['m_data']
193  if start >= end:
194  item = 0
195  elif (end > start) and (inner == data['m_indices'][end-1]):
196  item = data['m_values'][end-1]
197  else:
198  # create Python index list from the target range within m_indices
199  indices = [data['m_indices'][x] for x in range(int(start), int(end)-1)]
200  # find the index with binary search
201  idx = int(start) + bisect_left(indices, inner)
202  if idx < end and data['m_indices'][idx] == inner:
203  item = data['m_values'][idx]
204  else:
205  item = 0
206 
207  return '[%d,%d]' % (row, col), item
208 
209  def children(self):
return int(ret)+1

References int(), gdb.printers._MatrixEntryIterator.rowMajor, gdb.printers.EigenMatrixPrinter.rowMajor, gdb.printers.EigenSparseMatrixPrinter.rowMajor, gdb.printers.EigenMatrixPrinter.val, gdb.printers.EigenSparseMatrixPrinter.val, gdb.printers.EigenSparseMatrixPrinter._Iterator.val, gdb.printers.EigenQuaternionPrinter.val, Eigen::internal::Pointer_type_promotion< A, B >.val, Eigen::internal::Pointer_type_promotion< A, A >.val, KeyValueType.val, KVType.val, FKeyValueType.val, and KeyKeyValueType.val.

Referenced by gdb.printers._MatrixEntryIterator.next(), and gdb.printers.EigenQuaternionPrinter._Iterator.next().

Member Data Documentation

◆ val


The documentation for this class was generated from the following file: