ai lib and matrix tests