[gegl] matrix: add gegl_matrix2_determinant()
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] matrix: add gegl_matrix2_determinant()
- Date: Sat, 3 Mar 2018 09:17:23 +0000 (UTC)
commit ea05b209f116afa680bcafcf6164181f74800de9
Author: Ell <ell_se yahoo com>
Date: Sat Mar 3 02:46:58 2018 -0500
matrix: add gegl_matrix2_determinant()
... which calculates the determinant of a GeglMatrix2.
gegl/gegl-matrix.c | 7 +++++++
gegl/gegl-matrix.h | 8 ++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gegl/gegl-matrix.c b/gegl/gegl-matrix.c
index 119f230..98a0864 100644
--- a/gegl/gegl-matrix.c
+++ b/gegl/gegl-matrix.c
@@ -24,6 +24,13 @@
#include "gegl-matrix.h"
+gdouble
+gegl_matrix2_determinant (GeglMatrix2 *matrix)
+{
+ return matrix->coeff[0][0] * matrix->coeff[1][1] -
+ matrix->coeff[1][0] * matrix->coeff[0][1];
+}
+
#if 0
static void gegl_matrix3_debug (GeglMatrix3 *matrix)
{
diff --git a/gegl/gegl-matrix.h b/gegl/gegl-matrix.h
index f1763ea..b080a1f 100644
--- a/gegl/gegl-matrix.h
+++ b/gegl/gegl-matrix.h
@@ -32,6 +32,14 @@ typedef struct {
gdouble coeff[2][2];
} GeglMatrix2;
+/**
+ * gegl_matrix2_determinant:
+ * @matrix: a #GeglMatrix2
+ *
+ * Returns the determinant of @matrix.
+ */
+gdouble gegl_matrix2_determinant (GeglMatrix2 *matrix);
+
/***
* GeglMatrix3:
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]