-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatrix.h
47 lines (34 loc) · 1.48 KB
/
matrix.h
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
#ifndef MATRIX_H
#define MATRIX_H
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
// Basic operations
double** zero_matrix_2D(int n);
double* zero_matrix_1D(int n);
u_int64_t* zero_matrix_1D_integer(int n);
double** random_matrix_2D(int n, double p);
double* random_matrix_1D(int n, double p);
double* convert_2D_to_1D(double** mat, int n);
double** convert_1D_to_2D(double* mat, int n);
u_int64_t* convert_float_to_integer(double* mat, int n);
void delete_matrix_2D(double*** mat, int n);
void delete_matrix_1D(double** mat, int n);
void delete_matrix_1D_integer(u_int64_t** mat, int n);
u_int64_t* transpose_matrix_integer(u_int64_t* mat, int n);
void print_matrix_2D(double** mat, int n);
void print_matrix_1D(double* mat, int n);
void print_matrix_1D_integer(u_int64_t* mat, int n);
void write_matrix(double** mat, int n, char* filename);
void write_matrix_1D(double* mat, int n, char* filename);
void write_matrix_1D_integer(u_int64_t* mat, int n, char* filename);
double** read_matrix(char* filename, int* n);
double* read_matrix_1D(char* filename, int* n);
int equals_matrix_2D_2D(double** A, double** B, int n);
int equals_matrix_2D_1D(double** A, double* B, int n);
int equals_matrix_1D_1D(double* A, double* B, int n);
int equals_matrix_float_integer(double* A, u_int64_t* B, int n);
int equals_matrix_integer_integer(u_int64_t* A, u_int64_t* B, int n);
int equals_matrix_file(char* filename1, char* filename2);
#endif