//********************************************//
//************* matrici v2.02.01 *************//
//**************** by mamo139 ****************//
//******* http://mamo139.altervista.org ******//
//********************************************//
#ifndef _MATRICI_H
#define _MATRICI_H 1
#include <cstdlib>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
//costanti
typedef enum {
MATRICI_CUT_ROW,
MATRICI_CUT_COLUMN
} matrici_cut_mode;
typedef enum {
MATRICI_JOIN_HORIZONTALLY,
MATRICI_JOIN_VERTICALLY
} matrici_join_mode;
//**************** class ******************//
class matrice {
private:
int r;
int c;
double ** m;
public:
//costruttore e distruttore
matrice();
matrice(const matrice& o);//copy constructor
~matrice();
//crea matrice
void create(int r, int c);
void create_with_value(int r, int c, double value);
//visualizza matrice
void print();
//info matrice
int rows();
int columns();
double get_value(int r0, int c0);
void set_value(int r0, int c0, double value);
double *operator[](int i);
//caricamento - salvataggio matrici
void load_from_file(char * file);
void save_in_file(char * file);
//assignment operator
matrice operator=(const matrice o);
//operazioni matrici con matrici
friend matrice operator+(matrice a, matrice b);
friend matrice operator-(matrice a, matrice b);
friend matrice operator*(matrice a,matrice b);
//operazioni matrici con scalari
friend matrice operator+(double scal,matrice a);
friend matrice operator+(matrice a, double scal);
friend matrice operator-(double scal,matrice a);
friend matrice operator-(matrice a, double scal);
friend matrice operator*(double scal,matrice a);
friend matrice operator*(matrice a, double scal);
//altre operazioni
friend matrice matrici_transpose(matrice a);
friend double matrici_determinant(matrice a);
friend matrice matrici_invert(matrice a);
//modifica matrici
friend matrice matrici_cut(matrice a, matrici_cut_mode mode, int pos);
friend matrice matrici_join(matrice a, matrice b, matrici_join_mode mode);
};
#endif