This commit is contained in:
张壹 2025-07-19 07:43:12 +08:00
parent 65a9953dfa
commit d1bf361e43
4 changed files with 58 additions and 1 deletions

View File

@ -69,6 +69,7 @@ endmacro()
if(GCTL_FOUND)
add_example(core array_ex ON OFF OFF OFF)
add_example(core matrix_ex ON OFF OFF OFF)
add_example(core autodiff_ex ON OFF OFF OFF)
add_example(core ceemdan_ex ON OFF OFF OFF)
add_example(core cliplot_ex ON OFF OFF OFF)

View File

@ -64,7 +64,7 @@ void average_radian_spec(const array<double> &in_freq, const array<double> &in_p
if (!bin.empty())
{
bin_arr.input(bin);
bin_arr.import_vector(bin);
out_power[i] = bin_arr.mean();
out_std[i] = bin_arr.std();
}

View File

@ -25,6 +25,7 @@
* Also add information on how to contact you by electronic and paper mail.
******************************************************/
#include "gctl/core.h"
#include "gctl/utility.h"
#include "gctl/poly.h"

55
src/core/matrix_ex.cpp Normal file
View File

@ -0,0 +1,55 @@
/********************************************************
*
*
*
*
*
*
* Geophysical Computational Tools & Library (GCTL)
*
* Copyright (c) 2022 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.
******************************************************/
#include "gctl/core.h"
#include "gctl/io.h"
using namespace gctl;
int main(int argc, char const *argv[]) try
{
_2d_matrix m(5, 4);
m.sequence(1.0, 1.0, 0.1);
m.show();
m.resize(2, 10);
m.show();
_2d_matrix m2 = m.transpose();
m2.show();
_1d_array a, a2;
m.export_array(a);
m2.export_array(a2);
a.show();
a2.show();
return 0;
}
catch(std::exception &e)
{
GCTL_ShowWhatError(e.what(), GCTL_ERROR_ERROR, 0, 0, 0);
}