Commit 66af7c17 authored by phsf18's avatar phsf18
Browse files

Delete backup

parent ab55c7e7
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "../includes/io.h"
#include "../includes/data.h"
#include "../includes/fat_lu.h"
void interpolacao(matrizBase_t *M)
{
sl_t * SL = alocaSL(M->n);
for(int j = 0; j < SL->n; j++)
{
for(int i = 0; i < SL->n; i++)
{
if(i != 0)
SL->A[j][i] = pow(M->X[j], i);
else
SL->A[j][i] = 1;
}
}
for(int k = 0; k < SL->n; k++)
{
SL->b[k] = M->A[0][k];
}
real_t **L = alocaMatriz(SL->n, SL->n);
troca_t trocas[SL->n];
int trocasTam = 0;
double tTriang = 0;
double tY = 0;
double tX = 0;
real_t *x = malloc(SL->n*sizeof(real_t));
real_t *y = malloc(SL->n*sizeof(real_t));
real_t *bi = malloc(SL->n*sizeof(real_t));
real_t **buceta = alocaMatriz(SL->n, SL->n);
copyMatriz(buceta, SL->A, SL->n);
printf("Xi\n");
printVetor(M->X, M->n);
printf("\n");
printf("SL->A\n");
printMatriz(SL->A, SL->n, SL->n);
printf("\n");
eliminacaoGauss(SL->A, L, SL->n, trocas, &trocasTam, &tTriang);
printf("SL->A escalonado\n");
printMatriz(SL->A, SL->n, SL->n);
printf("\n");
printf("L\n");
printMatriz(L, SL->n, SL->n);
printf("\n");
printf("SL->B\n");
printVetor(SL->b, SL->n);
printf("\n");
for(int i = 0; i < SL->n; i++)
{
bi[i] = SL->b[i];
}
for(int i = 0; i < trocasTam; i++)
{
trocaItens(bi,SL->n, trocas[i].idx1, trocas[i].idx2);
}
retroSub(L, y, bi, SL->n, 0, &tY);
retroSub(SL->A, x, y, SL->n, 1, &tX);
printf("sol\n");
printVetor(x, SL->n);
printf("\n");
printf("%.9g\n", normaL2Residuo(buceta, x, bi, SL->n));
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment