|
MsPASS C++ API
2.4.1.dev4+g92330b7a
Defines the C++ API for MsPASS
|
Interfacing object to ease conversion between FORTRAN and C++ complex. More...
#include <ComplexArray.h>
Public Member Functions | |
| ComplexArray () | |
| ComplexArray (std::vector< Complex64 > &d) | |
| ComplexArray (std::vector< Complex32 > &d) | |
| ComplexArray (int nsamp, FortranComplex32 *d) | |
| ComplexArray (int nsamp, FortranComplex64 *d) | |
| ComplexArray (int nsamp, float *d) | |
| ComplexArray (int nsamp, double *d) | |
| ComplexArray (int nsamp) | |
| template<class T > | |
| ComplexArray (int nsamp, std::vector< T > d) | |
| template<class T > | |
| ComplexArray (int nsamp, T d) | |
| ComplexArray (std::vector< double > mag, std::vector< double > phase) | |
| ComplexArray (const ComplexArray &parent) | |
| ComplexArray & | operator= (const ComplexArray &parent) |
| ~ComplexArray () | |
| Complex64 | operator[] (int sample) |
| double * | ptr () |
| double * | ptr (int sample) |
| ComplexArray & | operator+= (const ComplexArray &other) noexcept(false) |
| ComplexArray & | operator-= (const ComplexArray &other) noexcept(false) |
| ComplexArray & | operator*= (const ComplexArray &other) noexcept(false) |
| ComplexArray & | operator/= (const ComplexArray &other) noexcept(false) |
| const ComplexArray | operator+ (const ComplexArray &other) const noexcept(false) |
| const ComplexArray | operator- (const ComplexArray &other) const noexcept(false) |
| const ComplexArray | operator* (const ComplexArray &other) const noexcept(false) |
| const ComplexArray | operator/ (const ComplexArray &other) const noexcept(false) |
| void | conj () |
| std::vector< double > | abs () const |
| double | rms () const |
| double | norm2 () const |
| std::vector< double > | phase () const |
| int | size () const |
Interfacing object to ease conversion between FORTRAN and C++ complex.
The internal representation is compatible with numerical libraries that expect interleaved real and imaginary values while exposing C++ convenience operators.
| mspass::algorithms::deconvolution::ComplexArray::ComplexArray | ( | ) |
Empty constructor.
| mspass::algorithms::deconvolution::ComplexArray::ComplexArray | ( | std::vector< Complex64 > & | d | ) |
Construct from stl vector container of complex.
| mspass::algorithms::deconvolution::ComplexArray::ComplexArray | ( | std::vector< Complex32 > & | d | ) |
Similar for 32 bit version
| mspass::algorithms::deconvolution::ComplexArray::ComplexArray | ( | int | nsamp, |
| FortranComplex32 * | d | ||
| ) |
Construct from a FORTRAN data array.
Fortran stores complex numbers in a mulitplexed array structure (real(1), imag(1), real(2), imag(2), etc.). The constructors below provide a mechanism for building this object from various permutations of this.
| nsamp | is the number of elements in the C vector |
| d | is the pointer to the first compoment of the fortran vector. |
References mspass::algorithms::deconvolution::FortranComplex32::imag, and mspass::algorithms::deconvolution::FortranComplex32::real.
| mspass::algorithms::deconvolution::ComplexArray::ComplexArray | ( | int | nsamp, |
| FortranComplex64 * | d | ||
| ) |
Construct from a double-precision FORTRAN complex array.
References mspass::algorithms::deconvolution::FortranComplex64::imag, and mspass::algorithms::deconvolution::FortranComplex64::real.
| mspass::algorithms::deconvolution::ComplexArray::ComplexArray | ( | int | nsamp, |
| float * | d | ||
| ) |
Construct from a real single-precision array.
| mspass::algorithms::deconvolution::ComplexArray::ComplexArray | ( | int | nsamp, |
| double * | d | ||
| ) |
Construct from a real double-precision array.
| mspass::algorithms::deconvolution::ComplexArray::ComplexArray | ( | int | nsamp | ) |
Construct a zero-filled complex array of length nsamp.
| mspass::algorithms::deconvolution::ComplexArray::ComplexArray | ( | int | nsamp, |
| std::vector< T > | d | ||
| ) |
Construct from different length of vector, adds zoeros to it And construct a constant arrays
| mspass::algorithms::deconvolution::ComplexArray::ComplexArray | ( | int | nsamp, |
| T | d | ||
| ) |
Construct a constant real-valued complex array of length nsamp.
| mspass::algorithms::deconvolution::ComplexArray::ComplexArray | ( | std::vector< double > | mag, |
| std::vector< double > | phase | ||
| ) |
Construct from magnitude and phase arrays.
References phase().
| mspass::algorithms::deconvolution::ComplexArray::ComplexArray | ( | const ComplexArray & | parent | ) |
Copy constructor.
| mspass::algorithms::deconvolution::ComplexArray::~ComplexArray | ( | ) |
Destructor.
| vector< double > mspass::algorithms::deconvolution::ComplexArray::abs | ( | ) | const |
Return stl vector of amplitude spectrum.
| void mspass::algorithms::deconvolution::ComplexArray::conj | ( | ) |
product of complex and real vectors
product of complex and a number
Change vector to complex conjugates.
| double mspass::algorithms::deconvolution::ComplexArray::norm2 | ( | ) | const |
Return 2-norm value.
| const ComplexArray mspass::algorithms::deconvolution::ComplexArray::operator* | ( | const ComplexArray & | other | ) | const |
Return the element-by-element product with another complex array.
| ComplexArray & mspass::algorithms::deconvolution::ComplexArray::operator*= | ( | const ComplexArray & | other | ) |
Multiply by another complex array element by element.
| const ComplexArray mspass::algorithms::deconvolution::ComplexArray::operator+ | ( | const ComplexArray & | other | ) | const |
Return the element-by-element sum with another complex array.
| ComplexArray & mspass::algorithms::deconvolution::ComplexArray::operator+= | ( | const ComplexArray & | other | ) |
Add another complex array element by element.
| const ComplexArray mspass::algorithms::deconvolution::ComplexArray::operator- | ( | const ComplexArray & | other | ) | const |
Return the element-by-element difference from another complex array.
| ComplexArray & mspass::algorithms::deconvolution::ComplexArray::operator-= | ( | const ComplexArray & | other | ) |
Subtract another complex array element by element.
| const ComplexArray mspass::algorithms::deconvolution::ComplexArray::operator/ | ( | const ComplexArray & | other | ) | const |
Return the element-by-element quotient with another complex array.
| ComplexArray & mspass::algorithms::deconvolution::ComplexArray::operator/= | ( | const ComplexArray & | other | ) |
Divide by another complex array element by element.
| ComplexArray & mspass::algorithms::deconvolution::ComplexArray::operator= | ( | const ComplexArray & | parent | ) |
Assignment operator.
| Complex64 mspass::algorithms::deconvolution::ComplexArray::operator[] | ( | int | sample | ) |
Return a pointer to a fortran array containing the data vector.
The array linked to the returned pointer should be created with the new operator and the caller should be sure to use delete [] to free this memory when finished.
Index operator. Cannot make it work by getting the address from reference. Have to call the ptr() function to get the address.
| sample | is the sample number to return. |
| vector< double > mspass::algorithms::deconvolution::ComplexArray::phase | ( | ) | const |
Return stl vector of phase values.
| double * mspass::algorithms::deconvolution::ComplexArray::ptr | ( | ) |
Return a pointer to the first interleaved complex value.
| double * mspass::algorithms::deconvolution::ComplexArray::ptr | ( | int | sample | ) |
Return a pointer to the interleaved complex value at sample.
| double mspass::algorithms::deconvolution::ComplexArray::rms | ( | ) | const |
Return rms value.
| int mspass::algorithms::deconvolution::ComplexArray::size | ( | ) | const |
Return size of the array.