Commit b51d7ca5 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

libpsdxx [FIX][FEATURE]: provide function sqrt; add all functions to library

parent 83073635
......@@ -73,12 +73,24 @@ $(call CHECKVARS,TF_BROWSER TF_WWWBASEDIR)
#
LIBHEADERS=debug.h error.h function_template_log_sampling.h psd.h helper.h
LIBCCSRC=dpsdcomputer_coherency.cc dpsdcomputer_cross_psd.cc \
dpsdcomputer_parameters.cc dpsdcomputer_processor.cc \
dpsdcomputer_psd.cc error.cc function_abs.cc function_arg.cc \
function_lin_frequency.cc function_log_frequency.cc \
function_log_sampling_c.cc function_log_sampling_r.cc \
log_index.cc log_taper.cc
LIBCCSRC= \
dpsdcomputer_coherency.cc \
dpsdcomputer_cross_psd.cc \
dpsdcomputer_parameters.cc \
dpsdcomputer_processor.cc \
dpsdcomputer_psd.cc \
error.cc \
function_abs.cc \
function_arg.cc \
function_conj.cc \
function_lin_frequency.cc \
function_log_frequency.cc \
function_log_sampling_c.cc \
function_log_sampling_r.cc \
function_sqrt.cc \
log_index.cc \
log_taper.cc \
testpsdxx.cc
INCINSTALLPATH=$(LOCINCLUDEDIR)/psdxx
LIBINSTALLPATH=$(LOCLIBDIR)
......
......@@ -34,6 +34,7 @@
"PSDXX_FUNCTION_CONJ_CC V1.0"
#include <psdxx/psd.h>
#include <aff/iterator.h>
namespace psd {
......
/*! \file function_sqrt.cc
* \brief return square root of real values in samples container (implementation)
*
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \date 07/02/2019
*
* return square root of real values in samples container (implementation)
*
* Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach)
*
* ----
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ----
*
* REVISIONS and CHANGES
* - 07/02/2019 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define PSDXX_FUNCTION_SQRT_CC_VERSION \
"PSDXX_FUNCTION_SQRT_CC V1.0"
#include <psdxx/psd.h>
#include <aff/iterator.h>
namespace psd {
TDseries sqrt(const TDseries::Tcoc& s)
{
TDseries retval(s.shape());
aff::Iterator<TDseries> S(retval);
aff::Browser<TDseries::Tcoc> C(s);
while(S.valid() && C.valid())
{
*S = std::sqrt(*C);
++S; ++C;
}
return(retval);
} // TDseries sqrt(const TDseries::Tcoc& s)
/* ---------------------------------------------------------------------- */
TDISeries sqrt(const TDISeries::Tcoc& s)
{
TDISeries retval;
retval.interval=s.interval;
retval.data=sqrt(s.data);
return(retval);
} // TDISeries sqrt(const TDISeries::Tcoc& s)
} // namespace psd
/* ----- END OF function_sqrt.cc ----- */
......@@ -146,6 +146,9 @@ namespace psd {
//! return complex conjugate values
TDCISeries conj(const TDCISeries::Tcoc& s);
//! return sqrt values
TDISeries sqrt(const TDISeries::Tcoc& s);
//! return absolute value (magnitude) of complex values
TDseries abs(const TDCseries::Tcoc& s);
......@@ -155,6 +158,9 @@ namespace psd {
//! return complex conjugate values
TDCseries conj(const TDCseries::Tcoc& s);
//! return sqrt values
TDseries sqrt(const TDseries::Tcoc& s);
/* ====================================================================== */
/*! \brief double precision function class for PSD computation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment