Skip to content

Commit f6cb2a9

Browse files
committed
add benchmarks
1 parent 6a1a23b commit f6cb2a9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

benchmarks/benchmarks/bench_shape_base.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,19 @@ def time_scalar_kron(self):
152152

153153
def time_mat_kron(self):
154154
np.kron(self.large_mat, self.large_mat)
155+
156+
class AtLeast1D(Benchmark):
157+
"""Benchmarks for np.atleast_1d"""
158+
159+
def setup(self):
160+
self.x = np.array([1, 2, 3])
161+
self.zero_d = np.float64(1.)
162+
163+
def time_atleast_1d(self):
164+
np.atleast_1d(self.x, self.x, self.x)
165+
166+
def time_atleast_1d_reshape(self):
167+
np.atleast_1d(self.zero_d, self.zero_d, self.zero_d)
168+
169+
def time_atleast_1d_single_argument(self):
170+
np.atleast_1d(self.x)

0 commit comments

Comments
 (0)