Skip to content

Commit

Permalink
fixed bug with list input
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Diamond committed Feb 21, 2017
1 parent 46d09a2 commit 4b1f85f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions cvxpy/atoms/affine/hstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@

class hstack(AffAtom):
""" Horizontal concatenation """
# Can take a single list as input.
def __init__(self, *args):
if len(args) == 1 and isinstance(args[0], list):
args = args[0]
super(hstack, self).__init__(*args)

# Returns the hstack of the values.
@AffAtom.numpy_numeric
def numeric(self, values):
Expand Down
3 changes: 2 additions & 1 deletion cvxpy/atoms/affine/vstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

class vstack(AffAtom):
""" Vertical concatenation """
# Can take a single list as input.
def __init__(self, *args):
if len(args) == 1 and isinstance(args, list):
if len(args) == 1 and isinstance(args[0], list):
args = args[0]
super(vstack, self).__init__(*args)

Expand Down
2 changes: 0 additions & 2 deletions cvxpy/atoms/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class Atom(Expression):
# args are the expressions passed into the Atom constructor.

def __init__(self, *args):
if len(args) == 1 and isinstance(args[0], list):
args = args[0]
# Throws error if args is empty.
if len(args) == 0:
raise TypeError(
Expand Down

0 comments on commit 4b1f85f

Please sign in to comment.