3 include
"../Matrix.php";
22 function tile(&
$X, $rowWise, $colWise){
24 $xArray =
$X->getArray();
30 $m =
$X->getRowDimension();
31 $n =
$X->getColumnDimension();
33 if( $rowWise<1 || $colWise<1 ){
34 die(
"tile : Array index is out-of-bound.");
37 $newRowDim = $m*$rowWise;
38 $newColDim = $n*$colWise;
42 for($i=0 ; $i<$newRowDim; ++$i) {
46 for($j=0 ; $j<$newColDim ; ++$j) {
48 $holder[$j] = $xArray[$countRow][$countColumn++];
52 if($countColumn == $n) { $countColumn = 0; }
60 if($countRow == $m) { $countRow = 0; }
62 $result[$i] = $holder;
66 return new Matrix($result);
71 $X =array(1,2,3,4,5,6,7,8,9);