sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
36b8ebc362477aad81d29a88f3536653fc4bbcdafbaa3b77afb56451ff57f411
C
525
28
# include <stdio.h> # include <stdlib.h> # include <malloc.h> # include <time.h> # include <math.h> # include "ElectroMConst.h" # include "FunAsser_ElePore.h" void Cal_dA_new(double a, double dte, double dA[Nthe + 1]) { int i, j; for (j = 0; j < Nthe + 1; j++) { if (j == 0) { dA[j] = PI * pow(...
6ceac234b84b12289e67e8dc15447910eaee59d561c74526b8ce9f78e953ae18
C
562
22
/* * Copyright (C) 2008, Robert Oostenveld * F.C. Donders Centre for Cognitive Neuroimaging, Radboud University Nijmegen, * Kapittelweg 29, 6525 EN Nijmegen, The Netherlands * */ #include "buffer.h" #include <pthread.h> pthread_mutex_t mutexstatus = PTHREAD_MUTEX_INITIALIZER; int tcpserverStatus = 0; pthread_mu...
0f17a80342b6044f5a7c73e2d605601d57e3794d110114aab58b5584612639f5
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 (csi *p, csi *c, csi n) { csi 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] ; ...
d99338a24a30b61b1aed61319311bf9659964e7148941fa295e328cdbe45a2f3
C
582
19
#include "cs.h" /* apply the ith Householder vector to x */ csi cs_happly (const cs *V, csi i, double beta, double *x) { csi 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...
2421f6699f196094f3ea9ad381be86b351f93f101dcf9be2edfb2dc86c0555e7
C
666
36
#include <R.h> #include <Rinternals.h> /* This function adds y to W by the i_k-th column and returns W. All W, and y should be in double. */ SEXP W_plus_y_k(SEXP R_W, SEXP R_y, SEXP R_nrow, SEXP R_ncol, SEXP R_i_k){ SEXP R_Z; double *C_Z, *C_W, *C_y; int *C_i_k, *C_nrow, i_k; int i; C_W = REAL(R_W); C_y ...
d669787c0d73fc238cda49592f439426b129e6375b3936261e680fe858b82867
C
674
23
#include <math.h> #include <stdio.h> const double pi = acos(-1); const double duration = 10; // ms const double amplitude_max = 100; // uA const char output_file[] = "sine.cwave"; int main() { int clock_div = (int)(ceil(duration * 1000 / 17.152 / 0x7fff)); int num_of_samples = (int)(round(duration * 1000 /...
f9f2dfe49fb6a5b41276f3c176b4a4ede23747cc3f981f8b3328a162be180e40
C
682
19
#include "cs.h" /* xi [top...n-1] = nodes reachable from graph of G*P' via nodes in B(:,k). * xi [n...2n-1] used as workspace */ csi cs_reach (cs *G, const cs *B, csi k, csi *xi, const csi *pinv) { csi p, n, top, *Bp, *Bi, *Gp ; if (!CS_CSC (G) || !CS_CSC (B) || !xi) return (-1) ; /* check inputs */ n =...
4cb56ff5d8a92256286db08df882642d2cd550feda48b19499871370a99c89ce
C
743
23
#include "cs.h" /* create a Householder reflection [v,beta,s]=house(x), overwrite x with v, * where (I-beta*v*v')*x = s*e1. See Algo 5.1.1, Golub & Van Loan, 3rd ed. */ double cs_house (double *x, double *beta, csi n) { double s, sigma = 0 ; csi i ; if (!x || !beta) return (-1) ; /* check inputs ...
3d123926c79f23d3998200020da8c5de9999f3cf63229e013606b9922c573e32
C
837
51
# include <stdio.h> # include <stdlib.h> # include <malloc.h> # include <time.h> # include <math.h> # include "ElectroMConst.h" # include "FunAsser_ElePore.h" double E_of_THzUniP(double Em, double freq, double PW, double time_Sim, double time_pulse_start) { double E0, time_dura, time_rem; double period_EP_t...
c8cede083b151027f3f2f23b791d81b00e747704fbabd254f086089183846222
C
838
31
/** k2c_embedding_layers.c This file is part of keras2c Copyright 2020 Rory Conlin Licensed under MIT License https://github.com/f0uriest/keras2c */ #include <math.h> #include <stdio.h> #include "k2c_include.h" /** * Embedding Layer. * turns positive integers (indexes) into dense vectors of fixed size. eg. [[4], ...
a7345d87eb324faf9b57c2ae74d469d011cd469643d425e27b402704e9556224
C
854
26
#include "cs.h" /* x=A\b where A is symmetric positive definite; b overwritten with solution */ csi cs_cholsol (csi order, const cs *A, double *b) { double *x ; css *S ; csn *N ; csi n, ok ; if (!CS_CSC (A) || !b) return (0) ; /* check inputs */ n = A->n ; S = cs_schol (order, A) ; ...
5b4df801546616eb88d6a79b45b81136ea8240db5cdedbf59cbbbde35c125afe
C
858
26
#include "cs.h" /* x=A\b where A is unsymmetric; b overwritten with solution */ csi cs_lusol (csi order, const cs *A, double *b, double tol) { double *x ; css *S ; csn *N ; csi n, ok ; if (!CS_CSC (A) || !b) return (0) ; /* check inputs */ n = A->n ; S = cs_sqr (order, A, 0) ; ...
d491aed55184d37dec7cd85c799cafbc9dca5fd67af3c9d6d733df8f12cf9b97
C
861
54
#include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> #include "err.h" void my_err(const char *format, ...) { int i; va_list args; va_start(args, format); fprintf(stderr, "ERROR: "); vfprintf(stderr, format, args); i = strlen(format); if(i < 1 || format[i-1] != '\n') { /...
45c9255955abd1382553af28e3e83932ef764afa9b30b4f4fce2c200527a76e5
C
877
22
#include "cs.h" /* x = x + beta * A(:,j), where x is a dense vector and A(:,j) is sparse */ csi cs_scatter (const cs *A, csi j, double beta, csi *w, double *x, csi mark, cs *C, csi nz) { csi i, p, *Ap, *Ai, *Ci ; double *Ax ; if (!CS_CSC (A) || !w || !CS_CSC (C)) return (-1) ; /* check inputs */ ...
73f2e1844b269b037327ddf004c6095f5b4c7ef9a22223addb145a6253af576d
C
890
35
#include "cs.h" #ifdef MATLAB_MEX_FILE #define malloc mxMalloc #define free mxFree #define realloc mxRealloc #define calloc mxCalloc #endif /* wrapper for malloc */ void *cs_malloc (csi n, size_t size) { return (malloc (CS_MAX (n,1) * size)) ; } /* wrapper for calloc */ void *cs_calloc (csi n, size_t size) { ...
c748478b0871575a1c878665f38a22f156fa00f9905fd14391587a667b413ea4
C
893
22
#include "cs.h" /* return a random permutation vector, the identity perm, or p = n-1:-1:0. * seed = -1 means p = n-1:-1:0. seed = 0 means p = identity. otherwise * p = random permutation. */ csi *cs_randperm (csi n, csi seed) { csi *p, k, j, t ; if (seed == 0) return (NULL) ; /* return p = NULL (ident...
15e478b6ade64c767efaca8f5e0ce1f608354db78d126f15f4e087d4d7a1f238
C
912
34
// Copyright [1999-2017] EMBL-European Bioinformatics Institute // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required b...
a86fed7f970cc87271da91c5f47b7d997d4c54f2c5efbc9dcdef32b521d9a5f3
C
917
24
#include "cs.h" /* depth-first search and postorder of a tree rooted at node j */ csi cs_tdfs (csi j, csi k, csi *head, const csi *next, csi *post, csi *stack) { csi i, p, top = 0 ; if (!head || !next || !post || !stack) return (-1) ; /* check inputs */ stack [0] = j ; /* place j on the s...
f67882b21ee7efc3db3fa61fa6132ae46a171ec4d4447e69550feff43c03c9f4
C
942
25
#include "cs.h" /* drop entries for which fkeep(A(i,j)) is false; return nz if OK, else -1 */ csi cs_fkeep (cs *A, csi (*fkeep) (csi, csi, double, void *), void *other) { csi j, p, nz = 0, n, *Ap, *Ai ; double *Ax ; if (!CS_CSC (A) || !fkeep) return (-1) ; /* check inputs */ n = A->n ; Ap = A->p ; Ai...
0733480a604dc3f436f429edd7050bce6bd7d78905a4c8526ad6a88d2df51d64
C
997
22
#include "cs.h" /* C = compressed-column form of a triplet matrix T */ cs *cs_compress (const cs *T) { csi m, n, nz, p, k, *Cp, *Ci, *w, *Ti, *Tj ; double *Cx, *Tx ; cs *C ; if (!CS_TRIPLET (T)) return (NULL) ; /* check inputs */ m = T->m ; n = T->n ; Ti = T->i ; Tj = T->p ; Tx = T->x...
8d38d6b98e2d0222c0e9ea2a6331bd67db73a2d9733bcb6481685adeb1a02dcc
C
1,002
35
#include <R.h> #include <Rinternals.h> #include <R_ext/Rdynload.h> SEXP W_plus_y_k(SEXP R_W, SEXP R_y, SEXP R_nrow, SEXP R_ncol, SEXP R_i_k); SEXP W_plus_y(SEXP R_W, SEXP R_y, SEXP R_nrow, SEXP R_ncol); SEXP W_divided_by_y(SEXP R_W, SEXP R_y, SEXP R_nrow, SEXP R_ncol); /* From AnalyzeFMRI. */ extern void cluster_mass...
99b46b16c6ce3eaa047247187ed3ccc4a9239f7cd08d3a60ff36ebf1530709ac
C
1,008
25
#include "cs.h" /* C = A' */ cs *cs_transpose (const cs *A, csi values) { csi p, q, j, *Cp, *Ci, n, m, *Ap, *Ai, *w ; double *Cx, *Ax ; cs *C ; if (!CS_CSC (A)) return (NULL) ; /* check inputs */ m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; C = cs_spalloc (n, m, Ap [n], values &&...
2641ab8c0ca8f2fd103fe9aa06b9a5fbfa759e017cef8fe750784d97a6fbe383
C
1,012
22
#include "cs.h" /* consider A(i,j), node j in ith row subtree and return lca(jprev,j) */ csi cs_leaf (csi i, csi j, const csi *first, csi *maxfirst, csi *prevleaf, csi *ancestor, csi *jleaf) { csi q, s, sparent, jprev ; if (!first || !maxfirst || !prevleaf || !ancestor || !jleaf) return (-1) ; *jleaf = ...
9f4dc3187c3ff6e5c7a832676ef944599076b325c099f9b3b88dc115d7640664
C
1,033
25
#include "cs.h" /* C = A(p,q) where p and q are permutations of 0..m-1 and 0..n-1. */ cs *cs_permute (const cs *A, const csi *pinv, const csi *q, csi values) { csi t, j, k, nz = 0, m, n, *Ap, *Ai, *Cp, *Ci ; double *Cx, *Ax ; cs *C ; if (!CS_CSC (A)) return (NULL) ; /* check inputs */ m = A->m ; ...
c5d9a51a909e23c7855c33a40f39293bcf8a4924fa2d6c93013fb65b99f1be44
C
1,073
24
#include "cs.h" /* post order a forest */ csi *cs_post (const csi *parent, csi n) { csi j, k = 0, *post, *w, *head, *next, *stack ; if (!parent) return (NULL) ; /* check inputs */ post = cs_malloc (n, sizeof (csi)) ; /* allocate result */ w = cs_malloc (3*n, sizeof ...
68ac5198aa5c77884c760f8b8f1073b9120882fb1bd05b2d2c03ef8152609e1a
C
1,077
24
/* * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contribut...
4430c0dfb157cfa3c846b9c792f794e714b099d7a600192506ec0fd5b27cece3
C
1,088
42
#include <stdio.h> #include <math.h> #include "k2c_include.h" #include "emmodel_rnadna.h" #include "xraymodel_rnadna.h" float results_array[2] = {0}; float * predict(float input_array[403], int em, int dna) { k2c_tensor input_tensor = {&input_array[0],1,403,{403, 1, 1, 1, 1}}; k2c_tensor results_tens...
ebf0da997d002a68b44e906b64ef10bebbd55d716ca2abfdfea21bbde0b77d7c
C
1,100
23
#include "cs.h" /* find nonzero pattern of Cholesky L(k,1:k-1) using etree and triu(A(:,k)) */ csi cs_ereach (const cs *A, csi k, const csi *parent, csi *s, csi *w) { csi i, p, n, len, top, *Ap, *Ai ; if (!CS_CSC (A) || !parent || !s || !w) return (-1) ; /* check inputs */ top = n = A->n ; Ap = A->p ; Ai ...
9d397966daffc7fea32e078695e2de0d3f48beb5eba52d4591b27e128f226b3b
C
1,134
39
/* * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contribut...
a14e94f6b4f298895a6487e8aabae89b1dca6e063d87845cf77ead08666a0497
C
1,158
26
#include "cs.h" /* ordering and symbolic analysis for a Cholesky factorization */ css *cs_schol (csi order, const cs *A) { csi n, *c, *post, *P ; cs *C ; css *S ; if (!CS_CSC (A)) return (NULL) ; /* check inputs */ n = A->n ; S = cs_calloc (1, sizeof (css)) ; /* allocate result S */...
9a52c9e7736933b4252ef64394ef1c7e58148d7a1370383e514b95f85f3bfd96
C
1,194
30
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contribut...
b7d1a5680b2385e0d16743dfb8eda34a46c57e0338869027cf89a99a7143af7b
C
1,207
44
/* * Copyright (C) 2008, Robert Oostenveld * F.C. Donders Centre for Cognitive Neuroimaging, Radboud University Nijmegen, * Kapittelweg 29, 6525 EN Nijmegen, The Netherlands * */ #include <stdio.h> #include <stdlib.h> #include "buffer.h" /**************************************************************************...
4a362bafa68b7747139e62e3b3951a9a27feec28237cad16629b7d5c42f4b80c
C
1,230
61
#include <winsock2.h> #include "poll.h" int poll (struct pollfd *p, int num, int timeout) { struct timeval tv; fd_set read, write, except; int i, n, ret; char buf[1024]; FD_ZERO (&read); FD_ZERO (&write); FD_ZERO (&except); n = -1; for (i = 0; i < num; ++i) { if (p[i].fd < 0) contin...
30213a72b5b1e5c1a13dbc79c210008d0b75cec91b92a45b6ffc444b58649fd8
C
1,251
68
#include <stdlib.h> #include <stdio.h> #include <string.h> #include "err.h" #include "memutil.h" /** * Wrapper for malloc that prints an error message and exits * if memory could not be allocated */ void *my_malloc(size_t n_bytes) { void *mem; mem = malloc(n_bytes); if(!mem) { my_err("%s:%d: could not...
3b80435bc95c9af885dd5acab2476e721cb5ea8bdeb790bab5013b468f6e3ff2
C
1,256
57
#include "blas.h" #ifdef __cplusplus extern "C" { #endif int daxpy_(int *n, double *sa, double *sx, int *incx, double *sy, int *incy) { long int i, m, ix, iy, nn, iincx, iincy; double ssa; /* constant times a vector plus a vector. uses unrolled loop for increments equal to one. jack dongar...
1e8a5f67a112d4205ad0f73cc9afee3b3bcd50d7083e18f61ce63af4564626dd
C
1,270
69
#include <R.h> #include <Rinternals.h> /* Example: W = [ 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 ] y = [ -1.0 -2.0 -3.0 -4.0 ] W_new = [ 0.0 0.0 0.0 0.0 4.0 4.0 4.0 4.0 ] */ /* This function adds y to W by column and returns Z. All W, and y should be in double. */ SEXP W_plus_y(SEXP R_...
f308ec03dbeb6b341985d7fa579720afa5aead28a78724380796f49569454e86
C
1,273
51
#include "tf.h" #include "utils.h" /* Buffer buf should be big enough to hold D^{x,k+1} beta. */ double tf_obj(double *x, double *y, double *w, int n, int k, double lambda, int family, double *beta, double *buf) { switch (family) { case FAMILY_GAUSSIAN: return tf_obj_gauss(x,y,w,n,k,lambda,beta,...
0c74e87b71011012a88d188548483b580e7e390ff880bf524f4ac710e28926f8
C
1,339
37
#include "cs.h" /* print a sparse matrix; use %g for integers to avoid differences with csi */ csi cs_print (const cs *A, csi brief) { csi p, j, m, n, nzmax, nz, *Ap, *Ai ; double *Ax ; if (!A) { printf ("(null)\n") ; return (0) ; } m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; nzmax = A...
9deb53ae5ca5f3e9f3cbab9d3afaa546cea31e49373d20ef0e5ebd189d3fdd46
C
1,354
46
/* * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contribut...
88de68bdc74d8d6738e36e15234190b93edb02167172fdf02b4b8ea53bad66e3
C
1,360
30
#include "cs.h" /* compute the etree of A (using triu(A), or A'A without forming A'A */ csi *cs_etree (const cs *A, csi ata) { csi i, k, p, m, n, inext, *Ap, *Ai, *w, *parent, *ancestor, *prev ; if (!CS_CSC (A)) return (NULL) ; /* check inputs */ m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; pare...
aa90cbaeaffc9ea3804b8c9de66675b61913a976b46177bf13a39838acd23ff0
C
1,364
28
#include "cs.h" /* solve Gx=b(:,k), where G is either upper (lo=0) or lower (lo=1) triangular */ csi cs_spsolve (cs *G, const cs *B, csi k, csi *xi, double *x, const csi *pinv, csi lo) { csi j, J, p, q, px, top, n, *Gp, *Gi, *Bp, *Bi ; double *Gx, *Bx ; if (!CS_CSC (G) || !CS_CSC (B) || !xi || !x) retur...
ffe91ba4f8e2e91e37bdb0b2e599641c54c63bb60a2612531355b2772a2e5f30
C
1,370
71
#include <math.h> /* Needed for fabs() and sqrt() */ #undef round #include "blas.h" #ifdef __cplusplus extern "C" { #endif double dnrm2_(int *n, double *x, int *incx) { long int ix, nn, iincx; double norm, scale, absxi, ssq, temp; /* DNRM2 returns the euclidean norm of a vector via the function name, so th...
e06e4288078728887619a701f21464342b93033710e7f863633692d3a9857a27
C
1,387
44
/** k2c_normalization_layers.c This file is part of keras2c Copyright 2020 Rory Conlin Licensed under MIT License https://github.com/f0uriest/keras2c */ #include <math.h> #include <stdio.h> #include <string.h> #include "k2c_include.h" /** * Batch normalization layer. * applies a transformation that maintains the ...
d67f12800eddfdc9d88eef41c9c0b9d51206cd17ebf26598b59a62f32c114670
C
1,394
34
#include "cs.h" /* remove duplicate entries from A */ csi cs_dupl (cs *A) { csi i, j, p, q, nz = 0, n, m, *Ap, *Ai, *w ; double *Ax ; if (!CS_CSC (A)) return (0) ; /* check inputs */ m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; w = cs_malloc (m, sizeof (csi)) ; /...
2ca8e4f39c9c064c89ac2a36ef066425e4228083091442ae56b3b50c60f0f8e0
C
1,405
28
#include "cs.h" /* C = alpha*A + beta*B */ cs *cs_add (const cs *A, const cs *B, double alpha, double beta) { csi p, j, nz = 0, anz, *Cp, *Ci, *Bp, m, n, bnz, *w, values ; double *x, *Bx, *Cx ; cs *C ; if (!CS_CSC (A) || !CS_CSC (B)) return (NULL) ; /* check inputs */ if (A->m != B->m || A->...
cbe8c0e49636be3006ebd66d427e209da54fcce3b4a683241f91e11a69e6b8b3
C
1,412
57
// Copyright [1999-2017] EMBL-European Bioinformatics Institute // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required b...
42e6eef7bd715a8ab247c7e6a76e877fd1059dd38355b5bd23ddfad5a13ab84c
C
1,437
75
/* * Copyright (C) 2008, Robert Oostenveld * F.C. Donders Centre for Cognitive Neuroimaging, Radboud University Nijmegen, * Kapittelweg 29, 6525 EN Nijmegen, The Netherlands * */ #include <stdlib.h> #include <stdio.h> #include "buffer.h" /* this is used for debugging */ int verbose = 0; void cleanup_socket(int ...
ae412949018ef206131d82cac4d945681b958a9bcdc1a5e8012bdbb790538e9a
C
1,564
80
/* SK: This has now been moved into util.c for simplification of compile scripts and Makefiles */ /* * timeval.h 1.0 01/12/19 * * Defines gettimeofday, timeval, etc. for Win32 * * By Wu Yongwei * */ #ifndef _TIMEVAL_H #define _TIMEVAL_H #if TIME_WITH_SYS_TIME #include <sys/time.h> #include <time.h> #elif HA...
ba294d0853f0274c3e647bb03ab75611bd06672f93cc120aef53d8e79092a075
C
1,566
35
#include "cs.h" /* C = A*B */ cs *cs_multiply (const cs *A, const cs *B) { csi p, j, nz = 0, anz, *Cp, *Ci, *Bp, m, n, bnz, *w, values, *Bi ; double *x, *Bx, *Cx ; cs *C ; if (!CS_CSC (A) || !CS_CSC (B)) return (NULL) ; /* check inputs */ if (A->n != B->m) return (NULL) ; m = A->m ; anz = A...
3ea0f7a01693b7fbebae90320c0427c366df16117327011feeb459c657d014c7
C
1,624
36
#include "cs.h" /* depth-first-search of the graph of a matrix, starting at node j */ csi cs_dfs (csi j, cs *G, csi top, csi *xi, csi *pstack, const csi *pinv) { csi i, p, p2, done, jnew, head = 0, *Gp, *Gi ; if (!CS_CSC (G) || !xi || !pstack) return (-1) ; /* check inputs */ Gp = G->p ; Gi = G->i ; ...
087c7d42ba817cd0f9f00eb12672e9a675c495f871f30bafdbfef0522fbe9f67
C
1,633
52
/* * Copyright (C) 2011 Florian Rathgeber, florian.rathgeber@gmail.com * * This code is licensed under the MIT License. See the FindCUDA.cmake script * for the text of the license. * * Based on code by Christopher Bruns published on Stack Overflow (CC-BY): * http://stackoverflow.com/questions/2285185 */ #incl...
4cf0ac596773461d559e3ddc105fe9d8fd712d4139c173ee9efb7024b29c086a
C
1,737
39
#include "cs.h" /* C = A(p,p) where A and C are symmetric the upper part stored; pinv not p */ cs *cs_symperm (const cs *A, const csi *pinv, csi values) { csi i, j, p, q, i2, j2, n, *Ap, *Ai, *Cp, *Ci, *w ; double *Cx, *Ax ; cs *C ; if (!CS_CSC (A)) return (NULL) ; /* check inputs */ ...
fc69e2497aa18c4daf84464ba60124985a6cb546cac6d075989a28943aa2ebbc
C
1,738
37
#include "cs.h" /* sparse Cholesky update/downdate, L*L' + sigma*w*w' (sigma = +1 or -1) */ csi cs_updown (cs *L, csi sigma, const cs *C, const csi *parent) { csi n, p, f, j, *Lp, *Li, *Cp, *Ci ; double *Lx, *Cx, alpha, beta = 1, delta, gamma, w1, w2, *w, beta2 = 1 ; if (!CS_CSC (L) || !CS_CSC (C) || !paren...
2d07dfbddb816bc9157de1008794546c566bb3a604281dd0ab01a43a44a9dc6b
C
1,866
53
#include "cs.h" /* x=A\b where A can be rectangular; b overwritten with solution */ csi cs_qrsol (csi order, const cs *A, double *b) { double *x ; css *S ; csn *N ; cs *AT = NULL ; csi k, m, n, ok ; if (!CS_CSC (A) || !b) return (0) ; /* check inputs */ n = A->n ; m = A->m ; if (m >=...
714b4adfb081f8ef2c7efd329509c391f8ff2bfac5187fdbff7cc4dcced70b7f
C
1,886
41
#include "cs.h" /* find the strongly connected components of a square matrix */ csd *cs_scc (cs *A) /* matrix A temporarily modified, then restored */ { csi n, i, k, b, nb = 0, top, *xi, *pstack, *p, *r, *Ap, *ATp, *rcopy, *Blk ; cs *AT ; csd *D ; if (!CS_CSC (A)) return (NULL) ; /* c...
6e1fdaf943afd48eaf009d4d78a94d8df9534c7b8faa10079c82e27c59fb125d
C
2,285
70
// Copyright [1999-2017] EMBL-European Bioinformatics Institute // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required b...
50d3c2b8cb1ba71c536d16e1260eeab3e2f300603ba69a595b268fc5a5e7a164
C
2,301
96
/* * real.c * * Created on: Apr 20, 2013 * Author: Rafat Hussain */ #include <stdio.h> #include "real.h" fft_real_object fft_real_init(int N, int sgn) { fft_real_object obj = (fft_real_object)malloc(sizeof(struct fft_real_set) + sizeof(fft_data) * (N / 2)); obj->cobj = fft_init(N / 2, sgn); fo...
1d8717e7f6442fc84ffddb03fcfa5f662d777c66a630fbabb16e4e61d19306dc
C
2,338
102
// Utility functions like CPLEX initialization/closing routines and // list accessors #include "Rcplex2.h" #include <time.h> int forceCplxClose; int numcalls; CPXLPptr lp; CPXENVptr env; void Rcplex_wait (int seconds) { clock_t endwait; endwait = clock() + seconds * CLOCKS_PER_SEC; while (clock() < endwait) {}...
90dc3316dc33ded136e787c6b05f8d4949c71753c0eca825c4d9ca1d01a117f7
C
2,338
102
// Utility functions like CPLEX initialization/closing routines and // list accessors #include "Rcplex2.h" #include <time.h> CPXENVptr env; CPXLPptr lp; int numcalls; int forceCplxClose; void Rcplex_wait (int seconds) { clock_t endwait; endwait = clock() + seconds * CLOCKS_PER_SEC; while (clock() < endwait) {}...
acf7d66683e2f8aac817b76560589eecd2111c72b61f53b42a6844fbbc2703aa
C
2,421
77
/* * Written by Wilco Dijkstra, 1996. The following email exchange establishes the * license. * * From: Wilco Dijkstra <Wilco.Dijkstra@ntlworld.com> * Date: Fri, Jun 24, 2011 at 3:20 AM * Subject: Re: sqrt routine * To: Kevin Ma <kma@google.com> * Hi Kevin, * Thanks for asking. Those routines are public domain...
75e169449e0403c52c2ee6af73cb847a8b7f0b2f8fa0fc1ca76fbe5f10dd716a
C
2,445
105
// Copyright [1999-2017] EMBL-European Bioinformatics Institute // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required b...
01ebe96c159c93a31f9d66747daa1844ead4744c45850d97824b83e3fc5a35ae
C
2,507
65
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contribut...
7325ad8e67912de8b1857411ef5d6fb70363041292a30171e64ea35a8b2b2657
C
2,683
68
/**************************************************************************** * Copyright (C) 2014 by Taylor Arnold, Veeranjaneyulu Sadhanala, * * Ryan Tibshirani * * * * This ...
6787b50ae4f743528e47cebcaa98e80d00fb053110cd5ae7bf2afd2b1217a3b7
C
2,744
62
/**************************************************************************** * Copyright (C) 2014 by Taylor Arnold, Veeranjaneyulu Sadhanala, * * Ryan Tibshirani * * * * This ...
ff43883107f5779c31a1c684aabc8f03756bba8383a7b86d921de25165b0e99e
C
2,807
58
#include "cs.h" /* L = chol (A, [pinv parent cp]), pinv is optional */ csn *cs_chol (const cs *A, const css *S) { double d, lki, *Lx, *x, *Cx ; csi top, i, p, k, n, *Li, *Lp, *cp, *pinv, *s, *c, *parent, *Cp, *Ci ; cs *L, *C, *E ; csn *N ; if (!CS_CSC (A) || !S || !S->cp || !S->parent) return (NULL)...
83f057329240f35129cfbb9d3fc9d4d2203cbff25102d2c4e4add1378b300815
C
2,838
99
// Copyright [1999-2017] EMBL-European Bioinformatics Institute // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required b...
488c3b8d8c3c2de88ef9e214ed40932bdd802e568f9385f3774544d63f492908
C
2,847
61
#include "cs.h" /* column counts of LL'=A or LL'=A'A, given parent & post ordering */ #define HEAD(k,j) (ata ? head [k] : j) #define NEXT(J) (ata ? next [J] : -1) static void init_ata (cs *AT, const csi *post, csi *w, csi **head, csi **next) { csi i, k, p, m = AT->n, n = AT->m, *ATp = AT->p, *ATi = AT->i ; *h...
7af6ecd3ac19a5acec306f814c30e92385862a7ef4f7623f9ba1c80a76ab831e
C
3,038
166
/* * conv.c * * Created on: May 1, 2013 * Author: Rafat Hussain */ #include "conv.h" int factorf(int M) { int N = M; while (N % 7 == 0) { N = N / 7; } while (N % 3 == 0) { N = N / 3; } while (N % 5 == 0) { N = N / 5; } while (N % 2 == 0) { N = N / 2; } return N; } int findnext(int M) { int N = M;...
daf4ebd4e19a7234e29f427c82efb66a8deff34cdc3dad4bc89a1edef234bbaf
C
3,045
82
/* * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contribut...
8b552f9924963d3121c8948db4b86b5296b6f888ca949196f91bac316988c496
C
3,078
83
/* * Copyright (C) 2008, Robert Oostenveld & Christian Hesse * F.C. Donders Centre for Cognitive Neuroimaging, Radboud University Nijmegen, * Kapittelweg 29, 6525 EN Nijmegen, The Netherlands * */ #include <stdio.h> #include <stdlib.h> #include "buffer.h" void print_request(messagedef_t *request) { fprintf(stde...
88e90b68499dd6c732b1ecb8ba6a76dc5f77df48fd726d650ac1665f645ae57c
C
3,082
115
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contribut...
1f4a069cbac6e5feef38be319290cf147849b64001585d1de26a434d1a51f579
C
3,418
105
# include <stdio.h> # include <stdlib.h> # include <malloc.h> # include <time.h> # include <math.h> # include "ProgConst.h" # include "FunAsser_Cal_ion_current.h" void Cal_I_NK_pump_Ventri_Myocy_cell_revised(double Vm_tm1[Nthe + 3], double Tem, double c_K_i_old[Nthe + 1], double c_K_o_old[Nthe + 1], double ...
35fc106948a5d8c104bc5f01f19cb3befae4e2479626e915e831ff1d3a953b91
C
3,422
106
/**************************************************************************** * Copyright (C) 2014 by Taylor Arnold, Veeranjaneyulu Sadhanala, * * Ryan Tibshirani * * * * This ...
8dd9cee55edbb553eaaa80596bcbcab09057770dc57c326a9177c938a2516187
C
3,437
149
#include <string.h> #include <stdio.h> #include <hdf5.h> #include <hdf5_hl.h> #include "memutil.h" #include "sampletab.h" #include "err.h" #include "util.h" /** * Allocates memory for and initializes data structure * that describes the HDF5 table used to store Samples data. * */ SampleTab *sample_tab_new(hid_t...
a6e3776fe871a44b670b4c594daac0e4876a8abb4db012c1c8026d2708e910e7
C
3,438
139
#include <Python.h> #include "pftypes.h" #include "pmatrices.h" #include "data.h" #include "part.h" data *newData(int nTax, int nParts) { data *theData; int i; theData = malloc(sizeof(data)); theData->nTax = nTax; theData->nParts = nParts; theData->parts = malloc(nParts * sizeof(part *)); for(i = 0; i < nPart...
baba741135e06f8b7663e4daf859914dc38d3cb1963645a046cd93424f4b60ed
C
3,515
73
#include "cs.h" /* sparse QR factorization [V,beta,pinv,R] = qr (A) */ csn *cs_qr (const cs *A, const css *S) { double *Rx, *Vx, *Ax, *x, *Beta ; csi i, k, p, m, n, vnz, p1, top, m2, len, col, rnz, *s, *leftmost, *Ap, *Ai, *parent, *Rp, *Ri, *Vp, *Vi, *w, *pinv, *q ; cs *R, *V ; csn *N ; if...
32998618519cfe152e32421a27886043d4707db9ebe0bcff1c45389e564f990c
C
3,521
141
/* * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contribut...
58a1f1e1d37a25a1592aaee63d78fbeb21fd57784740cf16afd3f28cff621834
C
3,539
110
// Copyright [1999-2017] EMBL-European Bioinformatics Institute // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required b...
42ed553d0ad3dcd280bdce9c2599e562a38a8fad223580b50b30ababea6be053
C
3,593
128
// Copyright [1999-2017] EMBL-European Bioinformatics Institute // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required b...
7286ccb5970045bcea0603ad731518237cbdcd16747325af18c02548600f0394
C
3,651
198
#include "blas.h" #ifdef __cplusplus extern "C" { #endif int dgemv_(char *trans, int *m, int *n, double* alpha, double *a, int *lda, double *x, int *incx, double *beta, double *y, int *incy) { /* System generated locals */ long int a_dim1, a_offset, i1, i2; /* Local variables */ long ...
439c24af452cf26145ca0350cb9edf51b2c5a3becb09f156712f72e638a497fd
C
3,713
104
/* * Copyright (C) 2008, Robert Oostenveld * F.C. Donders Centre for Cognitive Neuroimaging, Radboud University Nijmegen, * Kapittelweg 29, 6525 EN Nijmegen, The Netherlands * */ #include <stdio.h> #include <stdlib.h> #include "buffer.h" #define MERGE_THRESHOLD 4096 /* TODO: optimize this value? Maybe lo...
a8e1c8a984035b5fca9fe57662470d9d3e473bc95ff5f2eccd573df513935244
C
3,774
156
#include <stdlib.h> #include <stdint.h> #include <string.h> #include <stdio.h> #include <zlib.h> #include "ksort.h" KSORT_INIT_GENERIC(uint64_t) #include "kseq.h" KSTREAM_INIT(gzFile, gzread, 8192) typedef struct { int n, m; uint64_t *a; int *idx; } bed_reglist_t; #include "khash.h" KHASH_MAP_INIT_STR(reg, bed_r...
479436afdaffa723e9a78542f915c1ecbcba0503e48f458141107db611a6116e
C
3,784
128
// Copyright [1999-2017] EMBL-European Bioinformatics Institute // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required b...
7af78cb1532c26de025823b4422fc8fb217df391cf107b15f533d4fcfdb584ce
C
3,810
87
#include "cs.h" /* compute nnz(V) = S->lnz, S->pinv, S->leftmost, S->m2 from A and S->parent */ static csi cs_vcount (const cs *A, css *S) { csi i, k, p, pa, n = A->n, m = A->m, *Ap = A->p, *Ai = A->i, *next, *head, *tail, *nque, *pinv, *leftmost, *w, *parent = S->parent ; S->pinv = pinv = cs_malloc (m+...
505691b7a28a8b5d665642ba4ae9253d45c93149d093db9b1abfca1d10eb604b
C
3,833
133
/**************************************************************************** * Copyright (C) 2014 by Taylor Arnold, Veeranjaneyulu Sadhanala, * * Ryan Tibshirani * * * * This ...
9cf61f79b0ee964ba7064d1954438302afec23ea89bfe085055c5c368d7391eb
C
3,839
169
#include <stdio.h> #include <string.h> #include "memutil.h" #include "nuc.h" #include "util.h" #include "err.h" static const char NUC_SYMBOL[NUM_NUCS] = {'A', 'C', 'G', 'T', 'M', 'K', 'R', 'Y', 'W', 'S', '-', 'N'}; /** * Converts a nucleotide ID into a character. */ char nuc_id_to_char(const unsi...
22541824c8de217412900f63ad981c90f72388d93d0c57d9a8fc069bba50c2e4
C
3,845
114
# include <stdio.h> # include <stdlib.h> # include <malloc.h> # include <time.h> # include <math.h> # include "ProgConst.h" # include "FunAsser_Cal_ion_current.h" void Cal_I_NK_pump_rat_Neostri_Neur_revised(double Vm_tm1[Nthe + 3], double Tem, double c_K_i_old[Nthe + 1], double c_K_o_old[Nthe + 1], double c...
bca9e73b54be51f9c1d25618df23791b20ebecea50b851413f79b876b7eeb3f4
C
4,009
165
#include <stdarg.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include <stdint.h> #include "kstring.h" int ksprintf(kstring_t *s, const char *fmt, ...) { va_list ap; int l; va_start(ap, fmt); l = vsnprintf(s->s + s->l, s->m - s->l, fmt, ap); // This line does not work with glibc 2.0. See `man snpri...
03b0378c39923ea9ecb2c71b5379ea475b67549103d2350adc51ea9d0066202d
C
4,018
86
#include "cs.h" /* [L,U,pinv]=lu(A, [q lnz unz]). lnz and unz can be guess */ csn *cs_lu (const cs *A, const css *S, double tol) { cs *L, *U ; csn *N ; double pivot, *Lx, *Ux, *x, a, t ; csi *Lp, *Li, *Up, *Ui, *pinv, *xi, *q, n, ipiv, k, top, p, i, col, lnz,unz; if (!CS_CSC (A) || !S) return (NULL...
f4790afb753a612595886c51cc231a0659ad60a2c241df3e42e51b96d237e2de
C
4,022
143
#include <string.h> #include <stdio.h> #include <hdf5.h> #include <hdf5_hl.h> #include "memutil.h" #include "snptab.h" #include "err.h" #include "util.h" #include "snp.h" /** * Allocates memory for and initializes data structure * that describes the HDF5 table used to store SNP data. * A single SNPTab data stru...
2dcacde4c7766cbd8fd92194a4d1bca7902c578cdec0004684019a863416f592
C
4,064
168
#include <Python.h> #include "webrtc/common_audio/vad/include/webrtc_vad.h" #if PY_MAJOR_VERSION >= 3 #define PY3 #endif static PyObject *VadError; const char WebRtcVadDoc[] = "hello."; static void vad_free(PyObject* vadptr) { VadInst* handle = PyCapsule_GetPointer(vadptr, "WebRtcVadPtr"); WebRtcVad_Free(handle...
8c340ab2be9195a57d0140a1ca0ee59fcda1e77df83b93db06ec1e6f59b561ef
C
4,082
119
#include "cs.h" /* allocate a sparse matrix (triplet form or compressed-column form) */ cs *cs_spalloc (csi m, csi n, csi nzmax, csi values, csi triplet) { cs *A = cs_calloc (1, sizeof (cs)) ; /* allocate the cs struct */ if (!A) return (NULL) ; /* out of memory */ A->m = m ; ...
ea773e7b855ffc60e62df9a92ff7a4ef7b01d52f387fe230e0eccd1faebfb9c7
C
4,192
147
/** k2c_core_layers.c This file is part of keras2c Copyright 2020 Rory Conlin Licensed under MIT License https://github.com/f0uriest/keras2c */ #include <math.h> #include <stdio.h> #include <string.h> #include "k2c_include.h" /** * Dense (fully connected) Layer. * * :param output: output tensor. * :param input: ...
c5e66c5d6760dd40d1b52a329a980c65a5a7d416576473f8d693706852411359
C
4,327
134
// Copyright [1999-2017] EMBL-European Bioinformatics Institute // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by a...
a395a1116542798cff9ce23a21324a1a62a5566271c16fd5a70c5eb8b9332da7
C
4,389
108
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contribut...
92aaf5af56b543df77fa2203725297d0abcd4d5bbb8773c5689057d56270d2fa
C
4,468
92
#include "cs.h" /* find an augmenting path starting at column k and extend the match if found */ static void cs_augment (csi k, const cs *A, csi *jmatch, csi *cheap, csi *w, csi *js, csi *is, csi *ps) { csi found = 0, p, i = -1, *Ap = A->p, *Ai = A->i, head = 0, j ; js [0] = k ; /...
0801024094618fac9643cb2d5a74e4c72d3b329a37f19fc737d1c9eef40c237a
C
4,471
193
/**************************************************************************** * Copyright (C) 2014 by Taylor Arnold, Veeranjaneyulu Sadhanala, * * Ryan Tibshirani * * * * This ...
990cb65842e786e60e1cc7cab6596f49623ba54efa81ea2121743c67aa44751e
C
4,499
166
// Copyright [1999-2017] EMBL-European Bioinformatics Institute // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required b...
f825c8b5cc2c3834022a1e062ef46c302b8ea71022fb27e6fd202b5cd75c369f
C
4,613
133
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contribut...
2689050e4baa5ee4abc8735371dc775a0f8cb371cb9d38decd3654a508d3b8be
C
4,786
219
#include "wavefunc.h" void meyer(const int N, const double lb, const double ub, double* phi, double* psi, double* tgrid) { int i; double theta, x, x2, x3, x4, v, cs; const int M = divideby(N, 2); if (M == 0) { printf("Size of Wavelet must be a power of 2"); exit(1); } if (lb >= ub) { printf("upper boun...