示例#1
0
    def _():
        v0 = qy.select(True, 3, 4)
        v1 = qy.select(False, 3, 4)

        @qy.python(v0, v1)
        def _(v0_py, v1_py):
            result[0] = v0_py
            result[1] = v1_py
示例#2
0
    def ll(self, parameter, sample, out):
        """
        Compute constant-distribution log-likelihood.
        """

        qy.select(
            parameter.data.load() == sample.data.load(),
            0.0,
            numpy.finfo(float).min,
            ) \
        .store(out)
示例#3
0
        def log_add_d(x_in, y_in):
            s = x_in >= y_in
            a = qy.select(s, x_in, y_in)

            @qy.if_else(a == -numpy.inf)
            def _(then):
                if then:
                    qy.return_(-numpy.inf)
                else:
                    qy.return_(a + qy.log1p(qy.exp(qy.select(s, y_in, x_in) - a)))
示例#4
0
        def log_add_d(x_in, y_in):
            s = x_in >= y_in
            a = qy.select(s, x_in, y_in)

            @qy.if_else(a == -numpy.inf)
            def _(then):
                if then:
                    qy.return_(-numpy.inf)
                else:
                    qy.return_(a +
                               qy.log1p(qy.exp(qy.select(s, y_in, x_in) - a)))
示例#5
0
 def _(then):
     if then:
         qy.return_(-numpy.inf)
     else:
         qy.return_(a +
                    qy.log1p(qy.exp(qy.select(s, y_in, x_in) - a)))
示例#6
0
文件: real.py 项目: bsilverthorn/qy
    def __abs__(self):
        """
        Return the absolute value of this value.
        """

        return qy.select(self > 0.0, self, -self)
示例#7
0
 def _():
     qy.return_(qy.select(k == n, 0.0, -numpy.inf))
示例#8
0
 def _(then):
     if then:
         qy.return_(-numpy.inf)
     else:
         qy.return_(a + qy.log1p(qy.exp(qy.select(s, y_in, x_in) - a)))
示例#9
0
 def _():
     qy.return_(qy.select(k == n, 0.0, -numpy.inf))