C++QEDCore  v2 Milestone 10
a framework for simulating open quantum dynamics – core
BlitzArrayExtensions.h
Go to the documentation of this file.
1 // Copyright András Vukics 2006–2014. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
2 // -*- C++ -*-
4 #ifndef CPPQEDCORE_UTILS_BLITZARRAYEXTENSIONS_H_INCLUDED
5 #define CPPQEDCORE_UTILS_BLITZARRAYEXTENSIONS_H_INCLUDED
6 
7 #include "Exception.h"
8 
9 #include <blitz/array.h>
10 
11 #include <boost/math/special_functions/fpclassify.hpp>
12 
13 
15 namespace blitzplusplus {
16 
17 inline bool isfinite(double d) {return boost::math::isfinite(d);}
18 
19 BZ_DECLARE_FUNCTION_RET(isfinite,bool) ;
20 
21 
22 inline double selectNegative(double d) {return d<0 ? d : 0;}
23 
24 BZ_DECLARE_FUNCTION_RET(selectNegative,double) ;
25 
26 
29 
30 
32 
46 template<typename T, int RANK>
47 const blitz::Array<T,1>
48 unaryArray(const blitz::Array<T,RANK>&);
49 
50 
53 
54 
56 
71 template<typename T, int TWO_TIMES_RANK>
72 const blitz::Array<T,2>
73 binaryArray(const blitz::Array<T,TWO_TIMES_RANK>& array);
74 
75 
76 } // blitzplusplus
77 
78 
79 #endif // CPPQEDCORE_UTILS_BLITZARRAYEXTENSIONS_H_INCLUDED
The class that is (meant to be, at least) the base of all exceptions in the framework.
Definition: Exception.h:18
const blitz::Array< T, 2 > binaryArray(const blitz::Array< T, TWO_TIMES_RANK > &array)
Returns a binary view of array. TWO_TIMES_RANK must be an even number.
Exception class thrown by binaryArray.
const blitz::Array< T, 1 > unaryArray(const blitz::Array< T, RANK > &)
Returns a unary view of array
Exception class thrown by unaryArray & binaryArray.
Comprises our own extensions to Blitz++.
Defines tentative base classes for the exception classes of the framework.