Skip to content

Instantly share code, notes, and snippets.

@sencagri
sencagri / python5.py
Last active October 13, 2017 16:51
Project 5 code fix
import numpy as np
import matplotlib.pyplot as plt
x=np.random.randn(10000)
## Eğer direk olarak xm = x olarak tanımlanırsa, xm sadece x'in pointer'ını alıyor
## Bu şekilde oluşturulduğunda xm değerleri değiştirildiğinde x değerleri de değişeceğinden yanlış sonuçlar alırız
xm=list(x);
xv=list(x);
@sencagri
sencagri / pythonp1q2.py
Created October 26, 2017 09:48
Pattern Recognition P1 Q2
import numpy as np
# deviance ve mean buradan giriliyor
dev = 10
var = dev ** 2
mean = 3
# örnek kümesinin boyutu
size = 150
@sencagri
sencagri / pythonp1q3.py
Created October 26, 2017 15:48
Pattern Recognition P1 Q3
# Generate 2 - class problem, using parametric classification
import numpy as np
den1 = 1
den2 = 0.3
var1 = den1 ** 2
var2 = den2 ** 2
mean1 = 3
mean2 = 2
import numpy as np
p = 0.2
size = 1000
bern = np.random.binominal(1,p, size)
zeros = 0
ones = 0
for item in bern:
if item == 0:
ones += 1
else:
import re
# program counter
pc = 100
# jump list
colonList = list()
# param list
param = list()
@sencagri
sencagri / py
Created May 1, 2018 12:20
test
# instruction set for ARM V8 processor
instructionSet =[
["B", "000001mmmmmmmmmmmmmmmmmmmmmmmmmm"],
["BR", "100001mmmmmmmmmmmmmmmmmmmmmmmmmm"],
["EQ", "01000100mmmmmmmmmmmmmmmmmmm00000"],
["NE", "01110100mmmmmmmmmmmmmmmmmmm00000"],
["GE", "01100100mmmmmmmmmmmmmmmmmmm00000"],
["GT", "01010100mmmmmmmmmmmmmmmmmmm00000"],
["LE", "01001100mmmmmmmmmmmmmmmmmmm00000"],
["LT", "11000100mmmmmmmmmmmmmmmmmmm00000"],
; Initially PC is set to 100
; Data section is right after the code section
.text 100
.global _main
_main:
ADD R1, R0, #10 ; init i
LDR R1, [R0, VAR_i] ; store i
ADDI R20, R0, #2
FOR_0:
LDR R1, [R0, VAR_i]
@sencagri
sencagri / .cs
Created May 1, 2018 13:23
assembler
import re
from instructionSet import instructionSet
# program counter
pc = 100
# jump list
colonList = list()
# var list
@sencagri
sencagri / .py
Last active May 1, 2018 18:16
assembler
import re
import os
from instructionSet import instructionSet
# program counter
pc = 100
# jump list
colonList = list()
# instruction set for ARM V8 processor
instructionSet =[
["B", "000001mmmmmmmmmmmmmmmmmmmmmmmmmm"],
["BR", "100001mmmmmmmmmmmmmmmmmmmmmmmmmm"],
["EQ", "01000100mmmmmmmmmmmmmmmmmmmnnnnn"],
["NE", "01110100mmmmmmmmmmmmmmmmmmmnnnnn"],
["GE", "01100100mmmmmmmmmmmmmmmmmmmnnnnn"],
["GT", "01010100mmmmmmmmmmmmmmmmmmmnnnnn"],
["LE", "01001100mmmmmmmmmmmmmmmmmmmnnnnn"],
["LT", "11000100mmmmmmmmmmmmmmmmmmmnnnnn"],