LCOV - code coverage report
Current view: top level - AP_Math - matrixN.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 8 8 100.0 %
Date: 2026-09-09 11:02:08 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /*
       2             :  *  N dimensional matrix operations
       3             :  */
       4             : 
       5             : #pragma once
       6             : 
       7             : #include "math.h"
       8             : #include <stdint.h>
       9             : #include "vectorN.h"
      10             : 
      11             : template <typename T, uint8_t N>
      12             : class VectorN;
      13             : 
      14             : 
      15             : template <typename T, uint8_t N>
      16             : class MatrixN {
      17             :   
      18             :     friend class VectorN<T,N>;
      19             : 
      20             : public:
      21             :     // constructor from zeros
      22       15002 :     MatrixN(void) {
      23       15002 :         memset(v, 0, sizeof(v));        
      24       15002 :     }
      25             : 
      26             :     // constructor from 4 diagonals
      27           2 :     MatrixN(const float d[N]) {
      28           2 :         memset(v, 0, sizeof(v));
      29          10 :         for (uint8_t i = 0; i < N; i++) {
      30           8 :             v[i][i] = d[i];
      31             :         }
      32           2 :     }
      33             : 
      34             :     // multiply two vectors to give a matrix, in-place
      35             :     void mult(const VectorN<T,N> &A, const VectorN<T,N> &B);
      36             : 
      37             :     // subtract B from the matrix
      38             :     MatrixN<T,N> &operator -=(const MatrixN<T,N> &B);
      39             : 
      40             :     // add B to the matrix
      41             :     MatrixN<T,N> &operator +=(const MatrixN<T,N> &B);
      42             :     
      43             :     // Matrix symmetry routine
      44             :     void force_symmetry(void);
      45             : 
      46             : private:
      47             :     T v[N][N];
      48             : };

Generated by: LCOV version 1.14