Skip to content

Commit fba60a0

Browse files
committed
合成数の入力が正常に行われない不具合を修正
1 parent 7cd62f1 commit fba60a0

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

lat_fact.dll

1.5 KB
Binary file not shown.

lat_fact.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def lat_fact(N: int, input_bit: int = 1, print_info: int = 1) -> list:
2323
os.add_dll_directory(os.getcwd())
2424
LatFact = ctypes.cdll.LoadLibrary('lat_fact.dll')
2525
LatFact.lattice_factorization.restype = ctypes.POINTER(ctypes.c_longlong)
26-
LatFact.lattice_factorization.argtypes = ctypes.c_int, ctypes.c_double, ctypes.c_int
26+
LatFact.lattice_factorization.argtypes = ctypes.c_int, ctypes.c_char_p, ctypes.c_int
2727

28-
a = LatFact.lattice_factorization(input_bit, N, print_info)
28+
a = LatFact.lattice_factorization(input_bit, str(N).encode('utf-8'), print_info)
2929
return int(a[0]), int(a[1])

libfact.so

6.62 KB
Binary file not shown.

src/lat_fact.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ bool sr_test(const NTL::ZZ u, const NTL::ZZ v, const NTL::ZZ N, const std::vecto
510510
return false;
511511
}
512512

513-
extern "C" ll *lattice_factorization(const int bit_flag, const double NN, const int info_flag){
513+
extern "C" ll *lattice_factorization(const int bit_flag, const char* NN, const int info_flag){
514514
NTL::RR::SetPrecision(60);
515515

516516
bool new_pair = false;
@@ -524,7 +524,7 @@ extern "C" ll *lattice_factorization(const int bit_flag, const double NN, const
524524
std::vector<std::vector<double>> mu;
525525
std::vector<std::vector<ll>> L, close_vecs;
526526
NTL::mat_ZZ LL;
527-
527+
std::cout << NN << std::endl;
528528
if(bit_flag) GenSemiPrime(N);
529529
//if(argc >= 4){n = atoi(argv[3]); if(argc >= 5) c = atof(argv[4]); }else
530530
n = 2.2 * NTL::NumBits(N) / log(NTL::NumBits(N)) - 8;

src/lat_fact.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ std::vector<std::vector<ll>> ENUM_CVP_all(const std::vector<std::vector<double>>
4444
std::tuple<std::vector<std::vector<ll>>, NTL::mat_ZZ> imp_prime_mat(const double c, const std::vector<long> p, const long n);
4545
std::vector<ll> target(const NTL::ZZ N, const double c, const long n);
4646
bool sr_test(const NTL::ZZ u, const NTL::ZZ v, const NTL::ZZ N, const std::vector<long> p, const long n);
47-
extern "C" ll *lattice_factorization(const int bit_flag, const double NN, const int info_flag);
47+
extern "C" ll *lattice_factorization(const int bit_flag, const char* NN, const int info_flag);
4848

4949
#endif // !LAT_FACT

0 commit comments

Comments
 (0)