Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ADerrors.jl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Fabian Joswig
ADerrors.jl
Commits
37235722
Commit
37235722
authored
5 years ago
by
Alberto Ramos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added information on the use of PackageCompiler
parent
e9df23a0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
0 deletions
+98
-0
README.md
README.md
+32
-0
extra/typical.jl
extra/typical.jl
+66
-0
No files found.
README.md
View file @
37235722
...
...
@@ -37,5 +37,37 @@ julia> import Pkg
It is better to start with the
[
Getting started
](
https://ific.uv.es/~alramos/docs/ADerrors/tutorial/
)
guide.
# Alleviating time to first run
`Julia`
is well known for being slow the first time that you run some
routines. On the first call to a function Julia not only runs the
code, but also compiles it, making the first call slow.
This problem can be alleviated in general with
[
PackageCompiler.jl
](
https://github.com/JuliaLang/PackageCompiler.jl
)
. This
is specially true for the case of
`ADerrors`
since most functions are
type static.
As example, the file
`extra/typical.jl`
contains the most typical
calls to
`ADerrors`
. One can execute this file telling julia to
annotate the functions that are compiled
```
julia
julia
--
trace
-
compile
=
precompile_aderrors
.
jl
typical
.
jl
```
Now the functions annotated in
`precompile_aderrors.jl`
can be
compiled and included in a
`sysimage`
that is autmatically loaded
whenever you start Julia
```
julia
julia
>
using
PackageCompiler
julia
>
PackageCompiler
.
create_sysimage
(
:
ADerrors
;
precompile_statements_file
=
"precompile_aderrors.jl"
,
replace_default
=
true
)
```
This will make
`ADerrors`
from the first call. Obviously you can tune
the file
`typical.jl`
to your usage, or add other packages. Please
note that packages included in the sysimage are locked to the versions
of the sysimage. If you update
`ADerrors`
make sure to re-generate the
sysimage. Probably is better to read [the documentation of
PackageCompiler](https://julialang.github.io/PackageCompiler.jl/dev/sysimages/)
in order to fully understand the drawbacks.
This diff is collapsed.
Click to expand it.
extra/typical.jl
0 → 100644
View file @
37235722
using
ADerrors
# Input of uwreal's
a
=
uwreal
(
rand
(
1000
),
1
)
b
=
uwreal
([
1.0
,
0.1
],
2
)
p
=
cobs
([
1.0
,
2.0
],
[
1.0
0.1
;
0.1
2.0
],
[
3
,
4
])
# Most common operations.
# You might add something else if
# you use it frequently
for
op
in
(
:-
,
:
sin
,
:
cos
,
:
log
,
:
log10
,
:
log2
,
:
sqrt
,
:
exp
,
:
exp2
,
:
exp10
,
:
sinh
,
:
cosh
,
:
tanh
)
@eval
c
=
$
op
(
a
)
end
c
=
1.0
+
b
c
=
1.0
-
b
c
=
1.0
*
b
c
=
1.0
/
b
c
=
a
+
2.0
c
=
a
-
2.0
c
=
a
*
2.0
c
=
a
/
2.0
c
=
a
^
3
c
=
a
+
b
c
=
a
-
b
c
=
a
*
b
c
=
a
/
b
# Error analysis
uwerr
(
c
)
cov
([
c
,
a
,
b
])
trcov
([
1.0
2.0
3.0
;
2.0
1.0
0.4
;
3.0
0.4
1.0
],
[
c
,
a
,
b
])
details
(
c
)
# Error analysis of fit parameters
npt
=
12
sig
=
zeros
(
npt
,
npt
)
dx
=
zeros
(
npt
)
for
i
in
1
:
npt
dx
[
i
]
=
0.01
*
i
sig
[
i
,
i
]
=
dx
[
i
]
^
2
for
j
in
i
+
1
:
npt
sig
[
i
,
j
]
=
0.0001
-
0.000005
*
abs
(
i
-
j
)
sig
[
j
,
i
]
=
0.0001
-
0.000005
*
abs
(
i
-
j
)
end
end
y
=
[
0.0802273592699947
0.09150837606934502
0.047923648239388834
0.024851583326401416
0.01635482325054799
0.13115281737744588
0.21013177679604178
0.002143355151617357
0.2292183950698425
-
0.05174734852593241
0.1384913891139784
-
0.05211234898997283
]
dt
=
cobs
(
y
,
sig
,
[
100
+
n
for
n
in
1
:
npt
])
chisq
(
p
,
d
)
=
sum
(
(
d
.-
p
[
1
])
.^
2
./
dx
.^
2
)
xp
=
[
sum
(
value
.
(
dt
)
./
dx
)
/
sum
(
1.0
./
dx
)]
(
fitp
,
csqexp
)
=
fit_error
(
chisq
,
xp
,
dt
)
chiexp
(
chisq
,
xp
,
dt
)
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment