Skip to content

Instantly share code, notes, and snippets.

View SRatna's full-sized avatar

Sushanta Ratna Adhikari SRatna

  • Virtual Retail GmbH
  • Siegen, Germany
View GitHub Profile
#include <stdlib.h>
#include <sys/time.h>
#include <string>
#include <iostream>
#include <fstream>
#include "converter.h"
#include "config.h"
#include "bfsqueue.h"
/*************************************************************************
** Iterative solver: Gauss/Seidel method
**
** Author: RW
**
*************************************************************************/
#include <stdlib.h>
#include <math.h>
/*************************************************************************
** Iterative solver: Jacobi method
**
** Author: RW
**
*************************************************************************/
#include <iostream>
#include <stdlib.h>
#include <math.h>
/***************************************************************************
* Numerical Integration *
***************************************************************************/
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>
#include <omp.h>
/***************************************************************************
* Loop Parallelization
*
* Examine the loops below and check, if they can be parallelized.
* If so, parallelize these loops. Then run the program with 4 threads.
* It checks whether the result is the same as in the sequential version.
***************************************************************************/
/* Do not change the following declarations! */
#define N 1000
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <sys/time.h>
#include <pthread.h>
#include <errno.h>
#define MINSIZE 2000000
using namespace std;
void *quicksort(void *);
#include <iostream>
#include <iomanip>
#include <math.h>
#include <sys/time.h>
#include <pthread.h>
using namespace std;
extern double getTime();
extern double f1();
@SRatna
SRatna / multiFilter.js
Last active July 17, 2018 08:43 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple criteria.
/**
* Filters an array of objects with multiple criteria.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria as the property names
* @return {Array}
*/
function multiFilter(array, filters) {
const filterKeys = Object.keys(filters);
// filters all elements passing the criteria
@SRatna
SRatna / reduxObjectLiteral.js
Created June 22, 2018 04:16 — forked from sebjwallace/reduxObjectLiteral.js
Redux reducer using object literal instead of a switch statement
import {createStore} from 'redux';
const counter = (state = 0, action) => {
const index = {
'INCREMENT': () => {
return state+1;
},
'DECREMENT': () => {
return state-1;
},
@SRatna
SRatna / crud-saga.js
Created June 21, 2018 06:26 — forked from cbilgili/crud-saga.js
Redux CRUD Saga (redux-saga)
import { takeLatest } from 'redux-saga'
import { call, put } from 'redux-saga/effects'
import fetch from 'isomorphic-fetch'
import * as actions from './modules/grid'
import * as api from '../lib/api'
export function* fetchGrids(action) {
try {
const grids = yield call(api.GET, 'grids')
yield put(actions.fetchGridsSuccess(grids))