Skip to content

Commit 1f23ceb

Browse files
and -> xnor
1 parent 4c07621 commit 1f23ceb

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

BMP.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ MatrixXf BMP(MatrixXf A,MatrixXf B)
110110
int i, j, k;
111111

112112
MatrixXf C(I,J);
113-
C.setZero();
113+
// C.setZero();
114114

115115
// cout<<"Ab.rows() = "<<Ab.rows()<<endl;
116116
// cout<<"Ab.cols() = "<<Ab.cols()<<endl;
@@ -137,13 +137,17 @@ MatrixXf BMP(MatrixXf A,MatrixXf B)
137137
for(j=0;j<J;j+=1)
138138
{
139139
ptBj = ptB+j*K;
140-
Cij = ptCi[j];
140+
// Cij = ptCi[j];
141+
Cij = 0.;
141142

142143
for(k=0;k<K;k+=1)
143144
{
144-
Cij += (float)__builtin_popcount(ptAi[k]&ptBj[k]);
145+
// Cij += (float)__builtin_popcount(ptAi[k]&ptBj[k]);
146+
// Cij += (float) 2.* __builtin_popcount(~(ptAi[k]^ptBj[k])) -32.;
147+
Cij += (float)__builtin_popcount(~(ptAi[k]^ptBj[k]));
145148
}
146-
ptCi[j] = Cij;
149+
// ptCi[j] = 2* Cij -32*K + ptCi[j];
150+
ptCi[j] = 2* Cij -32*K;
147151
}
148152
}
149153

BMP_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ using namespace std;
77

88
float float_sign(float x)
99
{
10-
return (x>=0);
10+
// return (x>=0);
11+
return 2. * (x>=0) - 1.;
1112
}
1213

1314
int main(int argc, char* argv[])

0 commit comments

Comments
 (0)