本文整理汇总了C++中r0函数的典型用法代码示例。如果您正苦于以下问题:C++ r0函数的具体用法?C++ r0怎么用?C++ r0使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了r0函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aten_read_block
static void aten_read_block( PIA *pi, char * buf, int count )
{ int k, a, b, c, d;
switch (pi->mode) {
case 0: w0(0x48); w2(0xe); w2(6);
for (k=0;k<count/2;k++) {
w2(7); w2(6); w2(2);
a = r1(); w0(0x58); b = r1();
w2(0); d = r1(); w0(0x48); c = r1();
buf[2*k] = j44(c,d);
buf[2*k+1] = j44(a,b);
}
w2(0xc);
break;
case 1: w0(0x58); w2(0xe); w2(6);
for (k=0;k<count/2;k++) {
w2(0x27); w2(0x26); w2(0x22);
a = r0(); w2(0x20); b = r0();
buf[2*k] = b; buf[2*k+1] = a;
}
w2(0x26); w2(0xc);
break;
}
}
示例2: kx_r_execute_with_params
SEXP kx_r_execute_with_params(SEXP connection, SEXP query, SEXP param)
{
K result;
SEXP s;
kx_connection = INTEGER_VALUE(connection);
int i, n = length(param);
K vector = ktn(KF,n);
for (i = 0; i < n; i++) {
kF(vector)[i] = REAL(param)[i];
}
result = k(kx_connection, (char*) CHARACTER_VALUE(query), vector, (K)0);
if (0 == result) {
error("Error: not connected to kdb+ server\n");
}
else if (-128 == result->t) {
char *e = calloc(strlen(result->s) + 1, 1);
strcpy(e, result->s);
r0(result);
error("Error from kdb+: `%s\n", e);
}
s = from_any_kobject(result);
r0(result);
return s;
}
示例3: testSerial
KDB_API K K_DECL testSerial(K a) {
K k = kpn("000001.SZ", 9);
//K s = b9(-1, k);
K s = b9(1, k);
for (G* i = kG(s); i < kG(s) + s->n; ++i) {
std::cout << std::setiosflags(std::ios::uppercase) << std::setfill('0') << std::setw(2)
<< std::hex << static_cast<int>(*i) << ',';
}
std::cout << std::endl;
# if KX_HAS_OKX
std::cout << "okx = " << okx(s) << std::endl;
# endif
if (a->g) {
r0(s);
return k;
}
else {
r0(k);
return s;
}
}
示例4: recieve_data
K recieve_data(I x)
{
static char buf[BUFFER_SIZE];
read_bytes(sizeof(int), &buf);
int tnamesize = 0;
memcpy(&tnamesize, buf, sizeof(int));
read_bytes(tnamesize, &buf);
buf[tnamesize] = '\0';
K tname = ks(buf);
read_bytes(sizeof(J), &buf);
J size = 0;
memcpy(&size, buf, sizeof(J));
read_bytes(size, &buf);
K bytes = ktn(KG, size);
memcpy(kG(bytes), &buf, (size_t) size);
K result = k(0, ".u.upd", tname, d9(bytes), (K) 0);
r0(bytes);
if (result != 0) {
r0(result);
}
return (K) 0;
}
示例5: BprojCore_dag
void Dirac_DomainWall_4D::
BprojCore_dag(double* f1,double* fN,const double* f) const{
// f1 = f5(0), fN = f5(N5_-1)
for(int c=0; c<NC_; ++c){
double fup_r = 0.5*(f[r0(c)] +f[r2(c)]);
double fup_i = 0.5*(f[i0(c)] +f[i2(c)]);
double fdn_r = 0.5*(f[r1(c)] +f[r3(c)]);
double fdn_i = 0.5*(f[i1(c)] +f[i3(c)]);
fN[r0(c)] = fup_r; fN[i0(c)] = fup_i;
fN[r1(c)] = fdn_r; fN[i1(c)] = fdn_i;
fN[r2(c)] = fup_r; fN[i2(c)] = fup_i;
fN[r3(c)] = fdn_r; fN[i3(c)] = fdn_i;
fup_r -= f[r2(c)]; //0.5*(f[r0(c)] -f[r2(c)])
fup_i -= f[i2(c)]; //0.5*(f[i0(c)] -f[i2(c)])
fdn_r -= f[r3(c)]; //0.5*(f[r1(c)] -f[r3(c)])
fdn_i -= f[i3(c)]; //0.5*(f[i1(c)] -f[i3(c)])
f1[r0(c)] = fup_r; f1[i0(c)] = fup_i;
f1[r1(c)] = fdn_r; f1[i1(c)] = fdn_i;
f1[r2(c)] =-fup_r; f1[i2(c)] =-fup_i;
f1[r3(c)] =-fdn_r; f1[i3(c)] =-fdn_i;
}
}
示例6: main
int main(int argc,char*argv[])
{
K flip,result,columnNames,columnData;
int row,col,nCols,nRows;
int handle=khpu("localhost",1234,"user:password");
if(handle<0) exit(1);
result = k(handle,"`asc",(K)0);
std::string str = "([]a:til 10;b:reverse til 10;c:10#01010101010b;d:`a)";
result = k(handle,str.c_str(),(K)0);
if(!result) printf("Network Error\n"),perror("Network"),exit(1);
if(result->t==-128) printf("Server Error %s\n",result->s),kclose(handle),exit(1);
// kclose(handle);
if(result->t!=99&&result->t!=98)
{
printf("type %d\n",result->t);
r0(result);
exit(1);
}
flip = ktd(result); // if keyed table, unkey it. ktd decrements ref count of arg.
// table (flip) is column names!list of columns (data)
columnNames = kK(flip->k)[0];
columnData = kK(flip->k)[1];
nCols = columnNames->n;
nRows = kK(columnData)[0]->n;
for(row=0;row<nRows;row++)
{
if(0==row)
{
for(col=0;col<nCols;col++)
{
if(col>0)printf(",");
printf("%s",kS(columnNames)[col]);
}
printf("\n");
}
for(col=0;col<nCols;col++)
{
K obj=kK(columnData)[col];
if(col>0)printf(",");
switch(obj->t)
{
case(1):{printf("%d",kG(obj)[row]);}break;
case(4):{printf("%d",kG(obj)[row]);}break;
case(5):{printf("%d",kH(obj)[row]);}break;
case(6):{printf("%d",kI(obj)[row]);}break;
case(7):{printf("%lld",kJ(obj)[row]);}break;
case(8):{printf("%f",kE(obj)[row]);}break;
case(9):{printf("%f",kF(obj)[row]);}break;
case(11):{printf("%s",kS(obj)[row]);}break;
default:{printf("unknown type");}break;
}
}
printf("\n");
}
r0(flip);
return 0;
}
示例7:
void DiracWilsonLike::gamma5core(double* w,const double* f)const{
for(int c=0; c<N; ++c){
w[r0(c)] = f[r2(c)]; w[i0(c)] = f[i2(c)];
w[r1(c)] = f[r3(c)]; w[i1(c)] = f[i3(c)];
w[r2(c)] = f[r0(c)]; w[i2(c)] = f[i0(c)];
w[r3(c)] = f[r1(c)]; w[i3(c)] = f[i1(c)];
}
}
示例8:
void GammaMatrix::isigma24core(double* w,const double* f)const{
for(int c=0; c<Ncol_; ++c){
w[r0(c)] = f[r3(c)]; w[i0(c)] = f[i3(c)];
w[r1(c)] =-f[r2(c)]; w[i1(c)] =-f[i2(c)];
w[r2(c)] = f[r1(c)]; w[i2(c)] = f[i1(c)];
w[r3(c)] =-f[r0(c)]; w[i3(c)] =-f[i0(c)];
}
}
示例9: kbic_read_block
static void kbic_read_block( PIA *pi, char * buf, int count )
{ int k, a, b;
switch (pi->mode) {
case 0: w0(0x98); w2(4); w2(6); w2(4);
for (k=0;k<count/2;k++) {
w2(1); w0(8); a = r1();
w0(0x28); b = r1();
buf[2*k] = j44(a,b);
w2(5); b = r1();
w0(8); a = r1();
buf[2*k+1] = j44(a,b);
w2(4);
}
break;
case 1: w0(0xb8); w2(4); w2(6); w2(4);
for (k=0;k<count/4;k++) {
w0(0xb8);
w2(4); w2(5);
w0(8); buf[4*k] = j53(r12w());
w0(0xb8); buf[4*k+1] = j53(r12w());
w2(4); w2(5);
buf[4*k+3] = j53(r12w());
w0(8); buf[4*k+2] = j53(r12w());
}
w2(4);
break;
case 2: w0(0x88); w2(4); w2(6); w2(4);
for (k=0;k<count/2;k++) {
w2(0xa0); w2(0xa1); buf[2*k] = r0();
w2(0xa5); buf[2*k+1] = r0();
}
w2(4);
break;
case 3: w0(0xa0); w2(4); w2(6); w2(4); w3(0);
for (k=0;k<count;k++) buf[k] = r4();
w2(4); w2(0); w2(4);
break;
case 4: w0(0xa0); w2(4); w2(6); w2(4); w3(0);
for (k=0;k<count/2;k++) ((u16 *)buf)[k] = r4w();
w2(4); w2(0); w2(4);
break;
case 5: w0(0xa0); w2(4); w2(6); w2(4); w3(0);
for (k=0;k<count/4;k++) ((u32 *)buf)[k] = r4l();
w2(4); w2(0); w2(4);
break;
}
}
示例10: projMcore
void GammaMatrix::projMcore(double* w,const double* f)const{
for(int c=0; c<Ncol_; ++c){
double fup_r = 0.5*(f[r0(c)] -f[r2(c)]);
double fup_i = 0.5*(f[i0(c)] -f[i2(c)]);
double fdn_r = 0.5*(f[r1(c)] -f[r3(c)]);
double fdn_i = 0.5*(f[i1(c)] -f[i3(c)]);
w[r0(c)] = fup_r; w[i0(c)] = fup_i;
w[r1(c)] = fdn_r; w[i1(c)] = fdn_i;
w[r2(c)] =-fup_r; w[i2(c)] =-fup_i;
w[r3(c)] =-fdn_r; w[i3(c)] =-fdn_i;
}
}
示例11: projMcore
void DiracWilsonLike::projMcore(double* w,const double* f)const{
for(int c=0; c<N; ++c){
double fup_r = 0.5*(f[r0(c)] -f[r2(c)]);
double fup_i = 0.5*(f[i0(c)] -f[i2(c)]);
double fdn_r = 0.5*(f[r1(c)] -f[r3(c)]);
double fdn_i = 0.5*(f[i1(c)] -f[i3(c)]);
w[r0(c)] = fup_r; w[i0(c)] = fup_i;
w[r1(c)] = fdn_r; w[i1(c)] = fdn_i;
w[r2(c)] =-fup_r; w[i2(c)] =-fup_i;
w[r3(c)] =-fdn_r; w[i3(c)] =-fdn_i;
}
}
示例12: epat_read_regr
static int epat_read_regr( PIA *pi, int cont, int regr )
{ int a, b, r;
r = regr + cont_map[cont];
switch (pi->mode) {
case 0: w0(r); w2(1); w2(3);
a = r1(); w2(4); b = r1();
return j44(a,b);
case 1: w0(0x40+r); w2(1); w2(4);
a = r1(); b = r2(); w0(0xff);
return j53(a,b);
case 2: w0(0x20+r); w2(1); w2(0x25);
a = r0(); w2(4);
return a;
case 3:
case 4:
case 5: w3(r); w2(0x24); a = r4(); w2(4);
return a;
}
return -1; /* never gets here */
}
示例13: epat_connect
static void epat_connect ( PIA *pi )
{ pi->saved_r0 = r0();
pi->saved_r2 = r2();
/* Initialize the chip */
CPP(0);
if (epatc8) {
CPP(0x40);CPP(0xe0);
w0(0);w2(1);w2(4);
WR(0x8,0x12);WR(0xc,0x14);WR(0x12,0x10);
WR(0xe,0xf);WR(0xf,4);
/* WR(0xe,0xa);WR(0xf,4); */
WR(0xe,0xd);WR(0xf,0);
/* CPP(0x30); */
}
/* Connect to the chip */
CPP(0xe0);
w0(0);w2(1);w2(4); /* Idle into SPP */
if (pi->mode >= 3) {
w0(0);w2(1);w2(4);w2(0xc);
/* Request EPP */
w0(0x40);w2(6);w2(7);w2(4);w2(0xc);w2(4);
}
if (!epatc8) {
WR(8,0x10); WR(0xc,0x14); WR(0xa,0x38); WR(0x12,0x10);
}
}
示例14: epat_connect
static void epat_connect ( PIA *pi )
{ pi->saved_r0 = r0();
pi->saved_r2 = r2();
#ifdef CONFIG_PARIDE_EPATC8
/* Initialize the chip */
CPP(0);CPP(0x40);CPP(0xe0);
w0(0);w2(1);w2(4);
WR(0x8,0x12);WR(0xc,0x14);WR(0x12,0x10);
WR(0xe,0xf);WR(0xf,4);
/* WR(0xe,0xa);WR(0xf,4); */
WR(0xe,0xd);WR(0xf,0);
/* CPP(0x30); */
/* Connect to the chip */
CPP(0xe0);
w0(0);w2(1);w2(4); /* Idle into SPP */
if (pi->mode >= 3) {
w0(0);w2(1);w2(4);w2(0xc);
/* Request EPP */
w0(0x40);w2(6);w2(7);w2(4);w2(0xc);w2(4);
}
#else
CPP(0); CPP(0xe0);
w0(0); w2(1); w2(4);
if (pi->mode >= 3) {
w0(0); w2(1); w2(4); w2(0xc);
w0(0x40); w2(6); w2(7); w2(4); w2(0xc); w2(4);
}
WR(8,0x10); WR(0xc,0x14); WR(0xa,0x38); WR(0x12,0x10);
#endif
}
示例15: comm_read_regr
static int comm_read_regr( PIA *pi, int cont, int regr )
{ int l, h, r;
r = regr + cont_map[cont];
switch (pi->mode) {
case 0: w0(r); P1; w0(0);
w2(6); l = r1(); w0(0x80); h = r1(); w2(4);
return j44(l,h);
case 1: w0(r+0x20); P1;
w0(0); w2(0x26); h = r0(); w2(4);
return h;
case 2:
case 3:
case 4: w3(r+0x20); (void)r1();
w2(0x24); h = r4(); w2(4);
return h;
}
return -1;
}