{ "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, "id": "afd34800-7b9a-4006-9849-071fa197d962", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "x = [5.810770900369532e-16, 0.4999999999999994]\n" ] }, { "data": { "text/plain": [ "3-element Vector{Float64}:\n", " 0.9999999999999993\n", " 1.9999999999999993\n", " 2.999999999999999" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "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" ] }, { "cell_type": "code", "execution_count": 3, "id": "8b3d71f8-2f4f-44f0-8c97-dd9d78706163", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2-element Vector{Float64}:\n", " -1.5012955407352218e-16\n", " 0.5000000000000001" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "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" ] } ], "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 }