javascript linear algrebra functions