亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bayesys3.c

?? 貝葉斯算法:盲分離技術
?? C
?? 第 1 頁 / 共 5 頁
字號:
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//             Bayesian Inference
// 
// Filename:   bayesys3.c
//
// Purpose:    Obtain sample objects from posterior atomic distribution.
//
// Dedication: To my intellectual ancestors  the late Edwin T Jaynes,  and
//             Steve Gull, to my descendant Sibusiso Sibisi,  and the many
//             colleagues and friends  over the  past quarter-century  who
//             have inspired and encouraged the development of these ideas.
//
//             John Skilling, Kenmare, Ireland, November 2003
//             email: skilling@eircom.net
//=============================================================================
/*
    Copyright (c) 1999-2003 Maximum Entropy Data Consultants Ltd,
                            114c Milton Road, Cambridge CB4 1XE, England

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#include "license.txt"
*/
//=============================================================================
//
//  An OBJECT is a combination of a-priori-equivalent "atoms":
//  statisticians call this construction a "mixture model".
// 
//  ATOMS
//  The number of atoms N in an object can range from MIN to MAX.
//  MIN >= 1 is required to avoid the algorithmically special null object N=0.
//  Generally, MAX >= MIN is required (with MAX=MIN allowed), but
//  MAX=infinity (absence of limit) can be specified with MAX=0.
//  [ Technically, this coding allows at most 1 atom per identifiable
//    location, so "infinity" means #(locations), perhaps 2^32 . ]
//
//  There are three standard priors Pr(N), selected by sign(Alpha).
//  Alpha = 0.
//      The prior is UNIFORM in MIN <= N <= MAX (and MAX must be finite).
//  Alpha > 0.
//      The prior is POISSON or BINOMIAL.
//      N  ~  Alpha +- sqrt(Alpha), subject to MIN and MAX
//  Alpha < 0.
//      The prior is GEOMETRIC.
//      N  ~  |Alpha| +- |Alpha|, subject to MIN and MAX
//
//  COORDINATES
//  The BayeSys prior for locating an atom in space is flat over the hypercube
//  (0,1)^Ndim  of dimension  Ndim .  In fact, the hypercube is treated as
//  wraparound-continuous, so is more properly described as a "hyper-torus".
//  BayeSys gives you coordinate vectors "double Cube[Ndim]" with values in
//  (0,1), but you can transform these into other "Coord" if you wish.
//  
//  The BayeShape procedure lets you modify some or all of your coordinates
//  into nine alternative configurations:
//
//   Shape  Description           Prob(Coord[i])                    Range of i
//
//     0   Permutation         uniform on integers Perm(0...N-1)     0...N-1
//     1   +ve orthant         exp(-x) in x > 0                      0...N-1
//     2   Simplex volume      uniform in SUM(x) < 1                 0...N-1
//     3   Simplex surface     uniform on SUM(x) = 1                  0...N
//     4   Ordered             uniform in 0 < x[0] < x[1] < ... < 1  0...N-1
//     5   Bell                Normal(0,1) in -inf < x < inf         0...N-1
//     6   Sphere volume       uniform in SUM(x^2) < 1               0...N-1
//     7   Hemisphere surface  uniform on SUM(x^2) = 1, x[N]>0        0...N
//     8   Sphere surface      uniform on SUM(x^2) = 1                0...N
//
//  For the interior of an awkward shape, allow a circumscribing volume,
//  but return the value 0 from UserTry1 and UserTry2 (instead of the
//  usual positive acceptance code) for any location outside the shape.
//  The ensemble will keep within the domain, because BayeSys only accepts
//  points for which you give strictly positive return codes.
//
//  Thus the unit disc  x^2 + y^2 < 1 could be programmed in several ways:
// (a) Use BayeShape with Shape=6 which gives the N=2 disc interior directly.
// (b) Use N=2 hypercube (= unit square) but expand it to (-1,1) by setting
//        x = 2*Cube[0] - 1,  y = 2*Cube[1] - 1
//     and reject any point outside the disc by returning 0 from UserTry1
//     and UserTry2.
// (c) Use hypercube to yield a unit square, but spread the prior measure
//     uniformly through the unit disc with your own transformation, e.g.
//        radius^2 = Cube[0],  angle = 2 PI Cube[1] .
//
//  FLUXES
//  The Ndim coordinates can be supplemented by  Valency  intensities or
//  "fluxes" z, being attributes for which the joint distribution
//                  Prior(z).Likelihood(D|z,...)
//  is integrable and can be sampled from.
//  The MassInf library incorporated in BayeSys provides Flux procedures for
//  its priors and linear data.
//
//  DISPLAY 
//  The coordinates and intensities are supplemented by a guidance width, being
//      log(fraction of hypercube volume that atom might plausibly range over).
//  This may help you to produce smooth displays from the atomic objects.
//
//  The number of atoms in an object is supplied to you as Natoms and
//  each atom's attributes are supplied to you consecutively as
//    double Cube[ 0,1,...,Ndim-1,  Ndim,...,Ndim+Valency-1,  Ndim+Valency ]
//              coordinates in (0,1)     intensities            log(width)
//=============================================================================
//
//  ENSEMBLE
//  The program uses an ensemble of sample objects.  Using several objects is
//  usually recommended, partly because objects that seem to be getting stuck
//  are overwritten by more successful ones which reduces the risk of failure,
//  and partly because the geometrical exploration engines only work with
//  several objects.
//
//=============================================================================
//
//  METHOD
//  Internally in the program, hypercube coordinates are mapped to an
//  extended-integer label whose range fills the hypercube but which preserves
//  a degree of locality: small changes in this integer will necessarily
//  correspond to small changes in coordinates.  
//  The user can use the Method parameter to control the style of this mapping,
//  and the operation of the various internal engines that control the 
//  evolution of the ensemble.
//
//     Method = 0    is the simplest algorithm, mapping hypercube coordinates
//                   onto extended-integer position labels by simple raster,
//                   and using the "LifeStory1" diffusion engine to create,
//                   destroy, and move atoms.
//                   This is very likely to be enhanced by switching on
//                   various bits of the Method integer.
//
// if( Method & 1 ), hypercube coordinates are mapped to position labels along
//                   a space-filling Hilbert curve.
//                   This is generally recommended, but unnecessary if Ndim=1.
//
// if( Method & 2 ), the "LifeStory" diffusion engine will include interactions
//                   with atoms' neighbours, otherwise not.
//                   This is generally recommended for its extra power.
//
// if( Method & 4 ), the algorithm includes the Chameleon1 engine, which lets
//                   atoms jump from one ensemble object to another, without
//                   changing position.
//                   This is ineffective if there is only one ensemble object.
//
// if( Method & 8 ), the algorithm includes the Chameleon2 engine, which lets
//                   atoms from different ensemble objects exchange position. 
//                   This is ineffective if there is only one ensemble object.
//
// if( Method & 16), the algorithm will include the Leapfrog1 engine, which
//                   inverts atom positions with respect to another atom from
//                   the same or a different ensemble object.
//                   This is designed to assist when the posterior distribution
//                   in more than one dimension is highly non-spherical.
//
// if( Method & 32), the algorithm will include the Leapfrog2 engine, which
//                   reflects atom positions with respect to two other atoms
//                   from the same or different ensemble objects.
//                   This is designed to assist when the posterior distribution
//                   in more than one dimension is highly non-spherical.
//
// if( Method & 64), the algorithm will include the GuidedWalk engine, which
//                   moves atoms along directions parallel to displacements
//                   between neighbours, thus following the local shape of
//                   the posterior distribution.
//                   This may supersede the Leapfrog engines.
//
//  ________________________________________________________________________
// |                                                                        |
// | GuidedWalk Leapfrog2 Leapfrog1 Chameleon2 Chameleon1 LifeStory2 Hilbert| 1
// |    off        off       off       off       off      LifeStory1 raster | 0
// |________________________________________________________________________|
//       64        32        16         8         4          2         1 Method
//
//  In the interest of overall efficiency, the algorithm tries to equalise the
//  computation time between its engines so that even if all the optional
//  engines did nothing, the computation cost of including them would be
//  limited to the number of engines (currently a factor of 6).
//
//  Author generally recommends switching everything in by
//                   Method = 127 (equivalently -1) .
//  
//=============================================================================
//
// The "Massive Inference" (MassInf) option is provided for applications where
// atoms have intensities or "fluxes" about which the data are linear.
//
// The PRIOR for the number of atoms and for their location is as for BayeSys3.
//
// Prior on flux z of atom is Pr(z) = ProbON * P(z) + (1 - ProbON) * delta(z) ,
// i.e. each flux is expected to be distributed as P(z) with probability ProbON
//      otherwise it is switched off with zero value.
// Common->ProbON supplies ProbON, and the "units" decimal digit of the switch
// Common->MassInf defines the shape P(z) of the prior according to
//
// (0) "monkeys"              P(z) = delta(z-q),   i.e. z = q = constant
//                     
// (1) "positive"             P(z) = exp(-z/q) / q    in z > 0
//    
// (2) "positive/negative"    P(z) = exp(-|z|/q) / 2q
//                                         2     2               2
// (3) "Gaussian"             P(z) = exp(-z / 2 q ) / sqrt(2 pi q )
//
// When flux can be positive or negative, the "positive/negative" prior is
// more tolerant of dynamic range than is the Gaussian prior.
// In each case the flux unit q is fixed at the positive value supplied
// in Common->FluxUnit0, or (if <= 0) kept close to its most probable value.
//
// An atom can have Valency (=1,2,...) independent fluxes, provided
// (a) all atoms have the same valency,
// (b) the flux unit is the same for each,
// (c) the mock-data footprints of the different valencies of an atom
//     do not overlap (no common cells), and
// (d) (if using LifeStory2 engine) for any pair of atoms, each footprint
//     of one overlaps no more than one valency footprint of the other.
//
//
// To specify the LIKELIHOOD (used as its log), define
//
//                    f     = object = sum of atoms
//
//                    x[j]  = positional coordinate of atom j
//
//                    z[j]  = flux(es) of atom j
//
//                    Footprint(x) = mock data from unit flux at x
//
//                    Mock  = SUM[j] z[j] Footprint(x[j]) = mock data of object
//
// Likeliood Pr(Data | f) can be one of
//
// (0xx) "chisquared", derived from
//
//                    Data  = signal,
//
//                    Acc   = 1/sigma, can be 0,   (sigma = standard deviation)
//
//                    M     = # measured data, for which Acc[k] > 0.
//                               M                         2
//                    Z     = PRODUCT[k] sqrt(2 PI sigma[k] )
//                                                      2          2
//                    Chisq = SUM[k] (Mock[k] - Data[k]) / sigma[k]
//                                    -1   -Chisq / 2
//                    Pr(Data | f) = Z    e
//
// (1xx) "Poisson", for positive problems with "monkey" or "positive" prior;
//
//                    Data  = counts, can be floating-point but must be >= 0.0
//
//                    Acc   = extraneous "background", which may be small but
//                            must be strictly +ve wherever Data > 0.0
//                                               -F[k]     D[k]
//                    Pr(Data | f) = PRODUCT[k] e      F[k]    / D[k]!
//
//                    where  F = Mock + Acc, D = Data + Acc,  x! = GAMMA(x+1) :
//                    this form of likelihood avoids singularity when active
//                    cells happen to be empty of mock data, and reduces to
//                    standard Poisson when the background -> 0
//
// according to the "hundreds" digit of the switch Common->MassInf.
//
// For example, Common->MassInf =  1  is Gaussian data with "positive" prior;
//              Common->MassInf = 101  is Poisson data with "positive" prior.
//=============================================================================
// History:
// MassInf1 v1.12-2.36  1998-2000
// BayeSys1 code        1999-2000
// BayeSys2 v1.02-1.05  1 May - 10 Sep 2001
// BayeSys3 v1.01-1.32  2 Jan 2002 - 4 Feb 2003
//          v2.00      10 Feb 2003
//          v2.01      11 Jul 2003  Fixed-q0 option to fix FluxUnit0 in MassInf
//          v2.02      19 Jul 2003  MassInf options extended to allow flux=0
//          v2.10      12 Aug 2003  MassInf needs FluxUnit0 from user
//          v2.20      14 Aug 2003  Remove any overlay in MassInf user's "bits"
//          v3.00      20 Aug 2003  Poisson data as MassInf option
//          v3.01      12 Sep 2003  MassInf control of flux=0 by ProbON
//          v3.02      18 Sep 2003  BayeShape coordinate options
//          v3.03      11 Oct 2003  "Hilbert" name used instead of Peano
//          v3.04      20 Oct 2003  Display width of atom roughy halved
//          v3.05      27 Oct 2003  BayeShape permutation option
//          v3.10      29 Nov 2003  Free software under GNU LGPL
//          v3.11       3 Feb 2004  Control uses <#copies>.  Better Evid & Info
//-----------------------------------------------------------------------------
// 
#include <stdlib.h>
#include <float.h>
#include <math.h>
#include "bayesys3.h"
#include "random.h"
#include "hilbert.h"

#undef  PARALLEL
#define PARALLEL 0   // # slaved parallel processors [0 = none]
#undef  DEBUG
#define DEBUG    0   // check Cube/Link consistency  [0 = off]

/***********************/
/* Internal structures */
/***********************/
typedef struct
{
    int            i;        // 1st object
    int            j;        // [2nd object]
    int            k;        // [3rd object]
    signed char    engine;   // operation type
    signed char    iType;    // type of 1st object, -1=WRITE, 0=Unused, 1=read
    signed char    jType;    // type of 2nd object, -1=WRITE, 0=Unused, 1=read

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品一区二区三区很污很色的 | 国产乱码精品一区二区三区五月婷| 欧美系列在线观看| 午夜亚洲福利老司机| 日韩一级免费一区| 国产成人小视频| 亚洲一区二区视频| 91麻豆精品国产91久久久久久久久| 蜜臀av性久久久久av蜜臀妖精| 精品对白一区国产伦| 日韩欧美国产三级| 欧美性一区二区| 欧美裸体一区二区三区| 99精品国产视频| 日本不卡免费在线视频| 亚洲视频资源在线| 91精品免费在线观看| 日韩欧美电影一二三| 久久久91精品国产一区二区精品 | 成人av资源站| 毛片av一区二区| 国产一区在线看| 午夜精品久久久久久久99水蜜桃 | 91美女片黄在线| 国产美女精品在线| 99在线精品一区二区三区| 久久激五月天综合精品| 亚洲电影一级片| 日韩理论片一区二区| 亚洲图片欧美色图| 亚洲卡通欧美制服中文| 久久精品人人做| 一区二区三区91| 亚洲乱码精品一二三四区日韩在线| 亚洲国产日韩a在线播放性色| 日韩成人午夜精品| 日韩精品三区四区| 日日夜夜精品视频免费| 国产精品一区二区免费不卡| 在线免费观看日本欧美| 97久久精品人人做人人爽50路| 欧美日韩国产美| 91麻豆精品国产91久久久使用方法| 久久精品一级爱片| 日韩精品一二区| 粉嫩蜜臀av国产精品网站| 国产精品99久久久久久久女警| 欧美熟乱第一页| 国产精品欧美极品| 国产精品久久毛片av大全日韩| 国产精品视频第一区| 日韩电影在线观看网站| 99久久久久久| 国产婷婷色一区二区三区四区 | 欧美成人一区二区三区在线观看| 欧美精品久久99| 国产精品福利一区二区三区| 精品一区二区三区在线播放视频 | 国产午夜精品理论片a级大结局| 夜色激情一区二区| 欧美理论在线播放| 亚洲日本丝袜连裤袜办公室| 国产成人免费9x9x人网站视频| 欧美精品777| 一个色在线综合| 色综合久久久久综合| 91麻豆福利精品推荐| 久久久九九九九| 亚洲精品免费电影| www.日本不卡| 国产精品福利一区二区三区| 风间由美一区二区av101| 久久综合成人精品亚洲另类欧美| 国产无遮挡一区二区三区毛片日本| 麻豆一区二区在线| 欧美成人精品3d动漫h| 蜜桃av噜噜一区| 日韩女优av电影| 激情综合五月天| 精品久久国产字幕高潮| 国产一区二区三区免费观看| 日韩欧美一级在线播放| 久草热8精品视频在线观看| 日韩女优av电影在线观看| 久久66热re国产| 国产日韩欧美精品一区| 亚洲大片一区二区三区| 欧美特级限制片免费在线观看| 亚洲va欧美va天堂v国产综合| 欧美高清视频在线高清观看mv色露露十八| 亚洲图片有声小说| 欧美一区二区三区在| 一区二区三区中文在线| 欧美色图一区二区三区| 欧美精品一区二区三区一线天视频 | 亚洲午夜激情网页| 欧美色欧美亚洲另类二区| 蜜臀av性久久久久蜜臀av麻豆| 欧美成人猛片aaaaaaa| 国产a久久麻豆| 亚洲午夜电影在线观看| 精品少妇一区二区三区免费观看 | 99综合影院在线| 一区二区三区精品在线观看| 欧美精品vⅰdeose4hd| 国产一区二区精品久久91| 《视频一区视频二区| 激情综合色播激情啊| 6080日韩午夜伦伦午夜伦| 国产在线看一区| 亚洲免费电影在线| 成人理论电影网| 国产女人水真多18毛片18精品视频| 91小视频免费观看| 久久狠狠亚洲综合| 亚洲免费在线播放| 久久久久久久久免费| 日本乱人伦aⅴ精品| 一区二区三区在线观看动漫| 日韩三级在线观看| 99久久777色| 国产一区二区毛片| 午夜精品久久久久久久| 中文字幕欧美激情一区| 国模无码大尺度一区二区三区| 亚洲精品中文在线观看| 久久久www成人免费毛片麻豆 | 精品99999| 国产欧美一区二区精品性色超碰| 色偷偷一区二区三区| 国产精品白丝jk黑袜喷水| 天天影视网天天综合色在线播放| 国产精品久久福利| 久久奇米777| 日韩欧美卡一卡二| 欧美老肥妇做.爰bbww视频| 91麻豆精品视频| 大胆欧美人体老妇| 国产麻豆精品视频| 免费人成精品欧美精品| 日韩电影在线免费看| 亚洲午夜日本在线观看| 亚洲欧美日韩在线播放| 国产婷婷精品av在线| 欧美xxxxx裸体时装秀| 日韩午夜激情电影| 91精品福利在线一区二区三区| 色菇凉天天综合网| 91丨九色丨尤物| 91激情在线视频| 欧美在线短视频| 色综合久久综合| 欧洲精品一区二区三区在线观看| 91亚洲男人天堂| 色噜噜久久综合| 在线免费不卡电影| 欧美体内she精高潮| 在线免费观看日本一区| 精品视频在线视频| 在线不卡中文字幕| 日韩精品一区二区三区swag| 日韩欧美国产一区二区在线播放| 欧美一级片在线看| 亚洲精品一区二区三区四区高清| 久久色.com| 国产精品青草综合久久久久99| 18涩涩午夜精品.www| 一级做a爱片久久| 青青国产91久久久久久| 国内成人精品2018免费看| 不卡一区二区中文字幕| 一本到不卡免费一区二区| 欧美精品日韩综合在线| 26uuu国产一区二区三区| 国产精品国产自产拍高清av| 亚洲色大成网站www久久九九| 亚洲电影中文字幕在线观看| 日本强好片久久久久久aaa| 国产精一品亚洲二区在线视频| 99久久精品国产导航| 欧美久久久久免费| 国产亚洲精品精华液| **性色生活片久久毛片| 亚洲免费观看高清完整版在线观看 | 国产精品自在在线| 在线免费不卡电影| 亚洲色图欧洲色图婷婷| 一卡二卡欧美日韩| 国内精品久久久久影院色| 成人精品gif动图一区| 欧美性欧美巨大黑白大战| 日韩欧美激情在线| 日韩一区欧美小说| 狂野欧美性猛交blacked| 99视频一区二区| 欧美mv日韩mv国产网站| 亚洲日本韩国一区| 国产精品中文字幕欧美| 色网站国产精品| 国产欧美精品一区|