Skip to content

Commit

Permalink
implement matrix_toeplitz, matrix_from_array, matrix_is_toeplitz, mat…
Browse files Browse the repository at this point in the history
…rix_circulant, matrix_hilbert, matrix_cofactor, matrix_cholesky_decomposition, matrix_lu_decomposition, matrix_qt_decomposition, normalize_vector, subtract_projection, dot_product, matrix_pascal, binomial_coefficient, matrix_forbenius_norm, matrix_l1_norm, matrix_infinity_norm, matrix_inverse_gauss_jordan, matrix_is_positive_definite, matrix_projection, matrix_vandermonde, matrix_companion
  • Loading branch information
KaisenAmin committed Feb 18, 2024
1 parent 21d561e commit 6071efc
Show file tree
Hide file tree
Showing 4 changed files with 1,219 additions and 31 deletions.
32 changes: 1 addition & 31 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,6 @@
#include "fmt/fmt.h"

int main() {
size_t n = 4;
Matrix* matrix = matrix_create(n, n);

if (!matrix) {
fmt_fprintf(stderr, "Failed to create matrix.\n");
return EXIT_FAILURE;
}

double values[] = {1, 2, 3, 4, 3, 4, 5, 4, 5, 6, 5, 6, 7};
for (size_t i = 0; i < n; i++) {
for (size_t j = 0; j < n; j++) {
if (i + j < n) {
matrix_set(matrix, i, j, values[i + j]);
}
else {
matrix_set(matrix, i, j, values[n - 1 + (i + j - n + 1)]);
}
}
}

fmt_printf("Matrix:\n");
matrix_print(matrix);

if (matrix_is_hankel(matrix)) {
fmt_printf("The matrix is Hankel.\n");
}
else {
fmt_printf("The matrix is not Hankel.\n");
}

matrix_deallocate(matrix);
return 0;
return 0;
}
Loading

0 comments on commit 6071efc

Please sign in to comment.