Commit 451b2705 authored by Pedro Flores's avatar Pedro Flores
Browse files

t2 avançado

parent 5fa79e41
CC = gcc
CFLAGS = -g -std=c11 -Wall -O3 -mavx -march=native -DLIKWID_PERFMON -I${LIKWID_INCLUDE}
LFLAGS = -lm -L${LIKWID_LIB} -llikwid
DEBUG = -DDEBUG
INC = ./includes
SRC = ./src
PROG = main
OBJS = io.o
.PHONY: limpa faxina clean purge all
all:
echo $(LIKWID_INCLUDE)
$(CC) $(CFLAGS) $(SRC)/main.c $(SRC)/io.c $(SRC)/interpolacao.c $(SRC)/fat_lu.c $(SRC)/ajuste_curvas.c $(SRC)/array_op.c $(SRC)/utils.c -o main $(LFLAGS)
debug:
echo $(LIKWID_INCLUDE)
$(CC) $(CFLAGS) $(DEBUG) $(SRC)/main.c $(SRC)/io.c $(SRC)/interpolacao.c $(SRC)/fat_lu.c $(SRC)/ajuste_curvas.c $(SRC)/array_op.c $(SRC)/utils.c -o main $(LFLAGS)
faxina clean: limpa
@rm -f *.o core a.out
@rm -f $(PROG)
#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
10 4
2.5428845877307094 -4.109859840256829 4.936459730685252 -1.7733843326060827 -4.821256654385843 4.838016242568534 4.240495354771239 0.12037051982216695 3.2547603643757697 1.5456188663378612
3844.13802204434 79621.43836859541 760727.3432096153 -61.15582492487083 329934.2921685642 648474.5320164749 227909.4640815765 4.090478210663487 27757.000100655965 70.4651628670907
-6703.801252696644 -150471.0044242584 -1207301.4730685393 -144.08116139962735 -575934.9700639937 -1031000.1566831908 -367136.73604804825 -5.269314416073557 -46290.65319271203 -146.7318295592063
-10851.281055417494 -325938.3203452513 -1891102.9631749853 -274.47791864872755 -1200502.121446918 -1614163.9450556624 -573735.5311137093 -1.2069856886192134 -72845.89279915963 -260.1208229409394
-4686.389496371533 -259886.22629719746 -1147575.1269117526 -169.022858588959 -953410.2391506622 -974331.348807898 -332839.08540990966 -1.0123486680942122 -37662.43040883103 -39.609009533626335
This diff is collapsed.
20 20
5 5 1 5 1 2 3 3 4 3 3 5 2 1 2 3 4 4 3 4
2 5 1 4 2 4 5 5 3 4 3 1 5 4 2 4 3 5 4 2
5 1 1 2 4 3 5 2 1 3 1 1 3 1 5 2 3 4 4 3
5 3 1 4 2 1 5 3 3 2 4 2 1 4 3 4 2 5 5 4
3 2 3 1 5 1 3 1 2 5 4 4 1 4 3 4 2 1 4 5
2 2 3 3 2 5 1 3 1 3 1 5 2 4 3 5 2 4 3 4
4 1 4 2 3 2 1 2 4 3 4 5 5 1 2 2 2 3 1 3
5 1 3 2 1 3 3 3 2 4 2 3 5 5 3 4 1 5 3 4
1 5 3 2 2 2 1 2 4 3 5 3 1 2 3 5 3 4 4 1
2 5 2 5 3 2 1 2 5 5 1 1 5 1 5 4 4 1 3 3
3 1 4 5 5 1 4 4 1 5 2 3 3 2 3 2 5 5 1 4
5 3 4 4 3 2 1 1 3 4 3 5 2 3 1 2 3 2 3 2
4 1 3 2 2 5 4 2 3 1 5 3 1 1 5 4 1 1 5 2
1 1 5 3 2 5 3 4 1 2 2 4 2 4 1 4 3 5 3 4
3 3 2 4 2 4 3 3 4 1 3 1 5 2 4 3 2 3 3 1
5 3 2 3 5 4 4 5 4 1 5 1 5 4 5 1 1 4 3 5
4 4 5 4 1 4 2 3 1 1 1 5 1 1 5 3 4 4 3 1
3 2 4 4 2 1 1 2 4 1 5 4 5 3 4 1 3 4 5 1
1 5 2 3 2 5 4 2 1 3 1 5 2 3 5 1 1 1 2 1
5 2 2 3 4 4 3 2 5 2 3 5 1 4 5 5 5 2 5 3
5 4 1 5 3 1 4 5 2 2 4 1 3 1 1 1 3 4 1 2
20 5
0.4935161960845571 -3.85338794947946 -3.0362510773112583 0.4979391160911302 0.10226920343110812 -4.040086728071516 -4.795561837400967 -0.2580253094811278 0.5381989760519286 -3.5325088126619275 1.0483868375516856 -1.5060732093818707 3.205217343928698 4.608303581742577 0.9399344693389198 0.6845366250728189 0.9583150652867243 3.0347323321879287 3.778125252403271 4.393809264278918
0.889094239957154 108628394898.24318 1622131300.625063 0.8811779156619559 1.5477767784432184 251106703219.61728 5267084123162.299 1.3849534216878308 0.8161716719632984 23353754893.282074 24.77577616948249 8955.452633258672 3112540737.2335086 2109432315345.463 7.847056747836101 0.8673844129430187 9.50869208707794 1169095162.9700243 59457813361.40755 895425185802.3882
4.278307658495142 53134594401.98332 590232256.8246918 4.271496808759604 4.678636728585103 128636669505.15665 3110851990122.439 5.371129376436842 4.197110422789513 10393151374.162619 15.701327174764488 -400.3191065879514 5231539764.054475 3204736514117.4873 2.23555327501055 3.5899375179125315 2.8962166778548584 1997544897.2160978 95306837607.72235 1377477373087.6514
-1.491428084100551 44670464061.1514 587817358.1586634 -1.520564030476172 0.8238048437570108 105404987444.80289 2358713896642.02 2.4346344794137735 -1.7882013164459556 9214535401.042295 0.7168772770751248 1847.598325165341 2491881378.1646705 1595208248781.9749 -3.0388687227762956 -2.754584103247427 -2.7812620200169933 942705549.1825457 46439653152.33203 682436967503.2612
-0.6890306826411731 -121277652041.45476 -1466967879.9898233 -0.6899185216038761 -1.1141760511755614 -289172402974.38806 -6648940700296.941 -0.9330002556035477 -0.7211848087356632 -24430917074.40372 -51.15782620788426 995.7845896282366 -5642272991.251563 -3890813822351.4824 -17.244742749808452 -1.5576449045601795 -20.675707160152445 -2108716451.6582346 -108983095847.90987 -1650133635908.6694
3.815219509914034 23030001758.942398 411821260.9009099 3.8283385528295395 3.330661882207349 51652370724.33266 986673950689.512 4.046713941898619 3.9508119772641446 5259653749.696057 10.87674676110342 4917.527289395179 1081419983.1488173 568040070539.342 4.874497183124513 4.346482112309636 5.222356726444871 424745123.8692707 18240933730.97139 248295466717.39413
This diff is collapsed.
4 5
0.1395633536902583 4.616673946783779 -3.460634751191165 3.1679518049367204
1.354876156426693 -90.55688695582332 -22.813904113651557 -46.01861570021288
4.218344182446004 -15.59359658567331 -28.0738135377824 -1.9072568683816433
-2.9769169991482647 38.26199453739194 15.807533352035193 17.080618536766284
3.509467989362626 -12.847809127921451 -29.41760792453033 -0.6026732130789894
1.2445587651212033 90.77335552788675 61.091589725978324 41.91248933502163
64 3
4.6086630691301576 3.2953498997359656 -0.3519708989299106 3.486308929141522 -0.06044704948225288 3.0725824939097652 1.6716072689333608 4.867250571063019 -3.7133419286298794 0.9599505648007787 1.884319072414545 -3.3735860308403067 3.6890362549050444 -1.0107476134930682 -4.479176236572737 2.252124428699309 -1.927291484601159 0.005203364542375688 1.2010420205018377 3.7343227112577466 4.066055521975088 0.6821158851508002 -4.915856267572375 -3.8253640046708384 -2.6731614323373245 -3.9663288296602395 -2.2184778196629917 -3.5505338335154457 -4.652069070042657 2.325692584406238 -2.2279870927770795 -4.14612895489337 -2.8317387024125615 2.2416360043350174 -2.4650412743260643 1.6485049295657381 3.6244466384996024 3.9950883439448788 3.7132129062018286 -4.112731633582108 -0.27997399658035427 2.5234681017857525 2.761623338583031 -1.215416466419157 1.9580073276906411 -4.287719501102416 3.15818857299017 2.1010591726954697 -0.8794881079853747 -0.04763717698194547 3.1054383707199946 -1.9864993538793998 2.4397346955970356 4.319015690497931 4.489434991116891 -1.2850637726395808 4.075822835166306 3.541167621301298 4.475982772263237 -3.7117367999344353 3.3350508068578932 3.4697086394399985 -3.067232407531295 -1.3206186856900803
6.668253190404895e+41 6.235962619829953e+32 -0.2368212586909907 2.047776094444325e+34 0.5165636133711576 8.140308766799605e+30 308029032969145.06 1.96589204348935e+43 1.1098366291976052e+36 -20.356385729399292 5.3950502704958483e+17 2.949316793677184e+33 6.803796904906854e+35 9.450935342280003 1.2084132429295346e+41 3.498044364385962e+22 3.1514061603597686e+18 0.6019478437389231 199012.15711523 1.4493892315557066e+36 2.8320137583653196e+38 -1.720170768107192 3.8255825803886252e+43 6.97153865242055e+36 1.707032041553214e+27 6.534352151784233e+37 1.771218626085016e+22 6.944800856174706e+34 1.2592317375697472e+42 2.5714632152452643e+23 2.303753071893951e+22 1.0142067794780688e+39 5.963121396560235e+28 2.618135869736767e+22 1.1580118309730444e+25 129044496638780.56 2.2765588237383275e+35 9.508914566984306e+37 1.0199706441028332e+36 6.1496757824760726e+38 0.01494367273919861 4.065240656068935e+25 1.0910905794420732e+28 2124272.814195408 5.866454948898302e+18 8.097172319900702e+39 4.471312751833574e+31 4.694156458535594e+20 -3.3889404493642394 0.5353808231739356 1.5739399285999724e+31 2.0130320479935554e+19 5.012546511761402e+24 1.1932199237032949e+40 1.3135521294696158e+41 61328200.16507605 3.2860891141034636e+38 5.38963655343364e+34 1.0906035349701242e+41 1.0805644525817742e+36 1.3100198360639561e+33 1.5233567331308635e+34 8.247529147146642e+30 318952053.7335459
2.988267858220797e+41 3.284420866194319e+32 1.927459108049702 1.0463544143565888e+34 0.7334167922414443 4.4613227647211544e+30 288598899134034.44 8.614320081059085e+42 1.5902507048365937e+35 -3.255679245147519 4.339920799687161e+17 4.0721826568682946e+32 3.3771553526526225e+35 17.64158600543584 1.8910788299066072e+40 2.3751302152605655e+22 5.76645368027532e+17 0.4622819781063705 548148.8378392715 7.15057843138442e+35 1.3412734841024006e+38 -2.6376615657149878 6.263402559251278e+42 1.012074991106649e+36 2.3051440942440466e+26 9.644623115962194e+36 2.680300083215852e+21 9.768857601467961e+33 2.007357995583584e+41 1.7013308788239706e+23 3.471011834326753e+21 1.5287231745288038e+38 7.991505719517963e+27 1.7845548299438642e+22 1.6132505944104944e+24 123454406208735.08 1.1401250511728787e+35 4.540707171407862e+37 5.046250555872587e+35 9.23362881433038e+37 1.646851461428948 2.529898101676504e+25 6.386083394478537e+27 996293.8282224381 4.529511306765874e+18 1.2404535191369116e+39 2.4118543355510482e+31 3.3849675300125914e+20 4.55799085189494 0.6800222431813152 8.572696034093586e+30 3.5101021549663457e+18 3.197064699206769e+24 5.498892928590217e+39 5.952305331753577e+40 25805121.538710505 1.5545999169163738e+38 2.7316017516827025e+34 4.948393434696191e+40 1.5480197851717837e+35 6.854611289280226e+32 7.803489957242749e+33 1.1113469436220132e+30 126947603.28536347
-9.517656271410536e+40 -6.096503898079984e+31 -0.3125323966678377 -2.1771592104672645e+33 -1.2238305118314583 -7.037543537054684e+29 22825137502724.957 -2.9263919697181584e+42 -5.0182218086449056e+35 5.121636307688769 1.4687122326765166e+16 -1.385634826887069e+33 -7.787281760643002e+34 24.86599941571464 -5.085544491586999e+40 -8.362709370708647e+20 -1.756334494758545e+18 -1.378450375354073 77544.43016706736 -1.683553583612737e+35 -3.6111219817080127e+37 -0.6176734308567776 -1.5571674170337415e+43 -3.115554335789197e+36 -8.78707367489951e+26 -2.8792663902007505e+37 -9.671764266972583e+21 -3.1966193811167993e+34 -5.2268792469777716e+41 -8.127614501947877e+21 -1.2566508356731329e+22 -4.393474367013395e+38 -3.003448983676677e+28 -5.958202418636116e+20 -6.132870292996387e+24 10396935318081.703 -2.548790585467566e+34 -1.190825878705797e+37 -1.1767203811324968e+35 -2.6722288999252734e+38 -0.5718878074660166 -2.018868331829514e+24 -7.369311075145867e+26 -636372.4936209572 8.650530566373818e+16 -3.4633899313561504e+39 -4.0683894306724885e+30 -2.7688608117108337e+18 7.216985859088146 -1.255706842310485 -1.3885878794139667e+30 -1.1200819495639757e+19 -2.1271915273973215e+23 -1.6114922657763042e+39 -1.8348156314242665e+40 -22718434.137343045 -4.2002269337959045e+37 -5.853630796972737e+33 -1.5195392265988033e+40 -4.886700688008121e+35 -1.3050599346767743e+32 -1.6088346056016936e+33 -4.025621393643636e+30 -127869949.58433038
\ No newline at end of file
#! /usr/bin/env python3
# coding=latin-1
import sys
from string import *
from math import *
from numpy.random import *
from numpy.polynomial.polynomial import *
from datetime import *
# =====================================================
# Inicio Programa principal
# =====================================================
#
seed (int(datetime.timestamp(datetime.now())))
N = 20
M = randint(2,6)
if len(sys.argv) > 1 :
N = int(sys.argv[1])
if len(sys.argv) > 2 :
M = int(sys.argv[2])
# Gera vetor x
x = uniform(-5.0,5.0,N)
# Gera pontos a partir de polinômio aleatório
fm = []
for j in range (0,M) :
f = []
# Gera polinomio aleatório de grau N-1
pol = uniform(-5.0,5.0,N-1)
for k in range(0,N) :
f.append(polyval(x[k],pol))
fm.append(f)
# Gera saída
print(N,M)
for i in x :
print(i, end=" ")
print("")
for i in fm :
for j in i :
print(j, end=" ")
print("")
print("")
#FIM
#ifndef __CURVAS_H__
#define __CURVAS_H__
#include "../includes/data.h"
real_t * ajusteCurvas(matrizBase_t *M);
#endif
\ No newline at end of file
#ifndef __ARRAY_H__
#define __ARRAY_H__
#include "../includes/data.h"
real_t * alocaMatriz(int m, int n);
sl_t * alocaSL(int dim);
void setVecToMat(real_t *x, real_t *matSolution, int dimLin, int dimCol, int lineIdx);
void desalocaSL(sl_t *sl);
#endif
\ No newline at end of file
#ifndef __DATA_H__
#define __DATA_H__
typedef float real_t;
typedef struct
{
int n;
real_t *A;
real_t *b;
} sl_t;
typedef struct {
int idx1, idx2;//índices das linhas
} troca_t;
//k pontos -> n = k - 1
typedef struct
{
int n,m; //n:numero de valores tabulados, m: numero de func tabuladas
real_t *X; //pontos tabulados
real_t *A; //matriz das func de X #pode mudar o tipo depois por conta das otms
} matrizBase_t;
#endif // __DATA_H__
\ No newline at end of file
#ifndef __FAT_H__
#define __FAT_H__
#include "data.h"
int eliminacaoGaussOTM (real_t *A, real_t *L, int dim, troca_t *trocas, int *trocasTam, double *tTriang);
int eliminacaoGauss (real_t *A, real_t *L, int dim, troca_t *trocas, int *trocasTam, double *tTriang);
int retroSub(real_t * A, real_t *x, real_t * b, int dim, int triSupFlag, double * tTotal);
real_t normaL2Residuo(real_t *A, real_t *x, real_t *b, int dim);
void trocaItens(real_t *V, int dim, int idx1, int idx2);
void copyMatriz(real_t *target, real_t *source, int dim);
unsigned int encontraMax(real_t *A, int dim, int i);
void trocaLinha(real_t *A, int dim, int idx1, int idx2);
#endif
\ No newline at end of file
#ifndef __INTER_H__
#define __INTER_H__
#include "data.h"
real_t * interpolacao(matrizBase_t *M);
#endif
\ No newline at end of file
#ifndef __IO_H__
#define __IO_H__
#include "../includes/data.h"
matrizBase_t * lerMatriz ();
void printMatriz(real_t *M, int lin, int col);
void printSolution(real_t *solution1, real_t *solution2, int lin, int col);
void printVetor(real_t *V, int tam);
#endif
\ No newline at end of file
#ifndef __UTILS_H__
#define __UTILS_H__
#include <stdlib.h>
#include <sys/time.h>
/* Retorna tempo em milisegundos
Forma de uso:
double tempo;
tempo = timestamp();
<trecho de programa do qual se deseja medir tempo>
tempo = timestamp() - tempo;
*/
double timestamp(void);
#endif // __UTILS_H__
File added
#!/bin/bash
# Forma de uso:
#
# perfctr <CORE_ID> <GRUPO_PERFORMANCE> ./matmult <opcoe_matmult>
#
# Exemplo, para fazer as medições de performance de FLOPS_DP no core 3
#
# perfctr 3 FLOPS_DP ./matmult -n 64
#
LIKWID_CMD="likwid-perfctr -C $1 -g $2 -m"
shift 2
${LIKWID_CMD} $*
# Para obter topologia dos cpu's
# likwid-topology -c -g
# Para obter lista de grupos de indicadores de performance:
# likwid-perfctr -a
# Para obter lista de Eventos e Contadores
# likwid-perfctr -e
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <likwid.h>
#include "../includes/io.h"
#include "../includes/data.h"
#include "../includes/fat_lu.h"
#include "../includes/array_op.h"
real_t somatorioTermos(matrizBase_t *M, int exp1, int exp2)
{
real_t soma = 0.0f;
for(int i = 0 ; i < M->n; i++)
{
soma += (pow(M->X[i], exp1) * pow(M->X[i], exp2));
}
return soma;
}
real_t somatorioTermosIndep(matrizBase_t *M ,real_t yi, int exp)
{
real_t soma = 0;
for (int i = 0; i < M->n; i++)
{
soma += (yi* pow(M->X[i], exp));
}
return soma;
}
real_t * ajusteCurvas(matrizBase_t *M)
{
sl_t * SL = alocaSL(M->n);
real_t * matSolution = alocaMatriz(M->m, M->n);
int m = 8;
/*unroll & jam*/
for(int j = 0; j < (SL->n - (SL->n%m)); j+=m)
{
for(int i = 0; i < SL->n; i++)
{
/*verifica se está na diagonal de um valor já calculado*/
if(j-1 > 0 && i+1 < SL->n)
SL->A[j*SL->n + i] = SL->A[(j-1)*SL->n + (i+1)];
else
SL->A[j*SL->n + i] = somatorioTermos(M, j, i);
}
}
/*reminder loop*/
for(int j = (SL->n - (SL->n%m)); j < SL->n; j++)
{
for(int i = 0; i < SL->n; i++)
{
/*verifica se está na diagonal de um valor já calculado*/
if(j-1 > 0 && i+1 < SL->n)
SL->A[j*SL->n + i] = SL->A[(j-1)*SL->n + (i+1)];
else
SL->A[j*SL->n + i] = somatorioTermos(M, j, i);
}
}
/*imprime Matriz de coef*/
#ifdef DEBUG
printf("##DEBUG: MATRIZ DE COEF AC\n");
printMatriz(SL->A, SL->n, SL->n);
#endif
int trocasTam_OTM = 0;
int trocasTam_NOTM = 0;
double tTriang_OTM = 0;
double tTriang_NOTM = 0;
double tY_OTM = 0;
double tX_OTM = 0;
int err = 0;
troca_t trocas_OTM[SL->n];
troca_t trocas_NOTM[SL->n];
real_t *L_OTM = alocaMatriz(SL->n, SL->n);
real_t *L_NOTM = alocaMatriz(SL->n, SL->n);
real_t *U_OTM = alocaMatriz(SL->n, SL->n);
real_t *U_NOTM = alocaMatriz(SL->n, SL->n);
copyMatriz(U_OTM, SL->A, SL->n);
copyMatriz(U_NOTM, SL->A, SL->n);
LIKWID_MARKER_START("TRI_OTM");
err = eliminacaoGaussOTM(U_OTM, L_OTM, SL->n, trocas_OTM, &trocasTam_OTM, &tTriang_OTM);
LIKWID_MARKER_STOP("TRI_OTM");
LIKWID_MARKER_START("TRI_NOTM");
err = eliminacaoGauss(U_NOTM, L_NOTM, SL->n, trocas_NOTM, &trocasTam_NOTM, &tTriang_NOTM);
LIKWID_MARKER_STOP("TRI_NOTM");
if(err != -1)
{
/*para cada uma das linhas da matriz de f(xi)*/
for(int idx = 0; idx < M->m; idx++)
{
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));
/*pega as colunas que contêm os valores das funções pra formar o b do SL da vez*/
for(int j = 0; j < SL->n; j++)
{
SL->b[j] = somatorioTermosIndep(M, M->A[idx*M->m + j], j);
bi[j] = SL->b[j];
}
/*replicas as trocas realizadas em L no vetor bi*/
for(int i = 0; i < trocasTam_OTM; i++)
trocaItens(bi,SL->n, trocas_OTM[i].idx1, trocas_OTM[i].idx2);
/*calculo das matrizes L e U*/
retroSub(L_OTM, y, bi, SL->n, 0, &tY_OTM);
retroSub(U_OTM, x, y, SL->n, 1, &tX_OTM);
/*atribui vetor solução para a matriz de soluções de todas as f(xi)*/
setVecToMat(x, matSolution, M->m, SL->n, idx);
/*imprime na saída padrão para debug*/
#ifdef DEBUG
printf("##DEBUG: VETOR bi\n");
printVetor(bi, SL->n);
printf("##DEBUG: VETOR solução\n");
printVetor(x, SL->n);
printf("##DEBUG: NORMA L2\n");
printf("NL2: %.9g\n", normaL2Residuo(SL->A, x, SL->b, SL->n));
#endif
/*libera os ponteiros*/
free(x);
free(y);
free(bi);
}
}
else
{
desalocaSL(SL);
free(U_OTM);
free(U_NOTM);
free(L_NOTM);
free(L_OTM);
return NULL;
}
desalocaSL(SL);
free(U_OTM);
free(U_NOTM);
free(L_NOTM);
free(L_OTM);
return matSolution;
}
\ 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