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 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 |
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
# 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 |
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
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 |
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
#!/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 |
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
%%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] |
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 numpy as np | |
x_org = [1,2,3] | |
x = np.array( x_org) | |
y = x + 2*x | |
print y |
NewerOlder