Skip to content

Instantly share code, notes, and snippets.

View jskDr's full-sized avatar

Sungjin Kim jskDr

View GitHub Profile
@jskDr
jskDr / NNEQ_XOR.py
Created August 2, 2014 09:13
Under developing python code for NNEQ when XOR is used for testing
import matplotlib.pyplot as plt
# input is 1, 0
def NNEQ( x1, x2, w1, w2):
y = x1 * w1 + x2 * w2
return y
def NNEQ_bias( x1, x2, w1, w2, w_bias):
y = x1 * w1 + x2 * w2 + w_bias
return y
@jskDr
jskDr / scix_c.pyx
Created May 24, 2014 18:11
This code shows how to use functions of C libraries.
# Use C library, which is log() in math.h
cdef extern from "math.h":
double log(double x)
def kmc( float x):
cdef float t
t = log( x)
return t
public class String2
{
public static void main(String[] args)
{
String hw = "String of Hello world!";
String hwAll[] = {"00", "11", "22"};
String hwAll2[][] = {{"00", "zero"},{"11", "one"}, {"22", "two"}};
System.out.println( hw);
// this is used for displaying one dimensional array
@jskDr
jskDr / main.py
Created March 4, 2014 11:00 — forked from falsetru/main.py
#!/usr/bin/kivy
import kivy
#kivy.require('1.0.6')
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.label import Label
from kivy.graphics import Color, Rectangle, Point, GraphicException
from kivy.clock import Clock
from kivy.logger import Logger
@jskDr
jskDr / cython_numpy.pyx
Created February 26, 2014 13:02
Cython with numpy in ipython
%%cython
import numpy as np
cimport numpy as np
from libc.math cimport sqrt
cimport cython
ctypedef double (*mertric_ptr)(np.ndarray, np.ndarray)
cdef double euclidean_distance( np.ndarray[double, ndim=1, mode='c'] x1):
N = x1.shape[0]
@jskDr
jskDr / numpy_hello.py
Created February 18, 2014 12:19
This is numpy codes for testing its basic functionality. Numpy offers the efficient way to calculate array and matrix for linear algebraic problems.
import numpy as np
x_org = [1,2,3]
x = np.array( x_org)
y = x + 2*x
print y