Files
cmdla/project/testing.ipynb

117 lines
2.2 KiB
Plaintext
Raw Normal View History

2023-11-12 18:21:13 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "57a2b335-a7f3-4ace-a2d8-52219c4febc5",
"metadata": {},
"outputs": [],
"source": [
"include(\"thinQR.jl\")\n",
"using .thinQR"
]
},
{
"cell_type": "code",
"execution_count": 2,
2023-11-12 21:16:54 +01:00
"id": "afd34800-7b9a-4006-9849-071fa197d962",
2023-11-12 18:21:13 +01:00
"metadata": {},
"outputs": [
2023-11-12 21:16:54 +01:00
{
"name": "stdout",
"output_type": "stream",
"text": [
"x = [5.810770900369532e-16, 0.4999999999999994]\n"
]
},
2023-11-12 18:21:13 +01:00
{
"data": {
"text/plain": [
"3-element Vector{Float64}:\n",
2023-11-12 21:16:54 +01:00
" 0.9999999999999993\n",
" 1.9999999999999993\n",
" 2.999999999999999"
2023-11-12 18:21:13 +01:00
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2023-11-12 21:16:54 +01:00
"using LinearAlgebra: \\, qr\n",
"A = [1. 2.; 3. 4.; 5. 6.]\n",
"(Q, R) = qr(A)\n",
"x = A \\ [1., 2, 3]\n",
"@show x\n",
"A * x"
2023-11-12 18:21:13 +01:00
]
},
{
"cell_type": "code",
"execution_count": 3,
2023-11-12 21:16:54 +01:00
"id": "8b3d71f8-2f4f-44f0-8c97-dd9d78706163",
2023-11-12 18:21:13 +01:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
2023-11-12 21:16:54 +01:00
"2-element Vector{Float64}:\n",
" -1.5012955407352218e-16\n",
" 0.5000000000000001"
2023-11-12 18:21:13 +01:00
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2023-11-12 21:16:54 +01:00
"A = [1. 2; 3. 4.; 5. 6.]\n",
"A = qrhous!(A)\n",
"b = [1., 2, 3]\n",
"x = A \\ b"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "1883485c-b026-4a8a-8c34-b7c74ad79868",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3-element Vector{Float64}:\n",
" 0.9999999999999991\n",
" 1.9999999999999996\n",
" 2.9999999999999996"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"A * x"
2023-11-12 18:21:13 +01:00
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.9.3",
"language": "julia",
"name": "julia-1.9"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.9.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}