Commit Graph

110 Commits

Author SHA1 Message Date
Gael Guennebaud
64fcfd314f Implement scalar multiples and division by a scalar as a binary-expression with a constant expression.
This slightly complexifies the type of the expressions and implies that we now have to distinguish between scalar*expr and expr*scalar to catch scalar-multiple expression (e.g., see BlasUtil.h), but this brings several advantages:
- it makes it clear on each side the scalar is applied,
- it clearly reflects that we are dealing with a binary-expression,
- the complexity of the type is hidden through macros defined at the end of Macros.h,
- distinguishing between "scalar op expr" and "expr op scalar" is important to support non commutative fields (like quaternions)
- "scalar op expr" is now fully equivalent to "ConstantExpr(scalar) op expr"
- scalar_multiple_op, scalar_quotient1_op and scalar_quotient2_op are not used anymore in officially supported modules (still used in Tensor)
2016-06-14 11:26:57 +02:00
Gael Guennebaud
66e99ab6a1 Relax mixing-type constraints for binary coefficient-wise operators:
- Replace internal::scalar_product_traits<A,B> by Eigen::ScalarBinaryOpTraits<A,B,OP>
- Remove the "functor_is_product_like" helper (was pretty ugly)
- Currently, OP is not used, but it is available to the user for fine grained tuning
- Currently, only the following operators have been generalized: *,/,+,-,=,*=,/=,+=,-=
- TODO: generalize all other binray operators (comparisons,pow,etc.)
- TODO: handle "scalar op array" operators (currently only * is handled)
- TODO: move the handling of the "void" scalar type to ScalarBinaryOpTraits
2016-06-06 15:11:41 +02:00
Eugene Brevdo
c53687dd14 Add randomized properties tests for betainc special function. 2016-06-05 11:10:30 -07:00
Eugene Brevdo
39baff850c Add TernaryFunctors and the betainc SpecialFunction.
TernaryFunctors and their executors allow operations on 3-tuples of inputs.
API fully implemented for Arrays and Tensors based on binary functors.

Ported the cephes betainc function (regularized incomplete beta
integral) to Eigen, with support for CPU and GPU, floats, doubles, and
half types.

Added unit tests in array.cpp and cxx11_tensor_cuda.cu


Collapsed revision
* Merged helper methods for betainc across floats and doubles.
* Added TensorGlobalFunctions with betainc().  Removed betainc() from TensorBase.
* Clean up CwiseTernaryOp checks, change igamma_helper to cephes_helper.
* betainc: merge incbcf and incbd into incbeta_cfe.  and more cleanup.
* Update TernaryOp and SpecialFunctions (betainc) based on review comments.
2016-06-02 17:04:19 -07:00
Gael Guennebaud
89099b0cf7 Expose log1p to Array. 2016-06-01 17:00:08 +02:00
Benoit Steiner
7aa5bc9558 Fixed a typo in the array.cpp test 2016-05-23 14:39:51 -07:00
Gael Guennebaud
1395056fc0 Make EIGEN_HAS_C99_MATH user configurable 2016-05-20 14:58:19 +02:00
Gael Guennebaud
8d6bd5691b polygamma is C99/C++11 only 2016-05-20 14:45:33 +02:00
Gael Guennebaud
ccb408ee6a Improve unit tests of zeta, polygamma, and digamma 2016-05-19 18:34:41 +02:00
Benoit Steiner
2d74ef9682 Avoid float to double conversion 2016-05-17 07:20:11 -07:00
Till Hoffmann
643b697649 Proper handling of domain errors. 2016-04-10 00:37:53 +01:00
Till Hoffmann
3cb0a237c1 Fixed suggestions by Eugene Brevdo. 2016-04-01 17:51:39 +01:00
Till Hoffmann
57239f4a81 Added polygamma function. 2016-04-01 14:35:21 +01:00
Till Hoffmann
dd5d390daf Added zeta function. 2016-04-01 13:32:29 +01:00
Eugene Brevdo
b1a9afe9a9 Add tests in array.cpp that check igamma/igammac properties.
This adds to the set of existing tests, which compare a specific
set of values to third party calculated ground truth.
2016-03-13 15:45:34 -07:00
Eugene Brevdo
0b9e0abc96 Make igamma and igammac work correctly.
This required replacing ::abs with std::abs.
Modified some unit tests.
2016-03-04 21:12:10 -08:00
Eugene Brevdo
7ea35bfa1c Initial implementation of igamma and igammac. 2016-03-03 19:39:41 -08:00
Eugene Brevdo
14897600b7 Protect digamma tests behind a EIGEN_HAS_C99_MATH check. 2015-12-24 21:28:18 -08:00
Eugene Brevdo
f7362772e3 Add digamma for CPU + CUDA. Includes tests. 2015-12-24 21:15:38 -08:00
Benoit Steiner
8314962ce2 Only test the lgamma, erf and erfc function when using a C99 compliant compiler 2015-12-10 13:13:45 -08:00
Eugene Brevdo
fa4f933c0f Add special functions to Eigen: lgamma, erf, erfc.
Includes CUDA support and unit tests.
2015-12-07 15:24:49 -08:00
Benoit Steiner
e25e3a041b Added rsqrt() method to the Array class: this method computes the coefficient-wise inverse square root much more efficiently than calling sqrt().inverse(). 2015-12-03 18:16:35 -08:00
Gael Guennebaud
3f32f5ec22 ArrayBase::sign: add unit test and fix doc 2015-11-27 16:27:53 +01:00
Gael Guennebaud
4a985e793c Workaround msvc broken complex/complex division in unit test 2015-11-20 14:52:08 +01:00
Gael Guennebaud
2e0ece7b66 Fix wrong casting syntax 2015-10-06 17:22:12 +02:00
Christoph Hertzberg
61e0977e10 Protect all calls to isnan, isinf and isfinite with parentheses. 2015-08-14 17:32:34 +02:00
Gael Guennebaud
6544b49e59 Generalize pow(x,e) such that x and e can be a different expression type or a scalar for either x or e. Add x.pow(e) with e an array expression. 2015-07-20 13:57:55 +02:00
Gael Guennebaud
3f49cf4c90 More msvc 2013/2015 workarounds 2015-06-26 09:07:53 +02:00
Gael Guennebaud
6b4d255cab Avoid division by a zero complex 2015-06-25 14:04:05 +02:00
Gael Guennebaud
84264ceebc workaround msvc 2013/2015 wrong instanciation of isnan, isfinite, isinf 2015-06-25 10:00:26 +02:00
Gael Guennebaud
9fc1c92137 Fix isinf unit tests 2015-06-22 16:48:27 +02:00
Gael Guennebaud
40f326ef2e workaround clang's broken complex division 2015-06-17 15:33:09 +02:00
Gael Guennebaud
b0d5aaafcc Rename free functions isFinite, isInf, isNaN to be compatible with c++11 2015-06-10 16:17:09 +02:00
Gael Guennebaud
25a98be948 bug #80: merge with d_hood branch on adding more coefficient-wise unary array functors 2015-06-10 15:52:05 +02:00
Christoph Hertzberg
494fa991c3 bug #872: Avoid deprecated binder1st/binder2nd usage by providing custom functors for comparison operators 2015-05-07 17:28:40 +02:00
Christoph Hertzberg
3be9f5c4d7 Constructing a Matrix/Array with implicit transpose could lead to memory leaks.
Also reduced code duplication for Matrix/Array constructors
2015-04-16 13:25:20 +02:00
Deanna Hood
085aa8e601 Don't use M_PI since it's only guaranteed to be defined in Eigen/Geometry 2015-04-08 13:59:18 -05:00
Deanna Hood
83e5b7656b Use M_PI instead of acos(-1) for pi 2015-03-22 06:04:31 +10:00
Deanna Hood
41b717de25 More extensive unit tests for recent array-wise functors 2015-03-18 03:11:03 +10:00
Deanna Hood
1c78d6f2a6 Add boolean not operator (!) array support 2015-03-17 08:29:57 +10:00
Deanna Hood
85da0c2281 Remove test of now-missing floor, ceil, round complex implementations 2015-03-17 06:56:47 +10:00
Deanna Hood
e1d6e6c972 Make cube, inverse and abs2 free-functions 2015-03-17 06:25:24 +10:00
Deanna Hood
fef4e071d7 Rename isinf to isInf 2015-03-17 05:58:47 +10:00
Deanna Hood
46cf9cda32 Add isfinite array support as isFinite 2015-03-17 04:33:12 +10:00
Deanna Hood
fb68b149cb Rename isnan to isNaN 2015-03-17 02:04:42 +10:00
Deanna Hood
f89fcefa79 Add hyperbolic trigonometric functions from std array support 2015-03-11 13:13:30 +10:00
Deanna Hood
a5e49976f5 Add log10 array support 2015-03-11 08:56:42 +10:00
Deanna Hood
19a71056ae Allow calling of square(array) in addition to array.square() 2015-03-11 06:59:28 +10:00
Deanna Hood
31fdd67756 Additional unary coeff-wise functors (isnan, round, arg, e.g.) 2015-03-11 06:39:23 +10:00
Gael Guennebaud
1b7e12847d Fix some calls to result_of on binary functors as unary ones. 2015-02-19 23:30:41 +01:00