port dl4j matrix calculations to new nd4j arch