4 ms·
What other library tells you about complexity? And as you tell, if you don't know algorithns well, I'm pretty sure your implementations won't have better comple
by enedil 9y ago
What other library tells you about complexity? And as you tell, if you don't know algorithns well, I'm pretty sure your implementations won't have better complexity.
- hermitdev 9y agoC++'s standard library containers & algorithms have strict algorithmic complexity requirements & guarantees. For example from std::vector::insert [1]: Complexity 1-2) Constant plus linear in the distance between pos and end of the container. 3) Linear in count plus linear in the distance between pos and end of the container. 4) Linear in std::distance(first, last) plus linear in the distance between pos and end of the container. 5) Linear in ilist.size() plus linear in the distance between pos and end of the container. [1][http://en.cppreference.com/w/cpp/container/vector/insert http://en.cppreference.com/w/cpp/container/vector/insert] edit: formatting
- cjbillington 9y agoWell, often there are multiple ways of using numpy operations to do what you want, so it's good to have an idea of what numpy is doing under the hood so you can use the right functionality for the job at hand. For example, np.einsum for all its greatness in the past wasn't faster than np.tensordot, but it was more flexible. One can tell einsum to try and use the same underlying BLAS functions that tensordot uses (which can parallelise the computation) if applicable, and it will likely be default for einsum to perform this optimisation automatically once the devs iron out some bugs. But for now, it pays to know how the two methods are different.