Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlei committed Sep 14, 2014
1 parent bf26a5b commit 9101afb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions smop/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ FLAGS=

check:
python runtime.py $(FLAGS)
#python test_runtime.py $(FLAGS)
python test_runtime.py $(FLAGS)
python test_matlabarray.py $(FLAGS)
python test_sparsearray.py $(FLAGS)
python test_lexer.py $(FLAGS)
python main.py solver.m && python go.py | wc
python test_runtime.py #&& python main.py fastsolver.m && python go.py
python main.py fastsolver.m && python go.py
15 changes: 14 additions & 1 deletion smop/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ def __getslice__(self,i,j):
return self.__getitem__(slice(i,j))

def __getitem__(self,index):
return matlabarray(self.get(index))

def get(self,index):
#import pdb; pdb.set_trace()
indices = self.compute_indices(index)
if len(indices) == 1:
Expand Down Expand Up @@ -272,7 +275,10 @@ def __new__(cls, a=[]):
if obj.size == 0:
obj.shape = (0,0)
return obj


def __getitem__(self,index):
return self.get(index)

# def __str__(self):
# if self.ndim == 0:
# return ""
Expand Down Expand Up @@ -314,6 +320,10 @@ def __new__(cls, a):
def __str__(self):
return "\n".join("".join(s) for s in self.reshape(-1))

def __getitem__(self,index):
return self.get(index)


class char(matlabarray):
"""
class char is a rectangular string matrix, which
Expand Down Expand Up @@ -345,6 +355,9 @@ def __new__(cls, a=""):
obj.shape = (0,0)
return obj

def __getitem__(self,index):
return self.get(index)

def __str__(self):
if self.ndim == 0:
return ""
Expand Down

0 comments on commit 9101afb

Please sign in to comment.