Skip to content

Instantly share code, notes, and snippets.

@perdacherMartin
perdacherMartin / CalculateNMI.java
Created May 3, 2017 14:22
This function provides a NMI implementation for the lecture Scientific Data Management
public static double NMI(ArrayList<Integer> one, ArrayList<Integer> two){
if(one.size()!=two.size()){
throw new IllegalArgumentException("Sizes don't match!");
}
int maxone = Collections.max(one);
int maxtwo = Collections.max(two);
double[][] count = new double[maxone+1][maxtwo+1];
//System.out.println(count[1][2]);
for(int i=0;i<one.size();i++){
data <- rbind(cbind(rnorm(100,mean=0, sd=5), rnorm(100,mean=0, sd=0.5)),cbind(rnorm(100,mean=5, sd=2), rnorm(100,mean=12, sd=5)))
write.csv2(data, "data.csv", row.names=FALSE)
mydata = read.csv2("data.csv")
#include <iostream>
#include <x86intrin.h>
#include <immintrin.h>
#include <stdlib.h>
#include "cholesky.h"
#include <boost/timer/timer.hpp>
using namespace std;
// typedef __m256d T_dvec;
@perdacherMartin
perdacherMartin / serial_jacobi.c
Created February 18, 2013 16:35
serial jacobi example
#include <stdio.h>
#include <sys/time.h>
#define N 100
#define MAX_ITER 5000
typedef float MATRIX_V[N+1][N+1];
int timeval_subtract(struct timeval *result, struct timeval *t2, struct timeval *t1);
@perdacherMartin
perdacherMartin / jacobi_openmp.c
Created February 18, 2013 16:35
jacobi iteration with openmp
/*****************************************************
* Exercise 4
* File: jacobi.c
*
* description:
*
* Jacobi iteration on a NxN matrix with MAX_ITER iterations
*
* Language: c
*
@perdacherMartin
perdacherMartin / jacobi.c
Last active December 13, 2015 20:09
MPI-C, jacobi iteration, row-wise decomposition with MPI_Scatterv
/*
Perdacher Martin
jacobi iteration, with row-wise decomposition
* to distribute the matrix, MPI_Scatterv is used (row-wise decomposition)
*/
#include <stdio.h>
#include <stdlib.h>
@perdacherMartin
perdacherMartin / matVec2ab.c
Created January 13, 2013 20:09
Multiply of n*n-matrix with an n-vector * to distribute the vector, MPI_Scatterv is used (each process has rows of the vector) * to distribute the matrix, MPI_Scatterv is used (colum-wise decomposition) * to collect the results MPI_Reduce_Scatter is used
/*
Perdacher Martin
Multiply of n*n-matrix with an n-vector
* to distribute the vector, MPI_Scatterv is used (each process has rows of the vector)
* to distribute the matrix, MPI_Scatterv is used (colum-wise decomposition)
* to collect the results MPI_Reduce_Scatter is used
*/
@perdacherMartin
perdacherMartin / matVec2aa.c
Created January 13, 2013 20:06
Multiply of n*n-matrix with an n-vector. * to distribute the vector, MPI_Allgether is used * to distribute the matrix, MPI_Scatterv is used (row-wise decomposition)
/*
Perdacher Martin
Multiply of n*n-matrix with an n-vector
* to distribute the vector, MPI_Allgether is used
* to distribute the matrix, MPI_Scatterv is used (row-wise decomposition)
*/
#include <stdio.h>
@perdacherMartin
perdacherMartin / simpson1c.c
Created November 4, 2012 16:10
mpi simpson integration, scientific programming, exercise 1c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "mpi.h"
#define MASTER 0
#define REPETITIONS 10
double Function(double x);
@perdacherMartin
perdacherMartin / ring1bc.c
Created November 3, 2012 14:16
mpi ring mpi_isend/mpi_irecv - sp exercise 1b variant c, (using MPI_Isend/MPI_Irecv)
#include <stdio.h>
#include <stdlib.h>
#include "mpi.h"
#define MASTER 0
#define REPETITIONS 10
#define T_mpisendtype MPI_CHAR
typedef unsigned char T_arraytype;