Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle RowMajor #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

alecjacobson
Copy link

I somehow found it very difficult to extract whether a matrix is row or column major within lldb. Right now it's extracting it from the type string and seems to work well.

Fixes #11

Copy link
Owner

@tehrengruber tehrengruber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the addition, just a small suggestion.

Comment on lines +67 to +73
def _row_element(valobj, row, rows, cols, is_row_major):
if is_row_major:
for i in range(row*cols, (row+1)*cols):
yield valobj.GetChildAtIndex(i, lldb.eNoDynamicValues, True).GetValue()
else:
for i in range(row, rows*cols, rows):
yield valobj.GetChildAtIndex(i, lldb.eNoDynamicValues, True).GetValue()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _row_element(valobj, row, rows, cols, is_row_major):
if is_row_major:
for i in range(row*cols, (row+1)*cols):
yield valobj.GetChildAtIndex(i, lldb.eNoDynamicValues, True).GetValue()
else:
for i in range(row, rows*cols, rows):
yield valobj.GetChildAtIndex(i, lldb.eNoDynamicValues, True).GetValue()
def _row_element(valobj, row, rows, cols, is_row_major):
if is_row_major:
raw_idx_iterator = range(row*cols, (row+1)*cols)
else
raw_idx_iterator = range(row, rows*cols, rows)
for i in raw_idx_iterator:
yield valobj.GetChildAtIndex(i, lldb.eNoDynamicValues, True).GetValue()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect output for RowMajor
2 participants