Algebraic treatment of compactification on noncommutative tori