Overview

Packages

  • JAMA
  • None
  • PHP
  • PHPExcel
    • CachedObjectStorage
    • Calculation
    • Cell
    • Chart
      • Renderer
    • Reader
      • Excel2007
      • Excel5
    • RichText
    • Settings
    • Shared
      • Escher
      • OLE
      • Trend
      • ZipArchive
    • Style
    • Worksheet
      • Drawing
    • Writer
      • 2007
      • CSV
      • Excel2007
      • Excel5
      • HTML
      • PDF

Classes

  • CholeskyDecomposition
  • Dao
  • DateTime
  • DateTimeZone
  • DOMNode
  • EigenvalueDecomposition
  • Elemento
  • Historial
  • Irradiacion
  • Latitud
  • MotorPhp
  • Panel
  • PclZip
  • Periodo
  • PHPExcel
  • PHPExcel_Autoloader
  • PHPExcel_Best_Fit
  • PHPExcel_CachedObjectStorage_APC
  • PHPExcel_CachedObjectStorage_CacheBase
  • PHPExcel_CachedObjectStorage_DiscISAM
  • PHPExcel_CachedObjectStorage_Igbinary
  • PHPExcel_CachedObjectStorage_Memcache
  • PHPExcel_CachedObjectStorage_Memory
  • PHPExcel_CachedObjectStorage_MemoryGZip
  • PHPExcel_CachedObjectStorage_MemorySerialized
  • PHPExcel_CachedObjectStorage_PHPTemp
  • PHPExcel_CachedObjectStorage_SQLite
  • PHPExcel_CachedObjectStorage_SQLite3
  • PHPExcel_CachedObjectStorage_Wincache
  • PHPExcel_CachedObjectStorageFactory
  • PHPExcel_CalcEngine_CyclicReferenceStack
  • PHPExcel_CalcEngine_Logger
  • PHPExcel_Calculation
  • PHPExcel_Calculation_Database
  • PHPExcel_Calculation_DateTime
  • PHPExcel_Calculation_Engineering
  • PHPExcel_Calculation_ExceptionHandler
  • PHPExcel_Calculation_Financial
  • PHPExcel_Calculation_FormulaParser
  • PHPExcel_Calculation_FormulaToken
  • PHPExcel_Calculation_Function
  • PHPExcel_Calculation_Functions
  • PHPExcel_Calculation_Logical
  • PHPExcel_Calculation_LookupRef
  • PHPExcel_Calculation_MathTrig
  • PHPExcel_Calculation_Statistical
  • PHPExcel_Calculation_TextData
  • PHPExcel_Calculation_Token_Stack
  • PHPExcel_Cell
  • PHPExcel_Cell_AdvancedValueBinder
  • PHPExcel_Cell_DataType
  • PHPExcel_Cell_DataValidation
  • PHPExcel_Cell_DefaultValueBinder
  • PHPExcel_Cell_Hyperlink
  • PHPExcel_Chart
  • PHPExcel_Chart_DataSeries
  • PHPExcel_Chart_DataSeriesValues
  • PHPExcel_Chart_Layout
  • PHPExcel_Chart_Legend
  • PHPExcel_Chart_PlotArea
  • PHPExcel_Chart_Renderer_jpgraph
  • PHPExcel_Chart_Title
  • PHPExcel_Comment
  • PHPExcel_DocumentProperties
  • PHPExcel_DocumentSecurity
  • PHPExcel_Exponential_Best_Fit
  • PHPExcel_HashTable
  • PHPExcel_IOFactory
  • PHPExcel_Linear_Best_Fit
  • PHPExcel_Logarithmic_Best_Fit
  • PHPExcel_NamedRange
  • PHPExcel_Polynomial_Best_Fit
  • PHPExcel_Power_Best_Fit
  • PHPExcel_Reader_Abstract
  • PHPExcel_Reader_CSV
  • PHPExcel_Reader_DefaultReadFilter
  • PHPExcel_Reader_Excel2003XML
  • PHPExcel_Reader_Excel2007
  • PHPExcel_Reader_Excel2007_Chart
  • PHPExcel_Reader_Excel2007_Theme
  • PHPExcel_Reader_Excel5
  • PHPExcel_Reader_Excel5_Escher
  • PHPExcel_Reader_Excel5_MD5
  • PHPExcel_Reader_Excel5_RC4
  • PHPExcel_Reader_Gnumeric
  • PHPExcel_Reader_HTML
  • PHPExcel_Reader_OOCalc
  • PHPExcel_Reader_SYLK
  • PHPExcel_ReferenceHelper
  • PHPExcel_RichText
  • PHPExcel_RichText_Run
  • PHPExcel_RichText_TextElement
  • PHPExcel_Settings
  • PHPExcel_Shared_CodePage
  • PHPExcel_Shared_Date
  • PHPExcel_Shared_Drawing
  • PHPExcel_Shared_Escher
  • PHPExcel_Shared_Escher_DgContainer
  • PHPExcel_Shared_Escher_DgContainer_SpgrContainer
  • PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
  • PHPExcel_Shared_Escher_DggContainer
  • PHPExcel_Shared_Escher_DggContainer_BstoreContainer
  • PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
  • PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
  • PHPExcel_Shared_Excel5
  • PHPExcel_Shared_File
  • PHPExcel_Shared_Font
  • PHPExcel_Shared_JAMA_LUDecomposition
  • PHPExcel_Shared_JAMA_Matrix
  • PHPExcel_Shared_JAMA_QRDecomposition
  • PHPExcel_Shared_OLE
  • PHPExcel_Shared_OLE_ChainedBlockStream
  • PHPExcel_Shared_OLE_PPS
  • PHPExcel_Shared_OLE_PPS_File
  • PHPExcel_Shared_OLE_PPS_Root
  • PHPExcel_Shared_OLERead
  • PHPExcel_Shared_PasswordHasher
  • PHPExcel_Shared_String
  • PHPExcel_Shared_TimeZone
  • PHPExcel_Shared_XMLWriter
  • PHPExcel_Shared_ZipArchive
  • PHPExcel_Shared_ZipStreamWrapper
  • PHPExcel_Style
  • PHPExcel_Style_Alignment
  • PHPExcel_Style_Border
  • PHPExcel_Style_Borders
  • PHPExcel_Style_Color
  • PHPExcel_Style_Conditional
  • PHPExcel_Style_Fill
  • PHPExcel_Style_Font
  • PHPExcel_Style_NumberFormat
  • PHPExcel_Style_Protection
  • PHPExcel_Style_Supervisor
  • PHPExcel_Worksheet
  • PHPExcel_Worksheet_AutoFilter
  • PHPExcel_Worksheet_AutoFilter_Column
  • PHPExcel_Worksheet_AutoFilter_Column_Rule
  • PHPExcel_Worksheet_BaseDrawing
  • PHPExcel_Worksheet_CellIterator
  • PHPExcel_Worksheet_ColumnDimension
  • PHPExcel_Worksheet_Drawing
  • PHPExcel_Worksheet_Drawing_Shadow
  • PHPExcel_Worksheet_HeaderFooter
  • PHPExcel_Worksheet_HeaderFooterDrawing
  • PHPExcel_Worksheet_MemoryDrawing
  • PHPExcel_Worksheet_PageMargins
  • PHPExcel_Worksheet_PageSetup
  • PHPExcel_Worksheet_Protection
  • PHPExcel_Worksheet_Row
  • PHPExcel_Worksheet_RowDimension
  • PHPExcel_Worksheet_RowIterator
  • PHPExcel_Worksheet_SheetView
  • PHPExcel_WorksheetIterator
  • PHPExcel_Writer_Abstract
  • PHPExcel_Writer_CSV
  • PHPExcel_Writer_Excel2007
  • PHPExcel_Writer_Excel2007_Chart
  • PHPExcel_Writer_Excel2007_Comments
  • PHPExcel_Writer_Excel2007_ContentTypes
  • PHPExcel_Writer_Excel2007_DocProps
  • PHPExcel_Writer_Excel2007_Drawing
  • PHPExcel_Writer_Excel2007_Rels
  • PHPExcel_Writer_Excel2007_RelsRibbon
  • PHPExcel_Writer_Excel2007_RelsVBA
  • PHPExcel_Writer_Excel2007_StringTable
  • PHPExcel_Writer_Excel2007_Style
  • PHPExcel_Writer_Excel2007_Theme
  • PHPExcel_Writer_Excel2007_Workbook
  • PHPExcel_Writer_Excel2007_Worksheet
  • PHPExcel_Writer_Excel2007_WriterPart
  • PHPExcel_Writer_Excel5
  • PHPExcel_Writer_Excel5_BIFFwriter
  • PHPExcel_Writer_Excel5_Escher
  • PHPExcel_Writer_Excel5_Font
  • PHPExcel_Writer_Excel5_Parser
  • PHPExcel_Writer_Excel5_Workbook
  • PHPExcel_Writer_Excel5_Worksheet
  • PHPExcel_Writer_Excel5_Xf
  • PHPExcel_Writer_HTML
  • PHPExcel_Writer_PDF
  • PHPExcel_Writer_PDF_Core
  • PHPExcel_Writer_PDF_DomPDF
  • PHPExcel_Writer_PDF_mPDF
  • PHPExcel_Writer_PDF_tcPDF
  • Provincia
  • Radiacion
  • SingularValueDecomposition
  • Sistema
  • trendClass
  • xajax
  • xajaxArgumentManager
  • xajaxCallableObject
  • xajaxCallableObjectPlugin
  • xajaxControl
  • xajaxControlContainer
  • xajaxCustomRequest
  • xajaxCustomResponse
  • xajaxEvent
  • xajaxEventPlugin
  • xajaxFunctionPlugin
  • xajaxIncludeClientScriptPlugin
  • xajaxLanguageManager
  • xajaxPlugin
  • xajaxPluginManager
  • xajaxRequest
  • xajaxRequestPlugin
  • xajaxResponse
  • xajaxResponseManager
  • xajaxResponsePlugin
  • xajaxScriptPlugin
  • xajaxUserFunction
  • XMLWriter

Interfaces

  • DateTimeInterface
  • Iterator
  • PHPExcel_CachedObjectStorage_ICache
  • PHPExcel_Cell_IValueBinder
  • PHPExcel_IComparable
  • PHPExcel_Reader_IReader
  • PHPExcel_Reader_IReadFilter
  • PHPExcel_RichText_ITextElement
  • PHPExcel_Writer_IWriter
  • Throwable
  • Traversable

Exceptions

  • Exception
  • PHPExcel_Calculation_Exception
  • PHPExcel_Chart_Exception
  • PHPExcel_Exception
  • PHPExcel_Reader_Exception
  • PHPExcel_Writer_Exception

Functions

  • acosh
  • agregar_elemento
  • asinh
  • atanh
  • borrar_elementos
  • borrar_gdm_ab
  • borrar_irradiacion
  • borrar_latitud
  • borrar_panel
  • borrar_periodo
  • borrar_pmp_min_pmp_max
  • borrar_radiacion
  • borrar_resumen
  • borrar_sistema
  • borrar_sombra
  • gdm_ab
  • grabar_resumen
  • historial
  • hypo
  • irradiacion
  • JAMAError
  • latitud
  • limpiar_historial
  • login
  • mb_str_replace
  • mostrar_energia_total_ch
  • mostrar_panel_md_th
  • mostrar_panel_th
  • mostrar_radiacion_md_th
  • mostrar_radiacion_th
  • mostrar_resumen_th
  • panel
  • PclZipUtilCopyBlock
  • PclZipUtilOptionText
  • PclZipUtilPathInclusion
  • PclZipUtilPathReduction
  • PclZipUtilRename
  • PclZipUtilTranslateWinPath
  • periodo
  • pmp_min_pmp_max
  • preparar_panel
  • preparar_radiacion
  • preparar_radiacion_media
  • radiacion
  • resumen
  • sistema
  • sombra
  • xajaxCompressFile
  • xajaxErrorHandler
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
  1: <?php
  2: /**
  3:  *  @package JAMA
  4:  *
  5:  *  For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n
  6:  *  unit lower triangular matrix L, an n-by-n upper triangular matrix U,
  7:  *  and a permutation vector piv of length m so that A(piv,:) = L*U.
  8:  *  If m < n, then L is m-by-m and U is m-by-n.
  9:  *
 10:  *  The LU decompostion with pivoting always exists, even if the matrix is
 11:  *  singular, so the constructor will never fail. The primary use of the
 12:  *  LU decomposition is in the solution of square systems of simultaneous
 13:  *  linear equations. This will fail if isNonsingular() returns false.
 14:  *
 15:  *  @author Paul Meagher
 16:  *  @author Bartosz Matosiuk
 17:  *  @author Michael Bommarito
 18:  *  @version 1.1
 19:  *  @license PHP v3.0
 20:  */
 21: class PHPExcel_Shared_JAMA_LUDecomposition {
 22: 
 23:     const MatrixSingularException   = "Can only perform operation on singular matrix.";
 24:     const MatrixSquareException     = "Mismatched Row dimension";
 25: 
 26:     /**
 27:      *  Decomposition storage
 28:      *  @var array
 29:      */
 30:     private $LU = array();
 31: 
 32:     /**
 33:      *  Row dimension.
 34:      *  @var int
 35:      */
 36:     private $m;
 37: 
 38:     /**
 39:      *  Column dimension.
 40:      *  @var int
 41:      */
 42:     private $n;
 43: 
 44:     /**
 45:      *  Pivot sign.
 46:      *  @var int
 47:      */
 48:     private $pivsign;
 49: 
 50:     /**
 51:      *  Internal storage of pivot vector.
 52:      *  @var array
 53:      */
 54:     private $piv = array();
 55: 
 56: 
 57:     /**
 58:      *  LU Decomposition constructor.
 59:      *
 60:      *  @param $A Rectangular matrix
 61:      *  @return Structure to access L, U and piv.
 62:      */
 63:     public function __construct($A) {
 64:         if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
 65:             // Use a "left-looking", dot-product, Crout/Doolittle algorithm.
 66:             $this->LU = $A->getArray();
 67:             $this->m  = $A->getRowDimension();
 68:             $this->n  = $A->getColumnDimension();
 69:             for ($i = 0; $i < $this->m; ++$i) {
 70:                 $this->piv[$i] = $i;
 71:             }
 72:             $this->pivsign = 1;
 73:             $LUrowi = $LUcolj = array();
 74: 
 75:             // Outer loop.
 76:             for ($j = 0; $j < $this->n; ++$j) {
 77:                 // Make a copy of the j-th column to localize references.
 78:                 for ($i = 0; $i < $this->m; ++$i) {
 79:                     $LUcolj[$i] = &$this->LU[$i][$j];
 80:                 }
 81:                 // Apply previous transformations.
 82:                 for ($i = 0; $i < $this->m; ++$i) {
 83:                     $LUrowi = $this->LU[$i];
 84:                     // Most of the time is spent in the following dot product.
 85:                     $kmax = min($i,$j);
 86:                     $s = 0.0;
 87:                     for ($k = 0; $k < $kmax; ++$k) {
 88:                         $s += $LUrowi[$k] * $LUcolj[$k];
 89:                     }
 90:                     $LUrowi[$j] = $LUcolj[$i] -= $s;
 91:                 }
 92:                 // Find pivot and exchange if necessary.
 93:                 $p = $j;
 94:                 for ($i = $j+1; $i < $this->m; ++$i) {
 95:                     if (abs($LUcolj[$i]) > abs($LUcolj[$p])) {
 96:                         $p = $i;
 97:                     }
 98:                 }
 99:                 if ($p != $j) {
100:                     for ($k = 0; $k < $this->n; ++$k) {
101:                         $t = $this->LU[$p][$k];
102:                         $this->LU[$p][$k] = $this->LU[$j][$k];
103:                         $this->LU[$j][$k] = $t;
104:                     }
105:                     $k = $this->piv[$p];
106:                     $this->piv[$p] = $this->piv[$j];
107:                     $this->piv[$j] = $k;
108:                     $this->pivsign = $this->pivsign * -1;
109:                 }
110:                 // Compute multipliers.
111:                 if (($j < $this->m) && ($this->LU[$j][$j] != 0.0)) {
112:                     for ($i = $j+1; $i < $this->m; ++$i) {
113:                         $this->LU[$i][$j] /= $this->LU[$j][$j];
114:                     }
115:                 }
116:             }
117:         } else {
118:             throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ArgumentTypeException);
119:         }
120:     }   //  function __construct()
121: 
122: 
123:     /**
124:      *  Get lower triangular factor.
125:      *
126:      *  @return array Lower triangular factor
127:      */
128:     public function getL() {
129:         for ($i = 0; $i < $this->m; ++$i) {
130:             for ($j = 0; $j < $this->n; ++$j) {
131:                 if ($i > $j) {
132:                     $L[$i][$j] = $this->LU[$i][$j];
133:                 } elseif ($i == $j) {
134:                     $L[$i][$j] = 1.0;
135:                 } else {
136:                     $L[$i][$j] = 0.0;
137:                 }
138:             }
139:         }
140:         return new PHPExcel_Shared_JAMA_Matrix($L);
141:     }   //  function getL()
142: 
143: 
144:     /**
145:      *  Get upper triangular factor.
146:      *
147:      *  @return array Upper triangular factor
148:      */
149:     public function getU() {
150:         for ($i = 0; $i < $this->n; ++$i) {
151:             for ($j = 0; $j < $this->n; ++$j) {
152:                 if ($i <= $j) {
153:                     $U[$i][$j] = $this->LU[$i][$j];
154:                 } else {
155:                     $U[$i][$j] = 0.0;
156:                 }
157:             }
158:         }
159:         return new PHPExcel_Shared_JAMA_Matrix($U);
160:     }   //  function getU()
161: 
162: 
163:     /**
164:      *  Return pivot permutation vector.
165:      *
166:      *  @return array Pivot vector
167:      */
168:     public function getPivot() {
169:         return $this->piv;
170:     }   //  function getPivot()
171: 
172: 
173:     /**
174:      *  Alias for getPivot
175:      *
176:      *  @see getPivot
177:      */
178:     public function getDoublePivot() {
179:         return $this->getPivot();
180:     }   //  function getDoublePivot()
181: 
182: 
183:     /**
184:      *  Is the matrix nonsingular?
185:      *
186:      *  @return true if U, and hence A, is nonsingular.
187:      */
188:     public function isNonsingular() {
189:         for ($j = 0; $j < $this->n; ++$j) {
190:             if ($this->LU[$j][$j] == 0) {
191:                 return false;
192:             }
193:         }
194:         return true;
195:     }   //  function isNonsingular()
196: 
197: 
198:     /**
199:      *  Count determinants
200:      *
201:      *  @return array d matrix deterninat
202:      */
203:     public function det() {
204:         if ($this->m == $this->n) {
205:             $d = $this->pivsign;
206:             for ($j = 0; $j < $this->n; ++$j) {
207:                 $d *= $this->LU[$j][$j];
208:             }
209:             return $d;
210:         } else {
211:             throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
212:         }
213:     }   //  function det()
214: 
215: 
216:     /**
217:      *  Solve A*X = B
218:      *
219:      *  @param  $B  A Matrix with as many rows as A and any number of columns.
220:      *  @return  X so that L*U*X = B(piv,:)
221:      *  @PHPExcel_Calculation_Exception  IllegalArgumentException Matrix row dimensions must agree.
222:      *  @PHPExcel_Calculation_Exception  RuntimeException  Matrix is singular.
223:      */
224:     public function solve($B) {
225:         if ($B->getRowDimension() == $this->m) {
226:             if ($this->isNonsingular()) {
227:                 // Copy right hand side with pivoting
228:                 $nx = $B->getColumnDimension();
229:                 $X  = $B->getMatrix($this->piv, 0, $nx-1);
230:                 // Solve L*Y = B(piv,:)
231:                 for ($k = 0; $k < $this->n; ++$k) {
232:                     for ($i = $k+1; $i < $this->n; ++$i) {
233:                         for ($j = 0; $j < $nx; ++$j) {
234:                             $X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k];
235:                         }
236:                     }
237:                 }
238:                 // Solve U*X = Y;
239:                 for ($k = $this->n-1; $k >= 0; --$k) {
240:                     for ($j = 0; $j < $nx; ++$j) {
241:                         $X->A[$k][$j] /= $this->LU[$k][$k];
242:                     }
243:                     for ($i = 0; $i < $k; ++$i) {
244:                         for ($j = 0; $j < $nx; ++$j) {
245:                             $X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k];
246:                         }
247:                     }
248:                 }
249:                 return $X;
250:             } else {
251:                 throw new PHPExcel_Calculation_Exception(self::MatrixSingularException);
252:             }
253:         } else {
254:             throw new PHPExcel_Calculation_Exception(self::MatrixSquareException);
255:         }
256:     }   //  function solve()
257: 
258: }   //  class PHPExcel_Shared_JAMA_LUDecomposition
259: 
Autene API documentation generated by ApiGen