chromium/third_party/libaom/source/libaom/aom_dsp/mathutils.h

/*
 * Copyright (c) 2017, Alliance for Open Media. All rights reserved.
 *
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */

#ifndef AOM_AOM_DSP_MATHUTILS_H_
#define AOM_AOM_DSP_MATHUTILS_H_

#include <assert.h>
#include <math.h>
#include <string.h>

#include "aom_dsp/aom_dsp_common.h"

static const double TINY_NEAR_ZERO =;

// Solves Ax = b, where x and b are column vectors of size nx1 and A is nxn
static inline int linsolve(int n, double *A, int stride, double *b, double *x) {}

////////////////////////////////////////////////////////////////////////////////
// Least-squares
// Solves for n-dim x in a least squares sense to minimize |Ax - b|^2
// The solution is simply x = (A'A)^-1 A'b or simply the solution for
// the system: A'A x = A'b
//
// This process is split into three steps in order to avoid needing to
// explicitly allocate the A matrix, which may be very large if there
// are many equations to solve.
//
// The process for using this is (in pseudocode):
//
// Allocate mat (size n*n), y (size n), a (size n), x (size n)
// least_squares_init(mat, y, n)
// for each equation a . x = b {
//    least_squares_accumulate(mat, y, a, b, n)
// }
// least_squares_solve(mat, y, x, n)
//
// where:
// * mat, y are accumulators for the values A'A and A'b respectively,
// * a, b are the coefficients of each individual equation,
// * x is the result vector
// * and n is the problem size
static inline void least_squares_init(double *mat, double *y, int n) {}

// Round the given positive value to nearest integer
static AOM_FORCE_INLINE int iroundpf(float x) {}

static inline void least_squares_accumulate(double *mat, double *y,
                                            const double *a, double b, int n) {}

static inline int least_squares_solve(double *mat, double *y, double *x,
                                      int n) {}

// Matrix multiply
static inline void multiply_mat(const double *m1, const double *m2, double *res,
                                const int m1_rows, const int inner_dim,
                                const int m2_cols) {}

static inline float approx_exp(float y) {}
#endif  // AOM_AOM_DSP_MATHUTILS_H_