OSDN Git Service

Android.mk: Remove USE_IIO_SENSOR_HAL and USE_IIO_ACTIVITY_RECOGNITION_HAL
[android-x86/hardware-intel-libsensors.git] / matrix-ops.c
index eebfe1d..acc0837 100644 (file)
@@ -1,10 +1,22 @@
 /*
- * Copyright (C) 2014 Intel Corporation.
- */
+// Copyright (c) 2015 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
 
 #include "matrix-ops.h"
 #include <math.h>
-#include <stdio.h>
+
 
 void transpose (int rows, int cols, double m[rows][cols], double m_trans[cols][rows])
 {
@@ -27,6 +39,8 @@ void multiply (int m, int n, int p, double m1[m][n], double m2[n][p], double res
                 result [i][k] += m1[i][j] * m2 [j][k];
         }
 }
+
+
 void invert (int s, double m[s][s],  double m_inv[s][s])
 {
     double t;
@@ -36,6 +50,7 @@ void invert (int s, double m[s][s],  double m_inv[s][s])
     for (i = 0; i < s; i++)
         for (j = 0; j < s; j++)
             m_inv[i][j] = 0;
+
     for (i = 0; i < s; i++)
         m_inv[i][i] = 1;
 
@@ -62,12 +77,13 @@ void invert (int s, double m[s][s],  double m_inv[s][s])
         }
 
         t = 1 / tmp[i][i];
+
         for (k = 0 ; k < s ; k++) {
             tmp[k][i] *= t;
             m_inv[k][i] *= t;
         }
 
-        for (j = 0 ; j < s ; j++) {
+        for (j = 0 ; j < s ; j++)
             if (j != i) {
                 t = tmp[i][j];
                 for (k = 0 ; k < s; k++) {
@@ -75,10 +91,10 @@ void invert (int s, double m[s][s],  double m_inv[s][s])
                     m_inv[k][j] -= m_inv[k][i] * t;
                 }
             }
-        }
-
     }
 }
+
+
 void multiply_scalar_inplace(int rows, int cols, double m[rows][cols], double scalar)
 {
     int i,j;
@@ -87,6 +103,8 @@ void multiply_scalar_inplace(int rows, int cols, double m[rows][cols], double sc
         for (j = 0; j < cols; j++)
             m[i][j] = m[i][j] * scalar;
 }
+
+
 void assign (int rows, int cols, double m[rows][cols], double m1[rows][cols])
 {
     int i,j;