typo fixed in build.sh

This commit is contained in:
Raffaele
2022-01-15 00:37:25 +01:00
parent 524aee4b31
commit aa839de090
2 changed files with 213 additions and 1 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
gcc tests/test.c src/lina.c -o test -Wall -Wextra -g -Isrc/ gcc tests/test.c src/lina.c -o test -Wall -Wextra -g -Isrc/
gcc tests/test2.c src/lina.c -o test2 -Wall -Wextra -g -Isrc/ gcc tests/test_loader.c src/lina.c -o test_loader -Wall -Wextra -g -Isrc/
+212
View File
@@ -9,6 +9,218 @@
//Print the matrix A with size m by n //Print the matrix A with size m by n
static void pmatrix(FILE *fp, double *A, int m, int n); static void pmatrix(FILE *fp, double *A, int m, int n);
struct {
double A[9], // Left argument
B[9], // Right argument
C[9]; // Expected result
} dot_tests[] = {
{
.A = {
1, 0, 0,
0, 1, 0,
0, 0, 1,
},
.B = {
1, 0, 0,
0, 1, 0,
0, 0, 1,
},
.C = {
1, 0, 0,
0, 1, 0,
0, 0, 1,
},
},
};
struct {
double A[9], // Input
B[9], // Expected output
factor; // Scale factor
} scale_tests[] = {
{
.A = {
1, 1, 1,
1, 1, 1,
1, 1, 1,
},
.B = {
2, 2, 2,
2, 2, 2,
2, 2, 2,
},
.factor = 2,
},
};
struct {
double *A, *B;
int m, n;
} transp_tests[] = {
{
.A = (double[]) {
1, 0, 0, 0,
0, 2, 0, 0,
0, 0, 3, 0,
0, 0, 0, 4,
},
.B = (double[]) {
1, 0, 0, 0,
0, 2, 0, 0,
0, 0, 3, 0,
0, 0, 0, 4,
},
.m = 4,
.n = 4,
},
{
.A = (double[]) {
1, 2, 3, 4,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
},
.B = (double[]) {
1, 0, 0, 0,
2, 0, 0, 0,
3, 0, 0, 0,
4, 0, 0, 0,
},
.m = 4,
.n = 4,
},
{
.A = (double[]) {
0, 1, 0, 0,
0, 2, 0, 0,
0, 3, 0, 0,
0, 4, 0, 0,
},
.B = (double[]) {
0, 0, 0, 0,
1, 2, 3, 4,
0, 0, 0, 0,
0, 0, 0, 0,
},
.m = 4,
.n = 4,
},
{
.A = (double[]) {
0, 0, 1, 0,
0, 0, 2, 0,
0, 0, 3, 0,
0, 0, 4, 0,
},
.B = (double[]) {
0, 0, 0, 0,
0, 0, 0, 0,
1, 2, 3, 4,
0, 0, 0, 0,
},
.m = 4,
.n = 4,
},
{
.A = (double[]) {
0, 0, 0, 1,
0, 0, 0, 2,
0, 0, 0, 3,
0, 0, 0, 4,
},
.B = (double[]) {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
1, 2, 3, 4,
},
.m = 4,
.n = 4,
},
{
.A = (double[]) {
1, 0, 0,
0, 2, 0,
0, 0, 3,
},
.B = (double[]) {
1, 0, 0,
0, 2, 0,
0, 0, 3,
},
.m = 3,
.n = 3,
},
{
.A = (double[]) {
1, 2, 3,
0, 0, 0,
0, 0, 0,
},
.B = (double[]) {
1, 0, 0,
2, 0, 0,
3, 0, 0,
},
.m = 3,
.n = 3,
},
{
.A = (double[]) {
0, 1, 0,
0, 2, 0,
0, 3, 0,
},
.B = (double[]) {
0, 0, 0,
1, 2, 3,
0, 0, 0,
},
.m = 3,
.n = 3,
},
{
.A = (double[]) {
0, 0, 1,
0, 0, 2,
0, 0, 3,
},
.B = (double[]) {
0, 0, 0,
0, 0, 0,
1, 2, 3,
},
.m = 3,
.n = 3,
},
{
.A = (double[]) {
1, 2, 3,
4, 5, 6,
},
.B = (double[]) {
1, 4,
2, 5,
3, 6,
},
.m = 2,
.n = 3,
},
{
.A = (double[]) {
1, 4,
2, 5,
3, 6,
},
.B = (double[]) {
1, 2, 3,
4, 5, 6,
},
.m = 3,
.n = 2,
},
};
int main() int main()
{ {
// Evaluate dot product tests. // Evaluate dot product tests.