Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
se2aa4_cs2me3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
W. Spencer Smith
se2aa4_cs2me3
Commits
2dd5b391
Commit
2dd5b391
authored
7 years ago
by
W. Spencer Smith
Browse files
Options
Downloads
Patches
Plain Diff
Updates to A2, now includes selection of polynomial order
parent
5a29d461
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Assignments/A2/A2.pdf
+0
-0
0 additions, 0 deletions
Assignments/A2/A2.pdf
Assignments/A2/A2.tex
+23
-21
23 additions, 21 deletions
Assignments/A2/A2.tex
with
23 additions
and
21 deletions
Assignments/A2/A2.pdf
+
0
−
0
View file @
2dd5b391
No preview for this file type
This diff is collapsed.
Click to expand it.
Assignments/A2/A2.tex
+
23
−
21
View file @
2dd5b391
...
...
@@ -279,15 +279,15 @@ Questions - rewrite isInBounds not assuming ascending
\newpage
\section*
{
Curve
Interpolation
ADT Module
}
\section*
{
Curve ADT Module
}
\subsection*
{
Template Module
}
Curve
Interp
ADT
CurveADT
\subsection*
{
Uses
}
SeqServicesModule
for isAscending, interp1d and index
SeqServicesModule
\subsection*
{
Syntax
}
...
...
@@ -297,7 +297,7 @@ MAX\_ORDER = 2
\subsubsection*
{
Exported Types
}
Curve
Interp
T = ?
CurveT = ?
\subsubsection*
{
Exported Access Programs
}
...
...
@@ -305,8 +305,8 @@ CurveInterpT = ?
\hline
\textbf
{
Routine name
}
&
\textbf
{
In
}
&
\textbf
{
Out
}
&
\textbf
{
Exceptions
}
\\
\hline
new Curve
Interp
T
&
$
X:
\mathbb
{
R
}^
n
$
,
$
Y:
\mathbb
{
R
}^
n
$
,
$
i:
\mathbb
{
N
}$
&
Curve
Interp
T
&
IndepVarNotAscending,
\newline
InvalidInterpOrder
\\
new CurveT
&
$
X:
\mathbb
{
R
}^
n
$
,
$
Y:
\mathbb
{
R
}^
n
$
,
$
i:
\mathbb
{
N
}$
&
CurveT
&
IndepVarNotAscending,
\newline
InvalidInterpOrder
\\
\hline
minD
&
~
&
$
\mathbb
{
R
}$
&
~
\\
\hline
...
...
@@ -333,14 +333,15 @@ None
\subsubsection*
{
Assumptions
}
None
The user will not request function evaluations that would cause the
interpolation to select index values outside of where the function is defined.
\subsubsection*
{
Access Routine Semantics
}
\noindent
new Curve
Interp
T(
$
X, Y
$
):
\noindent
new CurveT(
$
X, Y
$
):
\begin{itemize}
\item
transition:
$
\mbox
{
minx
}
,
\mbox
{
maxx
}
, o, f :
=
X
_
0
, X
_{
|X|
-
1
}
, i,
(
\lambda
v:
\mbox
{
interp
}
(
X, Y, v
))
$
\mbox
{
interp
}
(
X, Y,
o,
v
))
$
\item
output:
$
out :
=
\mbox
{
self
}$
\item
exception:
$
(
\neg
\mbox
{
isAscending
}
(
X
)
\Rightarrow
...
...
@@ -373,11 +374,11 @@ None
\subsection*
{
Local Functions
}
interp:
$
\mathbb
{
R
}^
n
\times
\mathbb
{
R
}^
n
\times
\mathbb
{
R
}
\times
\mathbb
{
N
}
interp:
$
\mathbb
{
R
}^
n
\times
\mathbb
{
R
}^
n
\times
\mathbb
{
N
}
\times
\mathbb
{
R
}
\rightarrow
\mathbb
{
R
}$
\\
\noindent
interp(
$
X
$
,
$
Y
$
,
$
v
$
,
$
o
$
)
$$
\equiv
(
o
=
1
\Rightarrow
\mbox
{
interpLin
}
(
X
_
i, Y
_
i,
X
_{
i
+
1
}
, Y
_{
i
+
1
}
, v
)
| o
=
2
\Rightarrow
\mbox
{
interpQuad
}
(
X
_
i, Y
_
i, X
_{
i
+
1
}
,
\noindent
interp(
$
X
$
,
$
Y
$
,
$
o
$
,
$
v
$
)
$$
\equiv
(
o
=
1
\Rightarrow
\mbox
{
interpLin
}
(
X
_
i, Y
_
i,
X
_{
i
+
1
}
, Y
_{
i
+
1
}
, v
)
| o
=
2
\Rightarrow
\mbox
{
interpQuad
}
(
X
_{
i
-
1
}
, Y
_{
i
-
1
}
,
X
_
i, Y
_
i, X
_{
i
+
1
}
,
Y
_{
i
+
1
}
, v
)
)
$$
where
$
i
=
\mbox
{
index
}
(
X, v
)
$
\\
\newpage
...
...
@@ -390,7 +391,7 @@ DataModule
\subsection*
{
Uses
}
Curve
Interp
T, SeqServicesModule for interp
1d
and index
CurveT, SeqServicesModule for interp
Lin
and index
\subsection*
{
Syntax
}
...
...
@@ -406,11 +407,11 @@ MAX\_SIZE = 10
\hline
Data
\_
init
&
~
&
~
&
~
\\
\hline
Data
\_
add
&
c: Curve
Interp
T,
$
z:
\mathbb
{
R
}$
&
~
&
Full, IndepVarNotAscending
\\
Data
\_
add
&
c: CurveT,
$
z:
\mathbb
{
R
}$
&
~
&
Full, IndepVarNotAscending
\\
\hline
eval
&
$
x:
\mathbb
{
R
}
, z:
\mathbb
{
R
}$
&
~
&
~
\\
\hline
slice
&
$
x:
\mathbb
{
R
}$
&
Curve
Interp
T
&
~
\\
slice
&
$
x:
\mathbb
{
R
}$
&
CurveT
&
~
\\
\hline
\end{tabular}
...
...
@@ -419,7 +420,7 @@ slice & $x: \mathbb{R}$ & CurveInterpT & ~\\
\subsubsection*
{
State Variables
}
$
s
$
: sequence of Curve
Interp
T
\\
$
s
$
: sequence of CurveT
\\
$
Z
$
: sequence of
$
\mathbb
{
R
}$
\subsubsection*
{
State Invariant
}
...
...
@@ -448,14 +449,14 @@ Data\_init():
\noindent
Data
\_
eval(
$
x, z
$
):
\begin{itemize}
\item
output:
$
out :
=
\mbox
{
interp
1
d
}
(
z
_
j, s
_
j.
\mbox
{
eval
}
(
x
)
, z
_{
j
+
1
}
,
\item
output:
$
out :
=
\mbox
{
interp
Lin
}
(
z
_
j, s
_
j.
\mbox
{
eval
}
(
x
)
, z
_{
j
+
1
}
,
s
_{
j
+
1
}
.
\mbox
{
eval
}
(
x
)
, z
)
$
, where
$
j
=
\mbox
{
index
}
(
Z, z
)
$
\item
exception:
$
exc :
=
(
\neg
\mbox
{
isInBounds
}
(
Z, z
)
\Rightarrow
\mbox
{
OutOfDomain
}
)
$
\end{itemize}
\noindent
Data
\_
slice(
$
x
$
):
\begin{itemize}
\item
output:
$
out :
=
\mbox
{
Curve
Interp
T
}
(
Z, Y
)
$
, where
\item
output:
$
out :
=
\mbox
{
CurveT
}
(
Z, Y
)
$
, where
$
Y
=
||
(
i:
\mathbb
{
N
}
| i
\in
[
0
.. |Z|
-
1
]
:
\langle
s
_
i.
\mbox
{
eval
}
(
x
)
\rangle
)
$
or
$
Y
=
\mbox
{
map
}
\mbox
{
eval
}
(
x
)
\mbox
{
}
s
$
\textit
{
\#
in both cases
there is an abuse of notation
}
...
...
@@ -490,7 +491,7 @@ isAscending & $x: \mathbb{R}^n$ & $\mathbb{B}$ & ~\\
\hline
isInBounds
&
$
x:
\mathbb
{
R
}^
n,
\mathbb
{
R
}$
&
$
\mathbb
{
B
}$
&
~
\\
\hline
interp
1d
&
$
x
_
1
:
\mathbb
{
R
}
, y
_
1
:
\mathbb
{
R
}
, x
_
2
:
\mathbb
{
R
}
, y
_
2
:
\mathbb
{
R
}
,
interp
Lin
&
$
x
_
1
:
\mathbb
{
R
}
, y
_
1
:
\mathbb
{
R
}
, x
_
2
:
\mathbb
{
R
}
, y
_
2
:
\mathbb
{
R
}
,
x:
\mathbb
{
R
}$
&
$
\mathbb
{
R
}$
&
~
\\
\hline
index
&
$
X:
\mathbb
{
R
}^
n, x:
\mathbb
{
R
}$
&
$
\mathbb
{
N
}$
&
~
\\
...
...
@@ -533,9 +534,10 @@ None, unless noted with a particular access program
\item
exception: none
\end{itemize}
\noindent
interpQuad(
$
x
_
1
, y
_
1
, x
_
2
, y
_
2
, x
$
)
\textit
{
\#
assuming isAscending is True
}
\noindent
interpQuad(
$
x
_
0
, y
_
0
,
x
_
1
, y
_
1
, x
_
2
, y
_
2
, x
$
)
\textit
{
\#
assuming isAscending is True
}
\begin{itemize}
\item
output:
$
out :
=
\frac
{
(
y
_
2
-
y
_
1
)
}{
(
x
_
2
-
x
_
1
)
}
(
x
-
x
_
1
)
+
y
_
1
$
\item
output:
$
out :
=
y
_
1
+
\frac
{
y
_
2
-
y
_
0
}{
x
_
2
-
x
_
0
}
(
x
-
x
_
1
)
+
\frac
{
y
_
2
-
2
y
_
1
+
y
_
0
}{
2
(
x
_
2
-
x
_
1
)
^
2
}
(
x
-
x
_
1
)
^
2
$
\item
exception: none
\end{itemize}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment