initial commit
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
# Intentionally empty
|
||||
+338
@@ -0,0 +1,338 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# This file is part of Eigen, a lightweight C++ template library
|
||||
# for linear algebra.
|
||||
#
|
||||
# Copyright (C) 2009 Benjamin Schindler <bschindler@inf.ethz.ch>
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Pretty printers for Eigen::Matrix
|
||||
# This is still pretty basic as the python extension to gdb is still pretty basic.
|
||||
# It cannot handle complex eigen types and it doesn't support many of the other eigen types
|
||||
# This code supports fixed size as well as dynamic size matrices
|
||||
|
||||
# To use it:
|
||||
#
|
||||
# * Create a directory and put the file as well as an empty __init__.py in
|
||||
# that directory.
|
||||
# * Create a ~/.gdbinit file, that contains the following:
|
||||
# python
|
||||
# import sys
|
||||
# sys.path.insert(0, '/path/to/eigen/printer/directory')
|
||||
# from printers import register_eigen_printers
|
||||
# register_eigen_printers(None)
|
||||
# end
|
||||
|
||||
import gdb
|
||||
import re
|
||||
from bisect import bisect_left
|
||||
|
||||
|
||||
# Basic row/column iteration code for use with Sparse and Dense matrices
|
||||
class _MatrixEntryIterator(object):
|
||||
|
||||
def __init__(self, rows, cols, row_major):
|
||||
self.rows = rows
|
||||
self.cols = cols
|
||||
self.currentRow = 0
|
||||
self.currentCol = 0
|
||||
self.rowMajor = row_major
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def next(self):
|
||||
return self.__next__() # Python 2.x compatibility
|
||||
|
||||
def __next__(self):
|
||||
row = self.currentRow
|
||||
col = self.currentCol
|
||||
if self.rowMajor == 0:
|
||||
if self.currentCol >= self.cols:
|
||||
raise StopIteration
|
||||
|
||||
self.currentRow += 1
|
||||
if self.currentRow >= self.rows:
|
||||
self.currentRow = 0
|
||||
self.currentCol += 1
|
||||
else:
|
||||
if self.currentRow >= self.rows:
|
||||
raise StopIteration
|
||||
|
||||
self.currentCol += 1
|
||||
if self.currentCol >= self.cols:
|
||||
self.currentCol = 0
|
||||
self.currentRow += 1
|
||||
|
||||
return row, col
|
||||
|
||||
|
||||
class EigenMatrixPrinter:
|
||||
"""Print Eigen Matrix or Array of some kind"""
|
||||
|
||||
def __init__(self, variety, val):
|
||||
"""Extract all the necessary information"""
|
||||
|
||||
# Save the variety (presumably "Matrix" or "Array") for later usage
|
||||
self.variety = variety
|
||||
|
||||
# The gdb extension does not support value template arguments - need to extract them by hand
|
||||
typeinfo = val.type
|
||||
if typeinfo.code == gdb.TYPE_CODE_REF:
|
||||
typeinfo = typeinfo.target()
|
||||
self.type = typeinfo.unqualified().strip_typedefs()
|
||||
tag = self.type.tag
|
||||
regex = re.compile('<.*>')
|
||||
m = regex.findall(tag)[0][1:-1]
|
||||
template_params = m.split(',')
|
||||
template_params = [x.replace(" ", "") for x in template_params]
|
||||
|
||||
if template_params[1] in ['-0x00000000000000001', '-0x000000001', '-1']:
|
||||
self.rows = val['m_storage']['m_rows']
|
||||
else:
|
||||
self.rows = int(template_params[1])
|
||||
|
||||
if template_params[2] in ['-0x00000000000000001', '-0x000000001', '-1']:
|
||||
self.cols = val['m_storage']['m_cols']
|
||||
else:
|
||||
self.cols = int(template_params[2])
|
||||
|
||||
self.options = 0 # default value
|
||||
if len(template_params) > 3:
|
||||
self.options = template_params[3]
|
||||
|
||||
self.rowMajor = (int(self.options) & 0x1)
|
||||
|
||||
self.innerType = self.type.template_argument(0)
|
||||
|
||||
self.val = val
|
||||
|
||||
# Fixed size matrices have a struct as their storage, so we need to walk through this
|
||||
self.data = self.val['m_storage']['m_data']
|
||||
if self.data.type.code == gdb.TYPE_CODE_STRUCT:
|
||||
self.data = self.data['array']
|
||||
self.data = self.data.cast(self.innerType.pointer())
|
||||
|
||||
class _Iterator(_MatrixEntryIterator):
|
||||
def __init__(self, rows, cols, data_ptr, row_major):
|
||||
super(EigenMatrixPrinter._Iterator, self).__init__(rows, cols, row_major)
|
||||
|
||||
self.dataPtr = data_ptr
|
||||
|
||||
def __next__(self):
|
||||
row, col = super(EigenMatrixPrinter._Iterator, self).__next__()
|
||||
|
||||
item = self.dataPtr.dereference()
|
||||
self.dataPtr += 1
|
||||
if self.cols == 1: # if it's a column vector
|
||||
return '[%d]' % (row,), item
|
||||
elif self.rows == 1: # if it's a row vector
|
||||
return '[%d]' % (col,), item
|
||||
return '[%d,%d]' % (row, col), item
|
||||
|
||||
def children(self):
|
||||
return self._Iterator(self.rows, self.cols, self.data, self.rowMajor)
|
||||
|
||||
def to_string(self):
|
||||
return "Eigen::%s<%s,%d,%d,%s> (data ptr: %s)" % (
|
||||
self.variety, self.innerType, self.rows, self.cols,
|
||||
"RowMajor" if self.rowMajor else "ColMajor", self.data)
|
||||
|
||||
|
||||
class EigenSparseMatrixPrinter:
|
||||
"""Print an Eigen SparseMatrix"""
|
||||
|
||||
def __init__(self, val):
|
||||
"""Extract all the necessary information"""
|
||||
|
||||
typeinfo = val.type
|
||||
if typeinfo.code == gdb.TYPE_CODE_REF:
|
||||
typeinfo = typeinfo.target()
|
||||
self.type = typeinfo.unqualified().strip_typedefs()
|
||||
tag = self.type.tag
|
||||
regex = re.compile('<.*>')
|
||||
m = regex.findall(tag)[0][1:-1]
|
||||
template_params = m.split(',')
|
||||
template_params = [x.replace(" ", "") for x in template_params]
|
||||
|
||||
self.options = 0
|
||||
if len(template_params) > 1:
|
||||
self.options = template_params[1]
|
||||
|
||||
self.rowMajor = (int(self.options) & 0x1)
|
||||
|
||||
self.innerType = self.type.template_argument(0)
|
||||
|
||||
self.val = val
|
||||
|
||||
self.data = self.val['m_data']
|
||||
self.data = self.data.cast(self.innerType.pointer())
|
||||
|
||||
class _Iterator(_MatrixEntryIterator):
|
||||
def __init__(self, rows, cols, val, row_major):
|
||||
super(EigenSparseMatrixPrinter._Iterator, self).__init__(rows, cols, row_major)
|
||||
|
||||
self.val = val
|
||||
|
||||
def __next__(self):
|
||||
row, col = super(EigenSparseMatrixPrinter._Iterator, self).__next__()
|
||||
|
||||
# repeat calculations from SparseMatrix.h:
|
||||
outer = row if self.rowMajor else col
|
||||
inner = col if self.rowMajor else row
|
||||
start = self.val['m_outerIndex'][outer]
|
||||
end = (
|
||||
(start + self.val['m_innerNonZeros'][outer])
|
||||
if self.val['m_innerNonZeros'] else self.val['m_outerIndex'][outer+1]
|
||||
)
|
||||
|
||||
# and from CompressedStorage.h:
|
||||
data = self.val['m_data']
|
||||
if start >= end:
|
||||
item = 0
|
||||
elif (end > start) and (inner == data['m_indices'][end-1]):
|
||||
item = data['m_values'][end-1]
|
||||
else:
|
||||
# create Python index list from the target range within m_indices
|
||||
indices = [data['m_indices'][x] for x in range(int(start), int(end)-1)]
|
||||
# find the index with binary search
|
||||
idx = int(start) + bisect_left(indices, inner)
|
||||
if idx < end and data['m_indices'][idx] == inner:
|
||||
item = data['m_values'][idx]
|
||||
else:
|
||||
item = 0
|
||||
|
||||
return '[%d,%d]' % (row, col), item
|
||||
|
||||
def children(self):
|
||||
if self.data:
|
||||
return self._Iterator(self.rows(), self.cols(), self.val, self.rowMajor)
|
||||
|
||||
return iter([]) # empty matrix, for now
|
||||
|
||||
def rows(self):
|
||||
return self.val['m_outerSize'] if self.rowMajor else self.val['m_innerSize']
|
||||
|
||||
def cols(self):
|
||||
return self.val['m_innerSize'] if self.rowMajor else self.val['m_outerSize']
|
||||
|
||||
def to_string(self):
|
||||
|
||||
if self.data:
|
||||
status = ("not compressed" if self.val['m_innerNonZeros'] else "compressed")
|
||||
else:
|
||||
status = "empty"
|
||||
dimensions = "%d x %d" % (self.rows(), self.cols())
|
||||
layout = "row" if self.rowMajor else "column"
|
||||
|
||||
return "Eigen::SparseMatrix<%s>, %s, %s major, %s" % (
|
||||
self.innerType, dimensions, layout, status)
|
||||
|
||||
|
||||
class EigenQuaternionPrinter:
|
||||
"""Print an Eigen Quaternion"""
|
||||
|
||||
def __init__(self, val):
|
||||
"""Extract all the necessary information"""
|
||||
# The gdb extension does not support value template arguments - need to extract them by hand
|
||||
typeinfo = val.type
|
||||
if typeinfo.code == gdb.TYPE_CODE_REF:
|
||||
typeinfo = typeinfo.target()
|
||||
self.type = typeinfo.unqualified().strip_typedefs()
|
||||
self.innerType = self.type.template_argument(0)
|
||||
self.val = val
|
||||
|
||||
# Quaternions have a struct as their storage, so we need to walk through this
|
||||
self.data = self.val['m_coeffs']['m_storage']['m_data']['array']
|
||||
self.data = self.data.cast(self.innerType.pointer())
|
||||
|
||||
class _Iterator:
|
||||
def __init__(self, data_ptr):
|
||||
self.dataPtr = data_ptr
|
||||
self.currentElement = 0
|
||||
self.elementNames = ['x', 'y', 'z', 'w']
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def next(self):
|
||||
return self.__next__() # Python 2.x compatibility
|
||||
|
||||
def __next__(self):
|
||||
element = self.currentElement
|
||||
|
||||
if self.currentElement >= 4: # there are 4 elements in a quaternion
|
||||
raise StopIteration
|
||||
|
||||
self.currentElement += 1
|
||||
|
||||
item = self.dataPtr.dereference()
|
||||
self.dataPtr += 1
|
||||
return '[%s]' % (self.elementNames[element],), item
|
||||
|
||||
def children(self):
|
||||
return self._Iterator(self.data)
|
||||
|
||||
def to_string(self):
|
||||
return "Eigen::Quaternion<%s> (data ptr: %s)" % (self.innerType, self.data)
|
||||
|
||||
|
||||
def cast_eigen_block_to_matrix(val):
|
||||
# Get the type of the variable (and convert to a string)
|
||||
# Example: 'const Eigen::Block<Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, -1, -1, false> const, -1, -1, false>'
|
||||
val_type = str(val.type)
|
||||
|
||||
# Extract the Eigen::Matrix type from the Block:
|
||||
# From the previous example: Eigen::Matrix<double, -1, -1, 0, -1, -1>
|
||||
begin = val_type.find('Eigen::Matrix<')
|
||||
end = val_type.find('>', begin) + 1
|
||||
|
||||
# Convert the Eigen::Block to an Eigen::Matrix
|
||||
return val.cast(gdb.lookup_type(val_type[begin:end]))
|
||||
|
||||
|
||||
def build_eigen_dictionary():
|
||||
pretty_printers_dict[re.compile('^Eigen::Quaternion<.*>$')] = lambda val: EigenQuaternionPrinter(val)
|
||||
pretty_printers_dict[re.compile('^Eigen::Matrix<.*>$')] = lambda val: EigenMatrixPrinter("Matrix", val)
|
||||
pretty_printers_dict[re.compile('^Eigen::Block<.*>$')] =\
|
||||
lambda val: EigenMatrixPrinter("Matrix", cast_eigen_block_to_matrix(val))
|
||||
pretty_printers_dict[re.compile('^Eigen::VectorBlock<.*>$')] =\
|
||||
lambda val: EigenMatrixPrinter("Matrix", cast_eigen_block_to_matrix(val))
|
||||
pretty_printers_dict[re.compile('^Eigen::SparseMatrix<.*>$')] = lambda val: EigenSparseMatrixPrinter(val)
|
||||
pretty_printers_dict[re.compile('^Eigen::Array<.*>$')] = lambda val: EigenMatrixPrinter("Array", val)
|
||||
|
||||
|
||||
def register_eigen_printers(obj):
|
||||
"""Register eigen pretty-printers with objfile Obj"""
|
||||
|
||||
if obj is None:
|
||||
obj = gdb
|
||||
obj.pretty_printers.append(lookup_function)
|
||||
|
||||
|
||||
def lookup_function(val):
|
||||
"""Look-up and return a pretty-printer that can print val."""
|
||||
|
||||
typeinfo = val.type
|
||||
|
||||
if typeinfo.code == gdb.TYPE_CODE_REF:
|
||||
typeinfo = typeinfo.target()
|
||||
|
||||
typeinfo = typeinfo.unqualified().strip_typedefs()
|
||||
|
||||
typename = typeinfo.tag
|
||||
if typename is None:
|
||||
return None
|
||||
|
||||
for function in pretty_printers_dict:
|
||||
if function.search(typename):
|
||||
return pretty_printers_dict[function](val)
|
||||
|
||||
return None
|
||||
|
||||
|
||||
pretty_printers_dict = {}
|
||||
|
||||
build_eigen_dictionary()
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# This file is part of Eigen, a lightweight C++ template library
|
||||
# for linear algebra.
|
||||
#
|
||||
# Copyright (C) 2021 Huang, Zhaoquan <zhaoquan2008@hotmail.com>
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Pretty printers for Eigen::Matrix to use with LLDB debugger
|
||||
#
|
||||
# Usage:
|
||||
# 1. Add the following line (change it according to the path to this file)
|
||||
# to the file ~/.lldbinit (create one if it doesn't exist):
|
||||
# `command script import /path/to/eigenlldb.py`
|
||||
# 2. Inspect the variables in LLDB command line
|
||||
# `frame variable`
|
||||
|
||||
import lldb
|
||||
from typing import List
|
||||
import bisect
|
||||
|
||||
|
||||
def __lldb_init_module(debugger, internal_dict):
|
||||
debugger.HandleCommand("type synthetic add -x Eigen::Matrix<.*> --python-class eigenlldb.EigenMatrixChildProvider")
|
||||
debugger.HandleCommand(
|
||||
"type synthetic add -x Eigen::SparseMatrix<.*> --python-class eigenlldb.EigenSparseMatrixChildProvider")
|
||||
|
||||
|
||||
class EigenMatrixChildProvider:
|
||||
_valobj: lldb.SBValue
|
||||
_scalar_type: lldb.SBType
|
||||
_scalar_size: int
|
||||
_rows_compile_time: int
|
||||
_cols_compile_time: int
|
||||
_row_major: bool
|
||||
_fixed_storage: bool
|
||||
|
||||
def __init__(self, valobj, internal_dict):
|
||||
self._valobj = valobj
|
||||
valtype = valobj.GetType().GetCanonicalType()
|
||||
|
||||
scalar_type = valtype.GetTemplateArgumentType(0)
|
||||
if not scalar_type.IsValid():
|
||||
# In the case that scalar_type is invalid on LLDB 9.0 on Windows with CLion
|
||||
storage = valobj.GetChildMemberWithName("m_storage")
|
||||
data = storage.GetChildMemberWithName("m_data")
|
||||
data_type = data.GetType()
|
||||
if data_type.IsPointerType():
|
||||
scalar_type = data.GetType().GetPointeeType()
|
||||
else:
|
||||
scalar_type = data.GetChildMemberWithName("array").GetType().GetArrayElementType()
|
||||
self._scalar_type = scalar_type
|
||||
self._scalar_size = self._scalar_type.GetByteSize()
|
||||
|
||||
name = valtype.GetName()
|
||||
template_begin = name.find("<")
|
||||
template_end = name.find(">")
|
||||
template_args = name[(template_begin + 1):template_end].split(",")
|
||||
self._rows_compile_time = int(template_args[1])
|
||||
self._cols_compile_time = int(template_args[2])
|
||||
self._row_major = (int(template_args[3]) & 1) != 0
|
||||
|
||||
max_rows = int(template_args[4])
|
||||
max_cols = int(template_args[5])
|
||||
self._fixed_storage = (max_rows != -1 and max_cols != -1)
|
||||
|
||||
def num_children(self):
|
||||
return self._cols() * self._rows()
|
||||
|
||||
def get_child_index(self, name):
|
||||
pass
|
||||
|
||||
def get_child_at_index(self, index):
|
||||
storage = self._valobj.GetChildMemberWithName("m_storage")
|
||||
data = storage.GetChildMemberWithName("m_data")
|
||||
offset = self._scalar_size * index
|
||||
|
||||
if self._row_major:
|
||||
row = index // self._cols()
|
||||
col = index % self._cols()
|
||||
else:
|
||||
row = index % self._rows()
|
||||
col = index // self._rows()
|
||||
if self._fixed_storage:
|
||||
data = data.GetChildMemberWithName("array")
|
||||
if self._cols() == 1:
|
||||
name = '[{}]'.format(row)
|
||||
elif self._rows() == 1:
|
||||
name = '[{}]'.format(col)
|
||||
else:
|
||||
name = '[{},{}]'.format(row, col)
|
||||
return data.CreateChildAtOffset(
|
||||
name, offset, self._scalar_type
|
||||
)
|
||||
|
||||
def _cols(self):
|
||||
if self._cols_compile_time == -1:
|
||||
storage = self._valobj.GetChildMemberWithName("m_storage")
|
||||
cols = storage.GetChildMemberWithName("m_cols")
|
||||
return cols.GetValueAsUnsigned()
|
||||
else:
|
||||
return self._cols_compile_time
|
||||
|
||||
def _rows(self):
|
||||
if self._rows_compile_time == -1:
|
||||
storage = self._valobj.GetChildMemberWithName("m_storage")
|
||||
rows = storage.GetChildMemberWithName("m_rows")
|
||||
return rows.GetValueAsUnsigned()
|
||||
else:
|
||||
return self._rows_compile_time
|
||||
|
||||
|
||||
class EigenSparseMatrixChildProvider:
|
||||
_valobj: lldb.SBValue
|
||||
_scalar_type: lldb.SBType
|
||||
_scalar_size: int
|
||||
_index_type: lldb.SBType
|
||||
_index_size: int
|
||||
_row_major: bool
|
||||
|
||||
_outer_size: int
|
||||
_nnz: int
|
||||
_values: lldb.SBValue
|
||||
_inner_indices: lldb.SBValue
|
||||
_outer_starts: lldb.SBValue
|
||||
_inner_nnzs: lldb.SBValue
|
||||
_compressed: bool
|
||||
|
||||
# Index of the first synthetic child under each outer index
|
||||
_child_indices: List[int]
|
||||
|
||||
def __init__(self, valobj, internal_dict):
|
||||
self._valobj = valobj
|
||||
valtype = valobj.GetType().GetCanonicalType()
|
||||
scalar_type = valtype.GetTemplateArgumentType(0)
|
||||
if not scalar_type.IsValid():
|
||||
# In the case that scalar_type is invalid on LLDB 9.0 on Windows with CLion
|
||||
data = valobj.GetChildMemberWithName("m_data")
|
||||
values = data.GetChildMemberWithName("m_values")
|
||||
scalar_type = values.GetType().GetPointeeType()
|
||||
self._scalar_type = scalar_type
|
||||
self._scalar_size = scalar_type.GetByteSize()
|
||||
|
||||
index_type = valtype.GetTemplateArgumentType(2)
|
||||
if not index_type.IsValid():
|
||||
# In the case that scalar_type is invalid on LLDB 9.0 on Windows with CLion
|
||||
outer_starts = valobj.GetChildMemberWithName("m_outerIndex")
|
||||
index_type = outer_starts.GetType().GetPointeeType()
|
||||
self._index_type = index_type
|
||||
self._index_size = index_type.GetByteSize()
|
||||
|
||||
name = valtype.GetName()
|
||||
template_begin = name.find("<")
|
||||
template_end = name.find(">")
|
||||
template_args = name[(template_begin + 1):template_end].split(",")
|
||||
self._row_major = (int(template_args[1]) & 1) != 0
|
||||
|
||||
def num_children(self):
|
||||
return self._nnz + 2
|
||||
|
||||
def get_child_index(self, name):
|
||||
pass
|
||||
|
||||
def get_child_at_index(self, index):
|
||||
if index == 0:
|
||||
name = "rows" if self._row_major else "cols"
|
||||
return self._valobj.GetChildMemberWithName("m_outerSize") \
|
||||
.CreateChildAtOffset(name, 0, self._index_type)
|
||||
elif index == 1:
|
||||
name = "cols" if self._row_major else "rows"
|
||||
return self._valobj.GetChildMemberWithName("m_innerSize") \
|
||||
.CreateChildAtOffset(name, 0, self._index_type)
|
||||
else:
|
||||
index = index - 2
|
||||
outer_index = bisect.bisect_right(self._child_indices, index) - 1
|
||||
total_nnzs = self._child_indices[outer_index]
|
||||
if self._compressed:
|
||||
item_index = index
|
||||
inner_index = self._inner_indices \
|
||||
.CreateChildAtOffset("", item_index * self._index_size, self._index_type) \
|
||||
.GetValueAsUnsigned()
|
||||
return self._values \
|
||||
.CreateChildAtOffset(self._child_name(outer_index, inner_index),
|
||||
item_index * self._scalar_size,
|
||||
self._scalar_type)
|
||||
else:
|
||||
index_begin = self._outer_starts \
|
||||
.CreateChildAtOffset("", outer_index * self._index_size, self._index_type) \
|
||||
.GetValueAsUnsigned()
|
||||
item_index = index - total_nnzs + index_begin
|
||||
inner_index = self._inner_indices \
|
||||
.CreateChildAtOffset("", item_index * self._index_size, self._index_type) \
|
||||
.GetValueAsUnsigned()
|
||||
return self._values \
|
||||
.CreateChildAtOffset(self._child_name(outer_index, inner_index),
|
||||
item_index * self._scalar_size,
|
||||
self._scalar_type)
|
||||
|
||||
def update(self):
|
||||
valobj = self._valobj
|
||||
self._outer_size = valobj.GetChildMemberWithName("m_outerSize").GetValueAsUnsigned()
|
||||
data = valobj.GetChildMemberWithName("m_data")
|
||||
self._values = data.GetChildMemberWithName("m_values")
|
||||
self._inner_indices = data.GetChildMemberWithName("m_indices")
|
||||
self._outer_starts = valobj.GetChildMemberWithName("m_outerIndex")
|
||||
self._inner_nnzs = valobj.GetChildMemberWithName("m_innerNonZeros")
|
||||
|
||||
self._compressed = self._inner_nnzs.GetValueAsUnsigned() == 0
|
||||
|
||||
total_nnzs = 0
|
||||
child_indices = [0]
|
||||
for outer_index in range(self._outer_size):
|
||||
if self._compressed:
|
||||
index_end = self._outer_starts \
|
||||
.CreateChildAtOffset("", (outer_index + 1) * self._index_size, self._index_type) \
|
||||
.GetValueAsUnsigned()
|
||||
total_nnzs = index_end
|
||||
child_indices.append(total_nnzs)
|
||||
else:
|
||||
nnzs = self._inner_nnzs \
|
||||
.CreateChildAtOffset("", outer_index * self._index_size, self._index_type) \
|
||||
.GetValueAsUnsigned()
|
||||
total_nnzs = total_nnzs + nnzs
|
||||
child_indices.append(total_nnzs)
|
||||
self._child_indices = child_indices
|
||||
self._nnz = total_nnzs
|
||||
|
||||
def _child_name(self, outer_index, inner_index):
|
||||
if self._row_major:
|
||||
return "[{0},{1}]".format(outer_index, inner_index)
|
||||
else:
|
||||
return "[{1},{0}]".format(outer_index, inner_index)
|
||||
+235
@@ -0,0 +1,235 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
|
||||
<!-- Fixed x Fixed Matrix -->
|
||||
<Type Name="Eigen::Matrix<*,*,*,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Array<*,-1,-1,*,*,*>"/>
|
||||
<DisplayString>[{$T2}, {$T3}] (fixed matrix)</DisplayString>
|
||||
<Expand>
|
||||
<ArrayItems Condition="Flags%2"> <!-- row major layout -->
|
||||
<Rank>2</Rank>
|
||||
<Size>$i==0 ? $T2 : $T3</Size>
|
||||
<ValuePointer>m_storage.m_data.array</ValuePointer>
|
||||
</ArrayItems>
|
||||
<ArrayItems Condition="!(Flags%2)"> <!-- column major layout -->
|
||||
<Direction>Backward</Direction>
|
||||
<Rank>2</Rank>
|
||||
<Size>$i==0 ? $T2 : $T3</Size>
|
||||
<ValuePointer>m_storage.m_data.array</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<!-- 2 x 2 Matrix -->
|
||||
<Type Name="Eigen::Matrix<*,2,2,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Array<*,2,2,*,*,*>"/>
|
||||
<DisplayString>[2, 2] (fixed matrix)</DisplayString>
|
||||
<Expand>
|
||||
<Synthetic Name="[row 0]" Condition="Flags%2">
|
||||
<DisplayString>({m_storage.m_data.array[0]}, {m_storage.m_data.array[1]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 0]" Condition="!(Flags%2)">
|
||||
<DisplayString>({m_storage.m_data.array[0]}, {m_storage.m_data.array[2]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 1]" Condition="Flags%2">
|
||||
<DisplayString>({m_storage.m_data.array[2]}, {m_storage.m_data.array[3]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 1]" Condition="!(Flags%2)">
|
||||
<DisplayString>({m_storage.m_data.array[1]}, {m_storage.m_data.array[3]})</DisplayString>
|
||||
</Synthetic>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<!-- 3 x 3 Matrix -->
|
||||
<Type Name="Eigen::Matrix<*,3,3,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Array<*,3,3,*,*,*>"/>
|
||||
<DisplayString>[3, 3] (fixed matrix)</DisplayString>
|
||||
<Expand>
|
||||
<Synthetic Name="[row 0]" Condition="Flags%2">
|
||||
<DisplayString>({m_storage.m_data.array[0]}, {m_storage.m_data.array[1]}, {m_storage.m_data.array[2]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 0]" Condition="!(Flags%2)">
|
||||
<DisplayString>({m_storage.m_data.array[0]}, {m_storage.m_data.array[3]}, {m_storage.m_data.array[6]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 1]" Condition="Flags%2">
|
||||
<DisplayString>({m_storage.m_data.array[3]}, {m_storage.m_data.array[4]}, {m_storage.m_data.array[5]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 1]" Condition="!(Flags%2)">
|
||||
<DisplayString>({m_storage.m_data.array[1]}, {m_storage.m_data.array[4]}, {m_storage.m_data.array[7]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 2]" Condition="Flags%2">
|
||||
<DisplayString>({m_storage.m_data.array[6]}, {m_storage.m_data.array[7]}, {m_storage.m_data.array[8]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 2]" Condition="!(Flags%2)">
|
||||
<DisplayString>({m_storage.m_data.array[2]}, {m_storage.m_data.array[5]}, {m_storage.m_data.array[8]})</DisplayString>
|
||||
</Synthetic>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<!-- 4 x 4 Matrix -->
|
||||
<Type Name="Eigen::Matrix<*,4,4,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Array<*,4,4,*,*,*>"/>
|
||||
<DisplayString>[4, 4] (fixed matrix)</DisplayString>
|
||||
<Expand>
|
||||
<Synthetic Name="[row 0]" Condition="Flags%2">
|
||||
<DisplayString>({m_storage.m_data.array[0]}, {m_storage.m_data.array[1]}, {m_storage.m_data.array[2]}, {m_storage.m_data.array[3]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 0]" Condition="!(Flags%2)">
|
||||
<DisplayString>({m_storage.m_data.array[0]}, {m_storage.m_data.array[4]}, {m_storage.m_data.array[8]}, {m_storage.m_data.array[12]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 1]" Condition="Flags%2">
|
||||
<DisplayString>({m_storage.m_data.array[4]}, {m_storage.m_data.array[5]}, {m_storage.m_data.array[6]}, {m_storage.m_data.array[7]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 1]" Condition="!(Flags%2)">
|
||||
<DisplayString>({m_storage.m_data.array[1]}, {m_storage.m_data.array[5]}, {m_storage.m_data.array[9]}, {m_storage.m_data.array[13]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 2]" Condition="Flags%2">
|
||||
<DisplayString>({m_storage.m_data.array[8]}, {m_storage.m_data.array[9]}, {m_storage.m_data.array[10]}, {m_storage.m_data.array[11]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 2]" Condition="!(Flags%2)">
|
||||
<DisplayString>({m_storage.m_data.array[2]}, {m_storage.m_data.array[6]}, {m_storage.m_data.array[10]}, {m_storage.m_data.array[14]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 3]" Condition="Flags%2">
|
||||
<DisplayString>({m_storage.m_data.array[12]}, {m_storage.m_data.array[13]}, {m_storage.m_data.array[14]}, {m_storage.m_data.array[15]})</DisplayString>
|
||||
</Synthetic>
|
||||
<Synthetic Name="[row 3]" Condition="!(Flags%2)">
|
||||
<DisplayString>({m_storage.m_data.array[3]}, {m_storage.m_data.array[7]}, {m_storage.m_data.array[11]}, {m_storage.m_data.array[15]})</DisplayString>
|
||||
</Synthetic>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<!-- Dynamic x Dynamic Matrix -->
|
||||
<Type Name="Eigen::Matrix<*,-1,-1,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Array<*,-1,-1,*,*,*>"/>
|
||||
<DisplayString Condition="m_storage.m_data == 0">empty</DisplayString>
|
||||
<DisplayString Condition="m_storage.m_data != 0">[{m_storage.m_rows}, {m_storage.m_cols}] (dynamic matrix)</DisplayString>
|
||||
<Expand>
|
||||
<ArrayItems Condition="Flags%2"> <!-- row major layout -->
|
||||
<Rank>2</Rank>
|
||||
<Size>$i==0 ? m_storage.m_rows : m_storage.m_cols</Size>
|
||||
<ValuePointer>m_storage.m_data</ValuePointer>
|
||||
</ArrayItems>
|
||||
<ArrayItems Condition="!(Flags%2)"> <!-- column major layout -->
|
||||
<Direction>Backward</Direction>
|
||||
<Rank>2</Rank>
|
||||
<Size>$i==0 ? m_storage.m_rows : m_storage.m_cols</Size>
|
||||
<ValuePointer>m_storage.m_data</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<!-- Fixed x Dynamic Matrix -->
|
||||
<Type Name="Eigen::Matrix<*,*,-1,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Array<*,*,-1,*,*,*>"/>
|
||||
<DisplayString Condition="m_storage.m_data == 0">empty</DisplayString>
|
||||
<DisplayString Condition="m_storage.m_data != 0">[{$T2}, {m_storage.m_cols}] (dynamic column matrix)</DisplayString>
|
||||
<Expand>
|
||||
<ArrayItems Condition="Flags%2"> <!-- row major layout -->
|
||||
<Rank>2</Rank>
|
||||
<Size>$i==0 ? $T2 : m_storage.m_cols</Size>
|
||||
<ValuePointer>m_storage.m_data</ValuePointer>
|
||||
</ArrayItems>
|
||||
<ArrayItems Condition="!(Flags%2)"> <!-- column major layout -->
|
||||
<Direction>Backward</Direction>
|
||||
<Rank>2</Rank>
|
||||
<Size>$i==0 ? $T2 : m_storage.m_cols</Size>
|
||||
<ValuePointer>m_storage.m_data</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<!-- Dynamic x Fixed Matrix -->
|
||||
<Type Name="Eigen::Matrix<*,-1,*,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Array<*,-1,*,*,*,*>"/>
|
||||
<DisplayString Condition="m_storage.m_data == 0">empty</DisplayString>
|
||||
<DisplayString Condition="m_storage.m_data != 0">[{m_storage.m_rows}, {$T2}] (dynamic row matrix)</DisplayString>
|
||||
<Expand>
|
||||
<ArrayItems Condition="Flags%2"> <!-- row major layout -->
|
||||
<Rank>2</Rank>
|
||||
<Size>$i==0 ? m_storage.m_rows : $T2</Size>
|
||||
<ValuePointer>m_storage.m_data</ValuePointer>
|
||||
</ArrayItems>
|
||||
<ArrayItems Condition="!(Flags%2)"> <!-- column major layout -->
|
||||
<Direction>Backward</Direction>
|
||||
<Rank>2</Rank>
|
||||
<Size>$i==0 ? m_storage.m_rows : $T2</Size>
|
||||
<ValuePointer>m_storage.m_data</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<!-- Dynamic Column Vector -->
|
||||
<Type Name="Eigen::Matrix<*,1,-1,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Array<*,1,-1,*,*,*>"/>
|
||||
<DisplayString Condition="m_storage.m_data == 0">empty</DisplayString>
|
||||
<DisplayString Condition="m_storage.m_data != 0">[{m_storage.m_cols}] (dynamic column vector)</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[size]">m_storage.m_cols</Item>
|
||||
<ArrayItems>
|
||||
<Size>m_storage.m_cols</Size>
|
||||
<ValuePointer>m_storage.m_data</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<!-- Dynamic Row Vector -->
|
||||
<Type Name="Eigen::Matrix<*,-1,1,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Array<*,-1,1,*,*,*>"/>
|
||||
<DisplayString Condition="m_storage.m_data == 0">empty</DisplayString>
|
||||
<DisplayString Condition="m_storage.m_data != 0">[{m_storage.m_rows}] (dynamic row vector)</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[size]">m_storage.m_rows</Item>
|
||||
<ArrayItems>
|
||||
<Size>m_storage.m_rows</Size>
|
||||
<ValuePointer>m_storage.m_data</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<!-- Fixed Vector -->
|
||||
<Type Name="Eigen::Matrix<*,1,1,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Array<*,1,1,*,*,*>"/>
|
||||
<DisplayString>[1] ({m_storage.m_data.array[0]})</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[x]">m_storage.m_data.array[0]</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="Eigen::Matrix<*,2,1,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Matrix<*,1,2,*,*,*>"/>
|
||||
<AlternativeType Name="Eigen::Array<*,2,1,*,*,*>"/>
|
||||
<AlternativeType Name="Eigen::Array<*,1,2,*,*,*>"/>
|
||||
<DisplayString>[2] ({m_storage.m_data.array[0]}, {m_storage.m_data.array[1]})</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[x]">m_storage.m_data.array[0]</Item>
|
||||
<Item Name="[y]">m_storage.m_data.array[1]</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="Eigen::Matrix<*,3,1,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Matrix<*,1,3,*,*,*>"/>
|
||||
<AlternativeType Name="Eigen::Array<*,3,1,*,*,*>"/>
|
||||
<AlternativeType Name="Eigen::Array<*,1,3,*,*,*>"/>
|
||||
<DisplayString>[3] ({m_storage.m_data.array[0]}, {m_storage.m_data.array[1]}, {m_storage.m_data.array[2]})</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[x]">m_storage.m_data.array[0]</Item>
|
||||
<Item Name="[y]">m_storage.m_data.array[1]</Item>
|
||||
<Item Name="[z]">m_storage.m_data.array[2]</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="Eigen::Matrix<*,4,1,*,*,*>">
|
||||
<AlternativeType Name="Eigen::Matrix<*,1,4,*,*,*>"/>
|
||||
<AlternativeType Name="Eigen::Array<*,4,1,*,*,*>"/>
|
||||
<AlternativeType Name="Eigen::Array<*,1,4,*,*,*>"/>
|
||||
<DisplayString>[4] ({m_storage.m_data.array[0]}, {m_storage.m_data.array[1]}, {m_storage.m_data.array[2]}, {m_storage.m_data.array[3]})</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[x]">m_storage.m_data.array[0]</Item>
|
||||
<Item Name="[y]">m_storage.m_data.array[1]</Item>
|
||||
<Item Name="[z]">m_storage.m_data.array[2]</Item>
|
||||
<Item Name="[w]">m_storage.m_data.array[3]</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
</AutoVisualizer>
|
||||
+295
@@ -0,0 +1,295 @@
|
||||
; ***************************************************************
|
||||
; * Eigen Visualizer
|
||||
; *
|
||||
; * Author: Hauke Heibel <hauke.heibel@gmail.com>
|
||||
; *
|
||||
; * Support the enhanced debugging of the following Eigen
|
||||
; * types (*: any, +:fixed dimension) :
|
||||
; *
|
||||
; * - Eigen::Matrix<*,4,1,*,*,*> and Eigen::Matrix<*,1,4,*,*,*>
|
||||
; * - Eigen::Matrix<*,3,1,*,*,*> and Eigen::Matrix<*,1,3,*,*,*>
|
||||
; * - Eigen::Matrix<*,2,1,*,*,*> and Eigen::Matrix<*,1,2,*,*,*>
|
||||
; * - Eigen::Matrix<*,-1,-1,*,*,*>
|
||||
; * - Eigen::Matrix<*,+,-1,*,*,*>
|
||||
; * - Eigen::Matrix<*,-1,+,*,*,*>
|
||||
; * - Eigen::Matrix<*,+,+,*,*,*>
|
||||
; *
|
||||
; * Matrices are displayed properly independently of the memory
|
||||
; * alignment (RowMajor vs. ColMajor).
|
||||
; *
|
||||
; * This file is distributed WITHOUT ANY WARRANTY. Please ensure
|
||||
; * that your original autoexp.dat file is copied to a safe
|
||||
; * place before proceeding with its modification.
|
||||
; ***************************************************************
|
||||
|
||||
[Visualizer]
|
||||
|
||||
; Fixed size 4-vectors
|
||||
Eigen::Matrix<*,4,1,*,*,*>|Eigen::Matrix<*,1,4,*,*,*>{
|
||||
children
|
||||
(
|
||||
#(
|
||||
[internals]: [$c,!],
|
||||
x : ($c.m_storage.m_data.array)[0],
|
||||
y : ($c.m_storage.m_data.array)[1],
|
||||
z : ($c.m_storage.m_data.array)[2],
|
||||
w : ($c.m_storage.m_data.array)[3]
|
||||
)
|
||||
)
|
||||
|
||||
preview
|
||||
(
|
||||
#(
|
||||
"[",
|
||||
4,
|
||||
"](",
|
||||
#array(expr: $e.m_storage.m_data.array[$i], size: 4),
|
||||
")"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
; Fixed size 3-vectors
|
||||
Eigen::Matrix<*,3,1,*,*,*>|Eigen::Matrix<*,1,3,*,*,*>{
|
||||
children
|
||||
(
|
||||
#(
|
||||
[internals]: [$c,!],
|
||||
x : ($c.m_storage.m_data.array)[0],
|
||||
y : ($c.m_storage.m_data.array)[1],
|
||||
z : ($c.m_storage.m_data.array)[2]
|
||||
)
|
||||
)
|
||||
|
||||
preview
|
||||
(
|
||||
#(
|
||||
"[",
|
||||
3,
|
||||
"](",
|
||||
#array(expr: $e.m_storage.m_data.array[$i], size: 3),
|
||||
")"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
; Fixed size 2-vectors
|
||||
Eigen::Matrix<*,2,1,*,*,*>|Eigen::Matrix<*,1,2,*,*,*>{
|
||||
children
|
||||
(
|
||||
#(
|
||||
[internals]: [$c,!],
|
||||
x : ($c.m_storage.m_data.array)[0],
|
||||
y : ($c.m_storage.m_data.array)[1]
|
||||
)
|
||||
)
|
||||
|
||||
preview
|
||||
(
|
||||
#(
|
||||
"[",
|
||||
2,
|
||||
"](",
|
||||
#array(expr: $e.m_storage.m_data.array[$i], size: 2),
|
||||
")"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
; Fixed size 1-vectors
|
||||
Eigen::Matrix<*,1,1,*,*,*>|Eigen::Matrix<*,1,1,*,*,*>{
|
||||
children
|
||||
(
|
||||
#(
|
||||
[internals]: [$c,!],
|
||||
x : ($c.m_storage.m_data.array)[0]
|
||||
)
|
||||
)
|
||||
|
||||
preview
|
||||
(
|
||||
#(
|
||||
"[",
|
||||
1,
|
||||
"](",
|
||||
#array(expr: $e.m_storage.m_data.array[$i], size: 1),
|
||||
")"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
; Dynamic matrices (ColMajor and RowMajor support)
|
||||
Eigen::Matrix<*,-1,-1,*,*,*>{
|
||||
children
|
||||
(
|
||||
#(
|
||||
[internals]: [$c,!],
|
||||
rows: $c.m_storage.m_rows,
|
||||
cols: $c.m_storage.m_cols,
|
||||
; Check for RowMajorBit
|
||||
#if ($c.Flags & 0x1) (
|
||||
#array(
|
||||
rank: 2,
|
||||
base: 0,
|
||||
expr: ($c.m_storage.m_data)[($i % $c.m_storage.m_rows)*$c.m_storage.m_cols + (($i- $i % $c.m_storage.m_rows)/$c.m_storage.m_rows)],
|
||||
size: ($r==1)*$c.m_storage.m_rows+($r==0)*$c.m_storage.m_cols
|
||||
)
|
||||
) #else (
|
||||
#array(
|
||||
rank: 2,
|
||||
base: 0,
|
||||
expr: ($c.m_storage.m_data)[$i],
|
||||
size: ($r==1)*$c.m_storage.m_rows+($r==0)*$c.m_storage.m_cols
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
preview
|
||||
(
|
||||
#(
|
||||
"[",
|
||||
$c.m_storage.m_rows,
|
||||
",",
|
||||
$c.m_storage.m_cols,
|
||||
"](",
|
||||
#array(
|
||||
expr : [($c.m_storage.m_data)[$i],g],
|
||||
size : $c.m_storage.m_rows*$c.m_storage.m_cols
|
||||
),
|
||||
")"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
; Fixed rows, dynamic columns matrix (ColMajor and RowMajor support)
|
||||
Eigen::Matrix<*,*,-1,*,*,*>{
|
||||
children
|
||||
(
|
||||
#(
|
||||
[internals]: [$c,!],
|
||||
rows: $c.RowsAtCompileTime,
|
||||
cols: $c.m_storage.m_cols,
|
||||
; Check for RowMajorBit
|
||||
#if ($c.Flags & 0x1) (
|
||||
#array(
|
||||
rank: 2,
|
||||
base: 0,
|
||||
expr: ($c.m_storage.m_data)[($i % $c.RowsAtCompileTime)*$c.m_storage.m_cols + (($i- $i % $c.RowsAtCompileTime)/$c.RowsAtCompileTime)],
|
||||
size: ($r==1)*$c.RowsAtCompileTime+($r==0)*$c.m_storage.m_cols
|
||||
)
|
||||
) #else (
|
||||
#array(
|
||||
rank: 2,
|
||||
base: 0,
|
||||
expr: ($c.m_storage.m_data)[$i],
|
||||
size: ($r==1)*$c.RowsAtCompileTime+($r==0)*$c.m_storage.m_cols
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
preview
|
||||
(
|
||||
#(
|
||||
"[",
|
||||
$c.RowsAtCompileTime,
|
||||
",",
|
||||
$c.m_storage.m_cols,
|
||||
"](",
|
||||
#array(
|
||||
expr : [($c.m_storage.m_data)[$i],g],
|
||||
size : $c.RowsAtCompileTime*$c.m_storage.m_cols
|
||||
),
|
||||
")"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
; Dynamic rows, fixed columns matrix (ColMajor and RowMajor support)
|
||||
Eigen::Matrix<*,-1,*,*,*,*>{
|
||||
children
|
||||
(
|
||||
#(
|
||||
[internals]: [$c,!],
|
||||
rows: $c.m_storage.m_rows,
|
||||
cols: $c.ColsAtCompileTime,
|
||||
; Check for RowMajorBit
|
||||
#if ($c.Flags & 0x1) (
|
||||
#array(
|
||||
rank: 2,
|
||||
base: 0,
|
||||
expr: ($c.m_storage.m_data)[($i % $c.m_storage.m_rows)*$c.ColsAtCompileTime + (($i- $i % $c.m_storage.m_rows)/$c.m_storage.m_rows)],
|
||||
size: ($r==1)*$c.m_storage.m_rows+($r==0)*$c.ColsAtCompileTime
|
||||
)
|
||||
) #else (
|
||||
#array(
|
||||
rank: 2,
|
||||
base: 0,
|
||||
expr: ($c.m_storage.m_data)[$i],
|
||||
size: ($r==1)*$c.m_storage.m_rows+($r==0)*$c.ColsAtCompileTime
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
preview
|
||||
(
|
||||
#(
|
||||
"[",
|
||||
$c.m_storage.m_rows,
|
||||
",",
|
||||
$c.ColsAtCompileTime,
|
||||
"](",
|
||||
#array(
|
||||
expr : [($c.m_storage.m_data)[$i],g],
|
||||
size : $c.m_storage.m_rows*$c.ColsAtCompileTime
|
||||
),
|
||||
")"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
; Fixed size matrix (ColMajor and RowMajor support)
|
||||
Eigen::Matrix<*,*,*,*,*,*>{
|
||||
children
|
||||
(
|
||||
#(
|
||||
[internals]: [$c,!],
|
||||
rows: $c.RowsAtCompileTime,
|
||||
cols: $c.ColsAtCompileTime,
|
||||
; Check for RowMajorBit
|
||||
#if ($c.Flags & 0x1) (
|
||||
#array(
|
||||
rank: 2,
|
||||
base: 0,
|
||||
expr: ($c.m_storage.m_data.array)[($i % $c.RowsAtCompileTime)*$c.ColsAtCompileTime + (($i- $i % $c.RowsAtCompileTime)/$c.RowsAtCompileTime)],
|
||||
size: ($r==1)*$c.RowsAtCompileTime+($r==0)*$c.ColsAtCompileTime
|
||||
)
|
||||
) #else (
|
||||
#array(
|
||||
rank: 2,
|
||||
base: 0,
|
||||
expr: ($c.m_storage.m_data.array)[$i],
|
||||
size: ($r==1)*$c.RowsAtCompileTime+($r==0)*$c.ColsAtCompileTime
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
preview
|
||||
(
|
||||
#(
|
||||
"[",
|
||||
$c.RowsAtCompileTime,
|
||||
",",
|
||||
$c.ColsAtCompileTime,
|
||||
"](",
|
||||
#array(
|
||||
expr : [($c.m_storage.m_data.array)[$i],g],
|
||||
size : $c.RowsAtCompileTime*$c.ColsAtCompileTime
|
||||
),
|
||||
")"
|
||||
)
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user