  We present an algorithm for measurement of $k$-local operators in a quantum
state, which scales logarithmically both in the system size and the output
accuracy. The key ingredients of the algorithm are a digital representation of
the quantum state, and a decomposition of the measurement operator in a basis
of operators with known discrete spectra. We then show how this algorithm can
be combined with (a) Hamiltonian evolution to make quantum simulations
efficient, (b) the Newton-Raphson method based solution of matrix inverse to
efficiently solve linear simultaneous equations, and (c) Chebyshev expansion of
matrix exponentials to efficiently evaluate thermal expectation values. The
general strategy may be useful in solving many other linear algebra problems
efficiently.
