diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-11-15 14:16:15 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-11-15 14:16:15 -0700 |
commit | 1a6b95273628d898226eb448c8b671dc33f3c495 (patch) | |
tree | 08ebde756da3214142acaaa15ef45a1eea7e9970 /src/matrix.c | |
parent | 3f1f18b149788fe69180dc2a348fd32425bb9a3f (diff) | |
download | cmath-1a6b95273628d898226eb448c8b671dc33f3c495.tar.gz cmath-1a6b95273628d898226eb448c8b671dc33f3c495.zip |
compute dominant eigenvalue
Diffstat (limited to 'src/matrix.c')
-rw-r--r-- | src/matrix.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/matrix.c b/src/matrix.c index 0891734..04c5adc 100644 --- a/src/matrix.c +++ b/src/matrix.c @@ -42,6 +42,16 @@ Matrix_double *m_dot_m(Matrix_double *a, Matrix_double *b) { return prod; } +Matrix_double *transpose(Matrix_double *m) { + Matrix_double *transposed = InitMatrixWithSize(double, m->cols, m->rows, 0.0); + + for (size_t x = 0; x < m->rows; x++) + for (size_t y = 0; y < m->cols; y++) + transposed->data[y]->data[x] = m->data[x]->data[y]; + + return transposed; +} + Matrix_double *put_identity_diagonal(Matrix_double *m) { assert(m->rows == m->cols); Matrix_double *copy = copy_matrix(m); |