diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:12:17 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:12:17 +0200 |
commit | f1ab2f022fdc780aca0944d90e9a0e844a0820d7 (patch) | |
tree | 79942a40514f5ab40c5901349c9fcd30c6c8dc0e /admin/survey/excel/PHPExcel/Shared/JAMA/examples/tile.php | |
parent | 2024-02-19 upstream (diff) | |
download | 1ka-master.tar 1ka-master.tar.gz 1ka-master.tar.bz2 1ka-master.tar.lz 1ka-master.tar.xz 1ka-master.tar.zst 1ka-master.zip |
Diffstat (limited to 'admin/survey/excel/PHPExcel/Shared/JAMA/examples/tile.php')
-rw-r--r-- | admin/survey/excel/PHPExcel/Shared/JAMA/examples/tile.php | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/admin/survey/excel/PHPExcel/Shared/JAMA/examples/tile.php b/admin/survey/excel/PHPExcel/Shared/JAMA/examples/tile.php deleted file mode 100644 index b5c48e1..0000000 --- a/admin/survey/excel/PHPExcel/Shared/JAMA/examples/tile.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php
-
-include "../Matrix.php";
-
-/**
-* Tiling of matrix X in [rowWise by colWise] dimension. Tiling
-* creates a larger matrix than the original data X. Example, if
-* X is to be tiled in a [3 x 4] manner, then:
-*
-* / \
-* | X X X X |
-* C = | X X X X |
-* | X X X X |
-* \ /
-*
-* @param X Matrix
-* @param rowWise int
-* @param colWise int
-* @return Matrix
-*/
-
-function tile(&$X, $rowWise, $colWise){
-
- $xArray = $X->getArray();
- print_r($xArray);
-
- $countRow = 0;
- $countColumn = 0;
-
- $m = $X->getRowDimension();
- $n = $X->getColumnDimension();
-
- if( $rowWise<1 || $colWise<1 ){
- die("tile : Array index is out-of-bound.");
- }
-
- $newRowDim = $m*$rowWise;
- $newColDim = $n*$colWise;
-
- $result = array();
-
- for($i=0 ; $i<$newRowDim; ++$i) {
-
- $holder = array();
-
- for($j=0 ; $j<$newColDim ; ++$j) {
-
- $holder[$j] = $xArray[$countRow][$countColumn++];
-
- // reset the column-index to zero to avoid reference to out-of-bound index in xArray[][]
-
- if($countColumn == $n) { $countColumn = 0; }
-
- } // end for
-
- ++$countRow;
-
- // reset the row-index to zero to avoid reference to out-of-bound index in xArray[][]
-
- if($countRow == $m) { $countRow = 0; }
-
- $result[$i] = $holder;
-
- } // end for
-
- return new Matrix($result);
-
-}
-
-
-$X =array(1,2,3,4,5,6,7,8,9);
-$nRow = 3;
-$nCol = 3;
-$tiled_matrix = tile(new Matrix($X), $nRow, $nCol);
-echo "<pre>";
-print_r($tiled_matrix);
-echo "</pre>";
-?>
|