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

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

?? gaussqr.cpp

?? Add c++ support for Gaussian Quadrature v1.1
?? CPP
字號:
/* * Copyright (c) 2005, Andrew Fernandes (andrew@fernandes.org); * All rights reserved. *  * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: *  * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. *  * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. *  * - Neither the name of the North Carolina State University nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. *  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * */#include "gaussqr.h"#include <cmath>#include <algorithm>const integer_t gaussqr_version_major = 1;const integer_t gaussqr_version_minor = 1;gaussqr_result relative_error( const integer_t n , const real_t *w0 , const real_t *w1 , real_t *err )/*	Returns the maximum relative error difference between two vectors, w0 and w1. */{	if ( n < 3 || w0 == 0 || w1 == 0 || err == 0 )		return(gaussqr_illegal_argument);	*err = 0.0;	for ( integer_t i = 0; i < n; i++ ) {		*err = std::max( *err , std::fabs( (w0[i]-w1[i])/(0.5*(w0[i]+w1[i])) ) );	}		return(gaussqr_success);}namespace {		// raise a real_t number to an integer_t power	inline real_t pow_ri( real_t x , integer_t n )	{		real_t y = 1.0;				if ( n < 0 ) {			x = 1.0/x;			n = -n;		}				while ( n > 0 ) {			if ( n & 1 ) y *= x;			if ( n >>= 1 ) x *= x;		}				return(y);	}	inline real_t squared( const real_t &x )	// square the argument	{		return( x * x );	}	}gaussqr_result standard_distribution_rcoeffs( const distribution_type type , const integer_t n , real_t *a , real_t *b , const real_t *p )/*	Given one of the enumerated distriution types, and the number of desired recursion coefficients n,	this routine returns the desired recursion coefficients a and b. The parameters of the distribution	are passed in the array p, whose length is implied by the distribution type. See the cases below	for the number and meaning of the parameters (they are quite standard). 	WARNING: No error checking is done on the input parameters p for validity! */{	if ( n < 3 || a == 0 || b == 0 )		return(gaussqr_illegal_argument);		using std::exp;		real_t lambda = 0.0;		switch(type) {				case distribution_normal : {			const real_t &mu = p[0];			const real_t sigma2 = squared(p[1]);			lambda = 1.0;			for ( integer_t i = 0; i < n; i++ ) {				a[i] = mu;			}			for ( integer_t i = 1; i < n; i++ ) {				b[i] = i * sigma2;			}		} break;					case distribution_gamma : {			const real_t &alpha = p[0];			const real_t &beta  = p[1];			lambda = beta;			for ( integer_t i = 0; i < n; i++ ) {				a[i] = alpha + 2*i;			}			for ( integer_t i = 1; i < n; i++ ) {				b[i] = i*(alpha+i-1);			}		} break;					case distribution_log_normal : {			const real_t &m = p[0];			const real_t s2 = squared(p[1]);			lambda = exp(m);			const real_t zeta = exp(s2);			for ( integer_t i = 0; i < n; i++ ) {				a[i] = pow(zeta,0.5*(2*i-1))*(pow_ri(zeta,i)*(zeta+1.0)-1.0);			}			for ( integer_t i = 1; i < n; i++ ) {				b[i] = pow_ri(zeta,3*i-2)*(pow_ri(zeta,i)-1.0);			}		} break;					case distribution_students_t : {			const real_t &nu = p[0];			lambda = 1.0;			for ( integer_t i = 0; i < n; i++ ) {				a[i] = 0.0;			}			for ( integer_t i = 1; i < n; i++ ) {				b[i] = i*nu*(nu-i+1)/((nu-2*i)*(nu-2*i+2));			}		} break;					case distribution_inverse_gamma : {			const real_t &alpha = p[0];			const real_t &beta  = p[1];			lambda = beta;			for ( integer_t i = 0; i < n; i++ ) {				a[i] = (alpha+1.0)/((alpha-2*i+1)*(alpha-2*i-1));			}			for ( integer_t i = 1; i < n; i++ ) {				b[i] = i*(alpha-i+1)/((alpha-2*i)*squared(alpha-2*i+1)*(alpha-2*i+2));			}		} break;					case distribution_beta : {			const real_t &alpha = p[0];			const real_t &beta  = p[1];			const real_t gamma = alpha + beta;			lambda = 1.0;			for ( integer_t i = 0; i < n; i++ ) {				if ( i == 0 && alpha == 1.0 && beta == 1.0 ) {					a[i] = 0.5;				} else {					a[i] = (alpha*gamma+(2*i-2)*alpha+2*i*beta+i*(2*i-2))/((gamma+2*i)*(gamma+2*i-2));				}			}			for ( integer_t i = 1; i < n; i++ ) {				b[i] = (i*(gamma+i-2)*(alpha+i-1)*(beta+i-1))/((gamma+2*i-1)*squared(gamma+2*i-2)*(gamma+2*i-3));			}		} break;					case distribution_fishers_f : {			const real_t &nu1 = p[0];			const real_t &nu2 = p[1];			lambda = nu2/nu1;			for ( integer_t i = 0; i < n; i++ ) {				a[i] = (nu1*nu2+2*nu1+4*i*nu2-8*i*i)/((nu2-4*i-2)*(nu2-4*i+2));			}			for ( integer_t i = 1; i < n; i++ ) {				b[i] = (2*i*(nu1+2*i-2)*(nu2-2*i+2)*(nu1+nu2-2*i))/((nu2-4*i)*squared(nu2-4*i+2)*(nu2-4*i+4));			}		} break;					default :			return(gaussqr_illegal_argument);				}		const real_t lambda2 = squared(lambda);	for ( integer_t i = 0; i < n; i++ ) {		a[i] *= lambda;		b[i] *= lambda2;	}	b[0] = 1.0;		return(gaussqr_success);}namespace {		// Define a polymorphic gamma function, since C++ does not provide one.	// Note that the 'tgamma' variants are C99 standard and are probably	// called something else on Windows.	inline       float gamma_function( const      float  &x ) { return tgammaf(x); }	inline      double gamma_function( const      double &x ) { return tgamma (x); }	inline long double gamma_function( const long double &x ) { return tgammal(x); }	// Unfortunately, no standard library defines the beta function; we do so here.	inline real_t beta_function( const real_t &alpha , const real_t &beta ) {		return( gamma_function(alpha)*gamma_function(beta)/gamma_function(alpha+beta) );	}}gaussqr_result standard_distribution_pdf( const distribution_type type , const real_t x , real_t *y , const real_t *p )/*	Given one of the enumerated distriution types and an abscissa x,	this routine returns the ordinate y of the desired density function. The parameters of the distribution	are passed in the array p, whose length is implied by the distribution type. See the cases below	for the number and meaning of the parameters (they are quite standard). 	WARNING: No error checking is done on the input parameters p or abscissa x for validity!  */{	if ( y == 0 )		return(gaussqr_illegal_argument);		using std::exp;	using std::pow;	using std::log;	using std::sqrt;		switch(type) {				case distribution_normal : {			const real_t &mu = p[0];			const real_t sigma2 = squared(p[1]);			const real_t z = x - mu;			*y = exp( -0.5 * squared(z) / sigma2 ) / sqrt( 2.0 * sigma2 * M_PI );		} break;					case distribution_gamma : {			const real_t &alpha = p[0];			const real_t &beta  = p[1];			*y = pow(x,alpha-1.0) * exp(-x/beta) / ( gamma_function(alpha) * pow(beta,alpha) );		} break;								case distribution_log_normal : {			const real_t &m = p[0];			const real_t s2 = squared(p[1]);			const real_t z = log(x) - m;			*y = exp( -0.5 * squared(z) / s2 ) / ( x * sqrt( 2.0 * s2 * M_PI ) );		} break;								case distribution_students_t : {			const real_t &nu = p[0];			const real_t tmp = 0.5*( nu + 1.0 );			*y = gamma_function(tmp)/( sqrt(nu*M_PI) * gamma_function(0.5*nu) * pow(1.0+x*x/nu,tmp) );		} break;								case distribution_inverse_gamma : {			const real_t &alpha = p[0];			const real_t &beta  = p[1];			*y = pow(x,-(alpha+1.0)) * pow(beta,alpha) * exp(-beta/x) / gamma_function(alpha);		} break;								case distribution_beta : {			const real_t &alpha = p[0];			const real_t &beta  = p[1];			*y = pow(x,alpha-1.0) * pow(1.0-x,beta-1.0) / beta_function(alpha,beta);		} break;								case distribution_fishers_f : {			const real_t &nu1 = p[0];			const real_t &nu2 = p[1];			const real_t nu1by2 = 0.5 * nu1;			const real_t nu2by2 = 0.5 * nu2;			*y = pow(nu1,nu1by2) * pow(nu2,nu2by2) * pow(x,nu1by2-1.0) / ( beta_function(nu1by2,nu2by2) * pow(nu1*x+nu2,nu1by2+nu2by2) );		} break;								default :			return(gaussqr_illegal_argument);				}		return(gaussqr_success);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品麻豆日日躁夜夜躁| 色又黄又爽网站www久久| 午夜电影网一区| 中文字幕中文乱码欧美一区二区| 久久精品人人做人人综合| 久久久精品国产99久久精品芒果| 久久综合久久综合久久| 欧美成人乱码一区二区三区| 日韩欧美中文字幕精品| 精品福利一二区| 日本一区二区三级电影在线观看 | 欧美一级夜夜爽| 欧美日韩精品一区二区天天拍小说| 欧美在线视频日韩| 欧美一区二区三区人| 欧美一区二区三区成人| 精品精品国产高清a毛片牛牛 | 中文字幕在线观看不卡| 亚洲欧美日韩国产综合| 亚洲图片有声小说| 狠狠色狠狠色合久久伊人| 成人高清伦理免费影院在线观看| 成+人+亚洲+综合天堂| 91麻豆国产福利在线观看| 欧美人牲a欧美精品| 欧美大黄免费观看| 国产精品第四页| 偷拍一区二区三区| 韩国av一区二区| 99re6这里只有精品视频在线观看| 一本久久精品一区二区| 欧美精品一区二区在线观看| 中文字幕一区二区三区不卡 | 亚洲欧美日韩成人高清在线一区| 亚洲电影一级片| 国产成人免费视频网站高清观看视频| 97精品久久久久中文字幕| 7777精品伊人久久久大香线蕉完整版| 久久看人人爽人人| 一区二区三区久久| 国产精品一区二区久久不卡| 在线观看网站黄不卡| 久久久亚洲午夜电影| 亚欧色一区w666天堂| 成人一区二区三区视频在线观看 | 91麻豆国产在线观看| 欧美成人性战久久| 亚洲电影一级黄| 97精品久久久午夜一区二区三区 | 欧美激情中文不卡| 日本欧美在线看| av爱爱亚洲一区| 欧美精品一区二区三区在线| 亚洲电影视频在线| 91精彩视频在线观看| 国产精品私人影院| 国产电影一区在线| 欧美变态口味重另类| 三级精品在线观看| 欧美色图在线观看| 综合亚洲深深色噜噜狠狠网站| 精品一区二区三区免费观看| 精品视频资源站| 亚洲美女区一区| 99久久国产综合精品麻豆| 欧美激情一区在线| 国产精品一区二区久久不卡| 欧美mv日韩mv国产网站| 日本三级亚洲精品| 欧美一区二区三区免费大片| 午夜精品爽啪视频| 777xxx欧美| 日本vs亚洲vs韩国一区三区| 欧美精品在线视频| 蜜臀va亚洲va欧美va天堂| 欧美高清hd18日本| 免费欧美在线视频| 日韩美女天天操| 免费不卡在线视频| 久久青草欧美一区二区三区| 国产在线乱码一区二区三区| 久久久五月婷婷| 成人精品国产一区二区4080| 中文字幕在线免费不卡| 在线精品国精品国产尤物884a| 一区二区三区四区不卡视频| 在线视频一区二区免费| 欧美一a一片一级一片| 亚洲国产成人精品视频| 91香蕉视频mp4| 亚洲精品自拍动漫在线| 欧美日韩免费高清一区色橹橹| 天堂蜜桃一区二区三区| 精品av久久707| gogogo免费视频观看亚洲一| 夜夜嗨av一区二区三区四季av| 欧美日韩精品系列| 美国三级日本三级久久99| 久久久久国产免费免费| a4yy欧美一区二区三区| 亚洲国产sm捆绑调教视频| 精品国产乱码久久| av一本久道久久综合久久鬼色| 一区二区三区91| 久久久久久免费毛片精品| 99久久综合99久久综合网站| 午夜电影网亚洲视频| 国产欧美一区二区三区鸳鸯浴 | 欧美一级欧美一级在线播放| 午夜a成v人精品| 久久影院视频免费| 在线观看成人免费视频| 精品一区二区三区影院在线午夜| 国产人成一区二区三区影院| 欧美午夜片在线看| 国产成人午夜精品影院观看视频 | 亚洲色欲色欲www| 欧美日本一道本| 国产成人综合在线观看| 午夜久久久久久久久| 国产精品少妇自拍| 日韩免费视频一区二区| 99精品欧美一区二区三区小说 | 亚洲不卡av一区二区三区| 91精品国产高清一区二区三区蜜臀 | 久久精品免费在线观看| av成人免费在线观看| 免费成人在线播放| 樱桃视频在线观看一区| 精品日韩成人av| 欧美日韩成人在线| 色狠狠色狠狠综合| 国产高清在线观看免费不卡| 美国十次了思思久久精品导航| 一区二区三区高清不卡| 中文字幕中文字幕中文字幕亚洲无线 | 成人激情小说乱人伦| 精品亚洲成av人在线观看| 日韩电影一区二区三区四区| 亚洲综合一区在线| 亚洲女同女同女同女同女同69| 国产精品久久免费看| 久久综合久久鬼色| 亚洲精品一区二区三区蜜桃下载 | 色先锋资源久久综合| 久久疯狂做爰流白浆xx| 国产精品影视在线| 日本伊人午夜精品| 人人精品人人爱| 奇米影视7777精品一区二区| 天天做天天摸天天爽国产一区| 尤物视频一区二区| 亚洲在线免费播放| 性感美女极品91精品| 丝袜a∨在线一区二区三区不卡| 亚洲国产精品影院| 首页综合国产亚洲丝袜| 视频一区视频二区中文| 日韩高清在线一区| 日韩精品一级中文字幕精品视频免费观看 | 欧美性一区二区| 欧美三级欧美一级| 日韩一卡二卡三卡四卡| 日韩免费视频一区二区| 亚洲精品一区二区三区在线观看| 国产偷国产偷精品高清尤物 | 国产午夜亚洲精品午夜鲁丝片| 亚洲精品一区在线观看| 国产精品久久久久久亚洲伦| 亚洲乱码国产乱码精品精的特点 | 欧美日韩国产成人在线免费| 正在播放一区二区| 久久婷婷一区二区三区| 中文字幕精品综合| 亚洲午夜影视影院在线观看| 奇米色777欧美一区二区| 国产精品 欧美精品| 国产成人综合网| 日本韩国一区二区三区视频| 欧美一卡二卡在线| 国产欧美一区二区三区沐欲 | 热久久国产精品| 国产一区中文字幕| 99re热视频精品| 日韩三级精品电影久久久 | 亚洲第一主播视频| 韩国毛片一区二区三区| 色综合一个色综合| 日韩免费电影一区| 亚洲免费看黄网站| 精品一区二区三区免费| 在线免费一区三区| 国产亚洲欧洲997久久综合| 亚洲一级二级在线| 国产黄色91视频| 91精品久久久久久久91蜜桃| 国产视频视频一区| 日韩av一级电影| 色欧美片视频在线观看在线视频| 亚洲精品在线观看网站|