minimal log system
some use log system
add template types for matrix
some changes