File tree Expand file tree Collapse file tree 3 files changed +33
-9
lines changed Expand file tree Collapse file tree 3 files changed +33
-9
lines changed Original file line number Diff line number Diff line change @@ -34,14 +34,13 @@ static void helib_fft_forward(benchmark::State& state, Meta& meta)
3434 long q = prime_generator.next ();
3535 helib::Cmodulus cmod (zms, q, 0 );
3636
37- NTL::ZZX poly;
38- poly.SetLength (N);
39- for (long i = 0 ; i < N; ++i)
40- poly[i] = i;
37+ NTL::zz_pX poly (N, 1 );
4138
42- NTL::vec_long transformed;
43- for (auto _ : state)
39+ NTL::vec_long transformed (NTL::INIT_SIZE, N);
40+
41+ for (auto _ : state) {
4442 cmod.FFT (transformed, poly);
43+ }
4544}
4645
4746static void helib_fft_inverse (benchmark::State& state, Meta& meta)
Original file line number Diff line number Diff line change 99 * See the License for the specific language governing permissions and
1010 * limitations under the License. See accompanying LICENSE file.
1111 */
12+
13+ /* Intel HEXL integration.
14+ * Copyright (C) 2021 Intel Corporation
15+ * Licensed under the Apache License, Version 2.0 (the "License");
16+ * you may not use this file except in compliance with the License.
17+ * You may obtain a copy of the License at
18+ * http://www.apache.org/licenses/LICENSE-2.0
19+ * Unless required by applicable law or agreed to in writing, software
20+ * distributed under the License is distributed on an "AS IS" BASIS,
21+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22+ * See the License for the specific language governing permissions and
23+ * limitations under the License.
24+ */
25+
1226#ifndef HELIB_CMODULUS_H
1327#define HELIB_CMODULUS_H
1428/* *
@@ -123,6 +137,9 @@ class Cmodulus
123137 void FFT (NTL::vec_long& y, const NTL::ZZX& x) const ;
124138 // y = FFT(x)
125139 void FFT (NTL::vec_long& y, const zzX& x) const ;
140+ // y = FFT(x)
141+ void FFT (NTL::vec_long& y, NTL::zz_pX& x) const ;
142+
126143
127144 // expects zp context to be set externally
128145 // x = FFT^{-1}(y)
Original file line number Diff line number Diff line change @@ -370,7 +370,7 @@ void Cmodulus::FFT_aux(NTL::vec_long& y, NTL::zz_pX& tmp) const
370370 y.SetLength (phim);
371371 long * yp = y.elts ();
372372
373- NTL::zz_p* tmp_p = tmp.rep .elts ();
373+ const NTL::zz_p* tmp_p = tmp.rep .elts ();
374374
375375#ifdef USE_INTEL_HEXL
376376
@@ -456,7 +456,7 @@ void Cmodulus::FFT(NTL::vec_long& y, const NTL::ZZX& x) const
456456 convert (tmp, x); // convert input to zpx format
457457 }
458458
459- FFT_aux (y, tmp);
459+ FFT (y, tmp);
460460}
461461
462462void Cmodulus::FFT (NTL::vec_long& y, const zzX& x) const
@@ -471,8 +471,16 @@ void Cmodulus::FFT(NTL::vec_long& y, const zzX& x) const
471471 HELIB_NTIMER_START (FFT_remainder);
472472 convert (tmp, x); // convert input to zpx format
473473 }
474+ FFT (y, tmp);
475+ }
474476
475- FFT_aux (y, tmp);
477+ void Cmodulus::FFT (NTL::vec_long& y, NTL::zz_pX& x) const
478+ {
479+ HELIB_TIMER_START;
480+ NTL::zz_pBak bak;
481+ bak.save ();
482+ context.restore ();
483+ FFT_aux (y, x);
476484}
477485
478486void Cmodulus::iFFT (NTL::zz_pX& x, const NTL::vec_long& y) const
You can’t perform that action at this time.
0 commit comments