gctl/lib/algorithm/extrapolate.h

110 lines
6.0 KiB
C
Raw Normal View History

2024-09-10 15:45:07 +08:00
/********************************************************
*
*
*
*
*
*
* Geophysical Computational Tools & Library (GCTL)
*
* Copyright (c) 2023 Yi Zhang (yizhang-geo@zju.edu.cn)
*
* GCTL is distributed under a dual licensing scheme. You can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 2
* of the License, or (at your option) any later version. You should have
* received a copy of the GNU Lesser General Public License along with this
* program. If not, see <http://www.gnu.org/licenses/>.
*
* If the terms and conditions of the LGPL v.2. would prevent you from using
* the GCTL, please consider the option to obtain a commercial license for a
* fee. These licenses are offered by the GCTL's original author. As a rule,
* licenses are provided "as-is", unlimited in time for a one time fee. Please
* send corresponding requests to: yizhang-geo@zju.edu.cn. Please do not forget
* to include some description of your company and the realm of its activities.
* Also add information on how to contact you by electronic and paper mail.
******************************************************/
#ifndef _GCTL_EXTRAPOLATE_H
#define _GCTL_EXTRAPOLATE_H
#include "../core/array.h"
#include "../core/matrix.h"
#include "../maths/mathfunc_t.h"
namespace gctl
{
/**
* @brief 使cosine函数对一维数组进行外插
*
* @param in_arr
* @param[in] in_num
* @param out_arr
* @param[in] out_num
* @param[in] end_value NAN则函数会计算原数组端点值的均值作为新的端点值
*/
void cosine_extrapolate_1d(double *in_arr, int in_num, double *out_arr, int out_num, double end_value = NAN);
/**
* @brief 使cosine函数对一维数组进行外插
*
* @param[in] in_arr
* @param out_arr
* @param[in] end_val NAN函数会计算原数组端点值的均值作为新的端点值
* @param[in] out_len 02
*/
void cosine_extrapolate_1d(const array<double> &in_arr, array<double> &out_arr, double end_val = NAN, int out_len = -1);
/**
* @brief 使cosine函数对二维数组进行外插
*
* @param[in] in_arr
* @param out_arr
* @param ori_row
* @param ori_col
* @param[in] end_valx x方向外插后的端点值NAN函数会计算原数组端点值的均值作为新的端点值
* @param[in] end_valy y方向外插后的端点值NAN函数会计算原数组端点值的均值作为新的端点值
* @param[in] out_lenx x方向外插后的数组长度02
* @param[in] out_leny y方向外插后的数组长度02
*/
void cosine_extrapolate_2d(const _2d_matrix &in_arr, _2d_matrix &out_arr,
int &ori_row, int &ori_col, double end_valx = NAN, double end_valy = NAN, int out_lenx = -1, int out_leny = -1);
/**
* @brief 使cosine函数对二维数组进行外插
*
*
*
* @param[in] in_arr
* @param out_arr
* @param[in] in_row
* @param[in] in_col
* @param out_row 2
* @param out_col 2
* @param ori_row
* @param ori_col
* @param[in] end_valx x方向外插后的端点值NAN函数会计算原数组端点值的均值作为新的端点值
* @param[in] end_valy y方向外插后的端点值NAN函数会计算原数组端点值的均值作为新的端点值
*/
void cosine_extrapolate_2d(const array<double> &in_arr, array<double> &out_arr, int in_row, int in_col,
int &out_row, int &out_col, int &ori_row, int &ori_col, double end_valx = NAN, double end_valy = NAN);
/**
* @brief 使
*
*
*
* @param[in] in_arr
* @param out_arr
* @param[in] in_row
* @param[in] in_col
* @param out_row 2
* @param out_col 2
* @param ori_row
* @param ori_col
*/
void zeros_extrapolate_2d(const array<double> &in_arr, array<double> &out_arr, int in_row, int in_col,
int &out_row, int &out_col, int &ori_row, int &ori_col);
}
#endif // _GCTL_EXTRAPOLATE_H