linear algebra API implementation