Skip to content

Commit

Permalink
Merge pull request #232 from aebrahim/py3
Browse files Browse the repository at this point in the history
fix sparse matrix bug on python 3
  • Loading branch information
arokem committed Mar 15, 2016
2 parents f21bacc + e69fe45 commit 72b4482
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pymatbridge/pymatbridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,10 @@ def set_plot_settings(self, width=512, height=384, inline=True):
def _set_sparse_variable(self, varname, value):
value = value.todok()
prefix = 'pymatbridge_temp_sparse_%s_' % uuid4().hex
self.set_variable(prefix + 'keys', value.keys())
self.set_variable(prefix + 'keys', list(value.keys()))
# correct for 1-indexing in MATLAB
self.run_code('{0}keys = {0}keys + 1;'.format(prefix))
self.set_variable(prefix + 'values', value.values())
self.set_variable(prefix + 'values', list(value.values()))
cmd = "{1} = sparse({0}keys(:, 1), {0}keys(:, 2), {0}values');"
result = self.run_code(cmd.format(prefix, varname))
self.run_code('clear {0}keys {0}values'.format(prefix))
Expand Down

0 comments on commit 72b4482

Please sign in to comment.