Hello Alexei, while compiling an application with MSVC, I stumbled on this (because the code crashed) File: mul.cpp Function: ex mul::algebraic_subs_mul(const exmap & m, unsigned options) These two vectors are sized to seq.size(): std::vector<bool> subsed(seq.size(), false); std::vector<bool> currsubsed(seq.size(), false); They are then used in: algebraic_match_mul_with_mul() This iterates over the nops() of the mul: for (size_t i=0; i<e.nops(); ++i) { Can it be that the nops() of the mul is (always) equal to seq.size() + 1? Output of one example: ----- Code inserted in mul::algebraic_subs_mul(): std::cout << "mul::algebraic_subs_mul: nops: " << this->nops() << ", seq.size(): " << seq.size() << std::endl; std::cout << "mul::algebraic_subs_mul: " << tree << *this << dflt << std::endl; ------------ Output: mul::algebraic_subs_mul: nops: 2, seq.size(): 1 mul::algebraic_subs_mul: mul @00769848, hash=0x769820, flags=0x3, nops=2 mm 1 (numeric) @00753360, hash=0x160af41d, flags=0xf ----- overall_coeff 1/10 (numeric) @00769828, hash=0x36fbefb6, flags=0xf ===== ------------- Because the code crashes on the last iteration of the for loop, and if I size the vectors to seq.size()+1 (or maybe better nops()) it does not crash any more. Another possibility is that there is another error earlier on which results in a mul with seq.size() = 1 and nops() = 2 (for my example). Regards, Jan
Hello Jan,
Can it be that the nops() of the mul is (always) equal to seq.size() + 1?
nops() for a mul object is always seq.size() + 1
These two vectors are sized to seq.size(): std::vector<bool> subsed(seq.size(), false); std::vector<bool> currsubsed(seq.size(), false);
They are then used in: algebraic_match_mul_with_mul()
This iterates over the nops() of the mul: for (size_t i=0; i<e.nops(); ++i) {
In theory it's a bug. Those subsed and currsubsed arrays should contain nops() elements instead of seq.size(). I'll post a fix soon. Best regards, Alexei
participants (2)
-
Alexei Sheplyakov
-
Jan private