#include <iostream>
#define na 4
int main() {
int a[na];
a[0] = 2;
for (int n = 1; n < na; n++) a[n] = a[n-1] + 1;
This file contains 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 <stdio.h> | |
#include <stdlib.h> | |
#include <cuda_runtime.h> | |
//http://www.techdarting.com/2014/03/matrix-multiplication-in-cuda-using.html | |
// This code assumes that your device support block size of 1024 | |
#define MAX_RANGE 9999 |
This file contains 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
import sys,os | |
import curses | |
def draw_menu(stdscr): | |
k = 0 | |
cursor_x = 0 | |
cursor_y = 0 | |
# Clear and refresh the screen for a blank canvas | |
stdscr.clear() |
This file contains 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
#!/bin/bash | |
#------------------------------------------------------------------------------ | |
# Name: sbtmkdirs | |
# Version: 1.5 | |
# Purpose: Create an SBT project directory structure with a few simple options. | |
# Author: Alvin Alexander, http://alvinalexander.com | |
# License: Creative Commons Attribution-ShareAlike 2.5 Generic | |
# http://creativecommons.org/licenses/by-sa/2.5/ | |
#------------------------------------------------------------------------------ |
This file contains 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 page intentionally left blank |
Software Development for Scientists and Engineers
Recall how the stream insertion operator>> behaves: it returns a reference to the remaining stream after reading a unit of data from the stream
inspired by Madcola
This file contains 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 page intentionally left blank |
This file contains 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
import click | |
@click.command(help='Get evaluation result.') | |
@click.argument('exp_dir') | |
@click.option('--force', '-f', is_flag=True, default=False, help='Overwrite previous evaluation result.') | |
@click.option('--iteration', '-i', type=str, required=True, multiple=True, | |
help='specified multiple iterations in one run by E.g, -i 10 -i 400') | |
@click.option('--fa', type=float, default=None, help='Set threshold by fa.') | |
@click.option('--threshold', type=float, default=None, help='Set threshold.') |
This file contains 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
# https://github.com/tqdm/tqdm/issues/484#issuecomment-352463240 | |
import time | |
import random | |
from multiprocessing import Pool | |
from tqdm import tqdm | |
def myfunc(a): | |
time.sleep(random.random()) | |
return a ** 2 |