added transpose
fixed integral for non alligned input