-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSparse.h
More file actions
49 lines (31 loc) · 1.31 KB
/
Sparse.h
File metadata and controls
49 lines (31 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef ESTRUCTURA_MYMATRIZ_MATRIZ_H
#define ESTRUCTURA_MYMATRIZ_MATRIZ_H
#include "Definiciones.h"
#include "Elemento.h"
#include <iostream>
using namespace std;
//Objetivo 1: Reducir los requerimientos de memoria, es decir, los elementos 0 no almacenarlos
//Objetivo 2: Reducri el costo aritmetico de cada operacion
// Objetivo 3: Se busca su eficiencia en cuanto al acceso secuencial a la matriz
// Ventaja 1: COO (Coordinate) --> Acceso secuencial eficiente
// Ventaja 2: CSR (Compressed sparse row) --> Se alamacenan de forma implicita los indices de fila
class Sparse {
private:
Elemento* elemento; //Vector con elementos que contienen coordenadaFila, coordenadaColumna y valor
TipoEntero noZeros;
TipoEntero numFilas;
TipoEntero numColumnas;
public:
//Sparse();
Sparse(TipoEntero _noZeros,TipoEntero _numFilas, TipoEntero _numColumnas);
~Sparse();
//Sobrecargar operadores para leer e imprimir datos
friend istream &operator>>(istream &is, Sparse &matriz); // Leer
friend ostream &operator<<(ostream &os, Sparse &matriz); // Imprimir
//Sobrecargar operadores para realizar operaciones
Sparse operator+(Sparse &matriz);
Sparse operator*(Sparse &matriz);
Sparse ProductoPunto(Sparse &matriz);
Sparse Transpos();
};
#endif //ESTRUCTURA_MYMATRIZ_MATRIZ_H