本文整理汇总了C++中complement函数的典型用法代码示例。如果您正苦于以下问题:C++ complement函数的具体用法?C++ complement怎么用?C++ complement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了complement函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: complement
bfun* complement (bfun* b_initial) {
// does not free argument.
bfun* b = try_simplify(b_initial);
if (b_initial != b) {
return b;
} else {
int x = best_split(b);
bfun* pc = pos_co(b,x);
bfun* nc = neg_co(b,x);
bfun* p = complement(pc);
bfun* n = complement(nc);
del_bfun(pc);
del_bfun(nc);
// and_var modifies the passed cube_list
and_var(p, x);
and_var(n, x * -1);
// or allocates a new cube & copies the cubelists over
bfun* result = or(p,n);
del_bfun(p);
del_bfun(n);
return result;
}
}
开发者ID:rose,项目名称:boolean-calculator,代码行数:30,代码来源:bfun.c
示例2: split
SNPposition::SNPposition(int position, char* letters, const char* strand, const char* ref)
{
position_=position;
char* strs[4];
unsigned strs_cnt = split(letters, '/', strs);
bool reverse = strcmp(strand, "-") == 0;
char c_ref;
if (reverse) {
c_ref = complement(ref[0]);
} else {
c_ref = ref[0];
}
if (strs[0][0]==c_ref) {
nucleotide_ = strs[1][0];
} else {
nucleotide_=strs[0][0];
}
if (reverse) {
nucleotide_ = complement(nucleotide_);
}
freq_ = 0; // EV: must be initialized
status_ = 0; // EV: must be initialized
}
开发者ID:gurjaolab,项目名称:FREEC_7.4,代码行数:26,代码来源:SNPposition.cpp
示例3: complement
BigInt BigInt::operator*(BigInt b) {
if (*this == 0 || b == 0)
return 0;
BigInt a = *this;
bool negative = 0 xor a.negative_ xor b.negative_;
if (a.negative_) {
complement(a.value_);
a.negative_ = false;
}
if (b.negative_) {
complement(b.value_);
b.negative_ = false;
}
match_size_of_digits(a, b);
a = karatsuba(a, b);
a.negative_ = (a != 0) and negative ;
if (a.negative_)
complement(a.value_);
return a;
}
开发者ID:rhalstea,项目名称:euler_helper_functions,代码行数:26,代码来源:BigInt.cpp
示例4: and
bfun* and(bfun* b, bfun* g) {
bfun* m_not = complement(b);
bfun* n_not = complement(g);
bfun* mn_or = or(m_not, n_not);
bfun* to_return = complement(mn_or);
del_bfun(m_not);
del_bfun(n_not);
del_bfun(mn_or);
return to_return;
}
开发者ID:rose,项目名称:boolean-calculator,代码行数:10,代码来源:bfun.c
示例5: reverse_complement
void reverse_complement(char *p, size_t len)
{
char *pp = p + len - 1;
while (p <= pp) {
char tmp = *p;
*p = complement(*pp);
*pp = complement(tmp);
p++;
pp--;
}
}
开发者ID:rpurbo,项目名称:crosby,代码行数:11,代码来源:crosby.c
示例6: reverse_complement
void reverse_complement(char *string, unsigned len)
{
int i;
for (i = 0, len = len -1; len > i; ++i, --len) {
*(string+i) ^= *(string+len);
*(string+len) ^= *(string+i);
*(string+i) ^= *(string+len);
*(string+i) = complement(*(string+i));
*(string+len) = complement(*(string+len));
}
}
开发者ID:georgek,项目名称:bio-tools,代码行数:11,代码来源:soap-fix.c
示例7: reverseP
void reverseP(Args *args, Sequence *seq, FILE *snp) {
int i, pos, optStart;
char *snpId, *alt, *hsName, *chr, *primer;
hsName = emalloc(256);
chr = emalloc(256);
snpId = emalloc(256);
alt = emalloc(256);
primer = emalloc(args->M + 1);
/* get name of hotspot */
strcpy(hsName, tabField(0));
while(fscanf(snp,"%s %d %s %*s %s %*s %*s %*s",chr,&pos,snpId,alt) != EOF){
/* zero-based counting within progr. */
pos--;
if (strchr(alt, ','))
continue;
for (i = 0; i < args->M; i++)
primer[i] = seq->seq[pos + i];
primer[args->M] = '\0';
reverse(primer);
complement(primer);
/* print first primer */
optStart = optimalStartPos(args, primer, args->M - args->m);
printf("%s\t%s\t%s\t%d\t", hsName, snpId, chr, pos + 1);
for (i = optStart; i < args->M; i++)
printf("%c", primer[i]);
printf("\t%.2f\t%.1f\t", gc(primer, optStart), tm(primer, optStart));
complement(alt);
primer[args->M - 1] = alt[0];
/* print second primer */
optStart = optimalStartPos(args, primer, args->M - args->m);
for (i = optStart; i < args->M; i++)
printf("%c", primer[i]);
printf("\t%.2f\t%.1f\n", gc(primer, optStart), tm(primer, optStart));
}
free(chr);
free(snpId);
free(alt);
free(hsName);
free(primer);
}
开发者ID:EvolBioInf,项目名称:hotspot,代码行数:51,代码来源:asPrimers.c
示例8: operator
RealType operator()(const RealType& df)
{
if(df <= tools::min_value<RealType>())
{ //
return 1;
}
students_t_distribution<RealType, Policy> t(df);
RealType qa = quantile(complement(t, alpha));
RealType qb = quantile(complement(t, beta));
qa += qb;
qa *= qa;
qa *= ratio;
qa -= (df + 1);
return qa;
}
开发者ID:AsherBond,项目名称:PDAL,代码行数:15,代码来源:students_t.hpp
示例9: seqrc
void seqrc( char* seq, int n )
{
char c;
int i,j;
i = 0;
j = n-1;
while( i < j ) {
c = complement(seq[i]);
seq[i] = complement(seq[j]);
seq[j] = c;
i++; j--;
}
if( i == j ) seq[i] = complement(seq[i]);
}
开发者ID:dcjones,项目名称:peakolator-legacy,代码行数:15,代码来源:common.cpp
示例10: hotelling_t2_1test
T hotelling_t2_1test(
boost::numeric::ublas::vector<T> mean1,
boost::numeric::ublas::vector<T> mean2,
boost::numeric::ublas::matrix<T> cov1,
unsigned n1
){
unsigned k=mean1.size();
boost::numeric::ublas::vector<T > mean_diff=mean1-mean2;
boost::numeric::ublas::matrix<T> cov_inv(cov1);
invert_matrix(cov1 ,cov_inv);
T t2_score=
boost::numeric::ublas::inner_prod(
boost::numeric::ublas::prod( cov_inv,mean_diff)
,mean_diff)*n1;
T f_score= (t2_score*(n1 - k))/(k*(n1-1));
std::cout << t2_score << std::endl;
std::cout << f_score << std::endl;
boost::math::fisher_f dist(k, n1-k);
T p_score =boost::math::cdf(dist, f_score);
std::cout << p_score << std::endl;
T p_comp =boost::math::cdf(complement(dist, f_score));
std::cout << p_comp << std::endl;
//return p_comp;
return p_score;
}
开发者ID:niitsuma,项目名称:hotelling_t_square_test,代码行数:29,代码来源:ublas_hotelling_t2.hpp
示例11: TEST
TEST(ProbDistributionsBernoulli, chiSquareGoodnessFitTest) {
boost::random::mt19937 rng;
int N = 10000;
boost::math::bernoulli_distribution<>dist (0.4);
boost::math::chi_squared mydist(1);
int bin[2] = {0, 0};
double expect [2] = {N * (1 - 0.4), N * (0.4)};
int count = 0;
while (count < N) {
int a = stan::prob::bernoulli_rng(0.4,rng);
if(a == 1)
++bin[1];
else
++bin[0];
count++;
}
double chi = 0;
for(int j = 0; j < 2; j++)
chi += ((bin[j] - expect[j]) * (bin[j] - expect[j]) / expect[j]);
EXPECT_TRUE(chi < quantile(complement(mydist, 1e-6)));
}
开发者ID:HerraHuu,项目名称:stan,代码行数:27,代码来源:bernoulli_test.cpp
示例12: tr_main
extern int tr_main(int argc, char **argv)
{
register unsigned char *ptr;
int output_length=0, input_length;
int idx = 1;
int i;
RESERVE_CONFIG_BUFFER(output, BUFSIZ);
RESERVE_CONFIG_BUFFER(input, BUFSIZ);
RESERVE_CONFIG_UBUFFER(vector, ASCII+1);
RESERVE_CONFIG_BUFFER(invec, ASCII+1);
RESERVE_CONFIG_BUFFER(outvec, ASCII+1);
/* ... but make them available globally */
poutput = output;
pinput = input;
pvector = vector;
pinvec = invec;
poutvec = outvec;
if (argc > 1 && argv[idx][0] == '-') {
for (ptr = (unsigned char *) &argv[idx][1]; *ptr; ptr++) {
switch (*ptr) {
case 'c':
com_fl = TRUE;
break;
case 'd':
del_fl = TRUE;
break;
case 's':
sq_fl = TRUE;
break;
default:
bb_show_usage();
}
}
idx++;
}
for (i = 0; i <= ASCII; i++) {
vector[i] = i;
invec[i] = outvec[i] = FALSE;
}
if (argv[idx] != NULL) {
input_length = expand(argv[idx++], input);
if (com_fl)
input_length = complement(input, input_length);
if (argv[idx] != NULL) {
if (*argv[idx] == '\0')
bb_error_msg_and_die("STRING2 cannot be empty");
output_length = expand(argv[idx], output);
map(input, input_length, output, output_length);
}
for (i = 0; i < input_length; i++)
invec[(unsigned char)input[i]] = TRUE;
for (i = 0; i < output_length; i++)
outvec[(unsigned char)output[i]] = TRUE;
}
convert();
return (0);
}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:60,代码来源:tr.c
示例13: main6
int main6(int argc, char *argv[]) {
Intstack cell, co;
int rank, upb, nr = 0;
assert(argc > 1);
rank = atoi(argv[1]);
upb = 1 << rank;
co = newIntstack(upb, NULL);
cell = readCell();
while (cell) {
nr = getCnr();
printCell(nr, cell);
complement(upb, cell, co);
printf("COM ");
printCell(0, co);
freestack(cell);
printf("\n");
cell = readCell();
}
freestack(cell);
freestack(co);
#if 0
reportTime();
reportCnt();
#endif
finalizeScanner();
return 0;
}
开发者ID:germuth,项目名称:Kekule,代码行数:27,代码来源:complementcell.c
示例14: consensuses
SignalSensor::SignalSensor(GarbageCollector &gc,const SignalSensor &other,
bool revComp)
: consensuses(PRIME_HASH_SIZE),
gc(gc),
probabilityInverter(NULL)
{
contextWindowLength=other.contextWindowLength;
consensusLength=other.consensusLength;
cutoff=other.cutoff;
if(revComp)
{
consensusOffset=
contextWindowLength-other.consensusOffset-consensusLength;
strand=complement(other.strand);
signalType=::reverseComplement(other.signalType);
BOOM::StringMap<char>::const_iterator cur=other.consensuses.begin(),
end=other.consensuses.end();
for(; cur!=end ; ++cur)
{
const StringMapElem<char> &elem=*cur;
BOOM::String reverseConsensus=
BOOM::ProteinTrans::reverseComplement(elem.first);
consensuses.lookup(reverseConsensus.c_str(),elem.len)=char(1);
}
}
else
{
consensusOffset=other.consensusOffset;
strand=other.strand;
signalType=other.signalType;
consensuses=other.consensuses;
}
}
开发者ID:ReddyLab,项目名称:FBI,代码行数:34,代码来源:SignalSensor.C
示例15: TEST
TEST(ProbDistributionsExponential, chiSquareGoodnessFitTest) {
boost::random::mt19937 rng;
int N = 10000;
int K = boost::math::round(2 * std::pow(N, 0.4));
boost::math::exponential_distribution<>dist (2.0);
boost::math::chi_squared mydist(K-1);
double loc[K - 1];
for(int i = 1; i < K; i++)
loc[i - 1] = quantile(dist, i * std::pow(K, -1.0));
int count = 0;
int bin [K];
double expect [K];
for(int i = 0 ; i < K; i++) {
bin[i] = 0;
expect[i] = N / K;
}
while (count < N) {
double a = stan::math::exponential_rng(2.0,rng);
int i = 0;
while (i < K-1 && a > loc[i])
++i;
++bin[i];
count++;
}
double chi = 0;
for(int j = 0; j < K; j++)
chi += ((bin[j] - expect[j]) * (bin[j] - expect[j]) / expect[j]);
EXPECT_TRUE(chi < quantile(complement(mydist, 1e-6)));
}
开发者ID:piero-ranalli,项目名称:math,代码行数:35,代码来源:exponential_test.cpp
示例16: redundant
my_type redundant(int *new_clause, int *old_clause) {
int lit1, lit2, old_clause_diff=0, new_clause_diff=0;
lit1=*old_clause; lit2=*new_clause;
while ((lit1 != NONE) && (lit2 != NONE)) {
if (smaller_than(lit1, lit2)) {
lit1=*(++old_clause); old_clause_diff++;
}
else
if (smaller_than(lit2, lit1)) {
lit2=*(++new_clause); new_clause_diff++;
}
else
if (complement(lit1, lit2)) {
return FALSE; /* old_clause_diff++; new_clause_diff++; j1++; j2++; */
}
else {
lit1=*(++old_clause); lit2=*(++new_clause);
}
}
if ((lit1 == NONE) && (old_clause_diff == 0))
/* la nouvelle clause est redondante ou subsumee */
return NEW_CLAUSE_REDUNDANT;
if ((lit2 == NONE) && (new_clause_diff == 0))
/* la old clause est redondante ou subsumee */
return OLD_CLAUSE_REDUNDANT;
return FALSE;
}
开发者ID:pmatos,项目名称:maxsatzilla,代码行数:28,代码来源:input.c
示例17: complement
std::string Breakpoint::rev_complement(std::string seq) {
std::string tmp;
for (std::string::reverse_iterator i = seq.rbegin(); i != seq.rend(); i++) {
tmp += complement((*i));
}
return tmp;
}
开发者ID:fritzsedlazeck,项目名称:Sniffles,代码行数:7,代码来源:Breakpoint.cpp
示例18: hotelling_t2_2test
T hotelling_t2_2test(
boost::numeric::ublas::vector<T> mean1,
boost::numeric::ublas::vector<T> mean2,
boost::numeric::ublas::matrix<T> cov1,
boost::numeric::ublas::matrix<T> cov2,
unsigned n1,
unsigned n2){
unsigned k=mean1.size();
//int n = n1 + n2 -1;
boost::numeric::ublas::vector<T > mean_diff=mean1-mean2;
boost::numeric::ublas::matrix<T>
pooled_cov=(cov1*(n1-1)+cov2*(n2-1))*1.0/(n1+n2-2) ;
pooled_cov *= (1.0/n1+1.0/n2 );
boost::numeric::ublas::matrix<T> pooled_cov_inv(pooled_cov);
invert_matrix( pooled_cov ,pooled_cov_inv);
//std::cout << mean_diff << std::endl;
T t2_score=
boost::numeric::ublas::inner_prod(
boost::numeric::ublas::prod( pooled_cov_inv,mean_diff)
,mean_diff);
T f_score= (t2_score*(n1 + n2 - 1- k))/(k*( n1 + n2 - 2));
std::cout << t2_score << std::endl;
std::cout << f_score << std::endl;
boost::math::fisher_f dist(k, n1+n2-1-k);
T p_score =boost::math::cdf(dist, f_score);
std::cout << p_score << std::endl;
T p_comp =boost::math::cdf(complement(dist, f_score));
std::cout << p_comp << std::endl;
//return p_comp;
return p_score;
}
开发者ID:niitsuma,项目名称:hotelling_t_square_test,代码行数:34,代码来源:ublas_hotelling_t2.hpp
示例19:
char *make_complement_sequence_of(char *sequence, long unsigned length){
long i;
for(i=0;i<length;i++){
sequence[i]=complement((int)sequence[i]);
}
return sequence;
}
开发者ID:uhmin,项目名称:sequence-analysis-tools-1,代码行数:7,代码来源:revcmp2.c
示例20: TEST
TEST(ProbDistributionsScaledInvChiSquare, chiSquareGoodnessFitTest) {
boost::random::mt19937 rng;
int N = 10000;
double K = 5;
boost::math::inverse_chi_squared_distribution<>dist (2.0);
boost::math::chi_squared mydist(K-1);
double loc[4];
for(int i = 1; i < K; i++)
loc[i - 1] = quantile(dist, 0.2 * i);
int count = 0;
int bin [5] = {0, 0, 0, 0, 0};
while (count < N) {
double a = stan::prob::scaled_inv_chi_square_rng(2.0,1.0,rng) / (2.0 * 1.0);
int i = 0;
while (i < K-1 && a > loc[i])
++i;
++bin[i];
count++;
}
double chi = 0;
double expect [5] = {N / K, N / K, N / K, N / K, N / K};
for(int j = 0; j < K; j++)
chi += ((bin[j] - expect[j]) * (bin[j] - expect[j]) / expect[j]);
EXPECT_TRUE(chi < quantile(complement(mydist, 1e-6)));
}
开发者ID:dougalsutherland,项目名称:pystan,代码行数:31,代码来源:scaled_inv_chi_square_test.cpp
注:本文中的complement函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论