Skip to content

Commit 8cac6ca

Browse files
author
cflint
committed
correct number of arguments for sparse stack
1 parent 94173a7 commit 8cac6ca

1 file changed

Lines changed: 25 additions & 14 deletions

File tree

core/test/sketch/sparse_stack.cpp

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,34 @@ TYPED_TEST_SUITE(SparseStackCore, gko::test::ValueIndexTypes,
3838

3939
TYPED_TEST(SparseStackCore, ReturnsCorrectSketchSize)
4040
{
41-
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 42);
41+
// Added zeta = 1
42+
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 1, 42);
4243

4344
EXPECT_EQ(sketch->get_sketch_size(), 7);
4445
}
4546

4647

4748
TYPED_TEST(SparseStackCore, ReturnsCorrectInputSize)
4849
{
49-
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 42);
50+
// Added zeta = 1
51+
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 1, 42);
5052

5153
EXPECT_EQ(sketch->get_input_size(), 20);
5254
}
5355

5456

5557
TYPED_TEST(SparseStackCore, ReturnsCorrectSeed)
5658
{
57-
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 123);
59+
// Added zeta = 1
60+
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 1, 123);
5861

5962
EXPECT_EQ(sketch->get_seed(), 123);
6063
}
6164

6265

6366
TYPED_TEST(SparseStackCore, HashMapHasCorrectSize)
6467
{
68+
// zeta = 4
6569
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 4, 42);
6670

6771
EXPECT_EQ(sketch->get_hash_map().get_size(), 80);
@@ -71,16 +75,18 @@ TYPED_TEST(SparseStackCore, HashMapHasCorrectSize)
7175

7276
TYPED_TEST(SparseStackCore, SignsHasCorrectSize)
7377
{
74-
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 42);
78+
// Added zeta = 4
79+
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 4, 42);
7580

76-
EXPECT_EQ(sketch->get_signs().get_size(), 20);
81+
EXPECT_EQ(sketch->get_signs().get_size(), 80);
7782
}
7883

7984

8085
TYPED_TEST(SparseStackCore, ApplyThrowsOnDimensionMismatch)
8186
{
8287
using Dense = typename TestFixture::Dense;
83-
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 42);
88+
// Added zeta = 1
89+
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 1, 42);
8490
// b has wrong number of rows (4 instead of 5)
8591
auto b = Dense::create(this->exec, gko::dim<2>{4, 3});
8692
auto x = Dense::create(this->exec, gko::dim<2>{3, 3});
@@ -92,7 +98,8 @@ TYPED_TEST(SparseStackCore, ApplyThrowsOnDimensionMismatch)
9298
TYPED_TEST(SparseStackCore, ApplyThrowsOnOutputDimensionMismatch)
9399
{
94100
using Dense = typename TestFixture::Dense;
95-
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 42);
101+
// Added zeta = 1
102+
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 1, 42);
96103
auto b = Dense::create(this->exec, gko::dim<2>{5, 3});
97104
// x has wrong number of rows (4 instead of 3)
98105
auto x = Dense::create(this->exec, gko::dim<2>{4, 3});
@@ -104,7 +111,8 @@ TYPED_TEST(SparseStackCore, ApplyThrowsOnOutputDimensionMismatch)
104111
TYPED_TEST(SparseStackCore, ApplyThrowsOnColumnMismatch)
105112
{
106113
using Dense = typename TestFixture::Dense;
107-
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 42);
114+
// Added zeta = 1
115+
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 1, 42);
108116
auto b = Dense::create(this->exec, gko::dim<2>{5, 3});
109117
// x has wrong number of columns (2 instead of 3)
110118
auto x = Dense::create(this->exec, gko::dim<2>{3, 2});
@@ -116,7 +124,8 @@ TYPED_TEST(SparseStackCore, ApplyThrowsOnColumnMismatch)
116124
TYPED_TEST(SparseStackCore, RapplyThrowsOnDimensionMismatch)
117125
{
118126
using Dense = typename TestFixture::Dense;
119-
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 42);
127+
// Added zeta = 1
128+
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 1, 42);
120129
// rapply: b must have cols == 5 (input_size), this has 4
121130
auto b = Dense::create(this->exec, gko::dim<2>{4, 4});
122131
auto x = Dense::create(this->exec, gko::dim<2>{4, 3});
@@ -128,25 +137,27 @@ TYPED_TEST(SparseStackCore, RapplyThrowsOnDimensionMismatch)
128137
TYPED_TEST(SparseStackCore, RapplyThrowsOnOutputColumnMismatch)
129138
{
130139
using Dense = typename TestFixture::Dense;
131-
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 42);
140+
// Added zeta = 1
141+
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 1, 42);
132142
auto b = Dense::create(this->exec, gko::dim<2>{4, 5});
133143
// x must have cols == 3 (sketch_size), this has 4
134144
auto x = Dense::create(this->exec, gko::dim<2>{4, 4});
135145

136146
ASSERT_THROW(sketch->rapply(b, x), gko::DimensionMismatch);
137147
}
138148

139-
140149
TYPED_TEST(SparseStackCore, RapplyThrowsOnRowMismatch)
141150
{
142151
using Dense = typename TestFixture::Dense;
143-
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 42);
152+
// Added zeta = 1
153+
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 1, 42);
144154
auto b = Dense::create(this->exec, gko::dim<2>{4, 5});
145-
// x must have rows == b->rows (4), this has 3
146-
auto x = Dense::create(this->exec, gko::dim<2>{3, 3});
155+
// x must have rows == 3 (sketch_size), this has 4
156+
auto x = Dense::create(this->exec, gko::dim<2>{4, 3});
147157

148158
ASSERT_THROW(sketch->rapply(b, x), gko::DimensionMismatch);
149159
}
150160

151161

152162
} // namespace
163+

0 commit comments

Comments
 (0)