If you need to have a loop iterated as many times as there are 1-bits in an integer v it is better to write for (;v;v &= v-1) than for (i = popcnt(v); i>0; i--) because the former has O(popcnt(v)) compexity against the latter's O(width(v)).
Wednesday, January 26, 2011
Saturday, January 15, 2011
a submatrix problem
This problem is said to be proposed by Knuth: given an m*n (m<n) maxtix A of rank m find its m*m submatrix B such that all elements of of B^{-1}A have absolute value at most one.
Source: Local Search in Combinatorial Optimization E. Aarts, K. Lenstra, chapter 2
Source: Local Search in Combinatorial Optimization E. Aarts, K. Lenstra, chapter 2
Subscribe to:
Posts (Atom)