This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mkl.h" | |
#include <math.h> | |
#include <float.h> | |
#include <stdio.h> | |
/* Auxiliary routine: printing a matrix */ | |
void print_matrix(float * matrix, int nrow, int ncol) { | |
for (int i = 0; i < nrow; i++) { | |
for (int j = 0; j < ncol; j++) { | |
printf("%.*e\t",FLT_DIG, matrix[i * ncol + j]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mkl.h" | |
#include <math.h> | |
#include <float.h> | |
#include <ctime> | |
#include <stdio.h> | |
/* Auxiliary routine: printing a matrix */ | |
void print_matrix(double * matrix, int nrow, int ncol) { | |
for (int i = 0; i < nrow; i++) { | |
for (int j = 0; j < ncol; j++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this is a simple way to plot a matrix from a txt file | |
mat_data_frame=read.table("data.txt",header=F) | |
#rev is there to start plotting M(0,0) in the upper left corner | |
#col=rainbow(10) uses the rainbow color palette. You can find other ones here: | |
#http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/palettes.html | |
image(as.matrix(rev(mat_data_frame)),col=rainbow(10)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numbers.so: numbers.c | |
gcc --std=c99 -fPIC -c numbers.c | |
gcc -shared numbers.o -o numbers.so | |
clean: | |
rm -f numbers.o numbers.so |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[map(float,a.split(" ")) for a in data.split("\n")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: Lucas Hermann Negri <[email protected]> | |
# Contributor: shacristo | |
pkgname=armadillo | |
pkgver=4.300.8 | |
pkgrel=1 | |
pkgdesc="C++ linear algebra library" | |
arch=('i686' 'x86_64') | |
url="http://arma.sourceforge.net/" | |
license=('MPL 2.0') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//A little function to allocate a length-1 sds from a char | |
//This is a little nasty, since we would need a lot of tiny mallocs if we do this often | |
sds sdsnewchar(char c) { | |
//Do some dirty allocations to save the char | |
char *ch = (char*)malloc(2*sizeof(char)); //culprit of small size allocation - could pre-allocate if we do this often | |
ch[0] = c; | |
ch[1] = '\0'; //zero-termination | |
sds str = sdsnew(ch); //new sds item, copied | |
free(ch); //sdsnew copies the content, so we can free | |
return str; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "list.h" | |
list* list_init() { | |
list* ls = (list*)malloc(sizeof(list)); | |
ls->head = (list_node*)malloc(sizeof(list_node)); | |
ls->cursor = ls->head; | |
ls->head->data = NULL; | |
ls->dealloc = NULL; | |
ls->copy = NULL; | |
return ls; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/perl | |
use strict; | |
use warnings; | |
#The names of the input files are provided on the command line | |
if (@ARGV == 2) { | |
# Read input files | |
my $ids_file = $ARGV[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub codon_sequence { | |
my ($self, $n) = @_; | |
my ( $r, @s ); | |
for my $i ( 0 .. 2 ) { | |
$r = $n % 4; | |
$n = $n >> 2; | |
unshift( @s, $nucleotides[$r] ); | |
} | |
return join( '', @s ); | |
} |