Changeset b9d5f5e in mmcs for mainwindow.C
- Timestamp:
- Nov 4, 2016, 8:31:15 AM (8 years ago)
- Branches:
- master
- Children:
- f6d90ed
- Parents:
- 37012be
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mainwindow.C
r37012be rb9d5f5e 6118 6118 list.append(formdescomposicion->ui->listSeleccionado->item(i)->text()); 6119 6119 } 6120 if(validarDescomposicion(list))6121 {6122 QTableWidget *tw = findChild<QTableWidget *>("MatrizAn");6123 int filas = tw->rowCount();6124 Eigen::MatrixXd M1 = extractSubMatriz(tw,list.at(0),list.at(0),An);6125 Eigen::MatrixXd M2 = extractSubMatriz(tw,list.at(1),list.at(1),An);6126 QVector<double> V1 = extractDiagonal(M1);6127 QVector<double> V2 = extractDiagonal(M2);6128 QVector<double> diagonal;6129 appendElements(V1,diagonal);6130 appendElements(V2,diagonal);6131 for (int i = 2; i<filas;i++)6132 { 6133 for(int j=2; j<filas;j++)6120 QTableWidget *tw = findChild<QTableWidget *>("MatrizAn"); 6121 int filas = tw->rowCount(); 6122 Eigen::MatrixXd M1 = extractSubMatriz(tw,list.at(0),list.at(0),An); 6123 Eigen::MatrixXd M2 = extractSubMatriz(tw,list.at(1),list.at(1),An); 6124 QVector<double> V1 = extractDiagonal(M1); 6125 QVector<double> V2 = extractDiagonal(M2); 6126 QVector<double> diagonal; 6127 appendElements(V1,diagonal); 6128 appendElements(V2,diagonal); 6129 for (int i = 2; i<filas;i++) 6130 { 6131 for(int j=2; j<filas;j++) 6132 { 6133 if(tw->item(0,j)->text()!=list.at(0) and tw->item(0,j)->text()!=list.at(1)) 6134 6134 { 6135 if( tw->item(0,j)->text()!=list.at(0) and tw->item(0,j)->text()!=list.at(1))6135 if(i==j) 6136 6136 { 6137 if(i==j) 6138 { 6139 diagonal.append(An(i-2,j-2)); 6140 } 6137 diagonal.append(An(i-2,j-2)); 6141 6138 } 6142 6139 } 6143 6140 } 6144 calcularA0(diagonal); 6145 calcularAuxiliares(); 6146 calcularMatricesDescomposicion(); 6147 } 6148 else 6149 { 6150 QMessageBox::warning(this,"Error","La cuenta Producto y Actividad\ndeben ser simétricas, ajuste la matriz\ne intente de nuevo"); 6151 } 6141 } 6142 calcularA0(diagonal); 6143 calcularAuxiliares(); 6144 calcularMatricesDescomposicion(); 6152 6145 } 6153 6146 else … … 6156 6149 } 6157 6150 6158 }6159 6160 /**6161 @brief Función para validar que las cuentas producto y actividad sean simétricas6162 @date 28/09/20156163 @author Rodrigo Boet6164 @param <cuentas> Recibe la lista con las cuentas6165 @return <valores> Retorna verdadera si son simétricas, falso en caso contrario6166 */6167 bool MainWindow::validarDescomposicion(QStringList cuentas)6168 {6169 QStringList valores;6170 foreach (int key, diccCuentasEndogenas.keys()) {6171 if (diccCuentasEndogenas[key][0]==cuentas.at(0) or diccCuentasEndogenas[key][0]==cuentas.at(1))6172 {6173 valores.append(diccCuentasEndogenas[key][1]);6174 }6175 }6176 if(valores.at(0)==valores.at(1))6177 {6178 return true;6179 }6180 else6181 {6182 return false;6183 }6184 6151 } 6185 6152 … … 6254 6221 int cantidad = diccCuentasEndogenas.count()-2; 6255 6222 MatrixXd ant = aux; 6223 MatrixXd A1 = aux; 6256 6224 for(int i=0;i<cantidad;i++) 6257 6225 { 6258 aux *= ant;6226 aux = ant*A1; 6259 6227 ant = aux; 6260 6228 if(i<cantidad-1)
Note: See TracChangeset
for help on using the changeset viewer.