Modeling Digital Switching Circuits with Linear Algebra