sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
a5d7ed86727e61ada33f988bd84328261b46a2e3283defdcb8bf8bfb665d8a8c | C | 199 | 10 | /** @brief For CMake to try if code compiles. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main(int argc, char **argv)
{
return(strcasestr("Test", "Te"));
}
|
7c620a1eb9e3ff930555c129ee9d6b6e95539bead3fd8ec4a9e54be5fcd582b3 | C | 205 | 14 | #include "tensor2D.H"
#include "IOstreams.H"
using namespace Foam;
int main()
{
vector2D v1(1, 2), v2(3, 4);
tensor2D t = v1*v2;
Info<< "v1(1, 2)*v2(3, 4) = " << t << endl;
return 0;
}
|
c2bbe5eac8f498a731b342bba44c8b80c9fa0a891f3acf860026fe038b3416c1 | C | 208 | 9 | #include "cs_demo.h"
/* cs_demo2: read a matrix and solve a linear system */
int main (void)
{
problem *Prob = get_problem (stdin, 1e-14) ;
demo2 (Prob) ;
free_problem (Prob) ;
return (0) ;
}
|
f590ca8d7d519aa0ee6aae259e7fffcfa5a046944c10af6c5358d0acdc3ceeff | C | 212 | 9 | #include "cs_demo.h"
/* cs_demo3: read a matrix and test Cholesky update/downdate */
int main (void)
{
problem *Prob = get_problem (stdin, 0) ;
demo3 (Prob) ;
free_problem (Prob) ;
return (0) ;
}
|
1891724e707e49ca2a5f10077ba9c6b934da46b07e97e89efe837bd89bb10e63 | C | 213 | 11 | /** @brief For CMake to try if code compiles. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <direct.h>
int main(int argc, char **argv)
{
return(_mkdir("testpath"));
}
|
3e0c69656d4a5392bc099be130a3e87faed48c22e4ddbe8563964270999d0f62 | C | 214 | 9 | #include "cs_dl_demo.h"
/* cs_dl_demo2: read a matrix and solve a linear system */
int main (void)
{
problem *Prob = get_problem (stdin, 1e-14) ;
demo2 (Prob) ;
free_problem (Prob) ;
return (0) ;
}
|
50450263beab5bbc0c1e51a1a31b7c446906439846037774d0444454b0668863 | C | 214 | 9 | #include "cs_di_demo.h"
/* cs_di_demo2: read a matrix and solve a linear system */
int main (void)
{
problem *Prob = get_problem (stdin, 1e-14) ;
demo2 (Prob) ;
free_problem (Prob) ;
return (0) ;
}
|
9e536db619e4dc5830f9f6e4675af0c72022ad635f4f8244d49d5cb778e155db | C | 214 | 9 | #include "cs_ci_demo.h"
/* cs_ci_demo2: read a matrix and solve a linear system */
int main (void)
{
problem *Prob = get_problem (stdin, 1e-14) ;
demo2 (Prob) ;
free_problem (Prob) ;
return (0) ;
}
|
e33bad0f255388c5b29739eb3be0cf2910303f36d44a2abb2e9fa721f2611540 | C | 214 | 9 | #include "cs_cl_demo.h"
/* cs_cl_demo2: read a matrix and solve a linear system */
int main (void)
{
problem *Prob = get_problem (stdin, 1e-14) ;
demo2 (Prob) ;
free_problem (Prob) ;
return (0) ;
}
|
765dbdc8f0172de4312a6a3683e86cc230b6e2ceea64546ce7577f954c3ac514 | C | 215 | 9 | #include "cs.h"
static int cs_nonzero (int i, int j, double aij, void *other)
{
return (aij != 0) ;
}
int cs_dropzeros (cs *A)
{
return (cs_fkeep (A, &cs_nonzero, NULL)) ; /* keep all nonzero entries */
}
|
240f758177ec698b81db8c8f7cc2d7c526983ad6a71a76fd364872a125b77cf5 | C | 218 | 9 | #include "cs_dl_demo.h"
/* cs_dl_demo3: read a matrix and test Cholesky update/downdate */
int main (void)
{
problem *Prob = get_problem (stdin, 0) ;
demo3 (Prob) ;
free_problem (Prob) ;
return (0) ;
}
|
2d0158f82c6d92c34bed31490321111c4c1ad7696d03da4a367515f6eda59f6a | C | 218 | 9 | #include "cs_ci_demo.h"
/* cs_ci_demo3: read a matrix and test Cholesky update/downdate */
int main (void)
{
problem *Prob = get_problem (stdin, 0) ;
demo3 (Prob) ;
free_problem (Prob) ;
return (0) ;
}
|
39103a5302d4eb5fc5c87daa6ebc4e153901c1f1de0c3af9fe09a40ce916517b | C | 218 | 9 | #include "cs_cl_demo.h"
/* cs_cl_demo3: read a matrix and test Cholesky update/downdate */
int main (void)
{
problem *Prob = get_problem (stdin, 0) ;
demo3 (Prob) ;
free_problem (Prob) ;
return (0) ;
}
|
e15461987c31bf1414134815370b5a4908c1d588fe2be7c9729f61ba2f0615ca | C | 218 | 9 | #include "cs_di_demo.h"
/* cs_di_demo3: read a matrix and test Cholesky update/downdate */
int main (void)
{
problem *Prob = get_problem (stdin, 0) ;
demo3 (Prob) ;
free_problem (Prob) ;
return (0) ;
}
|
693230f5c89165f1459532694646efa1884a2df51893031c153923e1d7b63813 | C | 226 | 12 | /** @brief For CMake to try if code compiles. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
int main(int argc, char **argv)
{
struct timeval tv;
gettimeofday(&tv, 0);
}
|
6e8cce392b3d209043b6c81cbca5607381bd7f44c07562ffdc4292aaeb78ea56 | C | 228 | 13 | #include "wtime.h"
#include <sys/time.h>
void wtime(double *t)
{
static int sec = -1;
struct timeval tv;
gettimeofday(&tv, (void *)0);
if (sec < 0) sec = tv.tv_sec;
*t = (tv.tv_sec - sec) + 1.0e-6*tv.tv_usec;
}
|
caf2dc22cd0eaede23dcfa3c27e67d885f0757b07f7009f4e8f75edd3b77e071 | C | 229 | 9 | #include "cs.h"
static CS_INT cs_nonzero (CS_INT i, CS_INT j, CS_ENTRY aij, void *other)
{
return (aij != 0) ;
}
CS_INT cs_dropzeros (cs *A)
{
return (cs_fkeep (A, &cs_nonzero, NULL)) ; /* keep all nonzero entries */
}
|
b6dfa235a86c5bee33a692f7f6d35b27ad74740998a5d3459a19b1452aac052a | C | 232 | 12 | /** @brief For CMake to try if code compiles. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <dirent.h>
#include <direct.h>
int main(int argc, char **argv)
{
return(mkdir("testpath"));
}
|
39eafdb223c4742672146a9723ecbaa4649505149b89e9eab09c832cdfddafdf | C | 236 | 9 | #include "cs.h"
static int cs_tol (int i, int j, double aij, void *tol)
{
return (fabs (aij) > *((double *) tol)) ;
}
int cs_droptol (cs *A, double tol)
{
return (cs_fkeep (A, &cs_tol, &tol)) ; /* keep all large entries */
}
|
02bf5e11900cc6d9cfaf3fce1856b9ecda6d295fbc891b6a5084bbd809abb52e | C | 246 | 13 | /** @brief For CMake to try if code compiles. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main(int argc, char **argv)
{
time_t t = time(NULL);
struct tm d;
(void)localtime_r(&t, &d);
return(0);
}
|
ed90697f26a57dc830eea0d1bde67a74ee1c5c2a9537b31e1c6c3d0fbe6e984e | C | 246 | 13 | #include "common.h"
#include "cart.h"
static char *edit6decipherTracks[] =
{
"decipher",
"decipherSnvs"
};
void cartEdit6(struct cart *cart)
{
cartTurnOnSuper(cart, edit6decipherTracks, ArraySize(edit6decipherTracks), "decipherContainer");
}
|
7126ad91d6c5c5e84b6ee1f5e6f7119f26cd16c6c75654504fdc7460344e06f7 | C | 252 | 9 | #include "cs.h"
static CS_INT cs_tol (CS_INT i, CS_INT j, CS_ENTRY aij, void *tol)
{
return (CS_ABS (aij) > *((double *) tol)) ;
}
CS_INT cs_droptol (cs *A, double tol)
{
return (cs_fkeep (A, &cs_tol, &tol)) ; /* keep all large entries */
}
|
921a5e3d2383493ba7d93188210c1d5371206619308cf1889cd5bc7fa52e2f17 | C | 259 | 16 | #include <stdio.h>
#define A(X) _Generic(X, float : 0.1f, double : 0.1)
#define B(X) _Generic(X, float : 0.3f, double : 0.3)
int main(void) {
typeof(REAL) a, b, c;
a = A(a);
b = B(b);
c = a + b;
printf("%f + %f = %f\n", a, b, c);
return 0;
}
|
8d390966a3fb7f638b8d80bc149cc605ec4b9a0f9bb13b3dd8637e6e31ca0d96 | C | 260 | 13 | /** @brief For CMake to try if code compiles. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
int main(int argc, char **argv)
{
return(mkdir("testpath", 0777));
}
|
a3ae25099ce6c112fc5e9e7539fc976e0099c900aeacd19ea00340f9f7380af6 | C | 264 | 16 |
#include "common.h"
#include "cart.h"
static char *edit4tracksOmim[] =
{
"omimAvSnp",
"omimGene2",
"omimLocation"
};
void cartEdit4(struct cart *cart)
{
int length = ArraySize(edit4tracksOmim);
cartTurnOnSuper(cart, edit4tracksOmim, length, "omimContainer");
}
|
aa3b86ed0fbcc5bf7bbde891147eb7ff65333152227674f5bb134bcb4128f859 | C | 273 | 13 | /** @brief For CMake to try if code compiles. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <math.h>
int main(int argc, char **argv)
{
struct timespec ts[2];
return(clock_gettime(CLOCK_REALTIME, &ts);
}
|
c350edd8c84c932278bdc2d18d3327294e71ad835f3464bb8762a01e7905ccc1 | C | 274 | 15 | #include "UniformField.H"
#include "vector.H"
#include "IOstreams.H"
using namespace Foam;
int main()
{
UniformField<scalar> uf1(13.1);
UniformField<vector> uf2(vector(1, 2, 3));
Info<< "uf1 = " << uf1[22] << "; uf2 = " << uf2[1002] << endl;
return 0;
}
|
ee2e35e6eb3dd552f1ad1c9f3f470e2207eab31f522ecca3a295469d0401d500 | C | 281 | 14 | /** @brief For CMake to try if code compiles. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <math.h>
int main(int argc, char **argv)
{
struct timespec ts[2];
(void)timespec_get(&ts[0], TIME_UTC);
return(0);
}
|
c32bd4f3a3a83310d8526ad829d55f258cae24b1a9bdc3986a7ae4151431ddc4 | C | 284 | 17 | #include <stdio.h>
#include <stdlib.h>
double add_func(double a, double b) {
return a + b;
}
int main(void) {
double x = 1.5;
double y = 2.5;
double res = add_func(x, y);
printf("Result: %f\n", res);
if (res != 4.0) {
return 1;
}
return 0;
}
|
d962d3f2d459fc1c66c5c0194e3663ca1ae8ba4b2a72d021fe21ce3835f06e88 | C | 287 | 12 | #include <sys/types.h>
#include <unistd.h>
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
unsigned int *pr;
plhs[0] = mxCreateNumericMatrix(1,1,mxUINT32_CLASS,mxREAL);
pr = mxGetData(plhs[0]);
*pr = (unsigned int) getpid();
}
|
a86c3a96937458e74b1481cfcf4f1ae2dc178a00421b7b9b34cf1bf7634ad1e6 | C | 291 | 16 | #include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
assert(argc == 2);
int p = atoi(argv[1]);
float a = 1.25;
float b = pow(2, -p);
for (int i = 0; i < ITERATIONS; i++) {
printf("%.13a\n", a + b);
}
return 0;
}
|
9f5014cc32ba2eb9cfa87d34e1979ee1dfad7890c1f615bd0d3ea1fa2022c824 | C | 293 | 16 | #include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
assert(argc == 2);
int p = atoi(argv[1]);
double a = 1.25;
double b = pow(2, -p);
for (int i = 0; i < ITERATIONS; i++) {
printf("%.13a\n", a + b);
}
return 0;
}
|
aaf36f7196bfcb376fc0252f3fff28e15ca16c2a44dc6c517e5d1e46e26a2dfc | C | 300 | 10 | #include <stdio.h>
void __attribute__((constructor)) init_unbufferPrintf(void);
void __attribute__((constructor)) init_unbufferPrintf(void){
setbuf(stdout,NULL);
};
void __attribute__((destructor)) finalize_unbufferPrintf(void);
void __attribute__((destructor)) finalize_unbufferPrintf(void){
};
|
70bbe1b1f3e49d449aa10a98e1aacf0a70ac81a23c42cb873938b5baedf71456 | C | 301 | 23 | #include <stdlib.h>
#include <stdio.h>
#define REAL double
#define N_ITER 100
int main(void) {
int i;
/* initialize random seed */
srand(0);
REAL sum = 0.0;
/* Sum 0.1 N_ITER time */
for (i=0; i<N_ITER; i ++) {
sum += 0.1;
fprintf(stderr, "%.13a\n", sum);
}
return 0;
}
|
35c79dfb642f958ec461b806cd2f4d387be014a0b9107c0c858085cb1e0144cd | C | 314 | 14 | #include <stdio.h>
#include <stdlib.h>
#define FMT(X) _Generic((X), double : strtod, float : strtof)
int main(int argc, char *argv[]) {
REAL sum = 0.0;
REAL a = FMT(sum)(argv[1], NULL);
REAL b = FMT(sum)(argv[2], NULL);
for (int i = 0; i < 1000; i++) {
sum = a + b;
printf("%.13a\n", sum);
}
}
|
67bd2af8c9a27b304b984922f8d9189a773e3999344c021571ff8866739e2ace | C | 315 | 9 | #include "cs.h"
/* x = b(p), for dense vectors x and b; p=NULL denotes identity */
int cs_pvec (const int *p, const double *b, double *x, int n)
{
int k ;
if (!x || !b) return (0) ; /* check inputs */
for (k = 0 ; k < n ; k++) x [k] = b [p ? p [k] : k] ;
return (1) ;
}
|
71207b017f40600781a118d721557a6079f5a7d996f7920cf6f5ffd04f82e40d | C | 316 | 9 | #include "cs.h"
/* x(p) = b, for dense vectors x and b; p=NULL denotes identity */
int cs_ipvec (const int *p, const double *b, double *x, int n)
{
int k ;
if (!x || !b) return (0) ; /* check inputs */
for (k = 0 ; k < n ; k++) x [p ? p [k] : k] = b [k] ;
return (1) ;
}
|
a9144fa3885024b95f8a4e5b2a8c9aea0e5296ca480fe113b81744f3e8908ff9 | C | 317 | 14 | /** @brief For CMake to try if code compiles. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main(int argc, char **argv)
{
struct tm d;
time_t t;
d.tm_year=2014-1900; d.tm_mday=21; d.tm_mon=7;
d.tm_hour=19; d.tm_min=32; d.tm_sec=12; d.tm_isdst=-1;
t=timegm(&tm);
}
|
d6861dfc258ae40aee5c82b1c2b7fa771cf251a3a706e1a9ff2b838e4df82073 | C | 331 | 9 | #include "cs.h"
/* x = b(p), for dense vectors x and b; p=NULL denotes identity */
CS_INT cs_pvec (const CS_INT *p, const CS_ENTRY *b, CS_ENTRY *x, CS_INT n)
{
CS_INT k ;
if (!x || !b) return (0) ; /* check inputs */
for (k = 0 ; k < n ; k++) x [k] = b [p ? p [k] : k] ;
retu... |
d7903a3e4787e1f4f4d2fdb8cb40e875ad9d43cf129c6c71a3d0751f640ed4f4 | C | 332 | 9 | #include "cs.h"
/* x(p) = b, for dense vectors x and b; p=NULL denotes identity */
CS_INT cs_ipvec (const CS_INT *p, const CS_ENTRY *b, CS_ENTRY *x, CS_INT n)
{
CS_INT k ;
if (!x || !b) return (0) ; /* check inputs */
for (k = 0 ; k < n ; k++) x [p ? p [k] : k] = b [k] ;
ret... |
d63ed5983d355df810cac9b49a4e116516231916eca974ec8dad6ae64c6b9eb1 | C | 334 | 21 | #include<assert.h>
#include<stdlib.h>
#include<stdio.h>
#include<float.h>
double f(double z) {
return z-1.111111111112;
}
double g(double z) {
return z-1.111111111112;
}
int main (void)
{
double z = 1.111111111111 ;
double r1 = f(z);
printf("%a\n", r1);
double r2 = g(z);
fprintf(stderr, "... |
13dbcc072742af0b573b13ed255b5514357370b62a4cabab5d7a83df64a1681d | C | 340 | 24 | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
double Fdouble(double a){
return a - 10;
}
float Ffloat(float a){
return a - 10;
}
int main(int argc, char const *argv[])
{
for (int i = 1; i < 111; i += 10){
float f = i + 0.333;
Ffloat(f);
Ffloat(-f);
double d = i + 0.333;
Fdouble(d);
Fdouble(... |
176997cdd98d67778f8c99e261524da597a9099bb062c295f7741ec0ad2796ca | C | 346 | 27 | #include <iostream>
#include <unistd.h>
using namespace std;
int main()
{
int *ptrs[500000];
// for (;;);
cerr << "allocating ints\n";
for (int i=0; i<500000; i++)
{
ptrs[i] = new int[1];
delete[] ptrs[i];
}
for (;;);
cerr << "allocating double\n";
new double[... |
314c695d164033c685293e5e40e05b23987a6b5fcbd598a85a5beead758de876 | C | 348 | 22 | #include <stdio.h>
#include <stdlib.h>
#define N 100
float dbl2flt(double a) { return (float)a; }
int main(int argc, char *argv[]) {
if (argc < 2) {
printf("Usage: %s <double>\n", argv[0]);
return 1;
}
double a = atof(argv[1]);
for (int i = 0; i < N; i++) {
float b = dbl2flt(a);
printf("%.... |
ead5a7e711931225ab27350304f5eab44cd3b68d2f3878a0fbd6d423f0d81f27 | C | 364 | 27 | void calc(int count)
{
int s = 1;
int t = 2;
int u = 3;
int v = 4;
int x = 5;
int y = 6;
int z = 7;
int i,j;
for (i=0; i<count; ++i)
{
int xx = s*t + u*v+i;
int yy = x+y+z+i;
int sum = 0;
for (j=0; j<count;++j)
sum += xx + yy + j;
_printInt(sum);
s += 1;
t += 1;
u += 1;
v += 1;
... |
463cb98c82d97a80d6e493bab8edae7496afbb76c8b72c4963ab8e8cfbc9516a | C | 386 | 18 | #include <stdio.h>
int main() {
double a = 0.0;
for (int i=0; i < 100; i++) a += 0.1;
for (int i=0; i < 100; i++) a -= 0.1;
/* The branch below is numerically unstable; depending on the previous
* rounding errors a is either positive or negative */
if (a>0.0) {
printf("positive branch taken\n");
}... |
db95a45154720bd16ee1f1733fcb2150dc427b2e8aa9775d35f92531d770186f | C | 388 | 22 | // Dummy test to make sure that the vfc_probes system works properly
#include <stdio.h>
#include "vfc_probes.h"
int main(void) {
vfc_probes probes = vfc_init_probes();
float res = 1000.0f;
float inc = 0.0001f;
for(int i=0; i<100; i++) {
res = res + inc;
}
vfc_probe(&probes, "dummy... |
eae0edfb0f83ab5a66d7404005d2e7cfa7f3d1819003bd5fe00f9d0b981972cc | C | 388 | 12 | #include <stdbool.h>
bool f_ogt(double a, double b) { return (a > b); }
bool f_ole(double a, double b) { return (a <= b); }
// vectorized comparisons in aarch64 are not supported in LLVM15
#if (__x86_64__)
typedef double double4 __attribute__((ext_vector_type(4)));
typedef long long4 __attribute__((ext_vector_type(4)... |
a280f29f5223295de44fd683aede0551e547a2d665a0ed1d52ef35758a161974 | C | 397 | 15 | /* Stuff lifted from hgTables that should be libified. */
/* Copyright (C) 2014 The Regents of the University of California
* See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
#include "common.h"
//#*** duplicated many places... htmlshell?
void nbSpaces(int count)
/* Print some non-b... |
2090256c4b9a219f26f842d4fe06e17291f056399b56517931fdc4b2fc169fc2 | C | 422 | 22 | #include <assert.h>
#include <stdio.h>
int main(int argc, char **argv) {
float taba[100];
float tabb[100];
int tabc[100];
for (int i = 0; i < 100; i++) {
taba[i] = (i % 2 == 0) ? i * 1.2f : i * 1.1f;
tabb[i] = (i % 2 == 0) ? i * 1.1f : i * 1.2f;
}
for (int i = 0; i < 100; i++) {
tabc[i] = tab... |
ecf017cdfa525e4f5ecff5b6edeb7c9eb9d7283fa4af24b67c7d5a44309a276e | C | 422 | 15 | #include "cs.h"
/* load a triplet matrix from a file */
cs *cs_load (FILE *f)
{
int i, j ;
double x ;
cs *T ;
if (!f) return (NULL) ; /* check inputs */
T = cs_spalloc (0, 0, 1, 1, 1) ; /* allocate result */
while (fscanf (f, "%d %d %lg\n", &i, &j, ... |
c7d20b125a800f7f254295a13f5018dbc87e4328f3f0680e5decbede59861a63 | C | 426 | 17 | #include "cs.h"
/* y = A*x+y */
int cs_gaxpy (const cs *A, const double *x, double *y)
{
int p, j, n, *Ap, *Ai ;
double *Ax ;
if (!CS_CSC (A) || !x || !y) return (0) ; /* check inputs */
n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ;
for (j = 0 ; j < n ; j++)
{
for (p = Ap [j] ; p ... |
3c0764f58549e4c190f1dd4a080bd61f20b45b0ef382a347db2ad9cbbd1ac4a9 | C | 435 | 13 |
#include "common.h"
#include "cart.h"
void cartEdit5(struct cart *cart)
{
cartMatchValue(cart, "gnomadVariantsV4", "gnomadVariantsV4.1");
cartMatchValue(cart, "gnomadExomesV4", "gnomadExomesVariantsV4_1");
cartMatchValue(cart, "gnomadGenomesV4", "gnomadGenomesVariantsV4_1");
cartMatchValue(cart, "gnomadExomesV4_sel",... |
3f1244a51469f0d357aca4cb3a2fb702c3b495c29e9b99bab8b30927d0b1938d | C | 435 | 19 | /** @brief For CMake to try if code compiles. */
#define __STDC_LIB_EXT1__
#define __STDC_WANT_LIB_EXT1__ 1
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main(int argc, char **argv)
{
struct tm d;
time_t t;
d.tm_year=2014-1900; d.tm_mday=21; d.tm_mon=7;
... |
5f6017fcfc82e4b52646c23cfa58e8e8c5b4d2378b7d73ae20d4d0b5b97e446d | C | 437 | 19 | #include<stdio.h>
__attribute__ ((noinline)) double compute(double a, double b) {
return (a-b) + (a*b) + (a/b);
}
int main(void) {
double a = 1.2345678e-5;
double b = 9.8765432e12;
double c = compute(a,b);
double ref = (a-b) + (a*b) + (a/b);
if (c == ref) {
printf("result is correct %g == %g (ref)\n",... |
43c5a886d7e44ec591712d992720e039343406e91f935cc1c74840fa7a039215 | C | 438 | 17 | #include "cs.h"
/* y = A*x+y */
CS_INT cs_gaxpy (const cs *A, const CS_ENTRY *x, CS_ENTRY *y)
{
CS_INT p, j, n, *Ap, *Ai ;
CS_ENTRY *Ax ;
if (!CS_CSC (A) || !x || !y) return (0) ; /* check inputs */
n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ;
for (j = 0 ; j < n ; j++)
{
for (p =... |
431207178af4fa4be48715bf71e4437a45932a0184170dd326cb229bd7abf87e | C | 441 | 30 | #include <stream.h>
main()
{
int* intPtrs[500000];
cerr << "allocating ints\n";
for (int i=0; i<500000; i++)
{
intPtrs[i] = new int[1];
}
cerr << "allocated ints\n";
cerr << "deallocating ints\n";
for (i=0; i<500000; i++)
{
delete[] intPtrs[i];
}
cerr <... |
17fc5ef7311b4b2a999ebdf8d278b7d951e51478d6a70c6378832b1d6fb100fb | C | 448 | 13 | #include "cs.h"
/* add an entry to a triplet matrix; return 1 if ok, 0 otherwise */
int cs_entry (cs *T, int i, int j, double x)
{
if (!CS_TRIPLET (T) || i < 0 || j < 0) return (0) ; /* check inputs */
if (T->nz >= T->nzmax && !cs_sprealloc (T,2*(T->nzmax))) return (0) ;
if (T->x) T->x [T->nz] = x ;
... |
9f3d4d911f0ed996b448b5ae7093efdd7408d72947a0c7f3933aeff69cf25ab2 | C | 450 | 30 | #include "stream.h"
#include <unistd.h>
#include <stdlib.h>
main()
{
int *ptrs[500000];
cerr << "allocating ints\n";
for (int i=0; i<500000; i++)
{
ptrs[i] = (int*)malloc(sizeof(int));
}
// for (;;);
cerr << "deallocating ints\n";
for (i=0; i<500000; i++)
{
free(... |
20df1249e02a964cc2ddfc6ff062daf07af9ba0d657ff0e9c1919716c3f750ab | C | 457 | 20 | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
FILE *log_file = fopen("log", "w");
if (log_file == NULL) {
perror("Failed to open log file");
return EXIT_FAILURE;
}
double a = 3.14;
double b = 2.71;
double c = a + b;
fprintf(log_file, "%.13a+%.13a=%.13a\n", a, b, c);
... |
1b7b3d74f3e562e5c7ba47c370ee96ad86e9e8424ccdf5acfd10d7d5a8408473 | C | 459 | 13 | #include "cs.h"
/* add an entry to a triplet matrix; return 1 if ok, 0 otherwise */
CS_INT cs_entry (cs *T, CS_INT i, CS_INT j, CS_ENTRY x)
{
if (!CS_TRIPLET (T) || i < 0 || j < 0) return (0) ; /* check inputs */
if (T->nz >= T->nzmax && !cs_sprealloc (T,2*(T->nzmax))) return (0) ;
if (T->x) T->x [T->nz... |
03a65e452408c098618b8674047fa916c1a7dde79e0e25b2cc06c3a2ee8a7092 | C | 461 | 15 | #include "cs.h"
/* 1-norm of a sparse matrix = max (sum (abs (A))), largest column sum */
double cs_norm (const cs *A)
{
int p, j, n, *Ap ;
double *Ax, norm = 0, s ;
if (!CS_CSC (A) || !A->x) return (-1) ; /* check inputs */
n = A->n ; Ap = A->p ; Ax = A->x ;
for (j = 0 ; j < n ; j++)
... |
5d3c27e91aeb7326eea4b033ca81854d40babacd6413a4cf4d645a559cb1c6fe | C | 463 | 23 | #include<assert.h>
#include<stdlib.h>
#include<stdio.h>
#include<float.h>
int main (int argc, char ** argv)
{
assert(argc == 2);
/* Exemple taken from http://people.cs.clemson.edu/~steve/CPLSCMODS/123infty/floatexamples.new */
double z = atof(argv[1]);
double a = z/3.0;
double b = z/5.0;
dou... |
78d3f7aa12b921217912e9d3be6e7e5b769fb443aad92a5e71568a34cfd178e9 | C | 467 | 11 | #include "cs.h"
/* pinv = p', or p = pinv' */
int *cs_pinv (int const *p, int n)
{
int k, *pinv ;
if (!p) return (NULL) ; /* p = NULL denotes identity */
pinv = cs_malloc (n, sizeof (int)) ; /* allocate result */
if (!pinv) return (NULL) ; /* out of memory */
... |
f77bed2c42f900ad11869da6ee3b7366423c384fd633b9cf37cbee75cd26bdce | C | 473 | 25 | #include <assert.h>
#include <float.h>
#include <stdio.h>
#include <stdlib.h>
double coefs[] = {-200., 6600., -84480., 549120., -2050048.,
4659200., -6553600., 5570560., -2621440., 524288.};
int main(int argc, char **argv) {
assert(argc == 2);
double z = atof(argv[1]);
double r = 1.... |
649b35b4701d64752b41a4944bedf83c85365b26fedad6af98ad944ae5c89607 | C | 478 | 19 | #include <interflop/interflop.h>
/* Repeated multiplication -- result grows quickly, making it sensitive to
* both precision reduction (MCA noise) and exponent-range clipping (vprec). */
float compute_float(void) {
float r = 3.25938657906f;
float p = 4.05896796763f;
for (int i = 0; i < 5; i++)
r = r * p;
... |
818437697dc4a2f9f83636f30d291ad6beb83b2d186f0d50526f6673a0988f73 | C | 479 | 16 | #include "cs.h"
/* 1-norm of a sparse matrix = max (sum (abs (A))), largest column sum */
double cs_norm (const cs *A)
{
CS_INT p, j, n, *Ap ;
CS_ENTRY *Ax ;
double norm = 0, s ;
if (!CS_CSC (A) || !A->x) return (-1) ; /* check inputs */
n = A->n ; Ap = A->p ; Ax = A->x ;
for (j = 0 ... |
c49e3be1be5266fc7b803856080d4c5558b3e0327aeed0ea1f5882abbc745747 | C | 482 | 11 | #include "cs.h"
/* pinv = p', or p = pinv' */
CS_INT *cs_pinv (CS_INT const *p, CS_INT n)
{
CS_INT k, *pinv ;
if (!p) return (NULL) ; /* p = NULL denotes identity */
pinv = cs_malloc (n, sizeof (CS_INT)) ; /* allocate result */
if (!pinv) return (NULL) ; /* ou... |
f190018b4ebf1ae7f22ba79799caef116ae8f1b72b01d6065fa173371b81a87f | C | 509 | 18 | /* ========================================================================== */
/* === MATLAB/sparse2 mexFunction =========================================== */
/* ========================================================================== */
/* Identical to the "sparse" function in MATLAB, just faster. */
#include ... |
9e0f692f8fa9d12abb66d981212a4afbfa683f4fec5c798765f1877b4f526093 | C | 512 | 18 | #include "cs.h"
/* solve Lx=b where x and b are dense. x=b on input, solution on output. */
int cs_lsolve (const cs *L, double *x)
{
int p, j, n, *Lp, *Li ;
double *Lx ;
if (!CS_CSC (L) || !x) return (0) ; /* check inputs */
n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ;
for (j ... |
b3bd8066cf81a28bba27891b40170b6b1cacfe27582d82c37ca4fb5072fff184 | C | 517 | 18 | #include "cs.h"
/* solve L'x=b where x and b are dense. x=b on input, solution on output. */
int cs_ltsolve (const cs *L, double *x)
{
int p, j, n, *Lp, *Li ;
double *Lx ;
if (!CS_CSC (L) || !x) return (0) ; /* check inputs */
n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ;
for (... |
85e46ae7e6f20eb9c4092c7ca0b5b789c69f6e1f7caa521ba486e665f340fec8 | C | 518 | 18 | #include "cs.h"
/* solve U'x=b where x and b are dense. x=b on input, solution on output. */
int cs_utsolve (const cs *U, double *x)
{
int p, j, n, *Up, *Ui ;
double *Ux ;
if (!CS_CSC (U) || !x) return (0) ; /* check inputs */
n = U->n ; Up = U->p ; Ui = U->i ; Ux = U->x ;
for (... |
9e5264be6e2227d6de3cf6be7bd71df110c35ac1115792250abc51febf9088e1 | C | 518 | 28 | #include <stdio.h>
#include <stdlib.h>
typedef unsigned int u_32;
int main(int argc, char const *argv[])
{
if (argc < 2){
fprintf(stderr, "./test [tolerance]\n");
abort();
}
union {u_32 i; float f;} a_32;
union {u_32 i; float f;} b_32;
union {u_32 i; float f;} c_32;
int tolerance = atoi(argv[1]) - 1;
a_... |
dd299724045a63d212b12c14605e0024bd7763c469a44f132677cf63ca2b16ab | C | 519 | 18 | #include "cs.h"
/* solve Ux=b where x and b are dense. x=b on input, solution on output. */
int cs_usolve (const cs *U, double *x)
{
int p, j, n, *Up, *Ui ;
double *Ux ;
if (!CS_CSC (U) || !x) return (0) ; /* check inputs */
n = U->n ; Up = U->p ; Ui = U->i ; Ux = U->x ;
for (j ... |
4ed61753d71e596ace2abefe5a96d5ad51f7136b3ec0940f0dcbf65b2b3cfd90 | C | 522 | 18 | #include "cs.h"
/* solve Lx=b where x and b are dense. x=b on input, solution on output. */
CS_INT cs_lsolve (const cs *L, CS_ENTRY *x)
{
CS_INT p, j, n, *Lp, *Li ;
CS_ENTRY *Lx ;
if (!CS_CSC (L) || !x) return (0) ; /* check inputs */
n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ;
... |
c2230e486151211a6f21bd89a94cacca9c009b3f7c4dc0585745787332a6fc37 | C | 525 | 26 | #include <assert.h>
#include <float.h>
#include <interflop/interflop.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
assert(argc == 3);
int change_prec = atoi(argv[1]);
int change_range = atoi(argv[2]);
if (change_prec)
interflop_call(INTERFLOP_SET_PRECISION_BINARY32, 10);
... |
fa06606a7d201f7470a8f563b564c5a40819f44f28f638f192bff6ed43f86595 | C | 528 | 27 | #include<pandaseq-plugin.h>
HELP("Drops empty (zero-length) output sequences.", "empty");
VER_INFO("1.0");
static bool check_func(
PandaLogProxy logger,
const panda_result_seq *sequence,
void* data) {
(void) logger;
(void) data;
return sequence->sequence_length > 0;
}
OPEN {
*precheck = NULL;
*check = (Pand... |
4528c7a7f84945735fe55a362ecb87c0305fe5f7e584b8326e0f1297413efa2b | C | 529 | 18 | #include "cs.h"
/* solve Ux=b where x and b are dense. x=b on input, solution on output. */
CS_INT cs_usolve (const cs *U, CS_ENTRY *x)
{
CS_INT p, j, n, *Up, *Ui ;
CS_ENTRY *Ux ;
if (!CS_CSC (U) || !x) return (0) ; /* check inputs */
n = U->n ; Up = U->p ; Ui = U->i ; Ux = U->x ;
... |
a155d8d32710d967b2f6439826c125dad99ad9a0fab636fb0f2fd64855b576e3 | C | 544 | 30 | #include <stdlib.h>
#include <stdio.h>
#define xstr(s) str(s)
#define str(s) #s
#define concat(x) loop_##x
#define xconcat(x) concat(x)
#define define_loop(N) \
float xconcat(N)(float *A, int n) { \
float s = 0; \
for (int i = 0; i < n; i++) { \
s += A[i]; \
} \
return s; \
... |
85add7ab7a52559d144a14b3f2b3d1473ef19999b9ebe80f8a36beb079c8a104 | C | 547 | 18 | #include "cs.h"
/* solve L'x=b where x and b are dense. x=b on input, solution on output. */
CS_INT cs_ltsolve (const cs *L, CS_ENTRY *x)
{
CS_INT p, j, n, *Lp, *Li ;
CS_ENTRY *Lx ;
if (!CS_CSC (L) || !x) return (0) ; /* check inputs */
n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ;... |
39e32a6fd1a24dc71ce66125058738daa8d06e85b6bbca4ca5ec31ae991a8f84 | C | 548 | 18 | #include "cs.h"
/* solve U'x=b where x and b are dense. x=b on input, solution on output. */
CS_INT cs_utsolve (const cs *U, CS_ENTRY *x)
{
CS_INT p, j, n, *Up, *Ui ;
CS_ENTRY *Ux ;
if (!CS_CSC (U) || !x) return (0) ; /* check inputs */
n = U->n ; Up = U->p ; Ui = U->i ; Ux = U->x ;... |
69d2ebd48f784392009c9e6667f7d6bd9db43b7d613ad2db23c8be99b272c127 | C | 549 | 29 | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef REAL
#error "REAL must be defined"
#endif
#define FMA(a, b, c) \
_Generic((a), float : fmaf, double : fma, long double : fmal)(a, b, c)
int main(int argc, char *argv[]) {
if (argc != 4) {
... |
f9b77771b672613c6961d585103935e34c1995d24376b110042621deeb4309f5 | C | 550 | 29 | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef unsigned long long int u_64;
int main(int argc, char const *argv[])
{
if (argc < 2){
fprintf(stderr, "./test [tolerance]\n");
abort();
}
union {u_64 i; double f;} a_64;
union {u_64 i; double f;} b_64;
union {u_64 i; double f;} c_64;
int tole... |
2f84135323107bd8b495d3dfff4bbefec4b21958edb2c5f48df114684072b484 | C | 551 | 32 | /* Test.c */
#include "common.h"
#include "dnautil.h"
#include "dnaseq.h"
#include "oldGff.h"
#include "wormdna.h"
void doMiddle()
{
struct wormGeneIterator *it;
struct gffGene *gene;
int count = 0;
if ((wormSearchAllGenes(&it))
{
while ((gene = it->next(it))
{
++count;
if (count%1000 ... |
76ebd9c01663f28ebc8cb73796d7f802c6ccb6f826c7afb7f01b90163d18ef0c | C | 553 | 27 |
#include "common.h"
#include "cart.h"
static char *edit2Hg19tracks[] =
{
"dbSnp153Composite",
};
static char *edit2Hg38tracks[] =
{
"dbSnp153Composite",
};
void cartEdit2(struct cart *cart)
/* Moving a SNP 153 to an archive super track. We need
* to turn on the super track if dbSnp153 was on before.
*/
{
// hg3... |
e06490d4ca7f6cae1b68c823fb7a9ecb7cc67d0957449c84eff36e388fc09448 | C | 556 | 19 | #include "cs_mex.h"
/* C = cs_transpose (A), computes C=A', where A must be sparse and real */
void mexFunction
(
int nargout,
mxArray *pargout [ ],
int nargin,
const mxArray *pargin [ ]
)
{
cs Amatrix, *A, *C ;
if (nargout > 1 || nargin != 1)
{
mexErrMsgTxt ("Usage: C = cs_transpose... |
5a80a251725f289b68de79735bffac7b3dbd432281f401e1d718b7e485fb83c5 | C | 561 | 20 | #include "cs_mex.h"
/* cs_print: print the contents of a sparse matrix. */
void mexFunction
(
int nargout,
mxArray *pargout [ ],
int nargin,
const mxArray *pargin [ ]
)
{
cs Amatrix, *A ;
int brief ;
if (nargout > 0 || nargin < 1 || nargin > 2)
{
mexErrMsgTxt ("Usage: cs_print(A,... |
9a92c25c846b0b314f0e91beae8d21e397f9beea5390b864f7bfa05ba8ee841a | C | 564 | 17 | #include "cs.h"
/* p [0..n] = cumulative sum of c [0..n-1], and then copy p [0..n-1] into c */
double cs_cumsum (int *p, int *c, int n)
{
int i, nz = 0 ;
double nz2 = 0 ;
if (!p || !c) return (-1) ; /* check inputs */
for (i = 0 ; i < n ; i++)
{
p [i] = nz ;
nz += c [i] ;
... |
cb5fa77664c3993d1912e9c75372f6e7e2dbe573f48a53f52238559c3a9a2226 | C | 564 | 30 | /*
*
* Copyright (C) 2007, Robert Oostenveld
*
* This implements X+=1, i.e. it increments the scalar X by one.
*
*/
#include <math.h>
#include "mex.h"
void
mexFunction (int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[])
{
double *x;
if (nlhs > 0)
mexErrMsgTxt ("Invalid number of output arg... |
8c804e2d2a9c792d2287ffc06bae33351a6a6876f1351721a0aceda4daaa2a3b | C | 570 | 30 | /*
*
* Copyright (C) 2007, Robert Oostenveld
*
* This implements X=0, i.e. it sets the value of the scalar X to zero.
*
*/
#include <math.h>
#include "mex.h"
void
mexFunction (int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[])
{
double *x;
if (nlhs > 0)
mexErrMsgTxt ("Invalid number of out... |
c4762831b050180200292173934b6ae5bded9dfe947c1e6ba0be0aee3d370cf7 | C | 571 | 30 | #include <stdio.h>
#include <math.h>
#include <assert.h>
#define REAL double
__attribute__ ((noinline)) void solve(const REAL A[4], const REAL B[2], REAL C[2])
{
REAL det = A[0] * A[3] - A[2] * A[1];
REAL detX = B[0] * A[3] - B[1] * A[1];
REAL detY = A[0] * B[1] - A[2] * B[0];
C[0] = detX/det;
C[1] = det... |
1fd6fafb31fe516366955503d69d1d9e5bfcfaba049195716b05ae12319552a2 | C | 572 | 25 | /* Stuff to handle chromGraph tracks, especially custom ones. */
/* Copyright (C) 2011 The Regents of the University of California
* See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
#include "common.h"
#include "hash.h"
#include "linefile.h"
#include "trackDb.h"
#include "chromGraph... |
dbd12da81cf7b90442cc82d3a7ce4b3195be8508d51455668adb10aa1cf9b842 | C | 573 | 33 | /* averagExp - Average expression data within a cluster. */
#include "common.h"
#include "linefile.h"
#include "hash.h"
#include "options.h"
void usage()
/* Explain usage and exit. */
{
errAbort(
"averagExp - Average expression data within a cluster\n"
"usage:\n"
" averagExp XXX\n"
"options:\n"
" -xxx=X... |
8a4d75a46c311bc0aba8cd3b5e48e6ed76fb145be83d3a393a55d4ad72d7643a | C | 579 | 17 | #include "cs.h"
/* p [0..n] = cumulative sum of c [0..n-1], and then copy p [0..n-1] into c */
double cs_cumsum (CS_INT *p, CS_INT *c, CS_INT n)
{
CS_INT i, nz = 0 ;
double nz2 = 0 ;
if (!p || !c) return (-1) ; /* check inputs */
for (i = 0 ; i < n ; i++)
{
p [i] = nz ;
nz += c [... |
3979e4125c383efc6d63de90ab799e7946723fca4ed3a279c75a8edff2bdad1b | C | 582 | 19 | #include "cs.h"
/* apply the ith Householder vector to x */
int cs_happly (const cs *V, int i, double beta, double *x)
{
int p, *Vp, *Vi ;
double *Vx, tau = 0 ;
if (!CS_CSC (V) || !x) return (0) ; /* check inputs */
Vp = V->p ; Vi = V->i ; Vx = V->x ;
for (p = Vp [i] ; p < Vp [i+1] ; p++) /* t... |
8d0135901cdc973d9e9f7ea0574521de35cb4ac567a1ffca3f30cd83237e6b89 | C | 586 | 64 | #include <stdlib.h>
class Int
{
int I;
public:
Int(){}
operator int()
{
return I;
}
};
template<class T>
class List : public T
{
T* v;
int sz;
public:
List()
{
v = new T[sz=10];
}
List(int s)
{
v = new T[sz=s];
}
~List()
{
... |
2d8c8344bd8e0835c314fcf698e99bee44b9f89d5f7e10ba3c1fa12ebffd8402 | C | 595 | 27 | /* bedSort - Sort a BED file by chrom,chromStart. */
/* Copyright (C) 2011 The Regents of the University of California
* See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
#include "common.h"
#include "hash.h"
#include "bed.h"
void usage()
/* Explain usage and exit. */
{
errAbort(
... |
1a2b2db0049a00f59b72ce8b334d8aec5077ac50520a3e286792855546dadc07 | C | 597 | 30 | #include <stdio.h>
#include <stdlib.h>
/* a * b + c in C is contracted by clang into llvm.fmuladd (-ffp-contract=on
* is the default), scalar at -O0 and vectorized at -O3. */
#define N 1024
#ifndef REAL
#define REAL double
#endif
REAL a[N], b[N], c[N], r[N];
__attribute__((noinline)) void muladd(int n) {
for (i... |
bd909527c5c989d2489eb01c43a50ade123f5b575cdcd1bb3bd651c18861bc77 | C | 604 | 25 | /* hgsqladmin - Wrapper around mysqladmin using passwords in .hg.conf. */
/* Copyright (C) 2011 The Regents of the University of California
* See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
#include "common.h"
#include "options.h"
#include "sqlProg.h"
void usage()
/* Explain usage... |
832d57fdaa45edde94e7d9ff59d4375624aaa56e236b8ab895b5abad16a704fc | C | 605 | 19 | #include "cs.h"
/* apply the ith Householder vector to x */
CS_INT cs_happly (const cs *V, CS_INT i, double beta, CS_ENTRY *x)
{
CS_INT p, *Vp, *Vi ;
CS_ENTRY *Vx, tau = 0 ;
if (!CS_CSC (V) || !x) return (0) ; /* check inputs */
Vp = V->p ; Vi = V->i ; Vx = V->x ;
for (p = Vp [i] ; p < Vp [i+1] ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.