Dot

Added dot function for sparse matrix.
structured_grad is not a global variable.