diff options
author | Thomas White <taw@physics.org> | 2013-08-08 11:50:20 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2013-08-08 11:50:20 +0200 |
commit | 59e3078dd26cec7a8d604c70e69f5caa5331ed03 (patch) | |
tree | 1cf6099d6b183b203d6f7eaca3751c3c089476e7 /libcrystfel | |
parent | 5414ff57a37bc7b079a50b1c032d34e2341452f9 (diff) |
Add show_matrix()
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/utils.c | 20 | ||||
-rw-r--r-- | libcrystfel/src/utils.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/libcrystfel/src/utils.c b/libcrystfel/src/utils.c index 7f8882a2..697c773f 100644 --- a/libcrystfel/src/utils.c +++ b/libcrystfel/src/utils.c @@ -77,6 +77,26 @@ void show_matrix_eqn(gsl_matrix *M, gsl_vector *v, int r) } +/** + * show_matrix: + * @M: A matrix + * + * Displays a matrix. + **/ +void show_matrix(gsl_matrix *M) +{ + int i, j; + + for ( i=0; i<M->size1; i++ ) { + STATUS("[ "); + for ( j=0; j<M->size2; j++ ) { + STATUS("%+9.3e ", gsl_matrix_get(M, i, j)); + } + STATUS("]\n"); + } +} + + size_t notrail(char *s) { size_t i; diff --git a/libcrystfel/src/utils.h b/libcrystfel/src/utils.h index 1adb69e6..a206ccfd 100644 --- a/libcrystfel/src/utils.h +++ b/libcrystfel/src/utils.h @@ -97,6 +97,7 @@ extern struct rvec quat_rot(struct rvec q, struct quaternion z); /* --------------------------- Useful functions ----------------------------- */ extern void show_matrix_eqn(gsl_matrix *M, gsl_vector *v, int r); +extern void show_matrix(gsl_matrix *M); extern size_t notrail(char *s); extern void chomp(char *s); |