mirror of
https://github.com/fverdugo/XM_40017.git
synced 2025-11-09 00:34:24 +01:00
Update solutions notebook
This commit is contained in:
parent
ebdeef8893
commit
b55aef53a7
@ -758,7 +758,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.9.0",
|
||||
"display_name": "Julia 1.9.1",
|
||||
"language": "julia",
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
@ -766,7 +766,7 @@
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.9.0"
|
||||
"version": "1.9.1"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
@ -1589,7 +1589,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.9.0",
|
||||
"display_name": "Julia 1.9.1",
|
||||
"language": "julia",
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
@ -1597,7 +1597,7 @@
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.9.0"
|
||||
"version": "1.9.1"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
@ -1295,19 +1295,11 @@
|
||||
"\n",
|
||||
"We have seen the basics of distributed computing in Julia. The programming model is essentially an extension of tasks and channels to parallel computations on multiple machines. The low-level functions are `remotecall` and `RemoteChannel`, but there are other functions and macros like `pmap` and `@distributed` that simplify the implementation of parallel algorithms."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "49d094e4",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.9.0",
|
||||
"display_name": "Julia 1.9.1",
|
||||
"language": "julia",
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
@ -1315,7 +1307,7 @@
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.9.0"
|
||||
"version": "1.9.1"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
@ -1108,14 +1108,6 @@
|
||||
"println(\"Optimal speedup = \", P)\n",
|
||||
"println(\"Efficiency = \", 100*(T1/TP)/P, \"%\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "cd31d955",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@ -1,13 +1,90 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f48b9a60",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Solutions to Notebook Exercises\n",
|
||||
"\n",
|
||||
"## Julia Basics: Exercise 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a06fd02a",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"function ex1(a)\n",
|
||||
" j = 1\n",
|
||||
" m = a[j]\n",
|
||||
" for (i,ai) in enumerate(a)\n",
|
||||
" if m < ai\n",
|
||||
" m = ai\n",
|
||||
" j = i\n",
|
||||
" end\n",
|
||||
" end\n",
|
||||
" (m,j)\n",
|
||||
"end"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "175b6c35",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Julia Basics: Exercise 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "bb289acd",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"ex2(f,g) = x -> f(x) + g(x) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "86250e27",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Julia Basics: Exercise 3"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "41b537ab",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"function compute_values(n,max_iters)\n",
|
||||
" x = LinRange(-1.7,0.7,n)\n",
|
||||
" y = LinRange(-1.2,1.2,n)\n",
|
||||
" values = zeros(Int,n,n)\n",
|
||||
" for j in 1:n\n",
|
||||
" for i in 1:n\n",
|
||||
" values[i,j] = mandel(x[i],y[j],max_iters)\n",
|
||||
" end\n",
|
||||
" end\n",
|
||||
" values\n",
|
||||
"end\n",
|
||||
"values = compute_values(1000,10)\n",
|
||||
"using GLMakie\n",
|
||||
"heatmap(x,y,values)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d6d12733",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Solutions to Notebook Exercises\n",
|
||||
"\n",
|
||||
"## Matrix Multiplication : Implementation of Algorithm 3"
|
||||
"## Matrix Multiplication : Exercise 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user