File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ def ismatrix(m, shape):
113
113
return False
114
114
return True
115
115
116
- def getmatrix (m , shape ):
116
+ def getmatrix (m , shape , dtype = np . float64 ):
117
117
r"""
118
118
Convert argument to 2D array
119
119
@@ -159,13 +159,13 @@ def getmatrix(m, shape):
159
159
mshape = m .shape
160
160
161
161
if (shape [0 ] is None or shape [0 ] == mshape [0 ]) and (shape [1 ] is None or shape [1 ] == mshape [1 ]):
162
- return m
162
+ return np . array ( m , dtype = dtype )
163
163
else :
164
164
raise ValueError (f"expecting { shape } but got { mshape } " )
165
165
166
166
elif isvector (m ):
167
167
# passed a 1D array
168
- m = getvector (m )
168
+ m = getvector (m , dtype = dtype )
169
169
if shape [0 ] is not None and shape [1 ] is not None :
170
170
if len (m ) == np .prod (shape ):
171
171
return m .reshape (shape )
You can’t perform that action at this time.
0 commit comments