Improved select component and matrix.select operation. Modified dot_product for sparse inputs, using select operation