Terahertz Driven Linear Algebra