Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "cells": [
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "using LinearAlgebra\nusing RowEchelon\nusing BenchmarkTools",
- "execution_count": 1,
- "outputs": []
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "B = Float64[\n 1 2 1 3\n 4 5 1 6\n 7 8 1 9\n 1 2 2 3\n]\nB = Matrix(B')",
- "execution_count": 2,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 2,
- "data": {
- "text/plain": "4×4 Array{Float64,2}:\n 1.0 4.0 7.0 1.0\n 2.0 5.0 8.0 2.0\n 1.0 1.0 1.0 2.0\n 3.0 6.0 9.0 3.0"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "qr(B)",
- "execution_count": 3,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 3,
- "data": {
- "text/plain": "LinearAlgebra.QRCompactWY{Float64,Array{Float64,2}}\nQ factor:\n4×4 LinearAlgebra.QRCompactWYQ{Float64,Array{Float64,2}}:\n -0.258199 0.774597 -0.562294 -0.130991\n -0.516398 0.258199 0.693285 -0.431304\n -0.258199 -0.516398 -0.431304 -0.693285\n -0.774597 -0.258199 -0.130991 0.562294\nR factor:\n4×4 Array{Float64,2}:\n -3.87298 -8.52056 -13.1681 -4.13118 \n 0.0 2.32379 4.64758 -0.516398\n 0.0 0.0 4.17184e-15 -0.431304\n 0.0 0.0 0.0 -0.693285"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "rref(B)",
- "execution_count": 4,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 4,
- "data": {
- "text/plain": "4×4 Array{Float64,2}:\n 1.0 0.0 -1.0 0.0\n 0.0 1.0 2.0 0.0\n 0.0 0.0 0.0 1.0\n 0.0 0.0 0.0 0.0"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark qr(B)",
- "execution_count": 5,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 5,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 656 bytes\n allocs estimate: 4\n --------------\n minimum time: 3.441 μs (0.00% GC)\n median time: 3.791 μs (0.00% GC)\n mean time: 4.592 μs (16.16% GC)\n maximum time: 5.622 ms (99.83% GC)\n --------------\n samples: 10000\n evals/sample: 8"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark rref(B)",
- "execution_count": 6,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 6,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 1.02 KiB\n allocs estimate: 9\n --------------\n minimum time: 468.913 ns (0.00% GC)\n median time: 483.194 ns (0.00% GC)\n mean time: 594.480 ns (12.76% GC)\n maximum time: 233.954 μs (99.62% GC)\n --------------\n samples: 10000\n evals/sample: 196"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "function equilibrium_qr(A::AbstractMatrix)\n @assert size(A, 1) == size(A, 2)\n R = qr(A).R\n n = size(A, 1)\n v = zeros(eltype(A), n)\n a = abs.(diag(R))\n m, k = findmin(a)\n v[k] = 1\n for i in k-1:-1:1\n s = zero(eltype(A))\n for j in i+1:n\n s += R[i,j] * v[j]\n end\n v[i] = -s / R[i,i]\n end\n return v ./ norm(v)\nend",
- "execution_count": 7,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 7,
- "data": {
- "text/plain": "equilibrium_qr (generic function with 1 method)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "function equilibrium_rref(A::AbstractMatrix)\n @assert size(A, 1) == size(A, 2)\n R = rref!(copy(A), size(A,1)*eps(norm(A,Inf)))\n n = size(A, 1)\n v = zeros(eltype(A), n)\n a = abs.(diag(R))\n m, k = findmin(a)\n v[k] = 1\n for i in k-1:-1:1\n s = zero(eltype(A))\n for j in i+1:n\n s += R[i,j] * v[j]\n end\n v[i] = -s / R[i,i]\n end\n return v ./ norm(v)\nend",
- "execution_count": 8,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 8,
- "data": {
- "text/plain": "equilibrium_rref (generic function with 1 method)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@show x = equilibrium_qr(B)\nextrema(B*x)",
- "execution_count": 9,
- "outputs": [
- {
- "output_type": "stream",
- "text": "x = equilibrium_qr(B) = [0.408248, -0.816497, 0.408248, 0.0]\n",
- "name": "stdout"
- },
- {
- "output_type": "execute_result",
- "execution_count": 9,
- "data": {
- "text/plain": "(-6.661338147750939e-16, 1.7763568394002505e-15)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@show y = equilibrium_rref(B)\nextrema(B*y)",
- "execution_count": 10,
- "outputs": [
- {
- "output_type": "stream",
- "text": "y = equilibrium_rref(B) = [0.408248, -0.816497, 0.408248, 0.0]\n",
- "name": "stdout"
- },
- {
- "output_type": "execute_result",
- "execution_count": 10,
- "data": {
- "text/plain": "(0.0, 0.0)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@show z = nullspace(B)\nextrema(B*z)",
- "execution_count": 11,
- "outputs": [
- {
- "output_type": "stream",
- "text": "z = nullspace(B) = [0.408248; -0.816497; 0.408248; 7.77156e-16]\n",
- "name": "stdout"
- },
- {
- "output_type": "execute_result",
- "execution_count": 11,
- "data": {
- "text/plain": "(-1.1102230246251565e-16, 9.992007221626409e-16)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark equilibrium_qr(B)",
- "execution_count": 12,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 12,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 1.28 KiB\n allocs estimate: 9\n --------------\n minimum time: 3.791 μs (0.00% GC)\n median time: 3.966 μs (0.00% GC)\n mean time: 5.706 μs (14.74% GC)\n maximum time: 6.155 ms (99.82% GC)\n --------------\n samples: 10000\n evals/sample: 8"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark equilibrium_rref(B)",
- "execution_count": 13,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 13,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 1.45 KiB\n allocs estimate: 13\n --------------\n minimum time: 663.571 ns (0.00% GC)\n median time: 698.348 ns (0.00% GC)\n mean time: 915.809 ns (12.82% GC)\n maximum time: 298.575 μs (99.68% GC)\n --------------\n samples: 10000\n evals/sample: 161"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark nullspace(B)",
- "execution_count": 14,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 14,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 3.63 KiB\n allocs estimate: 12\n --------------\n minimum time: 6.251 μs (0.00% GC)\n median time: 6.905 μs (0.00% GC)\n mean time: 10.602 μs (16.89% GC)\n maximum time: 11.580 ms (99.86% GC)\n --------------\n samples: 10000\n evals/sample: 5"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "n = 30\n# k = rand(1:n)\nk = n ÷ 2\n@show n, k\nQ = randn(n,n)\ntmp = randn(k-1)\nQ[:,k] = Q[:,1:k-1]*tmp\nsol = [tmp[1:k-1]; -1.0; zeros(n-k)]\nsol = sol/norm(sol)\nextrema(Q*sol)",
- "execution_count": 15,
- "outputs": [
- {
- "output_type": "stream",
- "text": "(n, k) = (30, 15)\n",
- "name": "stdout"
- },
- {
- "output_type": "execute_result",
- "execution_count": 15,
- "data": {
- "text/plain": "(-4.440892098500626e-16, 4.440892098500626e-16)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "a = equilibrium_qr(Q)\nextrema(Q*a)",
- "execution_count": 16,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 16,
- "data": {
- "text/plain": "(-4.996003610813204e-16, 5.551115123125783e-16)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "b = equilibrium_rref(Q)\nextrema(Q*b)",
- "execution_count": 17,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 17,
- "data": {
- "text/plain": "(-4.440892098500626e-16, 8.881784197001252e-16)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "c = nullspace(Q)\nextrema(Q*c)",
- "execution_count": 18,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 18,
- "data": {
- "text/plain": "(-2.220446049250313e-15, 1.3877787807814457e-15)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark equilibrium_qr(Q)",
- "execution_count": 19,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 19,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 30.09 KiB\n allocs estimate: 9\n --------------\n minimum time: 296.714 μs (0.00% GC)\n median time: 356.897 μs (0.00% GC)\n mean time: 380.742 μs (2.94% GC)\n maximum time: 70.192 ms (98.22% GC)\n --------------\n samples: 10000\n evals/sample: 1"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark equilibrium_rref(Q)",
- "execution_count": 20,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 20,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 20.97 KiB\n allocs estimate: 65\n --------------\n minimum time: 20.060 μs (0.00% GC)\n median time: 22.393 μs (0.00% GC)\n mean time: 31.517 μs (22.87% GC)\n maximum time: 48.760 ms (99.89% GC)\n --------------\n samples: 10000\n evals/sample: 1"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true,
- "scrolled": false
- },
- "cell_type": "code",
- "source": "@benchmark nullspace(Q)",
- "execution_count": 21,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 21,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 47.52 KiB\n allocs estimate: 12\n --------------\n minimum time: 293.916 μs (0.00% GC)\n median time: 322.841 μs (0.00% GC)\n mean time: 379.750 μs (3.03% GC)\n maximum time: 52.384 ms (99.23% GC)\n --------------\n samples: 10000\n evals/sample: 1"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "n = 100\n# k = rand(1:n)\nk = n ÷ 2\n@show n, k\nQ = randn(n,n)\ntmp = randn(k-1)\nQ[:,k] = Q[:,1:k-1]*tmp\nsol = [tmp[1:k-1]; -1.0; zeros(n-k)]\nsol = sol/norm(sol)\nextrema(Q*sol)",
- "execution_count": 22,
- "outputs": [
- {
- "output_type": "stream",
- "text": "(n, k) = (100, 50)\n",
- "name": "stdout"
- },
- {
- "output_type": "execute_result",
- "execution_count": 22,
- "data": {
- "text/plain": "(-6.661338147750939e-16, 6.661338147750939e-16)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "a = equilibrium_qr(Q)\nextrema(Q*a)",
- "execution_count": 23,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 23,
- "data": {
- "text/plain": "(-1.3322676295501878e-15, 1.5543122344752192e-15)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "b = equilibrium_rref(Q)\nextrema(Q*b)",
- "execution_count": 24,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 24,
- "data": {
- "text/plain": "(-5.10702591327572e-15, 5.10702591327572e-15)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "c = nullspace(Q)\nextrema(Q*c)",
- "execution_count": 25,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 25,
- "data": {
- "text/plain": "(-2.6645352591003757e-15, 2.886579864025407e-15)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark equilibrium_qr(Q)",
- "execution_count": 26,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 26,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 216.34 KiB\n allocs estimate: 13\n --------------\n minimum time: 2.656 ms (0.00% GC)\n median time: 2.949 ms (0.00% GC)\n mean time: 3.127 ms (1.87% GC)\n maximum time: 60.029 ms (94.73% GC)\n --------------\n samples: 1595\n evals/sample: 1"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark equilibrium_rref(Q)",
- "execution_count": 27,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 27,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 180.61 KiB\n allocs estimate: 206\n --------------\n minimum time: 513.186 μs (0.00% GC)\n median time: 542.111 μs (0.00% GC)\n mean time: 591.065 μs (2.37% GC)\n maximum time: 49.252 ms (98.73% GC)\n --------------\n samples: 8424\n evals/sample: 1"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true,
- "scrolled": false
- },
- "cell_type": "code",
- "source": "@benchmark nullspace(Q)",
- "execution_count": 28,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 28,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 483.72 KiB\n allocs estimate: 15\n --------------\n minimum time: 5.191 ms (0.00% GC)\n median time: 6.131 ms (0.00% GC)\n mean time: 6.439 ms (1.84% GC)\n maximum time: 62.886 ms (89.39% GC)\n --------------\n samples: 775\n evals/sample: 1"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "n = 300\n# k = rand(1:n)\nk = n ÷ 2\n@show n, k\nQ = randn(n,n)\ntmp = randn(k-1)\nQ[:,k] = Q[:,1:k-1]*tmp\nsol = [tmp[1:k-1]; -1.0; zeros(n-k)]\nsol = sol/norm(sol)\nextrema(Q*sol)",
- "execution_count": 29,
- "outputs": [
- {
- "output_type": "stream",
- "text": "(n, k) = (300, 150)\n",
- "name": "stdout"
- },
- {
- "output_type": "execute_result",
- "execution_count": 29,
- "data": {
- "text/plain": "(-2.4424906541753444e-15, 1.3322676295501878e-15)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "a = equilibrium_qr(Q)\nextrema(Q*a)",
- "execution_count": 30,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 30,
- "data": {
- "text/plain": "(-1.7763568394002505e-15, 2.220446049250313e-15)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "b = equilibrium_rref(Q)\nextrema(Q*b)",
- "execution_count": 31,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 31,
- "data": {
- "text/plain": "(-1.2434497875801753e-14, 1.84297022087776e-14)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "c = nullspace(Q)\nextrema(Q*c)",
- "execution_count": 32,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 32,
- "data": {
- "text/plain": "(-5.094685062006425e-15, 4.831242609835234e-15)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark equilibrium_qr(Q)",
- "execution_count": 33,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 33,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 1.55 MiB\n allocs estimate: 13\n --------------\n minimum time: 11.598 ms (0.00% GC)\n median time: 12.640 ms (0.00% GC)\n mean time: 13.028 ms (2.26% GC)\n maximum time: 75.597 ms (82.57% GC)\n --------------\n samples: 384\n evals/sample: 1"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark equilibrium_rref(Q)",
- "execution_count": 34,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 34,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 1.46 MiB\n allocs estimate: 606\n --------------\n minimum time: 16.774 ms (0.00% GC)\n median time: 17.592 ms (0.00% GC)\n mean time: 20.066 ms (1.57% GC)\n maximum time: 72.141 ms (72.59% GC)\n --------------\n samples: 249\n evals/sample: 1"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true,
- "scrolled": true
- },
- "cell_type": "code",
- "source": "@benchmark nullspace(Q)",
- "execution_count": 35,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 35,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 4.16 MiB\n allocs estimate: 16\n --------------\n minimum time: 53.393 ms (0.00% GC)\n median time: 57.721 ms (0.00% GC)\n mean time: 58.873 ms (1.84% GC)\n maximum time: 110.145 ms (49.05% GC)\n --------------\n samples: 85\n evals/sample: 1"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "n = 1000\n# k = rand(1:n)\nk = n ÷ 2\n@show n, k\nQ = randn(n,n)\ntmp = randn(k-1)\nQ[:,k] = Q[:,1:k-1]*tmp\nsol = [tmp[1:k-1]; -1.0; zeros(n-k)]\nsol = sol/norm(sol)\nextrema(Q*sol)",
- "execution_count": 36,
- "outputs": [
- {
- "output_type": "stream",
- "text": "(n, k) = (1000, 500)\n",
- "name": "stdout"
- },
- {
- "output_type": "execute_result",
- "execution_count": 36,
- "data": {
- "text/plain": "(-2.220446049250313e-15, 2.220446049250313e-15)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "a = equilibrium_qr(Q)\nextrema(Q*a)",
- "execution_count": 37,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 37,
- "data": {
- "text/plain": "(-2.6645352591003757e-15, 3.1086244689504383e-15)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "b = equilibrium_rref(Q)\nextrema(Q*b)",
- "execution_count": 38,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 38,
- "data": {
- "text/plain": "(-1.1246559239452836e-13, 7.638334409421077e-14)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "c = nullspace(Q)\nextrema(Q*c)",
- "execution_count": 39,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 39,
- "data": {
- "text/plain": "(-6.573094430595726e-15, 3.076616599214022e-14)"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark equilibrium_qr(Q)",
- "execution_count": 40,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 40,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 15.84 MiB\n allocs estimate: 13\n --------------\n minimum time: 89.966 ms (0.00% GC)\n median time: 98.310 ms (2.00% GC)\n mean time: 102.481 ms (2.73% GC)\n maximum time: 177.349 ms (29.93% GC)\n --------------\n samples: 50\n evals/sample: 1"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark equilibrium_rref(Q)",
- "execution_count": 41,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 41,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 15.59 MiB\n allocs estimate: 2006\n --------------\n minimum time: 5.239 s (0.00% GC)\n median time: 5.239 s (0.00% GC)\n mean time: 5.239 s (0.00% GC)\n maximum time: 5.239 s (0.00% GC)\n --------------\n samples: 1\n evals/sample: 1"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "@benchmark nullspace(Q)",
- "execution_count": 42,
- "outputs": [
- {
- "output_type": "execute_result",
- "execution_count": 42,
- "data": {
- "text/plain": "BenchmarkTools.Trial: \n memory estimate: 45.91 MiB\n allocs estimate: 16\n --------------\n minimum time: 872.940 ms (0.46% GC)\n median time: 914.451 ms (0.83% GC)\n mean time: 918.522 ms (2.72% GC)\n maximum time: 984.217 ms (7.14% GC)\n --------------\n samples: 6\n evals/sample: 1"
- },
- "metadata": {}
- }
- ]
- },
- {
- "metadata": {
- "trusted": true
- },
- "cell_type": "code",
- "source": "",
- "execution_count": null,
- "outputs": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "name": "julia-1.1",
- "display_name": "Julia 1.1.1",
- "language": "julia"
- },
- "toc": {
- "nav_menu": {},
- "number_sections": true,
- "sideBar": true,
- "skip_h1_title": false,
- "base_numbering": 1,
- "title_cell": "Table of Contents",
- "title_sidebar": "Contents",
- "toc_cell": false,
- "toc_position": {},
- "toc_section_display": true,
- "toc_window_display": false
- },
- "language_info": {
- "file_extension": ".jl",
- "name": "julia",
- "mimetype": "application/julia",
- "version": "1.1.1"
- },
- "@webio": {
- "lastKernelId": null,
- "lastCommId": null
- },
- "gist": {
- "id": "",
- "data": {
- "description": "QR vs. RREF",
- "public": true
- }
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement