Intersections

Geometric object = a set of points satisfying a given relationship(e.g. equations)

“Flat” = defined by linear equations
Linear equations:
-Can add and subtract variables and constants
-Can multiply a variable by a constant

Linear: x + 2y = 1, y/2 – 2z =x
Nonlinear: x^2 -1 = y, y/x = 3

Equations come from observed or modeled relationships between real-world quantities.

ML for trading
stock:A, B
Wa = proportion of portfolio invested in A
Wb = proportion of portfolio invested in B
0 < Wa, Wb < 1 β value = measure of correlation of a stock's price movements with market movement β of portfolio = weighted average of individual components' β values Wa + Wb = 1 B portfolio = 2Wb - Wa = 0 Variables: weights of the stocks Constraints: equations representing physical realities or objectives Lines in Two dimensions Two pieces of info define a line -basepoint x -direction vector v x(t) = x + tv Ax + By = 0 (A and B not both 0)

Inner Products

Inner Products(Dot Products)
v*w = ||v||*||w||*cosΘ

def dot(self, v):
	return sum([x*y for x,y in zip(self.coordinates, v.coordinates)])

	def angle_with(self, v, in_degrees=False)
		try:
			u1 = self.normalized()
			u2 = v.normalized()
			angle_in_raddians = acos(u1.dot(u2))

			if in_degrees:
				degrees_per_radian = 180./ pi
				return angle_in_radians * degrees_per_radian
			else:
				return angle_in_radians

			except Exception as e:
				if str(e) == self.CANNOT_NORMALIZE_ZERO_VECTOR_MSG:
					raise Exception('Cannot compute an angle with the zero vector')
				else:
					raise e

Magnitude and Direction

P -> Q
magnitude of v = distance between P and Q
h^2 = (△x)^2 + (△y)^2
v = √(Vx^2 + Vy^2)

-A unit vector is a vector whose magnitude is 1.
-A vector’s direction can be represented by a unit vector.

Normalization: process of finding a unit vector in the same direction as a given vector.
[0 0 0] = 0
||0|| = 0
1 / ||0|| = ?

def magnitude(self):
	coordinates_squared = [x**2 for x in self.coordinates]
	return sqrt(sum(coordinates_squared))

def normalized(self):
	try:
		magnitude = self.magnitude()
		return self.times_scalar(1./magnitude)

	except ZeroDivisionError:
		raise Exception('Cannot normalize the zero vector')

def plus(self, v):
	new_coordinates = [x+y for x,y in zip(self.coordinates, v.coordinates)]
	return Vector(new_coordinates)

Operating on Vectors

– Addition
– Subtraction
[1 3] – [5 1] = [-4 2]
– Scalar Multiplication
2, 1, 1/2, -3/2

[8.218 -9.341]+[-1.129 2.111]=[7.089 -7.23]
[7.119 8.215] – [-8.223 0.878]=[15.342 7.337]
7.41[1.671 -1.012 -0.318]= [12.382 -7.499 -2.356]

def plus(self, v):
	new_coordinates = [x+y for x,y in zip(self.coordinates, v.coordinates)]
	return Vector(new_coordinates)

def minus(self, v):
	new_coordinates = [x-y for x,y in zip(self.coordinates, v.coordinates)]
	return Vector(new_coordinates)

def times_scalar(self, c):
	new_coordinates = [c*x for x,y in zip(self.coordinates, v.coordinates)]
	return Vector(new_coordinates)

def __str__(self):
	return 'Vector: {}'.format(self.coordinates)

def __eg__(self, v):
	return self.coordinates == v.coordinates

Point and Vectors

Points
-represent location
-written as (x,y,z…)
e.g. (2,-1)

Vectors
-represent change in location
-magnitude and direction
-written as [x,y,z…]

Common practice to interchange points and vectors
Technically different but often a useful shortcut
V=[-2, -3] P=(-2,-3)
P=(-4,-4), Q=(4,-2)
v=[-1,4],w=[-2,0]

class Vector(object):
	def __init__(self, coordinates):
		try:
			if not coordinates:
				raise ValueError
			self.coordinate = tuple(cordinates)
			self.dimension = len(coordinates)

		except ValueError:
			raise ValueError('The coordinates must be nonempty')

		except TypeError:
			raise TypeError('The coordinate must be an iterable')

	def __str__(self):
		return 'Vector: {}'.format(self.coordinates)

Branches

1.Conditional branches
2.Unconditional branches
3.Function Calls
4.Indirect Jumps

Branch Architecture
Speculation: predicting branches, executing in anticipation
Predication: removing branches, converting code into one that depends on outcome of a condition for a commit.

VLIW Data Path

The way things are organized inside processors to allow storage of data!

CISC and DSP
-Memory-to-memory and complex addressing modes
-Accumulator:a target register of ALU
-Some storage specialities force complier to make binding choice and optimizations too early

RISC and VLIW
-Registers-to-registers: large register files
-Decoupling scheduling and register allocation

Processor: 16×16 bit, 32x32bit
ARM7, ARM9E, ARMv5TE

VLIW Machine:A VLIW machine with 8 32-bit independent datapaths

In the embedded world, characteristics of application domain are also very important
Simple Integer and Compare Operations
Carry, Overflow, and other flags

Fixed Point Multiplication

Partial interconnect clusters promise better scalability
The bypass network of a clustered VLIW is also partitioned.

Index Register Files
illegal, outputs locals, static
-compiler can explicitly allocate a variable-sized section of the register file
-used in proc call and return for stack management

VLIW instructions are separated into primitive instructions by the compiler.
During each instruction cycle, one VLIW word is fetched from the cache and decoded.
Instructions are then issued to functional units to be executed in parallel.
Since the primitive instructions are from the same VLIW word, they are guaranteed to be independent.

VLIW is load/store architecture
– mostly reuse RISC memory-addressing concepts
– special addressing modes
– registers – data and address
– memory could be banked, power efficient
– X-Y memory
– GPUs constant memory, shader memory, shared memory, local memory

ISA Design

Overview: What to hide
Basic: VLIW Design Principle
Designing a VLIW ISA for Embedded Systems
Instruction-set Encoding

Terminology: Fundamental RISC-like minimal unit of work
Instruction:
-Fundamental unit of encoding
-Refers to a parallel set of operations
Bundle: a memory-aligned encoding unit
-VEX calls syllable (the min-sized encoding unit)

The ISA allows the designer to treat the processor as a black box.
Understanding the ISA can help determine processor to use for a given system.

Delay slots of early RISC machines
Illusion of instant registers update in superscalar

VLIW Architecture
-Exposes a scheduler in the compiler
-Conversely, superscalar architecture hides this

Memory: off-chip, and not specialized
Registers: fast, on-chip, connected to logics
Baseline model: sequential execution
Pipelining: Parallelism in time
-whether implementation is hidden or exposed is a design choice
-hidden: out-of-order

Pipelines in modern processors

modern high performance processors:
15 to 20 stages: pentium 4 had a 20 stage pipeline

sequential program semantic
-tries to issue an instruction every clock cycle
-but, there are dependencies, control hazards and long latency instructions
-delays result in execution of < 1 instruction per cycle on an average VEX example: clock cycle and instruction Modern CPU Techniques: Pipelinig Execution stages are divided into several steps A later operation can share the resource used by the first operation in previous cycles Shared hardware can be pipeline e.g. Integer multiplier is pipelined. Instructions can be overlapped In embedded system, the choice of ISA is crucial! data or memory access: set a register to a fixed constant value control flow: branch, call functions arithmetic or logic: add, multiply, subtract, divide

Cloud security

On demand self service
Broad or wide network access
Resource pooling or sharing
Measured service
Rapid elasticity

SaaS, PaaS, IaaS
Software as a servicd: use the provider’s applications running on a cloud infrastructure
Platform as a service: consumer-created applications using programming languages and tools supported by the provider
Infrastructure as a service: Capability provided to the consumer to provision processing, storage, networks, and other fundamental computing resources

Key Issues:
Trust, multi-tenancy, encryption, compliance
Clouds are massively complex systems
Simple primitives and common functional units

Cloud security challenges
– trusting vendor’s security model
– Customer inability to respond to audit findings
– Obtaining support for investigations
– Indirect administrator accountability
– Proprietary implementations can’t be examined
– Loss of physical control

Primary Technology
-Virtualization
-Grid technology
-Service Oriented Architectures
-Distributed Computing
-Broadband Networks

Hypervisor has higher privilege than guest kernel
Security VM is separated from User VM

User = application + data (encrypt)

Frequency Analysis Attack
connect data with public information
Optimization Attack