text stringlengths 30 4k | source stringlengths 60 201 |
|---|---|
6.895 Theory of Parallel Systems
Lecture 9
Analysis of Cilk Scheduler
Lecturer: Michael A. Bender
Scribe: Alexandru Caraca¸s, C. Scott Ananian
Lecture Summary
1. The Cilk Scheduler
We review the Cilk scheduler.
2. Location of Shallowest Thread
We define the depth of a thread and the shallowest thread. Next, We pr... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
on it.
(b) If the deque is empty, the processor tries to execute α’s parent (which is not in a deque).
(c) If the deque is empty and the processor is unable to execute α’s parent (because the parent is
busy), then the processor work steals.
3. Procedure α Syncs. If there are no outstanding children, then continue: ... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
Thread) The shal lowest thread is the thread with minimal depth.
We prove some structural properties of the deque.
Lemma 3 (Structural lemma) Consider any processor p at time t. Let u0 be the current root thread (of
procedure α0) executing on processor p. Let u1, u2, . . . , uk be the threads (of procedures α1, α2, ... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
a procedure is stolen.
uk
uk−1
.
.
.
u2
u1
u0
=⇒
uk
uk−1
.
.
.
u2
u1
Figure 3: Change in the deque of a processor when the processor returns from a procedure.
• Case 1: Steal. A steal removes the top entry from the deque (see Figure 2). The processor performing
the steal begins executing uk with an e... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
the currently-executing thread u0 with its successor in the DAG, ua. Figure 5 shows the
relevant piece of the computation DAG.
If the longest path to u0 has length d(u0), then clearly there is a path to ua through u0 which has
length d(u0) + 1. Therefore,
d(ua) ≥ d(u0) + 1,
9-3
uk
uk−1
.
.
.
u2
u1
u0
=⇒ ... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
required
d(us) ≥ d(ua) > d(u1) > · · · > d(uk−1) > d(uk ).
Note: This is the only case where the depth of the currently-executing thread may become equal to
the depth of the thread on the bottom of the deque; hence the only case where a shallowest thread
may be the currently-executing thread instead of the thread a... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
section we construct an augmented computation DAG G(cid:1) similar to the computation DAG G, such
that when a thread has no incomplete predecessors in G(cid:1), then it is at the top of a deque. Next, we introduce
critical threads.
Our goal is to show that any thread on the top of a deque cannot stay there long beca... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
u0 in procedure α0.
Note: Proposition 7 does not hold for the execution DAG G, that is why we create G(cid:2).
Example 1 To see why, consider the execution DAG in Figure 9. After threads v2 and v1 have been
executed, we begin to execute thread u0. We have the following deque:
u2
u1
u0
Top of deque
Bottom of deq... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
make progress on the critical path by executing the threads which are shallowest.
Definition 9 (Critical thread) A thread is critical if it has no un-executed predecessors in the augmented
DAG G(cid:2).
Note: The extra edges in the augmented DAG G(cid:2) are not execution edges, they simply induce extra ordering
tha... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
their respective results are:
• execute instruction – one dollar into work bucket,
• steal attempt – one dollar into steal bucket.
We assume that all threads are of equal size and that all processors have the same time-step. In the following
We overload the notation of steal attempt with steal.
Lemma 11 At the end... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
11: Dividing computation into steal rounds.
5 Performance Analysis of Scheduling Algorithm Using Delay Se
quences
In this section, we analyze the performance of the Cilk work-stealing scheduling algorithm. We define delay
sequences and use them to prove the execution time bounds of the Cilk scheduler.
We prove equa... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
C rounds is very small, namely:
(cid:2)CP
(cid:1)
1 −
1
P
≤ e −C .
The idea is that a thread is unlikely to be critical for many rounds. Also, a thread may be ready for
many rounds but not critical.
9-8
Figure 12: A directed path U = (u1, u2, . . . , uL) in the augmented DAG G�.
Theorem 17 The probability th... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
term e−C in the previous bound becomes
exponentially small. If a thread is at the top of a deck then it has no un-executed predecessors in the
augmented DAG G(cid:2). Intuitively we would expect that in every time-step we are able to peal some threads
from the augmented DAG such that in time O(P T∞) there would be n... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
The very last thread in the computation uL
when it is being executed it is critical. The extra edges in the augmented DAG introduce additional ordering
(see Figure 9).
In order to complete the proof for the execution time bound of the Cilk scheduler, we introduce some
definitions and lemmas.
Definition 20 (Delay Seq... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
during which a thread in U executes, since L ≤ 2T∞. For all the other R
rounds, some thread is critical and not executed.
Note: The converse need not be true.
The idea is to sum up over all possible events the probability that the event occurs. Show that the sum is
small. We would then be able to show that with high p... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
number of rounds, R.
Proof
Pr [(U, R, Π) occurs] =
≤
(cid:5)
πi rounds occur
while ui is critical
(cid:11)
(cid:4)
Pr
1≤i≤L
(cid:11)
e −πi
1≤i≤L
= e −R .
Lemma 24 (Number of Delay Sequences) The number of delay sequences is at most
(cid:1)
22T∞
(cid:2)
.
2T∞ + R
2T∞
Proof We have
#paths ≤ 22T∞ , ... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
] + Pr [C] + · · · .
Following from Lemma 23 and Lemma 24 we have that:
Pr [any (U, R, Π) occurs] ≤
(cid:1)
⎛
⎝
(cid:2) Maximum Probability
that any delay
sequence occurs
⎞
⎠
Number of
Delay Sequences
(cid:2)
(cid:1)
≤ 22T∞
2T∞ + R
2T∞
−R
e
Next, we use the following “death-bed” formula to simplify the... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
event occurs that is Pr [E] ≥ 1 − P (n), where P (n) is a polynomial. That is the probability that the event
does not occur is polynomially small.
Observation 26 When C ≥ 4, probability decreases exponentially in R.
Example 2 If we take C = 4 then the probability is less or equal to 0.84R .
Let:
(cid:4)
Then Pr
... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
at least 1 − ε:
(cid:1)
(cid:14) (cid:15)(cid:15)
1
(cid:14) (cid:15)(cid:15)
1
).
(cid:14)
(cid:14)
TP ≤ + O T∞ + lg
T1
P
(cid:1)
(cid:2)(cid:2)
.
1
ε
6.1 Death-Bed Formulae
Figure 13 shows a list of useful (“death-bed”) formulae that were used in the analysis of the Cilk scheduler.
12
(5)
(6)
(7)
... | https://ocw.mit.edu/courses/6-895-theory-of-parallel-systems-sma-5509-fall-2003/533da8dd57712f1c0414ef6c84baf90a_lecture9.pdf |
16.920J/SMA 5212
Numerical Methods for PDEs
Lecture 5
Finite Differences: Parabolic Problems
B. C. Khoo
Thanks to Franklin Tan
SMA-HPC ©2002 NUS
Outline
• Governing Equation
• Stability Analysis
• 3 Examples
• Relationship between σand λh
• Implicit Time-Marching Scheme
• Summary
SMA-HPC ©2002 NUS
2
G... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
��
2
x
∂
j
=
j u
u
2
+ −
j
1
2
x
∆
u
−+
j
1
+
(
O x
∆
2
)
which is second-order accurate.
• Schemes of other orders of accuracy may be
constructed.
SMA-HPC ©2002 NUS
5
Stability Analysis
Discretization
We obtain at
x
1
x
2
:
:
du
1
dt
du
2
dt
=
=
υ
2
x
∆
υ
2
x
∆
( u... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
u
υ
N
∆
2
x
0
1
−
0
A
SMA-HPC ©2002 NUS
7
Stability Analysis
PDE to Coupled ODEs
Or in compact form
(cid:71)
du
dt
(cid:71) (cid:71)
Au b
+
=
where
(cid:71)
u
(cid:71)
b
[
u
=
1
o u
υ
=
2
x
∆
u
2
0
0
0
T
]
... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
V
j
Tj
V
=
j v
1
j
v
2
v −
j
N
1
SMA-HPC ©2002 NUS
9
Stability Analysis
Eigenvalue and
Eigenvector of Matrix A
N
The (
j
V
1) (
− ×
−
diagonalizes the matrix by
E
A
N
1) matrix formed by the (
N
−
1) columns
1E AE−
= Λ
where
Λ =
λ
1
λ
2
0
0
... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
−
1
−
I
)
SMA-HPC ©2002 NUS
Λ
11
Stability Analysis
Coupled ODEs to
Uncoupled ODEs
Continuing from
(cid:71)
(cid:71)
1
−
U E u
=
Let
and
(cid:71)
(cid:71)
u E b
+
−
1
1 E −
1
−
E
= Λ
(cid:71)
du
dt
(cid:71)
(cid:71)
1−=
F E b
(cid:71)
U
d
dt
, we have
(cid:74)(cid:71)
(cid:74)(cid:71)
F... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
U
j
=
j c
jt
λ
e
is the solution for j = 1,2,….,N–1.
−
1
λ
j
F
j
Evaluating,
(cid:74)(cid:74)(cid:74)(cid:74)(cid:71)
(cid:71)
(cid:71)
t
λ
u EU E ce
=
=
(
(cid:71)
1
−
E E b
− Λ
1−
)
Complementary
(transient) solution
(cid:74)(cid:74)(cid:74)(cid:74)(cid:71)
)
(
t
λ
t
λ
c e
ce
= ... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
SMA-HPC ©2002 NUS
15
Stability Analysis
Use of Modal (Scalar)
Equation
(cid:71)
u
is expressed as a
It may be noted that since the solution
contribution from all the modes of the initial solution,
which have propagated or (and) diffused with the eigenvalue
, and a contribution fr
λ
j
properties of the time... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
a
22
⇒
(cid:71)
du
dt
(cid:71)
Au
=
SMA-HPC ©2002 NUS
18
Example 1
Continuous Time
Operator
Proceeding as before, or otherwise (solving the ODEs directly),
we can obtain the solution
u
1
u
2
=
=
c
ξ
1
11
c
ξ
1
21
t
λ
e
1
+
t
λ
e
1
+
t
λ ξ
c
e
2
2 12
t
λ
c
e
ξ
2 ... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
for the nth time level, then
(cid:71)
n
u
=
(cid:71)
n
u
A
1
−
where
(cid:71)
n
u
=
n
u
1
n
u
2
T
and
A
a
11
=
a
21
a
12
a
22
Since A is independent of time,
(cid:71)
n
u
=
(cid:71)
n
u
A
1
−
(cid:71)
n
AAu
−
2
=
....
=
(cid:71)
0
n
A u
=
S... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
2
2
n
=
'
c
λ ξ λ ξ
21 1
n
1
+
'
c
22 2
n
2
where
c
1
c
2
'
'
=
(cid:74)(cid:74)(cid:71)
1
0
−
E u
are constants.
SMA-HPC ©2002 NUS
21
Example 1
Comparison
Comparing the solution of the semi-discretized problem where
time is kept continuous
u
1
u
2
[ ... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
time is
solution
. nλ
co
nt
inuo
hus
as
exponential
discretized
has
power
SMA-HPC ©2002 NUS
22
Example 1
Comparison
In equivalence, the transient solution of the difference
equation must decay with time, i.e.
nλ <
1
for this particular form of time discretization.
SMA-HPC ©2002 NUS
23
Example 2
Le... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
solution pn, i.e.
un = cn + pn
There are several ways of solving for the complementary and
particular solutions.
S and characteristic polynomial.
One way is through use of the
shift operator
The time shift operator S operates on cn such that
Scn = cn+1
S2cn = S(Scn) = Scn+1 = cn+2
SMA-HPC ©2002 NUS
25
Exam... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
1
Combining the two components of the solution together,
n
u
n
)
) (
n c +
p
(
(
=
h
β λ
1
=
+
1
+
2
2
h
h
+
λ β λ
1
− +
2
2
h
λ
n
)
(
2
SMA-HPC ©2002 NUS
n
)
+
2
e
2
h
µ
h
µ
hn
µ
ahe e
h
µ
h
e
2
λ
−
1
−
27
Example 2
Leapfrog Time ... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
u
∂
2
x
∂
the central difference scheme for spatial discretization, we
obtain
A
=
υ
2
x
∆
1
−
2
1
0
2
−
1
0
1
−
2
1
which is the tridiagonal matrix.
SMA-HPC ©2002 NUS
30
Example 2
Leapfrog Time Discretization
According to analysis of a ... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
which can be plotted in the absolute stability diagram.
SMA-HPC ©2002 NUS
31
Example 2
Leapfrog Time Discretization
Absolute Stability Diagram for σ
As applied to the 1-D Parabolic PDE, the absolute stability
diagram for σis
Im(σ)
Region of
instability
Unit
circle
σ2 with h
increasing
σ2 at h = ∆t = 0
... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
+ +
1
(
2
2
h
λ
2
)
+
1
.
2
−
1
2 .
4
4
h
λ
!
2
σ
1
1
= +
h
λ
+
h
2
2
λ
2
+
...
and compared to
h
λ
e
1
= +
h
λ
+
2
2
h
λ
2!
.
..
+
is identical up to the second order of
is said to be second-order accurate.
h
λ
. Hence, the above scheme
SMA-HPC ©2002 NUS
34
Example 3... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
ization scheme is stable if
σ ≡ +
1
1λ <
h
or bounded by
SMA-HPC ©2002 NUS
h λ
σ
= −
1
s.t.
σ
<
1 in the
h
λ
-plane.
36
Example 3
Euler-Forward Time Discretization
Stability Diagram
The stability diagram for the Euler-forward time
discretization in the λh-plane is
Unit Circle
Im(λh)
-2
-1
0
Regio... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
(λh)
• The above set of ODEs becomes
−(cid:71)
(cid:71)
n u
1
n
1
+ −
u
h
2
(cid:71)
n
Au
(cid:71)
b
+
=
n
Introducing the time shift operator S
(cid:71)
n
hAu
2
(cid:71)
hb
n
+
2
•
i
1
−
+
−
=
A
(cid:71)
n
Su
(cid:71)
n
u
S
S S
−
h
2
Premultiplying
1
−
I EE
=
E AE... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
2
(cid:71)
n
F
=
−
(cid:71)
n
E
U
1
−−
S S
h
2
i.e.
Λ −
−
(cid:71)
1
S S
−
n
U
2
h
(cid:71)
nF
= −
which is a set of uncoupled equations.
Hence, for each j, j = 1,2,….,N-1,
λ
j
−
−
1
S S
−
U
j
h
2
= −
F
j
SMA-HPC ©2002 NUS
41
Relationship
between... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
Uncoupling the set,
Integrating each equation in the uncoupled set,
Re-coupling the results to form the final solution.
These 3 steps are commonly referred to as the
ISOLATION THEOREM
SMA-HPC ©2002 NUS
43
Implicit Time-
Marching Scheme
Thus far, we have presented examples of explicit time-marching
methods and... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
�
u
1
(
)
−
S
h
1
λ
the characteristic polynomial becomes
( )
)
h λ
σ
( )
S
The principal root is therefore
(
1
Ρ
Ρ
=
=
−
aheµ
( 1
)
n
+
h
S
1
− =
0
σ
=
1
h
−
λ
1
1
= +
h
λ
+
2
λ
2
h
+
....
which, upon comparison with
λ
he
first-order accurate.
1
= +
λ
1
2
h ... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
7
Implicit Time-
Marching Scheme
Euler-Backward
However, numerical solution of u requires the solution
of a set of simultaneous algebraic equations or matrix
inversion, which is computationally much more
intensive/expensive compared to the multiplication/
addition operations of explicit schemes.
SMA-HPC ©2002 ... | https://ocw.mit.edu/courses/16-920j-numerical-methods-for-partial-differential-equations-sma-5212-spring-2003/5350b98a660c073d845f9128a3851a8b_lec5.pdf |
18.409 An Algorithmist’s Toolkit
September 17, 2009
Lecturer: Jonathan Kelner
Scribe: Andre Wibisono
Lecture 3
1 Outline
Today’s lecture covers three main parts:
• Courant-Fischer formula and Rayleigh quotients
• The connection of λ2 to graph cutting
• Cheeger’s Inequality
2 Courant-Fischer and Rayleigh Quoti... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
(cid:2)x(cid:2)=1
⊥
x∈Sk
−1
−1
xT Ax
.
xT x
Let A = QT ΛQ be the eigendecomposition of A. We observe that xT Ax = xT QT ΛQx =
Proof
(Qx)T Λ(Qx), and since Q is orthogonal, (cid:3)Qx(cid:3) = (cid:3)x(cid:3). Thus it suffices to consider the case when A = Λ is a
diagonal matrix with the eigenvalues λ1, . . . , λn... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
:3)2 = λk.
x 2
i=1
i=k
i=k
3-1
⊥
On the other hand, plugging in x = ek ∈ Sk
−1 yields xT Ax = (ek)T Aek = λk. This shows that
λk = min x T Ax.
(cid:2)x(cid:2)=1
⊥
x∈Sk
−1
Similarly, for (cid:3)x(cid:3) = 1,
x T Ax =
n
(cid:10)
λix 2
i
i=1
≤ λmax
n
(cid:10)
i = λmax(cid:3)x(cid:3)2 = λmax.
x 2
i=1
... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
x=0
(cid:11)
(i,j)∈E (xi − xj )2
.
i∈V
x2
i
(cid:11)
We can interpret the formula for λ2 as putting springs on each edge (with slightly weird boundary
conditions corresponding to normalization) and minimizing the potential energy of the configuration.
Some big matrices are hard or annoying to diagonalize, so in... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
bound λ2 ≤ O(1/n2). We knew this was true from the explicit formula of λ2 in terms of sines
and cosines from Lecture 2, but this is much cleaner and more general of a result.
2.2 Example 2: A Complete Binary Tree
Let G be a complete binary tree on n = 2h − 1 nodes. Define the vector x ∈ Rn to have the value 0 on the ... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
Cut Graphs?
The first question to ask about graph cutting is what we want to optimize when we are cutting a graph.
Before attempting to answer this question, we introduce several notations. Let G = (V, E) be a graph. Given
a set S ⊆ V of vertices of G, let S ¯ = V \ S be the complement of S in V . Let |S| and |S¯| de... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
of problems, as Figure 1(b) shows. In this example, we ideally want to
cut the graph across the one edge in the middle that separates the two clusters. However, the approximate
bisection criterion would force us to make a cut across the dense graph on the left.
(a) Problem with min-cut
(b) Problem with approximate ... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
follows.
Associate every cut S − S ¯ with a vector x ∈ {−1, 1}n, where
(cid:14)
1,
−1,
xi =
if i ∈ S, and
if i ∈ ¯ S.
Then it is easy to see that we can write
e(S) =
(cid:10)
1
4 (i,j)∈E
(xi − xj )2 .
For a boolean statement A, let [A] denote the characteristic function on A, so [A] = 1 if A is true, and
... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
)
≤ min (cid:11)
x∈{−1,1}n
≤ min
S⊆V n min(|S|, |S¯|)
= φ(G).
2
n
(cid:11)
(i,j)∈E (xi − xj )2
(xi − xj )2
i<j
Therefore, solving the integer program
(cid:11)
min
x∈{−1,1}n
(xi − xj )2
(i,j)∈E
(cid:11)
(xi − xj )2
i<j
allows us to approximate φ(G) within a factor of 2. The bad news is that it is NP-... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
Let p and q be the points that minimize
Since C
C ⊆ C (cid:2), we know that f (q) ≤ f (p).
n
smaller
f (x)
C
p
q (cid:7)
C (cid:7)
q
Figure 2: Illustration of the relaxation technique for approximation algorithms.
For this relaxation to be useful, we have to show how to “round” q to a feasible point q(cid:7) ∈... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
in Lecture 2). Therefore, using the
Rayleigh quotient,
(cid:11)
min (cid:11)
x∈Rn
(i,j)∈E (xi − xj )2
i<j (xi − xj )2
(cid:11)
(i,j)∈E (xi − xj )2
i=1
(cid:11)n
2
xi
n
=
λ2
n
.
= min
x∈Rn
x⊥1
3-5
Putting all the pieces together, we get
φ(G) = min
e(S)
e(S)
S⊆V min(|S|, |S¯|)
n
≥ min
2 S⊆V |S| · ... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
, which is Cheeger’s Inequality.
Theorem 4 (Cheeger’s Inequality) Given a graph G,
φ(G)2
2dmax
≤ λ2 ≤ 2φ(G),
where dmax is the maximum degree in G.
As a side note, the dmax disappears from the formula if we use the normalized Laplacian in our calcu
lations, but the proof is messier and is not fundamentally any di... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
. . ≤ xn, and the cut will be defined by the
set S = {1, . . . , k} for some value of k. The value of k cannot be known a priori since the best cut depends
on the graph. In practice, an algorithm would have to try all values of k to actually find the optimal cut
after embedding the graph to the real line.
We will act... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
T Lx
xT x
≥
yT Ly
yT y
Proof First, the numerators are equal by the operation of the Laplacian,
x T Lx =
(cid:10)
(xi − xj )2 =
(cid:10)
(cid:2)
(yi + xm) − (yj + xm)
(cid:3)2 =
(cid:10)
(yi − yj )2 = y T Ly.
(i,j)∈E
(i,j)∈E
(i,j)∈E
Next, since x ⊥ 1,
y T y = (x + xm1)T (x + xm1) = x T x + 2xm(x T 1) + x... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
− ym)2 + (ym − yi)2 .
3-7
4.2.3 Step 3: Breaking the Sum in Half
We would like to break the summations in half so that we do not have to deal with separate cases with
positive and negative numbers. Let E(cid:7) be the edges (i, j) with i, j ≤ m, and let E(cid:7) be the edges (i, j) with
i, j ≥ m. We then have
(c... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
first one.
4.2.4 The Main Lemma
Let Ci be the number of edges crossing the point xi, i.e. the number of edges in the cut if we were to take
S = {1, . . . , i}. Recall that
φ = φ(G) = min
,
S⊆V min(|S|, |S¯|)
e(S)
so by taking S = {1, . . . , i}, we get Ci ≥ φi for i ≤ n/2 and Ci ≥ φ(n − i) for i ≥ n/2.
The main ... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
1 ≤ i ≤ m. Then we can evaluate the last summation above as
(cid:10)
(i,j)∈E
(cid:3)
−
|zi − zj | ≥ φ
(cid:10)
m−1
k(zk+1 − zk)
k=1
(cid:2)
(cid:3)
= φ (z2 − z1) + 2(z3 − z2) + 3(z4 − z3) + · · · + (m − 1)(zm − zm−1)
= φ(−z1 − z2 − · · · − zm−1 + (m − 1)zm)
(cid:10)
m
= φ
|zi|.
i=1
3-8
4.2.5 Using the M... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
i
− y 2
| =
j
(cid:10)
⎛
|yi − yj | · |yi + yj | ≤ ⎝
(cid:10)
⎞1/2
⎛
(yi − yj )2 ⎠ ⎝
(cid:10)
⎞1/2
(yi + yj )2 ⎠
.
(i,j)∈E(cid:3)
−
(i,j)∈E(cid:3)
−
(i,j)∈E(cid:3)
−
(i,j)∈E(cid:3)
−
4. We want to get rid of the (yi + yj )2 part, so we bound it and observe that the maximum number of
2 can show u... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
,j)∈E
(cid:11)
+
n
i=m
(yi − yj )2
2
yi
≥
φ2
2dmax
.
Therefore,
T Lx
x
xT x
≥
yT Ly
yT y
≥ min
(cid:14) (cid:11)
(i,j)∈E
(cid:11)
(yi − yj )2
,
2
i
(cid:3)
−
m
i=1
y
(cid:11)
(cid:3)
(i,j)∈E
(cid:11)
+
n
i=m
(yi − yj )2
2
i
y
(cid:19)
≥
φ2
2dmax
.
4.2.6 So who is Cheeger anyway?
Jeff Cheeger is ... | https://ocw.mit.edu/courses/18-409-topics-in-theoretical-computer-science-an-algorithmists-toolkit-fall-2009/535add3f6457cc13e51d9774f16bf48f_MIT18_409F09_scribe3.pdf |
MIT OpenCourseWare
http://ocw.mit.edu
6.005 Elements of Software Construction
Fall 2008
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
6.005
elements of
software
construction
coding the photo organizer
Daniel Jackson
topics for today
how to implement an ob... | https://ocw.mit.edu/courses/6-005-elements-of-software-construction-fall-2008/536852e935745fdafa966f405cea7916_MIT6_005f08_lec19.pdf |
Album root;}
static subset patterns
‣ classification of object does not change over time
‣ subset as subclass: class Root extends Album {...}
© Daniel Jackson 2008
6
example: Selected
OR
© Daniel Jackson 2008
7
PhotoSelectedSetCatalogelts!PhotoselectedPhotoBooleanisSelected!example: Root
OR
© Daniel Jac... | https://ocw.mit.edu/courses/6-005-elements-of-software-construction-fall-2008/536852e935745fdafa966f405cea7916_MIT6_005f08_lec19.pdf |
Photos;}
or class Photo {Set<Collection> insertedInto;}
‣ relation as map: class Catalog {Map<Album, Set<Photo>> insertedPhotos;}
or class Catalog {Map<Photo, Set<Album>> insertedInto;}
‣ for basic add operation, implementing as Album -> Photo is fine
‣ but if add operation removes photo from other collections,
wi... | https://ocw.mit.edu/courses/6-005-elements-of-software-construction-fall-2008/536852e935745fdafa966f405cea7916_MIT6_005f08_lec19.pdf |
15
thumbnails
architecture of GUI may influence decisions
‣ regard selection and images as part of view, not model
‣ and want to avoid back-dependences of model on view
© Daniel Jackson 2008
16
PhotoSelectedImage!File!?fileimagePhotoFile!fileListPreviewPanethumbnailsThumbnaileltsImage!imageBooleanisSelected!photo!... | https://ocw.mit.edu/courses/6-005-elements-of-software-construction-fall-2008/536852e935745fdafa966f405cea7916_MIT6_005f08_lec19.pdf |
(a2) or !a1.getName().equals(a2.getName())
* 4) Map of inserted photos has all albums as keys
*
inserted.keySet() = parent.keySet() + root
*
*/
where albums is the set of Album objects that are keys or values in the parent map
// checking rep (1)
assert root != null: "root cannot be null!";
assert... | https://ocw.mit.edu/courses/6-005-elements-of-software-construction-fall-2008/536852e935745fdafa966f405cea7916_MIT6_005f08_lec19.pdf |
2.160 System Identification, Estimation, and Learning
Lecture Notes No. 6
February 24, 2006
4.5.1 The Kalman Gain
Consider the error of a posteriori estimate x ıt
=
et ≡
x ı
t −
xt
=
x ı
t
x ı
t
+
1
t
−
K
t (
y t H
−
+
(
K H
t
xt
t
+
t
−
1
t
t
x ı t
vt
−
1−
)
−
xt
x ı t
t − )1
H
t
−
xt
(2... | https://ocw.mit.edu/courses/2-160-identification-estimation-and-learning-spring-2006/5374ca7c1c6c42d50e1a59807d00f438_lecture_6.pdf |
T
= KH εε H + KHεε H − 2[
T
T
T
vKH
ε
T + Kvε H ] + 2KvvT + 2[εv − εε H ]
T
T
T
T
T
(3)0
The necessary condition for the mean squared error of state estimate with respect to
the gain matrix K is:
Jd t = 0
dK
(31)
T
T
aking expectation of ee
t
t
, differentiating it w.r.t. K and setting it to zero yield:
[
T
K... | https://ocw.mit.edu/courses/2-160-identification-estimation-and-learning-spring-2006/5374ca7c1c6c42d50e1a59807d00f438_lecture_6.pdf |
Uncorrelated with vt
A ⋅ xt − 2 + wt − 2
Uncorrelated with vt
∴
ı[
xE
tt − 1vt
T ] = 0
For the second term
xt =
xA
⋅
t − 1
tw
1−+
Uncorrelated with vt
A ⋅ xt − 2 + wt − 2
Uncorrelated with vt
-
∴
vxE
[
t
T
t ] =
Therefore
xAE
[
t − 1vt
T ] + wE
[
t − 1vt
T
0] =
2
E [εtvt
T ] = 0
(34)
Now not... | https://ocw.mit.edu/courses/2-160-identification-estimation-and-learning-spring-2006/5374ca7c1c6c42d50e1a59807d00f438_lecture_6.pdf |
3
satisfy
5) and (3
6) into (33), we can conclude that the optimal gain must
Kt H t P
t
t −1Ht Kt Rt
+
T
−
T
t −1Ht
P
t
= 0
∴ Kt
= P t
t −1Ht
T
[H P
t
tt −1Ht
T
−1
+ R ]
t
(37)
(38)
This is called the Kalman Gain.
4.5.2 Updating the Error Covariance
The above Kalman gain contains the a priori error ... | https://ocw.mit.edu/courses/2-160-identification-estimation-and-learning-spring-2006/5374ca7c1c6c42d50e1a59807d00f438_lecture_6.pdf |
−
KH )T +
KR t
T
K
)
(40
Substituting the Kalman gain (3) into (40yields
8
)
P = (I − H K
t
t
t
)P
t − 1
t
(41)
Exercise. Derive (41)
Furthermore, based on Pt we can compute
Pt + 1 t
by using the state transition equation
(8)
Consider
From (36)
Pt + 1 = E[ε ε T ]
t + 1 t + 1
t
ı
ε t + 1 = xt + 1 t − xt +... | https://ocw.mit.edu/courses/2-160-identification-estimation-and-learning-spring-2006/5374ca7c1c6c42d50e1a59807d00f438_lecture_6.pdf |
T
t− 1wt ]
Kt ( y
+
vt )wT ]
t
T ] +
x E
[
w
t
t
−
I
)
+
t
t
= A E
[
A=
t− 1
−
T
yı )}w ] −
t
t
x E
[
t
T ]
w
t
−
x H K E
t
[
T
x E
[
t
ı t t | − 1wt ] −
t
T ] −
w
t
[ ı
x E H K
t
t
T ]
w
t
T
t t | − 1wt ]
v E K
[
t
t
(42)
(43)
(44)
The first term: xıt− 1 does not depend on wt , hence ... | https://ocw.mit.edu/courses/2-160-identification-estimation-and-learning-spring-2006/5374ca7c1c6c42d50e1a59807d00f438_lecture_6.pdf |
0
P
1
tP
,0 =
1
Compute Kalman Gain
K
t P
=
t
1−
t
HPHH
t
T
[
t
t
−
1
t
T
t
1
−
R
]
+ t
Initial State
Estimate x ı0
Measurement yt
Update State Estimate with
new measurement
ıx t
t −1 = At −1xt −1
ı
Update error covariance
tP
(=
PHKI
)
t
t
−
t
t
1
−
x ıt = x ı
t −1
t
+ Kt ( y − Ht... | https://ocw.mit.edu/courses/2-160-identification-estimation-and-learning-spring-2006/5374ca7c1c6c42d50e1a59807d00f438_lecture_6.pdf |
output error
The Kalman Gain
K t = P t
t −1 H t (H t P t
t −1 H t + Rt )
T
T
−1
Error Covariance update (a priori to a posteriori):
Pt = (I − K t H t )P
t −1
t
(9)
(20)
)
(23
(38)
(41)
xt )(xt
ı −
Δ
P = E
t
t
−x ı([
x ı[E=
(
Δ
P
t −1|
t
−
t −1
|t
]
xt )T
xt )(x ı
1|
t −
t
: a posteriori state est... | https://ocw.mit.edu/courses/2-160-identification-estimation-and-learning-spring-2006/5374ca7c1c6c42d50e1a59807d00f438_lecture_6.pdf |
t
t
Therefore
xı
t
x ı=
t −1
t
+ t
P H t
−1
T Rt
y Δ
t
(46)
(47)
(48)
Q1. Without loss of generality, we can write
2
⎡σ1
⎢
Rt = ⎢
⎢
⎢
⎢ 0
⎣
2
σ2
�
⎤
0
⎥
⎥
⎥
⎥
σl ⎦⎥
2
yt 1
⎡Δ
⎤
⎢
⎥
�
Δy = ⎢
⎥
⎥
⎢
⎥
⎢
⎣Δytl ⎦
t
since if not diagonal we can change the coordinates.
2
⎤
⎡Δyt 1
σ1
⎥
T ⎢
� ... | https://ocw.mit.edu/courses/2-160-identification-estimation-and-learning-spring-2006/5374ca7c1c6c42d50e1a59807d00f438_lecture_6.pdf |
⎜
⎜
⎜
⎝
⎞
⎟
⎟
⎟
⎠
Large variance in this
�
direction
sure in this direction
ı −x
t
t
1
is not
maxλ
More corrected
based on new data
Associated with matrix P , which is
t
positive-definite, we can consider an
ellipsoid with eigenvalues
λmin(P ) ,λ (P )
max
t
t
xt 2
x ıt = x ı
t −1
t
+ P Δq
t
... | https://ocw.mit.edu/courses/2-160-identification-estimation-and-learning-spring-2006/5374ca7c1c6c42d50e1a59807d00f438_lecture_6.pdf |
Lecture 7
ChIP-seq Analysis
Irreproducible Discovery Rate (IDR) Analysis
Foundations of Computational Systems Biology
David K. Gifford
1
Transcription factors regulate gene expression
© Emw on wikipedia. Some rights reserved. License: CC-BY-SA. This content is excluded from our Creative
Commons license. For m... | https://ocw.mit.edu/courses/7-91j-foundations-of-computational-and-systems-biology-spring-2014/53a07f80af4d4304844344039d97775e_MIT7_91JS14_Lecture7.pdf |
:10)(cid:22)(cid:4)(cid:5)(cid:24)(cid:17)(cid:12)(cid:18)(cid:13)(cid:5)(cid:15)(cid:12)(cid:18)(cid:11)(cid:12)(cid:18)(cid:25)(cid:5)(cid:4)(cid:22)(cid:4)(cid:18)(cid:13)(cid:6)(cid:5)
ChIP-Seq reads are independently
generated from a set of spatially
discrete binding events
9GPS addresses the challenges
in Ch... | https://ocw.mit.edu/courses/7-91j-foundations-of-computational-and-systems-biology-spring-2014/53a07f80af4d4304844344039d97775e_MIT7_91JS14_Lecture7.pdf |
n=1 m=1
M
m=1
Prob. of event m
Mixing prob.
13Likelihood of
observed reads p(R | π) = ∏∑πm p(rn | m), ∑πm = 1
N M
M
Read assignment is latent
n=1 m=1
m=1
g(zn = m) = 1 Read n came from event m π= arg max p(R | π)
g(z = m
n
Read n did not come from
event m
) = 0
π
Expectation-Maximization (EM) algorithm with comp... | https://ocw.mit.edu/courses/7-91j-foundations-of-computational-and-systems-biology-spring-2014/53a07f80af4d4304844344039d97775e_MIT7_91JS14_Lecture7.pdf |
no prior
(events at 500 and 550 bp)
16GPS deconvolves homotypic events and
improves spatial accuracy
Example of a predicted joint CTCF event that
contains coordinately located CTCF motifs
22Likelihood of
observed reads p(R | π) = ∏∑πm p(rn | m), ∑πm = 1
N M
M
n=1 m=1
m=1
A sparse prior on mixture components (b... | https://ocw.mit.edu/courses/7-91j-foundations-of-computational-and-systems-biology-spring-2014/53a07f80af4d4304844344039d97775e_MIT7_91JS14_Lecture7.pdf |
= 0.5 equal chance reads occurred in
control and IP channels for null model.
24
We determine significant events by Benjamini
Hochberg at a desired false discovery rate (FDR)
Rank: Rank of event in list list of p-values, from most
significant (rank = 1) to least (rank = Count)
Accept events (reject null) of ra... | https://ocw.mit.edu/courses/7-91j-foundations-of-computational-and-systems-biology-spring-2014/53a07f80af4d4304844344039d97775e_MIT7_91JS14_Lecture7.pdf |
Rate (IDR) Analysis
• Consider that the lists X and Y are a mixture of
two kinds of events – reproducible and
irreproducible.
• Model the ranking scores as a two component
mixture and learn the parameters of the
reproducible and irreproducible components
• For IDR α, select top l pairs using their scores
suc... | https://ocw.mit.edu/courses/7-91j-foundations-of-computational-and-systems-biology-spring-2014/53a07f80af4d4304844344039d97775e_MIT7_91JS14_Lecture7.pdf |
ev et al., 2008)
TF A TF A
Courtesy of PLoS Computational Biology. License: CC-BY.
Source: Guo, Yuchun, Shaun Mahony, et al. "High Resolution Genome Wide Binding Event Finding and Motif Discovery
Reveals Transcription Factor Spatial Binding Constraints." PLoS Computational Biology 8, no. 8 (2012): e1002638.
34
GE... | https://ocw.mit.edu/courses/7-91j-foundations-of-computational-and-systems-biology-spring-2014/53a07f80af4d4304844344039d97775e_MIT7_91JS14_Lecture7.pdf |
638.
Motif
Event call
35
GEM improves the spatial resolution of
ChIP-exo data event prediction
0.015
0.01
0.005
y
t
i
s
n
e
d
d
a
e
R
0
-300
GEM initial distribution
GEM learned distribution
CTCF empirical distribution
-200
0
Stranded location with respect to binding site (bp)
-100
100
200
300
Motif... | https://ocw.mit.edu/courses/7-91j-foundations-of-computational-and-systems-biology-spring-2014/53a07f80af4d4304844344039d97775e_MIT7_91JS14_Lecture7.pdf |
GEM Summary
• GEM incorporates motif information as a
position-specific prior to bias binding event
prediction
• GEM achieves exceptional spatial resolution,
and further improves joint event deconvolution
• GEM systematic analysis reveals in vivo
transcription factor spatial binding constraints in
human and ... | https://ocw.mit.edu/courses/7-91j-foundations-of-computational-and-systems-biology-spring-2014/53a07f80af4d4304844344039d97775e_MIT7_91JS14_Lecture7.pdf |
D. Dowell, et al. "Tissue-specific Transcriptional Regulation has
Diverged Significantly between Human and Mouse." Nature Genetics 39, no. 6 (2007): 730-32.
D. Odom, R. Dowell E. Fraenkel, D. Gifford Labs
Nature Genetics, 2007
43FIN
44MIT OpenCourseWare
http://ocw.mit.edu
7.91J / 20.490J / 20.390J / 7.36J / 6.802J... | https://ocw.mit.edu/courses/7-91j-foundations-of-computational-and-systems-biology-spring-2014/53a07f80af4d4304844344039d97775e_MIT7_91JS14_Lecture7.pdf |
MIT EECS 6.837 Computer Graphics
Collision Detection
and Response
MIT EECS 6.837 – Matusik
MIT EECS 6.837 – Durand
Philippe Halsman: Dali Atomicus
1
This image is in the public domain. Source:Wikimedia Commons.
Collisions
• Detection
• Response
• Overshooting problem
(when we enter the solid)
2
Collision... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53c5b275d4fb9eba7968e6e80047f2d4_MIT6_837F12_Lec10.pdf |
due to copyright restrictions.
This image is in the public domain.
Source:Wikimedia Commons.
Image courtesy of Chris Rand on Wikimedia Commons. License: CC-BY-SA.
This content is excluded from our Creative Commons license. For more info
rmation, see http://ocw.mit.edu/help/faq-fair-use/.
9
Collision Detection i... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53c5b275d4fb9eba7968e6e80047f2d4_MIT6_837F12_Lec10.pdf |
ierarchy
• http://isg.cs.tcd.ie/spheretree/
© Gareth Bradshaw. All rights reserved. This content is excluded from our Creative
Commons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
15
Pseudocode (simplistic version)
boolean intersect(node1, node2)
// no overlap? ==> no intersection!
... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53c5b275d4fb9eba7968e6e80047f2d4_MIT6_837F12_Lec10.pdf |
For more information, see
http://ocw.mit.edu/help/faq-fair-use/.
Courtesy of Patrick Laug. Used with permission.
18
boolean intersect(node1, node2)
if (!overlap(node1->sphere, node2->sphere)
return false
if (node1->radius()>node2->radius())
for each child c of node1
if intersect(c, node2) return true
else... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53c5b275d4fb9eba7968e6e80047f2d4_MIT6_837F12_Lec10.pdf |
boolean intersect(node1, node2)
if (!overlap(node1->sphere, node2->sphere)
return false
if (node1->radius()>node2->radius())
for each child c of node1
if intersect(c, node2) return true
else
for each child c f node2
if intersect(c, node1) return true
return false
© Gareth Bradshaw. All rights reserve... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53c5b275d4fb9eba7968e6e80047f2d4_MIT6_837F12_Lec10.pdf |
– Cluster nearby objects
• Incremental
– Add objects one by one, binary-tree style.
26
Bounding Sphere of a Set of Points
• Trivial given center C
– radius = maxi ||C-Pi||
C
© Gareth Bradshaw. All rights reserved. This content is excluded from our Creative
Commons license. For more information, see http://... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53c5b275d4fb9eba7968e6e80047f2d4_MIT6_837F12_Lec10.pdf |
)(cid:11)
(cid:27) (cid:16)(cid:4)%(cid:31)(cid:7)(cid:11)(cid:6)(cid:25)(cid:20)(cid:5)(cid:17)(cid:5)/(cid:16)(cid:15)<(cid:11)(cid:8)(cid:17)(cid:15)(cid:4)(cid:30)(cid:7)(cid:11)%(cid:14)(cid:11)
© Sara McMains. All rights reserved. This content
is excluded from our Creative Commons license.
For more information, s... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53c5b275d4fb9eba7968e6e80047f2d4_MIT6_837F12_Lec10.pdf |
)%(cid:30)(cid:11)(cid:14)(cid:20)(cid:5)(cid:11)(cid:26)%(cid:7)(cid:7)(cid:31)(cid:5)(cid:11)
Questions?
(cid:27) (cid:8)(cid:6)(cid:6)%"(cid:30)(cid:11)(cid:5)(cid:8)(cid:13)(cid:20)(cid:11)(cid:15)(cid:16)*(cid:5)(cid:13)(cid:14)(cid:11)(cid:15)(cid:17)(cid:11)(cid:14)(cid:17)%(cid:8)(cid:30)"(cid:31)(cid:5)(cid:1... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53c5b275d4fb9eba7968e6e80047f2d4_MIT6_837F12_Lec10.pdf |
uvia-Pastor, Daniel Rypl. All rights(cid:2)reserved. This content is
excluded from our(cid:2)Creative Commons license. For more information,
see http://ocw.mit.edu/help/faq-fair-use/.
Courtesy of Patrick Laug. Used with permission.
32
Reference
Image of the cover of the book, "Real Time Collision Detection," by Chris... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53c5b275d4fb9eba7968e6e80047f2d4_MIT6_837F12_Lec10.pdf |
Graphics Pipeline & Rasterization
Image removed due to copyright restrictions.
MIT EECS 6.837 – Matusik
1
How Do We Render Interactively?
• Use graphics hardware, via OpenGL or DirectX
– OpenGL is multi-platform, DirectX is MS only
OpenGL rendering
Our ray tracer
© Khronos Group. All rights reserved. This cont... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53d96abf747a3c82fd3497d2fea540f5_MIT6_837F12_Lec21.pdf |
ization
GPU
For each triangle
For each pixel
Does triangle cover pixel?
Keep closest hit
Pixel raster
Scene
primitives
7
GPUs do Rasterization
• The process of taking a
triangle and figuring out
which pixels it covers is
called rasterization
• We’ve seen acceleration
structures for ray
tracing; rast... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53d96abf747a3c82fd3497d2fea540f5_MIT6_837F12_Lec21.pdf |
at once
– Then, can sample the image completely freely
• The rasterizer only needs one triangle at a time, plus
the entire image and associated depth information for
all pixels
11
Rasterization Advantages
• Modern scenes are more complicated than images
– A 1920x1080 frame at 64-bit color and 32-bit ... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53d96abf747a3c82fd3497d2fea540f5_MIT6_837F12_Lec21.pdf |
times
scan conversion
flat shading
scan conversion
gouraud shading
© Khronos Group. All rights reserved. This content is excluded from our Creative
Commons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
15
Ray Casting / Tracing
• Advantages
– Generality: can render anything
that can... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53d96abf747a3c82fd3497d2fea540f5_MIT6_837F12_Lec21.pdf |
update frame buffer color
• Compute per-pixel color
© source unknown. All rights reserved. This content is
excluded from our Creative Commons license. For more
information, see http://ocw.mit.edu/help/faq-fair-use/.
© Khronos Group. All rights reserved. This content is
excluded from our Creative Commons license. For ... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53d96abf747a3c82fd3497d2fea540f5_MIT6_837F12_Lec21.pdf |
)
setup 3 edge equations
for each pixel x,y
if passes all edge equations
compute z
if z<zbuffer[x,y]
zbuffer[x,y]=z
framebuffer[x,y]=shade()
© source unknown. All rights reserved. This content is
excluded from our Creative Commons license. For more
information, see http://ocw.mit.edu/help/faq-fair-use/.
... | https://ocw.mit.edu/courses/6-837-computer-graphics-fall-2012/53d96abf747a3c82fd3497d2fea540f5_MIT6_837F12_Lec21.pdf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.