{ "cells": [ { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "ename": "LoadError", "evalue": "LoadError: invalid redefinition of constant cpu_tensor\nin expression starting at c:\\Users\\yapan\\DVR.jl\\HOperator.jl:4", "output_type": "error", "traceback": [ "LoadError: invalid redefinition of constant cpu_tensor\n", "in expression starting at c:\\Users\\yapan\\DVR.jl\\HOperator.jl:4\n", "\n", "Stacktrace:\n", " [1] top-level scope\n", " @ Enums.jl:204" ] } ], "source": [ "# prerequisite packages: KrylovKit, TensorOperations, LinearAlgebra, CUDA#tb/cutensor, Plots\n", "include(\"HOperator.jl\")\n", "mode = cpu_tensor # using CPU mode\n", "T = Float32 # single-precision mode" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 4.377701 seconds (5.09 M allocations: 764.743 MiB, 6.09% gc time, 71.04% compilation time: 99% of which was recompilation)\n", "114 operations : ComplexF32[-7.6208663f0 + 0.0f0im, -3.551723f0 + 0.0f0im, -3.5371912f0 + 0.0f0im, -3.5240355f0 + 0.0f0im, -3.5159583f0 + 0.0f0im, -3.4865863f0 + 0.0f0im, -3.1896422f0 + 0.0f0im, -2.9661055f0 + 0.0f0im]\n" ] } ], "source": [ "V_gauss(r2) =\n", " -4 * exp(-r2 / 4)\n", "\n", "d = 3\n", "n = 3\n", "N = 6\n", "L::T = 12\n", "ϕ::T = 0.0\n", "μ::T = 0.5\n", "n_imag = 1\n", "\n", "H = HOperator{T}(V_gauss, d, n, N, L, ϕ, μ, n_imag, mode)\n", "@time evals, evecs, info = eig(H, 5)\n", "print(info.numops, \" operations : \")\n", "println(evals)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "using Plots\n", "\n", "V_gauss(r2) =\n", " -4 * exp(-r2 / 4)\n", "\n", "d = 3\n", "n = 2\n", "N = 32\n", "L::T = 16\n", "ϕ::T = 0.5\n", "μ::T = 0.5\n", "n_imag = 0\n", "\n", "H = HOperator{T}(V_gauss, d, n, N, L, ϕ, μ, n_imag, mode)\n", "@time evals, evecs, info = eig(H, 20)\n", "print(info.numops, \" operations : \")\n", "print(evals)\n", "\n", "scatter(real.(evals), imag.(evals); legend=false)\n", "xlabel!(\"Re E\")\n", "ylabel!(\"Im E\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.8.5", "language": "julia", "name": "julia-1.8" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.8.5" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }