Go to the documentation of this file.
23 #ifndef COM_DAFER45_TBTK_MATH_ARRAY_ALGORITHMS
24 #define COM_DAFER45_TBTK_MATH_ARRAY_ALGORITHMS
33 template<
typename DataType>
164 template<
typename T = DataType>
165 static typename std::enable_if<
166 !std::is_same<T, std::complex<double>>::value,
175 template<
typename T = DataType>
176 static typename std::enable_if<
177 std::is_same<T, std::complex<double>>::value,
187 template<
typename T = DataType>
188 static typename std::enable_if<
189 std::is_same<T, std::complex<double>>::value,
191 >::type
arg(
const Array<std::complex<double>> &array);
199 template<
typename T = DataType>
200 static typename std::enable_if<
201 std::is_same<T, std::complex<double>>::value,
203 >::type
real(
const Array<std::complex<double>> &array);
211 template<
typename T = DataType>
212 static typename std::enable_if<
213 std::is_same<T, std::complex<double>>::value,
215 >::type
imag(
const Array<std::complex<double>> &array);
222 template<
typename T = DataType>
223 static typename std::enable_if<
224 std::is_same<T, std::complex<double>>::value,
251 template<
typename DataType>
257 for(
unsigned int n = 0; n < array.
getSize(); n++)
258 resultData[n] = std::sin(arrayData[n]);
263 template<
typename DataType>
269 for(
unsigned int n = 0; n < array.
getSize(); n++)
270 resultData[n] = std::cos(arrayData[n]);
275 template<
typename DataType>
281 for(
unsigned int n = 0; n < array.
getSize(); n++)
282 resultData[n] = std::tan(arrayData[n]);
287 template<
typename DataType>
295 for(
unsigned int n = 0; n < array.
getSize(); n++)
296 resultData[n] = std::asin(arrayData[n]);
301 template<
typename DataType>
307 for(
unsigned int n = 0; n < array.
getSize(); n++)
308 resultData[n] = std::acos(arrayData[n]);
313 template<
typename DataType>
319 for(
unsigned int n = 0; n < array.
getSize(); n++)
320 resultData[n] = std::atan(arrayData[n]);
325 template<
typename DataType>
331 for(
unsigned int n = 0; n < array.
getSize(); n++)
332 resultData[n] = std::sinh(arrayData[n]);
337 template<
typename DataType>
343 for(
unsigned int n = 0; n < array.
getSize(); n++)
344 resultData[n] = std::cosh(arrayData[n]);
349 template<
typename DataType>
355 for(
unsigned int n = 0; n < array.
getSize(); n++)
356 resultData[n] = std::tanh(arrayData[n]);
361 template<
typename DataType>
367 for(
unsigned int n = 0; n < array.
getSize(); n++)
368 resultData[n] = std::asinh(arrayData[n]);
373 template<
typename DataType>
379 for(
unsigned int n = 0; n < array.
getSize(); n++)
380 resultData[n] = std::acosh(arrayData[n]);
385 template<
typename DataType>
391 for(
unsigned int n = 0; n < array.
getSize(); n++)
392 resultData[n] = std::atanh(arrayData[n]);
397 template<
typename DataType>
403 for(
unsigned int n = 0; n < array.
getSize(); n++)
404 resultData[n] = std::log(arrayData[n]);
409 template<
typename DataType>
415 for(
unsigned int n = 0; n < array.
getSize(); n++)
416 resultData[n] = std::log2(arrayData[n]);
421 template<
typename DataType>
427 for(
unsigned int n = 0; n < array.
getSize(); n++)
428 resultData[n] = std::log10(arrayData[n]);
433 template<
typename DataType>
442 for(
unsigned int n = 0; n < array.
getSize(); n++)
443 resultData[n] = std::pow(arrayData[n], exponent);
448 template<
typename DataType>
454 for(
unsigned int n = 0; n < array.
getSize(); n++)
455 resultData[n] = std::exp(arrayData[n]);
460 template<
typename DataType>
462 typename std::enable_if<
463 !std::is_same<T, std::complex<double>>::value,
470 for(
unsigned int n = 0; n < array.
getSize(); n++)
471 resultData[n] = std::abs(arrayData[n]);
476 template<
typename DataType>
478 typename std::enable_if<
479 std::is_same<T, std::complex<double>>::value,
486 for(
unsigned int n = 0; n < array.
getSize(); n++)
487 resultData[n] = std::abs(arrayData[n]);
492 template<
typename DataType>
494 typename std::enable_if<
495 std::is_same<T, std::complex<double>>::value,
499 CArray<double> &resultData = result.
getData();
500 const CArray<std::complex<double>> &arrayData = array.
getData();
502 for(
unsigned int n = 0; n < array.
getSize(); n++)
503 resultData[n] = std::arg(arrayData[n]);
508 template<
typename DataType>
510 typename std::enable_if<
511 std::is_same<T, std::complex<double>>::value,
515 CArray<double> &resultData = result.getData();
516 const CArray<std::complex<double>> &arrayData = array.
getData();
518 for(
unsigned int n = 0; n < array.
getSize(); n++)
519 resultData[n] = std::real(arrayData[n]);
524 template<
typename DataType>
526 typename std::enable_if<
527 std::is_same<T, std::complex<double>>::value,
531 CArray<double> &resultData = result.getData();
532 const CArray<std::complex<double>> &arrayData = array.
getData();
534 for(
unsigned int n = 0; n < array.
getSize(); n++)
535 resultData[n] = std::imag(arrayData[n]);
540 template<
typename DataType>
542 typename std::enable_if<
543 std::is_same<T, std::complex<double>>::value,
547 CArray<DataType> &resultData = result.getData();
548 const CArray<DataType> &arrayData = array.getData();
550 for(
unsigned int n = 0; n < array.getSize(); n++)
551 resultData[n] = std::conj(arrayData[n]);
556 template<
typename DataType>
562 for(
unsigned int n = 0; n < array.
getSize(); n++)
563 resultData[n] = std::sqrt(arrayData[n]);
568 template<
typename DataType>
571 DataType maximum = arrayData[0];
572 for(
unsigned int n = 1; n < array.
getSize(); n++)
573 if(maximum < arrayData[n])
574 maximum = arrayData[n];
579 template<
typename DataType>
582 DataType minimum = arrayData[0];
583 for(
unsigned int n = 1; n < array.
getSize(); n++)
584 if(minimum > arrayData[n])
585 minimum = arrayData[n];
595 template<
typename DataType>
605 template<
typename DataType>
615 template<
typename DataType>
625 template<
typename DataType>
635 template<
typename DataType>
645 template<
typename DataType>
655 template<
typename DataType>
665 template<
typename DataType>
675 template<
typename DataType>
685 template<
typename DataType>
695 template<
typename DataType>
705 template<
typename DataType>
715 template<
typename DataType>
725 template<
typename DataType>
735 template<
typename DataType>
746 template<
typename DataType>
756 template<
typename DataType>
766 template<
typename DataType>
767 typename std::enable_if<
768 !std::is_same<DataType, std::complex<double>>::value,
779 template<
typename DataType>
780 typename std::enable_if<
781 std::is_same<DataType, std::complex<double>>::value,
830 template<
typename DataType>
840 template<
typename DataType>
850 template<
typename DataType>
Array< double > real(const Array< std::complex< double >> &array)
Definition: ArrayAlgorithms.h:802
Multi-dimensional array.
Definition: Array.h:98
static Array< DataType > acosh(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:374
Array< DataType > sinh(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:656
static Array< DataType > cosh(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:338
static Array< DataType > acos(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:302
CArray< DataType > & getData()
Definition: Array.h:1281
static std::enable_if< std::is_same< T, std::complex< double > >::value, Array< double > >::type arg(const Array< std::complex< double >> &array)
Container for a C style array.
Definition: CArray.h:44
Array< DataType > atan(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:646
static std::enable_if< !std::is_same< T, std::complex< double > >::value, Array< DataType > >::type abs(const Array< DataType > &array)
static Array< DataType > log2(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:410
static Array< DataType > log(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:398
static Array< DataType > sin(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:252
DataType * getData()
Definition: CArray.h:303
static Array< DataType > log10(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:422
static Array< DataType > sinh(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:326
Array< DataType > tan(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:616
DataType max(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:841
Array< DataType > asin(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:626
static std::enable_if< std::is_same< T, std::complex< double > >::value, Array< DataType > >::type conj(const Array< DataType > &array)
static Array< DataType > tan(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:276
static Array< DataType > cos(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:264
DataType min(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:851
std::enable_if< !std::is_same< DataType, std::complex< double > >::value, Array< DataType >>::type abs(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:770
Array< DataType > pow(const Array< DataType > &array, double exponent)
Definition: ArrayAlgorithms.h:747
Array< DataType > atanh(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:706
static Array< DataType > atan(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:314
static Array< DataType > atanh(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:386
Array< DataType > sqrt(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:831
Array< std::complex< double > > conj(const Array< std::complex< double >> &array)
Definition: ArrayAlgorithms.h:821
Array< DataType > tanh(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:676
static Array< DataType > sqrt(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:557
Array< DataType > cos(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:606
unsigned int getSize() const
Definition: Array.h:1291
const std::vector< unsigned int > & getRanges() const
Definition: Array.h:1228
static std::enable_if< std::is_same< T, std::complex< double > >::value, Array< double > >::type imag(const Array< std::complex< double >> &array)
Array< DataType > acos(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:636
Array< double > imag(const Array< std::complex< double >> &array)
Definition: ArrayAlgorithms.h:812
Array< DataType > log10(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:736
static DataType max(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:569
static std::enable_if< std::is_same< T, std::complex< double > >::value, Array< double > >::type real(const Array< std::complex< double >> &array)
Array< DataType > cosh(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:666
static Array< DataType > pow(const Array< DataType > &array, double exponent)
Definition: ArrayAlgorithms.h:434
Array< DataType > acosh(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:696
Array< DataType > sin(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:596
static Array< DataType > asin(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:288
Array< DataType > asinh(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:686
static DataType min(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:580
Array< DataType > exp(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:757
Array< DataType > log2(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:726
static Array< DataType > asinh(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:362
Definition: ArrayAlgorithms.h:34
static Array create(const std::vector< unsigned int > &ranges)
Definition: Array.h:585
static Array< DataType > tanh(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:350
Array< double > arg(const Array< std::complex< double >> &array)
Definition: ArrayAlgorithms.h:792
static Array< DataType > exp(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:449
Array< DataType > log(const Array< DataType > &array)
Definition: ArrayAlgorithms.h:716