stackoverflow:c++ template template
#include <iostream>
#include <vector>
#include <list>
#include <iterator>
#include <algorithm>
template <template<class, class...> class H, class T>
void f(const H<T> &value) {
std::copy(value.begin(), value.end(), std::ostream_iterator<T>(std::cout, " "));
std::cout << "generic implementationn";
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
//https ...
c++ enum class -- scoped and strongly typed enums
enum class
- enumerator names are local to the enum
- their values do not implicitly convert to other types
- the underlying type of an enum can be specified.
plain enum
- enumerator names are in the same scope as the enum, causing name clashes.
- their values implicitly convert to intergers and other ...
Python argument expansion
-
* operator: positional argument expansion
for a list, expand to function call argument list -
** operator: keyword argument expansion for a dictionary, expand to function call keyword argument list
def add(a, b):
print a+b
a = [1, 2]
kwargs={'b':1, 'a': 1}
add(*a)
add(**kwargs)
def add(a, *args ...
Epislon
machine epsilon
https://en.wikipedia.org/wiki/Machine_epsilon
epsilon-delta defintion of limit
https://en.wikipedia.org/wiki/(%CE%B5,_%CE%B4)-definition_of_limit
Pointer to Implementation idiom
Keywords
- Reduce compilation dependency
- pointer to implementation, smart pointer
- forward declaration
- incomplete type
- constness forwarding
Reference:
Template dependent name
https://en.cppreference.com/w/cpp/language/dependent_name
https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords
python list slicing
一个很好的总结:
stackoverflow: Understanding slice notation
a[start:end:step] # items from start through stop - 1. a[stop] not included.
当step为负数的时候,算法跟之前一样,[start, start+step, start+step+step, ..., end)
Energy function/loss function
energy function
https://en.wikipedia.org/wiki/Energy_functional
https://stackoverflow.com/questions/50342526/what-is-the-difference-between-energy-function-and-loss-function
objective function
cost function
loss function
https://en.wikipedia.org/wiki/Loss_function
likelihood function
In statistics, the likelihood function (often simply called likelihood) expresses how likely particular values of statistical parameters are for a given set ...
c++ type sepcifier, modifier, qualifier
type modifier
A modifier is used to alter the meaning of the base type so that it more
precisely fits the needs of various situations.
* size
* sign
access modifier
- private
- public
- protected
qualifier
The type qualifiers provide additional information about the variables they precede.
* const
* volatile
* restrict
type specifier
- friend ...
c++ term
closure
free varialbe
first order function
callable object
* function object, functor
A function object (or functor) is simply any object of a class that provides at least one definition for operator() What this means is that if you then declare an object f of the class in which this operator ...
近期评论