Commit ddb20d68 authored by Alessandro 's avatar Alessandro

Updated juobs_linalg documentation with examples

parent cc5a4523
......@@ -208,10 +208,6 @@ $(document).ready(function() {
$('#documenter-themepicker option').each(function(i,e) {
e.selected = (e.value === theme);
})
} else {
$('#documenter-themepicker option').each(function(i,e) {
e.selected = $("html").hasClass(`theme--${e.value}`);
})
}
}
})
......
......@@ -181,7 +181,7 @@ $(document).ready(function() {
var store = {}
documenterSearchIndex['docs'].forEach(function(e) {
store[e.location] = {title: e.title, category: e.category, page: e.page}
store[e.location] = {title: e.title, category: e.category}
})
$(function(){
......@@ -221,11 +221,7 @@ $(document).ready(function() {
data = store[result.ref]
link = $('<a class="docs-label">'+data.title+'</a>')
link.attr('href', documenterBaseURL+'/'+result.ref)
if (data.category != "page"){
cat = $('<span class="docs-category">('+data.category+', '+data.page+')</span>')
} else {
cat = $('<span class="docs-category">('+data.category+')</span>')
}
cat = $('<span class="docs-category">('+data.category+')</span>')
li = $('<li>').append(link).append(" ").append(cat)
searchresults.append(li)
})
......
// Small function to quickly swap out themes. Gets put into the <head> tag..
function set_theme_from_local_storage() {
// Intialize the theme to null, which means default
var theme = null;
// If the browser supports the localstorage and is not disabled then try to get the
// documenter theme
if(window.localStorage != null) {
// Get the user-picked theme from localStorage. May be `null`, which means the default
// theme.
theme = window.localStorage.getItem("documenter-theme");
}
// Check if the browser supports user color preference
var darkPreference = false;
// Check if the users preference is for dark color scheme
if(window.matchMedia('(prefers-color-scheme: dark)').matches === true) {
darkPreference = true;
}
// Browser does not support Web Storage, bail early.
if(typeof(window.localStorage) === "undefined") return;
// Get the user-picked theme from localStorage. May be `null`, which means the default
// theme.
var theme = window.localStorage.getItem("documenter-theme");
// Initialize a few variables for the loop:
//
// - active: will contain the index of the theme that should be active. Note that there
......@@ -24,7 +14,7 @@ function set_theme_from_local_storage() {
//
// - disabled: style sheets that should be disabled (i.e. all the theme style sheets
// that are not the currently active theme)
var active = null; var disabled = []; var darkTheme = null;
var active = null; var disabled = [];
for (var i = 0; i < document.styleSheets.length; i++) {
var ss = document.styleSheets[i];
// The <link> tag of each style sheet is expected to have a data-theme-name attribute
......@@ -35,12 +25,8 @@ function set_theme_from_local_storage() {
// To distinguish the default (primary) theme, it needs to have the data-theme-primary
// attribute set.
var isprimary = (ss.ownerNode.getAttribute("data-theme-primary") !== null);
// Check if the theme is primary dark theme
var isDarkTheme = (ss.ownerNode.getAttribute("data-theme-primary-dark") !== null);
// If ss is for dark theme then set the value of darkTheme to the name of the theme
if(isDarkTheme) darkTheme = themename;
// If we find a matching theme (and it's not the default), we'll set active to non-null
if(themename === theme) active = i;
if(!isprimary && themename === theme) active = i;
// Store the style sheets of inactive themes so that we could disable them
if(themename !== theme) disabled.push(ss);
}
......@@ -52,15 +38,5 @@ function set_theme_from_local_storage() {
ss.disabled = true;
});
}
else if(darkTheme !== null && darkPreference === true) {
// If we did find an active theme, we'll (1) add the theme--$(theme) class to <html>
document.getElementsByTagName('html')[0].className = "theme--" + darkTheme;
// and (2) disable all the other theme stylesheets
disabled.forEach(function(ss){
if (ss.ownerNode.getAttribute("data-theme-name") !== darkTheme) {
ss.disabled = true;
}
});
}
}
set_theme_from_local_storage();
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Home · juobs Documentation</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit">juobs Documentation</span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li class="is-active"><a class="tocitem" href="index.html">Home</a><ul class="internal"><li><a class="tocitem" href="#Contents"><span>Contents</span></a></li></ul></li><li><a class="tocitem" href="reader.html">Reader</a></li><li><a class="tocitem" href="tools.html">Tools</a></li><li><a class="tocitem" href="obs.html">Observables</a></li><li><a class="tocitem" href="linalg.html">Linear Algebra</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="index.html">Home</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="index.html">Home</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://gitlab.ift.uam-csic.es/jugarrio/juobs" title="Edit on GitLab"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitLab</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="DOCUMENTATION"><a class="docs-heading-anchor" href="#DOCUMENTATION">DOCUMENTATION</a><a id="DOCUMENTATION-1"></a><a class="docs-heading-anchor-permalink" href="#DOCUMENTATION" title="Permalink"></a></h1><h2 id="Contents"><a class="docs-heading-anchor" href="#Contents">Contents</a><a id="Contents-1"></a><a class="docs-heading-anchor-permalink" href="#Contents" title="Permalink"></a></h2><ul><li><a href="reader.html#Reader">Reader</a></li><li><a href="tools.html#Tools">Tools</a></li><li><a href="obs.html#Observables">Observables</a></li><li><a href="linalg.html#Linear-Algebra">Linear Algebra</a></li></ul></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="reader.html">Reader »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Wednesday 24 February 2021 11:46">Wednesday 24 February 2021</span>. Using Julia version 1.5.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Home · juobs Documentation</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit">juobs Documentation</span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li class="is-active"><a class="tocitem" href="index.html">Home</a><ul class="internal"><li><a class="tocitem" href="#Contents"><span>Contents</span></a></li></ul></li><li><a class="tocitem" href="reader.html">Reader</a></li><li><a class="tocitem" href="tools.html">Tools</a></li><li><a class="tocitem" href="obs.html">Observables</a></li><li><a class="tocitem" href="linalg.html">Linear Algebra</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="index.html">Home</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="index.html">Home</a></li></ul></nav><div class="docs-right"><a class="docs-edit-link" href="https://gitlab.ift.uam-csic.es/jugarrio/juobs" title="Edit on GitLab"><span class="docs-icon fab"></span><span class="docs-label is-hidden-touch">Edit on GitLab</span></a><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article class="content" id="documenter-page"><h1 id="DOCUMENTATION"><a class="docs-heading-anchor" href="#DOCUMENTATION">DOCUMENTATION</a><a id="DOCUMENTATION-1"></a><a class="docs-heading-anchor-permalink" href="#DOCUMENTATION" title="Permalink"></a></h1><h2 id="Contents"><a class="docs-heading-anchor" href="#Contents">Contents</a><a id="Contents-1"></a><a class="docs-heading-anchor-permalink" href="#Contents" title="Permalink"></a></h2><ul><li><a href="reader.html#Reader">Reader</a></li><li><a href="tools.html#Tools">Tools</a></li><li><a href="obs.html#Observables">Observables</a></li><li><a href="linalg.html#Linear-Algebra">Linear Algebra</a></li></ul></article><nav class="docs-footer"><a class="docs-footer-nextpage" href="reader.html">Reader »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Friday 26 February 2021 09:53">Friday 26 February 2021</span>. Using Julia version 1.4.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · juobs Documentation</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit">juobs Documentation</span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Home</a></li><li><a class="tocitem" href="reader.html">Reader</a></li><li><a class="tocitem" href="tools.html">Tools</a></li><li><a class="tocitem" href="obs.html">Observables</a></li><li><a class="tocitem" href="linalg.html">Linear Algebra</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="search.html">Search</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="search.html">Search</a></li></ul></nav><div class="docs-right"><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article><p id="documenter-search-info">Loading search...</p><ul id="documenter-search-results"></ul></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Wednesday 24 February 2021 11:46">Wednesday 24 February 2021</span>. Using Julia version 1.5.0.</p></section><footer class="modal-card-foot"></footer></div></div></div></body><script src="search_index.js"></script><script src="assets/search.js"></script></html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Search · juobs Documentation</title><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-dark.css" data-theme-name="documenter-dark"/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit">juobs Documentation</span></div><form class="docs-search" action="search.html"><input class="docs-search-query" id="documenter-search-query" name="q" type="text" placeholder="Search docs"/></form><ul class="docs-menu"><li><a class="tocitem" href="index.html">Home</a></li><li><a class="tocitem" href="reader.html">Reader</a></li><li><a class="tocitem" href="tools.html">Tools</a></li><li><a class="tocitem" href="obs.html">Observables</a></li><li><a class="tocitem" href="linalg.html">Linear Algebra</a></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href="search.html">Search</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href="search.html">Search</a></li></ul></nav><div class="docs-right"><a class="docs-settings-button fas fa-cog" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-sidebar-button fa fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a></div></header><article><p id="documenter-search-info">Loading search...</p><ul id="documenter-search-results"></ul></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> on <span class="colophon-date" title="Friday 26 February 2021 09:53">Friday 26 February 2021</span>. Using Julia version 1.4.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body><script src="search_index.js"></script><script src="assets/search.js"></script></html>
This diff is collapsed.
This diff is collapsed.
......@@ -13,45 +13,46 @@ end
=#
@doc raw"""
get_matrix(corr_diag::Vector{Array}, corr_upper::Vector{Array} )
get_matrix(diag::Vector{Array}, upper::Vector{Array} )
This method returns an array of dim `T` where each element is a symmetrix matrix of dimension n of `uwreal` correlators
at fixed time i=1..T. It takes as input:
`corr_diag`: vector of dimension n of correlators liying on the diagonal
This function allows the user to build an array of matrices, where each matrix is a symmetric matrix of correlators at a given timeslice.
It takes as input:
`corr_upper`: vector of correlators liying on the upper diagonal.
- `diag::Vector{Array}`: vector of correlators. Each correlator will constitute a diagonal element of the matrices A[i] where i runs over the timeslices, i.e.
`A[i][1,1] = diag[1], .... A[i][n,n] = diag[n]`
`Given n=length(diag)`, the matrices will have dimension n*n
- `upper::Vector{Array}`: vector of correlators liying on the upper diagonal position.
`A[i][1,2] = upper[1], .. , A[i][1,n] = upper[n-1], `
`A[i][2,3] = upper[n], .. , A[i][n-1,n] = upper[n(n-1)/2]`
Given n, `length(upper)=n(n-1)/2`
The method returns an array of symmetric matrices of dimension n for each timeslice
Each correlator is an vector of uwreal variables of dimension `T`.
Example:
```@example
for i in 1:n
a[i,i] = Vector{uwreal} # vector of uwreal variables of dimension T. They will constitute the diagonal elements of the matrices
for i in 1:n-1
for j in i+1:n
a[i,j] = Vector{uwreal} # vector of uwreal variables of dimension T. They will constitute the upper diagonal elements of the matrices. A matrix
of dimension n*n has n(n-1)/2 upper diagonal elements.
Assume n=4
diagonal = Vector{Array}()
push!(diagonal, a[1,1],a[2,2],a[3,3],a[4,4])
upsize = Vector{Array}()
push!(upsize, a[1,2], a[1,3], a[1,4], a[2,3], a[2,4], a[3,4])
array_of_matrices = get_matrix(diagonal, upsize)
Examples:
```@example
## load data
pp_data = read_mesons(path, "G5", "G5")
pa_data = read_mesons(path, "G5", "G0G5")
aa_data = read_mesons(path, "G0G5", "G0G5")
Julia> T-element Array{Array,1}
## create Corr struct
corr_pp = corr_obs.(pp_data)
corr_pa = corr_obs.(pa_data)
corr_aa = corr_obs.(aa_data) # array of correlators for different \mu_q combinations
size(array_of_matrices)
## set up matrices
corr_diag = [corr_pp[1], corr_aa[1]]
corr_upper = [corr_pa[1]]
Julia> (T,)
matrices = [corr_diag, corr_upper]
array_of_matrices[t] # t in 1:T
Julia> matrices[i]
pp[i] ap[i]
pa[i] aa[i]
Julia> 4*4 Array{uwreal,2}
## where i runs over the timeslices
```
"""
function get_matrix(corr_diag::Vector{Vector{uwreal}}, corr_upper::Vector{Vector{uwreal}})
......@@ -79,12 +80,41 @@ function get_matrix(corr_diag::Vector{Vector{uwreal}}, corr_upper::Vector{Vector
return res
end
get_matrix(corr_diag::Vector{Corr}, corr_upper::Vector{Corr}) = get_matrix(getfield.(corr_diag, :obs), getfield.(corr_upper, :obs))
@doc raw"""
energies(evals::Vector{Array})
energies(evals::Vector{Array}; wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing)
This method computes the energy level from the eigenvalues according to:
``E_i(t) = \log(λ(t) / λ(t+1))``
Given a vector where each entry `evals[t]` is a `uwreal` array of eigenvalues, this method computes the effective energies of the first N states, where ```N=dim(evals[t])```.
The index `t` here runs from 1:T=lenght(evals), while the index `i` stands for the number of energy levels computed: i = length(evals[t])
It returns a vector array `eff_en` where each entry `eff_en[t]` contains the first N states energies as uwreal objects
where `i=1,..,n` with `n=length(evals[1])` and `t=1,..,T` total time slices.
It returns a vector array en where each entry en[i][t] contains the i-th states energy at time t
Examples:
```@example
## load data
pp_data = read_mesons(path, "G5", "G5")
pa_data = read_mesons(path, "G5", "G0G5")
aa_data = read_mesons(path, "G0G5", "G0G5")
## create Corr struct
corr_pp = corr_obs.(pp_data)
corr_pa = corr_obs.(pa_data)
corr_aa = corr_obs.(aa_data) # array of correlators for different \mu_q combinations
## set up matrices
corr_diag = [corr_pp[1], corr_aa[1]]
corr_upper = [corr_pa[1]]
matrices = [corr_diag, corr_upper]
## solve the GEVP
evals = getall_eigvals(matrices, 5) #where t_0=5
en = energies(evals)
Julia> en[i] # i-th state energy at each timeslice
```
"""
function energies(evals::Union{Vector{Vector{uwreal}},Array{Array{uwreal}} }; wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing)
time = length(evals)
......@@ -108,7 +138,7 @@ end
This function solves a GEVP problem, returning the eigenvalues, for a list of matrices, taking as generalised matrix the one
at index t0, i.e:
``C(t_i)v_i = λ_i C(t_0) v_i``, with i=1:lenght(a)
``C(t_i)v_i = λ_i C(t_0) v_i``, with i=1:lenght(a)
It takes as input:
......@@ -125,9 +155,28 @@ It returns:
where `res[i]` are the generalised eigenvalues of the i-th matrix of the input array.
Examples:
```@example
mat_array = get_matrix(diag, upper_diag)
evals = getall_eigvals(mat_array, 5)
```@example
## load data
pp_data = read_mesons(path, "G5", "G5")
pa_data = read_mesons(path, "G5", "G0G5")
aa_data = read_mesons(path, "G0G5", "G0G5")
## create Corr struct
corr_pp = corr_obs.(pp_data)
corr_pa = corr_obs.(pa_data)
corr_aa = corr_obs.(aa_data) # array of correlators for different \mu_q combinations
## set up matrices
corr_diag = [corr_pp[1], corr_aa[1]]
corr_upper = [corr_pa[1]]
matrices = [corr_diag, corr_upper]
## solve the GEVP
evals = getall_eigvals(matrices, 5) #where t_0=5
Julia>
```
"""
function getall_eigvals(a::Vector{Matrix}, t0::Int64; iter=30 )
......@@ -150,9 +199,19 @@ It takes as input:
- `b::Matrix{uwreal}` : a matrix of uwreal, optional
- `iter=30`: optional flag to set the iterations of the qr algorithm used to solve the eigenvalue problem
It returns:
- `res = Vector{uwreal}`: a vector where each elements is an eigenvalue
```@example
a = Matrix{uwreal}(nothing, n,n) ## n*n matrix of uwreal with nothing entries
b = Matrix{uwreal}(nothing, n,n) ## n*n matrix of uwreal with nothing entries
res = uweigvals(a) ##eigenvalues
res1 = uweigvals(a,b) ## generalised eigenvalues
```
"""
function uweigvals(a::Matrix{uwreal}; iter = 30)
n = size(a,1)
......@@ -176,7 +235,7 @@ end
This function solves a GEVP problem, returning the eigenvectors, for a list of matrices.
``C(t_i)v_i = λ_i C(t_i-\delta_t) v_i``, with i=1:lenght(a)
``C(t_i)v_i = λ_i C(t_i-\delta_t) v_i ``, with i=1:lenght(a)
Here `delta_t` is the time shift within the two matrices of the problem, and is kept fixed.
It takes as input:
......@@ -189,7 +248,7 @@ It takes as input:
It returns:
- `res` = Vector{Matrix{uwreal}}
- `res = Vector{Matrix{uwreal}}`
where each `res[i]` is a matrix with the eigenvectors as columns
Examples:
......@@ -203,7 +262,6 @@ function getall_eigvecs(a::Vector{Matrix}, delta_t; iter=30)
res = Vector{Matrix{uwreal}}(undef, n)
[res[i] = uweigvecs(a[i+delta_t], a[i]) for i=1:n]
return res
end
@doc raw"""
......@@ -219,9 +277,19 @@ It takes as input:
- `b::Matrix{uwreal}` : a matrix of uwreal, optional
- `iter=30` : the number of iterations of the qr algorithm used to extract the eigenvalues
It returns:
- `res = Matrix{uwreal}`: a matrix where each column is an eigenvector
Examples:
```@example
a = Matrix{uwreal}(nothing, n,n) ## n*n matrix of uwreal with nothing entries
b = Matrix{uwreal}(nothing, n,n) ## n*n matrix of uwreal with nothing entries
res = uweigvecs(a) ##eigenvectors in column
res1 = uweigvecs(a,b) ## generalised eigenvectors in column
```
"""
function uweigvecs(a::Matrix{uwreal}; iter = 30)
n = size(a,1)
......@@ -258,9 +326,22 @@ It takes as input:
- `b::Matrix{uwreal}` : a matrix of uwreal, optional
- `iter=30` : the number of iterations of the qr algorithm used to extract the eigenvalues
It returns:
- `evals = Vector{uwreal}`: a vector where each elements is an eigenvalue
- `evecs = Matrix{uwreal}`: a matrix where the i-th column is the eigenvector of the i-th eigenvalue
Examples:
```@example
a = Matrix{uwreal}(nothing, n,n) ## n*n matrix of uwreal with nothing entries
b = Matrix{uwreal}(nothing, n,n) ## n*n matrix of uwreal with nothing entries
eval, evec = uweigen(a)
eval1, evec1 = uweigvecs(a,b)
```
"""
function uweigen(a::Matrix{uwreal}; iter = 30)
return uweigvals(a, iter=iter), uweigvecs(a, iter=iter)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment