Skip to content

Commit 816bad9

Browse files
author
cflint
committed
try to fix sparse stack tests
1 parent 300fd07 commit 816bad9

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

core/test/sketch/sparse_stack.cpp

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ TYPED_TEST_SUITE(SparseStackCore, gko::test::ValueIndexTypes,
3838

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

4443
EXPECT_EQ(sketch->get_sketch_size(), 7);
@@ -47,7 +46,6 @@ TYPED_TEST(SparseStackCore, ReturnsCorrectSketchSize)
4746

4847
TYPED_TEST(SparseStackCore, ReturnsCorrectInputSize)
4948
{
50-
// Added zeta = 1
5149
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 1, 42);
5250

5351
EXPECT_EQ(sketch->get_input_size(), 20);
@@ -56,7 +54,6 @@ TYPED_TEST(SparseStackCore, ReturnsCorrectInputSize)
5654

5755
TYPED_TEST(SparseStackCore, ReturnsCorrectSeed)
5856
{
59-
// Added zeta = 1
6057
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 1, 123);
6158

6259
EXPECT_EQ(sketch->get_seed(), 123);
@@ -65,7 +62,6 @@ TYPED_TEST(SparseStackCore, ReturnsCorrectSeed)
6562

6663
TYPED_TEST(SparseStackCore, HashMapHasCorrectSize)
6764
{
68-
// zeta = 4
6965
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 4, 42);
7066

7167
EXPECT_EQ(sketch->get_hash_map().get_size(), 80);
@@ -75,7 +71,6 @@ TYPED_TEST(SparseStackCore, HashMapHasCorrectSize)
7571

7672
TYPED_TEST(SparseStackCore, SignsHasCorrectSize)
7773
{
78-
// Added zeta = 4
7974
auto sketch = TestFixture::Sketch::create(this->exec, 7, 20, 4, 42);
8075

8176
EXPECT_EQ(sketch->get_signs().get_size(), 80);
@@ -85,7 +80,7 @@ TYPED_TEST(SparseStackCore, SignsHasCorrectSize)
8580
TYPED_TEST(SparseStackCore, ApplyThrowsOnDimensionMismatch)
8681
{
8782
using Dense = typename TestFixture::Dense;
88-
// Added zeta = 1
83+
8984
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 1, 42);
9085
// b has wrong number of rows (4 instead of 5)
9186
auto b = Dense::create(this->exec, gko::dim<2>{4, 3});
@@ -98,7 +93,7 @@ TYPED_TEST(SparseStackCore, ApplyThrowsOnDimensionMismatch)
9893
TYPED_TEST(SparseStackCore, ApplyThrowsOnOutputDimensionMismatch)
9994
{
10095
using Dense = typename TestFixture::Dense;
101-
// Added zeta = 1
96+
10297
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 1, 42);
10398
auto b = Dense::create(this->exec, gko::dim<2>{5, 3});
10499
// x has wrong number of rows (4 instead of 3)
@@ -111,7 +106,7 @@ TYPED_TEST(SparseStackCore, ApplyThrowsOnOutputDimensionMismatch)
111106
TYPED_TEST(SparseStackCore, ApplyThrowsOnColumnMismatch)
112107
{
113108
using Dense = typename TestFixture::Dense;
114-
// Added zeta = 1
109+
115110
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 1, 42);
116111
auto b = Dense::create(this->exec, gko::dim<2>{5, 3});
117112
// x has wrong number of columns (2 instead of 3)
@@ -124,7 +119,7 @@ TYPED_TEST(SparseStackCore, ApplyThrowsOnColumnMismatch)
124119
TYPED_TEST(SparseStackCore, RapplyThrowsOnDimensionMismatch)
125120
{
126121
using Dense = typename TestFixture::Dense;
127-
// Added zeta = 1
122+
128123
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 1, 42);
129124
// rapply: b must have cols == 5 (input_size), this has 4
130125
auto b = Dense::create(this->exec, gko::dim<2>{4, 4});
@@ -137,8 +132,8 @@ TYPED_TEST(SparseStackCore, RapplyThrowsOnDimensionMismatch)
137132
TYPED_TEST(SparseStackCore, RapplyThrowsOnOutputColumnMismatch)
138133
{
139134
using Dense = typename TestFixture::Dense;
140-
// Added zeta = 1
141-
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 1, 42);
135+
136+
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 4, 42);
142137
auto b = Dense::create(this->exec, gko::dim<2>{4, 5});
143138
// x must have cols == 3 (sketch_size), this has 4
144139
auto x = Dense::create(this->exec, gko::dim<2>{4, 4});
@@ -149,11 +144,13 @@ TYPED_TEST(SparseStackCore, RapplyThrowsOnOutputColumnMismatch)
149144
TYPED_TEST(SparseStackCore, RapplyThrowsOnRowMismatch)
150145
{
151146
using Dense = typename TestFixture::Dense;
152-
// Added zeta = 1
153-
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 1, 42);
147+
148+
// S is 3x5
149+
auto sketch = TestFixture::Sketch::create(this->exec, 3, 5, 4, 42);
150+
// b has 4 rows
154151
auto b = Dense::create(this->exec, gko::dim<2>{4, 5});
155-
// x must have rows == 3 (sketch_size), this has 4
156-
auto x = Dense::create(this->exec, gko::dim<2>{4, 3});
152+
// Error: x has 5 rows instead of 3
153+
auto x = Dense::create(this->exec, gko::dim<2>{5, 3});
157154

158155
ASSERT_THROW(sketch->rapply(b, x), gko::DimensionMismatch);
159156
}

0 commit comments

Comments
 (0)