BlackCat_Tensors
A GPU-supported autograd and linear algebra library, designed for neural network construction
unary.h
Go to the documentation of this file.
1 /* Project: BlackCat_Tensors
2  * Author: JosephJaspers
3  * Copyright 2018
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 
9 #ifndef EXPRESSION_UNARY_FUNCTORS_H_
10 #define EXPRESSION_UNARY_FUNCTORS_H_
11 
12 #include <cmath>
13 #include "tags.h"
14 
15 namespace bc {
16 namespace oper {
17 
18 struct Negation {
19  template<class Value>
20  BCINLINE Value operator ()(Value value) const {
21  return -value;
22  }
23 
24  template<class Value>
25  BCINLINE static Value apply(Value value) {
26  return -value;
27  }
28 } negation;
29 
30 }
31 }
32 
33 #endif /* EXPRESSION_BINARY_FUNCTORS_H_ */
34 
#define BCINLINE
Definition: common.h:96
Definition: unary.h:18
BCINLINE Value operator()(Value value) const
Definition: unary.h:20
static BCINLINE Value apply(Value value)
Definition: unary.h:25
struct bc::oper::Negation negation
The Evaluator determines if an expression needs to be greedily optimized.
Definition: algorithms.h:22