sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
c9cbafe3bab10b7b3f3f690b6c28fd8ac7c70923b12bc0e2742351e38e68ab77
C
1,802
41
bool TriangleTriangleIntersection(double *P1,double *P2,double *P3,double *O1,double *O2,double *O3, bool ignore_corners) { int i=0; double A[3],B[3],C[3], E1[3], E2[3]; double inter_xyz[3]; bool check; check=(mind(mind(P1[0],P2[0]),P3[0])>maxd(maxd(O1[0],O2[0]),O3[0]))||(mind(mind(P1[1],P2[1]),P3[...
6abbf8ae68057aa07594247dfb9111bd2501c62d491fa91e7e072079b06b07ed
C
1,823
69
/* * CORE_leadingedges.c * -------------------- * The syntax for this function is described in the M file of * the same name. * * This is a MEX-file for MATLAB. It was compiled using: * * COREmex CORE_leadingedges.c * * samar@cs.stanford.edu, 01/20/06 */ #include "matrix.h" #include "mex.h" #include...
8163c6495f6ba6a47e05dc2d005f211e43f23306d4ce81732ff749c79c5e4e58
C
1,848
53
/* * FILE: CORE_mextools.c * -------------------- * Common MEX utilities for Matlab CORE_function_ MEX files. * Function descriptions can be found in CORE_mextools.h * * samar@cs.stanford.edu, 09/18/05 */ #include "CORE_mextools.h" // ------------------------------------------------------------------------ ...
6018237b3fb43fa32f93746d8b6f3eb6ac167f875e6e3b60c3897235329f10e4
C
1,866
55
/* * CORE_mindist.c * -------------------- * The syntax for this function is described in the M file of * the same name. * * This is a MEX-file for MATLAB. It was compiled using: * COREmex CORE_mindist.c * * samar@cs.stanford.edu, 09/12/05 */ #include "mex.h" #include "matrix.h" #include "CORE_library...
f392566a71f33eb593b168e72559998d19c131b3cf9f7ddff5887f187a58ad31
C
1,881
111
#include "utils.h" /* * given log(a) and log(b), return log(a + b) * */ double log_sum(double log_a, double log_b) { double v; if (log_a < log_b) { v = log_b+log(1 + exp(log_a-log_b)); } else { v = log_a+log(1 + exp(log_b-log_a)); } return(v); } /** * Proc to calculate the value o...
7cbc2a1961cc69730ae1d408e3066bf21726bd3c57dbe56a2389a0a234c5bfe5
C
1,885
54
/*************************************************************************** FindInInterval.c -------------------- begin : June 2008 copyright : (C) 2008 by Michaël Zugaro email : michael.zugaro@college-de-franc...
4da1decacedd1a9cba4fadedcc52b4d86eaa2000f1412f44dd5d9ce5cc35fc50
C
1,887
97
/** @file betweenness_centrality_mex.c * @copyright Stanford University, 2007-2008 * @author David F. Gleich * The mex interface to the matlab bgl wrapper for the topological order func */ /** History * 2007-04-20: Initial version */ #include "mex.h" #if MX_API_VER < 0x07030000 typedef int mwIndex; typedef in...
b52655b35a9d122d2fa4bb9e9f11df68fc9a5439fffb4963c420a94c9faa99ec
C
1,907
64
/*********************************************************************** * mexexpand.c : C mex file * * z = mexexpand(blk,x); * * Input: blk = [n1, n2, ..., nk] * * Output: [x1 x1...x1, x2 x2...x2, ...., xk xk...xk]' * n1 n2 nk * * SDPT3: version 3.0 * Copyr...
229b43ab4c9a12e9aaaa0a2129151111fb22a6e92eee992dba3890408bd8b1b6
C
1,930
60
#define _GNU_SOURCE #include <string.h> #include <stdbool.h> #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include "medaka_bamiter.h" #include "medaka_counts.h" #include "medaka_read_matrix.h" // Demonstrates usage int main(int argc, char *argv[]) { if(argc < 3) { fprintf(stderr, "Usage %s <...
d29f40ee24a8afe73cf69977db1510e5e0296b1da7185e0d991b1c10ee0ab343
C
1,937
68
// (C) Copyright 2018, Nanbo Sun (nanbosun@u.nus.edu) // This file is part of MMLDA-C. // MMLDA-C is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or (at your // option) any...
83c0f42e27b13cfa85d49c420db7e0c3e4f066d4fd5d2ec52f8410f94f2eebd4
C
1,944
77
/* * $Id: zstream.c 6417 2015-04-21 16:03:44Z guillaume $ * Guillaume Flandin */ /* mex -O CFLAGS='$CFLAGS -std=c99' -largeArrayDims zstream.c */ /* setenv CFLAGS "`mkoctfile -p CFLAGS` -std=c99" */ /* mkoctfile --mex zstream.c */ /* miniz: http://code.google.com/p/miniz/ */ #define MINIZ_NO_STDIO #define MINIZ_N...
0abc74ef34f83eca02c92f2652c468ac5eefd786055a30956c37d907c52de88d
C
1,947
68
// (C) Copyright 2004, David M. Blei (blei [at] cs [dot] cmu [dot] edu) // This file is part of LDA-C. // LDA-C is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or (at your ...
055f9ca1b4a849af1633b6ac3e86e9bf80b22a90c81772de15b78caf71b09179
C
1,964
68
// (C) Copyright 2018, Nanbo Sun (nanbosun@u.nus.edu), Xiuming Zhang // This file is part of POLARLDA-C. // POLARLDA-C is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or (a...
2fbf176602da4745e2d7d866b0029d634fe37f311772e78a760f6020d7a5ffb6
C
1,978
54
/*************************************************************************** MatchUpIndices.c - description ------------------- copyright : (C) 2012 by Michaël Zugaro email : mzugaro@andromeda.rutgers.edu ***********************...
f9bc9d04c086391b4228f3e1a7e50de9a7473e79ca8181a9c1785dc94c4c7e83
C
1,999
63
double nnz(double x) { if(absd(x)<1e-16) { return 1e-16; } else { return x; } } void LineLineIntersect(double *P1,double *P2,double *O1,double *O2,double *Val) { double inter_x, inter_y, SlopeA, SlopeB, t, disp, diso, OffsetA, OffsetB, temp; int swap; bool inter; bool check; check=(mind(P1...
342808f0f3a630e8c9b0631e9bf038e8379779fdefa1e4aaa3d40419295dcc2e
C
2,021
77
/* * $Id: zstream.c 6417 2015-04-21 16:03:44Z guillaume $ * Guillaume Flandin */ /* mex -O CFLAGS='$CFLAGS -std=c99' -largeArrayDims zstream.c */ /* setenv CFLAGS "`mkoctfile -p CFLAGS` -std=c99" */ /* mkoctfile --mex zstream.c */ /* miniz: http://code.google.com/p/miniz/ */ #define MINIZ_NO_STDIO #de...
04cc89afaf7ee4c2806f47456ad703bc70d8c6a0c52fb87a1db97ecd1f4f0c1a
C
2,024
67
// (C) Copyright 2018, Nanbo Sun (nanbosun@u.nus.edu) // This file is part of MMLDA-C. // MMLDA-C is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or (at your // option) any...
522948e716d985c80ac413eed4fe4c264acafd9fdf10836b47f097f51a9e050e
C
2,034
67
// (C) Copyright 2004, David M. Blei (blei [at] cs [dot] cmu [dot] edu) // This file is part of LDA-C. // LDA-C is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or (at your ...
2d4968718aa5fa0654cfe2e6aec58f7051eb4a22fb14933bd5dd443617639846
C
2,058
53
void SphereFrom4Points(double *PA, double *PB, double *PC, double *PD, double *Cx, double *Cy, double *Cz, double *L) { double x1, x2, x3, x4; double **a; double m11, m12, m13, m14, m15; int i; a = malloc(4*sizeof(double *)); for (i=0;i<4;i++) { a[i] = malloc(4*sizeof(double)); } x1=PA...
3373f803c1464901c06861f37a701213dad139dc62d565648d9d379177b3ccfd
C
2,069
55
#include <lsl_c.h> #include <stdio.h> /** * Example program that demonstrates how to resolve a specific stream on the lab network and how to * connect to it in order to receive data. */ #define NCHANS 8 int main(int argc, char *argv[]) { unsigned k, t; /* channel index */ lsl_streaminfo info; /* the streamin...
ffffd7fcd6b19299e34cfd75f0432dd8a862ec1f5aa211ac85cdd1998bdeab37
C
2,096
55
#include <stdlib.h> #include <stdbool.h> #include <stdio.h> /** Calculate which columns of an RNN output matrix should be considered * variant. * * @param minor pileup minor indices (non-zero elements count insertion). * @param reference reference sequence including gaps for insertion pileup * columns. * @param...
1254a1ec6f6e7ea1acf3b4c13ac088a361da3ca86ed37850705c28b9bd63957d
C
2,130
52
/*************************************************************************** CountInIntervals.c -------------------- begin : December 2009-2011 copyright : (C) 2009-2011 by Michaël Zugaro email : michael.zugaro@...
d3d9bf85be573640e987f70160ac50e493ad38a55bd7d82377e60d219a4a4b49
C
2,148
106
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "mex.h" #ifdef MX_API_VER #if MX_API_VER < 0x07030000 typedef int mwIndex; #endif #endif void exit_with_help() { mexPrintf( "Usage: libsvmwrite('filename', label_vector, instance_matrix);\n" ); } void libsvmwrite(const char *filename, const mxArr...
6ee28d96db4cd77f4f7efcaedf51b27ee9eb907c61f66cb1096f14e5116f1cea
C
2,209
65
/*************************************************************************** copyright : (C) 2013 by Michaël Zugaro email : michael.zugaro@college-de-france.fr ***************************************************************************/ /**********************************************...
6ad6d576120bf9591a7955245211693ba5d98d5d8041e6b11446a85bb0d0ff8f
C
2,251
87
/* * $Id: zstream.c 8044 2021-01-21 15:08:54Z guillaume $ * Guillaume Flandin */ /* mex -O CFLAGS='$CFLAGS -std=c99' -largeArrayDims zstream.c */ /* setenv CFLAGS "`mkoctfile -p CFLAGS` -std=c99" */ /* mkoctfile --mex zstream.c */ /* miniz: https://github.com/richgel999/miniz */ #define MINIZ_NO_STDIO #define MIN...
03d84ffb7af47d40f2fabfc52f2d80e5b848200a003e455cb722bbb3dddd036b
C
2,286
115
/* * ============================================================== * bfs_mex.c The mex interface to the matlab bgl wrapper. * * David Gleich * 20 April 20020 * ============================================================= */ /* * 19 February 2007 * Updated to use Matlab 2006b sparse matrix interface * * 25...
7b6e8df53f0cadb7ca5aec873e0ba087c9eb5026f85fc00cfc2073770753026e
C
2,291
54
#include <lsl_c.h> #include <stdio.h> #include <stdlib.h> /** * This example program offers an 8-channel stream, float-formatted, that resembles EEG data. * The example demonstrates also how per-channel meta-data can be specified using the description field of the streaminfo object. * * Note that the app sends dat...
932a1a17949a66988ea0174ed54d3681614b6fca448a484c6bb10127670688fe
C
2,313
59
#include <lsl_c.h> #include <stdio.h> int main(int argc, char* argv[]) { int c; /* channel index */ lsl_xml_ptr desc,chns,chn,cap; /* some xml element pointers */ lsl_outlet outlet; /* stream outlet */ lsl_streaminfo info,inf; /* streaminfo objects */ lsl_inlet inlet; /* a stream inlet to get sample...
fe08185c47878c983a07556a6d7fb38e5743530eb0ee60cf2d0e50260f6d3081
C
2,317
70
// (C) Copyright 2018, Nanbo Sun (nanbosun@u.nus.edu), Xiuming Zhang // This file is part of POLARLDA-C. // POLARLDA-C is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or (a...
fa357004aef5ba024d647d8fcd7c4514ebc154aaf147a7bf374b5384fd66037c
C
2,337
56
#include <lsl_c.h> #include <stdio.h> #include <stdlib.h> /** * This example program offers an 8-channel stream, float-formatted, that resembles EEG data. * The example demonstrates also how per-channel meta-data can be specified using the description * field of the streaminfo object. * * Note that the app sends ...
04f00e48af0899b7512d0eac9c85c37827cfb0fcc624aaffe8e32cf0ad279e7d
C
2,342
58
/* ************************************************************ MODULE sdmaux*.c -- Several low-level subroutines for the mex-files in the Self-Dual-Minimization package. % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1)...
1b26e5e132691661f042b6c693f864ae9421415d9aa5bdb7dd53b944c660dbdf
C
2,364
60
#include <lsl_c.h> #include <stdio.h> int main(int argc, char *argv[]) { int c; /* channel index */ lsl_xml_ptr desc, chns, chn, cap; /* some xml element pointers */ lsl_outlet outlet; /* stream outlet */ lsl_streaminfo info, inf; /* streaminfo objects */ lsl_inlet inlet; /* a stream inlet to...
c3140456cdd15233aac6da4cd59e98d56cc150f7c2e69b7a079fde87e1497e3d
C
2,371
133
/* * ============================================================== * components_mex.c The mex interface to the matlab bgl wrapper. * * David Gleich * 21 April 20020 * ============================================================= */ /* * 19 February 2007 * Updated to use Matlab 2006b sparse matrix interface ...
11dd0df8262cfa71b8e2e90844fe01fc2286cce706193362eb4d3eec43e7526b
C
2,380
80
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Softwar...
5e54195a9f2d247e40d2d12369c70e8303cbd50f471c914024cabf86ba716a1e
C
2,381
80
#include "mex.h" void revord(char *input_buf, int buflen, char *output_buf) { int i; /* reverse the order of the input string */ for(i=0;i<buflen-1;i++) *(output_buf+i) = *(input_buf+buflen-i-2); } void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]...
477bfd6174b77780f52cca494ae1ad60e25af6696f1790f36c6788e3d5d56a2f
C
2,412
63
/* Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions */ /*========================================================================= Copyright (c) 2008 Thomas Yeo and Mert Sabuncu All rights reserved. Redistribution and use in source and binary forms, with or without modification, are ...
8957b94a2db8218ab97848510c973453f56927478f0a5b64fc100698fc22d358
C
2,508
76
/* Copyright (c) 1994, 1996-1997, 2000, 2003 MEDICAL RESEARCH COUNCIL All rights reserved Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1 Redistributions of source code must retain the above copyright notice, this li...
2968eb1287a44e9c627c6c6776aff9be2690b26b40e1ed7503f7374622f69fc2
C
2,546
84
bool LineTriangleIntersection(double *A, double *B, double *C, double *P1, double *P2, bool ignore_corners, double *inter_xyz) { bool intersect; double T1[3], T2[3], N[3]; double l; double Pline[3], Vline[3], P[3]; double P_2D[2], A_2D[2], B_2D[2], C_2D[2]; double mi[2], ma[2]; int i, j; ...
14391303e8d85dce1bb103454705bdf909d2e7186fa50ad6a7795b23b178a2fe
C
2,561
84
/*************************************************************************** FindField.c - description ------------------- begin : Wed May 22 2002 copyright : (C) 2002-2012 by Michaël Zugaro email : mzugaro@and...
5aecb330c22f37d67e5c451f62394f10db51f29eae4175b31f754540e539fb20
C
2,563
119
/* * David Gleich * Copyright, Stanford Unviersity, 2007 */ /** * @file test_matching_mex.c * Wrap a call to the libmbgl test_matching function. */ /* * 8 July 2007 * Initial version */ #include "mex.h" #if MX_API_VER < 0x07030000 typedef int mwIndex; typedef int mwSize; #endif /* MX_API_VER */ #include...
30d2e636c59a79b50e633a14037c5405960b25b36b3043b8f32326d4c6347059
C
2,614
75
/* * fast_kmeans_step.c - fast pairwise distance matrix * * Warning: this MEX file works, but is still being updated. * Comments and documentation in particular are a little * slim ... * * Syntax: * [assigns,bestdists,clustersizes,centroids] = * fast_kmeans(waves,centroids,normsqr...
13ae64ddb226ffc5c4eafad9fcf09fe4b307a63cf8a320265360f50ad0fe8e32
C
2,617
94
/** @file planar_drawing_mex.c * @copyright Stanford University, 2008 * @author David F. Gleich * Get extra sets of edges for a planar graph */ /** History * 2008-10-05: Initial version */ #include "mex.h" #if MX_API_VER < 0x07030000 typedef int mwIndex; typedef int mwSize; #endif /* MX_API_VER */ #include "m...
668a549396b15d98539933f9320526f21a72a704d08ca0071181626f54625a95
C
2,623
128
/* * David Gleich * Copyright, Stanford Unviersity, 2007 */ /** * @file dominator_tree_mex.c * Wrap a call to the libmbgl shortest path functions. */ /* * 12 July 2007 * Initial version */ #include "mex.h" #if MX_API_VER < 0x07030000 typedef int mwIndex; typedef int mwSize; #endif /* MX_API_VER */ #incl...
5c11e1fc22e219cb986f6fa9e4ba939315227e84aef042737d38ec668b89b6d2
C
2,699
86
/* compress.c -- compress a memory buffer * Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #define ZLIB_INTERNAL #include "zlib.h" /* ======================================================================...
d768fb4458774cbf6e5da4d27f2bf3cc7afe179be069fe8a34965fe21b671bcb
C
2,712
87
/* Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions */ /*========================================================================= Copyright (c) 2008 Thomas Yeo and Mert Sabuncu All rights reserved. Redistribution and use in source and binary forms, with or without modification, are ...
24adb9ec0fec520a67c3dcba4440b7766b73bc60f3f2e0d04b63687a6764c395
C
2,744
126
// This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Library General Public License as published by // the Free Software Foundation (either version 2 of the License or, at your // option, any later version). This library is distributed in the hope that // it will be ...
9545285f1cb66559756a4eaa2fef8224d468c9e67c84598c126d43af79dc2f16
C
2,761
67
/* ************************************************************ MODULE sdmaux*.c -- Several low-level subroutines for the mex-files in the Self-Dual-Minimization package. % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1)...
c1935020623bf49c06885bc23cd56274b39a9df9f9194ba26b2e6eefe0483724
C
2,766
75
/* ************************************************************ MODULE sdmaux*.c -- Several low-level subroutines for the mex-files in the Self-Dual-Minimization package. % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1)...
87c5f6978bddbd55931de7545baec6eed218775bce95acbc6e358be0ad1a4f07
C
2,770
75
/* ************************************************************ MODULE sdmaux*.c -- Several low-level subroutines for the mex-files in the Self-Dual-Minimization package. % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1)...
946aa814069c92876c9d34ab06f55eb261d96878379a2356285d5874138f63bc
C
2,774
94
/* * CORE_pairdist.c * -------------------- * The syntax for this function is described in the M file of * the same name. * * This is a MEX-file for MATLAB. It was compiled using: * * COREmex CORE_pairdist.c * * samar@cs.stanford.edu, 07/12/05 */ #include "mex.h" #include "matrix.h" #include "CORE_li...
52e4f23a77a1a7d83caf1d1b905fc6330509ae338e0519b85a98953c5db36812
C
2,860
99
/* hfile_net.c -- network backend for low-level input/output streams. Copyright (C) 2013-2014 Genome Research Ltd. Author: John Marshall <jm18@sanger.ac.uk> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to d...
9d568d6bf79050d445ec7d43cb9d7ee3d34addcf6e0648da6d0e6323c2498d8f
C
2,903
81
#include "xorshift128plus.h" uint64_t xorshift128plus(xorshift128plus_key_t * key) { uint64_t s1 = key->part1; const uint64_t s0 = key->part2; key->part1 = s0; s1 ^= s1 << 23; // a key->part2 = s1 ^ s0 ^ (s1 >> 18) ^ (s0 >> 5); // b, c return key->part2 + s0; } void xorshift128plus_jump(xorsh...
e0630276f7af9d4b18505ad4c14654e4115ee2aa317e271a65e850613bbb9723
C
2,905
91
#include <errno.h> #include <string.h> #include "medaka_bamiter.h" #include "medaka_common.h" // iterator for reading bam int read_bam(void *data, bam1_t *b) { mplp_data *aux = (mplp_data*) data; uint8_t *tag; bool check_tag = (strcmp(aux->tag_name, "") != 0); bool have_rg = (aux->read_group != NULL);...
69ea1f9ff62317b752a6e63c96cff702bc34f082708a7bcd8c767bc2c73b70e5
C
2,923
122
/* * ============================================================== * path_from_pred.c A mex interface to the matlab bgl function * to convert a predecessor array into a path * * David Gleich * 17 April 2007 * ============================================================= */ /* * History * * 17 April 2007 *...
31922aa982ee12fd28d1ce5fe6a94a3f07c2a941c821b566a881ca21845cdfaf
C
2,966
93
/* uncompr.c -- decompress a memory buffer * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #define ZLIB_INTERNAL #include "zlib.h" /* ===============================================================...
409031c31ef180d694ea5e98e893ae0e23006014779e9b36f18957851d4244b8
C
3,209
88
/* Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions */ /*========================================================================= Copyright (c) 2008 Thomas Yeo and Mert Sabuncu All rights reserved. Redistribution and use in source and binary forms, with or without modification, are ...
2a3b609533ce37b658817b9a1d21ac8f0f8012c1c14bbd5520f925d3003e84d6
C
3,398
109
/** @file fruchterman_reingold_mex.c * @copyright Stanford University, 2008 * @author David F. Gleich * The mex interface to the matlab bgl wrapper. */ /** History * 2008-09-26: Initial version */ #include "mex.h" #if MX_API_VER < 0x07030000 typedef int mwIndex; typedef int mwSize; #endif /* MX_API_VER */ #in...
c4c5e9a86bad061e8b7f98f2a2e857f098b8ac4f200ebe0dadf1b07c7524f779
C
3,471
111
#include "mex.h" /* Differences with built-in findstr: - allows to search only the n first occurences of a pattern - allows to search only in a substring (given an index of the beginning) MATLAB hack: - doesn't use mxGetString to prevent a copy of the string. - assumes MATLAB stores strings as unsign...
ca0b79a57cbe8a93fe4f00d8d2ca43043d090b62b8d2f4976650b8dbf2d4996c
C
3,471
96
/* y = mJdetd(detd,K) yields length(y)=sum(K.q) vector with y[k] = -detd(k)*J, where J = [1, 0'; 0, -I]. % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1) % % Copyright (C) 2001 Jos F. Sturm (up to 1.05R5) % Dept....
37a54bc453a7aea80e0e409db004804c4fdd59bc8d42ce99df7ed7974f2d0e27
C
3,546
110
#include "mex.h" /* * $Id: xml_findstr.c 6480 2015-06-13 01:08:30Z guillaume $ * Guillaume Flandin <guillaume@artefact.tk> */ /* Differences with built-in findstr: - allows to search only the n first occurences of a pattern - allows to search only in a substring (given an index of the beginning...
3ee1774bda0c8cb2994d2aebb5172c2ab16dabcbc242e687f1ff362d8b992952
C
3,550
176
#include <stdlib.h> #include <string.h> #include "../linear.h" #include "mex.h" #ifdef MX_API_VER #if MX_API_VER < 0x07030000 typedef int mwIndex; #endif #endif #define Malloc(type,n) (type *)malloc((n)*sizeof(type)) #define NUM_OF_RETURN_FIELD 6 static const char *field_names[] = { "Parameters", "nr_class", "n...
5f816f9b229afd49308413264200760195c2014212c1cde850d0273ec2d12acb
C
3,648
108
/** @file planar_test_mex.c * @copyright Stanford University, 2008 * @author David F. Gleich * The mex interface to the matlab bgl wrapper. */ /** History * 2008-10-01: Initial version */ #include "mex.h" #if MX_API_VER < 0x07030000 typedef int mwIndex; typedef int mwSize; #endif /* MX_API_VER */ #include "ma...
6d79bc62ee91ce486aa3833ff6f677587abb65d62a6dea1a2303679b872f5494
C
3,656
110
#include "mex.h" /* * $Id: xml_findstr.c 6480 2015-06-13 01:08:30Z guillaume $ * Guillaume Flandin <guillaume@artefact.tk> */ /* Differences with built-in findstr: - allows to search only the n first occurences of a pattern - allows to search only in a substring (given an index of the...
a2ad6d8a69fc5231f7b7636c031d87b607b6ceb513610b2e029e5f6c7f48cea9
C
3,679
153
/** @file core_numbers_mex.c * @copyright Stanford University, 2007-2008 * @author David F. Gleich * Wrap a call to the libmbgl core_numbers function. */ /** History * 2007-07-08: Initial version * 2007-07-11: Updated for weighted cores * 2007-07-30: Added option for removal times */ #include "mex.h" #if ...
c8ccad2a69126ae6cfdcc7db866d52e66e3ebdab51b3cf4651c0cf51d92b7bea
C
3,718
174
/* * ============================================================== * bfs_mex.c The mex interface to the matlab bgl wrapper. * * David Gleich * 20 April 2006 * ============================================================= */ /* * 19 February 2007 * Updated to use Matlab 2006b sparse matrix interface * * 1 ...
fe3c1d877a7d914cec63aea4d8aa48135c4a650e809f09c548d86be04099caa5
C
3,754
155
/** @file betweenness_centrality_mex.c * @copyright Stanford University, 2006-2008 * @author David F. Gleich * The mex interface to the matlab bgl wrapper. */ /** History * 2006-04-23: Initial version * 2007-02-19: Updated to Matlab 2006b sparse matrix interface * 2007-02-22: Added edge centrality output * ...
52ff5004d1dd3140f7b731bcc6b974cfe3f72aca0956ddd2d2b63dbe40697fab
C
3,789
149
/** @file clustering_coefficients_mex.c * @copyright Stanford University, 2006-2008 * @author David F. Gleich * The mex interface to the matlab bgl wrapper. */ /** History * 2006-04-23: Initial version * 2007-02-19: Updated to Matlab 2006b sparse matrix interface * 2007-07-11: Update for weighted and directe...
55166ee8e392e685d77a8320e4357fb59627f01abf0becc3c393163f81c2a164
C
3,810
134
#include "mex.h" #include "lfev.h" void lfmxdata(lfdata *lfd, const mxArray *data) { const mxArray *tmp; double *x, *sc, *xl; int n, d, i, k; char c, ststr[16]; n = lfd->n = mxGetM(mxGetField(data,0,"x")); d = lfd->d = mxGetN(mxGetField(data,0,"x")); x = mxGetPr(mxGetField(data,0,"x")); for (i=0; i<d;...
b74f8655adb70fc6bd3843556b6258ab81bf7b4714f0596699b6923b1e065a25
C
3,856
154
/* * David Gleich * Copyright, Stanford Unviersity, 2007 */ /** * @file matching_mex.c * Wrap a call to the libmbgl matching function. */ /* * 8 July 2007 * Initial version */ #include "mex.h" #if MX_API_VER < 0x07030000 typedef int mwIndex; typedef int mwSize; #endif /* MX_API_VER */ #include "matlab_b...
f5136c256fe9a6ba38d9e9825e855928cc34a96a25a73e64736e01e1e4ca0bbc
C
3,875
128
// (C) Copyright 2004, David M. Blei (blei [at] cs [dot] cmu [dot] edu) // This file is part of LDA-C. // LDA-C is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or (at your ...
e4b43fa73fefc6ac6986fe6d405651271a2dc7f80cf53319c88d4492dc930f75
C
3,899
128
/*================================================================= * mexpp.c * * starting a locfit interface. * * $Revision: 1.5 $ */ #include "mex.h" #include "lfev.h" extern void lfmxdata(), lfmxevs(); design des; lfit lf; int lf_error; void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[...
d163066fa90659551e7a90b1cd3fffb7a9e96a13cb9546e1cd33c090b8715a12
C
4,014
212
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <errno.h> #include "mex.h" #ifdef MX_API_VER #if MX_API_VER < 0x07030000 typedef int mwIndex; #endif #endif #ifndef max #define max(x,y) (((x)>(y))?(x):(y)) #endif #ifndef min #define min(x,y) (((x)<(y))?(x):(y)) #endif void exi...
ac9008dd046a9dace25994035d70b90012564250c13ca77a8407ab0bb96111ef
C
4,055
186
/* * ============================================================== * bfs_mex.c The mex interface to the matlab bgl wrapper. * * David Gleich * 20 April 20020 * ============================================================= */ /* * 19 February 2007 * Updated to use Matlab 2006b sparse matrix interface * * 1 ...
319ab87e7515ee09bde00185674003554a92fd40b19a208afe3925acf6fe1b0a
C
4,064
105
/* Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions */ /*========================================================================= Copyright (c) 2008 Thomas Yeo and Mert Sabuncu All rights reserved. Redistribution and use in source and binary forms, with or without modification, are ...
e568bf28347e54c205e4492648f436b4c522e315f9dcd40ca239677f327ea8ea
C
4,117
129
/********************************************************************** * mextriangsp: given upper triangular U, * options = 1 (default), solves U *y = b (backward substitutions) * = 2 , solves U'*y = b (forward substitutions). * * y = mextriangsp(Uinput,b,options) * * Important: U is ass...
909a5bde29c6c74b5f5a4178de5e79b4fc9d09b201924d1c6b7abc85088ce59d
C
4,128
116
/* ************************************************************ MODULE sdmaux*.c -- Several low-level subroutines for the mex-files in the Self-Dual-Minimization package. % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1)...
1f3ff10d2224827598f7587a5bbc203b12981e7ff4785cc7b5d67af9528affc6
C
4,133
101
/* Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions */ /*========================================================================= Copyright (c) 2008 Thomas Yeo and Mert Sabuncu All rights reserved. Redistribution and use in source and binary forms, with or without modification, are ...
c1eb0b22fdc882145d3e152172d280c315388c250b0c7d8b9f71e2a785f382ec
C
4,135
124
/** @file kamada_kawai_spring_layout_mex.c * @copyright Stanford University, 2008 * @author David F. Gleich * The mex interface to the matlab bgl wrapper. */ /** History * 2008-09-26: Initial version */ #include "mex.h" #if MX_API_VER < 0x07030000 typedef int mwIndex; typedef int mwSize; #endif /* MX_API_VER *...
0e6be70eaf51078638ff691ac15fc0ba08b9172a33bfe75e6024aaf880cc0446
C
4,152
153
/* Copyright (c) 2010 Genome Research Ltd. Author: Andrew Whitwham <aw7@sanger.ac.uk> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list ...
a71072ac81709b2c320560d0d894935f5b1d21c30c670a5befe0a77c4412db31
C
4,155
170
/* Copyright (c) 2009 Genome Research Ltd. Author: Rob Davies <rmd@sanger.ac.uk> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of co...
052e2a4e894f59e89e95dd7da8a73e446af68097916083b85e247ec06c5887ba
C
4,163
158
#include "htslib/vcf_sweep.h" #include "htslib/bgzf.h" #define SW_FWD 0 #define SW_BWD 1 struct _bcf_sweep_t { htsFile *file; bcf_hdr_t *hdr; BGZF *fp; int direction; // to tell if the direction has changed int block_size; // the size of uncompressed data to hold in memory bc...
f25861caafed86071cf8c6c65ac543ea7c376c53cce1093349d4e098f01bd79a
C
4,204
110
/*================================================================= * mexlocfit.c * * starting a locfit interface. * /* $Revision: 1.5 $ */ #include "mex.h" #include "lfev.h" design des; lfit lf; int lf_error; extern void lfmxdata(), lfmxsp(), lfmxevs(); void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const ...
b918eebc7f36bacb658eb4fc17dfc6d2b639a888601351c3b5a13f63dbe7b640
C
4,222
136
/* * $Id$ * Guillaume Flandin */ #include <string.h> #include "mex.h" /* * https://stackoverflow.com/a/37109258 * by polfosol: https://stackoverflow.com/users/5358284/polfosol */ static const char* B64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static const int B64index[256] = ...
fcd0d1f0f7164b4014b58b4eb2ca6f65f724293c694ace49a4eae7f48a2b7430
C
4,259
124
#ifndef lint static char svnid[] = "$Id: nifti_stats_mex.c 253 2005-10-13 15:31:34Z guillaume $"; #endif /* * This is a Matlab mex interface for Bob Cox's extensive nifti_stats.c * functionality. See nifti_stats.m for documentation. */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include "mex.h" #in...
37b694766f4d30b9b5bb0608ac197afd75b2c568d6638b67afdf5c50feec93a8
C
4,315
92
#define FLOAT_T float #define SIZE_T long /* * C implementation of row sliding, used to prepare input data for training. * */ void runRow(const FLOAT_T * const restrict source, FLOAT_T *restrict dest, SIZE_T numRows, SIZE_T numSourceCols, SIZE_T numDestCols, SIZE_T depth, const int * const r...
537efc3182631353244aa8ffeb6c4e8ca51f8698ce477ef79b7ff10174eaf1e8
C
4,364
147
/************************************************************************ * mexschurfun(X,Y,options) * options = 1, add Y to the diagonal of X (a square matrix) * options = 2, add Y to X * options = 3, X(i,j) = X(i,j)*Y(i)*Y(j) ************************************************************************/ #in...
2ea074c653a6bb755c4c4433c96060ed3e72f0e1ae5076e7246eba07f044394d
C
4,372
100
#include "fastdelta.h" #if defined(_MSC_VER) /* Microsoft C/C++-compatible compiler */ #include <intrin.h> #elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) /* GCC-compatible compiler, targeting x86/x86-64 */ #include <x86intrin.h> #elif defined(__GNUC__) && defined(__ARM_NEON__)...
8c544ae19636faec30d8586329918c84316608dbdc00b983f5f8fd1be857e98d
C
4,506
143
/*********************************************************************** * mexqops.c : C mex file * * z = mexqops(blk,x,y,options); * * Input: blk = [n1, n2, ... nk] * x = n-vector or k-vector * y = n-vector, where n = n1+...+nk * * options = 1, z = k-vector, z(i) = <xi,yi> * = 2...
2407fbf7ca92a9100d6c8d201928cbd145f74f534a354af89696999c45821b94
C
4,573
122
/* % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1) % % Copyright (C) 2001 Jos F. Sturm (up to 1.05R5) % Dept. Econometrics & O.R., Tilburg University, the Netherlands. % Supported by the Netherlands Organization for Sc...
f3e544fea52fd87f0a2738883ef56610289ef7ae79c999eff928ffe0a053ac97
C
4,634
187
/************************************************************************* * MATLAB MEX ROUTINE inplaceprod.c * * > inplaceprod(A,B) * performs inplace (i.e., without allocate array) complex array product * > A(:) = A(:).*B(:); * * User must make sure A is not shared by other array. * B must have the same size...
18ff9426a663247000f152d619a9b4e3e17861422000b7d06ba7f77e26e347d2
C
4,655
135
/** @file gursoy_atun_mex.c * @copyright Stanford University, 2008 * @author David F. Gleich * The mex interface to the matlab bgl wrapper. */ /** History * 2008-09-28: Initial version */ #include "mex.h" #if MX_API_VER < 0x07030000 typedef int mwIndex; typedef int mwSize; #endif /* MX_API_VER *...
f72e6f3f96f13f3f314387ca455a97706e9df295c0ddd275196beea25a7c82f0
C
4,669
116
/* % y = qblkmul(mu,d,blkstart) % QBLKMUL yields length(y)=blkstart(end)-blkstart(1) vector with % y[k] = mu(k) * d[k]; the blocks d[k] are partitioned by blkstart. % % SEE ALSO sedumi % ********** INTERNAL FUNCTION OF SEDUMI ********** function y = qblkmul(mu,d,blkst...
8ceb77529243c3c0738dd027630b94924756ac7b6d434d907edb7498fc509a2f
C
4,700
143
/* bam_cat -- efficiently concatenates bam files bam_cat can be used to concatenate BAM files. Under special circumstances, it can be used as an alternative to 'samtools merge' to concatenate multiple sorted files into a single sorted file. For this to work each file must be sorted, and the sorted files must be given...
49d5a4f0c338c2832f04589471ab6139dfce20f193532b3bfd1ecd95c81aebdd
C
4,756
143
/* Lindemann's precedence model. * * Copyright 2016 University of Surrey. * */ #include "math.h" #include "mex.h" #define TEMP_ARRAY mxCreateDoubleMatrix((mwSize)length_c,(mwSize)1,mxREAL) #define IN_ARRAY mxCreateDoubleMatrix((mwSize)n_sample,(mwSize)1,mxREAL) void mexFunction(int nlhs, mxArray *plhs[], int n...
56a6e355de5e03b9b0a2841d8eb54722cb7e4e07616f2ccf4ea673653a4a5e37
C
4,765
175
/* * $Id: init.c 6428 2015-05-06 14:09:04Z guillaume $ * Guillaume Flandin */ #ifndef MATLAB_MEX_FILE # undef _LARGEFILE64_SOURCE # define _LARGEFILE64_SOURCE # include <stdio.h> # include <sys/stat.h> # if defined(__APPLE__) # define structStat struct stat # define getFileFstat fstat # define getFilePos fgetpo...
38e64fe182fb228e03b482d5e86a84b1dbbafe3303c491e8538178bc18e824f8
C
4,843
144
/* Copyright (c) 2010-2013 Genome Research Ltd. Author: James Bonfield <jkb@sanger.ac.uk> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this l...
4fd6ebe51ba1662f96f530db72510611b48854eedab2b3a92dc4fa5ef1dec7e1
C
4,915
131
/* y = blkmul(mu,d,nL) yields length(y)=sum(nL) vector with y[k] = mu(k) * d[k]. length(mu)=length(nL), length(d)=sum(nL). % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1) % % Copyright (C) 2001 Jos F. Sturm (up to...
8ee0da78a1221a3c2036e22eed06c2faa27a671a46565a60e10111d4ee9c30ee
C
4,917
165
/* * pufftest.c * Copyright (C) 2002-2013 Mark Adler * For conditions of distribution and use, see copyright notice in puff.h * version 2.3, 21 Jan 2013 */ /* Example of how to use puff(). Usage: puff [-w] [-f] [-nnn] file ... | puff [-w] [-f] [-nnn] where file is the input file with deflate dat...
ac3c0221e57281e1542fa94a99b5f6725bf60f50a22d4f7135196577be26d1c2
C
4,929
148
/* Written by Ru(by) Kong and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md */ #include "mex.h" /* The computational routine */ /*function V_lam=Compute_V_lambda(params,V_same,V_diff,lambda) neighborsys=double(params.neighborhood);%revise*/ void CBIG_MSHBM_V_lambda_Product(doub...
7c6867443ee4940d86dce4cb5f25b757d5393b4c55cfd3581e70aed70df7490e
C
4,947
185
/* Copyright (c) 2009-2013 Genome Research Ltd. Author: James Bonfield <jkb@sanger.ac.uk> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this l...