aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-03-12 14:31:49 +0100
committerThomas White <taw@physics.org>2019-03-12 14:31:49 +0100
commit4fdfdfa0eef645e290a8ab98c9ff6507c2bc1f5f (patch)
tree4993f3ee9bb3f001d19a5c833d060a357e7db4d6 /libcrystfel
parentee77fdf67c9bb5430c7a8eb5005673e507964931 (diff)
Rename intmat_intvec_mult to transform_indices
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/integer_matrix.c29
-rw-r--r--libcrystfel/src/integer_matrix.h3
-rw-r--r--libcrystfel/src/symmetry.c2
3 files changed, 18 insertions, 16 deletions
diff --git a/libcrystfel/src/integer_matrix.c b/libcrystfel/src/integer_matrix.c
index b6f55ac2..e74e0ea4 100644
--- a/libcrystfel/src/integer_matrix.c
+++ b/libcrystfel/src/integer_matrix.c
@@ -183,7 +183,7 @@ signed int intmat_get(const IntegerMatrix *m, unsigned int i, unsigned int j)
* @ans: An array of %Rational in which to store the result
*
* Solves the matrix equation m*ans = vec, where @ans and @vec are
- * vectors of %Rational.
+ * column vectors of %Rational numbers.
*
* This is just a convenience function which creates a %RationalMatrix out of
* @m and then calls rtnl_mtx_solve().
@@ -204,35 +204,38 @@ int intmat_solve_rational(const IntegerMatrix *m, const Rational *vec,
/**
- * intmat_intvec_mult:
- * @m: An %IntegerMatrix
- * @vec: An array of signed integers
+ * transform_indices:
+ * @P: An %IntegerMatrix
+ * @hkl: An array of signed integers
+ *
+ * Apply transformation matrix P to a set of reciprocal space Miller indices.
*
- * Multiplies the matrix @m by the vector @vec. The size of @vec must equal the
- * number of columns in @m, and the size of the result equals the number of rows
- * in @m.
+ * In other words:
+ * Multiplies the matrix @P by the row vector @hkl. The size of @vec must equal
+ * the number of columns in @P, and the size of the result equals the number of
+ * rows in @P.
*
* The multiplication looks like this:
- * (a1, a2, a3) = (vec1, vec2, vec3) m
+ * (a1, a2, a3) = (hkl1, hkl2, hkl3) P
* Therefore matching the notation in ITA chapter 5.1.
*
* Returns: a newly allocated array of signed integers containing the answer,
* or NULL on error.
**/
-signed int *intmat_intvec_mult(const IntegerMatrix *m, const signed int *vec)
+signed int *transform_indices(const IntegerMatrix *P, const signed int *hkl)
{
signed int *ans;
unsigned int j;
- ans = malloc(m->rows * sizeof(signed int));
+ ans = malloc(P->rows * sizeof(signed int));
if ( ans == NULL ) return NULL;
- for ( j=0; j<m->cols; j++ ) {
+ for ( j=0; j<P->cols; j++ ) {
unsigned int i;
ans[j] = 0;
- for ( i=0; i<m->rows; i++ ) {
- ans[i] += intmat_get(m, i, j) * vec[j];
+ for ( i=0; i<P->rows; i++ ) {
+ ans[i] += intmat_get(P, i, j) * hkl[j];
}
}
diff --git a/libcrystfel/src/integer_matrix.h b/libcrystfel/src/integer_matrix.h
index 2da2328a..9a2e4ce2 100644
--- a/libcrystfel/src/integer_matrix.h
+++ b/libcrystfel/src/integer_matrix.h
@@ -71,8 +71,7 @@ extern IntegerMatrix *intmat_create_3x3(signed int m11, signed int m12, signed i
signed int m31, signed int m32, signed int m33);
/* Matrix-vector multiplication */
-extern signed int *intmat_intvec_mult(const IntegerMatrix *m,
- const signed int *vec);
+extern signed int *transform_indices(const IntegerMatrix *P, const signed int *hkl);
/* Matrix-matrix multiplication */
extern IntegerMatrix *intmat_intmat_mult(const IntegerMatrix *a,
diff --git a/libcrystfel/src/symmetry.c b/libcrystfel/src/symmetry.c
index 05ee7c6b..9b5c683d 100644
--- a/libcrystfel/src/symmetry.c
+++ b/libcrystfel/src/symmetry.c
@@ -1126,7 +1126,7 @@ static void do_op(const IntegerMatrix *op,
v[0] = h; v[1] = k; v[2] = l;
- ans = intmat_intvec_mult(op, v);
+ ans = transform_indices(op, v);
assert(ans != NULL);
*he = ans[0]; *ke = ans[1]; *le = ans[2];