text
stringlengths 0
1.25M
| meta
stringlengths 47
1.89k
|
---|---|
from matplotlib import pyplot as plt
import csv
import os
import h5py
import numpy as np
from skimage.io import imread
from skimage.transform import resize
import pandas as pd
import torch
from torch import nn, optim
from torch.autograd import Variable
import torch.nn.functional as F
from torchvision.utils import make_grid
from sklearn.metrics import confusion_matrix , precision_score , recall_score , f1_score
# from resources.plotcm import plot_confusion_matrix
from torch.utils.data import DataLoader
from torchvision.datasets import CIFAR10
from torchvision import transforms
from torch.utils.tensorboard import SummaryWriter
# to import models
# from torchvision import models
from dataset import *
from model import *
# default `log_dir` is "runs" - we'll be more specific here
writer = SummaryWriter( os.path.join( 'runs' , 'GTSRB_VGG_SE_11' ) )
device = torch.device( 'cuda' if torch.cuda.is_available() == True else 'cpu' )
def split_train_test_val( train_data , test_train_split=0.8 , val_train_split=0.2 , shuffle=True ):
dataset_size = len( train_data )
indices = list( range( dataset_size ) )
test_split = int( np.floor( test_train_split * dataset_size ) )
if shuffle == True:
np.random.shuffle(indices)
train_indices, test_indices = indices[:test_split] , indices[test_split:]
train_size = len( train_indices )
validation_split = int( np.floor( ( 1 - val_train_split ) * train_size ) )
train_indices, val_indices = train_indices[ : validation_split ] , train_indices[ validation_split : ]
test_data = train_data[ test_indices ]
val_data = train_data[ val_indices ]
train_data = train_data[ train_indices ]
return ( train_data , test_data , val_data )
import time
EPOCHS = 44
BATCH_SIZE = 128
LEARNING_RATE = 1e-1
WEIGHT_DECAY = 1e-4
NUM_CLASSES = 43
INPUT_IMAGE_SIZE = 28
CHECKPOINT_PATH = os.path.join( 'checkpoint' , 'GTSRB_VGG_SE_11' )
def main():
model_state = None
opt_state = None
last_epoch = None
loss = None
# if the checkpoint path does not exists , then create it
if not os.path.exists( CHECKPOINT_PATH ):
os.makedirs( CHECKPOINT_PATH )
# if checkpoint path already exists
else:
dirs = os.listdir( CHECKPOINT_PATH )
if len(dirs) > 0:
latest_checkpoint = max(dirs)
checkpoint = torch.load( os.path.join(CHECKPOINT_PATH,latest_checkpoint) )
model_state = checkpoint['model_state_dict']
opt_state = checkpoint['optimizer_state_dict']
last_epoch = checkpoint['epoch']
loss = checkpoint['loss']
print(' [*] Model Restored from {} Epoch \n'.format(last_epoch) )
model_restored = True
train_loader , val_loader , test_loader = get_loaders( batch_size=BATCH_SIZE )
print('Training : ' , len(train_loader) )
print('Validation : ' , len(val_loader) )
print('Testing : ' , len(test_loader) )
net = VGG11( num_classes=NUM_CLASSES ).to(device)
at_start = True
if model_state:
net.load_state_dict(model_state)
ACE = nn.CrossEntropyLoss().to(device)
opt = optim.SGD(net.parameters(), lr=LEARNING_RATE, weight_decay=WEIGHT_DECAY, momentum=.9, nesterov=True)
if opt_state:
opt.load_state_dict(opt_state)
for epoch in range( last_epoch+1 , EPOCHS + 1 ) if last_epoch else range(1, EPOCHS + 1):
print('[Epoch %d]' % epoch)
train_loss = 0
train_correct, train_total = 0 , 0
start_point = time.time()
batch_iter = 0
for inputs, labels in train_loader:
labels = np.array(labels ,dtype=np.long)
inputs = torch.as_tensor(inputs)
labels = torch.as_tensor(labels)
inputs, labels = Variable(inputs).to(device), Variable(labels).to(device)
if at_start == True:
# create grid of images
img_grid = make_grid(inputs)
# write to tensorboard
writer.add_image('sample Images'.format(batch_iter), img_grid)
writer.add_graph(net, inputs)
at_start = False
opt.zero_grad()
preds = net(inputs)
loss = ACE(preds, labels)
loss.backward()
opt.step()
train_loss += loss.item()
train_correct += (preds.argmax(dim=1) == labels).sum().item()
train_total += len(preds)
# cm = confusion_matrix( labels , preds.argmax(dim=1) )
training_p_score , training_recall , training_f1_score = get_metrics( labels , preds )
writer.add_scalar('training p-score',
training_p_score ,
epoch * len(train_loader) + batch_iter
)
writer.add_scalar('training recall',
training_recall ,
epoch * len(train_loader) + batch_iter
)
writer.add_scalar('training f1-score',
training_f1_score ,
epoch * len(train_loader) + batch_iter
)
# log the training loss
writer.add_scalar('training loss',
train_loss / len(train_loader),
epoch * len(train_loader) + batch_iter
)
# log the training accuracy
writer.add_scalar('training accuracy',
100 * train_correct / train_total,
epoch * len(train_loader) + batch_iter
)
batch_iter = batch_iter + 1
printProgressBar( batch_iter , len(train_loader) , prefix = 'Training : ', suffix = 'Complete', length = 50)
print('train-acc : %.4f%% train-loss : %.5f' % (100 * train_correct / train_total, train_loss / len(train_loader) ) )
print('elapsed time: %ds' % (time.time() - start_point))
test_loss = 0
test_correct, test_total = 0 , 0
batch_iter = 0
for inputs, labels in test_loader:
with torch.no_grad():
labels = np.array(labels ,dtype=np.long)
inputs , labels = torch.as_tensor(inputs) , torch.as_tensor(labels)
inputs, labels = Variable(inputs).to(device), Variable(labels).to(device)
preds = net(inputs)
test_loss += ACE(preds, labels).item()
test_correct += (preds.argmax(dim=1) == labels).sum().item()
test_total += len(preds)
testing_p_score , testing_recall , testing_f1_score = get_metrics( labels , preds )
writer.add_scalar('testing p-score',
testing_p_score ,
epoch * len(test_loader) + batch_iter
)
writer.add_scalar('testing recall',
testing_recall ,
epoch * len(test_loader) + batch_iter
)
writer.add_scalar('testing f1-score',
testing_f1_score ,
epoch * len(test_loader) + batch_iter
)
# log the testing loss
writer.add_scalar('testing loss',
test_loss / len(test_loader),
epoch * len(test_loader) + batch_iter
)
# log the testing accuracy
writer.add_scalar('testing accuracy',
100 * test_correct / test_total,
epoch * len(test_loader) + batch_iter
)
batch_iter = batch_iter + 1
printProgressBar( batch_iter , len(test_loader) , prefix = 'Testing : ', suffix = 'Complete', length = 50)
print('test-acc : %.4f%% test-loss : %.5f' % (100 * test_correct / test_total, test_loss / len(test_loader) ) )
val_loss = 0
val_correct, val_total = 0 , 0
batch_iter = 0
for inputs, labels in val_loader:
with torch.no_grad():
labels = np.array(labels ,dtype=np.long)
inputs , labels = torch.as_tensor(inputs) , torch.as_tensor(labels)
inputs, labels = Variable(inputs).to(device), Variable(labels).to(device)
preds = net(inputs)
val_loss += ACE(preds, labels).item()
val_correct += (preds.argmax(dim=1) == labels).sum().item()
val_total += len(preds)
val_p_score , val_recall , val_f1_score = get_metrics( labels , preds )
writer.add_scalar('validation p-score',
val_p_score ,
epoch * len(val_loader) + batch_iter
)
writer.add_scalar('validation recall',
val_recall ,
epoch * len(val_loader) + batch_iter
)
writer.add_scalar('validation f1-score',
val_f1_score ,
epoch * len(val_loader) + batch_iter
)
# log the validation loss
writer.add_scalar('validation loss',
val_loss / len(val_loader) ,
epoch * len(val_loader) + batch_iter
)
# log the validation accuracy
writer.add_scalar('validation accuracy',
100 * val_correct / val_total,
epoch * len(val_loader) + batch_iter
)
batch_iter = batch_iter + 1
printProgressBar( batch_iter , len(val_loader) , prefix = 'Validating : ', suffix = 'Complete', length = 50)
print('val-acc : %.4f%% val-loss : %.5f' % (100 * val_correct / val_total, val_loss / len(val_loader) ) )
for name , weight in net.named_parameters():
writer.add_histogram( name , weight , epoch )
writer.add_histogram( '{}.grad'.format(name) , weight.grad , epoch )
torch.save( {
'epoch': epoch,
'model_state_dict': net.state_dict(),
'optimizer_state_dict': opt.state_dict(),
'loss': loss,
} , os.path.join( CHECKPOINT_PATH , 'GTSRB-checkpoint-{:04d}.bin'.format(epoch) ) )
writer.flush()
writer.close()
if __name__ == '__main__':
main()
| {"hexsha": "52607fd13b05480dd3c56786a6d4558c3629408c", "size": 11033, "ext": "py", "lang": "Python", "max_stars_repo_path": "GTSRB/train_vgg.py", "max_stars_repo_name": "guruprasaad123/all_dl_projects", "max_stars_repo_head_hexsha": "04c869f7f001ef94c467740260663d91a34815e0", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-12-10T16:06:20.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-10T16:06:20.000Z", "max_issues_repo_path": "GTSRB/train_vgg.py", "max_issues_repo_name": "guruprasaad123/all_dl_projects", "max_issues_repo_head_hexsha": "04c869f7f001ef94c467740260663d91a34815e0", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "GTSRB/train_vgg.py", "max_forks_repo_name": "guruprasaad123/all_dl_projects", "max_forks_repo_head_hexsha": "04c869f7f001ef94c467740260663d91a34815e0", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.5457227139, "max_line_length": 125, "alphanum_fraction": 0.5409226865, "include": true, "reason": "import numpy", "num_tokens": 2221} |
from __future__ import absolute_import, division
import numpy as np
import cv2
from . import Tracker
from ..utils import dict2tuple
from ..utils.complex import real, conj, fft2, ifft2, complex_add, complex_mul, complex_div
from ..descriptors.fhog import fast_hog
class TrackerDCF(Tracker):
def __init__(self, **kargs):
super(TrackerDCF, self).__init__('DCF')
self.parse_args(**kargs)
def parse_args(self, **kargs):
self.cfg = {
'lambda_': 1e-4,
'padding': 1.5,
'output_sigma_factor': 0.125,
'interp_factor': 0.012,
'cell_size': 4}
for key, val in kargs.items():
self.cfg.update({key: val})
self.cfg = dict2tuple(self.cfg)
def init(self, image, init_rect):
# initialize parameters
self.resize_image = False
if np.sqrt(init_rect[2:].prod()) > 100:
self.resize_image = True
init_rect = init_rect / 2
self.t_center = init_rect[:2] + init_rect[2:] / 2
self.t_sz = init_rect[2:]
mod = self.cfg.cell_size * 2
self.padded_sz = self.t_sz * (1 + self.cfg.padding)
self.padded_sz = self.padded_sz.astype(int) // mod * mod + mod
# get feature size and initialize hanning window
if image.ndim == 2:
image = cv2.cvtColor(image, cv2.COLOR_GRAY2BGR)
if self.resize_image:
size = (int(image.shape[1] / 2), int(image.shape[0] / 2))
image = cv2.resize(image, size)
z = self._crop(image, self.t_center, self.padded_sz)
z = fast_hog(np.float32(z), self.cfg.cell_size)
self.feat_sz = z.shape
self.hann_window = np.outer(
np.hanning(self.feat_sz[0]),
np.hanning(self.feat_sz[1])).astype(np.float32)
self.hann_window = self.hann_window[:, :, np.newaxis]
self.zf = fft2(z * self.hann_window)
# create gaussian labels
output_sigma = self.cfg.output_sigma_factor * \
np.sqrt(np.prod(self.feat_sz[:2])) / (1 + self.cfg.padding)
rs, cs = np.ogrid[:self.feat_sz[0], :self.feat_sz[1]]
rs, cs = rs - self.feat_sz[0] // 2, cs - self.feat_sz[1] // 2
y = np.exp(-0.5 / output_sigma ** 2 * (rs ** 2 + cs ** 2))
self.yf = fft2(y)
# train classifier
kf = self._linear_correlation(self.zf, self.zf)
self.alphaf = complex_div(self.yf, complex_add(kf, self.cfg.lambda_))
def update(self, image):
if image.ndim == 2:
image = cv2.cvtColor(image, cv2.COLOR_GRAY2BGR)
if self.resize_image:
size = (int(image.shape[1] / 2), int(image.shape[0] / 2))
image = cv2.resize(image, size)
# locate target
x = self._crop(image, self.t_center, self.padded_sz)
x = self.hann_window * fast_hog(np.float32(x), self.cfg.cell_size)
kf = self._linear_correlation(fft2(x), self.zf)
score = real(ifft2(complex_mul(self.alphaf, kf)))
offset = self._locate_target(score)
self.t_center += offset * self.cfg.cell_size
# limit the estimated bounding box to be overlapped with the image
self.t_center = np.clip(
self.t_center, -self.t_sz / 2 + 2,
image.shape[1::-1] + self.t_sz / 2 - 1)
# update model
new_z = self._crop(image, self.t_center, self.padded_sz)
new_z = fast_hog(np.float32(new_z), self.cfg.cell_size)
new_zf = fft2(new_z * self.hann_window)
kf = self._linear_correlation(new_zf, new_zf)
new_alphaf = complex_div(self.yf, complex_add(kf, self.cfg.lambda_))
self.alphaf = (1 - self.cfg.interp_factor) * self.alphaf + \
self.cfg.interp_factor * new_alphaf
self.zf = (1 - self.cfg.interp_factor) * self.zf + \
self.cfg.interp_factor * new_zf
bndbox = np.concatenate([
self.t_center - self.t_sz / 2, self.t_sz])
if self.resize_image:
bndbox = bndbox * 2
return bndbox
def _crop(self, image, center, size):
corners = np.zeros(4, dtype=int)
corners[:2] = np.floor(center - size / 2).astype(int)
corners[2:] = corners[:2] + size
pads = np.concatenate(
(-corners[:2], corners[2:] - image.shape[1::-1]))
pads = np.maximum(0, pads)
if np.any(pads > 0):
corners = np.concatenate((
corners[:2] + pads[:2],
corners[2:] - pads[2:])).astype(int)
patch = image[corners[1]:corners[3], corners[0]:corners[2]]
if np.any(pads > 0):
patch = cv2.copyMakeBorder(
patch, pads[1], pads[3], pads[0], pads[2],
borderType=cv2.BORDER_REPLICATE)
return patch
def _linear_correlation(self, x1f, x2f):
xcorr = complex_mul(x1f, conj(x2f))
xcorr = np.sum(xcorr, axis=2) / x1f.size
return xcorr
def _locate_target(self, score):
def subpixel_peak(left, center, right):
divisor = 2 * center - left - right
if abs(divisor) < 1e-3:
return 0
return 0.5 * (right - left) / divisor
_, _, _, max_loc = cv2.minMaxLoc(score)
loc = np.float32(max_loc)
if max_loc[0] in range(1, score.shape[1] - 1):
loc[0] += subpixel_peak(
score[max_loc[1], max_loc[0] - 1],
score[max_loc[1], max_loc[0]],
score[max_loc[1], max_loc[0] + 1])
if max_loc[1] in range(1, score.shape[0] - 1):
loc[1] += subpixel_peak(
score[max_loc[1] - 1, max_loc[0]],
score[max_loc[1], max_loc[0]],
score[max_loc[1] + 1, max_loc[0]])
offset = loc - np.float32(score.shape[1::-1]) / 2
return offset
| {"hexsha": "6906cd624af11c9b13b8cc45bb7a2366569e67d3", "size": 5838, "ext": "py", "lang": "Python", "max_stars_repo_path": "lib/trackers/dcf.py", "max_stars_repo_name": "BestSonny/open-vot-1", "max_stars_repo_head_hexsha": "3e00fbded601cf8c6a38d6f57d7b5a9df0be394b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 95, "max_stars_repo_stars_event_min_datetime": "2018-05-12T13:13:22.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-30T18:42:11.000Z", "max_issues_repo_path": "lib/trackers/dcf.py", "max_issues_repo_name": "BestSonny/open-vot-1", "max_issues_repo_head_hexsha": "3e00fbded601cf8c6a38d6f57d7b5a9df0be394b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2018-05-21T03:43:28.000Z", "max_issues_repo_issues_event_max_datetime": "2018-12-09T05:42:03.000Z", "max_forks_repo_path": "lib/trackers/dcf.py", "max_forks_repo_name": "BestSonny/open-vot-1", "max_forks_repo_head_hexsha": "3e00fbded601cf8c6a38d6f57d7b5a9df0be394b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 19, "max_forks_repo_forks_event_min_datetime": "2018-05-20T17:04:48.000Z", "max_forks_repo_forks_event_max_datetime": "2019-04-02T12:28:15.000Z", "avg_line_length": 37.1847133758, "max_line_length": 90, "alphanum_fraction": 0.5664611168, "include": true, "reason": "import numpy", "num_tokens": 1639} |
import numpy as np
import PIL
import pathlib
import pdf2image
#import rename_image
#image_size = input("生成画像のサイズ>")
pdf_files = pathlib.Path('in_pdf').glob('*.pdf')
img_dir = pathlib.Path('out_img')
for pdf_file in pdf_files:
base = pdf_file.stem
print(pdf_file)
images = pdf2image.convert_from_path(pdf_file,dpi=160)
for index, image in enumerate(images):
#print(image.stem)
print(index)
image.save(img_dir/pathlib.Path(base + '-{}.jpg'.format(index + 1)),'jpeg')
#rename_image.rename_img() | {"hexsha": "0558160d27c3a010b1ca35ff822a4b17e610e3ef", "size": 535, "ext": "py", "lang": "Python", "max_stars_repo_path": "make-dataset/pdftojpg.py", "max_stars_repo_name": "jphacks/A_2004", "max_stars_repo_head_hexsha": "185e53a2a74f23f62bf9e9cbc0d4a02ef33f4b5f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-10-31T01:58:29.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-03T13:51:54.000Z", "max_issues_repo_path": "make-dataset/pdftojpg.py", "max_issues_repo_name": "jphacks/A_2004", "max_issues_repo_head_hexsha": "185e53a2a74f23f62bf9e9cbc0d4a02ef33f4b5f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "make-dataset/pdftojpg.py", "max_forks_repo_name": "jphacks/A_2004", "max_forks_repo_head_hexsha": "185e53a2a74f23f62bf9e9cbc0d4a02ef33f4b5f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.4761904762, "max_line_length": 83, "alphanum_fraction": 0.6990654206, "include": true, "reason": "import numpy", "num_tokens": 141} |
# # Solve BTPDE
#
# We start by loading SpinDoctor and a Makie plotting backend.
# LSP indexing solution #src
# https://github.com/julia-vscode/julia-vscode/issues/800#issuecomment-650085983 #src
if isdefined(@__MODULE__, :LanguageServer) #src
include("../src/SpinDoctor.jl") #src
using .SpinDoctor #src
end #src
using SpinDoctor
using LinearAlgebra
if haskey(ENV, "GITHUB_ACTIONS")
using CairoMakie
else
using GLMakie
end
# The built in geometry recipes allow for making various cell configuration. We here consider
# the case of three twisted axons immersed in an extracellular space (ECS).
setup = CylinderSetup(;
name = "some-very-real-axons",
ncell = 3,
rmin = 2.0,
rmax = 6.0,
dmin = 0.2,
dmax = 0.3,
height = 40.0,
bend = 0.0,
twist = π / 4,
include_in = false,
in_ratio = 0.6,
ecs_shape = :convex_hull,
ecs_ratio = 0.5,
)
# We also define coefficients for the different cell compartments `:in` (axon), `:out`
# (myelin), and `:ecs` (ECS).
coeffs = coefficients(
setup;
D = (; in = 0.002 * I(3), out = 0.002 * I(3), ecs = 0.002 * I(3)),
T₂ = (; in = Inf, out = Inf, ecs = Inf),
ρ = (; in = 1.0, out = 1.0, ecs = 1.0),
κ = (; in_out = 1e-4, out_ecs = 1e-4, in = 0.0, out = 0.0, ecs = 0.0),
γ = 2.67513e-4,
)
# The following line creates a random cell configuration for our cylinder setup, generates a
# surface triangulation and calls TetGen to create a tetrahedral finite element mesh. The
# compartments and boundaries will be ordered in the same way as `coeffs`.
mesh, = create_geometry(setup)
# The resulting mesh can be plotted in 3D provided a Makie backend is loaded.
plot_mesh(mesh)
# The mesh looks good, so we can proceed with the assembly our biological model and the
# associated finite element matrices.
model = Model(; mesh, coeffs...)
matrices = assemble_matrices(model)
# The Bloch-Torrey PDE takes a magnetic field gradient pulse sequence as an input. Here
# we consider a [`ScalarGradient`](@ref) with a [`PGSE`](@ref) time profile.
dir = [1.0, 0.0, 0.0]
profile = PGSE(2000.0, 6000.0)
b = 1000
g = √(b / int_F²(profile)) / coeffs.γ
gradient = ScalarGradient(dir, profile, g)
# SpinDoctor provides a [`solve`](@ref) function, which has the same base signature for all
# diffusion MRI problems. The BTPDE is one such problem. They generally take a gradient
# sequence as an input.
btpde = BTPDE(; model, matrices)
ξ = solve(btpde, gradient)
# Here, `ξ` is a vector containing the complex-valued magnetization at all degrees of freedom
# at the echo time `TE`. We may compute the resulting signal as follows:
compute_signal(matrices.M, ξ)
# The global mass matrix `M` is used to compute the integral. We may however be interested in
# the compartment-wise signals. This requires splitting the magnetization field into the
# respective compartments. The compartment mass matrices are also available.
ξ_cmpts = split_field(mesh, ξ)
compute_signal.(matrices.M_cmpts, ξ_cmpts)
# The final magnetization can be visualized using the [`plot_field`](@ref) function.
plot_field(mesh, ξ)
# In this example, we have computed the complex transverse water proton magnetization field
# using the finite element method. The measured diffusion MRI signal is the integral of this
# field, and other quantities of interest, such as the apparent diffusion coefficient (ADC),
# or the effective diffusion tensor, may easily be obtained from this reference field.
# Directly solving the BTPDE is thus considered to be the "gold standard" for computing these
# quantities, as arbitrary precision may be obtained.
# However, this is also often the most computationally expensive approach. In the following
# examples, we will consider some other specialized methods provided by SpinDoctor, each
# having their own domains of validity, use cases, and computational footprints.
| {"hexsha": "a3bd1bbca1559c4695e9fe04a7284d1b736521b1", "size": 4168, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "examples/solve_btpde.jl", "max_stars_repo_name": "SpinDoctorMRI/SpinDoctor.jl", "max_stars_repo_head_hexsha": "6f8df53bc5741bd41d7f984e9041671ecd12d413", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 7, "max_stars_repo_stars_event_min_datetime": "2022-03-19T12:53:56.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T22:39:38.000Z", "max_issues_repo_path": "examples/solve_btpde.jl", "max_issues_repo_name": "SpinDoctorMRI/SpinDoctor.jl", "max_issues_repo_head_hexsha": "6f8df53bc5741bd41d7f984e9041671ecd12d413", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 5, "max_issues_repo_issues_event_min_datetime": "2022-03-13T19:49:18.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-25T14:58:15.000Z", "max_forks_repo_path": "examples/solve_btpde.jl", "max_forks_repo_name": "SpinDoctorMRI/SpinDoctor.jl", "max_forks_repo_head_hexsha": "6f8df53bc5741bd41d7f984e9041671ecd12d413", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.8909090909, "max_line_length": 93, "alphanum_fraction": 0.674184261, "num_tokens": 1083} |
# -*- coding: utf-8 -*-
## Sample file to show the implementation of thickness estimation module
### AUTHOR : VISWAMBHAR REDDY YASA
### MATRICULATION NUMBER : 65074
### STUDENT PROJECT TUBF: Projekt LaDECO (Machine learning on thermographic videos)
import numpy as np
print('Project MLaDECO')
print('Author: Viswambhar Yasa')
print('Software version: 0.1')
from thermograms.Utilities import Utilities
from utilites.tolerance_maks_gen import tolerance_predicted_mask
from utilites.thermal_profile import constrast_function
from tensorflow.keras import models
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
import seaborn as sns
# file path
root_path = r'utilites/datasets'
# file name
data_file_name = r'material_thickness_1000W.hdf5'
# to open the hadoop fle
thermal_object = Utilities()
# extracting hadoop file and listing experiment
thermal_data, experiment_list = thermal_object.open_file(root_path, data_file_name, True)
experiment_name = r'2021-12-07-Materialstudie-8.5-40µmS1013_40µmS6018_grün-1000W-10s'
experimental_data = thermal_data[experiment_name]
#length of the radiation phase
no_of_time_steps = 200
# calulating the constrast function
input_data = constrast_function(experimental_data, index=8, start_tol=9, no_of_time_steps=200)
print("shape of input data", input_data.shape)
# assigning the thickness classes
number_of_classes = 15
# assigning the thickness ranges
initial_thickness=0.001
final_thickness=0.1
# creating bins to classify thickness class
bins = np.linspace(initial_thickness, final_thickness, number_of_classes + 1)
# selecting a RNN model
model = 'Bi-GRU'
print('Thickness estimation model ', model)
# loading the model
if model == 'GRU':
thickness_net = models.load_model(r'trained_models/GRU/thickness_estimation_GRU.h5')
elif model == 'LSTM':
thickness_net = models.load_model(r'trained_models/LSTM/thickness_estimation_lstm.h5')
elif model == 'Bi-GRU':
thickness_net = models.load_model(r'trained_models/GRU/thickness_estimation_bi_GRU.h5')
else:
thickness_net = models.load_model(r'trained_models/LSTM/thickness_estimation_bi_lstm.h5')
#predicting the thickness class
thickness_class_predicted = np.argmax(thickness_net.predict(input_data), axis=1)
print("Thickness of the coating is", np.squeeze(bins[thickness_class_predicted]), " mm")
# plotting the constrast function along with the thickness class
plt.plot(np.squeeze(input_data), linewidth=2, color='tab:orange')
plt.ylabel("Constrast Function (No units)")
plt.xlabel("Radiation time frames")
plt.grid()
plt.title("Thickness of the coating is {} mm".format(np.squeeze(bins[thickness_class_predicted])))
plt.show()
| {"hexsha": "d4b05f1d643b60b6f558df95cf24295bf6a3fdac", "size": 2654, "ext": "py", "lang": "Python", "max_stars_repo_path": "thickness_estimation.py", "max_stars_repo_name": "viswambhar-yasa/LaDECO", "max_stars_repo_head_hexsha": "0172270a86c71e8c32913005ec07fd63293af0f7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "thickness_estimation.py", "max_issues_repo_name": "viswambhar-yasa/LaDECO", "max_issues_repo_head_hexsha": "0172270a86c71e8c32913005ec07fd63293af0f7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "thickness_estimation.py", "max_forks_repo_name": "viswambhar-yasa/LaDECO", "max_forks_repo_head_hexsha": "0172270a86c71e8c32913005ec07fd63293af0f7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.46875, "max_line_length": 98, "alphanum_fraction": 0.8006782216, "include": true, "reason": "import numpy", "num_tokens": 662} |
#include <boost/algorithm/string.hpp>
#include <raft-kv/raft/raft.h>
#include <raft-kv/common/log.h>
#include <raft-kv/common/slice.h>
#include <raft-kv/raft/util.h>
namespace kv {
static const std::string kCampaignPreElection = "CampaignPreElection";
static const std::string kCampaignElection = "CampaignElection";
static const std::string kCampaignTransfer = "CampaignTransfer";
static uint32_t num_of_pending_conf(const std::vector<proto::EntryPtr>& entries) {
uint32_t n = 0;
for (const proto::EntryPtr& entry: entries) {
if (entry->type == proto::EntryConfChange) {
n++;
}
}
return n;
}
Raft::Raft(const Config& c)
: id_(c.id),
term_(0),
vote_(0),
max_msg_size_(c.max_size_per_msg),
max_uncommitted_size_(c.max_uncommitted_entries_size),
max_inflight_(c.max_inflight_msgs),
state_(RaftState::Follower),
is_learner_(false),
lead_(0),
lead_transferee_(0),
pending_conf_index_(0),
uncommitted_size_(0),
read_only_(new ReadOnly(c.read_only_option)),
election_elapsed_(0),
heartbeat_elapsed_(0),
check_quorum_(c.check_quorum),
pre_vote_(c.pre_vote),
heartbeat_timeout_(c.heartbeat_tick),
election_timeout_(c.election_tick),
randomized_election_timeout_(0),
disable_proposal_forwarding_(c.disable_proposal_forwarding),
random_device_(0, c.election_tick) {
raft_log_ = std::make_shared<RaftLog>(c.storage, c.max_committed_size_per_ready);
proto::HardState hs;
proto::ConfState cs;
Status status = c.storage->initial_state(hs, cs);
if (!status.is_ok()) {
LOG_FATAL("%s", status.to_string().c_str());
}
std::vector<uint64_t> peers = c.peers;
std::vector<uint64_t> learners = c.learners;
if (!cs.nodes.empty() || !cs.learners.empty()) {
if (!peers.empty() || !learners.empty()) {
// tests; the argument should be removed and these tests should be
// updated to specify their nodes through a snapshot.
LOG_FATAL("cannot specify both newRaft(peers, learners) and ConfState.(Nodes, Learners)");
}
peers = cs.nodes;
learners = cs.learners;
}
for (uint64_t peer : peers) {
ProgressPtr p(new Progress(max_inflight_));
p->next = 1;
prs_[peer] = p;
}
for (uint64_t learner : learners) {
auto it = prs_.find(learner);
if (it != prs_.end()) {
LOG_FATAL("node %lu is in both learner and peer list", learner);
}
ProgressPtr p(new Progress(max_inflight_));
p->next = 1;
p->is_learner = true;
learner_prs_[learner] = p;
if (id_ == learner) {
is_learner_ = true;
}
}
if (!hs.is_empty_state()) {
load_state(hs);
}
if (c.applied > 0) {
raft_log_->applied_to(c.applied);
}
become_follower(term_, 0);
std::string node_str;
{
std::vector<std::string> nodes_strs;
std::vector<uint64_t> node;
this->nodes(node);
for (uint64_t n : node) {
nodes_strs.push_back(std::to_string(n));
}
node_str = boost::join(nodes_strs, ",");
}
LOG_INFO("raft %lu [peers: [%s], term: %lu, commit: %lu, applied: %lu, last_index: %lu, last_term: %lu]",
id_,
node_str.c_str(),
term_,
raft_log_->committed_,
raft_log_->applied_,
raft_log_->last_index(),
raft_log_->last_term());
}
Raft::~Raft() {
}
void Raft::become_follower(uint64_t term, uint64_t lead) {
step_ = std::bind(&Raft::step_follower, this, std::placeholders::_1);
reset(term);
tick_ = std::bind(&Raft::tick_election, this);
lead_ = lead;
state_ = RaftState::Follower;
LOG_INFO("%lu became follower at term %lu", id_, term_);
}
void Raft::become_candidate() {
if (state_ == RaftState::Leader) {
LOG_FATAL("invalid transition [leader -> candidate]");
}
step_ = std::bind(&Raft::step_candidate, this, std::placeholders::_1);
reset(term_ + 1);
tick_ = std::bind(&Raft::tick_election, this);
vote_ = id_;
state_ = RaftState::Candidate;
LOG_INFO("%lu became candidate at term %lu", id_, term_);
}
void Raft::become_pre_candidate() {
if (state_ == RaftState::Leader) {
LOG_FATAL("invalid transition [leader -> pre-candidate]");
}
// Becoming a pre-candidate changes our step functions and state,
// but doesn't change anything else. In particular it does not increase
// r.Term or change r.Vote.
step_ = std::bind(&Raft::step_candidate, this, std::placeholders::_1);
votes_.clear();
tick_ = std::bind(&Raft::tick_election, this);
lead_ = 0;
state_ = RaftState::PreCandidate;
LOG_INFO("%lu became pre-candidate at term %lu", id_, term_);
}
void Raft::become_leader() {
if (state_ == RaftState::Follower) {
LOG_FATAL("invalid transition [follower -> leader]");
}
step_ = std::bind(&Raft::step_leader, this, std::placeholders::_1);
reset(term_);
tick_ = std::bind(&Raft::tick_heartbeat, this);
lead_ = id_;
state_ = RaftState::Leader;
// Followers enter replicate mode when they've been successfully probed
// (perhaps after having received a snapshot as a result). The leader is
// trivially in this state. Note that r.reset() has initialized this
// progress with the last index already.
auto it = prs_.find(id_);
assert(it != prs_.end());
it->second->become_replicate();
// Conservatively set the pendingConfIndex to the last index in the
// log. There may or may not be a pending config change, but it's
// safe to delay any future proposals until we commit all our
// pending log entries, and scanning the entire tail of the log
// could be expensive.
pending_conf_index_ = raft_log_->last_index();
auto empty_ent = std::make_shared<proto::Entry>();
if (!append_entry(std::vector<proto::Entry>{*empty_ent})) {
// This won't happen because we just called reset() above.
LOG_FATAL("empty entry was dropped");
}
// As a special case, don't count the initial empty entry towards the
// uncommitted log quota. This is because we want to preserve the
// behavior of allowing one entry larger than quota if the current
// usage is zero.
std::vector<proto::EntryPtr> entries{empty_ent};
reduce_uncommitted_size(entries);
LOG_INFO("%lu became leader at term %lu", id_, term_);
}
void Raft::campaign(const std::string& campaign_type) {
uint64_t term = 0;
proto::MessageType vote_msg = 0;
if (campaign_type == kCampaignPreElection) {
become_pre_candidate();
vote_msg = proto::MsgPreVote;
// PreVote RPCs are sent for the next term before we've incremented r.Term.
term = term_ + 1;
} else {
become_candidate();
vote_msg = proto::MsgVote;
term = term_;
}
if (quorum() == poll(id_, vote_resp_msg_type(vote_msg), true)) {
// We won the election after voting for ourselves (which must mean that
// this is a single-node cluster). Advance to the next state.
if (campaign_type == kCampaignPreElection) {
campaign(kCampaignElection);
} else {
become_leader();
}
return;
}
for (auto it = prs_.begin(); it != prs_.end(); ++it) {
if (it->first == id_) {
continue;
}
LOG_INFO("%lu [log_term: %lu, index: %lu] sent %s request to %lu at term %lu",
id_,
raft_log_->last_term(),
raft_log_->last_index(),
proto::msg_type_to_string(vote_msg),
it->first,
term_);
std::vector<uint8_t> ctx;
if (campaign_type == kCampaignTransfer) {
ctx = std::vector<uint8_t>(kCampaignTransfer.begin(), kCampaignTransfer.end());
}
proto::MessagePtr msg(new proto::Message());
msg->term = term;
msg->to = it->first;
msg->type = vote_msg;
msg->index = raft_log_->last_index();
msg->log_term = raft_log_->last_term();
msg->context = std::move(ctx);
send(std::move(msg));
}
}
uint32_t Raft::poll(uint64_t id, proto::MessageType type, bool v) {
uint32_t granted = 0;
if (v) {
LOG_INFO("%lu received %s from %lu at term %lu", id_, proto::msg_type_to_string(type), id, term_);
} else {
LOG_INFO("%lu received %s rejection from %lu at term %lu", id_, proto::msg_type_to_string(type), id, term_);
}
auto it = votes_.find(id);
if (it == votes_.end()) {
votes_[id] = v;
}
for (it = votes_.begin(); it != votes_.end(); ++it) {
if (it->second) {
granted++;
}
}
return granted;
}
Status Raft::step(proto::MessagePtr msg) {
if (msg->term == 0) {
} else if (msg->term > term_) {
if (msg->type == proto::MsgVote || msg->type == proto::MsgPreVote) {
bool force = (Slice((const char*) msg->context.data(), msg->context.size()) == Slice(kCampaignTransfer));
bool in_lease = (check_quorum_ && lead_ != 0 && election_elapsed_ < election_timeout_);
if (!force && in_lease) {
// If a server receives a RequestVote request within the minimum election timeout
// of hearing from a current leader, it does not update its term or grant its vote
LOG_INFO(
"%lu [log_term: %lu, index: %lu, vote: %lu] ignored %s from %lu [log_term: %lu, index: %lu] at term %lu: lease is not expired (remaining ticks: %d)",
id_,
raft_log_->last_term(),
raft_log_->last_index(),
vote_,
proto::msg_type_to_string(msg->type),
msg->from,
msg->log_term,
msg->index,
term_,
election_timeout_ - election_elapsed_);
return Status::ok();
}
}
switch (msg->type) {
case proto::MsgPreVote:
// Never change our term in response to a PreVote
break;
case proto::MsgPreVoteResp:
if (!msg->reject) {
// We send pre-vote requests with a term in our future. If the
// pre-vote is granted, we will increment our term when we get a
// quorum. If it is not, the term comes from the node that
// rejected our vote so we should become a follower at the new
// term.
break;
}
default:LOG_INFO("%lu [term: %lu] received a %s message with higher term from %lu [term: %lu]",
id_, term_,
proto::msg_type_to_string(msg->type),
msg->from,
msg->term);
if (msg->type == proto::MsgApp || msg->type == proto::MsgHeartbeat || msg->type == proto::MsgSnap) {
become_follower(msg->term, msg->from);
} else {
become_follower(msg->term, 0);
}
}
} else if (msg->term < term_) {
if ((check_quorum_ || pre_vote_) && (msg->type == proto::MsgHeartbeat || msg->type == proto::MsgApp)) {
// We have received messages from a leader at a lower term. It is possible
// that these messages were simply delayed in the network, but this could
// also mean that this node has advanced its term number during a network
// partition, and it is now unable to either win an election or to rejoin
// the majority on the old term. If checkQuorum is false, this will be
// handled by incrementing term numbers in response to MsgVote with a
// higher term, but if checkQuorum is true we may not advance the term on
// MsgVote and must generate other messages to advance the term. The net
// result of these two features is to minimize the disruption caused by
// nodes that have been removed from the cluster's configuration: a
// removed node will send MsgVotes (or MsgPreVotes) which will be ignored,
// but it will not receive MsgApp or MsgHeartbeat, so it will not create
// disruptive term increases, by notifying leader of this node's activeness.
// The above comments also true for Pre-Vote
//
// When follower gets isolated, it soon starts an election ending
// up with a higher term than leader, although it won't receive enough
// votes to win the election. When it regains connectivity, this response
// with "pb.MsgAppResp" of higher term would force leader to step down.
// However, this disruption is inevitable to free this stuck node with
// fresh election. This can be prevented with Pre-Vote phase.
proto::MessagePtr m(new proto::Message());
m->to = msg->from;
m->type = proto::MsgAppResp;
send(std::move(m));
} else if (msg->type == proto::MsgPreVote) {
// Before Pre-Vote enable, there may have candidate with higher term,
// but less log. After update to Pre-Vote, the cluster may deadlock if
// we drop messages with a lower term.
LOG_INFO(
"%lu [log_term: %lu, index: %lu, vote: %lu] rejected %s from %lu [log_term: %lu, index: %lu] at term %lu",
id_,
raft_log_->last_term(),
raft_log_->last_index(),
vote_,
proto::msg_type_to_string(msg->type),
msg->from,
msg->log_term,
msg->index,
term_);
proto::MessagePtr m(new proto::Message());
m->to = msg->from;
m->type = proto::MsgPreVoteResp;
m->reject = true;
m->term = term_;
send(std::move(m));
} else {
// ignore other cases
LOG_INFO("%lu [term: %lu] ignored a %s message with lower term from %lu [term: %lu]",
id_, term_, proto::msg_type_to_string(msg->type), msg->from, msg->term);
}
return Status::ok();
}
switch (msg->type) {
case proto::MsgHup: {
if (state_ != RaftState::Leader) {
std::vector<proto::EntryPtr> entries;
Status status =
raft_log_->slice(raft_log_->applied_ + 1,
raft_log_->committed_ + 1,
RaftLog::unlimited(),
entries);
if (!status.is_ok()) {
LOG_FATAL("unexpected error getting unapplied entries (%s)", status.to_string().c_str());
}
uint32_t pending = num_of_pending_conf(entries);
if (pending > 0 && raft_log_->committed_ > raft_log_->applied_) {
LOG_WARN(
"%lu cannot campaign at term %lu since there are still %u pending configuration changes to apply",
id_,
term_,
pending);
return Status::ok();
}
LOG_INFO("%lu is starting a new election at term %lu", id_, term_);
if (pre_vote_) {
campaign(kCampaignPreElection);
} else {
campaign(kCampaignElection);
}
} else {
LOG_DEBUG("%lu ignoring MsgHup because already leader", id_);
}
break;
}
case proto::MsgVote:
case proto::MsgPreVote: {
if (is_learner_) {
// TODO: learner may need to vote, in case of node down when confchange.
LOG_INFO(
"%lu [log_term: %lu, index: %lu, vote: %lu] ignored %s from %lu [log_term: %lu, index: %lu] at term %lu: learner can not vote",
id_,
raft_log_->last_term(),
raft_log_->last_index(),
vote_,
proto::msg_type_to_string(msg->type),
msg->from,
msg->log_term,
msg->index,
msg->term);
return Status::ok();
}
// We can vote if this is a repeat of a vote we've already cast...
bool can_vote = vote_ == msg->from ||
// ...we haven't voted and we don't think there's a leader yet in this term...
(vote_ == 0 && lead_ == 0) ||
// ...or this is a PreVote for a future term...
(msg->type == proto::MsgPreVote && msg->term > term_);
// ...and we believe the candidate is up to date.
if (can_vote && this->raft_log_->is_up_to_date(msg->index, msg->log_term)) {
LOG_INFO(
"%lu [log_term: %lu, index: %lu, vote: %lu] cast %s for %lu [log_term: %lu, index: %lu] at term %lu",
id_,
raft_log_->last_term(),
raft_log_->last_index(),
vote_,
proto::msg_type_to_string(msg->type),
msg->from,
msg->log_term,
msg->index,
term_);
// When responding to Msg{Pre,}Vote messages we include the term
// from the message, not the local term. To see why consider the
// case where a single node was previously partitioned away and
// it's local term is now of date. If we include the local term
// (recall that for pre-votes we don't update the local term), the
// (pre-)campaigning node on the other end will proceed to ignore
// the message (it ignores all out of date messages).
// The term in the original message and current local term are the
// same in the case of regular votes, but different for pre-votes.
proto::MessagePtr m(new proto::Message());
m->to = msg->from;
m->term = msg->term;
m->type = vote_resp_msg_type(msg->type);
send(std::move(m));
if (msg->type == proto::MsgVote) {
// Only record real votes.
election_elapsed_ = 0;
vote_ = msg->from;
}
} else {
LOG_INFO(
"%lu [log_term: %lu, index: %lu, vote: %lu] rejected %s from %lu [log_term: %lu, index: %lu] at term %lu",
id_,
raft_log_->last_term(),
raft_log_->last_index(),
vote_,
proto::msg_type_to_string(msg->type),
msg->from,
msg->log_term,
msg->index,
term_);
proto::MessagePtr m(new proto::Message());
m->to = msg->from;
m->term = term_;
m->type = vote_resp_msg_type(msg->type);
m->reject = true;
send(std::move(m));
}
break;
}
default: {
return step_(msg);
}
}
return Status::ok();
}
Status Raft::step_leader(proto::MessagePtr msg) {
// These message types do not require any progress for m.From.
switch (msg->type) {
case proto::MsgBeat: {
bcast_heartbeat();
return Status::ok();
}
case proto::MsgCheckQuorum:
if (!check_quorum_active()) {
LOG_WARN("%lu stepped down to follower since quorum is not active", id_);
become_follower(term_, 0);
}
return Status::ok();
case proto::MsgProp: {
if (msg->entries.empty()) {
LOG_FATAL("%lu stepped empty MsgProp", id_);
}
auto it = prs_.find(id_);
if (it == prs_.end()) {
// If we are not currently a member of the range (i.e. this node
// was removed from the configuration while serving as leader),
// drop any new proposals.
return Status::invalid_argument("raft proposal dropped");
}
if (lead_transferee_ != 0) {
LOG_DEBUG("%lu [term %lu] transfer leadership to %lu is in progress; dropping proposal",
id_,
term_,
lead_transferee_);
return Status::invalid_argument("raft proposal dropped");
}
for (size_t i = 0; i < msg->entries.size(); ++i) {
proto::Entry& e = msg->entries[i];
if (e.type == proto::EntryConfChange) {
if (pending_conf_index_ > raft_log_->applied_) {
LOG_INFO(
"propose conf %s ignored since pending unapplied configuration [index %lu, applied %lu]",
proto::entry_type_to_string(e.type),
pending_conf_index_,
raft_log_->applied_);
e.type = proto::EntryNormal;
e.index = 0;
e.term = 0;
e.data.clear();
} else {
pending_conf_index_ = raft_log_->last_index() + i + 1;
}
}
}
if (!append_entry(msg->entries)) {
return Status::invalid_argument("raft proposal dropped");
}
bcast_append();
return Status::ok();
}
case proto::MsgReadIndex: {
if (quorum() > 1) {
uint64_t term = 0;
raft_log_->term(raft_log_->committed_, term);
if (term != term_) {
return Status::ok();
}
// thinking: use an interally defined context instead of the user given context.
// We can express this in terms of the term and index instead of a user-supplied value.
// This would allow multiple reads to piggyback on the same message.
switch (read_only_->option) {
case ReadOnlySafe:read_only_->add_request(raft_log_->committed_, msg);
bcast_heartbeat_with_ctx(msg->entries[0].data);
break;
case ReadOnlyLeaseBased:
if (msg->from == 0 || msg->from == id_) { // from local member
read_states_
.push_back(ReadState{.index = raft_log_->committed_, .request_ctx = msg->entries[0]
.data});
} else {
proto::MessagePtr m(new proto::Message());
m->to = msg->from;
m->type = proto::MsgReadIndexResp;
m->index = raft_log_->committed_;
m->entries = msg->entries;
send(std::move(m));
}
break;
}
} else {
read_states_.push_back(ReadState{.index = raft_log_->committed_, .request_ctx = msg->entries[0].data});
}
return Status::ok();
}
}
// All other message types require a progress for m.From (pr).
auto pr = get_progress(msg->from);
if (pr == nullptr) {
LOG_DEBUG("%lu no progress available for %lu", id_, msg->from);
return Status::ok();
}
switch (msg->type) {
case proto::MsgAppResp: {
pr->recent_active = true;
if (msg->reject) {
LOG_DEBUG("%lu received msgApp rejection(last_index: %lu) from %lu for index %lu",
id_, msg->reject_hint, msg->from, msg->index);
if (pr->maybe_decreases_to(msg->index, msg->reject_hint)) {
LOG_DEBUG("%lu decreased progress of %lu to [%s]", id_, msg->from, pr->string().c_str());
if (pr->state == ProgressStateReplicate) {
pr->become_probe();
}
send_append(msg->from);
}
} else {
bool old_paused = pr->is_paused();
if (pr->maybe_update(msg->index)) {
if (pr->state == ProgressStateProbe) {
pr->become_replicate();
} else if (pr->state == ProgressStateSnapshot && pr->need_snapshot_abort()) {
LOG_DEBUG("%lu snapshot aborted, resumed sending replication messages to %lu [%s]",
id_,
msg->from,
pr->string().c_str());
// Transition back to replicating state via probing state
// (which takes the snapshot into account). If we didn't
// move to replicating state, that would only happen with
// the next round of appends (but there may not be a next
// round for a while, exposing an inconsistent RaftStatus).
pr->become_probe();
} else if (pr->state == ProgressStateReplicate) {
pr->inflights->free_to(msg->index);
}
if (maybe_commit()) {
bcast_append();
} else if (old_paused) {
// If we were paused before, this node may be missing the
// latest commit index, so send it.
send_append(msg->from);
}
// We've updated flow control information above, which may
// allow us to send multiple (size-limited) in-flight messages
// at once (such as when transitioning from probe to
// replicate, or when freeTo() covers multiple messages). If
// we have more entries to send, send as many messages as we
// can (without sending empty messages for the commit index)
while (maybe_send_append(msg->from, false)) {
}
// Transfer leadership is in progress.
if (msg->from == lead_transferee_ && pr->match == raft_log_->last_index()) {
LOG_INFO("%lu sent MsgTimeoutNow to %lu after received MsgAppResp", id_, msg->from);
send_timeout_now(msg->from);
}
}
}
}
break;
case proto::MsgHeartbeatResp: {
pr->recent_active = true;
pr->resume();
// free one slot for the full inflights window to allow progress.
if (pr->state == ProgressStateReplicate && pr->inflights->is_full()) {
pr->inflights->free_first_one();
}
if (pr->match < raft_log_->last_index()) {
send_append(msg->from);
}
if (read_only_->option != ReadOnlySafe || msg->context.empty()) {
return Status::ok();
}
uint32_t ack_count = read_only_->recv_ack(*msg);
if (ack_count < quorum()) {
return Status::ok();
}
auto rss = read_only_->advance(*msg);
for (auto& rs : rss) {
auto& req = rs->req;
if (req.from == 0 || req.from == id_) {
ReadState read_state = ReadState{.index = rs->index, .request_ctx = req.entries[0].data};
read_states_.push_back(std::move(read_state));
} else {
proto::MessagePtr m(new proto::Message());
m->to = req.from;
m->type = proto::MsgReadIndexResp;
m->index = rs->index;
m->entries = req.entries;
send(std::move(m));
}
}
}
break;
case proto::MsgSnapStatus: {
if (pr->state != ProgressStateSnapshot) {
return Status::ok();
}
if (!msg->reject) {
pr->become_probe();
LOG_DEBUG("%lu snapshot succeeded, resumed sending replication messages to %lu [%s]",
id_,
msg->from,
pr->string().c_str());
} else {
pr->snapshot_failure();
pr->become_probe();
LOG_DEBUG("%lu snapshot failed, resumed sending replication messages to %lu [%s]",
id_,
msg->from,
pr->string().c_str());
}
// If snapshot finish, wait for the msgAppResp from the remote node before sending
// out the next msgApp.
// If snapshot failure, wait for a heartbeat interval before next try
pr->set_pause();
break;
}
case proto::MsgUnreachable: {
// During optimistic replication, if the remote becomes unreachable,
// there is huge probability that a MsgApp is lost.
if (pr->state == ProgressStateReplicate) {
pr->become_probe();
}
LOG_DEBUG("%lu failed to send message to %lu because it is unreachable [%s]", id_,
msg->from,
pr->string().c_str());
break;
}
case proto::MsgTransferLeader: {
if (pr->is_learner) {
LOG_DEBUG("%lu is learner. Ignored transferring leadership", id_);
return Status::ok();
}
uint64_t lead_transferee = msg->from;
uint64_t last_lead_transferee = lead_transferee_;
if (last_lead_transferee != 0) {
if (last_lead_transferee == lead_transferee) {
LOG_INFO(
"%lu [term %lu] transfer leadership to %lu is in progress, ignores request to same node %lu",
id_,
term_,
lead_transferee,
lead_transferee);
return Status::ok();
}
abort_leader_transfer();
LOG_INFO("%lu [term %lu] abort previous transferring leadership to %lu",
id_,
term_,
last_lead_transferee);
}
if (lead_transferee == id_) {
LOG_DEBUG("%lu is already leader. Ignored transferring leadership to self", id_);
return Status::ok();
}
// Transfer leadership to third party.
LOG_INFO("%lu [term %lu] starts to transfer leadership to %lu", id_, term_, lead_transferee);
// Transfer leadership should be finished in one electionTimeout, so reset r.electionElapsed.
election_elapsed_ = 0;
lead_transferee_ = lead_transferee;
if (pr->match == raft_log_->last_index()) {
send_timeout_now(lead_transferee);
LOG_INFO("%lu sends MsgTimeoutNow to %lu immediately as %lu already has up-to-date log",
id_,
lead_transferee,
lead_transferee);
} else {
send_append(lead_transferee);
}
break;
}
}
return Status::ok();
}
Status Raft::step_candidate(proto::MessagePtr msg) {
// Only handle vote responses corresponding to our candidacy (while in
// StateCandidate, we may get stale MsgPreVoteResp messages in this term from
// our pre-candidate state).
switch (msg->type) {
case proto::MsgProp:LOG_INFO("%lu no leader at term %lu; dropping proposal", id_, term_);
return Status::invalid_argument("raft proposal dropped");
case proto::MsgApp:become_follower(msg->term, msg->from); // always m.Term == r.Term
handle_append_entries(std::move(msg));
break;
case proto::MsgHeartbeat:become_follower(msg->term, msg->from); // always m.Term == r.Term
handle_heartbeat(std::move(msg));
break;
case proto::MsgSnap:become_follower(msg->term, msg->from); // always m.Term == r.Term
handle_snapshot(std::move(msg));
break;
case proto::MsgPreVoteResp:
case proto::MsgVoteResp: {
uint64_t gr = poll(msg->from, msg->type, !msg->reject);
LOG_INFO("%lu [quorum:%u] has received %lu %s votes and %lu vote rejections",
id_,
quorum(),
gr,
proto::msg_type_to_string(msg->type),
votes_.size() - gr);
if (quorum() == gr) {
if (state_ == RaftState::PreCandidate) {
campaign(kCampaignElection);
} else {
assert(state_ == RaftState::Candidate);
become_leader();
bcast_append();
}
} else if (quorum() == votes_.size() - gr) {
// pb.MsgPreVoteResp contains future term of pre-candidate
// m.Term > r.Term; reuse r.Term
become_follower(term_, 0);
}
break;
}
case proto::MsgTimeoutNow: {
LOG_DEBUG("%lu [term %lu state %d] ignored MsgTimeoutNow from %lu",
id_,
term_,
state_,
msg->from);
}
}
return Status::ok();
}
void Raft::send(proto::MessagePtr msg) {
msg->from = id_;
if (msg->type == proto::MsgVote || msg->type == proto::MsgVoteResp || msg->type == proto::MsgPreVote
|| msg->type == proto::MsgPreVoteResp) {
if (msg->term == 0) {
// All {pre-,}campaign messages need to have the term set when
// sending.
// - MsgVote: m.Term is the term the node is campaigning for,
// non-zero as we increment the term when campaigning.
// - MsgVoteResp: m.Term is the new r.Term if the MsgVote was
// granted, non-zero for the same reason MsgVote is
// - MsgPreVote: m.Term is the term the node will campaign,
// non-zero as we use m.Term to indicate the next term we'll be
// campaigning for
// - MsgPreVoteResp: m.Term is the term received in the original
// MsgPreVote if the pre-vote was granted, non-zero for the
// same reasons MsgPreVote is
LOG_FATAL("term should be set when sending %s", proto::msg_type_to_string(msg->type));
}
} else {
if (msg->term != 0) {
LOG_FATAL("term should not be set when sending %d (was %lu)", msg->type, msg->term);
}
// do not attach term to MsgProp, MsgReadIndex
// proposals are a way to forward to the leader and
// should be treated as local message.
// MsgReadIndex is also forwarded to leader.
if (msg->type != proto::MsgProp && msg->type != proto::MsgReadIndex) {
msg->term = term_;
}
}
msgs_.push_back(std::move(msg));
}
void Raft::restore_node(const std::vector<uint64_t>& nodes, bool is_learner) {
for (uint64_t node: nodes) {
uint64_t match = 0;
uint64_t next = raft_log_->last_index() + 1;
if (node == id_) {
match = next - 1;
is_learner_ = is_learner;
}
set_progress(node, match, next, is_learner);
LOG_INFO("%lu restored progress of %lu [%s]", id_, node, get_progress(id_)->string().c_str());
}
}
bool Raft::promotable() const {
auto it = prs_.find(id_);
return it != prs_.end();
}
void Raft::add_node_or_learner(uint64_t id, bool is_learner) {
ProgressPtr pr = get_progress(id);
if (pr == nullptr) {
set_progress(id, 0, raft_log_->last_index() + 1, is_learner);
} else {
if (is_learner && !pr->is_learner) {
// can only change Learner to Voter
LOG_INFO("%lu ignored addLearner: do not support changing %lu from raft peer to learner.", id_, id);
return;
}
if (is_learner == pr->is_learner) {
// Ignore any redundant addNode calls (which can happen because the
// initial bootstrapping entries are applied twice).
return;
}
// change Learner to Voter, use origin Learner progress
learner_prs_.erase(id);
pr->is_learner = false;
prs_[id] = pr;
}
if (id_ == id) {
is_learner_ = is_learner;
}
// When a node is first added, we should mark it as recently active.
// Otherwise, CheckQuorum may cause us to step down if it is invoked
// before the added node has a chance to communicate with us.
get_progress(id)->recent_active = true;
}
void Raft::remove_node(uint64_t id) {
del_progress(id);
// do not try to commit or abort transferring if there is no nodes in the cluster.
if (prs_.empty() && learner_prs_.empty()) {
return;
}
// The quorum size is now smaller, so see if any pending entries can
// be committed.
if (maybe_commit()) {
bcast_append();
}
// If the removed node is the leadTransferee, then abort the leadership transferring.
if (state_ == RaftState::Leader && lead_transferee_ == id) {
abort_leader_transfer();
}
}
Status Raft::step_follower(proto::MessagePtr msg) {
switch (msg->type) {
case proto::MsgProp:
if (lead_ == 0) {
LOG_INFO("%lu no leader at term %lu; dropping proposal", id_, term_);
return Status::invalid_argument("raft proposal dropped");
} else if (disable_proposal_forwarding_) {
LOG_INFO("%lu not forwarding to leader %lu at term %lu; dropping proposal", id_, lead_, term_);
return Status::invalid_argument("raft proposal dropped");
}
msg->to = lead_;
send(msg);
break;
case proto::MsgApp: {
election_elapsed_ = 0;
lead_ = msg->from;
handle_append_entries(msg);
break;
}
case proto::MsgHeartbeat: {
election_elapsed_ = 0;
lead_ = msg->from;
handle_heartbeat(msg);
break;
}
case proto::MsgSnap: {
election_elapsed_ = 0;
lead_ = msg->from;
handle_snapshot(msg);
break;
}
case proto::MsgTransferLeader:
if (lead_ == 0) {
LOG_INFO("%lu no leader at term %lu; dropping leader transfer msg", id_, term_);
return Status::ok();
}
msg->to = lead_;
send(msg);
break;
case proto::MsgTimeoutNow:
if (promotable()) {
LOG_INFO("%lu [term %lu] received MsgTimeoutNow from %lu and starts an election to get leadership.",
id_,
term_,
msg->from);
// Leadership transfers never use pre-vote even if r.preVote is true; we
// know we are not recovering from a partition so there is no need for the
// extra round trip.
campaign(kCampaignTransfer);
} else {
LOG_INFO("%lu received MsgTimeoutNow from %lu but is not promotable", id_, msg->from);
}
break;
case proto::MsgReadIndex:
if (lead_ == 0) {
LOG_INFO("%lu no leader at term %lu; dropping index reading msg", id_, term_);
return Status::ok();
}
msg->to = lead_;
send(msg);
break;
case proto::MsgReadIndexResp:
if (msg->entries.size() != 1) {
LOG_ERROR("%lu invalid format of MsgReadIndexResp from %lu, entries count: %lu",
id_,
msg->from,
msg->entries.size());
return Status::ok();
}
ReadState rs;
rs.index = msg->index;
rs.request_ctx = std::move(msg->entries[0].data);
read_states_.push_back(std::move(rs));
break;
}
return Status::ok();
}
void Raft::handle_append_entries(proto::MessagePtr msg) {
if (msg->index < raft_log_->committed_) {
proto::MessagePtr m(new proto::Message());
m->to = msg->from;
m->type = proto::MsgAppResp;
m->index = raft_log_->committed_;
send(std::move(m));
return;
}
std::vector<proto::EntryPtr> entries;
for (proto::Entry& entry: msg->entries) {
entries.push_back(std::make_shared<proto::Entry>(std::move(entry)));
}
bool ok = false;
uint64_t last_index = 0;
raft_log_->maybe_append(msg->index, msg->log_term, msg->commit, std::move(entries), last_index, ok);
if (ok) {
proto::MessagePtr m(new proto::Message());
m->to = msg->from;
m->type = proto::MsgAppResp;
m->index = last_index;
send(std::move(m));
} else {
uint64_t term = 0;
raft_log_->term(msg->index, term);
LOG_DEBUG("%lu [log_term: %lu, index: %lu] rejected msgApp [log_term: %lu, index: %lu] from %lu",
id_, term, msg->index, msg->log_term, msg->index, msg->from)
proto::MessagePtr m(new proto::Message());
m->to = msg->from;
m->type = proto::MsgAppResp;
m->index = msg->index;
m->reject = true;
m->reject_hint = raft_log_->last_index();
send(std::move(m));
}
}
void Raft::handle_heartbeat(proto::MessagePtr msg) {
raft_log_->commit_to(msg->commit);
proto::MessagePtr m(new proto::Message());
m->to = msg->from;
m->type = proto::MsgHeartbeatResp;
msg->context = std::move(msg->context);
send(std::move(m));
}
void Raft::handle_snapshot(proto::MessagePtr msg) {
uint64_t sindex = msg->snapshot.metadata.index;
uint64_t sterm = msg->snapshot.metadata.term;
if (restore(msg->snapshot)) {
LOG_INFO("%lu [commit: %lu] restored snapshot [index: %lu, term: %lu]",
id_, raft_log_->committed_, sindex, sterm);
proto::MessagePtr m(new proto::Message());
m->to = msg->from;
m->type = proto::MsgAppResp;
msg->index = raft_log_->last_index();
send(std::move(m));
} else {
LOG_INFO("%lu [commit: %lu] ignored snapshot [index: %lu, term: %lu]",
id_, raft_log_->committed_, sindex, sterm);
proto::MessagePtr m(new proto::Message());
m->to = msg->from;
m->type = proto::MsgAppResp;
msg->index = raft_log_->committed_;
send(std::move(m));
}
}
bool Raft::restore(const proto::Snapshot& s) {
if (s.metadata.index <= raft_log_->committed_) {
return false;
}
if (raft_log_->match_term(s.metadata.index, s.metadata.term)) {
LOG_INFO(
"%lu [commit: %lu, last_index: %lu, last_term: %lu] fast-forwarded commit to snapshot [index: %lu, term: %lu]",
id_,
raft_log_->committed_,
raft_log_->last_index(),
raft_log_->last_term(),
s.metadata.index,
s.metadata.term);
raft_log_->commit_to(s.metadata.index);
return false;
}
// The normal peer can't become learner.
if (!is_learner_) {
for (uint64_t id : s.metadata.conf_state.learners) {
if (id == id_) {
LOG_ERROR("%lu can't become learner when restores snapshot [index: %lu, term: %lu]",
id_,
s.metadata.index,
s.metadata.term);
return false;
}
}
}
LOG_INFO("%lu [commit: %lu, last_index: %lu, last_term: %lu] starts to restore snapshot [index: %lu, term: %lu]",
id_,
raft_log_->committed_,
raft_log_->last_index(),
raft_log_->last_term(),
s.metadata.index,
s.metadata.term);
proto::SnapshotPtr snap(new proto::Snapshot(s));
raft_log_->restore(snap);
prs_.clear();
learner_prs_.clear();
restore_node(s.metadata.conf_state.nodes, false);
restore_node(s.metadata.conf_state.learners, true);
return true;
}
void Raft::tick() {
if (tick_) {
tick_();
} else {
LOG_WARN("tick function is not set");
}
}
SoftStatePtr Raft:: soft_state() const {
return std::make_shared<SoftState>(lead_, state_);
}
proto::HardState Raft::hard_state() const {
proto::HardState hs;
hs.term = term_;
hs.vote = vote_;
hs.commit = raft_log_->committed_;
return hs;
}
void Raft::load_state(const proto::HardState& state) {
if (state.commit < raft_log_->committed_ || state.commit > raft_log_->last_index()) {
LOG_FATAL("%lu state.commit %lu is out of range [%lu, %lu]",
id_,
state.commit,
raft_log_->committed_,
raft_log_->last_index());
}
raft_log_->committed_ = state.commit;
term_ = state.term;
vote_ = state.vote;
}
void Raft::nodes(std::vector<uint64_t>& node) const {
for (auto it = prs_.begin(); it != prs_.end(); ++it) {
node.push_back(it->first);
}
std::sort(node.begin(), node.end());
}
void Raft::learner_nodes(std::vector<uint64_t>& learner) const {
for (auto it = learner_prs_.begin(); it != prs_.end(); ++it) {
learner.push_back(it->first);
}
std::sort(learner.begin(), learner.end());
}
ProgressPtr Raft::get_progress(uint64_t id) {
auto it = prs_.find(id);
if (it != prs_.end()) {
return it->second;
}
it = learner_prs_.find(id);
if (it != learner_prs_.end()) {
return it->second;
}
return nullptr;
}
void Raft::set_progress(uint64_t id, uint64_t match, uint64_t next, bool is_learner) {
if (!is_learner) {
learner_prs_.erase(id);
ProgressPtr progress(new Progress(max_inflight_));
progress->next = next;
progress->match = match;
prs_[id] = progress;
return;
}
auto it = prs_.find(id);
if (it != prs_.end()) {
LOG_FATAL("%lu unexpected changing from voter to learner for %lu", id_, id);
}
ProgressPtr progress(new Progress(max_inflight_));
progress->next = next;
progress->match = match;
progress->is_learner = true;
learner_prs_[id] = progress;
}
void Raft::del_progress(uint64_t id) {
prs_.erase(id);
learner_prs_.erase(id);
}
void Raft::send_append(uint64_t to) {
maybe_send_append(to, true);
}
bool Raft::maybe_send_append(uint64_t to, bool send_if_empty) {
ProgressPtr pr = get_progress(to);
if (pr->is_paused()) {
return false;
}
proto::MessagePtr msg(new proto::Message());
msg->to = to;
uint64_t term = 0;
Status status_term = raft_log_->term(pr->next - 1, term);
std::vector<proto::EntryPtr> entries;
Status status_entries = raft_log_->entries(pr->next, max_msg_size_, entries);
if (entries.empty() && !send_if_empty) {
return false;
}
if (!status_term.is_ok() || !status_entries.is_ok()) { // send snapshot if we failed to get term or entries
if (!pr->recent_active) {
LOG_DEBUG("ignore sending snapshot to %lu since it is not recently active", to)
return false;
}
msg->type = proto::MsgSnap;
proto::SnapshotPtr snap;
Status status = raft_log_->snapshot(snap);
if (!status.is_ok()) {
LOG_FATAL("snapshot error %s", status.to_string().c_str());
}
if (snap->is_empty()) {
LOG_FATAL("need non-empty snapshot");
}
uint64_t sindex = snap->metadata.index;
uint64_t sterm = snap->metadata.term;
LOG_DEBUG("%lu [first_index: %lu, commit: %lu] sent snapshot[index: %lu, term: %lu] to %lu [%s]",
id_, raft_log_->first_index(), raft_log_->committed_, sindex, sterm, to, pr->string().c_str());
pr->become_snapshot(sindex);
msg->snapshot = *snap;
LOG_DEBUG("%lu paused sending replication messages to %lu [%s]", id_, to, pr->string().c_str());
} else {
msg->type = proto::MsgApp;
msg->index = pr->next - 1;
msg->log_term = term;
for (proto::EntryPtr& entry: entries) {
//copy
msg->entries.emplace_back(*entry);
}
msg->commit = raft_log_->committed_;
if (!msg->entries.empty()) {
switch (pr->state) {
// optimistically increase the next when in ProgressStateReplicate
case ProgressStateReplicate: {
uint64_t last = msg->entries.back().index;
pr->optimistic_update(last);
pr->inflights->add(last);
break;
}
case ProgressStateProbe: {
pr->set_pause();
break;
}
default: {
LOG_FATAL("%lu is sending append in unhandled state %s", id_, progress_state_to_string(pr->state));
}
}
}
}
send(std::move(msg));
return true;
}
void Raft::send_heartbeat(uint64_t to, std::vector<uint8_t> ctx) {
// Attach the commit as min(to.matched, r.committed).
// When the leader sends out heartbeat message,
// the receiver(follower) might not be matched with the leader
// or it might not have all the committed entries.
// The leader MUST NOT forward the follower's commit to
// an unmatched index.
uint64_t commit = std::min(get_progress(to)->match, raft_log_->committed_);
proto::MessagePtr msg(new proto::Message());
msg->to = to;
msg->type = proto::MsgHeartbeat;
msg->commit = commit;
msg->context = std::move(ctx);
send(std::move(msg));
}
void Raft::for_each_progress(const std::function<void(uint64_t, ProgressPtr&)>& callback) {
for (auto it = prs_.begin(); it != prs_.end(); ++it) {
callback(it->first, it->second);
}
for (auto it = learner_prs_.begin(); it != learner_prs_.end(); ++it) {
callback(it->first, it->second);
}
}
void Raft::bcast_append() {
for_each_progress([this](uint64_t id, ProgressPtr& progress) {
if (id == id_) {
return;
}
this->send_append(id);
});
}
void Raft::bcast_heartbeat() {
std::vector<uint8_t> ctx;
read_only_->last_pending_request_ctx(ctx);
bcast_heartbeat_with_ctx(std::move(ctx));
}
void Raft::bcast_heartbeat_with_ctx(const std::vector<uint8_t>& ctx) {
for_each_progress([this, ctx](uint64_t id, ProgressPtr& progress) {
if (id == id_) {
return;
}
this->send_heartbeat(id, std::move(ctx));
});
}
bool Raft::maybe_commit() {
// Preserving matchBuf across calls is an optimization
// used to avoid allocating a new slice on each call.
match_buf_.clear();
for (auto it = prs_.begin(); it != prs_.end(); ++it) {
match_buf_.push_back(it->second->match);
}
std::sort(match_buf_.begin(), match_buf_.end());
auto mci = match_buf_[match_buf_.size() - quorum()];
return raft_log_->maybe_commit(mci, term_);
}
void Raft::reset(uint64_t term) {
if (term_ != term) {
term_ = term;
vote_ = 0;
}
lead_ = 0;
election_elapsed_ = 0;
heartbeat_elapsed_ = 0;
reset_randomized_election_timeout();
abort_leader_transfer();
votes_.clear();
for_each_progress([this](uint64_t id, ProgressPtr& progress) {
bool is_learner = progress->is_learner;
progress = std::make_shared<Progress>(max_inflight_);
progress->next = raft_log_->last_index() + 1;
progress->is_learner = is_learner;
if (id == id_) {
progress->match = raft_log_->last_index();
}
});
pending_conf_index_ = 0;
uncommitted_size_ = 0;
read_only_->pending_read_index.clear();
read_only_->read_index_queue.clear();
}
void Raft::add_node(uint64_t id) {
add_node_or_learner(id, false);
}
bool Raft::append_entry(const std::vector<proto::Entry>& entries) {
uint64_t li = raft_log_->last_index();
std::vector<proto::EntryPtr> ents(entries.size(), nullptr);
for (size_t i = 0; i < entries.size(); ++i) {
proto::EntryPtr ent(new proto::Entry());
ent->term = term_;
ent->index = li + 1 + i;
ent->data = entries[i].data;
ent->type = entries[i].type;
ents[i] = ent;
}
// Track the size of this uncommitted proposal.
if (!increase_uncommitted_size(ents)) {
LOG_DEBUG("%lu appending new entries to log would exceed uncommitted entry size limit; dropping proposal", id_);
// Drop the proposal.
return false;
}
// use latest "last" index after truncate/append
li = raft_log_->append(ents);
get_progress(id_)->maybe_update(li);
// Regardless of maybeCommit's return, our caller will call bcastAppend.
maybe_commit();
return true;
}
void Raft::tick_election() {
election_elapsed_++;
if (promotable() && past_election_timeout()) {
election_elapsed_ = 0;
proto::MessagePtr msg(new proto::Message());
msg->from = id_;
msg->type = proto::MsgHup;
step(std::move(msg));
}
}
void Raft::tick_heartbeat() {
heartbeat_elapsed_++;
election_elapsed_++;
if (election_elapsed_ >= election_timeout_) {
election_elapsed_ = 0;
if (check_quorum_) {
proto::MessagePtr msg(new proto::Message());
msg->from = id_;
msg->type = proto::MsgCheckQuorum;
step(std::move(msg));
}
// If current leader cannot transfer leadership in electionTimeout, it becomes leader again.
if (state_ == RaftState::Leader && lead_transferee_ != 0) {
abort_leader_transfer();
}
}
if (state_ != RaftState::Leader) {
return;
}
if (heartbeat_elapsed_ >= heartbeat_timeout_) {
heartbeat_elapsed_ = 0;
proto::MessagePtr msg(new proto::Message());
msg->from = id_;
msg->type = proto::MsgBeat;
step(std::move(msg));
}
}
bool Raft::past_election_timeout() {
return election_elapsed_ >= randomized_election_timeout_;
}
void Raft::reset_randomized_election_timeout() {
randomized_election_timeout_ = election_timeout_ + random_device_.gen();
assert(randomized_election_timeout_ <= 2 * election_timeout_);
}
bool Raft::check_quorum_active() {
size_t act = 0;
for_each_progress([&act, this](uint64_t id, ProgressPtr& pr) {
if (id == this->id_) {
act++;
return;
}
if (pr->recent_active && !pr->is_learner) {
act++;
}
});
return act >= quorum();
}
void Raft::send_timeout_now(uint64_t to) {
proto::MessagePtr msg(new proto::Message());
msg->to = to;
msg->type = proto::MsgTimeoutNow;
send(std::move(msg));
}
void Raft::abort_leader_transfer() {
lead_transferee_ = 0;
}
bool Raft::increase_uncommitted_size(const std::vector<proto::EntryPtr>& entries) {
uint32_t s = 0;
for (auto& entry : entries) {
s += entry->payload_size();
}
if (uncommitted_size_ > 0 && uncommitted_size_ + s > max_uncommitted_size_) {
// If the uncommitted tail of the Raft log is empty, allow any size
// proposal. Otherwise, limit the size of the uncommitted tail of the
// log and drop any proposal that would push the size over the limit.
return false;
}
uncommitted_size_ += s;
return true;
}
void Raft::reduce_uncommitted_size(const std::vector<proto::EntryPtr>& entries) {
if (uncommitted_size_ == 0) {
// Fast-path for followers, who do not track or enforce the limit.
return;
}
uint32_t size = 0;
for (const proto::EntryPtr& e: entries) {
size += e->payload_size();
}
if (size > uncommitted_size_) {
// uncommittedSize may underestimate the size of the uncommitted Raft
// log tail but will never overestimate it. Saturate at 0 instead of
// allowing overflow.
uncommitted_size_ = 0;
} else {
uncommitted_size_ -= size;
}
}
} | {"hexsha": "56dab223ffb1494840a672aef41ec292f0695625", "size": 51271, "ext": "cpp", "lang": "C++", "max_stars_repo_path": "raft-kv/raft/raft.cpp", "max_stars_repo_name": "jinyyu/kvd", "max_stars_repo_head_hexsha": "f3a2f7944b037ee59f26e7e8bf69024686023fd0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2.0, "max_stars_repo_stars_event_min_datetime": "2019-04-18T15:15:20.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-16T03:01:16.000Z", "max_issues_repo_path": "raft-kv/raft/raft.cpp", "max_issues_repo_name": "jinyyu/kvd", "max_issues_repo_head_hexsha": "f3a2f7944b037ee59f26e7e8bf69024686023fd0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "raft-kv/raft/raft.cpp", "max_forks_repo_name": "jinyyu/kvd", "max_forks_repo_head_hexsha": "f3a2f7944b037ee59f26e7e8bf69024686023fd0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.0567375887, "max_line_length": 161, "alphanum_fraction": 0.6059955921, "num_tokens": 13246} |
import math, sys, datetime
import logging
import numpy as np
from tqdm.auto import tqdm
import torch
import torch.optim as optim
from torch.optim.lr_scheduler import LambdaLR
from torch.utils.data.dataloader import DataLoader
logger = logging.getLogger(__name__)
# print('logging to wandb... (comment it if you don\'t have wandb)')
# import wandb # comment this if you don't have wandb
class TrainerConfig:
max_epochs = 10
batch_size = 64
learning_rate = 4e-4
betas = (0.9, 0.99)
eps = 1e-8
grad_norm_clip = 1.0
weight_decay = 0.01
lr_decay = False # linear warmup followed by cosine decay
warmup_tokens = 375e6 # these two numbers come from the GPT-3 paper
final_tokens = 260e9 # at which point do we reach lr_final
epoch_save_frequency = 0
epoch_save_path = 'trained-'
num_workers = 0 # for DataLoader
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
class Trainer:
def __init__(self, model, train_dataset, test_dataset, config):
self.model = model
self.train_dataset = train_dataset
self.test_dataset = test_dataset
self.config = config
self.avg_loss = -1
self.steps = 0
if 'wandb' in sys.modules:
cfg = model.config
for k in config.__dict__:
setattr(cfg, k, config.__dict__[k]) # combine cfg
wandb.init(project="RWKV-LM", name=self.get_run_name() + '-' + datetime.datetime.today().strftime('%Y-%m-%d-%H-%M-%S'), config=cfg,
save_code=False)
self.device = 'cpu'
if torch.cuda.is_available(): # take over whatever gpus are on the system
self.device = torch.cuda.current_device()
self.model = torch.nn.DataParallel(self.model).to(self.device)
def get_run_name(self):
raw_model = self.model.module if hasattr(self.model, "module") else self.model
cfg = raw_model.config
run_name = str(cfg.vocab_size) + '-' + str(cfg.ctx_len) + '-' + cfg.model_type + '-' + str(cfg.n_layer) + '-' + str(cfg.n_embd)
return run_name
def train(self):
model, config = self.model, self.config
raw_model = model.module if hasattr(self.model, "module") else model
optimizer = raw_model.configure_optimizers(config)
def run_epoch(split):
is_train = split == 'train'
model.train(is_train)
data = self.train_dataset if is_train else self.test_dataset
loader = DataLoader(data, shuffle=True, pin_memory=True,
batch_size=config.batch_size,
num_workers=config.num_workers)
pbar = tqdm(enumerate(loader), total=len(loader), bar_format='{l_bar}{bar:10}{r_bar}{bar:-10b}') if is_train else enumerate(loader)
for it, (x, y) in pbar:
x = x.to(self.device) # place data on the correct device
y = y.to(self.device)
with torch.set_grad_enabled(is_train):
_, loss = model(x, y) # forward the model
loss = loss.mean() # collapse all losses if they are scattered on multiple gpus
if is_train: # backprop and update the parameters
model.zero_grad()
loss.backward()
torch.nn.utils.clip_grad_norm_(model.parameters(), config.grad_norm_clip)
optimizer.step()
if config.lr_decay: # decay the learning rate based on our progress
self.tokens += (y >= 0).sum() # number of tokens processed this step (i.e. label is not -100)
lr_final_factor = config.lr_final / config.learning_rate
if self.tokens < config.warmup_tokens:
# linear warmup
lr_mult = lr_final_factor + (1 - lr_final_factor) * float(self.tokens) / float(config.warmup_tokens)
progress = 0
else:
# cosine learning rate decay
progress = float(self.tokens - config.warmup_tokens) / float(max(1, config.final_tokens - config.warmup_tokens))
# progress = min(progress * 1.1, 1.0) # more fine-tuning with low LR
lr_mult = (0.5 + lr_final_factor / 2) + (0.5 - lr_final_factor / 2) * math.cos(math.pi * progress) # better 1.0 ~ 0.1
lr = config.learning_rate * lr_mult
for param_group in optimizer.param_groups:
param_group['lr'] = lr
else:
lr = config.learning_rate
now_loss = loss.item() # report progress
if 'wandb' in sys.modules:
wandb.log({"loss": now_loss}, step=self.steps * self.config.batch_size)
self.steps += 1
if self.avg_loss < 0:
self.avg_loss = now_loss
else:
# factor = max(1.0 / 300, 1.0 / math.sqrt(it + 1))
factor = 1 / (it + 1)
self.avg_loss = self.avg_loss * (1.0 - factor) + now_loss * factor
pbar.set_description(
f"epoch {epoch + 1} progress {progress * 100.0:.2f}% iter {it}: ppl {math.exp(self.avg_loss):.2f} loss {self.avg_loss:.4f} lr {lr:e}")
while True:
self.tokens = 0 # counter used for learning rate decay
for epoch in range(config.max_epochs):
run_epoch('train')
if (self.config.epoch_save_frequency > 0 and epoch % self.config.epoch_save_frequency == 0) or (epoch == config.max_epochs - 1):
raw_model = self.model.module if hasattr(self.model,
"module") else self.model # DataParallel wrappers keep raw model object in .module
torch.save(raw_model, self.config.epoch_save_path + str(epoch + 1) + '.pth') | {"hexsha": "12fc4aa1f4c4214e30d2facecb3c3470f8fe8484", "size": 6217, "ext": "py", "lang": "Python", "max_stars_repo_path": "src/trainer.py", "max_stars_repo_name": "ofooo/AI-Writer", "max_stars_repo_head_hexsha": "1ba84894c15c9e5605d3c6cd7521d5c6dab6eb6d", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/trainer.py", "max_issues_repo_name": "ofooo/AI-Writer", "max_issues_repo_head_hexsha": "1ba84894c15c9e5605d3c6cd7521d5c6dab6eb6d", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/trainer.py", "max_forks_repo_name": "ofooo/AI-Writer", "max_forks_repo_head_hexsha": "1ba84894c15c9e5605d3c6cd7521d5c6dab6eb6d", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.7132352941, "max_line_length": 158, "alphanum_fraction": 0.5584687148, "include": true, "reason": "import numpy", "num_tokens": 1392} |
###PROCESS LOCALLY DOWNLOADED FILES
###FOR JAXA EORC GSMAP-RT PRODUCT
##############################
import sys
# print sys.path
print 'starting'
##IMPORT MODULES
import datetime as dt
import pytz
import urllib
import numpy as np
import numpy.ma as ma
import gzip
import os
##############################
##SET DIRECTORY PATH AND DATA LATENCY
rdhead = 'ftp://rainmap:[email protected]/realtime/archive/'
rdext = '.dat.gz'
savdirraw = '/d2/dbroman/gsmap-nrt/raw/'
savdirproc = '/d2/dbroman/gsmap-nrt/india/'
dattyp = np.dtype('<f4')
lonlen = 3600
latlen = 1200
lonvec = np.arange(0.05, 360, 0.1)
latvec = np.arange(-59.95, 60, 0.1)
hlag = 5
#INDIA SUBSET BOUNDS
latbounds = [22 , 32]
lonbounds = [73 , 98]
latli = np.argmin(np.abs(latvec - latbounds[0]))
latui = np.argmin(np.abs(latvec - latbounds[1]))
lonli = np.argmin(np.abs(lonvec - lonbounds[0]))
lonui = np.argmin(np.abs(lonvec - lonbounds[1]))
##############################
utc = pytz.utc
#yyyy,m,d,h,m,s,ss
# ds = dt.datetime(2016,8,8,2,0,0,0, utc) #set start time
# d = dt.datetime(2016,8,8,21,0,0,0, utc) #set end time
d = dt.datetime.now(tz = utc) - dt.timedelta(hours = hlag)
# numhours = int((d-ds).total_seconds() / 60 / 60) + 2
numhours = 720
dlist = [d - dt.timedelta(hours = x) for x in range(0, numhours)]
for i in range(0, numhours-1):
year = str(dlist[i].year)
month = str('%02d' % (int(dlist[i].month)))
day = str('%02d' % (int(dlist[i].day)))
hour = str('%04d' % (int(dlist[i].hour) * 100))
url = rdhead + year + '/' + month + '/' + day + '/' + 'gsmap_nrt.' + year + month + day + '.' + hour + rdext
binsav = savdirraw + 'gsmap_nrt.' + year + month + day + '.' + hour + rdext
binsubsav = savdirproc + 'gsmap_nrt_indiasub.' + year + month + day + '.' + hour + '.bin'
if os.path.isfile(binsubsav) is False:
if os.path.isfile(binsav) is False:
try:
# urllib.urlretrieve(url, binsav)
os.system('wget ' + url + ' -O ' + binsav)
except (RuntimeError, TypeError, NameError, IOError):
continue
#OPEN FILE INTO NP ARRAY
try:
varin = gzip.open(binsav)
var = np.frombuffer(varin.read(), dtype = dattyp).reshape(latlen, lonlen).swapaxes(0,1)
var = np.fliplr(var)
#SUBSET TO INDIA
varsub = var[lonli:lonui, latli:latui]
#SAVE SUBSET FILE
varsub.astype('int16').tofile(binsubsav)
except (RuntimeError, TypeError, NameError, IOError):
continue
| {"hexsha": "0ccd8a7717d2a502927d78495c1a0b4189721072", "size": 2596, "ext": "py", "lang": "Python", "max_stars_repo_path": "get_gsmap_backfill.py", "max_stars_repo_name": "dpbroman/satrain", "max_stars_repo_head_hexsha": "a71d5829be6e5c08f6ae29b773b96ad724301515", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "get_gsmap_backfill.py", "max_issues_repo_name": "dpbroman/satrain", "max_issues_repo_head_hexsha": "a71d5829be6e5c08f6ae29b773b96ad724301515", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "get_gsmap_backfill.py", "max_forks_repo_name": "dpbroman/satrain", "max_forks_repo_head_hexsha": "a71d5829be6e5c08f6ae29b773b96ad724301515", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.7142857143, "max_line_length": 112, "alphanum_fraction": 0.5816640986, "include": true, "reason": "import numpy", "num_tokens": 831} |
# test_hscimgloader.py
# ALS 2017/05/02
"""
to be used with pytest
test sets for hscimgloader
"""
import numpy as np
import astropy.units as u
import shutil
import os
import pytest
from astropy.io import fits
import filecmp
import glob
from ..hscimgloader import hscimgLoader
ra = 140.099341430207
dec = 0.580162492432517
dir_parent = './testing/'
dir_obj = './testing/SDSSJ0920+0034/'
img_width = 128*u.pix
img_height = 128*u.pix
@pytest.fixture(scope="module", autouse=True)
def setUp_tearDown():
""" rm ./testing/ and ./test2/ before and after test"""
# setup
if os.path.isdir(dir_parent):
shutil.rmtree(dir_parent)
yield
# tear down
if os.path.isdir(dir_parent):
shutil.rmtree(dir_parent)
@pytest.fixture
def L_radec():
""" returns a imgLoader object initiated with the ra dec above"""
return hscimgLoader(ra=ra , dec=dec, dir_parent=dir_parent, img_width=img_width, img_height=img_height)
def test_make_stamp(L_radec):
""" test it can make_stamp"""
L = L_radec
L.make_stamp(band = 'r', overwrite=True)
L.make_stamp(band = 'i', overwrite=True)
L.make_stamp(band = 'z', overwrite=True)
L.plot_colorimg(img_type='stamp', bands ='riz')
assert os.path.isfile(L.dir_obj+'color_stamp-riz.png')
| {"hexsha": "31e50333213f4e704d3bc3362b7a449a7f71ecc7", "size": 1227, "ext": "py", "lang": "Python", "max_stars_repo_path": "bubbleimg/imgdownload/hsc/test/test_hscimgloader_plotcolorimg.py", "max_stars_repo_name": "aileisun/bubblepy", "max_stars_repo_head_hexsha": "054e7a3993659e7002f243c75253c2cb71d4fa73", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2017-11-20T23:16:09.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-19T09:38:01.000Z", "max_issues_repo_path": "bubbleimg/imgdownload/hsc/test/test_hscimgloader_plotcolorimg.py", "max_issues_repo_name": "aileisun/bubblepy", "max_issues_repo_head_hexsha": "054e7a3993659e7002f243c75253c2cb71d4fa73", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "bubbleimg/imgdownload/hsc/test/test_hscimgloader_plotcolorimg.py", "max_forks_repo_name": "aileisun/bubblepy", "max_forks_repo_head_hexsha": "054e7a3993659e7002f243c75253c2cb71d4fa73", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2017-07-17T09:31:11.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-19T09:38:07.000Z", "avg_line_length": 20.45, "max_line_length": 104, "alphanum_fraction": 0.7351263244, "include": true, "reason": "import numpy,import astropy,from astropy", "num_tokens": 346} |
subroutine tprnc(abeta,alamnc,incpr,ipbtmx,jpfcmx,natmax,
$ ncvnc,nerr,nncpr,noutpt,npx2mx,npx2t,nttyo,nwarn,pcvnc,
$ qpdnc,uaqsp,upair)
c
c Test and process the nc (neutral, cation) pair Pitzer data read
c from the DATA0 file. Find and flag errors, such as duplication of
c data (e.g., two data blocks for the same nc pair). The
c conventional primitive Pitzer parameters are identical to the
c observable parameters read from the data file:
c
c lambda(nc) -> lambda(nc)
c
c Check the coverage of entered Pitzer data against all possible
c nc pairs that can be composed of the aqueous neutral species and
c cations present on the data file.
c
c This subroutine is called by:
c
c EQPT/eqpt.f
c
c-----------------------------------------------------------------------
c
c Principal input:
c
c nat = the number of aqueous species
c uaqsp = array of names of aqueous species
c
c Principal output:
c
c nerr = cumulative error counter
c nwarn = cumulative warning counter
c
c-----------------------------------------------------------------------
c
implicit none
c
c-----------------------------------------------------------------------
c
c Calling sequence variable declarations.
c
integer ipbtmx,jpfcmx,natmax,nncpr,npx2mx
c
integer noutpt,nttyo
c
integer incpr(2,nncpr)
c
integer ncvnc,nerr,npx2t,nwarn
c
logical qpdnc(nncpr)
c
character(len=24) uaqsp(natmax),upair(2,npx2mx)
c
real*8 abeta(jpfcmx,0:ipbtmx,npx2mx),
$ alamnc(jpfcmx,0:ipbtmx,nncpr)
c
real*8 pcvnc
c
c-----------------------------------------------------------------------
c
c Local variable declarations.
c
integer i,j,jp,jpair,j2,j3,j4,j5,n,ncount,ndupl,nlistl,
$ nn,nodatc
c
integer ilnobl
c
character*56 ustr56
character*24 unam1,unam2
character*8 ux8
c
c-----------------------------------------------------------------------
c
c Limit on the list of pairs for which no data were found.
c
data nlistl / 20 /
c
c-----------------------------------------------------------------------
c
c Initialize the data arrays.
c
do n = 1,nncpr
qpdnc(n) = .false.
do j = 1,jpfcmx
do i = 0,ipbtmx
alamnc(j,i,n) = 0.
enddo
enddo
enddo
c
c Check the entered data for nc pairs.
c
nodatc = 0
c
do n = 1,nncpr
i = incpr(1,n)
j = incpr(2,n)
unam1 = uaqsp(i)
unam2 = uaqsp(j)
c
c Search for unam1, unam2 in the upair array.
c That array corresponds to the species pairs blocks.
c
call srch22(jpair,unam1,unam2,upair,npx2mx,npx2t)
c
if (jpair .gt. 0) then
c
c Have found an entry.
c
qpdnc(n) = .true.
c
c Store the data.
c
do j = 1,jpfcmx
do i = 0,ipbtmx
alamnc(j,i,n) = abeta(j,i,jpair)
enddo
enddo
c
c Check for duplicate data sets.
c
ndupl = 0
do jp = jpair + 1,npx2t
if (unam1(1:24) .eq. upair(1,jp)(1:24)) then
if (unam2(1:24) .eq. upair(2,jp)(1:24)) then
ndupl = ndupl + 1
endif
endif
enddo
c
if (ndupl .gt. 0) then
j2 = ilnobl(unam1)
j3 = ilnobl(unam2)
if (ndupl .eq. 1) then
write (noutpt,1010) unam1(1:j2),unam2(1:j3)
write (nttyo,1010) unam1(1:j2),unam2(1:j3)
1010 format(/' * Error - (EQPT/tprnc) Have found a',
$ ' duplicate data block on the DATA0 file',
$ /7x,'for the nc pair ',a,', ',a,'.')
else
ux8 = ' '
write (ux8,'(i5)') ndupl
call lejust(ux8)
j5 = ilnobl(ux8)
write (noutpt,1020) ux8(1:j5),unam1(1:j2),unam2(1:j3)
write (nttyo,1020) ux8(1:j5),unam1(1:j2),unam2(1:j3)
1020 format(/' * Error - (EQPT/tprnc) Have found ',a,
$ ' duplicate data blocks on the DATA0 file',
$ /7x,'for the nc pair ',a,', ',a,'.')
endif
nerr = nerr + ndupl
endif
c
else
c
c No data block was found on the DATA0 file.
c Note that qpdnc(n) is left with a value of .false.
c
nodatc = nodatc + 1
endif
c
enddo
c
c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
c
if (nodatc .gt. 0) then
write (noutpt,1040)
write (nttyo,1040)
1040 format(/' * Warning - (EQPT/tprnc) Did not find a data',
$ ' block on the DATA0 file',/7x,'for any of the following',
$ ' nc pairs:',/)
c
ncount = 0
do n = 1,nncpr
if (.not.qpdnc(n)) then
ncount = ncount + 1
i = incpr(1,n)
j = incpr(2,n)
unam1 = uaqsp(i)
unam2 = uaqsp(j)
j2 = ilnobl(unam1)
j3 = ilnobl(unam2)
ustr56 = unam1(1:j2) // ', ' // unam2(1:j3)
j4 = ilnobl(ustr56)
write (noutpt,1050) ustr56(1:j4)
write (nttyo,1050) ustr56(1:j4)
1050 format(9x,a)
if (ncount .eq. nlistl) go to 200
endif
enddo
200 continue
c
nn = nodatc - ncount
if (nn .gt. 0) then
write (ux8,'(i5)') nn
call lejust(ux8)
j3 = ilnobl(ux8)
write (noutpt,1060) ux8(1:j3)
write (nttyo,1060) ux8(1:j3)
1060 format(/9x,'plus ',a,' others')
endif
write (noutpt,1070)
write (nttyo,1070)
1070 format(1x)
nwarn = nwarn + 1
endif
c
ncvnc = nncpr - nodatc
pcvnc = (100.*ncvnc)/float(nncpr)
c
c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
c
end
| {"hexsha": "166cb1020cbe41a08467a0a2762c554bbed7b7c0", "size": 5867, "ext": "f", "lang": "FORTRAN", "max_stars_repo_path": "src/eqpt/src/tprnc.f", "max_stars_repo_name": "39alpha/eq3_6", "max_stars_repo_head_hexsha": "4ff7eec3d34634f1470ae5f67d8e294694216b6e", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/eqpt/src/tprnc.f", "max_issues_repo_name": "39alpha/eq3_6", "max_issues_repo_head_hexsha": "4ff7eec3d34634f1470ae5f67d8e294694216b6e", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 6, "max_issues_repo_issues_event_min_datetime": "2021-11-30T15:48:52.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T18:16:22.000Z", "max_forks_repo_path": "src/eqpt/src/tprnc.f", "max_forks_repo_name": "39alpha/eq3_6", "max_forks_repo_head_hexsha": "4ff7eec3d34634f1470ae5f67d8e294694216b6e", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.544600939, "max_line_length": 72, "alphanum_fraction": 0.4888358616, "num_tokens": 1964} |
import ast
import os
import re
from glob import glob
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from loren_frank_data_processing import make_tetrode_dataframe
from src.figure_utilities import PAGE_HEIGHT, TWO_COLUMN, save_figure
from src.parameters import (_BRAIN_AREAS, ANIMALS, PROBABILITY_THRESHOLD,
PROCESSED_DATA_DIR, SHORT_STATE_ORDER,
STATE_COLORS, STATE_ORDER)
from src.visualization import (SHORT_STATE_NAMES, _plot_category,
plot_category_duration,
plot_linear_position_markers,
plot_replay_distance_from_actual_position)
from upsetplot import UpSet
def load_replay_info(
n_unique_spiking=2,
data_type="clusterless",
dim="1D",
probability_threshold=PROBABILITY_THRESHOLD,
speed_threshold=4,
exclude_interneuron_spikes=False
):
tetrode_info = make_tetrode_dataframe(ANIMALS)
prob = int(probability_threshold * 100)
if exclude_interneuron_spikes:
interneuron = 'no_interneuron_'
else:
interneuron = ''
file_regex = f"*_{data_type}_{dim}_{interneuron}replay_info_{prob:02d}.csv"
file_paths = glob(os.path.join(PROCESSED_DATA_DIR, file_regex))
replay_info = pd.concat(
[pd.read_csv(file_path) for file_path in file_paths], axis=0,
).set_index(["animal", "day", "epoch", "ripple_number"])
replay_info = replay_info.loc[
(replay_info.n_unique_spiking >= n_unique_spiking) &
(replay_info.actual_speed <= speed_threshold)
].sort_index()
is_brain_areas = tetrode_info.area.astype(
str).str.upper().isin(_BRAIN_AREAS)
n_tetrodes = (
tetrode_info.loc[is_brain_areas]
.groupby(["animal", "day", "epoch"])
.tetrode_id.count()
.rename("n_tetrodes")
)
replay_info = pd.merge(
replay_info.reset_index(), pd.DataFrame(n_tetrodes).reset_index()
).set_index(["animal", "day", "epoch", "ripple_number"])
for state in STATE_ORDER:
replay_info[f"{state}_pct_unique_spiking"] = (
replay_info[f"{state}_n_unique_spiking"] /
replay_info["n_tetrodes"]
)
replay_info = replay_info.rename(index={"Cor": "cor"}).rename_axis(
index={"animal": "Animal ID"}
)
return replay_info
def plot_category_counts(replay_info):
df = (replay_info
.loc[replay_info.is_classified]
.rename(columns=SHORT_STATE_NAMES)
.set_index(SHORT_STATE_ORDER[::-1]))
upset = UpSet(
df,
sort_sets_by=None,
show_counts=False,
subset_size="count",
sort_by="cardinality",
intersection_plot_elements=5,
)
ax_dict = upset.plot()
n_classified = replay_info.is_classified.sum()
_, intersect_max = ax_dict["intersections"].get_ylim()
ax_dict["intersections"].set_yticks(n_classified * np.arange(0, 0.6, 0.1))
ax_dict["intersections"].set_yticklabels(range(0, 60, 10))
ax_dict["intersections"].set_ylabel(
"Percentage\nof Ripples",
ha="center",
va="center",
rotation="horizontal",
labelpad=30,
)
ax_dict["intersections"].text(
9, n_classified * 0.45, f"N = {n_classified}", zorder=1000, fontsize=9
)
ax_dict["totals"].set_xticks([0, 0.5 * n_classified])
ax_dict["totals"].set_xticklabels([0, 50])
ax_dict["totals"].set_xlabel("Marginal Percentage\nof Ripples")
ax_dict["totals"].set_ylim([-0.5, len(SHORT_STATE_ORDER) - 1 + 0.4])
plt.suptitle("Most Common Combinations of Classifications per Ripple",
fontsize=14, x=0.55, y=0.925)
for i, color in enumerate(STATE_ORDER):
rect = plt.Rectangle(
xy=(0, len(STATE_ORDER) - i - 1.4),
width=1,
height=0.8,
facecolor=STATE_COLORS[color],
lw=0,
zorder=0,
alpha=0.25,
)
ax_dict["shading"].add_patch(rect)
save_figure(os.path.join("Figure5", "figure5_category_counts"))
def convert_object_to_array(fixed_string):
pattern = r"""# Match (mandatory) whitespace between...
(?<=\]) # ] and
\s+
(?= \[) # [, or
|
(?<=[^\[\]\s])
\s+
(?= [^\[\]\s]) # two non-bracket non-whitespace characters
"""
# Replace such whitespace with a comma
fixed_string = re.sub(pattern, ",", fixed_string, flags=re.VERBOSE)
return np.array(ast.literal_eval(fixed_string))
def get_norm_linear_position(replay_info):
non_local_stationary = replay_info.loc[
replay_info.Hover_replay_distance_from_actual_position > 30
]
norm_linear_position = []
for ripple_id, df in non_local_stationary.iterrows():
try:
temp = (
convert_object_to_array(df.Hover_replay_linear_position)
/ df.left_well_position
)
for pos in temp:
norm_linear_position.append(pos)
except TypeError:
norm_linear_position.append(
df.Hover_replay_linear_position / df.left_well_position
)
return np.asarray(norm_linear_position)
def plot_stats(replay_info, saturation=0.7, fliersize=1.0):
fig, axes = plt.subplots(
nrows=2, ncols=2, figsize=(TWO_COLUMN, PAGE_HEIGHT / 2),
constrained_layout=True
)
# Duration of Dynamic
plot_category_duration(
replay_info, kind="box", ax=axes[0, 0], fliersize=fliersize,
saturation=saturation,
)
axes[0, 0].set_title("Duration")
axes[0, 0].set_xlim((0, 400))
sns.despine(ax=axes[0, 0], offset=5)
# Distance from Animal
plot_replay_distance_from_actual_position(
replay_info, kind="box", ax=axes[0, 1], fliersize=fliersize,
saturation=saturation
)
axes[0, 1].set_title("Distance from Animal")
sns.despine(ax=axes[0, 1], offset=5)
axes[0, 1].set_xlim((0, 250))
axes[0, 1].set_yticks([])
axes[0, 1].spines["left"].set_visible(False)
# Non-Local Hover Position
norm_non_local_hover = get_norm_linear_position(replay_info)
sns.distplot(
norm_non_local_hover,
kde_kws=dict(
bw=0.020,
clip=(0, 1),
shade=True,
facecolor=STATE_COLORS["Hover"],
legend=False,
),
rug_kws=dict(color="black", alpha=0.5),
kde=True,
rug=True,
hist=False,
color=STATE_COLORS["Hover"],
ax=axes[1, 0],
)
axes[1, 0].set_xlabel("Normalized Position")
axes[1, 0].set_ylabel("Probability Density")
plot_linear_position_markers(
replay_info,
is_normalized=True,
jitter=0.00,
zorder=101,
alpha=1,
ax=axes[1, 0],
linestyle="-",
fontsize=14,
)
sns.despine(ax=axes[1, 0], offset=5)
axes[1, 0].set_xlim((0, 1))
axes[1, 0].set_title("Non-Local Stationary Position")
n_non_local = norm_non_local_hover.size
axes[1, 0].text(0.75, 3.5, f"N = {n_non_local}", zorder=100, fontsize=9)
# Population firing rate
_plot_category(
replay_info,
"population_rate",
kind="box",
ax=axes[1, 1],
fliersize=fliersize,
saturation=saturation,
)
axes[1, 1].set_xlim((0, 400))
axes[1, 1].set_xlabel("Rate [spikes / s]")
axes[1, 1].set_title("Multiunit Population Rate")
sns.despine(ax=axes[1, 1], offset=5)
axes[1, 1].set_yticks([])
axes[1, 1].spines["left"].set_visible(False)
| {"hexsha": "db413361d08eda3fb2a7c5d28de2fafaa7184479", "size": 7715, "ext": "py", "lang": "Python", "max_stars_repo_path": "src/figure5.py", "max_stars_repo_name": "Eden-Kramer-Lab/replay_trajectory_paper", "max_stars_repo_head_hexsha": "f2d2b3cc55968fe7d94d3109621b2772cdbb2c0a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/figure5.py", "max_issues_repo_name": "Eden-Kramer-Lab/replay_trajectory_paper", "max_issues_repo_head_hexsha": "f2d2b3cc55968fe7d94d3109621b2772cdbb2c0a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/figure5.py", "max_forks_repo_name": "Eden-Kramer-Lab/replay_trajectory_paper", "max_forks_repo_head_hexsha": "f2d2b3cc55968fe7d94d3109621b2772cdbb2c0a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2021-07-09T23:02:11.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-17T18:49:57.000Z", "avg_line_length": 32.552742616, "max_line_length": 79, "alphanum_fraction": 0.6155541154, "include": true, "reason": "import numpy", "num_tokens": 2019} |
/-
Copyright (c) 2021 Kexing Ying. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kexing Ying
! This file was ported from Lean 3 source module probability.density
! leanprover-community/mathlib commit 17ef379e997badd73e5eabb4d38f11919ab3c4b3
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.MeasureTheory.Decomposition.RadonNikodym
import Mathbin.MeasureTheory.Measure.Lebesgue
/-!
# Probability density function
This file defines the probability density function of random variables, by which we mean
measurable functions taking values in a Borel space. In particular, a measurable function `f`
is said to the probability density function of a random variable `X` if for all measurable
sets `S`, `ℙ(X ∈ S) = ∫ x in S, f x dx`. Probability density functions are one way of describing
the distribution of a random variable, and are useful for calculating probabilities and
finding moments (although the latter is better achieved with moment generating functions).
This file also defines the continuous uniform distribution and proves some properties about
random variables with this distribution.
## Main definitions
* `measure_theory.has_pdf` : A random variable `X : Ω → E` is said to `has_pdf` with
respect to the measure `ℙ` on `Ω` and `μ` on `E` if there exists a measurable function `f`
such that the push-forward measure of `ℙ` along `X` equals `μ.with_density f`.
* `measure_theory.pdf` : If `X` is a random variable that `has_pdf X ℙ μ`, then `pdf X`
is the measurable function `f` such that the push-forward measure of `ℙ` along `X` equals
`μ.with_density f`.
* `measure_theory.pdf.uniform` : A random variable `X` is said to follow the uniform
distribution if it has a constant probability density function with a compact, non-null support.
## Main results
* `measure_theory.pdf.integral_fun_mul_eq_integral` : Law of the unconscious statistician,
i.e. if a random variable `X : Ω → E` has pdf `f`, then `𝔼(g(X)) = ∫ x, g x * f x dx` for
all measurable `g : E → ℝ`.
* `measure_theory.pdf.integral_mul_eq_integral` : A real-valued random variable `X` with
pdf `f` has expectation `∫ x, x * f x dx`.
* `measure_theory.pdf.uniform.integral_eq` : If `X` follows the uniform distribution with
its pdf having support `s`, then `X` has expectation `(λ s)⁻¹ * ∫ x in s, x dx` where `λ`
is the Lebesgue measure.
## TODOs
Ultimately, we would also like to define characteristic functions to describe distributions as
it exists for all random variables. However, to define this, we will need Fourier transforms
which we currently do not have.
-/
noncomputable section
open Classical MeasureTheory NNReal ENNReal
namespace MeasureTheory
open TopologicalSpace MeasureTheory.Measure
variable {Ω E : Type _} [MeasurableSpace E]
/-- A random variable `X : Ω → E` is said to `has_pdf` with respect to the measure `ℙ` on `Ω` and
`μ` on `E` if there exists a measurable function `f` such that the push-forward measure of `ℙ`
along `X` equals `μ.with_density f`. -/
class HasPdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) : Prop where
pdf' : Measurable X ∧ ∃ f : E → ℝ≥0∞, Measurable f ∧ map X ℙ = μ.withDensity f
#align measure_theory.has_pdf MeasureTheory.HasPdf
@[measurability]
theorem HasPdf.measurable {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPdf X ℙ μ] :
Measurable X :=
hX.pdf'.1
#align measure_theory.has_pdf.measurable MeasureTheory.HasPdf.measurable
/-- If `X` is a random variable that `has_pdf X ℙ μ`, then `pdf X` is the measurable function `f`
such that the push-forward measure of `ℙ` along `X` equals `μ.with_density f`. -/
def pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) :=
if hX : HasPdf X ℙ μ then Classical.choose hX.pdf'.2 else 0
#align measure_theory.pdf MeasureTheory.pdf
theorem pdf_undef {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
(h : ¬HasPdf X ℙ μ) : pdf X ℙ μ = 0 := by simp only [pdf, dif_neg h]
#align measure_theory.pdf_undef MeasureTheory.pdf_undef
theorem hasPdfOfPdfNeZero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
(h : pdf X ℙ μ ≠ 0) : HasPdf X ℙ μ := by
by_contra hpdf
rw [pdf, dif_neg hpdf] at h
exact hpdf (False.ndrec (has_pdf X ℙ μ) (h rfl))
#align measure_theory.has_pdf_of_pdf_ne_zero MeasureTheory.hasPdfOfPdfNeZero
theorem pdf_eq_zero_of_not_measurable {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
{X : Ω → E} (hX : ¬Measurable X) : pdf X ℙ μ = 0 :=
pdf_undef fun hpdf => hX hpdf.pdf'.1
#align measure_theory.pdf_eq_zero_of_not_measurable MeasureTheory.pdf_eq_zero_of_not_measurable
theorem measurable_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
(X : Ω → E) (h : pdf X ℙ μ ≠ 0) : Measurable X :=
by
by_contra hX
exact h (pdf_eq_zero_of_not_measurable hX)
#align measure_theory.measurable_of_pdf_ne_zero MeasureTheory.measurable_of_pdf_ne_zero
@[measurability]
theorem measurable_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) : Measurable (pdf X ℙ μ) :=
by
by_cases hX : has_pdf X ℙ μ
· rw [pdf, dif_pos hX]
exact (Classical.choose_spec hX.pdf'.2).1
· rw [pdf, dif_neg hX]
exact measurable_zero
#align measure_theory.measurable_pdf MeasureTheory.measurable_pdf
theorem map_eq_withDensity_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPdf X ℙ μ] :
Measure.map X ℙ = μ.withDensity (pdf X ℙ μ) :=
by
rw [pdf, dif_pos hX]
exact (Classical.choose_spec hX.pdf'.2).2
#align measure_theory.map_eq_with_density_pdf MeasureTheory.map_eq_withDensity_pdf
theorem map_eq_set_lintegral_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) [hX : HasPdf X ℙ μ] {s : Set E}
(hs : MeasurableSet s) : Measure.map X ℙ s = ∫⁻ x in s, pdf X ℙ μ x ∂μ := by
rw [← with_density_apply _ hs, map_eq_with_density_pdf X ℙ μ]
#align measure_theory.map_eq_set_lintegral_pdf MeasureTheory.map_eq_set_lintegral_pdf
namespace Pdf
variable {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
theorem lintegral_eq_measure_univ {X : Ω → E} [HasPdf X ℙ μ] :
(∫⁻ x, pdf X ℙ μ x ∂μ) = ℙ Set.univ := by
rw [← set_lintegral_univ, ← map_eq_set_lintegral_pdf X ℙ μ MeasurableSet.univ,
measure.map_apply (has_pdf.measurable X ℙ μ) MeasurableSet.univ, Set.preimage_univ]
#align measure_theory.pdf.lintegral_eq_measure_univ MeasureTheory.pdf.lintegral_eq_measure_univ
theorem ae_lt_top [IsFiniteMeasure ℙ] {μ : Measure E} {X : Ω → E} : ∀ᵐ x ∂μ, pdf X ℙ μ x < ∞ :=
by
by_cases hpdf : has_pdf X ℙ μ
· haveI := hpdf
refine' ae_lt_top (measurable_pdf X ℙ μ) _
rw [lintegral_eq_measure_univ]
exact (measure_lt_top _ _).Ne
· rw [pdf, dif_neg hpdf]
exact Filter.eventually_of_forall fun x => WithTop.zero_lt_top
#align measure_theory.pdf.ae_lt_top MeasureTheory.pdf.ae_lt_top
theorem ofReal_toReal_ae_eq [IsFiniteMeasure ℙ] {X : Ω → E} :
(fun x => ENNReal.ofReal (pdf X ℙ μ x).toReal) =ᵐ[μ] pdf X ℙ μ :=
ofReal_toReal_ae_eq ae_lt_top
#align measure_theory.pdf.of_real_to_real_ae_eq MeasureTheory.pdf.ofReal_toReal_ae_eq
theorem integrable_iff_integrable_mul_pdf [IsFiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
(hf : Measurable f) :
Integrable (fun x => f (X x)) ℙ ↔ Integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ :=
by
rw [← integrable_map_measure hf.ae_strongly_measurable (has_pdf.measurable X ℙ μ).AeMeasurable,
map_eq_with_density_pdf X ℙ μ, integrable_with_density_iff (measurable_pdf _ _ _) ae_lt_top]
infer_instance
#align measure_theory.pdf.integrable_iff_integrable_mul_pdf MeasureTheory.pdf.integrable_iff_integrable_mul_pdf
/-- **The Law of the Unconscious Statistician**: Given a random variable `X` and a measurable
function `f`, `f ∘ X` is a random variable with expectation `∫ x, f x * pdf X ∂μ`
where `μ` is a measure on the codomain of `X`. -/
theorem integral_fun_mul_eq_integral [IsFiniteMeasure ℙ] {X : Ω → E} [HasPdf X ℙ μ] {f : E → ℝ}
(hf : Measurable f) : (∫ x, f x * (pdf X ℙ μ x).toReal ∂μ) = ∫ x, f (X x) ∂ℙ :=
by
by_cases hpdf : integrable (fun x => f x * (pdf X ℙ μ x).toReal) μ
· rw [← integral_map (has_pdf.measurable X ℙ μ).AeMeasurable hf.ae_strongly_measurable,
map_eq_with_density_pdf X ℙ μ, integral_eq_lintegral_pos_part_sub_lintegral_neg_part hpdf,
integral_eq_lintegral_pos_part_sub_lintegral_neg_part,
lintegral_with_density_eq_lintegral_mul _ (measurable_pdf X ℙ μ) hf.neg.ennreal_of_real,
lintegral_with_density_eq_lintegral_mul _ (measurable_pdf X ℙ μ) hf.ennreal_of_real]
· congr 2
· have :
∀ x,
ENNReal.ofReal (f x * (pdf X ℙ μ x).toReal) =
ENNReal.ofReal (pdf X ℙ μ x).toReal * ENNReal.ofReal (f x) :=
by
intro x
rw [mul_comm, ENNReal.ofReal_mul ENNReal.toReal_nonneg]
simp_rw [this]
exact lintegral_congr_ae (Filter.EventuallyEq.mul of_real_to_real_ae_eq (ae_eq_refl _))
· have :
∀ x,
ENNReal.ofReal (-(f x * (pdf X ℙ μ x).toReal)) =
ENNReal.ofReal (pdf X ℙ μ x).toReal * ENNReal.ofReal (-f x) :=
by
intro x
rw [neg_mul_eq_neg_mul, mul_comm, ENNReal.ofReal_mul ENNReal.toReal_nonneg]
simp_rw [this]
exact lintegral_congr_ae (Filter.EventuallyEq.mul of_real_to_real_ae_eq (ae_eq_refl _))
· refine' ⟨hf.ae_strongly_measurable, _⟩
rw [has_finite_integral,
lintegral_with_density_eq_lintegral_mul _ (measurable_pdf _ _ _)
hf.nnnorm.coe_nnreal_ennreal]
have :
(fun x => (pdf X ℙ μ * fun x => ↑‖f x‖₊) x) =ᵐ[μ] fun x => ‖f x * (pdf X ℙ μ x).toReal‖₊ :=
by
simp_rw [← smul_eq_mul, nnnorm_smul, ENNReal.coe_mul]
rw [smul_eq_mul, mul_comm]
refine' Filter.EventuallyEq.mul (ae_eq_refl _) (ae_eq_trans of_real_to_real_ae_eq.symm _)
convert ae_eq_refl _
ext1 x
exact Real.ennnorm_eq_ofReal ENNReal.toReal_nonneg
rw [lintegral_congr_ae this]
exact hpdf.2
· rw [integral_undef hpdf, integral_undef]
rwa [← integrable_iff_integrable_mul_pdf hf] at hpdf
all_goals infer_instance
#align measure_theory.pdf.integral_fun_mul_eq_integral MeasureTheory.pdf.integral_fun_mul_eq_integral
theorem mapAbsolutelyContinuous {X : Ω → E} [HasPdf X ℙ μ] : map X ℙ ≪ μ :=
by
rw [map_eq_with_density_pdf X ℙ μ]
exact with_density_absolutely_continuous _ _
#align measure_theory.pdf.map_absolutely_continuous MeasureTheory.pdf.mapAbsolutelyContinuous
/-- A random variable that `has_pdf` is quasi-measure preserving. -/
theorem toQuasiMeasurePreserving {X : Ω → E} [HasPdf X ℙ μ] : QuasiMeasurePreserving X ℙ μ :=
{ Measurable := HasPdf.measurable X ℙ μ
AbsolutelyContinuous := mapAbsolutelyContinuous }
#align measure_theory.pdf.to_quasi_measure_preserving MeasureTheory.pdf.toQuasiMeasurePreserving
theorem haveLebesgueDecompositionOfHasPdf {X : Ω → E} [hX' : HasPdf X ℙ μ] :
(map X ℙ).HaveLebesgueDecomposition μ :=
⟨⟨⟨0, pdf X ℙ μ⟩, by
simp only [zero_add, measurable_pdf X ℙ μ, true_and_iff, mutually_singular.zero_left,
map_eq_with_density_pdf X ℙ μ]⟩⟩
#align measure_theory.pdf.have_lebesgue_decomposition_of_has_pdf MeasureTheory.pdf.haveLebesgueDecompositionOfHasPdf
theorem hasPdf_iff {X : Ω → E} :
HasPdf X ℙ μ ↔ Measurable X ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ :=
by
constructor
· intro hX'
exact ⟨hX'.pdf'.1, have_lebesgue_decomposition_of_has_pdf, map_absolutely_continuous⟩
· rintro ⟨hX, h_decomp, h⟩
haveI := h_decomp
refine' ⟨⟨hX, (measure.map X ℙ).rnDeriv μ, measurable_rn_deriv _ _, _⟩⟩
rwa [with_density_rn_deriv_eq]
#align measure_theory.pdf.has_pdf_iff MeasureTheory.pdf.hasPdf_iff
theorem hasPdf_iff_of_measurable {X : Ω → E} (hX : Measurable X) :
HasPdf X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ :=
by
rw [has_pdf_iff]
simp only [hX, true_and_iff]
#align measure_theory.pdf.has_pdf_iff_of_measurable MeasureTheory.pdf.hasPdf_iff_of_measurable
section
variable {F : Type _} [MeasurableSpace F] {ν : Measure F}
/-- A random variable that `has_pdf` transformed under a `quasi_measure_preserving`
map also `has_pdf` if `(map g (map X ℙ)).have_lebesgue_decomposition μ`.
`quasi_measure_preserving_has_pdf'` is more useful in the case we are working with a
probability measure and a real-valued random variable. -/
theorem quasiMeasurePreservingHasPdf {X : Ω → E} [HasPdf X ℙ μ] {g : E → F}
(hg : QuasiMeasurePreserving g μ ν) (hmap : (map g (map X ℙ)).HaveLebesgueDecomposition ν) :
HasPdf (g ∘ X) ℙ ν :=
by
rw [has_pdf_iff, ← map_map hg.measurable (has_pdf.measurable X ℙ μ)]
refine' ⟨hg.measurable.comp (has_pdf.measurable X ℙ μ), hmap, _⟩
rw [map_eq_with_density_pdf X ℙ μ]
refine' absolutely_continuous.mk fun s hsm hs => _
rw [map_apply hg.measurable hsm, with_density_apply _ (hg.measurable hsm)]
have := hg.absolutely_continuous hs
rw [map_apply hg.measurable hsm] at this
exact set_lintegral_measure_zero _ _ this
#align measure_theory.pdf.quasi_measure_preserving_has_pdf MeasureTheory.pdf.quasiMeasurePreservingHasPdf
theorem quasiMeasurePreservingHasPdf' [IsFiniteMeasure ℙ] [SigmaFinite ν] {X : Ω → E} [HasPdf X ℙ μ]
{g : E → F} (hg : QuasiMeasurePreserving g μ ν) : HasPdf (g ∘ X) ℙ ν :=
quasiMeasurePreservingHasPdf hg inferInstance
#align measure_theory.pdf.quasi_measure_preserving_has_pdf' MeasureTheory.pdf.quasiMeasurePreservingHasPdf'
end
section Real
variable [IsFiniteMeasure ℙ] {X : Ω → ℝ}
/-- A real-valued random variable `X` `has_pdf X ℙ λ` (where `λ` is the Lebesgue measure) if and
only if the push-forward measure of `ℙ` along `X` is absolutely continuous with respect to `λ`. -/
theorem Real.hasPdf_iff_of_measurable (hX : Measurable X) : HasPdf X ℙ ↔ map X ℙ ≪ volume :=
by
rw [has_pdf_iff_of_measurable hX, and_iff_right_iff_imp]
exact fun h => inferInstance
#align measure_theory.pdf.real.has_pdf_iff_of_measurable MeasureTheory.pdf.Real.hasPdf_iff_of_measurable
theorem Real.hasPdf_iff : HasPdf X ℙ ↔ Measurable X ∧ map X ℙ ≪ volume :=
by
by_cases hX : Measurable X
· rw [real.has_pdf_iff_of_measurable hX, iff_and_self]
exact fun h => hX
infer_instance
· exact ⟨fun h => False.elim (hX h.pdf'.1), fun h => False.elim (hX h.1)⟩
#align measure_theory.pdf.real.has_pdf_iff MeasureTheory.pdf.Real.hasPdf_iff
/-- If `X` is a real-valued random variable that has pdf `f`, then the expectation of `X` equals
`∫ x, x * f x ∂λ` where `λ` is the Lebesgue measure. -/
theorem integral_mul_eq_integral [HasPdf X ℙ] :
(∫ x, x * (pdf X ℙ volume x).toReal) = ∫ x, X x ∂ℙ :=
integral_fun_mul_eq_integral measurable_id
#align measure_theory.pdf.integral_mul_eq_integral MeasureTheory.pdf.integral_mul_eq_integral
theorem hasFiniteIntegralMul {f : ℝ → ℝ} {g : ℝ → ℝ≥0∞} (hg : pdf X ℙ =ᵐ[volume] g)
(hgi : (∫⁻ x, ‖f x‖₊ * g x) ≠ ∞) : HasFiniteIntegral fun x => f x * (pdf X ℙ volume x).toReal :=
by
rw [has_finite_integral]
have : (fun x => ↑‖f x‖₊ * g x) =ᵐ[volume] fun x => ‖f x * (pdf X ℙ volume x).toReal‖₊ :=
by
refine'
ae_eq_trans
(Filter.EventuallyEq.mul (ae_eq_refl fun x => ‖f x‖₊)
(ae_eq_trans hg.symm of_real_to_real_ae_eq.symm))
_
simp_rw [← smul_eq_mul, nnnorm_smul, ENNReal.coe_mul, smul_eq_mul]
refine' Filter.EventuallyEq.mul (ae_eq_refl _) _
convert ae_eq_refl _
ext1 x
exact Real.ennnorm_eq_ofReal ENNReal.toReal_nonneg
rwa [lt_top_iff_ne_top, ← lintegral_congr_ae this]
#align measure_theory.pdf.has_finite_integral_mul MeasureTheory.pdf.hasFiniteIntegralMul
end Real
section
/-! **Uniform Distribution** -/
/-- A random variable `X` has uniform distribution if it has a probability density function `f`
with support `s` such that `f = (μ s)⁻¹ 1ₛ` a.e. where `1ₛ` is the indicator function for `s`. -/
def IsUniform {m : MeasurableSpace Ω} (X : Ω → E) (support : Set E) (ℙ : Measure Ω)
(μ : Measure E := by exact MeasureTheory.MeasureSpace.volume) :=
pdf X ℙ μ =ᵐ[μ] support.indicator ((μ support)⁻¹ • 1)
#align measure_theory.pdf.is_uniform MeasureTheory.pdf.IsUniform
namespace IsUniform
theorem hasPdf {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E} {s : Set E}
(hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hu : IsUniform X s ℙ μ) : HasPdf X ℙ μ :=
hasPdfOfPdfNeZero
(by
intro hpdf
rw [is_uniform, hpdf] at hu
suffices μ (s ∩ Function.support ((μ s)⁻¹ • 1)) = 0
by
have heq : Function.support ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) = Set.univ :=
by
ext x
rw [Function.mem_support]
simp [hnt]
rw [HEq, Set.inter_univ] at this
exact hns this
exact Set.indicator_ae_eq_zero hu.symm)
#align measure_theory.pdf.is_uniform.has_pdf MeasureTheory.pdf.IsUniform.hasPdf
theorem pdf_toReal_ae_eq {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
{s : Set E} (hX : IsUniform X s ℙ μ) :
(fun x => (pdf X ℙ μ x).toReal) =ᵐ[μ] fun x =>
(s.indicator ((μ s)⁻¹ • (1 : E → ℝ≥0∞)) x).toReal :=
Filter.EventuallyEq.fun_comp hX ENNReal.toReal
#align measure_theory.pdf.is_uniform.pdf_to_real_ae_eq MeasureTheory.pdf.IsUniform.pdf_toReal_ae_eq
theorem measure_preimage {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
{s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hms : MeasurableSet s) (hu : IsUniform X s ℙ μ)
{A : Set E} (hA : MeasurableSet A) : ℙ (X ⁻¹' A) = μ (s ∩ A) / μ s :=
by
haveI := hu.has_pdf hns hnt
rw [← measure.map_apply (has_pdf.measurable X ℙ μ) hA, map_eq_set_lintegral_pdf X ℙ μ hA,
lintegral_congr_ae hu.restrict]
simp only [hms, hA, lintegral_indicator, Pi.smul_apply, Pi.one_apply, Algebra.id.smul_eq_mul,
mul_one, lintegral_const, restrict_apply', Set.univ_inter]
rw [ENNReal.div_eq_inv_mul]
#align measure_theory.pdf.is_uniform.measure_preimage MeasureTheory.pdf.IsUniform.measure_preimage
theorem isProbabilityMeasure {m : MeasurableSpace Ω} {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
{s : Set E} (hns : μ s ≠ 0) (hnt : μ s ≠ ∞) (hms : MeasurableSet s) (hu : IsUniform X s ℙ μ) :
IsProbabilityMeasure ℙ :=
⟨by
have : X ⁻¹' Set.univ = Set.univ := by simp only [Set.preimage_univ]
rw [← this, hu.measure_preimage hns hnt hms MeasurableSet.univ, Set.inter_univ,
ENNReal.div_self hns hnt]⟩
#align measure_theory.pdf.is_uniform.is_probability_measure MeasureTheory.pdf.IsUniform.isProbabilityMeasure
variable {X : Ω → ℝ} {s : Set ℝ} (hms : MeasurableSet s) (hns : volume s ≠ 0)
include hms hns
theorem mulPdfIntegrable [IsFiniteMeasure ℙ] (hcs : IsCompact s) (huX : IsUniform X s ℙ) :
Integrable fun x : ℝ => x * (pdf X ℙ volume x).toReal :=
by
by_cases hsupp : volume s = ∞
· have : pdf X ℙ =ᵐ[volume] 0 := by
refine' ae_eq_trans huX _
simp [hsupp]
refine' integrable.congr (integrable_zero _ _ _) _
rw [(by simp : (fun x => 0 : ℝ → ℝ) = fun x => x * (0 : ℝ≥0∞).toReal)]
refine'
Filter.EventuallyEq.mul (ae_eq_refl _) (Filter.EventuallyEq.fun_comp this.symm ENNReal.toReal)
refine'
⟨ae_strongly_measurable_id.mul
(measurable_pdf X ℙ).AeMeasurable.eNNReal_toReal.AeStronglyMeasurable,
_⟩
refine' has_finite_integral_mul huX _
set ind := (volume s)⁻¹ • (1 : ℝ → ℝ≥0∞) with hind
have : ∀ x, ↑‖x‖₊ * s.indicator ind x = s.indicator (fun x => ‖x‖₊ * ind x) x := fun x =>
(s.indicator_mul_right (fun x => ↑‖x‖₊) ind).symm
simp only [this, lintegral_indicator _ hms, hind, mul_one, Algebra.id.smul_eq_mul, Pi.one_apply,
Pi.smul_apply]
rw [lintegral_mul_const _ measurable_nnnorm.coe_nnreal_ennreal]
·
refine'
(ENNReal.mul_lt_top (set_lintegral_lt_top_of_is_compact hsupp hcs continuous_nnnorm).Ne
(ENNReal.inv_lt_top.2 (pos_iff_ne_zero.mpr hns)).Ne).Ne
· infer_instance
#align measure_theory.pdf.is_uniform.mul_pdf_integrable MeasureTheory.pdf.IsUniform.mulPdfIntegrable
/-- A real uniform random variable `X` with support `s` has expectation
`(λ s)⁻¹ * ∫ x in s, x ∂λ` where `λ` is the Lebesgue measure. -/
theorem integral_eq (hnt : volume s ≠ ∞) (huX : IsUniform X s ℙ) :
(∫ x, X x ∂ℙ) = (volume s)⁻¹.toReal * ∫ x in s, x :=
by
haveI := has_pdf hns hnt huX
haveI := huX.is_probability_measure hns hnt hms
rw [← integral_mul_eq_integral]
rw [integral_congr_ae (Filter.EventuallyEq.mul (ae_eq_refl _) (pdf_to_real_ae_eq huX))]
have :
∀ x,
x * (s.indicator ((volume s)⁻¹ • (1 : ℝ → ℝ≥0∞)) x).toReal =
x * s.indicator ((volume s)⁻¹.toReal • (1 : ℝ → ℝ)) x :=
by
refine' fun x => congr_arg ((· * ·) x) _
by_cases hx : x ∈ s
· simp [Set.indicator_of_mem hx]
· simp [Set.indicator_of_not_mem hx]
simp_rw [this, ← s.indicator_mul_right fun x => x, integral_indicator hms]
change (∫ x in s, x * (volume s)⁻¹.toReal • 1 ∂volume) = _
rw [integral_mul_right, mul_comm, Algebra.id.smul_eq_mul, mul_one]
#align measure_theory.pdf.is_uniform.integral_eq MeasureTheory.pdf.IsUniform.integral_eq
end IsUniform
end
end Pdf
end MeasureTheory
| {"author": "leanprover-community", "repo": "mathlib3port", "sha": "62505aa236c58c8559783b16d33e30df3daa54f4", "save_path": "github-repos/lean/leanprover-community-mathlib3port", "path": "github-repos/lean/leanprover-community-mathlib3port/mathlib3port-62505aa236c58c8559783b16d33e30df3daa54f4/Mathbin/Probability/Density.lean"} |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.ticker import MaxNLocator
import pickle
import math
import os, sys
from robolearn.old_utils.plot_utils import plot_sample_list, plot_sample_list_distribution, lqr_forward, plot_3d_gaussian
from robolearn.old_algos.gps.gps_utils import IterationData
from robolearn.old_utils.iit.iit_robots_params import bigman_params
from robolearn.old_utils.traj_opt.traj_opt_utils import traj_distr_kl, traj_distr_kl_alt
import scipy.stats
gps_directory_name = 'GPS_2017-09-10_15:30:24' # Normal Sunday 10/09 | new init_pos
#gps_directory_name = 'GPS_2017-09-10_19:10:07' # G/B Sunday 10/09 | new init_pos
gps_directory_names = ['GPS_2017-09-12_07:01:16', 'GPS_2017-09-11_15:25:19', 'GPS_2017-09-13_07:24:42']
gps_models_labels = ['MDGPS', 'B-MDGPS', 'D-MDGPS']
gps_models_line_styles = [':', '--', '-']
init_itr = 0
final_itr = 2
#final_itr = 30
samples_idx = None # List of samples / None: all samples
max_traj_plots = None # None, plot all
last_n_iters = None # None, plot all iterations
sensed_joints = 'RA'
method = 'MDGPS_MDREPS'
iteration_data_options = {
'plot_errors': True,
}
eta_color = 'black'
cs_color = 'red'
step_mult_color = 'red'
sample_list_cols = 3
plot_sample_list_max_min = False
plot_joint_limits = True
gps_num = 0
load_iteration_data = True
#iteration_data_options = [value for key, value in options.items() if key not in duality_data_options+policy_different_options]
gps_path = '/home/desteban/workspace/robolearn/scenarios/robolearn_log/' + gps_directory_name
iteration_data_list = list()
good_duality_info_list = list()
good_trajectories_info_list = list()
bad_duality_info_list = list()
bad_trajectories_info_list = list()
iteration_ids = list()
pol_sample_lists_costs = list()
pol_sample_lists_cost_compositions = list()
max_available_itr = None
for pp in range(init_itr, final_itr):
if os.path.isfile(gps_path+'/' + str('gps%02d_' % gps_num) + method.upper() + '_iteration_data_itr_'+str('%02d' % pp)+'.pkl'):
if os.path.isfile(gps_path+'/' + str('gps%02d_' % gps_num) + method.upper() + '_iteration_data_itr_'+str('%02d' % pp)+'.pkl'):
max_available_itr = pp
if max_available_itr is not None:
print("Max available iterations: %d" % max_available_itr)
if last_n_iters is not None:
init_itr = max(max_available_itr - last_n_iters + 1, 0)
if max_traj_plots is not None:
if max_available_itr > max_traj_plots:
itr_to_load = np.linspace(init_itr, max_available_itr, max_traj_plots, dtype=np.uint8)
else:
itr_to_load = range(init_itr, max_available_itr+1)
else:
itr_to_load = range(init_itr, max_available_itr+1)
print("Iterations to load: %s" % itr_to_load)
for pp in itr_to_load:
if os.path.isfile(gps_path+'/' + str('gps%02d_' % gps_num) + method.upper() + '_iteration_data_itr_'+str('%02d' % pp)+'.pkl'):
print('Loading GPS iteration_data from iteration %d' % pp)
iteration_data_list.append(pickle.load(open(gps_path+'/' + str('gps%02d_' % gps_num) + method.upper() +'_iteration_data_itr_'+str('%02d' % pp)+'.pkl',
'rb')))
iteration_ids.append(pp)
if load_iteration_data:
data_list_with_data = iteration_data_list
if not data_list_with_data:
raise AttributeError("No data has been loaded. Check that files exist")
T = iteration_data_list[-1][-1].sample_list.get_actions(samples_idx).shape[1]
else:
raise ValueError("NO data has been loaded!")
# total_cond = len(pol_sample_lists_costs[0])
total_itr = len(data_list_with_data)
total_cond = len(data_list_with_data[0])
colormap = plt.cm.rainbow # nipy_spectral, Set1, Paired, winter
joint_limits = [bigman_params['joints_limits'][ii] for ii in bigman_params['joint_ids'][sensed_joints]]
if False:
for cond in range(total_cond):
dData = iteration_data_list[0][cond].sample_list.get_actions(samples_idx).shape[-1]
fig, axs = plt.subplots(int(math.ceil(float(dData)/sample_list_cols)), sample_list_cols)
fig.subplots_adjust(hspace=0)
fig.canvas.set_window_title('Actions | Condition %d' % cond)
fig.set_facecolor((1, 1, 1))
for ii in range(axs.size):
ax = axs[ii/sample_list_cols, ii % sample_list_cols]
ax.set_prop_cycle('color', [colormap(i) for i in np.linspace(0, 1, total_itr)])
lines = list()
labels = list()
for itr in range(total_itr):
actions = iteration_data_list[itr][cond].sample_list.get_actions(samples_idx)
for ii in range(axs.size):
ax = axs[ii/sample_list_cols, ii % sample_list_cols]
if ii < dData:
ax.set_title("Action %d" % (ii+1))
label = "itr %d" % iteration_ids[itr]
line = ax.plot(actions.mean(axis=0)[:, ii], label=label)[0]
if ii == 0:
lines.append(line)
labels.append(label)
if itr == 0:
ax.tick_params(axis='both', direction='in')
#ax.set_xlim([0, actions.shape[2]])
#ax.set_ylim([ymin, ymax])
if plot_sample_list_max_min:
ax.fill_between(range(actions.mean(axis=0).shape[0]), actions.min(axis=0)[:, ii],
actions.max(axis=0)[:, ii], alpha=0.5)
# # One legend for each ax
# legend = ax.legend(loc='lower right', fontsize='x-small', borderaxespad=0.)
# legend.get_frame().set_alpha(0.4)
else:
plt.setp(ax, visible=False)
# One legend for all figures
legend = plt.figlegend(lines, labels, loc='lower center', ncol=5, labelspacing=0., borderaxespad=0.)
legend.get_frame().set_alpha(0.4)
if True:
error_x = 0.05
error_y = 0.05
error_z = 0.05
error_R = 0.05
error_P = 0.05
error_Y = 0.05
max_error_drill = np.array([0.05, 0.05, 0.05, 0.05, 0.05, 0.05])
indeces_drill = np.array([27, 28, 29, 30, 31, 32])
for cond in range(total_cond):
N = iteration_data_list[0][cond].sample_list.get_states(samples_idx).shape[-3]
dData = iteration_data_list[0][cond].sample_list.get_states(samples_idx).shape[-1]
fig, axs = plt.subplots(1, 1,)
fig.subplots_adjust(hspace=0)
fig.canvas.set_window_title('States | Condition %d' % cond)
fig.set_facecolor((1, 1, 1))
#for ii in range(axs.size):
# ax = axs[ii/sample_list_cols, ii % sample_list_cols]
# ax.set_prop_cycle('color', [colormap(i) for i in np.linspace(0, 1, total_itr)])
lines = list()
labels = list()
errors = np.zeros(total_itr)
for itr in range(total_itr):
states = iteration_data_list[itr][cond].sample_list.get_states(samples_idx)
all_zs = states[:, :, indeces_drill[-1]]
print(all_zs.shape)
error_count = 0
for nn in range(N):
print(N)
print(nn)
if np.any(all_zs[nn, :] > max_error_drill[-1]):
error_count += 1
errors[itr] = error_count*100./N
axs.plot(errors)
## One legend for all figures
#legend = plt.figlegend(lines, labels, loc='lower center', ncol=5, labelspacing=0., borderaxespad=0.)
#legend.get_frame().set_alpha(0.4)
plt.show(block=False)
raw_input('Showing plots. Press a key to close...')
| {"hexsha": "9e2a3bbd66c145fd57c5b57160ea3751e2fe5664", "size": 7708, "ext": "py", "lang": "Python", "max_stars_repo_path": "scenarios/tests/load_plot_good_bad_errors.py", "max_stars_repo_name": "domingoesteban/robolearn", "max_stars_repo_head_hexsha": "0d20125425c352b80ef2eeed1c0b11ab6497b11a", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-01-13T09:44:22.000Z", "max_stars_repo_stars_event_max_datetime": "2020-01-13T09:44:22.000Z", "max_issues_repo_path": "scenarios/tests/load_plot_good_bad_errors.py", "max_issues_repo_name": "domingoesteban/robolearn", "max_issues_repo_head_hexsha": "0d20125425c352b80ef2eeed1c0b11ab6497b11a", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scenarios/tests/load_plot_good_bad_errors.py", "max_forks_repo_name": "domingoesteban/robolearn", "max_forks_repo_head_hexsha": "0d20125425c352b80ef2eeed1c0b11ab6497b11a", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-12-22T00:41:20.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-22T00:41:20.000Z", "avg_line_length": 39.9378238342, "max_line_length": 162, "alphanum_fraction": 0.6394654904, "include": true, "reason": "import numpy,import scipy", "num_tokens": 2042} |
[STATEMENT]
lemma MAC_synth_helper:
"\<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo;
HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, \<sigma>\<rangle>; \<sigma> = Mac[Key (macK asid)] j; \<sigma> \<in> ik \<or> HVF m \<in> ik\<rbrakk>
\<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, \<sigma>\<rangle>; \<sigma> = Mac[macKey asid] j; \<sigma> \<in> ik \<or> HVF m \<in> ik\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
apply(auto simp add: ik_def ik_hfs_simp
dest: MAC_synth_oracle ik_add_form ik_oracle_parts_form[simplified])
[PROOF STATE]
proof (prove)
goal (7 subgoals):
1. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, HVF hf\<rangle>; \<sigma> = HVF hf; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[macKey asid] j = HVF hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
2. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, UHI hf\<rangle>; \<sigma> = UHI hf; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[macKey asid] j = UHI hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
3. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[macKey asid] j \<in> ik_add\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
4. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[macKey asid] j \<in> ik_oracle\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
5. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = HVF hf; \<sigma> = Mac[macKey asid] j; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = HVF hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
6. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = UHI hf; \<sigma> = Mac[macKey asid] j; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = UHI hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
7. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> \<in> ik_add\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, HVF hf_\<rangle>; \<sigma> = HVF hf_; hf_ \<in> set hfs_; (ainfoa_, hfs_) \<in> auth_seg2 uinfoa_; hf_valid ainfoa_ uinfoa_ hf_ x_; Mac[macKey asid] j = HVF hf_\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
by(auto simp add: hf_valid_invert simp add: K_i_def)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
1. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, UHI hf\<rangle>; \<sigma> = UHI hf; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[macKey asid] j = UHI hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
2. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[macKey asid] j \<in> ik_add\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
3. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[macKey asid] j \<in> ik_oracle\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
4. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = HVF hf; \<sigma> = Mac[macKey asid] j; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = HVF hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
5. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = UHI hf; \<sigma> = Mac[macKey asid] j; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = UHI hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
6. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> \<in> ik_add\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, UHI hf_\<rangle>; \<sigma> = UHI hf_; hf_ \<in> set hfs_; (ainfoa_, hfs_) \<in> auth_seg2 uinfoa_; hf_valid ainfoa_ uinfoa_ hf_ x_; Mac[macKey asid] j = UHI hf_\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
by(auto simp add: hf_valid_invert simp add: K_i_def)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
1. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[macKey asid] j \<in> ik_add\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
2. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[macKey asid] j \<in> ik_oracle\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
3. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = HVF hf; \<sigma> = Mac[macKey asid] j; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = HVF hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
4. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = UHI hf; \<sigma> = Mac[macKey asid] j; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = UHI hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
5. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> \<in> ik_add\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[macKey asid] j \<in> ik_add\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
by(auto elim!: uinfo_change_auth_seg2 simp add: K_i_def)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
1. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[macKey asid] j \<in> ik_oracle\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
2. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = HVF hf; \<sigma> = Mac[macKey asid] j; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = HVF hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
3. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = UHI hf; \<sigma> = Mac[macKey asid] j; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = UHI hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
4. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> \<in> ik_add\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[macKey asid] j \<in> ik_oracle\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
apply(auto simp add: hf_valid_invert simp add: K_i_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>ahi ahi2 ts upif downif upif2 downif2 uhi2 x2. \<lbrakk>no_oracle (Num ts) uinfo; \<sigma> = Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]); Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]) \<in> ik_oracle; m = \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr>; ASIF (DownIF ahi) downif; ASIF (UpIF ahi) upif; z = Some \<lparr>AHI = ahi2, UHI = uhi2, HVF = x2\<rparr>; ASIF (DownIF ahi2) downif2; ASIF (UpIF ahi2) upif2; ainfo = Num ts; k_i = \<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>; asid = ASID ahi; j = L [Num ts, upif, downif, uhi2]\<rbrakk> \<Longrightarrow> \<exists>hfs. \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr> \<in> set hfs \<and> (\<exists>uinfo'. (Num ts, hfs) \<in> auth_seg2 uinfo')
2. \<And>ahi ts upif downif. \<lbrakk>no_oracle (Num ts) uinfo; \<sigma> = Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]); Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]) \<in> ik_oracle; m = \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif])\<rangle>\<rparr>; ASIF (DownIF ahi) downif; ASIF (UpIF ahi) upif; z = None; ainfo = Num ts; k_i = \<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>; asid = ASID ahi; j = L [Num ts, upif, downif]\<rbrakk> \<Longrightarrow> \<exists>hfs. \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif])\<rangle>\<rparr> \<in> set hfs \<and> (\<exists>uinfo'. (Num ts, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
using ik_oracle_parts_form
[PROOF STATE]
proof (prove)
using this:
?t \<in> ik_oracle \<Longrightarrow> (\<exists>asid l ainfo uinfo k_i. ?t = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] l\<rangle>) \<or> (\<exists>asid l. ?t = Hash Mac[macKey asid] l)
goal (2 subgoals):
1. \<And>ahi ahi2 ts upif downif upif2 downif2 uhi2 x2. \<lbrakk>no_oracle (Num ts) uinfo; \<sigma> = Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]); Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]) \<in> ik_oracle; m = \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr>; ASIF (DownIF ahi) downif; ASIF (UpIF ahi) upif; z = Some \<lparr>AHI = ahi2, UHI = uhi2, HVF = x2\<rparr>; ASIF (DownIF ahi2) downif2; ASIF (UpIF ahi2) upif2; ainfo = Num ts; k_i = \<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>; asid = ASID ahi; j = L [Num ts, upif, downif, uhi2]\<rbrakk> \<Longrightarrow> \<exists>hfs. \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr> \<in> set hfs \<and> (\<exists>uinfo'. (Num ts, hfs) \<in> auth_seg2 uinfo')
2. \<And>ahi ts upif downif. \<lbrakk>no_oracle (Num ts) uinfo; \<sigma> = Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]); Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]) \<in> ik_oracle; m = \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif])\<rangle>\<rparr>; ASIF (DownIF ahi) downif; ASIF (UpIF ahi) upif; z = None; ainfo = Num ts; k_i = \<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>; asid = ASID ahi; j = L [Num ts, upif, downif]\<rbrakk> \<Longrightarrow> \<exists>hfs. \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif])\<rangle>\<rparr> \<in> set hfs \<and> (\<exists>uinfo'. (Num ts, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
by blast+
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = HVF hf; \<sigma> = Mac[macKey asid] j; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = HVF hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
2. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = UHI hf; \<sigma> = Mac[macKey asid] j; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = UHI hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
3. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> \<in> ik_add\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = HVF hf_; \<sigma> = Mac[macKey asid] j; hf_ \<in> set hfs_; (ainfoa_, hfs_) \<in> auth_seg2 uinfoa_; hf_valid ainfoa_ uinfoa_ hf_ x_; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = HVF hf_\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
apply(auto simp add: hf_valid_invert simp add: K_i_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>ahi ahi2 ts upif downif upif2 downif2 uhi2 x2 ahia ahi2a upif2a downif2a x2a. \<lbrakk>no_oracle (Num ts) uinfoa_; \<sigma> = Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2]); \<lparr>AHI = ahia, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr> \<in> set hfs_; (Num ts, hfs_) \<in> auth_seg2 uinfoa_; m = \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr>; ASIF (DownIF ahi) downif; ASIF (UpIF ahi) upif; z = Some \<lparr>AHI = ahi2, UHI = uhi2, HVF = x2\<rparr>; ASIF (DownIF ahi2) downif2; ASIF (UpIF ahi2) upif2; ainfo = Num ts; hf_ = \<lparr>AHI = ahia, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr>; ASIF (DownIF ahia) downif; ASIF (UpIF ahia) upif; x_ = Some \<lparr>AHI = ahi2a, UHI = uhi2, HVF = x2a\<rparr>; ASIF (DownIF ahi2a) downif2a; ASIF (UpIF ahi2a) upif2a; ainfoa_ = Num ts; k_i = \<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>; asid = ASID ahia; j = L [Num ts, upif, downif, uhi2]; ASID ahi = ASID ahia; uinfo = uinfoa_\<rbrakk> \<Longrightarrow> \<exists>hfs. \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr> \<in> set hfs \<and> (\<exists>uinfo'. (Num ts, hfs) \<in> auth_seg2 uinfo')
2. \<And>ahi ts upif downif ahia. \<lbrakk>no_oracle (Num ts) uinfoa_; \<sigma> = Mac[macKey (ASID ahia)] (L [Num ts, upif, downif]); \<lparr>AHI = ahia, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif])\<rangle>\<rparr> \<in> set hfs_; (Num ts, hfs_) \<in> auth_seg2 uinfoa_; m = \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif])\<rangle>\<rparr>; ASIF (DownIF ahi) downif; ASIF (UpIF ahi) upif; z = None; ainfo = Num ts; hf_ = \<lparr>AHI = ahia, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif])\<rangle>\<rparr>; ASIF (DownIF ahia) downif; ASIF (UpIF ahia) upif; x_ = None; ainfoa_ = Num ts; k_i = \<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>; asid = ASID ahia; j = L [Num ts, upif, downif]; ASID ahi = ASID ahia; uinfo = uinfoa_\<rbrakk> \<Longrightarrow> \<exists>hfs. \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif])\<rangle>\<rparr> \<in> set hfs \<and> (\<exists>uinfo'. (Num ts, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
using ahi_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>ASID ?ahi' = ASID ?ahi; ASIF (DownIF ?ahi') ?downif; ASIF (UpIF ?ahi') ?upif; ASIF (DownIF ?ahi) ?downif; ASIF (UpIF ?ahi) ?upif\<rbrakk> \<Longrightarrow> ?ahi = ?ahi'
goal (2 subgoals):
1. \<And>ahi ahi2 ts upif downif upif2 downif2 uhi2 x2 ahia ahi2a upif2a downif2a x2a. \<lbrakk>no_oracle (Num ts) uinfoa_; \<sigma> = Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2]); \<lparr>AHI = ahia, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr> \<in> set hfs_; (Num ts, hfs_) \<in> auth_seg2 uinfoa_; m = \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr>; ASIF (DownIF ahi) downif; ASIF (UpIF ahi) upif; z = Some \<lparr>AHI = ahi2, UHI = uhi2, HVF = x2\<rparr>; ASIF (DownIF ahi2) downif2; ASIF (UpIF ahi2) upif2; ainfo = Num ts; hf_ = \<lparr>AHI = ahia, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr>; ASIF (DownIF ahia) downif; ASIF (UpIF ahia) upif; x_ = Some \<lparr>AHI = ahi2a, UHI = uhi2, HVF = x2a\<rparr>; ASIF (DownIF ahi2a) downif2a; ASIF (UpIF ahi2a) upif2a; ainfoa_ = Num ts; k_i = \<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>; asid = ASID ahia; j = L [Num ts, upif, downif, uhi2]; ASID ahi = ASID ahia; uinfo = uinfoa_\<rbrakk> \<Longrightarrow> \<exists>hfs. \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr> \<in> set hfs \<and> (\<exists>uinfo'. (Num ts, hfs) \<in> auth_seg2 uinfo')
2. \<And>ahi ts upif downif ahia. \<lbrakk>no_oracle (Num ts) uinfoa_; \<sigma> = Mac[macKey (ASID ahia)] (L [Num ts, upif, downif]); \<lparr>AHI = ahia, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif])\<rangle>\<rparr> \<in> set hfs_; (Num ts, hfs_) \<in> auth_seg2 uinfoa_; m = \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif])\<rangle>\<rparr>; ASIF (DownIF ahi) downif; ASIF (UpIF ahi) upif; z = None; ainfo = Num ts; hf_ = \<lparr>AHI = ahia, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif])\<rangle>\<rparr>; ASIF (DownIF ahia) downif; ASIF (UpIF ahia) upif; x_ = None; ainfoa_ = Num ts; k_i = \<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>; asid = ASID ahia; j = L [Num ts, upif, downif]; ASID ahi = ASID ahia; uinfo = uinfoa_\<rbrakk> \<Longrightarrow> \<exists>hfs. \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahia)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahia), source_extract (Num uinfoa_)\<rangle>] \<langle>Num ts, Num uinfoa_, Mac[macKey (ASID ahia)] (L [Num ts, upif, downif])\<rangle>\<rparr> \<in> set hfs \<and> (\<exists>uinfo'. (Num ts, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
by blast+
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>hf hfs ainfoa uinfoa x. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = UHI hf; \<sigma> = Mac[macKey asid] j; hf \<in> set hfs; (ainfoa, hfs) \<in> auth_seg2 uinfoa; hf_valid ainfoa uinfoa hf x; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = UHI hf\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
2. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> \<in> ik_add\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = UHI hf_; \<sigma> = Mac[macKey asid] j; hf_ \<in> set hfs_; (ainfoa_, hfs_) \<in> auth_seg2 uinfoa_; hf_valid ainfoa_ uinfoa_ hf_ x_; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> = UHI hf_\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
by(auto simp add: hf_valid_invert simp add: K_i_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> \<in> ik_add\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>hf_valid ainfo uinfo m z; no_oracle ainfo uinfo; HVF m = Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle>; \<sigma> = Mac[macKey asid] j; Mac[k_i] \<langle>ainfo, Num uinfo, Mac[macKey asid] j\<rangle> \<in> ik_add\<rbrakk> \<Longrightarrow> \<exists>hfs. m \<in> set hfs \<and> (\<exists>uinfo'. (ainfo, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
apply(auto simp add: hf_valid_invert simp add: K_i_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. \<And>ahi ahi2 ts upif downif upif2 downif2 uhi2 x2. \<lbrakk>no_oracle (Num ts) uinfo; \<sigma> = Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]); Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2])\<rangle> \<in> ik_add; m = \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr>; ASIF (DownIF ahi) downif; ASIF (UpIF ahi) upif; z = Some \<lparr>AHI = ahi2, UHI = uhi2, HVF = x2\<rparr>; ASIF (DownIF ahi2) downif2; ASIF (UpIF ahi2) upif2; ainfo = Num ts; k_i = \<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>; asid = ASID ahi; j = L [Num ts, upif, downif, uhi2]\<rbrakk> \<Longrightarrow> \<exists>hfs. \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr> \<in> set hfs \<and> (\<exists>uinfo'. (Num ts, hfs) \<in> auth_seg2 uinfo')
2. \<And>ahi ts upif downif. \<lbrakk>no_oracle (Num ts) uinfo; \<sigma> = Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]); Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif])\<rangle> \<in> ik_add; m = \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif])\<rangle>\<rparr>; ASIF (DownIF ahi) downif; ASIF (UpIF ahi) upif; z = None; ainfo = Num ts; k_i = \<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>; asid = ASID ahi; j = L [Num ts, upif, downif]\<rbrakk> \<Longrightarrow> \<exists>hfs. \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif])\<rangle>\<rparr> \<in> set hfs \<and> (\<exists>uinfo'. (Num ts, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
using ik_add_form
[PROOF STATE]
proof (prove)
using this:
?t \<in> ik_add \<Longrightarrow> \<exists>asid l. ?t = Mac[macKey asid] l
goal (2 subgoals):
1. \<And>ahi ahi2 ts upif downif upif2 downif2 uhi2 x2. \<lbrakk>no_oracle (Num ts) uinfo; \<sigma> = Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]); Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2])\<rangle> \<in> ik_add; m = \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr>; ASIF (DownIF ahi) downif; ASIF (UpIF ahi) upif; z = Some \<lparr>AHI = ahi2, UHI = uhi2, HVF = x2\<rparr>; ASIF (DownIF ahi2) downif2; ASIF (UpIF ahi2) upif2; ainfo = Num ts; k_i = \<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>; asid = ASID ahi; j = L [Num ts, upif, downif, uhi2]\<rbrakk> \<Longrightarrow> \<exists>hfs. \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif, uhi2])\<rangle>\<rparr> \<in> set hfs \<and> (\<exists>uinfo'. (Num ts, hfs) \<in> auth_seg2 uinfo')
2. \<And>ahi ts upif downif. \<lbrakk>no_oracle (Num ts) uinfo; \<sigma> = Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]); Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif])\<rangle> \<in> ik_add; m = \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif])\<rangle>\<rparr>; ASIF (DownIF ahi) downif; ASIF (UpIF ahi) upif; z = None; ainfo = Num ts; k_i = \<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>; asid = ASID ahi; j = L [Num ts, upif, downif]\<rbrakk> \<Longrightarrow> \<exists>hfs. \<lparr>AHI = ahi, UHI = Hash Mac[macKey (ASID ahi)] (L [Num ts, upif, downif]), HVF = Mac[\<langle>AS (ASID ahi), source_extract (Num uinfo)\<rangle>] \<langle>Num ts, Num uinfo, Mac[macKey (ASID ahi)] (L [Num ts, upif, downif])\<rangle>\<rparr> \<in> set hfs \<and> (\<exists>uinfo'. (Num ts, hfs) \<in> auth_seg2 uinfo')
[PROOF STEP]
by blast+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done | {"llama_tokens": 14121, "file": "IsaNet_instances_EPIC_L2_SA", "length": 22} |
import pymc3 as pm
import exoplanet as xo
import os
import model_apf as m
# with m.model:
# map_sol = xo.optimize(vars=[m.logKAa, m.logKAb, m.P, m.t_periastron, m.omega])
# map_sol1 = xo.optimize(start=map_sol)
# print(map_sol1)
with m.model:
trace = pm.sample(
tune=2500,
draws=3000,
# start=map_sol1,
chains=4,
step=xo.get_dense_nuts_step(target_accept=0.9),
)
chaindir = "chains/close/rv/"
if not os.path.isdir(chaindir):
os.makedirs(chaindir)
# save the samples as a pymc3 object
pm.save_trace(trace, directory=chaindir, overwrite=True)
# and as a CSV, just in case the model spec
# changes and we have trouble reloading things
df = pm.trace_to_dataframe(trace)
df.to_csv(f"{chaindir}current.csv")
| {"hexsha": "f4c19319db235466f1a23da1e0ee45e57c9e3196", "size": 771, "ext": "py", "lang": "Python", "max_stars_repo_path": "analysis/close/rv/sample.py", "max_stars_repo_name": "iancze/TWA-3-orbit", "max_stars_repo_head_hexsha": "e852f69b298d315aacc5801dacb42346e3a281c1", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "analysis/close/rv/sample.py", "max_issues_repo_name": "iancze/TWA-3-orbit", "max_issues_repo_head_hexsha": "e852f69b298d315aacc5801dacb42346e3a281c1", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "analysis/close/rv/sample.py", "max_forks_repo_name": "iancze/TWA-3-orbit", "max_forks_repo_head_hexsha": "e852f69b298d315aacc5801dacb42346e3a281c1", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.0285714286, "max_line_length": 84, "alphanum_fraction": 0.6874189364, "include": true, "reason": "import pymc3", "num_tokens": 222} |
import math
from pyradioconfig.parts.panther.calculators.calc_agc import CALC_AGC_panther
from py_2_and_3_compatibility import *
from scipy import interpolate
#This file contains calculations related to the configuring the AGC
class CALC_AGC_ocelot(CALC_AGC_panther):
def calc_agc_misc(self, model):
self._reg_write(model.vars.AGC_AGCPERIOD0_SETTLETIMEIF,6)
self._reg_write(model.vars.AGC_AGCPERIOD0_SETTLETIMERF,14)
self._reg_write(model.vars.AGC_CTRL0_AGCRST,0)
self._reg_write(model.vars.AGC_CTRL0_DISCFLOOPADJ,1)
self._reg_write(model.vars.AGC_CTRL0_DISRESETCHPWR,0)
self._reg_write(model.vars.AGC_CTRL0_DSADISCFLOOP,0)
self._reg_write(model.vars.AGC_CTRL0_DISPNDWNCOMP,0)
self._reg_write(model.vars.AGC_CTRL0_DISPNGAINUP,0)
self._reg_write(model.vars.AGC_CTRL0_ENRSSIRESET,0)
self._reg_write(model.vars.AGC_CTRL1_PWRPERIOD, 1)
self._reg_write(model.vars.AGC_CTRL2_DISRFPKD,0)
self._reg_write(model.vars.AGC_CTRL2_DMASEL,0)
self._reg_write(model.vars.AGC_CTRL2_PRSDEBUGEN,0)
self._reg_write(model.vars.AGC_CTRL2_REHICNTTHD,7)
self._reg_write(model.vars.AGC_CTRL2_RELBYCHPWR,3)
self._reg_write(model.vars.AGC_CTRL2_RELOTHD,4)
self._reg_write(model.vars.AGC_CTRL2_RELTARGETPWR,236)
self._reg_write(model.vars.AGC_CTRL2_SAFEMODE,0)
self._reg_write(model.vars.AGC_CTRL2_SAFEMODETHD,3)
self._reg_write(model.vars.AGC_CTRL3_IFPKDDEB,1)
self._reg_write(model.vars.AGC_CTRL3_IFPKDDEBPRD,40)
self._reg_write(model.vars.AGC_CTRL3_IFPKDDEBRST,10)
self._reg_write(model.vars.AGC_CTRL3_IFPKDDEBTHD,1)
self._reg_write(model.vars.AGC_CTRL3_RFPKDDEB,1)
self._reg_write(model.vars.AGC_CTRL3_RFPKDDEBPRD,40)
self._reg_write(model.vars.AGC_CTRL3_RFPKDDEBRST,10)
self._reg_write(model.vars.AGC_CTRL3_RFPKDDEBTHD,1)
self._reg_write(model.vars.AGC_CTRL4_FRZPKDEN,0)
self._reg_write(model.vars.AGC_CTRL4_PERIODRFPKD,4000)
self._reg_write(model.vars.AGC_CTRL4_RFPKDCNTEN,1)
self._reg_write(model.vars.AGC_CTRL4_RFPKDPRDGEAR,4)
self._reg_write(model.vars.AGC_CTRL4_RFPKDSEL,1)
self._reg_write(model.vars.AGC_CTRL4_RFPKDSYNCSEL,1)
self._reg_write(model.vars.AGC_CTRL5_PNUPDISTHD,48)
self._reg_write(model.vars.AGC_CTRL5_PNUPRELTHD,4)
self._reg_write(model.vars.AGC_CTRL5_SEQPNUPALLOW,0)
self._reg_write(model.vars.AGC_CTRL5_SEQRFPKDEN,0)
self._reg_write(model.vars.AGC_GAINRANGE_GAININCSTEP,1)
self._reg_write(model.vars.AGC_GAINRANGE_HIPWRTHD,3)
self._reg_write(model.vars.AGC_GAINRANGE_LATCHEDHISTEP,0)
self._reg_write(model.vars.AGC_GAINSTEPLIM0_MAXPWRVAR,0)
self._reg_write(model.vars.AGC_GAINSTEPLIM0_TRANRSTAGC,0)
self._reg_write(model.vars.AGC_LBT_CCARSSIPERIOD,0)
self._reg_write(model.vars.AGC_LBT_ENCCAGAINREDUCED,0)
self._reg_write(model.vars.AGC_LBT_ENCCARSSIMAX,0)
self._reg_write(model.vars.AGC_LBT_ENCCARSSIPERIOD,0)
self._reg_write(model.vars.AGC_LNAMIXCODE0_LNAMIXSLICE1,61)
self._reg_write(model.vars.AGC_LNAMIXCODE0_LNAMIXSLICE2,46)
self._reg_write(model.vars.AGC_LNAMIXCODE0_LNAMIXSLICE3,36)
self._reg_write(model.vars.AGC_LNAMIXCODE0_LNAMIXSLICE4,28)
self._reg_write(model.vars.AGC_LNAMIXCODE0_LNAMIXSLICE5,21)
self._reg_write(model.vars.AGC_LNAMIXCODE1_LNAMIXSLICE6,17)
self._reg_write(model.vars.AGC_LNAMIXCODE1_LNAMIXSLICE7,12)
self._reg_write(model.vars.AGC_LNAMIXCODE1_LNAMIXSLICE8,10)
self._reg_write(model.vars.AGC_LNAMIXCODE1_LNAMIXSLICE9,6)
self._reg_write(model.vars.AGC_LNAMIXCODE1_LNAMIXSLICE10,5)
self._reg_write(model.vars.AGC_MANGAIN_MANGAINEN,0)
self._reg_write(model.vars.AGC_MANGAIN_MANGAINIFPGA,0)
self._reg_write(model.vars.AGC_MANGAIN_MANGAINLNA,0)
self._reg_write(model.vars.AGC_MANGAIN_MANGAINPN,0)
self._reg_write(model.vars.AGC_MANGAIN_MANIFHILATRST,0)
self._reg_write(model.vars.AGC_MANGAIN_MANIFLOLATRST,0)
self._reg_write(model.vars.AGC_MANGAIN_MANRFLATRST,0)
self._reg_write(model.vars.AGC_PGACODE0_PGAGAIN1,0)
self._reg_write(model.vars.AGC_PGACODE0_PGAGAIN2,1)
self._reg_write(model.vars.AGC_PGACODE0_PGAGAIN3,2)
self._reg_write(model.vars.AGC_PGACODE0_PGAGAIN4,3)
self._reg_write(model.vars.AGC_PGACODE0_PGAGAIN5,4)
self._reg_write(model.vars.AGC_PGACODE0_PGAGAIN6,5)
self._reg_write(model.vars.AGC_PGACODE0_PGAGAIN7,6)
self._reg_write(model.vars.AGC_PGACODE0_PGAGAIN8,7)
self._reg_write(model.vars.AGC_PGACODE1_PGAGAIN9,8)
self._reg_write(model.vars.AGC_PGACODE1_PGAGAIN10,9)
self._reg_write(model.vars.AGC_PGACODE1_PGAGAIN11,10)
self._reg_write(model.vars.AGC_RSSISTEPTHR_RSSIFAST,0)
self._reg_write(model.vars.RAC_PGACTRL_PGAENLATCHI,1)
self._reg_write(model.vars.RAC_PGACTRL_PGAENLATCHQ,1)
self._reg_write(model.vars.AGC_GAINSTEPLIM0_CFLOOPSTEPMAX, 0)
self._reg_write(model.vars.AGC_GAINSTEPLIM0_HYST, 0)
# numbers from Arup's email dated 7/2/19 to Xun
def calc_lnamixenrfpkdlothresh_reg(self, model):
self._reg_write(model.vars.RAC_RX_LNAMIXENRFPKDLOTHRESH, 1)
def calc_lnamixrfatt_reg(self, model):
#Load in model variables
rf_band = model.vars.rf_band.value
#Calculate the LNAMIXRFATT values based on band
if rf_band == model.vars.rf_band.var_enum.BAND_915 or rf_band == model.vars.rf_band.var_enum.BAND_868:
lnamixrfatt = [0, 63, 141, 238, 502, 940, 1269, 1942, 2526, 3484, 4547, 6035, 7678, 9973, 12989, 16383,
5630, 7160, 9180, 11700, 14800, 16383, 16383]
pnindexmax = 16
elif rf_band == model.vars.rf_band.var_enum.BAND_490:
lnamixrfatt = [0, 20, 45, 78, 125, 175, 246, 477, 726, 1012, 1471, 1983, 2703, 3485, 4543, 5835,
7582, 9707, 12672, 16359, 16383, 16383, 16383]
pnindexmax = 20
elif rf_band == model.vars.rf_band.var_enum.BAND_434:
lnamixrfatt = [0, 15, 44, 77, 117, 172, 239, 468, 725, 998, 1469, 1983, 2551, 3491, 4525, 5849,
7623, 9910, 12750, 16383, 14800, 16383, 16383]
pnindexmax = 20
elif rf_band == model.vars.rf_band.var_enum.BAND_315:
lnamixrfatt = [0, 12, 29, 52, 78, 111, 156, 207, 420, 502, 750, 1187, 1502, 2012, 2720, 3521,
4557, 5870, 7623, 9711, 12719, 16383, 16383]
pnindexmax = 22
elif rf_band == model.vars.rf_band.var_enum.BAND_169:
lnamixrfatt = [0, 13, 36, 63, 99, 141, 199, 412, 502, 757, 1190, 1507, 2029, 2743, 3541, 4601,
6055, 7811, 9966, 12964, 16383, 16383, 16383]
pnindexmax = 21
else:
lnamixrfatt = [0, 20, 48, 76, 116, 164, 228, 436, 668, 924, 1210, 1530, 2030, 2720, 3480, 4350,
5630, 7160, 9180, 11700, 14800, 16383, 16383]
pnindexmax = 17
#Write registers
self._reg_write(model.vars.AGC_PNRFATT0_LNAMIXRFATT1,lnamixrfatt[0])
self._reg_write(model.vars.AGC_PNRFATT0_LNAMIXRFATT2, lnamixrfatt[1])
self._reg_write(model.vars.AGC_PNRFATT1_LNAMIXRFATT3, lnamixrfatt[2])
self._reg_write(model.vars.AGC_PNRFATT1_LNAMIXRFATT4, lnamixrfatt[3])
self._reg_write(model.vars.AGC_PNRFATT2_LNAMIXRFATT5, lnamixrfatt[4])
self._reg_write(model.vars.AGC_PNRFATT2_LNAMIXRFATT6, lnamixrfatt[5])
self._reg_write(model.vars.AGC_PNRFATT3_LNAMIXRFATT7, lnamixrfatt[6])
self._reg_write(model.vars.AGC_PNRFATT3_LNAMIXRFATT8, lnamixrfatt[7])
self._reg_write(model.vars.AGC_PNRFATT4_LNAMIXRFATT9, lnamixrfatt[8])
self._reg_write(model.vars.AGC_PNRFATT4_LNAMIXRFATT10, lnamixrfatt[9])
self._reg_write(model.vars.AGC_PNRFATT5_LNAMIXRFATT11, lnamixrfatt[10])
self._reg_write(model.vars.AGC_PNRFATT5_LNAMIXRFATT12, lnamixrfatt[11])
self._reg_write(model.vars.AGC_PNRFATT6_LNAMIXRFATT13, lnamixrfatt[12])
self._reg_write(model.vars.AGC_PNRFATT6_LNAMIXRFATT14, lnamixrfatt[13])
self._reg_write(model.vars.AGC_PNRFATT7_LNAMIXRFATT15, lnamixrfatt[14])
self._reg_write(model.vars.AGC_PNRFATT7_LNAMIXRFATT16, lnamixrfatt[15])
self._reg_write(model.vars.AGC_PNRFATT8_LNAMIXRFATT17, lnamixrfatt[16])
self._reg_write(model.vars.AGC_PNRFATT8_LNAMIXRFATT18, lnamixrfatt[17])
self._reg_write(model.vars.AGC_PNRFATT9_LNAMIXRFATT19, lnamixrfatt[18])
self._reg_write(model.vars.AGC_PNRFATT9_LNAMIXRFATT20, lnamixrfatt[19])
self._reg_write(model.vars.AGC_PNRFATT10_LNAMIXRFATT21, lnamixrfatt[20])
self._reg_write(model.vars.AGC_PNRFATT10_LNAMIXRFATT22, lnamixrfatt[21])
self._reg_write(model.vars.AGC_PNRFATT11_LNAMIXRFATT23, lnamixrfatt[22])
self._reg_write(model.vars.AGC_GAINSTEPLIM1_PNINDEXMAX, pnindexmax)
def calc_agc_series2(self, model):
#We need to override this function because the variable fxo_or_fdec8 will go away (replaced by ADC rate calculations)
mod_format = model.vars.modulation_type.value
hardmodem_freq_actual = model.vars.hardmodem_freq_actual.value
f_if = model.vars.if_frequency_hz_actual.value
# period over which we count how many times we tripped the HI threshold - xtal PLL freq because AGC runs at this clock
if f_if > 0:
periodhi = int(py2round(hardmodem_freq_actual / (2 * f_if)))
else:
periodhi = 14 # for zero-IF used on FPGA tests fix periodhi to 14
# Function of PERIODHI and attack vs decay ratio needed. We currently use 3x
# The scaler 3 could be an input that tunes attack vs decay ratio.
baudrate = model.vars.baudrate.value
if (mod_format == model.vars.modulation_type.var_enum.OOK):
periodlow = int(py2round((hardmodem_freq_actual/(baudrate * 0.9))))
else:
periodlow = 3 * periodhi
self._reg_write(model.vars.AGC_AGCPERIOD0_PERIODHI, int(round(periodhi)))
self._reg_write(model.vars.AGC_AGCPERIOD1_PERIODLOW, int(round(periodlow)))
# % There are many possible ways to handle the table but the simplest would be:
# % this is based on sine wave tripping N times at different gain settings
self._reg_write(model.vars.AGC_STEPDWN_STEPDWN0, 0)
self._reg_write(model.vars.AGC_STEPDWN_STEPDWN1, 1)
self._reg_write(model.vars.AGC_STEPDWN_STEPDWN2, 2)
self._reg_write(model.vars.AGC_STEPDWN_STEPDWN3, 3)
self._reg_write(model.vars.AGC_STEPDWN_STEPDWN4, 4)
self._reg_write(model.vars.AGC_STEPDWN_STEPDWN5, 5)
hicntregion0 = int(py2round(0.55 * periodhi))
hicntregion1 = int(py2round(0.75 * periodhi))
hicntregion2 = int(py2round(0.85 * periodhi))
hicntregion3 = int(py2round(0.90 * periodhi))
hicntregion4 = int(py2round(0.93 * periodhi))
if (hicntregion0 > 255):
print(" WARNING: AGC_HICNTREGION_HICNTREGION 0 calculated beyond range: hicntregion0 {}, hicntregion1 {}, AGC_AGCPERIOD0_PERIODHI {}. Saturating value to 255 !".format(hicntregion0, hicntregion1, periodhi))
hicntregion0 = 255
if (hicntregion1 > 255):
print(" WARNING: AGC_HICNTREGION_HICNTREGION 1 calculated beyond range: hicntregion0 {}, hicntregion1 {}, AGC_AGCPERIOD0_PERIODHI {}. Saturating value to 255 !".format(hicntregion0, hicntregion1, periodhi))
hicntregion1 = 255
self._reg_write(model.vars.AGC_HICNTREGION0_HICNTREGION0, hicntregion0)
self._reg_write(model.vars.AGC_HICNTREGION0_HICNTREGION1, hicntregion1)
self._reg_write(model.vars.AGC_HICNTREGION0_HICNTREGION2, hicntregion2)
self._reg_write(model.vars.AGC_HICNTREGION0_HICNTREGION3, hicntregion3)
self._reg_write(model.vars.AGC_HICNTREGION1_HICNTREGION4, hicntregion4)
# % safe way of setting this.
self._reg_write(model.vars.AGC_AGCPERIOD0_MAXHICNTTHD, hicntregion4)
def calc_fastloopdel_reg(self, model):
#This register does not exist in Ocelot
pass
def calc_ifpgadel_reg(self, model):
#This register does not exist in Ocelot
pass
def calc_lnaslicesdel_reg(self, model):
# This register does not exist in Ocelot
pass
def calc_pngainstep_reg(self, model):
etsi_cat1_compatability = model.vars.etsi_cat1_compatible.value
# PN gain step size should be 1 for ETSI Cat 1 case and 2 in all other cases
if (etsi_cat1_compatability != model.vars.etsi_cat1_compatible.var_enum.Normal):
reg = 1
else:
reg = 2
self._reg_write(model.vars.AGC_GAINRANGE_PNGAINSTEP, reg)
def calc_agc_settling_delay(self, model):
pass
def calc_agcperiod_actual(self, model):
#Read in the actual AGC period register (different name for Ocelot)
agc_period_reg = model.vars.AGC_CTRL1_PWRPERIOD.value
#Calculate the actual period value based on the reg
val = 2 ** (agc_period_reg * 1.0)
model.vars.agcperiod_actual.value = val
def calc_cfloopdel_reg(self, model):
"""calculate AGC settling delay which is basically the group delay of decimation and
channel filters through the datapath plus processing delays
calculations are in channel filter clock cycles to directly program into CFLOOPDEL
Args:
model (ModelRoot) : Data model to read and write variables from
"""
agc_delay = model.vars.agc_settling_delay.value
cfloopdel = agc_delay
if cfloopdel > 127:
cfloopdel = 127
self._reg_write(model.vars.AGC_GAINSTEPLIM0_CFLOOPDEL, int(math.ceil(cfloopdel)))
def calc_agc_cfloopdel_actual(self, model):
reg = model.vars.AGC_GAINSTEPLIM0_CFLOOPDEL.value
adc_freq_actual = model.vars.adc_freq_actual.value
dec0 = model.vars.dec0_actual.value
dec1 = model.vars.dec1_actual.value
src2_actual = model.vars.src2_ratio_actual.value
fsrc2 = adc_freq_actual / 8.0 / dec0 / dec1 * src2_actual
model.vars.cfloopdel_us_actual.value = reg / fsrc2 * 1e6
return
def calc_agc_sub_reg(self, model):
demod_sel = model.vars.demod_select.value
adc_freq_actual = model.vars.adc_freq_actual.value
dec0_actual = model.vars.dec0_actual.value
dec1_actual = model.vars.dec1_actual.value
dec2_actual = model.vars.dec2_actual.value
baudrate = model.vars.baudrate.value
src2_actual = model.vars.src2_ratio_actual.value
osr = adc_freq_actual * src2_actual / (dec0_actual * dec1_actual * 8 * dec2_actual * baudrate)
# when BCR demod is selected we the OSR can be as high as 127
# this does not fit into the RXBR register which is used in generating a baudrate clock
# we switch to using SUB registers instead of RXBR for this purpose when BCR is selected
if (demod_sel == model.vars.demod_select.var_enum.BCR):
rawndec = model.vars.MODEM_BCRDEMODOOK_RAWNDEC.value #Checking inside of the BCR condition to allow inheritance for Bobcat
subperiod = 1
dec = pow(2, rawndec)
osr_bcr = osr / dec
# write half of sampling rate into SUB registers
subfrac = osr_bcr / 2
subint = math.floor(subfrac)
frac = subfrac - subint
best_error = 999
for den in range(1,256):
num = round(frac * den)
error = abs(frac - num/den)
if error < best_error:
subden = den
subnum = num
best_error = error
if best_error < 1e-3:
break
elif (demod_sel == model.vars.demod_select.var_enum.TRECS_VITERBI or
demod_sel == model.vars.demod_select.var_enum.TRECS_SLICER) and osr >= 8:
subint = model.vars.rxbrint.value
subnum = model.vars.rxbrnum.value
subden = model.vars.rxbrden.value
subperiod = 1
else:
subden = 0
subint = 0
subnum = 0
subperiod = 0
self._reg_write(model.vars.AGC_CTRL7_SUBDEN,subden)
self._reg_write(model.vars.AGC_CTRL7_SUBINT,subint)
self._reg_write(model.vars.AGC_CTRL7_SUBNUM,subnum)
self._reg_write(model.vars.AGC_CTRL7_SUBPERIOD,subperiod)
return
def calc_subfrac_actual(self, model):
# Load model variables into local variables
subint_actual = model.vars.AGC_CTRL7_SUBINT.value
subnum_actual = model.vars.AGC_CTRL7_SUBNUM.value
subden_actual = model.vars.AGC_CTRL7_SUBDEN.value
subperiod = model.vars.AGC_CTRL7_SUBPERIOD.value
# Calculate the sub fraction
if subperiod and subden_actual > 0:
subfrac_actual = float(subint_actual + float(subnum_actual) / subden_actual)
else:
subfrac_actual = 0.0
# Load local variables back into model variables
model.vars.subfrac_actual.value = subfrac_actual
def calc_agc_mode_reg(self, model):
demod_sel = model.vars.demod_select.value
preamsch = model.vars.MODEM_TRECPMDET_PREAMSCH.value
# we like AGC to freeze once timing is detected (MODE=1) to avoid AGC changes while receiving data
# the only exception to this is the case where we are directly searching for the sync word when using Viterbi
# in this case we need to set the MODE=2 to freeze the AGC when frame is detected
if (demod_sel == model.vars.demod_select.var_enum.TRECS_VITERBI or demod_sel == model.vars.demod_select.var_enum.TRECS_SLICER):
if preamsch:
mode = 1
else:
mode = 2
else:
mode = 1
self._reg_write(model.vars.AGC_CTRL0_MODE, mode)
return
def calc_agc_decision_matrix_reg(self, model):
dualrfpkddec_val = 240296
self._reg_write(model.vars.AGC_CTRL6_DUALRFPKDDEC, dualrfpkddec_val)
#Removing legacy AGC calculations
def calc_agc_scheme(self, model):
pass
def calc_agc_index_min_atten_reg(self, model):
pass
def calc_agc_index_min_degen_reg(self, model):
pass
def calc_agc_index_min_pga_reg(self, model):
pass
def calc_agc_index_min_slices_reg(self, model):
pass
def calc_agcperiod_reg(self, model):
pass
def calc_agc_reg(self, model):
pass
def calc_agc_cfloopstepmax_reg(self, model):
pass
def calc_hyst_reg(self, model):
pass
def calc_agc_baudrate_calculation_mode(self, model):
demod_select = model.vars.demod_select.value
if demod_select == model.vars.demod_select.var_enum.COHERENT:
# : disable RX baudrate calculation used by AGC and instead assume OSR = 2 * RXBRFRAC
self._reg_write(model.vars.MODEM_CTRL6_RXBRCALCDIS, 1)
else:
self._reg_write(model.vars.MODEM_CTRL6_RXBRCALCDIS, 0)
def calc_dagc_channel_power_accumulator_reg(self, model):
demod_select = model.vars.demod_select.value
modtype = model.vars.modulation_type.value
preamble_pattern_len = model.vars.preamble_pattern_len.value
sens_calculated = model.vars.sensitivity.value
target_osr = model.vars.target_osr.value
agc_period_actual = model.vars.agcperiod_actual.value
baudrate = model.vars.baudrate.value
bitrate = model.vars.bitrate.value
mod_format = model.vars.modulation_type.value
if hasattr(model.profiles, 'Long_Range'):
is_long_range = model.profile == model.profiles.Long_Range
else:
is_long_range = False
if demod_select == model.vars.demod_select.var_enum.COHERENT:
# : accumulate channel power for preamble pattern duration
# : actual avgwin period is 2^(avgwin+2)*2^pwrperiod_s*OSR
# : agc_period_actual = 2^pwrperiod
# : actual avgwin time is 2^(avgwin+2)*agc_period_actual/baudrate
preamble_time_us = preamble_pattern_len * (1 / bitrate) * 1e6
target_avgwin_time_us = 4.0 * preamble_time_us
target_avgwin_period = (target_avgwin_time_us / 1e6) * baudrate
target_avgwin = round(math.log2(target_avgwin_period / agc_period_actual) - 2)
if target_avgwin < 0:
target_avgwin = 0
avgwin = int(target_avgwin)
chpwraccudel = 0
else:
avgwin = 0
chpwraccudel = 0
if demod_select == model.vars.demod_select.var_enum.COHERENT and \
mod_format == model.vars.modulation_type.var_enum.OQPSK:
# : 0 - Channel power is locked when timing is detected
# : 1 - Channel power is locked when DSA is detected
self._reg_write(model.vars.MODEM_COH0_COHCHPWRLOCK, 0)
# : Set to enable automatic restart of channel power - needed to make sure channel power is not dependent on
# : power of received frames
self._reg_write(model.vars.MODEM_COH0_COHCHPWRRESTART, 1)
else:
self._reg_write(model.vars.MODEM_COH0_COHCHPWRLOCK, 0)
self._reg_write(model.vars.MODEM_COH0_COHCHPWRRESTART, 0)
if demod_select == model.vars.demod_select.var_enum.COHERENT and is_long_range:
self._reg_write(model.vars.MODEM_LONGRANGE1_AVGWIN, avgwin)
self._reg_write(model.vars.MODEM_LONGRANGE1_CHPWRACCUDEL, chpwraccudel)
else:
self._reg_write(model.vars.MODEM_LONGRANGE1_AVGWIN, 0)
self._reg_write(model.vars.MODEM_LONGRANGE1_CHPWRACCUDEL, 0)
def calc_dagc_dynamic_bbss_reg(self, model):
demod_select = model.vars.demod_select.value
sens_calculated = model.vars.sensitivity.value
bitrate = model.vars.bitrate.value
mod_format = model.vars.modulation_type.value
if hasattr(model.profiles, 'Long_Range'):
is_long_range = model.profile == model.profiles.Long_Range
else:
is_long_range = False
""" Model calculation range based on DUT power [dBm] """
min_dut_power = -140 # : This is arbitrarily low power that should be below sensitivity
max_dut_power = 10 # : This is maximum supported receive power of DUT
if sens_calculated < min_dut_power:
min_dut_power = round(sens_calculated) - 10
dut_power_list = list(range(min_dut_power,max_dut_power,+1))
""" Model of Q Sample vs. Dut Power """
estimated_adc_noise_dBm = -162.8694 # This is measured value
model_max_Q_list = []
for dut_power in dut_power_list:
# : Model ADC resolution
adc_enob = (dut_power - estimated_adc_noise_dBm - 1.76) / 6.02
# : Model analog frontend noise
minimum_detectable_signal_dBm = -173.9 + 10*math.log10(bitrate) + 4.0
if bitrate <= 2.8e3:
analog_noise_bitwidth = 0.1938 * minimum_detectable_signal_dBm + 33.296
elif bitrate < 67e3: # : TODO change to ADC mode.
analog_noise_bitwidth = 0.1565 * minimum_detectable_signal_dBm + 27.928
else:
analog_noise_bitwidth = 0.1599 * minimum_detectable_signal_dBm + 28.119
# : Determine signal + noise level
signal_max_q = math.pow(2,adc_enob) + math.pow(2,analog_noise_bitwidth)
signal_max_q_bitwidth = math.log2(signal_max_q)
if signal_max_q_bitwidth > 17:
signal_max_q_bitwidth = 17
model_max_Q_list.append(signal_max_q_bitwidth)
# : Calculate bbss shift based on the Q sample model
bbss_model = []
for model_max_Q in model_max_Q_list:
bbss_at_max_Q_calc = round(model_max_Q - 5.5)
bbss_model.append(bbss_at_max_Q_calc)
""" Calculate chpwraccumux model """
model_chpwraccumux_list = []
for dut_power in dut_power_list:
calc_chpwraccumux = dut_power + 139.0
# : Based on measurement, chpwraccumux does not go below 14 due to noise
if calc_chpwraccumux < 14:
calc_chpwraccumux = 14
# : By design, maximum chpwraccumux is 80 due signal power after AGC
elif calc_chpwraccumux > 80:
calc_chpwraccumux = 80
model_chpwraccumux_list.append(calc_chpwraccumux)
""" """
# : Calculate chpwraccumux at sensitivity. This can be used to calculate noise level
chpwraccumux_interp_func = interpolate.interp1d(dut_power_list, model_chpwraccumux_list)
chpwr_accumux_noise = float(chpwraccumux_interp_func(sens_calculated))
""" """
bbss_interp_func = interpolate.interp1d(dut_power_list, bbss_model)
starting_BBSS = math.ceil(bbss_interp_func(sens_calculated))
""" Calculate BBSS transitions """
bbss_transition = []
bbss_transition_threshold = []
for dut_power_index in range(len(dut_power_list)):
bbss_val = bbss_model[dut_power_index]
if bbss_val > starting_BBSS:
if bbss_model[dut_power_index-1] < bbss_val:
bbss_transition.append(int(bbss_val))
bbss_transition_threshold.append(int(round(model_chpwraccumux_list[dut_power_index])))
# : Add two bbss transitions below sensitivity
bbss_transition.insert(0, starting_BBSS)
bbss_transition.insert(0, starting_BBSS - 1)
bbss_transition_threshold.insert(0, int(round(chpwr_accumux_noise-6)))
# : fill up remaining registers
max_bbss_shift = 12
while len(bbss_transition_threshold) < 11:
bbss_transition_threshold.append(80)
while len(bbss_transition) < 12:
bbss_transition.append(max_bbss_shift)
""" Set calculated value """
model.vars.chpwraccu_noise.value = chpwr_accumux_noise
""" Set registers related to dynamic bbss mode"""
if demod_select == model.vars.demod_select.var_enum.COHERENT and \
mod_format == model.vars.modulation_type.var_enum.OQPSK:
# : Enable dynamic BBSS adjustment
self._reg_write(model.vars.MODEM_COH0_COHDYNAMICBBSSEN, 1)
# : BBSS hysteresis
self._reg_write(model.vars.MODEM_LONGRANGE1_HYSVAL, 3)
else:
self._reg_write(model.vars.MODEM_COH0_COHDYNAMICBBSSEN, 0)
self._reg_write(model.vars.MODEM_LONGRANGE1_HYSVAL, 0)
""" Set registers related to dynamic thresholds """
if demod_select == model.vars.demod_select.var_enum.COHERENT and is_long_range:
# : BBSS thresholds
self._reg_write(model.vars.MODEM_LONGRANGE2_LRCHPWRTH1, bbss_transition_threshold[0])
self._reg_write(model.vars.MODEM_LONGRANGE2_LRCHPWRTH2, bbss_transition_threshold[1])
self._reg_write(model.vars.MODEM_LONGRANGE2_LRCHPWRTH3, bbss_transition_threshold[2])
self._reg_write(model.vars.MODEM_LONGRANGE2_LRCHPWRTH4, bbss_transition_threshold[3])
self._reg_write(model.vars.MODEM_LONGRANGE3_LRCHPWRTH5, bbss_transition_threshold[4])
self._reg_write(model.vars.MODEM_LONGRANGE3_LRCHPWRTH6, bbss_transition_threshold[5])
self._reg_write(model.vars.MODEM_LONGRANGE3_LRCHPWRTH7, bbss_transition_threshold[6])
self._reg_write(model.vars.MODEM_LONGRANGE3_LRCHPWRTH8, bbss_transition_threshold[7])
self._reg_write(model.vars.MODEM_LONGRANGE4_LRCHPWRTH9, bbss_transition_threshold[8])
self._reg_write(model.vars.MODEM_LONGRANGE4_LRCHPWRTH10, bbss_transition_threshold[9])
self._reg_write(model.vars.MODEM_LONGRANGE6_LRCHPWRTH11, bbss_transition_threshold[10])
# : BBSS Shifts
self._reg_limit_write(model.vars.MODEM_LONGRANGE4_LRCHPWRSH1, bbss_transition[0], max_bbss_shift)
self._reg_limit_write(model.vars.MODEM_LONGRANGE4_LRCHPWRSH2, bbss_transition[1], max_bbss_shift)
self._reg_limit_write(model.vars.MODEM_LONGRANGE4_LRCHPWRSH3, bbss_transition[2], max_bbss_shift)
self._reg_limit_write(model.vars.MODEM_LONGRANGE4_LRCHPWRSH4, bbss_transition[3], max_bbss_shift)
self._reg_limit_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH5, bbss_transition[4], max_bbss_shift)
self._reg_limit_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH6, bbss_transition[5], max_bbss_shift)
self._reg_limit_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH7, bbss_transition[6], max_bbss_shift)
self._reg_limit_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH8, bbss_transition[7], max_bbss_shift)
self._reg_limit_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH9, bbss_transition[8], max_bbss_shift)
self._reg_limit_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH10, bbss_transition[9], max_bbss_shift)
self._reg_limit_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH11, bbss_transition[10], max_bbss_shift)
self._reg_limit_write(model.vars.MODEM_LONGRANGE6_LRCHPWRSH12, bbss_transition[11], max_bbss_shift)
else:
self._reg_write(model.vars.MODEM_LONGRANGE2_LRCHPWRTH1, 0)
self._reg_write(model.vars.MODEM_LONGRANGE2_LRCHPWRTH2, 0)
self._reg_write(model.vars.MODEM_LONGRANGE2_LRCHPWRTH3, 0)
self._reg_write(model.vars.MODEM_LONGRANGE2_LRCHPWRTH4, 0)
self._reg_write(model.vars.MODEM_LONGRANGE3_LRCHPWRTH5, 0)
self._reg_write(model.vars.MODEM_LONGRANGE3_LRCHPWRTH6, 0)
self._reg_write(model.vars.MODEM_LONGRANGE3_LRCHPWRTH7, 0)
self._reg_write(model.vars.MODEM_LONGRANGE3_LRCHPWRTH8, 0)
self._reg_write(model.vars.MODEM_LONGRANGE4_LRCHPWRTH9, 0)
self._reg_write(model.vars.MODEM_LONGRANGE4_LRCHPWRTH10, 0)
self._reg_write(model.vars.MODEM_LONGRANGE6_LRCHPWRTH11, 0)
self._reg_write(model.vars.MODEM_LONGRANGE4_LRCHPWRSH1, 0)
self._reg_write(model.vars.MODEM_LONGRANGE4_LRCHPWRSH2, 0)
self._reg_write(model.vars.MODEM_LONGRANGE4_LRCHPWRSH3, 0)
self._reg_write(model.vars.MODEM_LONGRANGE4_LRCHPWRSH4, 0)
self._reg_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH5, 0)
self._reg_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH6, 0)
self._reg_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH7, 0)
self._reg_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH8, 0)
self._reg_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH9, 0)
self._reg_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH10, 0)
self._reg_write(model.vars.MODEM_LONGRANGE5_LRCHPWRSH11, 0)
self._reg_write(model.vars.MODEM_LONGRANGE6_LRCHPWRSH12, 0)
def calc_antdiv_gainmode_reg(self, model):
#Antenna diversity has its own AGC gain restore mode that determines how to set the gain index based on previous packet
antdivmode = model.vars.antdivmode.value
if antdivmode == model.vars.antdivmode.var_enum.DISABLE or \
antdivmode == model.vars.antdivmode.var_enum.ANTENNA1:
#The value of this field does matter even when antdiv is disabled
gainmode = 0
else:
gainmode = 1 # : Always enable gain restore mode - clear stored gain from last packet when RX is turned off.
self._reg_write(model.vars.AGC_ANTDIV_GAINMODE, gainmode)
def calc_antdiv_debouncecntthd(self, model):
"""
Number of clock cycles to wait after antenna switching before setting AGC gains.
Args:
model:
Returns:
"""
antdivmode = model.vars.antdivmode.value
debouncecntthd = 40 # : Recommended value by He Gou
if antdivmode == model.vars.antdivmode.var_enum.DISABLE or \
antdivmode == model.vars.antdivmode.var_enum.ANTENNA1:
self._reg_do_not_care(model.vars.AGC_ANTDIV_DEBOUNCECNTTHD)
else:
self._reg_write(model.vars.AGC_ANTDIV_DEBOUNCECNTTHD, debouncecntthd)
def calc_gain_schedule_regs(self, model):
lnaindexborder = 7
pgaindexborder = 8
self._reg_write(model.vars.AGC_GAINRANGE_LNAINDEXBORDER, lnaindexborder)
self._reg_write(model.vars.AGC_GAINRANGE_PGAINDEXBORDER, pgaindexborder) | {"hexsha": "ce5a2c6beb9f2426d591cca98e51a3788fb8d67a", "size": 32819, "ext": "py", "lang": "Python", "max_stars_repo_path": "platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/ocelot/calculators/calc_agc.py", "max_stars_repo_name": "PascalGuenther/gecko_sdk", "max_stars_repo_head_hexsha": "2e82050dc8823c9fe0e8908c1b2666fb83056230", "max_stars_repo_licenses": ["Zlib"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/ocelot/calculators/calc_agc.py", "max_issues_repo_name": "PascalGuenther/gecko_sdk", "max_issues_repo_head_hexsha": "2e82050dc8823c9fe0e8908c1b2666fb83056230", "max_issues_repo_licenses": ["Zlib"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/ocelot/calculators/calc_agc.py", "max_forks_repo_name": "PascalGuenther/gecko_sdk", "max_forks_repo_head_hexsha": "2e82050dc8823c9fe0e8908c1b2666fb83056230", "max_forks_repo_licenses": ["Zlib"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 49.203898051, "max_line_length": 219, "alphanum_fraction": 0.6886559615, "include": true, "reason": "from scipy", "num_tokens": 9459} |
from pygenesys.data.library import nrel_electric_costs
import pandas as pd
import numpy as np
renewable_techs = ['LandbasedWind',
'OffshoreWind',
'UtilityPV',
'ResPV',
'CommPV',
'Geothermal',
'Hydropower',
'CSP',]
def read_atb_data(atb_year=2021):
"""
This function returns the NREL Annual Technology
Baseline (ATB) data as a pandas dataframe. Reads
from ``pygenesys.data.library``
Parameters
----------
atb_year : integer
Indicates the ATB version. Default is 2021.
"""
df = pd.read_csv(nrel_electric_costs,
usecols=['atb_year',
'core_metric_parameter',
'core_metric_case',
'technology',
'techdetail',
'scenario',
'core_metric_variable',
'value'],)
df.dropna(axis=1, inplace=True)
df.rename(columns={'core_metric_variable':'year'}, inplace=True)
df.set_index('year', inplace=True)
df = df[df['atb_year']==atb_year]
df = df.drop('atb_year', axis=1)
return df
def return_nrel_scenario(df, scenario):
"""
This function returns an ATB dataframe for only one
scenario.
Parameters
----------
df : Pandas DataFrame
The NREL ATB dataframe. Must have a ``scenario`` column
with values ['Advanced','Conservative', 'Moderate'].
scenario : string
Specifies the scenario of interest. Must be
* Advanced
* Conservative
* Moderate
"""
df = df[df['scenario'] == scenario]
return df
def get_nrel_techs(df):
"""
Returns the names of the technologyies in
the NREL ATB.
"""
tech_list = np.unique(df['technology'])
return tech_list
def nrel_cost_projection(tech,
cost_metric,
tech_detail=None,
scenario='Moderate',):
"""
Returns cost projections from the NREL Annual
Technology Baseline.
Parameters
----------
tech : string
The name of the technology in the NREL ATB.
Accepted keys:
* 'Commercial Battery Storage' : Li-ion battery storage
* 'Utility-scale Battery Storage' : Li-ion battery storage
* 'Residential Battery Storage' : Li-ion battery storage
* 'Biopower' : Biopower
* 'CSP' : Concentrated solar power
* 'Coal_FE' : Coal Fueled Electricity (COAL FE) power plant
* 'CommPV' : Commercial rooftop PV solar
* 'Geothermal' : Geothermal electricity
* 'Hydropower' : Conventional hydropower
* 'LandbasedWind' : Onshore wind
* 'NaturalGas_FE' : Natural gas fired power plant
* 'Nuclear' : Advanced nuclear power (AP1000)
* 'OffShoreWind' : Offshore wind
* 'ResPV' : Residential rooftop PV solar
* 'UtilityPV' : Utility scale PV solar
cost_metric : string
The string indicating the cost metric
"""
return
if __name__ == "__main__":
df = read_atb_data()
scenario = 'Conservative'
df = return_nrel_scenario(df, scenario)
df = df[df['technology'] == 'Nuclear']
param = 'CAPEX'
# param = 'Fixed O&M'
# param = 'Variable O&M'
# df = df[df['core_metric_parameter']==param]
print(df.columns)
for col in df.columns:
print(col)
print(np.unique(df[col]))
print(df.head(5))
| {"hexsha": "0f33a7de6a7cc498568985862f8ccd7a8e1b22f7", "size": 3629, "ext": "py", "lang": "Python", "max_stars_repo_path": "pygenesys/data/nrel_data.py", "max_stars_repo_name": "arfc/pygenesys", "max_stars_repo_head_hexsha": "2ac0c1fbe7c2dffd0135cf8c52d2c8b31cc31ab4", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-05-27T18:28:48.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-27T18:28:48.000Z", "max_issues_repo_path": "pygenesys/data/nrel_data.py", "max_issues_repo_name": "arfc/pygenesys", "max_issues_repo_head_hexsha": "2ac0c1fbe7c2dffd0135cf8c52d2c8b31cc31ab4", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 34, "max_issues_repo_issues_event_min_datetime": "2021-05-31T18:52:46.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-07T17:57:13.000Z", "max_forks_repo_path": "pygenesys/data/nrel_data.py", "max_forks_repo_name": "arfc/pygenesys", "max_forks_repo_head_hexsha": "2ac0c1fbe7c2dffd0135cf8c52d2c8b31cc31ab4", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2021-05-27T18:30:46.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-01T14:09:48.000Z", "avg_line_length": 27.9153846154, "max_line_length": 68, "alphanum_fraction": 0.5591071921, "include": true, "reason": "import numpy", "num_tokens": 832} |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Interpolate given variable to tropopause height.
###############################################################################
testkw/diag_tropopause.py
Author: Katja Weigel (IUP, Uni Bremen, Germany)
ESA-CMUG project
###############################################################################
Description
-----------
Interpolate given variable to tropopause height.
Currently only cold point tropopause is used based on ta and plev.
Configuration options
---------------------
###############################################################################
"""
import logging
import os
from pprint import pformat
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import iris
from iris.analysis import Aggregator
from esmvaltool.diag_scripts.shared import (group_metadata, run_diagnostic,
select_metadata, sorted_metadata)
from esmvaltool.diag_scripts.shared._base import (
ProvenanceLogger, get_diagnostic_filename, get_plot_filename)
logger = logging.getLogger(os.path.basename(__file__))
def _get_data_for_agg(new_svarcube, new_tacube):
"""Reshape data for use in iris aggregator based on two cubes."""
dims_to_collapse = set()
dims_to_collapse.update(new_svarcube.coord_dims('air_pressure'))
untouched_dims = set(range(new_svarcube.ndim)) -\
set(dims_to_collapse)
dims = list(untouched_dims) + list(dims_to_collapse)
unrolled_data = np.moveaxis(new_tacube.data, dims,
range(new_svarcube.ndim))
return unrolled_data
def _get_range_and_pstring(variable, mean_cube, tropopause=False):
"""Get range for color bar and print string."""
if variable == "Air Temperature":
print_var = "Temperature [K]"
set_range = np.linspace(180, 230, 21)
elif variable == "Geopotential Height":
print_var = "Geopotential Height [m]"
set_range = np.linspace(8000, 22000, 25)
elif variable == "Relative Humidity":
print_var = "Relative Humidity [%]"
set_range = np.linspace(0, 100, 21)
elif variable == "Specific Humidity":
print_var = "Specific Humidity [kg/kg]"
if tropopause:
set_range = np.linspace(0.1e-5, 2.5e-5, 25)
else:
logval = np.log(np.array([1e-6, 1e-5]))
set_range = np.exp(np.linspace(logval[0], logval[1], 41))
else:
print_var = mean_cube.long_name
set_range = np.linspace(np.nanmin(mean_cube.data),
np.nanmax(mean_cube.data), 21)
return {'print_var': print_var, 'set_range': set_range}
def _get_sel_files(cfg, dataname, dim=2):
"""Get filenames from cfg for single models or multi-model mean."""
selection = []
if dim == 2:
for hlp in select_metadata(cfg['input_data'].values(),
dataset=dataname):
selection.append(hlp['filename'])
else:
for hlp in cfg['input_data'].values():
selection.append(hlp['filename'])
return selection
def _get_sel_files_var(cfg, varnames):
"""Get filenames from cfg for all model mean and differen variables."""
selection = []
for var in varnames:
for hlp in select_metadata(cfg['input_data'].values(), short_name=var):
selection.append(hlp['filename'])
return selection
def _get_sel_lvardata(cfg, dataname, lvarnames):
"""Get filenames from cfg for one model and differen variable(s)."""
selection = []
for lvar in lvarnames:
for hlp in select_metadata(cfg['input_data'].values(), long_name=lvar,
dataset=dataname):
selection.append(hlp['filename'])
return selection
def _read_data(attributes, svar):
"""Read data for ta and other variabe from files."""
input_file_svar = attributes['filename'].replace('/ta/', '/' + svar + '/')
input_file_svar = input_file_svar.replace('_ta_', '_' + svar + '_')
logger.debug("Loading %s", input_file_svar)
svarcube = iris.load_cube(input_file_svar)
svarcube = svarcube.collapsed('longitude', iris.analysis.MEAN)
return svarcube
def cube_to_save_profile(var1, var2, names):
"""Create cubes to prepare scatter plot data for saving to netCDF."""
cubes = iris.cube.CubeList([iris.cube.Cube(var1,
var_name=names['var_name1'],
long_name=names['long_name1'],
units=names['units1'])])
cubes.append(iris.cube.Cube(var2, var_name=names['var_name2'],
long_name=names['long_name2'],
units=names['units2']))
return cubes
def find_min(data, data_min, axis):
"""Functions for Iris Aggregator to find the min based on other cube."""
if axis < 0:
# just cope with negative axis numbers
axis += data.ndim
min_ind = np.expand_dims(np.argmin(data_min, axis=axis), axis=axis)
return_data = np.squeeze(np.take_along_axis(data, min_ind, axis=axis))
return return_data
def get_provenance_record(ancestor_files, caption, statistics,
domains, plot_type='zonal'):
"""Get Provenance record."""
record = {
'caption': caption,
'statistics': statistics,
'domains': domains,
'plot_type': plot_type,
'projects': ['cmug'],
'realms': ['atmos'],
'themes': ['atmDyn'],
'authors': [
'weigel_katja',
],
'references': [
'acknow_project',
],
'ancestors': ancestor_files,
}
return record
def get_prof_and_plt_data(cfg, data, available_vars_min_tas):
"""Plot data for singe data sets and get profile for each."""
profiles = {}
for svar in available_vars_min_tas:
profiles[svar] = {}
# Make an iris aggregator to find value based on minimum different cube.
min_pos = Aggregator('ag_find_min', find_min,
units_func=lambda units: 1)
# interpolate to dense grid, use equal dist points in log(p)
logpr = np.log(np.array([25000, 2500]))
sample_points = [('air_pressure', np.exp(np.linspace(logpr[0], logpr[1],
221)))]
for attributes in data['ta']:
logger.info("Processing dataset %s", attributes['dataset'])
dataset = attributes['dataset']
tacube = _read_data(attributes, 'ta')
new_tacube = tacube.interpolate(sample_points,
iris.analysis.Linear())
unrolled_data = _get_data_for_agg(new_tacube, new_tacube)
plot_zonal_timedev(cfg, new_tacube.collapsed('air_pressure',
min_pos,
data_min=unrolled_data),
dataset, "Cold point tropopause ",
"Air Temperature")
for svar in available_vars_min_tas:
svarcube = _read_data(attributes, svar)
profiles[svar][dataset] = svarcube.collapsed(['time', 'latitude'],
iris.analysis.MEAN)
plot_zonal_mean(cfg, svarcube.collapsed(['time'],
iris.analysis.MEAN),
dataset, "Zonal mean ",
svarcube.long_name)
new_svarcube = svarcube.interpolate(sample_points,
iris.analysis.Linear())
unrolled_data = _get_data_for_agg(new_svarcube, new_tacube)
plot_zonal_timedev(cfg,
new_svarcube.collapsed('air_pressure',
min_pos,
data_min=unrolled_data),
dataset, "Cold point tropopause ",
new_svarcube.long_name)
return profiles
def plot_zonal_mean(cfg, mean_cube, dataname, titlestr, variable):
"""Plot zonal mean contour."""
# Plot data
# create figure and axes instances
fig, axx = plt.subplots(figsize=(7, 5))
rps = _get_range_and_pstring(variable, mean_cube)
# draw filled contours
cnplot = plt.contourf(
mean_cube.coord('latitude').points,
mean_cube.coord('air_pressure').points / 100.0,
mean_cube.data,
rps['set_range'],
cmap='jet',
extend='both')
axx = plt.gca()
axx.invert_yaxis()
axx.set_ylim(250, 1)
# add colorbar
cbar = fig.colorbar(cnplot, ax=axx, shrink=0.8)
# add colorbar title string
cbar.set_label(rps['print_var'])
axx.set_ylabel('Pressure [hPa]')
axx.set_xlabel('Latitude')
axx.set_title(titlestr + variable)
fig.tight_layout()
caption = dataname + " " + titlestr + variable +\
" between 250 and 1 hPa." +\
" The diagnostic averages the complete time series."
figname = 'fig_' + dataname + "_" + titlestr.replace(" ", "_") +\
variable.replace(" ", "_")
fig.savefig(get_plot_filename(figname, cfg), dpi=300)
plt.close()
provenance_record = get_provenance_record(_get_sel_lvardata(cfg,
dataname,
[variable]),
caption, ['mean'], ['global'])
#
diagnostic_file = get_diagnostic_filename(figname, cfg)
#
logger.info("Saving analysis results to %s", diagnostic_file)
#
iris.save(mean_cube, target=diagnostic_file)
#
logger.info("Recording provenance of %s:\n%s", diagnostic_file,
pformat(provenance_record))
with ProvenanceLogger(cfg) as provenance_logger:
provenance_logger.log(diagnostic_file, provenance_record)
def plot_zonal_timedev(cfg, mean_cube, dataname, titlestr, variable):
"""Plot zonal mean temporal developement at tropopause."""
# Plot data
# create figure and axes instances
fig, axx = plt.subplots(figsize=(7, 12))
rps = _get_range_and_pstring(variable, mean_cube, tropopause=True)
iris.coord_categorisation.add_year(mean_cube, 'time', name='year')
iris.coord_categorisation.add_month_number(mean_cube, 'time',
name='month_number')
# Adjust (ncdf) time to the format matplotlib expects
cnplot = plt.contourf(
mean_cube.coord('latitude').points,
mean_cube.coord('year').points +
(mean_cube.coord('month_number').points - 1.0) / 12.0,
mean_cube.data,
rps['set_range'],
cmap='rainbow',
# cmap='RdBu_r',
extend='both')
# add colorbar
cbar = fig.colorbar(cnplot, ax=axx, shrink=0.8)
# add colorbar title string
cbar.set_label(rps['print_var'])
axx.set_ylabel('Time')
axx.set_xlabel('Latitude')
axx.set_title(titlestr + variable)
fig.tight_layout()
figname = 'fig_' + dataname + "_" + titlestr.replace(" ", "_") + \
variable.replace(" ", "_")
caption = dataname + " " + titlestr + variable
fig.savefig(get_plot_filename(figname, cfg), dpi=300)
plt.close()
provenance_record = get_provenance_record(_get_sel_lvardata(cfg,
dataname,
[variable]),
caption, ['mean'], ['global'])
#
diagnostic_file = get_diagnostic_filename(figname, cfg)
#
logger.info("Saving analysis results to %s", diagnostic_file)
#
iris.save(mean_cube, target=diagnostic_file)
#
logger.info("Recording provenance of %s:\n%s", diagnostic_file,
pformat(provenance_record))
with ProvenanceLogger(cfg) as provenance_logger:
provenance_logger.log(diagnostic_file, provenance_record)
def plot_profiles(cfg, profiles, available_vars_min_tas, available_datasets):
"""Plot zonal mean contour."""
# Plot data
# create figure and axes instances
for svar in available_vars_min_tas:
fig, axx = plt.subplots(figsize=(7, 5))
for iii, dataset in enumerate(available_datasets):
plt.plot((profiles[svar][dataset]).data,
(profiles[svar][dataset]).coord('air_pressure').points /
100.0, label=dataset)
if iii == 0:
profiles_save = iris.cube.CubeList([profiles[svar][dataset]])
else:
profiles_save.append(profiles[svar][dataset])
axx = plt.gca()
axx.invert_yaxis()
plt.legend(loc='upper right')
axx.set_ylabel('Pressure [hPa]')
axx.set_ylim(250, 1)
onedat = profiles[svar][available_datasets[0]]
if onedat.long_name == "Specific Humidity":
unitstr = "kg/kg"
axx.set_xlim(0, 1e-4)
else:
unitstr = str(onedat.units)
axx.set_xlabel(onedat.long_name +
' [' + unitstr + ']')
axx.set_title('Average ' +
onedat.long_name +
' profile')
fig.tight_layout()
figname = 'fig_profile_' +\
onedat.long_name.replace(" ", "_")
fig.savefig(get_plot_filename(figname, cfg), dpi=300)
plt.close()
provenance_record = get_provenance_record(_get_sel_files_var(cfg,
svar),
'Average ' +
onedat.long_name +
' profile', ['mean'],
['global'])
diagnostic_file = get_diagnostic_filename(figname, cfg)
#
logger.info("Saving analysis results to %s", diagnostic_file)
#
iris.save(profiles_save, target=diagnostic_file)
#
logger.info("Recording provenance of %s:\n%s", diagnostic_file,
pformat(provenance_record))
with ProvenanceLogger(cfg) as provenance_logger:
provenance_logger.log(diagnostic_file, provenance_record)
def main(cfg):
"""Read in data for tropopause calculation."""
available_vars = list(group_metadata(cfg['input_data'].values(),
'short_name'))
available_datasets = list(group_metadata(cfg['input_data'].values(),
'dataset'))
logging.debug("Found variables in recipe:\n%s", available_vars)
available_vars_min_tas = deepcopy(available_vars)
available_vars_min_tas.remove('ta')
# Get input data
data = {}
for varname in available_vars:
data[varname] = select_metadata(cfg['input_data'].values(),
short_name=varname)
data[varname] = sorted_metadata(data[varname], sort='dataset')
profiles = get_prof_and_plt_data(cfg, data, available_vars_min_tas)
plot_profiles(cfg, profiles, available_vars_min_tas, available_datasets)
if __name__ == '__main__':
with run_diagnostic() as config:
main(config)
| {"hexsha": "0401bb45af5b89fab82e9b57cff33c3b6e58d081", "size": 15496, "ext": "py", "lang": "Python", "max_stars_repo_path": "esmvaltool/diag_scripts/cmug_h2o/diag_tropopause_zonalmean.py", "max_stars_repo_name": "cffbots/ESMValTool", "max_stars_repo_head_hexsha": "a9b6592a02f2085634a214ff5f36a736fa18ff47", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "esmvaltool/diag_scripts/cmug_h2o/diag_tropopause_zonalmean.py", "max_issues_repo_name": "cffbots/ESMValTool", "max_issues_repo_head_hexsha": "a9b6592a02f2085634a214ff5f36a736fa18ff47", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "esmvaltool/diag_scripts/cmug_h2o/diag_tropopause_zonalmean.py", "max_forks_repo_name": "cffbots/ESMValTool", "max_forks_repo_head_hexsha": "a9b6592a02f2085634a214ff5f36a736fa18ff47", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.9535962877, "max_line_length": 79, "alphanum_fraction": 0.5701471347, "include": true, "reason": "import numpy", "num_tokens": 3352} |
import numpy as np
from typing import List, Tuple, Any
from sklearn.metrics import accuracy_score
def ChooseBestModel(models_: List[Any],
train_data: Tuple[np.ndarray],
test_data: Tuple[np.ndarray]):
"""
Takes list of potential models and returns the most accurate model
and its accuracy.
Parameters
----------
- models_ : list of models to choose each model must support 'fit' and
'predict' methods
- train_date : tuple {trainX: np.ndarray, trainY: np.ndarray}
data to fit model
- test_date : tuple {testX: np.ndarray, testY: np.ndarray}
data to test fitted model
Returns
-------
tuple {the most accurate model: any model class, its accuracy: float}
"""
models = models_.copy()
# Fit each model
for model in models:
model.fit(train_data[0], train_data[1])
# Calculate accuracy
scores = []
for model in models:
pred = model.predict(test_data[0])
score = accuracy_score(test_data[1], pred)
scores.append(score)
# Return the most accurate model and its score
return models[np.argmax(scores)], max(scores)
| {"hexsha": "ad63bef020d84ca97f189baee456172ec187020e", "size": 1269, "ext": "py", "lang": "Python", "max_stars_repo_path": "src/choose_model.py", "max_stars_repo_name": "eightlay/ReviewAnalysis", "max_stars_repo_head_hexsha": "d66f5eef1c24f97299cc1a2b33e0da68a6a2d44d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/choose_model.py", "max_issues_repo_name": "eightlay/ReviewAnalysis", "max_issues_repo_head_hexsha": "d66f5eef1c24f97299cc1a2b33e0da68a6a2d44d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/choose_model.py", "max_forks_repo_name": "eightlay/ReviewAnalysis", "max_forks_repo_head_hexsha": "d66f5eef1c24f97299cc1a2b33e0da68a6a2d44d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.9512195122, "max_line_length": 78, "alphanum_fraction": 0.5925925926, "include": true, "reason": "import numpy", "num_tokens": 267} |
from collections import defaultdict
from pathlib import Path
from typing import Dict, List
import numpy as np
import orjson
import typer
from sklearn.preprocessing import LabelBinarizer, MultiLabelBinarizer
from geneeval.common.data_utils import load_benchmark, load_features
from geneeval.common.utils import BENCHMARK_FILEPATH, TASKS, resolve_tasks
from geneeval.engine import Engine
from geneeval.fetcher.auto_fetcher import AutoFetcher
from geneeval.metrics.auto_metric import AutoMetric
app = typer.Typer()
evaluate_app = typer.Typer()
app.add_typer(evaluate_app, name="evaluate")
@app.command()
def build_benchmark() -> None:
"""Downloads the benchmark data. Include or exclude specific tasks with `include_tasks` and
`exclude_tasks` respectively.
"""
fetcher = AutoFetcher(list(TASKS.keys()))
benchmark = fetcher.fetch()
benchmark = {**benchmark, **orjson.loads(BENCHMARK_FILEPATH.read_bytes())}
benchmark = orjson.dumps(benchmark, option=orjson.OPT_INDENT_2)
BENCHMARK_FILEPATH.write_bytes(benchmark)
@app.command()
def prepare(
filepath: Path = typer.Argument(
..., writable=True, help="Filepath to save prepared benchmark file."
),
include_tasks: List[str] = typer.Option(
None, help="A task name (or list of task names) to include in the prepared data."
),
exclude_tasks: List[str] = typer.Option(
None, help="A task name (or list of task names) to exclude in the prepared data."
),
):
tasks = resolve_tasks(include_tasks, exclude_tasks)
benchmark = load_benchmark()
prepared_benchmark = {task: benchmark[task] for task in tasks}
task_specific_genes = list(
set(
[
gene
for partition in prepared_benchmark.values()
for genes in partition.values()
for gene in genes.keys()
]
)
) # Find the subset of genes specific to the `tasks` specified
prepared_benchmark["inputs"] = {gene: benchmark["inputs"][gene] for gene in task_specific_genes}
prepared_benchmark = orjson.dumps(prepared_benchmark, option=orjson.OPT_INDENT_2)
filepath.write_bytes(prepared_benchmark)
@evaluate_app.command("features")
def evaluate_features(
filepath: Path = typer.Argument(
..., exists=True, dir_okay=False, help="Filepath to the gene features."
),
include_tasks: List[str] = typer.Option(
None, help="A task name (or list of task names) to include in the evaluation."
),
exclude_tasks: List[str] = typer.Option(
None, help="A task name (or list of task names) to exclude in the evaluation."
),
) -> Dict:
"""Evaluate fixed-length feature vectors on the benchmark. Include or exclude specific tasks
with `include_tasks` and `exclude_tasks` respectively.
"""
features = load_features(filepath)
engine = Engine(features, include_tasks, exclude_tasks)
engine.run()
# Nicely display results in the console.
# Save the results to disk (should be a format that is easy to load)
results = engine.results
print(
orjson.dumps(results, option=orjson.OPT_INDENT_2 | orjson.OPT_SERIALIZE_NUMPY).decode("utf")
)
return results
@evaluate_app.command("predictions")
def evaluate_predictions(
filepath: Path = typer.Argument(
..., exists=True, dir_okay=False, help="Filepath to the gene label predictions."
),
) -> Dict:
"""Evaluate predictions on the benchmark."""
with open(filepath, "r") as f:
predictions = orjson.loads(f.read())
benchmark = load_benchmark()
# Create a recursive dictionary so that we can add keys willy-nilly.
# https://stackoverflow.com/a/19189356/6046281
def recursive_defaultdict():
return defaultdict(recursive_defaultdict)
results = recursive_defaultdict()
for task, partitions in predictions.items():
metric = AutoMetric(task)
# Fit the label binarizer on the train set of the benchmark.
multilabel = (
isinstance(list(benchmark[task]["train"].values())[0], list)
and len(max(list(benchmark[task]["train"].values()), key=len)) > 1
)
lb = MultiLabelBinarizer() if multilabel else LabelBinarizer()
lb.fit(list(benchmark[task]["train"].values()))
for partition, data in partitions.items():
y_true = lb.transform(list(benchmark[task][partition].values())).astype(np.float32)
y_pred = lb.transform(list(data.values())).astype(np.float32)
results[task][partition][metric.__name__] = round(metric(y_true, y_pred), 2)
print(
orjson.dumps(results, option=orjson.OPT_INDENT_2 | orjson.OPT_SERIALIZE_NUMPY).decode("utf")
)
return results
| {"hexsha": "ad47b9d42058612953c2bc21778718cfce94b9b6", "size": 4766, "ext": "py", "lang": "Python", "max_stars_repo_path": "geneeval/main.py", "max_stars_repo_name": "BaderLab/GeneEval", "max_stars_repo_head_hexsha": "ad26540d999e7f0562ad1d67d574e08edcadae57", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2020-07-15T18:02:00.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-30T21:48:10.000Z", "max_issues_repo_path": "geneeval/main.py", "max_issues_repo_name": "BaderLab/GeneEval", "max_issues_repo_head_hexsha": "ad26540d999e7f0562ad1d67d574e08edcadae57", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 232, "max_issues_repo_issues_event_min_datetime": "2020-07-29T18:34:42.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T15:06:02.000Z", "max_forks_repo_path": "geneeval/main.py", "max_forks_repo_name": "BaderLab/GeneEval", "max_forks_repo_head_hexsha": "ad26540d999e7f0562ad1d67d574e08edcadae57", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 36.3816793893, "max_line_length": 100, "alphanum_fraction": 0.6875786823, "include": true, "reason": "import numpy", "num_tokens": 1090} |
import pathlib
from collections import deque
import gym
import numpy as np
from mani_skill_learn.env import get_env_info
from mani_skill_learn.env.observation_process import process_mani_skill_base
from mani_skill_learn.methods.builder import build_brl
from mani_skill_learn.utils.data import to_np, unsqueeze
from mani_skill_learn.utils.meta import Config
from mani_skill_learn.utils.torch import load_checkpoint
import os
class ObsProcess:
# modified from Saself.agentenRLWrapper
def __init__(self, env, obs_mode, stack_frame=1):
"""
Stack k last frames for point clouds or rgbd
"""
self.env = env
self.obs_mode = obs_mode
self.stack_frame = stack_frame
self.buffered_data = {}
def _update_buffer(self, obs):
for key in obs:
if key not in self.buffered_data:
self.buffered_data[key] = deque([obs[key]] * self.stack_frame, maxlen=self.stack_frame)
else:
self.buffered_data[key].append(obs[key])
def _get_buffer_content(self):
axis = 0 if self.obs_mode == 'pointcloud' else -1
return {key: np.concatenate(self.buffered_data[key], axis=axis) for key in self.buffered_data}
def process_observation(self, observation):
if self.obs_mode == "state":
return observation
observation = process_mani_skill_base(observation, self.env)
visual_data = observation[self.obs_mode]
self._update_buffer(visual_data)
visual_data = self._get_buffer_content()
state = observation['agent']
# Convert dict of array to list of array with sorted key
ret = {}
ret[self.obs_mode] = visual_data
ret['state'] = state
return ret
class BasePolicy(object):
def __init__(self, opts=None):
self.obs_mode = 'pointcloud'
def act(self, observation):
raise NotImplementedError()
def reset(self): # if you use an RNN-based policy, you need to implement this function
pass
class UserPolicy(BasePolicy):
def __init__(self, env_name):
super().__init__()
self.env = gym.make(env_name)
self.obs_mode = 'pointcloud' # remember to set this!
self.env.set_env_mode(obs_mode=self.obs_mode)
self.stack_frame = 1
# cfg_path = str(pathlib.Path('./configs/bc/mani_skill_point_cloud_transformer.py').resolve())
# cfg_path = os.path.join(os.path.dirname(__file__), './configs/cql/mani_skill_point_cloud_transformer.py')
# cfg_path = os.path.join(os.path.dirname(__file__), './configs/bc/mani_skill_point_cloud_transformer.py')
# cfg_path = os.path.join(os.path.dirname(__file__), './configs/bc/mani_skill_point_cloud_transformer2.py')
# cfg_path = str(pathlib.Path(cfg_path).resolve())
# cfg = Config.fromfile(cfg_path)
# cfg.env_cfg['env_name'] = env_name
# obs_shape, action_shape, action_space = get_env_info(cfg.env_cfg)
# cfg.agent['obs_shape'] = obs_shape
# cfg.agent['action_shape'] = action_shape
# cfg.agent['action_space'] = action_space
self.agents = []
if env_name.find('Door') >= 0:
matrix_index = [i for i in range(20)]
model_paths = [
'./work_dirs/bc_pointnet_transformer_door10_0/BC/models/model_110000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_1/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_2/BC/models/model_100000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_3/BC/models/model_110000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_4/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_5/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_6/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_7/BC/models/model_100000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_8/BC/models/model_100000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_9/BC/models/model_110000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_10/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_11/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_12/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_13/BC/models/model_130000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_14/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_15/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_16/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_17/BC/models/model_110000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_18/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_door10_19/BC/models/model_120000.ckpt',
]
config7 = False #True
model7_path = './work_dirs/bc_pointnet_transformer_door7/BC/models/model_150000.ckpt'
elif env_name.find('Drawer') >= 0:
matrix_index = [i for i in range(20)]
model_paths = [
'./work_dirs/bc_pointnet_transformer_drawer10_0/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_1/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_2/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_3/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_4/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_5/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_6/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_7/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_8/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_9/BC/models/model_100000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_10/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_11/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_12/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_13/BC/models/model_130000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_14/BC/models/model_110000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_15/BC/models/model_130000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_16/BC/models/model_110000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_17/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_18/BC/models/model_130000.ckpt',
'./work_dirs/bc_pointnet_transformer_drawer10_19/BC/models/model_120000.ckpt',
]
config7 = False #True
model7_path = './work_dirs/bc_pointnet_transformer_drawer7/BC/models/model_120000.ckpt'
elif env_name.find('Bucket') >= 0:
matrix_index = [i for i in range(20)]
model_paths = [
'./work_dirs/bc_pointnet_transformer_bucket10_0/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_1/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_2/BC/models/model_110000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_3/BC/models/model_100000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_4/BC/models/model_110000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_5/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_6/BC/models/model_110000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_7/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_8/BC/models/model_100000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_9/BC/models/model_100000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_10/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_11/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_12/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_13/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_14/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_15/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_16/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_17/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_18/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_bucket10_19/BC/models/model_140000.ckpt',
]
config7 = False #True #False
model7_path = './work_dirs/bc_pointnet_transformer_bucket7/BC/models/model_30000.ckpt'
elif env_name.find('Chair') >= 0:
matrix_index = [i for i in range(20)]
model_paths = [
'./work_dirs/bc_pointnet_transformer_chair10_0/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_1/BC/models/model_110000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_2/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_3/BC/models/model_130000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_4/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_5/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_6/BC/models/model_100000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_7/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_8/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_9/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_10/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_11/BC/models/model_110000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_12/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_13/BC/models/model_150000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_14/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_15/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_16/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_17/BC/models/model_140000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_18/BC/models/model_120000.ckpt',
'./work_dirs/bc_pointnet_transformer_chair10_19/BC/models/model_100000.ckpt',
]
config7 = False #True #False
model7_path = './work_dirs/bc_pointnet_transformer_chair7/BC/models/model_150000.ckpt'
for idx, i in enumerate(matrix_index):
cfg_path = os.path.join(os.path.dirname(__file__), './configs/bc/mani_skill_point_cloud_transformer10.py')
cfg_path = str(pathlib.Path(cfg_path).resolve())
cfg = Config.fromfile(cfg_path)
cfg.env_cfg['env_name'] = env_name
obs_shape, action_shape, action_space = get_env_info(cfg.env_cfg)
cfg.agent['obs_shape'] = obs_shape
cfg.agent['action_shape'] = action_shape
cfg.agent['action_space'] = action_space
cfg.agent['policy_cfg']['nn_cfg']['matrix_index'] = i
cur_agent = build_brl(cfg.agent)
ckpt_path = os.path.join(os.path.dirname(__file__), model_paths[idx])
load_checkpoint(cur_agent,
str(pathlib.Path(ckpt_path).resolve()),
map_location='cpu'
)
cur_agent.to('cuda') # dataparallel not done here
cur_agent.eval()
self.agents.append(cur_agent)
if config7:
cfg_path = os.path.join(os.path.dirname(__file__), './configs/bc/mani_skill_point_cloud_transformer7.py')
cfg_path = str(pathlib.Path(cfg_path).resolve())
cfg = Config.fromfile(cfg_path)
cfg.env_cfg['env_name'] = env_name
obs_shape, action_shape, action_space = get_env_info(cfg.env_cfg)
cfg.agent['obs_shape'] = obs_shape
cfg.agent['action_shape'] = action_shape
cfg.agent['action_space'] = action_space
cfg.agent['policy_cfg']['nn_cfg']['matrix_index'] = -1
cur_agent = build_brl(cfg.agent)
ckpt_path = os.path.join(os.path.dirname(__file__), model7_path)
load_checkpoint(cur_agent,
str(pathlib.Path(ckpt_path).resolve()),
map_location='cpu'
)
cur_agent.to('cuda') # dataparallel not done here
cur_agent.eval()
self.agents.append(cur_agent)
# self.agent = build_brl(cfg.agent)
# if env_name.find('Bucket') >= 0:
# ckpt_path = os.path.join(os.path.dirname(__file__), './work_dirs/cql_transformer_bucket/CQL/models/model_115000.ckpt')
# if env_name.find('Chair') >= 0:
# ckpt_path = os.path.join(os.path.dirname(__file__), './work_dirs/cql_transformer_chair/CQL/models/model_115000.ckpt')
# if env_name.find('Door') >= 0:
# ckpt_path = os.path.join(os.path.dirname(__file__), './work_dirs/base_bc_point_transformer_door/BC/models/model_140000.ckpt')
# ckpt_path = os.path.join(os.path.dirname(__file__), './work_dirs/bc_pointnet_transformer_door3/BC/models/model_5000.ckpt')
# ckpt_path = os.path.join(os.path.dirname(__file__), './work_dirs/bc_pointnet_transformer_door3/BC/models/model_25000.ckpt')
# if env_name.find('Drawer') >= 0:
# ckpt_path = os.path.join(os.path.dirname(__file__), './work_dirs/cql_transformer_drawer/CQL/models/model_90000.ckpt')
# load_checkpoint(self.agent,
# str(pathlib.Path('./example_mani_skill_data/OpenCabinetDrawer_1045_link_0-v0_PN_Transformer.ckpt').resolve()),
# map_location='cpu'
# )
# load_checkpoint(self.agent,
# str(pathlib.Path(ckpt_path).resolve()),
# map_location='cpu'
# )
# self.agent.to('cuda') # dataparallel not done here
# self.agent.eval()
self.lstm_obs = []
self.obsprocess = ObsProcess(self.env, self.obs_mode, self.stack_frame)
# def act(self, observation):
# ##### Replace with your code
# observation = self.obsprocess.process_observation(observation)
# return to_np(self.agent(unsqueeze(observation, axis=0), mode='eval'))[0]
def reset(self):
self.lstm_obs = []
return super().reset()
def act(self, observation):
##### Replace with your code
# observation = self.obsprocess.process_observation(observation)
# return to_np(self.agent(unsqueeze(observation, axis=0), mode='eval'))[0]
obs = self.obsprocess.process_observation(observation)
action_list = []
if len(self.lstm_obs) < self.agents[0].lstm_len:
self.lstm_obs.append(obs)
else:
for i in range(self.agents[0].lstm_len - 1):
self.lstm_obs[i] = self.lstm_obs[i + 1]
self.lstm_obs[-1] = obs
for cur_agent in self.agents:
if cur_agent.lstm_len == 1 or len(self.lstm_obs) < cur_agent.lstm_len:
action = to_np(cur_agent(unsqueeze(obs, axis=0), mode='eval'))[0]
action_list.append(action)
else:
# for k in merge_obs:
# print("k: %s; v: %s" % (k, merge_obs[k]))
state_list = []
xyz_list = []
rgb_list = []
seg_list = []
for i in range(cur_agent.lstm_len):
state_list.append(self.lstm_obs[i]['state'])
xyz_list.append(self.lstm_obs[i]['pointcloud']['xyz'])
rgb_list.append(self.lstm_obs[i]['pointcloud']['rgb'])
seg_list.append(self.lstm_obs[i]['pointcloud']['seg'])
# k = 'state'
# merge_obs[k] = [merge_obs[k], lstm_obs[i+1].get(k)]
# k = 'pointcloud'
# merge_obs[k] = {sub_k: [merge_obs[k][sub_k], lstm_obs[i+1][k][sub_k]] for sub_k in merge_obs[k]}
# merge_obs = {k: [merge_obs[k], lstm_obs[i+1].get(k)] for k in merge_obs}
merge_obs = self.lstm_obs[0]
merge_obs['state'] = np.stack(state_list)
# print("state: %s" % (str(merge_obs['state'].shape)))
# k = 'state'
# # merge_obs = {k: np.stack(merge_obs[k]) for k in merge_obs}
# merge_obs[k] = np.stack(merge_obs[k])
# print("k: %s; v: %s" % (k, merge_obs[k].shape))
k = 'pointcloud'
# merge_obs[k] = {sub_k: np.stack(merge_obs[k][sub_k]) for sub_k in merge_obs[k]}
merge_obs[k]['xyz'] = np.stack(xyz_list)
merge_obs[k]['rgb'] = np.stack(rgb_list)
merge_obs[k]['seg'] = np.stack(seg_list)
# for sub_k in merge_obs[k]:
# print("sub_k: %s; v: %s" % (str(sub_k), str(merge_obs[k][sub_k].shape)))
# action = to_np(self.agent(unsqueeze(merge_obs, axis=0), mode=self.sample_mode))[0]
action = to_np(cur_agent(merge_obs, mode='eval'))[0]
# print("cur action: %s" % (str(action.shape)))
action_list.append(action)
action_list = np.stack(action_list)
action = np.mean(action_list, axis=0)
return action
| {"hexsha": "a21e8c4965d4be4b202ec28d42af1be78d00c829", "size": 18715, "ext": "py", "lang": "Python", "max_stars_repo_path": "user_solution.py", "max_stars_repo_name": "Zed-Wu/ManiSkill-Learn", "max_stars_repo_head_hexsha": "8056fe327752cd0863f8730672fe62bd85a0ec12", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "user_solution.py", "max_issues_repo_name": "Zed-Wu/ManiSkill-Learn", "max_issues_repo_head_hexsha": "8056fe327752cd0863f8730672fe62bd85a0ec12", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "user_solution.py", "max_forks_repo_name": "Zed-Wu/ManiSkill-Learn", "max_forks_repo_head_hexsha": "8056fe327752cd0863f8730672fe62bd85a0ec12", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 56.3704819277, "max_line_length": 139, "alphanum_fraction": 0.6423189955, "include": true, "reason": "import numpy", "num_tokens": 4596} |
from collections import ChainMap
from itertools import chain
from functools import reduce
from typing import (
Dict, Tuple, Optional, NamedTuple, Iterator, List, Union
)
from functools import partial
import numpy as np
from autofit.graphical.factor_graphs import \
Factor, AbstractNode, FactorGraph, FactorValue, JacobianValue
from autofit.graphical.messages import \
AbstractMessage, FixedMessage, map_dists
from autofit.graphical.utils import \
prod, add_arrays, OptResult, Status, aggregate, diag, Axis
from autofit.mapper.variable import Variable
VariableFactorDist = Dict[str, Dict[Factor, AbstractMessage]]
Projection = Dict[str, AbstractMessage]
def project_on_to_factor_approx(
factor_approx: "FactorApproximation",
model_dist: Dict[str, AbstractMessage],
delta: float = 1.,
status: Optional[Status] = None
) -> Tuple["FactorApproximation", Status]:
"""
For a passed FactorApproximation this calculates the
factor messages such that
model_dist = factor_dist * cavity_dist
"""
success, messages = Status() if status is None else status
assert 0 < delta <= 1
factor_projection = {}
# log_norm = 0.
for v, q_fit in model_dist.items():
q_cavity = factor_approx.cavity_dist.get(v)
if isinstance(q_fit, FixedMessage):
factor_projection[v] = q_fit
elif q_fit.is_valid:
if q_cavity:
q_f0 = factor_approx.factor_dist[v]
q_f1 = (q_fit / q_cavity)
else:
# In the case that q_cavity does not exist the model fit
# equals the factor approximation
q_f1 = q_fit
# weighted update
if delta != 1:
q_f1 = (q_f1 ** delta).sum_natural_parameters(q_f0 ** (1 - delta))
if not q_f1.is_valid:
# partial updating of values
q_f1 = q_f1.update_invalid(q_f0)
messages += (
f"factor projection for {v} with {factor_approx.factor} contained "
"invalid values",)
if not q_f1.is_valid:
success = False
messages += (
f"factor projection for {v} with {factor_approx.factor} is invalid",)
factor_projection[v] = q_f1
else:
success = False
messages += (
f"model projection for {v} with {factor_approx.factor} is invalid",)
factor_projection[v] = factor_approx.factor_dist[v]
q_model = (q_fit ** delta).sum_natural_parameters(
factor_approx.model_dist[v] ** (1 - delta))
if q_model.is_valid:
model_dist[v] = q_model
projection = FactorApproximation(
factor_approx.factor,
factor_approx.cavity_dist,
factor_dist=MeanField(factor_projection),
model_dist=MeanField(model_dist),
# log_norm=log_norm
)
status = Status(success, messages)
return projection, status
class MeanField(Dict[Variable, AbstractMessage], Factor):
"""For a factor with multiple variables, this class represents the
the mean field approximation to that factor,
f(x₁, x₂, x₃) = q(x₁, x₂, x₃) = q₁(x₁) q₂(x₂) q₃(x₃)
Internally these variables approximations are stored in a
dictionary with the variables as keys and the message or
variable distribution as values
Methods
-------
keys()
returns the variables of the mean_field
logpdf({x₁: x1, x₂: x2, x₃: x3})
returns the q(x₁, x₂, x₃), axis defines the axes over which
to reduce the return, if the meanfield is duplicated over multiple
plates.
logpdf_gradient({x₁: x1, x₂: x2, x₃: x3})
returns the q(x₁, x₂, x₃) and the gradients for each input.
to save memory the gradients are always the shape of the input
values (i.e. this does not calculate the Jacobian)
"""
def __init__(
self,
dists: Dict[Variable, AbstractMessage],
log_norm: np.ndarray = 0.):
dict.__init__(self, dists)
Factor.__init__(
self, self._logpdf, **{v.name: v for v in dists})
if isinstance(dists, MeanField):
self.log_norm = dists.log_norm
else:
self.log_norm = log_norm
pop = dict.pop
values = dict.values
items = dict.items
__getitem__ = dict.__getitem__
def _logpdf(self, **kwargs: np.ndarray) -> np.ndarray:
var_names = self.name_variable_dict
return self.logpdf(
{var_names[k]: value for k, value in kwargs.items()})
@property
def mean(self):
return {v: dist.mean for v, dist in self.items()}
@property
def variance(self):
return {v: dist.variance for v, dist in self.items()}
@property
def scale(self):
return {v: dist.scale for v, dist in self.items()}
def logpdf(
self,
values: Dict[Variable, np.ndarray],
axis: Axis = False,
) -> np.ndarray:
"""Calculates the logpdf of the passed values for messages
the result is broadcast to the appropriate shape given the variable
plates
"""
return reduce(
add_arrays,
(aggregate(
self._broadcast(
self._variable_plates[v], m.logpdf(values[v])),
axis = axis)
for v, m in self.items())
)
def __call__(
self,
values: Dict[Variable, np.ndarray],
axis: Axis = False,
) -> FactorValue:
return FactorValue(self.logpdf(values, axis=axis), {})
def logpdf_gradient(
self,
values: Dict[Variable, np.ndarray],
axis: Axis = False,
**kwargs):
logl = 0
gradl = {}
for v, m in self.items():
lv, gradl[v] = m.logpdf_gradient(values[v])
lv = aggregate(
self._broadcast(self._variable_plates[v], lv),
axis = axis)
logl = add_arrays(logl, lv)
return logl, gradl
def logpdf_gradient_hessian(
self,
values: Dict[Variable, np.ndarray],
axis: Optional[Union[bool, int, Tuple[int, ...]]] = False,
**kwargs):
logl = 0.
gradl = {}
hessl = {}
for v, m in self.items():
lv, gradl[v], hessl[v] = m.logpdf_gradient_hessian(values[v])
lv = aggregate(
self._broadcast(self._variable_plates[v], lv),
axis = axis)
logl = add_arrays(logl, lv)
return logl, gradl, hessl
def __repr__(self):
reprdict = "{\n" + "\n".join(
" {}: {}".format(k, v) for k, v in self.items()) + "\n }"
classname = (type(self).__name__)
return f"{classname}({reprdict}, log_norm={self.log_norm})"
@property
def is_valid(self):
return all(d.is_valid for d in self.values())
def prod(self, *approxs: 'MeanField') -> 'MeanField':
dists = (
(k, prod((m.get(k, 1.) for m in approxs), m))
for k, m in self.items())
return MeanField({
k: m for k, m in dists if isinstance(m, AbstractMessage)})
__mul__ = prod
def __truediv__(self, other: 'MeanField') -> 'MeanField':
return type(self)({
k: m / other.get(k, 1.) for k, m in self.items()},
self.log_norm - other.log_norm)
def __pow__(self, other: float) -> 'MeanField':
return type(self)({
k: m**other for k, m in self.items()},
self.log_norm * other)
def log_normalisation(self, other: 'MeanField') -> float:
return sum(
np.sum(dist.log_normalisation(other[v]))
for v, dist in self.items()
)
def update_invalid(self, other: "MeanField") -> "MeanField":
mean_field = {}
for k, m in self.items():
m2 = other.get(k)
mean_field[k] = m.update_invalid(m2) if m2 else m
return type(self)(mean_field, self.log_norm)
def project_mode(self, res: OptResult):
projection = type(self)({
v: dist.from_mode(res.mode[v], res.hess_inv.get(v))
for v, dist in self.items()})
projection.log_norm = (
res.log_norm - projection(res.mode, axis=None).log_value)
return projection
def _project_mode(
self,
mode: Dict[Variable, np.ndarray],
covar: Dict[Variable, np.ndarray],
fun: Optional[float] = None):
"""
Projects the mode and covariance
"""
projection = MeanField({
v: dist.from_mode(mode[v], covar.get(v))
for v, dist in self.items()})
if fun is not None:
projection.log_norm = fun - projection(mode).log_value
return projection
def sample(self, n_samples=None):
return {v: dist.sample(n_samples) for v, dist in self.items()}
def kl(self, mean_field: 'MeanField') -> np.ndarray:
return sum(
np.sum(dist.kl(mean_field[k]))
for k, dist in self.items()
)
__hash__ = Factor.__hash__
@classmethod
def from_dist(
cls,
dist: Union[Dict[Variable, AbstractMessage], "MeanField"]
) -> "MeanField":
return dist if isinstance(dist, cls) else MeanField(dist)
class FactorApproximation(AbstractNode):
"""
This class represents the 'tilted distribution' in EP,
When approximating a model distribution of the form,
m(x) = ∏ₐ fₐ(xₐ)
we can define an approximating distribution as the product of
factor distributions,
q(x) = ∏ₐ qₐ(xₐ)
the 'cavity distribution' q⁻ᵃ for a factor can be viewed as a
prior distribution for the factor,
q⁻ᵃ(xₐ) = ∏_{ᵦ ≠ a} qᵦ(xᵦ)
so the model can be approximated by the 'tilted distribution'
q⁺ᵃ(xₐ) = fₐ(xₐ) q⁻ᵃ(xₐ)
Parameters
----------
is_valid
factor: Factor
fₐ(xₐ)
cavity_dist: MeanField
q⁻ᵃ(xₐ)
factor_dist: MeanField
qₐ(xₐ)
model_dist: MeanField
q(xₐ)
Methods
-------
__call__(values={xₐ: x₀}, axis=axis)
returns q⁺ᵃ(x₀)
func_jacobian(values={xₐ: x₀}, variables=(xₐ,), axis=axis)
returns q⁺ᵃ(x₀), {xₐ: dq⁺ᵃ(x₀)/dxₐ}
project_mean_field(mean_field, delta=1., status=Status())
for qᶠ = mean_field, finds qₐ such that qᶠₐ * q⁻ᵃ = qᶠ
delta controls how much to change from the original factor qₐ
so qʳₐ = (qᶠₐ)ᵟ * (qᶠₐ)¹⁻ᵟ
returns qʳₐ, status
"""
def __init__(
self,
factor: Factor,
cavity_dist: MeanField,
factor_dist: MeanField,
model_dist: MeanField
):
# Have to seperate FactorApproximation into two classes
# in order to be able to redefine __new__
self.factor = factor
self.cavity_dist = MeanField.from_dist(cavity_dist)
self.factor_dist = MeanField.from_dist(factor_dist)
self.model_dist = MeanField.from_dist(model_dist)
super().__init__(**factor._kwargs)
@property
def variables(self):
return self.factor.variables
@property
def deterministic_variables(self):
return self.factor.deterministic_variables
@property
def all_variables(self):
return self.factor.all_variables
@property
def name(self):
return f"FactorApproximation({self.factor.name})"
@property
def deterministic_dist(self):
"""
the `MeanField` approximation of the deterministic variables
"""
return MeanField({
v: self.cavity_dist[v] for v in self.deterministic_variables})
@property
def is_valid(self) -> bool:
"""
returns whether all the distributions in the factor approximation
are valid
"""
dists = chain(
self.cavity_dist.values(),
self.factor_dist.values(),
self.model_dist.values())
return all(d.is_valid for d in dists if isinstance(d, AbstractMessage))
def __call__(
self,
values: Dict[Variable, np.ndarray],
axis: Axis = False,
) -> FactorValue:
fval = self.factor(values, axis=axis)
log_meanfield = self.cavity_dist(
{**values, **fval.deterministic_values}, axis=axis)
return add_arrays(fval, log_meanfield)
def func_jacobian(
self,
variable_dict: Dict[Variable, np.ndarray],
variables: Optional[List[Variable]] = None,
axis: Axis = None,
_calc_deterministic: bool = True,
**kwargs,
) -> Tuple[FactorValue, JacobianValue]:
if axis is not None:
raise NotImplementedError(
"FactorApproximation.func_jacobian has not implemeted "
f"axis={axis}, try axis=None")
if variables is None:
fixed_variables = set(
v for v, m in self.model_dist.items()
if isinstance(m, FixedMessage))
variables = self.factor.variables - fixed_variables
fval, fjac = self.factor.func_jacobian(
variable_dict, variables, axis=axis,
_calc_deterministic=_calc_deterministic)
values = {**variable_dict, **fval.deterministic_values}
var_sizes = {v: np.size(x) for v, x in values.items()}
var_shapes = {v: np.shape(x) for v, x in values.items()}
log_cavity, grad_cavity = self.cavity_dist.logpdf_gradient(
values, axis=axis)
logl = fval + log_cavity
for v in fjac:
fjac[v] += grad_cavity[v]
# Update gradients using jacobians of deterministic variables
# TODO: Should add logic to account for pullbacks for
# AD frameworks e.g. Zygote.jl
for var, grad in fjac.items():
for det, jac in grad.deterministic_values.items():
det_grad = grad_cavity[det].ravel()
g = jac.reshape(var_sizes[det], var_sizes[var])
fjac[var] += det_grad.dot(g).reshape(var_shapes[var])
return logl, fjac
def project_mean_field(
self,
model_dist: MeanField,
delta: float = 1.,
status: Optional[Status] = None,
) -> "FactorApprox":
success, messages = Status() if status is None else status
factor_dist = (model_dist / self.cavity_dist)
if delta < 1:
log_norm = factor_dist.log_norm
factor_dist = (
factor_dist**delta * self.factor_dist**(1-delta))
factor_dist.log_norm = (
delta * log_norm + (1 - delta) * self.factor_dist.log_norm)
if not factor_dist.is_valid:
success = False
messages += (
f"model projection for {self} is invalid",)
factor_dist = factor_dist.update_invalid(self.factor_dist)
new_approx = FactorApproximation(
self.factor,
self.cavity_dist,
factor_dist=factor_dist,
model_dist=model_dist,
)
return new_approx, Status(success, messages)
project = project_mean_field
def __repr__(self):
# TODO make this nicer
return f"{type(self).__name__}({self.factor}, ...)"
| {"hexsha": "bed123e60eca4b8bdefeeff8e35636668e5fe6dc", "size": 15614, "ext": "py", "lang": "Python", "max_stars_repo_path": "autofit/graphical/mean_field.py", "max_stars_repo_name": "arfon/PyAutoFit", "max_stars_repo_head_hexsha": "5926b13eefd97e089ee468cbec33452766edbd22", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-01-18T23:20:31.000Z", "max_stars_repo_stars_event_max_datetime": "2021-01-18T23:20:31.000Z", "max_issues_repo_path": "autofit/graphical/mean_field.py", "max_issues_repo_name": "arfon/PyAutoFit", "max_issues_repo_head_hexsha": "5926b13eefd97e089ee468cbec33452766edbd22", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "autofit/graphical/mean_field.py", "max_forks_repo_name": "arfon/PyAutoFit", "max_forks_repo_head_hexsha": "5926b13eefd97e089ee468cbec33452766edbd22", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.7357723577, "max_line_length": 89, "alphanum_fraction": 0.5789035481, "include": true, "reason": "import numpy", "num_tokens": 3799} |
#ifndef BID_DROP_FRONT_HPP_
#define BID_DROP_FRONT_HPP_
#include <bid/range/traits/drop_front_intrinsically.hpp>
#include <bid/range/traits/pop_front.hpp>
#include <bid/functor.hpp>
#include <boost/optional.hpp>
namespace bid
{
using boost::none_t;
template<class Range>
using prefered_drop_front_method = std::conditional_t
<
has_any_drop_front<Range>{},
prefered_drop_front_intrinsically_method<Range>,
std::conditional_t
<
has_pop_front<Range>{},
std::integral_constant<drop_front_method, drop_front_method::POP_FRONT>,
std::integral_constant<drop_front_method, drop_front_method::NONE>
>
>;
template<class Range>
using prefered_drop_front_amount_method = std::conditional_t
<
has_any_drop_front<Range>{},
prefered_drop_front_amount_intrinsically_method<Range>,
std::conditional_t
<
has_pop_front<Range>{},
std::integral_constant<drop_front_method, drop_front_method::POP_FRONT>,
std::integral_constant<drop_front_method, drop_front_method::NONE>
>
>;
template<class Range>
using can_drop_front = std::integral_constant
<
bool,
prefered_drop_front_method<Range>{} != drop_front_method::NONE
>;
namespace drop_front_detail
{
template<drop_front_method>
struct drop_front_impl;
template<>
struct drop_front_impl<drop_front_method::POP_FRONT>
{
template<class Range>
static void doit(Range&& r)
{
pop_front(std::forward<Range>(r), overloaded(
[](none_t)
{
assert(false); // drop_front: empty range
},
[](auto&&)
{}));
}
template<class Range>
static void doit(Range&& r, size_type_t<Range> amount)
{
for(size_type_t<Range> i = 0; i != amount; ++i)
{
pop_front(std::forward<Range>(r), overloaded(
[](none_t)
{
assert(false); // drop_front: range too short
},
[](auto&&)
{}));
}
}
};
template<drop_front_method>
struct drop_front_impl
{
template<class Range>
static void doit(Range&& r)
{
drop_front_intrinsically(std::forward<Range>(r));
}
template<class Range>
static void doit(Range&& r, size_type_t<Range> amount)
{
drop_front_intrinsically(std::forward<Range>(r), amount);
}
};
}
template<class Range>
void drop_front(Range&& r)
{
using namespace drop_front_detail;
typedef std::decay_t<Range> decayed_range;
static constexpr drop_front_method method = prefered_drop_front_method<decayed_range>{};
typedef drop_front_impl<method> impl;
impl::doit(std::forward<Range>(r));
}
template<class Range>
void drop_front(Range&& r, size_type_t<Range> amount)
{
using namespace drop_front_detail;
typedef std::decay_t<Range> decayed_range;
static constexpr drop_front_method method = prefered_drop_front_method<decayed_range>{};
typedef drop_front_impl<method> impl;
impl::doit(std::forward<Range>(r), amount);
}
}
#endif
| {"hexsha": "421df356fa1e19bcb7d0cdadf91d62f1b91b659b", "size": 3019, "ext": "hpp", "lang": "C++", "max_stars_repo_path": "include/bid/range/traits/drop_front.hpp", "max_stars_repo_name": "mbid/subsetunion-problem", "max_stars_repo_head_hexsha": "b161ed832576acce23e8c44f08ec2c28a8f1b98d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "include/bid/range/traits/drop_front.hpp", "max_issues_repo_name": "mbid/subsetunion-problem", "max_issues_repo_head_hexsha": "b161ed832576acce23e8c44f08ec2c28a8f1b98d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "include/bid/range/traits/drop_front.hpp", "max_forks_repo_name": "mbid/subsetunion-problem", "max_forks_repo_head_hexsha": "b161ed832576acce23e8c44f08ec2c28a8f1b98d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.152, "max_line_length": 92, "alphanum_fraction": 0.6793640278, "num_tokens": 718} |
import copy
import numpy as np
from ext import get_ext_list
def b_mul(b, exp_list, init_ext_list):
sum_add_v_all = 0.0
ext_list = get_ext_list(init_ext_list)
for curr_exp in exp_list:
sum_add_v = curr_exp[-1]
for n_curr in range(len(ext_list)):
sum_add_v *= curr_exp[n_curr] ** ext_list[n_curr]
sum_add_v_all += sum_add_v
b.append(sum_add_v_all)
return b
def calc_b(exp_list, b, pol_ext, nv, n_call, ext_list):
n_call_new = n_call + 1
new_ext_list = copy.deepcopy(ext_list)
new_ext_list.append(0)
for i in range(pol_ext + 1):
new_ext_list[-1] = i
if n_call_new == nv:
b = b_mul(b, exp_list, new_ext_list)
else:
b = calc_b(exp_list, b, i, nv, n_call_new, new_ext_list)
return b
def a_mul(a, exp_list, init_ext_list):
sum_add_v_all1 = 0.0
ext_list = []
for curr_init_list in init_ext_list:
ext_list.append(get_ext_list(curr_init_list))
for curr_exp in exp_list:
sum_add_v = 1.0
for curr_ext_list in ext_list:
for n_curr in range(len(ext_list[0])):
sum_add_v *= curr_exp[n_curr] ** curr_ext_list[n_curr]
sum_add_v_all1 += sum_add_v
a.append(sum_add_v_all1)
return a
def calc_a(exp_list, a, pol_ext, nv, n_call, ext_list, dim, real_pol_ext):
n_call_new = n_call + 1
new_ext_list = copy.deepcopy(ext_list)
new_ext_list[dim].append(0)
for i in range(pol_ext + 1):
new_ext_list[dim][-1] = i
if (n_call_new == nv) and (dim != 0):
a = calc_a(exp_list, a, real_pol_ext, nv, 0, new_ext_list, dim - 1, real_pol_ext)
elif (n_call_new == nv) and (dim == 0):
a = a_mul(a, exp_list, new_ext_list)
else:
a = calc_a(exp_list, a, i, nv, n_call_new, new_ext_list, dim, real_pol_ext)
return a
def calc_approx(exp_data, pol_ext, nv):
b = calc_b(exp_data, [], pol_ext, nv, 0, [])
a = calc_a(exp_data, [], pol_ext, nv, 0, [[], []], 1, pol_ext)
n_size = int(np.sqrt(len(a)))
a = np.reshape(a, (n_size, n_size))
try:
c = np.linalg.solve(np.array(a), np.array(b))
return c
except np.linalg.LinAlgError:
print("Singular matrix. Try to enter more experimental points.")
return None
| {"hexsha": "184440e4df06c0cc05c995438302f1119776db97", "size": 2386, "ext": "py", "lang": "Python", "max_stars_repo_path": "approximation.py", "max_stars_repo_name": "DmitriyKhudiakov/MSE_approximation", "max_stars_repo_head_hexsha": "6d25711c14a27301335fe211bff9305ea2ad88d8", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "approximation.py", "max_issues_repo_name": "DmitriyKhudiakov/MSE_approximation", "max_issues_repo_head_hexsha": "6d25711c14a27301335fe211bff9305ea2ad88d8", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "approximation.py", "max_forks_repo_name": "DmitriyKhudiakov/MSE_approximation", "max_forks_repo_head_hexsha": "6d25711c14a27301335fe211bff9305ea2ad88d8", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.1388888889, "max_line_length": 94, "alphanum_fraction": 0.602263202, "include": true, "reason": "import numpy", "num_tokens": 686} |
from keras.layers import Input, Conv2D, MaxPooling2D, concatenate, UpSampling2D
from keras.models import Model
from keras.optimizers import Adam
import keras
from random import shuffle, randint
import numpy as np
import os
import tensorflow as tf
import glob
from keras import backend as K
import matplotlib.pyplot as plt
from scipy.ndimage.interpolation import rotate
import pandas as pd
import SimpleITK as sitk
from skimage.measure import label
from scipy.ndimage.morphology import binary_closing
import time
GPU = 0
os.environ['CUDA_VISIBLE_DEVICES'] = str(GPU)
def dice_coef(y_true, y_pred):
smooth = 1
y_true_f = K.flatten(y_true)
y_pred_f = K.flatten(y_pred)
intersection = K.sum(y_true_f * y_pred_f)
return (2. * intersection + smooth) / (K.sum(y_true_f) + K.sum(y_pred_f) + smooth)
def dice_coef_loss(y_true, y_pred):
return -dice_coef(y_true, y_pred)
def get_unet():
inputs = Input((200, 200, 1))
conv1 = Conv2D(32, (3, 3), activation='relu', padding='same')(inputs)
conv1 = Conv2D(32, (3, 3), activation='relu', padding='same')(conv1)
pool1 = MaxPooling2D(pool_size=(2, 2))(conv1)
conv2 = Conv2D(64, (3, 3), activation='relu', padding='same')(pool1)
conv2 = Conv2D(64, (3, 3), activation='relu', padding='same')(conv2)
pool2 = MaxPooling2D(pool_size=(2, 2))(conv2)
conv3 = Conv2D(128, (3, 3), activation='relu', padding='same')(pool2)
conv3 = Conv2D(128, (3, 3), activation='relu', padding='same')(conv3)
pool3 = MaxPooling2D(pool_size=(2, 2))(conv3)
conv4 = Conv2D(256, (3, 3), activation='relu', padding='same')(pool3)
conv6 = Conv2D(256, (3, 3), activation='relu', padding='same')(conv4)
up7 = concatenate([UpSampling2D(size=(2, 2))(conv6), conv3], axis=3)
conv7 = Conv2D(128, (3, 3), activation='relu', padding='same')(up7)
conv7 = Conv2D(128, (3, 3), activation='relu', padding='same')(conv7)
up8 = concatenate([UpSampling2D(size=(2, 2))(conv7), conv2], axis=3)
conv8 = Conv2D(64, (3, 3), activation='relu', padding='same')(up8)
conv8 = Conv2D(64, (3, 3), activation='relu', padding='same')(conv8)
up9 = concatenate([UpSampling2D(size=(2, 2))(conv8), conv1], axis=3)
conv9 = Conv2D(32, (3, 3), activation='relu', padding='same')(up9)
conv9 = Conv2D(32, (3, 3), activation='relu', padding='same')(conv9)
conv10 = Conv2D(1, (1, 1), activation='sigmoid')(conv9)
model = Model(inputs=[inputs], outputs=[conv10])
model.compile(optimizer=Adam(lr=1e-5), loss=dice_coef_loss, metrics=[dice_coef])
return model
def load_data(imgs_f, idxs_f):
ret_data = np.zeros((len(idxs_f), 200, 200, 1))
for i, idx in enumerate(idxs_f):
ret_data[i, :,:,0] = imgs_f[:,:, idx]
return ret_data
def getLargestCC(segmentation):
if np.max(segmentation) == 0:
return segmentation
labels = label(segmentation)
largestCC = (labels == np.argmax(np.bincount(labels.flat)[1::])+1)
return largestCC
if __name__ == "__main__":
mode = "Test" # "Train" or "Test" or "Debug" or "Create_Masks_All_Images_Unet"
data_directory = "deep_learning/unet-2D/"
output_directory = data_directory + "/training"
if not os.path.exists(output_directory):
os.mkdir(output_directory)
m_batch = 25
print("Loading sitk images")
imgs = sitk.GetArrayFromImage(sitk.ReadImage(data_directory + "data/deep_learning_contour_mask.nrrd"))
rs = sitk.GetArrayFromImage(
sitk.ReadImage(data_directory + "data/deep_learning_contour_mask_reference_standard.nrrd"))
if mode == "Train":
cts = np.sum(np.sum(rs, axis=0), 0)
idx = np.where(cts > 1000)[0]
np.random.shuffle(idx)
idx_train = idx[0:800]
idx_valid = idx[800:1000]
idx_test = idx[1000:1704]
np.save(output_directory + "/indexes.npy", [idx_train, idx_valid, idx_test])
print("Start the training")
n_t_samples = len(idx_train)
n_v_samples = len(idx_valid)
print("Training on %i cells and validating on %i cells" % (n_t_samples, n_v_samples))
tbCallBack = keras.callbacks.TensorBoard(log_dir=os.path.join(output_directory, 'Graph'),
histogram_freq=0, write_graph=True, write_images=True)
saveCallback = keras.callbacks.ModelCheckpoint(os.path.join(output_directory, "unet_model.h5"),
monitor='val_loss', verbose=0, save_best_only=True,
save_weights_only=False, mode='auto', period=1)
print("Creating the model")
with tf.device('/gpu:%i' % GPU):
model = get_unet()
model.fit(x=load_data(imgs, idx_train), y=load_data(rs, idx_train), batch_size=m_batch, epochs=150, verbose=1,
callbacks=[tbCallBack, saveCallback], validation_data=[ load_data(imgs, idx_valid), load_data(rs, idx_valid)],
shuffle=True)
model.save(os.path.join(output_directory,"last_model.h5"))
if mode == "Test":
model = get_unet()
model.load_weights(os.path.join(output_directory, "unet_model.h5"))
imgsr = np.transpose(imgs, (2, 0, 1))
imgsr = np.reshape(imgsr, (imgs.shape[2], 200, 200, 1))
print(imgsr.shape)
t1 = time.time()
out = model.predict(imgsr, batch_size=25, verbose=1)
outr = np.reshape(out, (imgs.shape[2], 200, 200))
out2 = np.transpose(outr, (1, 2, 0))
out3 = out2 * 0
for i in range(0, out2.shape[2]):
out3[:, :, i] = binary_closing(getLargestCC(out2[:, :, i] > 0.5),
structure=np.zeros((10, 10)) + 1)
print("Processing time: %f" % (time.time() - t1))
# sitk.WriteImage(sitk.GetImageFromArray((out3).astype(np.int16)), output_directory + "/predictions.nrrd")
| {"hexsha": "bada2f9de03e569f9917ece686b5752be73a6aac", "size": 5927, "ext": "py", "lang": "Python", "max_stars_repo_path": "unet/unet_cell_contour.py", "max_stars_repo_name": "evansgroup/JournalOfBiomedicalOptics", "max_stars_repo_head_hexsha": "72fc3ef7551a3b38c49e4818f4c4b285972d627a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "unet/unet_cell_contour.py", "max_issues_repo_name": "evansgroup/JournalOfBiomedicalOptics", "max_issues_repo_head_hexsha": "72fc3ef7551a3b38c49e4818f4c4b285972d627a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "unet/unet_cell_contour.py", "max_forks_repo_name": "evansgroup/JournalOfBiomedicalOptics", "max_forks_repo_head_hexsha": "72fc3ef7551a3b38c49e4818f4c4b285972d627a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.7048192771, "max_line_length": 133, "alphanum_fraction": 0.6321916653, "include": true, "reason": "import numpy,from scipy", "num_tokens": 1693} |
#include <iostream>
#include <cmath>
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <sophus/so3.h>
#include <sophus/se3.h>
int main(int argc, char** argv) {
Eigen::Matrix3d R = Eigen::AngleAxisd(M_PI / 2, Eigen::Vector3d(0, 0, 1)).toRotationMatrix();
Sophus::SO3 SO3_R(R);
Sophus::SO3 SO3_V(0, 0, M_PI / 2);
Eigen::Quaterniond Q(R);
Sophus::SO3 SO3_Q(Q);
std::cout << "SO3 from matrix: " << SO3_R << std::endl;
std::cout << "SO3 from vector: " << SO3_V << std::endl;
std::cout << "SO3 from quaternion: " << SO3_Q << std::endl;
Eigen::Vector3d so3 = SO3_R.log();
std::cout << "so3 = " << so3.transpose() << std::endl;
std::cout << "so3 hat = \n" << Sophus::SO3::hat(so3) << std::endl;
std::cout << "so3 hat vee = " << Sophus::SO3::vee(Sophus::SO3::hat(so3)) << std::endl;
Eigen::Vector3d update_so3(1e-4, 0, 0);
Sophus::SO3 SO3_updated = Sophus::SO3::exp(update_so3) * SO3_R;
std::cout << "SO3 updated = " << SO3_updated << std::endl;
std::cout << "op SE3" << std::endl;
Eigen::Vector3d t(1, 0, 0);
Sophus::SE3 SE3_Rt(R, t);
Sophus::SE3 SE3_Qt(Q, t);
std::cout << "SE3 from R, t = \n" << SE3_Rt << std::endl;
std::cout << "SE3 from Q, t = \n" << SE3_Qt << std::endl;
typedef Eigen::Matrix<double, 6, 1> Vector6d;
Vector6d se3 = SE3_Rt.log();
std::cout << "se3 = \n" << se3.transpose() << std::endl;
std::cout << "se3 hat = \n" << Sophus::SE3::hat(se3) << std::endl;
std::cout << "se3 hat vee = \n" <<
Sophus::SE3::vee(Sophus::SE3::hat(se3)).transpose() << std::endl;
Vector6d update_se3;
update_se3.setZero();
update_se3(0, 0) = 1e-4d;
Sophus::SE3 SE3_updated = Sophus::SE3::exp(update_se3) * SE3_Rt;
std::cout << "SE3 updated = \n" << SE3_updated.matrix() << std::endl;
return 0;
}
| {"hexsha": "e03498eecb6f6bf38d71c3ec89de22f41db3fc45", "size": 1801, "ext": "cc", "lang": "C++", "max_stars_repo_path": "VisionSLAM14/ch4/sophus_test/use_sophus.cc", "max_stars_repo_name": "DLonng/Go", "max_stars_repo_head_hexsha": "a67ac6d6501f9fadadec6a6cf766d4b4a356d572", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 23.0, "max_stars_repo_stars_event_min_datetime": "2020-04-10T01:53:46.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-31T03:43:10.000Z", "max_issues_repo_path": "VisionSLAM14/ch4/sophus_test/use_sophus.cc", "max_issues_repo_name": "DLonng/Go", "max_issues_repo_head_hexsha": "a67ac6d6501f9fadadec6a6cf766d4b4a356d572", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1.0, "max_issues_repo_issues_event_min_datetime": "2020-12-10T07:08:37.000Z", "max_issues_repo_issues_event_max_datetime": "2021-04-14T07:47:01.000Z", "max_forks_repo_path": "VisionSLAM14/ch4/sophus_test/use_sophus.cc", "max_forks_repo_name": "DLonng/Go", "max_forks_repo_head_hexsha": "a67ac6d6501f9fadadec6a6cf766d4b4a356d572", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 9.0, "max_forks_repo_forks_event_min_datetime": "2020-04-05T11:49:22.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-04T10:23:37.000Z", "avg_line_length": 26.8805970149, "max_line_length": 97, "alphanum_fraction": 0.5891171571, "num_tokens": 697} |
import pytest
np = pytest.importorskip("numpy")
import networkx as nx
class TestFloydNumpy:
def test_cycle_numpy(self):
dist = nx.floyd_warshall_numpy(nx.cycle_graph(7))
assert dist[0, 3] == 3
assert dist[0, 4] == 3
def test_weighted_numpy_three_edges(self):
XG3 = nx.Graph()
XG3.add_weighted_edges_from(
[[0, 1, 2], [1, 2, 12], [2, 3, 1], [3, 4, 5], [4, 5, 1], [5, 0, 10]]
)
dist = nx.floyd_warshall_numpy(XG3)
assert dist[0, 3] == 15
def test_weighted_numpy_two_edges(self):
XG4 = nx.Graph()
XG4.add_weighted_edges_from(
[
[0, 1, 2],
[1, 2, 2],
[2, 3, 1],
[3, 4, 1],
[4, 5, 1],
[5, 6, 1],
[6, 7, 1],
[7, 0, 1],
]
)
dist = nx.floyd_warshall_numpy(XG4)
assert dist[0, 2] == 4
def test_weight_parameter_numpy(self):
XG4 = nx.Graph()
XG4.add_edges_from(
[
(0, 1, {"heavy": 2}),
(1, 2, {"heavy": 2}),
(2, 3, {"heavy": 1}),
(3, 4, {"heavy": 1}),
(4, 5, {"heavy": 1}),
(5, 6, {"heavy": 1}),
(6, 7, {"heavy": 1}),
(7, 0, {"heavy": 1}),
]
)
dist = nx.floyd_warshall_numpy(XG4, weight="heavy")
assert dist[0, 2] == 4
def test_directed_cycle_numpy(self):
G = nx.DiGraph()
nx.add_cycle(G, [0, 1, 2, 3])
pred, dist = nx.floyd_warshall_predecessor_and_distance(G)
D = nx.utils.dict_to_numpy_array(dist)
np.testing.assert_equal(nx.floyd_warshall_numpy(G), D)
def test_zero_weight(self):
G = nx.DiGraph()
edges = [(1, 2, -2), (2, 3, -4), (1, 5, 1), (5, 4, 0), (4, 3, -5), (2, 5, -7)]
G.add_weighted_edges_from(edges)
dist = nx.floyd_warshall_numpy(G)
assert int(np.min(dist)) == -14
G = nx.MultiDiGraph()
edges.append((2, 5, -7))
G.add_weighted_edges_from(edges)
dist = nx.floyd_warshall_numpy(G)
assert int(np.min(dist)) == -14
| {"hexsha": "13df927f4ed9a73aae03447dee879c5aea595934", "size": 2230, "ext": "py", "lang": "Python", "max_stars_repo_path": "networkx/algorithms/shortest_paths/tests/test_dense_numpy.py", "max_stars_repo_name": "ChristopherReinartz/networkx", "max_stars_repo_head_hexsha": "f542e5fb92d12ec42570d14df867d144a9e8ba4f", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-02-02T09:59:34.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-02T09:59:34.000Z", "max_issues_repo_path": "networkx/algorithms/shortest_paths/tests/test_dense_numpy.py", "max_issues_repo_name": "ChristopherReinartz/networkx", "max_issues_repo_head_hexsha": "f542e5fb92d12ec42570d14df867d144a9e8ba4f", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2016-04-22T14:50:02.000Z", "max_issues_repo_issues_event_max_datetime": "2020-11-20T09:30:44.000Z", "max_forks_repo_path": "networkx/algorithms/shortest_paths/tests/test_dense_numpy.py", "max_forks_repo_name": "ChristopherReinartz/networkx", "max_forks_repo_head_hexsha": "f542e5fb92d12ec42570d14df867d144a9e8ba4f", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2020-12-21T11:41:13.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-08T17:09:21.000Z", "avg_line_length": 29.3421052632, "max_line_length": 86, "alphanum_fraction": 0.4650224215, "include": true, "reason": "import networkx", "num_tokens": 718} |
[STATEMENT]
lemma mem_set_indexed_members'[simp]:
"t \<in> set (indexed_members s) \<longleftrightarrow> snd t |\<in>|\<^bsub>fst t\<^esub> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (t \<in> set (indexed_members s)) = (snd t |\<in>|\<^bsub>fst t\<^esub> s)
[PROOF STEP]
by (cases t, simp add: mem_set_indexed_members) | {"llama_tokens": 147, "file": "Incredible_Proof_Machine_Indexed_FSet", "length": 1} |
# -*- coding: utf-8 -*-
"""
@date: 2020/3/26 下午2:50
@file: create_train_val.py
@author: zj
@description: 提取分类任务的训练/测试集,分类别保存
"""
import cv2
import numpy as np
import os
import xmltodict
#### for train
# aeroplane 1171
# bicycle 1064
# bird 1605
# boat 1140
# bottle 1764
# bus 822
# car 3267
# cat 1593
# chair 3152
# cow 847
# diningtable 824
# dog 2025
# horse 1072
# motorbike 1052
# person 13256
# pottedplant 1487
# sheep 1070
# sofa 814
# train 925
# tvmonitor 1108
# total train num: 40058
#### for test
# aeroplane 285
# bicycle 337
# bird 459
# boat 263
# bottle 469
# bus 213
# car 1201
# cat 358
# chair 756
# cow 244
# diningtable 206
# dog 489
# horse 348
# motorbike 325
# person 4528
# pottedplant 480
# sheep 242
# sofa 239
# train 282
# tvmonitor 308
# total test num: 12032
alphabets = ['aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable',
'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor']
def check_dir(data_dir):
if not os.path.exists(data_dir):
os.mkdir(data_dir)
def find_all_cate_rects(annotation_dir, name_list):
"""
找出所有的类别的标注框(取消标记为difficult的边界框)
"""
cate_list = list()
for i in range(20):
cate_list.append(list())
for name in name_list:
annotation_path = os.path.join(annotation_dir, name + ".xml")
with open(annotation_path, 'rb') as f:
xml_dict = xmltodict.parse(f)
# print(xml_dict)
objects = xml_dict['annotation']['object']
if isinstance(objects, list):
for obj in objects:
obj_name = obj['name']
obj_idx = alphabets.index(obj_name)
difficult = int(obj['difficult'])
if difficult != 1:
bndbox = obj['bndbox']
cate_list[obj_idx].append({'img_name': name, 'rect':
(int(bndbox['xmin']), int(bndbox['ymin']), int(bndbox['xmax']), int(bndbox['ymax']))})
elif isinstance(objects, dict):
obj_name = objects['name']
obj_idx = alphabets.index(obj_name)
difficult = int(objects['difficult'])
if difficult != 1:
bndbox = objects['bndbox']
cate_list[obj_idx].append({'img_name': name, 'rect':
(int(bndbox['xmin']), int(bndbox['ymin']), int(bndbox['xmax']), int(bndbox['ymax']))})
else:
pass
return cate_list
def save_cate(cate_list, image_dir, res_dir):
"""
保存裁剪的图像
"""
# 保存image_dir下所有图像,以便后续查询
# 前提条件:足够的内存!!!
# image_dict = dict()
# image_name_list = os.listdir(image_dir)
# for name in image_name_list:
# image_path = os.path.join(image_dir, name)
# img = cv2.imread(image_path)
#
# image_dict[name.split('.')[0]] = img
# 遍历所有类别,保存标注的图像
for i in range(20):
cate_name = alphabets[i]
cate_dir = os.path.join(res_dir, cate_name)
check_dir(cate_dir)
for item in cate_list[i]:
img_name = item['img_name']
xmin, ymin, xmax, ymax = item['rect']
image_path = os.path.join(image_dir, img_name+'.jpg')
img = cv2.imread(image_path)
rect_img = img[ymin:ymax, xmin:xmax]
# rect_img = image_dict[img_name][ymin:ymax, xmin:xmax]
img_path = os.path.join(cate_dir, '%s-%d-%d-%d-%d.png' % (img_name, xmin, ymin, xmax, ymax))
cv2.imwrite(img_path, rect_img)
if __name__ == '__main__':
root_dir = '../../data/pascal-voc/'
train_txt_path = '../../data/pascal-voc/train/name.csv'
val_txt_path = '../../data/pascal-voc/test/name.csv'
for phase in ['train', 'test']:
if phase == 'train':
suffix = 'train_imgs'
else:
suffix = 'test_imgs'
dst_dir = os.path.join(root_dir, suffix)
check_dir(dst_dir)
print(dst_dir)
name_path = os.path.join(root_dir, phase, 'name.csv')
name_list = np.loadtxt(name_path, dtype=np.str, delimiter=' ')
annotation_dir = os.path.join(root_dir, phase, 'Annotations')
rects_list = find_all_cate_rects(annotation_dir, name_list)
total_num = 0
# 打印出每个类别的数据
for i in range(20):
total_num += len(rects_list[i])
print(alphabets[i], len(rects_list[i]))
print('total {} num: {}'.format(phase, total_num))
image_dir = os.path.join(root_dir, phase, 'JPEGImages')
save_cate(rects_list, image_dir, dst_dir)
print()
print('done')
| {"hexsha": "dcefd44b43a1c28dd5076b6a351c59f6996f0599", "size": 4716, "ext": "py", "lang": "Python", "max_stars_repo_path": "py/lib/data/create_train_val.py", "max_stars_repo_name": "zjZSTU/ResNet", "max_stars_repo_head_hexsha": "f185d1d24cdc96a533b2cf2df94f68172d820cb3", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-09-04T01:50:53.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-21T02:31:32.000Z", "max_issues_repo_path": "py/lib/data/create_train_val.py", "max_issues_repo_name": "zjZSTU/ResNet", "max_issues_repo_head_hexsha": "f185d1d24cdc96a533b2cf2df94f68172d820cb3", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "py/lib/data/create_train_val.py", "max_forks_repo_name": "zjZSTU/ResNet", "max_forks_repo_head_hexsha": "f185d1d24cdc96a533b2cf2df94f68172d820cb3", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2020-07-10T11:45:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-15T08:46:14.000Z", "avg_line_length": 27.2601156069, "max_line_length": 114, "alphanum_fraction": 0.574639525, "include": true, "reason": "import numpy", "num_tokens": 1363} |
import glob
import json
import pdb
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import csv
with open('k80_only_JCT.json', 'r') as fp:
k80_only = json.load(fp)
with open('oracle_JCT.json', 'r') as fp:
oracle_only = json.load(fp)
with open('v100_only_JCT.json', 'r') as fp:
v100_only = json.load(fp)
with open('oracle_K80_time.json', 'r') as fp:
oracle_K80_only = json.load(fp)
with open('oracle_V100_time.json', 'r') as fp:
oracle_V100_only = json.load(fp)
with open('oracle_overhead.json', 'r') as fp:
oracle_overhead_only = json.load(fp)
with open('oracle_epoch_waste.json', 'r') as fp:
oracle_epoch_waste_only = json.load(fp)
with open('oracle_num_mig.json', 'r') as fp:
oracle_num_mig_only = json.load(fp)
with open('oracle_ovhd_a.json', 'r') as fp:
oracle_ovhd_a_only = json.load(fp)
with open('oracle_ovhd_b.json', 'r') as fp:
oracle_ovhd_b_only = json.load(fp)
with open('oracle_ovhd_c.json', 'r') as fp:
oracle_ovhd_c_only = json.load(fp)
with open('oracle_ovhd_d.json', 'r') as fp:
oracle_ovhd_d_only = json.load(fp)
with open('oracle_k80_1st.json', 'r') as fp:
oracle_k80_1st_only = json.load(fp)
with open('oracle_v100_1st.json', 'r') as fp:
oracle_v100_1st_only = json.load(fp)
with open('speedup.json', 'r') as fp:
speedup_only = json.load(fp)
with open('epoch_num.json', 'r') as fp:
epoch_num_only = json.load(fp)
with open('k80_time.json', 'r') as fp:
k80_time_only = json.load(fp)
with open('v100_time.json', 'r') as fp:
v100_time_only = json.load(fp)
job_list = []
oracle = []
k80 = []
v100 = []
oracle_K80 = []
oracle_V100 = []
oracle_overhead = []
oracle_epoch_waste = []
oracle_ovhd_a = []
oracle_ovhd_b = []
oracle_ovhd_c = []
oracle_ovhd_d = []
oracle_k80_1st = []
oracle_v100_1st = []
oracle_num_mig = []
speedup = []
epoch_num = []
k80_time = []
v100_time = []
for i in range(50):
job = str(i+1)
job_list.append('job'+job)
oracle.append(oracle_only[job])
k80.append(k80_only[job])
v100.append(v100_only[job])
oracle_K80.append(oracle_K80_only[job])
oracle_V100.append(oracle_V100_only[job])
oracle_overhead.append(oracle_overhead_only[job])
oracle_epoch_waste.append(oracle_epoch_waste_only['job'+job])
oracle_num_mig.append(oracle_num_mig_only[job])
if len(oracle_ovhd_a_only[job]) > 0:
oracle_ovhd_a.append(int(np.mean(oracle_ovhd_a_only[job])))
else:
oracle_ovhd_a.append(0)
if len(oracle_ovhd_b_only[job]) > 0:
oracle_ovhd_b.append(int(np.mean(oracle_ovhd_b_only[job])))
else:
oracle_ovhd_b.append(0)
if len(oracle_ovhd_c_only[job]) > 0:
oracle_ovhd_c.append(int(np.mean(oracle_ovhd_c_only[job])))
else:
oracle_ovhd_c.append(0)
if len(oracle_ovhd_d_only[job]) > 0:
oracle_ovhd_d.append(int(np.mean(oracle_ovhd_d_only[job])))
else:
oracle_ovhd_d.append(0)
if len(oracle_k80_1st_only[job]) > 0:
oracle_k80_1st.append(int(np.mean(oracle_k80_1st_only[job])))
else:
oracle_k80_1st.append(0)
if len(oracle_v100_1st_only[job]) > 0:
oracle_v100_1st.append(int(np.mean(oracle_v100_1st_only[job])))
else:
oracle_v100_1st.append(0)
speedup.append(round(speedup_only[job],2))
epoch_num.append(epoch_num_only[job])
k80_time.append(k80_time_only[job])
v100_time.append(v100_time_only[job])
job_list = np.asarray(job_list)
oracle = np.asarray(oracle)
k80 = np.asarray(k80)
v100 = np.asarray(v100)
oracle_K80 = np.asarray(oracle_K80)
oracle_V100 = np.asarray(oracle_V100)
oracle_overhead = np.asarray(oracle_overhead)
oracle_epoch_waste = np.asarray(oracle_epoch_waste)
oracle_num_mig = np.asarray(oracle_num_mig)
oracle_ovhd_a = np.asarray(oracle_ovhd_a)
oracle_ovhd_b = np.asarray(oracle_ovhd_b)
oracle_ovhd_c = np.asarray(oracle_ovhd_c)
oracle_ovhd_d = np.asarray(oracle_ovhd_d)
oracle_k80_1st = np.asarray(oracle_k80_1st)
oracle_v100_1st = np.asarray(oracle_v100_1st)
speedup = np.asarray(speedup)
epoch_num = np.asarray(epoch_num)
k80_time = np.asarray(k80_time)
v100_time = np.asarray(v100_time)
rows = zip(job_list, epoch_num, k80, v100, oracle, oracle_K80, oracle_V100, oracle_overhead, oracle_epoch_waste, oracle_num_mig,
oracle_ovhd_a, oracle_ovhd_b, oracle_ovhd_c,oracle_ovhd_d,oracle_k80_1st,k80_time, oracle_v100_1st,v100_time, speedup)
with open('comparison.csv', 'w') as f:
writer = csv.writer(f)
for row in rows:
writer.writerow(row)
#np.savetxt('comparison.csv', (job_list, k80, v100, oracle, oracle_K80, oracle_V100, oracle_overhead, oracle_num_mig,
#total_time, save_time, load_time), fmt='%s')
| {"hexsha": "df5687ade4b0fc487f99cc5942f285c6ef5dd1e3", "size": 4649, "ext": "py", "lang": "Python", "max_stars_repo_path": "examples/pwr_run/checkpointing/throughput/comparison/compare_oracle/generate_csv.py", "max_stars_repo_name": "boringlee24/keras_old", "max_stars_repo_head_hexsha": "1e1176c45c4952ba1b9b9e58e9cc4df027ab111d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "examples/pwr_run/checkpointing/throughput/comparison/compare_oracle/generate_csv.py", "max_issues_repo_name": "boringlee24/keras_old", "max_issues_repo_head_hexsha": "1e1176c45c4952ba1b9b9e58e9cc4df027ab111d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/pwr_run/checkpointing/throughput/comparison/compare_oracle/generate_csv.py", "max_forks_repo_name": "boringlee24/keras_old", "max_forks_repo_head_hexsha": "1e1176c45c4952ba1b9b9e58e9cc4df027ab111d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.9716312057, "max_line_length": 128, "alphanum_fraction": 0.7177887718, "include": true, "reason": "import numpy", "num_tokens": 1417} |
# -*- coding: utf-8 -*-
'''
博客1:python+opencv实现基于傅里叶变换的旋转文本校正
https://blog.csdn.net/qq_36387683/article/details/80530709
博客2:OpenCV—python 图像矫正(基于傅里叶变换—基于透视变换)
https://blog.csdn.net/wsp_1138886114/article/details/83374333
傅里叶相关知识:
https://blog.csdn.net/on2way/article/details/46981825
频率:对于图像来说就是指图像颜色值的梯度,即灰度级的变化速度
幅度:可以简单的理解为是频率的权,即该频率所占的比例
DFT之前的原图像在x y方向上表示空间坐标,DFT是经过x y方向上的傅里叶变换来统计像素在这两个方向上不同频率的分布情况,
所以DFT得到的图像在x y方向上不再表示空间上的长度,而是频率。
仿射变换与透射变换:
仿射变换和透视变换更直观的叫法可以叫做“平面变换”和“空间变换”或者“二维坐标变换”和“三维坐标变换”.
从另一个角度也能说明三维变换和二维变换的意思,仿射变换的方程组有6个未知数,所以要求解就需要找到3组映射点,
三个点刚好确定一个平面.
透视变换的方程组有8个未知数,所以要求解就需要找到4组映射点,四个点就刚好确定了一个三维空间.
图像旋转算法 数学原理:
https://blog.csdn.net/liyuan02/article/details/6750828
角度angle可以用np.angle()
ϕ=atan(实部/虚部)
numpy包中自带一个angle函数可以直接根据复数的实部与虚部求出角度(默认出来的角度是弧度)。
'''
import cv2 as cv
import numpy as np
import math
from matplotlib import pyplot as plt
def fourier_demo():
#1、读取文件,灰度化
img = cv.imread('img/table-3.png')
cv.imshow('original', img)
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
cv.imshow('gray', gray)
#2、图像延扩
# OpenCV中的DFT采用的是快速算法,这种算法要求图像的尺寸是2的、3和5的倍数是处理速度最快。
# 所以需要用getOptimalDFTSize()
# 找到最合适的尺寸,然后用copyMakeBorder()填充多余的部分。
# 这里是让原图像和扩大的图像左上角对齐。填充的颜色如果是纯色,
# 对变换结果的影响不会很大,后面寻找倾斜线的过程又会完全忽略这一点影响。
h, w = img.shape[:2]
new_h = cv.getOptimalDFTSize(h)
new_w = cv.getOptimalDFTSize(w)
right = new_w - w
bottom = new_h - h
nimg = cv.copyMakeBorder(gray, 0, bottom, 0, right, borderType=cv.BORDER_CONSTANT, value=0)
cv.imshow('optim image', nimg)
#3、执行傅里叶变换,并得到频域图像
f = np.fft.fft2(nimg) # 将图像从空间域转到频域
fshift = np.fft.fftshift(f) # 将低频分量移动到中心,得到复数形式(实部、虚部)
magnitude = np.log(np.abs(fshift)) # 用abs()得到实数(imag()得到虚部),取对数是为了将数据变换到0-255,相当与实现了归一化。
# 4、二值化,进行Houge直线检测
# 二值化
magnitude_uint = magnitude.astype(np.uint8) #HougnLinesP()函数要求输入图像必须为8位单通道图像
ret, thresh = cv.threshold(magnitude_uint, thresh=11, maxval=255, type=cv.THRESH_BINARY)
print("ret:",ret)
cv.imshow('thresh', thresh)
print("thresh.dtype:", thresh.dtype)
#霍夫直线变换
lines = cv.HoughLinesP(thresh, 2, np.pi/180, 30, minLineLength=40, maxLineGap=100)
print("len(lines):", len(lines))
# 5、创建一个新图像,标注直线,找出偏移弧度
#创建一个新图像,标注直线
lineimg = np.ones(nimg.shape,dtype=np.uint8)
lineimg = lineimg * 255
piThresh = np.pi/180
pi2 = np.pi/2
print("piThresh:",piThresh)
# 得到三个角度,一个是0度,一个是90度,另一个就是我们需要的倾斜角。
for line in lines:
x1, y1, x2, y2 = line[0]
cv.line(lineimg, (x1, y1), (x2, y2), (0, 255, 0), 2)
if x2 - x1 == 0:
continue
else:
theta = (y2 - y1) / (x2 - x1)
if abs(theta) < piThresh or abs(theta - pi2) < piThresh:
continue
else:
print("theta:",theta)
# 6、计算倾斜角,将弧度转换成角度,并注意误差
angle = math.atan(theta)
print("angle(弧度):",angle)
angle = angle * (180 / np.pi)
print("angle(角度1):",angle)
angle = (angle - 90)/ (w/h)
#由于DFT的特点,只有输出图像是正方形时,检测到的角才是文本真正旋转的角度。
# 但是我们的输入图像不一定是正方形的,所以要根据图像的长宽比改变这个角度。
print("angle(角度2):",angle)
# 7、校正图片
# 先用getRotationMatrix2D()获得一个仿射变换矩阵,再把这个矩阵输入warpAffine(),
# 做一个单纯的仿射变换,得到校正的结果:
center = (w//2, h//2)
M = cv.getRotationMatrix2D(center, angle, 1.0)
rotated = cv.warpAffine(img, M, (w, h), flags=cv.INTER_CUBIC, borderMode=cv.BORDER_REPLICATE)
cv.imshow('line image', lineimg)
cv.imshow('rotated', rotated)
if __name__ == '__main__':
fourier_demo()
cv.waitKey(0)
cv.destroyAllWindows()
| {"hexsha": "87435a809a803028a7e08b77c0bba2d08370e25b", "size": 3546, "ext": "py", "lang": "Python", "max_stars_repo_path": "utils/rotation-opencv.py", "max_stars_repo_name": "vuminhduc97/TableDetect", "max_stars_repo_head_hexsha": "e69d760392973715c29238e56b35737663353aaa", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 13, "max_stars_repo_stars_event_min_datetime": "2020-07-08T11:40:34.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-07T08:20:30.000Z", "max_issues_repo_path": "rotation-opencv.py", "max_issues_repo_name": "moyans/TableCell", "max_issues_repo_head_hexsha": "f2c1c5136ab5d54cab83fdbb83657f889983ff85", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "rotation-opencv.py", "max_forks_repo_name": "moyans/TableCell", "max_forks_repo_head_hexsha": "f2c1c5136ab5d54cab83fdbb83657f889983ff85", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 6, "max_forks_repo_forks_event_min_datetime": "2020-07-15T03:05:31.000Z", "max_forks_repo_forks_event_max_datetime": "2021-08-05T06:19:36.000Z", "avg_line_length": 29.55, "max_line_length": 97, "alphanum_fraction": 0.6796390299, "include": true, "reason": "import numpy", "num_tokens": 1865} |
function G = get_payoff_G_matrix_from_ygrid_2d( y_1, y_2, S_0s, sigmas, rho, contractParams)
%UNTITLED5 Summary of this function goes here
% Detailed explanation goes here
payoff_type = contractParams.payoff_type;
if payoff_type == 1 % G = S_1
payoff = @(y1,y2)S_0s(1)*exp(sigmas(1)*y1);
elseif payoff_type == 2 % G = S_2
payoff = @(y1,y2)S_0s(2)*exp(sigmas(2)*(y2 + rho*y1));
elseif payoff_type == 3 % Exchange: G = (S_1 - S_2)^+
payoff = @(y1,y2) max(0, S_0s(1)*exp(sigmas(1)*y1) - S_0s(2)*exp(sigmas(2)*(y2 + rho*y1)));
elseif payoff_type == 4 % Spread: G = (S_1 - S_2 - K)^+
K = contractParams.K;
payoff = @(y1,y2) max(0, S_0s(1)*exp(sigmas(1)*y1) - S_0s(2)*exp(sigmas(2)*(y2 + rho*y1)) - K);
elseif payoff_type == 5 % Geometric Basket Call / Put: G = (sqrt(S_1) * sqrt(S_2) - K)^+ and
K = contractParams.K;
if contractParams.call == 1
payoff = @(y1,y2) max(0, sqrt(S_0s(1)*exp(sigmas(1)*y1)) * sqrt(S_0s(2)*exp(sigmas(2)*(y2 + rho*y1))) - K);
else
payoff = @(y1,y2) max(0, K - sqrt(S_0s(1)*exp(sigmas(1)*y1)) * sqrt(S_0s(2)*exp(sigmas(2)*(y2 + rho*y1))));
end
elseif payoff_type == 6 % Arithmetic Basket Call / Put: G = (sqrt(S_1) * sqrt(S_2) - K)^+
K = contractParams.K;
if contractParams.call == 1
payoff = @(y1,y2) max(0, 0.5*S_0s(1)*exp(sigmas(1)*y1) + 0.5*S_0s(2)*exp(sigmas(2)*(y2 + rho*y1)) - K);
else
payoff = @(y1,y2) max(0, K - 0.5*S_0s(1)*exp(sigmas(1)*y1) - 0.5*S_0s(2)*exp(sigmas(2)*(y2 + rho*y1)));
end
elseif payoff_type == 7 % Call-on-Max and Put-on-Min
K = contractParams.K;
if contractParams.call == 1
payoff = @(y1,y2) max(0, max(S_0s(1)*exp(sigmas(1)*y1), S_0s(2)*exp(sigmas(2)*(y2 + rho*y1))) - K);
else
payoff = @(y1,y2) max(0, K - min(S_0s(1)*exp(sigmas(1)*y1), S_0s(2)*exp(sigmas(2)*(y2 + rho*y1))));
end
elseif payoff_type == 8 % Call/put on Just S_2
K = contractParams.K;
if contractParams.call == 1
payoff = @(y1,y2) max(0, S_0s(2)*exp(sigmas(2)*(y2 + rho*y1)) - K);
else
payoff = @(y1,y2) max(0, K - S_0s(2)*exp(sigmas(2)*(y2 + rho*y1)));
end
elseif payoff_type == 9 % Best-of / worst of
if contractParams.best == 1
payoff = @(y1,y2) max(S_0s(1)*exp(sigmas(1)*y1), S_0s(2)*exp(sigmas(2)*(y2 + rho*y1)));
else % worst of
payoff = @(y1,y2) min(S_0s(1)*exp(sigmas(1)*y1), S_0s(2)*exp(sigmas(2)*(y2 + rho*y1)));
end
end
m_0 = length(y_1);
G = zeros(m_0, m_0);
for i=1:m_0
for j=1:m_0
G(i,j) = payoff(y_1(i), y_2(j));
end
end
end
| {"author": "jkirkby3", "repo": "PROJ_Option_Pricing_Matlab", "sha": "3859a390f395e452ad61440f95a5714dd8fb4d90", "save_path": "github-repos/MATLAB/jkirkby3-PROJ_Option_Pricing_Matlab", "path": "github-repos/MATLAB/jkirkby3-PROJ_Option_Pricing_Matlab/PROJ_Option_Pricing_Matlab-3859a390f395e452ad61440f95a5714dd8fb4d90/CTMC/Diffusion_2D/get_payoff_G_matrix_from_ygrid_2d.m"} |
[STATEMENT]
lemma eccentricity_bot_iff: "eccentricity v = 0 \<longleftrightarrow> V = {} \<or> V = {v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (eccentricity v = 0) = (V = {} \<or> V = {v})
[PROOF STEP]
proof (intro iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. eccentricity v = 0 \<Longrightarrow> V = {} \<or> V = {v}
2. V = {} \<or> V = {v} \<Longrightarrow> eccentricity v = 0
[PROOF STEP]
assume a: "eccentricity v = 0"
[PROOF STATE]
proof (state)
this:
eccentricity v = 0
goal (2 subgoals):
1. eccentricity v = 0 \<Longrightarrow> V = {} \<or> V = {v}
2. V = {} \<or> V = {v} \<Longrightarrow> eccentricity v = 0
[PROOF STEP]
show "V = {} \<or> V = {v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. V = {} \<or> V = {v}
[PROOF STEP]
proof (rule ccontr, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. V \<noteq> {} \<and> V \<noteq> {v} \<Longrightarrow> False
[PROOF STEP]
assume a2: "V \<noteq> {} \<and> V \<noteq> {v}"
[PROOF STATE]
proof (state)
this:
V \<noteq> {} \<and> V \<noteq> {v}
goal (1 subgoal):
1. V \<noteq> {} \<and> V \<noteq> {v} \<Longrightarrow> False
[PROOF STEP]
have eq0: "\<forall> u \<in> V - {v} . shortest_path v u = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<forall>u\<in>V - {v}. shortest_path v u = 0
[PROOF STEP]
using SUP_bot_conv(1)[of "\<lambda> u. shortest_path v u" "V - {v}"] a eccentricity_def bot_enat_def
[PROOF STATE]
proof (prove)
using this:
(Sup (shortest_path v ` (V - {v})) = bot) = (\<forall>x\<in>V - {v}. shortest_path v x = bot)
eccentricity v = 0
eccentricity ?v \<equiv> Sup (shortest_path ?v ` (V - {?v}))
bot = 0
goal (1 subgoal):
1. \<forall>u\<in>V - {v}. shortest_path v u = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>u\<in>V - {v}. shortest_path v u = 0
goal (1 subgoal):
1. V \<noteq> {} \<and> V \<noteq> {v} \<Longrightarrow> False
[PROOF STEP]
have nc: "\<forall> u \<in> V - {v} . \<not> vert_connected v u \<longrightarrow> shortest_path v u = \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<forall>u\<in>V - {v}. \<not> vert_connected v u \<longrightarrow> shortest_path v u = \<infinity>
[PROOF STEP]
using shortest_path_inf
[PROOF STATE]
proof (prove)
using this:
\<not> vert_connected ?u ?v \<Longrightarrow> shortest_path ?u ?v = \<infinity>
goal (1 subgoal):
1. \<forall>u\<in>V - {v}. \<not> vert_connected v u \<longrightarrow> shortest_path v u = \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>u\<in>V - {v}. \<not> vert_connected v u \<longrightarrow> shortest_path v u = \<infinity>
goal (1 subgoal):
1. V \<noteq> {} \<and> V \<noteq> {v} \<Longrightarrow> False
[PROOF STEP]
have "\<forall> u \<in> V - {v} . vert_connected v u \<longrightarrow> shortest_path v u > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<forall>u\<in>V - {v}. vert_connected v u \<longrightarrow> 0 < shortest_path v u
[PROOF STEP]
using shortest_path_lb
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?u \<noteq> ?v; vert_connected ?u ?v\<rbrakk> \<Longrightarrow> 0 < shortest_path ?u ?v
goal (1 subgoal):
1. \<forall>u\<in>V - {v}. vert_connected v u \<longrightarrow> 0 < shortest_path v u
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>u\<in>V - {v}. vert_connected v u \<longrightarrow> 0 < shortest_path v u
goal (1 subgoal):
1. V \<noteq> {} \<and> V \<noteq> {v} \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>u\<in>V - {v}. vert_connected v u \<longrightarrow> 0 < shortest_path v u
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<forall>u\<in>V - {v}. vert_connected v u \<longrightarrow> 0 < shortest_path v u
goal (1 subgoal):
1. False
[PROOF STEP]
using eq0 a2 nc
[PROOF STATE]
proof (prove)
using this:
\<forall>u\<in>V - {v}. vert_connected v u \<longrightarrow> 0 < shortest_path v u
\<forall>u\<in>V - {v}. shortest_path v u = 0
V \<noteq> {} \<and> V \<noteq> {v}
\<forall>u\<in>V - {v}. \<not> vert_connected v u \<longrightarrow> shortest_path v u = \<infinity>
goal (1 subgoal):
1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
V = {} \<or> V = {v}
goal (1 subgoal):
1. V = {} \<or> V = {v} \<Longrightarrow> eccentricity v = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. V = {} \<or> V = {v} \<Longrightarrow> eccentricity v = 0
[PROOF STEP]
show "V = {} \<or> V = {v} \<Longrightarrow> eccentricity v = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. V = {} \<or> V = {v} \<Longrightarrow> eccentricity v = 0
[PROOF STEP]
using eccentricity_empty_vertices
[PROOF STATE]
proof (prove)
using this:
V = {} \<Longrightarrow> eccentricity ?v = 0
V = {?v} \<Longrightarrow> eccentricity ?v = 0
goal (1 subgoal):
1. V = {} \<or> V = {v} \<Longrightarrow> eccentricity v = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V = {} \<or> V = {v} \<Longrightarrow> eccentricity v = 0
goal:
No subgoals!
[PROOF STEP]
qed | {"llama_tokens": 2160, "file": "Undirected_Graph_Theory_Connectivity", "length": 24} |
import keras.backend
import numpy as np
import tensorflow as tf
#cpu
def bbox_transform_cpu(ex_rois, gt_rois):
ex_widths = ex_rois[:, 2] - ex_rois[:, 0] + 1.0
ex_heights = ex_rois[:, 3] - ex_rois[:, 1] + 1.0
ex_ctr_x = ex_rois[:, 0] + 0.5 * ex_widths
ex_ctr_y = ex_rois[:, 1] + 0.5 * ex_heights
gt_widths = gt_rois[:, 2] - gt_rois[:, 0] + 1.0
gt_heights = gt_rois[:, 3] - gt_rois[:, 1] + 1.0
gt_ctr_x = gt_rois[:, 0] + 0.5 * gt_widths
gt_ctr_y = gt_rois[:, 1] + 0.5 * gt_heights
targets_dx = (gt_ctr_x - ex_ctr_x) / ex_widths
targets_dy = (gt_ctr_y - ex_ctr_y) / ex_heights
targets_dw = np.log(gt_widths / ex_widths)
targets_dh = np.log(gt_heights / ex_heights)
targets = np.stack((targets_dx, targets_dy, targets_dw, targets_dh))
targets = np.transpose(targets)
return targets
#gpu
def bbox_transform(ex_rois, gt_rois):
ex_widths = ex_rois[:, 2] - ex_rois[:, 0] + 1.0
ex_heights = ex_rois[:, 3] - ex_rois[:, 1] + 1.0
ex_ctr_x = ex_rois[:, 0] + 0.5 * ex_widths
ex_ctr_y = ex_rois[:, 1] + 0.5 * ex_heights
gt_widths = gt_rois[:, 2] - gt_rois[:, 0] + 1.0
gt_heights = gt_rois[:, 3] - gt_rois[:, 1] + 1.0
gt_ctr_x = gt_rois[:, 0] + 0.5 * gt_widths
gt_ctr_y = gt_rois[:, 1] + 0.5 * gt_heights
targets_dx = (gt_ctr_x - ex_ctr_x) / ex_widths
targets_dy = (gt_ctr_y - ex_ctr_y) / ex_heights
targets_dw = keras.backend.log(gt_widths / ex_widths)
targets_dh = keras.backend.log(gt_heights / ex_heights)
targets = keras.backend.stack((targets_dx, targets_dy, targets_dw, targets_dh))
targets = keras.backend.transpose(targets)
return targets
| {"hexsha": "292589e7da2f0692876e17876412c140061ee1e2", "size": 1663, "ext": "py", "lang": "Python", "max_stars_repo_path": "keras_detection/bbox_encode.py", "max_stars_repo_name": "Walter1218/Self_Driving_Car_ND", "max_stars_repo_head_hexsha": "526a9583a2bc616cb19cdfc7921b5e1c0f9711bd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2017-05-25T01:26:41.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-16T13:38:57.000Z", "max_issues_repo_path": "keras_detection/bbox_encode.py", "max_issues_repo_name": "Walter1218/Self_Driving_Car_ND", "max_issues_repo_head_hexsha": "526a9583a2bc616cb19cdfc7921b5e1c0f9711bd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "keras_detection/bbox_encode.py", "max_forks_repo_name": "Walter1218/Self_Driving_Car_ND", "max_forks_repo_head_hexsha": "526a9583a2bc616cb19cdfc7921b5e1c0f9711bd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2017-05-25T01:26:50.000Z", "max_forks_repo_forks_event_max_datetime": "2017-05-25T01:26:50.000Z", "avg_line_length": 33.9387755102, "max_line_length": 83, "alphanum_fraction": 0.6416115454, "include": true, "reason": "import numpy", "num_tokens": 621} |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao ([email protected])
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import pprint
import shutil
import torch.nn as nn
import torch
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torchvision.transforms as transforms
from torch.autograd import Variable
from torchvision import datasets, transforms
from tensorboardX import SummaryWriter
import numpy as np
import _init_paths
from config import cfg
from config import update_config
from core.loss import JointsMSELoss
from core.function import train
from core.function import validate,validate_select
from utils.utils import get_optimizer
from utils.utils import save_checkpoint
from utils.utils import create_logger
from utils.utils import get_model_summary
from models.pose_resnet import Bottleneck,BasicBlock
from models.purnpose_hrnet import PosePurnHighResolutionNet
from dataset import coco
import dataset
import models
import json
from purning_criterion import getpruneffects,getpruneffects_v2,getpruneffects_v3
# v3 0.5514472610784643
# v2 0.47681901943061233
def parse_args():
parser = argparse.ArgumentParser(description='Train keypoints network')
# general
parser.add_argument('--cfg',
help='experiment configure file name',
required=True,
type=str)
parser.add_argument('opts',
help="Modify config options using the command-line",
default=None,
nargs=argparse.REMAINDER)
# philly
parser.add_argument('--modelDir',
help='model directory',
type=str,
default='')
parser.add_argument('--logDir',
help='log directory',
type=str,
default='')
parser.add_argument('--dataDir',
help='data directory',
type=str,
default='')
parser.add_argument('--prevModelDir',
help='prev Model directory',
type=str,
default='')
parser.add_argument('--save', default='MPIIHRNET48_sns', type=str, metavar='PATH',
help='path to save pruned model (default: none)')
args = parser.parse_args()
return args
def test(model,cfg,final_output_dir,tb_log_dir):
#model = torch.nn.DataParallel(model, device_ids=cfg.GPUS).cuda()
# define loss function (criterion) and optimizer
#model.eval()
criterion = JointsMSELoss(
use_target_weight=cfg.LOSS.USE_TARGET_WEIGHT
).cuda()
# Data loading code
normalize = transforms.Normalize(
mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]
)
# valid_dataset = eval('dataset.'+cfg.DATASET.DATASET)(
# cfg, cfg.DATASET.ROOT, cfg.DATASET.TEST_SET, False,
# transforms.Compose([
# transforms.ToTensor(),
# normalize,
# ])
# )
valid_dataset = eval('dataset.'+cfg.DATASET.DATASET)(
cfg, cfg.DATASET.ROOT, cfg.DATASET.TEST_SET, False,
transforms.Compose([
transforms.ToTensor(),
normalize,
])
)
valid_loader = torch.utils.data.DataLoader(
valid_dataset,
batch_size=cfg.TEST.BATCH_SIZE_PER_GPU*len(cfg.GPUS),
shuffle=False,
num_workers=cfg.WORKERS,
pin_memory=True
)
# evaluate on validation set
perf_indicator = validate_select(cfg, valid_loader, valid_dataset, model, criterion,
final_output_dir, tb_log_dir)
return perf_indicator
def fic(percent,ap,acc,maxap,maxacc):
return acc/maxacc + ap/maxap + percent
def main():
epsilon = 1e-3
alpha = 0.618
a = 0
b = 1
args = parse_args()
update_config(cfg, args)
datadir = {}
datadir["percent"] = []
datadir["Perf_indicator"] = []
datadir["Acc"] = []
max_perf,max_acc = getpruneffects(0,"original")
per = 0
count = 0
max_count = 45
while b - a > 0:
lam = a + (1 - alpha) * (b - a)
mu = a + alpha * (b - a)
print("count:{},a:{},b:{},lam:{},mu:{}".format(count,a,b,lam,mu))
Per_lam,Acc_lam = getpruneffects(lam,int(lam*100000))
datadir["percent"].append(lam)
datadir["Perf_indicator"].append(Per_lam)
datadir["Acc"].append(Acc_lam)
Per_mu,Acc_mu = getpruneffects(mu,int(mu*100000))
datadir["percent"].append(mu)
datadir["Perf_indicator"].append(Per_mu)
datadir["Acc"].append(Acc_mu)
F_lam = fic(lam,Per_lam,Acc_lam,max_perf,max_acc)
F_mu = fic(mu,Per_mu,Acc_mu,max_perf,max_acc)
if (b - a < epsilon) or (count > max_count):
percent = (b+a)/2
Perf_indicator , Acc = getpruneffects(percent,"final_percent{}".format(int(percent*100000)))
datadir["percent"].append(percent)
datadir["Perf_indicator"].append(Perf_indicator)
datadir["Acc"].append(Acc)
print(percent)
break
elif F_lam > F_mu:
a = lam
lam = mu
mu = a + alpha * (b - a)
elif F_lam <= F_mu:
b = mu
mu = lam
lam = a + (1 - alpha) * (b - a)
count += 1
with open(os.path.join(args.save,'datav2.json'), 'w') as f:
json.dump(datadir, f)
if __name__ == '__main__':
main()
| {"hexsha": "0014fcf61045d8810b4569012fef57a72361cf09", "size": 5876, "ext": "py", "lang": "Python", "max_stars_repo_path": "tools/golden_cut_select.py", "max_stars_repo_name": "vvhj/APRCP-HRNet-Adaptive-Pruning-Rate-Channel-Pruning-for-HRNet", "max_stars_repo_head_hexsha": "bb3d946b9de311f7d1161a0056f39d84db00cb4c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2020-11-01T15:36:16.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-13T08:24:47.000Z", "max_issues_repo_path": "tools/golden_cut_select.py", "max_issues_repo_name": "vvhj/APRCP-HRNet-Adaptive-Pruning-Rate-Channel-Purning-for-HRNet", "max_issues_repo_head_hexsha": "bb3d946b9de311f7d1161a0056f39d84db00cb4c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2020-12-30T07:28:58.000Z", "max_issues_repo_issues_event_max_datetime": "2021-04-07T07:16:38.000Z", "max_forks_repo_path": "tools/golden_cut_select.py", "max_forks_repo_name": "vvhj/APRCP-HRNet-Adaptive-Pruning-Rate-Channel-Purning-for-HRNet", "max_forks_repo_head_hexsha": "bb3d946b9de311f7d1161a0056f39d84db00cb4c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2020-11-01T15:36:17.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-01T09:50:36.000Z", "avg_line_length": 32.8268156425, "max_line_length": 104, "alphanum_fraction": 0.5973451327, "include": true, "reason": "import numpy", "num_tokens": 1391} |
[STATEMENT]
lemma autoref_SUCCEED[autoref_rules]: "(SUCCEED,SUCCEED) \<in> \<langle>R\<rangle>nres_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (SUCCEED, SUCCEED) \<in> \<langle>R\<rangle>nres_rel
[PROOF STEP]
by (auto simp: nres_rel_def) | {"llama_tokens": 111, "file": "Refine_Monadic_Refine_Basic", "length": 1} |
\chapter{Finite differences in 2D}\label{chap: finite diff 2d}
In this chapter, we study the numerical solution of the Dirichlet boundary-value
problem for the Poisson equation. Let $\Omega$ be a bounded, open subset
of~$\mathbb{R}^2$, with a piecewise smooth boundary~$\Gamma=\partial\Omega$.
Given suitable functions $f(x,y)$~and $g(x,y)$, we see $u=u(x,y)$ satisfying
\begin{equation}\label{eq: Poisson bvp}
\begin{aligned}
-\nabla^2u&=f(x,y)&&\text{for $(x,y)\in\Omega$,}\\
u&=g(x,y)&&\text{for $(x,y)\in\Gamma$.}
\end{aligned}
\end{equation}
Here, the \emph{Laplacian} is the second-order elliptic differential operator
defined by
\[
\nabla^2 u=\nabla\cdot(\nabla u)=\frac{\partial^2u}{\partial x^2}
+\frac{\partial^2u}{\partial y^2}.
\]
\section{Five-point difference scheme}\label{sec: five point scheme}
For simplicity, we now restrict our attention to the case when the spatial
domain is a rectangle,
\begin{equation}\label{eq: Omega rectangle}
\Omega=(0,L_x)\times(0,L_y).
\end{equation}
To set up the spatial finite difference grid, we fix positive integers $P$~and
$Q$, define the step sizes
\[
\Delta x=\frac{L_x}{P}\quad\text{and}\quad\Delta y=\frac{L_y}{Q},
\]
and define the grid points
\begin{equation}\label{eq: xp yq grid}
(x_p,y_q)=(p\,\Delta x,q\,\Delta y)
\quad\text{for $0\le p\le P$ and $0\le q\le Q$.}
\end{equation}
Our is to compute $U_{p,q}\approx u(x_p,y_q)$ where $u$ is the solution
of~\eqref{eq: Poisson bvp}.
Let $\delta_x^2$~and $\delta_y^2$ denote the second-order, central difference
operators in the $x$- and $y$-directions, respectively; that is,
\[
\delta_x^2u(x,y)=\frac{u(x+\Delta x,y)-2u(x,y)+u(x-\Delta x,y)}{\Delta x^2}
=\frac{\partial^2u}{\partial x^2}+O(\Delta x^2)
\]
and
\[
\delta_y^2u(x,y)=\frac{u(x,y+\Delta y)-2u(x,y)+u(x,y-\Delta y)}{\Delta x^2}
=\frac{\partial^2u}{\partial y^2}+O(\Delta y^2).
\]
We also write
\[
\delta_x^2U_{pq}=\frac{U_{p+1,q}-2U_{p,q}+U_{p-1,q}}{\Delta x^2}
\quad\text{and}\quad
\delta_y^2U_{pq}=\frac{U_{p,q}-2U_{p,q}+U_{p,q-1}}{\Delta y^2}.
\]
With this notation, our finite difference scheme can be written compactly as
\begin{equation}\label{eq: 5-pt Poisson}
\begin{aligned}
-\bigl(\delta_x^2U_{p,q}+\delta_y^2U_{p,q}\bigr)&=f_{p,q}
&&\text{for $(x_p,y_q)\in\Omega$,}\\
U_{p,q}&=g_{p,q}&&\text{for $(x_p,y_q)\in\Gamma$,}
\end{aligned}
\end{equation}
with the obvious abbreviations $f_{p,q}=f(x_p,y_q)$~and $g_{p,q}=g(x_p,y_q)$.
Notice that $(x_p,y_q)\in\Omega$ for $1\le p\le P-1$ and $1\le q\le Q-1$, so
there are
\[
M=(P-1)(Q-1)
\]
unknown values of~$U_{p,q}$ at the interior grid points. The remaining
$(P+1)(Q+1)-M=2P+2Q$ values are given directly by the Dirichlet boundary
condition. The finite difference approximation provides one equation for
each interior grid points, and hence one equation for each unknown, to yield an
$M\times M$~linear system. Figure~\ref{fig: 5-pt stencil} shows the stencil
for the scheme, which involes 5~grid points: $(x_p,y_q)$ and its four nearest
neighbours $(x_{p-1},y_q)$, $(x_{p+1},y_q)$, $(x_{p,q-1})$~and
$(x_p,y_{q+1})$.
\begin{figure}
\caption{Five-point finite difference stencil for the discrete Poisson
equation~\eqref{eq: 5-pt Poisson}.}\label{fig: 5-pt stencil}
\begin{center}
\begin{tikzpicture}[scale=0.5]
\draw[->] (-1,0) -- (17,0);
\node[right] at (17,0) {$x$};
\node[below] at (8,0) {$x_p$};
\draw[->] (0,-1) -- (0,13);
\node[above left] at (0,13) {$y$};
\node[left] at (0,6) {$y_q$};
\foreach \x in {2, 4, ..., 14}
\draw[thin] (\x,0) -- (\x,12);
\foreach \y in {2, 4, ..., 10}
\draw[thin] (0,\y) -- (16,\y);
\draw[ultra thick] (8,4) -- (8,8);
\draw[ultra thick] (6,6) -- (10,6);
\draw[fill=red] (8,4) circle (0.15cm);
\draw[fill=red] (8,6) circle (0.15cm);
\draw[fill=red] (8,8) circle (0.15cm);
\draw[fill=red] (6,6) circle (0.15cm);
\draw[fill=red] (10,6) circle (0.15cm);
\node[below] at (16,0) {$L_x$};
\node[left] at (0,12) {$L_y$};
\draw[thick] (0,0) -- (16,0) -- (16,12) -- (0,12) -- (0,0);
\end{tikzpicture}
\end{center}
\end{figure}
To describe the $M\times M$ system explicitly, we need to arrange the
unknowns~$U_{p,q}$ into a column vector of length~$M$. A standard approach is
to think of the $U_{p,q}$ as the entries of a $(P-1)\times(Q-1)$ matrix and use
\emph{column-major ordering}, so that
\begin{equation}\label{eq: column-major}
U_j=U_{p,q}\quad
\text{where $j=p+(q-1)(P-1)$ for $1\le p\le P-1$ and $1\le q\le Q-1$.}
\end{equation}
The right-hand sides $f_{p,q}$ are arranged in the same way.
\begin{example}\label{example: 5-pt matrix}
Suppose $P=5$ and $Q=4$, with $\Delta x=h=\Delta y$. The finite difference
equation is then
\[
-\frac{1}{h^2}\bigl(U_{p+1,q}-2U_{p,q}+U_{p-1,q}+U_{p,q+1}2-U_{p,q}+U_{p,q-1}
\bigr)=f_{p,q},
\]
or equivalently,
\[
\frac{1}{h^2}\bigl(-U_{p,q-1}-U_{p-1,q}+4U_{p,q}-U_{p+1,q}-U_{p,q+1}\bigr)
=f_{p,q}.
\]
When $p=1$~and $q=3$,
\[
\frac{1}{h^2}\bigl(-U_{1,2}-U_{0,3}+4U_{1,3}-U_{2,3}-U_{1,4}\bigr)
=f_{1,3},
\]
and the boundary conditions give $U_{0,3}=g_{0,3}$~and $U_{1,4}=g_{1,4}$, so
\[
\frac{1}{h^2}\bigl(-U_{1,2}+4U_{1,3}-U_{2,3}\bigr)
=f_{1,3}+\frac{1}{h^2}\bigl(g_{0,3}+g_{1,4}\bigr).
\]
Using column-major ordering~\eqref{eq: column-major} with~$P=5$, we have
$U_5=U_{1,2}$, $U_9=U_{1,3}$~and $U_{10}=U_{2,3}$ so the $9$th equation is
\[
\frac{1}{h^2}\bigl(-U_5+4U_9-U_{10}\bigr)=f_9
+\frac{1}{h^2}\bigl(g_{0,3}+g_{1,4}\bigr).
\]
Figure~\ref{fig: 5-pt matrix} shows the complete $12\times12$ linear system.
\end{example}
\begin{figure}
\caption{The $12\times12$ linear system from
Example~\ref{example: 5-pt matrix}.}\label{fig: 5-pt matrix}
\begin{gather*}
\frac{1}{h^2}
\left[\begin{array}{cccc|cccc|cccc}
4&-1& 0& 0& -1& 0& 0& 0& 0& 0& 0& 0\\
-1& 4&-1& 0& 0&-1& 0& 0& 0& 0& 0& 0\\
0&-1& 4&-1& 0& 0&-1& 0& 0& 0& 0& 0\\
0& 0&-1& 4& 0& 0& 0&-1& 0& 0& 0& 0\\
\hline
-1& 0& 0& 0& 4&-1& 0& 0& -1& 0& 0& 0\\
0&-1& 0& 0& -1& 4&-1& 0& 0&-1& 0& 0\\
0& 0&-1& 0& 0&-1& 4&-1& 0& 0&-1& 0\\
0& 0& 0&-1& 0& 0&-1& 4& 0& 0& 0&-1\\
\hline
0& 0& 0& 0& -1& 0& 0& 0& 4&-1& 0& 0\\
0& 0& 0& 0& 0&-1& 0& 0& -1& 4&-1& 0\\
0& 0& 0& 0& 0& 0&-1& 0& 0&-1& 4&-1\\
0& 0& 0& 0& 0& 0& 0&-1& 0& 0&-1& 4
\end{array}\right]
\left[\begin{array}{c}
U_{1,1}\\ U_{2,1}\\ U_{3,1}\\ U_{4,1}\\
\hline
U_{1,2}\\ U_{2,2}\\ U_{3,2}\\ U_{4,2}\\
\hline
U_{1,3}\\ U_{2,3}\\ U_{3,3}\\ U_{4,3}
\end{array}\right]\\
=\left[\begin{array}{c}
f_{1,1}\\ f_{2,1}\\ f_{3,1}\\ f_{4,1}\\
\hline
f_{1,2}\\ f_{2,2}\\ f_{3,2}\\ f_{4,2}\\
\hline
f_{1,3}\\ f_{2,3}\\ f_{3,3}\\ f_{4,3}
\end{array}\right]
+\frac{1}{h^2}\left[\begin{array}{c}
g_{01}+g_{10}\\ g_{20}\\ g_{30}\\ g_{40}+g_{51}\\ \hline
g_{02} \\ 0 \\ 0 \\ g_{52}\\ \hline
g_{03}+g_{14}\\ g_{24}\\ g_{34}\\ g_{44}+g_{53}
\end{array}\right].
\end{gather*}
\end{figure}
\section{Matrix structure}
The structure of the matrix arising from the discrete Poisson
problem~\eqref{eq: 5-pt Poisson} can be understood more easily with the help of
the following concept.
\begin{definition}
Given matrices
$\boldsymbol{A}\in\mathbb{R}^{M\times N}$~and
$\boldsymbol{B}\in\mathbb{R}^{P\times Q}$, the \emph{Kronecker product}
$\boldsymbol{A}\otimes\boldsymbol{B}\in\mathbb{R}^{(MP)\times(NQ)}$
is the $M\times N$ block matrix whose $ij$-block equals $a_{ji}\boldsymbol{B}$,
that is,
\[
\boldsymbol{A}\otimes\boldsymbol{B}=\begin{bmatrix}
a_{11}\boldsymbol{B}&a_{12}\boldsymbol{B}&\cdots&a_{1N}\boldsymbol{B}\\
a_{21}\boldsymbol{B}&a_{22}\boldsymbol{B}&\cdots&a_{2N}\boldsymbol{B}\\
\vdots& \vdots&\ddots& \vdots\\
a_{M1}\boldsymbol{B}&a_{M2}\boldsymbol{B}&\cdots&a_{MN}\boldsymbol{B}
\end{bmatrix}.
\]
\end{definition}
\begin{example}\label{example: Kronecker product}
If
\[
\boldsymbol{A}=\begin{bmatrix}1&3\\ 2&4\end{bmatrix}
\quad\text{and}\quad
\boldsymbol{B}=\begin{bmatrix}1&0&-3\\ -2&1&-1\end{bmatrix}
\]
then
\[
\boldsymbol{A}\otimes\boldsymbol{B}
=\begin{bmatrix}
\boldsymbol{B}&3\boldsymbol{B}\\
2\boldsymbol{B}&4\boldsymbol{B}
\end{bmatrix}
=\left[\begin{array}{ccc|ccc}
1& 0&-3& 3& 0&-9\\
-2& 1&-1&-6& 3&-3\\
\hline
2& 0&-6& 4& 0&-12\\
-4& 2&-2&-8& 4&-4
\end{array}\right].
\]
\end{example}
The next theorem gives a key relation between the Kronecker product and the
ordinary matrix product.
\begin{theorem}\label{thm: Kronecker A B C D}
If $\boldsymbol{A}\in\mathbb{R}^{M\times N}$,
$\boldsymbol{B}\in\mathbb{R}^{P\times Q}$,
$\boldsymbol{C}\in\mathbb{R}^{N\times R}$~and
$\boldsymbol{D}\in\mathbb{R}^{Q\times S}$, then
\[
(\boldsymbol{A}\otimes\boldsymbol{B})(\boldsymbol{C}\otimes\boldsymbol{D})
=(\boldsymbol{A}\boldsymbol{C})\otimes(\boldsymbol{B}\boldsymbol{D}).
\]
\end{theorem}
\begin{proof}
The $ij$-block of
$(\boldsymbol{A}\otimes\boldsymbol{B})(\boldsymbol{C}\otimes\boldsymbol{D})$
equals
\[
\sum_{k=1}^N(a_{ik}\boldsymbol{B})(c_{kj}\boldsymbol{D})
=\biggl(\sum_{k=1}^Na_{ik}c_{kj}\biggr)(\boldsymbol{B}\boldsymbol{D})
=(\boldsymbol{A}\boldsymbol{C})_{ij}(\boldsymbol{B}\boldsymbol{D}),
\]
which is also the $ij$-block of
$(\boldsymbol{A}\boldsymbol{C})\otimes(\boldsymbol{B}\boldsymbol{D})$.
\end{proof}
\begin{example}
\newcommand{\bs}[1]{\boldsymbol{#1}}
With $\boldsymbol{A}$~and $\boldsymbol{B}$ as in
Example~\ref{example: Kronecker product}, and with
\[
\boldsymbol{C}=\begin{bmatrix}1&-1&3\\ 5&0&3\end{bmatrix}
\quad\text{and}\quad
\boldsymbol{D}=\begin{bmatrix}1&0&7\\ 0&-4&1\\ 2&3&9\end{bmatrix},
\]
we have
\[
(\bs{A}\otimes\bs{B})(\bs{C}\otimes\bs{D})
=\begin{bmatrix}
\bs{B}&3\bs{B}\\
2\bs{B}&4\bs{B}\end{bmatrix}
\begin{bmatrix}
\bs{D}&-\bs{D}&3\bs{D}\\
5\bs{D}& \bs{0}&3\bs{D}
\end{bmatrix}
=\begin{bmatrix}
16\bs{B}\bs{D}& -\bs{B}\bs{D}&12\bs{B}\bs{D}\\
22\bs{B}\bs{D}&-2\bs{B}\bs{D}&18\bs{B}\bs{D}
\end{bmatrix}
\]
which is the same matrix as
\[
(\bs{A}\bs{C})\otimes(\bs{B}\bs{D})
=\left(\begin{bmatrix}1&3\\ 2&4\end{bmatrix}
\begin{bmatrix}1&-1&3\\ 5&0&3\end{bmatrix}\right)\otimes(\bs{B}\bs{D})
=\begin{bmatrix}16&-1&12\\ 22&-2&18\end{bmatrix}\otimes(\bs{B}\bs{D}).
\]
\end{example}
The Kronecker product makes sense for vector operands, if we identify an
$N$-dimensional row vector with a $1\times N$~matrix, and identify an
$N$-dimensional column vector with an $N\times1$~matrix. Suppose that
\[
\newcommand{\bs}[1]{\boldsymbol{#1}}
\bs{U}=\bs{w}\otimes\bs{v}
=\begin{bmatrix}w_1\bs{v}\\ w_2\bs{v}\\ \vdots\\ w_{Q-1}\bs{v}\end{bmatrix}
\quad\text{for $\bs{v}\in\mathbb{R}^{P-1}$ and $\bs{w}\in\mathbb{R}^{Q-1}$,}
\]
so that
\[
U_j=U_{p,q}=v_pw_q\quad\text{where $j=p+(q-1)(P-1)$,}
\]
for $1\le p\le P-1$ and $1\le q\le Q-1$. Define
\[
\boldsymbol{A}_x=\frac{1}{\Delta x^2}\begin{bmatrix}
2& -1& & &\\
-1& 2& -1& &\\
&\ddots&\ddots&\ddots&\\
& & -1& 2&-1\\
& & & -1& 2\end{bmatrix}\in\mathbb{R}^{(P-1)\times(P-1)}
\]
and
\[
\boldsymbol{A}_y=\frac{1}{\Delta y^2}\begin{bmatrix}
2& -1& & &\\
-1& 2& -1& &\\
&\ddots&\ddots&\ddots&\\
& & -1& 2&-1\\
& & & -1& 2\end{bmatrix}\in\mathbb{R}^{(Q-1)\times(Q-1)},
\]
so that
\begin{equation}\label{eq: delta x y separable}
-\delta_x^2U_{p,q}=(\boldsymbol{A}_x\boldsymbol{v})_pw_q
\quad\text{and}\quad
-\delta_y^2U_{p,q}=v_p(\boldsymbol{A}_y\boldsymbol{w})_q,
\end{equation}
if we set $v_0=0=v_P$ and $w_0=0=w_Q$. These relations correspond to the case
when $u(x,y)=v(x)w(y)$ so that $-u_{xx}=(-v'')w$~and $u_{yy}=v(-w'')$.
\begin{theorem}\label{thm: Poisson matrix}
Let
\[
\boldsymbol{A}\boldsymbol{U}=\boldsymbol{f}+\boldsymbol{g}
\]
be the linear system resulting from the discrete Poisson
problem~\eqref{eq: 5-pt Poisson} scheme~\eqref{eq: 5-pt Poisson}. Then,
\[
\boldsymbol{A}=\boldsymbol{I}_y\otimes\boldsymbol{A}_x
+\boldsymbol{A}_y\otimes\boldsymbol{I}_x,
\]
where $\boldsymbol{I}_x$~and $\boldsymbol{I}_y$ are the identity matrices of
dimension $P-1$~and $Q-1$, respectively.
\end{theorem}
\begin{proof}
We see from \eqref{eq: delta x y separable}~and
Theorem~\ref{thm: Kronecker A B C D} that
\begin{align*}
\boldsymbol{A}(\boldsymbol{w}\otimes\boldsymbol{v})
&=\boldsymbol{w}\otimes(\boldsymbol{A}_x\boldsymbol{v})
+(\boldsymbol{A}_y\boldsymbol{w})\otimes\boldsymbol{v}\\
&=\bigl(\boldsymbol{I}_y\boldsymbol{w})
\otimes(\boldsymbol{A}_x\boldsymbol{v})
+(\boldsymbol{A}_y\boldsymbol{w})
\otimes(\boldsymbol{I}_x\boldsymbol{v})\\
&=(\boldsymbol{I}_y\otimes\boldsymbol{A}_x)
(\boldsymbol{w}\otimes\boldsymbol{v})
+(\boldsymbol{A}_y\otimes\boldsymbol{I}_x)
(\boldsymbol{w}\otimes\boldsymbol{v})\\
&=\bigl(\boldsymbol{I}_y\otimes\boldsymbol{A}_x
+\boldsymbol{A}_y\otimes\boldsymbol{I}_x\bigr)
(\boldsymbol{w}\otimes\boldsymbol{v})
\end{align*}
for every $\boldsymbol{v}\in\mathbb{R}^{P-1}$ and
$\boldsymbol{w}\in\mathbb{R}^{Q-1}$.
\end{proof}
\section{Band Cholesky factorization}
A matrix~$\boldsymbol{A}=[a_{ij}]$ has \emph{upper bandwidth}~$\beta$
if $a_{ij}=0$ whenever $j-i>\beta$, or equivalently if $\boldsymbol{A}$ has
$\beta$~non-zero superdiagonals. Similarly, $\boldsymbol{A}$ has \emph{lower
bandwidth}~$\beta$ if $a_{ij}=0$ whenever $i-j>\beta$, so that there are
$\beta$~non-zero subdiagonals. For example, the following matrix has upper
bandwidth~$2$ and lower bandwidth~$3$:
\[
\begin{bmatrix}
5& 2&-1& 0& 0& 0& 0\\
1& 6& 0& 8& 0& 0& 0\\
2& 3& 9& 1& 8& 0& 0\\
-3& 4& 7& 2& 5& 8& 0\\
0& 0& 2& 8& 3&-7& 1\\
0& 0& 4&-5& 6& 9& 3
\end{bmatrix}.
\]
If a matrix is symmetric, then its upper and lower bandwidths must be equal, so
we refer to both as just the \emph{bandwidth}.
Let $\boldsymbol{A}$ be an $n\times n$ symmetric, positive-definite matrix
with bandwith~$\beta$. We will seek a \emph{band Cholesky factorization}
\begin{equation}\label{eq: Chol fact}
\boldsymbol{A}=\boldsymbol{R}^T\boldsymbol{R},
\end{equation}
where the $n\times n$ matrix~$\boldsymbol{R}=[r_{ij}]$ is upper triangular with
upper bandwidth~$\beta$. By the definition of matrix multiplication,
\[
\bigl(\boldsymbol{R}^T\boldsymbol{R}\bigr)_{ij}
=\sum_{k=1}^n\bigl(\boldsymbol{R}^T\bigr)_{ik}\boldsymbol{R}_{kj}
=\sum_{k=1}^n r_{ki}r_{kj}.
\]
Since $\boldsymbol{R}$ is upper triangular, $r_{ki}r_{kj}=0$ if $k>i$~or $k>j$,
that is, if $k>\min(i,j)$, so in fact
\[
\bigl(\boldsymbol{R}^T\boldsymbol{R}\bigr)_{ij}
=\sum_{k=1}^{\min(i,j)} r_{ki}r_{kj}.
\]
In addition, $\boldsymbol{R}$ has upper bandwidth~$\beta$ so $r_{ki}r_{kj}=0$
if $i>k+\beta$~or $j>k+\beta$. Thus, taking account of symmetry,
\eqref{eq: Chol fact} is satisfied iff
\[
a_{ij}=\sum_{k=\max(1,j-\beta)}^ir_{ki}r_{kj}
\quad\text{for $\max(1,j-\beta)\le i\le j\le n$.}
\]
We split the last term off the sum, writing
\[
a_{ij}=r_{ii}r_{ij}+\sum_{k=\max(1,j-\beta)}^{i-1}r_{ki}r_{kj}
\quad\text{for $\max(1,j-\beta)\le i<j\le n$,}
\]
in the off-diagonal case, and
\[
a_{jj}=r_{jj}^2+\sum_{k=\max(1,j-\beta)}^{j-1}r_{kj}^2
\quad\text{for $1\le j\le n$.}
\]
in the diagonal case. Rearranging these equations leads to the formulae
\[
r_{ij}=\frac{1}{r_{ii}}\biggl(a_{ij}-\sum_{k=\max(1,j-\beta)}^{i-1}r_{ki}r_{kj}
\biggr)\quad\text{for $\max(1,j-\beta)\le i\le j\le n$,}
\]
and
\[
r_{jj}=\sqrt{a_{jj}-\sum_{k=\max(1,j-\beta)}^{j-1}r_{kj}^2}
\quad\text{for $1\le j\le n$,}
\]
which yield Algorithm~\ref{alg: band Chol}.
\begin{algorithm}
G\caption{Compute the band Cholesky factorization \eqref{eq: Chol fact}.}
\label{alg: band Chol}
\begin{algorithmic}
\Require{$\boldsymbol{A}=[a_{ij}]$ is a real, $n\times n$, symmetric
positive-definite matrix with bandwidth~$\beta$.}
\State
\Function{Factorize}{$\boldsymbol{A}$}
\State Allocate storage for the $n\times n$ Cholesky
factor~$\boldsymbol{R}=[r_{ij}]$ and initialize to zero.
\For{$j=1:n$}
\For{$i=\max(1,j-\beta):j$}
\State $s=0$
\For{$k=\max(1,j-\beta):i-1$}
\State $s=s+r_{ki}r_{kj}$
\EndFor
\State $r_{ij}=(a_{ij}-s)/r_{ii}$
\EndFor
\State $s=0$
\For{$k=\max(1,j-\beta):j-1$}
\State $s=s+r_{kj}^2$
\EndFor
\If{$a_{jj}\le s$}
\State Error: $\boldsymbol{A}$ is not positive-definite.
\EndIf
\State $r_{jj}=\sqrt{a_{jj}-s}$
\EndFor
\State\Return{$\boldsymbol{R}$}
\EndFunction
\end{algorithmic}
\end{algorithm}
\begin{algorithm}
\caption{Solve the linear system $\boldsymbol{A}\boldsymbol{x}=\boldsymbol{b}$
given the band Cholesky factorization~\eqref{eq: Chol fact}.}
\label{alg: band Chol solve}
\begin{algorithmic}
\Require{$\boldsymbol{b}=[b_i]_{i=1}^n$ is the right-hand side vector.}
\Require{$\boldsymbol{R}=[r_{ij}]_{i,j=1}^n$ is the band Cholesky factor
of~$\boldsymbol{A}$, computed via Algorithm~\ref{alg: band Chol}.}
\State
\Function{Solve}{$\boldsymbol{b}, \boldsymbol{R}$}
\State Allocate storage for $\boldsymbol{x}=[x_i]_{i=1}^n$~and
$\boldsymbol{y}=[y_i]_{i=1}^n$.
\For{$i=1:n$}
\State $s=b_i$
\For{$k=\max(1,i-\beta):i-1$}
\State $s=s-r_{ji}y_j$
\EndFor
\State $y_i=s/r_{ii}$
\EndFor
\For{$i=n:-1:1$}
\State $s=y_i$
\For{$j=i+1:\min(n,i+\beta)$}
\State $s=s-r_{ij}x_j$
\EndFor
\State $x_i=s/r_{ii}$
\EndFor
\State\Return{$\boldsymbol{x}$}
\EndFunction
\end{algorithmic}
\end{algorithm}
Once the Cholesky factor~$\boldsymbol{R}$ is known, we can solve a linear
system~$\boldsymbol{A}\boldsymbol{x}=\boldsymbol{b}$ by first solving the lower
triangular system $\boldsymbol{R}^T\boldsymbol{y}=\boldsymbol{b}$, and then
solving the upper triangular
system~$\boldsymbol{R}\boldsymbol{x}=\boldsymbol{y}$, so that
\[
\boldsymbol{A}\boldsymbol{x}=\boldsymbol{R}^T\boldsymbol{R}\boldsymbol{x}
=\boldsymbol{R}^T\boldsymbol{y}=\boldsymbol{b}.
\]
Since $r_{ji}=0$ if $j>i$~or $i-j>s$,
\[
(\boldsymbol{R}^T\boldsymbol{y})_i=\sum_{j=1}^nr_{ji}y_j
=\sum_{j=\max(1,i-\beta)}^ir_{ji}y_j
=r_{ii}y_i+\sum_{j=\max(1,i-\beta)}^{i-1}r_{ji}y_j
\]
and so $\boldsymbol{R}^T\boldsymbol{y}=\boldsymbol{b}$ iff
\[
y_i=\frac{1}{r_{ii}}\biggl(b_i-\sum_{j=\max(1,i-\beta)}^{i-1}r_{ji}y_j\biggr)
\quad\text{for $1\le i\le n$.}
\]
Similarly, since $r_{ij}=0$ if $i>j$~or $j-i>\beta$,
\[
(\boldsymbol{R}\boldsymbol{x})_i=\sum_{j=1}^nr_{ij}x_j
=\sum_{j=i}^{\min(n,i+\beta)}r_{ij}x_j
=r_{ii}x_i+\sum_{j=i+1}^{\min(n,i+\beta)}r_{ij}x_j
\]
and so $\boldsymbol{R}\boldsymbol{x}=\boldsymbol{y}$ iff
\[
x_i=\frac{1}{r_{ii}}\biggl(y_i-\sum_{j=i+1}^{\min(n,i+\beta)}r_{ij}x_j\biggr)
\quad\text{for $1\le i\le n$.}
\]
These formula lead to Algorithm~\ref{alg: band Chol solve} for solving
$\boldsymbol{A}\boldsymbol{x}=\boldsymbol{b}$.
\begin{algorithm}
\newcommand{\rb}[1]{r^{\mathrm{band}}_{#1}}
\caption{Solve in place the linear system
$\boldsymbol{A}\boldsymbol{x}=\boldsymbol{b}$
given the band Cholesky factorization~\eqref{eq: Chol fact}.}
\label{alg: band Chol solve in place}
\begin{algorithmic}
\Require{$\boldsymbol{x}=[b_i]_{i=1}^n$ stores the right-hand side vector.}
\Require{The $(\beta+1)\times n$ array
$\boldsymbol{R}_{\mathrm{band}}=[\rb{ij}]$ stores
the band Cholesky factor~$\boldsymbol{R}=[r_{ij}]$ of~$\boldsymbol{A}$, as
computed via Algorithm~\ref{alg: band Chol} so that
$r_{ij}=\rb{\beta+1+i-j,j}$.}
\State
\Function{Solve}{$\boldsymbol{x},\boldsymbol{R}_{\mathrm{band}}$}
\For{$i=1:n$}
\State $s=x_i$
\For{$j=\max(1,i-\beta):i-1$}
\State $s=s-\rb{\beta+1+j-i,i}x_j$
\EndFor
\State $x_i=s/\rb{\beta+1,i}$
\EndFor
\For{$i=n:-1:1$}
\State $s=x_i$
\For{$j=i+1:\min(n,i+\beta)$}
\State $s=s-\rb{\beta+1+i-j,j}x_j$
\EndFor
\State $x_i=s/\rb{\beta+1,i}$
\EndFor
\State\Return{$\boldsymbol{x}$}
\EndFunction
\end{algorithmic}
\end{algorithm}
When $\beta$ is small compared to~$n$, storing $\boldsymbol{A}$ as an
$n\times n$~array wastes a lot of space. A more efficient method is to use
the \emph{symmetric band storage scheme} that uses a
$(\beta+1)\times n$~matrix
$\boldsymbol{A}_{\textrm{band}}=[a^{\mathrm{band}}_{ij}]$ to hold the non-zero
superdiagonals of~$\boldsymbol{A}$ by putting
\begin{equation}\label{eq: symm band storage}
a^{\mathrm{band}}_{\beta+1+i-j,j}=a_{ij}
\quad\text{for $\max(1,j-\beta)\le i\le j$ and $1\le j\le n$.}
\end{equation}
For example, if $n=9$ and $\beta=3$, then
\[
\boldsymbol{A}_{\mathrm{b}}=\begin{bmatrix}
*& *& *&a_{14}&a_{25}&a_{36}&a_{47}&a_{58}&a_{69}\\
*& *&a_{13}&a_{24}&a_{35}&a_{46}&a_{57}&a_{68}&a_{79}\\
*&a_{12}&a_{23}&a_{34}&a_{45}&a_{56}&a_{67}&a_{78}&a_{89}\\
a_{11}&a_{22}&a_{33}&a_{44}&a_{55}&a_{66}&a_{77}&a_{88}&a_{99}
\end{bmatrix}.
\]
Computing the band Cholesky factor~$\boldsymbol{R}$ using
Algorithm~\ref{alg: band Chol}, the number of multiplications is
\begin{multline*}
\sum_{j=1}^n\biggl([j-\max(1,j-\beta)]
+\sum_{i=\max(1,j-\beta)}^j[i-\max(1,j-\beta)]\biggr)\\
=\sum_{j=1}^n\biggl([j-\max(1,j-\beta)]
+\sum_{i=0}^{j-\max(1,j-\beta)}i\biggr)
\le\sum_{j=1}^n\biggl(\beta+\sum_{i=1}^\beta i\biggr)
=n\bigl[\beta+\tfrac12\beta(\beta+1)\bigr].
\end{multline*}
Assuming that the bandwidth~$\beta$ is small compared to~$n$, we can see that
the multiplication counts is essentially $\tfrac12n\beta^2$, as is the number
of addition/subtractions. There are also $n$ square roots and
\[
\sum_{j=1}^n\bigl[j-\max(1,j-\beta)+1]\le\sum_{j=1}^n(\beta+1)=n(\beta+1)
\]
divisions.
\section{Maximum principle}
\newcommand{\bx}{\boldsymbol{x}}
\newcommand{\by}{\boldsymbol{y}}
We wish to show that the boundary-value problem~\eqref{eq: Poisson bvp} is
well-posed, generalising the 1D results of \cref{thm: Lu=f apriori infty}.
Consider the general, second-order, linear partial differential operator,
\begin{equation}\label{eq: general L Rn}
(\mathcal{L}u)(\bx)
=-\sum_{j,k=1}^na_{jk}(\bx)(\partial_j\partial_ku)(\bx)
+\sum_{j=1}^nb_j(\bx)(\partial_ju)(x)+c(\bx)u(\bx)
\quad\text{for $\bx\in\Omega$,}
\end{equation}
where $\partial_j=\partial/\partial x_j$ and where $\Omega$ is a bounded,
open, connected subset of~$\mathbb{R}^n$. Since
$\partial_k\partial_ju=\partial_k\partial_ju$ if $u$ is $C^2$, we assume
without loss of generality that the coefficient matrix is symmetric, that is,
\[
a_{jk}(\bx)=a_{kj}(\bx)\quad\text{for $\bx\in\Omega$.}
\]
In addition, we assume that all coefficients of~$\mathcal{L}$ are bounded
and continuous on~$\Omega$.
\begin{definition}
The partial differential operator~\eqref{eq: general L Rn} is
\emph{uniformly elliptic} in~$\Omega$ if there exist strictly positive
constants $\lambda_{\min}$~and $\lambda_{\max}$ such that
\[
\lambda_{\min}|\boldsymbol{\xi}|^2\le\sum_{j,k=1}^na_{jk}(\bx)\xi_j\xi_k
\le\lambda_{\max}|\boldsymbol{\xi}|^2
\quad\text{for $\bx\in\Omega$ and $\boldsymbol{\xi}\in\mathbb{R}^n$.}
\]
\end{definition}
Equivalently, $\mathcal{L}$ is uniformly elliptic if the spectrum of the
symmetric matrix~$[a_{ij}(\bx)]$ lies in the
interval~$[\lambda_{\min},\lambda_{\max}]$
for all $\bx\in\Omega$.
The next two results generalise \cref{lem: Lu<0}~and
\cref{thm: max principle 1d}. The proof of the lemma uses the notation
\[
B(\bx_0,\delta)=\{\,\bx\in\mathbb{R}^n:|\bx-\bx_0|<\delta\,\}
\]
for the open ball with centre~$\bx_0$ and radius~$\delta>0$.
\begin{lemma}\label{lem: Lu<0 Omega}
Assume that $\mathcal{L}$ is uniformly elliptic and that $u$ is $C^2$
on~$\Omega$. If $c\ge0$ and $\mathcal{L}u<0$ on~$\Omega$, then $u$ cannot
attain a non-negative local maximum in~$\Omega$.
\end{lemma}
\begin{proof}
Suppose for a contradiction that there exist $\bx_0\in\Omega$ and $\delta>0$
such that
\[
u(\bx_0)\ge0\quad\text{and}\quad
\text{$u(\bx)\le u(\bx_0)$ for $\bx\in B(\bx_0,\delta)\subseteq\Omega$.}
\]
Since $u$ has an interior local maximum at~$\bx_0$, it follows that
$\partial_ju(\bx_0)=0$ and so
\begin{equation}\label{eq: Lu x0}
(\mathcal{L}u)(\bx_0)
=-\sum_{j,k=1}^na_{jk}(\bx_0)(\partial_j\partial_ku)(\bx_0)
+c(\bx_0)u(\bx_0).
\end{equation}
Moreover, there is an orthogonal matrix~$\boldsymbol{Q}$ and a diagonal
matrix~$\boldsymbol{\Lambda}=[\lambda_j\delta_{jk}]$ such that
\[
\text{$\lambda_{\min}\le\lambda_j\le\lambda_{\max}$ for $1\le j\le n$}
\qquad\text{and}\qquad
\boldsymbol{Q}^T[a_{jk}(\bx_0)]\boldsymbol{Q}=\boldsymbol{\Lambda}.
\]
Let
\[
\bar u(\by)=u(\bx)\quad
\text{for $\by=\bx_0+Q^T(\bx-\bx_0)$ and $\bx\in B(\bx_0,\delta)$,}
\]
noting that $\by\in B(\bx_0,\delta)$ iff $\bx\in B(\bx_0,\delta)$ because
$|\bx-\bx_0|=|\by-\bx_0|$. Since $\partial y_l/\partial x_j=q_{jl}$, the
chain rule gives
\[
\partial_ju(\bx)=\sum_{l=1}^n q_{jl}\partial_l\bar u(\by),
\]
and therefore
\begin{align*}
\sum_{j,k=1}^n a_{jk}(\bx_0)(\partial_j\partial_k u)(\bx_0)
&=\sum_{j,k=1}^n\sum_{l=1}^nq_{jl}\sum_{m=1}^nq_{km}
\partial_l\partial_m\bar u(\bx_0)\\
&=\sum_{j,k=1}^n\biggl(\sum_{l,k=1}^n q_{jl}a_{jk}(\bx_0)q_{km}
\biggr)\partial_l\partial_m\bar u(\bx_0)\\
&=\sum_{j,k=1}^n\lambda_l\delta_{lm}
\partial_l\partial_m\bar u(\bx_0)\\
&=\sum_{j,k=1}^n\lambda_j\delta_{jk}
\partial_l\partial_m\bar u(\bx_0)
=\sum_{j=1}^n\lambda_j\partial_j^2\bar u(\bx_0).
\end{align*}
The function~$\bar u$ has a local maximum at~$\bar x_0$ so
$\partial_j^2\bar u(\bx_0)\le0$ for all~$j$. But then we see
from~\eqref{eq: Lu x0} that $(\mathcal{L}u)(\bx_0)<0$, a contradiction.
\end{proof}
\begin{theorem}\label{thm: max principle}
Assume that $\mathcal{L}$ is uniformly elliptic and that $u$ is $C^2$
on~$\Omega$. If $c\ge0$ and $\mathcal{L}u\le0$ on~$\Omega$, then
\[
\max_{\bx\in\overline{\Omega}}u(\bx)\le\max_{\bx\in\partial\Omega}u^+(\bx).
\]
\end{theorem}
\begin{proof}
Let $\epsilon>0$ and $\mu>0$, and put $w(\bx)=u(\bx)+\epsilon e^{\mu x_1}$.
Since
\begin{align*}
(\mathcal{L}w)(\bx)&=(\mathcal{L}u)(\bx)+\epsilon\bigl[-a_{11}(\bx)\mu^2
+b_1(\bx)\mu+c(\bx)\bigr]e^{\mu x_1}\\
&\le-\epsilon\bigl[\lambda_{\min}\mu^2
-\mu\|b\|_\infty-\|c\|_\infty\bigr]e^{\mu x_1}
\end{align*}
by choosing $\mu$ sufficiently large we can ensure that $\mathcal{L}w<0$
on~$\Omega$. By \cref{lem:}, the function~$w$ cannot attain a non-negative
local maximum in~$\Omega$, implying that
\[
u(\bx)\le w(\bx)\le w^+(\bx)\le\max_{by\in\partial\Omega}w^+(\by)
\le\max_{\by\in\partial\Omega}[u^+(y)+\epsilon e^{\mu L}]
\]
for $\bx\in\Omega$, where $L=\max_{\bx\in\Omega} x_1$. Since this inequality
holds for any $\epsilon>0$, the result follows.
\end{proof}
\begin{theorem}\label{thm: max min elliptic}
Assume the $\mathcal{L}$ is uniformly elliptic, and that $u$ is continuous
on~$\overline{\Omega}$ and $C^2$ on~$\Omega$. If $c\ge0$~and
$\mathcal{L}u=f$ on~$\Omega$, then
\[
\max_{\overline{\Omega}}u\le\bigl(\max_{\partial\Omega}u^+\bigr)
+C\max_{\overline{\Omega}}f^+
\]
and
\[
\min_{\overline{\Omega}}u\le\bigl(\min_{\partial\Omega}u^-\bigr)
+C\min_{\overline{\Omega}}f^-,
\]
where $C=\cosh(\tfrac12\mu\operatorname{diam}\Omega)$~and
$\mu=\max(1, (1+\|b_1\|_\infty)/\lambda_{\min}$.
\end{theorem}
\begin{proof}
Without loss of generality, we may assume that
$\Omega\subseteq B(\boldsymbol{0},r)$ for $r=\tfrac12\operatorname\Omega$.
Let
\[
w(x)=\bigl(\max_{\partial\Omega}u^+\bigr)+v(x)\max_{\overline{\Omega}}f^+
\quad\text{where}\quad
v(x)=\cos(\mu r)-\cosh(\mu x_1),
\]
and observe that $v\ge0$ on~$\overline{\Omega}$ with
\begin{align*}
(\mathcal{L}v)(x)&=a_{11}(\bx)\mu^2\cosh(\mu x_1)-b_1(\bx)\mu\sinh(\mu x_1)
+c(\bx)\bigl(v(x)+\max_{\partial\Omega}u^+\bigr)\\
&\ge\bigl(\lambda_{\min}\mu^2-\|b_1\|_\infty\mu\bigr)\cosh(\mu x_1)
\ge(\lambda_{\min}\mu-\|b_1\|_\infty)\mu\ge1
\end{align*}
for $\bx\in\Omega$, so
\[
\mathcal{L}(u-w)=f-c(x)\max_{\partial\Omega}u^+
-(\mathcal{L}v)\max_{\overline{\Omega}}f^+\le0
\quad\text{on $\Omega$.}
\]
By \cref{thm: max principle},
\[
u(\bx)-w(\bx)\le\max_{\partial\Omega}(u-w)^+\quad\text{for $\bx\in\Omega$,}
\]
and we see that
\[
u(\bx)-w(\bx)=\bigl(u(\bx)-\max_{\partial\Omega}u^+\bigr)
-v(x)\max_{\overline{\Omega}}f^+\le0
\quad\text{for $\bx\in\partial\Omega$.}
\]
Thus, $u-w\le0$ on~$\Omega$, and therefore
\[
\max_{\overline{\Omega}}u\le\max_{\overline{\Omega}}w
\le\bigl(\max_{\partial\Omega}u^+\bigr)
+\cosh(\mu r)\max_{\overline{\Omega}}f^+,
\]
proving the first inequality. The second follows because
$\mathcal{L}(-u)=-f$, $(-u)^+=-(u^-)$ and $(-f)^+=-(f^-)$.
\end{proof}
Now consider the elliptic boundary-value problem
\begin{equation}\label{eq: Dirichlet problem L}
\mathcal{L}u=f\quad\text{in $\Omega$,}
\quad\text{with $u=g$ on $\partial\Omega$.}
\end{equation}
As an immediate consequence of \cref{thm: max min elliptic}, we obtain
the desired \emph{a priori} estimate for~$u$ in terms of the data $f$~and $g$.
\begin{theorem}\label{thm: a priori elliptic}
Assume the $\mathcal{L}$ is uniformly elliptic and that $c\ge0$ on~$\Omega$.
Then any solution $u\in C^2(\Omega)\cap C(\overline{\Omega})$
of~\eqref{eq: Dirichlet problem L} satisfies
\[
\max_{\overline{\Omega}}|u|\le\max_{\partial\Omega}|g|
+C\max_{\overline{\Omega}}|f|.
\]
\end{theorem}
\section{Discrete maximum principle}
We now restrict our attention to a rectangular
domain~$\Omega=(0,L_x)\times(0,L_y)$ in~$\mathbb{R}^2$, and assume that the
coefficients of $\mathcal{L}$ satisfy
\[
a_{jk}(x,y)=a_j(x,y)\delta_{jk}\quad\text{and}\quad
b_j(x,y)=0\quad\text{for $j$, $k\in\{1,2\}$.}
\]
Thus,
\begin{equation}\label{eq: L simple}
(\mathcal{L}u)(x,y)=-a_1(x,y)(\partial_1^2u)(x,y)
-a_2(x,y)(\partial_2^2u)(x,y)+c(x,y)u(x,y),
\end{equation}
and we define the corresponding finite difference operator
\begin{multline*}
(\mathcal{L}_{\Delta x,\Delta y}U)_{pq}=-a_1(x_p,y_q)\,
\frac{U_{p+1,q}-2U_{pq}+U_{p-1,q}}{\Delta x^2}\\
-a_2(x_p,y_q)\,
\frac{U_{p,q+1}-2U_{pq}+U_{p,q-1}}{\Delta y^2}
+c(x_p,y_q)U_{pq}.
\end{multline*}
The finite difference approximation to the boundary-value
problem~\eqref{eq: Dirichlet problem L} can then be written as
\begin{equation}\label{eq: discrete bvp 2d}
\begin{aligned}
(\mathcal{L}_{\Delta x,\Delta y}U)_{pq}&=f_{pq}&&
\text{for $(x_p,y_q)\in\Omega$,}\\
U_{pq}&=g_{pq}&&\text{for $(x_p,y_q)\in\Gamma$,}
\end{aligned}
\end{equation}
which, in the special case $a_1(x,y)=1$, $a_2(x,y)=1$, $c(x,y)=0$
reduces to the five-point scheme \eqref{eq: 5-pt Poisson} for the Poisson
The simplified operator~\eqref{eq: L simple} is uniformly elliptic iff
there are positive constants $\lambda_{\min}$ and $\lambda_{\max}$ such that
\[
\lambda_{\min}\le a_1(x,y)\le\lambda_{\max}\quad\text{for $(x,y)\in\Omega$,}
\]
and we will assume throughout that this is the case. Given a grid
point~$(x_{p^*},y_{q^*})\in\Omega$, let
\[
\operatorname{Nbr}(p^*,q^*)=\{(p+1,q),(p-1,q),(p,q+1),(p,q-1)\}.
\]
so that $(p,q)\in\operatorname{Nbr}(p^*,q^*)$ if and only if $(x_p,y_q)$ is
one of the four nearest neighbours to~$(x_{p^*},y_{q^*})$. The following
discrete analogue of \cref{lem: Lu<0 Omega}.
\begin{lemma}\label{lem: Lu<0 Omega discrete}
If $c_{p,q}\ge0$ and $(\mathcal{L}_{\Delta x,\Delta y}U)_{p,q}<0$ for
$(x_p,y_q)\in\Omega$, then there is no grid point~$(x_{p^*},y_{q^*})\in\Omega$
such that
\[
U_{p^*,q^*}\ge0\quad\text{and}\quad\text{$U_{p,q}\le U_{p^*,q^*}$
for $(p,q)\in\operatorname{Nbr}(p^*,q^*)$.}
\]
\end{lemma}
\begin{proof}
If such a grid point exists, then
\[
U_{p^*+1,q^*}+U_{p^*-1,q^*}\le 2U_{p^*,q^*}
\quad\text{and}\quad
U_{p^*,q^*+1}+U_{p^*,q^*-1}\le 2U_{p^*,q^*},
\]
so $(\mathcal{L}_{\Delta x,\Delta y}U)_{p^*,q^*}\ge0$, contradicting the
second hypothesis of the lemma.
\end{proof}
A discrete analogue of \cref{thm: max principle} then follows; we use the
abbreviation
\[
\max_{S}U^+=\max_{(x_p,y_q)\in S}U_{p,q}
\quad\text{for $S\subseteq\overline{\Omega}.$}
\]
\begin{theorem}
If $c_{p,q}\ge0$ and $(\mathcal{L}_{\Delta x,\Delta y}U)_{p,q}\le0$
for $(x_p,y_q)\in\Omega$, then
\[
\max_\Omega U\le\max_{\partial\Omega}U^+ \quad\text{for $(x_p,y_q)\in\Omega$.}
\]
\end{theorem}
\begin{proof}
Let $\epsilon>0$ and $\mu>0$, and put
\[
W_{p,q}=U_{p,q}+\epsilon g(x_p)\quad\text{where $g(x)=e^{\mu x}$.}
\]
Since $g^{(4)}(x)=\mu^4e^{\mu x}\ge0$ for all~$x$, if follows by considering
the remainder term for the Taylor expansion of~$g$ about~$x_p$ that
\[
\frac{g(x_{p+1}-2g(x_p)+g(x_{p-1}}{\Delta x^2}\ge g''(x_p)=\mu^2 e^{\mu x_p}.
\]
Hence, writing $a_{1,p,q}=a_1(x_p,y_q)$ and $c_{p,q}=c(x_p,y_q)$,
\begin{align*}
(\mathcal{L}_{\Delta x,\Delta y}W)_{p,q}
&=(\mathcal{L}_{\Delta x,\Delta y}U)_{p,q}+\epsilon\biggl(-a_{1,p,q}
\frac{g(x_{p+1}-2g(x_p)+g(x_{p-1}}{\Delta x^2}+c_{p,q}g(x_p)\biggr)\\
&\le(\mathcal{L}_{\Delta x,\Delta y}U)_{p,q}+\epsilon\bigl(-a_{1,p,q}
e^{\mu x_p}+c_{p,q}e^{\mu x_p}\bigr)\\
&\le0-\epsilon\bigl(\lambda_{\min}\mu^2-\|c\|_\infty\bigr)e^{\mu x_p},
\end{align*}
and by choosing $\mu^2>\|c\|_\infty/\lambda_{\min}$ we can ensure that
$(\mathcal{L}_{\Delta x,\Delta y}W)_{p,q}<0$ for $(x_p,y_q)\in\Omega$.
Applying \cref{lem: Lu<0 Omega discrete}, we conclude that
\[
\max_\Omega U\le\max_\Omega W\le\max_{\partial\Omega}W
\le\bigl(\max_{\partial\Omega}U\bigr)+\epsilon e^{\mu L_x}.
\]
Since this inequality holds for any $\epsilon>0$, the result follows.
\end{proof}
Next is a discrete version of \cref{thm: max min elliptic}.
\begin{theorem}\label{thm: discrete max principle elliptic}
If $c_{p,q}\ge0$ and $(\mathcal{L}_{\Delta x,\Delta y}U)_{p,q}=f_{p,q}$
for $(x_p,y_q)\in\Omega$, then
\[
\max_\Omega U\le\max_{\partial\Omega}U^++C\max_{(x_p,y_q)\in\Omega} f^+_{p,q}.
\]
and
\[
\min_\Omega U\le\min_{\partial\Omega}U^-+C\max_{(x_p,y_q)\in\Omega}f^-_{p,q},
\]
where $C=L^2/(8\lambda_{\min})$.
\end{theorem}
\begin{proof}
Let
\[
W_{p,q}=\bigl(\max_{\partial\Omega}U^+\bigr)
+v(x_p)\max_\Omega f^+_{\cdot,\cdot}
\quad\text{where $v(x)=\frac{x(L_x-x)}{2\lambda_{\min}}$.}
\]
Since the second-order central difference quotient equals the exact second
derivative for a quadratic polynomial,
\[
\frac{v(x_{p+1})-2v(x_p)+v(x_{p-1})}{\Delta x^2}=v''(x_p)
=\frac{-1}{\lambda_{\min}}
\]
and thus, noting that $v(x)\ge0$ for~$0\le x\le L_x$, we conclude that
\[
(\mathcal{L}_{\Delta x,\Delta y}v)_{p,q}=\frac{a_{1,p,q}}{\lambda_{\min}}
+c_{p,q}v_{p,q}\ge1\quad\text{for $(x_p,y_q)\in\Omega$.}
\]
It follows that
\[
(\mathcal{L}_{\Delta x,\Delta y}W)_{p,q}
=c_{p,q}\bigl(\max_{\partial\Omega}U^+\bigr)
+(\mathcal{L}_{\Delta x,\Delta y}V)_{p,q}
\bigl(\max_\Omega f^+_{\cdot,\cdot}\bigr)
\ge\bigl(\max_\Omega f^+_{\cdot,\cdot}\bigr)
\]
and so
\[
\bigl(\mathcal{L}_{\Delta x,\Delta y}(U-W)\bigr)_{p,q}
=f_{p,q}-(\mathcal{L}_{\Delta x,\Delta y}W)_{p,q}
\le f_{p,q}-\max_{\Omega}f^+_{\cdot,\cdot}\le0
\quad\text{for $(x_p,y_q)\in\Omega$,}
\]
with
\[
(U-W)_{p,q}=U_{p,q}-\bigl(\max_{\partial\Omega}U^+\bigr)
-V_p\max f^+_{\cdot,\cdot}\le0
\quad\text{for $(x_p,y_q)\in\partial\Omega$.}
\]
By \cref{thm: discrete max principle elliptic},
\[
\max_\Omega(U-W)\le\max_{\partial\Omega}(U-W)\le0,
\]
and the first inequality follows because $\max_{0\le x\le L_x}v(x)=C$ and so
\[
\max_\Omega U\le\max_\Omega W\le\bigl(\max_{\partial\Omega}U^+\bigr)
+C\max_\Omega f^+_{\cdot,\cdot}.
\]
The second follows because
$\bigl(\mathcal{L}_{\Delta x,\Delta y}(-U)\bigr)_{p,q}=-f_p$,
$(-U)^+_{p,q}=-(U^+_{p,q})$ and $(-f)^+_{p,q}=-(f^+_{p,q})$.
\end{proof}
Our final result for this section is a discrete version of
\cref{thm: a priori elliptic}.
\begin{theorem}\label{thm: discrete apriori elliptic}
If $c\ge0$ on $\Omega$, then the discrete boundary-value
problem~\eqref{eq: discrete bvp 2d} has a unique solutions~$U_{p,q}$, and
\[
\max_{\overline{\Omega}}|U|\le\max_{\partial\Omega}|g_{\cdot,\cdot}|
+C\max_\Omega|f_{\cdot,\cdot}|.
\]
\end{theorem}
\begin{proof}
The \emph{a priori} estimate follows at once from
\cref{thm: discrete max principle elliptic}, and shows that if $f_{p,q}=0$
for all $(x_p,y_q)\in\Omega$~and if $g_{p,q}=0$ for all
$(x_p,y_q)\in\partial\Omega$, then the problem has only the trivial solution
$U_{p,q}=0$ for all $(x_p,y_q)\in\overline{\Omega}$. Hence, the coefficient
matrix for the associated linear system is non-singular, implying the
existence and uniqueness of~$U_{p,q}$.
\end{proof}
\section{An error bound}
We will say that the finite difference scheme used in~\eqref{eq: }
is \emph{stable} if there is a constant~$C$ --- independent of $f$, $g$,
$\Delta x$~and $\Delta y$ --- such that
\begin{equation}\label{eq: stability elliptic Omega}
\max_{\overline{\Omega}}|U|\le C\Bigl(\max_{\partial\Omega}|g_{\cdot,\cdot}|.
\end{equation}
For example, by \cref{thm: discrete apriori elliptic}, sufficient conditions
for stability are that the simplified partial differential
operator~\eqref{eq: L simple} is uniformly elliptic with~$c\ge0$.
We define the local truncation error in the usual way, as
\[
\tau_{p,q}=f_{p,q}-(\mathcal{L}_{\Delta x,\Delta y}u)_{p,q}
=(\mathcal{L}u)_{p,q}-(\mathcal{L}_{\Delta x,\Delta y}u)_{p,q},
\]
and note that
\begin{equation}\label{eq: tau pq bound}
\begin{aligned}
\tau_{p,q}&=-a_{1,p,q}\biggl(u_{xx}(x_p,y_q)
-\frac{u(x_{p+1},y_q)-2u(x_p,y_q)+u(x_{p-1},y_q)}{\Delta x^2}\biggr)\\
&\qquad{}-a_{2,p,q}\biggl(u_{yy}(x_p,y_q)
-\frac{u(x_p,y_{q+1})-2u(x_p,y_q)+u(x,y_{q-1})}{\Delta y^2}\biggr),
\end{aligned}
\end{equation}
so, by \cref{thm: 2nd central diff},
\begin{equation}\label{eq: tau pq bound}
|\tau_{p,q}|\le\biggl(
\frac{|a_{1,p,q}|}{12}\|\partial_1^4u\|_\infty\,\Delta x^2
+\frac{|a_{2,p,q}|}{12}\|\partial_2^4u\|_\infty\,\Delta y^2\biggr)
\end{equation}
The \emph{solution error},
\[
E_{p,q}=U_{p,q}-u(x_p,y_q),
\]
satisfies
\[
(\mathcal{L}_{\Delta x,\Delta y}E)_{p,q}
=(\mathcal{L}_{\Delta x,\Delta y}U)_{p,q}
-(\mathcal{L}_{\Delta x,\Delta y}u)_{p,q}
=f_{p,q}-(\mathcal{L}_{\Delta x,\Delta y}u)_{p,q}=\tau_{p,q},
\]
for $(x_p,y_q)\in\Omega$, with $E_{p,q}=g_{p,q}-g_{p,q}=0$
for $(x_p,y_q)\in\partial\Omega$. Replacing $U$, $f$ and $g$
in~\eqref{eq: stability elliptic Omega} by $E$, $\tau$ and $0$, respectively,
we have
\[
\max_{\overline{\Omega}}|U|\le C\max_\Omega|\tau_{\cdot,\cdot}|.
\]
Combining this estimate with~\eqref{eq: tau pq bound}, we obtain the error
bound
\[
|U_{p,q}-u(x_p,y_q)|\le C\biggl(
\frac{\|a_1\|_\infty}{12}\|\partial_1^4u\|_\infty\,\Delta x^2
+\frac{\|a_2\|_\infty}{12}\|\partial_2^4u\|_\infty\,\Delta y^2\biggr)
\]
for $(x_p,y_q)\in\overline{\Omega}$. In other words,
\[
U_{p,q}=u(x_p,y_q)+O(\Delta x^2+\Delta y^2),
\]
showing that the finite difference scheme is indeed second-order
accurate.
\section{Parabolic problems in 2D}
Consider the following 2D initial-boundary value problem,
\begin{equation}\label{eq: ibvp 2d}
\begin{aligned}
u_t-a\nabla^2u&=f(x,y,t)&&\text{for $(x,y)\in\Omega$ and $0<t<T$,}\\
u&=g(x,y,t)&&\text{for $(x,y)\in\partial\Omega$ and $0<t<T$,}\\
u&=u_0(x,y)&&\text{for $(x,y)\in\Omega$ when $t=0$,}
\end{aligned}
\end{equation}
where, for simplicity, we assume that the coefficient~$a$ is a positive
constant. For the rectangular domain~\eqref{eq: Omega rectangle} and the
grid \eqref{eq: xp yq grid}, we can define the semidiscrete finite difference
solution~$U_{pq}(t)\approx u(x_p,y_q,t)$ by
\[
\frac{dU_{p,q}}{dt}-a\biggl(\frac{U_{p+1,q}-2U_{p,q}+U_{p-1,q}}{\Delta x^2}
+\frac{U_{p,q+1}-2U_{p,q}+U_{p,q-1}}{\Delta y^2}\biggr)=f_{p,q}(t)
\]
for $1\le p\le P-1$ and $1\le q\le Q-1$, together with the discrete
boundary conditions
\[
U_{p,q}(t)=g(x_p,y_q,t)\quad
\text{for $(x_p,y_q)\in\partial\Omega$ and $1\le t\le T$,}
\]
and initial condition
\[
U_{p,q}(0)=u_0(x_p,y_q)\quad\text{for $1\le p\le P-1$ and $1\le q\le Q-1$.}
\]
Since
\[
-a\bigl(\delta_x^2U_{p,q}+\delta_y^2U_{p,q}\bigr)=f_{p,q}-\frac{dU_{p,q}}{dt},
\]
we see that
\[
\boldsymbol{A}\boldsymbol{U}=\boldsymbol{f}(t)+\boldsymbol{g(t)}
-\frac{d\boldsymbol{U}}{dt}
\]
where $\boldsymbol{A}$ is the same matrix as in \cref{thm: Poisson matrix},
and the vectors $\boldsymbol{f}(t)$~and $\boldsymbol{g}(t)$ are time-dependent
vectors constructed from grid values of the functions $f$~and $g$, as in
\cref{example: 5-pt matrix}. Thus, in matrix form the semidiscrete method is
\[
\frac{d\boldsymbol{U}}{dt}+\boldsymbol{A}\boldsymbol{U}
=\boldsymbol{f}(t)+\boldsymbol{g(t)}
\quad\text{for $0\le t\le T$, with $\boldsymbol{U}(0)=\boldsymbol{U}_0$.}
\]
Here, the column vector~$\boldsymbol{U}_0=[(U_0)_j]_{j=1}^M$ is defined
by putting $(U_0)_j=u_0(x_p,y_q)$ for~$j$ as in~\eqref{eq: column-major}.
By introducing the time levels~\eqref{eq: uniform tn}, we can consider a
fully-discrete approximation
\[
U^n_{p,q}\approx U_{p,q}(t_n)\approx u(x_p,y_q,t_n).
\]
The forward Euler method for the 2D problem~\eqref{eq: ibvp 2d} is
\[
\frac{U^{n+1}_{p,q}-U^n_{p,q}}{\Delta t}
-a\biggl(\frac{U_{p+1,q}^n-2U_{p,q}^n+U_{p-1,q}^n}{\Delta x^2}
+\frac{U_{p,q+1}^n-2U_{p,q}^n+U_{p,q-1}^n}{\Delta y^2}\biggr)=f_{p,q}^n,
\]
for $0\le n\le N-1$, $1\le p\le P-1$ and $1\le q\le Q-1$, with the
fully-discrete boundary and initial conditions
\begin{equation}\label{eq: fully discrete bc ic 2d}
\begin{aligned}
U^n_{p,q}&=g^n_{p,q}&
&\text{for $0\le n\le N-1$ and $(x_p,y_q)\in\partial\Omega$,}\\
U^0_{p,q}&=(U_0)_{p,q}&
&\text{for $(x_p,y_q)\in\Omega$.}
\end{aligned}
\end{equation}
Let
\[
\rho_x=\frac{a\,\Delta t}{\Delta x^2}\quad\text{and}\quad
\rho_y=\frac{a\,\Delta t}{\Delta y^2},
\]
so that
\[
U^{n+1}_{p,q}-U^n_{p,q}-\rho_x\bigl(U^n_{p+1,q}-2U^n_{p,q}+U^n_{p-1,q}\bigr)
-\rho_y\bigl(U^n_{p,q+1}-2U^n_{p,q}+U^n_{p,q-1}\bigr)
=f^n_{p,q}
\]
and hence
\[
U^{n+1}_{p,q}=f^n_{p,q}+\rho_xU^n_{p-1,q}+\rho_yU^n_{p,q-1}
+(1-2\rho_x-2\rho_y)U^n_{p,q}+\rho_yU^n_{p,q+1}+\rho_xU^n_{p+1,q}.
\]
The proof of \cref{thm: explicit Euler stability} generalises to
show that the scheme is stable if $1-2\rho_x-2\rho_y\ge0$, or equivalently if
\[
\Delta t\le\frac{\Delta x^2\,\Delta y^2}{2a(\Delta x^2+\Delta y^2)}
=\frac{\Delta x\,\Delta y}{2a(\theta+\theta^{-1})},
\quad\text{where $\theta=\frac{\Delta x}{\Delta y}$.}
\]
The backward Euler method for the 2D problem~\eqref{eq: ibvp 2d} is
\[
\frac{U^n_{p,q}-U^{n-1}_{p,q}}{\Delta t}
-a\biggl(\frac{U_{p+1,q}^n-2U_{p,q}^n+U_{p-1,q}^n}{\Delta x^2}
+\frac{U_{p,q+1}^n-2U_{p,q}^n+U_{p,q-1}^n}{\Delta y^2}\biggr)=f_{p,q}^n,
\]
for $1\le n\le N$, $1\le p\le P-1$ and $1\le q\le P-1$, with the boundary
and initial conditions again given by~\eqref{eq: fully discrete bc ic 2d}.
Rearranging the finite difference equation gives
\[
-\rho_yU^n_{p,q-1}-\rho_xU^n_{p-1,q}+(1+2\rho_x+2\rho_y)U^n_{p,q}
-\rho_xU^n_{p+1,q}-\rho_yU^n_{p,q+1}=U^{n-1}_{p,q}+f^n_{p,q}\,\Delta t.
\]
In matrix notation, the backward Euler method looks the same as in 1D,
\[
\frac{\boldsymbol{U}^n-\boldsymbol{U}^{n-1}}{\Delta t}
+\boldsymbol{A}\boldsymbol{U}^n=\boldsymbol{f}^n+\boldsymbol{g}^n,
\]
and at the $n$th time step we must again solve the linear system
\[
(\boldsymbol{I}+\Delta t\,\boldsymbol{A})\boldsymbol{U}^n
=\boldsymbol{U}^{n-1}+\Delta t(\boldsymbol{f}^n+\boldsymbol{g}^n).
\]
However, $\boldsymbol{A}$ is now given by \cref{thm: Poisson matrix} and the
meanings of the vectors $\boldsymbol{U}^n$,
$\boldsymbol{f}^n=\boldsymbol{f}(t_n)$ and
$\boldsymbol{g}^n=\boldsymbol{g}(t_n)$ are also different from in
\eqref{eq: implicit Euler 1d vector}. The coefficient matrix is again
symmetric and positive-definite, with the same sparsity pattern
as~$\boldsymbol{A}$, so we can use a band Cholesky factorization,
\begin{equation}\label{eq: backward Euler 2d Cholesky}
\boldsymbol{I}+\Delta t\,\boldsymbol{A}=\boldsymbol{R}^T\boldsymbol{R},
\end{equation}
to compute $\boldsymbol{U}^n$ at the $n$th~time step.
\begin{Exercises}
\exercise
Find $A\otimes B$~and $B\otimes A$ in each case.
\begin{description}
\item{(i)}
\[
A=\begin{bmatrix}2&0\\ 1&-7\\ 4&6 \end{bmatrix},\qquad
B=\begin{bmatrix}1&-1\\ 2&0 \end{bmatrix}.
\]
\item{(ii)}
\[
A=\begin{bmatrix}2&5\\ 0&-1\end{bmatrix},\qquad
B=\begin{bmatrix}1\\ 8\\ -9 \end{bmatrix}.
\]
\item{(iii)}
\[
A=\begin{bmatrix}3&-2&0 \end{bmatrix},\qquad
B=\begin{bmatrix}1&-4\\ 3&2 \end{bmatrix}.
\]
\end{description}
\begin{ans}
(ii)
\[
A\otimes B=\begin{bmatrix}2B&5B\\0&-B\end{bmatrix}
=\left[\begin{array}{c|c}
2&5\\ 15&40\\ -18&-45\\
\hline
0&-1\\ 0&-8\\ 0&9
\end{array}\right].
\]
\[
B\otimes A=\begin{bmatrix}A\\ 8A\\ -9A \end{bmatrix}
=\left[\begin{array}{cc}
2&5\\ 0&-1\\
\hline
16&40\\ 0&-8\\
\hline
-18&-45\\ 0&-9
\end{array}\right].
\]
\end{ans}
\exercise
Prove the following properties of the Kronecker product.
\begin{description}
\item{(i)} $A\otimes(B+C)=A\otimes B+A\otimes C$.
\item{(ii)} $(A+B)\otimes C=A\otimes C+B\otimes C$.
\item{(iii)} $A\otimes(B\otimes C)=(A\otimes B)\otimes C$.
\item{(iv)} $(A\otimes B)^\top=A^\top\otimes B^\top$.
\end{description}
\exercise
Suppose that the matrices $\boldsymbol{A}$~and $\boldsymbol{B}$ have upper
bandwidth $s_{\boldsymbol{A}}$~and $s_{\boldsymbol{B}}$, respectively, and that
the number of columns of~$\boldsymbol{A}$ equals the number of rows
of~$\boldsymbol{B}$. Show that the matrix
product~$\boldsymbol{A}\boldsymbol{B}$ has upper
bandwidth~$s_{\boldsymbol{A}}+s_{\boldsymbol{B}}$. State and prove the
corresponding result for lower bandwidths.
\exercise
We wish to solve the Poisson problem,
\[
\begin{aligned}
-(u_{xx}+u_{yy})&=f&&\text{in $\Omega$,}\\
u&=g&&\text{on $\partial\Omega$,}
\end{aligned}
\]
where $\Omega$ is the triangular region
\[
0\le x\le1,\quad 0\le y\le 1-x.
\]
We define grid points
\[
(x_p,y_q)=(p\,\Delta x,q\,\Delta y)
\quad\text{for $0\le p\le P$, $0\le q\le P-p$,}
\]
where $\Delta x=\Delta y=1/P$, as illustrated in
\cref{fig: finite diff triangle} for the case~$P=5$, and seek
$U_{pq}\approx u(x_p,y_q)$.
\begin{figure}
\caption{Finite difference grid for a triangular domain.}
\label{fig: finite diff triangle}
\begin{center}
\begin{tikzpicture}[scale=1.0]
\draw[->] (-1,0)--(6,0);
\node[right] at (6,0) {$x$};
\draw[->] (0,-1) -- (0,6);
\node[right] at (0,6) {$y$};
\foreach \x in {1, 2, 3, 4}
{
\draw[thin] (\x,0) -- (\x,5-\x);
\draw[fill] (\x,0) circle (0.05cm);
\draw[fill] (\x,5-\x) circle (0.05cm);
}
\foreach \y in {1, 2, 3, 4}
{
\draw[thin] (0,\y) -- (5-\y,\y);
\draw[fill] (0,\y) circle (0.05cm);
\draw[fill] (5-\y,\y) circle (0.05cm);
}
\draw[fill] (0,0) circle (0.05cm);
\draw[fill] (5,0) circle (0.05cm);
\draw[fill] (0,5) circle (0.05cm);
\foreach \x in {1, 2, 3}
\draw[fill=white] (\x,1) circle (0.05cm);
\foreach \x in {1, 2}
\draw[fill=white] (\x,2) circle (0.05cm);
\draw[fill=white] (1,3) circle (0.05cm);
\draw[thick] (0,0) -- (5,0) -- (0,5) -- (0,0);
\node[below] at (5,0) {$1$};
\node[left] at (0,5) {$1$};
\end{tikzpicture}
\end{center}
\end{figure}
\begin{description}
\item{(i)}
Write down the usual 5-point finite difference approximation for the
Poisson equation, based on second-order central difference
approximations to $u_{xx}$~and $u_{yy}$. Use the
abbreviation~$f_{pq}=f(x_p,y_q)$
\item{(ii)}
Write down the equation at~$(x_1,y_1)$, after the known boundary
values are moved to the right-hand side. You can use the
abbreviation~$g_{pq}=g(x_p,y_q)$.
\item{(iii)}
Assume now that $P=5$, and put
\begin{align*}
\boldsymbol{U}&=[U_{11}\quad U_{21}\quad U_{31}\quad U_{12} \quad U_{22}
\quad U_{13}]^\top,\\
\boldsymbol{f}&=[f_{11}\quad f_{21}\quad f_{31}\quad f_{12} \quad f_{22}
\quad f_{13}]^\top.
\end{align*}
Find the matrix~$\boldsymbol{A}$ and vector~$\boldsymbol{g}$ such that, with
$h=\Delta x=\Delta y=1/5$,
\[
\boldsymbol{A}\boldsymbol{U}=h^2\boldsymbol{f}+\boldsymbol{g}.
\]
\end{description}
\begin{ans}
(ii) $4U_{11}-U_{21}-U_{12}=h^2f_{11}+g_{01}+g_{10}$ \\
(iii)
\[
\boldsymbol{A}=\kbordermatrix{
&U_{11}&U_{21}&U_{31}&U_{12}&U_{22}&U_{13}\\
(x_1,y_1)& 4&-1& &-1& &\\
(x_2,y_1)&-1& 4&-1& &-1&\\
(x_3,y_1)& &-1& 4& & &\\
(x_1,y_2)&-1& & & 4&-1&-1\\
(x_2,y_2)& &-1& &-1& 4&\\
(x_1,y_3)& & & &-1& &4},\qquad
\boldsymbol{g}=\kbordermatrix{
&\\
(x_1,y_1)&g_{10}+g_{10}\\
(x_2,y_1)&g_{20}\\
(x_3,y_1)&g_{30}+g_{41}+g_{32}\\
(x_1,y_2)&g_{02}\\
(x_2,y_2)&g_{32}+g_{23}\\
(x_1,y_3)&g_{03}+g_{23}+g_{14}}.
\]
\end{ans}
\exercise
Write down $\boldsymbol{A}_{\mathrm{band}}$ given
by~\eqref{eq: symm band storage} if
\[
\boldsymbol{A}=\begin{bmatrix}
5& 1& 7& & &\\
1& 2& 0&-1& &\\
7& 0& 8& 2& 3&\\
&-1& 2& 5& 1& 6\\
& & 3& 1& 7& 2\\
& & & 6& 2& 9
\end{bmatrix}.
\]
\begin{ans}
\[
\boldsymbol{A}_{\mathrm{band}}=\begin{bmatrix}
*& *& 7&-1& 3& 6\\
*& 1& 0& 2& 1& 2\\
5& 2& 8& 5& 7& 9
\end{bmatrix}
\]
\end{ans}
\exercise
Write an in-place version of Algorithm~\ref{alg: band Chol}.
\begin{ans}
In-place algorithm:
\begin{center}
\newcommand{\rb}[1]{r^{\mathrm{band}}_{#1}}
\begin{algorithmic}
\Require{The $(\beta+1)\times n$
array~$\boldsymbol{R}_{\mathrm{band}}=[\rb{ij}]$
stores a real, $n\times n$, symmetric positive-definite matrix with
bandwidth~$\beta$, using the symmetric band storage so
$a_{ij}=\rb{\beta+1+i-j,j}$.}
\State
\Function{Factorize}{$\boldsymbol{R}_{\mathrm{band}}$}
\For{$j=1:n$}
\For{$i=\max(1,j-\beta):j$}
\State $s=0$
\For{$k=\max(1,j-\beta):i-1$}
\State $s=s+\rb{\beta+1+k-i,i}\rb{\beta+1+k-j,j}$
\EndFor
\State $\rb{\beta+1+i-j,j}=(\rb{\beta+1+i-j,j}-s)/\rb{\beta+1,i}$
\EndFor
\State $s=0$
\For{$k=\max(1,j-\beta):j-1$}
\State $s=s+(\rb{\beta+1+k-j,j})^2$
\EndFor
\If{$\rb{s+1,j}\le s$}
\State Error: $\boldsymbol{A}$ is not positive-definite.
\EndIf
\State $\rb{\beta+1,j}=\sqrt{\rb{\beta+1,j}-s}$
\EndFor
\State\Return{$\boldsymbol{R}_{\mathrm{band}}$}
\EndFunction
\end{algorithmic}
\end{center}
\end{ans}
\exercise
Write an in-place version of Algorithm~\ref{alg: band Chol solve}.
\begin{ans}
In-place algorithm:
\begin{center}
\newcommand{\rb}[1]{r^{\mathrm{band}}_{#1}}
\begin{algorithmic}
\Require{$\boldsymbol{x}=[b_i]_{i=1}^n$ stores the right-hand side vector.}
\Require{The $(\beta+1)\times n$ array
$\boldsymbol{R}_{\mathrm{band}}=[\rb{ij}]$ stores
the band Cholesky factor~$\boldsymbol{R}=[r_{ij}]$ of~$\boldsymbol{A}$, as
computed via Algorithm~\ref{alg: band Chol} so that
$r_{ij}=\rb{\beta+1+i-j,j}$.}
\State
\Function{Solve}{$\boldsymbol{x},\boldsymbol{R}_{\mathrm{band}}$}
\For{$i=1:n$}
\State $s=x_i$
\For{$j=\max(1,i-\beta):i-1$}
\State $s=s-\rb{\beta+1+j-i,i}x_j$
\EndFor
\State $x_i=s/\rb{\beta+1,i}$
\EndFor
\For{$i=n:-1:1$}
\State $s=x_i$
\For{$j=i+1:\min(n,i+\beta)$}
\State $s=s-\rb{\beta+1+i-j,j}x_j$
\EndFor
\State $x_i=s/\rb{\beta+1,i}$
\EndFor
\State\Return{$\boldsymbol{x}$}
\EndFunction
\end{algorithmic}
\end{center}
\end{ans}
\exercise
Describe the 2D version of the Crank--Nicolson method, and count the number of
floating-point operations needed for each of the following computations.
\begin{description}
\item{(i)} Finding the Cholesky factor~$\boldsymbol{R}$
in~\eqref{eq: backward Euler 2d Cholesky}.
\item{(ii)} Solving for~$\boldsymbol{U}^n$ for a single choice of~$n$.
\item{(iii)} Completing the whole calculation.
\item{(iv)} How does the computational cost scale with the overall problem
size~$S=NPQ$?
\end{description}
\exercise
Let $(r,\theta)$ denote the usual polar coordinates, and consider a
domain~$\Omega$ of the form
\[
a<r<b
\quad\text{and}\quad
\alpha<\theta<\beta,
\]
with $a>0$~and $\beta-\alpha<2\pi$. It is natural to define polar
grid points
\[
(r_p,\theta_q)=(a+p\,\Delta r, \alpha+q\,\Delta\theta),\quad
\Delta r=\frac{b-a}{P},\quad
\Delta\theta=\frac{\beta-\alpha}{Q},
\]
for $0\le p\le P$~and $0\le q\le Q$. Recall that
\[
\nabla^2u=\frac{1}{r}\frac{\partial}{\partial r}
\biggl(r\,\frac{\partial u}{\partial r}\biggr)
+\frac{1}{r^2}\,\frac{\partial^2u}{\partial\theta^2}.
\]
\begin{description}
\item{(i)} Formulate a finite difference approximation to the Poisson problem
\[
\begin{aligned}
-\nabla^2u&=f&\text{in $\Omega$,}\\
u&=0&\text{on $\partial\Omega$,}
\end{aligned}
\]
by setting up a $P\times Q$ rectangular grid in the
$(r,\theta)$-plane.
\item{(ii)}
Suppose that $\Omega$ is a disk of radius~$b$ (so $a=0$,
$\alpha=-\pi$~and $\beta=\pi$). Formulate a finite difference
method with $1+(P-1)Q$~unknowns. Hint: you will need an equation
at the origin.
\end{description}
\begin{ans}
(i)
Put $(r_p,\theta_q)=(a+p\,\Delta r,b+q\,\Delta\theta)$
for $0\le p\le P$~and $0\le q\le Q$, where $\Delta r=(b-a)/P$~and
$\Delta\theta=(\beta-\alpha)/Q$. Then $U_{pq}\approx u(r_p,\theta_q)$
should satisfy
\begin{multline*}
\frac{1}{\Delta r^2}\biggl(
-\frac{r_{p-1/2}}{r_p}\,U_{p-1,q}
+\frac{r_{p-1/2}+r_{p+1/2}}{r_p}\,U_{pq}
-\frac{r_{p+1/2}}{r_p}\,U_{p+1,q}\biggr)\\
+\frac{-U_{p,q-1}+2U_{pq}-U_{p,q+1}}{r_p^2\Delta\theta^2}
=f(r_p,\theta_q)
\end{multline*}
for $1\le p\le P-1$~and $1\le q\le Q-1$, with zero boundary conditions
$U_{0q}=0=U_{Pq}$ for $0\le q\le Q$, and $U_{p0}=0=U_{pQ}$
for~$0\le p\le P$.\quad
(ii) Note that $u(r,\pi)=u(r,-\pi)$ so we have a periodic
boundary condition in~$\theta$, that is $U_{pQ}=U_{p0}$
for~$0\le q\le Q$. Also, $u(0,\theta)$ is independent of~$\theta$,
so $U_{0q}=U_{00}$ for $1\le q\le Q$. Since $u=0$ when~$r=b$, we have
$U_{Pq}=0$ for $0\le q\le Q$. Thus, the $1+(P-1)Q$ unknowns are
$U_{00}$ and $U_{pq}$ for $1\le p\le P-1$ and $1\le q\le Q$. We can
apply the finite difference equation above
for $1\le p\le P-1$ and $1\le q\le Q$, giving $(P-1)Q$~equations.
The extra equation is
\[
\frac{-U_{1,Q/2}+2U_{00}-U_{1,Q}}{\Delta r^2}
\frac{-U_{1,Q/4}+2U_{00}-U_{1,3Q/4}}{\Delta r^2}=f(r_0,\theta_0).
\]
\end{ans}
\end{Exercises}
| {"hexsha": "6cae0b4327de97518734331ffae6df20709d3763", "size": 53222, "ext": "tex", "lang": "TeX", "max_stars_repo_path": "texsrc/chap5.tex", "max_stars_repo_name": "billmclean/ComputationalMathsNotes", "max_stars_repo_head_hexsha": "9d521fdf7ec407cca287997885d81c3150973415", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-09-30T21:30:20.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-30T21:30:20.000Z", "max_issues_repo_path": "texsrc/chap5.tex", "max_issues_repo_name": "billmclean/ComputationalMathsNotes", "max_issues_repo_head_hexsha": "9d521fdf7ec407cca287997885d81c3150973415", "max_issues_repo_licenses": ["CC0-1.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "texsrc/chap5.tex", "max_forks_repo_name": "billmclean/ComputationalMathsNotes", "max_forks_repo_head_hexsha": "9d521fdf7ec407cca287997885d81c3150973415", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.4033613445, "max_line_length": 81, "alphanum_fraction": 0.6330464845, "num_tokens": 22675} |
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
import pandas as pd
def f(x, a, b):
return a * x + b
def error(ydata):
v_error = np.empty(len(ydata))
for i in range(len(ydata)):
v_error[i] = max(ydata[i] * 0.0010, 0.01)
return v_error
data = pd.read_csv(r"C:\Users\Walter\IdeaProjects\PHY224\Photoelectric\EXP1.csv", delimiter=',', skiprows=0)
plt.title('LED Color stopping Voltage vs. wave length')
plt.ylabel('Stop Voltage (V)')
plt.xlabel('Wave Length (nm)')
xdata1 = data["wavelength "]
ydata1 = data["V stop"]
plt.errorbar(xdata1, ydata1, label='Test 1', yerr=error(ydata1), linestyle='None', marker=".")
data = pd.read_csv(r"C:\Users\Walter\IdeaProjects\PHY224\Photoelectric\EXP2.csv", delimiter=',', skiprows=0)
xdata2 = data["wavelength"]
ydata2 = data["Vstop"]
plt.errorbar(xdata2, ydata2, label='Test 2', yerr=error(ydata2), linestyle='None', marker=".")
data = pd.read_csv(r"C:\Users\Walter\IdeaProjects\PHY224\Photoelectric\EXP3.csv", delimiter=',', skiprows=0)
xdata3 = data["wavelength"]
ydata3 = data["Vstop"]
plt.errorbar(xdata3, ydata3, label='Test 3', yerr=error(ydata3), linestyle='None', marker=".")
xdata = (xdata1 + xdata2 + xdata3) / 3
ydata = (ydata1 + ydata2 + ydata3) / 3
plt.plot(xdata, ydata, label='Average')
plt.legend()
plt.show()
# Computing frequency from wavelength
frequency = (3 * 10 ** 8) / xdata
# Estimated errors from equipment
v_error = np.empty(len(ydata))
for i in range(len(ydata)):
v_error[i] = max(ydata[i] * 0.0010, 0.01)
# Linear regression
p_opt, p_cov = curve_fit(f, frequency, ydata, (0, 0), v_error, True)
lin_output = f(frequency, p_opt[0], p_opt[1])
# Outputting Planck's Constant h
h = p_opt[0] * (1.6 * 10 ** (-19))
h_error = p_cov[0, 0] * (1.6 * 10 ** (-19))
print('Estimated Plancks Constant: ', h, '(J*s) +/-', h_error, '(J**s)')
# Outputting the Work Function
wf = -p_opt[1] * (1.6 * 10 ** (-19))
wf_error = p_cov[1, 1] * (1.6 * 10 ** (-19))
print('Estimated Work Function: ', wf, '(J) +/-', wf_error, '(J)')
# Outputting the cut-off frequency
f0 = -(1.6 * 10 ** (-19)) * p_opt[1] / h
f0_error = p_cov[1, 1] * (1.6 * 10 ** (-19)) / h
print('Estimated Cut-off Frequency: ', f0, '(Hz) +/-', f0_error, '(Hz)')
# Calculating chi squared
chi_sq = (1 / 2) * (np.sum(((ydata - lin_output) / v_error) ** 2))
print('Chi squared for linear regression: ', chi_sq)
plt.title('Curve Fit vs. Original Data')
plt.ylabel('Stop Voltage (V)')
plt.xlabel('Wave Length (nm)')
plt.errorbar(xdata, ydata, label='Average', yerr=v_error, linestyle='None', marker=".")
plt.plot(xdata, lin_output, label='Curve fit ')
plt.legend()
plt.show()
| {"hexsha": "742bfeb505b3e21a87bfcba157efde989c20c36a", "size": 2665, "ext": "py", "lang": "Python", "max_stars_repo_path": "Photoelectric.py", "max_stars_repo_name": "EroSkulled/PHY224-324", "max_stars_repo_head_hexsha": "060a020d75e938d240d926e05e41f8e5c4bf435a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Photoelectric.py", "max_issues_repo_name": "EroSkulled/PHY224-324", "max_issues_repo_head_hexsha": "060a020d75e938d240d926e05e41f8e5c4bf435a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Photoelectric.py", "max_forks_repo_name": "EroSkulled/PHY224-324", "max_forks_repo_head_hexsha": "060a020d75e938d240d926e05e41f8e5c4bf435a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.7261904762, "max_line_length": 108, "alphanum_fraction": 0.6600375235, "include": true, "reason": "import numpy,from scipy", "num_tokens": 892} |
from gym import Wrapper
import numpy as np
from scipy.stats import norm
class InstanceSamplingWrapper(Wrapper):
"""
Wrapper to sample a new instance at a given time point.
Instances can either be sampled using a given method or a distribution infered from a given list of instances.
"""
def __init__(self, env, sampling_function=None, instances=None, reset_interval=0):
"""
Initialize wrapper
Either sampling_function or instances must be given
Parameters
-------
env : gym.Env
Environment to wrap
sampling_function : function
Function to sample instances from
instances : list
List of instances to infer distribution from
"""
super(InstanceSamplingWrapper, self).__init__(env)
if sampling_function:
self.sampling_function = sampling_function
elif instances:
self.sampling_function = self.fit_dist(instances)
else:
raise Exception("No distribution to sample from given")
self.reset_interval = reset_interval
self.reset_tracker = 0
def __setattr__(self, name, value):
"""
Set attribute in wrapper if available and in env if not
Parameters
----------
name : str
Attribute to set
value
Value to set attribute to
"""
if name in ["sampling_function", "env", "fit_dist", "reset"]:
object.__setattr__(self, name, value)
else:
setattr(self.env, name, value)
def __getattribute__(self, name):
"""
Get attribute value of wrapper if available and of env if not
Parameters
----------
name : str
Attribute to get
Returns
-------
value
Value of given name
"""
if name in ["sampling_function", "env", "fit_dist", "reset"]:
return object.__getattribute__(self, name)
else:
return getattr(self.env, name)
def reset(self):
"""
Reset environment and use sampled instance for training
Returns
-------
np.array
state
"""
if self.reset_tracker >= self.reset_interval:
instance = self.sampling_function()
self.env.use_next_instance(instance=instance)
return self.env.reset()
def fit_dist(self, instances):
"""
Approximate instance distribution in given instance set
Parameters
----------
instances : List
instance set
Returns
---------
method
sampling method for new instances
"""
dists = []
for i in range(len(instances[0])):
component = [instances[k][i] for k in instances.keys()]
dist = norm.fit(component)
dists.append(dist)
def sample():
instance = []
for d in dists:
instance.append(np.random.normal(d[0], d[1]))
return instance
return sample
| {"hexsha": "72a66f707d492d2feb7855c24aa50ff32d141338", "size": 3143, "ext": "py", "lang": "Python", "max_stars_repo_path": "dacbench/wrappers/instance_sampling_wrapper.py", "max_stars_repo_name": "ndangtt/LeadingOnesDAC", "max_stars_repo_head_hexsha": "953747d8702f179851d7973c65779a1f830e03a1", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-02-23T15:26:11.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-23T15:26:11.000Z", "max_issues_repo_path": "dacbench/wrappers/instance_sampling_wrapper.py", "max_issues_repo_name": "ndangtt/LeadingOnesDAC", "max_issues_repo_head_hexsha": "953747d8702f179851d7973c65779a1f830e03a1", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dacbench/wrappers/instance_sampling_wrapper.py", "max_forks_repo_name": "ndangtt/LeadingOnesDAC", "max_forks_repo_head_hexsha": "953747d8702f179851d7973c65779a1f830e03a1", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.814159292, "max_line_length": 114, "alphanum_fraction": 0.5606108813, "include": true, "reason": "import numpy,from scipy", "num_tokens": 606} |
import numpy as np
from prml.nn.array.array import asarray
def uniform(min, max, size):
return asarray(np.random.uniform(min, max, size))
| {"hexsha": "8acce618f203c6f5dab0c00b604da5d9773cb2e7", "size": 145, "ext": "py", "lang": "Python", "max_stars_repo_path": "prml/nn/random/uniform.py", "max_stars_repo_name": "alexandru-dinu/PRML", "max_stars_repo_head_hexsha": "acd823e098df67abe0306a70225e7539f8edda40", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "prml/nn/random/uniform.py", "max_issues_repo_name": "alexandru-dinu/PRML", "max_issues_repo_head_hexsha": "acd823e098df67abe0306a70225e7539f8edda40", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "prml/nn/random/uniform.py", "max_forks_repo_name": "alexandru-dinu/PRML", "max_forks_repo_head_hexsha": "acd823e098df67abe0306a70225e7539f8edda40", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2019-06-22T20:56:02.000Z", "max_forks_repo_forks_event_max_datetime": "2019-06-22T20:56:02.000Z", "avg_line_length": 18.125, "max_line_length": 53, "alphanum_fraction": 0.7310344828, "include": true, "reason": "import numpy", "num_tokens": 36} |
[STATEMENT]
theorem diff_const_axiom_valid: "valid diff_const_axiom"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. valid diff_const_axiom
[PROOF STEP]
apply(simp only: valid_def diff_const_axiom_def equals_sem)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<forall>I \<nu>. is_interp I \<longrightarrow> dterm_sem I (Differential ($f fid1 local.empty)) \<nu> = dterm_sem I (Const 0) \<nu>
[PROOF STEP]
apply(rule allI | rule impI)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>I \<nu>. is_interp I \<Longrightarrow> dterm_sem I (Differential ($f fid1 local.empty)) \<nu> = dterm_sem I (Const 0) \<nu>
[PROOF STEP]
apply(simp only: dterm_sem.simps constant_deriv_zero sterm_sem.simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done | {"llama_tokens": 316, "file": "Differential_Dynamic_Logic_Differential_Axioms", "length": 4} |
[STATEMENT]
lemma Abs_ffilter: "(ffilter f s = s') = ({e \<in> (fset s). f e} = (fset s'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (ffilter f s = s') = ({e \<in> fset s. f e} = fset s')
[PROOF STEP]
by (simp add: ffilter_def fset_both_sides Abs_fset_inverse Set.filter_def) | {"llama_tokens": 131, "file": "Extended_Finite_State_Machines_FSet_Utils", "length": 1} |
from distutils.version import StrictVersion
import unittest
import numpy as np
import sklearn
from sklearn import linear_model
from sklearn.svm import LinearSVC
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from onnxruntime import InferenceSession, __version__ as ort_version
from skl2onnx import convert_sklearn
from skl2onnx.common.data_types import (
BooleanTensorType,
FloatTensorType,
Int64TensorType,
)
from skl2onnx.common.data_types import onnx_built_with_ml
from test_utils import (
dump_data_and_model,
fit_classification_model,
fit_multilabel_classification_model,
)
def _sklearn_version():
# Remove development version 0.22.dev0 becomes 0.22.
v = ".".join(sklearn.__version__.split('.')[:2])
return StrictVersion(v)
class TestGLMClassifierConverter(unittest.TestCase):
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_binary_class(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(max_iter=100), 2)
model_onnx = convert_sklearn(
model, "logistic regression",
[("input", FloatTensorType([None, X.shape[1]]))])
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionBinary",
# Operator cast-1 is not implemented in onnxruntime
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.3') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
if StrictVersion(ort_version) >= StrictVersion("1.0.0"):
sess = InferenceSession(model_onnx.SerializeToString())
out = sess.get_outputs()
lb = out[0].type
sh = out[0].shape
self.assertEqual(str(lb), "tensor(int64)")
self.assertEqual(sh, [None])
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_binary_class_string(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(max_iter=100), 2,
label_string=True)
model_onnx = convert_sklearn(
model, "logistic regression",
[("input", FloatTensorType([None, X.shape[1]]))])
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionBinary",
# Operator cast-1 is not implemented in onnxruntime
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.3') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
if StrictVersion(ort_version) >= StrictVersion("1.0.0"):
sess = InferenceSession(model_onnx.SerializeToString())
out = sess.get_outputs()
lb = out[0].type
sh = out[0].shape
self.assertEqual(str(lb), "tensor(string)")
self.assertEqual(sh, [None])
def test_model_logistic_regression_int(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(max_iter=100), 3, is_int=True)
model_onnx = convert_sklearn(
model, "logistic regression",
[("input", Int64TensorType([None, X.shape[1]]))])
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionInt",
# Operator cast-1 is not implemented in onnxruntime
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.3') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
def test_model_logistic_regression_bool(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(max_iter=100), 3, is_bool=True)
model_onnx = convert_sklearn(
model, "logistic regression",
[("input", BooleanTensorType([None, X.shape[1]]))])
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionBool",
# Operator cast-1 is not implemented in onnxruntime
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.3') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_linear_discriminant_analysis(self):
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
y = np.array([1, 1, 1, 2, 2, 2])
X_test = np.array([[-0.8, -1], [-2, -1]], dtype=np.float32)
model = LinearDiscriminantAnalysis().fit(X, y)
model_onnx = convert_sklearn(
model, "linear model",
[("input", FloatTensorType([None, X_test.shape[1]]))])
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X_test,
model,
model_onnx,
basename="SklearnLinearDiscriminantAnalysisBin-Dec3",
# Operator cast-1 is not implemented in onnxruntime
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.3') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_linear_discriminant_analysis_decfunc(self):
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
y = np.array([1, 1, 1, 2, 2, 2])
X_test = np.array([[-0.8, -1], [0, 1]], dtype=np.float32)
model = LinearDiscriminantAnalysis().fit(X, y)
model_onnx = convert_sklearn(
model, "linear model",
[("input", FloatTensorType([None, X_test.shape[1]]))],
options={id(model): {'raw_scores': True}})
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X_test, model, model_onnx,
basename="SklearnLinearDiscriminantAnalysisBinRawScore-Out0",
# Operator cast-1 is not implemented in onnxruntime
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.3') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
methods=['predict', 'decision_function']
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_linear_discriminant_analysis_decfunc3(self):
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
y = np.array([1, 1, 1, 2, 2, 3])
X_test = np.array([[-0.8, -1], [0, 1]], dtype=np.float32)
model = LinearDiscriminantAnalysis().fit(X, y)
model_onnx = convert_sklearn(
model, "linear model",
[("input", FloatTensorType([None, X_test.shape[1]]))],
options={id(model): {'raw_scores': True}})
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X_test, model, model_onnx,
basename="SklearnLinearDiscriminantAnalysisBinRawScore3-Out0",
# Operator cast-1 is not implemented in onnxruntime
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.3') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
methods=['predict', 'decision_function']
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_cv_binary_class(self):
model, X = fit_classification_model(
linear_model.LogisticRegressionCV(max_iter=100), 2)
model_onnx = convert_sklearn(
model, "logistic regression cv",
[("input", FloatTensorType([None, X.shape[1]]))])
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticCVRegressionBinary",
# Operator cast-1 is not implemented in onnxruntime
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.3') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_cv_int(self):
model, X = fit_classification_model(
linear_model.LogisticRegressionCV(max_iter=100), 4, is_int=True)
model_onnx = convert_sklearn(
model, "logistic regression cv",
[("input", Int64TensorType([None, X.shape[1]]))])
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionCVInt",
# Operator cast-1 is not implemented in onnxruntime
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.3') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_cv_bool(self):
model, X = fit_classification_model(
linear_model.LogisticRegressionCV(max_iter=100), 3, is_bool=True)
model_onnx = convert_sklearn(
model, "logistic regression cv",
[("input", BooleanTensorType([None, X.shape[1]]))])
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionCVBool",
# Operator cast-1 is not implemented in onnxruntime
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.3') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_binary_class_nointercept(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(
fit_intercept=False, max_iter=10000), 2)
model_onnx = convert_sklearn(
model, "logistic regression",
[("input", FloatTensorType([None, X.shape[1]]))])
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionBinaryNoIntercept",
# Operator cast-1 is not implemented in onnxruntime
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.3') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_multi_class(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(max_iter=10000), 4)
model_onnx = convert_sklearn(
model,
"multi-class logistic regression",
[("input", FloatTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionMulti",
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.2') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_multi_class_nocl(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(max_iter=10000), 4,
label_string=True)
model_onnx = convert_sklearn(
model,
"multi-class logistic regression",
[("input", FloatTensorType([None, X.shape[1]]))],
options={id(model): {'nocl': True}})
self.assertIsNotNone(model_onnx)
sonx = str(model_onnx)
assert 'classlabels_strings' not in sonx
assert 'cl0' not in sonx
dump_data_and_model(
X, model, model_onnx, classes=model.classes_,
basename="SklearnLogitisticRegressionMultiNoCl",
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.2') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')")
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_multi_class_ovr(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(
multi_class='ovr', max_iter=10000), 3)
model_onnx = convert_sklearn(
model,
"multi-class logistic regression",
[("input", FloatTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionMulti",
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.2') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_multi_class_multinomial(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(
multi_class="multinomial", solver="lbfgs",
max_iter=10000), 4)
model_onnx = convert_sklearn(
model,
"multi-class logistic regression",
[("input", FloatTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionMulti",
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.2') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_multi_class_no_intercept(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(
fit_intercept=False, max_iter=10000), 3)
model_onnx = convert_sklearn(
model,
"multi-class logistic regression",
[("input", FloatTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionMultiNoIntercept",
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.2') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_multi_class_lbfgs(self):
penalty = (
'l2'
if _sklearn_version() < StrictVersion('0.21.0')
else 'none')
model, X = fit_classification_model(
linear_model.LogisticRegression(
solver='lbfgs', penalty=penalty, max_iter=10000), 5)
model_onnx = convert_sklearn(
model,
"multi-class logistic regression",
[("input", FloatTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionMultiLbfgs",
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.2') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_multi_class_liblinear_l1(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(
solver='liblinear', penalty='l1', max_iter=10000),
4)
model_onnx = convert_sklearn(
model,
"multi-class logistic regression",
[("input", FloatTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionMultiLiblinearL1",
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.2') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_multi_class_saga_elasticnet(self):
if _sklearn_version() < StrictVersion('0.21.0'):
model, X = fit_classification_model(
linear_model.LogisticRegression(
solver='saga', max_iter=10000), 3)
else:
model, X = fit_classification_model(
linear_model.LogisticRegression(
solver='saga', penalty='elasticnet', l1_ratio=0.1,
max_iter=10000), 3)
model_onnx = convert_sklearn(
model,
"multi-class logistic regression",
[("input", FloatTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLogitisticRegressionMultiSagaElasticnet",
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.2') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_linear_svc_binary_class(self):
model, X = fit_classification_model(LinearSVC(max_iter=10000), 2)
model_onnx = convert_sklearn(
model, "linear SVC",
[("input", FloatTensorType([None, X.shape[1]]))])
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLinearSVCBinary-NoProb",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_linear_svc_multi_class(self):
model, X = fit_classification_model(LinearSVC(max_iter=100), 5)
model_onnx = convert_sklearn(
model,
"multi-class linear SVC",
[("input", FloatTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLinearSVCMulti",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_linear_svc_int(self):
model, X = fit_classification_model(
LinearSVC(max_iter=100), 5, is_int=True)
model_onnx = convert_sklearn(
model,
"multi-class linear SVC",
[("input", Int64TensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLinearSVCInt",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_linear_svc_bool(self):
model, X = fit_classification_model(
LinearSVC(max_iter=100), 5, is_bool=True)
model_onnx = convert_sklearn(
model,
"multi-class linear SVC",
[("input", BooleanTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnLinearSVCBool",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_ridge_classifier_binary(self):
model, X = fit_classification_model(linear_model.RidgeClassifier(), 2)
model_onnx = convert_sklearn(
model,
"binary ridge classifier",
[("input", FloatTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnRidgeClassifierBin",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_ridge_classifier_binary_nozipmap(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(max_iter=10000), 2)
model_onnx = convert_sklearn(
model, "binary ridge classifier",
[("input", FloatTensorType([None, X.shape[1]]))])
assert 'zipmap' in str(model_onnx).lower()
options = {id(model): {'zipmap': True}}
model_onnx = convert_sklearn(
model, "binary ridge classifier",
[("input", FloatTensorType([None, X.shape[1]]))],
options=options)
assert 'zipmap' in str(model_onnx).lower()
options = {id(model): {'zipmap': False}}
model_onnx = convert_sklearn(
model, "binary ridge classifier",
[("input", FloatTensorType([None, X.shape[1]]))],
options=options)
assert 'zipmap' not in str(model_onnx).lower()
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnRidgeClassifierNZMBin",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_ridge_classifier_binary_mispelled_zipmap(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(max_iter=10000), 2)
options = {id(model): {'zipmap ': True}}
try:
convert_sklearn(
model, "binary ridge classifier",
[("input", FloatTensorType([None, X.shape[1]]))],
options=options)
raise AssertionError("Expecting an error.")
except NameError as e:
assert "Option 'zipmap ' not in" in str(e)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_ridge_classifier_binary_mispelled_zipmap_wrong_value(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(max_iter=10000), 2)
options = {id(model): {'zipmap': 'True'}}
try:
convert_sklearn(
model, "binary ridge classifier",
[("input", FloatTensorType([None, X.shape[1]]))],
options=options)
raise AssertionError("Expecting an error.")
except ValueError as e:
assert "Unexpected value ['True'] for option 'zipmap'" in str(e)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_ridge_classifier_multi_class(self):
model, X = fit_classification_model(linear_model.RidgeClassifier(), 5)
model_onnx = convert_sklearn(
model,
"multi-class ridge classifier",
[("input", FloatTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnRidgeClassifierMulti",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_ridge_classifier_int(self):
model, X = fit_classification_model(
linear_model.RidgeClassifier(), 5, is_int=True)
model_onnx = convert_sklearn(
model,
"multi-class ridge classifier",
[("input", Int64TensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnRidgeClassifierInt",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_ridge_classifier_bool(self):
model, X = fit_classification_model(
linear_model.RidgeClassifier(), 4, is_bool=True)
model_onnx = convert_sklearn(
model,
"multi-class ridge classifier",
[("input", BooleanTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnRidgeClassifierBool",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_ridge_classifier_cv_binary(self):
model, X = fit_classification_model(
linear_model.RidgeClassifierCV(), 2)
model_onnx = convert_sklearn(
model,
"binary ridge classifier cv",
[("input", FloatTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnRidgeClassifierCVBin",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_ridge_classifier_cv_int(self):
model, X = fit_classification_model(
linear_model.RidgeClassifierCV(), 2, is_int=True)
model_onnx = convert_sklearn(
model,
"binary ridge classifier cv",
[("input", Int64TensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnRidgeClassifierCVInt",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_ridge_classifier_cv_bool(self):
model, X = fit_classification_model(
linear_model.RidgeClassifierCV(), 2, is_bool=True)
model_onnx = convert_sklearn(
model,
"binary ridge classifier cv",
[("input", BooleanTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnRidgeClassifierCVBool",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_ridge_classifier_cv_multi_class(self):
model, X = fit_classification_model(
linear_model.RidgeClassifierCV(), 5)
model_onnx = convert_sklearn(
model,
"multi-class ridge classifier cv",
[("input", FloatTensorType([None, X.shape[1]]))],
)
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X,
model,
model_onnx,
basename="SklearnRidgeClassifierCVMulti",
allow_failure="StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
)
@unittest.skipIf(not onnx_built_with_ml(),
reason="Requires ONNX-ML extension.")
def test_model_logistic_regression_binary_class_decision_function(self):
model, X = fit_classification_model(
linear_model.LogisticRegression(max_iter=10000), 2)
model_onnx = convert_sklearn(
model, "logistic regression",
[("input", FloatTensorType([None, X.shape[1]]))],
options={linear_model.LogisticRegression: {'raw_scores': True}})
self.assertIsNotNone(model_onnx)
dump_data_and_model(
X[:5],
model,
model_onnx,
basename="SklearnLogitisticRegressionBinaryRawScore",
# Operator cast-1 is not implemented in onnxruntime
allow_failure="StrictVersion(onnx.__version__)"
" < StrictVersion('1.3') or "
"StrictVersion(onnxruntime.__version__)"
" <= StrictVersion('0.2.1')",
methods=['predict', 'decision_function_binary'])
@unittest.skip(
reason="Scikit-learn doesn't return multi-label output.")
def test_model_ridge_classifier_cv_multilabel(self):
model, X_test = fit_multilabel_classification_model(
linear_model.RidgeClassifierCV(random_state=42))
model_onnx = convert_sklearn(
model,
"scikit-learn RidgeClassifierCV",
[("input", FloatTensorType([None, X_test.shape[1]]))],
)
self.assertTrue(model_onnx is not None)
dump_data_and_model(
X_test,
model,
model_onnx,
basename="SklearnRidgeClassifierCVMultiLabel",
allow_failure="StrictVersion("
"onnxruntime.__version__)<= StrictVersion('0.2.1')",
)
if __name__ == "__main__":
unittest.main()
| {"hexsha": "13a41a786f4835046be2889aea9830e5f735b12d", "size": 33538, "ext": "py", "lang": "Python", "max_stars_repo_path": "tests/test_sklearn_glm_classifier_converter.py", "max_stars_repo_name": "alexivaner/sklearn-onnx", "max_stars_repo_head_hexsha": "535a79481a79964287430bb390912c16911cff01", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-04-12T12:38:20.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-12T12:38:20.000Z", "max_issues_repo_path": "tests/test_sklearn_glm_classifier_converter.py", "max_issues_repo_name": "alexivaner/sklearn-onnx", "max_issues_repo_head_hexsha": "535a79481a79964287430bb390912c16911cff01", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/test_sklearn_glm_classifier_converter.py", "max_forks_repo_name": "alexivaner/sklearn-onnx", "max_forks_repo_head_hexsha": "535a79481a79964287430bb390912c16911cff01", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 40.9, "max_line_length": 78, "alphanum_fraction": 0.5711729978, "include": true, "reason": "import numpy", "num_tokens": 7334} |
[STATEMENT]
lemma a_star_ImpLR:
"N \<longrightarrow>\<^sub>a* N'\<Longrightarrow> ImpL <a>.M (y).N z \<longrightarrow>\<^sub>a* ImpL <a>.M (y).N' z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. N \<longrightarrow>\<^sub>a* N' \<Longrightarrow> ImpL <a>.M y.N z \<longrightarrow>\<^sub>a* ImpL <a>.M y.N' z
[PROOF STEP]
by (induct set: rtranclp) (blast intro: rtranclp.rtrancl_into_rtrancl)+ | {"llama_tokens": 168, "file": null, "length": 1} |
"""Beamformer module."""
from typing import List
from typing import Optional
from typing import Union
import numpy as np
import torch
from torch_complex import functional as FC
from torch_complex.tensor import ComplexTensor
EPS = torch.finfo(torch.double).eps
def complex_norm(c: ComplexTensor) -> torch.Tensor:
return torch.sqrt((c.real ** 2 + c.imag ** 2).sum(dim=-1, keepdim=True) + EPS)
def get_rtf(
psd_speech: ComplexTensor,
psd_noise: ComplexTensor,
reference_vector: Union[int, torch.Tensor, None] = None,
iterations: int = 3,
use_torch_solver: bool = True,
) -> ComplexTensor:
"""Calculate the relative transfer function (RTF) using the power method.
Algorithm:
1) rtf = reference_vector
2) for i in range(iterations):
rtf = (psd_noise^-1 @ psd_speech) @ rtf
rtf = rtf / ||rtf||_2 # this normalization can be skipped
3) rtf = psd_noise @ rtf
4) rtf = rtf / rtf[..., ref_channel, :]
Note: 4) Normalization at the reference channel is not performed here.
Args:
psd_speech (ComplexTensor): speech covariance matrix (..., F, C, C)
psd_noise (ComplexTensor): noise covariance matrix (..., F, C, C)
reference_vector (torch.Tensor or int): (..., C) or scalar
iterations (int): number of iterations in power method
use_torch_solver (bool): Whether to use `solve` instead of `inverse`
Returns:
rtf (ComplexTensor): (..., F, C, 1)
"""
if use_torch_solver:
phi = FC.solve(psd_speech, psd_noise)[0]
else:
phi = FC.matmul(psd_noise.inverse2(), psd_speech)
rtf = (
phi[..., reference_vector, None]
if isinstance(reference_vector, int)
else FC.matmul(phi, reference_vector[..., None, :, None])
)
for _ in range(iterations - 2):
rtf = FC.matmul(phi, rtf)
# rtf = rtf / complex_norm(rtf)
rtf = FC.matmul(psd_speech, rtf)
return rtf
def get_mvdr_vector(
psd_s: ComplexTensor,
psd_n: ComplexTensor,
reference_vector: torch.Tensor,
use_torch_solver: bool = True,
diagonal_loading: bool = True,
diag_eps: float = 1e-7,
eps: float = 1e-8,
) -> ComplexTensor:
"""Return the MVDR (Minimum Variance Distortionless Response) vector:
h = (Npsd^-1 @ Spsd) / (Tr(Npsd^-1 @ Spsd)) @ u
Reference:
On optimal frequency-domain multichannel linear filtering
for noise reduction; M. Souden et al., 2010;
https://ieeexplore.ieee.org/document/5089420
Args:
psd_s (ComplexTensor): speech covariance matrix (..., F, C, C)
psd_n (ComplexTensor): observation/noise covariance matrix (..., F, C, C)
reference_vector (torch.Tensor): (..., C)
use_torch_solver (bool): Whether to use `solve` instead of `inverse`
diagonal_loading (bool): Whether to add a tiny term to the diagonal of psd_n
diag_eps (float):
eps (float):
Returns:
beamform_vector (ComplexTensor): (..., F, C)
""" # noqa: D400
if diagonal_loading:
psd_n = tik_reg(psd_n, reg=diag_eps, eps=eps)
if use_torch_solver:
numerator = FC.solve(psd_s, psd_n)[0]
else:
numerator = FC.matmul(psd_n.inverse2(), psd_s)
# ws: (..., C, C) / (...,) -> (..., C, C)
ws = numerator / (FC.trace(numerator)[..., None, None] + eps)
# h: (..., F, C_1, C_2) x (..., C_2) -> (..., F, C_1)
beamform_vector = FC.einsum("...fec,...c->...fe", [ws, reference_vector])
return beamform_vector
def get_mvdr_vector_with_rtf(
psd_n: ComplexTensor,
psd_speech: ComplexTensor,
psd_noise: ComplexTensor,
iterations: int = 3,
reference_vector: Union[int, torch.Tensor, None] = None,
normalize_ref_channel: Optional[int] = None,
use_torch_solver: bool = True,
diagonal_loading: bool = True,
diag_eps: float = 1e-7,
eps: float = 1e-8,
) -> ComplexTensor:
"""Return the MVDR (Minimum Variance Distortionless Response) vector
calculated with RTF:
h = (Npsd^-1 @ rtf) / (rtf^H @ Npsd^-1 @ rtf)
Reference:
On optimal frequency-domain multichannel linear filtering
for noise reduction; M. Souden et al., 2010;
https://ieeexplore.ieee.org/document/5089420
Args:
psd_n (ComplexTensor): observation/noise covariance matrix (..., F, C, C)
psd_speech (ComplexTensor): speech covariance matrix (..., F, C, C)
psd_noise (ComplexTensor): noise covariance matrix (..., F, C, C)
iterations (int): number of iterations in power method
reference_vector (torch.Tensor or int): (..., C) or scalar
normalize_ref_channel (int): reference channel for normalizing the RTF
use_torch_solver (bool): Whether to use `solve` instead of `inverse`
diagonal_loading (bool): Whether to add a tiny term to the diagonal of psd_n
diag_eps (float):
eps (float):
Returns:
beamform_vector (ComplexTensor): (..., F, C)
""" # noqa: H405, D205, D400
if diagonal_loading:
psd_noise = tik_reg(psd_noise, reg=diag_eps, eps=eps)
# (B, F, C, 1)
rtf = get_rtf(
psd_speech,
psd_noise,
reference_vector,
iterations=iterations,
use_torch_solver=use_torch_solver,
)
# numerator: (..., C_1, C_2) x (..., C_2, 1) -> (..., C_1)
if use_torch_solver:
numerator = FC.solve(rtf, psd_n)[0].squeeze(-1)
else:
numerator = FC.matmul(psd_n.inverse2(), rtf).squeeze(-1)
denominator = FC.einsum("...d,...d->...", [rtf.squeeze(-1).conj(), numerator])
if normalize_ref_channel is not None:
scale = rtf.squeeze(-1)[..., normalize_ref_channel, None].conj()
beamforming_vector = numerator * scale / (denominator.real.unsqueeze(-1) + eps)
else:
beamforming_vector = numerator / (denominator.real.unsqueeze(-1) + eps)
return beamforming_vector
def signal_framing(
signal: Union[torch.Tensor, ComplexTensor],
frame_length: int,
frame_step: int,
bdelay: int,
do_padding: bool = False,
pad_value: int = 0,
indices: List = None,
) -> Union[torch.Tensor, ComplexTensor]:
"""Expand `signal` into several frames, with each frame of length `frame_length`.
Args:
signal : (..., T)
frame_length: length of each segment
frame_step: step for selecting frames
bdelay: delay for WPD
do_padding: whether or not to pad the input signal at the beginning
of the time dimension
pad_value: value to fill in the padding
Returns:
torch.Tensor:
if do_padding: (..., T, frame_length)
else: (..., T - bdelay - frame_length + 2, frame_length)
"""
frame_length2 = frame_length - 1
# pad to the right at the last dimension of `signal` (time dimension)
if do_padding:
# (..., T) --> (..., T + bdelay + frame_length - 2)
signal = FC.pad(signal, (bdelay + frame_length2 - 1, 0), "constant", pad_value)
do_padding = False
if indices is None:
# [[ 0, 1, ..., frame_length2 - 1, frame_length2 - 1 + bdelay ],
# [ 1, 2, ..., frame_length2, frame_length2 + bdelay ],
# [ 2, 3, ..., frame_length2 + 1, frame_length2 + 1 + bdelay ],
# ...
# [ T-bdelay-frame_length2, ..., T-1-bdelay, T-1 ]]
indices = [
[*range(i, i + frame_length2), i + frame_length2 + bdelay - 1]
for i in range(0, signal.shape[-1] - frame_length2 - bdelay + 1, frame_step)
]
if isinstance(signal, ComplexTensor):
real = signal_framing(
signal.real,
frame_length,
frame_step,
bdelay,
do_padding,
pad_value,
indices,
)
imag = signal_framing(
signal.imag,
frame_length,
frame_step,
bdelay,
do_padding,
pad_value,
indices,
)
return ComplexTensor(real, imag)
else:
# (..., T - bdelay - frame_length + 2, frame_length)
signal = signal[..., indices]
# signal[..., :-1] = -signal[..., :-1]
return signal
def get_covariances(
Y: ComplexTensor,
inverse_power: torch.Tensor,
bdelay: int,
btaps: int,
get_vector: bool = False,
) -> ComplexTensor:
"""Calculates the power normalized spatio-temporal covariance
matrix of the framed signal.
Args:
Y : Complex STFT signal with shape (B, F, C, T)
inverse_power : Weighting factor with shape (B, F, T)
Returns:
Correlation matrix: (B, F, (btaps+1) * C, (btaps+1) * C)
Correlation vector: (B, F, btaps + 1, C, C)
""" # noqa: H405, D205, D400, D401
assert inverse_power.dim() == 3, inverse_power.dim()
assert inverse_power.size(0) == Y.size(0), (inverse_power.size(0), Y.size(0))
Bs, Fdim, C, T = Y.shape
# (B, F, C, T - bdelay - btaps + 1, btaps + 1)
Psi = signal_framing(Y, btaps + 1, 1, bdelay, do_padding=False)[
..., : T - bdelay - btaps + 1, :
]
# Reverse along btaps-axis:
# [tau, tau-bdelay, tau-bdelay-1, ..., tau-bdelay-frame_length+1]
Psi = FC.reverse(Psi, dim=-1)
Psi_norm = Psi * inverse_power[..., None, bdelay + btaps - 1 :, None]
# let T' = T - bdelay - btaps + 1
# (B, F, C, T', btaps + 1) x (B, F, C, T', btaps + 1)
# -> (B, F, btaps + 1, C, btaps + 1, C)
covariance_matrix = FC.einsum("bfdtk,bfetl->bfkdle", (Psi, Psi_norm.conj()))
# (B, F, btaps + 1, C, btaps + 1, C)
# -> (B, F, (btaps + 1) * C, (btaps + 1) * C)
covariance_matrix = covariance_matrix.view(
Bs, Fdim, (btaps + 1) * C, (btaps + 1) * C
)
if get_vector:
# (B, F, C, T', btaps + 1) x (B, F, C, T')
# --> (B, F, btaps +1, C, C)
covariance_vector = FC.einsum(
"bfdtk,bfet->bfked", (Psi_norm, Y[..., bdelay + btaps - 1 :].conj())
)
return covariance_matrix, covariance_vector
else:
return covariance_matrix
def get_WPD_filter(
Phi: ComplexTensor,
Rf: ComplexTensor,
reference_vector: torch.Tensor,
use_torch_solver: bool = True,
diagonal_loading: bool = True,
diag_eps: float = 1e-7,
eps: float = 1e-8,
) -> ComplexTensor:
"""Return the WPD vector.
WPD is the Weighted Power minimization Distortionless response
convolutional beamformer. As follows:
h = (Rf^-1 @ Phi_{xx}) / tr[(Rf^-1) @ Phi_{xx}] @ u
Reference:
T. Nakatani and K. Kinoshita, "A Unified Convolutional Beamformer
for Simultaneous Denoising and Dereverberation," in IEEE Signal
Processing Letters, vol. 26, no. 6, pp. 903-907, June 2019, doi:
10.1109/LSP.2019.2911179.
https://ieeexplore.ieee.org/document/8691481
Args:
Phi (ComplexTensor): (B, F, (btaps+1) * C, (btaps+1) * C)
is the PSD of zero-padded speech [x^T(t,f) 0 ... 0]^T.
Rf (ComplexTensor): (B, F, (btaps+1) * C, (btaps+1) * C)
is the power normalized spatio-temporal covariance matrix.
reference_vector (torch.Tensor): (B, (btaps+1) * C)
is the reference_vector.
use_torch_solver (bool): Whether to use `solve` instead of `inverse`
diagonal_loading (bool): Whether to add a tiny term to the diagonal of psd_n
diag_eps (float):
eps (float):
Returns:
filter_matrix (ComplexTensor): (B, F, (btaps + 1) * C)
"""
if diagonal_loading:
Rf = tik_reg(Rf, reg=diag_eps, eps=eps)
# numerator: (..., C_1, C_2) x (..., C_2, C_3) -> (..., C_1, C_3)
if use_torch_solver:
numerator = FC.solve(Phi, Rf)[0]
else:
numerator = FC.matmul(Rf.inverse2(), Phi)
# ws: (..., C, C) / (...,) -> (..., C, C)
ws = numerator / (FC.trace(numerator)[..., None, None] + eps)
# h: (..., F, C_1, C_2) x (..., C_2) -> (..., F, C_1)
beamform_vector = FC.einsum("...fec,...c->...fe", [ws, reference_vector])
# (B, F, (btaps + 1) * C)
return beamform_vector
def get_WPD_filter_v2(
Phi: ComplexTensor,
Rf: ComplexTensor,
reference_vector: torch.Tensor,
diagonal_loading: bool = True,
diag_eps: float = 1e-7,
eps: float = 1e-8,
) -> ComplexTensor:
"""Return the WPD vector (v2).
This implementation is more efficient than `get_WPD_filter` as
it skips unnecessary computation with zeros.
Args:
Phi (ComplexTensor): (B, F, C, C)
is speech PSD.
Rf (ComplexTensor): (B, F, (btaps+1) * C, (btaps+1) * C)
is the power normalized spatio-temporal covariance matrix.
reference_vector (torch.Tensor): (B, C)
is the reference_vector.
diagonal_loading (bool): Whether to add a tiny term to the diagonal of psd_n
diag_eps (float):
eps (float):
Returns:
filter_matrix (ComplexTensor): (B, F, (btaps+1) * C)
"""
C = reference_vector.shape[-1]
if diagonal_loading:
Rf = tik_reg(Rf, reg=diag_eps, eps=eps)
inv_Rf = Rf.inverse2()
# (B, F, (btaps+1) * C, C)
inv_Rf_pruned = inv_Rf[..., :C]
# numerator: (..., C_1, C_2) x (..., C_2, C_3) -> (..., C_1, C_3)
numerator = FC.matmul(inv_Rf_pruned, Phi)
# ws: (..., (btaps+1) * C, C) / (...,) -> (..., (btaps+1) * C, C)
ws = numerator / (FC.trace(numerator[..., :C, :])[..., None, None] + eps)
# h: (..., F, C_1, C_2) x (..., C_2) -> (..., F, C_1)
beamform_vector = FC.einsum("...fec,...c->...fe", [ws, reference_vector])
# (B, F, (btaps+1) * C)
return beamform_vector
def get_WPD_filter_with_rtf(
psd_observed_bar: ComplexTensor,
psd_speech: ComplexTensor,
psd_noise: ComplexTensor,
iterations: int = 3,
reference_vector: Union[int, torch.Tensor, None] = None,
normalize_ref_channel: Optional[int] = None,
use_torch_solver: bool = True,
diagonal_loading: bool = True,
diag_eps: float = 1e-7,
eps: float = 1e-15,
) -> ComplexTensor:
"""Return the WPD vector calculated with RTF.
WPD is the Weighted Power minimization Distortionless response
convolutional beamformer. As follows:
h = (Rf^-1 @ vbar) / (vbar^H @ R^-1 @ vbar)
Reference:
T. Nakatani and K. Kinoshita, "A Unified Convolutional Beamformer
for Simultaneous Denoising and Dereverberation," in IEEE Signal
Processing Letters, vol. 26, no. 6, pp. 903-907, June 2019, doi:
10.1109/LSP.2019.2911179.
https://ieeexplore.ieee.org/document/8691481
Args:
psd_observed_bar (ComplexTensor): stacked observation covariance matrix
psd_speech (ComplexTensor): speech covariance matrix (..., F, C, C)
psd_noise (ComplexTensor): noise covariance matrix (..., F, C, C)
iterations (int): number of iterations in power method
reference_vector (torch.Tensor or int): (..., C) or scalar
normalize_ref_channel (int): reference channel for normalizing the RTF
use_torch_solver (bool): Whether to use `solve` instead of `inverse`
diagonal_loading (bool): Whether to add a tiny term to the diagonal of psd_n
diag_eps (float):
eps (float):
Returns:
beamform_vector (ComplexTensor)r: (..., F, C)
"""
C = psd_noise.size(-1)
if diagonal_loading:
psd_noise = tik_reg(psd_noise, reg=diag_eps, eps=eps)
# (B, F, C, 1)
rtf = get_rtf(
psd_speech,
psd_noise,
reference_vector,
iterations=iterations,
use_torch_solver=use_torch_solver,
)
# (B, F, (K+1)*C, 1)
rtf = FC.pad(rtf, (0, 0, 0, psd_observed_bar.shape[-1] - C), "constant", 0)
# numerator: (..., C_1, C_2) x (..., C_2, 1) -> (..., C_1)
if use_torch_solver:
numerator = FC.solve(rtf, psd_observed_bar)[0].squeeze(-1)
else:
numerator = FC.matmul(psd_observed_bar.inverse2(), rtf).squeeze(-1)
denominator = FC.einsum("...d,...d->...", [rtf.squeeze(-1).conj(), numerator])
if normalize_ref_channel is not None:
scale = rtf.squeeze(-1)[..., normalize_ref_channel, None].conj()
beamforming_vector = numerator * scale / (denominator.real.unsqueeze(-1) + eps)
else:
beamforming_vector = numerator / (denominator.real.unsqueeze(-1) + eps)
return beamforming_vector
def perform_WPD_filtering(
filter_matrix: ComplexTensor, Y: ComplexTensor, bdelay: int, btaps: int
) -> ComplexTensor:
"""Perform WPD filtering.
Args:
filter_matrix: Filter matrix (B, F, (btaps + 1) * C)
Y : Complex STFT signal with shape (B, F, C, T)
Returns:
enhanced (ComplexTensor): (B, F, T)
"""
# (B, F, C, T) --> (B, F, C, T, btaps + 1)
Ytilde = signal_framing(Y, btaps + 1, 1, bdelay, do_padding=True, pad_value=0)
Ytilde = FC.reverse(Ytilde, dim=-1)
Bs, Fdim, C, T = Y.shape
# --> (B, F, T, btaps + 1, C) --> (B, F, T, (btaps + 1) * C)
Ytilde = Ytilde.permute(0, 1, 3, 4, 2).contiguous().view(Bs, Fdim, T, -1)
# (B, F, T, 1)
enhanced = FC.einsum("...tc,...c->...t", [Ytilde, filter_matrix.conj()])
return enhanced
def tik_reg(mat: ComplexTensor, reg: float = 1e-8, eps: float = 1e-8) -> ComplexTensor:
"""Perform Tikhonov regularization (only modifying real part).
Args:
mat (ComplexTensor): input matrix (..., C, C)
reg (float): regularization factor
eps (float)
Returns:
ret (ComplexTensor): regularized matrix (..., C, C)
"""
# Add eps
C = mat.size(-1)
eye = torch.eye(C, dtype=mat.dtype, device=mat.device)
shape = [1 for _ in range(mat.dim() - 2)] + [C, C]
eye = eye.view(*shape).repeat(*mat.shape[:-2], 1, 1)
with torch.no_grad():
epsilon = FC.trace(mat).real[..., None, None] * reg
# in case that correlation_matrix is all-zero
epsilon = epsilon + eps
mat = mat + epsilon * eye
return mat
##############################################
# Below are for Multi-Frame MVDR beamforming #
##############################################
# modified from https://gitlab.uni-oldenburg.de/hura4843/deep-mfmvdr/-/blob/master/deep_mfmvdr (# noqa: E501)
def get_adjacent(spec: ComplexTensor, filter_length: int = 5) -> ComplexTensor:
"""Zero-pad and unfold stft, i.e.,
add zeros to the beginning so that, using the multi-frame signal model,
there will be as many output frames as input frames.
Args:
spec (ComplexTensor): input spectrum (B, F, T)
filter_length (int): length for frame extension
Returns:
ret (ComplexTensor): output spectrum (B, F, T, filter_length)
""" # noqa: D400
return (
FC.pad(spec, pad=[filter_length - 1, 0])
.unfold(dim=-1, size=filter_length, step=1)
.contiguous()
)
def get_adjacent_th(spec: torch.Tensor, filter_length: int = 5) -> torch.Tensor:
"""Zero-pad and unfold stft, i.e.,
add zeros to the beginning so that, using the multi-frame signal model,
there will be as many output frames as input frames.
Args:
spec (torch.Tensor): input spectrum (B, F, T, 2)
filter_length (int): length for frame extension
Returns:
ret (torch.Tensor): output spectrum (B, F, T, filter_length, 2)
""" # noqa: D400
return (
torch.nn.functional.pad(spec, pad=[0, 0, filter_length - 1, 0])
.unfold(dimension=-2, size=filter_length, step=1)
.transpose(-2, -1)
.contiguous()
)
def vector_to_Hermitian(vec):
"""Construct a Hermitian matrix from a vector of N**2 independent
real-valued elements.
Args:
vec (torch.Tensor): (..., N ** 2)
Returns:
mat (ComplexTensor): (..., N, N)
""" # noqa: H405, D205, D400
N = int(np.sqrt(vec.shape[-1]))
mat = torch.zeros(size=vec.shape[:-1] + (N, N, 2), device=vec.device)
# real component
triu = np.triu_indices(N, 0)
triu2 = np.triu_indices(N, 1) # above main diagonal
tril = (triu2[1], triu2[0]) # below main diagonal; for symmetry
mat[(...,) + triu + (np.zeros(triu[0].shape[0]),)] = vec[..., : triu[0].shape[0]]
start = triu[0].shape[0]
mat[(...,) + tril + (np.zeros(tril[0].shape[0]),)] = mat[
(...,) + triu2 + (np.zeros(triu2[0].shape[0]),)
]
# imaginary component
mat[(...,) + triu2 + (np.ones(triu2[0].shape[0]),)] = vec[
..., start : start + triu2[0].shape[0]
]
mat[(...,) + tril + (np.ones(tril[0].shape[0]),)] = -mat[
(...,) + triu2 + (np.ones(triu2[0].shape[0]),)
]
return ComplexTensor(mat[..., 0], mat[..., 1])
def get_mfmvdr_vector(gammax, Phi, use_torch_solver: bool = True, eps: float = EPS):
"""Compute conventional MFMPDR/MFMVDR filter.
Args:
gammax (ComplexTensor): (..., L, N)
Phi (ComplexTensor): (..., L, N, N)
use_torch_solver (bool): Whether to use `solve` instead of `inverse`
eps (float)
Returns:
beamforming_vector (ComplexTensor): (..., L, N)
"""
# (..., L, N)
if use_torch_solver:
numerator = FC.solve(gammax.unsqueeze(-1), Phi)[0].squeeze(-1)
else:
numerator = FC.matmul(Phi.inverse2(), gammax.unsqueeze(-1)).squeeze(-1)
denominator = FC.einsum("...d,...d->...", [gammax.conj(), numerator])
return numerator / (denominator.real.unsqueeze(-1) + eps)
def filter_minimum_gain_like(
G_min, w, y, alpha=None, k: float = 10.0, eps: float = EPS
):
"""Approximate a minimum gain operation.
speech_estimate = alpha w^H y + (1 - alpha) G_min Y,
where alpha = 1 / (1 + exp(-2 k x)), x = w^H y - G_min Y
Args:
G_min (float): minimum gain
w (ComplexTensor): filter coefficients (..., L, N)
y (ComplexTensor): buffered and stacked input (..., L, N)
alpha: mixing factor
k (float): scaling in tanh-like function
esp (float)
Returns:
output (ComplexTensor): minimum gain-filtered output
alpha (float): optional
"""
# (..., L)
filtered_input = FC.einsum("...d,...d->...", [w.conj(), y])
# (..., L)
Y = y[..., -1]
return minimum_gain_like(G_min, Y, filtered_input, alpha, k, eps)
def minimum_gain_like(
G_min, Y, filtered_input, alpha=None, k: float = 10.0, eps: float = EPS
):
if alpha is None:
diff = (filtered_input + eps).abs() - (G_min * Y + eps).abs()
alpha = 1.0 / (1.0 + torch.exp(-2 * k * diff))
return_alpha = True
else:
return_alpha = False
output = alpha * filtered_input + (1 - alpha) * G_min * Y
if return_alpha:
return output, alpha
else:
return output
| {"hexsha": "0786eda313194279d5171b7f67e93607b7b8044e", "size": 22822, "ext": "py", "lang": "Python", "max_stars_repo_path": "espnet2/enh/layers/beamformer.py", "max_stars_repo_name": "zh794390558/espnet", "max_stars_repo_head_hexsha": "edb89d8c955e7d88f6e59c8e8e025617feec5af1", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2020-01-15T08:49:12.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-09T16:12:19.000Z", "max_issues_repo_path": "espnet2/enh/layers/beamformer.py", "max_issues_repo_name": "zh794390558/espnet", "max_issues_repo_head_hexsha": "edb89d8c955e7d88f6e59c8e8e025617feec5af1", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2021-03-02T14:52:18.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-01T08:02:40.000Z", "max_forks_repo_path": "espnet2/enh/layers/beamformer.py", "max_forks_repo_name": "shirayu/espnet", "max_forks_repo_head_hexsha": "66f0f8382b0e1195bed7c280c29711f8436b3db4", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2020-05-27T18:48:27.000Z", "max_forks_repo_forks_event_max_datetime": "2020-05-27T22:20:13.000Z", "avg_line_length": 35.7151799687, "max_line_length": 109, "alphanum_fraction": 0.5876785558, "include": true, "reason": "import numpy", "num_tokens": 6725} |
# scan.py
# Author: Thomas MINIER - MIT License 2017-2020
from typing import Dict, Optional
from sage.database.db_iterator import DBIterator
from sage.query_engine.iterators.preemptable_iterator import PreemptableIterator
from sage.query_engine.iterators.utils import selection, vars_positions
from sage.query_engine.protobuf.iterators_pb2 import (SavedScanIterator,
TriplePattern)
class ScanIterator(PreemptableIterator):
"""A ScanIterator evaluates a triple pattern over a RDF graph.
It can be used as the starting iterator in a pipeline of iterators.
Args:
* source: A DBIterator that yields RDF triple.
* triple: The triple pattern corresponding to the source iterator.
* cardinality: The cardinality of the triple pattern.
"""
def __init__(self, source: DBIterator, triple: Dict[str, str], cardinality: int = 0, progress: int = 0):
super(ScanIterator, self).__init__()
self._source = source
self._triple = triple
self._variables = vars_positions(triple['subject'], triple['predicate'], triple['object'])
self._cardinality = cardinality
self._progress = progress
def __len__(self) -> int:
return self._cardinality
def __repr__(self) -> str:
return f"<ScanIterator ({self._triple['subject']} {self._triple['predicate']} {self._triple['object']})>"
def serialized_name(self):
"""Get the name of the iterator, as used in the plan serialization protocol"""
return "scan"
def last_read(self) -> str:
return self._source.last_read()
def has_next(self) -> bool:
"""Return True if the iterator has more item to yield"""
return self._source.has_next()
def next_sync(self) -> Optional[Dict[str, str]]:
""" test !!
"""
if not self.has_next():
raise StopAsyncIteration()
triple = next(self._source)
self._progress+=1
if triple is None:
return None
return selection(triple, self._variables)
async def next(self) -> Optional[Dict[str, str]]:
"""Get the next item from the iterator, following the iterator protocol.
This function may contains `non interruptible` clauses which must
be atomically evaluated before preemption occurs.
Returns: A set of solution mappings, or `None` if none was produced during this call.
Throws: `StopAsyncIteration` if the iterator cannot produce more items.
"""
if not self.has_next():
raise StopAsyncIteration()
triple = next(self._source)
self._progress+=1
if triple is None:
return None
return selection(triple, self._variables)
def save(self) -> SavedScanIterator:
"""Save and serialize the iterator as a Protobuf message"""
saved_scan = SavedScanIterator()
triple = TriplePattern()
triple.subject = self._triple['subject']
triple.predicate = self._triple['predicate']
triple.object = self._triple['object']
triple.graph = self._triple['graph']
saved_scan.triple.CopyFrom(triple)
saved_scan.last_read = self._source.last_read()
saved_scan.cardinality = self._cardinality
saved_scan.progress = self._progress
return saved_scan
| {"hexsha": "7f138bf6f278c99fbec66c63a011a6bad1a8acea", "size": 3385, "ext": "py", "lang": "Python", "max_stars_repo_path": "sage/query_engine/iterators/scan.py", "max_stars_repo_name": "JulienDavat/sage-engine", "max_stars_repo_head_hexsha": "87fb7075a07395a527da660d5efc056b0f49758c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "sage/query_engine/iterators/scan.py", "max_issues_repo_name": "JulienDavat/sage-engine", "max_issues_repo_head_hexsha": "87fb7075a07395a527da660d5efc056b0f49758c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "sage/query_engine/iterators/scan.py", "max_forks_repo_name": "JulienDavat/sage-engine", "max_forks_repo_head_hexsha": "87fb7075a07395a527da660d5efc056b0f49758c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2020-05-09T10:06:56.000Z", "max_forks_repo_forks_event_max_datetime": "2020-05-09T10:06:56.000Z", "avg_line_length": 37.1978021978, "max_line_length": 113, "alphanum_fraction": 0.6564254062, "include": true, "reason": "from sage", "num_tokens": 732} |
[STATEMENT]
theorem IK_nf_real_card:
shows "card ((\<lambda> f. f RRR) ` {f . IK_nf f}) = 7"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. card ((\<lambda>f. f RRR) ` {f. IK_nf f}) = 7
[PROOF STEP]
by (simp add: IK_nf_set) ((subst card_insert_disjoint; auto dest!: RRR_test simp: nf_RRR I_K id_def[symmetric] o_assoc)[1])+ | {"llama_tokens": 164, "file": "Kuratowski_Closure_Complement_KuratowskiClosureComplementTheorem", "length": 1} |
#include "text/csv/iterator.hpp"
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <boost/test/unit_test.hpp>
using text::csv::row_range;
using text::csv::map_row_range;
static const std::string NUMERIC_DATA = "1,2,3\n4,5,6";
BOOST_AUTO_TEST_SUITE(csv_ranges)
BOOST_AUTO_TEST_CASE(numeric_row_range_test) {
std::istringstream in(NUMERIC_DATA);
std::vector<std::vector<std::string> > grid(2);
grid[0].push_back("1");
grid[1].push_back("4");
grid[0].push_back("2");
grid[1].push_back("5");
grid[0].push_back("3");
grid[1].push_back("6");
row_range range(in);
std::size_t i = 0;
for (row_range::iterator r = range.begin(), e = range.end(); r != e; ++r) {
for (std::size_t j = 0; j < grid[i].size(); ++j) {
BOOST_CHECK_EQUAL(grid[i][j], (*r)[j]);
}
++i;
}
BOOST_CHECK_EQUAL(i, grid.size());
}
BOOST_AUTO_TEST_CASE(map_row_range_test) {
const char *const values[] = { "1", "2", "3", "4", "5", "6" };
std::istringstream in("x,y,z\n1,2,3\n4,5,6");
map_row_range range(in);
std::size_t i = 0;
for (map_row_range::iterator r = range.begin(), e = range.end(); r != e;
++r) {
BOOST_CHECK_EQUAL(values[i++], (*r)["x"]);
BOOST_CHECK_EQUAL(values[i++], (*r)["y"]);
BOOST_CHECK_EQUAL(values[i++], (*r)["z"]);
}
BOOST_CHECK_EQUAL(sizeof values / sizeof values[0], i);
}
BOOST_AUTO_TEST_SUITE_END()
| {"hexsha": "94af67666978d758df7d5ebe104ab706db084b1d", "size": 1477, "ext": "cpp", "lang": "C++", "max_stars_repo_path": "test/test_ranges.cpp", "max_stars_repo_name": "ferdymercury/text-csv", "max_stars_repo_head_hexsha": "08e0657137497c740c4022bdfae37c70310a9f8e", "max_stars_repo_licenses": ["BSL-1.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/test_ranges.cpp", "max_issues_repo_name": "ferdymercury/text-csv", "max_issues_repo_head_hexsha": "08e0657137497c740c4022bdfae37c70310a9f8e", "max_issues_repo_licenses": ["BSL-1.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/test_ranges.cpp", "max_forks_repo_name": "ferdymercury/text-csv", "max_forks_repo_head_hexsha": "08e0657137497c740c4022bdfae37c70310a9f8e", "max_forks_repo_licenses": ["BSL-1.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.375, "max_line_length": 79, "alphanum_fraction": 0.5971563981, "num_tokens": 436} |
#!/usr/bin/env python
import roslib; roslib.load_manifest('rover_driver_base')
import rospy
from std_msgs.msg import Float64
from sensor_msgs.msg import JointState
from geometry_msgs.msg import Twist,Pose
from math import atan2, hypot, pi, cos, sin
import tf
import message_filters
import numpy
from numpy.linalg import pinv
from rover_driver_base.rover_kinematics import *
class RoverDriver:
def __init__(self,name):
self.name = name
rospy.init_node('rover_driver')
self.name = rospy.get_param("~rover_name",self.name)
self.skidsteer = rospy.get_param("~skidsteer",False)
self.check_timeout = rospy.get_param("~check_timeout",True)
rospy.loginfo("Starting rover driver for rover '%s'" % self.name)
self.last_cmd = rospy.Time.now()
self.listener = tf.TransformListener()
self.steering_pub={}
self.drive_pub={}
self.ready = False
self.kinematics = RoverKinematics()
self.twist_sub = rospy.Subscriber('~twistCommand', Twist, self.twist_cb)
# print "Initialising wheel data structure"
for k in prefix:
self.steering_pub[k] = rospy.Publisher("/vrep/%s/%sSteerCommand" % (self.name,k), Float64, queue_size=1)
self.drive_pub[k] = rospy.Publisher("/vrep/%s/%sDriveCommand" % (self.name,k), Float64, queue_size=1)
def twist_cb(self,twist):
if not self.ready:
return
# print "Got twist: " + str(twist)
self.last_cmd = rospy.Time.now()
# Get the pose of all drives
drive_cfg={}
for k in prefix:
# try:
# self.listener.waitForTransform('/%s/ground'%(self.name),
# '/%s/%sDrive'%(self.name,k), self.last_cmd, rospy.Duration(1.0))
((x,y,z),rot) = self.listener.lookupTransform('/%s/ground'%(self.name),
'/%s/%sDrive'%(self.name,k), rospy.Time(0))
drive_cfg[k] = DriveConfiguration(self.radius[k],x,y,z)
# except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException):
# return
# Now compute for each drive, its rotation speed and steering angle
motors = self.kinematics.twist_to_motors(twist,drive_cfg,self.skidsteer)
self.publish(motors)
def publish(self, motor):
for k in prefix:
self.drive_pub[k].publish(Float64(motor.drive[k]))
self.steering_pub[k].publish(Float64(motor.steering[k]))
def run(self):
timeout = True
rate = rospy.Rate(10)
rospy.loginfo("Waiting for initial transforms")
rospy.sleep(1.0)
self.radius={}
for k in prefix:
try:
self.listener.waitForTransform('/%s/ground'%(self.name),
'/%s/%sDrive'%(self.name,k), rospy.Time(0), rospy.Duration(5.0))
((x,y,z),rot) = self.listener.lookupTransform('/%s/ground'%(self.name),
'/%s/%sDrive'%(self.name,k), rospy.Time(0))
self.radius[k] = z
rospy.loginfo("Got transform for " + k)
except tf.Exception,e:
rospy.logerr("TF exception: " + repr(e))
self.ready = True
while not rospy.is_shutdown():
if self.check_timeout:
if (rospy.rostime.get_time() - self.last_cmd.to_sec()) < 0.5:
if timeout:
timeout = False
rospy.loginfo("Accepting joystick commands")
else:
if not timeout:
timeout = True
rospy.loginfo("Timeout: ignoring joystick commands")
motors = RoverMotors()
self.publish(motors)
rate.sleep()
if __name__ == '__main__':
try:
rd = RoverDriver("rover")
rd.run()
except rospy.ROSInterruptException:
pass
| {"hexsha": "a1d7cec41d705049885f4a5ed84bb96afd71755b", "size": 3990, "ext": "py", "lang": "Python", "max_stars_repo_path": "src/rover_driver_base/nodes/rover_command.py", "max_stars_repo_name": "Thanusan19/catkin_ws", "max_stars_repo_head_hexsha": "c8622a48a29b9aabe17d86074c6005c45b2f58ca", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/rover_driver_base/nodes/rover_command.py", "max_issues_repo_name": "Thanusan19/catkin_ws", "max_issues_repo_head_hexsha": "c8622a48a29b9aabe17d86074c6005c45b2f58ca", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/rover_driver_base/nodes/rover_command.py", "max_forks_repo_name": "Thanusan19/catkin_ws", "max_forks_repo_head_hexsha": "c8622a48a29b9aabe17d86074c6005c45b2f58ca", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2016-08-08T23:48:36.000Z", "max_forks_repo_forks_event_max_datetime": "2016-08-08T23:48:36.000Z", "avg_line_length": 38.7378640777, "max_line_length": 116, "alphanum_fraction": 0.5766917293, "include": true, "reason": "import numpy,from numpy", "num_tokens": 917} |
from maindash import server
import dash_html_components as html
from stream_analysis.motion_detection.model_dash_integration import Detector, gen
from flask import Response
import os
import numpy as np
import cv2
@server.route('/video_feed')
def video_feed():
# Find paths to model weights, model, and class names
current_path = str(os.getcwd())
weights_path = current_path + r'\src\stream_analysis\motion_detection\weights\last.pt'
model_path = current_path + r'\src\stream_analysis\motion_detection\cfg\yolov3-tiny.cfg'
names_path = current_path + r'\src\stream_analysis\motion_detection\data_new\names.name'
# Initiate generator
a = gen(Detector(weights_path, model_path, names_path, 'cpu', '0'))
# Return Flask response
return Response(a, mimetype='multipart/x-mixed-replace; boundary=frame')
# Wrap feed into HTML element
def serve_feed():
return html.Img(src="/video_feed")
| {"hexsha": "5d2a4eb41bfe16ad03484356b40a01075e1b4fb3", "size": 930, "ext": "py", "lang": "Python", "max_stars_repo_path": "src/frontend/detection_stream.py", "max_stars_repo_name": "MLStruckmann/formula-frankfurt", "max_stars_repo_head_hexsha": "5a09f6ed02805c1dd5cfa42e82f9e396f52f9001", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/frontend/detection_stream.py", "max_issues_repo_name": "MLStruckmann/formula-frankfurt", "max_issues_repo_head_hexsha": "5a09f6ed02805c1dd5cfa42e82f9e396f52f9001", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/frontend/detection_stream.py", "max_forks_repo_name": "MLStruckmann/formula-frankfurt", "max_forks_repo_head_hexsha": "5a09f6ed02805c1dd5cfa42e82f9e396f52f9001", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2020-09-30T14:55:36.000Z", "max_forks_repo_forks_event_max_datetime": "2020-09-30T14:55:36.000Z", "avg_line_length": 33.2142857143, "max_line_length": 92, "alphanum_fraction": 0.7591397849, "include": true, "reason": "import numpy", "num_tokens": 221} |
import math
import torch
import numpy as np
import utils.image_processing as ip
import utils.torch_complex as tc
import torch.fft as fft
def ASM_precal(slm_res, pix_pitch, wavelength, prop_dist, device,
linear_conv=True, dtype=torch.float64):
input_resolution = slm_res
if linear_conv:
input_resolution = [i * 2 for i in input_resolution]
num_y, num_x = input_resolution[0], input_resolution[1]
dy, dx = pix_pitch[0], pix_pitch[1]
x, y = dx * num_x, dy * num_y
xx = np.linspace(-(num_x / 2), num_x / 2, num_x)
yy = np.linspace(-(num_y / 2), num_y / 2, num_y)
fy = yy / y
fx = xx / x
FX, FY = np.meshgrid(fx, fy)
H_angle = 2 * np.pi * np.sqrt(1 / wavelength ** 2 - (FX ** 2 + FY ** 2))
H_angle_z = H_angle * prop_dist
# Band-Limited Angular Spectrum Method for Numerical Simulation of Free-Space Propagation in Far and Near Fields
# - Kyoji Matsushima and Tomoyoshi Shimobaba (2009)
fy_max = 1. / np.sqrt((2 * prop_dist * (1. / y)) ** 2 + 1) // wavelength
fx_max = 1. / np.sqrt((2 * prop_dist * (1. / x)) ** 2 + 1) // wavelength
H_amp = (abs(FX) < fx_max) & (abs(FY) < fy_max)
trans_f = np.fft.ifftshift(np.multiply(H_amp, np.exp(1j * H_angle_z)))
trans_b = np.fft.ifftshift(np.multiply(H_amp, np.exp(-1j * H_angle_z)))
tensor_trans_f = tc.np2tensor_complex(trans_f)
tensor_trans_b = tc.np2tensor_complex(trans_b)
return tensor_trans_f.to(device), tensor_trans_b.to(device)
def ASM_prop(slm_field, linear_conv, tensor_trans):
if linear_conv:
# preprocess with padding for linear conv.
input_resolution = torch.tensor(slm_field.size())
conv_size = torch.multiply(input_resolution, 2)
padval = 0
u_in = ip.img_pad(slm_field, conv_size, padval)
else:
input_resolution = slm_field.size()
u_in = slm_field
H = tensor_trans
U1 = fft.fftn(tc.torch_ifftshift(u_in)) # angular spectrum
U2 = H * U1 # system convolution
u_out = tc.torch_fftshift(fft.ifftn(U2)) # Fourier transform of the convolution to the observation plane
if linear_conv:
return ip.img_crop(u_out, input_resolution)
else:
return u_out
| {"hexsha": "bb47732edacfe83403f5e6a018ce4bf080368a19", "size": 2220, "ext": "py", "lang": "Python", "max_stars_repo_path": "propMethods/asm.py", "max_stars_repo_name": "fy255/perceptual_cgh", "max_stars_repo_head_hexsha": "71a999a8ca8fb355d2f8fb41f97321e48f219324", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2022-02-24T16:19:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-27T01:13:33.000Z", "max_issues_repo_path": "propMethods/asm.py", "max_issues_repo_name": "fy255/perceptual_cgh", "max_issues_repo_head_hexsha": "71a999a8ca8fb355d2f8fb41f97321e48f219324", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "propMethods/asm.py", "max_forks_repo_name": "fy255/perceptual_cgh", "max_forks_repo_head_hexsha": "71a999a8ca8fb355d2f8fb41f97321e48f219324", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-03-27T01:13:34.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-27T01:13:34.000Z", "avg_line_length": 37.6271186441, "max_line_length": 116, "alphanum_fraction": 0.6594594595, "include": true, "reason": "import numpy", "num_tokens": 653} |
#!/usr/bin/env python3
# (c) University of the Witwatersand, Johannesburg on behalf of the H3ABioinformatics Network Consortium
# 2016-2018
# Licensed under the Creative Commons Attribution 4.0 International Licence.
# See the "LICENSE" file for details
import sys
import pandas as pd
import numpy as np
EOL=chr(10)
def check_missing(x):
if x in ["NA","na","null","-9"] or ((type(x)==type("x")) and (len(x)<1)) or x==-9 or x==r"\N" or x=="-":
return "NA"
else:
return x
def errorMessage10(phe):
print("""
A problem has been detected in file <%s> column <%s>.
There is some invalid data. I regret I can't tell you which row.
Please check -- the data should be numeric only.
If there is missing data, please use NA
"""%(sys.argv[1],phe))
dataf = pd.read_csv(sys.argv[1],delim_whitespace=True)
columns = dataf.columns
pheno_labels_0 = sys.argv[2].split(",")
pheno_labels = ["FID","IID"]
if "FID" not in columns or "IID" not in columns:
sys.exit(EOL*3+"It is mandatory for FID IID to be columns of the file %s"%sys.argv[1]+EOL*3)
for lab in pheno_labels_0:
det = lab.split("/")
phe = det[0]
if phe not in columns:
sys.exit((EOL*3+"<%s> given as phenotype, but is not a column of the file <%s>"+EOL+EOL)%(phe,sys.argv[1]))
if len(det)>1:
fn = eval(det[1])
try:
dataf[det[0]]=fn(dataf[phe])
except:
errorMessage10(phe)
sys.exit(10)
pheno_labels.append(phe)
dataf[phe]=dataf[phe].apply(check_missing)
dataf[pheno_labels].to_csv(sys.argv[3],na_rep="-9",sep=chr(9),index=False,header=True)
| {"hexsha": "500d6ad02093dc59a30115a28848cfc2e5fe7682", "size": 1649, "ext": "py", "lang": "Python", "max_stars_repo_path": "assoc/bin/extractPheno.py", "max_stars_repo_name": "lvclark/h3agwas", "max_stars_repo_head_hexsha": "5e42e60123b819d3c331a91b25ee50846e55af3b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 62, "max_stars_repo_stars_event_min_datetime": "2016-08-29T11:27:35.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-10T17:16:14.000Z", "max_issues_repo_path": "assoc/bin/extractPheno.py", "max_issues_repo_name": "lvclark/h3agwas", "max_issues_repo_head_hexsha": "5e42e60123b819d3c331a91b25ee50846e55af3b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 33, "max_issues_repo_issues_event_min_datetime": "2016-12-26T13:48:19.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-05T13:34:06.000Z", "max_forks_repo_path": "assoc/bin/extractPheno.py", "max_forks_repo_name": "lvclark/h3agwas", "max_forks_repo_head_hexsha": "5e42e60123b819d3c331a91b25ee50846e55af3b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 50, "max_forks_repo_forks_event_min_datetime": "2017-04-15T04:17:43.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T07:26:01.000Z", "avg_line_length": 26.1746031746, "max_line_length": 115, "alphanum_fraction": 0.636143117, "include": true, "reason": "import numpy", "num_tokens": 491} |
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import re
import nltk
import pickle
from nltk.corpus import stopwords
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.tokenize import word_tokenize
from sklearn.feature_extraction.text import CountVectorizer
from sqlalchemy import create_engine
from sklearn.feature_extraction.text import TfidfTransformer,TfidfVectorizer
from sklearn.ensemble import RandomForestClassifier
from sklearn.multioutput import MultiOutputClassifier
from sklearn.pipeline import Pipeline
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.metrics import classification_report,precision_score
def load_data(database_filepath):
'''
This function loads the data from the database and output the features and target
Input:
database_filepath: OS location for sqlite database
Output:
X: Message
y: Categories
colnames: Category Labels
'''
engine = create_engine('sqlite:///' + database_filepath)
df = pd.read_sql_query("select * from messages ", engine)
X = df.message.values
y = df.iloc[:,4:40].values
colnames = df.iloc[:,4:40].columns
return X,y, colnames
def tokenize(text):
text = re.sub(r"[^a-zA-Z0-9]", " ", text.lower())
# tokenize text
tokens = word_tokenize(text)
lemmatizer = WordNetLemmatizer()
# lemmatize and remove stop words
#stop_words = stopwords.words("english")
#tokens = [lemmatizer.lemmatize(word) for word in tokens if word not in stop_words]
clean_tokens = []
for tok in tokens:
clean_tok = lemmatizer.lemmatize(tok).lower().strip()
clean_tokens.append(clean_tok)
return clean_tokens
def build_model():
'''
Build the ML pipeline
Input:
Output:
GridSearchCV pipleline
'''
pipeline = Pipeline([
('vect', CountVectorizer(tokenizer=tokenize)),
('tfidf', TfidfTransformer()),
('clf', MultiOutputClassifier(RandomForestClassifier(), n_jobs=-1))
])
parameters = {'clf__estimator__n_estimators': [50,100],
'clf__estimator__criterion': ['entropy', 'gini']
}
model_cv = GridSearchCV(pipeline, param_grid=parameters)
return model_cv
def evaluate_model(model, X_test, Y_test, category_names):
'''
Function to evaluate the ML model.
Input:
model: Machine learning model
X_test: test features( Messages)
Y_test: test target lables (Categories)
category_names: Category Labels
Output:
print the f1 score, precision and recall for each category
'''
y_pred = model.predict(X_test)
for idx,val in enumerate(category_names):
print("Category:", val,"\n", classification_report(Y_test[:, idx], y_pred[:, idx]))
def save_model(model, model_filepath):
'''
Input:
model: The trained model to be saved to disk.
model_filepath: model store location on Disk
'''
# save the model to disk
pickle.dump(model, open(model_filepath, 'wb'))
def main():
if len(sys.argv) == 3:
database_filepath, model_filepath = sys.argv[1:]
print('Loading data...\n DATABASE: {}'.format(database_filepath))
X, Y, category_names = load_data(database_filepath)
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2)
print('Building model...')
model = build_model()
print('Training model...')
model.fit(X_train, Y_train)
print('Evaluating model...')
evaluate_model(model, X_test, Y_test, category_names)
print('Saving model...\n MODEL: {}'.format(model_filepath))
save_model(model, model_filepath)
print('Trained model saved!')
else:
print('Please provide the filepath of the disaster messages database '\
'as the first argument and the filepath of the pickle file to '\
'save the model to as the second argument. \n\nExample: python '\
'train_classifier.py ../data/DisasterResponse.db classifier.pkl')
if __name__ == '__main__':
main() | {"hexsha": "4835435c67c5e815deb6b1e999da1088750d028b", "size": 4354, "ext": "py", "lang": "Python", "max_stars_repo_path": "models/train_classifier.py", "max_stars_repo_name": "tobikasali/Disaster_response_pipleine", "max_stars_repo_head_hexsha": "aee12fc6ca27486490a5d90f7267740e4f7d6f1c", "max_stars_repo_licenses": ["FTL"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "models/train_classifier.py", "max_issues_repo_name": "tobikasali/Disaster_response_pipleine", "max_issues_repo_head_hexsha": "aee12fc6ca27486490a5d90f7267740e4f7d6f1c", "max_issues_repo_licenses": ["FTL"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "models/train_classifier.py", "max_forks_repo_name": "tobikasali/Disaster_response_pipleine", "max_forks_repo_head_hexsha": "aee12fc6ca27486490a5d90f7267740e4f7d6f1c", "max_forks_repo_licenses": ["FTL"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.619047619, "max_line_length": 103, "alphanum_fraction": 0.6566375746, "include": true, "reason": "import numpy", "num_tokens": 964} |
def split_space_data(
X_normalized,
X,
Y,
file_path,
observation_number,
test_size
):
'''Seperate the data in a stratified way.
The function takes in a few different datasets, where the indices of each are aligned to be of the
same object.
| X_normalized | X | Y | file_path | observation_number |
|---------------------|----------|----------|------------------|---------------------------|
| obj_0_X_normalized | obj_0_X | obj_0_Y | obj_0_file_path | obj_0_observation_number |
| obj_42_X_normalized | obj_42_X | obj_42_Y | obj_42_file_path | obj_42_observation_number |
It is important to make sure that the split data is stratified. Stratification means that if there
is multiple classes in our dataset, then when we split our data the classes are make up a similar
balance as when they were in the full data set.
An example is: Our full dataset is 60% dogs and 40% cats. When we split our data into a training set
and a test set, each set is still made of 60% dogs and 40% cats (or as close to this split as possible).
'''
from sklearn.model_selection import StratifiedShuffleSplit
# Create the helper object
sss = StratifiedShuffleSplit(
n_splits=1,
test_size=test_size
)
# Generate the indecis
train_index, test_index = next(sss.split(X_normalized, Y))
# Shuffle and split the data
X_normalized_train, X_normalized_test = X_normalized[train_index], X_normalized[test_index]
X_train, X_test = X[train_index], X[test_index]
Y_train, Y_test = Y[train_index], Y[test_index]
file_path_train, file_path_test = file_path[train_index], file_path[test_index]
observation_number_train, observation_number_test = observation_number[train_index], observation_number[test_index]
return (
X_normalized_train,
X_train,
Y_train,
file_path_train,
observation_number_train
), (
X_normalized_test,
X_test,
Y_test,
file_path_test,
observation_number_test
)
def metrics(outputs, labels, threshold=0.5):
'''Gets all metrics that we need for model comparison.
Throughout the paper they talk about 2 main metrics: False Positive Rate (FPR) and Missed Detection
Rate (MDR). We get these by calculating
True Positive: The number of times we said a supernova EXISTS and it DID
False Positive: The number of times we said a supernova EXISTS and it DID NOT
True Negative: The number of times we said a supernova DID NOT EXISTS and it DID NOT
False Negative: The number of times we said a supernova DID NOT EXISTS and it DID
'''
# Set the predicions to either 0 or 1 based on the given threshold
predictions = outputs >= (1 - threshold)
# Set the indices to either 0 or 1 based on the metric we are checking
true_positive_indices = (predictions == 0.) * (labels == 0)
false_positive_indices = (predictions == 0.) * (labels == 1)
true_negative_indices = (predictions == 1.) * (labels == 1)
false_negative_indices = (predictions == 1.) * (labels == 0)
# Get the total count for each metric we are checking
true_positive_count = true_positive_indices.sum()
false_positive_count = false_positive_indices.sum()
true_negative_count = true_negative_indices.sum()
false_negative_count = false_negative_indices.sum()
# Calculate and store the FPR and MDR in a dictionary for convenience
fpr_and_mdr = {
'MDR': false_negative_count / (true_positive_count + false_negative_count),
'FPR': false_positive_count / (true_negative_count + false_positive_count)
}
return fpr_and_mdr
def get_metrics(outputs, labels, with_acc=True):
'''Get all metrics for all interesting thresholds.
In the paper there is focus on 3 main thresholds -- 0.4, 0.5, and 0.6. We check
To make sure we are all on the same page, a threshold is basically a boundry that dictates what decision
the model is making. This happens because a models output is a float between 0 and 1. If a model outputs
0.42 we have to decide what that actually means. With a threshold of 0.4, a 0.42 would be pushed to a 1; where
a threshold of 0.5 would push it to a 0.
'''
import numpy as np
all_metrics = {}
# FPR and MDR 0.4
temp = metrics(outputs, labels, threshold=0.4)
all_metrics["FALSE_POSITIVE_RATE_4"] = temp["FPR"]
all_metrics["MISSED_DETECTION_RATE_4"] = temp["MDR"]
# FPR and MDR 0.5
temp = metrics(outputs, labels, threshold=0.5)
all_metrics["FALSE_POSITIVE_RATE_5"] = temp["FPR"]
all_metrics["MISSED_DETECTION_RATE_5"] = temp["MDR"]
# FPR and MDR 0.6
temp = metrics(outputs, labels, threshold=0.6)
all_metrics["FALSE_POSITIVE_RATE_6"] = temp["FPR"]
all_metrics["MISSED_DETECTION_RATE_6"] = temp["MDR"]
# Summed FPR and MDR
all_metrics["FALSE_POSITIVE_RATE"] = all_metrics["FALSE_POSITIVE_RATE_4"] + all_metrics["FALSE_POSITIVE_RATE_5"] + all_metrics["FALSE_POSITIVE_RATE_6"]
all_metrics["MISSED_DETECTION_RATE"] = all_metrics["MISSED_DETECTION_RATE_4"] + all_metrics["MISSED_DETECTION_RATE_5"] + all_metrics["MISSED_DETECTION_RATE_6"]
# The true sum
all_metrics["PIPPIN_METRIC"] = all_metrics["FALSE_POSITIVE_RATE"] + all_metrics["MISSED_DETECTION_RATE"]
# Accuracy
if with_acc:
predictions = np.around(outputs).astype(int)
all_metrics["ACCURACY"] = (predictions == labels).sum() / len(labels)
return all_metrics
def create_result_csv(user_params, model_params, metrics, extra_dict=None, file_name="results.csv"):
'''Format information to be stored and write to a CSV on disk.
This function is used for record keeping of model experiments that have been run. Each header listed in
csv_header_order are the pieces of information that we care about when comparing models. Each row of the
CSV becomes a record for specific experiment where we can then use Pandas Dataframes or Excel to sort and
compare models.
'''
import pandas as pd
import os
# Define results file
results_file = file_name
# Dictionary to be turned into a CSV
csv_dict = {}
# Set the important columns in a set order
csv_header_order = [
"INITIALS",
"MODEL_DESCRIPTION",
"VERSION",
"FALSE_POSITIVE_RATE_4",
"MISSED_DETECTION_RATE_4",
"FALSE_POSITIVE_RATE_5",
"MISSED_DETECTION_RATE_5",
"FALSE_POSITIVE_RATE_6",
"MISSED_DETECTION_RATE_6",
"FALSE_POSITIVE_RATE",
"MISSED_DETECTION_RATE",
"PIPPIN_METRIC",
"ACCURACY",
"NUMBER_OF_FILTERS_1",
"NUMBER_OF_FILTERS_2",
"NUMBER_OF_FILTERS_3",
"NUMBER_OF_FILTERS_4",
"LEARNING_RATE",
"BATCH_SIZE",
"NUMBER_OF_EPOCHS",
"NUMBER_OF_FILTERS",
"POOL_SIZE",
"KERNAL_SIZE",
"NUMBER_OF_LAYERS",
"DROPOUT_PERCENT",
"FPR_ALPHA",
"MDR_ALPHA",
"DENSE_LAYER_SHAPES"
]
# Loop through headers and create the dictionary
for header in csv_header_order:
# Check where the header is
if header in metrics.keys():
csv_dict[header] = str(metrics[header])
elif header in user_params.keys():
csv_dict[header] = str(user_params[header])
elif header in model_params.keys():
csv_dict[header] = str(model_params[header])
# Turn the current data to a Dataframe
updated_df = pd.DataFrame(csv_dict, index=[0])
# Check if a CSV already exists so we can add the current experiment to the previously logged ones
if os.path.isfile(results_file):
df = pd.read_csv(results_file)
updated_df = pd.concat([df, updated_df])
# Write the CSV to disk
updated_df.to_csv(results_file, index=False)
return updated_df
| {"hexsha": "39f2d00432c79f254443c58516795af776d8b242", "size": 8201, "ext": "py", "lang": "Python", "max_stars_repo_path": "cnn-model/space_utils.py", "max_stars_repo_name": "dessa-oss/supernova-classifier", "max_stars_repo_head_hexsha": "f9ac4cbdd7fd4d6294eb215555a1d380cb8dee02", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2020-03-17T18:55:47.000Z", "max_stars_repo_stars_event_max_datetime": "2020-05-26T00:54:09.000Z", "max_issues_repo_path": "cnn-model/space_utils.py", "max_issues_repo_name": "dessa-oss/supernova-classifier", "max_issues_repo_head_hexsha": "f9ac4cbdd7fd4d6294eb215555a1d380cb8dee02", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "cnn-model/space_utils.py", "max_forks_repo_name": "dessa-oss/supernova-classifier", "max_forks_repo_head_hexsha": "f9ac4cbdd7fd4d6294eb215555a1d380cb8dee02", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2020-05-25T19:50:10.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-20T20:38:28.000Z", "avg_line_length": 39.0523809524, "max_line_length": 163, "alphanum_fraction": 0.6610169492, "include": true, "reason": "import numpy", "num_tokens": 2021} |
# -*- coding: utf-8 -*-
"""Boilerplate:
Created on Tue Feb 16 18:54:55 2021
@author: Timothe
"""
import os,sys,inspect
import warnings
from datetime import datetime
from fileio import ConfigFile
from structs import TwoLayerDict
import pathes
try :
import numpy as np
except TypeError as e :
warnings.warn("numpy installation was not detected, some functions from workflow module will be deactivated")
np = e
# @dataclass
# class Point:
# x: float
# y: float
# z: float = 0.0
def get_currentfile_git_repo_metadata(input_path = None):
if input_path is None :
input_path = inspect.stack()[1][1]
if 'ipython' in input_path and input_path[0] == '<':
raise NameError("cannot get file path of current executed script from a jupyter call; ")
import git
try :
repo = git.Repo(input_path, search_parent_directories=True)
except git.InvalidGitRepositoryError :
warnings.warn(f"No git repository was found here or upstream : {input_path}")
return None
repo_data = {"file_called" : input_path,"path_on_disk":repo.git_dir, "name":repo.remotes.origin.url.split('.git')[0].split('/')[-1], "branch": repo.active_branch.name, "author": repo.remotes.origin.url.split('.git')[0].split('/')[-2], "commit": repo.active_branch.commit.hexsha, "commiter": repo.active_branch.commit.committer.name, "commiter_email": repo.active_branch.commit.committer.email}
return repo_data
class CachedVariables(ConfigFile):
def _get_outside_caller_info(self):
"""
Iteratively scans the caller's parents and stops at first encounter of a function coming from another file than this one (the deepest outside caller)
Returns it' file name and the function that "asked" for a raise if a module wasn't present.
Returns:
dict
"""
start_depth = 2
for depth in range(start_depth,len(inspect.stack())):
#fullpath = inspect.stack()[depth][1]
fullpath = inspect.stack()[depth][0].f_code.co_filename
if not "__packages__" in fullpath:
try :#If caller is a classmethod
caller_object = str(inspect.stack()[depth][0].f_locals["self"].__class__.__name__)+'.'+str(inspect.stack()[depth][0].f_code.co_name)
except KeyError :#if caller is a simple function
caller_object = str(inspect.stack()[depth][3])
return { "caller_function_name" : caller_object, "caller_file_name" : fullpath}
return { "caller_function_name" : "unknown", "caller_file_name" : "unknown"}
def _add_meta_section(self,description):
self._section = "meta"
self._enter_var_init
self["creator_full_path"]= inspect.stack()[2][1]
self._enter_var_init
try :#If caller is a classmethod
self["creator_object"] = str(inspect.stack()[2][0].f_locals["self"].__class__.__name__)+'.'+str(inspect.stack()[2][0].f_code.co_name)
except KeyError :#if caller is a simple function
self["creator_object"] = inspect.stack()[2][3]
self._enter_var_init
self["creation_date"] = datetime.now().strftime("%y-%m-%d %H:%M:%S")
self._enter_var_init
self["description"] = description if description is not None else None
self._section = "current"
def _add_readme_section(self):
self._section = "readme"
self._enter_var_init
self["help_section_current"] ="The current section contains the values of variables last used or currentely in use."
self._enter_var_init
self["help_section_meta"] = "The meta section contains information for you, reader, to determine if the file can be removed (very old last_used date) and by wich program it was used (caller_full_path and caller_object)"
self._enter_var_init
self["help_section_date#name"] = "The sections with names composed of a [date#name] are sections that contains saved cached variables values and that can be retrieved back in the current section by calling `retrieve` with a name or a date."
self._section = "current"
def __init__(self, **kwargs):
"""
Handle file and ram representation of user selected current working variables
that needs to be saved to later execution sessions, to improve work efficiency
and user experience, mainly intended to use with GUI work variables.
Args:
**kwargs (optionnal):
- description (`str`):
- cache_dir_path (`str`):
path to the .ini file if you wish to save it in a custom location.
By default, it will be saved in the pGenUtils package, inside the __varcache__ folder.
- distinguisher (`str`):
Warning :
Advanced user
If you wish to have the ability to have several variables caches configurations
for a class implementing a CachedVariables object, and if that class is called from several functions,
you will need to disambiguate the .ini file with such distinguisher.
Question:
TODO
Add the ability to simply roll back the caller to the top,
so the user doesn't have to specify itself subjective distinguisher
strings in the code depending on if it has been called from here or there.
Returns:
CachedVariables : An instance of the class
Info:
how to use inspect:
```python
import inspect
inspect.stack first index content :
inspect.stack()[0] #callee
inspect.stack()[1] #caller
inspect.stack()[2] #caller's caller etc
#inspect.stack second index content, for the caller in that case
frame,filename,line_number,function_name,lines,index = inspect.stack()[1][1]
```
"""
"""
Cache section to use for a given script (to separate variables used
for different scripts in the same cache file).
cache_filename : str, optional
Optionnal filename. The default is "saved_cache.vars".
Can contain only the filename, and supply the folder
in cache_dir_path, or can contain the whole concatenated path.
In that case, leave the parameter cache_dir_path to None.
cache_dir_path : str, optional
The default is None.
If None, the path is automatically set to the __varcache__ folder
inside the main library folder.
Returns
-------
cached_execution_variables object.
Available methods bound to that object :
- individual key getters and setters :
( value = object["item"] or bject["item"] = value )
that will automatically resolve if the kei is available in ram
or fetch it on .vars file attached to the object.
- pull() :
fetches all available variables in section in attached file
to the ram. Can be usefull at start if all variables are necessary,
to avoid loading them individually.
- fetch(key) :
updates the ram of unique or list of keys supplied to the function
with values stored in the attached file.
Same as pull except if is selective to variables supplied by user.
- refresh() :
same as pull except it selective only to keys already
stored in ram (ie : keys already used during current session,
for efficiency purposes)
- push() :
updates or add values of all keys stored in ram to the attached file
"""
cache_dir_path = kwargs["cache_dir_path"] if kwargs.get("cache_dir_path") is not None else os.path.join(os.path.dirname(__file__), "__varcache__")
pathes.is_or_makedir(cache_dir_path)
name_distinguisher = "#" + kwargs["distinguisher"] if kwargs.get("distinguisher") is not None else ""
if not os.path.exists(cache_dir_path):
os.makedirs(cache_dir_path)
if name_distinguisher != "" :
name_distinguisher = '#' + name_distinguisher
if kwargs.get("cache_filename") is not None :
self._filename = kwargs["cache_filename"]
else :
self._filename = os.path.splitext( os.path.basename(inspect.stack()[1][1]) )[0] +"."+ inspect.stack()[1][3][1:-1] + name_distinguisher + ".ini"
self._dirname = cache_dir_path
self._fullpath = os.path.join(self._dirname,self._filename)
super().__init__(self._fullpath)
self._add_readme_section()
self._add_meta_section(kwargs.get("description",None))
self._section = "current"
#CheckConfigFile(self.fullpath, self.section)
#super().__init__()
@property
def _enter_var_init(self):
self._initializing_var_mode = True
@property
def _exit_var_init(self):
self._initializing_var_mode = False
@property
def _is_init(self):
if self._initializing_var_mode :
return True
return False
def _key_resolver(self,key):
if isinstance(key,(list,tuple)):
return key
return (self._section,key)
def __getitem__(self, key):
if self._is_init:
self._exit_var_init
return super().__getitem__(self._key_resolver(key))
def __setitem__(self, key, value):
setkey = True
if self._is_init :
try :
super().__getitem__(self._key_resolver(key))
setkey = False
except :
setkey = True
self._exit_var_init
if setkey :
super().__setitem__(self._key_resolver(key),value)
def _write_callback(self):
self._update_timestamp()
def _update_timestamp(self):
TwoLayerDict.__setitem__(self,("meta","last_used"),datetime.now().strftime("%y-%m-%d %H:%M:%S"))
call_info = self._get_outside_caller_info()
TwoLayerDict.__setitem__(self,("meta","last_caller_full_path"), call_info["caller_file_name"] )
TwoLayerDict.__setitem__(self,("meta","last_caller_objet"), call_info["caller_function_name"] )
@property
def init(self):
self._enter_var_init
return self
def set_working_section(self,section):
self._section = section
def save(self,section = None):
"""
"""
sel_section = self._section if section is None else section
backup_section = datetime.now().strftime("%y%m%d") + "#" + sel_section
for key in self[sel_section,:].keys():
self[backup_section,key] = self[sel_section,key]
self.pop((sel_section,slice(None,None,None)))
def retrieve(self,date=None,section = None):
"""
"""
sel_section = self._section if section is None else section
backup_section = self._find_most_recent_backup(sel_section) if date is None else date + "#" + sel_section
for key in self[backup_section,:].keys():
self[sel_section,key] = self[backup_section,key]
def _find_most_recent_backup(self,section):
dates = []
for sec in self.sections():
parts = sec.split("#")
if len(parts) == 1:
continue
if parts[1] == section:
dates.append(parts[0])
date = sorted(dates,key=lambda content : int(content),reverse = True)[0]
return date + "#" + section
def ProgressBarImage(Fraction):
try :
raise np("Numpy must be installed in order to use this function")
except TypeError :
pass
if Fraction == 1:
blue = np.zeros((10,100,3))
blue[:,:,2] = np.ones((10,100))
return(blue)
elif Fraction == 0:
blue = np.zeros((10,100,3))
return(blue)
else:
blue = np.zeros((10,100,3))
blue[:,:,2] = np.ones((10,100))
blue[:,int(Fraction*100):,:] = np.ones((10,100-int(Fraction*100),3))
return(blue)
def sizeof_fmt(num, suffix='oct'):
''' by Fred Cirera, https://stackoverflow.com/a/1094933/1870254, modified'''
for unit in ['','K ','M ','G ','T ','P ','E ','Z ']:
if abs(num) < 1024.0:
return "%3.1f %s%s" % (num, unit, suffix)
num /= 1024.0
return "%.1f %s%s" % (num, 'Yi', suffix)
def singleton(cls):
instances = {}
def getinstance(*args, **kwargs):
if cls not in instances or kwargs.get("regen",False) is True:
kwargs.pop("regen",None)
instances[cls] = cls(*args, **kwargs)
return instances[cls]
return getinstance
class classproperty(property):
def __get__(self, cls, owner):
return classmethod(self.fget).__get__(None, owner)()
if __name__ == "__main__" :
#parse_mkdocs_yml(test_path , "")
test = CachedVariables(description="This is a test description")
test.init["a_key"] = "vola"
test["a_key"] = "value"
test.init["a_key"] = "SHIT"
print(test["a_key"])
print(test["a_key"])
test["a_key"] = 1332
import numpy as np
test["another_key"] = np.array([[7,8],[4,1]])
print(test["a_key"])
test = np.zeros((1000,1000,100),dtype = np.float64)
sys.exit()
for name, size in sorted(((name, sys.getsizeof(value)) for name, value in globals().items()),key= lambda x: -x[1])[:]:
print("{:>30}: {:>8}".format(name, sizeof_fmt(size))) | {"hexsha": "b76a8d4767b5baa500398d0b06e4bc14686656c4", "size": 13864, "ext": "py", "lang": "Python", "max_stars_repo_path": "workflows.py", "max_stars_repo_name": "ShulzLab/pGenUtils", "max_stars_repo_head_hexsha": "084e83f7c1030553a3c1ba69525de8e52ca9b503", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "workflows.py", "max_issues_repo_name": "ShulzLab/pGenUtils", "max_issues_repo_head_hexsha": "084e83f7c1030553a3c1ba69525de8e52ca9b503", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2021-11-22T19:33:49.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-30T17:49:32.000Z", "max_forks_repo_path": "workflows.py", "max_forks_repo_name": "ShulzLab/pGenUtils", "max_forks_repo_head_hexsha": "084e83f7c1030553a3c1ba69525de8e52ca9b503", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-09-02T14:38:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-02T14:38:01.000Z", "avg_line_length": 38.1928374656, "max_line_length": 397, "alphanum_fraction": 0.6098528563, "include": true, "reason": "import numpy", "num_tokens": 3132} |
program main
use iso_c_binding
implicit none
block
use tcl
character(:), allocatable, target :: code
integer(c_int) rc
type(c_ptr) interp
interp = tcl_create_interp()
code = "puts foo" // achar(0)
rc = tcl_eval(interp, c_loc(code))
call tcl_delete_interp(interp)
end block
end program main
| {"hexsha": "72fd629ccec8a0c6b3d42c686dfb9df9fc3bf24c", "size": 336, "ext": "f90", "lang": "FORTRAN", "max_stars_repo_path": "tests/main.f90", "max_stars_repo_name": "dram/fortran-tcl", "max_stars_repo_head_hexsha": "c8ed977b565574b722f74531a41ddd38f2538335", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "tests/main.f90", "max_issues_repo_name": "dram/fortran-tcl", "max_issues_repo_head_hexsha": "c8ed977b565574b722f74531a41ddd38f2538335", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/main.f90", "max_forks_repo_name": "dram/fortran-tcl", "max_forks_repo_head_hexsha": "c8ed977b565574b722f74531a41ddd38f2538335", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 16.0, "max_line_length": 45, "alphanum_fraction": 0.6636904762, "num_tokens": 95} |
import pandas as pd
import numpy as np
from sklearn.cluster import DBSCAN
import more_itertools as mit
import multiprocessing as mp
from numba import njit
pd.options.mode.chained_assignment = None
@njit
def _distance_between_two_coordinates(lat1_degrees, lon1_degrees, lat2_degrees, lon2_degrees) -> float:
"""Distance in meters between two points given in coordinates using the haversine distance.
Args:
lat1_degrees (float): latitude of the first point in degrees.
lon1_degrees (float): longitude of the first point in degrees.
lat2_degrees (float): latitude of the second point in degrees.
lon2_degrees (float): longitude of the second point in degrees.
Returns:
float: distance in m between the two coordiantes.
"""
# approximate radius of earth in km
R = 6373.0
lat1 = np.deg2rad(lat1_degrees)
lon1 = np.deg2rad(lon1_degrees)
lat2 = np.deg2rad(lat2_degrees)
lon2 = np.deg2rad(lon2_degrees)
dlon = lon2 - lon1
dlat = lat2 - lat1
a = np.sin(dlat / 2) ** 2 + np.cos(lat1) * \
np.cos(lat2) * np.sin(dlon / 2) ** 2
c = 2 * np.arctan2(np.sqrt(a), np.sqrt(1 - a))
distance = R * c
return distance * 1000
def _create_route(df) -> pd.DataFrame:
"""Adds distance, time_delta, speed (m/s) and acceleration to the waypoints DataFrame
Args:
df (pandas.DataFrame): the waypoints DataFrame to be processed
Returns:
pandas.DataFrame: waypoints DataFrame with additional statistics: distance, time_delta, speed (m/s) and acceleration
"""
if df.shape[0] == 0:
return pd.DataFrame(columns=['tracked_at_start', 'latitude_start', 'longitude_start', 'tracked_at_end', 'latitude_end', 'longitude_end', 'distance', 'time_delta', 'speed', 'acceleration', 'detection'])
res = df.reset_index().merge(
df.shift(-1).dropna().reset_index(), # last row of shift is NA
on="index",
suffixes=("_start", "_end"),
)
res = res.drop(
columns=[
"index",
"user_id_start",
"user_id_end",
"accuracy_start",
"accuracy_end",
], errors='ignore'
)
res["distance"] = _distance_between_two_coordinates(
res.latitude_start.values,
res.longitude_start.values,
res.latitude_end.values,
res.longitude_end.values,
)
res["time_delta"] = res.tracked_at_end - res.tracked_at_start
res["time_delta"] = res["time_delta"].apply(
lambda x: x.total_seconds()
) # in seconds
res["speed"] = (
res["distance"] / res["time_delta"]
) # we want to have meters / seconds
# This will be necessary for mode detection
res["acceleration"] = res["speed"] / res["time_delta"]
return res
def _prepare_for_detection(df) -> pd.DataFrame:
"""Flags all detections as trips. By default, we are looking for activities so everything else is tagged as a trip.
Args:
df (pandas.DataFrame): Waypoints DataFrame to be flagged
Returns:
pandas.DataFrame: DataFrame with 'detection' column being 'trip'
"""
df["detection"] = "trip"
return df
def _activities_density(args) -> pd.DataFrame:
""" Detects activities by density
Args:
df (pandas.DataFrame):
clusterer (sklearn.cluster):
Returns:
pandas.DataFrame:
"""
df, clusterer = args
clusters_start = clusterer.fit_predict(
np.radians(df[["latitude_start", "longitude_start"]]))
df["cluster_start"] = clusters_start
df["cluster_end"] = df.cluster_start.shift(-1).fillna(0).astype('int')
# update the detection column: Whenever the clusters column are different, we put trip in detection. Otherwise, we put activity.
df.loc[
(df["detection"] == "trip")
& (df["cluster_start"] == df["cluster_end"])
& (df["cluster_start"] != -1),
["detection"],
] = "activity"
return df
def _correct_clusters(df):
"""Corrects detected clusters by merging them using a window time and mean speed
Args:
df (pandas.DataFrame): DataFrame to be corrected, with 'detection', 'speed' and 'time_delta' columns
"""
activity_indexes = df.loc[df.detection == "activity"].index.values
trip_indexes = df.loc[df.detection == "trip"].index.values
time_delta = df['time_delta'].values
speed = df['speed'].values
detection = df['detection'].values
for group in mit.consecutive_groups(activity_indexes):
indexes = list(group)
window_time = np.sum(time_delta[indexes])
if window_time < 120:
detection[indexes] = 'trip'
for group in mit.consecutive_groups(trip_indexes):
indexes = list(group)
window_time = np.sum(time_delta[indexes])
mean_speed = np.mean(speed[indexes])
if window_time < 120 or mean_speed < 1:
detection[indexes] = 'activity'
df['detection'] = detection
def segment(prepared_df, radius=0.025, min_samples=50, time_gap=850, use_multiprocessing=True) -> pd.DataFrame:
"""Finds clusters of waypoints for legs
Args:
df (pandas.DataFrame): Waypoints DataFrame to be processed
radius (float): Eps for DBSCAN
min_samples (int): Minimum number of samples to be considered for
time_gap (float): Max time gap threshold for detected clusters
Returns:
pandas.DataFrame: DataFrame with the segment starts and ends
"""
route_user = _create_route(prepared_df)
df = _prepare_for_detection(route_user)
df["day"] = df.tracked_at_start.apply(lambda x: x.day)
df["month"] = df.tracked_at_start.apply(lambda x: x.month)
df["year"] = df.tracked_at_start.apply(lambda x: x.year)
db = DBSCAN(eps=radius / 6371.0, min_samples=min_samples,
algorithm="ball_tree", metric="haversine")
route_clusters_detected = pd.DataFrame(columns=list(
df.columns) + list(['cluster_start', 'cluster_end']))
arguments = list(df.groupby(['day', 'month', 'year']).groups.items())
arguments = list(map(lambda x: (df.iloc[list(x[1])], db), arguments))
if use_multiprocessing:
pool = mp.Pool(processes=(mp.cpu_count() - 1))
results = pool.map_async(_activities_density, arguments)
pool.close()
pool.join()
for res in results.get(timeout=1):
route_clusters_detected = route_clusters_detected.append(res)
else:
for argument_list in arguments:
res = _activities_density(argument_list)
route_clusters_detected = route_clusters_detected.append(res)
route_clusters_detected = route_clusters_detected.sort_values(
by='tracked_at_start', ascending=True)
route_clusters_detected = route_clusters_detected.drop(
columns=['day', 'month', 'year'])
route_clusters_detected = route_clusters_detected.reset_index().drop(columns="index")
_correct_clusters(route_clusters_detected)
route_clusters_detected = (route_clusters_detected.drop(
route_clusters_detected[route_clusters_detected.time_delta >
time_gap].index
)
.reset_index()
.drop(columns="index")
)
route_clusters_detected = route_clusters_detected.drop(
columns=['cluster_start', 'cluster_end'])
return route_clusters_detected
| {"hexsha": "feb3a15c5b30ae4754c93b6a9ae897c5f3d63d1c", "size": 7400, "ext": "py", "lang": "Python", "max_stars_repo_path": "mobilipy/segmentation.py", "max_stars_repo_name": "plechoss/mobilipy", "max_stars_repo_head_hexsha": "3bf54fe11defe186228af99d01de82bf11f0b590", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "mobilipy/segmentation.py", "max_issues_repo_name": "plechoss/mobilipy", "max_issues_repo_head_hexsha": "3bf54fe11defe186228af99d01de82bf11f0b590", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "mobilipy/segmentation.py", "max_forks_repo_name": "plechoss/mobilipy", "max_forks_repo_head_hexsha": "3bf54fe11defe186228af99d01de82bf11f0b590", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.1013824885, "max_line_length": 209, "alphanum_fraction": 0.6567567568, "include": true, "reason": "import numpy,from numba", "num_tokens": 1750} |
"""
Unit tests for php_wrappers module.
Running tests which are NOT marked as slow (default):
python -m pytest test_php_wrappers.py
These tests take about 30 seconds to run (on my local machine).
Running all tests, including those marked as slow:
python -m pytest test_php_wrappers.py --runslow
These tests take a VERY long time, upwards of 30 minutes (on my local machine).
"""
from etta.php_wrappers import *
from tools import FileCheck
from pandas import DataFrame
from astropy.table import Table
import os
import pytest
def wrapper_tester(func, params, expected_rows, expected_cols):
# Test default output (pandas.DataFrame)
res = func(**params)
assert isinstance(res, DataFrame)
assert len(res) >= expected_rows
assert len(res.columns) >= expected_cols
# Test astropy output (astropy.table.Table)
res = func(**params, output='astropy')
assert isinstance(res, Table)
assert len(res) >= expected_rows
assert len(res.columns) >= expected_cols
# Test file download (csv)
filename = f'test_{func.__name__}.csv'
with FileCheck(filename) as file_check:
res = func(**params, output='csv', path=filename)
assert res is None
file_check.check_min_length(expected_rows + 1)
def test_download_toi_single():
wrapper_tester(
download_toi,
{'toi': 174},
expected_rows=4,
expected_cols=57
)
@pytest.mark.slow
def test_download_toi_all():
res = download_toi(sort='sg1a')
assert res['SG1A'].is_monotonic
assert len(res) >= 4198
assert len(res.columns) >= 57
def test_download_nearbytarget():
wrapper_tester(
download_nearbytarget,
{'tic': 278683844, 'sort': 'tmag'},
expected_rows=12,
expected_cols=14
)
def test_download_uploads():
wrapper_tester(
download_uploads,
{'target': 'Kepler-633'},
expected_rows=2,
expected_cols=9
)
wrapper_tester(
download_uploads,
{'target': 63898957},
expected_rows=1,
expected_cols=9
)
wrapper_tester(
download_uploads,
{'target': 'TOI286'},
expected_rows=1,
expected_cols=9
)
def test_download_imaging_single():
wrapper_tester(
download_imaging,
{'target': 26474039},
expected_rows=8,
expected_cols=15
)
@pytest.mark.slow
def test_download_imaging_all():
res = download_imaging(sort='user')
assert res['User'].is_monotonic
assert len(res) >= 16382
assert len(res.columns) >= 15
def test_download_tag_imaging():
wrapper_tester(
download_tag_imaging,
{'tag': 95132},
expected_rows=2,
expected_cols=15
)
def test_download_spect_single():
wrapper_tester(
download_spect,
{'target': 'TOI1162'},
expected_rows=4,
expected_cols=15
)
@pytest.mark.slow
def test_download_spect_all():
res = download_spect(sort='inst')
assert res['Instrument'].is_monotonic
assert len(res) >= 14802
assert len(res.columns) >= 15
def test_download_tag_spect():
wrapper_tester(
download_tag_spect,
{'tag': 1494},
expected_rows=9,
expected_cols=15
)
def test_download_tseries_single():
wrapper_tester(
download_tseries,
{'target': 366074069},
expected_rows=6,
expected_cols=19
)
@pytest.mark.slow
def test_download_tseries_all():
res = download_tseries(sort='user')
assert res['User'].is_monotonic
assert len(res) >= 6373
assert len(res.columns) >= 19
def test_download_tag_tseries():
wrapper_tester(
download_tag_tseries,
{'tag': 7},
expected_rows=2,
expected_cols=19
)
def test_download_obsnotes():
wrapper_tester(
download_obsnotes,
{'tag': 3059},
expected_rows=1185,
expected_cols=7
)
wrapper_tester(
download_obsnotes,
{'tic': 254113311},
expected_rows=3,
expected_cols=7
)
wrapper_tester(
download_obsnotes,
{'row_id': 4339},
expected_rows=1,
expected_cols=7
)
@pytest.mark.slow
def test_download_user_tags():
"""This test is extremely slow (can take about 30 minutes).
"""
wrapper_tester(
download_user_tags,
{'username': 'ciardi'},
expected_rows=19043,
expected_cols=13
)
def test_download_stellarcomp_single():
wrapper_tester(
download_stellarcomp,
{'target': 27769688},
expected_rows=3,
expected_cols=15
)
def test_download_stellarcomp_all():
res = download_stellarcomp(sort='id')
assert res['TIC ID'].is_monotonic
assert len(res) >= 4017
assert len(res.columns) >= 15
| {"hexsha": "f0b3f9c51b255ecff03da8549040963bd9c40c21", "size": 4808, "ext": "py", "lang": "Python", "max_stars_repo_path": "etta/tests/test_php_wrappers.py", "max_stars_repo_name": "jennywwww/exofop-tess-api", "max_stars_repo_head_hexsha": "fe3673e6cc379bea8a5ea4a053b9548c26d3775f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2021-08-29T23:07:48.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-15T05:23:45.000Z", "max_issues_repo_path": "etta/tests/test_php_wrappers.py", "max_issues_repo_name": "jennywwww/exofop-tess-api", "max_issues_repo_head_hexsha": "fe3673e6cc379bea8a5ea4a053b9548c26d3775f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "etta/tests/test_php_wrappers.py", "max_forks_repo_name": "jennywwww/exofop-tess-api", "max_forks_repo_head_hexsha": "fe3673e6cc379bea8a5ea4a053b9548c26d3775f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.04, "max_line_length": 79, "alphanum_fraction": 0.6447587354, "include": true, "reason": "from astropy", "num_tokens": 1202} |
# *-* coding: utf-8 *-*
import tensorflow as tf
import numpy as np
import cv2
import os
import re
import detect_face
default_color = (0, 255, 0) #BGR
default_thickness = 2
image_paths = sorted([f for f in os.listdir('.') if re.match(r'.+\.jpg', f)])
with tf.Graph().as_default():
sess = tf.Session()
pnet, rnet, onet = detect_face.create_mtcnn(sess, None)
minsize = 20 # minimum size of face
threshold = [ 0.6, 0.7, 0.7 ] # three steps's threshold
factor = 0.709 # scale factor
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while True:
ret, img_orig = cap.read()
img = np.copy(img_orig)
bounding_boxes, points = detect_face.detect_face(img, minsize, pnet, rnet, onet, threshold, factor)
for bounding_box in bounding_boxes:
pts = bounding_box[:4].astype(np.int32)
pt1 = (pts[0], pts[1])
pt2 = (pts[2], pts[3])
cv2.rectangle(img, pt1, pt2, color=default_color, thickness=default_thickness)
cv2.imshow("salam", img)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
| {"hexsha": "7e8900e68a96145f7ef369643c1c91de9c262881", "size": 1094, "ext": "py", "lang": "Python", "max_stars_repo_path": "32-detect/mtcnn-camera.py", "max_stars_repo_name": "moh3n9595/class.vision", "max_stars_repo_head_hexsha": "cbcc65fd1f226273d26e44576ca7c3950faea75c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 103, "max_stars_repo_stars_event_min_datetime": "2018-02-23T15:58:26.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-09T05:49:14.000Z", "max_issues_repo_path": "32-detect/mtcnn-camera.py", "max_issues_repo_name": "Deep-learning999/class.vision", "max_issues_repo_head_hexsha": "c3cc8118d8c00aff56956fba69e8c99d666251d5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "32-detect/mtcnn-camera.py", "max_forks_repo_name": "Deep-learning999/class.vision", "max_forks_repo_head_hexsha": "c3cc8118d8c00aff56956fba69e8c99d666251d5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 53, "max_forks_repo_forks_event_min_datetime": "2018-02-16T20:38:29.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-07T10:12:10.000Z", "avg_line_length": 22.3265306122, "max_line_length": 103, "alphanum_fraction": 0.6563071298, "include": true, "reason": "import numpy", "num_tokens": 329} |
import math
import librosa
import numpy as np
import pickle
import os
LENGTH_CHOSEN = 80000
SCALERS_FOLDER = "speech_emotion_recognition/data_scaler"
def read_file(audio_file):
"""
:param audio_file: a string representing the full-path of the input audio file
:type audio_file: string
:return: an array representing the sampled audio file, sample rate
:rtype: np.array, int
"""
samples, sr = librosa.load(audio_file, res_type='kaiser_fast', sr=16000)
return samples, sr
def cut_pad(samples):
"""
:param samples: an array representing the sampled audio
:type samples: np.array, float64
:return: an array representing the cut or padded audio file
:rtype: np.array, float64
"""
# cut
if samples.shape[0] > LENGTH_CHOSEN:
new_samples = samples[:LENGTH_CHOSEN]
# pad
elif samples.shape[0] < LENGTH_CHOSEN:
new_samples = np.pad(samples, math.ceil((LENGTH_CHOSEN - samples.shape[0]) / 2), mode='median')
# nothing
else:
new_samples = samples
if len(new_samples) == 80001:
new_samples = new_samples[:-1]
return new_samples
def compute_energy(samples):
"""
:param samples: an array representing the sampled audio
:type samples: float64
:return: a value representing the rms on the input audio
:rtype: float
"""
energy = librosa.feature.rms(samples)
energy = energy.T
energy = np.array(energy)
return energy
def compute_energy_mean(samples):
"""
:param samples: an array representing the sampled audio
:type samples: float64
:return: a value representing the average rms on the input audio
:rtype: float
"""
energy = librosa.feature.rms(samples)
energy = energy.T
energy = np.array(energy)
energy = np.mean(energy, axis=0)
return energy
def compute_mfccs(samples, n_mfcc, scaler, feature_energy):
"""
:param samples: an array representing the sampled audio
:type samples: np.array, float 64
:param n_mfcc: the desired number of mfcc
:type n_mfcc: int
:param scaler: the full-path of the scaler pickle object
:type scaler: string
:param feature_energy: a value to indicate whether the energy feature should be concatenated to MFCCs
:type feature_energy: boolean
:return: an of audio features
:rtype: np.array, float64
"""
# Compute MFCCS
mfccs = librosa.feature.mfcc(y=samples, sr=16000, n_mfcc=n_mfcc)
mfccs = mfccs.T
mfccs = np.array(mfccs)
mfccs = mfccs[:, 1:] # get rid of the first component
# Compute energy, if required
if feature_energy == True:
energy = compute_energy(samples)
features = []
conc = np.column_stack((mfccs, energy))
features.append(conc)
mfccs = np.array(features)
# Reshape features in (1, 157, n_mfcc)
if feature_energy == True:
mfccs = mfccs.reshape(1, 157, n_mfcc)
else:
mfccs = mfccs.reshape(1, 157, n_mfcc-1)
# Load scaler
SCALER_PATH = os.path.join(SCALERS_FOLDER, scaler)
# print("SCALER PATH", SCALER_PATH)
with open(SCALER_PATH, 'rb') as f:
scaler = pickle.load(f)
# print("Shape MFCCS", mfccs.shape)
# Scale data
mfccs = scaler.transform(mfccs.reshape(-1, mfccs.shape[-1])).reshape(mfccs.shape)
return mfccs
def compute_mfccs_mean(samples, n_mfcc, scaler, feature_energy):
"""
:param samples: an array representing the sampled audio
:type samples: np.array, float 64
:param n_mfcc: the desired number of mfcc
:type n_mfcc: int
:param scaler: the full-path of the scaler pickle object
:type scaler: string
:param feature_energy: a value to indicate whether the energy feature should be concatenated to MFCCs
:type feature_energy: boolean
:return: an of audio features
:rtype: np.array, float64
"""
mfccs = librosa.feature.mfcc(y=samples, sr=16000, n_mfcc=n_mfcc)
mfccs = mfccs.T
mfccs = np.array(mfccs)
mfccs = np.mean(mfccs[:, 1:], axis=0)
# print("Shape MFCCS", mfccs.shape)
# Compute energy, if required
if feature_energy == True:
energy = compute_energy_mean(samples)
features = []
conc = np.concatenate((mfccs, energy), axis=None)
features.append(conc)
mfccs = np.array(features)
# Reshape features in (1, 157, n_mfcc)
if feature_energy == True:
mfccs = mfccs.reshape(1, n_mfcc)
else:
mfccs = mfccs.reshape(1, n_mfcc - 1)
# Load scaler
SCALER_PATH = os.path.join(SCALERS_FOLDER, scaler)
# print("SCALER PATH", SCALER_PATH)
with open(SCALER_PATH, 'rb') as f:
scaler = pickle.load(f)
# Scale data
mfccs = scaler.transform(mfccs.reshape(-1, mfccs.shape[-1])).reshape(mfccs.shape)
return mfccs
def mfccs_scaled(samples, scaler, id_exp):
"""
:param samples: an array representing the sampled audio
:type samples: np.array, float 64
:param scaler: the full-path of the scaler pickle object
:type scaler: string
:param id_exp: a string that identifies the experiment
:type id_exp: string
:return: an array of features
:rtype: np.array, float64
"""
parts = id_exp.split('_')
num_exp = parts[0]
# print("Computing features for Experiment: ", num_exp)
if num_exp == '1':
mfccs = compute_mfccs(samples, 13, scaler, feature_energy=False)
return mfccs
elif num_exp == '2':
mfccs = compute_mfccs(samples, 13, scaler, feature_energy=True)
return mfccs
elif num_exp == '3':
mfccs = compute_mfccs(samples, 26, scaler, feature_energy=False)
return mfccs
elif num_exp == '4':
mfccs = compute_mfccs(samples, 26, scaler, feature_energy=True)
return mfccs
elif num_exp == '5':
mfccs = compute_mfccs_mean(samples, 13, scaler, feature_energy=False)
return mfccs
elif num_exp == '6':
mfccs = compute_mfccs_mean(samples, 13, scaler, feature_energy=True)
return mfccs
elif num_exp == '7':
mfccs = compute_mfccs_mean(samples, 26, scaler, feature_energy=False)
return mfccs
elif num_exp == '8':
mfccs = compute_mfccs_mean(samples, 26, scaler, feature_energy=True)
return mfccs
| {"hexsha": "0ce832362fc34c2febd3e114daed60b36db66ba4", "size": 6290, "ext": "py", "lang": "Python", "max_stars_repo_path": "speech_emotion_recognition/feature_extraction.py", "max_stars_repo_name": "helemanc/ambient-intelligence", "max_stars_repo_head_hexsha": "fe3571ac2d43b91b1331973ed7769372cc544af2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2022-01-27T18:35:29.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-28T11:40:24.000Z", "max_issues_repo_path": "speech_emotion_recognition/feature_extraction.py", "max_issues_repo_name": "helemanc/ambient-intelligence", "max_issues_repo_head_hexsha": "fe3571ac2d43b91b1331973ed7769372cc544af2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "speech_emotion_recognition/feature_extraction.py", "max_forks_repo_name": "helemanc/ambient-intelligence", "max_forks_repo_head_hexsha": "fe3571ac2d43b91b1331973ed7769372cc544af2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.5339805825, "max_line_length": 105, "alphanum_fraction": 0.6597774245, "include": true, "reason": "import numpy", "num_tokens": 1731} |
section\<open>The general Rasiowa-Sikorski lemma\<close>
theory Rasiowa_Sikorski imports Forcing_Notions Pointed_DC begin
context countable_generic
begin
lemma RS_relation:
assumes "p\<in>P" "n\<in>nat"
shows "\<exists>y\<in>P. \<langle>p,y\<rangle> \<in> (\<lambda>m\<in>nat. {\<langle>x,y\<rangle>\<in>P\<times>P. y\<preceq>x \<and> y\<in>\<D>`(pred(m))})`n"
proof -
from seq_of_denses \<open>n\<in>nat\<close>
have "dense(\<D> ` pred(n))" by simp
with \<open>p\<in>P\<close>
have "\<exists>d\<in>\<D> ` Arith.pred(n). d\<preceq> p"
unfolding dense_def by simp
then obtain d where 3: "d \<in> \<D> ` Arith.pred(n) \<and> d\<preceq> p"
by blast
from countable_subs_of_P \<open>n\<in>nat\<close>
have "\<D> ` Arith.pred(n) \<in> Pow(P)"
by (blast dest:apply_funtype intro:pred_type)
then
have "\<D> ` Arith.pred(n) \<subseteq> P"
by (rule PowD)
with 3
have "d \<in> P \<and> d\<preceq> p \<and> d \<in> \<D> ` Arith.pred(n)"
by auto
with \<open>p\<in>P\<close> \<open>n\<in>nat\<close>
show ?thesis by auto
qed
lemma DC_imp_RS_sequence:
assumes "p\<in>P"
shows "\<exists>f. f: nat\<rightarrow>P \<and> f ` 0 = p \<and>
(\<forall>n\<in>nat. f ` succ(n)\<preceq> f ` n \<and> f ` succ(n) \<in> \<D> ` n)"
proof -
let ?S="(\<lambda>m\<in>nat. {\<langle>x,y\<rangle>\<in>P\<times>P. y\<preceq>x \<and> y\<in>\<D>`(pred(m))})"
have "\<forall>x\<in>P. \<forall>n\<in>nat. \<exists>y\<in>P. \<langle>x,y\<rangle> \<in> ?S`n"
using RS_relation by (auto)
then
have "\<forall>a\<in>P. (\<exists>f \<in> nat\<rightarrow>P. f`0 = a \<and> (\<forall>n \<in> nat. \<langle>f`n,f`succ(n)\<rangle>\<in>?S`succ(n)))"
using sequence_DC by (blast)
with \<open>p\<in>P\<close>
show ?thesis by auto
qed
theorem rasiowa_sikorski:
"p\<in>P \<Longrightarrow> \<exists>G. p\<in>G \<and> D_generic(G)"
using RS_sequence_imp_rasiowa_sikorski by (auto dest:DC_imp_RS_sequence)
end (* countable_generic *)
end | {"author": "data61", "repo": "PSL", "sha": "2a71eac0db39ad490fe4921a5ce1e4344dc43b12", "save_path": "github-repos/isabelle/data61-PSL", "path": "github-repos/isabelle/data61-PSL/PSL-2a71eac0db39ad490fe4921a5ce1e4344dc43b12/SeLFiE/Example/afp-2020-05-16/thys/Forcing/Rasiowa_Sikorski.thy"} |
program dc
double complex a, b, c, d, e, f, g, h
double precision x
complex w, z
a = (1.0,1.0)
b = 1
c = 1.0e0
d = 1.0d0
e = a + b
f = COS(e)
x = ABS(f)
f = DCMPLX(x)
h = LOG(g) + SQRT(f) + SIN(e) + EXP(a)
print *, h
w = (1.0, 1.0)
z = w + 1
w = CMPLX(1.0, 1.0)
z = w + 1
end
| {"hexsha": "e1838badf26ca75e02a087f6827630936e99d51d", "size": 396, "ext": "f", "lang": "FORTRAN", "max_stars_repo_path": "packages/PIPS/validation/Flint/dcmplx.f", "max_stars_repo_name": "DVSR1966/par4all", "max_stars_repo_head_hexsha": "86b33ca9da736e832b568c5637a2381f360f1996", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 51, "max_stars_repo_stars_event_min_datetime": "2015-01-31T01:51:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-18T02:01:50.000Z", "max_issues_repo_path": "packages/PIPS/validation/Flint/dcmplx.f", "max_issues_repo_name": "DVSR1966/par4all", "max_issues_repo_head_hexsha": "86b33ca9da736e832b568c5637a2381f360f1996", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2017-05-29T09:29:00.000Z", "max_issues_repo_issues_event_max_datetime": "2019-03-11T16:01:39.000Z", "max_forks_repo_path": "packages/PIPS/validation/Flint/dcmplx.f", "max_forks_repo_name": "DVSR1966/par4all", "max_forks_repo_head_hexsha": "86b33ca9da736e832b568c5637a2381f360f1996", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 12, "max_forks_repo_forks_event_min_datetime": "2015-03-26T08:05:38.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-18T02:01:51.000Z", "avg_line_length": 15.2307692308, "max_line_length": 44, "alphanum_fraction": 0.3560606061, "num_tokens": 172} |
/*
* Copyright (C) 2015 Dato, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
#include <typeinfo>
#include <boost/filesystem.hpp>
#include <sframe/sframe.hpp>
#include <sframe/algorithm.hpp>
#include <flexible_type/flexible_type.hpp>
#include <sframe/parallel_csv_parser.hpp>
#include <sframe/csv_line_tokenizer.hpp>
#include <sframe/csv_writer.hpp>
#include <random/random.hpp>
#include <sframe/groupby_aggregate.hpp>
#include <sframe/groupby_aggregate_operators.hpp>
#include <sframe/sframe_saving.hpp>
#include <cxxtest/TestSuite.h>
using namespace graphlab;
class sframe_test : public CxxTest::TestSuite {
std::string test_writer_prefix;
std::string test_writer_dbl_prefix;
std::string test_writer_str_prefix;
std::string test_writer_add_col_prefix;
std::string test_writer_seg_size_err_prefix;
public:
static sframe_test *createSuite() {
sframe_test *test_suite = new sframe_test();
sarray<flexible_type> test_writer;
sarray<flexible_type> test_writer_dbl;
sarray<flexible_type> test_writer_str;
sarray<flexible_type> test_writer_add_col;
sarray<flexible_type> test_writer_seg_size_err;
test_suite->test_writer_prefix = get_temp_name() + ".sidx";
test_suite->test_writer_dbl_prefix = get_temp_name() + ".sidx";
test_suite->test_writer_str_prefix = get_temp_name() + ".sidx";
test_suite->test_writer_add_col_prefix = get_temp_name() + ".sidx";
test_suite->test_writer_seg_size_err_prefix = get_temp_name() + ".sidx";
std::vector<std::vector<size_t> > data{{1,2,3,4,5},
{6,7,8,9,10},
{11,12,13,14,15},
{16,17,18,19,20}};
//TODO: Make better!
test_writer.open_for_write(test_suite->test_writer_prefix, 4);
test_writer_dbl.open_for_write(test_suite->test_writer_dbl_prefix, 4);
test_writer_str.open_for_write(test_suite->test_writer_str_prefix, 4);
test_writer_add_col.open_for_write(test_suite->test_writer_add_col_prefix, 4);
test_writer.set_type(flex_type_enum::INTEGER);
test_writer_dbl.set_type(flex_type_enum::FLOAT);
test_writer_str.set_type(flex_type_enum::STRING);
test_writer_add_col.set_type(flex_type_enum::FLOAT);
for (size_t i = 0; i < 4; ++i) {
auto iter = test_writer.get_output_iterator(i);
auto iter_dbl = test_writer_dbl.get_output_iterator(i);
auto iter_str = test_writer_str.get_output_iterator(i);
auto iter_add_col = test_writer_add_col.get_output_iterator(i);
for(auto val: data[i]) {
*iter = val;
*iter_dbl = val;
*iter_str = std::to_string(val);
*iter_add_col = val;
++iter;
++iter_dbl;
++iter_str;
++iter_add_col;
}
}
test_writer.close();
test_writer_dbl.close();
test_writer_str.close();
test_writer_add_col.close();
std::vector<std::vector<size_t> > data2{{1,2,3,4},
{5, 6,7,8,9,10,11,12},
{13,14,15},
{16,17,18,19,20}};
test_writer_seg_size_err.open_for_write(test_suite->test_writer_seg_size_err_prefix, 4);
for (size_t i = 0; i < 4; ++i) {
auto iter = test_writer_seg_size_err.get_output_iterator(i);
for(auto val : data2[i]) {
*iter = val;
++iter;
}
}
test_writer_seg_size_err.close();
return test_suite;
}
static void destroySuite(sframe_test *ts) {
delete ts;
}
void test_sframe_construction() {
// Create an sarray from on-disk representation
auto tmp_ptr = new sarray<flexible_type>(test_writer_prefix);
std::shared_ptr<sarray<flexible_type> > sa_ptr(tmp_ptr);
std::vector<std::shared_ptr<sarray<flexible_type> > > v;
// Create 3 identical columns
v.push_back(sa_ptr);
v.push_back(sa_ptr);
v.push_back(sa_ptr);
// Create an sframe where the first column is named and the rest
// get an automatic name
std::vector<std::string> name_vector;
name_vector.push_back(std::string("the_cool_column"));
// Test that empty strings are handled correctly
name_vector.push_back(std::string(""));
// ...and test that the name_vector doesn't have to be the same size
// as the vector v.
sframe sf(v, name_vector);
TS_ASSERT_EQUALS(sf.num_segments(), sa_ptr->num_segments());
TS_ASSERT_EQUALS(sf.num_columns(), 3);
size_t num_rows = 0;
for(size_t i = 0; i < sa_ptr->num_segments(); ++i) {
num_rows += sa_ptr->segment_length(i);
}
TS_ASSERT_EQUALS(sf.num_rows(), num_rows);
std::string x("X");
for(size_t i = 0; i < sf.num_columns(); ++i) {
if(i == 0) {
TS_ASSERT_EQUALS(sf.column_name(i), std::string("the_cool_column"));
} else {
// Test automatic column names
TS_ASSERT_EQUALS(sf.column_name(i),
std::string(x + std::to_string(i+1)));
}
TS_ASSERT_EQUALS(sf.column_type(i), flex_type_enum::INTEGER);
}
// verify contents of the sframe
std::vector<std::vector<flexible_type> > frame;
graphlab::copy(sf, std::inserter(frame, frame.end()));
TS_ASSERT_EQUALS(frame.size(), 20);
for (size_t i = 0;i < frame.size(); ++i) {
TS_ASSERT_EQUALS(frame[i].size(), 3);
for (size_t j = 0; j < frame[i].size(); ++j) {
TS_ASSERT_EQUALS((size_t)(frame[i][j]), i + 1);
}
}
// Test that I can add a misaligned segment
auto tmp_ptr_seg = new sarray<flexible_type>(test_writer_seg_size_err_prefix);
std::shared_ptr<sarray<flexible_type> > seg_size_ptr(tmp_ptr_seg);
v.push_back(seg_size_ptr);
sframe sf2(v);
// and that the contents match up
frame.clear();
graphlab::copy(sf2, std::inserter(frame, frame.end()));
TS_ASSERT_EQUALS(frame.size(), 20);
for (size_t i = 0;i < frame.size(); ++i) {
TS_ASSERT_EQUALS(frame[i].size(), 4);
for (size_t j = 0; j < frame[i].size(); ++j) {
TS_ASSERT_EQUALS((size_t)(frame[i][j]), i + 1);
}
}
// Unique column name
name_vector.push_back(std::string("the_cool_column"));
TS_ASSERT_THROWS_ANYTHING(sframe sf3(v, name_vector));
}
void test_empty_sframe() {
sframe sf;
sf.open_for_write({"hello","world","pika"},
{flex_type_enum::FLOAT, flex_type_enum::FLOAT, flex_type_enum::INTEGER});
sf.close();
TS_ASSERT(sf.is_opened_for_read() == true);
auto reader = sf.get_reader();
TS_ASSERT_EQUALS(sf.size(), 0);
sframe sf2 = sf.select_columns({"hello","world"});
TS_ASSERT(sf2.is_opened_for_read() == true);
auto reader2 = sf2.get_reader();
TS_ASSERT_EQUALS(sf2.size(), 0);
}
void test_sframe_save() {
// Create an sarray from on-disk representation
auto tmp_ptr = new sarray<flexible_type>(test_writer_prefix);
std::shared_ptr<sarray<flexible_type> > sa_ptr(tmp_ptr);
std::vector<std::shared_ptr<sarray<flexible_type> > > v;
// Create 3 identical columns
v.push_back(sa_ptr);
v.push_back(sa_ptr);
v.push_back(sa_ptr);
// Create SFrame with auto-named columns
sframe *sf = new sframe(v);
size_t exp_num_rows = sf->num_rows();
size_t exp_num_cols = sf->num_columns();
// Normal use case is to give an index file in a persistent place,
// but that could cause errors in a unit test
std::string index_file = get_temp_name();
index_file += ".frame_idx";
std::cerr << index_file;
// Save in a different spot
sf->save(index_file);
std::vector<std::vector<flexible_type> > frame;
graphlab::copy(*sf, std::inserter(frame, frame.end()));
// Get rid of the original copy (to make sure the saved one is legit)
delete sf;
// Check that new files are in their spot
TS_ASSERT(boost::filesystem::exists(index_file));
// Load sframe back and check that the contents are right
sframe *sf2 = new sframe(index_file);
TS_ASSERT_EQUALS(sf2->num_rows(), exp_num_rows);
TS_ASSERT_EQUALS(sf2->num_columns(), exp_num_cols);
std::vector<std::vector<flexible_type> > new_frame;
graphlab::copy(*sf2, std::inserter(new_frame, new_frame.end()));
TS_ASSERT_EQUALS(new_frame.size(), frame.size());
for (size_t i = 0;i < frame.size(); ++i) {
TS_ASSERT_EQUALS(new_frame[i].size(), frame[i].size());
for (size_t j = 0; j < frame[i].size(); ++j) {
TS_ASSERT_EQUALS(new_frame[i][j], frame[i][j]);
}
}
// serialize sf2
{
std::string dirpath = "sframe_test_dir";
graphlab::dir_archive dir;
dir.open_directory_for_write(dirpath);
graphlab::oarchive oarc(dir);
oarc << (*sf2);
}
delete sf2;
{
// Load sframe back and check that the contents are right
std::string dirpath = "sframe_test_dir";
graphlab::dir_archive dir;
dir.open_directory_for_read(dirpath);
sframe sf3;
graphlab::iarchive iarc(dir);
iarc >> sf3;
TS_ASSERT_EQUALS(sf3.num_rows(), exp_num_rows);
TS_ASSERT_EQUALS(sf3.num_columns(), exp_num_cols);
std::vector<std::vector<flexible_type> > new_frame;
graphlab::copy(sf3, std::inserter(new_frame, new_frame.end()));
TS_ASSERT_EQUALS(new_frame.size(), frame.size());
for (size_t i = 0;i < frame.size(); ++i) {
TS_ASSERT_EQUALS(new_frame[i].size(), frame[i].size());
for (size_t j = 0; j < frame[i].size(); ++j) {
TS_ASSERT_EQUALS(new_frame[i][j], frame[i][j]);
}
}
}
}
void test_sframe_save_reference_no_copy() {
// Create an sarray from on-disk representation
auto tmp_ptr = new sarray<flexible_type>(test_writer_prefix);
std::shared_ptr<sarray<flexible_type> > sa_ptr(tmp_ptr);
std::vector<std::shared_ptr<sarray<flexible_type> > > v;
// Create 3 identical columns
v.push_back(sa_ptr);
v.push_back(sa_ptr);
v.push_back(sa_ptr);
// Create SFrame with auto-named columns
sframe *sf = new sframe(v);
size_t exp_num_rows = sf->num_rows();
size_t exp_num_cols = sf->num_columns();
// Normal use case is to give an index file in a persistent place,
// but that could cause errors in a unit test
std::string base_name = get_temp_name();
auto index_file = base_name + ".frame_idx";
std::cerr << index_file;
// Save in a different spot
sframe_save_weak_reference(*sf, index_file);
std::vector<std::vector<flexible_type> > frame;
graphlab::copy(*sf, std::inserter(frame, frame.end()));
// Check that new files are in their spot
TS_ASSERT(boost::filesystem::exists(index_file));
// Load sframe back and check that the contents are right
sframe *sf2 = new sframe(index_file);
TS_ASSERT_EQUALS(sf2->num_rows(), exp_num_rows);
TS_ASSERT_EQUALS(sf2->num_columns(), exp_num_cols);
std::vector<std::vector<flexible_type> > new_frame;
graphlab::copy(*sf2, std::inserter(new_frame, new_frame.end()));
TS_ASSERT_EQUALS(new_frame.size(), frame.size());
for (size_t i = 0;i < frame.size(); ++i) {
TS_ASSERT_EQUALS(new_frame[i].size(), frame[i].size());
for (size_t j = 0; j < frame[i].size(); ++j) {
TS_ASSERT_EQUALS(new_frame[i][j], frame[i][j]);
}
}
}
void test_sframe_save_reference_one_copy() {
/*
* Create a saved sframe of 2 columns.
* create one more cache column.
* save a reference to this new sframe
*/
// the original sarray we are going to replicate
auto tmp_ptr = new sarray<flexible_type>(test_writer_prefix);
std::shared_ptr<sarray<flexible_type> > sa_ptr(tmp_ptr);
// save an sframe of 2 columns
auto base_sframe = get_temp_name() + ".frame_idx";
{
// Create an sarray from on-disk representation
std::vector<std::shared_ptr<sarray<flexible_type> > > v;
v.push_back(sa_ptr);
v.push_back(sa_ptr);
// Create SFrame with auto-named columns
sframe sf(v);
sf.save(base_sframe);
}
sframe bsf(base_sframe);
// create an inmemory sarray and append to it
std::shared_ptr<sarray<flexible_type> > sa2 = std::make_shared<sarray<flexible_type>>();
sa2->open_for_write(1);
sframe_rows rows;
sa_ptr->get_reader()->read_rows(0, sa_ptr->size(), rows);
(*sa2->get_output_iterator(0)) = rows;
sa2->close();
auto sf = bsf.add_column(sa2);
size_t exp_num_rows = sf.num_rows();
size_t exp_num_cols = sf.num_columns();
// Normal use case is to give an index file in a persistent place,
// but that could cause errors in a unit test
std::string base_name = get_temp_name();
auto index_file = base_name + ".frame_idx";
std::cerr << index_file;
// Save in a different spot
sframe_save_weak_reference(sf, index_file);
std::vector<std::vector<flexible_type> > frame;
graphlab::copy(sf, std::inserter(frame, frame.end()));
// Check that new files are in their spot
TS_ASSERT(boost::filesystem::exists(index_file));
// Load sframe back and check that the contents are right
sframe *sf2 = new sframe(index_file);
TS_ASSERT_EQUALS(sf2->num_rows(), exp_num_rows);
TS_ASSERT_EQUALS(sf2->num_columns(), exp_num_cols);
// 3rd cikynb
TS_ASSERT_DIFFERS(parse_v2_segment_filename(sf2->get_index_info().column_files[2]).first,
parse_v2_segment_filename(bsf.get_index_info().column_files[1]).first);
std::vector<std::vector<flexible_type> > new_frame;
graphlab::copy(*sf2, std::inserter(new_frame, new_frame.end()));
TS_ASSERT_EQUALS(new_frame.size(), frame.size());
for (size_t i = 0;i < frame.size(); ++i) {
TS_ASSERT_EQUALS(new_frame[i].size(), frame[i].size());
for (size_t j = 0; j < frame[i].size(); ++j) {
TS_ASSERT_EQUALS(new_frame[i][j], frame[i][j]);
}
}
delete sf2;
}
void test_sframe_save_empty_columns() {
sframe sf;
sf.open_for_write({"col1", "col2"}, {flex_type_enum::INTEGER, flex_type_enum::STRING});
sf.close();
std::string index = get_temp_name() + ".frame_idx";
sf.save(index);
sframe newsf(index);
TS_ASSERT_EQUALS(newsf.size(), 0);
}
void test_sframe_save_really_empty() {
sframe sf;
sf.open_for_write(std::vector<std::string>(), std::vector<flex_type_enum>());
sf.close();
std::string index = get_temp_name() + ".frame_idx";
sf.save(index);
sframe newsf(index);
TS_ASSERT_EQUALS(newsf.size(), 0);
}
void test_sframe_dataframe_conversion() {
std::vector<flexible_type> int_col{0,1,2,3,4,5};
std::vector<flexible_type> float_col{.0,.1,.2,.3,.4,.5};
std::vector<flexible_type> str_col{".0",".1",".2",".3",".4",".5"};
std::vector<flexible_type> vec_col{{.0},{.1},{.2},{.3},{.4},{.5}};
dataframe_t df;
df.set_column("int_col", int_col, flex_type_enum::INTEGER);
df.set_column("float_col", float_col, flex_type_enum::FLOAT);
df.set_column("str_col", str_col, flex_type_enum::STRING);
df.set_column("vec_col", vec_col, flex_type_enum::VECTOR);
// Test df -> sf
sframe sf(df);
TS_ASSERT_EQUALS(sf.num_rows(), 6);
TS_ASSERT_EQUALS(sf.num_columns(), 4);
std::vector<flex_type_enum> expected_types{flex_type_enum::INTEGER, flex_type_enum::FLOAT, flex_type_enum::STRING, flex_type_enum::VECTOR};
std::vector<std::string> expected_names{"int_col", "float_col", "str_col", "vec_col"};
for (size_t i = 0; i < sf.num_columns(); ++i) {
TS_ASSERT_EQUALS(sf.column_type(i), expected_types[i]);
TS_ASSERT_EQUALS(sf.column_name(i), expected_names[i]);
}
size_t ctr = 0;
auto reader = sf.get_reader();
for (size_t i = 0; i < reader->num_segments(); ++i) {
auto iter = reader->begin(i);
while(iter != reader->end(i)) {
std::vector<flexible_type> row = *iter;
TS_ASSERT_EQUALS(row.size(), reader->num_columns());
for (size_t j = 0; j < row.size(); ++j) {
if (j == 0) {
TS_ASSERT_EQUALS(row[j], int_col[ctr]);
} else if (j == 1) {
TS_ASSERT_EQUALS(row[j], float_col[ctr]);
} else if (j == 2){
TS_ASSERT_EQUALS(row[j], str_col[ctr]);
} else {
TS_ASSERT_EQUALS(row[j], vec_col[ctr]);
}
}
++iter;
++ctr;
}
}
// Test sf -> df
dataframe_t df2 = sf.to_dataframe();
TS_ASSERT_EQUALS(df2.names, df.names);
TS_ASSERT_EQUALS(df2.types, df.types);
TS_ASSERT_EQUALS(df2.values, df.values);
}
void test_sframe_dataframe_conversion_with_na() {
std::vector<flexible_type> int_col{0,1,2,3,4,5};
std::vector<flexible_type> float_col{.0,.1,.2,.3,.4,.5};
std::vector<flexible_type> str_col{".0",".1",".2",".3",".4",".5"};
std::vector<flexible_type> vec_col{{.0},{.1},{.2},{.3},{.4},{.5}};
// set the last row to NA
int_col[int_col.size() - 1].reset(flex_type_enum::UNDEFINED);
float_col[float_col.size() - 1].reset(flex_type_enum::UNDEFINED);
str_col[str_col.size() - 1].reset(flex_type_enum::UNDEFINED);
vec_col[vec_col.size() - 1].reset(flex_type_enum::UNDEFINED);
dataframe_t df;
df.set_column("int_col", int_col, flex_type_enum::INTEGER);
df.set_column("float_col", float_col, flex_type_enum::FLOAT);
df.set_column("str_col", str_col, flex_type_enum::STRING);
df.set_column("vec_col", vec_col, flex_type_enum::VECTOR);
// Test df -> sf
sframe sf(df);
TS_ASSERT_EQUALS(sf.num_rows(), 6);
TS_ASSERT_EQUALS(sf.num_columns(), 4);
std::vector<flex_type_enum> expected_types{flex_type_enum::INTEGER, flex_type_enum::FLOAT, flex_type_enum::STRING, flex_type_enum::VECTOR};
std::vector<std::string> expected_names{"int_col", "float_col", "str_col", "vec_col"};
for (size_t i = 0; i < sf.num_columns(); ++i) {
TS_ASSERT_EQUALS(sf.column_type(i), expected_types[i]);
TS_ASSERT_EQUALS(sf.column_name(i), expected_names[i]);
}
auto reader = sf.get_reader();
size_t ctr = 0;
for (size_t i = 0; i < reader->num_segments(); ++i) {
auto iter = reader->begin(i);
while(iter != reader->end(i)) {
std::vector<flexible_type> row = *iter;
TS_ASSERT_EQUALS(row.size(), reader->num_columns());
for (size_t j = 0; j < row.size(); ++j) {
if (ctr < 5) {
if (j == 0) {
TS_ASSERT_EQUALS(row[j], int_col[ctr]);
} else if (j == 1) {
TS_ASSERT_EQUALS(row[j], float_col[ctr]);
} else if (j == 2){
TS_ASSERT_EQUALS(row[j], str_col[ctr]);
} else {
TS_ASSERT_EQUALS(row[j], vec_col[ctr]);
}
} if (ctr == 5) {
TS_ASSERT_EQUALS(row[j].get_type(), flex_type_enum::UNDEFINED);
}
}
++iter;
++ctr;
}
}
// Test sf -> df
dataframe_t df2 = sf.to_dataframe();
TS_ASSERT_EQUALS(df2.names, df.names);
TS_ASSERT_EQUALS(df2.types, df.types);
// we can't compare values because UNDEFINED != UNDEFINED.
// annoyingly. So we have to do this explicitly.
for (const auto& col: df.values) {
const auto& col2 = *(df2.values.find(col.first));
TS_ASSERT_EQUALS(col.first, col2.first);
TS_ASSERT_EQUALS(col.second.size(), col2.second.size());
for (size_t i = 0;i < col.second.size(); ++i) {
TS_ASSERT_EQUALS(col.second[i].get_type(), col2.second[i].get_type());
if (col.second[i].get_type() != flex_type_enum::UNDEFINED) {
TS_ASSERT_EQUALS(col.second[i], col2.second[i]);
}
}
}
}
void test_sframe_iterate() {
// Create an sframe
std::vector<std::shared_ptr<sarray<flexible_type>>>
v{std::make_shared<sarray<flexible_type>>(test_writer_prefix),
std::make_shared<sarray<flexible_type>>(test_writer_dbl_prefix),
std::make_shared<sarray<flexible_type>>(test_writer_str_prefix)};
sframe sf(v);
auto reader = sf.get_reader();
for(size_t i = 0; i < reader->num_segments(); ++i) {
auto iter = reader->begin(i);
auto end_iter = reader->end(i);
TS_ASSERT(iter != end_iter);
TS_ASSERT(iter == iter);
size_t startrow = 0;
for (size_t j = 0; j < i; ++j) {
startrow += reader->segment_length(j);
}
size_t rowid = startrow;
while(iter != end_iter) {
std::vector<flexible_type> expected {flex_int(rowid+1),
flex_float(rowid+1),
flex_string(std::to_string(rowid+1))};
sframe::value_type actual = *iter;
TS_ASSERT_EQUALS(actual.size(), expected.size());
for (size_t j = 0; j < actual.size(); ++j) {
TS_ASSERT_EQUALS(actual[j], expected[j]);
}
++iter;
++rowid;
}
}
// Test that not resetting iterators throws an exception
TS_ASSERT_THROWS_ANYTHING(reader->begin(0));
reader->reset_iterators();
parallel_for(0, reader->num_segments(),
[&](size_t segmentid) {
auto iter = reader->begin(segmentid);
auto end_iter = reader->end(segmentid);
TS_ASSERT(iter != end_iter);
TS_ASSERT(iter == iter);
size_t startrow = 0;
for (size_t i = 0; i < segmentid; ++i) {
startrow += reader->segment_length(i);
}
size_t rowid = startrow;
while(iter != end_iter) {
std::vector<flexible_type> expected {flex_int(rowid+1), flex_float(rowid+1), flex_string(std::to_string(rowid+1))};
TS_ASSERT_EQUALS(iter->size(), expected.size());
for (size_t j = 0; j < iter->size(); ++j) {
TS_ASSERT_EQUALS(iter->at(j), expected[j]);
}
++iter;
++rowid;
}
});
// make 15 threads, each read 5 rows
parallel_for(0, (size_t)15,
[&](size_t startrow) {
std::vector<std::vector<flexible_type> > ret;
size_t nrows = reader->read_rows(startrow, startrow + 5, ret);
TS_ASSERT_EQUALS(nrows, 5);
TS_ASSERT_EQUALS(ret.size(), 5);
for (size_t i = 0;i < ret.size(); ++i) {
size_t rowid = i + startrow;
std::vector<flexible_type> expected {flex_int(rowid+1), flex_float(rowid+1), flex_string(std::to_string(rowid+1))};
TS_ASSERT_EQUALS(ret[i].size(), expected.size());
for (size_t j = 0; j < ret[i].size(); ++j) {
TS_ASSERT_EQUALS(ret[i].at(j), expected[j]);
}
}
});
// once again using the sframe_rows datastructure
// make 15 threads, each read 5 rows
parallel_for(0, (size_t)15,
[&](size_t startrow) {
sframe_rows rows;
size_t nrows = reader->read_rows(startrow, startrow + 5, rows);
TS_ASSERT_EQUALS(nrows, 5);
TS_ASSERT_EQUALS(rows.num_rows(), 5);
TS_ASSERT_EQUALS(rows.num_columns(), 3);
size_t i = 0;
for (const auto& ret: rows) {
size_t rowid = i + startrow;
std::vector<flexible_type> expected {flex_int(rowid+1), flex_float(rowid+1), flex_string(std::to_string(rowid+1))};
TS_ASSERT_EQUALS(ret.size(), expected.size());
for (size_t j = 0; j < ret.size(); ++j) {
TS_ASSERT_EQUALS(ret.at(j), expected[j]);
}
++i;
}
});
// Test other exceptions throwing
TS_ASSERT_THROWS_ANYTHING(reader->begin(3543));
TS_ASSERT_THROWS_ANYTHING(reader->end(3543));
}
void copy_sarray(sarray<flexible_type>& src,
sarray<flexible_type>& dst,
size_t ndst_segments) {
auto src_reader = src.get_reader(1);
dst.open_for_write(ndst_segments);
graphlab::copy(src_reader->begin(0), src_reader->end(0), dst);
dst.close();
}
void validate_test_sframe_logical_segments(std::unique_ptr<sframe_reader> reader,
size_t nsegments) {
TS_ASSERT_EQUALS(reader->num_segments(), nsegments);
// read the data we wrote the last time
std::vector<std::vector<flexible_type> > outdata;
for (size_t i = 0; i < nsegments; ++i) {
auto begin = reader->begin(i);
auto end = reader->end(i);
while(begin != end){
outdata.push_back(*begin);
++begin;
}
}
TS_ASSERT_EQUALS(outdata.size(), 20);
for (size_t i = 0;i < outdata.size(); ++i) {
std::vector<flexible_type> expected {flex_int(i+1), flex_float(i+1)};
auto actual = outdata[i];
TS_ASSERT_EQUALS(actual.size(), expected.size());
for (size_t j = 0; j < actual.size(); ++j) {
TS_ASSERT_EQUALS(actual[j], expected[j]);
}
}
}
void test_sframe_logical_segments() {
// Copy integers to some other target with 4 segments
sarray<flexible_type> src_integers(test_writer_prefix);
std::shared_ptr<sarray<flexible_type> > integers(new sarray<flexible_type>);
copy_sarray(src_integers, *integers, 4);
for (size_t i = 0;i < 4; ++i) TS_ASSERT(integers->segment_length(i) > 0);
// Copy doubles to some other target with 6 segments
sarray<flexible_type> src_doubles(test_writer_dbl_prefix);
std::shared_ptr<sarray<flexible_type> > doubles(new sarray<flexible_type>);
copy_sarray(src_doubles, *doubles, 6);
for (size_t i = 0;i < 6; ++i) TS_ASSERT(doubles->segment_length(i) > 0);
sframe sf(std::vector<std::shared_ptr<sarray<flexible_type>>>{integers, doubles});
validate_test_sframe_logical_segments(sf.get_reader(), 4);
validate_test_sframe_logical_segments(sf.get_reader(8), 8);
validate_test_sframe_logical_segments(sf.get_reader(200), 200);
std::vector<size_t> custom_sizes{4,0,6,10};
validate_test_sframe_logical_segments(sf.get_reader(custom_sizes), 4);
}
void test_sframe_write() {
// Build data
std::vector<std::string> words {"hello", "this", "is", "a",
"test", "of", "writing", "an", "sframe", "let's", "have", "some",
"more", "words", "for", "good", "measure"};
std::vector<std::vector<flexible_type>> data_rows;
for(size_t i = 0; i < words.size(); ++i) {
data_rows.push_back({i, double(i)+0.5, words[i]});
}
std::vector<flex_type_enum> column_types {flex_type_enum::INTEGER,
flex_type_enum::FLOAT,
flex_type_enum::STRING};
std::vector<std::string> column_names {"nums", "decimal_nums", "words"};
// Write a new sframe from a vector of data
for(size_t num_segments = 1; num_segments <= 10; ++num_segments) {
sframe frame;
frame.open_for_write(column_names, column_types, "", num_segments);
// Throw if open before closed
TS_ASSERT_THROWS_ANYTHING(
frame.open_for_write({"hello","world"},
{flex_type_enum::INTEGER,
flex_type_enum::STRING}));
// Add my data rows to an sframe
graphlab::copy(data_rows.begin(), data_rows.end(), frame);
// Not used for anything, just to see if exceptions are thrown when
// I do bad stuff.
auto output_iter = frame.get_output_iterator(0);
// Row of wrong size
TS_ASSERT_THROWS_ANYTHING((
*output_iter=std::vector<flexible_type>({1,2.0,"3","extra"})));
frame.close();
#ifndef NDEBUG
// Write after close
TS_ASSERT_THROWS_ANYTHING((
*output_iter=std::vector<flexible_type>({1,2.0,"3"})));
#endif
TS_ASSERT_EQUALS(frame.num_segments(), num_segments);
TS_ASSERT_EQUALS(frame.num_columns(), column_types.size());
for(size_t i = 0; i < frame.num_columns(); ++i) {
TS_ASSERT_EQUALS(column_names[i], frame.column_name(i));
TS_ASSERT_EQUALS(column_types[i], frame.column_type(i));
}
// Check the data of the sframe
size_t cntr = 0;
auto reader = frame.get_reader();
for(size_t i = 0; i < reader->num_segments(); ++i) {
for(auto iter = reader->begin(i); iter != reader->end(i); ++iter, ++cntr) {
std::vector<flexible_type> expected = data_rows[cntr];
sframe::value_type actual = *iter;
TS_ASSERT_EQUALS(iter->size(), expected.size());
for(size_t j = 0; j < actual.size(); ++j) {
TS_ASSERT_EQUALS(actual[j], expected[j]);
}
}
}
}
}
void test_select_column() {
// Create an sframe
std::vector<std::shared_ptr<sarray<flexible_type>>>
v{std::make_shared<sarray<flexible_type>>(test_writer_prefix),
std::make_shared<sarray<flexible_type>>(test_writer_dbl_prefix),
std::make_shared<sarray<flexible_type>>(test_writer_str_prefix)};
sframe sf(v);
for(size_t i = 0; i < sf.num_columns(); ++i) {
auto column = sf.select_column(i);
size_t index = 0;
auto reader = column->get_reader();
for(size_t j = 0; j < reader->num_segments(); ++j) {
auto iter = reader->begin(j);
while(iter != reader->end(j)) {
if (i == 0) {
TS_ASSERT_EQUALS(*iter, flex_int(index+1));
} else if (i == 1) {
TS_ASSERT_EQUALS(*iter, flex_float(index+1));
} else {
TS_ASSERT_EQUALS(*iter, flex_string(std::to_string(index+1)));
}
++index;
++iter;
}
}
}
}
void test_add_column() {
std::vector<std::shared_ptr<sarray<flexible_type>>>
v{std::make_shared<sarray<flexible_type>>(test_writer_prefix),
std::make_shared<sarray<flexible_type>>(test_writer_dbl_prefix),
std::make_shared<sarray<flexible_type>>(test_writer_str_prefix)};
sframe sf(v);
auto sa_ptr_add_col =
std::make_shared<sarray<flexible_type>>(test_writer_add_col_prefix);
// Column in the original sframe that is the same as the new column
size_t src_col = 1;
sframe sf2 = sf.add_column(sa_ptr_add_col, std::string("copy_col"));
TS_ASSERT_EQUALS(sf2.num_columns(), sf.num_columns()+1);
size_t dst_col = sf2.num_columns()-1;
TS_ASSERT_EQUALS(sf2.column_name(dst_col), "copy_col");
TS_ASSERT_EQUALS(sf2.column_type(dst_col), sf2.column_type(src_col));
TS_ASSERT_EQUALS(sf2.column_type(dst_col), sf.column_type(src_col));
auto reader = sf2.get_reader();
for(size_t i = 0; i < reader->num_segments(); ++i) {
auto iter = reader->begin(i);
auto end_iter = reader->end(i);
while(iter != end_iter) {
const auto& val = *iter;
TS_ASSERT_EQUALS(val[src_col], val[dst_col]);
++iter;
}
}
reader->reset_iterators();
parallel_for(0, sf2.num_segments(),
[&](size_t segmentid) {
auto iter = reader->begin(segmentid);
while(iter != reader->end(segmentid)) {
const auto& val = *iter;
TS_ASSERT_EQUALS(val[src_col], val[dst_col]);
++iter;
}
});
// Test unique column name checking
TS_ASSERT_THROWS_ANYTHING(sf2.add_column(sa_ptr_add_col,
std::string("X1")));
}
// helper for the test below
void check_basic_csv_values(sframe& frame) {
std::vector<std::vector<flexible_type> > vals;
graphlab::copy(frame, std::inserter(vals, vals.end()));
TS_ASSERT_EQUALS(vals.size(), 3);
TS_ASSERT_EQUALS(vals[0].size(), 6);
TS_ASSERT_EQUALS(vals[1].size(), 6);
TS_ASSERT_EQUALS(vals[2].size(), 6);
TS_ASSERT_DELTA(vals[0][0], 1.1, 1E-5);
TS_ASSERT_DELTA(vals[1][0], 2.2, 1E-5);
TS_ASSERT_DELTA(vals[2][0], 3.3, 1E-5);
TS_ASSERT_EQUALS(vals[0][1], 1);
TS_ASSERT_EQUALS(vals[1][1], 2);
TS_ASSERT_EQUALS(vals[2][1], 3);
TS_ASSERT_EQUALS(vals[0][2], "one");
TS_ASSERT_EQUALS(vals[1][2], "two");
TS_ASSERT_EQUALS(vals[2][2], "three");
{
auto v1 = vals[0][3].get<flex_vec>();
auto v2 = vals[1][3].get<flex_vec>();
auto v3 = vals[2][3].get<flex_vec>();
TS_ASSERT_EQUALS(v1.size(), 3);
TS_ASSERT_EQUALS(v2.size(), 3);
TS_ASSERT_EQUALS(v3.size(), 3);
for (size_t i = 0;i < 3; ++i) {
TS_ASSERT_EQUALS(v1[i], 1.0);
TS_ASSERT_EQUALS(v2[i], 2.0);
TS_ASSERT_EQUALS(v3[i], 3.0);
}
}
{
auto v1 = vals[0][4].get<flex_dict>();
auto v2 = vals[1][4].get<flex_dict>();
auto v3 = vals[2][4].get<flex_dict>();
TS_ASSERT_EQUALS(v1.size(), 2);
TS_ASSERT_EQUALS(v2.size(), 2);
TS_ASSERT_EQUALS(v3.size(), 2);
TS_ASSERT_EQUALS((int)v1[0].first, 1);
TS_ASSERT_EQUALS((int)v1[0].second, 1);
TS_ASSERT_EQUALS((int)v2[0].first, 2);
TS_ASSERT_EQUALS((int)v2[0].second, 2);
TS_ASSERT_EQUALS((int)v3[0].first, 3);
TS_ASSERT_EQUALS((int)v3[0].second, 3);
TS_ASSERT_EQUALS((std::string)v1[1].first, "a");
TS_ASSERT_EQUALS((std::string)v1[1].second, "a");
TS_ASSERT_EQUALS((std::string)v2[1].first, "b");
TS_ASSERT_EQUALS((std::string)v2[1].first, "b");
TS_ASSERT_EQUALS((std::string)v3[1].second, "c");
TS_ASSERT_EQUALS((std::string)v3[1].second, "c");
}
{
auto v1 = vals[0][5].get<flex_list>();
auto v2 = vals[1][5].get<flex_list>();
auto v3 = vals[2][5].get<flex_list>();
TS_ASSERT_EQUALS(v1.size(), 2);
TS_ASSERT_EQUALS(v2.size(), 2);
TS_ASSERT_EQUALS(v3.size(), 2);
TS_ASSERT_EQUALS((std::string)v1[0], "a");
TS_ASSERT_EQUALS((std::string)v1[1], "a");
TS_ASSERT_EQUALS((std::string)v2[0], "b");
TS_ASSERT_EQUALS((std::string)v2[1], "b");
TS_ASSERT_EQUALS((std::string)v3[0], "c");
TS_ASSERT_EQUALS((std::string)v3[1], "c");
}
}
// helper for the test below
void check_basic_csv_string_values(sframe& frame) {
std::vector<std::vector<flexible_type> > vals;
graphlab::copy(frame, std::inserter(vals, vals.end()));
TS_ASSERT_EQUALS(vals.size(), 3);
TS_ASSERT_EQUALS(vals[0].size(), 6);
TS_ASSERT_EQUALS(vals[1].size(), 6);
TS_ASSERT_EQUALS(vals[2].size(), 6);
TS_ASSERT_EQUALS(std::string(vals[0][0]), "1.1");
TS_ASSERT_EQUALS(std::string(vals[1][0]), "2.2");
TS_ASSERT_EQUALS(std::string(vals[2][0]), "3.3");
TS_ASSERT_EQUALS(std::string(vals[0][1]), "1");
TS_ASSERT_EQUALS(std::string(vals[1][1]), "2");
TS_ASSERT_EQUALS(std::string(vals[2][1]), "3");
TS_ASSERT_EQUALS(std::string(vals[0][2]), "one");
TS_ASSERT_EQUALS(std::string(vals[1][2]), "two");
TS_ASSERT_EQUALS(std::string(vals[2][2]), "three");
TS_ASSERT_EQUALS(std::string(vals[0][3]), "[1,1,1]");
TS_ASSERT_EQUALS(std::string(vals[1][3]), "[2,2,2]");
TS_ASSERT_EQUALS(std::string(vals[2][3]), "[3,3,3]");
TS_ASSERT_EQUALS(std::string(vals[0][4]), "{1:1,\"a\":\"a\"}");
TS_ASSERT_EQUALS(std::string(vals[1][4]), "{2:2,\"b\":\"b\"}");
TS_ASSERT_EQUALS(std::string(vals[2][4]), "{3:3,\"c\":\"c\"}");
TS_ASSERT_EQUALS(std::string(vals[0][5]), "[a,a]");
TS_ASSERT_EQUALS(std::string(vals[1][5]), "[b,b]");
TS_ASSERT_EQUALS(std::string(vals[2][5]), "[c,c]");
}
void test_column_name_wrangling() {
std::string basic_csv_file = get_temp_name() + ".csv";
std::ofstream fout(basic_csv_file);
fout << "A,A,A.1,B,C,D\n"
<< "1.1,1,one,[1,1,1],{1:1,\"a\":\"a\"},[a,a]\n"
<< "2.2,2,two,[2,2,2],{2:2,\"b\":\"b\"},[b,b]\n"
<< " 3.3,3,three,[3,3,3],{3:3,\"c\":\"c\"},[c,c]\n";
fout.close();
// parse should make 2nd column A.2
// we also omit the hint for A.1. It should default to string
csv_line_tokenizer tokenizer;
tokenizer.delimiter = ',';
tokenizer.init();
sframe frame;
frame.init_from_csvs(basic_csv_file,
tokenizer,
true, // header
false, // continue on failure
false, // do not store errors
{{"A", flex_type_enum::FLOAT}, // hints
{"A.2", flex_type_enum::INTEGER},
{"A.1", flex_type_enum::STRING},
{"B", flex_type_enum::VECTOR},
{"C",flex_type_enum::DICT},
{"D",flex_type_enum::LIST}});
TS_ASSERT_EQUALS(frame.num_rows(), 3);
TS_ASSERT_EQUALS(frame.num_columns(), 6);
TS_ASSERT_EQUALS(frame.column_name(0), "A");
TS_ASSERT_EQUALS(frame.column_name(1), "A.2");
TS_ASSERT_EQUALS(frame.column_name(2), "A.1");
TS_ASSERT_EQUALS(frame.column_name(3), "B");
TS_ASSERT_EQUALS(frame.column_name(4), "C");
TS_ASSERT_EQUALS(frame.column_name(5), "D");
TS_ASSERT_EQUALS(frame.column_type(0), flex_type_enum::FLOAT);
TS_ASSERT_EQUALS(frame.column_type(1), flex_type_enum::INTEGER);
TS_ASSERT_EQUALS(frame.column_type(2), flex_type_enum::STRING);
TS_ASSERT_EQUALS(frame.column_type(3), flex_type_enum::VECTOR);
TS_ASSERT_EQUALS(frame.column_type(4), flex_type_enum::DICT);
TS_ASSERT_EQUALS(frame.column_type(5), flex_type_enum::LIST);
check_basic_csv_values(frame);
}
void run_groupby_aggregate_sum_test(size_t NUM_GROUPS,
size_t NUM_ROWS,
size_t BUFFER_SIZE) {
// create an SFrame with 5 columns, string, int, float, int, unused
sframe input;
input.open_for_write({"str","int","float","int2","unused","vector"},
{flex_type_enum::STRING, flex_type_enum::INTEGER,
flex_type_enum::FLOAT, flex_type_enum::INTEGER,
flex_type_enum::INTEGER, flex_type_enum::VECTOR},
"", 4 /* 4 segments*/);
// we will emit the following into the sframe
// "0", 0, 0.0, 1, 2, {0.0, 0.0, ...}
// "1", 1, 0.5, 2, 3, {1.0, 1.0, ...}
// "2", 2, 1.0, 3, 4, {2.0, 2.0, ...}
// ...
// "99", 99, 49.5, 100, 101, {99.0, 99.0, ...}
// "0", 100, 50.0, 101, 102, {100.0, 100.0, ...}
// "1", 101, 50.5, 102, 103, {101.0, 101.0, ...}
// etc.
// we will groupby column 0 and sum the next 4 columns, summing the 4th
// column (int2) twice. And ignore the last column
std::cout << "Generating input data: " << std::endl;
std::unordered_map<std::string, flexible_type> group_results[4];
for (size_t i = 0;i < NUM_GROUPS; ++i) {
std::string key = std::to_string(i % NUM_GROUPS);
group_results[0][key].reset(flex_type_enum::INTEGER);
group_results[1][key].reset(flex_type_enum::FLOAT);
group_results[2][key].reset(flex_type_enum::INTEGER);
group_results[3][key].reset(flex_type_enum::VECTOR);
group_results[3][key] = std::vector<double> (10,0);
}
for (size_t i = 0;i < NUM_ROWS; ++i) {
auto iter = input.get_output_iterator(i % 4);
std::vector<flexible_type> flex(6);
std::string key = std::to_string(i % NUM_GROUPS);
flex[0] = key;
flex[1] = i;
flex[2] = (double)i / 2.0;
flex[3] = i + 1;
flex[4] = i + 2;
flex[5] = std::vector<double> (10,i);
(*iter) = flex;
++iter;
group_results[0][key] += i;
group_results[1][key] += (double)i / 2.0;
group_results[2][key] += i + 1;
group_results[3][key] += flex[5];
}
input.close();
std::cout << "Starting groupby: " << std::endl;
graphlab::timer ti;
sframe output = graphlab::groupby_aggregate(input,
{"str"},
{"intsum","floatsum","","",""},
{{{"int"}, std::make_shared<groupby_operators::sum>()},
{{"float"}, std::make_shared<groupby_operators::sum>()},
{{"int2"}, std::make_shared<groupby_operators::sum>()},
{{"int2"}, std::make_shared<groupby_operators::sum>()},
{{"vector"}, std::make_shared<groupby_operators::vector_sum>()}},
BUFFER_SIZE);
std::cout << "Groupby done in: " << ti.current_time() << " seconds" << std::endl;
TS_ASSERT_EQUALS(output.num_columns(), 6);
TS_ASSERT_EQUALS(output.num_rows(), NUM_GROUPS);
TS_ASSERT_EQUALS(output.column_name(0), "str");
TS_ASSERT_EQUALS(output.column_name(1), "intsum");
TS_ASSERT_EQUALS(output.column_name(2), "floatsum");
TS_ASSERT_EQUALS(output.column_name(3), "Sum of int2");
TS_ASSERT_EQUALS(output.column_name(4), "Sum of int2.1");
TS_ASSERT_EQUALS(output.column_name(5), "Vector Sum of vector");
TS_ASSERT_EQUALS(output.column_type(0), flex_type_enum::STRING);
TS_ASSERT_EQUALS(output.column_type(1), flex_type_enum::INTEGER);
TS_ASSERT_EQUALS(output.column_type(2), flex_type_enum::FLOAT);
TS_ASSERT_EQUALS(output.column_type(3), flex_type_enum::INTEGER);
TS_ASSERT_EQUALS(output.column_type(4), flex_type_enum::INTEGER);
TS_ASSERT_EQUALS(output.column_type(5), flex_type_enum::VECTOR);
std::vector<std::vector<flexible_type> > ret;
int rows_read = output.get_reader()->read_rows(0, output.num_rows(), ret);
TS_ASSERT_EQUALS(rows_read, NUM_GROUPS);
// make sure every key is covered and is unique
std::set<std::string> allkeys;
for(auto& row : ret) {
std::string key = row[0];
allkeys.insert(key);
TS_ASSERT_EQUALS(int(group_results[0][key]), int(row[1]));
TS_ASSERT_EQUALS(float(group_results[1][key]), float(row[2]));
TS_ASSERT_EQUALS(int(group_results[2][key]), int(row[3]));
TS_ASSERT_EQUALS(int(group_results[2][key]), int(row[4]));
TS_ASSERT_EQUALS(group_results[3][key].get<flex_vec>(), row[5].get<flex_vec>());
}
TS_ASSERT_EQUALS(allkeys.size(), NUM_GROUPS);
}
void run_multikey_groupby_aggregate_sum_test(size_t NUM_GROUPS,
size_t NUM_ROWS,
size_t BUFFER_SIZE) {
// create an SFrame with 7 columns, string, int, float, int, unused, vec
sframe input;
input.open_for_write({"str1","str2","int","float","int2","unused", "vector"},
{flex_type_enum::STRING, flex_type_enum::STRING,
flex_type_enum::INTEGER,
flex_type_enum::FLOAT, flex_type_enum::INTEGER,
flex_type_enum::INTEGER, flex_type_enum::VECTOR},
"", 4 /* 4 segments*/);
// we will emit the following into the sframe
// "", "0", 0, 0.0, 1, 2, {0.0, 0.0, ...}
// "", "1", 1, 0.5, 2, 3, {1.0, 1.0, ...}
// "", "2", 2, 1.0, 3, 4, {2.0, 2.0, ...}
// ...
// "9", "9", 99, 49.5, 100, 101, {99.0, 99.0, ...}
// "10", "0", 100, 50.0, 101, 102, {100.0, 100.0, ...}
// "10", "1", 101, 50.5, 102, 103, {101.0, 101.0, ...}
// etc.
// basically the string counter is split into 2 pieces. The concatenation
// of the first two key columns should make up the actual counter value.
// we will groupby the string columns and sum the next 3 columns, summing
// the 4th column (int2) twice. And ignore the last column
std::cout << "Generating input data: " << std::endl;
std::unordered_map<std::string, flexible_type> group_results[4];
for (size_t i = 0;i < NUM_GROUPS; ++i) {
std::string key = std::to_string(i % NUM_GROUPS);
group_results[0][key].reset(flex_type_enum::INTEGER);
group_results[1][key].reset(flex_type_enum::FLOAT);
group_results[2][key].reset(flex_type_enum::INTEGER);
group_results[3][key].reset(flex_type_enum::VECTOR);
group_results[3][key] = std::vector<double> (10, 0);
}
for (size_t i = 0;i < NUM_ROWS; ++i) {
auto iter = input.get_output_iterator(i % 4);
std::vector<flexible_type> flex(7);
std::string key = std::to_string(i % NUM_GROUPS);
flex[0] = key.substr(0, key.length() - 1);
flex[1] = key.substr(key.length() - 1);
flex[2] = i;
flex[3] = (double)i / 2.0;
flex[4] = i + 1;
flex[5] = i + 2;
flex[6] = std::vector<double> (10, i);
(*iter) = flex;
++iter;
group_results[0][key] += i;
group_results[1][key] += (double)i / 2.0;
group_results[2][key] += i + 1;
group_results[3][key] += flex[6];
}
input.close();
std::cout << "Starting multikey groupby: " << std::endl;
graphlab::timer ti;
sframe output = graphlab::groupby_aggregate(input,
{"str1", "str2"},
{"intsum", "floatsum", "", "", ""},
{{{"int"}, std::make_shared<groupby_operators::sum>()},
{{"float"}, std::make_shared<groupby_operators::sum>()},
{{"int2"}, std::make_shared<groupby_operators::sum>()},
{{"int2"}, std::make_shared<groupby_operators::sum>()},
{{"vector"}, std::make_shared<groupby_operators::vector_sum>()}},
BUFFER_SIZE);
std::cout << "Groupby done in: " << ti.current_time() << " seconds" << std::endl;
TS_ASSERT_EQUALS(output.num_columns(), 7);
TS_ASSERT_EQUALS(output.num_rows(), NUM_GROUPS);
TS_ASSERT_EQUALS(output.column_name(0), "str1");
TS_ASSERT_EQUALS(output.column_name(1), "str2");
TS_ASSERT_EQUALS(output.column_name(2), "intsum");
TS_ASSERT_EQUALS(output.column_name(3), "floatsum");
TS_ASSERT_EQUALS(output.column_name(4), "Sum of int2");
TS_ASSERT_EQUALS(output.column_name(5), "Sum of int2.1");
TS_ASSERT_EQUALS(output.column_name(6), "Vector Sum of vector");
TS_ASSERT_EQUALS(output.column_type(0), flex_type_enum::STRING);
TS_ASSERT_EQUALS(output.column_type(1), flex_type_enum::STRING);
TS_ASSERT_EQUALS(output.column_type(2), flex_type_enum::INTEGER);
TS_ASSERT_EQUALS(output.column_type(3), flex_type_enum::FLOAT);
TS_ASSERT_EQUALS(output.column_type(4), flex_type_enum::INTEGER);
TS_ASSERT_EQUALS(output.column_type(5), flex_type_enum::INTEGER);
TS_ASSERT_EQUALS(output.column_type(6), flex_type_enum::VECTOR);
std::vector<std::vector<flexible_type> > ret;
int rows_read = output.get_reader()->read_rows(0, output.num_rows(), ret);
TS_ASSERT_EQUALS(rows_read, NUM_GROUPS);
// make sure every key is covered and is unique
std::set<std::string> allkeys;
for(auto& row : ret) {
std::string key = row[0] + row[1];
allkeys.insert(key);
TS_ASSERT_EQUALS(int(group_results[0][key]), int(row[2]));
TS_ASSERT_EQUALS(float(group_results[1][key]), float(row[3]));
TS_ASSERT_EQUALS(int(group_results[2][key]), int(row[4]));
TS_ASSERT_EQUALS(int(group_results[2][key]), int(row[5]));
TS_ASSERT_EQUALS(group_results[3][key].get<flex_vec>(), row[6].get<flex_vec>());
}
TS_ASSERT_EQUALS(allkeys.size(), NUM_GROUPS);
}
void run_groupby_aggregate_average_test(size_t NUM_GROUPS,
size_t NUM_ROWS,
size_t BUFFER_SIZE) {
// create an SFrame with 6 columns, string, int, float, int,unused, vec
sframe input;
input.open_for_write({"str","int","float","int2","unused","vector"},
{flex_type_enum::STRING, flex_type_enum::FLOAT,
flex_type_enum::FLOAT, flex_type_enum::FLOAT,
flex_type_enum::FLOAT, flex_type_enum::VECTOR},
"", 4 /* 4 segments*/);
// we will emit the following into the sframe
// "0", 0, 0.0, 1, 2, {0.0,0.0,0.0,..}
// "1", 1, 0.5, 2, 3, {1.0, 1.0, 1.0, ...}
// "2", 2, 1.0, 3, 4, {2.0, 2.0, 2.0, ...}
// ...
// "99", 99, 49.5, 100, 101, {99.0, 99.0, 99.0, ...}
// "0", 100, 50.0, 101, 102, {100.0, 100.0, ...}
// "1", 101, 50.5, 102, 103, {101.0, 101.0, ...}
// etc.
// we will groupby column 0 and average the next 4 columns, averaging the 4th
// column (int2) twice. And ignore the last column
std::cout << "Generating input data: " << std::endl;
std::unordered_map<std::string, flexible_type> group_results[4];
for (size_t i = 0;i < NUM_GROUPS; ++i) {
std::string key = std::to_string(i % NUM_GROUPS);
group_results[0][key].reset(flex_type_enum::FLOAT);
group_results[1][key].reset(flex_type_enum::FLOAT);
group_results[2][key].reset(flex_type_enum::FLOAT);
group_results[3][key].reset(flex_type_enum::VECTOR);
group_results[3][key] = std::vector<double> (10, 0);
}
for (size_t i = 0;i < NUM_ROWS; ++i) {
auto iter = input.get_output_iterator(i % 4);
std::vector<flexible_type> flex(6);
std::string key = std::to_string(i % NUM_GROUPS);
flex[0] = key;
flex[1] = i;
flex[2] = (double)i / 2.0;
flex[3] = i + 1;
flex[4] = i + 2;
flex[5] = std::vector<double> (10, i);
(*iter) = flex;
++iter;
group_results[0][key] += i;
group_results[1][key] += (double)i / 2.0;
group_results[2][key] += i + 1;
group_results[3][key] += flex[5];
}
input.close();
std::cout << "Starting groupby: " << std::endl;
graphlab::timer ti;
sframe output = graphlab::groupby_aggregate(input,
{"str"},
{"intavg","floatavg","","",""},
{{{"int"}, std::make_shared<groupby_operators::average>()},
{{"float"}, std::make_shared<groupby_operators::average>()},
{{"int2"}, std::make_shared<groupby_operators::average>()},
{{"int2"}, std::make_shared<groupby_operators::average>()},
{{"vector"}, std::make_shared<groupby_operators::vector_average>()}},
BUFFER_SIZE);
std::cout << "Groupby done in: " << ti.current_time() << " seconds" << std::endl;
TS_ASSERT_EQUALS(output.num_columns(), 6);
TS_ASSERT_EQUALS(output.num_rows(), NUM_GROUPS);
TS_ASSERT_EQUALS(output.column_name(0), "str");
TS_ASSERT_EQUALS(output.column_name(1), "intavg");
TS_ASSERT_EQUALS(output.column_name(2), "floatavg");
TS_ASSERT_EQUALS(output.column_name(3), "Avg of int2");
TS_ASSERT_EQUALS(output.column_name(4), "Avg of int2.1");
TS_ASSERT_EQUALS(output.column_name(5), "Vector Avg of vector");
TS_ASSERT_EQUALS(output.column_type(0), flex_type_enum::STRING);
TS_ASSERT_EQUALS(output.column_type(1), flex_type_enum::FLOAT);
TS_ASSERT_EQUALS(output.column_type(2), flex_type_enum::FLOAT);
TS_ASSERT_EQUALS(output.column_type(3), flex_type_enum::FLOAT);
TS_ASSERT_EQUALS(output.column_type(4), flex_type_enum::FLOAT);
TS_ASSERT_EQUALS(output.column_type(5), flex_type_enum::VECTOR);
std::vector<std::vector<flexible_type> > ret;
int rows_read = output.get_reader()->read_rows(0, output.num_rows(), ret);
TS_ASSERT_EQUALS(rows_read, NUM_GROUPS);
// make sure every key is covered and is unique
std::set<std::string> allkeys;
for(auto& row : ret) {
std::string key = row[0];
allkeys.insert(key);
TS_ASSERT_DELTA(double(group_results[0][key])*(NUM_GROUPS/double(NUM_ROWS)), double(row[1]), 1E-5);
TS_ASSERT_DELTA(double(group_results[1][key])*(NUM_GROUPS/double(NUM_ROWS)), double(row[2]), 1E-5);
TS_ASSERT_DELTA(double(group_results[2][key])*(NUM_GROUPS/double(NUM_ROWS)), double(row[3]), 1E-5);
TS_ASSERT_DELTA(double(group_results[2][key])*(NUM_GROUPS/double(NUM_ROWS)), double(row[4]), 1E-5);
TS_ASSERT_DELTA((group_results[3][key]*(NUM_GROUPS/double(NUM_ROWS))).get<flex_vec>(), row[5].get<flex_vec>(), 1E-5);
}
TS_ASSERT_EQUALS(allkeys.size(), NUM_GROUPS);
}
void run_multikey_groupby_aggregate_average_test(size_t NUM_GROUPS,
size_t NUM_ROWS,
size_t BUFFER_SIZE) {
// create an SFrame with 7 columns, string, string, int, float, int, unused
sframe input;
input.open_for_write({"str1","str2","int","float","int2","unused","vector"},
{flex_type_enum::STRING, flex_type_enum::STRING,
flex_type_enum::FLOAT,
flex_type_enum::FLOAT, flex_type_enum::FLOAT,
flex_type_enum::FLOAT, flex_type_enum::VECTOR},
"", 4 /* 4 segments*/);
// we will emit the following into the sframe
// "", "0", 0, 0.0, 1, 2, {0.0, 0.0, 0.0, ...}
// "", "1", 1, 0.5, 2, 3, {1.0, 1.0, 1.0, ...}
// "", "2", 2, 1.0, 3, 4, {2.0, 2.0, 2.0, ...}
// ...
// "9", "9", 99, 49.5, 100, 101, {99.0, 99.0, ...}
// "10", "0", 100, 50.0, 101, 102, {100.0, ...}
// "10", "1", 101, 50.5, 102, 103, {101.0, ...}
// etc.
// basically the string counter is split into 2 pieces. The concatenation
// of the first two key columns should make up the actual counter value.
// we will groupby the string columns and average the next 3 columns, averaging
// the 4th column (int2) twice. And ignore the last column
std::cout << "Generating input data: " << std::endl;
std::unordered_map<std::string, flexible_type> group_results[4];
for (size_t i = 0;i < NUM_GROUPS; ++i) {
std::string key = std::to_string(i % NUM_GROUPS);
group_results[0][key].reset(flex_type_enum::FLOAT);
group_results[1][key].reset(flex_type_enum::FLOAT);
group_results[2][key].reset(flex_type_enum::FLOAT);
group_results[3][key].reset(flex_type_enum::VECTOR);
group_results[3][key] = std::vector<double> (10,0);
}
for (size_t i = 0;i < NUM_ROWS; ++i) {
auto iter = input.get_output_iterator(i % 4);
std::vector<flexible_type> flex(7);
std::string key = std::to_string(i % NUM_GROUPS);
flex[0] = key.substr(0, key.length() - 1);
flex[1] = key.substr(key.length() - 1);
flex[2] = i;
flex[3] = (double)i / 2.0;
flex[4] = i + 1;
flex[5] = i + 2;
flex[6] = std::vector<double> (10,i);
(*iter) = flex;
++iter;
group_results[0][key] += i;
group_results[1][key] += (double)i / 2.0;
group_results[2][key] += i + 1;
group_results[3][key] += flex[6];
}
input.close();
std::cout << "Starting multikey groupby: " << std::endl;
graphlab::timer ti;
sframe output = graphlab::groupby_aggregate(input,
{"str1", "str2"},
{"intavg", "floatavg", "", "",""},
{{{"int"}, std::make_shared<groupby_operators::average>()},
{{"float"}, std::make_shared<groupby_operators::average>()},
{{"int2"}, std::make_shared<groupby_operators::average>()},
{{"int2"}, std::make_shared<groupby_operators::average>()},
{{"vector"}, std::make_shared<groupby_operators::vector_average>()}},
BUFFER_SIZE);
std::cout << "Groupby done in: " << ti.current_time() << " seconds" << std::endl;
TS_ASSERT_EQUALS(output.num_columns(), 7);
TS_ASSERT_EQUALS(output.num_rows(), NUM_GROUPS);
TS_ASSERT_EQUALS(output.column_name(0), "str1");
TS_ASSERT_EQUALS(output.column_name(1), "str2");
TS_ASSERT_EQUALS(output.column_name(2), "intavg");
TS_ASSERT_EQUALS(output.column_name(3), "floatavg");
TS_ASSERT_EQUALS(output.column_name(4), "Avg of int2");
TS_ASSERT_EQUALS(output.column_name(5), "Avg of int2.1");
TS_ASSERT_EQUALS(output.column_name(6), "Vector Avg of vector");
TS_ASSERT_EQUALS(output.column_type(0), flex_type_enum::STRING);
TS_ASSERT_EQUALS(output.column_type(1), flex_type_enum::STRING);
TS_ASSERT_EQUALS(output.column_type(2), flex_type_enum::FLOAT);
TS_ASSERT_EQUALS(output.column_type(3), flex_type_enum::FLOAT);
TS_ASSERT_EQUALS(output.column_type(4), flex_type_enum::FLOAT);
TS_ASSERT_EQUALS(output.column_type(5), flex_type_enum::FLOAT);
TS_ASSERT_EQUALS(output.column_type(6), flex_type_enum::VECTOR);
std::vector<std::vector<flexible_type> > ret;
int rows_read = output.get_reader()->read_rows(0, output.num_rows(), ret);
TS_ASSERT_EQUALS(rows_read, NUM_GROUPS);
// make sure every key is covered and is unique
std::set<std::string> allkeys;
for(auto& row : ret) {
std::string key = row[0] + row[1];
allkeys.insert(key);
TS_ASSERT_DELTA(double(group_results[0][key])*(NUM_GROUPS/double(NUM_ROWS)), double(row[2]), 1E-5);
TS_ASSERT_DELTA(double(group_results[1][key])*(NUM_GROUPS/double(NUM_ROWS)), double(row[3]), 1E-5);
TS_ASSERT_DELTA(double(group_results[2][key])*(NUM_GROUPS/double(NUM_ROWS)), double(row[4]), 1E-5);
TS_ASSERT_DELTA(double(group_results[2][key])*(NUM_GROUPS/double(NUM_ROWS)), double(row[5]), 1E-5);
TS_ASSERT_DELTA((group_results[3][key]*(NUM_GROUPS/double(NUM_ROWS))).get<flex_vec>(), row[6].get<flex_vec>(), 1E-5);
}
TS_ASSERT_EQUALS(allkeys.size(), NUM_GROUPS);
}
void test_sframe_groupby_aggregate() {
//small number of groups
run_groupby_aggregate_sum_test(100, 100000, 100);
run_groupby_aggregate_average_test(100, 100000, 100);
//big buffer
run_groupby_aggregate_sum_test(100, 100000, 1000);
run_groupby_aggregate_average_test(100, 100000, 1000);
//very small data
run_groupby_aggregate_sum_test(10, 100, 1000);
run_groupby_aggregate_average_test(10, 100, 1000);
//very small buffer
run_groupby_aggregate_sum_test(1000, 100000, 10);
run_groupby_aggregate_average_test(1000, 100000, 10);
//very very small buffer
run_groupby_aggregate_sum_test(100000, 100000, 2);
run_groupby_aggregate_average_test(100000, 100000, 2);
}
void test_sframe_multikey_groupby_aggregate() {
//small number of groups
run_multikey_groupby_aggregate_sum_test(100, 100000, 100);
run_multikey_groupby_aggregate_average_test(100, 100000, 100);
//big buffer
run_multikey_groupby_aggregate_sum_test(100, 100000, 1000);
run_multikey_groupby_aggregate_average_test(100, 100000, 1000);
//very small data
run_multikey_groupby_aggregate_sum_test(10, 100, 1000);
run_multikey_groupby_aggregate_average_test(10, 100, 1000);
//very small buffer
run_multikey_groupby_aggregate_sum_test(1000, 100000, 10);
run_multikey_groupby_aggregate_average_test(1000, 100000, 10);
//very very small buffer
run_multikey_groupby_aggregate_sum_test(100000, 100000, 2);
run_multikey_groupby_aggregate_average_test(100000, 100000, 2);
}
void test_sframe_groupby_aggregate_negative_tests() {
sframe input;
input.open_for_write({"str","int","float"},
{flex_type_enum::STRING, flex_type_enum::INTEGER,
flex_type_enum::FLOAT},
"", 4 /* 4 segments*/);
// we will emit the following into the sframe
// "0", 0, 0.0
// "1", 1, 1.0
// "2", 2, 2.0
// ...
// "9", 99, 99.0
// "0", 100, 100.0
// "1", 101, 101.1
// etc.
// actual data doesn't really matter. This is just data for negative tests
std::cout << "Generating input data: " << std::endl;
for (size_t i = 0;i < 1000 ; ++i) {
auto iter = input.get_output_iterator(i % 4);
std::vector<flexible_type> flex(3);
std::string key = std::to_string(i % 10);
flex[0] = key;
flex[1] = i;
flex[2] = i;
(*iter) = flex;
++iter;
}
input.close();
// sum on strings shall fail
TS_ASSERT_THROWS_ANYTHING(graphlab::groupby_aggregate(input,
{"int"},
{""},
{{{"str"}, std::make_shared<groupby_operators::sum>()}}));
// multiple identical keys
TS_ASSERT_THROWS_ANYTHING(graphlab::groupby_aggregate(input,
{"str", "str"},
{""},
{{{"int"}, std::make_shared<groupby_operators::sum>()}}));
// nonexistant column
TS_ASSERT_THROWS_ANYTHING(graphlab::groupby_aggregate(input,
{"pika", "str"},
{""},
{{{"int"}, std::make_shared<groupby_operators::sum>()}}));
// nonexistant column
TS_ASSERT_THROWS_ANYTHING(graphlab::groupby_aggregate(input,
{"str"},
{""},
{{{"pika"}, std::make_shared<groupby_operators::sum>()}}));
}
void run_sframe_aggregate_operators_test(std::shared_ptr<group_aggregate_value> val,
const std::vector<size_t>& vals,
const std::vector<flex_type_enum>& input_types,
size_t expected_result) {
std::vector<group_aggregate_value*> parallel_vals;
auto ret = val->set_input_types(input_types);
TS_ASSERT_EQUALS(ret, flex_type_enum::INTEGER);
// make a collection of partial aggregators
for (size_t i = 0;i < 4; ++i) {
parallel_vals.push_back(val->new_instance());
}
for (size_t i = 0;i < 4; ++i) {
TS_ASSERT(typeid(*parallel_vals[i]) == typeid(*val));
}
// perform the partial aggregation
for (size_t i = 0; i < vals.size(); ++i) {
parallel_vals[i % 4]->add_element({vals[i]});
}
// combine the partial aggregates
for (size_t i = 1; i < parallel_vals.size(); ++i) {
parallel_vals[0]->combine(*parallel_vals[i]);
}
// check if values are good
flexible_type final_val = parallel_vals[0]->emit();
TS_ASSERT_EQUALS(final_val.get_type(), flex_type_enum::INTEGER);
TS_ASSERT_EQUALS((size_t)final_val, expected_result);
for (size_t i = 0;i < 4; ++i) {
delete parallel_vals[i];
}
}
void test_sframe_aggregate_operators() {
std::vector<size_t> vals;
for (size_t i = 0;i < 100000; ++i) vals.push_back(i);
size_t min = vals[0], max = vals[0], count = 0, sum = 0;
for (size_t val: vals) {
min = std::min(min, val);
max = std::max(max, val);
++count;
sum += val;
}
run_sframe_aggregate_operators_test(std::make_shared<groupby_operators::sum>(),
vals,
{flex_type_enum::INTEGER},
sum);
run_sframe_aggregate_operators_test(std::make_shared<groupby_operators::min>(),
vals,
{flex_type_enum::INTEGER},
min);
run_sframe_aggregate_operators_test(std::make_shared<groupby_operators::max>(),
vals,
{flex_type_enum::INTEGER},
max);
run_sframe_aggregate_operators_test(std::make_shared<groupby_operators::count>(),
vals,
{},
count);
}
void append_some_data_to_sframe(sframe& sframe_out) {
std::vector<flexible_type> int_col{0,1,2,3,4,5};
std::vector<flexible_type> float_col{0,1,2,3,4,5};
std::vector<flexible_type> str_col{"0","1","2","3","4","5"};
dataframe_t df;
df.set_column("int_col", int_col, flex_type_enum::INTEGER);
df.set_column("float_col", float_col, flex_type_enum::FLOAT);
df.set_column("str_col", str_col, flex_type_enum::STRING);
sframe sf(df);
sframe_out = sframe_out.append(sf);
// make sure sf is still accessible
std::vector<std::vector<flexible_type> > result;
graphlab::copy(sf, std::inserter(result, result.end()));
TS_ASSERT_EQUALS(result.size(), 6);
for (size_t i = 0;i < result.size(); ++i) {
TS_ASSERT_EQUALS(result[i][0], i);
TS_ASSERT_EQUALS(result[i][1], (double)i);
TS_ASSERT_EQUALS(result[i][2], std::to_string(i));
}
}
void test_sframe_append() {
// Create an sframe
sframe sframe_out;
sframe frame2;
append_some_data_to_sframe(frame2);
sframe_out = sframe_out.append(frame2);
// check that the copy is good
TS_ASSERT_EQUALS(sframe_out.size(), 6);
TS_ASSERT_EQUALS(sframe_out.num_columns(), 3);
std::vector<std::vector<flexible_type> > result;
graphlab::copy(sframe_out, std::inserter(result, result.end()));
TS_ASSERT_EQUALS(result.size(), 6);
for (size_t i = 0;i < result.size(); ++i) {
TS_ASSERT_EQUALS(result[i][0], i);
TS_ASSERT_EQUALS(result[i][1], (double)i);
TS_ASSERT_EQUALS(result[i][2], std::to_string(i));
}
// check that frame2 is still good
TS_ASSERT_EQUALS(frame2.size(), 6);
TS_ASSERT_EQUALS(frame2.num_columns(), 3);
result.clear();
graphlab::copy(frame2, std::inserter(result, result.end()));
TS_ASSERT_EQUALS(result.size(), 6);
for (size_t i = 0;i < result.size(); ++i) {
TS_ASSERT_EQUALS(result[i][0], i);
TS_ASSERT_EQUALS(result[i][1], (double)i);
TS_ASSERT_EQUALS(result[i][2], std::to_string(i));
}
// do it again
append_some_data_to_sframe(sframe_out);
// check that the move is good
TS_ASSERT_EQUALS(sframe_out.size(), 2 * 6);
TS_ASSERT_EQUALS(sframe_out.num_columns(), 3);
result.clear();
graphlab::copy(sframe_out, std::inserter(result, result.end()));
TS_ASSERT_EQUALS(result.size(), 2 * 6);
for (size_t i = 0;i < result.size(); ++i) {
TS_ASSERT_EQUALS(result[i][0], i % 6);
TS_ASSERT_EQUALS(result[i][1], (double)(i % 6));
TS_ASSERT_EQUALS(result[i][2], std::to_string(i % 6));
}
}
void test_sframe_rows() {
std::vector<std::vector<flexible_type> > data{{1,2,3,4,5},
{6,7,8,9,10},
{11,12,13,14,15},
{16,17,18,19,20}};
sframe_rows rows;
rows.clear();
rows.add_decoded_column(std::make_shared<std::vector<flexible_type>>(data[0]));
TS_ASSERT_EQUALS(rows.num_rows(), 5);
TS_ASSERT_EQUALS(rows.num_columns(), 1);
size_t i = 0;
for (auto& row: rows) {
TS_ASSERT_EQUALS(row[0], data[0][i]);
++i;
}
}
};
| {"hexsha": "29d03ed95e4ef4c461a0ee8967f430485766c87f", "size": 69640, "ext": "cxx", "lang": "C++", "max_stars_repo_path": "oss_test/sframe/sframe_test.cxx", "max_stars_repo_name": "csgxy123/SFrame-Ex", "max_stars_repo_head_hexsha": "b97cbefdaee9f8842735dbe50a1fa07fa2b460cf", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "oss_test/sframe/sframe_test.cxx", "max_issues_repo_name": "csgxy123/SFrame-Ex", "max_issues_repo_head_hexsha": "b97cbefdaee9f8842735dbe50a1fa07fa2b460cf", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "oss_test/sframe/sframe_test.cxx", "max_forks_repo_name": "csgxy123/SFrame-Ex", "max_forks_repo_head_hexsha": "b97cbefdaee9f8842735dbe50a1fa07fa2b460cf", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.775644871, "max_line_length": 145, "alphanum_fraction": 0.5814905227, "num_tokens": 18319} |
Dear Princess Celestia: FizzBuzz!
I learned modulus with a number using the number x and the number y.
Did you know that product is a number?
For every number factor from 1 to x:
product is now factor times y.
If product isn't less than x:
Then you get product minus x.
That's what I would do!
That's what I did.
That's all about modulus!
I learned fizz with an argument using the number x.
Did you know that remainder is the number modulus using x and 3?
Then you get remainder is 0.
That's all about fizz!
I learned buzz with an argument using the number x.
Did you know that remainder is the number modulus using x and 5?
Then you get remainder is 0.
That's all about buzz!
Today I learned FizzBuzz!
Did you know that fizz here is an argument? (argument is another word for boolean)
Did you know that buzz here is an argument?
For every number i from 1 to 20:
(we use intermediate variables because there's no associativity)
fizz here is now fizz using i!
buzz here is now buzz using i!
If fizz here and buzz here:
I sang "fizzbuzz"!
Otherwise: If fizz here:
I sang "fizz"!
Otherwise: If buzz here:
I sang "buzz"!
Otherwise: I sang i.
That's what I would do.
That's what I would do.
That's what I would do.
That's what I did.
That's all about FizzBuzz!
Your faithful student, Beta. | {"hexsha": "10843f856bba8b5825b82d5db07ce969fc1ad941", "size": 1390, "ext": "fpp", "lang": "FORTRAN", "max_stars_repo_path": "examples/fizzbuzz.fpp", "max_stars_repo_name": "stillinbeta/friendshipismonadic", "max_stars_repo_head_hexsha": "434cee6f1df3bcd87e23cd09022fa5a268d46b15", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2017-12-05T07:32:27.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-13T19:49:15.000Z", "max_issues_repo_path": "examples/fizzbuzz.fpp", "max_issues_repo_name": "stillinbeta/friendshipismonadic", "max_issues_repo_head_hexsha": "434cee6f1df3bcd87e23cd09022fa5a268d46b15", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/fizzbuzz.fpp", "max_forks_repo_name": "stillinbeta/friendshipismonadic", "max_forks_repo_head_hexsha": "434cee6f1df3bcd87e23cd09022fa5a268d46b15", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.5909090909, "max_line_length": 84, "alphanum_fraction": 0.7035971223, "num_tokens": 347} |
#include "ros/ros.h"
#include <lwr_controllers/PoseRPY.h>
#include <kdl/tree.hpp>
#include <Eigen/Dense>
#include <tf/transform_listener.h>
#include <tf/transform_datatypes.h>
#define PI 3.141592653
ros::Subscriber sub_terminal;
ros::Publisher pub_right;
ros::Publisher pub_left;
Eigen::Matrix<double,3,1> p_global_r, p_global_l, p_right, p_left;
tf::StampedTransform transform_right;
tf::StampedTransform transform_left;
double L = 0.1;
Eigen::Matrix<double,3,3> rot_right, rot_left;
Eigen::Matrix<double,3,3> rot_des_r, rot_des_l;
Eigen::Matrix<double,3,3> rot_fin_r, rot_fin_l;
Eigen::Matrix<double,3,1> pos_right, pos_left;
Eigen::Matrix<double,3,3> quat_rot(double x, double y, double z, double w) {
Eigen::Matrix<double,3,3> temp;
temp << 1-2*pow(y,2)-2*pow(z,2), 2*x*y-2*w*z, 2*x*z+2*w*y,
2*x*y+2*w*z, 1-2*pow(x,2)-2*pow(z,2), 2*z*y-2*w*x,
2*x*z-2*w*y, 2*z*y+2*w*x, 1-2*pow(x,2)-2*pow(y,2);
return temp;
}
int sign(double n) {
if (n > 0)
return 1;
else if (n < 0)
return -1;
else
return 0;
}
Eigen::Matrix<double,4,1> rot_quat(Eigen::Matrix<double,3,3> r) {
Eigen::Matrix<double,4,1> temp;
temp << 0.5*sign(r(2,1)-r(1,2))*sqrt(r(0,0)-r(1,1)-r(2,2)+1),
0.5*sign(r(0,2)-r(2,0))*sqrt(r(1,1)-r(2,2)-r(0,0)+1),
0.5*sign(r(1,0)-r(0,1))*sqrt(r(2,2)-r(0,0)-r(1,1)+1),
0.5*sqrt(r(0,0)+r(1,1)+r(2,2)+1);
return temp;
}
void gposeCallback(const lwr_controllers::PoseRPY::ConstPtr& msg) {
KDL::Rotation rot_msg = KDL::Rotation::EulerZYX(msg->orientation.yaw, msg->orientation.pitch, msg->orientation.roll);
double t1,t2,t3,t4;
rot_msg.GetQuaternion(t1,t2,t3,t4);
Eigen::Matrix<double,3,3> rot_msg_mat;
rot_msg_mat = quat_rot(t1,t2,t3,t4);
Eigen::Matrix<double,3,1> vec_r, vec_l;
vec_r << 0, L/2, 0;
vec_l << 0, -L/2, 0;
p_global_r = rot_msg_mat*vec_r;
p_global_l = rot_msg_mat*vec_l;
p_global_r << msg->position.x + p_global_r(0), msg->position.y + p_global_r(1), msg->position.z + p_global_r(2);
p_global_l << msg->position.x + p_global_l(0), msg->position.y + p_global_l(1), msg->position.z + p_global_l(2);
p_right = rot_right*p_global_r + pos_right;
p_left = rot_left*p_global_l + pos_left;
KDL::Rotation rot_glob = KDL::Rotation::EulerZYX(msg->orientation.yaw,msg->orientation.pitch,msg->orientation.roll);
KDL::Rotation rot_des_r_kdl = rot_glob;
rot_des_r_kdl.DoRotX(PI/2);
KDL::Rotation rot_des_l_kdl = rot_glob;
rot_des_l_kdl.DoRotX(-PI/2);
Eigen::Matrix<double,3,3> rot_des_r, rot_des_l;
rot_des_r_kdl.GetQuaternion(t1,t2,t3,t4);
rot_des_r = quat_rot(t1,t2,t3,t4);
rot_des_l_kdl.GetQuaternion(t1,t2,t3,t4);
rot_des_l = quat_rot(t1,t2,t3,t4);
rot_fin_r = rot_right*rot_des_r;
rot_fin_l = rot_left*rot_des_l;
Eigen::Matrix<double,4,1> r, l;
r = rot_quat(rot_fin_r);
l = rot_quat(rot_fin_l);
KDL::Rotation q_r = KDL::Rotation::Quaternion(r(0),r(1),r(2),r(3));
KDL::Rotation q_l = KDL::Rotation::Quaternion(l(0),l(1),l(2),l(3));
lwr_controllers::PoseRPY msg_right;
lwr_controllers::PoseRPY msg_left;
q_r.GetEulerZYX(msg_right.orientation.yaw, msg_right.orientation.pitch, msg_right.orientation.roll);
q_l.GetEulerZYX(msg_left.orientation.yaw, msg_left.orientation.pitch, msg_left.orientation.roll);
msg_left.id = 0;
msg_left.position.x = p_left(0);
msg_left.position.y = p_left(1);
msg_left.position.z = p_left(2);
msg_right.id = 0;
msg_right.position.x = p_right(0);
msg_right.position.y = p_right(1);
msg_right.position.z = p_right(2);
pub_right.publish(msg_right);
pub_left.publish(msg_left);
}
int main(int argc, char **argv) {
// Initialize the node
ros::init(argc, argv, "command_vito");
ros::NodeHandle node;
// rot_des_l << 0, -1, 0,
// 0, 0, 1,
// -1, 0, 0;
// rot_des_r << 1, 0, 0,
// 0, 0, -1,
// 0, 1, 0;
tf::TransformListener listener_right;
tf::TransformListener listener_left;
transform_right.setIdentity();
transform_left.setIdentity();
sleep(5.0);
while (transform_right.getOrigin().getX() == 0 && transform_left.getOrigin().getX() == 0) {
try{
listener_right.lookupTransform("world", "right_arm_base_link", ros::Time(0), transform_right);
listener_left.lookupTransform("world", "left_arm_base_link", ros::Time(0), transform_left);
} catch (tf::TransformException &ex) {
ROS_ERROR("%s",ex.what());
ros::Duration(1.0).sleep();
continue;
}
}
rot_right = quat_rot(transform_right.inverse().getRotation().getX(),
transform_right.inverse().getRotation().getY(),
transform_right.inverse().getRotation().getZ(),
transform_right.inverse().getRotation().getW());
rot_left = quat_rot(transform_left.inverse().getRotation().getX(),
transform_left.inverse().getRotation().getY(),
transform_left.inverse().getRotation().getZ(),
transform_left.inverse().getRotation().getW());
pos_right << transform_right.inverse().getOrigin().getX(),
transform_right.inverse().getOrigin().getY(),
transform_right.inverse().getOrigin().getZ();
pos_left << transform_left.inverse().getOrigin().getX(),
transform_left.inverse().getOrigin().getY(),
transform_left.inverse().getOrigin().getZ();
sub_terminal = node.subscribe("/global_pose", 30, &gposeCallback);
pub_right = node.advertise<lwr_controllers::PoseRPY>("/right_arm/joint_impedance_controller/command", 30);
pub_left = node.advertise<lwr_controllers::PoseRPY>("/left_arm/joint_impedance_controller/command", 30);
sleep(0.1);
// Loop at a specified frequency, publishing movement commands until we shut down
ros::Rate rate(30);
while (ros::ok()) {
ros::spinOnce();
rate.sleep();
}
} | {"hexsha": "909b0840f0553bc88e0c6ffc1bcddfbda3b705bd", "size": 5662, "ext": "cpp", "lang": "C++", "max_stars_repo_path": "lwr_controllers/src/cartesian_command_vito.cpp", "max_stars_repo_name": "wxmerkt/kuka-lwr", "max_stars_repo_head_hexsha": "42841aad08fe771ac4fc8ca451d9c2adc55671a2", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 106.0, "max_stars_repo_stars_event_min_datetime": "2015-01-20T12:45:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-17T11:27:28.000Z", "max_issues_repo_path": "lwr_controllers/src/cartesian_command_vito.cpp", "max_issues_repo_name": "wxmerkt/kuka-lwr", "max_issues_repo_head_hexsha": "42841aad08fe771ac4fc8ca451d9c2adc55671a2", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": 92.0, "max_issues_repo_issues_event_min_datetime": "2015-01-26T09:08:37.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-13T09:31:41.000Z", "max_forks_repo_path": "lwr_controllers/src/cartesian_command_vito.cpp", "max_forks_repo_name": "wxmerkt/kuka-lwr", "max_forks_repo_head_hexsha": "42841aad08fe771ac4fc8ca451d9c2adc55671a2", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 93.0, "max_forks_repo_forks_event_min_datetime": "2015-01-23T16:39:20.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-09T09:24:39.000Z", "avg_line_length": 33.5029585799, "max_line_length": 118, "alphanum_fraction": 0.6840339103, "num_tokens": 1843} |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
#
# Copyright 2016-2021 Blaise Frederick
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# $Author: frederic $
# $Date: 2016/07/12 13:50:29 $
# $Id: tide_funcs.py,v 1.4 2016/07/12 13:50:29 frederic Exp $
#
import matplotlib.pyplot as plt
import numpy as np
import pyfftw
import scipy as sp
from numba import jit
from scipy.stats import johnsonsb, kurtosis, kurtosistest
import rapidtide.fit as tide_fit
import rapidtide.io as tide_io
fftpack = pyfftw.interfaces.scipy_fftpack
pyfftw.interfaces.cache.enable()
# ---------------------------------------- Global constants -------------------------------------------
defaultbutterorder = 6
MAXLINES = 10000000
donotbeaggressive = True
# ----------------------------------------- Conditional imports ---------------------------------------
try:
from memory_profiler import profile
memprofilerexists = True
except ImportError:
memprofilerexists = False
donotusenumba = False
def disablenumba():
global donotusenumba
donotusenumba = True
def conditionaljit():
def resdec(f):
if donotusenumba:
return f
return jit(f, nopython=False)
return resdec
def conditionaljit2():
def resdec(f):
if donotusenumba or donotbeaggressive:
return f
return jit(f, nopython=False)
return resdec
# --------------------------- probability functions -------------------------------------------------
def printthresholds(pcts, thepercentiles, labeltext):
"""
Parameters
----------
pcts
thepercentiles
labeltext
Returns
-------
"""
print(labeltext)
for i in range(0, len(pcts)):
print(
"\tp <",
"{:.3f}".format(1.0 - thepercentiles[i]),
": ",
"{:.3f}".format(pcts[i]),
)
def fitjsbpdf(thehist, histlen, thedata, displayplots=False, nozero=False):
"""
Parameters
----------
thehist
histlen
thedata
displayplots
nozero
Returns
-------
"""
thestore = np.zeros((2, histlen), dtype="float64")
thestore[0, :] = thehist[1][:-1]
thestore[1, :] = thehist[0][:] / (1.0 * len(thedata))
# store the zero term for later
zeroterm = thestore[1, 0]
thestore[1, 0] = 0.0
# fit the johnsonSB function
params = johnsonsb.fit(thedata[np.where(thedata > 0.0)])
# print('Johnson SB fit parameters for pdf:', params)
# restore the zero term if needed
# if nozero is True, assume that R=0 is not special (i.e. there is no spike in the
# histogram at zero from failed fits)
if nozero:
zeroterm = 0.0
else:
thestore[1, 0] = zeroterm
# generate the johnsonsb function
johnsonsbvals = johnsonsb.pdf(thestore[0, :], params[0], params[1], params[2], params[3])
corrfac = (1.0 - zeroterm) / (1.0 * histlen)
johnsonsbvals *= corrfac
johnsonsbvals[0] = zeroterm
if displayplots:
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title("fitjsbpdf: histogram")
plt.plot(thestore[0, :], thestore[1, :], "b", thestore[0, :], johnsonsbvals, "r")
plt.legend(["histogram", "fit to johnsonsb"])
plt.show()
return np.append(params, np.array([zeroterm]))
def getjohnsonppf(percentile, params, zeroterm):
"""
Parameters
----------
percentile
params
zeroterm
Returns
-------
"""
johnsonfunc = johnsonsb(params[0], params[1], params[2], params[3])
corrfac = 1.0 - zeroterm
def sigFromDistributionData(
vallist,
histlen,
thepercentiles,
displayplots=False,
twotail=False,
nozero=False,
dosighistfit=True,
):
"""
Parameters
----------
vallist
histlen
thepercentiles
displayplots
twotail
nozero
dosighistfit
Returns
-------
"""
# check to make sure there are nonzero values first
if len(np.where(vallist != 0.0)[0]) == 0:
print("no nonzero values - skipping percentile calculation")
return None, 0, 0
thehistogram, peakheight, peakloc, peakwidth, centerofmass = makehistogram(
np.abs(vallist), histlen, therange=[0.0, 1.0]
)
if dosighistfit:
histfit = fitjsbpdf(
thehistogram, histlen, vallist, displayplots=displayplots, nozero=nozero
)
if twotail:
thepercentiles = 1.0 - (1.0 - thepercentiles) / 2.0
print("thepercentiles adapted for two tailed distribution:", thepercentiles)
pcts_data = getfracvals(vallist, thepercentiles, nozero=nozero)
if dosighistfit:
pcts_fit = getfracvalsfromfit(histfit, thepercentiles)
return pcts_data, pcts_fit, histfit
else:
return pcts_data, 0, 0
def rfromp(fitfile, thepercentiles):
"""
Parameters
----------
fitfile
thepercentiles
Returns
-------
"""
thefit = np.array(tide_io.readvecs(fitfile)[0]).astype("float64")
print("thefit = ", thefit)
return getfracvalsfromfit(thefit, thepercentiles)
def tfromr(r, nsamps, dfcorrfac=1.0, oversampfactor=1.0, returnp=False):
"""
Parameters
----------
r
nsamps
dfcorrfac
oversampfactor
returnp
Returns
-------
"""
if r >= 1.0:
tval = float("inf")
pval = 0.0
else:
dof = int((dfcorrfac * nsamps) // oversampfactor)
tval = r * np.sqrt(dof / (1 - r * r))
pval = sp.stats.t.sf(abs(tval), dof) * 2.0
if returnp:
return tval, pval
else:
return tval
def zfromr(r, nsamps, dfcorrfac=1.0, oversampfactor=1.0, returnp=False):
"""
Parameters
----------
r
nsamps
dfcorrfac
oversampfactor
returnp
Returns
-------
"""
if r >= 1.0:
zval = float("inf")
pval = 0.0
else:
dof = int((dfcorrfac * nsamps) // oversampfactor)
zval = r / np.sqrt(1.0 / (dof - 3))
pval = 1.0 - sp.stats.norm.cdf(abs(zval))
if returnp:
return zval, pval
else:
return zval
def fisher(r):
"""
Parameters
----------
r
Returns
-------
"""
return 0.5 * np.log((1 + r) / (1 - r))
def kurtosisstats(timecourse):
"""
Parameters
----------
timecourse: array
The timecourse to test
:return:
"""
testres = kurtosistest(timecourse)
return kurtosis(timecourse), testres[0], testres[1]
def fast_ICC_rep_anova(Y, nocache=False, debug=False):
"""
the data Y are entered as a 'table' ie subjects are in rows and repeated
measures in columns
One Sample Repeated measure ANOVA
Y = XB + E with X = [FaTor / Subjects]
This is a hacked up (but fully compatible) version of ICC_rep_anova
from nipype that caches some very expensive operations that depend
only on the input array shape - if you're going to run the routine
multiple times (like, on every voxel of an image), this gives you a
HUGE speed boost for large input arrays. If you change the dimensions
of Y, it will reinitialize automatically. Set nocache to True to get
the original, much slower behavior. No, actually, don't do that. That would
be silly.
"""
global icc_inited
global current_Y_shape
global dfc, dfe, dfr
global nb_subjects, nb_conditions
global x, x0, X
global centerbit
try:
current_Y_shape
if nocache or (current_Y_shape != Y.shape):
icc_inited = False
except NameError:
icc_inited = False
if not icc_inited:
[nb_subjects, nb_conditions] = Y.shape
if debug:
print(
f"fast_ICC_rep_anova inited with nb_subjects = {nb_subjects}, nb_conditions = {nb_conditions}"
)
current_Y_shape = Y.shape
dfc = nb_conditions - 1
dfe = (nb_subjects - 1) * dfc
dfr = nb_subjects - 1
# Compute the repeated measure effect
# ------------------------------------
# Sum Square Total
mean_Y = np.mean(Y)
SST = ((Y - mean_Y) ** 2).sum()
# create the design matrix for the different levels
if not icc_inited:
x = np.kron(np.eye(nb_conditions), np.ones((nb_subjects, 1))) # sessions
x0 = np.tile(np.eye(nb_subjects), (nb_conditions, 1)) # subjects
X = np.hstack([x, x0])
centerbit = np.dot(np.dot(X, np.linalg.pinv(np.dot(X.T, X))), X.T)
# Sum Square Error
predicted_Y = np.dot(centerbit, Y.flatten("F"))
residuals = Y.flatten("F") - predicted_Y
SSE = (residuals**2).sum()
residuals.shape = Y.shape
MSE = SSE / dfe
# Sum square session effect - between columns/sessions
SSC = ((np.mean(Y, 0) - mean_Y) ** 2).sum() * nb_subjects
MSC = SSC / dfc / nb_subjects
session_effect_F = MSC / MSE
# Sum Square subject effect - between rows/subjects
SSR = SST - SSC - SSE
MSR = SSR / dfr
# ICC(3,1) = (mean square subjeT - mean square error) / (mean square subjeT + (k-1)*-mean square error)
ICC = np.nan_to_num((MSR - MSE) / (MSR + dfc * MSE))
e_var = MSE # variance of error
r_var = (MSR - MSE) / nb_conditions # variance between subjects
icc_inited = True
return ICC, r_var, e_var, session_effect_F, dfc, dfe
# --------------------------- histogram functions -------------------------------------------------
def gethistprops(indata, histlen, refine=False, therange=None, pickleft=False, peakthresh=0.33):
"""
Parameters
----------
indata
histlen
refine
therange
pickleftpeak
Returns
-------
"""
thestore = np.zeros((2, histlen), dtype="float64")
if therange is None:
thehist = np.histogram(indata, histlen)
else:
thehist = np.histogram(indata, histlen, therange)
thestore[0, :] = thehist[1][-histlen:]
thestore[1, :] = thehist[0][-histlen:]
# get starting values for the peak, ignoring first and last point of histogram
if pickleft:
overallmax = np.max(thestore[1, 1:-2])
peakindex = 1
i = 1
started = False
finished = False
while i < len(thestore[1, :] - 2) and not finished:
if thestore[1, i] > peakthresh * overallmax:
started = True
if thestore[1, i] > thestore[1, peakindex]:
peakindex = i
if started and (thestore[1, i] < 0.75 * thestore[1, peakindex]):
finished = True
i += 1
else:
peakindex = np.argmax(thestore[1, 1:-2])
peaklag = thestore[0, peakindex + 1]
peakheight = thestore[1, peakindex + 1]
numbins = 1
while (peakindex + numbins < histlen - 1) and (
thestore[1, peakindex + numbins] > peakheight / 2.0
):
numbins += 1
peakwidth = (thestore[0, peakindex + numbins] - thestore[0, peakindex]) * 2.0
if refine:
peakheight, peaklag, peakwidth = tide_fit.gaussfit(
peakheight, peaklag, peakwidth, thestore[0, :], thestore[1, :]
)
return peaklag, peakheight, peakwidth
def makehistogram(indata, histlen, binsize=None, therange=None, refine=False, normalize=False):
"""
Parameters
----------
indata
histlen
binsize
therange
refine
normalize
Returns
-------
"""
if therange is None:
therange = [indata.min(), indata.max()]
if histlen is None and binsize is None:
thebins = 10
elif binsize is not None:
thebins = np.linspace(
therange[0],
therange[1],
(therange[1] - therange[0]) / binsize + 1,
endpoint=True,
)
else:
thebins = histlen
thehist = np.histogram(indata, thebins, therange, density=normalize)
thestore = np.zeros((2, len(thehist[0])), dtype="float64")
thestore[0, :] = (thehist[1][1:] + thehist[1][0:-1]) / 2.0
thestore[1, :] = thehist[0][-histlen:]
# get starting values for the peak, ignoring first and last point of histogram
peakindex = np.argmax(thestore[1, 1:-2])
peakloc = thestore[0, peakindex + 1]
peakheight = thestore[1, peakindex + 1]
numbins = 1
while (peakindex + numbins < histlen - 1) and (
thestore[1, peakindex + numbins] > peakheight / 2.0
):
numbins += 1
peakwidth = (thestore[0, peakindex + numbins] - thestore[0, peakindex]) * 2.0
if refine:
peakheight, peakloc, peakwidth = tide_fit.gaussfit(
peakheight, peakloc, peakwidth, thestore[0, :], thestore[1, :]
)
centerofmass = np.sum(thestore[0, :] * thestore[1, :]) / np.sum(thestore[1, :])
return thehist, peakheight, peakloc, peakwidth, centerofmass
def echoloc(indata, histlen, startoffset=5.0):
thehist, peakheight, peakloc, peakwidth, centerofmass = makehistogram(
indata, histlen, refine=True
)
thestore = np.zeros((2, len(thehist[0])), dtype="float64")
thestore[0, :] = (thehist[1][1:] + thehist[1][0:-1]) / 2.0
thestore[1, :] = thehist[0][-histlen:]
timestep = thestore[0, 1] - thestore[0, 0]
startpt = np.argmax(thestore[1, :]) + int(startoffset // timestep)
print("primary peak:", peakheight, peakloc, peakwidth)
print("startpt, startloc, timestep:", startpt, thestore[1, startpt], timestep)
while (thestore[1, startpt] > thestore[1, startpt + 1]) and (startpt < len(thehist[0]) - 2):
startpt += 1
echopeakindex = np.argmax(thestore[1, startpt:-2]) + startpt
echopeakloc = thestore[0, echopeakindex + 1]
echopeakheight = thestore[1, echopeakindex + 1]
numbins = 1
while (echopeakindex + numbins < histlen - 1) and (
thestore[1, echopeakindex + numbins] > echopeakheight / 2.0
):
numbins += 1
echopeakwidth = (thestore[0, echopeakindex + numbins] - thestore[0, echopeakindex]) * 2.0
echopeakheight, echopeakloc, echopeakwidth = tide_fit.gaussfit(
echopeakheight, echopeakloc, echopeakwidth, thestore[0, :], thestore[1, :]
)
return echopeakloc - peakloc, (echopeakheight * echopeakwidth) / (peakheight * peakwidth)
def makeandsavehistogram(
indata,
histlen,
endtrim,
outname,
binsize=None,
displaytitle="histogram",
displayplots=False,
refine=False,
therange=None,
normalize=False,
dictvarname=None,
thedict=None,
saveasbids=False,
append=False,
debug=False,
):
"""
Parameters
----------
indata
histlen
endtrim
outname
displaytitle
displayplots
refine
therange
normalize
dictvarname
thedict
Returns
-------
"""
thehist, peakheight, peakloc, peakwidth, centerofmass = makehistogram(
indata,
histlen,
binsize=binsize,
therange=therange,
refine=refine,
normalize=normalize,
)
thestore = np.zeros((2, len(thehist[0])), dtype="float64")
thestore[0, :] = (thehist[1][1:] + thehist[1][0:-1]) / 2.0
thebinsizes = np.diff(thehist[1][:])
thestore[1, :] = thehist[0][-histlen:]
if debug:
print(f"histlen: {len(thestore[1, :])}, sizelen: {len(thebinsizes)}")
if dictvarname is None:
varroot = outname
else:
varroot = dictvarname
if thedict is None:
tide_io.writenpvecs(np.array([centerofmass]), outname + "_centerofmass.txt")
tide_io.writenpvecs(np.array([peakloc]), outname + "_peak.txt")
else:
thedict[varroot + "_centerofmass.txt"] = centerofmass
thedict[varroot + "_peak.txt"] = peakloc
if saveasbids:
tide_io.writebidstsv(
outname,
np.transpose(thestore[1, :]),
1.0 / (thestore[0, 1] - thestore[0, 0]),
starttime=thestore[0, 0],
columns=[varroot],
append=append,
debug=debug,
)
else:
tide_io.writenpvecs(thestore, outname + ".txt")
if displayplots:
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title(displaytitle)
plt.plot(thestore[0, : (-1 - endtrim)], thestore[1, : (-1 - endtrim)])
plt.show()
def symmetrize(a, antisymmetric=False, zerodiagonal=False):
"""
Parameters
----------
a
antisymmetric
zerodiagonal
Returns
-------
"""
if antisymmetric:
intermediate = (a - a.T) / 2.0
else:
intermediate = (a + a.T) / 2.0
if zerodiagonal:
return intermediate - np.diag(intermediate.diagonal())
else:
return intermediate
def makepmask(rvals, pval, sighistfit, onesided=True):
"""
Parameters
----------
rvals
pval
sighistfit
onesided
Returns
-------
"""
if onesided:
return np.where(
rvals > getfracvalsfromfit(sighistfit, 1.0 - pval), np.int16(1), np.int16(0)
)
else:
return np.where(
np.abs(rvals) > getfracvalsfromfit(sighistfit, 1.0 - pval / 2.0),
np.int16(1),
np.int16(0),
)
# Find the image intensity value which thefrac of the non-zero voxels in the image exceed
def getfracval(datamat, thefrac, nozero=False):
"""
Parameters
----------
datamat
thefrac
Returns
-------
"""
return getfracvals(datamat, [thefrac], nozero=nozero)[0]
def getfracvals(datamat, thefracs, nozero=False, debug=False):
"""
Parameters
----------
datamat
thefracs
displayplots
nozero
debug
Returns
-------
"""
thevals = []
if nozero:
maskmat = np.sort(datamat[np.where(datamat != 0.0)].flatten())
if len(maskmat) == 0:
for thisfrac in thefracs:
thevals.append(0.0)
return thevals
else:
maskmat = np.sort(datamat.flatten())
maxindex = len(maskmat)
for thisfrac in thefracs:
theindex = np.min([int(np.round(thisfrac * maxindex, 0)), len(maskmat) - 1])
thevals.append(maskmat[theindex])
if debug:
print("getfracvals: input datamat shape", datamat.shape)
print("getfracvals: maskmat shape", maskmat.shape)
print("getfracvals: thefracs", thefracs)
print("getfracvals: maxindex", maxindex)
print("getfracvals: thevals", thevals)
return thevals
def getfracvalsfromfit_old(histfit, thefracs, numbins=2000, displayplots=False):
"""
Parameters
----------
histfit
thefracs
numbins
displayplots
Returns
-------
"""
themax = 1.0
themin = 0.0
bins = np.arange(themin, themax, (themax - themin) / numbins)
meanhist = johnsonsb.pdf(bins, histfit[0], histfit[1], histfit[2], histfit[3])
corrfac = (1.0 - histfit[-1]) / (1.0 * numbins)
meanhist *= corrfac
meanhist[0] = histfit[-1]
cummeanhist = histfit[-1] + (1.0 - histfit[-1]) * johnsonsb.cdf(
bins, histfit[0], histfit[1], histfit[2], histfit[3]
)
thevals = []
if displayplots:
fig = plt.figure()
ax = fig.add_subplot(211)
ax.set_title("probability histogram")
plt.plot(bins[-numbins:], meanhist[-numbins:])
ax = fig.add_subplot(212)
ax.set_title("cumulative mean sum of histogram")
plt.plot(bins[-numbins:], cummeanhist[-numbins:])
plt.show()
for thisfrac in thefracs:
target = cummeanhist[numbins - 1] * thisfrac
thevals.append(0.0)
for i in range(0, numbins):
if cummeanhist[i] >= target:
thevals[-1] = bins[i]
break
return thevals
def getfracvalsfromfit(histfit, thefracs):
"""
Parameters
----------
histfit
thefracs
displayplots
Returns
-------
"""
# print('entering getfracvalsfromfit: histfit=',histfit, ' thefracs=', thefracs)
thedist = johnsonsb(histfit[0], histfit[1], histfit[2], histfit[3])
thevals = thedist.ppf(thefracs)
return thevals
def makemask(image, threshpct=25.0, verbose=False, nozero=False, noneg=False):
"""
Parameters
----------
image: array-like
The image data to generate the mask for.
threshpct: float
Voxels with values greater then threshpct of the 98th percentile of voxel values are preserved.
verbose: bool
If true, print additional debugging information.
nozero: bool
If true, exclude zero values when calculating percentiles
noneg: bool
If true, exclude negative values when calculating percentiles
Returns
-------
themask: array-like
An int16 mask with dimensions matching the input. 1 for voxels to preserve, 0 elsewhere
"""
if noneg:
pct2, pct98, pctthresh = getfracvals(
np.where(image >= 0.0, image, 0.0), [0.02, 0.98, threshpct], nozero=nozero
)
else:
pct2, pct98, pctthresh = getfracvals(image, [0.02, 0.98, threshpct], nozero=nozero)
threshval = pct2 + (threshpct / 100.0) * (pct98 - pct2)
print("old style threshval:", threshval, "new style threshval:", pctthresh)
if verbose:
print(
"fracval:",
pctthresh,
" threshpct:",
threshpct,
" mask threshhold:",
threshval,
)
themask = np.where(image > threshval, np.int16(1), np.int16(0))
return themask
def getmasksize(themask):
"""
Parameters
----------
image: array-like
The mask data to check.
Returns
-------
numvoxels: int
The number of nonzero voxels in themask
"""
return len(np.where(themask > 0)[0])
| {"hexsha": "32fd5ed2644e00fce5fd1d58ef93add579b38ca9", "size": 22153, "ext": "py", "lang": "Python", "max_stars_repo_path": "rapidtide/stats.py", "max_stars_repo_name": "bbfrederick/delaytools", "max_stars_repo_head_hexsha": "190d79ae4c19317dfce38a528e43fd05459f29a5", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2016-06-15T03:45:52.000Z", "max_stars_repo_stars_event_max_datetime": "2016-06-15T03:45:52.000Z", "max_issues_repo_path": "rapidtide/stats.py", "max_issues_repo_name": "bbfrederick/delaytools", "max_issues_repo_head_hexsha": "190d79ae4c19317dfce38a528e43fd05459f29a5", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "rapidtide/stats.py", "max_forks_repo_name": "bbfrederick/delaytools", "max_forks_repo_head_hexsha": "190d79ae4c19317dfce38a528e43fd05459f29a5", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.1546635183, "max_line_length": 110, "alphanum_fraction": 0.5882273281, "include": true, "reason": "import numpy,import scipy,from scipy,from numba", "num_tokens": 6380} |
! -----------------------------------------------------------------------------
! This file was automatically created by SARAH version 4.12.1
! SARAH References: arXiv:0806.0538, 0909.2863, 1002.0840, 1207.0906, 1309.7223
! (c) Florian Staub, 2013
! ------------------------------------------------------------------------------
! File created at 11:22 on 20.8.2017
! ----------------------------------------------------------------------
Module CouplingsCT_NInvSeesaw
Use Control
Use Settings
Use Model_Data_NInvSeesaw
Use Mathematics, Only: CompareMatrices, Adjungate
Contains
Subroutine CalculateCouplingCT(lam,Tlam,kap,Tk,vd,vu,vS,ZA,g1,g2,ZH,ZP, &
& Yd,Td,ZD,Ye,Te,ZE,Yu,Tu,ZU,MUX,lamN,TLN,Yv,Tv,ZVI,ZVR,TW,g3,UM,UP,ZN,ZDL, &
& ZDR,ZEL,ZER,ZUL,ZUR,UV,pG,dlam,dTlam,dkap,dTk,dvd,dvu,dvS,dZA,dg1,dg2,dZH, &
& dZP,dYd,dTd,dZD,dYe,dTe,dZE,dYu,dTu,dZU,dMUX,dlamN,dTLN,dYv,dTv,dZVI,dZVR, &
& dSinTW,dCosTW,dTanTW,dg3,dUM,dUP,dZN,dZDL,dZDR,dZEL,dZER,dZUL,dZUR,dUV,dpG, &
& ctcplAhAhAh,ctcplAhAhhh,ctcplAhhhhh,ctcplAhHpmcHpm,ctcplAhSdcSd,ctcplAhSecSe, &
& ctcplAhSucSu,ctcplAhSvImSvIm,ctcplAhSvImSvRe,ctcplAhSvReSvRe,ctcplhhhhhh, &
& ctcplhhHpmcHpm,ctcplhhSdcSd,ctcplhhSecSe,ctcplhhSucSu,ctcplhhSvImSvIm,ctcplhhSvImSvRe, &
& ctcplhhSvReSvRe,ctcplHpmSucSd,ctcplHpmSvImcSe,ctcplHpmSvRecSe,ctcplSdcHpmcSu, &
& ctcplSeSvImcHpm,ctcplSeSvRecHpm,ctcplAhhhVZ,ctcplAhHpmcVWm,ctcplAhcHpmVWm, &
& ctcplhhHpmcVWm,ctcplhhcHpmVWm,ctcplHpmcHpmVP,ctcplHpmcHpmVZ,ctcplSdcSdVG, &
& ctcplSdcSdVP,ctcplSdcSdVZ,ctcplSdcSucVWm,ctcplSeSvImcVWm,ctcplSeSvRecVWm, &
& ctcplSecSeVP,ctcplSecSeVZ,ctcplSucSuVG,ctcplSucSuVP,ctcplSucSdVWm,ctcplSucSuVZ, &
& ctcplSvImSvReVZ,ctcplSvImcSeVWm,ctcplSvRecSeVWm,ctcplhhcVWmVWm,ctcplhhVZVZ, &
& ctcplHpmcVWmVP,ctcplHpmcVWmVZ,ctcplcHpmVPVWm,ctcplcHpmVWmVZ,ctcplVGVGVG, &
& ctcplcVWmVPVWm,ctcplcVWmVWmVZ,ctcplcChaChaAhL,ctcplcChaChaAhR,ctcplChiChiAhL, &
& ctcplChiChiAhR,ctcplcFdFdAhL,ctcplcFdFdAhR,ctcplcFeFeAhL,ctcplcFeFeAhR,ctcplcFuFuAhL, &
& ctcplcFuFuAhR,ctcplFvFvAhL,ctcplFvFvAhR,ctcplChiChacHpmL,ctcplChiChacHpmR, &
& ctcplChaFucSdL,ctcplChaFucSdR,ctcplFvChacSeL,ctcplFvChacSeR,ctcplcChaChahhL, &
& ctcplcChaChahhR,ctcplcFdChaSuL,ctcplcFdChaSuR,ctcplcFeChaSvImL,ctcplcFeChaSvImR, &
& ctcplcFeChaSvReL,ctcplcFeChaSvReR,ctcplChiChihhL,ctcplChiChihhR,ctcplChiFdcSdL, &
& ctcplChiFdcSdR,ctcplChiFecSeL,ctcplChiFecSeR,ctcplChiFucSuL,ctcplChiFucSuR, &
& ctcplChiFvSvImL,ctcplChiFvSvImR,ctcplChiFvSvReL,ctcplChiFvSvReR,ctcplcChaChiHpmL, &
& ctcplcChaChiHpmR,ctcplcFdChiSdL,ctcplcFdChiSdR,ctcplcFeChiSeL,ctcplcFeChiSeR, &
& ctcplcFuChiSuL,ctcplcFuChiSuR,ctcplGluFdcSdL,ctcplGluFdcSdR,ctcplcFdFdhhL, &
& ctcplcFdFdhhR,ctcplcChaFdcSuL,ctcplcChaFdcSuR,ctcplcFuFdcHpmL,ctcplcFuFdcHpmR, &
& ctcplFvFecHpmL,ctcplFvFecHpmR,ctcplcFeFehhL,ctcplcFeFehhR,ctcplcChaFeSvImL, &
& ctcplcChaFeSvImR,ctcplcChaFeSvReL,ctcplcChaFeSvReR,ctcplGluFucSuL,ctcplGluFucSuR, &
& ctcplcFuFuhhL,ctcplcFuFuhhR,ctcplcFdFuHpmL,ctcplcFdFuHpmR,ctcplFvFvhhL,ctcplFvFvhhR, &
& ctcplcFeFvHpmL,ctcplcFeFvHpmR,ctcplcChaFvSeL,ctcplcChaFvSeR,ctcplcFdGluSdL, &
& ctcplcFdGluSdR,ctcplcFuGluSuL,ctcplcFuGluSuR,ctcplcChacFuSdL,ctcplcChacFuSdR, &
& ctcplChiChacVWmL,ctcplChiChacVWmR,ctcplcChaChaVPL,ctcplcChaChaVPR,ctcplcChaChaVZL, &
& ctcplcChaChaVZR,ctcplChiChiVZL,ctcplChiChiVZR,ctcplcChaChiVWmL,ctcplcChaChiVWmR, &
& ctcplcFdFdVGL,ctcplcFdFdVGR,ctcplcFdFdVPL,ctcplcFdFdVPR,ctcplcFdFdVZL,ctcplcFdFdVZR, &
& ctcplcFuFdcVWmL,ctcplcFuFdcVWmR,ctcplFvFecVWmL,ctcplFvFecVWmR,ctcplcFeFeVPL, &
& ctcplcFeFeVPR,ctcplcFeFeVZL,ctcplcFeFeVZR,ctcplcFuFuVGL,ctcplcFuFuVGR,ctcplcFuFuVPL, &
& ctcplcFuFuVPR,ctcplcFdFuVWmL,ctcplcFdFuVWmR,ctcplcFuFuVZL,ctcplcFuFuVZR, &
& ctcplFvFvVZL,ctcplFvFvVZR,ctcplcFeFvVWmL,ctcplcFeFvVWmR,ctcplGluGluVGL,ctcplGluGluVGR)
Implicit None
Real(dp), Intent(in) :: vd,vu,vS,ZA(3,3),g1,g2,ZH(3,3),ZP(2,2),TW,g3,dvd,dvu,dvS,dZA(3,3),dg1,dg2, &
& dZH(3,3),dZP(2,2),dSinTW,dCosTW,dTanTW,dg3
Complex(dp), Intent(in) :: lam,Tlam,kap,Tk,Yd(3,3),Td(3,3),ZD(6,6),Ye(3,3),Te(3,3),ZE(6,6),Yu(3,3), &
& Tu(3,3),ZU(6,6),MUX(3,3),lamN(3,3),TLN(3,3),Yv(3,3),Tv(3,3),ZVI(9,9),ZVR(9,9), &
& UM(2,2),UP(2,2),ZN(5,5),ZDL(3,3),ZDR(3,3),ZEL(3,3),ZER(3,3),ZUL(3,3),ZUR(3,3), &
& UV(9,9),pG,dlam,dTlam,dkap,dTk,dYd(3,3),dTd(3,3),dZD(6,6),dYe(3,3),dTe(3,3), &
& dZE(6,6),dYu(3,3),dTu(3,3),dZU(6,6),dMUX(3,3),dlamN(3,3),dTLN(3,3),dYv(3,3), &
& dTv(3,3),dZVI(9,9),dZVR(9,9),dUM(2,2),dUP(2,2),dZN(5,5),dZDL(3,3),dZDR(3,3), &
& dZEL(3,3),dZER(3,3),dZUL(3,3),dZUR(3,3),dUV(9,9),dpG
Complex(dp), Intent(out) :: ctcplAhAhAh(3,3,3),ctcplAhAhhh(3,3,3),ctcplAhhhhh(3,3,3),ctcplAhHpmcHpm(3,2,2), &
& ctcplAhSdcSd(3,6,6),ctcplAhSecSe(3,6,6),ctcplAhSucSu(3,6,6),ctcplAhSvImSvIm(3,9,9), &
& ctcplAhSvImSvRe(3,9,9),ctcplAhSvReSvRe(3,9,9),ctcplhhhhhh(3,3,3),ctcplhhHpmcHpm(3,2,2),&
& ctcplhhSdcSd(3,6,6),ctcplhhSecSe(3,6,6),ctcplhhSucSu(3,6,6),ctcplhhSvImSvIm(3,9,9), &
& ctcplhhSvImSvRe(3,9,9),ctcplhhSvReSvRe(3,9,9),ctcplHpmSucSd(2,6,6),ctcplHpmSvImcSe(2,9,6),&
& ctcplHpmSvRecSe(2,9,6),ctcplSdcHpmcSu(6,2,6),ctcplSeSvImcHpm(6,9,2),ctcplSeSvRecHpm(6,9,2),&
& ctcplAhhhVZ(3,3),ctcplAhHpmcVWm(3,2),ctcplAhcHpmVWm(3,2),ctcplhhHpmcVWm(3,2), &
& ctcplhhcHpmVWm(3,2),ctcplHpmcHpmVP(2,2),ctcplHpmcHpmVZ(2,2),ctcplSdcSdVG(6,6), &
& ctcplSdcSdVP(6,6),ctcplSdcSdVZ(6,6),ctcplSdcSucVWm(6,6),ctcplSeSvImcVWm(6,9), &
& ctcplSeSvRecVWm(6,9),ctcplSecSeVP(6,6),ctcplSecSeVZ(6,6),ctcplSucSuVG(6,6), &
& ctcplSucSuVP(6,6),ctcplSucSdVWm(6,6),ctcplSucSuVZ(6,6),ctcplSvImSvReVZ(9,9), &
& ctcplSvImcSeVWm(9,6),ctcplSvRecSeVWm(9,6),ctcplhhcVWmVWm(3),ctcplhhVZVZ(3), &
& ctcplHpmcVWmVP(2),ctcplHpmcVWmVZ(2),ctcplcHpmVPVWm(2),ctcplcHpmVWmVZ(2), &
& ctcplVGVGVG,ctcplcVWmVPVWm,ctcplcVWmVWmVZ,ctcplcChaChaAhL(2,2,3),ctcplcChaChaAhR(2,2,3),&
& ctcplChiChiAhL(5,5,3),ctcplChiChiAhR(5,5,3),ctcplcFdFdAhL(3,3,3),ctcplcFdFdAhR(3,3,3), &
& ctcplcFeFeAhL(3,3,3),ctcplcFeFeAhR(3,3,3),ctcplcFuFuAhL(3,3,3),ctcplcFuFuAhR(3,3,3), &
& ctcplFvFvAhL(9,9,3),ctcplFvFvAhR(9,9,3),ctcplChiChacHpmL(5,2,2),ctcplChiChacHpmR(5,2,2),&
& ctcplChaFucSdL(2,3,6),ctcplChaFucSdR(2,3,6),ctcplFvChacSeL(9,2,6),ctcplFvChacSeR(9,2,6),&
& ctcplcChaChahhL(2,2,3),ctcplcChaChahhR(2,2,3),ctcplcFdChaSuL(3,2,6),ctcplcFdChaSuR(3,2,6),&
& ctcplcFeChaSvImL(3,2,9),ctcplcFeChaSvImR(3,2,9),ctcplcFeChaSvReL(3,2,9), &
& ctcplcFeChaSvReR(3,2,9),ctcplChiChihhL(5,5,3),ctcplChiChihhR(5,5,3),ctcplChiFdcSdL(5,3,6),&
& ctcplChiFdcSdR(5,3,6),ctcplChiFecSeL(5,3,6),ctcplChiFecSeR(5,3,6),ctcplChiFucSuL(5,3,6),&
& ctcplChiFucSuR(5,3,6),ctcplChiFvSvImL(5,9,9),ctcplChiFvSvImR(5,9,9),ctcplChiFvSvReL(5,9,9),&
& ctcplChiFvSvReR(5,9,9),ctcplcChaChiHpmL(2,5,2),ctcplcChaChiHpmR(2,5,2),ctcplcFdChiSdL(3,5,6),&
& ctcplcFdChiSdR(3,5,6),ctcplcFeChiSeL(3,5,6),ctcplcFeChiSeR(3,5,6),ctcplcFuChiSuL(3,5,6),&
& ctcplcFuChiSuR(3,5,6),ctcplGluFdcSdL(3,6),ctcplGluFdcSdR(3,6),ctcplcFdFdhhL(3,3,3), &
& ctcplcFdFdhhR(3,3,3),ctcplcChaFdcSuL(2,3,6),ctcplcChaFdcSuR(2,3,6),ctcplcFuFdcHpmL(3,3,2),&
& ctcplcFuFdcHpmR(3,3,2),ctcplFvFecHpmL(9,3,2),ctcplFvFecHpmR(9,3,2),ctcplcFeFehhL(3,3,3),&
& ctcplcFeFehhR(3,3,3),ctcplcChaFeSvImL(2,3,9),ctcplcChaFeSvImR(2,3,9),ctcplcChaFeSvReL(2,3,9),&
& ctcplcChaFeSvReR(2,3,9),ctcplGluFucSuL(3,6),ctcplGluFucSuR(3,6),ctcplcFuFuhhL(3,3,3), &
& ctcplcFuFuhhR(3,3,3),ctcplcFdFuHpmL(3,3,2),ctcplcFdFuHpmR(3,3,2),ctcplFvFvhhL(9,9,3), &
& ctcplFvFvhhR(9,9,3),ctcplcFeFvHpmL(3,9,2),ctcplcFeFvHpmR(3,9,2),ctcplcChaFvSeL(2,9,6), &
& ctcplcChaFvSeR(2,9,6),ctcplcFdGluSdL(3,6),ctcplcFdGluSdR(3,6),ctcplcFuGluSuL(3,6), &
& ctcplcFuGluSuR(3,6),ctcplcChacFuSdL(2,3,6),ctcplcChacFuSdR(2,3,6),ctcplChiChacVWmL(5,2),&
& ctcplChiChacVWmR(5,2),ctcplcChaChaVPL(2,2),ctcplcChaChaVPR(2,2),ctcplcChaChaVZL(2,2), &
& ctcplcChaChaVZR(2,2),ctcplChiChiVZL(5,5),ctcplChiChiVZR(5,5),ctcplcChaChiVWmL(2,5), &
& ctcplcChaChiVWmR(2,5),ctcplcFdFdVGL(3,3),ctcplcFdFdVGR(3,3),ctcplcFdFdVPL(3,3)
Complex(dp), Intent(out) :: ctcplcFdFdVPR(3,3),ctcplcFdFdVZL(3,3),ctcplcFdFdVZR(3,3),ctcplcFuFdcVWmL(3,3), &
& ctcplcFuFdcVWmR(3,3),ctcplFvFecVWmL(9,3),ctcplFvFecVWmR(9,3),ctcplcFeFeVPL(3,3), &
& ctcplcFeFeVPR(3,3),ctcplcFeFeVZL(3,3),ctcplcFeFeVZR(3,3),ctcplcFuFuVGL(3,3), &
& ctcplcFuFuVGR(3,3),ctcplcFuFuVPL(3,3),ctcplcFuFuVPR(3,3),ctcplcFdFuVWmL(3,3), &
& ctcplcFdFuVWmR(3,3),ctcplcFuFuVZL(3,3),ctcplcFuFuVZR(3,3),ctcplFvFvVZL(9,9), &
& ctcplFvFvVZR(9,9),ctcplcFeFvVWmL(3,9),ctcplcFeFvVWmR(3,9),ctcplGluGluVGL, &
& ctcplGluGluVGR
Integer :: gt1, gt2, gt3, gt4, ct1, ct2, ct3, ct4
Iname = Iname + 1
NameOfUnit(Iname) = 'CalculateCouplingCT'
ctcplAhAhAh = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Do gt3 = 1, 3
Call CT_CouplingAhAhAh(gt1,gt2,gt3,lam,Tlam,kap,Tk,vd,vu,vS,ZA,dlam,dTlam, &
& dkap,dTk,dvd,dvu,dvS,dZA,ctcplAhAhAh(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplAhAhhh = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Do gt3 = 1, 3
Call CT_CouplingAhAhhh(gt1,gt2,gt3,g1,g2,lam,Tlam,kap,Tk,vd,vu,vS,ZH,ZA, &
& dg1,dg2,dlam,dTlam,dkap,dTk,dvd,dvu,dvS,dZH,dZA,ctcplAhAhhh(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplAhhhhh = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Do gt3 = 1, 3
Call CT_CouplingAhhhhh(gt1,gt2,gt3,lam,Tlam,kap,Tk,vd,vu,vS,ZH,ZA,dlam, &
& dTlam,dkap,dTk,dvd,dvu,dvS,dZH,dZA,ctcplAhhhhh(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplAhHpmcHpm = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 2
Do gt3 = 1, 2
Call CT_CouplingAhHpmcHpm(gt1,gt2,gt3,g2,lam,Tlam,kap,vd,vu,vS,ZA,ZP,dg2, &
& dlam,dTlam,dkap,dvd,dvu,dvS,dZA,dZP,ctcplAhHpmcHpm(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplAhSdcSd = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 6
Do gt3 = 1, 6
Call CT_CouplingAhSdcSd(gt1,gt2,gt3,Yd,Td,lam,vu,vS,ZD,ZA,dYd,dTd,dlam, &
& dvu,dvS,dZD,dZA,ctcplAhSdcSd(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplAhSecSe = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 6
Do gt3 = 1, 6
Call CT_CouplingAhSecSe(gt1,gt2,gt3,Ye,Te,lam,vu,vS,ZE,ZA,dYe,dTe,dlam, &
& dvu,dvS,dZE,dZA,ctcplAhSecSe(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplAhSucSu = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 6
Do gt3 = 1, 6
Call CT_CouplingAhSucSu(gt1,gt2,gt3,lam,Yu,Tu,vd,vS,ZU,ZA,dlam,dYu,dTu, &
& dvd,dvS,dZU,dZA,ctcplAhSucSu(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplAhSvImSvIm = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 9
Do gt3 = 1, 9
Call CT_CouplingAhSvImSvIm(gt1,gt2,gt3,MUX,lam,kap,lamN,TLN,Yv,Tv,vd,vu, &
& vS,ZVI,ZA,dMUX,dlam,dkap,dlamN,dTLN,dYv,dTv,dvd,dvu,dvS,dZVI,dZA,ctcplAhSvImSvIm(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplAhSvImSvRe = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 9
Do gt3 = 1, 9
Call CT_CouplingAhSvImSvRe(gt1,gt2,gt3,MUX,lam,kap,lamN,TLN,Yv,Tv,vd,vu, &
& vS,ZVI,ZVR,ZA,dMUX,dlam,dkap,dlamN,dTLN,dYv,dTv,dvd,dvu,dvS,dZVI,dZVR,dZA, &
& ctcplAhSvImSvRe(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplAhSvReSvRe = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 9
Do gt3 = 1, 9
Call CT_CouplingAhSvReSvRe(gt1,gt2,gt3,MUX,lam,kap,lamN,TLN,Yv,Tv,vd,vu, &
& vS,ZVR,ZA,dMUX,dlam,dkap,dlamN,dTLN,dYv,dTv,dvd,dvu,dvS,dZVR,dZA,ctcplAhSvReSvRe(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplhhhhhh = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Do gt3 = 1, 3
Call CT_Couplinghhhhhh(gt1,gt2,gt3,g1,g2,lam,Tlam,kap,Tk,vd,vu,vS,ZH,dg1, &
& dg2,dlam,dTlam,dkap,dTk,dvd,dvu,dvS,dZH,ctcplhhhhhh(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplhhHpmcHpm = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 2
Do gt3 = 1, 2
Call CT_CouplinghhHpmcHpm(gt1,gt2,gt3,g1,g2,lam,Tlam,kap,vd,vu,vS,ZH,ZP, &
& dg1,dg2,dlam,dTlam,dkap,dvd,dvu,dvS,dZH,dZP,ctcplhhHpmcHpm(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplhhSdcSd = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 6
Do gt3 = 1, 6
Call CT_CouplinghhSdcSd(gt1,gt2,gt3,g1,g2,Yd,Td,lam,vd,vu,vS,ZD,ZH,dg1, &
& dg2,dYd,dTd,dlam,dvd,dvu,dvS,dZD,dZH,ctcplhhSdcSd(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplhhSecSe = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 6
Do gt3 = 1, 6
Call CT_CouplinghhSecSe(gt1,gt2,gt3,g1,g2,Ye,Te,lam,vd,vu,vS,ZE,ZH,dg1, &
& dg2,dYe,dTe,dlam,dvd,dvu,dvS,dZE,dZH,ctcplhhSecSe(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplhhSucSu = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 6
Do gt3 = 1, 6
Call CT_CouplinghhSucSu(gt1,gt2,gt3,g1,g2,lam,Yu,Tu,vd,vu,vS,ZU,ZH,dg1, &
& dg2,dlam,dYu,dTu,dvd,dvu,dvS,dZU,dZH,ctcplhhSucSu(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplhhSvImSvIm = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 9
Do gt3 = 1, 9
Call CT_CouplinghhSvImSvIm(gt1,gt2,gt3,g1,g2,MUX,lam,kap,lamN,TLN,Yv,Tv, &
& vd,vu,vS,ZVI,ZH,dg1,dg2,dMUX,dlam,dkap,dlamN,dTLN,dYv,dTv,dvd,dvu,dvS,dZVI, &
& dZH,ctcplhhSvImSvIm(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplhhSvImSvRe = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 9
Do gt3 = 1, 9
Call CT_CouplinghhSvImSvRe(gt1,gt2,gt3,MUX,lam,kap,lamN,TLN,Yv,Tv,vd,vu, &
& vS,ZVI,ZVR,ZH,dMUX,dlam,dkap,dlamN,dTLN,dYv,dTv,dvd,dvu,dvS,dZVI,dZVR,dZH, &
& ctcplhhSvImSvRe(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplhhSvReSvRe = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 9
Do gt3 = 1, 9
Call CT_CouplinghhSvReSvRe(gt1,gt2,gt3,g1,g2,MUX,lam,kap,lamN,TLN,Yv,Tv, &
& vd,vu,vS,ZVR,ZH,dg1,dg2,dMUX,dlam,dkap,dlamN,dTLN,dYv,dTv,dvd,dvu,dvS,dZVR, &
& dZH,ctcplhhSvReSvRe(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplHpmSucSd = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 6
Do gt3 = 1, 6
Call CT_CouplingHpmSucSd(gt1,gt2,gt3,g2,Yd,Td,lam,Yu,Tu,vd,vu,vS,ZD,ZU, &
& ZP,dg2,dYd,dTd,dlam,dYu,dTu,dvd,dvu,dvS,dZD,dZU,dZP,ctcplHpmSucSd(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplHpmSvImcSe = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 9
Do gt3 = 1, 6
Call CT_CouplingHpmSvImcSe(gt1,gt2,gt3,g2,Ye,Te,lam,lamN,Yv,Tv,vd,vu,vS, &
& ZVI,ZE,ZP,dg2,dYe,dTe,dlam,dlamN,dYv,dTv,dvd,dvu,dvS,dZVI,dZE,dZP,ctcplHpmSvImcSe(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplHpmSvRecSe = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 9
Do gt3 = 1, 6
Call CT_CouplingHpmSvRecSe(gt1,gt2,gt3,g2,Ye,Te,lam,lamN,Yv,Tv,vd,vu,vS, &
& ZVR,ZE,ZP,dg2,dYe,dTe,dlam,dlamN,dYv,dTv,dvd,dvu,dvS,dZVR,dZE,dZP,ctcplHpmSvRecSe(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplSdcHpmcSu = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 2
Do gt3 = 1, 6
Call CT_CouplingSdcHpmcSu(gt1,gt2,gt3,g2,Yd,Td,lam,Yu,Tu,vd,vu,vS,ZD,ZU, &
& ZP,dg2,dYd,dTd,dlam,dYu,dTu,dvd,dvu,dvS,dZD,dZU,dZP,ctcplSdcHpmcSu(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplSeSvImcHpm = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 9
Do gt3 = 1, 2
Call CT_CouplingSeSvImcHpm(gt1,gt2,gt3,g2,Ye,Te,lam,lamN,Yv,Tv,vd,vu,vS, &
& ZVI,ZE,ZP,dg2,dYe,dTe,dlam,dlamN,dYv,dTv,dvd,dvu,dvS,dZVI,dZE,dZP,ctcplSeSvImcHpm(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplSeSvRecHpm = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 9
Do gt3 = 1, 2
Call CT_CouplingSeSvRecHpm(gt1,gt2,gt3,g2,Ye,Te,lam,lamN,Yv,Tv,vd,vu,vS, &
& ZVR,ZE,ZP,dg2,dYe,dTe,dlam,dlamN,dYv,dTv,dvd,dvu,dvS,dZVR,dZE,dZP,ctcplSeSvRecHpm(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplAhhhVZ = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Call CT_CouplingAhhhVZ(gt1,gt2,g1,g2,ZH,ZA,TW,dg1,dg2,dZH,dZA,dSinTW,dCosTW, &
& dTanTW,ctcplAhhhVZ(gt1,gt2))
End Do
End Do
ctcplAhHpmcVWm = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 2
Call CT_CouplingAhHpmcVWm(gt1,gt2,g2,ZA,ZP,dg2,dZA,dZP,ctcplAhHpmcVWm(gt1,gt2))
End Do
End Do
ctcplAhcHpmVWm = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 2
Call CT_CouplingAhcHpmVWm(gt1,gt2,g2,ZA,ZP,dg2,dZA,dZP,ctcplAhcHpmVWm(gt1,gt2))
End Do
End Do
ctcplhhHpmcVWm = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 2
Call CT_CouplinghhHpmcVWm(gt1,gt2,g2,ZH,ZP,dg2,dZH,dZP,ctcplhhHpmcVWm(gt1,gt2))
End Do
End Do
ctcplhhcHpmVWm = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 2
Call CT_CouplinghhcHpmVWm(gt1,gt2,g2,ZH,ZP,dg2,dZH,dZP,ctcplhhcHpmVWm(gt1,gt2))
End Do
End Do
ctcplHpmcHpmVP = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 2
Call CT_CouplingHpmcHpmVP(gt1,gt2,g1,g2,ZP,TW,dg1,dg2,dZP,dSinTW,dCosTW, &
& dTanTW,ctcplHpmcHpmVP(gt1,gt2))
End Do
End Do
ctcplHpmcHpmVZ = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 2
Call CT_CouplingHpmcHpmVZ(gt1,gt2,g1,g2,ZP,TW,dg1,dg2,dZP,dSinTW,dCosTW, &
& dTanTW,ctcplHpmcHpmVZ(gt1,gt2))
End Do
End Do
ctcplSdcSdVG = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 6
Call CT_CouplingSdcSdVG(gt1,gt2,g3,dg3,ctcplSdcSdVG(gt1,gt2))
End Do
End Do
ctcplSdcSdVP = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 6
Call CT_CouplingSdcSdVP(gt1,gt2,g1,g2,ZD,TW,dg1,dg2,dZD,dSinTW,dCosTW,dTanTW, &
& ctcplSdcSdVP(gt1,gt2))
End Do
End Do
ctcplSdcSdVZ = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 6
Call CT_CouplingSdcSdVZ(gt1,gt2,g1,g2,ZD,TW,dg1,dg2,dZD,dSinTW,dCosTW,dTanTW, &
& ctcplSdcSdVZ(gt1,gt2))
End Do
End Do
ctcplSdcSucVWm = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 6
Call CT_CouplingSdcSucVWm(gt1,gt2,g2,ZD,ZU,dg2,dZD,dZU,ctcplSdcSucVWm(gt1,gt2))
End Do
End Do
ctcplSeSvImcVWm = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 9
Call CT_CouplingSeSvImcVWm(gt1,gt2,g2,ZVI,ZE,dg2,dZVI,dZE,ctcplSeSvImcVWm(gt1,gt2))
End Do
End Do
ctcplSeSvRecVWm = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 9
Call CT_CouplingSeSvRecVWm(gt1,gt2,g2,ZVR,ZE,dg2,dZVR,dZE,ctcplSeSvRecVWm(gt1,gt2))
End Do
End Do
ctcplSecSeVP = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 6
Call CT_CouplingSecSeVP(gt1,gt2,g1,g2,ZE,TW,dg1,dg2,dZE,dSinTW,dCosTW,dTanTW, &
& ctcplSecSeVP(gt1,gt2))
End Do
End Do
ctcplSecSeVZ = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 6
Call CT_CouplingSecSeVZ(gt1,gt2,g1,g2,ZE,TW,dg1,dg2,dZE,dSinTW,dCosTW,dTanTW, &
& ctcplSecSeVZ(gt1,gt2))
End Do
End Do
ctcplSucSuVG = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 6
Call CT_CouplingSucSuVG(gt1,gt2,g3,dg3,ctcplSucSuVG(gt1,gt2))
End Do
End Do
ctcplSucSuVP = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 6
Call CT_CouplingSucSuVP(gt1,gt2,g1,g2,ZU,TW,dg1,dg2,dZU,dSinTW,dCosTW,dTanTW, &
& ctcplSucSuVP(gt1,gt2))
End Do
End Do
ctcplSucSdVWm = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 6
Call CT_CouplingSucSdVWm(gt1,gt2,g2,ZD,ZU,dg2,dZD,dZU,ctcplSucSdVWm(gt1,gt2))
End Do
End Do
ctcplSucSuVZ = 0._dp
Do gt1 = 1, 6
Do gt2 = 1, 6
Call CT_CouplingSucSuVZ(gt1,gt2,g1,g2,ZU,TW,dg1,dg2,dZU,dSinTW,dCosTW,dTanTW, &
& ctcplSucSuVZ(gt1,gt2))
End Do
End Do
ctcplSvImSvReVZ = 0._dp
Do gt1 = 1, 9
Do gt2 = 1, 9
Call CT_CouplingSvImSvReVZ(gt1,gt2,g1,g2,ZVI,ZVR,TW,dg1,dg2,dZVI,dZVR,dSinTW, &
& dCosTW,dTanTW,ctcplSvImSvReVZ(gt1,gt2))
End Do
End Do
ctcplSvImcSeVWm = 0._dp
Do gt1 = 1, 9
Do gt2 = 1, 6
Call CT_CouplingSvImcSeVWm(gt1,gt2,g2,ZVI,ZE,dg2,dZVI,dZE,ctcplSvImcSeVWm(gt1,gt2))
End Do
End Do
ctcplSvRecSeVWm = 0._dp
Do gt1 = 1, 9
Do gt2 = 1, 6
Call CT_CouplingSvRecSeVWm(gt1,gt2,g2,ZVR,ZE,dg2,dZVR,dZE,ctcplSvRecSeVWm(gt1,gt2))
End Do
End Do
ctcplhhcVWmVWm = 0._dp
Do gt1 = 1, 3
Call CT_CouplinghhcVWmVWm(gt1,g2,vd,vu,ZH,dg2,dvd,dvu,dZH,ctcplhhcVWmVWm(gt1))
End Do
ctcplhhVZVZ = 0._dp
Do gt1 = 1, 3
Call CT_CouplinghhVZVZ(gt1,g1,g2,vd,vu,ZH,TW,dg1,dg2,dvd,dvu,dZH,dSinTW, &
& dCosTW,dTanTW,ctcplhhVZVZ(gt1))
End Do
ctcplHpmcVWmVP = 0._dp
Do gt1 = 1, 2
Call CT_CouplingHpmcVWmVP(gt1,g1,g2,vd,vu,ZP,TW,dg1,dg2,dvd,dvu,dZP,dSinTW, &
& dCosTW,dTanTW,ctcplHpmcVWmVP(gt1))
End Do
ctcplHpmcVWmVZ = 0._dp
Do gt1 = 1, 2
Call CT_CouplingHpmcVWmVZ(gt1,g1,g2,vd,vu,ZP,TW,dg1,dg2,dvd,dvu,dZP,dSinTW, &
& dCosTW,dTanTW,ctcplHpmcVWmVZ(gt1))
End Do
ctcplcHpmVPVWm = 0._dp
Do gt1 = 1, 2
Call CT_CouplingcHpmVPVWm(gt1,g1,g2,vd,vu,ZP,TW,dg1,dg2,dvd,dvu,dZP,dSinTW, &
& dCosTW,dTanTW,ctcplcHpmVPVWm(gt1))
End Do
ctcplcHpmVWmVZ = 0._dp
Do gt1 = 1, 2
Call CT_CouplingcHpmVWmVZ(gt1,g1,g2,vd,vu,ZP,TW,dg1,dg2,dvd,dvu,dZP,dSinTW, &
& dCosTW,dTanTW,ctcplcHpmVWmVZ(gt1))
End Do
ctcplVGVGVG = 0._dp
Call CT_CouplingVGVGVG(g3,dg3,ctcplVGVGVG)
ctcplcVWmVPVWm = 0._dp
Call CT_CouplingcVWmVPVWm(g2,TW,dg2,dSinTW,dCosTW,dTanTW,ctcplcVWmVPVWm)
ctcplcVWmVWmVZ = 0._dp
Call CT_CouplingcVWmVWmVZ(g2,TW,dg2,dSinTW,dCosTW,dTanTW,ctcplcVWmVWmVZ)
ctcplcChaChaAhL = 0._dp
ctcplcChaChaAhR = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 2
Do gt3 = 1, 3
Call CT_CouplingcChaChaAh(gt1,gt2,gt3,g2,lam,ZA,UM,UP,dg2,dlam,dZA,dUM, &
& dUP,ctcplcChaChaAhL(gt1,gt2,gt3),ctcplcChaChaAhR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplChiChiAhL = 0._dp
ctcplChiChiAhR = 0._dp
Do gt1 = 1, 5
Do gt2 = 1, 5
Do gt3 = 1, 3
Call CT_CouplingChiChiAh(gt1,gt2,gt3,g1,g2,lam,kap,ZA,ZN,dg1,dg2,dlam,dkap, &
& dZA,dZN,ctcplChiChiAhL(gt1,gt2,gt3),ctcplChiChiAhR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFdFdAhL = 0._dp
ctcplcFdFdAhR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Do gt3 = 1, 3
Call CT_CouplingcFdFdAh(gt1,gt2,gt3,Yd,ZA,ZDL,ZDR,dYd,dZA,dZDL,dZDR,ctcplcFdFdAhL(gt1,gt2,gt3)&
& ,ctcplcFdFdAhR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFeFeAhL = 0._dp
ctcplcFeFeAhR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Do gt3 = 1, 3
Call CT_CouplingcFeFeAh(gt1,gt2,gt3,Ye,ZA,ZEL,ZER,dYe,dZA,dZEL,dZER,ctcplcFeFeAhL(gt1,gt2,gt3)&
& ,ctcplcFeFeAhR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFuFuAhL = 0._dp
ctcplcFuFuAhR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Do gt3 = 1, 3
Call CT_CouplingcFuFuAh(gt1,gt2,gt3,Yu,ZA,ZUL,ZUR,dYu,dZA,dZUL,dZUR,ctcplcFuFuAhL(gt1,gt2,gt3)&
& ,ctcplcFuFuAhR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplFvFvAhL = 0._dp
ctcplFvFvAhR = 0._dp
Do gt1 = 1, 9
Do gt2 = 1, 9
Do gt3 = 1, 3
Call CT_CouplingFvFvAh(gt1,gt2,gt3,lamN,Yv,ZA,UV,dlamN,dYv,dZA,dUV,ctcplFvFvAhL(gt1,gt2,gt3)&
& ,ctcplFvFvAhR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplChiChacHpmL = 0._dp
ctcplChiChacHpmR = 0._dp
Do gt1 = 1, 5
Do gt2 = 1, 2
Do gt3 = 1, 2
Call CT_CouplingChiChacHpm(gt1,gt2,gt3,g1,g2,lam,ZP,ZN,UM,UP,dg1,dg2,dlam, &
& dZP,dZN,dUM,dUP,ctcplChiChacHpmL(gt1,gt2,gt3),ctcplChiChacHpmR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplChaFucSdL = 0._dp
ctcplChaFucSdR = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 3
Do gt3 = 1, 6
Call CT_CouplingChaFucSd(gt1,gt2,gt3,g2,Yd,Yu,ZD,UM,UP,ZUL,ZUR,dg2,dYd, &
& dYu,dZD,dUM,dUP,dZUL,dZUR,ctcplChaFucSdL(gt1,gt2,gt3),ctcplChaFucSdR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplFvChacSeL = 0._dp
ctcplFvChacSeR = 0._dp
Do gt1 = 1, 9
Do gt2 = 1, 2
Do gt3 = 1, 6
Call CT_CouplingFvChacSe(gt1,gt2,gt3,g2,Ye,Yv,ZE,UV,UM,UP,dg2,dYe,dYv,dZE, &
& dUV,dUM,dUP,ctcplFvChacSeL(gt1,gt2,gt3),ctcplFvChacSeR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcChaChahhL = 0._dp
ctcplcChaChahhR = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 2
Do gt3 = 1, 3
Call CT_CouplingcChaChahh(gt1,gt2,gt3,g2,lam,ZH,UM,UP,dg2,dlam,dZH,dUM, &
& dUP,ctcplcChaChahhL(gt1,gt2,gt3),ctcplcChaChahhR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFdChaSuL = 0._dp
ctcplcFdChaSuR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 2
Do gt3 = 1, 6
Call CT_CouplingcFdChaSu(gt1,gt2,gt3,g2,Yd,Yu,ZU,UM,UP,ZDL,ZDR,dg2,dYd, &
& dYu,dZU,dUM,dUP,dZDL,dZDR,ctcplcFdChaSuL(gt1,gt2,gt3),ctcplcFdChaSuR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFeChaSvImL = 0._dp
ctcplcFeChaSvImR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 2
Do gt3 = 1, 9
Call CT_CouplingcFeChaSvIm(gt1,gt2,gt3,g2,Ye,Yv,ZVI,UM,UP,ZEL,ZER,dg2,dYe, &
& dYv,dZVI,dUM,dUP,dZEL,dZER,ctcplcFeChaSvImL(gt1,gt2,gt3),ctcplcFeChaSvImR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFeChaSvReL = 0._dp
ctcplcFeChaSvReR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 2
Do gt3 = 1, 9
Call CT_CouplingcFeChaSvRe(gt1,gt2,gt3,g2,Ye,Yv,ZVR,UM,UP,ZEL,ZER,dg2,dYe, &
& dYv,dZVR,dUM,dUP,dZEL,dZER,ctcplcFeChaSvReL(gt1,gt2,gt3),ctcplcFeChaSvReR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplChiChihhL = 0._dp
ctcplChiChihhR = 0._dp
Do gt1 = 1, 5
Do gt2 = 1, 5
Do gt3 = 1, 3
Call CT_CouplingChiChihh(gt1,gt2,gt3,g1,g2,lam,kap,ZH,ZN,dg1,dg2,dlam,dkap, &
& dZH,dZN,ctcplChiChihhL(gt1,gt2,gt3),ctcplChiChihhR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplChiFdcSdL = 0._dp
ctcplChiFdcSdR = 0._dp
Do gt1 = 1, 5
Do gt2 = 1, 3
Do gt3 = 1, 6
Call CT_CouplingChiFdcSd(gt1,gt2,gt3,g1,g2,Yd,ZD,ZN,ZDL,ZDR,dg1,dg2,dYd, &
& dZD,dZN,dZDL,dZDR,ctcplChiFdcSdL(gt1,gt2,gt3),ctcplChiFdcSdR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplChiFecSeL = 0._dp
ctcplChiFecSeR = 0._dp
Do gt1 = 1, 5
Do gt2 = 1, 3
Do gt3 = 1, 6
Call CT_CouplingChiFecSe(gt1,gt2,gt3,g1,g2,Ye,ZE,ZN,ZEL,ZER,dg1,dg2,dYe, &
& dZE,dZN,dZEL,dZER,ctcplChiFecSeL(gt1,gt2,gt3),ctcplChiFecSeR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplChiFucSuL = 0._dp
ctcplChiFucSuR = 0._dp
Do gt1 = 1, 5
Do gt2 = 1, 3
Do gt3 = 1, 6
Call CT_CouplingChiFucSu(gt1,gt2,gt3,g1,g2,Yu,ZU,ZN,ZUL,ZUR,dg1,dg2,dYu, &
& dZU,dZN,dZUL,dZUR,ctcplChiFucSuL(gt1,gt2,gt3),ctcplChiFucSuR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplChiFvSvImL = 0._dp
ctcplChiFvSvImR = 0._dp
Do gt1 = 1, 5
Do gt2 = 1, 9
Do gt3 = 1, 9
Call CT_CouplingChiFvSvIm(gt1,gt2,gt3,g1,g2,lamN,Yv,ZVI,ZN,UV,dg1,dg2,dlamN, &
& dYv,dZVI,dZN,dUV,ctcplChiFvSvImL(gt1,gt2,gt3),ctcplChiFvSvImR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplChiFvSvReL = 0._dp
ctcplChiFvSvReR = 0._dp
Do gt1 = 1, 5
Do gt2 = 1, 9
Do gt3 = 1, 9
Call CT_CouplingChiFvSvRe(gt1,gt2,gt3,g1,g2,lamN,Yv,ZVR,ZN,UV,dg1,dg2,dlamN, &
& dYv,dZVR,dZN,dUV,ctcplChiFvSvReL(gt1,gt2,gt3),ctcplChiFvSvReR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcChaChiHpmL = 0._dp
ctcplcChaChiHpmR = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 5
Do gt3 = 1, 2
Call CT_CouplingcChaChiHpm(gt1,gt2,gt3,g1,g2,lam,ZP,ZN,UM,UP,dg1,dg2,dlam, &
& dZP,dZN,dUM,dUP,ctcplcChaChiHpmL(gt1,gt2,gt3),ctcplcChaChiHpmR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFdChiSdL = 0._dp
ctcplcFdChiSdR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 5
Do gt3 = 1, 6
Call CT_CouplingcFdChiSd(gt1,gt2,gt3,g1,g2,Yd,ZD,ZN,ZDL,ZDR,dg1,dg2,dYd, &
& dZD,dZN,dZDL,dZDR,ctcplcFdChiSdL(gt1,gt2,gt3),ctcplcFdChiSdR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFeChiSeL = 0._dp
ctcplcFeChiSeR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 5
Do gt3 = 1, 6
Call CT_CouplingcFeChiSe(gt1,gt2,gt3,g1,g2,Ye,ZE,ZN,ZEL,ZER,dg1,dg2,dYe, &
& dZE,dZN,dZEL,dZER,ctcplcFeChiSeL(gt1,gt2,gt3),ctcplcFeChiSeR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFuChiSuL = 0._dp
ctcplcFuChiSuR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 5
Do gt3 = 1, 6
Call CT_CouplingcFuChiSu(gt1,gt2,gt3,g1,g2,Yu,ZU,ZN,ZUL,ZUR,dg1,dg2,dYu, &
& dZU,dZN,dZUL,dZUR,ctcplcFuChiSuL(gt1,gt2,gt3),ctcplcFuChiSuR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplGluFdcSdL = 0._dp
ctcplGluFdcSdR = 0._dp
Do gt2 = 1, 3
Do gt3 = 1, 6
Call CT_CouplingGluFdcSd(gt2,gt3,g3,pG,ZD,ZDL,ZDR,dg3,dpG,dZD,dZDL,dZDR, &
& ctcplGluFdcSdL(gt2,gt3),ctcplGluFdcSdR(gt2,gt3))
End Do
End Do
ctcplcFdFdhhL = 0._dp
ctcplcFdFdhhR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Do gt3 = 1, 3
Call CT_CouplingcFdFdhh(gt1,gt2,gt3,Yd,ZH,ZDL,ZDR,dYd,dZH,dZDL,dZDR,ctcplcFdFdhhL(gt1,gt2,gt3)&
& ,ctcplcFdFdhhR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcChaFdcSuL = 0._dp
ctcplcChaFdcSuR = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 3
Do gt3 = 1, 6
Call CT_CouplingcChaFdcSu(gt1,gt2,gt3,g2,Yd,Yu,ZU,UM,UP,ZDL,ZDR,dg2,dYd, &
& dYu,dZU,dUM,dUP,dZDL,dZDR,ctcplcChaFdcSuL(gt1,gt2,gt3),ctcplcChaFdcSuR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFuFdcHpmL = 0._dp
ctcplcFuFdcHpmR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Do gt3 = 1, 2
Call CT_CouplingcFuFdcHpm(gt1,gt2,gt3,Yd,Yu,ZP,ZDL,ZDR,ZUL,ZUR,dYd,dYu, &
& dZP,dZDL,dZDR,dZUL,dZUR,ctcplcFuFdcHpmL(gt1,gt2,gt3),ctcplcFuFdcHpmR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplFvFecHpmL = 0._dp
ctcplFvFecHpmR = 0._dp
Do gt1 = 1, 9
Do gt2 = 1, 3
Do gt3 = 1, 2
Call CT_CouplingFvFecHpm(gt1,gt2,gt3,Ye,Yv,ZP,UV,ZEL,ZER,dYe,dYv,dZP,dUV, &
& dZEL,dZER,ctcplFvFecHpmL(gt1,gt2,gt3),ctcplFvFecHpmR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFeFehhL = 0._dp
ctcplcFeFehhR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Do gt3 = 1, 3
Call CT_CouplingcFeFehh(gt1,gt2,gt3,Ye,ZH,ZEL,ZER,dYe,dZH,dZEL,dZER,ctcplcFeFehhL(gt1,gt2,gt3)&
& ,ctcplcFeFehhR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcChaFeSvImL = 0._dp
ctcplcChaFeSvImR = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 3
Do gt3 = 1, 9
Call CT_CouplingcChaFeSvIm(gt1,gt2,gt3,g2,Ye,Yv,ZVI,UM,UP,ZEL,ZER,dg2,dYe, &
& dYv,dZVI,dUM,dUP,dZEL,dZER,ctcplcChaFeSvImL(gt1,gt2,gt3),ctcplcChaFeSvImR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcChaFeSvReL = 0._dp
ctcplcChaFeSvReR = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 3
Do gt3 = 1, 9
Call CT_CouplingcChaFeSvRe(gt1,gt2,gt3,g2,Ye,Yv,ZVR,UM,UP,ZEL,ZER,dg2,dYe, &
& dYv,dZVR,dUM,dUP,dZEL,dZER,ctcplcChaFeSvReL(gt1,gt2,gt3),ctcplcChaFeSvReR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplGluFucSuL = 0._dp
ctcplGluFucSuR = 0._dp
Do gt2 = 1, 3
Do gt3 = 1, 6
Call CT_CouplingGluFucSu(gt2,gt3,g3,pG,ZU,ZUL,ZUR,dg3,dpG,dZU,dZUL,dZUR, &
& ctcplGluFucSuL(gt2,gt3),ctcplGluFucSuR(gt2,gt3))
End Do
End Do
ctcplcFuFuhhL = 0._dp
ctcplcFuFuhhR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Do gt3 = 1, 3
Call CT_CouplingcFuFuhh(gt1,gt2,gt3,Yu,ZH,ZUL,ZUR,dYu,dZH,dZUL,dZUR,ctcplcFuFuhhL(gt1,gt2,gt3)&
& ,ctcplcFuFuhhR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFdFuHpmL = 0._dp
ctcplcFdFuHpmR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Do gt3 = 1, 2
Call CT_CouplingcFdFuHpm(gt1,gt2,gt3,Yd,Yu,ZP,ZDL,ZDR,ZUL,ZUR,dYd,dYu,dZP, &
& dZDL,dZDR,dZUL,dZUR,ctcplcFdFuHpmL(gt1,gt2,gt3),ctcplcFdFuHpmR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplFvFvhhL = 0._dp
ctcplFvFvhhR = 0._dp
Do gt1 = 1, 9
Do gt2 = 1, 9
Do gt3 = 1, 3
Call CT_CouplingFvFvhh(gt1,gt2,gt3,lamN,Yv,ZH,UV,dlamN,dYv,dZH,dUV,ctcplFvFvhhL(gt1,gt2,gt3)&
& ,ctcplFvFvhhR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFeFvHpmL = 0._dp
ctcplcFeFvHpmR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 9
Do gt3 = 1, 2
Call CT_CouplingcFeFvHpm(gt1,gt2,gt3,Ye,Yv,ZP,UV,ZEL,ZER,dYe,dYv,dZP,dUV, &
& dZEL,dZER,ctcplcFeFvHpmL(gt1,gt2,gt3),ctcplcFeFvHpmR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcChaFvSeL = 0._dp
ctcplcChaFvSeR = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 9
Do gt3 = 1, 6
Call CT_CouplingcChaFvSe(gt1,gt2,gt3,g2,Ye,Yv,ZE,UV,UM,UP,dg2,dYe,dYv,dZE, &
& dUV,dUM,dUP,ctcplcChaFvSeL(gt1,gt2,gt3),ctcplcChaFvSeR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplcFdGluSdL = 0._dp
ctcplcFdGluSdR = 0._dp
Do gt1 = 1, 3
Do gt3 = 1, 6
Call CT_CouplingcFdGluSd(gt1,gt3,g3,pG,ZD,ZDL,ZDR,dg3,dpG,dZD,dZDL,dZDR, &
& ctcplcFdGluSdL(gt1,gt3),ctcplcFdGluSdR(gt1,gt3))
End Do
End Do
ctcplcFuGluSuL = 0._dp
ctcplcFuGluSuR = 0._dp
Do gt1 = 1, 3
Do gt3 = 1, 6
Call CT_CouplingcFuGluSu(gt1,gt3,g3,pG,ZU,ZUL,ZUR,dg3,dpG,dZU,dZUL,dZUR, &
& ctcplcFuGluSuL(gt1,gt3),ctcplcFuGluSuR(gt1,gt3))
End Do
End Do
ctcplcChacFuSdL = 0._dp
ctcplcChacFuSdR = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 3
Do gt3 = 1, 6
Call CT_CouplingcChacFuSd(gt1,gt2,gt3,g2,Yd,Yu,ZD,UM,UP,ZUL,ZUR,dg2,dYd, &
& dYu,dZD,dUM,dUP,dZUL,dZUR,ctcplcChacFuSdL(gt1,gt2,gt3),ctcplcChacFuSdR(gt1,gt2,gt3))
End Do
End Do
End Do
ctcplChiChacVWmL = 0._dp
ctcplChiChacVWmR = 0._dp
Do gt1 = 1, 5
Do gt2 = 1, 2
Call CT_CouplingChiChacVWm(gt1,gt2,g2,ZN,UM,UP,dg2,dZN,dUM,dUP,ctcplChiChacVWmL(gt1,gt2)&
& ,ctcplChiChacVWmR(gt1,gt2))
End Do
End Do
ctcplcChaChaVPL = 0._dp
ctcplcChaChaVPR = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 2
Call CT_CouplingcChaChaVP(gt1,gt2,g1,g2,UM,UP,TW,dg1,dg2,dUM,dUP,dSinTW, &
& dCosTW,dTanTW,ctcplcChaChaVPL(gt1,gt2),ctcplcChaChaVPR(gt1,gt2))
End Do
End Do
ctcplcChaChaVZL = 0._dp
ctcplcChaChaVZR = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 2
Call CT_CouplingcChaChaVZ(gt1,gt2,g1,g2,UM,UP,TW,dg1,dg2,dUM,dUP,dSinTW, &
& dCosTW,dTanTW,ctcplcChaChaVZL(gt1,gt2),ctcplcChaChaVZR(gt1,gt2))
End Do
End Do
ctcplChiChiVZL = 0._dp
ctcplChiChiVZR = 0._dp
Do gt1 = 1, 5
Do gt2 = 1, 5
Call CT_CouplingChiChiVZ(gt1,gt2,g1,g2,ZN,TW,dg1,dg2,dZN,dSinTW,dCosTW, &
& dTanTW,ctcplChiChiVZL(gt1,gt2),ctcplChiChiVZR(gt1,gt2))
End Do
End Do
ctcplcChaChiVWmL = 0._dp
ctcplcChaChiVWmR = 0._dp
Do gt1 = 1, 2
Do gt2 = 1, 5
Call CT_CouplingcChaChiVWm(gt1,gt2,g2,ZN,UM,UP,dg2,dZN,dUM,dUP,ctcplcChaChiVWmL(gt1,gt2)&
& ,ctcplcChaChiVWmR(gt1,gt2))
End Do
End Do
ctcplcFdFdVGL = 0._dp
ctcplcFdFdVGR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Call CT_CouplingcFdFdVG(gt1,gt2,g3,dg3,ctcplcFdFdVGL(gt1,gt2),ctcplcFdFdVGR(gt1,gt2))
End Do
End Do
ctcplcFdFdVPL = 0._dp
ctcplcFdFdVPR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Call CT_CouplingcFdFdVP(gt1,gt2,g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW,ctcplcFdFdVPL(gt1,gt2)&
& ,ctcplcFdFdVPR(gt1,gt2))
End Do
End Do
ctcplcFdFdVZL = 0._dp
ctcplcFdFdVZR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Call CT_CouplingcFdFdVZ(gt1,gt2,g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW,ctcplcFdFdVZL(gt1,gt2)&
& ,ctcplcFdFdVZR(gt1,gt2))
End Do
End Do
ctcplcFuFdcVWmL = 0._dp
ctcplcFuFdcVWmR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Call CT_CouplingcFuFdcVWm(gt1,gt2,g2,ZDL,ZUL,dg2,dZDL,dZUL,ctcplcFuFdcVWmL(gt1,gt2) &
& ,ctcplcFuFdcVWmR(gt1,gt2))
End Do
End Do
ctcplFvFecVWmL = 0._dp
ctcplFvFecVWmR = 0._dp
Do gt1 = 1, 9
Do gt2 = 1, 3
Call CT_CouplingFvFecVWm(gt1,gt2,g2,UV,ZEL,dg2,dUV,dZEL,ctcplFvFecVWmL(gt1,gt2) &
& ,ctcplFvFecVWmR(gt1,gt2))
End Do
End Do
ctcplcFeFeVPL = 0._dp
ctcplcFeFeVPR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Call CT_CouplingcFeFeVP(gt1,gt2,g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW,ctcplcFeFeVPL(gt1,gt2)&
& ,ctcplcFeFeVPR(gt1,gt2))
End Do
End Do
ctcplcFeFeVZL = 0._dp
ctcplcFeFeVZR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Call CT_CouplingcFeFeVZ(gt1,gt2,g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW,ctcplcFeFeVZL(gt1,gt2)&
& ,ctcplcFeFeVZR(gt1,gt2))
End Do
End Do
ctcplcFuFuVGL = 0._dp
ctcplcFuFuVGR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Call CT_CouplingcFuFuVG(gt1,gt2,g3,dg3,ctcplcFuFuVGL(gt1,gt2),ctcplcFuFuVGR(gt1,gt2))
End Do
End Do
ctcplcFuFuVPL = 0._dp
ctcplcFuFuVPR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Call CT_CouplingcFuFuVP(gt1,gt2,g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW,ctcplcFuFuVPL(gt1,gt2)&
& ,ctcplcFuFuVPR(gt1,gt2))
End Do
End Do
ctcplcFdFuVWmL = 0._dp
ctcplcFdFuVWmR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Call CT_CouplingcFdFuVWm(gt1,gt2,g2,ZDL,ZUL,dg2,dZDL,dZUL,ctcplcFdFuVWmL(gt1,gt2) &
& ,ctcplcFdFuVWmR(gt1,gt2))
End Do
End Do
ctcplcFuFuVZL = 0._dp
ctcplcFuFuVZR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 3
Call CT_CouplingcFuFuVZ(gt1,gt2,g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW,ctcplcFuFuVZL(gt1,gt2)&
& ,ctcplcFuFuVZR(gt1,gt2))
End Do
End Do
ctcplFvFvVZL = 0._dp
ctcplFvFvVZR = 0._dp
Do gt1 = 1, 9
Do gt2 = 1, 9
Call CT_CouplingFvFvVZ(gt1,gt2,g1,g2,UV,TW,dg1,dg2,dUV,dSinTW,dCosTW,dTanTW, &
& ctcplFvFvVZL(gt1,gt2),ctcplFvFvVZR(gt1,gt2))
End Do
End Do
ctcplcFeFvVWmL = 0._dp
ctcplcFeFvVWmR = 0._dp
Do gt1 = 1, 3
Do gt2 = 1, 9
Call CT_CouplingcFeFvVWm(gt1,gt2,g2,UV,ZEL,dg2,dUV,dZEL,ctcplcFeFvVWmL(gt1,gt2) &
& ,ctcplcFeFvVWmR(gt1,gt2))
End Do
End Do
ctcplGluGluVGL = 0._dp
ctcplGluGluVGR = 0._dp
Call CT_CouplingGluGluVG(g3,pG,dg3,dpG,ctcplGluGluVGL,ctcplGluGluVGR)
Iname = Iname - 1
End Subroutine CalculateCouplingCT
Subroutine CT_CouplingAhAhAh(gt1,gt2,gt3,lam,Tlam,kap,Tk,vd,vu,vS,ZA,dlam, &
& dTlam,dkap,dTk,dvd,dvu,dvS,dZA,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: vd,vu,vS,ZA(3,3),dvd,dvu,dvS,dZA(3,3)
Complex(dp), Intent(in) :: lam,Tlam,kap,Tk,dlam,dTlam,dkap,dTk
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhAhAh'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
res = res-(vS*lam*Conjg(kap)*dZA(gt3,3)*ZA(gt1,2)*ZA(gt2,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt3,3)*ZA(gt1,2)*ZA(gt2,1))/2._dp
res = res-(Conjg(Tlam)*dZA(gt3,3)*ZA(gt1,2)*ZA(gt2,1))/(2._dp*sqrt(2._dp))
res = res+(dZA(gt3,3)*Tlam*ZA(gt1,2)*ZA(gt2,1))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt3,2)*ZA(gt1,3)*ZA(gt2,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt3,2)*ZA(gt1,3)*ZA(gt2,1))/2._dp
res = res-(Conjg(Tlam)*dZA(gt3,2)*ZA(gt1,3)*ZA(gt2,1))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt3,3)*ZA(gt1,3)*ZA(gt2,1))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt3,3)*ZA(gt1,3)*ZA(gt2,1))/2._dp
res = res+(dZA(gt3,2)*Tlam*ZA(gt1,3)*ZA(gt2,1))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt3,3)*ZA(gt1,1)*ZA(gt2,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt3,3)*ZA(gt1,1)*ZA(gt2,2))/2._dp
res = res-(Conjg(Tlam)*dZA(gt3,3)*ZA(gt1,1)*ZA(gt2,2))/(2._dp*sqrt(2._dp))
res = res+(dZA(gt3,3)*Tlam*ZA(gt1,1)*ZA(gt2,2))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt3,1)*ZA(gt1,3)*ZA(gt2,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt3,1)*ZA(gt1,3)*ZA(gt2,2))/2._dp
res = res-(Conjg(Tlam)*dZA(gt3,1)*ZA(gt1,3)*ZA(gt2,2))/(2._dp*sqrt(2._dp))
res = res+(vd*lam*Conjg(kap)*dZA(gt3,3)*ZA(gt1,3)*ZA(gt2,2))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt3,3)*ZA(gt1,3)*ZA(gt2,2))/2._dp
res = res+(dZA(gt3,1)*Tlam*ZA(gt1,3)*ZA(gt2,2))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt3,2)*ZA(gt1,1)*ZA(gt2,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt3,2)*ZA(gt1,1)*ZA(gt2,3))/2._dp
res = res-(Conjg(Tlam)*dZA(gt3,2)*ZA(gt1,1)*ZA(gt2,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt3,3)*ZA(gt1,1)*ZA(gt2,3))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt3,3)*ZA(gt1,1)*ZA(gt2,3))/2._dp
res = res+(dZA(gt3,2)*Tlam*ZA(gt1,1)*ZA(gt2,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt3,1)*ZA(gt1,2)*ZA(gt2,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt3,1)*ZA(gt1,2)*ZA(gt2,3))/2._dp
res = res-(Conjg(Tlam)*dZA(gt3,1)*ZA(gt1,2)*ZA(gt2,3))/(2._dp*sqrt(2._dp))
res = res+(vd*lam*Conjg(kap)*dZA(gt3,3)*ZA(gt1,2)*ZA(gt2,3))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt3,3)*ZA(gt1,2)*ZA(gt2,3))/2._dp
res = res+(dZA(gt3,1)*Tlam*ZA(gt1,2)*ZA(gt2,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt3,1)*ZA(gt1,3)*ZA(gt2,3))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt3,1)*ZA(gt1,3)*ZA(gt2,3))/2._dp
res = res+(vd*lam*Conjg(kap)*dZA(gt3,2)*ZA(gt1,3)*ZA(gt2,3))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt3,2)*ZA(gt1,3)*ZA(gt2,3))/2._dp
res = res+(Conjg(Tk)*dZA(gt3,3)*ZA(gt1,3)*ZA(gt2,3))/sqrt(2._dp)
res = res-((dZA(gt3,3)*Tk*ZA(gt1,3)*ZA(gt2,3))/sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt2,3)*ZA(gt1,2)*ZA(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt2,3)*ZA(gt1,2)*ZA(gt3,1))/2._dp
res = res-(Conjg(Tlam)*dZA(gt2,3)*ZA(gt1,2)*ZA(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dZA(gt2,3)*Tlam*ZA(gt1,2)*ZA(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt2,2)*ZA(gt1,3)*ZA(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt2,2)*ZA(gt1,3)*ZA(gt3,1))/2._dp
res = res-(Conjg(Tlam)*dZA(gt2,2)*ZA(gt1,3)*ZA(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt2,3)*ZA(gt1,3)*ZA(gt3,1))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt2,3)*ZA(gt1,3)*ZA(gt3,1))/2._dp
res = res+(dZA(gt2,2)*Tlam*ZA(gt1,3)*ZA(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt1,3)*ZA(gt2,2)*ZA(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,3)*ZA(gt2,2)*ZA(gt3,1))/2._dp
res = res-(Conjg(Tlam)*dZA(gt1,3)*ZA(gt2,2)*ZA(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dZA(gt1,3)*Tlam*ZA(gt2,2)*ZA(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dTlam*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,1))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,1))/2._dp
res = res-(Conjg(dTlam)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,1))/2._dp
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,1))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,1))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,1))/2._dp
res = res-(vS*lam*Conjg(kap)*dZA(gt1,2)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,2)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res-(Conjg(Tlam)*dZA(gt1,2)*ZA(gt2,3)*ZA(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt1,3)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt1,3)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res+(dZA(gt1,2)*Tlam*ZA(gt2,3)*ZA(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dTlam*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res-(Conjg(dTlam)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res+(vu*lam*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res-(vu*kap*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res+(dlam*vu*Conjg(kap)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res+(dvu*lam*Conjg(kap)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res-(dkap*vu*Conjg(lam)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res-(dvu*kap*Conjg(lam)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,1))/2._dp
res = res-(vS*lam*Conjg(kap)*dZA(gt2,3)*ZA(gt1,1)*ZA(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt2,3)*ZA(gt1,1)*ZA(gt3,2))/2._dp
res = res-(Conjg(Tlam)*dZA(gt2,3)*ZA(gt1,1)*ZA(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dZA(gt2,3)*Tlam*ZA(gt1,1)*ZA(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt2,1)*ZA(gt1,3)*ZA(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt2,1)*ZA(gt1,3)*ZA(gt3,2))/2._dp
res = res-(Conjg(Tlam)*dZA(gt2,1)*ZA(gt1,3)*ZA(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(vd*lam*Conjg(kap)*dZA(gt2,3)*ZA(gt1,3)*ZA(gt3,2))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt2,3)*ZA(gt1,3)*ZA(gt3,2))/2._dp
res = res+(dZA(gt2,1)*Tlam*ZA(gt1,3)*ZA(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt1,3)*ZA(gt2,1)*ZA(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,3)*ZA(gt2,1)*ZA(gt3,2))/2._dp
res = res-(Conjg(Tlam)*dZA(gt1,3)*ZA(gt2,1)*ZA(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dZA(gt1,3)*Tlam*ZA(gt2,1)*ZA(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dTlam*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,2))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,2))/2._dp
res = res-(Conjg(dTlam)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,2))/2._dp
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,2))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,2))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,2))/2._dp
res = res-(vS*lam*Conjg(kap)*dZA(gt1,1)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,1)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res-(Conjg(Tlam)*dZA(gt1,1)*ZA(gt2,3)*ZA(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(vd*lam*Conjg(kap)*dZA(gt1,3)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt1,3)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res+(dZA(gt1,1)*Tlam*ZA(gt2,3)*ZA(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dTlam*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res-(Conjg(dTlam)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res+(vd*lam*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res-(vd*kap*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res+(dlam*vd*Conjg(kap)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res+(dvd*lam*Conjg(kap)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res-(dkap*vd*Conjg(lam)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res-(dvd*kap*Conjg(lam)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,2))/2._dp
res = res-(vS*lam*Conjg(kap)*dZA(gt2,2)*ZA(gt1,1)*ZA(gt3,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt2,2)*ZA(gt1,1)*ZA(gt3,3))/2._dp
res = res-(Conjg(Tlam)*dZA(gt2,2)*ZA(gt1,1)*ZA(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt2,3)*ZA(gt1,1)*ZA(gt3,3))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt2,3)*ZA(gt1,1)*ZA(gt3,3))/2._dp
res = res+(dZA(gt2,2)*Tlam*ZA(gt1,1)*ZA(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt2,1)*ZA(gt1,2)*ZA(gt3,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt2,1)*ZA(gt1,2)*ZA(gt3,3))/2._dp
res = res-(Conjg(Tlam)*dZA(gt2,1)*ZA(gt1,2)*ZA(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vd*lam*Conjg(kap)*dZA(gt2,3)*ZA(gt1,2)*ZA(gt3,3))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt2,3)*ZA(gt1,2)*ZA(gt3,3))/2._dp
res = res+(dZA(gt2,1)*Tlam*ZA(gt1,2)*ZA(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt2,1)*ZA(gt1,3)*ZA(gt3,3))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt2,1)*ZA(gt1,3)*ZA(gt3,3))/2._dp
res = res+(vd*lam*Conjg(kap)*dZA(gt2,2)*ZA(gt1,3)*ZA(gt3,3))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt2,2)*ZA(gt1,3)*ZA(gt3,3))/2._dp
res = res+(Conjg(Tk)*dZA(gt2,3)*ZA(gt1,3)*ZA(gt3,3))/sqrt(2._dp)
res = res-((dZA(gt2,3)*Tk*ZA(gt1,3)*ZA(gt3,3))/sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt1,2)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,2)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res-(Conjg(Tlam)*dZA(gt1,2)*ZA(gt2,1)*ZA(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt1,3)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt1,3)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res+(dZA(gt1,2)*Tlam*ZA(gt2,1)*ZA(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(dTlam*ZA(gt1,2)*ZA(gt2,1)*ZA(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,2)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,2)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res-(Conjg(dTlam)*ZA(gt1,2)*ZA(gt2,1)*ZA(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,2)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,2)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,2)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,2)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res+(vu*lam*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res-(vu*kap*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res+(dlam*vu*Conjg(kap)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res+(dvu*lam*Conjg(kap)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res-(dkap*vu*Conjg(lam)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res-(dvu*kap*Conjg(lam)*ZA(gt1,3)*ZA(gt2,1)*ZA(gt3,3))/2._dp
res = res-(vS*lam*Conjg(kap)*dZA(gt1,1)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,1)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res-(Conjg(Tlam)*dZA(gt1,1)*ZA(gt2,2)*ZA(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vd*lam*Conjg(kap)*dZA(gt1,3)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt1,3)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res+(dZA(gt1,1)*Tlam*ZA(gt2,2)*ZA(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(dTlam*ZA(gt1,1)*ZA(gt2,2)*ZA(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,1)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,1)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res-(Conjg(dTlam)*ZA(gt1,1)*ZA(gt2,2)*ZA(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,1)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,1)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,1)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,1)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res+(vd*lam*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res-(vd*kap*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res+(dlam*vd*Conjg(kap)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res+(dvd*lam*Conjg(kap)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res-(dkap*vd*Conjg(lam)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res-(dvd*kap*Conjg(lam)*ZA(gt1,3)*ZA(gt2,2)*ZA(gt3,3))/2._dp
res = res+(vu*lam*Conjg(kap)*dZA(gt1,1)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt1,1)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res+(vd*lam*Conjg(kap)*dZA(gt1,2)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt1,2)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res+(Conjg(Tk)*dZA(gt1,3)*ZA(gt2,3)*ZA(gt3,3))/sqrt(2._dp)
res = res-((dZA(gt1,3)*Tk*ZA(gt2,3)*ZA(gt3,3))/sqrt(2._dp))
res = res+(vu*lam*Conjg(dkap)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res-(vu*kap*Conjg(dlam)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res+(dlam*vu*Conjg(kap)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res+(dvu*lam*Conjg(kap)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res-(dkap*vu*Conjg(lam)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res-(dvu*kap*Conjg(lam)*ZA(gt1,1)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res+(vd*lam*Conjg(dkap)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res-(vd*kap*Conjg(dlam)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res+(dlam*vd*Conjg(kap)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res+(dvd*lam*Conjg(kap)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res-(dkap*vd*Conjg(lam)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res-(dvd*kap*Conjg(lam)*ZA(gt1,2)*ZA(gt2,3)*ZA(gt3,3))/2._dp
res = res-((dTk*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,3))/sqrt(2._dp))
res = res+(Conjg(dTk)*ZA(gt1,3)*ZA(gt2,3)*ZA(gt3,3))/sqrt(2._dp)
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhAhAh
Subroutine CT_CouplingAhAhhh(gt1,gt2,gt3,g1,g2,lam,Tlam,kap,Tk,vd,vu,vS, &
& ZH,ZA,dg1,dg2,dlam,dTlam,dkap,dTk,dvd,dvu,dvS,dZH,dZA,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,vd,vu,vS,ZH(3,3),ZA(3,3),dg1,dg2,dvd,dvu,dvS,dZH(3,3),dZA(3,3)
Complex(dp), Intent(in) :: lam,Tlam,kap,Tk,dlam,dTlam,dkap,dTk
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhAhhh'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
res = res-(g1**2*vd*dZH(gt3,1)*ZA(gt1,1)*ZA(gt2,1))/4._dp
res = res-(g2**2*vd*dZH(gt3,1)*ZA(gt1,1)*ZA(gt2,1))/4._dp
res = res+(g1**2*vu*dZH(gt3,2)*ZA(gt1,1)*ZA(gt2,1))/4._dp
res = res+(g2**2*vu*dZH(gt3,2)*ZA(gt1,1)*ZA(gt2,1))/4._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt3,2)*ZA(gt1,1)*ZA(gt2,1))
res = res-(vS*lam*Conjg(lam)*dZH(gt3,3)*ZA(gt1,1)*ZA(gt2,1))
res = res-(vS*lam*Conjg(kap)*dZH(gt3,3)*ZA(gt1,2)*ZA(gt2,1))/2._dp
res = res-(vS*kap*Conjg(lam)*dZH(gt3,3)*ZA(gt1,2)*ZA(gt2,1))/2._dp
res = res-(Conjg(Tlam)*dZH(gt3,3)*ZA(gt1,2)*ZA(gt2,1))/(2._dp*sqrt(2._dp))
res = res-(dZH(gt3,3)*Tlam*ZA(gt1,2)*ZA(gt2,1))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(kap)*dZH(gt3,2)*ZA(gt1,3)*ZA(gt2,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,2)*ZA(gt1,3)*ZA(gt2,1))/2._dp
res = res-(Conjg(Tlam)*dZH(gt3,2)*ZA(gt1,3)*ZA(gt2,1))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt3,3)*ZA(gt1,3)*ZA(gt2,1))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt3,3)*ZA(gt1,3)*ZA(gt2,1))/2._dp
res = res-(dZH(gt3,2)*Tlam*ZA(gt1,3)*ZA(gt2,1))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZH(gt3,3)*ZA(gt1,1)*ZA(gt2,2))/2._dp
res = res-(vS*kap*Conjg(lam)*dZH(gt3,3)*ZA(gt1,1)*ZA(gt2,2))/2._dp
res = res-(Conjg(Tlam)*dZH(gt3,3)*ZA(gt1,1)*ZA(gt2,2))/(2._dp*sqrt(2._dp))
res = res-(dZH(gt3,3)*Tlam*ZA(gt1,1)*ZA(gt2,2))/(2._dp*sqrt(2._dp))
res = res+(g1**2*vd*dZH(gt3,1)*ZA(gt1,2)*ZA(gt2,2))/4._dp
res = res+(g2**2*vd*dZH(gt3,1)*ZA(gt1,2)*ZA(gt2,2))/4._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt3,1)*ZA(gt1,2)*ZA(gt2,2))
res = res-(g1**2*vu*dZH(gt3,2)*ZA(gt1,2)*ZA(gt2,2))/4._dp
res = res-(g2**2*vu*dZH(gt3,2)*ZA(gt1,2)*ZA(gt2,2))/4._dp
res = res-(vS*lam*Conjg(lam)*dZH(gt3,3)*ZA(gt1,2)*ZA(gt2,2))
res = res+(vS*lam*Conjg(kap)*dZH(gt3,1)*ZA(gt1,3)*ZA(gt2,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,1)*ZA(gt1,3)*ZA(gt2,2))/2._dp
res = res-(Conjg(Tlam)*dZH(gt3,1)*ZA(gt1,3)*ZA(gt2,2))/(2._dp*sqrt(2._dp))
res = res+(vd*lam*Conjg(kap)*dZH(gt3,3)*ZA(gt1,3)*ZA(gt2,2))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt3,3)*ZA(gt1,3)*ZA(gt2,2))/2._dp
res = res-(dZH(gt3,1)*Tlam*ZA(gt1,3)*ZA(gt2,2))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(kap)*dZH(gt3,2)*ZA(gt1,1)*ZA(gt2,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,2)*ZA(gt1,1)*ZA(gt2,3))/2._dp
res = res-(Conjg(Tlam)*dZH(gt3,2)*ZA(gt1,1)*ZA(gt2,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt3,3)*ZA(gt1,1)*ZA(gt2,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt3,3)*ZA(gt1,1)*ZA(gt2,3))/2._dp
res = res-(dZH(gt3,2)*Tlam*ZA(gt1,1)*ZA(gt2,3))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(kap)*dZH(gt3,1)*ZA(gt1,2)*ZA(gt2,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,1)*ZA(gt1,2)*ZA(gt2,3))/2._dp
res = res-(Conjg(Tlam)*dZH(gt3,1)*ZA(gt1,2)*ZA(gt2,3))/(2._dp*sqrt(2._dp))
res = res+(vd*lam*Conjg(kap)*dZH(gt3,3)*ZA(gt1,2)*ZA(gt2,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt3,3)*ZA(gt1,2)*ZA(gt2,3))/2._dp
res = res-(dZH(gt3,1)*Tlam*ZA(gt1,2)*ZA(gt2,3))/(2._dp*sqrt(2._dp))
res = res-(vu*lam*Conjg(kap)*dZH(gt3,1)*ZA(gt1,3)*ZA(gt2,3))/2._dp
res = res-(vu*kap*Conjg(lam)*dZH(gt3,1)*ZA(gt1,3)*ZA(gt2,3))/2._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt3,1)*ZA(gt1,3)*ZA(gt2,3))
res = res-(vd*lam*Conjg(kap)*dZH(gt3,2)*ZA(gt1,3)*ZA(gt2,3))/2._dp
res = res-(vd*kap*Conjg(lam)*dZH(gt3,2)*ZA(gt1,3)*ZA(gt2,3))/2._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt3,2)*ZA(gt1,3)*ZA(gt2,3))
res = res-2*vS*kap*Conjg(kap)*dZH(gt3,3)*ZA(gt1,3)*ZA(gt2,3)
res = res+(Conjg(Tk)*dZH(gt3,3)*ZA(gt1,3)*ZA(gt2,3))/sqrt(2._dp)
res = res+(dZH(gt3,3)*Tk*ZA(gt1,3)*ZA(gt2,3))/sqrt(2._dp)
res = res-(g1**2*vd*dZA(gt2,1)*ZA(gt1,1)*ZH(gt3,1))/4._dp
res = res-(g2**2*vd*dZA(gt2,1)*ZA(gt1,1)*ZH(gt3,1))/4._dp
res = res+(g1**2*vd*dZA(gt2,2)*ZA(gt1,2)*ZH(gt3,1))/4._dp
res = res+(g2**2*vd*dZA(gt2,2)*ZA(gt1,2)*ZH(gt3,1))/4._dp
res = res-(vd*lam*Conjg(lam)*dZA(gt2,2)*ZA(gt1,2)*ZH(gt3,1))
res = res+(vS*lam*Conjg(kap)*dZA(gt2,3)*ZA(gt1,2)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt2,3)*ZA(gt1,2)*ZH(gt3,1))/2._dp
res = res-(Conjg(Tlam)*dZA(gt2,3)*ZA(gt1,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(dZA(gt2,3)*Tlam*ZA(gt1,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(kap)*dZA(gt2,2)*ZA(gt1,3)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt2,2)*ZA(gt1,3)*ZH(gt3,1))/2._dp
res = res-(Conjg(Tlam)*dZA(gt2,2)*ZA(gt1,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(vu*lam*Conjg(kap)*dZA(gt2,3)*ZA(gt1,3)*ZH(gt3,1))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt2,3)*ZA(gt1,3)*ZH(gt3,1))/2._dp
res = res-(vd*lam*Conjg(lam)*dZA(gt2,3)*ZA(gt1,3)*ZH(gt3,1))
res = res-(dZA(gt2,2)*Tlam*ZA(gt1,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(g1**2*vd*dZA(gt1,1)*ZA(gt2,1)*ZH(gt3,1))/4._dp
res = res-(g2**2*vd*dZA(gt1,1)*ZA(gt2,1)*ZH(gt3,1))/4._dp
res = res-(dvd*g1**2*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,1))/4._dp
res = res-(dvd*g2**2*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,1))/4._dp
res = res-(dg1*g1*vd*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,1))/2._dp
res = res-(dg2*g2*vd*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,1))/2._dp
res = res+(g1**2*vd*dZA(gt1,2)*ZA(gt2,2)*ZH(gt3,1))/4._dp
res = res+(g2**2*vd*dZA(gt1,2)*ZA(gt2,2)*ZH(gt3,1))/4._dp
res = res-(vd*lam*Conjg(lam)*dZA(gt1,2)*ZA(gt2,2)*ZH(gt3,1))
res = res+(vS*lam*Conjg(kap)*dZA(gt1,3)*ZA(gt2,2)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,3)*ZA(gt2,2)*ZH(gt3,1))/2._dp
res = res-(Conjg(Tlam)*dZA(gt1,3)*ZA(gt2,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(dZA(gt1,3)*Tlam*ZA(gt2,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dvd*g1**2*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,1))/4._dp
res = res+(dvd*g2**2*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,1))/4._dp
res = res+(dg1*g1*vd*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,1))/2._dp
res = res+(dg2*g2*vd*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,1))/2._dp
res = res-(vd*lam*Conjg(dlam)*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,1))
res = res-(dlam*vd*Conjg(lam)*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,1))
res = res-(dvd*lam*Conjg(lam)*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,1))
res = res-(dTlam*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,1))/2._dp
res = res-(Conjg(dTlam)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dlam*vS*Conjg(kap)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,1))/2._dp
res = res+(dvS*lam*Conjg(kap)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,1))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,1))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,1))/2._dp
res = res+(vS*lam*Conjg(kap)*dZA(gt1,2)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,2)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res-(Conjg(Tlam)*dZA(gt1,2)*ZA(gt2,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(vu*lam*Conjg(kap)*dZA(gt1,3)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt1,3)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res-(vd*lam*Conjg(lam)*dZA(gt1,3)*ZA(gt2,3)*ZH(gt3,1))
res = res-(dZA(gt1,2)*Tlam*ZA(gt2,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(dTlam*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(dkap)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res-(Conjg(dTlam)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dlam*vS*Conjg(kap)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res+(dvS*lam*Conjg(kap)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res-(vu*lam*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res-(vu*kap*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res-(vd*lam*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,1))
res = res-(dlam*vu*Conjg(kap)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res-(dvu*lam*Conjg(kap)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res-(dlam*vd*Conjg(lam)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,1))
res = res-(dkap*vu*Conjg(lam)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res-(dvu*kap*Conjg(lam)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,1))/2._dp
res = res-(dvd*lam*Conjg(lam)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,1))
res = res+(g1**2*vu*dZA(gt2,1)*ZA(gt1,1)*ZH(gt3,2))/4._dp
res = res+(g2**2*vu*dZA(gt2,1)*ZA(gt1,1)*ZH(gt3,2))/4._dp
res = res-(vu*lam*Conjg(lam)*dZA(gt2,1)*ZA(gt1,1)*ZH(gt3,2))
res = res+(vS*lam*Conjg(kap)*dZA(gt2,3)*ZA(gt1,1)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt2,3)*ZA(gt1,1)*ZH(gt3,2))/2._dp
res = res-(Conjg(Tlam)*dZA(gt2,3)*ZA(gt1,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(dZA(gt2,3)*Tlam*ZA(gt1,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(g1**2*vu*dZA(gt2,2)*ZA(gt1,2)*ZH(gt3,2))/4._dp
res = res-(g2**2*vu*dZA(gt2,2)*ZA(gt1,2)*ZH(gt3,2))/4._dp
res = res+(vS*lam*Conjg(kap)*dZA(gt2,1)*ZA(gt1,3)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt2,1)*ZA(gt1,3)*ZH(gt3,2))/2._dp
res = res-(Conjg(Tlam)*dZA(gt2,1)*ZA(gt1,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(vd*lam*Conjg(kap)*dZA(gt2,3)*ZA(gt1,3)*ZH(gt3,2))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt2,3)*ZA(gt1,3)*ZH(gt3,2))/2._dp
res = res-(vu*lam*Conjg(lam)*dZA(gt2,3)*ZA(gt1,3)*ZH(gt3,2))
res = res-(dZA(gt2,1)*Tlam*ZA(gt1,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(g1**2*vu*dZA(gt1,1)*ZA(gt2,1)*ZH(gt3,2))/4._dp
res = res+(g2**2*vu*dZA(gt1,1)*ZA(gt2,1)*ZH(gt3,2))/4._dp
res = res-(vu*lam*Conjg(lam)*dZA(gt1,1)*ZA(gt2,1)*ZH(gt3,2))
res = res+(vS*lam*Conjg(kap)*dZA(gt1,3)*ZA(gt2,1)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,3)*ZA(gt2,1)*ZH(gt3,2))/2._dp
res = res-(Conjg(Tlam)*dZA(gt1,3)*ZA(gt2,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(dZA(gt1,3)*Tlam*ZA(gt2,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dvu*g1**2*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,2))/4._dp
res = res+(dvu*g2**2*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,2))/4._dp
res = res+(dg1*g1*vu*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,2))/2._dp
res = res+(dg2*g2*vu*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,2))/2._dp
res = res-(vu*lam*Conjg(dlam)*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,2))
res = res-(dlam*vu*Conjg(lam)*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,2))
res = res-(dvu*lam*Conjg(lam)*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,2))
res = res-(dTlam*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,2))/2._dp
res = res-(Conjg(dTlam)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dlam*vS*Conjg(kap)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,2))/2._dp
res = res+(dvS*lam*Conjg(kap)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,2))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,2))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,2))/2._dp
res = res-(g1**2*vu*dZA(gt1,2)*ZA(gt2,2)*ZH(gt3,2))/4._dp
res = res-(g2**2*vu*dZA(gt1,2)*ZA(gt2,2)*ZH(gt3,2))/4._dp
res = res-(dvu*g1**2*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,2))/4._dp
res = res-(dvu*g2**2*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,2))/4._dp
res = res-(dg1*g1*vu*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,2))/2._dp
res = res-(dg2*g2*vu*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,2))/2._dp
res = res+(vS*lam*Conjg(kap)*dZA(gt1,1)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,1)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res-(Conjg(Tlam)*dZA(gt1,1)*ZA(gt2,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(vd*lam*Conjg(kap)*dZA(gt1,3)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt1,3)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res-(vu*lam*Conjg(lam)*dZA(gt1,3)*ZA(gt2,3)*ZH(gt3,2))
res = res-(dZA(gt1,1)*Tlam*ZA(gt2,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(dTlam*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(dkap)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res-(Conjg(dTlam)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dlam*vS*Conjg(kap)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res+(dvS*lam*Conjg(kap)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res-(vd*lam*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res-(vd*kap*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res-(vu*lam*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,2))
res = res-(dlam*vd*Conjg(kap)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res-(dvd*lam*Conjg(kap)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res-(dkap*vd*Conjg(lam)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res-(dlam*vu*Conjg(lam)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,2))
res = res-(dvd*kap*Conjg(lam)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,2))/2._dp
res = res-(dvu*lam*Conjg(lam)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,2))
res = res-(vS*lam*Conjg(lam)*dZA(gt2,1)*ZA(gt1,1)*ZH(gt3,3))
res = res-(vS*lam*Conjg(kap)*dZA(gt2,2)*ZA(gt1,1)*ZH(gt3,3))/2._dp
res = res-(vS*kap*Conjg(lam)*dZA(gt2,2)*ZA(gt1,1)*ZH(gt3,3))/2._dp
res = res-(Conjg(Tlam)*dZA(gt2,2)*ZA(gt1,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt2,3)*ZA(gt1,1)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZA(gt2,3)*ZA(gt1,1)*ZH(gt3,3))/2._dp
res = res-(dZA(gt2,2)*Tlam*ZA(gt1,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZA(gt2,1)*ZA(gt1,2)*ZH(gt3,3))/2._dp
res = res-(vS*kap*Conjg(lam)*dZA(gt2,1)*ZA(gt1,2)*ZH(gt3,3))/2._dp
res = res-(Conjg(Tlam)*dZA(gt2,1)*ZA(gt1,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZA(gt2,2)*ZA(gt1,2)*ZH(gt3,3))
res = res+(vd*lam*Conjg(kap)*dZA(gt2,3)*ZA(gt1,2)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZA(gt2,3)*ZA(gt1,2)*ZH(gt3,3))/2._dp
res = res-(dZA(gt2,1)*Tlam*ZA(gt1,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt2,1)*ZA(gt1,3)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZA(gt2,1)*ZA(gt1,3)*ZH(gt3,3))/2._dp
res = res+(vd*lam*Conjg(kap)*dZA(gt2,2)*ZA(gt1,3)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZA(gt2,2)*ZA(gt1,3)*ZH(gt3,3))/2._dp
res = res-2*vS*kap*Conjg(kap)*dZA(gt2,3)*ZA(gt1,3)*ZH(gt3,3)
res = res+(Conjg(Tk)*dZA(gt2,3)*ZA(gt1,3)*ZH(gt3,3))/sqrt(2._dp)
res = res+(dZA(gt2,3)*Tk*ZA(gt1,3)*ZH(gt3,3))/sqrt(2._dp)
res = res-(vS*lam*Conjg(lam)*dZA(gt1,1)*ZA(gt2,1)*ZH(gt3,3))
res = res-(vS*lam*Conjg(kap)*dZA(gt1,2)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res-(vS*kap*Conjg(lam)*dZA(gt1,2)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res-(Conjg(Tlam)*dZA(gt1,2)*ZA(gt2,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt1,3)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZA(gt1,3)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res-(dZA(gt1,2)*Tlam*ZA(gt2,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dlam)*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,3))
res = res-(dlam*vS*Conjg(lam)*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,3))
res = res-(dvS*lam*Conjg(lam)*ZA(gt1,1)*ZA(gt2,1)*ZH(gt3,3))
res = res-(dTlam*ZA(gt1,2)*ZA(gt2,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,2)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res-(vS*kap*Conjg(dlam)*ZA(gt1,2)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res-(Conjg(dTlam)*ZA(gt1,2)*ZA(gt2,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,2)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,2)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res-(dkap*vS*Conjg(lam)*ZA(gt1,2)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res-(dvS*kap*Conjg(lam)*ZA(gt1,2)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res+(vu*lam*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dlam*vu*Conjg(kap)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dvu*lam*Conjg(kap)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dkap*vu*Conjg(lam)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dvu*kap*Conjg(lam)*ZA(gt1,3)*ZA(gt2,1)*ZH(gt3,3))/2._dp
res = res-(vS*lam*Conjg(kap)*dZA(gt1,1)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res-(vS*kap*Conjg(lam)*dZA(gt1,1)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res-(Conjg(Tlam)*dZA(gt1,1)*ZA(gt2,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZA(gt1,2)*ZA(gt2,2)*ZH(gt3,3))
res = res+(vd*lam*Conjg(kap)*dZA(gt1,3)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZA(gt1,3)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res-(dZA(gt1,1)*Tlam*ZA(gt2,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(dTlam*ZA(gt1,1)*ZA(gt2,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,1)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res-(vS*kap*Conjg(dlam)*ZA(gt1,1)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res-(Conjg(dTlam)*ZA(gt1,1)*ZA(gt2,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,1)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,1)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res-(dkap*vS*Conjg(lam)*ZA(gt1,1)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res-(dvS*kap*Conjg(lam)*ZA(gt1,1)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res-(vS*lam*Conjg(dlam)*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,3))
res = res-(dlam*vS*Conjg(lam)*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,3))
res = res-(dvS*lam*Conjg(lam)*ZA(gt1,2)*ZA(gt2,2)*ZH(gt3,3))
res = res+(vd*lam*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(dlam)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dlam*vd*Conjg(kap)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dvd*lam*Conjg(kap)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dkap*vd*Conjg(lam)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dvd*kap*Conjg(lam)*ZA(gt1,3)*ZA(gt2,2)*ZH(gt3,3))/2._dp
res = res+(vu*lam*Conjg(kap)*dZA(gt1,1)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZA(gt1,1)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vd*lam*Conjg(kap)*dZA(gt1,2)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZA(gt1,2)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res-2*vS*kap*Conjg(kap)*dZA(gt1,3)*ZA(gt2,3)*ZH(gt3,3)
res = res+(Conjg(Tk)*dZA(gt1,3)*ZA(gt2,3)*ZH(gt3,3))/sqrt(2._dp)
res = res+(dZA(gt1,3)*Tk*ZA(gt2,3)*ZH(gt3,3))/sqrt(2._dp)
res = res+(vu*lam*Conjg(dkap)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(dlam)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dlam*vu*Conjg(kap)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dvu*lam*Conjg(kap)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dkap*vu*Conjg(lam)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dvu*kap*Conjg(lam)*ZA(gt1,1)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vd*lam*Conjg(dkap)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(dlam)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dlam*vd*Conjg(kap)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dvd*lam*Conjg(kap)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dkap*vd*Conjg(lam)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dvd*kap*Conjg(lam)*ZA(gt1,2)*ZA(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dTk*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,3))/sqrt(2._dp)
res = res-2*vS*kap*Conjg(dkap)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,3)
res = res+(Conjg(dTk)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,3))/sqrt(2._dp)
res = res-2*dkap*vS*Conjg(kap)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,3)
res = res-2*dvS*kap*Conjg(kap)*ZA(gt1,3)*ZA(gt2,3)*ZH(gt3,3)
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhAhhh
Subroutine CT_CouplingAhhhhh(gt1,gt2,gt3,lam,Tlam,kap,Tk,vd,vu,vS,ZH,ZA, &
& dlam,dTlam,dkap,dTk,dvd,dvu,dvS,dZH,dZA,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: vd,vu,vS,ZH(3,3),ZA(3,3),dvd,dvu,dvS,dZH(3,3),dZA(3,3)
Complex(dp), Intent(in) :: lam,Tlam,kap,Tk,dlam,dTlam,dkap,dTk
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhhhhh'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
res = res-(vS*lam*Conjg(kap)*dZH(gt3,3)*ZA(gt1,2)*ZH(gt2,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,3)*ZA(gt1,2)*ZH(gt2,1))/2._dp
res = res+(Conjg(Tlam)*dZH(gt3,3)*ZA(gt1,2)*ZH(gt2,1))/(2._dp*sqrt(2._dp))
res = res-(dZH(gt3,3)*Tlam*ZA(gt1,2)*ZH(gt2,1))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(kap)*dZH(gt3,2)*ZA(gt1,3)*ZH(gt2,1))/2._dp
res = res-(vS*kap*Conjg(lam)*dZH(gt3,2)*ZA(gt1,3)*ZH(gt2,1))/2._dp
res = res+(Conjg(Tlam)*dZH(gt3,2)*ZA(gt1,3)*ZH(gt2,1))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt3,3)*ZA(gt1,3)*ZH(gt2,1))/2._dp
res = res-(vu*kap*Conjg(lam)*dZH(gt3,3)*ZA(gt1,3)*ZH(gt2,1))/2._dp
res = res-(dZH(gt3,2)*Tlam*ZA(gt1,3)*ZH(gt2,1))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZH(gt3,3)*ZA(gt1,1)*ZH(gt2,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,3)*ZA(gt1,1)*ZH(gt2,2))/2._dp
res = res+(Conjg(Tlam)*dZH(gt3,3)*ZA(gt1,1)*ZH(gt2,2))/(2._dp*sqrt(2._dp))
res = res-(dZH(gt3,3)*Tlam*ZA(gt1,1)*ZH(gt2,2))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(kap)*dZH(gt3,1)*ZA(gt1,3)*ZH(gt2,2))/2._dp
res = res-(vS*kap*Conjg(lam)*dZH(gt3,1)*ZA(gt1,3)*ZH(gt2,2))/2._dp
res = res+(Conjg(Tlam)*dZH(gt3,1)*ZA(gt1,3)*ZH(gt2,2))/(2._dp*sqrt(2._dp))
res = res+(vd*lam*Conjg(kap)*dZH(gt3,3)*ZA(gt1,3)*ZH(gt2,2))/2._dp
res = res-(vd*kap*Conjg(lam)*dZH(gt3,3)*ZA(gt1,3)*ZH(gt2,2))/2._dp
res = res-(dZH(gt3,1)*Tlam*ZA(gt1,3)*ZH(gt2,2))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZH(gt3,2)*ZA(gt1,1)*ZH(gt2,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,2)*ZA(gt1,1)*ZH(gt2,3))/2._dp
res = res+(Conjg(Tlam)*dZH(gt3,2)*ZA(gt1,1)*ZH(gt2,3))/(2._dp*sqrt(2._dp))
res = res-(vu*lam*Conjg(kap)*dZH(gt3,3)*ZA(gt1,1)*ZH(gt2,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt3,3)*ZA(gt1,1)*ZH(gt2,3))/2._dp
res = res-(dZH(gt3,2)*Tlam*ZA(gt1,1)*ZH(gt2,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZH(gt3,1)*ZA(gt1,2)*ZH(gt2,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,1)*ZA(gt1,2)*ZH(gt2,3))/2._dp
res = res+(Conjg(Tlam)*dZH(gt3,1)*ZA(gt1,2)*ZH(gt2,3))/(2._dp*sqrt(2._dp))
res = res-(vd*lam*Conjg(kap)*dZH(gt3,3)*ZA(gt1,2)*ZH(gt2,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt3,3)*ZA(gt1,2)*ZH(gt2,3))/2._dp
res = res-(dZH(gt3,1)*Tlam*ZA(gt1,2)*ZH(gt2,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt3,1)*ZA(gt1,3)*ZH(gt2,3))/2._dp
res = res-(vu*kap*Conjg(lam)*dZH(gt3,1)*ZA(gt1,3)*ZH(gt2,3))/2._dp
res = res+(vd*lam*Conjg(kap)*dZH(gt3,2)*ZA(gt1,3)*ZH(gt2,3))/2._dp
res = res-(vd*kap*Conjg(lam)*dZH(gt3,2)*ZA(gt1,3)*ZH(gt2,3))/2._dp
res = res-((Conjg(Tk)*dZH(gt3,3)*ZA(gt1,3)*ZH(gt2,3))/sqrt(2._dp))
res = res+(dZH(gt3,3)*Tk*ZA(gt1,3)*ZH(gt2,3))/sqrt(2._dp)
res = res-(vS*lam*Conjg(kap)*dZH(gt2,3)*ZA(gt1,2)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt2,3)*ZA(gt1,2)*ZH(gt3,1))/2._dp
res = res+(Conjg(Tlam)*dZH(gt2,3)*ZA(gt1,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(dZH(gt2,3)*Tlam*ZA(gt1,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(kap)*dZH(gt2,2)*ZA(gt1,3)*ZH(gt3,1))/2._dp
res = res-(vS*kap*Conjg(lam)*dZH(gt2,2)*ZA(gt1,3)*ZH(gt3,1))/2._dp
res = res+(Conjg(Tlam)*dZH(gt2,2)*ZA(gt1,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt2,3)*ZA(gt1,3)*ZH(gt3,1))/2._dp
res = res-(vu*kap*Conjg(lam)*dZH(gt2,3)*ZA(gt1,3)*ZH(gt3,1))/2._dp
res = res-(dZH(gt2,2)*Tlam*ZA(gt1,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(kap)*dZA(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res-(vS*kap*Conjg(lam)*dZA(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res+(Conjg(Tlam)*dZA(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(dZA(gt1,3)*Tlam*ZH(gt2,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(dTlam*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(dkap)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res-(vS*kap*Conjg(dlam)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res+(Conjg(dTlam)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dlam*vS*Conjg(kap)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res+(dvS*lam*Conjg(kap)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res-(dkap*vS*Conjg(lam)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res-(dvS*kap*Conjg(lam)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res-(vS*lam*Conjg(kap)*dZA(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(Conjg(Tlam)*dZA(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res-(dZA(gt1,2)*Tlam*ZH(gt2,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(dTlam*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(Conjg(dTlam)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(vu*lam*Conjg(dkap)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res-(vu*kap*Conjg(dlam)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(dlam*vu*Conjg(kap)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(dvu*lam*Conjg(kap)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res-(dkap*vu*Conjg(lam)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res-(dvu*kap*Conjg(lam)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res-(vS*lam*Conjg(kap)*dZH(gt2,3)*ZA(gt1,1)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt2,3)*ZA(gt1,1)*ZH(gt3,2))/2._dp
res = res+(Conjg(Tlam)*dZH(gt2,3)*ZA(gt1,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(dZH(gt2,3)*Tlam*ZA(gt1,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(kap)*dZH(gt2,1)*ZA(gt1,3)*ZH(gt3,2))/2._dp
res = res-(vS*kap*Conjg(lam)*dZH(gt2,1)*ZA(gt1,3)*ZH(gt3,2))/2._dp
res = res+(Conjg(Tlam)*dZH(gt2,1)*ZA(gt1,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(vd*lam*Conjg(kap)*dZH(gt2,3)*ZA(gt1,3)*ZH(gt3,2))/2._dp
res = res-(vd*kap*Conjg(lam)*dZH(gt2,3)*ZA(gt1,3)*ZH(gt3,2))/2._dp
res = res-(dZH(gt2,1)*Tlam*ZA(gt1,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(kap)*dZA(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res-(vS*kap*Conjg(lam)*dZA(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(Conjg(Tlam)*dZA(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(dZA(gt1,3)*Tlam*ZH(gt2,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(dTlam*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(dkap)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res-(vS*kap*Conjg(dlam)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(Conjg(dTlam)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dlam*vS*Conjg(kap)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(dvS*lam*Conjg(kap)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res-(dkap*vS*Conjg(lam)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res-(dvS*kap*Conjg(lam)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res-(vS*lam*Conjg(kap)*dZA(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(Conjg(Tlam)*dZA(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(vd*lam*Conjg(kap)*dZA(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res-(dZA(gt1,1)*Tlam*ZH(gt2,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(dTlam*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(Conjg(dTlam)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(vd*lam*Conjg(dkap)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res-(vd*kap*Conjg(dlam)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(dlam*vd*Conjg(kap)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(dvd*lam*Conjg(kap)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res-(dkap*vd*Conjg(lam)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res-(dvd*kap*Conjg(lam)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res-(vS*lam*Conjg(kap)*dZH(gt2,2)*ZA(gt1,1)*ZH(gt3,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt2,2)*ZA(gt1,1)*ZH(gt3,3))/2._dp
res = res+(Conjg(Tlam)*dZH(gt2,2)*ZA(gt1,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vu*lam*Conjg(kap)*dZH(gt2,3)*ZA(gt1,1)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt2,3)*ZA(gt1,1)*ZH(gt3,3))/2._dp
res = res-(dZH(gt2,2)*Tlam*ZA(gt1,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(kap)*dZH(gt2,1)*ZA(gt1,2)*ZH(gt3,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt2,1)*ZA(gt1,2)*ZH(gt3,3))/2._dp
res = res+(Conjg(Tlam)*dZH(gt2,1)*ZA(gt1,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vd*lam*Conjg(kap)*dZH(gt2,3)*ZA(gt1,2)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt2,3)*ZA(gt1,2)*ZH(gt3,3))/2._dp
res = res-(dZH(gt2,1)*Tlam*ZA(gt1,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt2,1)*ZA(gt1,3)*ZH(gt3,3))/2._dp
res = res-(vu*kap*Conjg(lam)*dZH(gt2,1)*ZA(gt1,3)*ZH(gt3,3))/2._dp
res = res+(vd*lam*Conjg(kap)*dZH(gt2,2)*ZA(gt1,3)*ZH(gt3,3))/2._dp
res = res-(vd*kap*Conjg(lam)*dZH(gt2,2)*ZA(gt1,3)*ZH(gt3,3))/2._dp
res = res-((Conjg(Tk)*dZH(gt2,3)*ZA(gt1,3)*ZH(gt3,3))/sqrt(2._dp))
res = res+(dZH(gt2,3)*Tk*ZA(gt1,3)*ZH(gt3,3))/sqrt(2._dp)
res = res-(vS*lam*Conjg(kap)*dZA(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(Conjg(Tlam)*dZA(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZA(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res-(vu*kap*Conjg(lam)*dZA(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res-(dZA(gt1,2)*Tlam*ZH(gt2,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(dTlam*ZA(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(Conjg(dTlam)*ZA(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(vu*lam*Conjg(dkap)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res-(vu*kap*Conjg(dlam)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dlam*vu*Conjg(kap)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dvu*lam*Conjg(kap)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res-(dkap*vu*Conjg(lam)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res-(dvu*kap*Conjg(lam)*ZA(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res-(vS*lam*Conjg(kap)*dZA(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZA(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(Conjg(Tlam)*dZA(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vd*lam*Conjg(kap)*dZA(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res-(vd*kap*Conjg(lam)*dZA(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res-(dZA(gt1,1)*Tlam*ZH(gt2,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(dTlam*ZA(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZA(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(Conjg(dTlam)*ZA(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZA(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZA(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(vd*lam*Conjg(dkap)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res-(vd*kap*Conjg(dlam)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dlam*vd*Conjg(kap)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dvd*lam*Conjg(kap)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res-(dkap*vd*Conjg(lam)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res-(dvd*kap*Conjg(lam)*ZA(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res-(vu*lam*Conjg(kap)*dZA(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZA(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(vd*lam*Conjg(kap)*dZA(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZA(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-((Conjg(Tk)*dZA(gt1,3)*ZH(gt2,3)*ZH(gt3,3))/sqrt(2._dp))
res = res+(dZA(gt1,3)*Tk*ZH(gt2,3)*ZH(gt3,3))/sqrt(2._dp)
res = res-(vu*lam*Conjg(dkap)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(dlam)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(dlam*vu*Conjg(kap)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(dvu*lam*Conjg(kap)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dkap*vu*Conjg(lam)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dvu*kap*Conjg(lam)*ZA(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(vd*lam*Conjg(dkap)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(dlam)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(dlam*vd*Conjg(kap)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(dvd*lam*Conjg(kap)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dkap*vd*Conjg(lam)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dvd*kap*Conjg(lam)*ZA(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dTk*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,3))/sqrt(2._dp)
res = res-((Conjg(dTk)*ZA(gt1,3)*ZH(gt2,3)*ZH(gt3,3))/sqrt(2._dp))
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhhhhh
Subroutine CT_CouplingAhHpmcHpm(gt1,gt2,gt3,g2,lam,Tlam,kap,vd,vu,vS,ZA, &
& ZP,dg2,dlam,dTlam,dkap,dvd,dvu,dvS,dZA,dZP,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,vd,vu,vS,ZA(3,3),ZP(2,2),dg2,dvd,dvu,dvS,dZA(3,3),dZP(2,2)
Complex(dp), Intent(in) :: lam,Tlam,kap,dlam,dTlam,dkap
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhHpmcHpm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
res = res-(g2**2*vu*dZP(gt3,2)*ZA(gt1,1)*ZP(gt2,1))/4._dp
res = res+(vu*lam*Conjg(lam)*dZP(gt3,2)*ZA(gt1,1)*ZP(gt2,1))/2._dp
res = res-(g2**2*vd*dZP(gt3,2)*ZA(gt1,2)*ZP(gt2,1))/4._dp
res = res+(vd*lam*Conjg(lam)*dZP(gt3,2)*ZA(gt1,2)*ZP(gt2,1))/2._dp
res = res-(vS*lam*Conjg(kap)*dZP(gt3,2)*ZA(gt1,3)*ZP(gt2,1))
res = res+(dZP(gt3,2)*Tlam*ZA(gt1,3)*ZP(gt2,1))/sqrt(2._dp)
res = res+(g2**2*vu*dZP(gt3,1)*ZA(gt1,1)*ZP(gt2,2))/4._dp
res = res-(vu*lam*Conjg(lam)*dZP(gt3,1)*ZA(gt1,1)*ZP(gt2,2))/2._dp
res = res+(g2**2*vd*dZP(gt3,1)*ZA(gt1,2)*ZP(gt2,2))/4._dp
res = res-(vd*lam*Conjg(lam)*dZP(gt3,1)*ZA(gt1,2)*ZP(gt2,2))/2._dp
res = res+vS*kap*Conjg(lam)*dZP(gt3,1)*ZA(gt1,3)*ZP(gt2,2)
res = res-((Conjg(Tlam)*dZP(gt3,1)*ZA(gt1,3)*ZP(gt2,2))/sqrt(2._dp))
res = res+(g2**2*vu*dZP(gt2,2)*ZA(gt1,1)*ZP(gt3,1))/4._dp
res = res-(vu*lam*Conjg(lam)*dZP(gt2,2)*ZA(gt1,1)*ZP(gt3,1))/2._dp
res = res+(g2**2*vd*dZP(gt2,2)*ZA(gt1,2)*ZP(gt3,1))/4._dp
res = res-(vd*lam*Conjg(lam)*dZP(gt2,2)*ZA(gt1,2)*ZP(gt3,1))/2._dp
res = res+vS*kap*Conjg(lam)*dZP(gt2,2)*ZA(gt1,3)*ZP(gt3,1)
res = res-((Conjg(Tlam)*dZP(gt2,2)*ZA(gt1,3)*ZP(gt3,1))/sqrt(2._dp))
res = res+(g2**2*vu*dZA(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/4._dp
res = res-(vu*lam*Conjg(lam)*dZA(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res+(g2**2*vd*dZA(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/4._dp
res = res-(vd*lam*Conjg(lam)*dZA(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res+vS*kap*Conjg(lam)*dZA(gt1,3)*ZP(gt2,2)*ZP(gt3,1)
res = res-((Conjg(Tlam)*dZA(gt1,3)*ZP(gt2,2)*ZP(gt3,1))/sqrt(2._dp))
res = res+(dvu*g2**2*ZA(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/4._dp
res = res+(dg2*g2*vu*ZA(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res-(vu*lam*Conjg(dlam)*ZA(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res-(dlam*vu*Conjg(lam)*ZA(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res-(dvu*lam*Conjg(lam)*ZA(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res+(dvd*g2**2*ZA(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/4._dp
res = res+(dg2*g2*vd*ZA(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res-(vd*lam*Conjg(dlam)*ZA(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res-(dlam*vd*Conjg(lam)*ZA(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res-(dvd*lam*Conjg(lam)*ZA(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res+vS*kap*Conjg(dlam)*ZA(gt1,3)*ZP(gt2,2)*ZP(gt3,1)
res = res-((Conjg(dTlam)*ZA(gt1,3)*ZP(gt2,2)*ZP(gt3,1))/sqrt(2._dp))
res = res+dkap*vS*Conjg(lam)*ZA(gt1,3)*ZP(gt2,2)*ZP(gt3,1)
res = res+dvS*kap*Conjg(lam)*ZA(gt1,3)*ZP(gt2,2)*ZP(gt3,1)
res = res-(g2**2*vu*dZP(gt2,1)*ZA(gt1,1)*ZP(gt3,2))/4._dp
res = res+(vu*lam*Conjg(lam)*dZP(gt2,1)*ZA(gt1,1)*ZP(gt3,2))/2._dp
res = res-(g2**2*vd*dZP(gt2,1)*ZA(gt1,2)*ZP(gt3,2))/4._dp
res = res+(vd*lam*Conjg(lam)*dZP(gt2,1)*ZA(gt1,2)*ZP(gt3,2))/2._dp
res = res-(vS*lam*Conjg(kap)*dZP(gt2,1)*ZA(gt1,3)*ZP(gt3,2))
res = res+(dZP(gt2,1)*Tlam*ZA(gt1,3)*ZP(gt3,2))/sqrt(2._dp)
res = res-(g2**2*vu*dZA(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/4._dp
res = res+(vu*lam*Conjg(lam)*dZA(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res-(g2**2*vd*dZA(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/4._dp
res = res+(vd*lam*Conjg(lam)*dZA(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res-(vS*lam*Conjg(kap)*dZA(gt1,3)*ZP(gt2,1)*ZP(gt3,2))
res = res+(dZA(gt1,3)*Tlam*ZP(gt2,1)*ZP(gt3,2))/sqrt(2._dp)
res = res-(dvu*g2**2*ZA(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/4._dp
res = res-(dg2*g2*vu*ZA(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(vu*lam*Conjg(dlam)*ZA(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(dlam*vu*Conjg(lam)*ZA(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(dvu*lam*Conjg(lam)*ZA(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res-(dvd*g2**2*ZA(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/4._dp
res = res-(dg2*g2*vd*ZA(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(vd*lam*Conjg(dlam)*ZA(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(dlam*vd*Conjg(lam)*ZA(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(dvd*lam*Conjg(lam)*ZA(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(dTlam*ZA(gt1,3)*ZP(gt2,1)*ZP(gt3,2))/sqrt(2._dp)
res = res-(vS*lam*Conjg(dkap)*ZA(gt1,3)*ZP(gt2,1)*ZP(gt3,2))
res = res-(dlam*vS*Conjg(kap)*ZA(gt1,3)*ZP(gt2,1)*ZP(gt3,2))
res = res-(dvS*lam*Conjg(kap)*ZA(gt1,3)*ZP(gt2,1)*ZP(gt3,2))
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhHpmcHpm
Subroutine CT_CouplingAhSdcSd(gt1,gt2,gt3,Yd,Td,lam,vu,vS,ZD,ZA,dYd,dTd, &
& dlam,dvu,dvS,dZD,dZA,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: vu,vS,ZA(3,3),dvu,dvS,dZA(3,3)
Complex(dp), Intent(in) :: Yd(3,3),Td(3,3),lam,ZD(6,6),dYd(3,3),dTd(3,3),dlam,dZD(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhSdcSd'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZD(gt2,3 + j1))*Conjg(Td(j1,j2))*dZD(gt3,j2)*ZA(gt1,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*dZD(gt3,j2)*ZA(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZD(gt2,j2))*dZD(gt3,3 + j1)*Yd(j1,j2)*ZA(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*dZD(gt3,j2)*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZD(gt2,j2))*dZD(gt3,3 + j1)*Yd(j1,j2)*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZD(gt2,j2))*dZA(gt1,2)*Yd(j1,j2)*ZD(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZD(gt2,j2))*dZA(gt1,3)*Yd(j1,j2)*ZD(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZD(gt2,j2))*dTd(j1,j2)*ZA(gt1,1)*ZD(gt3,3 + j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZD(gt2,j2))*dYd(j1,j2)*ZA(gt1,2)*ZD(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZD(gt2,j2))*Yd(j1,j2)*ZA(gt1,2)*ZD(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZD(gt2,j2))*Yd(j1,j2)*ZA(gt1,2)*ZD(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZD(gt2,j2))*Yd(j1,j2)*ZA(gt1,2)*ZD(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZD(gt2,j2))*dYd(j1,j2)*ZA(gt1,3)*ZD(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZD(gt2,j2))*Yd(j1,j2)*ZA(gt1,3)*ZD(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZD(gt2,j2))*Yd(j1,j2)*ZA(gt1,3)*ZD(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZD(gt2,j2))*Yd(j1,j2)*ZA(gt1,3)*ZD(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZD(gt2,3 + j1))*Conjg(Td(j1,j2))*dZA(gt1,1)*ZD(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*dZA(gt1,2)*ZD(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*dZA(gt1,3)*ZD(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dTd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZA(gt1,1)*ZD(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dZD(gt2,3 + j1))*Conjg(Td(j1,j2))*ZA(gt1,1)*ZD(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZD(gt2,3 + j1))*Conjg(Yd(j1,j2))*ZA(gt1,2)*ZD(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dYd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZA(gt1,2)*ZD(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vS*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZA(gt1,2)*ZD(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZA(gt1,2)*ZD(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZD(gt2,3 + j1))*Conjg(Yd(j1,j2))*ZA(gt1,3)*ZD(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dYd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZA(gt1,3)*ZD(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vu*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZA(gt1,3)*ZD(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZA(gt1,3)*ZD(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZD(gt2,j2))*dZD(gt3,3 + j1)*ZA(gt1,1)*Td(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZD(gt2,j2))*dZA(gt1,1)*ZD(gt3,3 + j1)*Td(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZD(gt2,j2))*ZA(gt1,1)*ZD(gt3,3 + j1)*Td(j1,j2))/sqrt(2._dp)
End Do
End Do
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhSdcSd
Subroutine CT_CouplingAhSecSe(gt1,gt2,gt3,Ye,Te,lam,vu,vS,ZE,ZA,dYe,dTe, &
& dlam,dvu,dvS,dZE,dZA,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: vu,vS,ZA(3,3),dvu,dvS,dZA(3,3)
Complex(dp), Intent(in) :: Ye(3,3),Te(3,3),lam,ZE(6,6),dYe(3,3),dTe(3,3),dlam,dZE(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhSecSe'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZE(gt2,3 + j1))*Conjg(Te(j1,j2))*dZE(gt3,j2)*ZA(gt1,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*dZE(gt3,j2)*ZA(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZE(gt2,j2))*dZE(gt3,3 + j1)*Ye(j1,j2)*ZA(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*dZE(gt3,j2)*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZE(gt2,j2))*dZE(gt3,3 + j1)*Ye(j1,j2)*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZE(gt2,j2))*dZA(gt1,2)*Ye(j1,j2)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZE(gt2,j2))*dZA(gt1,3)*Ye(j1,j2)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZE(gt2,j2))*dTe(j1,j2)*ZA(gt1,1)*ZE(gt3,3 + j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZE(gt2,j2))*dYe(j1,j2)*ZA(gt1,2)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZE(gt2,j2))*Ye(j1,j2)*ZA(gt1,2)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZE(gt2,j2))*Ye(j1,j2)*ZA(gt1,2)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZE(gt2,j2))*Ye(j1,j2)*ZA(gt1,2)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZE(gt2,j2))*dYe(j1,j2)*ZA(gt1,3)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZE(gt2,j2))*Ye(j1,j2)*ZA(gt1,3)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZE(gt2,j2))*Ye(j1,j2)*ZA(gt1,3)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZE(gt2,j2))*Ye(j1,j2)*ZA(gt1,3)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZE(gt2,3 + j1))*Conjg(Te(j1,j2))*dZA(gt1,1)*ZE(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*dZA(gt1,2)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*dZA(gt1,3)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dTe(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZA(gt1,1)*ZE(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dZE(gt2,3 + j1))*Conjg(Te(j1,j2))*ZA(gt1,1)*ZE(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZE(gt2,3 + j1))*Conjg(Ye(j1,j2))*ZA(gt1,2)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dYe(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZA(gt1,2)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vS*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZA(gt1,2)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZA(gt1,2)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZE(gt2,3 + j1))*Conjg(Ye(j1,j2))*ZA(gt1,3)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dYe(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZA(gt1,3)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vu*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZA(gt1,3)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZA(gt1,3)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZE(gt2,j2))*dZE(gt3,3 + j1)*ZA(gt1,1)*Te(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZE(gt2,j2))*dZA(gt1,1)*ZE(gt3,3 + j1)*Te(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZE(gt2,j2))*ZA(gt1,1)*ZE(gt3,3 + j1)*Te(j1,j2))/sqrt(2._dp)
End Do
End Do
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhSecSe
Subroutine CT_CouplingAhSucSu(gt1,gt2,gt3,lam,Yu,Tu,vd,vS,ZU,ZA,dlam,dYu, &
& dTu,dvd,dvS,dZU,dZA,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: vd,vS,ZA(3,3),dvd,dvS,dZA(3,3)
Complex(dp), Intent(in) :: lam,Yu(3,3),Tu(3,3),ZU(6,6),dlam,dYu(3,3),dTu(3,3),dZU(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhSucSu'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*dZU(gt3,j2)*ZA(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZU(gt2,j2))*dZU(gt3,3 + j1)*Yu(j1,j2)*ZA(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZU(gt2,3 + j1))*Conjg(Tu(j1,j2))*dZU(gt3,j2)*ZA(gt1,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*dZU(gt3,j2)*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZU(gt2,j2))*dZU(gt3,3 + j1)*Yu(j1,j2)*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZU(gt2,j2))*dZA(gt1,1)*Yu(j1,j2)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZU(gt2,j2))*dZA(gt1,3)*Yu(j1,j2)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZU(gt2,j2))*dYu(j1,j2)*ZA(gt1,1)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZU(gt2,j2))*Yu(j1,j2)*ZA(gt1,1)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZU(gt2,j2))*Yu(j1,j2)*ZA(gt1,1)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZU(gt2,j2))*Yu(j1,j2)*ZA(gt1,1)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZU(gt2,j2))*dTu(j1,j2)*ZA(gt1,2)*ZU(gt3,3 + j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZU(gt2,j2))*dYu(j1,j2)*ZA(gt1,3)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZU(gt2,j2))*Yu(j1,j2)*ZA(gt1,3)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZU(gt2,j2))*Yu(j1,j2)*ZA(gt1,3)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZU(gt2,j2))*Yu(j1,j2)*ZA(gt1,3)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*dZA(gt1,1)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZU(gt2,3 + j1))*Conjg(Tu(j1,j2))*dZA(gt1,2)*ZU(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*dZA(gt1,3)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZU(gt2,3 + j1))*Conjg(Yu(j1,j2))*ZA(gt1,1)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dYu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZA(gt1,1)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vS*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZA(gt1,1)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZA(gt1,1)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dTu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZA(gt1,2)*ZU(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dZU(gt2,3 + j1))*Conjg(Tu(j1,j2))*ZA(gt1,2)*ZU(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZU(gt2,3 + j1))*Conjg(Yu(j1,j2))*ZA(gt1,3)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dYu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZA(gt1,3)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZA(gt1,3)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZA(gt1,3)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZU(gt2,j2))*dZU(gt3,3 + j1)*ZA(gt1,2)*Tu(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZU(gt2,j2))*dZA(gt1,2)*ZU(gt3,3 + j1)*Tu(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZU(gt2,j2))*ZA(gt1,2)*ZU(gt3,3 + j1)*Tu(j1,j2))/sqrt(2._dp)
End Do
End Do
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhSucSu
Subroutine CT_CouplingAhSvImSvIm(gt1,gt2,gt3,MUX,lam,kap,lamN,TLN,Yv,Tv, &
& vd,vu,vS,ZVI,ZA,dMUX,dlam,dkap,dlamN,dTLN,dYv,dTv,dvd,dvu,dvS,dZVI,dZA,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: vd,vu,vS,ZA(3,3),dvd,dvu,dvS,dZA(3,3)
Complex(dp), Intent(in) :: MUX(3,3),lam,kap,lamN(3,3),TLN(3,3),Yv(3,3),Tv(3,3),ZVI(9,9),dMUX(3,3), &
& dlam,dkap,dlamN(3,3),dTLN(3,3),dYv(3,3),dTv(3,3),dZVI(9,9)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhSvImSvIm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Conjg(Tv(j1,j2))*dZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Conjg(Tv(j1,j2))*dZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*Conjg(TLN(j1,j2))*dZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*Conjg(TLN(j1,j2))*dZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dZA(gt1,1)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dZA(gt1,1)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dZA(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dZA(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVI(gt3,j2))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVI(gt3,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVI(gt2,j2))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVI(gt2,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZVI(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vu*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vu*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*dlamN(j2,j1)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dYv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dYv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVI(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVI(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVI(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(Tv(j1,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*Conjg(Tv(j1,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Conjg(Tv(j1,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Conjg(Tv(j1,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*dlamN(j2,j1)*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dTv(j1,j2)*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dTv(j1,j2)*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVI(gt3,j2))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVI(gt3,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVI(gt2,j2))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTLN(j1,j2))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVI(gt2,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTLN(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dZVI(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dkap*vS*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*kap*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dkap*vS*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*kap*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(TLN(j1,j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,3 + j1))*Conjg(ZVI(gt2,6 + j2))*Conjg(TLN(j1,j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*Conjg(TLN(j1,j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*Conjg(TLN(j1,j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*dlamN(j2,j1)*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*dTLN(j1,j2)*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*dTLN(j1,j2)*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dYv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dYv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*dZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*dZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*dZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*dZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*dZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*dZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVI(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVI(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dkap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(kap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dkap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(kap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*ZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*ZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*dZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*dZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j1))*ZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,3 + j1))*Conjg(ZVI(gt2,6 + j2))*ZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*ZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*ZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j3,j1))*dZA(gt1,3)*MUX(j1,j2))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZA(gt1,3)*MUX(j1,j2))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j3,j1))*dZA(gt1,3)*MUX(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZA(gt1,3)*MUX(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*dZA(gt1,2)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZA(gt1,2)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*dZA(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZA(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*dlamN(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*dlamN(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVI(gt3,6 + j3))*Conjg(ZVI(gt2,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVI(gt3,j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*dlamN(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*dlamN(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j3))*dlamN(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j3))*dlamN(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j3,j1))*dMUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*dMUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j3,j1))*dMUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*dMUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,3 + j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j3))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,3 + j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j3))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt3,6 + j3))*Conjg(ZVI(gt2,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt3,j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*dZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*dZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*dZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*dZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt3,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt3,6 + j2))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt3,j3))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVI(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVI(gt3,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVI(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt3,6 + j2))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVI(gt2,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt3,j3))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,3 + j2))*dZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,3 + j2))*dZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j3))*dZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j3))*dZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,6 + j3))*Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,6 + j3))*Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,3 + j2))*Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,3 + j2))*Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,6 + j3))*Conjg(MUX(j1,j3))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,6 + j3))*Conjg(MUX(j3,j1))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j2))*Conjg(MUX(j1,j3))*Conjg(ZVI(gt3,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j2))*Conjg(MUX(j3,j1))*Conjg(ZVI(gt3,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhSvImSvIm
Subroutine CT_CouplingAhSvImSvRe(gt1,gt2,gt3,MUX,lam,kap,lamN,TLN,Yv,Tv, &
& vd,vu,vS,ZVI,ZVR,ZA,dMUX,dlam,dkap,dlamN,dTLN,dYv,dTv,dvd,dvu,dvS,dZVI,dZVR,dZA,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: vd,vu,vS,ZA(3,3),dvd,dvu,dvS,dZA(3,3)
Complex(dp), Intent(in) :: MUX(3,3),lam,kap,lamN(3,3),TLN(3,3),Yv(3,3),Tv(3,3),ZVI(9,9),ZVR(9,9),dMUX(3,3), &
& dlam,dkap,dlamN(3,3),dTLN(3,3),dYv(3,3),dTv(3,3),dZVI(9,9),dZVR(9,9)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhSvImSvRe'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(Tv(j1,j2))*dZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Conjg(Tv(j1,j2))*dZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(TLN(j1,j2))*dZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*Conjg(TLN(j1,j2))*dZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZA(gt1,1)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZA(gt1,1)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZA(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZA(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVR(gt3,j2))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVR(gt3,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVI(gt2,j2))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVI(gt2,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vu*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vu*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dlamN(j2,j1)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dYv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dYv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(lam)*Conjg(dZVR(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVR(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(lam)*Conjg(dZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dTv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(Tv(j1,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*Conjg(Tv(j1,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(Tv(j1,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Conjg(Tv(j1,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dlamN(j2,j1)*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dTv(j1,j2)*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dTv(j1,j2)*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVR(gt3,j2))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVR(gt3,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVI(gt2,j2))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dTLN(j1,j2))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVI(gt2,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTLN(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dkap*vS*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*kap*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dkap*vS*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*kap*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(TLN(j1,j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVI(gt2,6 + j2))*Conjg(TLN(j1,j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(TLN(j1,j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*Conjg(TLN(j1,j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(kap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dlamN(j2,j1)*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*dTLN(j1,j2)*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*dTLN(j1,j2)*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dYv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dYv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(dZVR(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(dZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dlam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(kap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(lam)*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(lam)*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dlam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dlam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(kap)*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(kap)*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dkap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(kap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dkap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(kap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*ZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*ZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*dZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*dZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j1))*ZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVI(gt2,6 + j2))*ZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dZA(gt1,3)*MUX(j1,j2))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZA(gt1,3)*MUX(j1,j2))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dZA(gt1,3)*MUX(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZA(gt1,3)*MUX(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dZA(gt1,2)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZA(gt1,2)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dZA(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZA(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dlamN(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dlamN(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVR(gt3,6 + j3))*Conjg(ZVI(gt2,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dlamN(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dlamN(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dlamN(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dlamN(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dMUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dMUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dMUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dMUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j3))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j3))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,6 + j3))*Conjg(ZVI(gt2,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt3,j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVR(gt3,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVI(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,j3))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVI(gt2,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,j3))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j3))*Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j3))*Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j2))*Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j2))*Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,6 + j3))*Conjg(MUX(j1,j3))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,6 + j3))*Conjg(MUX(j3,j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j2))*Conjg(MUX(j1,j3))*Conjg(ZVR(gt3,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j2))*Conjg(MUX(j3,j1))*Conjg(ZVR(gt3,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhSvImSvRe
Subroutine CT_CouplingAhSvReSvRe(gt1,gt2,gt3,MUX,lam,kap,lamN,TLN,Yv,Tv, &
& vd,vu,vS,ZVR,ZA,dMUX,dlam,dkap,dlamN,dTLN,dYv,dTv,dvd,dvu,dvS,dZVR,dZA,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: vd,vu,vS,ZA(3,3),dvd,dvu,dvS,dZA(3,3)
Complex(dp), Intent(in) :: MUX(3,3),lam,kap,lamN(3,3),TLN(3,3),Yv(3,3),Tv(3,3),ZVR(9,9),dMUX(3,3), &
& dlam,dkap,dlamN(3,3),dTLN(3,3),dYv(3,3),dTv(3,3),dZVR(9,9)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhSvReSvRe'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(Tv(j1,j2))*dZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Conjg(Tv(j1,j2))*dZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(TLN(j1,j2))*dZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*Conjg(TLN(j1,j2))*dZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZA(gt1,1)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZA(gt1,1)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZA(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZA(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVR(gt3,j2))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVR(gt3,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVR(gt2,j2))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dlamN(j2,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVR(gt2,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dlamN(j2,j1))*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vu*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*lam*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vu*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*lam*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dlamN(j2,j1)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dYv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dYv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVR(gt3,j2))*Conjg(ZVR(gt2,3 + j1))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVR(gt3,3 + j1))*Conjg(ZVR(gt2,j2))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dlamN(j2,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dlamN(j2,j1))*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(Tv(j1,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVR(gt2,j2))*Conjg(Tv(j1,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(Tv(j1,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Conjg(Tv(j1,j2))*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dlamN(j2,j1)*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dTv(j1,j2)*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dTv(j1,j2)*ZA(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVR(gt3,j2))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVR(gt3,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVR(gt2,j2))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dYv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTLN(j1,j2))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dlamN(j2,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVR(gt2,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dYv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dlamN(j2,j1))*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTLN(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dkap*vS*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*kap*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dkap*vS*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*kap*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(TLN(j1,j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVR(gt2,6 + j2))*Conjg(TLN(j1,j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(TLN(j1,j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*Conjg(TLN(j1,j2))*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dlamN(j2,j1)*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*dTLN(j1,j2)*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*dTLN(j1,j2)*ZA(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dYv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dYv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt3,j2))*Conjg(ZVR(gt2,3 + j1))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt3,3 + j1))*Conjg(ZVR(gt2,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,6 + j1))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVR(gt2,3 + j2))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,6 + j1))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVR(gt2,3 + j2))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,6 + j1))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVR(gt2,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dkap)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(kap)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dkap)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(kap)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,j2))*Conjg(ZVR(gt2,3 + j1))*ZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVR(gt2,j2))*ZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZA(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*dZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*dZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVR(gt2,3 + j1))*ZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVR(gt2,6 + j2))*ZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*ZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dZA(gt1,3)*MUX(j1,j2))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZA(gt1,3)*MUX(j1,j2))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dZA(gt1,3)*MUX(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZA(gt1,3)*MUX(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dZA(gt1,2)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZA(gt1,2)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dZA(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZA(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dlamN(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dlamN(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlamN(j1,j3))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlamN(j1,j3))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVR(gt3,6 + j3))*Conjg(ZVR(gt2,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVR(gt3,j2))*Conjg(ZVR(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dlamN(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dlamN(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j1,j3))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j3,j1))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j1,j3))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dlamN(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dlamN(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dMUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dMUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dMUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dMUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dlamN(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dlamN(j3,j1))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVR(gt2,3 + j3))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dlamN(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dlamN(j3,j1))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVR(gt2,3 + j3))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZA(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dlamN(j1,j3))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dlamN(j1,j3))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,6 + j3))*Conjg(ZVR(gt2,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,j2))*Conjg(ZVR(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZA(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dYv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt2,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,j3))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dYv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZA(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt3,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt2,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,j3))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZA(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j1,j3))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j3,j1))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j1,j3))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,6 + j3))*Conjg(MUX(j1,j3))*Conjg(ZVR(gt2,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,6 + j3))*Conjg(MUX(j3,j1))*Conjg(ZVR(gt2,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,3 + j2))*Conjg(MUX(j1,j3))*Conjg(ZVR(gt2,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,3 + j2))*Conjg(MUX(j3,j1))*Conjg(ZVR(gt2,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt2,6 + j3))*Conjg(MUX(j1,j3))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt2,6 + j3))*Conjg(MUX(j3,j1))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dMUX(j1,j3))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dMUX(j3,j1))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt2,3 + j2))*Conjg(MUX(j1,j3))*Conjg(ZVR(gt3,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt2,3 + j2))*Conjg(MUX(j3,j1))*Conjg(ZVR(gt3,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dMUX(j1,j3))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dMUX(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*ZA(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhSvReSvRe
Subroutine CT_Couplinghhhhhh(gt1,gt2,gt3,g1,g2,lam,Tlam,kap,Tk,vd,vu,vS, &
& ZH,dg1,dg2,dlam,dTlam,dkap,dTk,dvd,dvu,dvS,dZH,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,vd,vu,vS,ZH(3,3),dg1,dg2,dvd,dvu,dvS,dZH(3,3)
Complex(dp), Intent(in) :: lam,Tlam,kap,Tk,dlam,dTlam,dkap,dTk
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_Couplinghhhhhh'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
res = res+(-3*g1**2*vd*dZH(gt3,1)*ZH(gt1,1)*ZH(gt2,1))/4._dp
res = res+(-3*g2**2*vd*dZH(gt3,1)*ZH(gt1,1)*ZH(gt2,1))/4._dp
res = res+(g1**2*vu*dZH(gt3,2)*ZH(gt1,1)*ZH(gt2,1))/4._dp
res = res+(g2**2*vu*dZH(gt3,2)*ZH(gt1,1)*ZH(gt2,1))/4._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt3,2)*ZH(gt1,1)*ZH(gt2,1))
res = res-(vS*lam*Conjg(lam)*dZH(gt3,3)*ZH(gt1,1)*ZH(gt2,1))
res = res+(g1**2*vu*dZH(gt3,1)*ZH(gt1,2)*ZH(gt2,1))/4._dp
res = res+(g2**2*vu*dZH(gt3,1)*ZH(gt1,2)*ZH(gt2,1))/4._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt3,1)*ZH(gt1,2)*ZH(gt2,1))
res = res+(g1**2*vd*dZH(gt3,2)*ZH(gt1,2)*ZH(gt2,1))/4._dp
res = res+(g2**2*vd*dZH(gt3,2)*ZH(gt1,2)*ZH(gt2,1))/4._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt3,2)*ZH(gt1,2)*ZH(gt2,1))
res = res+(vS*lam*Conjg(kap)*dZH(gt3,3)*ZH(gt1,2)*ZH(gt2,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,3)*ZH(gt1,2)*ZH(gt2,1))/2._dp
res = res+(Conjg(Tlam)*dZH(gt3,3)*ZH(gt1,2)*ZH(gt2,1))/(2._dp*sqrt(2._dp))
res = res+(dZH(gt3,3)*Tlam*ZH(gt1,2)*ZH(gt2,1))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZH(gt3,1)*ZH(gt1,3)*ZH(gt2,1))
res = res+(vS*lam*Conjg(kap)*dZH(gt3,2)*ZH(gt1,3)*ZH(gt2,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,2)*ZH(gt1,3)*ZH(gt2,1))/2._dp
res = res+(Conjg(Tlam)*dZH(gt3,2)*ZH(gt1,3)*ZH(gt2,1))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt3,3)*ZH(gt1,3)*ZH(gt2,1))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt3,3)*ZH(gt1,3)*ZH(gt2,1))/2._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt3,3)*ZH(gt1,3)*ZH(gt2,1))
res = res+(dZH(gt3,2)*Tlam*ZH(gt1,3)*ZH(gt2,1))/(2._dp*sqrt(2._dp))
res = res+(g1**2*vu*dZH(gt3,1)*ZH(gt1,1)*ZH(gt2,2))/4._dp
res = res+(g2**2*vu*dZH(gt3,1)*ZH(gt1,1)*ZH(gt2,2))/4._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt3,1)*ZH(gt1,1)*ZH(gt2,2))
res = res+(g1**2*vd*dZH(gt3,2)*ZH(gt1,1)*ZH(gt2,2))/4._dp
res = res+(g2**2*vd*dZH(gt3,2)*ZH(gt1,1)*ZH(gt2,2))/4._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt3,2)*ZH(gt1,1)*ZH(gt2,2))
res = res+(vS*lam*Conjg(kap)*dZH(gt3,3)*ZH(gt1,1)*ZH(gt2,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,3)*ZH(gt1,1)*ZH(gt2,2))/2._dp
res = res+(Conjg(Tlam)*dZH(gt3,3)*ZH(gt1,1)*ZH(gt2,2))/(2._dp*sqrt(2._dp))
res = res+(dZH(gt3,3)*Tlam*ZH(gt1,1)*ZH(gt2,2))/(2._dp*sqrt(2._dp))
res = res+(g1**2*vd*dZH(gt3,1)*ZH(gt1,2)*ZH(gt2,2))/4._dp
res = res+(g2**2*vd*dZH(gt3,1)*ZH(gt1,2)*ZH(gt2,2))/4._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt3,1)*ZH(gt1,2)*ZH(gt2,2))
res = res+(-3*g1**2*vu*dZH(gt3,2)*ZH(gt1,2)*ZH(gt2,2))/4._dp
res = res+(-3*g2**2*vu*dZH(gt3,2)*ZH(gt1,2)*ZH(gt2,2))/4._dp
res = res-(vS*lam*Conjg(lam)*dZH(gt3,3)*ZH(gt1,2)*ZH(gt2,2))
res = res+(vS*lam*Conjg(kap)*dZH(gt3,1)*ZH(gt1,3)*ZH(gt2,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,1)*ZH(gt1,3)*ZH(gt2,2))/2._dp
res = res+(Conjg(Tlam)*dZH(gt3,1)*ZH(gt1,3)*ZH(gt2,2))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZH(gt3,2)*ZH(gt1,3)*ZH(gt2,2))
res = res+(vd*lam*Conjg(kap)*dZH(gt3,3)*ZH(gt1,3)*ZH(gt2,2))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt3,3)*ZH(gt1,3)*ZH(gt2,2))/2._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt3,3)*ZH(gt1,3)*ZH(gt2,2))
res = res+(dZH(gt3,1)*Tlam*ZH(gt1,3)*ZH(gt2,2))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZH(gt3,1)*ZH(gt1,1)*ZH(gt2,3))
res = res+(vS*lam*Conjg(kap)*dZH(gt3,2)*ZH(gt1,1)*ZH(gt2,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,2)*ZH(gt1,1)*ZH(gt2,3))/2._dp
res = res+(Conjg(Tlam)*dZH(gt3,2)*ZH(gt1,1)*ZH(gt2,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt3,3)*ZH(gt1,1)*ZH(gt2,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt3,3)*ZH(gt1,1)*ZH(gt2,3))/2._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt3,3)*ZH(gt1,1)*ZH(gt2,3))
res = res+(dZH(gt3,2)*Tlam*ZH(gt1,1)*ZH(gt2,3))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(kap)*dZH(gt3,1)*ZH(gt1,2)*ZH(gt2,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt3,1)*ZH(gt1,2)*ZH(gt2,3))/2._dp
res = res+(Conjg(Tlam)*dZH(gt3,1)*ZH(gt1,2)*ZH(gt2,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZH(gt3,2)*ZH(gt1,2)*ZH(gt2,3))
res = res+(vd*lam*Conjg(kap)*dZH(gt3,3)*ZH(gt1,2)*ZH(gt2,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt3,3)*ZH(gt1,2)*ZH(gt2,3))/2._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt3,3)*ZH(gt1,2)*ZH(gt2,3))
res = res+(dZH(gt3,1)*Tlam*ZH(gt1,2)*ZH(gt2,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt3,1)*ZH(gt1,3)*ZH(gt2,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt3,1)*ZH(gt1,3)*ZH(gt2,3))/2._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt3,1)*ZH(gt1,3)*ZH(gt2,3))
res = res+(vd*lam*Conjg(kap)*dZH(gt3,2)*ZH(gt1,3)*ZH(gt2,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt3,2)*ZH(gt1,3)*ZH(gt2,3))/2._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt3,2)*ZH(gt1,3)*ZH(gt2,3))
res = res-6*vS*kap*Conjg(kap)*dZH(gt3,3)*ZH(gt1,3)*ZH(gt2,3)
res = res-((Conjg(Tk)*dZH(gt3,3)*ZH(gt1,3)*ZH(gt2,3))/sqrt(2._dp))
res = res-((dZH(gt3,3)*Tk*ZH(gt1,3)*ZH(gt2,3))/sqrt(2._dp))
res = res+(-3*g1**2*vd*dZH(gt2,1)*ZH(gt1,1)*ZH(gt3,1))/4._dp
res = res+(-3*g2**2*vd*dZH(gt2,1)*ZH(gt1,1)*ZH(gt3,1))/4._dp
res = res+(g1**2*vu*dZH(gt2,2)*ZH(gt1,1)*ZH(gt3,1))/4._dp
res = res+(g2**2*vu*dZH(gt2,2)*ZH(gt1,1)*ZH(gt3,1))/4._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt2,2)*ZH(gt1,1)*ZH(gt3,1))
res = res-(vS*lam*Conjg(lam)*dZH(gt2,3)*ZH(gt1,1)*ZH(gt3,1))
res = res+(g1**2*vu*dZH(gt2,1)*ZH(gt1,2)*ZH(gt3,1))/4._dp
res = res+(g2**2*vu*dZH(gt2,1)*ZH(gt1,2)*ZH(gt3,1))/4._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt2,1)*ZH(gt1,2)*ZH(gt3,1))
res = res+(g1**2*vd*dZH(gt2,2)*ZH(gt1,2)*ZH(gt3,1))/4._dp
res = res+(g2**2*vd*dZH(gt2,2)*ZH(gt1,2)*ZH(gt3,1))/4._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt2,2)*ZH(gt1,2)*ZH(gt3,1))
res = res+(vS*lam*Conjg(kap)*dZH(gt2,3)*ZH(gt1,2)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt2,3)*ZH(gt1,2)*ZH(gt3,1))/2._dp
res = res+(Conjg(Tlam)*dZH(gt2,3)*ZH(gt1,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dZH(gt2,3)*Tlam*ZH(gt1,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZH(gt2,1)*ZH(gt1,3)*ZH(gt3,1))
res = res+(vS*lam*Conjg(kap)*dZH(gt2,2)*ZH(gt1,3)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt2,2)*ZH(gt1,3)*ZH(gt3,1))/2._dp
res = res+(Conjg(Tlam)*dZH(gt2,2)*ZH(gt1,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt2,3)*ZH(gt1,3)*ZH(gt3,1))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt2,3)*ZH(gt1,3)*ZH(gt3,1))/2._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt2,3)*ZH(gt1,3)*ZH(gt3,1))
res = res+(dZH(gt2,2)*Tlam*ZH(gt1,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(-3*g1**2*vd*dZH(gt1,1)*ZH(gt2,1)*ZH(gt3,1))/4._dp
res = res+(-3*g2**2*vd*dZH(gt1,1)*ZH(gt2,1)*ZH(gt3,1))/4._dp
res = res+(g1**2*vu*dZH(gt1,2)*ZH(gt2,1)*ZH(gt3,1))/4._dp
res = res+(g2**2*vu*dZH(gt1,2)*ZH(gt2,1)*ZH(gt3,1))/4._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt1,2)*ZH(gt2,1)*ZH(gt3,1))
res = res-(vS*lam*Conjg(lam)*dZH(gt1,3)*ZH(gt2,1)*ZH(gt3,1))
res = res+(-3*dvd*g1**2*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,1))/4._dp
res = res+(-3*dvd*g2**2*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,1))/4._dp
res = res+(-3*dg1*g1*vd*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,1))/2._dp
res = res+(-3*dg2*g2*vd*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,1))/2._dp
res = res+(dvu*g1**2*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,1))/4._dp
res = res+(dvu*g2**2*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,1))/4._dp
res = res+(dg1*g1*vu*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,1))/2._dp
res = res+(dg2*g2*vu*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,1))/2._dp
res = res-(vu*lam*Conjg(dlam)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,1))
res = res-(dlam*vu*Conjg(lam)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,1))
res = res-(dvu*lam*Conjg(lam)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,1))
res = res-(vS*lam*Conjg(dlam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,1))
res = res-(dlam*vS*Conjg(lam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,1))
res = res-(dvS*lam*Conjg(lam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,1))
res = res+(g1**2*vu*dZH(gt1,1)*ZH(gt2,2)*ZH(gt3,1))/4._dp
res = res+(g2**2*vu*dZH(gt1,1)*ZH(gt2,2)*ZH(gt3,1))/4._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt1,1)*ZH(gt2,2)*ZH(gt3,1))
res = res+(g1**2*vd*dZH(gt1,2)*ZH(gt2,2)*ZH(gt3,1))/4._dp
res = res+(g2**2*vd*dZH(gt1,2)*ZH(gt2,2)*ZH(gt3,1))/4._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt1,2)*ZH(gt2,2)*ZH(gt3,1))
res = res+(vS*lam*Conjg(kap)*dZH(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res+(Conjg(Tlam)*dZH(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dZH(gt1,3)*Tlam*ZH(gt2,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dvu*g1**2*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,1))/4._dp
res = res+(dvu*g2**2*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,1))/4._dp
res = res+(dg1*g1*vu*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res+(dg2*g2*vu*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res-(vu*lam*Conjg(dlam)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,1))
res = res-(dlam*vu*Conjg(lam)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,1))
res = res-(dvu*lam*Conjg(lam)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,1))
res = res+(dvd*g1**2*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,1))/4._dp
res = res+(dvd*g2**2*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,1))/4._dp
res = res+(dg1*g1*vd*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res+(dg2*g2*vd*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res-(vd*lam*Conjg(dlam)*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,1))
res = res-(dlam*vd*Conjg(lam)*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,1))
res = res-(dvd*lam*Conjg(lam)*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,1))
res = res+(dTlam*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(dkap)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res+(Conjg(dTlam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dlam*vS*Conjg(kap)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res+(dvS*lam*Conjg(kap)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,1))/2._dp
res = res-(vS*lam*Conjg(lam)*dZH(gt1,1)*ZH(gt2,3)*ZH(gt3,1))
res = res+(vS*lam*Conjg(kap)*dZH(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(Conjg(Tlam)*dZH(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt1,3)*ZH(gt2,3)*ZH(gt3,1))
res = res+(dZH(gt1,2)*Tlam*ZH(gt2,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dlam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,1))
res = res-(dlam*vS*Conjg(lam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,1))
res = res-(dvS*lam*Conjg(lam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,1))
res = res+(dTlam*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(dkap)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(Conjg(dTlam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/(2._dp*sqrt(2._dp))
res = res+(dlam*vS*Conjg(kap)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(dvS*lam*Conjg(kap)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(vu*lam*Conjg(dkap)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(vu*kap*Conjg(dlam)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res-(vd*lam*Conjg(dlam)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,1))
res = res+(dlam*vu*Conjg(kap)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(dvu*lam*Conjg(kap)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res-(dlam*vd*Conjg(lam)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,1))
res = res+(dkap*vu*Conjg(lam)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res+(dvu*kap*Conjg(lam)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,1))/2._dp
res = res-(dvd*lam*Conjg(lam)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,1))
res = res+(g1**2*vu*dZH(gt2,1)*ZH(gt1,1)*ZH(gt3,2))/4._dp
res = res+(g2**2*vu*dZH(gt2,1)*ZH(gt1,1)*ZH(gt3,2))/4._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt2,1)*ZH(gt1,1)*ZH(gt3,2))
res = res+(g1**2*vd*dZH(gt2,2)*ZH(gt1,1)*ZH(gt3,2))/4._dp
res = res+(g2**2*vd*dZH(gt2,2)*ZH(gt1,1)*ZH(gt3,2))/4._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt2,2)*ZH(gt1,1)*ZH(gt3,2))
res = res+(vS*lam*Conjg(kap)*dZH(gt2,3)*ZH(gt1,1)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt2,3)*ZH(gt1,1)*ZH(gt3,2))/2._dp
res = res+(Conjg(Tlam)*dZH(gt2,3)*ZH(gt1,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dZH(gt2,3)*Tlam*ZH(gt1,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(g1**2*vd*dZH(gt2,1)*ZH(gt1,2)*ZH(gt3,2))/4._dp
res = res+(g2**2*vd*dZH(gt2,1)*ZH(gt1,2)*ZH(gt3,2))/4._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt2,1)*ZH(gt1,2)*ZH(gt3,2))
res = res+(-3*g1**2*vu*dZH(gt2,2)*ZH(gt1,2)*ZH(gt3,2))/4._dp
res = res+(-3*g2**2*vu*dZH(gt2,2)*ZH(gt1,2)*ZH(gt3,2))/4._dp
res = res-(vS*lam*Conjg(lam)*dZH(gt2,3)*ZH(gt1,2)*ZH(gt3,2))
res = res+(vS*lam*Conjg(kap)*dZH(gt2,1)*ZH(gt1,3)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt2,1)*ZH(gt1,3)*ZH(gt3,2))/2._dp
res = res+(Conjg(Tlam)*dZH(gt2,1)*ZH(gt1,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZH(gt2,2)*ZH(gt1,3)*ZH(gt3,2))
res = res+(vd*lam*Conjg(kap)*dZH(gt2,3)*ZH(gt1,3)*ZH(gt3,2))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt2,3)*ZH(gt1,3)*ZH(gt3,2))/2._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt2,3)*ZH(gt1,3)*ZH(gt3,2))
res = res+(dZH(gt2,1)*Tlam*ZH(gt1,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(g1**2*vu*dZH(gt1,1)*ZH(gt2,1)*ZH(gt3,2))/4._dp
res = res+(g2**2*vu*dZH(gt1,1)*ZH(gt2,1)*ZH(gt3,2))/4._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt1,1)*ZH(gt2,1)*ZH(gt3,2))
res = res+(g1**2*vd*dZH(gt1,2)*ZH(gt2,1)*ZH(gt3,2))/4._dp
res = res+(g2**2*vd*dZH(gt1,2)*ZH(gt2,1)*ZH(gt3,2))/4._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt1,2)*ZH(gt2,1)*ZH(gt3,2))
res = res+(vS*lam*Conjg(kap)*dZH(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(Conjg(Tlam)*dZH(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dZH(gt1,3)*Tlam*ZH(gt2,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dvu*g1**2*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,2))/4._dp
res = res+(dvu*g2**2*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,2))/4._dp
res = res+(dg1*g1*vu*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(dg2*g2*vu*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res-(vu*lam*Conjg(dlam)*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,2))
res = res-(dlam*vu*Conjg(lam)*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,2))
res = res-(dvu*lam*Conjg(lam)*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,2))
res = res+(dvd*g1**2*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,2))/4._dp
res = res+(dvd*g2**2*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,2))/4._dp
res = res+(dg1*g1*vd*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(dg2*g2*vd*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res-(vd*lam*Conjg(dlam)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,2))
res = res-(dlam*vd*Conjg(lam)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,2))
res = res-(dvd*lam*Conjg(lam)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,2))
res = res+(dTlam*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(dkap)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(Conjg(dTlam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dlam*vS*Conjg(kap)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(dvS*lam*Conjg(kap)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,2))/2._dp
res = res+(g1**2*vd*dZH(gt1,1)*ZH(gt2,2)*ZH(gt3,2))/4._dp
res = res+(g2**2*vd*dZH(gt1,1)*ZH(gt2,2)*ZH(gt3,2))/4._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt1,1)*ZH(gt2,2)*ZH(gt3,2))
res = res+(-3*g1**2*vu*dZH(gt1,2)*ZH(gt2,2)*ZH(gt3,2))/4._dp
res = res+(-3*g2**2*vu*dZH(gt1,2)*ZH(gt2,2)*ZH(gt3,2))/4._dp
res = res-(vS*lam*Conjg(lam)*dZH(gt1,3)*ZH(gt2,2)*ZH(gt3,2))
res = res+(dvd*g1**2*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,2))/4._dp
res = res+(dvd*g2**2*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,2))/4._dp
res = res+(dg1*g1*vd*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,2))/2._dp
res = res+(dg2*g2*vd*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,2))/2._dp
res = res-(vd*lam*Conjg(dlam)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,2))
res = res-(dlam*vd*Conjg(lam)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,2))
res = res-(dvd*lam*Conjg(lam)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,2))
res = res+(-3*dvu*g1**2*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,2))/4._dp
res = res+(-3*dvu*g2**2*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,2))/4._dp
res = res+(-3*dg1*g1*vu*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,2))/2._dp
res = res+(-3*dg2*g2*vu*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,2))/2._dp
res = res-(vS*lam*Conjg(dlam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,2))
res = res-(dlam*vS*Conjg(lam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,2))
res = res-(dvS*lam*Conjg(lam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,2))
res = res+(vS*lam*Conjg(kap)*dZH(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(Conjg(Tlam)*dZH(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZH(gt1,2)*ZH(gt2,3)*ZH(gt3,2))
res = res+(vd*lam*Conjg(kap)*dZH(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt1,3)*ZH(gt2,3)*ZH(gt3,2))
res = res+(dZH(gt1,1)*Tlam*ZH(gt2,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dTlam*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(dkap)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(Conjg(dTlam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/(2._dp*sqrt(2._dp))
res = res+(dlam*vS*Conjg(kap)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(dvS*lam*Conjg(kap)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res-(vS*lam*Conjg(dlam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,2))
res = res-(dlam*vS*Conjg(lam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,2))
res = res-(dvS*lam*Conjg(lam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,2))
res = res+(vd*lam*Conjg(dkap)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(vd*kap*Conjg(dlam)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res-(vu*lam*Conjg(dlam)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,2))
res = res+(dlam*vd*Conjg(kap)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(dvd*lam*Conjg(kap)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res+(dkap*vd*Conjg(lam)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res-(dlam*vu*Conjg(lam)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,2))
res = res+(dvd*kap*Conjg(lam)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,2))/2._dp
res = res-(dvu*lam*Conjg(lam)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,2))
res = res-(vS*lam*Conjg(lam)*dZH(gt2,1)*ZH(gt1,1)*ZH(gt3,3))
res = res+(vS*lam*Conjg(kap)*dZH(gt2,2)*ZH(gt1,1)*ZH(gt3,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt2,2)*ZH(gt1,1)*ZH(gt3,3))/2._dp
res = res+(Conjg(Tlam)*dZH(gt2,2)*ZH(gt1,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt2,3)*ZH(gt1,1)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt2,3)*ZH(gt1,1)*ZH(gt3,3))/2._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt2,3)*ZH(gt1,1)*ZH(gt3,3))
res = res+(dZH(gt2,2)*Tlam*ZH(gt1,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(kap)*dZH(gt2,1)*ZH(gt1,2)*ZH(gt3,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt2,1)*ZH(gt1,2)*ZH(gt3,3))/2._dp
res = res+(Conjg(Tlam)*dZH(gt2,1)*ZH(gt1,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZH(gt2,2)*ZH(gt1,2)*ZH(gt3,3))
res = res+(vd*lam*Conjg(kap)*dZH(gt2,3)*ZH(gt1,2)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt2,3)*ZH(gt1,2)*ZH(gt3,3))/2._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt2,3)*ZH(gt1,2)*ZH(gt3,3))
res = res+(dZH(gt2,1)*Tlam*ZH(gt1,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt2,1)*ZH(gt1,3)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt2,1)*ZH(gt1,3)*ZH(gt3,3))/2._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt2,1)*ZH(gt1,3)*ZH(gt3,3))
res = res+(vd*lam*Conjg(kap)*dZH(gt2,2)*ZH(gt1,3)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt2,2)*ZH(gt1,3)*ZH(gt3,3))/2._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt2,2)*ZH(gt1,3)*ZH(gt3,3))
res = res-6*vS*kap*Conjg(kap)*dZH(gt2,3)*ZH(gt1,3)*ZH(gt3,3)
res = res-((Conjg(Tk)*dZH(gt2,3)*ZH(gt1,3)*ZH(gt3,3))/sqrt(2._dp))
res = res-((dZH(gt2,3)*Tk*ZH(gt1,3)*ZH(gt3,3))/sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZH(gt1,1)*ZH(gt2,1)*ZH(gt3,3))
res = res+(vS*lam*Conjg(kap)*dZH(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(Conjg(Tlam)*dZH(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vu*lam*Conjg(kap)*dZH(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt1,3)*ZH(gt2,1)*ZH(gt3,3))
res = res+(dZH(gt1,2)*Tlam*ZH(gt2,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(dlam)*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,3))
res = res-(dlam*vS*Conjg(lam)*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,3))
res = res-(dvS*lam*Conjg(lam)*ZH(gt1,1)*ZH(gt2,1)*ZH(gt3,3))
res = res+(dTlam*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(dkap)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(Conjg(dTlam)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(dlam*vS*Conjg(kap)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dvS*lam*Conjg(kap)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZH(gt1,2)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(vu*lam*Conjg(dkap)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(dlam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res-(vd*lam*Conjg(dlam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,3))
res = res+(dlam*vu*Conjg(kap)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dvu*lam*Conjg(kap)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res-(dlam*vd*Conjg(lam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,3))
res = res+(dkap*vu*Conjg(lam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res+(dvu*kap*Conjg(lam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,3))/2._dp
res = res-(dvd*lam*Conjg(lam)*ZH(gt1,3)*ZH(gt2,1)*ZH(gt3,3))
res = res+(vS*lam*Conjg(kap)*dZH(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(vS*kap*Conjg(lam)*dZH(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(Conjg(Tlam)*dZH(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZH(gt1,2)*ZH(gt2,2)*ZH(gt3,3))
res = res+(vd*lam*Conjg(kap)*dZH(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt1,3)*ZH(gt2,2)*ZH(gt3,3))
res = res+(dZH(gt1,1)*Tlam*ZH(gt2,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(dTlam*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(vS*lam*Conjg(dkap)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(vS*kap*Conjg(dlam)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(Conjg(dTlam)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/(2._dp*sqrt(2._dp))
res = res+(dlam*vS*Conjg(kap)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dvS*lam*Conjg(kap)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dkap*vS*Conjg(lam)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dvS*kap*Conjg(lam)*ZH(gt1,1)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res-(vS*lam*Conjg(dlam)*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,3))
res = res-(dlam*vS*Conjg(lam)*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,3))
res = res-(dvS*lam*Conjg(lam)*ZH(gt1,2)*ZH(gt2,2)*ZH(gt3,3))
res = res+(vd*lam*Conjg(dkap)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(dlam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res-(vu*lam*Conjg(dlam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,3))
res = res+(dlam*vd*Conjg(kap)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dvd*lam*Conjg(kap)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res+(dkap*vd*Conjg(lam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res-(dlam*vu*Conjg(lam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,3))
res = res+(dvd*kap*Conjg(lam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,3))/2._dp
res = res-(dvu*lam*Conjg(lam)*ZH(gt1,3)*ZH(gt2,2)*ZH(gt3,3))
res = res+(vu*lam*Conjg(kap)*dZH(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(lam)*dZH(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(vd*lam*Conjg(lam)*dZH(gt1,1)*ZH(gt2,3)*ZH(gt3,3))
res = res+(vd*lam*Conjg(kap)*dZH(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(lam)*dZH(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(vu*lam*Conjg(lam)*dZH(gt1,2)*ZH(gt2,3)*ZH(gt3,3))
res = res-6*vS*kap*Conjg(kap)*dZH(gt1,3)*ZH(gt2,3)*ZH(gt3,3)
res = res-((Conjg(Tk)*dZH(gt1,3)*ZH(gt2,3)*ZH(gt3,3))/sqrt(2._dp))
res = res-((dZH(gt1,3)*Tk*ZH(gt2,3)*ZH(gt3,3))/sqrt(2._dp))
res = res+(vu*lam*Conjg(dkap)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vu*kap*Conjg(dlam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(vd*lam*Conjg(dlam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,3))
res = res+(dlam*vu*Conjg(kap)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dvu*lam*Conjg(kap)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(dlam*vd*Conjg(lam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,3))
res = res+(dkap*vu*Conjg(lam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dvu*kap*Conjg(lam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(dvd*lam*Conjg(lam)*ZH(gt1,1)*ZH(gt2,3)*ZH(gt3,3))
res = res+(vd*lam*Conjg(dkap)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(vd*kap*Conjg(dlam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(vu*lam*Conjg(dlam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,3))
res = res+(dlam*vd*Conjg(kap)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dvd*lam*Conjg(kap)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res+(dkap*vd*Conjg(lam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(dlam*vu*Conjg(lam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,3))
res = res+(dvd*kap*Conjg(lam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,3))/2._dp
res = res-(dvu*lam*Conjg(lam)*ZH(gt1,2)*ZH(gt2,3)*ZH(gt3,3))
res = res-((dTk*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,3))/sqrt(2._dp))
res = res-6*vS*kap*Conjg(dkap)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,3)
res = res-((Conjg(dTk)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,3))/sqrt(2._dp))
res = res-6*dkap*vS*Conjg(kap)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,3)
res = res-6*dvS*kap*Conjg(kap)*ZH(gt1,3)*ZH(gt2,3)*ZH(gt3,3)
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_Couplinghhhhhh
Subroutine CT_CouplinghhHpmcHpm(gt1,gt2,gt3,g1,g2,lam,Tlam,kap,vd,vu,vS, &
& ZH,ZP,dg1,dg2,dlam,dTlam,dkap,dvd,dvu,dvS,dZH,dZP,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,vd,vu,vS,ZH(3,3),ZP(2,2),dg1,dg2,dvd,dvu,dvS,dZH(3,3),dZP(2,2)
Complex(dp), Intent(in) :: lam,Tlam,kap,dlam,dTlam,dkap
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplinghhHpmcHpm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
res = res-(g1**2*vd*dZP(gt3,1)*ZH(gt1,1)*ZP(gt2,1))/4._dp
res = res-(g2**2*vd*dZP(gt3,1)*ZH(gt1,1)*ZP(gt2,1))/4._dp
res = res-(g2**2*vu*dZP(gt3,2)*ZH(gt1,1)*ZP(gt2,1))/4._dp
res = res+(vu*lam*Conjg(lam)*dZP(gt3,2)*ZH(gt1,1)*ZP(gt2,1))/2._dp
res = res+(g1**2*vu*dZP(gt3,1)*ZH(gt1,2)*ZP(gt2,1))/4._dp
res = res-(g2**2*vu*dZP(gt3,1)*ZH(gt1,2)*ZP(gt2,1))/4._dp
res = res-(g2**2*vd*dZP(gt3,2)*ZH(gt1,2)*ZP(gt2,1))/4._dp
res = res+(vd*lam*Conjg(lam)*dZP(gt3,2)*ZH(gt1,2)*ZP(gt2,1))/2._dp
res = res-(vS*lam*Conjg(lam)*dZP(gt3,1)*ZH(gt1,3)*ZP(gt2,1))
res = res-(vS*lam*Conjg(kap)*dZP(gt3,2)*ZH(gt1,3)*ZP(gt2,1))
res = res-((dZP(gt3,2)*Tlam*ZH(gt1,3)*ZP(gt2,1))/sqrt(2._dp))
res = res-(g2**2*vu*dZP(gt3,1)*ZH(gt1,1)*ZP(gt2,2))/4._dp
res = res+(vu*lam*Conjg(lam)*dZP(gt3,1)*ZH(gt1,1)*ZP(gt2,2))/2._dp
res = res+(g1**2*vd*dZP(gt3,2)*ZH(gt1,1)*ZP(gt2,2))/4._dp
res = res-(g2**2*vd*dZP(gt3,2)*ZH(gt1,1)*ZP(gt2,2))/4._dp
res = res-(g2**2*vd*dZP(gt3,1)*ZH(gt1,2)*ZP(gt2,2))/4._dp
res = res+(vd*lam*Conjg(lam)*dZP(gt3,1)*ZH(gt1,2)*ZP(gt2,2))/2._dp
res = res-(g1**2*vu*dZP(gt3,2)*ZH(gt1,2)*ZP(gt2,2))/4._dp
res = res-(g2**2*vu*dZP(gt3,2)*ZH(gt1,2)*ZP(gt2,2))/4._dp
res = res-(vS*kap*Conjg(lam)*dZP(gt3,1)*ZH(gt1,3)*ZP(gt2,2))
res = res-((Conjg(Tlam)*dZP(gt3,1)*ZH(gt1,3)*ZP(gt2,2))/sqrt(2._dp))
res = res-(vS*lam*Conjg(lam)*dZP(gt3,2)*ZH(gt1,3)*ZP(gt2,2))
res = res-(g1**2*vd*dZP(gt2,1)*ZH(gt1,1)*ZP(gt3,1))/4._dp
res = res-(g2**2*vd*dZP(gt2,1)*ZH(gt1,1)*ZP(gt3,1))/4._dp
res = res-(g2**2*vu*dZP(gt2,2)*ZH(gt1,1)*ZP(gt3,1))/4._dp
res = res+(vu*lam*Conjg(lam)*dZP(gt2,2)*ZH(gt1,1)*ZP(gt3,1))/2._dp
res = res+(g1**2*vu*dZP(gt2,1)*ZH(gt1,2)*ZP(gt3,1))/4._dp
res = res-(g2**2*vu*dZP(gt2,1)*ZH(gt1,2)*ZP(gt3,1))/4._dp
res = res-(g2**2*vd*dZP(gt2,2)*ZH(gt1,2)*ZP(gt3,1))/4._dp
res = res+(vd*lam*Conjg(lam)*dZP(gt2,2)*ZH(gt1,2)*ZP(gt3,1))/2._dp
res = res-(vS*lam*Conjg(lam)*dZP(gt2,1)*ZH(gt1,3)*ZP(gt3,1))
res = res-(vS*kap*Conjg(lam)*dZP(gt2,2)*ZH(gt1,3)*ZP(gt3,1))
res = res-((Conjg(Tlam)*dZP(gt2,2)*ZH(gt1,3)*ZP(gt3,1))/sqrt(2._dp))
res = res-(g1**2*vd*dZH(gt1,1)*ZP(gt2,1)*ZP(gt3,1))/4._dp
res = res-(g2**2*vd*dZH(gt1,1)*ZP(gt2,1)*ZP(gt3,1))/4._dp
res = res+(g1**2*vu*dZH(gt1,2)*ZP(gt2,1)*ZP(gt3,1))/4._dp
res = res-(g2**2*vu*dZH(gt1,2)*ZP(gt2,1)*ZP(gt3,1))/4._dp
res = res-(vS*lam*Conjg(lam)*dZH(gt1,3)*ZP(gt2,1)*ZP(gt3,1))
res = res-(dvd*g1**2*ZH(gt1,1)*ZP(gt2,1)*ZP(gt3,1))/4._dp
res = res-(dvd*g2**2*ZH(gt1,1)*ZP(gt2,1)*ZP(gt3,1))/4._dp
res = res-(dg1*g1*vd*ZH(gt1,1)*ZP(gt2,1)*ZP(gt3,1))/2._dp
res = res-(dg2*g2*vd*ZH(gt1,1)*ZP(gt2,1)*ZP(gt3,1))/2._dp
res = res+(dvu*g1**2*ZH(gt1,2)*ZP(gt2,1)*ZP(gt3,1))/4._dp
res = res-(dvu*g2**2*ZH(gt1,2)*ZP(gt2,1)*ZP(gt3,1))/4._dp
res = res+(dg1*g1*vu*ZH(gt1,2)*ZP(gt2,1)*ZP(gt3,1))/2._dp
res = res-(dg2*g2*vu*ZH(gt1,2)*ZP(gt2,1)*ZP(gt3,1))/2._dp
res = res-(vS*lam*Conjg(dlam)*ZH(gt1,3)*ZP(gt2,1)*ZP(gt3,1))
res = res-(dlam*vS*Conjg(lam)*ZH(gt1,3)*ZP(gt2,1)*ZP(gt3,1))
res = res-(dvS*lam*Conjg(lam)*ZH(gt1,3)*ZP(gt2,1)*ZP(gt3,1))
res = res-(g2**2*vu*dZH(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/4._dp
res = res+(vu*lam*Conjg(lam)*dZH(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res-(g2**2*vd*dZH(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/4._dp
res = res+(vd*lam*Conjg(lam)*dZH(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res-(vS*kap*Conjg(lam)*dZH(gt1,3)*ZP(gt2,2)*ZP(gt3,1))
res = res-((Conjg(Tlam)*dZH(gt1,3)*ZP(gt2,2)*ZP(gt3,1))/sqrt(2._dp))
res = res-(dvu*g2**2*ZH(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/4._dp
res = res-(dg2*g2*vu*ZH(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res+(vu*lam*Conjg(dlam)*ZH(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res+(dlam*vu*Conjg(lam)*ZH(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res+(dvu*lam*Conjg(lam)*ZH(gt1,1)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res-(dvd*g2**2*ZH(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/4._dp
res = res-(dg2*g2*vd*ZH(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res+(vd*lam*Conjg(dlam)*ZH(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res+(dlam*vd*Conjg(lam)*ZH(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res+(dvd*lam*Conjg(lam)*ZH(gt1,2)*ZP(gt2,2)*ZP(gt3,1))/2._dp
res = res-(vS*kap*Conjg(dlam)*ZH(gt1,3)*ZP(gt2,2)*ZP(gt3,1))
res = res-((Conjg(dTlam)*ZH(gt1,3)*ZP(gt2,2)*ZP(gt3,1))/sqrt(2._dp))
res = res-(dkap*vS*Conjg(lam)*ZH(gt1,3)*ZP(gt2,2)*ZP(gt3,1))
res = res-(dvS*kap*Conjg(lam)*ZH(gt1,3)*ZP(gt2,2)*ZP(gt3,1))
res = res-(g2**2*vu*dZP(gt2,1)*ZH(gt1,1)*ZP(gt3,2))/4._dp
res = res+(vu*lam*Conjg(lam)*dZP(gt2,1)*ZH(gt1,1)*ZP(gt3,2))/2._dp
res = res+(g1**2*vd*dZP(gt2,2)*ZH(gt1,1)*ZP(gt3,2))/4._dp
res = res-(g2**2*vd*dZP(gt2,2)*ZH(gt1,1)*ZP(gt3,2))/4._dp
res = res-(g2**2*vd*dZP(gt2,1)*ZH(gt1,2)*ZP(gt3,2))/4._dp
res = res+(vd*lam*Conjg(lam)*dZP(gt2,1)*ZH(gt1,2)*ZP(gt3,2))/2._dp
res = res-(g1**2*vu*dZP(gt2,2)*ZH(gt1,2)*ZP(gt3,2))/4._dp
res = res-(g2**2*vu*dZP(gt2,2)*ZH(gt1,2)*ZP(gt3,2))/4._dp
res = res-(vS*lam*Conjg(kap)*dZP(gt2,1)*ZH(gt1,3)*ZP(gt3,2))
res = res-(vS*lam*Conjg(lam)*dZP(gt2,2)*ZH(gt1,3)*ZP(gt3,2))
res = res-((dZP(gt2,1)*Tlam*ZH(gt1,3)*ZP(gt3,2))/sqrt(2._dp))
res = res-(g2**2*vu*dZH(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/4._dp
res = res+(vu*lam*Conjg(lam)*dZH(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res-(g2**2*vd*dZH(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/4._dp
res = res+(vd*lam*Conjg(lam)*dZH(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res-(vS*lam*Conjg(kap)*dZH(gt1,3)*ZP(gt2,1)*ZP(gt3,2))
res = res-((dZH(gt1,3)*Tlam*ZP(gt2,1)*ZP(gt3,2))/sqrt(2._dp))
res = res-(dvu*g2**2*ZH(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/4._dp
res = res-(dg2*g2*vu*ZH(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(vu*lam*Conjg(dlam)*ZH(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(dlam*vu*Conjg(lam)*ZH(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(dvu*lam*Conjg(lam)*ZH(gt1,1)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res-(dvd*g2**2*ZH(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/4._dp
res = res-(dg2*g2*vd*ZH(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(vd*lam*Conjg(dlam)*ZH(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(dlam*vd*Conjg(lam)*ZH(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res+(dvd*lam*Conjg(lam)*ZH(gt1,2)*ZP(gt2,1)*ZP(gt3,2))/2._dp
res = res-((dTlam*ZH(gt1,3)*ZP(gt2,1)*ZP(gt3,2))/sqrt(2._dp))
res = res-(vS*lam*Conjg(dkap)*ZH(gt1,3)*ZP(gt2,1)*ZP(gt3,2))
res = res-(dlam*vS*Conjg(kap)*ZH(gt1,3)*ZP(gt2,1)*ZP(gt3,2))
res = res-(dvS*lam*Conjg(kap)*ZH(gt1,3)*ZP(gt2,1)*ZP(gt3,2))
res = res+(g1**2*vd*dZH(gt1,1)*ZP(gt2,2)*ZP(gt3,2))/4._dp
res = res-(g2**2*vd*dZH(gt1,1)*ZP(gt2,2)*ZP(gt3,2))/4._dp
res = res-(g1**2*vu*dZH(gt1,2)*ZP(gt2,2)*ZP(gt3,2))/4._dp
res = res-(g2**2*vu*dZH(gt1,2)*ZP(gt2,2)*ZP(gt3,2))/4._dp
res = res-(vS*lam*Conjg(lam)*dZH(gt1,3)*ZP(gt2,2)*ZP(gt3,2))
res = res+(dvd*g1**2*ZH(gt1,1)*ZP(gt2,2)*ZP(gt3,2))/4._dp
res = res-(dvd*g2**2*ZH(gt1,1)*ZP(gt2,2)*ZP(gt3,2))/4._dp
res = res+(dg1*g1*vd*ZH(gt1,1)*ZP(gt2,2)*ZP(gt3,2))/2._dp
res = res-(dg2*g2*vd*ZH(gt1,1)*ZP(gt2,2)*ZP(gt3,2))/2._dp
res = res-(dvu*g1**2*ZH(gt1,2)*ZP(gt2,2)*ZP(gt3,2))/4._dp
res = res-(dvu*g2**2*ZH(gt1,2)*ZP(gt2,2)*ZP(gt3,2))/4._dp
res = res-(dg1*g1*vu*ZH(gt1,2)*ZP(gt2,2)*ZP(gt3,2))/2._dp
res = res-(dg2*g2*vu*ZH(gt1,2)*ZP(gt2,2)*ZP(gt3,2))/2._dp
res = res-(vS*lam*Conjg(dlam)*ZH(gt1,3)*ZP(gt2,2)*ZP(gt3,2))
res = res-(dlam*vS*Conjg(lam)*ZH(gt1,3)*ZP(gt2,2)*ZP(gt3,2))
res = res-(dvS*lam*Conjg(lam)*ZH(gt1,3)*ZP(gt2,2)*ZP(gt3,2))
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplinghhHpmcHpm
Subroutine CT_CouplinghhSdcSd(gt1,gt2,gt3,g1,g2,Yd,Td,lam,vd,vu,vS,ZD,ZH, &
& dg1,dg2,dYd,dTd,dlam,dvd,dvu,dvS,dZD,dZH,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,vd,vu,vS,ZH(3,3),dg1,dg2,dvd,dvu,dvS,dZH(3,3)
Complex(dp), Intent(in) :: Yd(3,3),Td(3,3),lam,ZD(6,6),dYd(3,3),dTd(3,3),dlam,dZD(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplinghhSdcSd'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res+(g1**2*vd*Conjg(ZD(gt2,j1))*dZH(gt1,1)*ZD(gt3,j1))/12._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vd*Conjg(ZD(gt2,j1))*dZH(gt1,1)*ZD(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vu*Conjg(ZD(gt2,j1))*dZH(gt1,2)*ZD(gt3,j1))/12._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(ZD(gt2,j1))*dZH(gt1,2)*ZD(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vd*Conjg(ZD(gt2,3 + j1))*dZH(gt1,1)*ZD(gt3,3 + j1))/6._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vu*Conjg(ZD(gt2,3 + j1))*dZH(gt1,2)*ZD(gt3,3 + j1))/6._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vd*Conjg(ZD(gt2,j1))*dZD(gt3,j1)*ZH(gt1,1))/12._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vd*Conjg(ZD(gt2,j1))*dZD(gt3,j1)*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vd*Conjg(ZD(gt2,3 + j1))*dZD(gt3,3 + j1)*ZH(gt1,1))/6._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vd*Conjg(dZD(gt2,j1))*ZD(gt3,j1)*ZH(gt1,1))/12._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vd*Conjg(dZD(gt2,j1))*ZD(gt3,j1)*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res+(dvd*g1**2*Conjg(ZD(gt2,j1))*ZD(gt3,j1)*ZH(gt1,1))/12._dp
End Do
Do j1 = 1,3
res = res+(dvd*g2**2*Conjg(ZD(gt2,j1))*ZD(gt3,j1)*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res+(dg1*g1*vd*Conjg(ZD(gt2,j1))*ZD(gt3,j1)*ZH(gt1,1))/6._dp
End Do
Do j1 = 1,3
res = res+(dg2*g2*vd*Conjg(ZD(gt2,j1))*ZD(gt3,j1)*ZH(gt1,1))/2._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vd*Conjg(dZD(gt2,3 + j1))*ZD(gt3,3 + j1)*ZH(gt1,1))/6._dp
End Do
Do j1 = 1,3
res = res+(dvd*g1**2*Conjg(ZD(gt2,3 + j1))*ZD(gt3,3 + j1)*ZH(gt1,1))/6._dp
End Do
Do j1 = 1,3
res = res+(dg1*g1*vd*Conjg(ZD(gt2,3 + j1))*ZD(gt3,3 + j1)*ZH(gt1,1))/3._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vu*Conjg(ZD(gt2,j1))*dZD(gt3,j1)*ZH(gt1,2))/12._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(ZD(gt2,j1))*dZD(gt3,j1)*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vu*Conjg(ZD(gt2,3 + j1))*dZD(gt3,3 + j1)*ZH(gt1,2))/6._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vu*Conjg(dZD(gt2,j1))*ZD(gt3,j1)*ZH(gt1,2))/12._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(dZD(gt2,j1))*ZD(gt3,j1)*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res-(dvu*g1**2*Conjg(ZD(gt2,j1))*ZD(gt3,j1)*ZH(gt1,2))/12._dp
End Do
Do j1 = 1,3
res = res-(dvu*g2**2*Conjg(ZD(gt2,j1))*ZD(gt3,j1)*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res-(dg1*g1*vu*Conjg(ZD(gt2,j1))*ZD(gt3,j1)*ZH(gt1,2))/6._dp
End Do
Do j1 = 1,3
res = res-(dg2*g2*vu*Conjg(ZD(gt2,j1))*ZD(gt3,j1)*ZH(gt1,2))/2._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vu*Conjg(dZD(gt2,3 + j1))*ZD(gt3,3 + j1)*ZH(gt1,2))/6._dp
End Do
Do j1 = 1,3
res = res-(dvu*g1**2*Conjg(ZD(gt2,3 + j1))*ZD(gt3,3 + j1)*ZH(gt1,2))/6._dp
End Do
Do j1 = 1,3
res = res-(dg1*g1*vu*Conjg(ZD(gt2,3 + j1))*ZD(gt3,3 + j1)*ZH(gt1,2))/3._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZD(gt2,j2))*dZH(gt1,2)*Yd(j1,j2)*ZD(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZD(gt2,j2))*dZH(gt1,3)*Yd(j1,j2)*ZD(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZD(gt2,3 + j1))*Conjg(Td(j1,j2))*dZH(gt1,1)*ZD(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*dZH(gt1,2)*ZD(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*dZH(gt1,3)*ZD(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZD(gt2,3 + j1))*Conjg(Td(j1,j2))*dZD(gt3,j2)*ZH(gt1,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZD(gt2,j2))*dTd(j1,j2)*ZD(gt3,3 + j1)*ZH(gt1,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dTd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZD(gt3,j2)*ZH(gt1,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dZD(gt2,3 + j1))*Conjg(Td(j1,j2))*ZD(gt3,j2)*ZH(gt1,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*dZD(gt3,j2)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZD(gt2,j2))*dZD(gt3,3 + j1)*Yd(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZD(gt2,j2))*dYd(j1,j2)*ZD(gt3,3 + j1)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZD(gt2,j2))*Yd(j1,j2)*ZD(gt3,3 + j1)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZD(gt2,j2))*Yd(j1,j2)*ZD(gt3,3 + j1)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZD(gt2,j2))*Yd(j1,j2)*ZD(gt3,3 + j1)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZD(gt2,3 + j1))*Conjg(Yd(j1,j2))*ZD(gt3,j2)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZD(gt3,j2)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZD(gt3,j2)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZD(gt3,j2)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*dZD(gt3,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZD(gt2,j2))*dZD(gt3,3 + j1)*Yd(j1,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZD(gt2,j2))*dYd(j1,j2)*ZD(gt3,3 + j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZD(gt2,j2))*Yd(j1,j2)*ZD(gt3,3 + j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZD(gt2,j2))*Yd(j1,j2)*ZD(gt3,3 + j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZD(gt2,j2))*Yd(j1,j2)*ZD(gt3,3 + j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZD(gt2,3 + j1))*Conjg(Yd(j1,j2))*ZD(gt3,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dYd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZD(gt3,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vu*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZD(gt3,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt2,3 + j1))*ZD(gt3,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZD(gt2,j2))*dZH(gt1,1)*ZD(gt3,3 + j1)*Td(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZD(gt2,j2))*dZD(gt3,3 + j1)*ZH(gt1,1)*Td(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dZD(gt2,j2))*ZD(gt3,3 + j1)*ZH(gt1,1)*Td(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Yd(j3,j1))*Conjg(ZD(gt2,3 + j3))*dZH(gt1,1)*Yd(j2,j1)*ZD(gt3,3 + j2))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Yd(j1,j3))*Conjg(ZD(gt2,j2))*dZH(gt1,1)*Yd(j1,j2)*ZD(gt3,j3))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Yd(j1,j3))*Conjg(ZD(gt2,j2))*dZD(gt3,j3)*Yd(j1,j2)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Yd(j3,j1))*Conjg(ZD(gt2,3 + j3))*dZD(gt3,3 + j2)*Yd(j2,j1)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Yd(j3,j1))*Conjg(ZD(gt2,3 + j3))*dYd(j2,j1)*ZD(gt3,3 + j2)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dZD(gt2,3 + j3))*Conjg(Yd(j3,j1))*Yd(j2,j1)*ZD(gt3,3 + j2)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dYd(j3,j1))*Conjg(ZD(gt2,3 + j3))*Yd(j2,j1)*ZD(gt3,3 + j2)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*Conjg(Yd(j3,j1))*Conjg(ZD(gt2,3 + j3))*Yd(j2,j1)*ZD(gt3,3 + j2)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Yd(j1,j3))*Conjg(ZD(gt2,j2))*dYd(j1,j2)*ZD(gt3,j3)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dZD(gt2,j2))*Conjg(Yd(j1,j3))*Yd(j1,j2)*ZD(gt3,j3)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dYd(j1,j3))*Conjg(ZD(gt2,j2))*Yd(j1,j2)*ZD(gt3,j3)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*Conjg(Yd(j1,j3))*Conjg(ZD(gt2,j2))*Yd(j1,j2)*ZD(gt3,j3)*ZH(gt1,1))
End Do
End Do
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplinghhSdcSd
Subroutine CT_CouplinghhSecSe(gt1,gt2,gt3,g1,g2,Ye,Te,lam,vd,vu,vS,ZE,ZH, &
& dg1,dg2,dYe,dTe,dlam,dvd,dvu,dvS,dZE,dZH,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,vd,vu,vS,ZH(3,3),dg1,dg2,dvd,dvu,dvS,dZH(3,3)
Complex(dp), Intent(in) :: Ye(3,3),Te(3,3),lam,ZE(6,6),dYe(3,3),dTe(3,3),dlam,dZE(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplinghhSecSe'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(g1**2*vd*Conjg(ZE(gt2,j1))*dZH(gt1,1)*ZE(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vd*Conjg(ZE(gt2,j1))*dZH(gt1,1)*ZE(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vu*Conjg(ZE(gt2,j1))*dZH(gt1,2)*ZE(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(ZE(gt2,j1))*dZH(gt1,2)*ZE(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vd*Conjg(ZE(gt2,3 + j1))*dZH(gt1,1)*ZE(gt3,3 + j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vu*Conjg(ZE(gt2,3 + j1))*dZH(gt1,2)*ZE(gt3,3 + j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vd*Conjg(ZE(gt2,j1))*dZE(gt3,j1)*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vd*Conjg(ZE(gt2,j1))*dZE(gt3,j1)*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vd*Conjg(ZE(gt2,3 + j1))*dZE(gt3,3 + j1)*ZH(gt1,1))/2._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vd*Conjg(dZE(gt2,j1))*ZE(gt3,j1)*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vd*Conjg(dZE(gt2,j1))*ZE(gt3,j1)*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dvd*g1**2*Conjg(ZE(gt2,j1))*ZE(gt3,j1)*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res+(dvd*g2**2*Conjg(ZE(gt2,j1))*ZE(gt3,j1)*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dg1*g1*vd*Conjg(ZE(gt2,j1))*ZE(gt3,j1)*ZH(gt1,1))/2._dp
End Do
Do j1 = 1,3
res = res+(dg2*g2*vd*Conjg(ZE(gt2,j1))*ZE(gt3,j1)*ZH(gt1,1))/2._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vd*Conjg(dZE(gt2,3 + j1))*ZE(gt3,3 + j1)*ZH(gt1,1))/2._dp
End Do
Do j1 = 1,3
res = res+(dvd*g1**2*Conjg(ZE(gt2,3 + j1))*ZE(gt3,3 + j1)*ZH(gt1,1))/2._dp
End Do
Do j1 = 1,3
res = res+dg1*g1*vd*Conjg(ZE(gt2,3 + j1))*ZE(gt3,3 + j1)*ZH(gt1,1)
End Do
Do j1 = 1,3
res = res+(g1**2*vu*Conjg(ZE(gt2,j1))*dZE(gt3,j1)*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(ZE(gt2,j1))*dZE(gt3,j1)*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vu*Conjg(ZE(gt2,3 + j1))*dZE(gt3,3 + j1)*ZH(gt1,2))/2._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vu*Conjg(dZE(gt2,j1))*ZE(gt3,j1)*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(dZE(gt2,j1))*ZE(gt3,j1)*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(dvu*g1**2*Conjg(ZE(gt2,j1))*ZE(gt3,j1)*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res-(dvu*g2**2*Conjg(ZE(gt2,j1))*ZE(gt3,j1)*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(dg1*g1*vu*Conjg(ZE(gt2,j1))*ZE(gt3,j1)*ZH(gt1,2))/2._dp
End Do
Do j1 = 1,3
res = res-(dg2*g2*vu*Conjg(ZE(gt2,j1))*ZE(gt3,j1)*ZH(gt1,2))/2._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vu*Conjg(dZE(gt2,3 + j1))*ZE(gt3,3 + j1)*ZH(gt1,2))/2._dp
End Do
Do j1 = 1,3
res = res-(dvu*g1**2*Conjg(ZE(gt2,3 + j1))*ZE(gt3,3 + j1)*ZH(gt1,2))/2._dp
End Do
Do j1 = 1,3
res = res-(dg1*g1*vu*Conjg(ZE(gt2,3 + j1))*ZE(gt3,3 + j1)*ZH(gt1,2))
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZE(gt2,j2))*dZH(gt1,2)*Ye(j1,j2)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZE(gt2,j2))*dZH(gt1,3)*Ye(j1,j2)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZE(gt2,3 + j1))*Conjg(Te(j1,j2))*dZH(gt1,1)*ZE(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*dZH(gt1,2)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*dZH(gt1,3)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZE(gt2,3 + j1))*Conjg(Te(j1,j2))*dZE(gt3,j2)*ZH(gt1,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZE(gt2,j2))*dTe(j1,j2)*ZE(gt3,3 + j1)*ZH(gt1,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dTe(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZE(gt3,j2)*ZH(gt1,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dZE(gt2,3 + j1))*Conjg(Te(j1,j2))*ZE(gt3,j2)*ZH(gt1,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*dZE(gt3,j2)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZE(gt2,j2))*dZE(gt3,3 + j1)*Ye(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZE(gt2,j2))*dYe(j1,j2)*ZE(gt3,3 + j1)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZE(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZE(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZE(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZE(gt2,3 + j1))*Conjg(Ye(j1,j2))*ZE(gt3,j2)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYe(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZE(gt3,j2)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZE(gt3,j2)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZE(gt3,j2)*ZH(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*dZE(gt3,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZE(gt2,j2))*dZE(gt3,3 + j1)*Ye(j1,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZE(gt2,j2))*dYe(j1,j2)*ZE(gt3,3 + j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZE(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZE(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZE(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZE(gt2,3 + j1))*Conjg(Ye(j1,j2))*ZE(gt3,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dYe(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZE(gt3,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vu*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZE(gt3,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt2,3 + j1))*ZE(gt3,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZE(gt2,j2))*dZH(gt1,1)*ZE(gt3,3 + j1)*Te(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZE(gt2,j2))*dZE(gt3,3 + j1)*ZH(gt1,1)*Te(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dZE(gt2,j2))*ZE(gt3,3 + j1)*ZH(gt1,1)*Te(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Ye(j3,j1))*Conjg(ZE(gt2,3 + j3))*dZH(gt1,1)*Ye(j2,j1)*ZE(gt3,3 + j2))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Ye(j1,j3))*Conjg(ZE(gt2,j2))*dZH(gt1,1)*Ye(j1,j2)*ZE(gt3,j3))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Ye(j1,j3))*Conjg(ZE(gt2,j2))*dZE(gt3,j3)*Ye(j1,j2)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Ye(j3,j1))*Conjg(ZE(gt2,3 + j3))*dZE(gt3,3 + j2)*Ye(j2,j1)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Ye(j3,j1))*Conjg(ZE(gt2,3 + j3))*dYe(j2,j1)*ZE(gt3,3 + j2)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dZE(gt2,3 + j3))*Conjg(Ye(j3,j1))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dYe(j3,j1))*Conjg(ZE(gt2,3 + j3))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*Conjg(Ye(j3,j1))*Conjg(ZE(gt2,3 + j3))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Ye(j1,j3))*Conjg(ZE(gt2,j2))*dYe(j1,j2)*ZE(gt3,j3)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dZE(gt2,j2))*Conjg(Ye(j1,j3))*Ye(j1,j2)*ZE(gt3,j3)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dYe(j1,j3))*Conjg(ZE(gt2,j2))*Ye(j1,j2)*ZE(gt3,j3)*ZH(gt1,1))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*Conjg(Ye(j1,j3))*Conjg(ZE(gt2,j2))*Ye(j1,j2)*ZE(gt3,j3)*ZH(gt1,1))
End Do
End Do
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplinghhSecSe
Subroutine CT_CouplinghhSucSu(gt1,gt2,gt3,g1,g2,lam,Yu,Tu,vd,vu,vS,ZU,ZH, &
& dg1,dg2,dlam,dYu,dTu,dvd,dvu,dvS,dZU,dZH,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,vd,vu,vS,ZH(3,3),dg1,dg2,dvd,dvu,dvS,dZH(3,3)
Complex(dp), Intent(in) :: lam,Yu(3,3),Tu(3,3),ZU(6,6),dlam,dYu(3,3),dTu(3,3),dZU(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplinghhSucSu'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res+(g1**2*vd*Conjg(ZU(gt2,j1))*dZU(gt3,j1)*ZH(gt1,1))/12._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(ZU(gt2,j1))*dZU(gt3,j1)*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vd*Conjg(ZU(gt2,3 + j1))*dZU(gt3,3 + j1)*ZH(gt1,1))/3._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vu*Conjg(ZU(gt2,j1))*dZU(gt3,j1)*ZH(gt1,2))/12._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vu*Conjg(ZU(gt2,j1))*dZU(gt3,j1)*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vu*Conjg(ZU(gt2,3 + j1))*dZU(gt3,3 + j1)*ZH(gt1,2))/3._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vd*Conjg(ZU(gt2,j1))*dZH(gt1,1)*ZU(gt3,j1))/12._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(ZU(gt2,j1))*dZH(gt1,1)*ZU(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vu*Conjg(ZU(gt2,j1))*dZH(gt1,2)*ZU(gt3,j1))/12._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vu*Conjg(ZU(gt2,j1))*dZH(gt1,2)*ZU(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vd*Conjg(dZU(gt2,j1))*ZH(gt1,1)*ZU(gt3,j1))/12._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(dZU(gt2,j1))*ZH(gt1,1)*ZU(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res+(dvd*g1**2*Conjg(ZU(gt2,j1))*ZH(gt1,1)*ZU(gt3,j1))/12._dp
End Do
Do j1 = 1,3
res = res-(dvd*g2**2*Conjg(ZU(gt2,j1))*ZH(gt1,1)*ZU(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res+(dg1*g1*vd*Conjg(ZU(gt2,j1))*ZH(gt1,1)*ZU(gt3,j1))/6._dp
End Do
Do j1 = 1,3
res = res-(dg2*g2*vd*Conjg(ZU(gt2,j1))*ZH(gt1,1)*ZU(gt3,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vu*Conjg(dZU(gt2,j1))*ZH(gt1,2)*ZU(gt3,j1))/12._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vu*Conjg(dZU(gt2,j1))*ZH(gt1,2)*ZU(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res-(dvu*g1**2*Conjg(ZU(gt2,j1))*ZH(gt1,2)*ZU(gt3,j1))/12._dp
End Do
Do j1 = 1,3
res = res+(dvu*g2**2*Conjg(ZU(gt2,j1))*ZH(gt1,2)*ZU(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res-(dg1*g1*vu*Conjg(ZU(gt2,j1))*ZH(gt1,2)*ZU(gt3,j1))/6._dp
End Do
Do j1 = 1,3
res = res+(dg2*g2*vu*Conjg(ZU(gt2,j1))*ZH(gt1,2)*ZU(gt3,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vd*Conjg(ZU(gt2,3 + j1))*dZH(gt1,1)*ZU(gt3,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vu*Conjg(ZU(gt2,3 + j1))*dZH(gt1,2)*ZU(gt3,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vd*Conjg(dZU(gt2,3 + j1))*ZH(gt1,1)*ZU(gt3,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res-(dvd*g1**2*Conjg(ZU(gt2,3 + j1))*ZH(gt1,1)*ZU(gt3,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res+(-2*dg1*g1*vd*Conjg(ZU(gt2,3 + j1))*ZH(gt1,1)*ZU(gt3,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vu*Conjg(dZU(gt2,3 + j1))*ZH(gt1,2)*ZU(gt3,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res+(dvu*g1**2*Conjg(ZU(gt2,3 + j1))*ZH(gt1,2)*ZU(gt3,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res+(2*dg1*g1*vu*Conjg(ZU(gt2,3 + j1))*ZH(gt1,2)*ZU(gt3,3 + j1))/3._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*dZU(gt3,j2)*ZH(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZU(gt2,j2))*dZU(gt3,3 + j1)*Yu(j1,j2)*ZH(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZU(gt2,3 + j1))*Conjg(Tu(j1,j2))*dZU(gt3,j2)*ZH(gt1,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*dZU(gt3,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZU(gt2,j2))*dZU(gt3,3 + j1)*Yu(j1,j2)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZU(gt2,j2))*dZH(gt1,1)*Yu(j1,j2)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZU(gt2,j2))*dZH(gt1,3)*Yu(j1,j2)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZU(gt2,j2))*dYu(j1,j2)*ZH(gt1,1)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZU(gt2,j2))*Yu(j1,j2)*ZH(gt1,1)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZU(gt2,j2))*Yu(j1,j2)*ZH(gt1,1)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZU(gt2,j2))*Yu(j1,j2)*ZH(gt1,1)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZU(gt2,j2))*dTu(j1,j2)*ZH(gt1,2)*ZU(gt3,3 + j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZU(gt2,j2))*dYu(j1,j2)*ZH(gt1,3)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZU(gt2,j2))*Yu(j1,j2)*ZH(gt1,3)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZU(gt2,j2))*Yu(j1,j2)*ZH(gt1,3)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZU(gt2,j2))*Yu(j1,j2)*ZH(gt1,3)*ZU(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*dZH(gt1,1)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZU(gt2,3 + j1))*Conjg(Tu(j1,j2))*dZH(gt1,2)*ZU(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*dZH(gt1,3)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZU(gt2,3 + j1))*Conjg(Yu(j1,j2))*ZH(gt1,1)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZH(gt1,1)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZH(gt1,1)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZH(gt1,1)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dTu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZH(gt1,2)*ZU(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dZU(gt2,3 + j1))*Conjg(Tu(j1,j2))*ZH(gt1,2)*ZU(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZU(gt2,3 + j1))*Conjg(Yu(j1,j2))*ZH(gt1,3)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dYu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZH(gt1,3)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZH(gt1,3)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZH(gt1,3)*ZU(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZU(gt2,j2))*dZU(gt3,3 + j1)*ZH(gt1,2)*Tu(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZU(gt2,j2))*dZH(gt1,2)*ZU(gt3,3 + j1)*Tu(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dZU(gt2,j2))*ZH(gt1,2)*ZU(gt3,3 + j1)*Tu(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yu(j1,j3))*Conjg(ZU(gt2,j2))*dZU(gt3,j3)*Yu(j1,j2)*ZH(gt1,2))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yu(j3,j1))*Conjg(ZU(gt2,3 + j3))*dZU(gt3,3 + j2)*Yu(j2,j1)*ZH(gt1,2))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yu(j3,j1))*Conjg(ZU(gt2,3 + j3))*dZH(gt1,2)*Yu(j2,j1)*ZU(gt3,3 + j2))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yu(j3,j1))*Conjg(ZU(gt2,3 + j3))*dYu(j2,j1)*ZH(gt1,2)*ZU(gt3,3 + j2))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZU(gt2,3 + j3))*Conjg(Yu(j3,j1))*Yu(j2,j1)*ZH(gt1,2)*ZU(gt3,3 + j2))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYu(j3,j1))*Conjg(ZU(gt2,3 + j3))*Yu(j2,j1)*ZH(gt1,2)*ZU(gt3,3 + j2))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yu(j3,j1))*Conjg(ZU(gt2,3 + j3))*Yu(j2,j1)*ZH(gt1,2)*ZU(gt3,3 + j2))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yu(j1,j3))*Conjg(ZU(gt2,j2))*dZH(gt1,2)*Yu(j1,j2)*ZU(gt3,j3))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yu(j1,j3))*Conjg(ZU(gt2,j2))*dYu(j1,j2)*ZH(gt1,2)*ZU(gt3,j3))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZU(gt2,j2))*Conjg(Yu(j1,j3))*Yu(j1,j2)*ZH(gt1,2)*ZU(gt3,j3))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYu(j1,j3))*Conjg(ZU(gt2,j2))*Yu(j1,j2)*ZH(gt1,2)*ZU(gt3,j3))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yu(j1,j3))*Conjg(ZU(gt2,j2))*Yu(j1,j2)*ZH(gt1,2)*ZU(gt3,j3))
End Do
End Do
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplinghhSucSu
Subroutine CT_CouplinghhSvImSvIm(gt1,gt2,gt3,g1,g2,MUX,lam,kap,lamN,TLN, &
& Yv,Tv,vd,vu,vS,ZVI,ZH,dg1,dg2,dMUX,dlam,dkap,dlamN,dTLN,dYv,dTv,dvd,dvu, &
& dvS,dZVI,dZH,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,vd,vu,vS,ZH(3,3),dg1,dg2,dvd,dvu,dvS,dZH(3,3)
Complex(dp), Intent(in) :: MUX(3,3),lam,kap,lamN(3,3),TLN(3,3),Yv(3,3),Tv(3,3),ZVI(9,9),dMUX(3,3), &
& dlam,dkap,dlamN(3,3),dTLN(3,3),dYv(3,3),dTv(3,3),dZVI(9,9)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplinghhSvImSvIm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(g1**2*vd*Conjg(ZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*dZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(ZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*dZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vu*Conjg(ZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*dZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vu*Conjg(ZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*dZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vd*Conjg(dZVI(gt3,j1))*Conjg(ZVI(gt2,j1))*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(dZVI(gt3,j1))*Conjg(ZVI(gt2,j1))*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vd*Conjg(dZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(dZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dvd*g1**2*Conjg(ZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dvd*g2**2*Conjg(ZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dg1*g1*vd*Conjg(ZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*ZH(gt1,1))/2._dp
End Do
Do j1 = 1,3
res = res-(dg2*g2*vd*Conjg(ZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*ZH(gt1,1))/2._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vu*Conjg(dZVI(gt3,j1))*Conjg(ZVI(gt2,j1))*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vu*Conjg(dZVI(gt3,j1))*Conjg(ZVI(gt2,j1))*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vu*Conjg(dZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vu*Conjg(dZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(dvu*g1**2*Conjg(ZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(dvu*g2**2*Conjg(ZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(dg1*g1*vu*Conjg(ZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*ZH(gt1,2))/2._dp
End Do
Do j1 = 1,3
res = res+(dg2*g2*vu*Conjg(ZVI(gt2,j1))*Conjg(ZVI(gt3,j1))*ZH(gt1,2))/2._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Conjg(Tv(j1,j2))*dZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Conjg(Tv(j1,j2))*dZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*Conjg(TLN(j1,j2))*dZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*Conjg(TLN(j1,j2))*dZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dZH(gt1,1)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dZH(gt1,1)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dZH(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dZH(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVI(gt3,j2))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVI(gt3,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVI(gt2,j2))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVI(gt2,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZVI(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vu*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vu*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*dlamN(j2,j1)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dYv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dYv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVI(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVI(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVI(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(Tv(j1,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*Conjg(Tv(j1,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Conjg(Tv(j1,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Conjg(Tv(j1,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*dlamN(j2,j1)*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dTv(j1,j2)*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dTv(j1,j2)*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVI(gt3,j2))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVI(gt3,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVI(gt2,j2))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTLN(j1,j2))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVI(gt2,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTLN(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dZVI(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dkap*vS*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*kap*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dkap*vS*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*kap*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(TLN(j1,j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,3 + j1))*Conjg(ZVI(gt2,6 + j2))*Conjg(TLN(j1,j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*Conjg(TLN(j1,j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*Conjg(TLN(j1,j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*dlamN(j2,j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*dTLN(j1,j2)*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*dTLN(j1,j2)*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dYv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dYv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*dZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*dZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*dZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*dZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*dZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*dZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVI(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVI(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dkap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(kap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dkap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(kap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*dZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*ZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*ZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*ZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*ZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*dZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*dZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j1))*ZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt3,3 + j1))*Conjg(ZVI(gt2,6 + j2))*ZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*ZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*ZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j3,j1))*dZH(gt1,3)*MUX(j1,j2))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZH(gt1,3)*MUX(j1,j2))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j3,j1))*dZH(gt1,3)*MUX(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZH(gt1,3)*MUX(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,j2))*dZH(gt1,2)*Yv(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,j3))*dZH(gt1,2)*Yv(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*dZH(gt1,2)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZH(gt1,2)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*dZH(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZH(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,3 + j2))*dZH(gt1,2)*Yv(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,3 + j3))*dZH(gt1,2)*Yv(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*dlamN(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*dlamN(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,j2))*dYv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,j3))*dYv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,3 + j2))*dYv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,3 + j3))*dYv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j2))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt3,j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt3,j3))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,j3))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,j3))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt3,6 + j3))*Conjg(ZVI(gt2,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt3,j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt3,3 + j3))*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt3,3 + j2))*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,3 + j3))*Conjg(Yv(j3,j1))*Conjg(ZVI(gt3,3 + j2))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,3 + j2))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,3 + j2))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,3 + j2))*Conjg(Yv(j3,j1))*Conjg(ZVI(gt3,3 + j3))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,3 + j3))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,3 + j3))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*dlamN(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*dlamN(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j1,j3))*dlamN(j1,j2)*ZH(gt1,3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*dlamN(j1,j2)*ZH(gt1,3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j3))*dlamN(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j3))*dlamN(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j3,j1))*dlamN(j2,j1)*ZH(gt1,3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*dlamN(j2,j1)*ZH(gt1,3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j3,j1))*dMUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*dMUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j3,j1))*dMUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*dMUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,3 + j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j3))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,3 + j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j3))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt3,6 + j3))*Conjg(ZVI(gt2,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt3,j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(ZVI(gt2,j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*dZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*dZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*dZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*dZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j1,j3))*dZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt3,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt3,6 + j2))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt3,j3))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt3,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt3,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVI(gt3,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt3,j3))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,j3))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,6 + j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt3,6 + j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt3,6 + j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,6 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,6 + j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVI(gt3,6 + j3))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,3 + j2))*dZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,3 + j2))*dZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j3))*dZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j3))*dZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j3,j1))*dZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,6 + j3))*Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,6 + j3))*Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,3 + j2))*Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt3,3 + j2))*Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,6 + j3))*Conjg(MUX(j1,j3))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,6 + j3))*Conjg(MUX(j3,j1))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dMUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dMUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVI(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,3 + j3))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j2))*Conjg(MUX(j1,j3))*Conjg(ZVI(gt3,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j2))*Conjg(MUX(j3,j1))*Conjg(ZVI(gt3,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dMUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dMUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt3,3 + j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt3,3 + j2))*Conjg(ZVI(gt2,3 + j3))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,3 + j3))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVI(gt3,3 + j2))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVI(gt3,3 + j3))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplinghhSvImSvIm
Subroutine CT_CouplinghhSvImSvRe(gt1,gt2,gt3,MUX,lam,kap,lamN,TLN,Yv,Tv, &
& vd,vu,vS,ZVI,ZVR,ZH,dMUX,dlam,dkap,dlamN,dTLN,dYv,dTv,dvd,dvu,dvS,dZVI,dZVR,dZH,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: vd,vu,vS,ZH(3,3),dvd,dvu,dvS,dZH(3,3)
Complex(dp), Intent(in) :: MUX(3,3),lam,kap,lamN(3,3),TLN(3,3),Yv(3,3),Tv(3,3),ZVI(9,9),ZVR(9,9),dMUX(3,3), &
& dlam,dkap,dlamN(3,3),dTLN(3,3),dYv(3,3),dTv(3,3),dZVI(9,9),dZVR(9,9)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplinghhSvImSvRe'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(Tv(j1,j2))*dZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Conjg(Tv(j1,j2))*dZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(TLN(j1,j2))*dZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*Conjg(TLN(j1,j2))*dZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZH(gt1,1)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZH(gt1,1)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZH(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZH(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVR(gt3,j2))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVR(gt3,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVI(gt2,j2))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVI(gt2,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*lam*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vu*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vu*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dlamN(j2,j1)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dYv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dYv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVR(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(lam)*Conjg(dZVR(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(lam)*Conjg(dZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dTv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(Tv(j1,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*Conjg(Tv(j1,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(Tv(j1,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Conjg(Tv(j1,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dlamN(j2,j1)*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dTv(j1,j2)*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dTv(j1,j2)*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVR(gt3,j2))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVR(gt3,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVI(gt2,j2))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTLN(j1,j2))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dZVI(gt2,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vd*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dlamN(j2,j1))*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dTLN(j1,j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*kap*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dkap*vS*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*kap*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dkap*vS*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*kap*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j1))*Conjg(TLN(j1,j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVI(gt2,6 + j2))*Conjg(TLN(j1,j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(TLN(j1,j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*Conjg(TLN(j1,j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dlamN(j2,j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(kap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*dTLN(j1,j2)*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*dTLN(j1,j2)*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dYv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dYv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(dZVR(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(dZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dlam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*Conjg(lam)*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(kap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(lam)*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(lam)*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dlam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(lam)*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dlam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*Conjg(lam)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(kap)*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,6 + j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVI(gt2,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dkap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(kap)*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(kap)*Conjg(dZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dkap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(kap)*Conjg(ZVI(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,j2))*Conjg(ZVI(gt2,3 + j1))*ZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVI(gt2,j2))*ZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*dZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVI(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*dZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j1))*ZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVI(gt2,6 + j2))*ZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dZH(gt1,3)*MUX(j1,j2))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZH(gt1,3)*MUX(j1,j2))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dZH(gt1,3)*MUX(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZH(gt1,3)*MUX(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,j2))*dZH(gt1,2)*Yv(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,j3))*dZH(gt1,2)*Yv(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dZH(gt1,2)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZH(gt1,2)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dZH(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZH(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*dZH(gt1,2)*Yv(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*dZH(gt1,2)*Yv(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dlamN(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dlamN(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,j2))*dYv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,j3))*dYv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*dYv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*dYv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j2))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVI(gt2,j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,j3))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,j3))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,j3))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVR(gt3,6 + j3))*Conjg(ZVI(gt2,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,3 + j3))*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt3,3 + j2))*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVI(gt2,3 + j3))*Conjg(Yv(j3,j1))*Conjg(ZVR(gt3,3 + j2))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,3 + j2))*Conjg(Yv(j3,j1))*Conjg(ZVR(gt3,3 + j3))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dlamN(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dlamN(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j1,j3))*dlamN(j1,j2)*ZH(gt1,3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dlamN(j1,j2)*ZH(gt1,3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dlamN(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dlamN(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j3,j1))*dlamN(j2,j1)*ZH(gt1,3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dlamN(j2,j1)*ZH(gt1,3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dMUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dMUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dMUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dMUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,3 + j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j3))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,3 + j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVI(gt2,3 + j3))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt3,6 + j3))*Conjg(ZVI(gt2,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(ZVI(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j1,j3))*dZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVR(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVI(gt2,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,j3))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVI(gt2,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,j3))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlamN(j1,j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,6 + j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVR(gt3,6 + j3))*Conjg(ZVI(gt2,6 + j2))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,6 + j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,6 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVI(gt2,6 + j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(ZVI(gt2,6 + j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j3,j1))*dZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j3))*Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j3))*Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j2))*Conjg(MUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j2))*Conjg(MUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,6 + j3))*Conjg(MUX(j1,j3))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,6 + j3))*Conjg(MUX(j3,j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j1,j3))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j3,j1))*Conjg(ZVI(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j2))*Conjg(MUX(j1,j3))*Conjg(ZVR(gt3,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVI(gt2,3 + j2))*Conjg(MUX(j3,j1))*Conjg(ZVR(gt3,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j1,j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,3 + j3))*Conjg(ZVI(gt2,3 + j2))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVI(gt2,3 + j3))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVI(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(ZVI(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVI(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplinghhSvImSvRe
Subroutine CT_CouplinghhSvReSvRe(gt1,gt2,gt3,g1,g2,MUX,lam,kap,lamN,TLN, &
& Yv,Tv,vd,vu,vS,ZVR,ZH,dg1,dg2,dMUX,dlam,dkap,dlamN,dTLN,dYv,dTv,dvd,dvu, &
& dvS,dZVR,dZH,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,vd,vu,vS,ZH(3,3),dg1,dg2,dvd,dvu,dvS,dZH(3,3)
Complex(dp), Intent(in) :: MUX(3,3),lam,kap,lamN(3,3),TLN(3,3),Yv(3,3),Tv(3,3),ZVR(9,9),dMUX(3,3), &
& dlam,dkap,dlamN(3,3),dTLN(3,3),dYv(3,3),dTv(3,3),dZVR(9,9)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplinghhSvReSvRe'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(g1**2*vd*Conjg(ZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*dZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(ZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*dZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vu*Conjg(ZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*dZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vu*Conjg(ZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*dZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vd*Conjg(dZVR(gt3,j1))*Conjg(ZVR(gt2,j1))*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(dZVR(gt3,j1))*Conjg(ZVR(gt2,j1))*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g1**2*vd*Conjg(dZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(dZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dvd*g1**2*Conjg(ZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dvd*g2**2*Conjg(ZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*ZH(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dg1*g1*vd*Conjg(ZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*ZH(gt1,1))/2._dp
End Do
Do j1 = 1,3
res = res-(dg2*g2*vd*Conjg(ZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*ZH(gt1,1))/2._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vu*Conjg(dZVR(gt3,j1))*Conjg(ZVR(gt2,j1))*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vu*Conjg(dZVR(gt3,j1))*Conjg(ZVR(gt2,j1))*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(g1**2*vu*Conjg(dZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vu*Conjg(dZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(dvu*g1**2*Conjg(ZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(dvu*g2**2*Conjg(ZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*ZH(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(dg1*g1*vu*Conjg(ZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*ZH(gt1,2))/2._dp
End Do
Do j1 = 1,3
res = res+(dg2*g2*vu*Conjg(ZVR(gt2,j1))*Conjg(ZVR(gt3,j1))*ZH(gt1,2))/2._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(Tv(j1,j2))*dZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Conjg(Tv(j1,j2))*dZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*dZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*dZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(TLN(j1,j2))*dZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*Conjg(TLN(j1,j2))*dZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZH(gt1,1)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZH(gt1,1)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZH(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZH(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVR(gt3,j2))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVR(gt3,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVR(gt2,j2))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dlamN(j2,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVR(gt2,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dlamN(j2,j1))*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vu*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*lam*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*lam*Conjg(dZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vu*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*lam*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dlamN(j2,j1)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dYv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dYv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVR(gt3,j2))*Conjg(ZVR(gt2,3 + j1))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVR(gt3,3 + j1))*Conjg(ZVR(gt2,j2))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dlamN(j2,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dlamN(j2,j1))*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(Tv(j1,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVR(gt2,j2))*Conjg(Tv(j1,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(Tv(j1,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Conjg(Tv(j1,j2))*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dlamN(j2,j1)*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,2))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dTv(j1,j2)*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dTv(j1,j2)*ZH(gt1,2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVR(gt3,j2))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVR(gt3,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVR(gt2,j2))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dYv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTLN(j1,j2))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dlamN(j2,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dZVR(gt2,3 + j1))*Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*lam*Conjg(dYv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vd*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dlamN(j2,j1))*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dTLN(j1,j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dkap*vS*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*kap*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*kap*Conjg(dZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dkap*vS*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*kap*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j2,j1))*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVR(gt2,3 + j1))*Conjg(TLN(j1,j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVR(gt2,6 + j2))*Conjg(TLN(j1,j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*Conjg(TLN(j1,j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*Conjg(TLN(j1,j2))*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dlamN(j2,j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,3))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*dTLN(j1,j2)*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*dTLN(j1,j2)*ZH(gt1,3))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dYv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dYv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt3,j2))*Conjg(ZVR(gt2,3 + j1))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt3,3 + j1))*Conjg(ZVR(gt2,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*dZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*dZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,6 + j1))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVR(gt2,3 + j2))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(lam)*Conjg(dZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dlam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(lam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,1)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,6 + j1))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVR(gt2,3 + j2))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(lam)*Conjg(dZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dlam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(lam)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,2)*lamN(j2,j1))/4._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,6 + j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVR(gt3,6 + j1))*Conjg(ZVR(gt2,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dkap)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(kap)*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(kap)*Conjg(dZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dkap)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(kap)*Conjg(ZVR(gt2,6 + j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*dZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,j2))*Conjg(ZVR(gt2,3 + j1))*ZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVR(gt2,j2))*ZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*ZH(gt1,2)*Tv(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*dZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*dZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVR(gt2,3 + j1))*ZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j1))*Conjg(ZVR(gt2,6 + j2))*ZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*ZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,3)*TLN(j1,j2))/(2._dp*sqrt(2._dp))
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dZH(gt1,3)*MUX(j1,j2))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZH(gt1,3)*MUX(j1,j2))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dZH(gt1,3)*MUX(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZH(gt1,3)*MUX(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,j2))*dZH(gt1,2)*Yv(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,j3))*dZH(gt1,2)*Yv(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dZH(gt1,2)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZH(gt1,2)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dZH(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZH(gt1,3)*Yv(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*dZH(gt1,2)*Yv(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*dZH(gt1,2)*Yv(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dlamN(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dlamN(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,j2))*dYv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,j3))*dYv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*dYv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*dYv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j2))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j1,j3))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt2,j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,j3))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j1,j3))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,j3))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,j3))*Yv(j1,j2)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j1,j3))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,6 + j3))*Conjg(ZVR(gt2,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,j2))*Conjg(ZVR(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,3 + j3))*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,3 + j2))*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt2,3 + j3))*Conjg(Yv(j3,j1))*Conjg(ZVR(gt3,3 + j2))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt2,3 + j2))*Conjg(Yv(j3,j1))*Conjg(ZVR(gt3,3 + j3))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*Yv(j2,j1)*ZH(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dlamN(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dlamN(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j1,j3))*dlamN(j1,j2)*ZH(gt1,3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dlamN(j1,j2)*ZH(gt1,3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dlamN(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dlamN(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dlamN(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j3,j1))*dlamN(j2,j1)*ZH(gt1,3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dlamN(j2,j1)*ZH(gt1,3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dMUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dMUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*dMUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dMUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dlamN(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dlamN(j3,j1))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVR(gt2,3 + j3))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*MUX(j1,j2)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dlamN(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dlamN(j3,j1))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j2))*Conjg(ZVR(gt2,3 + j3))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,3 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*MUX(j2,j1)*ZH(gt1,3))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dlamN(j1,j3))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dlamN(j1,j3))*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,6 + j3))*Conjg(ZVR(gt2,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,j2))*Conjg(ZVR(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(ZVR(gt2,j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZH(gt1,3))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*dZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*dZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j1,j3))*dZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*dZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dYv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt2,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,j3))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dYv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZH(gt1,2)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt3,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j1,j3))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,6 + j2))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVR(gt2,6 + j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt3,j3))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,j3))*ZH(gt1,3)*lamN(j1,j2))/4._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j1,j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,6 + j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,6 + j3))*Conjg(ZVR(gt2,6 + j2))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,6 + j2))*Conjg(ZVR(gt2,6 + j3))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt2,6 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt2,6 + j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVR(gt2,6 + j2))*Conjg(ZVR(gt3,6 + j3))*Conjg(lamN(j1,j3))*ZH(gt1,3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*dZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j1,j3))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(MUX(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*dZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j3,j1))*dZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*dZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j3))*Conjg(MUX(j1,j3))*Conjg(ZVR(gt2,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,6 + j3))*Conjg(MUX(j3,j1))*Conjg(ZVR(gt2,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j2))*Conjg(MUX(j1,j3))*Conjg(ZVR(gt2,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt3,3 + j2))*Conjg(MUX(j3,j1))*Conjg(ZVR(gt2,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,6 + j3))*Conjg(MUX(j1,j3))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,6 + j3))*Conjg(MUX(j3,j1))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j1,j3))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j3,j1))*Conjg(ZVR(gt2,6 + j3))*Conjg(ZVR(gt3,3 + j2))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlamN(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,3 + j2))*Conjg(MUX(j1,j3))*Conjg(ZVR(gt3,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dZVR(gt2,3 + j2))*Conjg(MUX(j3,j1))*Conjg(ZVR(gt3,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j1,j3))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(Conjg(dMUX(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,6 + j3))*ZH(gt1,3)*lamN(j2,j1))/(4._dp*sqrt(2._dp))
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,3 + j3))*Conjg(ZVR(gt2,3 + j2))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt3,3 + j2))*Conjg(ZVR(gt2,3 + j3))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVR(gt2,3 + j3))*Conjg(ZVR(gt3,3 + j2))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVR(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(ZVR(gt2,3 + j2))*Conjg(ZVR(gt3,3 + j3))*Conjg(lamN(j3,j1))*ZH(gt1,3)*lamN(j2,j1))/2._dp
End Do
End Do
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplinghhSvReSvRe
Subroutine CT_CouplingHpmSucSd(gt1,gt2,gt3,g2,Yd,Td,lam,Yu,Tu,vd,vu,vS, &
& ZD,ZU,ZP,dg2,dYd,dTd,dlam,dYu,dTu,dvd,dvu,dvS,dZD,dZU,dZP,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,vd,vu,vS,ZP(2,2),dg2,dvd,dvu,dvS,dZP(2,2)
Complex(dp), Intent(in) :: Yd(3,3),Td(3,3),lam,Yu(3,3),Tu(3,3),ZD(6,6),ZU(6,6),dYd(3,3),dTd(3,3),dlam, &
& dYu(3,3),dTu(3,3),dZD(6,6),dZU(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingHpmSucSd'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(ZU(gt2,j1))*dZP(gt1,1)*ZD(gt3,j1))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(ZU(gt2,j1))*dZP(gt1,2)*ZD(gt3,j1))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(ZU(gt2,j1))*dZD(gt3,j1)*ZP(gt1,1))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(dZU(gt2,j1))*ZD(gt3,j1)*ZP(gt1,1))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(dvd*g2**2*Conjg(ZU(gt2,j1))*ZD(gt3,j1)*ZP(gt1,1))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-((dg2*g2*vd*Conjg(ZU(gt2,j1))*ZD(gt3,j1)*ZP(gt1,1))/sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(ZU(gt2,j1))*dZD(gt3,j1)*ZP(gt1,2))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(dZU(gt2,j1))*ZD(gt3,j1)*ZP(gt1,2))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(dvu*g2**2*Conjg(ZU(gt2,j1))*ZD(gt3,j1)*ZP(gt1,2))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-((dg2*g2*vu*Conjg(ZU(gt2,j1))*ZD(gt3,j1)*ZP(gt1,2))/sqrt(2._dp))
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZU(gt2,j2))*dZP(gt1,2)*Yd(j1,j2)*ZD(gt3,3 + j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*dZP(gt1,1)*ZD(gt3,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(ZU(gt2,3 + j1))*Conjg(Tu(j1,j2))*dZP(gt1,2)*ZD(gt3,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*dZD(gt3,j2)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(ZU(gt2,j2))*dTd(j1,j2)*ZD(gt3,3 + j1)*ZP(gt1,1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZU(gt2,3 + j1))*Conjg(Yu(j1,j2))*ZD(gt3,j2)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZD(gt3,j2)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZD(gt3,j2)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Yu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZD(gt3,j2)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(ZU(gt2,3 + j1))*Conjg(Tu(j1,j2))*dZD(gt3,j2)*ZP(gt1,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZU(gt2,j2))*dZD(gt3,3 + j1)*Yd(j1,j2)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZU(gt2,j2))*dYd(j1,j2)*ZD(gt3,3 + j1)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZU(gt2,j2))*Yd(j1,j2)*ZD(gt3,3 + j1)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZU(gt2,j2))*Yd(j1,j2)*ZD(gt3,3 + j1)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZU(gt2,j2))*Yd(j1,j2)*ZD(gt3,3 + j1)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(dTu(j1,j2))*Conjg(ZU(gt2,3 + j1))*ZD(gt3,j2)*ZP(gt1,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(dZU(gt2,3 + j1))*Conjg(Tu(j1,j2))*ZD(gt3,j2)*ZP(gt1,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(ZU(gt2,j2))*dZP(gt1,1)*ZD(gt3,3 + j1)*Td(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(ZU(gt2,j2))*dZD(gt3,3 + j1)*ZP(gt1,1)*Td(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(dZU(gt2,j2))*ZD(gt3,3 + j1)*ZP(gt1,1)*Td(j1,j2)
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yu(j3,j1))*Conjg(ZU(gt2,3 + j3))*dZP(gt1,1)*Yd(j2,j1)*ZD(gt3,3 + j2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yu(j3,j1))*Conjg(ZU(gt2,3 + j3))*dZP(gt1,2)*Yd(j2,j1)*ZD(gt3,3 + j2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yd(j1,j3))*Conjg(ZU(gt2,j2))*dZP(gt1,1)*Yd(j1,j2)*ZD(gt3,j3))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yu(j1,j3))*Conjg(ZU(gt2,j2))*dZP(gt1,2)*Yu(j1,j2)*ZD(gt3,j3))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yd(j1,j3))*Conjg(ZU(gt2,j2))*dZD(gt3,j3)*Yd(j1,j2)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yu(j3,j1))*Conjg(ZU(gt2,3 + j3))*dZD(gt3,3 + j2)*Yd(j2,j1)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yu(j3,j1))*Conjg(ZU(gt2,3 + j3))*dYd(j2,j1)*ZD(gt3,3 + j2)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZU(gt2,3 + j3))*Conjg(Yu(j3,j1))*Yd(j2,j1)*ZD(gt3,3 + j2)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYu(j3,j1))*Conjg(ZU(gt2,3 + j3))*Yd(j2,j1)*ZD(gt3,3 + j2)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yu(j3,j1))*Conjg(ZU(gt2,3 + j3))*Yd(j2,j1)*ZD(gt3,3 + j2)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yd(j1,j3))*Conjg(ZU(gt2,j2))*dYd(j1,j2)*ZD(gt3,j3)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZU(gt2,j2))*Conjg(Yd(j1,j3))*Yd(j1,j2)*ZD(gt3,j3)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dYd(j1,j3))*Conjg(ZU(gt2,j2))*Yd(j1,j2)*ZD(gt3,j3)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(Yd(j1,j3))*Conjg(ZU(gt2,j2))*Yd(j1,j2)*ZD(gt3,j3)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yu(j3,j1))*Conjg(ZU(gt2,3 + j3))*dZD(gt3,3 + j2)*Yd(j2,j1)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yu(j1,j3))*Conjg(ZU(gt2,j2))*dZD(gt3,j3)*Yu(j1,j2)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yu(j3,j1))*Conjg(ZU(gt2,3 + j3))*dYd(j2,j1)*ZD(gt3,3 + j2)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZU(gt2,3 + j3))*Conjg(Yu(j3,j1))*Yd(j2,j1)*ZD(gt3,3 + j2)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dYu(j3,j1))*Conjg(ZU(gt2,3 + j3))*Yd(j2,j1)*ZD(gt3,3 + j2)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(Yu(j3,j1))*Conjg(ZU(gt2,3 + j3))*Yd(j2,j1)*ZD(gt3,3 + j2)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yu(j1,j3))*Conjg(ZU(gt2,j2))*dYu(j1,j2)*ZD(gt3,j3)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZU(gt2,j2))*Conjg(Yu(j1,j3))*Yu(j1,j2)*ZD(gt3,j3)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYu(j1,j3))*Conjg(ZU(gt2,j2))*Yu(j1,j2)*ZD(gt3,j3)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yu(j1,j3))*Conjg(ZU(gt2,j2))*Yu(j1,j2)*ZD(gt3,j3)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingHpmSucSd
Subroutine CT_CouplingHpmSvImcSe(gt1,gt2,gt3,g2,Ye,Te,lam,lamN,Yv,Tv,vd, &
& vu,vS,ZVI,ZE,ZP,dg2,dYe,dTe,dlam,dlamN,dYv,dTv,dvd,dvu,dvS,dZVI,dZE,dZP,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,vd,vu,vS,ZP(2,2),dg2,dvd,dvu,dvS,dZP(2,2)
Complex(dp), Intent(in) :: Ye(3,3),Te(3,3),lam,lamN(3,3),Yv(3,3),Tv(3,3),ZVI(9,9),ZE(6,6),dYe(3,3), &
& dTe(3,3),dlam,dlamN(3,3),dYv(3,3),dTv(3,3),dZVI(9,9),dZE(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingHpmSvImcSe'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res+(g2**2*vd*Conjg(ZVI(gt2,j1))*dZP(gt1,1)*ZE(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vu*Conjg(ZVI(gt2,j1))*dZP(gt1,2)*ZE(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vd*Conjg(ZVI(gt2,j1))*dZE(gt3,j1)*ZP(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vd*Conjg(dZVI(gt2,j1))*ZE(gt3,j1)*ZP(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res+(dvd*g2**2*Conjg(ZVI(gt2,j1))*ZE(gt3,j1)*ZP(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res+(dg2*g2*vd*Conjg(ZVI(gt2,j1))*ZE(gt3,j1)*ZP(gt1,1))/2._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vu*Conjg(ZVI(gt2,j1))*dZE(gt3,j1)*ZP(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(g2**2*vu*Conjg(dZVI(gt2,j1))*ZE(gt3,j1)*ZP(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(dvu*g2**2*Conjg(ZVI(gt2,j1))*ZE(gt3,j1)*ZP(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res+(dg2*g2*vu*Conjg(ZVI(gt2,j1))*ZE(gt3,j1)*ZP(gt1,2))/2._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(lam)*Conjg(ZVI(gt2,j2))*dZP(gt1,2)*Ye(j1,j2)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*dZP(gt1,1)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZVI(gt2,3 + j1))*Conjg(Tv(j1,j2))*dZP(gt1,2)*ZE(gt3,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*dZE(gt3,j2)*ZP(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZVI(gt2,j2))*dTe(j1,j2)*ZE(gt3,3 + j1)*ZP(gt1,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dZVI(gt2,3 + j1))*Conjg(Yv(j1,j2))*ZE(gt3,j2)*ZP(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*ZE(gt3,j2)*ZP(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*ZE(gt3,j2)*ZP(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*ZE(gt3,j2)*ZP(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZVI(gt2,3 + j1))*Conjg(Tv(j1,j2))*dZE(gt3,j2)*ZP(gt1,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(lam)*Conjg(ZVI(gt2,j2))*dZE(gt3,3 + j1)*Ye(j1,j2)*ZP(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(lam)*Conjg(ZVI(gt2,j2))*dYe(j1,j2)*ZE(gt3,3 + j1)*ZP(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(lam)*Conjg(dZVI(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)*ZP(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dlam)*Conjg(ZVI(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)*ZP(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(lam)*Conjg(ZVI(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)*ZP(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dTv(j1,j2))*Conjg(ZVI(gt2,3 + j1))*ZE(gt3,j2)*ZP(gt1,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dZVI(gt2,3 + j1))*Conjg(Tv(j1,j2))*ZE(gt3,j2)*ZP(gt1,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZVI(gt2,j2))*dZP(gt1,1)*ZE(gt3,3 + j1)*Te(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(ZVI(gt2,j2))*dZE(gt3,3 + j1)*ZP(gt1,1)*Te(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res-((Conjg(dZVI(gt2,j2))*ZE(gt3,3 + j1)*ZP(gt1,1)*Te(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*dZP(gt1,1)*Ye(j2,j1)*ZE(gt3,3 + j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*dZP(gt1,2)*Ye(j2,j1)*ZE(gt3,3 + j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Ye(j1,j3))*Conjg(ZVI(gt2,j2))*dZP(gt1,1)*Ye(j1,j2)*ZE(gt3,j3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j2))*dZP(gt1,2)*Yv(j1,j2)*ZE(gt3,j3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Ye(j1,j3))*Conjg(ZVI(gt2,j2))*dZE(gt3,j3)*Ye(j1,j2)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*dZE(gt3,3 + j2)*Ye(j2,j1)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*dYe(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,3 + j3))*Conjg(Yv(j3,j1))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Ye(j1,j3))*Conjg(ZVI(gt2,j2))*dYe(j1,j2)*ZE(gt3,j3)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dZVI(gt2,j2))*Conjg(Ye(j1,j3))*Ye(j1,j2)*ZE(gt3,j3)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dYe(j1,j3))*Conjg(ZVI(gt2,j2))*Ye(j1,j2)*ZE(gt3,j3)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*Conjg(Ye(j1,j3))*Conjg(ZVI(gt2,j2))*Ye(j1,j2)*ZE(gt3,j3)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*dZE(gt3,3 + j2)*Ye(j2,j1)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j2))*dZE(gt3,j3)*Yv(j1,j2)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*dYe(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dZVI(gt2,3 + j3))*Conjg(Yv(j3,j1))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vd*Conjg(dYv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvd*Conjg(Yv(j3,j1))*Conjg(ZVI(gt2,3 + j3))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*dlamN(j1,j2)*ZE(gt3,j3)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j2))*dYv(j1,j2)*ZE(gt3,j3)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dZVI(gt2,j2))*Conjg(Yv(j1,j3))*Yv(j1,j2)*ZE(gt3,j3)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vu*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,j2))*Yv(j1,j2)*ZE(gt3,j3)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvu*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j2))*Yv(j1,j2)*ZE(gt3,j3)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*dZP(gt1,2)*ZE(gt3,j3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*dZE(gt3,j3)*ZP(gt1,2)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dZVI(gt2,6 + j2))*Conjg(Yv(j1,j3))*ZE(gt3,j3)*ZP(gt1,2)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(vS*Conjg(dYv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*ZE(gt3,j3)*ZP(gt1,2)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res-(dvS*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,6 + j2))*ZE(gt3,j3)*ZP(gt1,2)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingHpmSvImcSe
Subroutine CT_CouplingHpmSvRecSe(gt1,gt2,gt3,g2,Ye,Te,lam,lamN,Yv,Tv,vd, &
& vu,vS,ZVR,ZE,ZP,dg2,dYe,dTe,dlam,dlamN,dYv,dTv,dvd,dvu,dvS,dZVR,dZE,dZP,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,vd,vu,vS,ZP(2,2),dg2,dvd,dvu,dvS,dZP(2,2)
Complex(dp), Intent(in) :: Ye(3,3),Te(3,3),lam,lamN(3,3),Yv(3,3),Tv(3,3),ZVR(9,9),ZE(6,6),dYe(3,3), &
& dTe(3,3),dlam,dlamN(3,3),dYv(3,3),dTv(3,3),dZVR(9,9),dZE(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingHpmSvRecSe'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(ZVR(gt2,j1))*dZP(gt1,1)*ZE(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(ZVR(gt2,j1))*dZP(gt1,2)*ZE(gt3,j1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(ZVR(gt2,j1))*dZE(gt3,j1)*ZP(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(dZVR(gt2,j1))*ZE(gt3,j1)*ZP(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dvd*g2**2*Conjg(ZVR(gt2,j1))*ZE(gt3,j1)*ZP(gt1,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dg2*g2*vd*Conjg(ZVR(gt2,j1))*ZE(gt3,j1)*ZP(gt1,1))/2._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(ZVR(gt2,j1))*dZE(gt3,j1)*ZP(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(dZVR(gt2,j1))*ZE(gt3,j1)*ZP(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res-(dvu*g2**2*Conjg(ZVR(gt2,j1))*ZE(gt3,j1)*ZP(gt1,2))/4._dp
End Do
Do j1 = 1,3
res = res-(dg2*g2*vu*Conjg(ZVR(gt2,j1))*ZE(gt3,j1)*ZP(gt1,2))/2._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVR(gt2,j2))*dZP(gt1,2)*Ye(j1,j2)*ZE(gt3,3 + j1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*dZP(gt1,1)*ZE(gt3,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,3 + j1))*Conjg(Tv(j1,j2))*dZP(gt1,2)*ZE(gt3,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*dZE(gt3,j2)*ZP(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,j2))*dTe(j1,j2)*ZE(gt3,3 + j1)*ZP(gt1,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVR(gt2,3 + j1))*Conjg(Yv(j1,j2))*ZE(gt3,j2)*ZP(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*ZE(gt3,j2)*ZP(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*ZE(gt3,j2)*ZP(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Yv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*ZE(gt3,j2)*ZP(gt1,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,3 + j1))*Conjg(Tv(j1,j2))*dZE(gt3,j2)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVR(gt2,j2))*dZE(gt3,3 + j1)*Ye(j1,j2)*ZP(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZVR(gt2,j2))*dYe(j1,j2)*ZE(gt3,3 + j1)*ZP(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVR(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)*ZP(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZVR(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)*ZP(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZVR(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)*ZP(gt1,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dTv(j1,j2))*Conjg(ZVR(gt2,3 + j1))*ZE(gt3,j2)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt2,3 + j1))*Conjg(Tv(j1,j2))*ZE(gt3,j2)*ZP(gt1,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,j2))*dZP(gt1,1)*ZE(gt3,3 + j1)*Te(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZVR(gt2,j2))*dZE(gt3,3 + j1)*ZP(gt1,1)*Te(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt2,j2))*ZE(gt3,3 + j1)*ZP(gt1,1)*Te(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*dZP(gt1,1)*Ye(j2,j1)*ZE(gt3,3 + j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*dZP(gt1,2)*Ye(j2,j1)*ZE(gt3,3 + j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Ye(j1,j3))*Conjg(ZVR(gt2,j2))*dZP(gt1,1)*Ye(j1,j2)*ZE(gt3,j3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j2))*dZP(gt1,2)*Yv(j1,j2)*ZE(gt3,j3))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Ye(j1,j3))*Conjg(ZVR(gt2,j2))*dZE(gt3,j3)*Ye(j1,j2)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*dZE(gt3,3 + j2)*Ye(j2,j1)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*dYe(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt2,3 + j3))*Conjg(Yv(j3,j1))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Ye(j1,j3))*Conjg(ZVR(gt2,j2))*dYe(j1,j2)*ZE(gt3,j3)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZVR(gt2,j2))*Conjg(Ye(j1,j3))*Ye(j1,j2)*ZE(gt3,j3)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dYe(j1,j3))*Conjg(ZVR(gt2,j2))*Ye(j1,j2)*ZE(gt3,j3)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(Ye(j1,j3))*Conjg(ZVR(gt2,j2))*Ye(j1,j2)*ZE(gt3,j3)*ZP(gt1,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*dZE(gt3,3 + j2)*Ye(j2,j1)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j2))*dZE(gt3,j3)*Yv(j1,j2)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*dYe(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZVR(gt2,3 + j3))*Conjg(Yv(j3,j1))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dYv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(Yv(j3,j1))*Conjg(ZVR(gt2,3 + j3))*Ye(j2,j1)*ZE(gt3,3 + j2)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*dlamN(j1,j2)*ZE(gt3,j3)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j2))*dYv(j1,j2)*ZE(gt3,j3)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt2,j2))*Conjg(Yv(j1,j3))*Yv(j1,j2)*ZE(gt3,j3)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYv(j1,j3))*Conjg(ZVR(gt2,j2))*Yv(j1,j2)*ZE(gt3,j3)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j2))*Yv(j1,j2)*ZE(gt3,j3)*ZP(gt1,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*dZP(gt1,2)*ZE(gt3,j3)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*dZE(gt3,j3)*ZP(gt1,2)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVR(gt2,6 + j2))*Conjg(Yv(j1,j3))*ZE(gt3,j3)*ZP(gt1,2)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dYv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*ZE(gt3,j3)*ZP(gt1,2)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,6 + j2))*ZE(gt3,j3)*ZP(gt1,2)*lamN(j1,j2))/2._dp
End Do
End Do
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingHpmSvRecSe
Subroutine CT_CouplingSdcHpmcSu(gt1,gt2,gt3,g2,Yd,Td,lam,Yu,Tu,vd,vu,vS, &
& ZD,ZU,ZP,dg2,dYd,dTd,dlam,dYu,dTu,dvd,dvu,dvS,dZD,dZU,dZP,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,vd,vu,vS,ZP(2,2),dg2,dvd,dvu,dvS,dZP(2,2)
Complex(dp), Intent(in) :: Yd(3,3),Td(3,3),lam,Yu(3,3),Tu(3,3),ZD(6,6),ZU(6,6),dYd(3,3),dTd(3,3),dlam, &
& dYu(3,3),dTu(3,3),dZD(6,6),dZU(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSdcHpmcSu'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(ZD(gt1,j1))*dZU(gt3,j1)*ZP(gt2,1))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(ZD(gt1,j1))*dZU(gt3,j1)*ZP(gt2,2))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(ZD(gt1,j1))*dZP(gt2,1)*ZU(gt3,j1))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(ZD(gt1,j1))*dZP(gt2,2)*ZU(gt3,j1))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(dZD(gt1,j1))*ZP(gt2,1)*ZU(gt3,j1))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(dvd*g2**2*Conjg(ZD(gt1,j1))*ZP(gt2,1)*ZU(gt3,j1))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-((dg2*g2*vd*Conjg(ZD(gt1,j1))*ZP(gt2,1)*ZU(gt3,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(dZD(gt1,j1))*ZP(gt2,2)*ZU(gt3,j1))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-(dvu*g2**2*Conjg(ZD(gt1,j1))*ZP(gt2,2)*ZU(gt3,j1))/(2._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
res = res-((dg2*g2*vu*Conjg(ZD(gt1,j1))*ZP(gt2,2)*ZU(gt3,j1))/sqrt(2._dp))
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(ZD(gt1,3 + j1))*Conjg(Td(j1,j2))*dZU(gt3,j2)*ZP(gt2,1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZD(gt1,j2))*dZU(gt3,3 + j1)*Yu(j1,j2)*ZP(gt2,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt1,3 + j1))*dZU(gt3,j2)*ZP(gt2,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZD(gt1,j2))*dZP(gt2,1)*Yu(j1,j2)*ZU(gt3,3 + j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZD(gt1,j2))*dYu(j1,j2)*ZP(gt2,1)*ZU(gt3,3 + j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZD(gt1,j2))*Yu(j1,j2)*ZP(gt2,1)*ZU(gt3,3 + j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZD(gt1,j2))*Yu(j1,j2)*ZP(gt2,1)*ZU(gt3,3 + j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZD(gt1,j2))*Yu(j1,j2)*ZP(gt2,1)*ZU(gt3,3 + j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(ZD(gt1,j2))*dTu(j1,j2)*ZP(gt2,2)*ZU(gt3,3 + j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(ZD(gt1,3 + j1))*Conjg(Td(j1,j2))*dZP(gt2,1)*ZU(gt3,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt1,3 + j1))*dZP(gt2,2)*ZU(gt3,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(dTd(j1,j2))*Conjg(ZD(gt1,3 + j1))*ZP(gt2,1)*ZU(gt3,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(dZD(gt1,3 + j1))*Conjg(Td(j1,j2))*ZP(gt2,1)*ZU(gt3,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZD(gt1,3 + j1))*Conjg(Yd(j1,j2))*ZP(gt2,2)*ZU(gt3,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYd(j1,j2))*Conjg(ZD(gt1,3 + j1))*ZP(gt2,2)*ZU(gt3,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Yd(j1,j2))*Conjg(ZD(gt1,3 + j1))*ZP(gt2,2)*ZU(gt3,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Yd(j1,j2))*Conjg(ZD(gt1,3 + j1))*ZP(gt2,2)*ZU(gt3,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(ZD(gt1,j2))*dZU(gt3,3 + j1)*ZP(gt2,2)*Tu(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(ZD(gt1,j2))*dZP(gt2,2)*ZU(gt3,3 + j1)*Tu(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+Conjg(dZD(gt1,j2))*ZP(gt2,2)*ZU(gt3,3 + j1)*Tu(j1,j2)
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yd(j1,j3))*Conjg(ZD(gt1,j2))*dZU(gt3,j3)*Yd(j1,j2)*ZP(gt2,1))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yd(j3,j1))*Conjg(ZD(gt1,3 + j3))*dZU(gt3,3 + j2)*Yu(j2,j1)*ZP(gt2,1))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yu(j1,j3))*Conjg(ZD(gt1,j2))*dZU(gt3,j3)*Yu(j1,j2)*ZP(gt2,2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yd(j3,j1))*Conjg(ZD(gt1,3 + j3))*dZU(gt3,3 + j2)*Yu(j2,j1)*ZP(gt2,2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yd(j3,j1))*Conjg(ZD(gt1,3 + j3))*dZP(gt2,1)*Yu(j2,j1)*ZU(gt3,3 + j2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yd(j3,j1))*Conjg(ZD(gt1,3 + j3))*dZP(gt2,2)*Yu(j2,j1)*ZU(gt3,3 + j2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yd(j3,j1))*Conjg(ZD(gt1,3 + j3))*dYu(j2,j1)*ZP(gt2,1)*ZU(gt3,3 + j2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZD(gt1,3 + j3))*Conjg(Yd(j3,j1))*Yu(j2,j1)*ZP(gt2,1)*ZU(gt3,3 + j2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYd(j3,j1))*Conjg(ZD(gt1,3 + j3))*Yu(j2,j1)*ZP(gt2,1)*ZU(gt3,3 + j2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yd(j3,j1))*Conjg(ZD(gt1,3 + j3))*Yu(j2,j1)*ZP(gt2,1)*ZU(gt3,3 + j2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yd(j3,j1))*Conjg(ZD(gt1,3 + j3))*dYu(j2,j1)*ZP(gt2,2)*ZU(gt3,3 + j2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZD(gt1,3 + j3))*Conjg(Yd(j3,j1))*Yu(j2,j1)*ZP(gt2,2)*ZU(gt3,3 + j2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dYd(j3,j1))*Conjg(ZD(gt1,3 + j3))*Yu(j2,j1)*ZP(gt2,2)*ZU(gt3,3 + j2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(Yd(j3,j1))*Conjg(ZD(gt1,3 + j3))*Yu(j2,j1)*ZP(gt2,2)*ZU(gt3,3 + j2))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yd(j1,j3))*Conjg(ZD(gt1,j2))*dZP(gt2,1)*Yd(j1,j2)*ZU(gt3,j3))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yu(j1,j3))*Conjg(ZD(gt1,j2))*dZP(gt2,2)*Yu(j1,j2)*ZU(gt3,j3))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Yd(j1,j3))*Conjg(ZD(gt1,j2))*dYd(j1,j2)*ZP(gt2,1)*ZU(gt3,j3))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZD(gt1,j2))*Conjg(Yd(j1,j3))*Yd(j1,j2)*ZP(gt2,1)*ZU(gt3,j3))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dYd(j1,j3))*Conjg(ZD(gt1,j2))*Yd(j1,j2)*ZP(gt2,1)*ZU(gt3,j3))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(Yd(j1,j3))*Conjg(ZD(gt1,j2))*Yd(j1,j2)*ZP(gt2,1)*ZU(gt3,j3))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yu(j1,j3))*Conjg(ZD(gt1,j2))*dYu(j1,j2)*ZP(gt2,2)*ZU(gt3,j3))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZD(gt1,j2))*Conjg(Yu(j1,j3))*Yu(j1,j2)*ZP(gt2,2)*ZU(gt3,j3))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYu(j1,j3))*Conjg(ZD(gt1,j2))*Yu(j1,j2)*ZP(gt2,2)*ZU(gt3,j3))/sqrt(2._dp)
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yu(j1,j3))*Conjg(ZD(gt1,j2))*Yu(j1,j2)*ZP(gt2,2)*ZU(gt3,j3))/sqrt(2._dp)
End Do
End Do
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSdcHpmcSu
Subroutine CT_CouplingSeSvImcHpm(gt1,gt2,gt3,g2,Ye,Te,lam,lamN,Yv,Tv,vd, &
& vu,vS,ZVI,ZE,ZP,dg2,dYe,dTe,dlam,dlamN,dYv,dTv,dvd,dvu,dvS,dZVI,dZE,dZP,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,vd,vu,vS,ZP(2,2),dg2,dvd,dvu,dvS,dZP(2,2)
Complex(dp), Intent(in) :: Ye(3,3),Te(3,3),lam,lamN(3,3),Yv(3,3),Tv(3,3),ZVI(9,9),ZE(6,6),dYe(3,3), &
& dTe(3,3),dlam,dlamN(3,3),dYv(3,3),dTv(3,3),dZVI(9,9),dZE(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSeSvImcHpm'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(ZE(gt1,j1))*Conjg(ZVI(gt2,j1))*dZP(gt3,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(ZE(gt1,j1))*Conjg(ZVI(gt2,j1))*dZP(gt3,2))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(dZVI(gt2,j1))*Conjg(ZE(gt1,j1))*ZP(gt3,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(dZE(gt1,j1))*Conjg(ZVI(gt2,j1))*ZP(gt3,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dvd*g2**2*Conjg(ZE(gt1,j1))*Conjg(ZVI(gt2,j1))*ZP(gt3,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dg2*g2*vd*Conjg(ZE(gt1,j1))*Conjg(ZVI(gt2,j1))*ZP(gt3,1))/2._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(dZVI(gt2,j1))*Conjg(ZE(gt1,j1))*ZP(gt3,2))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(dZE(gt1,j1))*Conjg(ZVI(gt2,j1))*ZP(gt3,2))/4._dp
End Do
Do j1 = 1,3
res = res-(dvu*g2**2*Conjg(ZE(gt1,j1))*Conjg(ZVI(gt2,j1))*ZP(gt3,2))/4._dp
End Do
Do j1 = 1,3
res = res-(dg2*g2*vu*Conjg(ZE(gt1,j1))*Conjg(ZVI(gt2,j1))*ZP(gt3,2))/2._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZE(gt1,3 + j1))*Conjg(ZVI(gt2,j2))*Conjg(Te(j1,j2))*dZP(gt3,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt1,3 + j1))*Conjg(ZVI(gt2,j2))*dZP(gt3,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,3 + j1))*dZP(gt3,1)*Yv(j1,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dTe(j1,j2))*Conjg(ZE(gt1,3 + j1))*Conjg(ZVI(gt2,j2))*ZP(gt3,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,j2))*Conjg(ZE(gt1,3 + j1))*Conjg(Te(j1,j2))*ZP(gt3,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZE(gt1,3 + j1))*Conjg(ZVI(gt2,j2))*Conjg(Te(j1,j2))*ZP(gt3,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,3 + j1))*dYv(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVI(gt2,3 + j1))*Conjg(ZE(gt1,j2))*Yv(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZE(gt1,j2))*Conjg(ZVI(gt2,3 + j1))*Yv(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,3 + j1))*Yv(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,3 + j1))*Yv(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVI(gt2,j2))*Conjg(Ye(j1,j2))*Conjg(ZE(gt1,3 + j1))*ZP(gt3,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZE(gt1,3 + j1))*Conjg(Ye(j1,j2))*Conjg(ZVI(gt2,j2))*ZP(gt3,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYe(j1,j2))*Conjg(ZE(gt1,3 + j1))*Conjg(ZVI(gt2,j2))*ZP(gt3,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Ye(j1,j2))*Conjg(ZE(gt1,3 + j1))*Conjg(ZVI(gt2,j2))*ZP(gt3,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt1,3 + j1))*Conjg(ZVI(gt2,j2))*ZP(gt3,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,3 + j1))*dTv(j1,j2)*ZP(gt3,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,3 + j1))*dZP(gt3,2)*Tv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVI(gt2,3 + j1))*Conjg(ZE(gt1,j2))*ZP(gt3,2)*Tv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZE(gt1,j2))*Conjg(ZVI(gt2,3 + j1))*ZP(gt3,2)*Tv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Ye(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,j3))*dZP(gt3,1)*Ye(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,j3))*dZP(gt3,2)*Yv(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*dZP(gt3,2)*Yv(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVI(gt2,3 + j2))*dZP(gt3,1)*Yv(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVI(gt2,3 + j2))*dZP(gt3,2)*Yv(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Ye(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,j3))*dYe(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVI(gt2,3 + j2))*dYv(j2,j1)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZVI(gt2,j3))*Conjg(Ye(j1,j3))*Conjg(ZE(gt1,j2))*Ye(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZE(gt1,j2))*Conjg(Ye(j1,j3))*Conjg(ZVI(gt2,j3))*Ye(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dYe(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,j3))*Ye(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(Ye(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,j3))*Ye(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVI(gt2,3 + j2))*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Yv(j2,j1)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZE(gt1,3 + j3))*Conjg(Ye(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Yv(j2,j1)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYe(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVI(gt2,3 + j2))*Yv(j2,j1)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVI(gt2,3 + j2))*Yv(j2,j1)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,j3))*dYv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVI(gt2,3 + j2))*dYv(j2,j1)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVI(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZE(gt1,j2))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZE(gt1,j2))*Conjg(Yv(j1,j3))*Conjg(ZVI(gt2,j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYv(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yv(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlamN(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,6 + j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVI(gt2,6 + j3))*Conjg(ZE(gt1,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZE(gt1,j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(ZE(gt1,j2))*Conjg(ZVI(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZVI(gt2,3 + j2))*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Yv(j2,j1)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZE(gt1,3 + j3))*Conjg(Ye(j3,j1))*Conjg(ZVI(gt2,3 + j2))*Yv(j2,j1)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dYe(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVI(gt2,3 + j2))*Yv(j2,j1)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVI(gt2,3 + j2))*Yv(j2,j1)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSeSvImcHpm
Subroutine CT_CouplingSeSvRecHpm(gt1,gt2,gt3,g2,Ye,Te,lam,lamN,Yv,Tv,vd, &
& vu,vS,ZVR,ZE,ZP,dg2,dYe,dTe,dlam,dlamN,dYv,dTv,dvd,dvu,dvS,dZVR,dZE,dZP,res)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,vd,vu,vS,ZP(2,2),dg2,dvd,dvu,dvS,dZP(2,2)
Complex(dp), Intent(in) :: Ye(3,3),Te(3,3),lam,lamN(3,3),Yv(3,3),Tv(3,3),ZVR(9,9),ZE(6,6),dYe(3,3), &
& dTe(3,3),dlam,dlamN(3,3),dYv(3,3),dTv(3,3),dZVR(9,9),dZE(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSeSvRecHpm'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(ZE(gt1,j1))*Conjg(ZVR(gt2,j1))*dZP(gt3,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(ZE(gt1,j1))*Conjg(ZVR(gt2,j1))*dZP(gt3,2))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(dZVR(gt2,j1))*Conjg(ZE(gt1,j1))*ZP(gt3,1))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vd*Conjg(dZE(gt1,j1))*Conjg(ZVR(gt2,j1))*ZP(gt3,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dvd*g2**2*Conjg(ZE(gt1,j1))*Conjg(ZVR(gt2,j1))*ZP(gt3,1))/4._dp
End Do
Do j1 = 1,3
res = res-(dg2*g2*vd*Conjg(ZE(gt1,j1))*Conjg(ZVR(gt2,j1))*ZP(gt3,1))/2._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(dZVR(gt2,j1))*Conjg(ZE(gt1,j1))*ZP(gt3,2))/4._dp
End Do
Do j1 = 1,3
res = res-(g2**2*vu*Conjg(dZE(gt1,j1))*Conjg(ZVR(gt2,j1))*ZP(gt3,2))/4._dp
End Do
Do j1 = 1,3
res = res-(dvu*g2**2*Conjg(ZE(gt1,j1))*Conjg(ZVR(gt2,j1))*ZP(gt3,2))/4._dp
End Do
Do j1 = 1,3
res = res-(dg2*g2*vu*Conjg(ZE(gt1,j1))*Conjg(ZVR(gt2,j1))*ZP(gt3,2))/2._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZE(gt1,3 + j1))*Conjg(ZVR(gt2,j2))*Conjg(Te(j1,j2))*dZP(gt3,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt1,3 + j1))*Conjg(ZVR(gt2,j2))*dZP(gt3,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,3 + j1))*dZP(gt3,1)*Yv(j1,j2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dTe(j1,j2))*Conjg(ZE(gt1,3 + j1))*Conjg(ZVR(gt2,j2))*ZP(gt3,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt2,j2))*Conjg(ZE(gt1,3 + j1))*Conjg(Te(j1,j2))*ZP(gt3,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZE(gt1,3 + j1))*Conjg(ZVR(gt2,j2))*Conjg(Te(j1,j2))*ZP(gt3,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,3 + j1))*dYv(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZVR(gt2,3 + j1))*Conjg(ZE(gt1,j2))*Yv(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(lam)*Conjg(dZE(gt1,j2))*Conjg(ZVR(gt2,3 + j1))*Yv(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlam)*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,3 + j1))*Yv(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(lam)*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,3 + j1))*Yv(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZVR(gt2,j2))*Conjg(Ye(j1,j2))*Conjg(ZE(gt1,3 + j1))*ZP(gt3,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dZE(gt1,3 + j1))*Conjg(Ye(j1,j2))*Conjg(ZVR(gt2,j2))*ZP(gt3,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*lam*Conjg(dYe(j1,j2))*Conjg(ZE(gt1,3 + j1))*Conjg(ZVR(gt2,j2))*ZP(gt3,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dlam*vS*Conjg(Ye(j1,j2))*Conjg(ZE(gt1,3 + j1))*Conjg(ZVR(gt2,j2))*ZP(gt3,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*lam*Conjg(Ye(j1,j2))*Conjg(ZE(gt1,3 + j1))*Conjg(ZVR(gt2,j2))*ZP(gt3,2))/2._dp
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,3 + j1))*dTv(j1,j2)*ZP(gt3,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,3 + j1))*dZP(gt3,2)*Tv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZVR(gt2,3 + j1))*Conjg(ZE(gt1,j2))*ZP(gt3,2)*Tv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
res = res+(Conjg(dZE(gt1,j2))*Conjg(ZVR(gt2,3 + j1))*ZP(gt3,2)*Tv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Ye(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,j3))*dZP(gt3,1)*Ye(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,j3))*dZP(gt3,2)*Yv(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,6 + j3))*Conjg(lamN(j1,j3))*dZP(gt3,2)*Yv(j1,j2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVR(gt2,3 + j2))*dZP(gt3,1)*Yv(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVR(gt2,3 + j2))*dZP(gt3,2)*Yv(j2,j1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Ye(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,j3))*dYe(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVR(gt2,3 + j2))*dYv(j2,j1)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZVR(gt2,j3))*Conjg(Ye(j1,j3))*Conjg(ZE(gt1,j2))*Ye(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZE(gt1,j2))*Conjg(Ye(j1,j3))*Conjg(ZVR(gt2,j3))*Ye(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dYe(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,j3))*Ye(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(Ye(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,j3))*Ye(j1,j2)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt2,3 + j2))*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Yv(j2,j1)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZE(gt1,3 + j3))*Conjg(Ye(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Yv(j2,j1)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYe(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVR(gt2,3 + j2))*Yv(j2,j1)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVR(gt2,3 + j2))*Yv(j2,j1)*ZP(gt3,1))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(Yv(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,j3))*dYv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,6 + j3))*Conjg(lamN(j1,j3))*dYv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVR(gt2,3 + j2))*dYv(j2,j1)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZVR(gt2,j3))*Conjg(Yv(j1,j3))*Conjg(ZE(gt1,j2))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dZE(gt1,j2))*Conjg(Yv(j1,j3))*Conjg(ZVR(gt2,j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vu*Conjg(dYv(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvu*Conjg(Yv(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dlamN(j1,j3))*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,6 + j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZVR(gt2,6 + j3))*Conjg(ZE(gt1,j2))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vS*Conjg(dZE(gt1,j2))*Conjg(ZVR(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvS*Conjg(ZE(gt1,j2))*Conjg(ZVR(gt2,6 + j3))*Conjg(lamN(j1,j3))*Yv(j1,j2)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZVR(gt2,3 + j2))*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Yv(j2,j1)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dZE(gt1,3 + j3))*Conjg(Ye(j3,j1))*Conjg(ZVR(gt2,3 + j2))*Yv(j2,j1)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(vd*Conjg(dYe(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVR(gt2,3 + j2))*Yv(j2,j1)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
Do j3 = 1,3
Do j2 = 1,3
Do j1 = 1,3
res = res+(dvd*Conjg(Ye(j3,j1))*Conjg(ZE(gt1,3 + j3))*Conjg(ZVR(gt2,3 + j2))*Yv(j2,j1)*ZP(gt3,2))/2._dp
End Do
End Do
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSeSvRecHpm
Subroutine CT_CouplingAhhhVZ(gt1,gt2,g1,g2,ZH,ZA,TW,dg1,dg2,dZH,dZA,dSinTW, &
& dCosTW,dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,ZH(3,3),ZA(3,3),TW,dg1,dg2,dZH(3,3),dZA(3,3),dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhhhVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
res = res-(g2*Cos(TW)*dZH(gt2,1)*ZA(gt1,1))/2._dp
res = res-(g1*dZH(gt2,1)*Sin(TW)*ZA(gt1,1))/2._dp
res = res+(g2*Cos(TW)*dZH(gt2,2)*ZA(gt1,2))/2._dp
res = res+(g1*dZH(gt2,2)*Sin(TW)*ZA(gt1,2))/2._dp
res = res-(g2*Cos(TW)*dZA(gt1,1)*ZH(gt2,1))/2._dp
res = res-(g1*dZA(gt1,1)*Sin(TW)*ZH(gt2,1))/2._dp
res = res-(dSinTW*g1*ZA(gt1,1)*ZH(gt2,1))/2._dp
res = res-(dCosTW*g2*ZA(gt1,1)*ZH(gt2,1))/2._dp
res = res-(dg2*Cos(TW)*ZA(gt1,1)*ZH(gt2,1))/2._dp
res = res-(dg1*Sin(TW)*ZA(gt1,1)*ZH(gt2,1))/2._dp
res = res+(g2*Cos(TW)*dZA(gt1,2)*ZH(gt2,2))/2._dp
res = res+(g1*dZA(gt1,2)*Sin(TW)*ZH(gt2,2))/2._dp
res = res+(dSinTW*g1*ZA(gt1,2)*ZH(gt2,2))/2._dp
res = res+(dCosTW*g2*ZA(gt1,2)*ZH(gt2,2))/2._dp
res = res+(dg2*Cos(TW)*ZA(gt1,2)*ZH(gt2,2))/2._dp
res = res+(dg1*Sin(TW)*ZA(gt1,2)*ZH(gt2,2))/2._dp
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhhhVZ
Subroutine CT_CouplingAhHpmcVWm(gt1,gt2,g2,ZA,ZP,dg2,dZA,dZP,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,ZA(3,3),ZP(2,2),dg2,dZA(3,3),dZP(2,2)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhHpmcVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
res = res-(g2*dZP(gt2,1)*ZA(gt1,1))/2._dp
res = res-(g2*dZP(gt2,2)*ZA(gt1,2))/2._dp
res = res-(g2*dZA(gt1,1)*ZP(gt2,1))/2._dp
res = res-(dg2*ZA(gt1,1)*ZP(gt2,1))/2._dp
res = res-(g2*dZA(gt1,2)*ZP(gt2,2))/2._dp
res = res-(dg2*ZA(gt1,2)*ZP(gt2,2))/2._dp
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhHpmcVWm
Subroutine CT_CouplingAhcHpmVWm(gt1,gt2,g2,ZA,ZP,dg2,dZA,dZP,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,ZA(3,3),ZP(2,2),dg2,dZA(3,3),dZP(2,2)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingAhcHpmVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
res = res-(g2*dZP(gt2,1)*ZA(gt1,1))/2._dp
res = res-(g2*dZP(gt2,2)*ZA(gt1,2))/2._dp
res = res-(g2*dZA(gt1,1)*ZP(gt2,1))/2._dp
res = res-(dg2*ZA(gt1,1)*ZP(gt2,1))/2._dp
res = res-(g2*dZA(gt1,2)*ZP(gt2,2))/2._dp
res = res-(dg2*ZA(gt1,2)*ZP(gt2,2))/2._dp
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingAhcHpmVWm
Subroutine CT_CouplinghhHpmcVWm(gt1,gt2,g2,ZH,ZP,dg2,dZH,dZP,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,ZH(3,3),ZP(2,2),dg2,dZH(3,3),dZP(2,2)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplinghhHpmcVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
res = res-(g2*dZP(gt2,1)*ZH(gt1,1))/2._dp
res = res+(g2*dZP(gt2,2)*ZH(gt1,2))/2._dp
res = res-(g2*dZH(gt1,1)*ZP(gt2,1))/2._dp
res = res-(dg2*ZH(gt1,1)*ZP(gt2,1))/2._dp
res = res+(g2*dZH(gt1,2)*ZP(gt2,2))/2._dp
res = res+(dg2*ZH(gt1,2)*ZP(gt2,2))/2._dp
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplinghhHpmcVWm
Subroutine CT_CouplinghhcHpmVWm(gt1,gt2,g2,ZH,ZP,dg2,dZH,dZP,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,ZH(3,3),ZP(2,2),dg2,dZH(3,3),dZP(2,2)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplinghhcHpmVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
res = res+(g2*dZP(gt2,1)*ZH(gt1,1))/2._dp
res = res-(g2*dZP(gt2,2)*ZH(gt1,2))/2._dp
res = res+(g2*dZH(gt1,1)*ZP(gt2,1))/2._dp
res = res+(dg2*ZH(gt1,1)*ZP(gt2,1))/2._dp
res = res-(g2*dZH(gt1,2)*ZP(gt2,2))/2._dp
res = res-(dg2*ZH(gt1,2)*ZP(gt2,2))/2._dp
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplinghhcHpmVWm
Subroutine CT_CouplingHpmcHpmVP(gt1,gt2,g1,g2,ZP,TW,dg1,dg2,dZP,dSinTW, &
& dCosTW,dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,ZP(2,2),TW,dg1,dg2,dZP(2,2),dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingHpmcHpmVP'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
res = res-(g1*Cos(TW)*dZP(gt2,1)*ZP(gt1,1))/2._dp
res = res-(g2*dZP(gt2,1)*Sin(TW)*ZP(gt1,1))/2._dp
res = res-(g1*Cos(TW)*dZP(gt2,2)*ZP(gt1,2))/2._dp
res = res-(g2*dZP(gt2,2)*Sin(TW)*ZP(gt1,2))/2._dp
res = res-(g1*Cos(TW)*dZP(gt1,1)*ZP(gt2,1))/2._dp
res = res-(g2*dZP(gt1,1)*Sin(TW)*ZP(gt2,1))/2._dp
res = res-(dCosTW*g1*ZP(gt1,1)*ZP(gt2,1))/2._dp
res = res-(dSinTW*g2*ZP(gt1,1)*ZP(gt2,1))/2._dp
res = res-(dg1*Cos(TW)*ZP(gt1,1)*ZP(gt2,1))/2._dp
res = res-(dg2*Sin(TW)*ZP(gt1,1)*ZP(gt2,1))/2._dp
res = res-(g1*Cos(TW)*dZP(gt1,2)*ZP(gt2,2))/2._dp
res = res-(g2*dZP(gt1,2)*Sin(TW)*ZP(gt2,2))/2._dp
res = res-(dCosTW*g1*ZP(gt1,2)*ZP(gt2,2))/2._dp
res = res-(dSinTW*g2*ZP(gt1,2)*ZP(gt2,2))/2._dp
res = res-(dg1*Cos(TW)*ZP(gt1,2)*ZP(gt2,2))/2._dp
res = res-(dg2*Sin(TW)*ZP(gt1,2)*ZP(gt2,2))/2._dp
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingHpmcHpmVP
Subroutine CT_CouplingHpmcHpmVZ(gt1,gt2,g1,g2,ZP,TW,dg1,dg2,dZP,dSinTW, &
& dCosTW,dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,ZP(2,2),TW,dg1,dg2,dZP(2,2),dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingHpmcHpmVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
res = res-(g2*Cos(TW)*dZP(gt2,1)*ZP(gt1,1))/2._dp
res = res+(g1*dZP(gt2,1)*Sin(TW)*ZP(gt1,1))/2._dp
res = res-(g2*Cos(TW)*dZP(gt2,2)*ZP(gt1,2))/2._dp
res = res+(g1*dZP(gt2,2)*Sin(TW)*ZP(gt1,2))/2._dp
res = res-(g2*Cos(TW)*dZP(gt1,1)*ZP(gt2,1))/2._dp
res = res+(g1*dZP(gt1,1)*Sin(TW)*ZP(gt2,1))/2._dp
res = res+(dSinTW*g1*ZP(gt1,1)*ZP(gt2,1))/2._dp
res = res-(dCosTW*g2*ZP(gt1,1)*ZP(gt2,1))/2._dp
res = res-(dg2*Cos(TW)*ZP(gt1,1)*ZP(gt2,1))/2._dp
res = res+(dg1*Sin(TW)*ZP(gt1,1)*ZP(gt2,1))/2._dp
res = res-(g2*Cos(TW)*dZP(gt1,2)*ZP(gt2,2))/2._dp
res = res+(g1*dZP(gt1,2)*Sin(TW)*ZP(gt2,2))/2._dp
res = res+(dSinTW*g1*ZP(gt1,2)*ZP(gt2,2))/2._dp
res = res-(dCosTW*g2*ZP(gt1,2)*ZP(gt2,2))/2._dp
res = res-(dg2*Cos(TW)*ZP(gt1,2)*ZP(gt2,2))/2._dp
res = res+(dg1*Sin(TW)*ZP(gt1,2)*ZP(gt2,2))/2._dp
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingHpmcHpmVZ
Subroutine CT_CouplingSdcSdVG(gt1,gt2,g3,dg3,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g3,dg3
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSdcSdVG'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
If ((gt1.eq.gt2)) Then
res = res+dg3
End If
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSdcSdVG
Subroutine CT_CouplingSdcSdVP(gt1,gt2,g1,g2,ZD,TW,dg1,dg2,dZD,dSinTW,dCosTW, &
& dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(in) :: ZD(6,6),dZD(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSdcSdVP'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res+(g1*Conjg(ZD(gt1,j1))*Cos(TW)*dZD(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res-(g1*Conjg(ZD(gt1,3 + j1))*Cos(TW)*dZD(gt2,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res-(g2*Conjg(ZD(gt1,j1))*dZD(gt2,j1)*Sin(TW))/2._dp
End Do
Do j1 = 1,3
res = res+(dCosTW*g1*Conjg(ZD(gt1,j1))*ZD(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res-(dSinTW*g2*Conjg(ZD(gt1,j1))*ZD(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res+(g1*Conjg(dZD(gt1,j1))*Cos(TW)*ZD(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res+(dg1*Conjg(ZD(gt1,j1))*Cos(TW)*ZD(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res-(g2*Conjg(dZD(gt1,j1))*Sin(TW)*ZD(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(dg2*Conjg(ZD(gt1,j1))*Sin(TW)*ZD(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(dCosTW*g1*Conjg(ZD(gt1,3 + j1))*ZD(gt2,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res-(g1*Conjg(dZD(gt1,3 + j1))*Cos(TW)*ZD(gt2,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res-(dg1*Conjg(ZD(gt1,3 + j1))*Cos(TW)*ZD(gt2,3 + j1))/3._dp
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSdcSdVP
Subroutine CT_CouplingSdcSdVZ(gt1,gt2,g1,g2,ZD,TW,dg1,dg2,dZD,dSinTW,dCosTW, &
& dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(in) :: ZD(6,6),dZD(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSdcSdVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(g2*Conjg(ZD(gt1,j1))*Cos(TW)*dZD(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g1*Conjg(ZD(gt1,j1))*dZD(gt2,j1)*Sin(TW))/6._dp
End Do
Do j1 = 1,3
res = res+(g1*Conjg(ZD(gt1,3 + j1))*dZD(gt2,3 + j1)*Sin(TW))/3._dp
End Do
Do j1 = 1,3
res = res-(dSinTW*g1*Conjg(ZD(gt1,j1))*ZD(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res-(dCosTW*g2*Conjg(ZD(gt1,j1))*ZD(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g2*Conjg(dZD(gt1,j1))*Cos(TW)*ZD(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(dg2*Conjg(ZD(gt1,j1))*Cos(TW)*ZD(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g1*Conjg(dZD(gt1,j1))*Sin(TW)*ZD(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res-(dg1*Conjg(ZD(gt1,j1))*Sin(TW)*ZD(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res+(dSinTW*g1*Conjg(ZD(gt1,3 + j1))*ZD(gt2,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res+(g1*Conjg(dZD(gt1,3 + j1))*Sin(TW)*ZD(gt2,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res+(dg1*Conjg(ZD(gt1,3 + j1))*Sin(TW)*ZD(gt2,3 + j1))/3._dp
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSdcSdVZ
Subroutine CT_CouplingSdcSucVWm(gt1,gt2,g2,ZD,ZU,dg2,dZD,dZU,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: ZD(6,6),ZU(6,6),dZD(6,6),dZU(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSdcSucVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res+(g2*Conjg(ZD(gt1,j1))*dZU(gt2,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
res = res+(g2*Conjg(dZD(gt1,j1))*ZU(gt2,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
res = res+(dg2*Conjg(ZD(gt1,j1))*ZU(gt2,j1))/sqrt(2._dp)
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSdcSucVWm
Subroutine CT_CouplingSeSvImcVWm(gt1,gt2,g2,ZVI,ZE,dg2,dZVI,dZE,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: ZVI(9,9),ZE(6,6),dZVI(9,9),dZE(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSeSvImcVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res+(g2*Conjg(dZVI(gt2,j1))*Conjg(ZE(gt1,j1)))/2._dp
End Do
Do j1 = 1,3
res = res+(g2*Conjg(dZE(gt1,j1))*Conjg(ZVI(gt2,j1)))/2._dp
End Do
Do j1 = 1,3
res = res+(dg2*Conjg(ZE(gt1,j1))*Conjg(ZVI(gt2,j1)))/2._dp
End Do
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSeSvImcVWm
Subroutine CT_CouplingSeSvRecVWm(gt1,gt2,g2,ZVR,ZE,dg2,dZVR,dZE,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: ZVR(9,9),ZE(6,6),dZVR(9,9),dZE(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSeSvRecVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res+(g2*Conjg(dZVR(gt2,j1))*Conjg(ZE(gt1,j1)))/2._dp
End Do
Do j1 = 1,3
res = res+(g2*Conjg(dZE(gt1,j1))*Conjg(ZVR(gt2,j1)))/2._dp
End Do
Do j1 = 1,3
res = res+(dg2*Conjg(ZE(gt1,j1))*Conjg(ZVR(gt2,j1)))/2._dp
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSeSvRecVWm
Subroutine CT_CouplingSecSeVP(gt1,gt2,g1,g2,ZE,TW,dg1,dg2,dZE,dSinTW,dCosTW, &
& dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(in) :: ZE(6,6),dZE(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSecSeVP'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(g1*Conjg(ZE(gt1,j1))*Cos(TW)*dZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g1*Conjg(ZE(gt1,3 + j1))*Cos(TW)*dZE(gt2,3 + j1))
End Do
Do j1 = 1,3
res = res-(g2*Conjg(ZE(gt1,j1))*dZE(gt2,j1)*Sin(TW))/2._dp
End Do
Do j1 = 1,3
res = res-(dCosTW*g1*Conjg(ZE(gt1,j1))*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(dSinTW*g2*Conjg(ZE(gt1,j1))*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g1*Conjg(dZE(gt1,j1))*Cos(TW)*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(dg1*Conjg(ZE(gt1,j1))*Cos(TW)*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g2*Conjg(dZE(gt1,j1))*Sin(TW)*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(dg2*Conjg(ZE(gt1,j1))*Sin(TW)*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(dCosTW*g1*Conjg(ZE(gt1,3 + j1))*ZE(gt2,3 + j1))
End Do
Do j1 = 1,3
res = res-(g1*Conjg(dZE(gt1,3 + j1))*Cos(TW)*ZE(gt2,3 + j1))
End Do
Do j1 = 1,3
res = res-(dg1*Conjg(ZE(gt1,3 + j1))*Cos(TW)*ZE(gt2,3 + j1))
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSecSeVP
Subroutine CT_CouplingSecSeVZ(gt1,gt2,g1,g2,ZE,TW,dg1,dg2,dZE,dSinTW,dCosTW, &
& dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(in) :: ZE(6,6),dZE(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSecSeVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(g2*Conjg(ZE(gt1,j1))*Cos(TW)*dZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res+(g1*Conjg(ZE(gt1,j1))*dZE(gt2,j1)*Sin(TW))/2._dp
End Do
Do j1 = 1,3
res = res+g1*Conjg(ZE(gt1,3 + j1))*dZE(gt2,3 + j1)*Sin(TW)
End Do
Do j1 = 1,3
res = res+(dSinTW*g1*Conjg(ZE(gt1,j1))*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(dCosTW*g2*Conjg(ZE(gt1,j1))*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g2*Conjg(dZE(gt1,j1))*Cos(TW)*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(dg2*Conjg(ZE(gt1,j1))*Cos(TW)*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res+(g1*Conjg(dZE(gt1,j1))*Sin(TW)*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res+(dg1*Conjg(ZE(gt1,j1))*Sin(TW)*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res+dSinTW*g1*Conjg(ZE(gt1,3 + j1))*ZE(gt2,3 + j1)
End Do
Do j1 = 1,3
res = res+g1*Conjg(dZE(gt1,3 + j1))*Sin(TW)*ZE(gt2,3 + j1)
End Do
Do j1 = 1,3
res = res+dg1*Conjg(ZE(gt1,3 + j1))*Sin(TW)*ZE(gt2,3 + j1)
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSecSeVZ
Subroutine CT_CouplingSucSuVG(gt1,gt2,g3,dg3,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g3,dg3
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSucSuVG'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
If ((gt1.eq.gt2)) Then
res = res+dg3
End If
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSucSuVG
Subroutine CT_CouplingSucSuVP(gt1,gt2,g1,g2,ZU,TW,dg1,dg2,dZU,dSinTW,dCosTW, &
& dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(in) :: ZU(6,6),dZU(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSucSuVP'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res+(g1*Conjg(ZU(gt1,j1))*Cos(TW)*dZU(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res+(2*g1*Conjg(ZU(gt1,3 + j1))*Cos(TW)*dZU(gt2,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res+(g2*Conjg(ZU(gt1,j1))*dZU(gt2,j1)*Sin(TW))/2._dp
End Do
Do j1 = 1,3
res = res+(dCosTW*g1*Conjg(ZU(gt1,j1))*ZU(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res+(dSinTW*g2*Conjg(ZU(gt1,j1))*ZU(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res+(g1*Conjg(dZU(gt1,j1))*Cos(TW)*ZU(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res+(dg1*Conjg(ZU(gt1,j1))*Cos(TW)*ZU(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res+(g2*Conjg(dZU(gt1,j1))*Sin(TW)*ZU(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res+(dg2*Conjg(ZU(gt1,j1))*Sin(TW)*ZU(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res+(2*dCosTW*g1*Conjg(ZU(gt1,3 + j1))*ZU(gt2,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res+(2*g1*Conjg(dZU(gt1,3 + j1))*Cos(TW)*ZU(gt2,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res+(2*dg1*Conjg(ZU(gt1,3 + j1))*Cos(TW)*ZU(gt2,3 + j1))/3._dp
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSucSuVP
Subroutine CT_CouplingSucSdVWm(gt1,gt2,g2,ZD,ZU,dg2,dZD,dZU,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: ZD(6,6),ZU(6,6),dZD(6,6),dZU(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSucSdVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res+(g2*Conjg(ZU(gt1,j1))*dZD(gt2,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
res = res+(g2*Conjg(dZU(gt1,j1))*ZD(gt2,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
res = res+(dg2*Conjg(ZU(gt1,j1))*ZD(gt2,j1))/sqrt(2._dp)
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSucSdVWm
Subroutine CT_CouplingSucSuVZ(gt1,gt2,g1,g2,ZU,TW,dg1,dg2,dZU,dSinTW,dCosTW, &
& dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(in) :: ZU(6,6),dZU(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSucSuVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res+(g2*Conjg(ZU(gt1,j1))*Cos(TW)*dZU(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g1*Conjg(ZU(gt1,j1))*dZU(gt2,j1)*Sin(TW))/6._dp
End Do
Do j1 = 1,3
res = res+(-2*g1*Conjg(ZU(gt1,3 + j1))*dZU(gt2,3 + j1)*Sin(TW))/3._dp
End Do
Do j1 = 1,3
res = res-(dSinTW*g1*Conjg(ZU(gt1,j1))*ZU(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res+(dCosTW*g2*Conjg(ZU(gt1,j1))*ZU(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res+(g2*Conjg(dZU(gt1,j1))*Cos(TW)*ZU(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res+(dg2*Conjg(ZU(gt1,j1))*Cos(TW)*ZU(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g1*Conjg(dZU(gt1,j1))*Sin(TW)*ZU(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res-(dg1*Conjg(ZU(gt1,j1))*Sin(TW)*ZU(gt2,j1))/6._dp
End Do
Do j1 = 1,3
res = res+(-2*dSinTW*g1*Conjg(ZU(gt1,3 + j1))*ZU(gt2,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res+(-2*g1*Conjg(dZU(gt1,3 + j1))*Sin(TW)*ZU(gt2,3 + j1))/3._dp
End Do
Do j1 = 1,3
res = res+(-2*dg1*Conjg(ZU(gt1,3 + j1))*Sin(TW)*ZU(gt2,3 + j1))/3._dp
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSucSuVZ
Subroutine CT_CouplingSvImSvReVZ(gt1,gt2,g1,g2,ZVI,ZVR,TW,dg1,dg2,dZVI, &
& dZVR,dSinTW,dCosTW,dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(in) :: ZVI(9,9),ZVR(9,9),dZVI(9,9),dZVR(9,9)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSvImSvReVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(dSinTW*g1*Conjg(ZVI(gt1,j1))*Conjg(ZVR(gt2,j1)))/2._dp
End Do
Do j1 = 1,3
res = res-(dCosTW*g2*Conjg(ZVI(gt1,j1))*Conjg(ZVR(gt2,j1)))/2._dp
End Do
Do j1 = 1,3
res = res-(g2*Conjg(dZVR(gt2,j1))*Conjg(ZVI(gt1,j1))*Cos(TW))/2._dp
End Do
Do j1 = 1,3
res = res-(g2*Conjg(dZVI(gt1,j1))*Conjg(ZVR(gt2,j1))*Cos(TW))/2._dp
End Do
Do j1 = 1,3
res = res-(dg2*Conjg(ZVI(gt1,j1))*Conjg(ZVR(gt2,j1))*Cos(TW))/2._dp
End Do
Do j1 = 1,3
res = res-(g1*Conjg(dZVR(gt2,j1))*Conjg(ZVI(gt1,j1))*Sin(TW))/2._dp
End Do
Do j1 = 1,3
res = res-(g1*Conjg(dZVI(gt1,j1))*Conjg(ZVR(gt2,j1))*Sin(TW))/2._dp
End Do
Do j1 = 1,3
res = res-(dg1*Conjg(ZVI(gt1,j1))*Conjg(ZVR(gt2,j1))*Sin(TW))/2._dp
End Do
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSvImSvReVZ
Subroutine CT_CouplingSvImcSeVWm(gt1,gt2,g2,ZVI,ZE,dg2,dZVI,dZE,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: ZVI(9,9),ZE(6,6),dZVI(9,9),dZE(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSvImcSeVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res-(g2*Conjg(ZVI(gt1,j1))*dZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(g2*Conjg(dZVI(gt1,j1))*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res-(dg2*Conjg(ZVI(gt1,j1))*ZE(gt2,j1))/2._dp
End Do
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSvImcSeVWm
Subroutine CT_CouplingSvRecSeVWm(gt1,gt2,g2,ZVR,ZE,dg2,dZVR,dZE,res)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: ZVR(9,9),ZE(6,6),dZVR(9,9),dZE(6,6)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingSvRecSeVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
res = 0._dp
Do j1 = 1,3
res = res+(g2*Conjg(ZVR(gt1,j1))*dZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res+(g2*Conjg(dZVR(gt1,j1))*ZE(gt2,j1))/2._dp
End Do
Do j1 = 1,3
res = res+(dg2*Conjg(ZVR(gt1,j1))*ZE(gt2,j1))/2._dp
End Do
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingSvRecSeVWm
Subroutine CT_CouplinghhcVWmVWm(gt1,g2,vd,vu,ZH,dg2,dvd,dvu,dZH,res)
Implicit None
Integer, Intent(in) :: gt1
Real(dp), Intent(in) :: g2,vd,vu,ZH(3,3),dg2,dvd,dvu,dZH(3,3)
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplinghhcVWmVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
res = 0._dp
res = res+(g2**2*vd*dZH(gt1,1))/2._dp
res = res+(g2**2*vu*dZH(gt1,2))/2._dp
res = res+(dvd*g2**2*ZH(gt1,1))/2._dp
res = res+dg2*g2*vd*ZH(gt1,1)
res = res+(dvu*g2**2*ZH(gt1,2))/2._dp
res = res+dg2*g2*vu*ZH(gt1,2)
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplinghhcVWmVWm
Subroutine CT_CouplinghhVZVZ(gt1,g1,g2,vd,vu,ZH,TW,dg1,dg2,dvd,dvu,dZH, &
& dSinTW,dCosTW,dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1
Real(dp), Intent(in) :: g1,g2,vd,vu,ZH(3,3),TW,dg1,dg2,dvd,dvu,dZH(3,3),dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplinghhVZVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
res = 0._dp
res = res+(g1**2*vd*dZH(gt1,1))/4._dp
res = res+(g2**2*vd*dZH(gt1,1))/4._dp
res = res-(g1**2*vd*Cos(TW)**2*dZH(gt1,1))/4._dp
res = res+(g2**2*vd*Cos(TW)**2*dZH(gt1,1))/4._dp
res = res+(g1**2*vu*dZH(gt1,2))/4._dp
res = res+(g2**2*vu*dZH(gt1,2))/4._dp
res = res-(g1**2*vu*Cos(TW)**2*dZH(gt1,2))/4._dp
res = res+(g2**2*vu*Cos(TW)**2*dZH(gt1,2))/4._dp
res = res+g1*g2*vd*Cos(TW)*dZH(gt1,1)*Sin(TW)
res = res+g1*g2*vu*Cos(TW)*dZH(gt1,2)*Sin(TW)
res = res+(g1**2*vd*dZH(gt1,1)*Sin(TW)**2)/4._dp
res = res-(g2**2*vd*dZH(gt1,1)*Sin(TW)**2)/4._dp
res = res+(g1**2*vu*dZH(gt1,2)*Sin(TW)**2)/4._dp
res = res-(g2**2*vu*dZH(gt1,2)*Sin(TW)**2)/4._dp
res = res+(dvd*g1**2*ZH(gt1,1))/4._dp
res = res+(dvd*g2**2*ZH(gt1,1))/4._dp
res = res+(dg1*g1*vd*ZH(gt1,1))/2._dp
res = res+(dg2*g2*vd*ZH(gt1,1))/2._dp
res = res-(dCosTW*g1**2*vd*Cos(TW)*ZH(gt1,1))/2._dp
res = res+dSinTW*g1*g2*vd*Cos(TW)*ZH(gt1,1)
res = res+(dCosTW*g2**2*vd*Cos(TW)*ZH(gt1,1))/2._dp
res = res-(dvd*g1**2*Cos(TW)**2*ZH(gt1,1))/4._dp
res = res+(dvd*g2**2*Cos(TW)**2*ZH(gt1,1))/4._dp
res = res-(dg1*g1*vd*Cos(TW)**2*ZH(gt1,1))/2._dp
res = res+(dg2*g2*vd*Cos(TW)**2*ZH(gt1,1))/2._dp
res = res+(dSinTW*g1**2*vd*Sin(TW)*ZH(gt1,1))/2._dp
res = res+dCosTW*g1*g2*vd*Sin(TW)*ZH(gt1,1)
res = res-(dSinTW*g2**2*vd*Sin(TW)*ZH(gt1,1))/2._dp
res = res+dvd*g1*g2*Cos(TW)*Sin(TW)*ZH(gt1,1)
res = res+dg2*g1*vd*Cos(TW)*Sin(TW)*ZH(gt1,1)
res = res+dg1*g2*vd*Cos(TW)*Sin(TW)*ZH(gt1,1)
res = res+(dvd*g1**2*Sin(TW)**2*ZH(gt1,1))/4._dp
res = res-(dvd*g2**2*Sin(TW)**2*ZH(gt1,1))/4._dp
res = res+(dg1*g1*vd*Sin(TW)**2*ZH(gt1,1))/2._dp
res = res-(dg2*g2*vd*Sin(TW)**2*ZH(gt1,1))/2._dp
res = res+(dvu*g1**2*ZH(gt1,2))/4._dp
res = res+(dvu*g2**2*ZH(gt1,2))/4._dp
res = res+(dg1*g1*vu*ZH(gt1,2))/2._dp
res = res+(dg2*g2*vu*ZH(gt1,2))/2._dp
res = res-(dCosTW*g1**2*vu*Cos(TW)*ZH(gt1,2))/2._dp
res = res+dSinTW*g1*g2*vu*Cos(TW)*ZH(gt1,2)
res = res+(dCosTW*g2**2*vu*Cos(TW)*ZH(gt1,2))/2._dp
res = res-(dvu*g1**2*Cos(TW)**2*ZH(gt1,2))/4._dp
res = res+(dvu*g2**2*Cos(TW)**2*ZH(gt1,2))/4._dp
res = res-(dg1*g1*vu*Cos(TW)**2*ZH(gt1,2))/2._dp
res = res+(dg2*g2*vu*Cos(TW)**2*ZH(gt1,2))/2._dp
res = res+(dSinTW*g1**2*vu*Sin(TW)*ZH(gt1,2))/2._dp
res = res+dCosTW*g1*g2*vu*Sin(TW)*ZH(gt1,2)
res = res-(dSinTW*g2**2*vu*Sin(TW)*ZH(gt1,2))/2._dp
res = res+dvu*g1*g2*Cos(TW)*Sin(TW)*ZH(gt1,2)
res = res+dg2*g1*vu*Cos(TW)*Sin(TW)*ZH(gt1,2)
res = res+dg1*g2*vu*Cos(TW)*Sin(TW)*ZH(gt1,2)
res = res+(dvu*g1**2*Sin(TW)**2*ZH(gt1,2))/4._dp
res = res-(dvu*g2**2*Sin(TW)**2*ZH(gt1,2))/4._dp
res = res+(dg1*g1*vu*Sin(TW)**2*ZH(gt1,2))/2._dp
res = res-(dg2*g2*vu*Sin(TW)**2*ZH(gt1,2))/2._dp
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplinghhVZVZ
Subroutine CT_CouplingHpmcVWmVP(gt1,g1,g2,vd,vu,ZP,TW,dg1,dg2,dvd,dvu,dZP, &
& dSinTW,dCosTW,dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1
Real(dp), Intent(in) :: g1,g2,vd,vu,ZP(2,2),TW,dg1,dg2,dvd,dvu,dZP(2,2),dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingHpmcVWmVP'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
res = 0._dp
res = res-(g1*g2*vd*Cos(TW)*dZP(gt1,1))/2._dp
res = res+(g1*g2*vu*Cos(TW)*dZP(gt1,2))/2._dp
res = res-(dCosTW*g1*g2*vd*ZP(gt1,1))/2._dp
res = res-(dvd*g1*g2*Cos(TW)*ZP(gt1,1))/2._dp
res = res-(dg2*g1*vd*Cos(TW)*ZP(gt1,1))/2._dp
res = res-(dg1*g2*vd*Cos(TW)*ZP(gt1,1))/2._dp
res = res+(dCosTW*g1*g2*vu*ZP(gt1,2))/2._dp
res = res+(dvu*g1*g2*Cos(TW)*ZP(gt1,2))/2._dp
res = res+(dg2*g1*vu*Cos(TW)*ZP(gt1,2))/2._dp
res = res+(dg1*g2*vu*Cos(TW)*ZP(gt1,2))/2._dp
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingHpmcVWmVP
Subroutine CT_CouplingHpmcVWmVZ(gt1,g1,g2,vd,vu,ZP,TW,dg1,dg2,dvd,dvu,dZP, &
& dSinTW,dCosTW,dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1
Real(dp), Intent(in) :: g1,g2,vd,vu,ZP(2,2),TW,dg1,dg2,dvd,dvu,dZP(2,2),dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingHpmcVWmVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
res = 0._dp
res = res+(g1*g2*vd*dZP(gt1,1)*Sin(TW))/2._dp
res = res-(g1*g2*vu*dZP(gt1,2)*Sin(TW))/2._dp
res = res+(dSinTW*g1*g2*vd*ZP(gt1,1))/2._dp
res = res+(dvd*g1*g2*Sin(TW)*ZP(gt1,1))/2._dp
res = res+(dg2*g1*vd*Sin(TW)*ZP(gt1,1))/2._dp
res = res+(dg1*g2*vd*Sin(TW)*ZP(gt1,1))/2._dp
res = res-(dSinTW*g1*g2*vu*ZP(gt1,2))/2._dp
res = res-(dvu*g1*g2*Sin(TW)*ZP(gt1,2))/2._dp
res = res-(dg2*g1*vu*Sin(TW)*ZP(gt1,2))/2._dp
res = res-(dg1*g2*vu*Sin(TW)*ZP(gt1,2))/2._dp
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingHpmcVWmVZ
Subroutine CT_CouplingcHpmVPVWm(gt1,g1,g2,vd,vu,ZP,TW,dg1,dg2,dvd,dvu,dZP, &
& dSinTW,dCosTW,dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1
Real(dp), Intent(in) :: g1,g2,vd,vu,ZP(2,2),TW,dg1,dg2,dvd,dvu,dZP(2,2),dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcHpmVPVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
res = 0._dp
res = res-(g1*g2*vd*Cos(TW)*dZP(gt1,1))/2._dp
res = res+(g1*g2*vu*Cos(TW)*dZP(gt1,2))/2._dp
res = res-(dCosTW*g1*g2*vd*ZP(gt1,1))/2._dp
res = res-(dvd*g1*g2*Cos(TW)*ZP(gt1,1))/2._dp
res = res-(dg2*g1*vd*Cos(TW)*ZP(gt1,1))/2._dp
res = res-(dg1*g2*vd*Cos(TW)*ZP(gt1,1))/2._dp
res = res+(dCosTW*g1*g2*vu*ZP(gt1,2))/2._dp
res = res+(dvu*g1*g2*Cos(TW)*ZP(gt1,2))/2._dp
res = res+(dg2*g1*vu*Cos(TW)*ZP(gt1,2))/2._dp
res = res+(dg1*g2*vu*Cos(TW)*ZP(gt1,2))/2._dp
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcHpmVPVWm
Subroutine CT_CouplingcHpmVWmVZ(gt1,g1,g2,vd,vu,ZP,TW,dg1,dg2,dvd,dvu,dZP, &
& dSinTW,dCosTW,dTanTW,res)
Implicit None
Integer, Intent(in) :: gt1
Real(dp), Intent(in) :: g1,g2,vd,vu,ZP(2,2),TW,dg1,dg2,dvd,dvu,dZP(2,2),dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcHpmVWmVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
res = 0._dp
res = res+(g1*g2*vd*dZP(gt1,1)*Sin(TW))/2._dp
res = res-(g1*g2*vu*dZP(gt1,2)*Sin(TW))/2._dp
res = res+(dSinTW*g1*g2*vd*ZP(gt1,1))/2._dp
res = res+(dvd*g1*g2*Sin(TW)*ZP(gt1,1))/2._dp
res = res+(dg2*g1*vd*Sin(TW)*ZP(gt1,1))/2._dp
res = res+(dg1*g2*vd*Sin(TW)*ZP(gt1,1))/2._dp
res = res-(dSinTW*g1*g2*vu*ZP(gt1,2))/2._dp
res = res-(dvu*g1*g2*Sin(TW)*ZP(gt1,2))/2._dp
res = res-(dg2*g1*vu*Sin(TW)*ZP(gt1,2))/2._dp
res = res-(dg1*g2*vu*Sin(TW)*ZP(gt1,2))/2._dp
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcHpmVWmVZ
Subroutine CT_CouplingVGVGVG(g3,dg3,res)
Implicit None
Real(dp), Intent(in) :: g3,dg3
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingVGVGVG'
res = 0._dp
res = res+dg3
res = -(0.,1.)*res
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingVGVGVG
Subroutine CT_CouplingcVWmVPVWm(g2,TW,dg2,dSinTW,dCosTW,dTanTW,res)
Implicit None
Real(dp), Intent(in) :: g2,TW,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcVWmVPVWm'
res = 0._dp
res = res+dSinTW*g2
res = res+dg2*Sin(TW)
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcVWmVPVWm
Subroutine CT_CouplingcVWmVWmVZ(g2,TW,dg2,dSinTW,dCosTW,dTanTW,res)
Implicit None
Real(dp), Intent(in) :: g2,TW,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: res
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcVWmVWmVZ'
res = 0._dp
res = res-(dCosTW*g2)
res = res-(dg2*Cos(TW))
If (Real(res,dp).ne.Real(res,dp)) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcVWmVWmVZ
Subroutine CT_CouplingcChaChaAh(gt1,gt2,gt3,g2,lam,ZA,UM,UP,dg2,dlam,dZA, &
& dUM,dUP,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,ZA(3,3),dg2,dZA(3,3)
Complex(dp), Intent(in) :: lam,UM(2,2),UP(2,2),dlam,dUM(2,2),dUP(2,2)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcChaChaAh'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
resL = resL-((g2*Conjg(UM(gt2,2))*Conjg(UP(gt1,1))*dZA(gt3,1))/sqrt(2._dp))
resL = resL-((g2*Conjg(UM(gt2,1))*Conjg(UP(gt1,2))*dZA(gt3,2))/sqrt(2._dp))
resL = resL+(lam*Conjg(UM(gt2,2))*Conjg(UP(gt1,2))*dZA(gt3,3))/sqrt(2._dp)
resL = resL-((g2*Conjg(dUP(gt1,1))*Conjg(UM(gt2,2))*ZA(gt3,1))/sqrt(2._dp))
resL = resL-((g2*Conjg(dUM(gt2,2))*Conjg(UP(gt1,1))*ZA(gt3,1))/sqrt(2._dp))
resL = resL-((dg2*Conjg(UM(gt2,2))*Conjg(UP(gt1,1))*ZA(gt3,1))/sqrt(2._dp))
resL = resL-((g2*Conjg(dUP(gt1,2))*Conjg(UM(gt2,1))*ZA(gt3,2))/sqrt(2._dp))
resL = resL-((g2*Conjg(dUM(gt2,1))*Conjg(UP(gt1,2))*ZA(gt3,2))/sqrt(2._dp))
resL = resL-((dg2*Conjg(UM(gt2,1))*Conjg(UP(gt1,2))*ZA(gt3,2))/sqrt(2._dp))
resL = resL+(lam*Conjg(dUP(gt1,2))*Conjg(UM(gt2,2))*ZA(gt3,3))/sqrt(2._dp)
resL = resL+(lam*Conjg(dUM(gt2,2))*Conjg(UP(gt1,2))*ZA(gt3,3))/sqrt(2._dp)
resL = resL+(dlam*Conjg(UM(gt2,2))*Conjg(UP(gt1,2))*ZA(gt3,3))/sqrt(2._dp)
resR = 0._dp
resR = resR+(g2*dZA(gt3,1)*UM(gt1,2)*UP(gt2,1))/sqrt(2._dp)
resR = resR+(g2*dZA(gt3,2)*UM(gt1,1)*UP(gt2,2))/sqrt(2._dp)
resR = resR-((Conjg(lam)*dZA(gt3,3)*UM(gt1,2)*UP(gt2,2))/sqrt(2._dp))
resR = resR+(g2*dUP(gt2,1)*UM(gt1,2)*ZA(gt3,1))/sqrt(2._dp)
resR = resR+(g2*dUM(gt1,2)*UP(gt2,1)*ZA(gt3,1))/sqrt(2._dp)
resR = resR+(dg2*UM(gt1,2)*UP(gt2,1)*ZA(gt3,1))/sqrt(2._dp)
resR = resR+(g2*dUP(gt2,2)*UM(gt1,1)*ZA(gt3,2))/sqrt(2._dp)
resR = resR+(g2*dUM(gt1,1)*UP(gt2,2)*ZA(gt3,2))/sqrt(2._dp)
resR = resR+(dg2*UM(gt1,1)*UP(gt2,2)*ZA(gt3,2))/sqrt(2._dp)
resR = resR-((Conjg(lam)*dUP(gt2,2)*UM(gt1,2)*ZA(gt3,3))/sqrt(2._dp))
resR = resR-((Conjg(lam)*dUM(gt1,2)*UP(gt2,2)*ZA(gt3,3))/sqrt(2._dp))
resR = resR-((Conjg(dlam)*UM(gt1,2)*UP(gt2,2)*ZA(gt3,3))/sqrt(2._dp))
resL = -(0.,1.)*resL
resR = -(0.,1.)*resR
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcChaChaAh
Subroutine CT_CouplingChiChiAh(gt1,gt2,gt3,g1,g2,lam,kap,ZA,ZN,dg1,dg2, &
& dlam,dkap,dZA,dZN,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,ZA(3,3),dg1,dg2,dZA(3,3)
Complex(dp), Intent(in) :: lam,kap,ZN(5,5),dlam,dkap,dZN(5,5)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingChiChiAh'
If ((gt1.Lt.1).Or.(gt1.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
resL = resL+(g1*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,1))*dZA(gt3,1))/2._dp
resL = resL-(g2*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,2))*dZA(gt3,1))/2._dp
resL = resL+(g1*Conjg(ZN(gt1,1))*Conjg(ZN(gt2,3))*dZA(gt3,1))/2._dp
resL = resL-(g2*Conjg(ZN(gt1,2))*Conjg(ZN(gt2,3))*dZA(gt3,1))/2._dp
resL = resL-((lam*Conjg(ZN(gt1,5))*Conjg(ZN(gt2,4))*dZA(gt3,1))/sqrt(2._dp))
resL = resL-((lam*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,5))*dZA(gt3,1))/sqrt(2._dp))
resL = resL-(g1*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,1))*dZA(gt3,2))/2._dp
resL = resL+(g2*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,2))*dZA(gt3,2))/2._dp
resL = resL-((lam*Conjg(ZN(gt1,5))*Conjg(ZN(gt2,3))*dZA(gt3,2))/sqrt(2._dp))
resL = resL-(g1*Conjg(ZN(gt1,1))*Conjg(ZN(gt2,4))*dZA(gt3,2))/2._dp
resL = resL+(g2*Conjg(ZN(gt1,2))*Conjg(ZN(gt2,4))*dZA(gt3,2))/2._dp
resL = resL-((lam*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,5))*dZA(gt3,2))/sqrt(2._dp))
resL = resL-((lam*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,3))*dZA(gt3,3))/sqrt(2._dp))
resL = resL-((lam*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,4))*dZA(gt3,3))/sqrt(2._dp))
resL = resL+sqrt(2._dp)*kap*Conjg(ZN(gt1,5))*Conjg(ZN(gt2,5))*dZA(gt3,3)
resL = resL+(g1*Conjg(dZN(gt2,3))*Conjg(ZN(gt1,1))*ZA(gt3,1))/2._dp
resL = resL-(g2*Conjg(dZN(gt2,3))*Conjg(ZN(gt1,2))*ZA(gt3,1))/2._dp
resL = resL+(g1*Conjg(dZN(gt2,1))*Conjg(ZN(gt1,3))*ZA(gt3,1))/2._dp
resL = resL-(g2*Conjg(dZN(gt2,2))*Conjg(ZN(gt1,3))*ZA(gt3,1))/2._dp
resL = resL-((lam*Conjg(dZN(gt2,5))*Conjg(ZN(gt1,4))*ZA(gt3,1))/sqrt(2._dp))
resL = resL-((lam*Conjg(dZN(gt2,4))*Conjg(ZN(gt1,5))*ZA(gt3,1))/sqrt(2._dp))
resL = resL+(g1*Conjg(dZN(gt1,3))*Conjg(ZN(gt2,1))*ZA(gt3,1))/2._dp
resL = resL+(dg1*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,1))*ZA(gt3,1))/2._dp
resL = resL-(g2*Conjg(dZN(gt1,3))*Conjg(ZN(gt2,2))*ZA(gt3,1))/2._dp
resL = resL-(dg2*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,2))*ZA(gt3,1))/2._dp
resL = resL+(g1*Conjg(dZN(gt1,1))*Conjg(ZN(gt2,3))*ZA(gt3,1))/2._dp
resL = resL-(g2*Conjg(dZN(gt1,2))*Conjg(ZN(gt2,3))*ZA(gt3,1))/2._dp
resL = resL+(dg1*Conjg(ZN(gt1,1))*Conjg(ZN(gt2,3))*ZA(gt3,1))/2._dp
resL = resL-(dg2*Conjg(ZN(gt1,2))*Conjg(ZN(gt2,3))*ZA(gt3,1))/2._dp
resL = resL-((lam*Conjg(dZN(gt1,5))*Conjg(ZN(gt2,4))*ZA(gt3,1))/sqrt(2._dp))
resL = resL-((dlam*Conjg(ZN(gt1,5))*Conjg(ZN(gt2,4))*ZA(gt3,1))/sqrt(2._dp))
resL = resL-((lam*Conjg(dZN(gt1,4))*Conjg(ZN(gt2,5))*ZA(gt3,1))/sqrt(2._dp))
resL = resL-((dlam*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,5))*ZA(gt3,1))/sqrt(2._dp))
resL = resL-(g1*Conjg(dZN(gt2,4))*Conjg(ZN(gt1,1))*ZA(gt3,2))/2._dp
resL = resL+(g2*Conjg(dZN(gt2,4))*Conjg(ZN(gt1,2))*ZA(gt3,2))/2._dp
resL = resL-((lam*Conjg(dZN(gt2,5))*Conjg(ZN(gt1,3))*ZA(gt3,2))/sqrt(2._dp))
resL = resL-(g1*Conjg(dZN(gt2,1))*Conjg(ZN(gt1,4))*ZA(gt3,2))/2._dp
resL = resL+(g2*Conjg(dZN(gt2,2))*Conjg(ZN(gt1,4))*ZA(gt3,2))/2._dp
resL = resL-((lam*Conjg(dZN(gt2,3))*Conjg(ZN(gt1,5))*ZA(gt3,2))/sqrt(2._dp))
resL = resL-(g1*Conjg(dZN(gt1,4))*Conjg(ZN(gt2,1))*ZA(gt3,2))/2._dp
resL = resL-(dg1*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,1))*ZA(gt3,2))/2._dp
resL = resL+(g2*Conjg(dZN(gt1,4))*Conjg(ZN(gt2,2))*ZA(gt3,2))/2._dp
resL = resL+(dg2*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,2))*ZA(gt3,2))/2._dp
resL = resL-((lam*Conjg(dZN(gt1,5))*Conjg(ZN(gt2,3))*ZA(gt3,2))/sqrt(2._dp))
resL = resL-((dlam*Conjg(ZN(gt1,5))*Conjg(ZN(gt2,3))*ZA(gt3,2))/sqrt(2._dp))
resL = resL-(g1*Conjg(dZN(gt1,1))*Conjg(ZN(gt2,4))*ZA(gt3,2))/2._dp
resL = resL+(g2*Conjg(dZN(gt1,2))*Conjg(ZN(gt2,4))*ZA(gt3,2))/2._dp
resL = resL-(dg1*Conjg(ZN(gt1,1))*Conjg(ZN(gt2,4))*ZA(gt3,2))/2._dp
resL = resL+(dg2*Conjg(ZN(gt1,2))*Conjg(ZN(gt2,4))*ZA(gt3,2))/2._dp
resL = resL-((lam*Conjg(dZN(gt1,3))*Conjg(ZN(gt2,5))*ZA(gt3,2))/sqrt(2._dp))
resL = resL-((dlam*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,5))*ZA(gt3,2))/sqrt(2._dp))
resL = resL-((lam*Conjg(dZN(gt2,4))*Conjg(ZN(gt1,3))*ZA(gt3,3))/sqrt(2._dp))
resL = resL-((lam*Conjg(dZN(gt2,3))*Conjg(ZN(gt1,4))*ZA(gt3,3))/sqrt(2._dp))
resL = resL+sqrt(2._dp)*kap*Conjg(dZN(gt2,5))*Conjg(ZN(gt1,5))*ZA(gt3,3)
resL = resL-((lam*Conjg(dZN(gt1,4))*Conjg(ZN(gt2,3))*ZA(gt3,3))/sqrt(2._dp))
resL = resL-((dlam*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,3))*ZA(gt3,3))/sqrt(2._dp))
resL = resL-((lam*Conjg(dZN(gt1,3))*Conjg(ZN(gt2,4))*ZA(gt3,3))/sqrt(2._dp))
resL = resL-((dlam*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,4))*ZA(gt3,3))/sqrt(2._dp))
resL = resL+sqrt(2._dp)*kap*Conjg(dZN(gt1,5))*Conjg(ZN(gt2,5))*ZA(gt3,3)
resL = resL+sqrt(2._dp)*dkap*Conjg(ZN(gt1,5))*Conjg(ZN(gt2,5))*ZA(gt3,3)
resR = 0._dp
resR = resR-(g1*dZN(gt2,3)*ZA(gt3,1)*ZN(gt1,1))/2._dp
resR = resR+(g1*dZN(gt2,4)*ZA(gt3,2)*ZN(gt1,1))/2._dp
resR = resR+(g2*dZN(gt2,3)*ZA(gt3,1)*ZN(gt1,2))/2._dp
resR = resR-(g2*dZN(gt2,4)*ZA(gt3,2)*ZN(gt1,2))/2._dp
resR = resR-(g1*dZN(gt2,1)*ZA(gt3,1)*ZN(gt1,3))/2._dp
resR = resR+(g2*dZN(gt2,2)*ZA(gt3,1)*ZN(gt1,3))/2._dp
resR = resR+(Conjg(lam)*dZN(gt2,5)*ZA(gt3,2)*ZN(gt1,3))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt2,4)*ZA(gt3,3)*ZN(gt1,3))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt2,5)*ZA(gt3,1)*ZN(gt1,4))/sqrt(2._dp)
resR = resR+(g1*dZN(gt2,1)*ZA(gt3,2)*ZN(gt1,4))/2._dp
resR = resR-(g2*dZN(gt2,2)*ZA(gt3,2)*ZN(gt1,4))/2._dp
resR = resR+(Conjg(lam)*dZN(gt2,3)*ZA(gt3,3)*ZN(gt1,4))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt2,4)*ZA(gt3,1)*ZN(gt1,5))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt2,3)*ZA(gt3,2)*ZN(gt1,5))/sqrt(2._dp)
resR = resR-(sqrt(2._dp)*Conjg(kap)*dZN(gt2,5)*ZA(gt3,3)*ZN(gt1,5))
resR = resR-(g1*dZN(gt1,3)*ZA(gt3,1)*ZN(gt2,1))/2._dp
resR = resR+(g1*dZN(gt1,4)*ZA(gt3,2)*ZN(gt2,1))/2._dp
resR = resR-(g1*dZA(gt3,1)*ZN(gt1,3)*ZN(gt2,1))/2._dp
resR = resR-(dg1*ZA(gt3,1)*ZN(gt1,3)*ZN(gt2,1))/2._dp
resR = resR+(g1*dZA(gt3,2)*ZN(gt1,4)*ZN(gt2,1))/2._dp
resR = resR+(dg1*ZA(gt3,2)*ZN(gt1,4)*ZN(gt2,1))/2._dp
resR = resR+(g2*dZN(gt1,3)*ZA(gt3,1)*ZN(gt2,2))/2._dp
resR = resR-(g2*dZN(gt1,4)*ZA(gt3,2)*ZN(gt2,2))/2._dp
resR = resR+(g2*dZA(gt3,1)*ZN(gt1,3)*ZN(gt2,2))/2._dp
resR = resR+(dg2*ZA(gt3,1)*ZN(gt1,3)*ZN(gt2,2))/2._dp
resR = resR-(g2*dZA(gt3,2)*ZN(gt1,4)*ZN(gt2,2))/2._dp
resR = resR-(dg2*ZA(gt3,2)*ZN(gt1,4)*ZN(gt2,2))/2._dp
resR = resR-(g1*dZN(gt1,1)*ZA(gt3,1)*ZN(gt2,3))/2._dp
resR = resR+(g2*dZN(gt1,2)*ZA(gt3,1)*ZN(gt2,3))/2._dp
resR = resR+(Conjg(lam)*dZN(gt1,5)*ZA(gt3,2)*ZN(gt2,3))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt1,4)*ZA(gt3,3)*ZN(gt2,3))/sqrt(2._dp)
resR = resR-(g1*dZA(gt3,1)*ZN(gt1,1)*ZN(gt2,3))/2._dp
resR = resR-(dg1*ZA(gt3,1)*ZN(gt1,1)*ZN(gt2,3))/2._dp
resR = resR+(g2*dZA(gt3,1)*ZN(gt1,2)*ZN(gt2,3))/2._dp
resR = resR+(dg2*ZA(gt3,1)*ZN(gt1,2)*ZN(gt2,3))/2._dp
resR = resR+(Conjg(lam)*dZA(gt3,3)*ZN(gt1,4)*ZN(gt2,3))/sqrt(2._dp)
resR = resR+(Conjg(dlam)*ZA(gt3,3)*ZN(gt1,4)*ZN(gt2,3))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZA(gt3,2)*ZN(gt1,5)*ZN(gt2,3))/sqrt(2._dp)
resR = resR+(Conjg(dlam)*ZA(gt3,2)*ZN(gt1,5)*ZN(gt2,3))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt1,5)*ZA(gt3,1)*ZN(gt2,4))/sqrt(2._dp)
resR = resR+(g1*dZN(gt1,1)*ZA(gt3,2)*ZN(gt2,4))/2._dp
resR = resR-(g2*dZN(gt1,2)*ZA(gt3,2)*ZN(gt2,4))/2._dp
resR = resR+(Conjg(lam)*dZN(gt1,3)*ZA(gt3,3)*ZN(gt2,4))/sqrt(2._dp)
resR = resR+(g1*dZA(gt3,2)*ZN(gt1,1)*ZN(gt2,4))/2._dp
resR = resR+(dg1*ZA(gt3,2)*ZN(gt1,1)*ZN(gt2,4))/2._dp
resR = resR-(g2*dZA(gt3,2)*ZN(gt1,2)*ZN(gt2,4))/2._dp
resR = resR-(dg2*ZA(gt3,2)*ZN(gt1,2)*ZN(gt2,4))/2._dp
resR = resR+(Conjg(lam)*dZA(gt3,3)*ZN(gt1,3)*ZN(gt2,4))/sqrt(2._dp)
resR = resR+(Conjg(dlam)*ZA(gt3,3)*ZN(gt1,3)*ZN(gt2,4))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZA(gt3,1)*ZN(gt1,5)*ZN(gt2,4))/sqrt(2._dp)
resR = resR+(Conjg(dlam)*ZA(gt3,1)*ZN(gt1,5)*ZN(gt2,4))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt1,4)*ZA(gt3,1)*ZN(gt2,5))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt1,3)*ZA(gt3,2)*ZN(gt2,5))/sqrt(2._dp)
resR = resR-(sqrt(2._dp)*Conjg(kap)*dZN(gt1,5)*ZA(gt3,3)*ZN(gt2,5))
resR = resR+(Conjg(lam)*dZA(gt3,2)*ZN(gt1,3)*ZN(gt2,5))/sqrt(2._dp)
resR = resR+(Conjg(dlam)*ZA(gt3,2)*ZN(gt1,3)*ZN(gt2,5))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZA(gt3,1)*ZN(gt1,4)*ZN(gt2,5))/sqrt(2._dp)
resR = resR+(Conjg(dlam)*ZA(gt3,1)*ZN(gt1,4)*ZN(gt2,5))/sqrt(2._dp)
resR = resR-(sqrt(2._dp)*Conjg(kap)*dZA(gt3,3)*ZN(gt1,5)*ZN(gt2,5))
resR = resR-(sqrt(2._dp)*Conjg(dkap)*ZA(gt3,3)*ZN(gt1,5)*ZN(gt2,5))
resL = -(0.,1.)*resL
resR = -(0.,1.)*resR
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingChiChiAh
Subroutine CT_CouplingcFdFdAh(gt1,gt2,gt3,Yd,ZA,ZDL,ZDR,dYd,dZA,dZDL,dZDR, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: ZA(3,3),dZA(3,3)
Complex(dp), Intent(in) :: Yd(3,3),ZDL(3,3),ZDR(3,3),dYd(3,3),dZDL(3,3),dZDR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFdFdAh'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(ZDL(gt2,j2))*Conjg(ZDR(gt1,j1))*dZA(gt3,1)*Yd(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(ZDL(gt2,j2))*Conjg(ZDR(gt1,j1))*dYd(j1,j2)*ZA(gt3,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZDR(gt1,j1))*Conjg(ZDL(gt2,j2))*Yd(j1,j2)*ZA(gt3,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZDL(gt2,j2))*Conjg(ZDR(gt1,j1))*Yd(j1,j2)*ZA(gt3,1))/sqrt(2._dp)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yd(j1,j2))*dZDR(gt2,j1)*ZA(gt3,1)*ZDL(gt1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yd(j1,j2))*dZDL(gt1,j2)*ZA(gt3,1)*ZDR(gt2,j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yd(j1,j2))*dZA(gt3,1)*ZDL(gt1,j2)*ZDR(gt2,j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYd(j1,j2))*ZA(gt3,1)*ZDL(gt1,j2)*ZDR(gt2,j1))/sqrt(2._dp))
End Do
End Do
resL = -(0.,1.)*resL
resR = -(0.,1.)*resR
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFdFdAh
Subroutine CT_CouplingcFeFeAh(gt1,gt2,gt3,Ye,ZA,ZEL,ZER,dYe,dZA,dZEL,dZER, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: ZA(3,3),dZA(3,3)
Complex(dp), Intent(in) :: Ye(3,3),ZEL(3,3),ZER(3,3),dYe(3,3),dZEL(3,3),dZER(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFeFeAh'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(ZEL(gt2,j2))*Conjg(ZER(gt1,j1))*dZA(gt3,1)*Ye(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(ZEL(gt2,j2))*Conjg(ZER(gt1,j1))*dYe(j1,j2)*ZA(gt3,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZER(gt1,j1))*Conjg(ZEL(gt2,j2))*Ye(j1,j2)*ZA(gt3,1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZEL(gt2,j2))*Conjg(ZER(gt1,j1))*Ye(j1,j2)*ZA(gt3,1))/sqrt(2._dp)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Ye(j1,j2))*dZER(gt2,j1)*ZA(gt3,1)*ZEL(gt1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Ye(j1,j2))*dZEL(gt1,j2)*ZA(gt3,1)*ZER(gt2,j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Ye(j1,j2))*dZA(gt3,1)*ZEL(gt1,j2)*ZER(gt2,j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYe(j1,j2))*ZA(gt3,1)*ZEL(gt1,j2)*ZER(gt2,j1))/sqrt(2._dp))
End Do
End Do
resL = -(0.,1.)*resL
resR = -(0.,1.)*resR
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFeFeAh
Subroutine CT_CouplingcFuFuAh(gt1,gt2,gt3,Yu,ZA,ZUL,ZUR,dYu,dZA,dZUL,dZUR, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: ZA(3,3),dZA(3,3)
Complex(dp), Intent(in) :: Yu(3,3),ZUL(3,3),ZUR(3,3),dYu(3,3),dZUL(3,3),dZUR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFuFuAh'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(ZUL(gt2,j2))*Conjg(ZUR(gt1,j1))*dZA(gt3,2)*Yu(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(ZUL(gt2,j2))*Conjg(ZUR(gt1,j1))*dYu(j1,j2)*ZA(gt3,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZUR(gt1,j1))*Conjg(ZUL(gt2,j2))*Yu(j1,j2)*ZA(gt3,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZUL(gt2,j2))*Conjg(ZUR(gt1,j1))*Yu(j1,j2)*ZA(gt3,2))/sqrt(2._dp)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yu(j1,j2))*dZUR(gt2,j1)*ZA(gt3,2)*ZUL(gt1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yu(j1,j2))*dZUL(gt1,j2)*ZA(gt3,2)*ZUR(gt2,j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yu(j1,j2))*dZA(gt3,2)*ZUL(gt1,j2)*ZUR(gt2,j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYu(j1,j2))*ZA(gt3,2)*ZUL(gt1,j2)*ZUR(gt2,j1))/sqrt(2._dp))
End Do
End Do
resL = -(0.,1.)*resL
resR = -(0.,1.)*resR
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFuFuAh
Subroutine CT_CouplingFvFvAh(gt1,gt2,gt3,lamN,Yv,ZA,UV,dlamN,dYv,dZA,dUV, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: ZA(3,3),dZA(3,3)
Complex(dp), Intent(in) :: lamN(3,3),Yv(3,3),UV(9,9),dlamN(3,3),dYv(3,3),dUV(9,9)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingFvFvAh'
If ((gt1.Lt.1).Or.(gt1.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UV(gt1,j2))*Conjg(UV(gt2,3 + j1))*dZA(gt3,2)*Yv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UV(gt1,3 + j1))*Conjg(UV(gt2,j2))*dZA(gt3,2)*Yv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UV(gt1,j2))*Conjg(UV(gt2,3 + j1))*dYv(j1,j2)*ZA(gt3,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UV(gt1,3 + j1))*Conjg(UV(gt2,j2))*dYv(j1,j2)*ZA(gt3,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUV(gt2,j2))*Conjg(UV(gt1,3 + j1))*Yv(j1,j2)*ZA(gt3,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUV(gt2,3 + j1))*Conjg(UV(gt1,j2))*Yv(j1,j2)*ZA(gt3,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUV(gt1,j2))*Conjg(UV(gt2,3 + j1))*Yv(j1,j2)*ZA(gt3,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUV(gt1,3 + j1))*Conjg(UV(gt2,j2))*Yv(j1,j2)*ZA(gt3,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UV(gt1,6 + j2))*Conjg(UV(gt2,3 + j1))*dlamN(j1,j2)*ZA(gt3,3))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UV(gt1,3 + j1))*Conjg(UV(gt2,6 + j2))*dlamN(j1,j2)*ZA(gt3,3))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UV(gt1,6 + j2))*Conjg(UV(gt2,3 + j1))*dZA(gt3,3)*lamN(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UV(gt1,3 + j1))*Conjg(UV(gt2,6 + j2))*dZA(gt3,3)*lamN(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUV(gt2,6 + j2))*Conjg(UV(gt1,3 + j1))*ZA(gt3,3)*lamN(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUV(gt2,3 + j1))*Conjg(UV(gt1,6 + j2))*ZA(gt3,3)*lamN(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUV(gt1,6 + j2))*Conjg(UV(gt2,3 + j1))*ZA(gt3,3)*lamN(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUV(gt1,3 + j1))*Conjg(UV(gt2,6 + j2))*ZA(gt3,3)*lamN(j1,j2))/sqrt(2._dp)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*dZA(gt3,2)*UV(gt1,j2)*UV(gt2,3 + j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(lamN(j1,j2))*dZA(gt3,3)*UV(gt1,6 + j2)*UV(gt2,3 + j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*dZA(gt3,2)*UV(gt1,3 + j1)*UV(gt2,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(lamN(j1,j2))*dZA(gt3,3)*UV(gt1,3 + j1)*UV(gt2,6 + j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*dUV(gt2,j2)*UV(gt1,3 + j1)*ZA(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*dUV(gt2,3 + j1)*UV(gt1,j2)*ZA(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*dUV(gt1,j2)*UV(gt2,3 + j1)*ZA(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYv(j1,j2))*UV(gt1,j2)*UV(gt2,3 + j1)*ZA(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*dUV(gt1,3 + j1)*UV(gt2,j2)*ZA(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYv(j1,j2))*UV(gt1,3 + j1)*UV(gt2,j2)*ZA(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(lamN(j1,j2))*dUV(gt2,6 + j2)*UV(gt1,3 + j1)*ZA(gt3,3))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(lamN(j1,j2))*dUV(gt2,3 + j1)*UV(gt1,6 + j2)*ZA(gt3,3))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(lamN(j1,j2))*dUV(gt1,6 + j2)*UV(gt2,3 + j1)*ZA(gt3,3))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dlamN(j1,j2))*UV(gt1,6 + j2)*UV(gt2,3 + j1)*ZA(gt3,3))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(lamN(j1,j2))*dUV(gt1,3 + j1)*UV(gt2,6 + j2)*ZA(gt3,3))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dlamN(j1,j2))*UV(gt1,3 + j1)*UV(gt2,6 + j2)*ZA(gt3,3))/sqrt(2._dp))
End Do
End Do
resL = -(0.,1.)*resL
resR = -(0.,1.)*resR
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingFvFvAh
Subroutine CT_CouplingChiChacHpm(gt1,gt2,gt3,g1,g2,lam,ZP,ZN,UM,UP,dg1, &
& dg2,dlam,dZP,dZN,dUM,dUP,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,ZP(2,2),dg1,dg2,dZP(2,2)
Complex(dp), Intent(in) :: lam,ZN(5,5),UM(2,2),UP(2,2),dlam,dZN(5,5),dUM(2,2),dUP(2,2)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingChiChacHpm'
If ((gt1.Lt.1).Or.(gt1.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
resL = resL+(g1*Conjg(UM(gt2,2))*Conjg(ZN(gt1,1))*dZP(gt3,1))/sqrt(2._dp)
resL = resL+(g2*Conjg(UM(gt2,2))*Conjg(ZN(gt1,2))*dZP(gt3,1))/sqrt(2._dp)
resL = resL-(g2*Conjg(UM(gt2,1))*Conjg(ZN(gt1,3))*dZP(gt3,1))
resL = resL-(lam*Conjg(UM(gt2,2))*Conjg(ZN(gt1,5))*dZP(gt3,2))
resL = resL-(g2*Conjg(dZN(gt1,3))*Conjg(UM(gt2,1))*ZP(gt3,1))
resL = resL+(g1*Conjg(dZN(gt1,1))*Conjg(UM(gt2,2))*ZP(gt3,1))/sqrt(2._dp)
resL = resL+(g2*Conjg(dZN(gt1,2))*Conjg(UM(gt2,2))*ZP(gt3,1))/sqrt(2._dp)
resL = resL+(g1*Conjg(dUM(gt2,2))*Conjg(ZN(gt1,1))*ZP(gt3,1))/sqrt(2._dp)
resL = resL+(dg1*Conjg(UM(gt2,2))*Conjg(ZN(gt1,1))*ZP(gt3,1))/sqrt(2._dp)
resL = resL+(g2*Conjg(dUM(gt2,2))*Conjg(ZN(gt1,2))*ZP(gt3,1))/sqrt(2._dp)
resL = resL+(dg2*Conjg(UM(gt2,2))*Conjg(ZN(gt1,2))*ZP(gt3,1))/sqrt(2._dp)
resL = resL-(g2*Conjg(dUM(gt2,1))*Conjg(ZN(gt1,3))*ZP(gt3,1))
resL = resL-(dg2*Conjg(UM(gt2,1))*Conjg(ZN(gt1,3))*ZP(gt3,1))
resL = resL-(lam*Conjg(dZN(gt1,5))*Conjg(UM(gt2,2))*ZP(gt3,2))
resL = resL-(lam*Conjg(dUM(gt2,2))*Conjg(ZN(gt1,5))*ZP(gt3,2))
resL = resL-(dlam*Conjg(UM(gt2,2))*Conjg(ZN(gt1,5))*ZP(gt3,2))
resR = 0._dp
resR = resR-((g1*dZP(gt3,2)*UP(gt2,2)*ZN(gt1,1))/sqrt(2._dp))
resR = resR-((g2*dZP(gt3,2)*UP(gt2,2)*ZN(gt1,2))/sqrt(2._dp))
resR = resR-(g2*dZP(gt3,2)*UP(gt2,1)*ZN(gt1,4))
resR = resR-(Conjg(lam)*dZP(gt3,1)*UP(gt2,2)*ZN(gt1,5))
resR = resR-(Conjg(lam)*dZN(gt1,5)*UP(gt2,2)*ZP(gt3,1))
resR = resR-(Conjg(lam)*dUP(gt2,2)*ZN(gt1,5)*ZP(gt3,1))
resR = resR-(Conjg(dlam)*UP(gt2,2)*ZN(gt1,5)*ZP(gt3,1))
resR = resR-(g2*dZN(gt1,4)*UP(gt2,1)*ZP(gt3,2))
resR = resR-((g1*dZN(gt1,1)*UP(gt2,2)*ZP(gt3,2))/sqrt(2._dp))
resR = resR-((g2*dZN(gt1,2)*UP(gt2,2)*ZP(gt3,2))/sqrt(2._dp))
resR = resR-((g1*dUP(gt2,2)*ZN(gt1,1)*ZP(gt3,2))/sqrt(2._dp))
resR = resR-((dg1*UP(gt2,2)*ZN(gt1,1)*ZP(gt3,2))/sqrt(2._dp))
resR = resR-((g2*dUP(gt2,2)*ZN(gt1,2)*ZP(gt3,2))/sqrt(2._dp))
resR = resR-((dg2*UP(gt2,2)*ZN(gt1,2)*ZP(gt3,2))/sqrt(2._dp))
resR = resR-(g2*dUP(gt2,1)*ZN(gt1,4)*ZP(gt3,2))
resR = resR-(dg2*UP(gt2,1)*ZN(gt1,4)*ZP(gt3,2))
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingChiChacHpm
Subroutine CT_CouplingChaFucSd(gt1,gt2,gt3,g2,Yd,Yu,ZD,UM,UP,ZUL,ZUR,dg2, &
& dYd,dYu,dZD,dUM,dUP,dZUL,dZUR,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: Yd(3,3),Yu(3,3),ZD(6,6),UM(2,2),UP(2,2),ZUL(3,3),ZUR(3,3),dYd(3,3),dYu(3,3), &
& dZD(6,6),dUM(2,2),dUP(2,2),dZUL(3,3),dZUR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingChaFucSd'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-(g2*Conjg(UM(gt1,1))*Conjg(ZUL(gt2,j1))*dZD(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dZUL(gt2,j1))*Conjg(UM(gt1,1))*ZD(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dUM(gt1,1))*Conjg(ZUL(gt2,j1))*ZD(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(dg2*Conjg(UM(gt1,1))*Conjg(ZUL(gt2,j1))*ZD(gt3,j1))
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UM(gt1,2))*Conjg(ZUL(gt2,j2))*dZD(gt3,3 + j1)*Yd(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UM(gt1,2))*Conjg(ZUL(gt2,j2))*dYd(j1,j2)*ZD(gt3,3 + j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZUL(gt2,j2))*Conjg(UM(gt1,2))*Yd(j1,j2)*ZD(gt3,3 + j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dUM(gt1,2))*Conjg(ZUL(gt2,j2))*Yd(j1,j2)*ZD(gt3,3 + j1)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yu(j1,j2))*dZUR(gt2,j1)*UP(gt1,2)*ZD(gt3,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yu(j1,j2))*dZD(gt3,j2)*UP(gt1,2)*ZUR(gt2,j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yu(j1,j2))*dUP(gt1,2)*ZD(gt3,j2)*ZUR(gt2,j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dYu(j1,j2))*UP(gt1,2)*ZD(gt3,j2)*ZUR(gt2,j1)
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingChaFucSd
Subroutine CT_CouplingFvChacSe(gt1,gt2,gt3,g2,Ye,Yv,ZE,UV,UM,UP,dg2,dYe, &
& dYv,dZE,dUV,dUM,dUP,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: Ye(3,3),Yv(3,3),ZE(6,6),UV(9,9),UM(2,2),UP(2,2),dYe(3,3),dYv(3,3),dZE(6,6), &
& dUV(9,9),dUM(2,2),dUP(2,2)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingFvChacSe'
If ((gt1.Lt.1).Or.(gt1.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-(g2*Conjg(UM(gt2,1))*Conjg(UV(gt1,j1))*dZE(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dUV(gt1,j1))*Conjg(UM(gt2,1))*ZE(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dUM(gt2,1))*Conjg(UV(gt1,j1))*ZE(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(dg2*Conjg(UM(gt2,1))*Conjg(UV(gt1,j1))*ZE(gt3,j1))
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UM(gt2,2))*Conjg(UV(gt1,j2))*dZE(gt3,3 + j1)*Ye(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UM(gt2,2))*Conjg(UV(gt1,j2))*dYe(j1,j2)*ZE(gt3,3 + j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dUV(gt1,j2))*Conjg(UM(gt2,2))*Ye(j1,j2)*ZE(gt3,3 + j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dUM(gt2,2))*Conjg(UV(gt1,j2))*Ye(j1,j2)*ZE(gt3,3 + j1)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yv(j1,j2))*dZE(gt3,j2)*UP(gt2,2)*UV(gt1,3 + j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yv(j1,j2))*dUV(gt1,3 + j1)*UP(gt2,2)*ZE(gt3,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yv(j1,j2))*dUP(gt2,2)*UV(gt1,3 + j1)*ZE(gt3,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dYv(j1,j2))*UP(gt2,2)*UV(gt1,3 + j1)*ZE(gt3,j2)
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingFvChacSe
Subroutine CT_CouplingcChaChahh(gt1,gt2,gt3,g2,lam,ZH,UM,UP,dg2,dlam,dZH, &
& dUM,dUP,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,ZH(3,3),dg2,dZH(3,3)
Complex(dp), Intent(in) :: lam,UM(2,2),UP(2,2),dlam,dUM(2,2),dUP(2,2)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcChaChahh'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
resL = resL-((g2*Conjg(UM(gt2,2))*Conjg(UP(gt1,1))*dZH(gt3,1))/sqrt(2._dp))
resL = resL-((g2*Conjg(UM(gt2,1))*Conjg(UP(gt1,2))*dZH(gt3,2))/sqrt(2._dp))
resL = resL-((lam*Conjg(UM(gt2,2))*Conjg(UP(gt1,2))*dZH(gt3,3))/sqrt(2._dp))
resL = resL-((g2*Conjg(dUP(gt1,1))*Conjg(UM(gt2,2))*ZH(gt3,1))/sqrt(2._dp))
resL = resL-((g2*Conjg(dUM(gt2,2))*Conjg(UP(gt1,1))*ZH(gt3,1))/sqrt(2._dp))
resL = resL-((dg2*Conjg(UM(gt2,2))*Conjg(UP(gt1,1))*ZH(gt3,1))/sqrt(2._dp))
resL = resL-((g2*Conjg(dUP(gt1,2))*Conjg(UM(gt2,1))*ZH(gt3,2))/sqrt(2._dp))
resL = resL-((g2*Conjg(dUM(gt2,1))*Conjg(UP(gt1,2))*ZH(gt3,2))/sqrt(2._dp))
resL = resL-((dg2*Conjg(UM(gt2,1))*Conjg(UP(gt1,2))*ZH(gt3,2))/sqrt(2._dp))
resL = resL-((lam*Conjg(dUP(gt1,2))*Conjg(UM(gt2,2))*ZH(gt3,3))/sqrt(2._dp))
resL = resL-((lam*Conjg(dUM(gt2,2))*Conjg(UP(gt1,2))*ZH(gt3,3))/sqrt(2._dp))
resL = resL-((dlam*Conjg(UM(gt2,2))*Conjg(UP(gt1,2))*ZH(gt3,3))/sqrt(2._dp))
resR = 0._dp
resR = resR-((g2*dZH(gt3,1)*UM(gt1,2)*UP(gt2,1))/sqrt(2._dp))
resR = resR-((g2*dZH(gt3,2)*UM(gt1,1)*UP(gt2,2))/sqrt(2._dp))
resR = resR-((Conjg(lam)*dZH(gt3,3)*UM(gt1,2)*UP(gt2,2))/sqrt(2._dp))
resR = resR-((g2*dUP(gt2,1)*UM(gt1,2)*ZH(gt3,1))/sqrt(2._dp))
resR = resR-((g2*dUM(gt1,2)*UP(gt2,1)*ZH(gt3,1))/sqrt(2._dp))
resR = resR-((dg2*UM(gt1,2)*UP(gt2,1)*ZH(gt3,1))/sqrt(2._dp))
resR = resR-((g2*dUP(gt2,2)*UM(gt1,1)*ZH(gt3,2))/sqrt(2._dp))
resR = resR-((g2*dUM(gt1,1)*UP(gt2,2)*ZH(gt3,2))/sqrt(2._dp))
resR = resR-((dg2*UM(gt1,1)*UP(gt2,2)*ZH(gt3,2))/sqrt(2._dp))
resR = resR-((Conjg(lam)*dUP(gt2,2)*UM(gt1,2)*ZH(gt3,3))/sqrt(2._dp))
resR = resR-((Conjg(lam)*dUM(gt1,2)*UP(gt2,2)*ZH(gt3,3))/sqrt(2._dp))
resR = resR-((Conjg(dlam)*UM(gt1,2)*UP(gt2,2)*ZH(gt3,3))/sqrt(2._dp))
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcChaChahh
Subroutine CT_CouplingcFdChaSu(gt1,gt2,gt3,g2,Yd,Yu,ZU,UM,UP,ZDL,ZDR,dg2, &
& dYd,dYu,dZU,dUM,dUP,dZDL,dZDR,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: Yd(3,3),Yu(3,3),ZU(6,6),UM(2,2),UP(2,2),ZDL(3,3),ZDR(3,3),dYd(3,3),dYu(3,3), &
& dZU(6,6),dUM(2,2),dUP(2,2),dZDL(3,3),dZDR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFdChaSu'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UM(gt2,2))*Conjg(ZDR(gt1,j1))*Conjg(ZU(gt3,j2))*dYd(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZU(gt3,j2))*Conjg(UM(gt2,2))*Conjg(ZDR(gt1,j1))*Yd(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZDR(gt1,j1))*Conjg(UM(gt2,2))*Conjg(ZU(gt3,j2))*Yd(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dUM(gt2,2))*Conjg(ZDR(gt1,j1))*Conjg(ZU(gt3,j2))*Yd(j1,j2)
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR-(g2*Conjg(ZU(gt3,j1))*dZDL(gt1,j1)*UP(gt2,1))
End Do
Do j1 = 1,3
resR = resR-(g2*Conjg(ZU(gt3,j1))*dUP(gt2,1)*ZDL(gt1,j1))
End Do
Do j1 = 1,3
resR = resR-(g2*Conjg(dZU(gt3,j1))*UP(gt2,1)*ZDL(gt1,j1))
End Do
Do j1 = 1,3
resR = resR-(dg2*Conjg(ZU(gt3,j1))*UP(gt2,1)*ZDL(gt1,j1))
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yu(j1,j2))*Conjg(ZU(gt3,3 + j1))*dZDL(gt1,j2)*UP(gt2,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yu(j1,j2))*Conjg(ZU(gt3,3 + j1))*dUP(gt2,2)*ZDL(gt1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dZU(gt3,3 + j1))*Conjg(Yu(j1,j2))*UP(gt2,2)*ZDL(gt1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dYu(j1,j2))*Conjg(ZU(gt3,3 + j1))*UP(gt2,2)*ZDL(gt1,j2)
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFdChaSu
Subroutine CT_CouplingcFeChaSvIm(gt1,gt2,gt3,g2,Ye,Yv,ZVI,UM,UP,ZEL,ZER, &
& dg2,dYe,dYv,dZVI,dUM,dUP,dZEL,dZER,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: Ye(3,3),Yv(3,3),ZVI(9,9),UM(2,2),UP(2,2),ZEL(3,3),ZER(3,3),dYe(3,3),dYv(3,3), &
& dZVI(9,9),dUM(2,2),dUP(2,2),dZEL(3,3),dZER(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFeChaSvIm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UM(gt2,2))*Conjg(ZER(gt1,j1))*Conjg(ZVI(gt3,j2))*dYe(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZVI(gt3,j2))*Conjg(UM(gt2,2))*Conjg(ZER(gt1,j1))*Ye(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZER(gt1,j1))*Conjg(UM(gt2,2))*Conjg(ZVI(gt3,j2))*Ye(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUM(gt2,2))*Conjg(ZER(gt1,j1))*Conjg(ZVI(gt3,j2))*Ye(j1,j2))/sqrt(2._dp))
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR+(g2*Conjg(ZVI(gt3,j1))*dZEL(gt1,j1)*UP(gt2,1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR+(g2*Conjg(ZVI(gt3,j1))*dUP(gt2,1)*ZEL(gt1,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR+(g2*Conjg(dZVI(gt3,j1))*UP(gt2,1)*ZEL(gt1,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR+(dg2*Conjg(ZVI(gt3,j1))*UP(gt2,1)*ZEL(gt1,j1))/sqrt(2._dp)
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,3 + j1))*dZEL(gt1,j2)*UP(gt2,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,3 + j1))*dUP(gt2,2)*ZEL(gt1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dZVI(gt3,3 + j1))*Conjg(Yv(j1,j2))*UP(gt2,2)*ZEL(gt1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYv(j1,j2))*Conjg(ZVI(gt3,3 + j1))*UP(gt2,2)*ZEL(gt1,j2))/sqrt(2._dp))
End Do
End Do
resL = -(0.,1.)*resL
resR = -(0.,1.)*resR
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFeChaSvIm
Subroutine CT_CouplingcFeChaSvRe(gt1,gt2,gt3,g2,Ye,Yv,ZVR,UM,UP,ZEL,ZER, &
& dg2,dYe,dYv,dZVR,dUM,dUP,dZEL,dZER,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: Ye(3,3),Yv(3,3),ZVR(9,9),UM(2,2),UP(2,2),ZEL(3,3),ZER(3,3),dYe(3,3),dYv(3,3), &
& dZVR(9,9),dUM(2,2),dUP(2,2),dZEL(3,3),dZER(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFeChaSvRe'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UM(gt2,2))*Conjg(ZER(gt1,j1))*Conjg(ZVR(gt3,j2))*dYe(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZVR(gt3,j2))*Conjg(UM(gt2,2))*Conjg(ZER(gt1,j1))*Ye(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZER(gt1,j1))*Conjg(UM(gt2,2))*Conjg(ZVR(gt3,j2))*Ye(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUM(gt2,2))*Conjg(ZER(gt1,j1))*Conjg(ZVR(gt3,j2))*Ye(j1,j2))/sqrt(2._dp)
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR-((g2*Conjg(ZVR(gt3,j1))*dZEL(gt1,j1)*UP(gt2,1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR-((g2*Conjg(ZVR(gt3,j1))*dUP(gt2,1)*ZEL(gt1,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR-((g2*Conjg(dZVR(gt3,j1))*UP(gt2,1)*ZEL(gt1,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR-((dg2*Conjg(ZVR(gt3,j1))*UP(gt2,1)*ZEL(gt1,j1))/sqrt(2._dp))
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*dZEL(gt1,j2)*UP(gt2,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*dUP(gt2,2)*ZEL(gt1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(dZVR(gt3,3 + j1))*Conjg(Yv(j1,j2))*UP(gt2,2)*ZEL(gt1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(dYv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*UP(gt2,2)*ZEL(gt1,j2))/sqrt(2._dp)
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFeChaSvRe
Subroutine CT_CouplingChiChihh(gt1,gt2,gt3,g1,g2,lam,kap,ZH,ZN,dg1,dg2, &
& dlam,dkap,dZH,dZN,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,ZH(3,3),dg1,dg2,dZH(3,3)
Complex(dp), Intent(in) :: lam,kap,ZN(5,5),dlam,dkap,dZN(5,5)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingChiChihh'
If ((gt1.Lt.1).Or.(gt1.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
resL = resL+(g1*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,1))*dZH(gt3,1))/2._dp
resL = resL-(g2*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,2))*dZH(gt3,1))/2._dp
resL = resL+(g1*Conjg(ZN(gt1,1))*Conjg(ZN(gt2,3))*dZH(gt3,1))/2._dp
resL = resL-(g2*Conjg(ZN(gt1,2))*Conjg(ZN(gt2,3))*dZH(gt3,1))/2._dp
resL = resL+(lam*Conjg(ZN(gt1,5))*Conjg(ZN(gt2,4))*dZH(gt3,1))/sqrt(2._dp)
resL = resL+(lam*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,5))*dZH(gt3,1))/sqrt(2._dp)
resL = resL-(g1*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,1))*dZH(gt3,2))/2._dp
resL = resL+(g2*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,2))*dZH(gt3,2))/2._dp
resL = resL+(lam*Conjg(ZN(gt1,5))*Conjg(ZN(gt2,3))*dZH(gt3,2))/sqrt(2._dp)
resL = resL-(g1*Conjg(ZN(gt1,1))*Conjg(ZN(gt2,4))*dZH(gt3,2))/2._dp
resL = resL+(g2*Conjg(ZN(gt1,2))*Conjg(ZN(gt2,4))*dZH(gt3,2))/2._dp
resL = resL+(lam*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,5))*dZH(gt3,2))/sqrt(2._dp)
resL = resL+(lam*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,3))*dZH(gt3,3))/sqrt(2._dp)
resL = resL+(lam*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,4))*dZH(gt3,3))/sqrt(2._dp)
resL = resL-(sqrt(2._dp)*kap*Conjg(ZN(gt1,5))*Conjg(ZN(gt2,5))*dZH(gt3,3))
resL = resL+(g1*Conjg(dZN(gt2,3))*Conjg(ZN(gt1,1))*ZH(gt3,1))/2._dp
resL = resL-(g2*Conjg(dZN(gt2,3))*Conjg(ZN(gt1,2))*ZH(gt3,1))/2._dp
resL = resL+(g1*Conjg(dZN(gt2,1))*Conjg(ZN(gt1,3))*ZH(gt3,1))/2._dp
resL = resL-(g2*Conjg(dZN(gt2,2))*Conjg(ZN(gt1,3))*ZH(gt3,1))/2._dp
resL = resL+(lam*Conjg(dZN(gt2,5))*Conjg(ZN(gt1,4))*ZH(gt3,1))/sqrt(2._dp)
resL = resL+(lam*Conjg(dZN(gt2,4))*Conjg(ZN(gt1,5))*ZH(gt3,1))/sqrt(2._dp)
resL = resL+(g1*Conjg(dZN(gt1,3))*Conjg(ZN(gt2,1))*ZH(gt3,1))/2._dp
resL = resL+(dg1*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,1))*ZH(gt3,1))/2._dp
resL = resL-(g2*Conjg(dZN(gt1,3))*Conjg(ZN(gt2,2))*ZH(gt3,1))/2._dp
resL = resL-(dg2*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,2))*ZH(gt3,1))/2._dp
resL = resL+(g1*Conjg(dZN(gt1,1))*Conjg(ZN(gt2,3))*ZH(gt3,1))/2._dp
resL = resL-(g2*Conjg(dZN(gt1,2))*Conjg(ZN(gt2,3))*ZH(gt3,1))/2._dp
resL = resL+(dg1*Conjg(ZN(gt1,1))*Conjg(ZN(gt2,3))*ZH(gt3,1))/2._dp
resL = resL-(dg2*Conjg(ZN(gt1,2))*Conjg(ZN(gt2,3))*ZH(gt3,1))/2._dp
resL = resL+(lam*Conjg(dZN(gt1,5))*Conjg(ZN(gt2,4))*ZH(gt3,1))/sqrt(2._dp)
resL = resL+(dlam*Conjg(ZN(gt1,5))*Conjg(ZN(gt2,4))*ZH(gt3,1))/sqrt(2._dp)
resL = resL+(lam*Conjg(dZN(gt1,4))*Conjg(ZN(gt2,5))*ZH(gt3,1))/sqrt(2._dp)
resL = resL+(dlam*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,5))*ZH(gt3,1))/sqrt(2._dp)
resL = resL-(g1*Conjg(dZN(gt2,4))*Conjg(ZN(gt1,1))*ZH(gt3,2))/2._dp
resL = resL+(g2*Conjg(dZN(gt2,4))*Conjg(ZN(gt1,2))*ZH(gt3,2))/2._dp
resL = resL+(lam*Conjg(dZN(gt2,5))*Conjg(ZN(gt1,3))*ZH(gt3,2))/sqrt(2._dp)
resL = resL-(g1*Conjg(dZN(gt2,1))*Conjg(ZN(gt1,4))*ZH(gt3,2))/2._dp
resL = resL+(g2*Conjg(dZN(gt2,2))*Conjg(ZN(gt1,4))*ZH(gt3,2))/2._dp
resL = resL+(lam*Conjg(dZN(gt2,3))*Conjg(ZN(gt1,5))*ZH(gt3,2))/sqrt(2._dp)
resL = resL-(g1*Conjg(dZN(gt1,4))*Conjg(ZN(gt2,1))*ZH(gt3,2))/2._dp
resL = resL-(dg1*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,1))*ZH(gt3,2))/2._dp
resL = resL+(g2*Conjg(dZN(gt1,4))*Conjg(ZN(gt2,2))*ZH(gt3,2))/2._dp
resL = resL+(dg2*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,2))*ZH(gt3,2))/2._dp
resL = resL+(lam*Conjg(dZN(gt1,5))*Conjg(ZN(gt2,3))*ZH(gt3,2))/sqrt(2._dp)
resL = resL+(dlam*Conjg(ZN(gt1,5))*Conjg(ZN(gt2,3))*ZH(gt3,2))/sqrt(2._dp)
resL = resL-(g1*Conjg(dZN(gt1,1))*Conjg(ZN(gt2,4))*ZH(gt3,2))/2._dp
resL = resL+(g2*Conjg(dZN(gt1,2))*Conjg(ZN(gt2,4))*ZH(gt3,2))/2._dp
resL = resL-(dg1*Conjg(ZN(gt1,1))*Conjg(ZN(gt2,4))*ZH(gt3,2))/2._dp
resL = resL+(dg2*Conjg(ZN(gt1,2))*Conjg(ZN(gt2,4))*ZH(gt3,2))/2._dp
resL = resL+(lam*Conjg(dZN(gt1,3))*Conjg(ZN(gt2,5))*ZH(gt3,2))/sqrt(2._dp)
resL = resL+(dlam*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,5))*ZH(gt3,2))/sqrt(2._dp)
resL = resL+(lam*Conjg(dZN(gt2,4))*Conjg(ZN(gt1,3))*ZH(gt3,3))/sqrt(2._dp)
resL = resL+(lam*Conjg(dZN(gt2,3))*Conjg(ZN(gt1,4))*ZH(gt3,3))/sqrt(2._dp)
resL = resL-(sqrt(2._dp)*kap*Conjg(dZN(gt2,5))*Conjg(ZN(gt1,5))*ZH(gt3,3))
resL = resL+(lam*Conjg(dZN(gt1,4))*Conjg(ZN(gt2,3))*ZH(gt3,3))/sqrt(2._dp)
resL = resL+(dlam*Conjg(ZN(gt1,4))*Conjg(ZN(gt2,3))*ZH(gt3,3))/sqrt(2._dp)
resL = resL+(lam*Conjg(dZN(gt1,3))*Conjg(ZN(gt2,4))*ZH(gt3,3))/sqrt(2._dp)
resL = resL+(dlam*Conjg(ZN(gt1,3))*Conjg(ZN(gt2,4))*ZH(gt3,3))/sqrt(2._dp)
resL = resL-(sqrt(2._dp)*kap*Conjg(dZN(gt1,5))*Conjg(ZN(gt2,5))*ZH(gt3,3))
resL = resL-(sqrt(2._dp)*dkap*Conjg(ZN(gt1,5))*Conjg(ZN(gt2,5))*ZH(gt3,3))
resR = 0._dp
resR = resR+(g1*dZN(gt2,3)*ZH(gt3,1)*ZN(gt1,1))/2._dp
resR = resR-(g1*dZN(gt2,4)*ZH(gt3,2)*ZN(gt1,1))/2._dp
resR = resR-(g2*dZN(gt2,3)*ZH(gt3,1)*ZN(gt1,2))/2._dp
resR = resR+(g2*dZN(gt2,4)*ZH(gt3,2)*ZN(gt1,2))/2._dp
resR = resR+(g1*dZN(gt2,1)*ZH(gt3,1)*ZN(gt1,3))/2._dp
resR = resR-(g2*dZN(gt2,2)*ZH(gt3,1)*ZN(gt1,3))/2._dp
resR = resR+(Conjg(lam)*dZN(gt2,5)*ZH(gt3,2)*ZN(gt1,3))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt2,4)*ZH(gt3,3)*ZN(gt1,3))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt2,5)*ZH(gt3,1)*ZN(gt1,4))/sqrt(2._dp)
resR = resR-(g1*dZN(gt2,1)*ZH(gt3,2)*ZN(gt1,4))/2._dp
resR = resR+(g2*dZN(gt2,2)*ZH(gt3,2)*ZN(gt1,4))/2._dp
resR = resR+(Conjg(lam)*dZN(gt2,3)*ZH(gt3,3)*ZN(gt1,4))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt2,4)*ZH(gt3,1)*ZN(gt1,5))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt2,3)*ZH(gt3,2)*ZN(gt1,5))/sqrt(2._dp)
resR = resR-(sqrt(2._dp)*Conjg(kap)*dZN(gt2,5)*ZH(gt3,3)*ZN(gt1,5))
resR = resR+(g1*dZN(gt1,3)*ZH(gt3,1)*ZN(gt2,1))/2._dp
resR = resR-(g1*dZN(gt1,4)*ZH(gt3,2)*ZN(gt2,1))/2._dp
resR = resR+(g1*dZH(gt3,1)*ZN(gt1,3)*ZN(gt2,1))/2._dp
resR = resR+(dg1*ZH(gt3,1)*ZN(gt1,3)*ZN(gt2,1))/2._dp
resR = resR-(g1*dZH(gt3,2)*ZN(gt1,4)*ZN(gt2,1))/2._dp
resR = resR-(dg1*ZH(gt3,2)*ZN(gt1,4)*ZN(gt2,1))/2._dp
resR = resR-(g2*dZN(gt1,3)*ZH(gt3,1)*ZN(gt2,2))/2._dp
resR = resR+(g2*dZN(gt1,4)*ZH(gt3,2)*ZN(gt2,2))/2._dp
resR = resR-(g2*dZH(gt3,1)*ZN(gt1,3)*ZN(gt2,2))/2._dp
resR = resR-(dg2*ZH(gt3,1)*ZN(gt1,3)*ZN(gt2,2))/2._dp
resR = resR+(g2*dZH(gt3,2)*ZN(gt1,4)*ZN(gt2,2))/2._dp
resR = resR+(dg2*ZH(gt3,2)*ZN(gt1,4)*ZN(gt2,2))/2._dp
resR = resR+(g1*dZN(gt1,1)*ZH(gt3,1)*ZN(gt2,3))/2._dp
resR = resR-(g2*dZN(gt1,2)*ZH(gt3,1)*ZN(gt2,3))/2._dp
resR = resR+(Conjg(lam)*dZN(gt1,5)*ZH(gt3,2)*ZN(gt2,3))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt1,4)*ZH(gt3,3)*ZN(gt2,3))/sqrt(2._dp)
resR = resR+(g1*dZH(gt3,1)*ZN(gt1,1)*ZN(gt2,3))/2._dp
resR = resR+(dg1*ZH(gt3,1)*ZN(gt1,1)*ZN(gt2,3))/2._dp
resR = resR-(g2*dZH(gt3,1)*ZN(gt1,2)*ZN(gt2,3))/2._dp
resR = resR-(dg2*ZH(gt3,1)*ZN(gt1,2)*ZN(gt2,3))/2._dp
resR = resR+(Conjg(lam)*dZH(gt3,3)*ZN(gt1,4)*ZN(gt2,3))/sqrt(2._dp)
resR = resR+(Conjg(dlam)*ZH(gt3,3)*ZN(gt1,4)*ZN(gt2,3))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZH(gt3,2)*ZN(gt1,5)*ZN(gt2,3))/sqrt(2._dp)
resR = resR+(Conjg(dlam)*ZH(gt3,2)*ZN(gt1,5)*ZN(gt2,3))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt1,5)*ZH(gt3,1)*ZN(gt2,4))/sqrt(2._dp)
resR = resR-(g1*dZN(gt1,1)*ZH(gt3,2)*ZN(gt2,4))/2._dp
resR = resR+(g2*dZN(gt1,2)*ZH(gt3,2)*ZN(gt2,4))/2._dp
resR = resR+(Conjg(lam)*dZN(gt1,3)*ZH(gt3,3)*ZN(gt2,4))/sqrt(2._dp)
resR = resR-(g1*dZH(gt3,2)*ZN(gt1,1)*ZN(gt2,4))/2._dp
resR = resR-(dg1*ZH(gt3,2)*ZN(gt1,1)*ZN(gt2,4))/2._dp
resR = resR+(g2*dZH(gt3,2)*ZN(gt1,2)*ZN(gt2,4))/2._dp
resR = resR+(dg2*ZH(gt3,2)*ZN(gt1,2)*ZN(gt2,4))/2._dp
resR = resR+(Conjg(lam)*dZH(gt3,3)*ZN(gt1,3)*ZN(gt2,4))/sqrt(2._dp)
resR = resR+(Conjg(dlam)*ZH(gt3,3)*ZN(gt1,3)*ZN(gt2,4))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZH(gt3,1)*ZN(gt1,5)*ZN(gt2,4))/sqrt(2._dp)
resR = resR+(Conjg(dlam)*ZH(gt3,1)*ZN(gt1,5)*ZN(gt2,4))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt1,4)*ZH(gt3,1)*ZN(gt2,5))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZN(gt1,3)*ZH(gt3,2)*ZN(gt2,5))/sqrt(2._dp)
resR = resR-(sqrt(2._dp)*Conjg(kap)*dZN(gt1,5)*ZH(gt3,3)*ZN(gt2,5))
resR = resR+(Conjg(lam)*dZH(gt3,2)*ZN(gt1,3)*ZN(gt2,5))/sqrt(2._dp)
resR = resR+(Conjg(dlam)*ZH(gt3,2)*ZN(gt1,3)*ZN(gt2,5))/sqrt(2._dp)
resR = resR+(Conjg(lam)*dZH(gt3,1)*ZN(gt1,4)*ZN(gt2,5))/sqrt(2._dp)
resR = resR+(Conjg(dlam)*ZH(gt3,1)*ZN(gt1,4)*ZN(gt2,5))/sqrt(2._dp)
resR = resR-(sqrt(2._dp)*Conjg(kap)*dZH(gt3,3)*ZN(gt1,5)*ZN(gt2,5))
resR = resR-(sqrt(2._dp)*Conjg(dkap)*ZH(gt3,3)*ZN(gt1,5)*ZN(gt2,5))
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingChiChihh
Subroutine CT_CouplingChiFdcSd(gt1,gt2,gt3,g1,g2,Yd,ZD,ZN,ZDL,ZDR,dg1,dg2, &
& dYd,dZD,dZN,dZDL,dZDR,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,dg1,dg2
Complex(dp), Intent(in) :: Yd(3,3),ZD(6,6),ZN(5,5),ZDL(3,3),ZDR(3,3),dYd(3,3),dZD(6,6),dZN(5,5),dZDL(3,3),dZDR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingChiFdcSd'
If ((gt1.Lt.1).Or.(gt1.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-(g1*Conjg(ZDL(gt2,j1))*Conjg(ZN(gt1,1))*dZD(gt3,j1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL+(g2*Conjg(ZDL(gt2,j1))*Conjg(ZN(gt1,2))*dZD(gt3,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resL = resL-(g1*Conjg(dZN(gt1,1))*Conjg(ZDL(gt2,j1))*ZD(gt3,j1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL+(g2*Conjg(dZN(gt1,2))*Conjg(ZDL(gt2,j1))*ZD(gt3,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resL = resL-(g1*Conjg(dZDL(gt2,j1))*Conjg(ZN(gt1,1))*ZD(gt3,j1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-(dg1*Conjg(ZDL(gt2,j1))*Conjg(ZN(gt1,1))*ZD(gt3,j1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL+(g2*Conjg(dZDL(gt2,j1))*Conjg(ZN(gt1,2))*ZD(gt3,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resL = resL+(dg2*Conjg(ZDL(gt2,j1))*Conjg(ZN(gt1,2))*ZD(gt3,j1))/sqrt(2._dp)
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(ZDL(gt2,j2))*Conjg(ZN(gt1,3))*dZD(gt3,3 + j1)*Yd(j1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(ZDL(gt2,j2))*Conjg(ZN(gt1,3))*dYd(j1,j2)*ZD(gt3,3 + j1))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZN(gt1,3))*Conjg(ZDL(gt2,j2))*Yd(j1,j2)*ZD(gt3,3 + j1))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZDL(gt2,j2))*Conjg(ZN(gt1,3))*Yd(j1,j2)*ZD(gt3,3 + j1))
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*g1*dZN(gt1,1)*ZD(gt3,3 + j1)*ZDR(gt2,j1))/3._dp
End Do
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*g1*dZDR(gt2,j1)*ZD(gt3,3 + j1)*ZN(gt1,1))/3._dp
End Do
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*g1*dZD(gt3,3 + j1)*ZDR(gt2,j1)*ZN(gt1,1))/3._dp
End Do
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*dg1*ZD(gt3,3 + j1)*ZDR(gt2,j1)*ZN(gt1,1))/3._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Yd(j1,j2))*dZN(gt1,3)*ZD(gt3,j2)*ZDR(gt2,j1))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Yd(j1,j2))*dZDR(gt2,j1)*ZD(gt3,j2)*ZN(gt1,3))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Yd(j1,j2))*dZD(gt3,j2)*ZDR(gt2,j1)*ZN(gt1,3))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(dYd(j1,j2))*ZD(gt3,j2)*ZDR(gt2,j1)*ZN(gt1,3))
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingChiFdcSd
Subroutine CT_CouplingChiFecSe(gt1,gt2,gt3,g1,g2,Ye,ZE,ZN,ZEL,ZER,dg1,dg2, &
& dYe,dZE,dZN,dZEL,dZER,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,dg1,dg2
Complex(dp), Intent(in) :: Ye(3,3),ZE(6,6),ZN(5,5),ZEL(3,3),ZER(3,3),dYe(3,3),dZE(6,6),dZN(5,5),dZEL(3,3),dZER(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingChiFecSe'
If ((gt1.Lt.1).Or.(gt1.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL+(g1*Conjg(ZEL(gt2,j1))*Conjg(ZN(gt1,1))*dZE(gt3,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resL = resL+(g2*Conjg(ZEL(gt2,j1))*Conjg(ZN(gt1,2))*dZE(gt3,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resL = resL+(g1*Conjg(dZN(gt1,1))*Conjg(ZEL(gt2,j1))*ZE(gt3,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resL = resL+(g2*Conjg(dZN(gt1,2))*Conjg(ZEL(gt2,j1))*ZE(gt3,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resL = resL+(g1*Conjg(dZEL(gt2,j1))*Conjg(ZN(gt1,1))*ZE(gt3,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resL = resL+(dg1*Conjg(ZEL(gt2,j1))*Conjg(ZN(gt1,1))*ZE(gt3,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resL = resL+(g2*Conjg(dZEL(gt2,j1))*Conjg(ZN(gt1,2))*ZE(gt3,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resL = resL+(dg2*Conjg(ZEL(gt2,j1))*Conjg(ZN(gt1,2))*ZE(gt3,j1))/sqrt(2._dp)
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(ZEL(gt2,j2))*Conjg(ZN(gt1,3))*dZE(gt3,3 + j1)*Ye(j1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(ZEL(gt2,j2))*Conjg(ZN(gt1,3))*dYe(j1,j2)*ZE(gt3,3 + j1))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZN(gt1,3))*Conjg(ZEL(gt2,j2))*Ye(j1,j2)*ZE(gt3,3 + j1))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZEL(gt2,j2))*Conjg(ZN(gt1,3))*Ye(j1,j2)*ZE(gt3,3 + j1))
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*g1*dZN(gt1,1)*ZE(gt3,3 + j1)*ZER(gt2,j1))
End Do
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*g1*dZER(gt2,j1)*ZE(gt3,3 + j1)*ZN(gt1,1))
End Do
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*g1*dZE(gt3,3 + j1)*ZER(gt2,j1)*ZN(gt1,1))
End Do
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*dg1*ZE(gt3,3 + j1)*ZER(gt2,j1)*ZN(gt1,1))
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Ye(j1,j2))*dZN(gt1,3)*ZE(gt3,j2)*ZER(gt2,j1))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Ye(j1,j2))*dZER(gt2,j1)*ZE(gt3,j2)*ZN(gt1,3))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Ye(j1,j2))*dZE(gt3,j2)*ZER(gt2,j1)*ZN(gt1,3))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(dYe(j1,j2))*ZE(gt3,j2)*ZER(gt2,j1)*ZN(gt1,3))
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingChiFecSe
Subroutine CT_CouplingChiFucSu(gt1,gt2,gt3,g1,g2,Yu,ZU,ZN,ZUL,ZUR,dg1,dg2, &
& dYu,dZU,dZN,dZUL,dZUR,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,dg1,dg2
Complex(dp), Intent(in) :: Yu(3,3),ZU(6,6),ZN(5,5),ZUL(3,3),ZUR(3,3),dYu(3,3),dZU(6,6),dZN(5,5),dZUL(3,3),dZUR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingChiFucSu'
If ((gt1.Lt.1).Or.(gt1.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-(g1*Conjg(ZN(gt1,1))*Conjg(ZUL(gt2,j1))*dZU(gt3,j1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((g2*Conjg(ZN(gt1,2))*Conjg(ZUL(gt2,j1))*dZU(gt3,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-(g1*Conjg(dZUL(gt2,j1))*Conjg(ZN(gt1,1))*ZU(gt3,j1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((g2*Conjg(dZUL(gt2,j1))*Conjg(ZN(gt1,2))*ZU(gt3,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-(g1*Conjg(dZN(gt1,1))*Conjg(ZUL(gt2,j1))*ZU(gt3,j1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((g2*Conjg(dZN(gt1,2))*Conjg(ZUL(gt2,j1))*ZU(gt3,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-(dg1*Conjg(ZN(gt1,1))*Conjg(ZUL(gt2,j1))*ZU(gt3,j1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((dg2*Conjg(ZN(gt1,2))*Conjg(ZUL(gt2,j1))*ZU(gt3,j1))/sqrt(2._dp))
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(ZN(gt1,4))*Conjg(ZUL(gt2,j2))*dZU(gt3,3 + j1)*Yu(j1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(ZN(gt1,4))*Conjg(ZUL(gt2,j2))*dYu(j1,j2)*ZU(gt3,3 + j1))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZUL(gt2,j2))*Conjg(ZN(gt1,4))*Yu(j1,j2)*ZU(gt3,3 + j1))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZN(gt1,4))*Conjg(ZUL(gt2,j2))*Yu(j1,j2)*ZU(gt3,3 + j1))
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR+(2*sqrt(2._dp)*g1*dZUR(gt2,j1)*ZN(gt1,1)*ZU(gt3,3 + j1))/3._dp
End Do
Do j1 = 1,3
resR = resR+(2*sqrt(2._dp)*g1*dZU(gt3,3 + j1)*ZN(gt1,1)*ZUR(gt2,j1))/3._dp
End Do
Do j1 = 1,3
resR = resR+(2*sqrt(2._dp)*g1*dZN(gt1,1)*ZU(gt3,3 + j1)*ZUR(gt2,j1))/3._dp
End Do
Do j1 = 1,3
resR = resR+(2*sqrt(2._dp)*dg1*ZN(gt1,1)*ZU(gt3,3 + j1)*ZUR(gt2,j1))/3._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Yu(j1,j2))*dZUR(gt2,j1)*ZN(gt1,4)*ZU(gt3,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Yu(j1,j2))*dZU(gt3,j2)*ZN(gt1,4)*ZUR(gt2,j1))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Yu(j1,j2))*dZN(gt1,4)*ZU(gt3,j2)*ZUR(gt2,j1))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(dYu(j1,j2))*ZN(gt1,4)*ZU(gt3,j2)*ZUR(gt2,j1))
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingChiFucSu
Subroutine CT_CouplingChiFvSvIm(gt1,gt2,gt3,g1,g2,lamN,Yv,ZVI,ZN,UV,dg1, &
& dg2,dlamN,dYv,dZVI,dZN,dUV,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,dg1,dg2
Complex(dp), Intent(in) :: lamN(3,3),Yv(3,3),ZVI(9,9),ZN(5,5),UV(9,9),dlamN(3,3),dYv(3,3),dZVI(9,9), &
& dZN(5,5),dUV(9,9)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingChiFvSvIm'
If ((gt1.Lt.1).Or.(gt1.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL+(g1*Conjg(dZVI(gt3,j1))*Conjg(UV(gt2,j1))*Conjg(ZN(gt1,1)))/2._dp
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dZVI(gt3,j1))*Conjg(UV(gt2,j1))*Conjg(ZN(gt1,2)))/2._dp
End Do
Do j1 = 1,3
resL = resL+(g1*Conjg(dZN(gt1,1))*Conjg(UV(gt2,j1))*Conjg(ZVI(gt3,j1)))/2._dp
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dZN(gt1,2))*Conjg(UV(gt2,j1))*Conjg(ZVI(gt3,j1)))/2._dp
End Do
Do j1 = 1,3
resL = resL+(g1*Conjg(dUV(gt2,j1))*Conjg(ZN(gt1,1))*Conjg(ZVI(gt3,j1)))/2._dp
End Do
Do j1 = 1,3
resL = resL+(dg1*Conjg(UV(gt2,j1))*Conjg(ZN(gt1,1))*Conjg(ZVI(gt3,j1)))/2._dp
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dUV(gt2,j1))*Conjg(ZN(gt1,2))*Conjg(ZVI(gt3,j1)))/2._dp
End Do
Do j1 = 1,3
resL = resL-(dg2*Conjg(UV(gt2,j1))*Conjg(ZN(gt1,2))*Conjg(ZVI(gt3,j1)))/2._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt2,6 + j2))*Conjg(ZN(gt1,5))*Conjg(ZVI(gt3,3 + j1))*dlamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UV(gt2,3 + j1))*Conjg(ZN(gt1,5))*Conjg(ZVI(gt3,6 + j2))*dlamN(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt2,j2))*Conjg(ZN(gt1,4))*Conjg(ZVI(gt3,3 + j1))*dYv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UV(gt2,3 + j1))*Conjg(ZN(gt1,4))*Conjg(ZVI(gt3,j2))*dYv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZVI(gt3,j2))*Conjg(UV(gt2,3 + j1))*Conjg(ZN(gt1,4))*Yv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZVI(gt3,3 + j1))*Conjg(UV(gt2,j2))*Conjg(ZN(gt1,4))*Yv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZN(gt1,4))*Conjg(UV(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt2,j2))*Conjg(ZN(gt1,4))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZN(gt1,4))*Conjg(UV(gt2,3 + j1))*Conjg(ZVI(gt3,j2))*Yv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUV(gt2,3 + j1))*Conjg(ZN(gt1,4))*Conjg(ZVI(gt3,j2))*Yv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZVI(gt3,6 + j2))*Conjg(UV(gt2,3 + j1))*Conjg(ZN(gt1,5))*lamN(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZVI(gt3,3 + j1))*Conjg(UV(gt2,6 + j2))*Conjg(ZN(gt1,5))*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZN(gt1,5))*Conjg(UV(gt2,6 + j2))*Conjg(ZVI(gt3,3 + j1))*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt2,6 + j2))*Conjg(ZN(gt1,5))*Conjg(ZVI(gt3,3 + j1))*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZN(gt1,5))*Conjg(UV(gt2,3 + j1))*Conjg(ZVI(gt3,6 + j2))*lamN(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUV(gt2,3 + j1))*Conjg(ZN(gt1,5))*Conjg(ZVI(gt3,6 + j2))*lamN(j1,j2))/sqrt(2._dp)
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR-(g1*Conjg(ZVI(gt3,j1))*dZN(gt1,1)*UV(gt2,j1))/2._dp
End Do
Do j1 = 1,3
resR = resR+(g2*Conjg(ZVI(gt3,j1))*dZN(gt1,2)*UV(gt2,j1))/2._dp
End Do
Do j1 = 1,3
resR = resR-(g1*Conjg(ZVI(gt3,j1))*dUV(gt2,j1)*ZN(gt1,1))/2._dp
End Do
Do j1 = 1,3
resR = resR-(g1*Conjg(dZVI(gt3,j1))*UV(gt2,j1)*ZN(gt1,1))/2._dp
End Do
Do j1 = 1,3
resR = resR-(dg1*Conjg(ZVI(gt3,j1))*UV(gt2,j1)*ZN(gt1,1))/2._dp
End Do
Do j1 = 1,3
resR = resR+(g2*Conjg(ZVI(gt3,j1))*dUV(gt2,j1)*ZN(gt1,2))/2._dp
End Do
Do j1 = 1,3
resR = resR+(g2*Conjg(dZVI(gt3,j1))*UV(gt2,j1)*ZN(gt1,2))/2._dp
End Do
Do j1 = 1,3
resR = resR+(dg2*Conjg(ZVI(gt3,j1))*UV(gt2,j1)*ZN(gt1,2))/2._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,j2))*dZN(gt1,4)*UV(gt2,3 + j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j1,j2))*dZN(gt1,5)*UV(gt2,3 + j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,3 + j1))*dZN(gt1,4)*UV(gt2,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(ZVI(gt3,3 + j1))*Conjg(lamN(j1,j2))*dZN(gt1,5)*UV(gt2,6 + j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,j2))*dUV(gt2,3 + j1)*ZN(gt1,4))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(Yv(j1,j2))*Conjg(ZVI(gt3,3 + j1))*dUV(gt2,j2)*ZN(gt1,4))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dZVI(gt3,j2))*Conjg(Yv(j1,j2))*UV(gt2,3 + j1)*ZN(gt1,4))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYv(j1,j2))*Conjg(ZVI(gt3,j2))*UV(gt2,3 + j1)*ZN(gt1,4))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(dZVI(gt3,3 + j1))*Conjg(Yv(j1,j2))*UV(gt2,j2)*ZN(gt1,4))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(dYv(j1,j2))*Conjg(ZVI(gt3,3 + j1))*UV(gt2,j2)*ZN(gt1,4))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(ZVI(gt3,6 + j2))*Conjg(lamN(j1,j2))*dUV(gt2,3 + j1)*ZN(gt1,5))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(ZVI(gt3,3 + j1))*Conjg(lamN(j1,j2))*dUV(gt2,6 + j2)*ZN(gt1,5))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dlamN(j1,j2))*Conjg(ZVI(gt3,6 + j2))*UV(gt2,3 + j1)*ZN(gt1,5))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dZVI(gt3,6 + j2))*Conjg(lamN(j1,j2))*UV(gt2,3 + j1)*ZN(gt1,5))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(dlamN(j1,j2))*Conjg(ZVI(gt3,3 + j1))*UV(gt2,6 + j2)*ZN(gt1,5))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(dZVI(gt3,3 + j1))*Conjg(lamN(j1,j2))*UV(gt2,6 + j2)*ZN(gt1,5))/sqrt(2._dp)
End Do
End Do
resL = -(0.,1.)*resL
resR = -(0.,1.)*resR
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingChiFvSvIm
Subroutine CT_CouplingChiFvSvRe(gt1,gt2,gt3,g1,g2,lamN,Yv,ZVR,ZN,UV,dg1, &
& dg2,dlamN,dYv,dZVR,dZN,dUV,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,dg1,dg2
Complex(dp), Intent(in) :: lamN(3,3),Yv(3,3),ZVR(9,9),ZN(5,5),UV(9,9),dlamN(3,3),dYv(3,3),dZVR(9,9), &
& dZN(5,5),dUV(9,9)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingChiFvSvRe'
If ((gt1.Lt.1).Or.(gt1.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL+(g1*Conjg(dZVR(gt3,j1))*Conjg(UV(gt2,j1))*Conjg(ZN(gt1,1)))/2._dp
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dZVR(gt3,j1))*Conjg(UV(gt2,j1))*Conjg(ZN(gt1,2)))/2._dp
End Do
Do j1 = 1,3
resL = resL+(g1*Conjg(dZN(gt1,1))*Conjg(UV(gt2,j1))*Conjg(ZVR(gt3,j1)))/2._dp
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dZN(gt1,2))*Conjg(UV(gt2,j1))*Conjg(ZVR(gt3,j1)))/2._dp
End Do
Do j1 = 1,3
resL = resL+(g1*Conjg(dUV(gt2,j1))*Conjg(ZN(gt1,1))*Conjg(ZVR(gt3,j1)))/2._dp
End Do
Do j1 = 1,3
resL = resL+(dg1*Conjg(UV(gt2,j1))*Conjg(ZN(gt1,1))*Conjg(ZVR(gt3,j1)))/2._dp
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dUV(gt2,j1))*Conjg(ZN(gt1,2))*Conjg(ZVR(gt3,j1)))/2._dp
End Do
Do j1 = 1,3
resL = resL-(dg2*Conjg(UV(gt2,j1))*Conjg(ZN(gt1,2))*Conjg(ZVR(gt3,j1)))/2._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt2,6 + j2))*Conjg(ZN(gt1,5))*Conjg(ZVR(gt3,3 + j1))*dlamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt2,3 + j1))*Conjg(ZN(gt1,5))*Conjg(ZVR(gt3,6 + j2))*dlamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt2,j2))*Conjg(ZN(gt1,4))*Conjg(ZVR(gt3,3 + j1))*dYv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt2,3 + j1))*Conjg(ZN(gt1,4))*Conjg(ZVR(gt3,j2))*dYv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZVR(gt3,j2))*Conjg(UV(gt2,3 + j1))*Conjg(ZN(gt1,4))*Yv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZVR(gt3,3 + j1))*Conjg(UV(gt2,j2))*Conjg(ZN(gt1,4))*Yv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZN(gt1,4))*Conjg(UV(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt2,j2))*Conjg(ZN(gt1,4))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZN(gt1,4))*Conjg(UV(gt2,3 + j1))*Conjg(ZVR(gt3,j2))*Yv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt2,3 + j1))*Conjg(ZN(gt1,4))*Conjg(ZVR(gt3,j2))*Yv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZVR(gt3,6 + j2))*Conjg(UV(gt2,3 + j1))*Conjg(ZN(gt1,5))*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZVR(gt3,3 + j1))*Conjg(UV(gt2,6 + j2))*Conjg(ZN(gt1,5))*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZN(gt1,5))*Conjg(UV(gt2,6 + j2))*Conjg(ZVR(gt3,3 + j1))*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt2,6 + j2))*Conjg(ZN(gt1,5))*Conjg(ZVR(gt3,3 + j1))*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZN(gt1,5))*Conjg(UV(gt2,3 + j1))*Conjg(ZVR(gt3,6 + j2))*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt2,3 + j1))*Conjg(ZN(gt1,5))*Conjg(ZVR(gt3,6 + j2))*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR+(g1*Conjg(ZVR(gt3,j1))*dZN(gt1,1)*UV(gt2,j1))/2._dp
End Do
Do j1 = 1,3
resR = resR-(g2*Conjg(ZVR(gt3,j1))*dZN(gt1,2)*UV(gt2,j1))/2._dp
End Do
Do j1 = 1,3
resR = resR+(g1*Conjg(ZVR(gt3,j1))*dUV(gt2,j1)*ZN(gt1,1))/2._dp
End Do
Do j1 = 1,3
resR = resR+(g1*Conjg(dZVR(gt3,j1))*UV(gt2,j1)*ZN(gt1,1))/2._dp
End Do
Do j1 = 1,3
resR = resR+(dg1*Conjg(ZVR(gt3,j1))*UV(gt2,j1)*ZN(gt1,1))/2._dp
End Do
Do j1 = 1,3
resR = resR-(g2*Conjg(ZVR(gt3,j1))*dUV(gt2,j1)*ZN(gt1,2))/2._dp
End Do
Do j1 = 1,3
resR = resR-(g2*Conjg(dZVR(gt3,j1))*UV(gt2,j1)*ZN(gt1,2))/2._dp
End Do
Do j1 = 1,3
resR = resR-(dg2*Conjg(ZVR(gt3,j1))*UV(gt2,j1)*ZN(gt1,2))/2._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,j2))*dZN(gt1,4)*UV(gt2,3 + j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j1,j2))*dZN(gt1,5)*UV(gt2,3 + j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*dZN(gt1,4)*UV(gt2,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(ZVR(gt3,3 + j1))*Conjg(lamN(j1,j2))*dZN(gt1,5)*UV(gt2,6 + j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,j2))*dUV(gt2,3 + j1)*ZN(gt1,4))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*dUV(gt2,j2)*ZN(gt1,4))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dZVR(gt3,j2))*Conjg(Yv(j1,j2))*UV(gt2,3 + j1)*ZN(gt1,4))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYv(j1,j2))*Conjg(ZVR(gt3,j2))*UV(gt2,3 + j1)*ZN(gt1,4))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dZVR(gt3,3 + j1))*Conjg(Yv(j1,j2))*UV(gt2,j2)*ZN(gt1,4))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYv(j1,j2))*Conjg(ZVR(gt3,3 + j1))*UV(gt2,j2)*ZN(gt1,4))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(ZVR(gt3,6 + j2))*Conjg(lamN(j1,j2))*dUV(gt2,3 + j1)*ZN(gt1,5))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(ZVR(gt3,3 + j1))*Conjg(lamN(j1,j2))*dUV(gt2,6 + j2)*ZN(gt1,5))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dlamN(j1,j2))*Conjg(ZVR(gt3,6 + j2))*UV(gt2,3 + j1)*ZN(gt1,5))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dZVR(gt3,6 + j2))*Conjg(lamN(j1,j2))*UV(gt2,3 + j1)*ZN(gt1,5))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dlamN(j1,j2))*Conjg(ZVR(gt3,3 + j1))*UV(gt2,6 + j2)*ZN(gt1,5))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dZVR(gt3,3 + j1))*Conjg(lamN(j1,j2))*UV(gt2,6 + j2)*ZN(gt1,5))/sqrt(2._dp))
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingChiFvSvRe
Subroutine CT_CouplingcChaChiHpm(gt1,gt2,gt3,g1,g2,lam,ZP,ZN,UM,UP,dg1, &
& dg2,dlam,dZP,dZN,dUM,dUP,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,ZP(2,2),dg1,dg2,dZP(2,2)
Complex(dp), Intent(in) :: lam,ZN(5,5),UM(2,2),UP(2,2),dlam,dZN(5,5),dUM(2,2),dUP(2,2)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcChaChiHpm'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
resL = resL-(lam*Conjg(UP(gt1,2))*Conjg(ZN(gt2,5))*dZP(gt3,1))
resL = resL-((g1*Conjg(UP(gt1,2))*Conjg(ZN(gt2,1))*dZP(gt3,2))/sqrt(2._dp))
resL = resL-((g2*Conjg(UP(gt1,2))*Conjg(ZN(gt2,2))*dZP(gt3,2))/sqrt(2._dp))
resL = resL-(g2*Conjg(UP(gt1,1))*Conjg(ZN(gt2,4))*dZP(gt3,2))
resL = resL-(lam*Conjg(dZN(gt2,5))*Conjg(UP(gt1,2))*ZP(gt3,1))
resL = resL-(lam*Conjg(dUP(gt1,2))*Conjg(ZN(gt2,5))*ZP(gt3,1))
resL = resL-(dlam*Conjg(UP(gt1,2))*Conjg(ZN(gt2,5))*ZP(gt3,1))
resL = resL-(g2*Conjg(dZN(gt2,4))*Conjg(UP(gt1,1))*ZP(gt3,2))
resL = resL-((g1*Conjg(dZN(gt2,1))*Conjg(UP(gt1,2))*ZP(gt3,2))/sqrt(2._dp))
resL = resL-((g2*Conjg(dZN(gt2,2))*Conjg(UP(gt1,2))*ZP(gt3,2))/sqrt(2._dp))
resL = resL-((g1*Conjg(dUP(gt1,2))*Conjg(ZN(gt2,1))*ZP(gt3,2))/sqrt(2._dp))
resL = resL-((dg1*Conjg(UP(gt1,2))*Conjg(ZN(gt2,1))*ZP(gt3,2))/sqrt(2._dp))
resL = resL-((g2*Conjg(dUP(gt1,2))*Conjg(ZN(gt2,2))*ZP(gt3,2))/sqrt(2._dp))
resL = resL-((dg2*Conjg(UP(gt1,2))*Conjg(ZN(gt2,2))*ZP(gt3,2))/sqrt(2._dp))
resL = resL-(g2*Conjg(dUP(gt1,1))*Conjg(ZN(gt2,4))*ZP(gt3,2))
resL = resL-(dg2*Conjg(UP(gt1,1))*Conjg(ZN(gt2,4))*ZP(gt3,2))
resR = 0._dp
resR = resR+(g1*dZP(gt3,1)*UM(gt1,2)*ZN(gt2,1))/sqrt(2._dp)
resR = resR+(g2*dZP(gt3,1)*UM(gt1,2)*ZN(gt2,2))/sqrt(2._dp)
resR = resR-(g2*dZP(gt3,1)*UM(gt1,1)*ZN(gt2,3))
resR = resR-(Conjg(lam)*dZP(gt3,2)*UM(gt1,2)*ZN(gt2,5))
resR = resR-(g2*dZN(gt2,3)*UM(gt1,1)*ZP(gt3,1))
resR = resR+(g1*dZN(gt2,1)*UM(gt1,2)*ZP(gt3,1))/sqrt(2._dp)
resR = resR+(g2*dZN(gt2,2)*UM(gt1,2)*ZP(gt3,1))/sqrt(2._dp)
resR = resR+(g1*dUM(gt1,2)*ZN(gt2,1)*ZP(gt3,1))/sqrt(2._dp)
resR = resR+(dg1*UM(gt1,2)*ZN(gt2,1)*ZP(gt3,1))/sqrt(2._dp)
resR = resR+(g2*dUM(gt1,2)*ZN(gt2,2)*ZP(gt3,1))/sqrt(2._dp)
resR = resR+(dg2*UM(gt1,2)*ZN(gt2,2)*ZP(gt3,1))/sqrt(2._dp)
resR = resR-(g2*dUM(gt1,1)*ZN(gt2,3)*ZP(gt3,1))
resR = resR-(dg2*UM(gt1,1)*ZN(gt2,3)*ZP(gt3,1))
resR = resR-(Conjg(lam)*dZN(gt2,5)*UM(gt1,2)*ZP(gt3,2))
resR = resR-(Conjg(lam)*dUM(gt1,2)*ZN(gt2,5)*ZP(gt3,2))
resR = resR-(Conjg(dlam)*UM(gt1,2)*ZN(gt2,5)*ZP(gt3,2))
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcChaChiHpm
Subroutine CT_CouplingcFdChiSd(gt1,gt2,gt3,g1,g2,Yd,ZD,ZN,ZDL,ZDR,dg1,dg2, &
& dYd,dZD,dZN,dZDL,dZDR,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,dg1,dg2
Complex(dp), Intent(in) :: Yd(3,3),ZD(6,6),ZN(5,5),ZDL(3,3),ZDR(3,3),dYd(3,3),dZD(6,6),dZN(5,5),dZDL(3,3),dZDR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFdChiSd'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*g1*Conjg(dZN(gt2,1))*Conjg(ZD(gt3,3 + j1))*Conjg(ZDR(gt1,j1)))/3._dp
End Do
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*g1*Conjg(dZDR(gt1,j1))*Conjg(ZD(gt3,3 + j1))*Conjg(ZN(gt2,1)))/3._dp
End Do
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*g1*Conjg(dZD(gt3,3 + j1))*Conjg(ZDR(gt1,j1))*Conjg(ZN(gt2,1)))/3._dp
End Do
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*dg1*Conjg(ZD(gt3,3 + j1))*Conjg(ZDR(gt1,j1))*Conjg(ZN(gt2,1)))/3._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(ZD(gt3,j2))*Conjg(ZDR(gt1,j1))*Conjg(ZN(gt2,3))*dYd(j1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZN(gt2,3))*Conjg(ZD(gt3,j2))*Conjg(ZDR(gt1,j1))*Yd(j1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZDR(gt1,j1))*Conjg(ZD(gt3,j2))*Conjg(ZN(gt2,3))*Yd(j1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZD(gt3,j2))*Conjg(ZDR(gt1,j1))*Conjg(ZN(gt2,3))*Yd(j1,j2))
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR-(g1*Conjg(ZD(gt3,j1))*dZN(gt2,1)*ZDL(gt1,j1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR+(g2*Conjg(ZD(gt3,j1))*dZN(gt2,2)*ZDL(gt1,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR-(g1*Conjg(ZD(gt3,j1))*dZDL(gt1,j1)*ZN(gt2,1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR-(g1*Conjg(dZD(gt3,j1))*ZDL(gt1,j1)*ZN(gt2,1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR-(dg1*Conjg(ZD(gt3,j1))*ZDL(gt1,j1)*ZN(gt2,1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR+(g2*Conjg(ZD(gt3,j1))*dZDL(gt1,j1)*ZN(gt2,2))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR+(g2*Conjg(dZD(gt3,j1))*ZDL(gt1,j1)*ZN(gt2,2))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR+(dg2*Conjg(ZD(gt3,j1))*ZDL(gt1,j1)*ZN(gt2,2))/sqrt(2._dp)
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Yd(j1,j2))*Conjg(ZD(gt3,3 + j1))*dZN(gt2,3)*ZDL(gt1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Yd(j1,j2))*Conjg(ZD(gt3,3 + j1))*dZDL(gt1,j2)*ZN(gt2,3))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(dZD(gt3,3 + j1))*Conjg(Yd(j1,j2))*ZDL(gt1,j2)*ZN(gt2,3))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(dYd(j1,j2))*Conjg(ZD(gt3,3 + j1))*ZDL(gt1,j2)*ZN(gt2,3))
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFdChiSd
Subroutine CT_CouplingcFeChiSe(gt1,gt2,gt3,g1,g2,Ye,ZE,ZN,ZEL,ZER,dg1,dg2, &
& dYe,dZE,dZN,dZEL,dZER,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,dg1,dg2
Complex(dp), Intent(in) :: Ye(3,3),ZE(6,6),ZN(5,5),ZEL(3,3),ZER(3,3),dYe(3,3),dZE(6,6),dZN(5,5),dZEL(3,3),dZER(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFeChiSe'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*g1*Conjg(dZN(gt2,1))*Conjg(ZE(gt3,3 + j1))*Conjg(ZER(gt1,j1)))
End Do
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*g1*Conjg(dZER(gt1,j1))*Conjg(ZE(gt3,3 + j1))*Conjg(ZN(gt2,1)))
End Do
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*g1*Conjg(dZE(gt3,3 + j1))*Conjg(ZER(gt1,j1))*Conjg(ZN(gt2,1)))
End Do
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*dg1*Conjg(ZE(gt3,3 + j1))*Conjg(ZER(gt1,j1))*Conjg(ZN(gt2,1)))
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(ZE(gt3,j2))*Conjg(ZER(gt1,j1))*Conjg(ZN(gt2,3))*dYe(j1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZN(gt2,3))*Conjg(ZE(gt3,j2))*Conjg(ZER(gt1,j1))*Ye(j1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZER(gt1,j1))*Conjg(ZE(gt3,j2))*Conjg(ZN(gt2,3))*Ye(j1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZE(gt3,j2))*Conjg(ZER(gt1,j1))*Conjg(ZN(gt2,3))*Ye(j1,j2))
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR+(g1*Conjg(ZE(gt3,j1))*dZN(gt2,1)*ZEL(gt1,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR+(g2*Conjg(ZE(gt3,j1))*dZN(gt2,2)*ZEL(gt1,j1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR+(g1*Conjg(ZE(gt3,j1))*dZEL(gt1,j1)*ZN(gt2,1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR+(g1*Conjg(dZE(gt3,j1))*ZEL(gt1,j1)*ZN(gt2,1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR+(dg1*Conjg(ZE(gt3,j1))*ZEL(gt1,j1)*ZN(gt2,1))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR+(g2*Conjg(ZE(gt3,j1))*dZEL(gt1,j1)*ZN(gt2,2))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR+(g2*Conjg(dZE(gt3,j1))*ZEL(gt1,j1)*ZN(gt2,2))/sqrt(2._dp)
End Do
Do j1 = 1,3
resR = resR+(dg2*Conjg(ZE(gt3,j1))*ZEL(gt1,j1)*ZN(gt2,2))/sqrt(2._dp)
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Ye(j1,j2))*Conjg(ZE(gt3,3 + j1))*dZN(gt2,3)*ZEL(gt1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Ye(j1,j2))*Conjg(ZE(gt3,3 + j1))*dZEL(gt1,j2)*ZN(gt2,3))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(dZE(gt3,3 + j1))*Conjg(Ye(j1,j2))*ZEL(gt1,j2)*ZN(gt2,3))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(dYe(j1,j2))*Conjg(ZE(gt3,3 + j1))*ZEL(gt1,j2)*ZN(gt2,3))
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFeChiSe
Subroutine CT_CouplingcFuChiSu(gt1,gt2,gt3,g1,g2,Yu,ZU,ZN,ZUL,ZUR,dg1,dg2, &
& dYu,dZU,dZN,dZUL,dZUR,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g1,g2,dg1,dg2
Complex(dp), Intent(in) :: Yu(3,3),ZU(6,6),ZN(5,5),ZUL(3,3),ZUR(3,3),dYu(3,3),dZU(6,6),dZN(5,5),dZUL(3,3),dZUR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFuChiSu'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL+(2*sqrt(2._dp)*g1*Conjg(dZUR(gt1,j1))*Conjg(ZN(gt2,1))*Conjg(ZU(gt3,3 + j1)))/3._dp
End Do
Do j1 = 1,3
resL = resL+(2*sqrt(2._dp)*g1*Conjg(dZU(gt3,3 + j1))*Conjg(ZN(gt2,1))*Conjg(ZUR(gt1,j1)))/3._dp
End Do
Do j1 = 1,3
resL = resL+(2*sqrt(2._dp)*g1*Conjg(dZN(gt2,1))*Conjg(ZU(gt3,3 + j1))*Conjg(ZUR(gt1,j1)))/3._dp
End Do
Do j1 = 1,3
resL = resL+(2*sqrt(2._dp)*dg1*Conjg(ZN(gt2,1))*Conjg(ZU(gt3,3 + j1))*Conjg(ZUR(gt1,j1)))/3._dp
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(ZN(gt2,4))*Conjg(ZU(gt3,j2))*Conjg(ZUR(gt1,j1))*dYu(j1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZUR(gt1,j1))*Conjg(ZN(gt2,4))*Conjg(ZU(gt3,j2))*Yu(j1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZU(gt3,j2))*Conjg(ZN(gt2,4))*Conjg(ZUR(gt1,j1))*Yu(j1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-(Conjg(dZN(gt2,4))*Conjg(ZU(gt3,j2))*Conjg(ZUR(gt1,j1))*Yu(j1,j2))
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR-(g1*Conjg(ZU(gt3,j1))*dZUL(gt1,j1)*ZN(gt2,1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR-((g2*Conjg(ZU(gt3,j1))*dZUL(gt1,j1)*ZN(gt2,2))/sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR-(g1*Conjg(ZU(gt3,j1))*dZN(gt2,1)*ZUL(gt1,j1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR-((g2*Conjg(ZU(gt3,j1))*dZN(gt2,2)*ZUL(gt1,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR-(g1*Conjg(dZU(gt3,j1))*ZN(gt2,1)*ZUL(gt1,j1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR-(dg1*Conjg(ZU(gt3,j1))*ZN(gt2,1)*ZUL(gt1,j1))/(3._dp*sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR-((g2*Conjg(dZU(gt3,j1))*ZN(gt2,2)*ZUL(gt1,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resR = resR-((dg2*Conjg(ZU(gt3,j1))*ZN(gt2,2)*ZUL(gt1,j1))/sqrt(2._dp))
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Yu(j1,j2))*Conjg(ZU(gt3,3 + j1))*dZUL(gt1,j2)*ZN(gt2,4))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(Yu(j1,j2))*Conjg(ZU(gt3,3 + j1))*dZN(gt2,4)*ZUL(gt1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(dZU(gt3,3 + j1))*Conjg(Yu(j1,j2))*ZN(gt2,4)*ZUL(gt1,j2))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-(Conjg(dYu(j1,j2))*Conjg(ZU(gt3,3 + j1))*ZN(gt2,4)*ZUL(gt1,j2))
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFuChiSu
Subroutine CT_CouplingGluFdcSd(gt2,gt3,g3,pG,ZD,ZDL,ZDR,dg3,dpG,dZD,dZDL, &
& dZDR,resL,resR)
Implicit None
Integer, Intent(in) :: gt2,gt3
Real(dp), Intent(in) :: g3,dg3
Complex(dp), Intent(in) :: pG,ZD(6,6),ZDL(3,3),ZDR(3,3),dpG,dZD(6,6),dZDL(3,3),dZDR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingGluFdcSd'
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*g3*pG*Conjg(ZDL(gt2,j1))*dZD(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*g3*pG*Conjg(dZDL(gt2,j1))*ZD(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*dpG*g3*Conjg(ZDL(gt2,j1))*ZD(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*dg3*pG*Conjg(ZDL(gt2,j1))*ZD(gt3,j1))
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR+sqrt(2._dp)*g3*Conjg(pG)*dZDR(gt2,j1)*ZD(gt3,3 + j1)
End Do
Do j1 = 1,3
resR = resR+sqrt(2._dp)*g3*Conjg(pG)*dZD(gt3,3 + j1)*ZDR(gt2,j1)
End Do
Do j1 = 1,3
resR = resR+sqrt(2._dp)*g3*Conjg(dpG)*ZD(gt3,3 + j1)*ZDR(gt2,j1)
End Do
Do j1 = 1,3
resR = resR+sqrt(2._dp)*dg3*Conjg(pG)*ZD(gt3,3 + j1)*ZDR(gt2,j1)
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingGluFdcSd
Subroutine CT_CouplingcFdFdhh(gt1,gt2,gt3,Yd,ZH,ZDL,ZDR,dYd,dZH,dZDL,dZDR, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: ZH(3,3),dZH(3,3)
Complex(dp), Intent(in) :: Yd(3,3),ZDL(3,3),ZDR(3,3),dYd(3,3),dZDL(3,3),dZDR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFdFdhh'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(ZDL(gt2,j2))*Conjg(ZDR(gt1,j1))*dZH(gt3,1)*Yd(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(ZDL(gt2,j2))*Conjg(ZDR(gt1,j1))*dYd(j1,j2)*ZH(gt3,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZDR(gt1,j1))*Conjg(ZDL(gt2,j2))*Yd(j1,j2)*ZH(gt3,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZDL(gt2,j2))*Conjg(ZDR(gt1,j1))*Yd(j1,j2)*ZH(gt3,1))/sqrt(2._dp))
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yd(j1,j2))*dZH(gt3,1)*ZDL(gt1,j2)*ZDR(gt2,j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yd(j1,j2))*dZDR(gt2,j1)*ZDL(gt1,j2)*ZH(gt3,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yd(j1,j2))*dZDL(gt1,j2)*ZDR(gt2,j1)*ZH(gt3,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYd(j1,j2))*ZDL(gt1,j2)*ZDR(gt2,j1)*ZH(gt3,1))/sqrt(2._dp))
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFdFdhh
Subroutine CT_CouplingcChaFdcSu(gt1,gt2,gt3,g2,Yd,Yu,ZU,UM,UP,ZDL,ZDR,dg2, &
& dYd,dYu,dZU,dUM,dUP,dZDL,dZDR,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: Yd(3,3),Yu(3,3),ZU(6,6),UM(2,2),UP(2,2),ZDL(3,3),ZDR(3,3),dYd(3,3),dYu(3,3), &
& dZU(6,6),dUM(2,2),dUP(2,2),dZDL(3,3),dZDR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcChaFdcSu'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-(g2*Conjg(UP(gt1,1))*Conjg(ZDL(gt2,j1))*dZU(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dZDL(gt2,j1))*Conjg(UP(gt1,1))*ZU(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dUP(gt1,1))*Conjg(ZDL(gt2,j1))*ZU(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(dg2*Conjg(UP(gt1,1))*Conjg(ZDL(gt2,j1))*ZU(gt3,j1))
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UP(gt1,2))*Conjg(ZDL(gt2,j2))*dZU(gt3,3 + j1)*Yu(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UP(gt1,2))*Conjg(ZDL(gt2,j2))*dYu(j1,j2)*ZU(gt3,3 + j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZDL(gt2,j2))*Conjg(UP(gt1,2))*Yu(j1,j2)*ZU(gt3,3 + j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dUP(gt1,2))*Conjg(ZDL(gt2,j2))*Yu(j1,j2)*ZU(gt3,3 + j1)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yd(j1,j2))*dZU(gt3,j2)*UM(gt1,2)*ZDR(gt2,j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yd(j1,j2))*dZDR(gt2,j1)*UM(gt1,2)*ZU(gt3,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yd(j1,j2))*dUM(gt1,2)*ZDR(gt2,j1)*ZU(gt3,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dYd(j1,j2))*UM(gt1,2)*ZDR(gt2,j1)*ZU(gt3,j2)
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcChaFdcSu
Subroutine CT_CouplingcFuFdcHpm(gt1,gt2,gt3,Yd,Yu,ZP,ZDL,ZDR,ZUL,ZUR,dYd, &
& dYu,dZP,dZDL,dZDR,dZUL,dZUR,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: ZP(2,2),dZP(2,2)
Complex(dp), Intent(in) :: Yd(3,3),Yu(3,3),ZDL(3,3),ZDR(3,3),ZUL(3,3),ZUR(3,3),dYd(3,3),dYu(3,3),dZDL(3,3), &
& dZDR(3,3),dZUL(3,3),dZUR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFuFdcHpm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(ZDL(gt2,j2))*Conjg(ZUR(gt1,j1))*dZP(gt3,2)*Yu(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(ZDL(gt2,j2))*Conjg(ZUR(gt1,j1))*dYu(j1,j2)*ZP(gt3,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZUR(gt1,j1))*Conjg(ZDL(gt2,j2))*Yu(j1,j2)*ZP(gt3,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZDL(gt2,j2))*Conjg(ZUR(gt1,j1))*Yu(j1,j2)*ZP(gt3,2)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yd(j1,j2))*dZUL(gt1,j2)*ZDR(gt2,j1)*ZP(gt3,1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yd(j1,j2))*dZP(gt3,1)*ZDR(gt2,j1)*ZUL(gt1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yd(j1,j2))*dZDR(gt2,j1)*ZP(gt3,1)*ZUL(gt1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dYd(j1,j2))*ZDR(gt2,j1)*ZP(gt3,1)*ZUL(gt1,j2)
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFuFdcHpm
Subroutine CT_CouplingFvFecHpm(gt1,gt2,gt3,Ye,Yv,ZP,UV,ZEL,ZER,dYe,dYv, &
& dZP,dUV,dZEL,dZER,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: ZP(2,2),dZP(2,2)
Complex(dp), Intent(in) :: Ye(3,3),Yv(3,3),UV(9,9),ZEL(3,3),ZER(3,3),dYe(3,3),dYv(3,3),dUV(9,9),dZEL(3,3),dZER(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingFvFecHpm'
If ((gt1.Lt.1).Or.(gt1.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UV(gt1,3 + j1))*Conjg(ZEL(gt2,j2))*dZP(gt3,2)*Yv(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UV(gt1,3 + j1))*Conjg(ZEL(gt2,j2))*dYv(j1,j2)*ZP(gt3,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZEL(gt2,j2))*Conjg(UV(gt1,3 + j1))*Yv(j1,j2)*ZP(gt3,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dUV(gt1,3 + j1))*Conjg(ZEL(gt2,j2))*Yv(j1,j2)*ZP(gt3,2)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Ye(j1,j2))*dZP(gt3,1)*UV(gt1,j2)*ZER(gt2,j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Ye(j1,j2))*dZER(gt2,j1)*UV(gt1,j2)*ZP(gt3,1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Ye(j1,j2))*dUV(gt1,j2)*ZER(gt2,j1)*ZP(gt3,1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dYe(j1,j2))*UV(gt1,j2)*ZER(gt2,j1)*ZP(gt3,1)
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingFvFecHpm
Subroutine CT_CouplingcFeFehh(gt1,gt2,gt3,Ye,ZH,ZEL,ZER,dYe,dZH,dZEL,dZER, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: ZH(3,3),dZH(3,3)
Complex(dp), Intent(in) :: Ye(3,3),ZEL(3,3),ZER(3,3),dYe(3,3),dZEL(3,3),dZER(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFeFehh'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(ZEL(gt2,j2))*Conjg(ZER(gt1,j1))*dZH(gt3,1)*Ye(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(ZEL(gt2,j2))*Conjg(ZER(gt1,j1))*dYe(j1,j2)*ZH(gt3,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZER(gt1,j1))*Conjg(ZEL(gt2,j2))*Ye(j1,j2)*ZH(gt3,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZEL(gt2,j2))*Conjg(ZER(gt1,j1))*Ye(j1,j2)*ZH(gt3,1))/sqrt(2._dp))
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Ye(j1,j2))*dZH(gt3,1)*ZEL(gt1,j2)*ZER(gt2,j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Ye(j1,j2))*dZER(gt2,j1)*ZEL(gt1,j2)*ZH(gt3,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Ye(j1,j2))*dZEL(gt1,j2)*ZER(gt2,j1)*ZH(gt3,1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYe(j1,j2))*ZEL(gt1,j2)*ZER(gt2,j1)*ZH(gt3,1))/sqrt(2._dp))
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFeFehh
Subroutine CT_CouplingcChaFeSvIm(gt1,gt2,gt3,g2,Ye,Yv,ZVI,UM,UP,ZEL,ZER, &
& dg2,dYe,dYv,dZVI,dUM,dUP,dZEL,dZER,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: Ye(3,3),Yv(3,3),ZVI(9,9),UM(2,2),UP(2,2),ZEL(3,3),ZER(3,3),dYe(3,3),dYv(3,3), &
& dZVI(9,9),dUM(2,2),dUP(2,2),dZEL(3,3),dZER(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcChaFeSvIm'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-((g2*Conjg(dZVI(gt3,j1))*Conjg(UP(gt1,1))*Conjg(ZEL(gt2,j1)))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((g2*Conjg(dZEL(gt2,j1))*Conjg(UP(gt1,1))*Conjg(ZVI(gt3,j1)))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((g2*Conjg(dUP(gt1,1))*Conjg(ZEL(gt2,j1))*Conjg(ZVI(gt3,j1)))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((dg2*Conjg(UP(gt1,1))*Conjg(ZEL(gt2,j1))*Conjg(ZVI(gt3,j1)))/sqrt(2._dp))
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UP(gt1,2))*Conjg(ZEL(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*dYv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZVI(gt3,3 + j1))*Conjg(UP(gt1,2))*Conjg(ZEL(gt2,j2))*Yv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZEL(gt2,j2))*Conjg(UP(gt1,2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUP(gt1,2))*Conjg(ZEL(gt2,j2))*Conjg(ZVI(gt3,3 + j1))*Yv(j1,j2))/sqrt(2._dp)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(Ye(j1,j2))*Conjg(ZVI(gt3,j2))*dZER(gt2,j1)*UM(gt1,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(Ye(j1,j2))*Conjg(ZVI(gt3,j2))*dUM(gt1,2)*ZER(gt2,j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(dZVI(gt3,j2))*Conjg(Ye(j1,j2))*UM(gt1,2)*ZER(gt2,j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(dYe(j1,j2))*Conjg(ZVI(gt3,j2))*UM(gt1,2)*ZER(gt2,j1))/sqrt(2._dp)
End Do
End Do
resL = -(0.,1.)*resL
resR = -(0.,1.)*resR
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcChaFeSvIm
Subroutine CT_CouplingcChaFeSvRe(gt1,gt2,gt3,g2,Ye,Yv,ZVR,UM,UP,ZEL,ZER, &
& dg2,dYe,dYv,dZVR,dUM,dUP,dZEL,dZER,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: Ye(3,3),Yv(3,3),ZVR(9,9),UM(2,2),UP(2,2),ZEL(3,3),ZER(3,3),dYe(3,3),dYv(3,3), &
& dZVR(9,9),dUM(2,2),dUP(2,2),dZEL(3,3),dZER(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcChaFeSvRe'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-((g2*Conjg(dZVR(gt3,j1))*Conjg(UP(gt1,1))*Conjg(ZEL(gt2,j1)))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((g2*Conjg(dZEL(gt2,j1))*Conjg(UP(gt1,1))*Conjg(ZVR(gt3,j1)))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((g2*Conjg(dUP(gt1,1))*Conjg(ZEL(gt2,j1))*Conjg(ZVR(gt3,j1)))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((dg2*Conjg(UP(gt1,1))*Conjg(ZEL(gt2,j1))*Conjg(ZVR(gt3,j1)))/sqrt(2._dp))
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(UP(gt1,2))*Conjg(ZEL(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*dYv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZVR(gt3,3 + j1))*Conjg(UP(gt1,2))*Conjg(ZEL(gt2,j2))*Yv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dZEL(gt2,j2))*Conjg(UP(gt1,2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+(Conjg(dUP(gt1,2))*Conjg(ZEL(gt2,j2))*Conjg(ZVR(gt3,3 + j1))*Yv(j1,j2))/sqrt(2._dp)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(Ye(j1,j2))*Conjg(ZVR(gt3,j2))*dZER(gt2,j1)*UM(gt1,2))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(Ye(j1,j2))*Conjg(ZVR(gt3,j2))*dUM(gt1,2)*ZER(gt2,j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(dZVR(gt3,j2))*Conjg(Ye(j1,j2))*UM(gt1,2)*ZER(gt2,j1))/sqrt(2._dp)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+(Conjg(dYe(j1,j2))*Conjg(ZVR(gt3,j2))*UM(gt1,2)*ZER(gt2,j1))/sqrt(2._dp)
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcChaFeSvRe
Subroutine CT_CouplingGluFucSu(gt2,gt3,g3,pG,ZU,ZUL,ZUR,dg3,dpG,dZU,dZUL, &
& dZUR,resL,resR)
Implicit None
Integer, Intent(in) :: gt2,gt3
Real(dp), Intent(in) :: g3,dg3
Complex(dp), Intent(in) :: pG,ZU(6,6),ZUL(3,3),ZUR(3,3),dpG,dZU(6,6),dZUL(3,3),dZUR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingGluFucSu'
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*g3*pG*Conjg(ZUL(gt2,j1))*dZU(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*g3*pG*Conjg(dZUL(gt2,j1))*ZU(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*dpG*g3*Conjg(ZUL(gt2,j1))*ZU(gt3,j1))
End Do
Do j1 = 1,3
resL = resL-(sqrt(2._dp)*dg3*pG*Conjg(ZUL(gt2,j1))*ZU(gt3,j1))
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR+sqrt(2._dp)*g3*Conjg(pG)*dZUR(gt2,j1)*ZU(gt3,3 + j1)
End Do
Do j1 = 1,3
resR = resR+sqrt(2._dp)*g3*Conjg(pG)*dZU(gt3,3 + j1)*ZUR(gt2,j1)
End Do
Do j1 = 1,3
resR = resR+sqrt(2._dp)*g3*Conjg(dpG)*ZU(gt3,3 + j1)*ZUR(gt2,j1)
End Do
Do j1 = 1,3
resR = resR+sqrt(2._dp)*dg3*Conjg(pG)*ZU(gt3,3 + j1)*ZUR(gt2,j1)
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingGluFucSu
Subroutine CT_CouplingcFuFuhh(gt1,gt2,gt3,Yu,ZH,ZUL,ZUR,dYu,dZH,dZUL,dZUR, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: ZH(3,3),dZH(3,3)
Complex(dp), Intent(in) :: Yu(3,3),ZUL(3,3),ZUR(3,3),dYu(3,3),dZUL(3,3),dZUR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFuFuhh'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(ZUL(gt2,j2))*Conjg(ZUR(gt1,j1))*dZH(gt3,2)*Yu(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(ZUL(gt2,j2))*Conjg(ZUR(gt1,j1))*dYu(j1,j2)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZUR(gt1,j1))*Conjg(ZUL(gt2,j2))*Yu(j1,j2)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dZUL(gt2,j2))*Conjg(ZUR(gt1,j1))*Yu(j1,j2)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yu(j1,j2))*dZUR(gt2,j1)*ZH(gt3,2)*ZUL(gt1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yu(j1,j2))*dZUL(gt1,j2)*ZH(gt3,2)*ZUR(gt2,j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yu(j1,j2))*dZH(gt3,2)*ZUL(gt1,j2)*ZUR(gt2,j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYu(j1,j2))*ZH(gt3,2)*ZUL(gt1,j2)*ZUR(gt2,j1))/sqrt(2._dp))
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFuFuhh
Subroutine CT_CouplingcFdFuHpm(gt1,gt2,gt3,Yd,Yu,ZP,ZDL,ZDR,ZUL,ZUR,dYd, &
& dYu,dZP,dZDL,dZDR,dZUL,dZUR,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: ZP(2,2),dZP(2,2)
Complex(dp), Intent(in) :: Yd(3,3),Yu(3,3),ZDL(3,3),ZDR(3,3),ZUL(3,3),ZUR(3,3),dYd(3,3),dYu(3,3),dZDL(3,3), &
& dZDR(3,3),dZUL(3,3),dZUR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFdFuHpm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(ZDR(gt1,j1))*Conjg(ZUL(gt2,j2))*dZP(gt3,1)*Yd(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(ZDR(gt1,j1))*Conjg(ZUL(gt2,j2))*dYd(j1,j2)*ZP(gt3,1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZUL(gt2,j2))*Conjg(ZDR(gt1,j1))*Yd(j1,j2)*ZP(gt3,1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZDR(gt1,j1))*Conjg(ZUL(gt2,j2))*Yd(j1,j2)*ZP(gt3,1)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yu(j1,j2))*dZUR(gt2,j1)*ZDL(gt1,j2)*ZP(gt3,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yu(j1,j2))*dZP(gt3,2)*ZDL(gt1,j2)*ZUR(gt2,j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yu(j1,j2))*dZDL(gt1,j2)*ZP(gt3,2)*ZUR(gt2,j1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dYu(j1,j2))*ZDL(gt1,j2)*ZP(gt3,2)*ZUR(gt2,j1)
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFdFuHpm
Subroutine CT_CouplingFvFvhh(gt1,gt2,gt3,lamN,Yv,ZH,UV,dlamN,dYv,dZH,dUV, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: ZH(3,3),dZH(3,3)
Complex(dp), Intent(in) :: lamN(3,3),Yv(3,3),UV(9,9),dlamN(3,3),dYv(3,3),dUV(9,9)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingFvFvhh'
If ((gt1.Lt.1).Or.(gt1.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt1,j2))*Conjg(UV(gt2,3 + j1))*dZH(gt3,2)*Yv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt1,3 + j1))*Conjg(UV(gt2,j2))*dZH(gt3,2)*Yv(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt1,j2))*Conjg(UV(gt2,3 + j1))*dYv(j1,j2)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt1,3 + j1))*Conjg(UV(gt2,j2))*dYv(j1,j2)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt2,j2))*Conjg(UV(gt1,3 + j1))*Yv(j1,j2)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt2,3 + j1))*Conjg(UV(gt1,j2))*Yv(j1,j2)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt1,j2))*Conjg(UV(gt2,3 + j1))*Yv(j1,j2)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt1,3 + j1))*Conjg(UV(gt2,j2))*Yv(j1,j2)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt1,6 + j2))*Conjg(UV(gt2,3 + j1))*dlamN(j1,j2)*ZH(gt3,3))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt1,3 + j1))*Conjg(UV(gt2,6 + j2))*dlamN(j1,j2)*ZH(gt3,3))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt1,6 + j2))*Conjg(UV(gt2,3 + j1))*dZH(gt3,3)*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(UV(gt1,3 + j1))*Conjg(UV(gt2,6 + j2))*dZH(gt3,3)*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt2,6 + j2))*Conjg(UV(gt1,3 + j1))*ZH(gt3,3)*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt2,3 + j1))*Conjg(UV(gt1,6 + j2))*ZH(gt3,3)*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt1,6 + j2))*Conjg(UV(gt2,3 + j1))*ZH(gt3,3)*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL-((Conjg(dUV(gt1,3 + j1))*Conjg(UV(gt2,6 + j2))*ZH(gt3,3)*lamN(j1,j2))/sqrt(2._dp))
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*dZH(gt3,2)*UV(gt1,j2)*UV(gt2,3 + j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(lamN(j1,j2))*dZH(gt3,3)*UV(gt1,6 + j2)*UV(gt2,3 + j1))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*dZH(gt3,2)*UV(gt1,3 + j1)*UV(gt2,j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(lamN(j1,j2))*dZH(gt3,3)*UV(gt1,3 + j1)*UV(gt2,6 + j2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*dUV(gt2,j2)*UV(gt1,3 + j1)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*dUV(gt2,3 + j1)*UV(gt1,j2)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*dUV(gt1,j2)*UV(gt2,3 + j1)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYv(j1,j2))*UV(gt1,j2)*UV(gt2,3 + j1)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(Yv(j1,j2))*dUV(gt1,3 + j1)*UV(gt2,j2)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dYv(j1,j2))*UV(gt1,3 + j1)*UV(gt2,j2)*ZH(gt3,2))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(lamN(j1,j2))*dUV(gt2,6 + j2)*UV(gt1,3 + j1)*ZH(gt3,3))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(lamN(j1,j2))*dUV(gt2,3 + j1)*UV(gt1,6 + j2)*ZH(gt3,3))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(lamN(j1,j2))*dUV(gt1,6 + j2)*UV(gt2,3 + j1)*ZH(gt3,3))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dlamN(j1,j2))*UV(gt1,6 + j2)*UV(gt2,3 + j1)*ZH(gt3,3))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(lamN(j1,j2))*dUV(gt1,3 + j1)*UV(gt2,6 + j2)*ZH(gt3,3))/sqrt(2._dp))
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR-((Conjg(dlamN(j1,j2))*UV(gt1,3 + j1)*UV(gt2,6 + j2)*ZH(gt3,3))/sqrt(2._dp))
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingFvFvhh
Subroutine CT_CouplingcFeFvHpm(gt1,gt2,gt3,Ye,Yv,ZP,UV,ZEL,ZER,dYe,dYv, &
& dZP,dUV,dZEL,dZER,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: ZP(2,2),dZP(2,2)
Complex(dp), Intent(in) :: Ye(3,3),Yv(3,3),UV(9,9),ZEL(3,3),ZER(3,3),dYe(3,3),dYv(3,3),dUV(9,9),dZEL(3,3),dZER(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFeFvHpm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UV(gt2,j2))*Conjg(ZER(gt1,j1))*dZP(gt3,1)*Ye(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UV(gt2,j2))*Conjg(ZER(gt1,j1))*dYe(j1,j2)*ZP(gt3,1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZER(gt1,j1))*Conjg(UV(gt2,j2))*Ye(j1,j2)*ZP(gt3,1)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dUV(gt2,j2))*Conjg(ZER(gt1,j1))*Ye(j1,j2)*ZP(gt3,1)
End Do
End Do
resR = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yv(j1,j2))*dZP(gt3,2)*UV(gt2,3 + j1)*ZEL(gt1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yv(j1,j2))*dZEL(gt1,j2)*UV(gt2,3 + j1)*ZP(gt3,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yv(j1,j2))*dUV(gt2,3 + j1)*ZEL(gt1,j2)*ZP(gt3,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dYv(j1,j2))*UV(gt2,3 + j1)*ZEL(gt1,j2)*ZP(gt3,2)
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFeFvHpm
Subroutine CT_CouplingcChaFvSe(gt1,gt2,gt3,g2,Ye,Yv,ZE,UV,UM,UP,dg2,dYe, &
& dYv,dZE,dUV,dUM,dUP,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: Ye(3,3),Yv(3,3),ZE(6,6),UV(9,9),UM(2,2),UP(2,2),dYe(3,3),dYv(3,3),dZE(6,6), &
& dUV(9,9),dUM(2,2),dUP(2,2)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcChaFvSe'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UP(gt1,2))*Conjg(UV(gt2,3 + j1))*Conjg(ZE(gt3,j2))*dYv(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZE(gt3,j2))*Conjg(UP(gt1,2))*Conjg(UV(gt2,3 + j1))*Yv(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dUV(gt2,3 + j1))*Conjg(UP(gt1,2))*Conjg(ZE(gt3,j2))*Yv(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dUP(gt1,2))*Conjg(UV(gt2,3 + j1))*Conjg(ZE(gt3,j2))*Yv(j1,j2)
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR-(g2*Conjg(ZE(gt3,j1))*dUV(gt2,j1)*UM(gt1,1))
End Do
Do j1 = 1,3
resR = resR-(g2*Conjg(ZE(gt3,j1))*dUM(gt1,1)*UV(gt2,j1))
End Do
Do j1 = 1,3
resR = resR-(g2*Conjg(dZE(gt3,j1))*UM(gt1,1)*UV(gt2,j1))
End Do
Do j1 = 1,3
resR = resR-(dg2*Conjg(ZE(gt3,j1))*UM(gt1,1)*UV(gt2,j1))
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Ye(j1,j2))*Conjg(ZE(gt3,3 + j1))*dUV(gt2,j2)*UM(gt1,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Ye(j1,j2))*Conjg(ZE(gt3,3 + j1))*dUM(gt1,2)*UV(gt2,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dZE(gt3,3 + j1))*Conjg(Ye(j1,j2))*UM(gt1,2)*UV(gt2,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dYe(j1,j2))*Conjg(ZE(gt3,3 + j1))*UM(gt1,2)*UV(gt2,j2)
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcChaFvSe
Subroutine CT_CouplingcFdGluSd(gt1,gt3,g3,pG,ZD,ZDL,ZDR,dg3,dpG,dZD,dZDL, &
& dZDR,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt3
Real(dp), Intent(in) :: g3,dg3
Complex(dp), Intent(in) :: pG,ZD(6,6),ZDL(3,3),ZDR(3,3),dpG,dZD(6,6),dZDL(3,3),dZDR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFdGluSd'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL+sqrt(2._dp)*g3*pG*Conjg(dZDR(gt1,j1))*Conjg(ZD(gt3,3 + j1))
End Do
Do j1 = 1,3
resL = resL+sqrt(2._dp)*g3*pG*Conjg(dZD(gt3,3 + j1))*Conjg(ZDR(gt1,j1))
End Do
Do j1 = 1,3
resL = resL+sqrt(2._dp)*dpG*g3*Conjg(ZD(gt3,3 + j1))*Conjg(ZDR(gt1,j1))
End Do
Do j1 = 1,3
resL = resL+sqrt(2._dp)*dg3*pG*Conjg(ZD(gt3,3 + j1))*Conjg(ZDR(gt1,j1))
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*g3*Conjg(pG)*Conjg(ZD(gt3,j1))*dZDL(gt1,j1))
End Do
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*g3*Conjg(pG)*Conjg(dZD(gt3,j1))*ZDL(gt1,j1))
End Do
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*g3*Conjg(dpG)*Conjg(ZD(gt3,j1))*ZDL(gt1,j1))
End Do
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*dg3*Conjg(pG)*Conjg(ZD(gt3,j1))*ZDL(gt1,j1))
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFdGluSd
Subroutine CT_CouplingcFuGluSu(gt1,gt3,g3,pG,ZU,ZUL,ZUR,dg3,dpG,dZU,dZUL, &
& dZUR,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt3
Real(dp), Intent(in) :: g3,dg3
Complex(dp), Intent(in) :: pG,ZU(6,6),ZUL(3,3),ZUR(3,3),dpG,dZU(6,6),dZUL(3,3),dZUR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFuGluSu'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL+sqrt(2._dp)*g3*pG*Conjg(dZUR(gt1,j1))*Conjg(ZU(gt3,3 + j1))
End Do
Do j1 = 1,3
resL = resL+sqrt(2._dp)*g3*pG*Conjg(dZU(gt3,3 + j1))*Conjg(ZUR(gt1,j1))
End Do
Do j1 = 1,3
resL = resL+sqrt(2._dp)*dpG*g3*Conjg(ZU(gt3,3 + j1))*Conjg(ZUR(gt1,j1))
End Do
Do j1 = 1,3
resL = resL+sqrt(2._dp)*dg3*pG*Conjg(ZU(gt3,3 + j1))*Conjg(ZUR(gt1,j1))
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*g3*Conjg(pG)*Conjg(ZU(gt3,j1))*dZUL(gt1,j1))
End Do
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*g3*Conjg(pG)*Conjg(dZU(gt3,j1))*ZUL(gt1,j1))
End Do
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*g3*Conjg(dpG)*Conjg(ZU(gt3,j1))*ZUL(gt1,j1))
End Do
Do j1 = 1,3
resR = resR-(sqrt(2._dp)*dg3*Conjg(pG)*Conjg(ZU(gt3,j1))*ZUL(gt1,j1))
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFuGluSu
Subroutine CT_CouplingcChacFuSd(gt1,gt2,gt3,g2,Yd,Yu,ZD,UM,UP,ZUL,ZUR,dg2, &
& dYd,dYu,dZD,dUM,dUP,dZUL,dZUR,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2,gt3
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: Yd(3,3),Yu(3,3),ZD(6,6),UM(2,2),UP(2,2),ZUL(3,3),ZUR(3,3),dYd(3,3),dYu(3,3), &
& dZD(6,6),dUM(2,2),dUP(2,2),dZUL(3,3),dZUR(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcChacFuSd'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
If ((gt3.Lt.1).Or.(gt3.Gt.6)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt3 out of range', gt3
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt3 out of range', gt3
Call TerminateProgram
End If
resL = 0._dp
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(UP(gt1,2))*Conjg(ZD(gt3,j2))*Conjg(ZUR(gt2,j1))*dYu(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZUR(gt2,j1))*Conjg(UP(gt1,2))*Conjg(ZD(gt3,j2))*Yu(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dZD(gt3,j2))*Conjg(UP(gt1,2))*Conjg(ZUR(gt2,j1))*Yu(j1,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resL = resL+Conjg(dUP(gt1,2))*Conjg(ZD(gt3,j2))*Conjg(ZUR(gt2,j1))*Yu(j1,j2)
End Do
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR-(g2*Conjg(ZD(gt3,j1))*dZUL(gt2,j1)*UM(gt1,1))
End Do
Do j1 = 1,3
resR = resR-(g2*Conjg(ZD(gt3,j1))*dUM(gt1,1)*ZUL(gt2,j1))
End Do
Do j1 = 1,3
resR = resR-(g2*Conjg(dZD(gt3,j1))*UM(gt1,1)*ZUL(gt2,j1))
End Do
Do j1 = 1,3
resR = resR-(dg2*Conjg(ZD(gt3,j1))*UM(gt1,1)*ZUL(gt2,j1))
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yd(j1,j2))*Conjg(ZD(gt3,3 + j1))*dZUL(gt2,j2)*UM(gt1,2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(Yd(j1,j2))*Conjg(ZD(gt3,3 + j1))*dUM(gt1,2)*ZUL(gt2,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dZD(gt3,3 + j1))*Conjg(Yd(j1,j2))*UM(gt1,2)*ZUL(gt2,j2)
End Do
End Do
Do j2 = 1,3
Do j1 = 1,3
resR = resR+Conjg(dYd(j1,j2))*Conjg(ZD(gt3,3 + j1))*UM(gt1,2)*ZUL(gt2,j2)
End Do
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcChacFuSd
Subroutine CT_CouplingChiChacVWm(gt1,gt2,g2,ZN,UM,UP,dg2,dZN,dUM,dUP,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: ZN(5,5),UM(2,2),UP(2,2),dZN(5,5),dUM(2,2),dUP(2,2)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingChiChacVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
resL = resL-(g2*Conjg(UM(gt2,1))*dZN(gt1,2))
resL = resL-((g2*Conjg(UM(gt2,2))*dZN(gt1,3))/sqrt(2._dp))
resL = resL-(g2*Conjg(dUM(gt2,1))*ZN(gt1,2))
resL = resL-(dg2*Conjg(UM(gt2,1))*ZN(gt1,2))
resL = resL-((g2*Conjg(dUM(gt2,2))*ZN(gt1,3))/sqrt(2._dp))
resL = resL-((dg2*Conjg(UM(gt2,2))*ZN(gt1,3))/sqrt(2._dp))
resR = 0._dp
resR = resR-(g2*Conjg(ZN(gt1,2))*dUP(gt2,1))
resR = resR+(g2*Conjg(ZN(gt1,4))*dUP(gt2,2))/sqrt(2._dp)
resR = resR-(g2*Conjg(dZN(gt1,2))*UP(gt2,1))
resR = resR-(dg2*Conjg(ZN(gt1,2))*UP(gt2,1))
resR = resR+(g2*Conjg(dZN(gt1,4))*UP(gt2,2))/sqrt(2._dp)
resR = resR+(dg2*Conjg(ZN(gt1,4))*UP(gt2,2))/sqrt(2._dp)
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingChiChacVWm
Subroutine CT_CouplingcChaChaVP(gt1,gt2,g1,g2,UM,UP,TW,dg1,dg2,dUM,dUP, &
& dSinTW,dCosTW,dTanTW,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(in) :: UM(2,2),UP(2,2),dUM(2,2),dUP(2,2)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcChaChaVP'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
resL = resL+(g1*Conjg(UM(gt2,2))*Cos(TW)*dUM(gt1,2))/2._dp
resL = resL+g2*Conjg(UM(gt2,1))*dUM(gt1,1)*Sin(TW)
resL = resL+(g2*Conjg(UM(gt2,2))*dUM(gt1,2)*Sin(TW))/2._dp
resL = resL+dSinTW*g2*Conjg(UM(gt2,1))*UM(gt1,1)
resL = resL+g2*Conjg(dUM(gt2,1))*Sin(TW)*UM(gt1,1)
resL = resL+dg2*Conjg(UM(gt2,1))*Sin(TW)*UM(gt1,1)
resL = resL+(dCosTW*g1*Conjg(UM(gt2,2))*UM(gt1,2))/2._dp
resL = resL+(dSinTW*g2*Conjg(UM(gt2,2))*UM(gt1,2))/2._dp
resL = resL+(g1*Conjg(dUM(gt2,2))*Cos(TW)*UM(gt1,2))/2._dp
resL = resL+(dg1*Conjg(UM(gt2,2))*Cos(TW)*UM(gt1,2))/2._dp
resL = resL+(g2*Conjg(dUM(gt2,2))*Sin(TW)*UM(gt1,2))/2._dp
resL = resL+(dg2*Conjg(UM(gt2,2))*Sin(TW)*UM(gt1,2))/2._dp
resR = 0._dp
resR = resR+(g1*Conjg(UP(gt1,2))*Cos(TW)*dUP(gt2,2))/2._dp
resR = resR+g2*Conjg(UP(gt1,1))*dUP(gt2,1)*Sin(TW)
resR = resR+(g2*Conjg(UP(gt1,2))*dUP(gt2,2)*Sin(TW))/2._dp
resR = resR+dSinTW*g2*Conjg(UP(gt1,1))*UP(gt2,1)
resR = resR+g2*Conjg(dUP(gt1,1))*Sin(TW)*UP(gt2,1)
resR = resR+dg2*Conjg(UP(gt1,1))*Sin(TW)*UP(gt2,1)
resR = resR+(dCosTW*g1*Conjg(UP(gt1,2))*UP(gt2,2))/2._dp
resR = resR+(dSinTW*g2*Conjg(UP(gt1,2))*UP(gt2,2))/2._dp
resR = resR+(g1*Conjg(dUP(gt1,2))*Cos(TW)*UP(gt2,2))/2._dp
resR = resR+(dg1*Conjg(UP(gt1,2))*Cos(TW)*UP(gt2,2))/2._dp
resR = resR+(g2*Conjg(dUP(gt1,2))*Sin(TW)*UP(gt2,2))/2._dp
resR = resR+(dg2*Conjg(UP(gt1,2))*Sin(TW)*UP(gt2,2))/2._dp
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcChaChaVP
Subroutine CT_CouplingcChaChaVZ(gt1,gt2,g1,g2,UM,UP,TW,dg1,dg2,dUM,dUP, &
& dSinTW,dCosTW,dTanTW,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(in) :: UM(2,2),UP(2,2),dUM(2,2),dUP(2,2)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcChaChaVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
resL = resL+g2*Conjg(UM(gt2,1))*Cos(TW)*dUM(gt1,1)
resL = resL+(g2*Conjg(UM(gt2,2))*Cos(TW)*dUM(gt1,2))/2._dp
resL = resL-(g1*Conjg(UM(gt2,2))*dUM(gt1,2)*Sin(TW))/2._dp
resL = resL+dCosTW*g2*Conjg(UM(gt2,1))*UM(gt1,1)
resL = resL+g2*Conjg(dUM(gt2,1))*Cos(TW)*UM(gt1,1)
resL = resL+dg2*Conjg(UM(gt2,1))*Cos(TW)*UM(gt1,1)
resL = resL-(dSinTW*g1*Conjg(UM(gt2,2))*UM(gt1,2))/2._dp
resL = resL+(dCosTW*g2*Conjg(UM(gt2,2))*UM(gt1,2))/2._dp
resL = resL+(g2*Conjg(dUM(gt2,2))*Cos(TW)*UM(gt1,2))/2._dp
resL = resL+(dg2*Conjg(UM(gt2,2))*Cos(TW)*UM(gt1,2))/2._dp
resL = resL-(g1*Conjg(dUM(gt2,2))*Sin(TW)*UM(gt1,2))/2._dp
resL = resL-(dg1*Conjg(UM(gt2,2))*Sin(TW)*UM(gt1,2))/2._dp
resR = 0._dp
resR = resR+g2*Conjg(UP(gt1,1))*Cos(TW)*dUP(gt2,1)
resR = resR+(g2*Conjg(UP(gt1,2))*Cos(TW)*dUP(gt2,2))/2._dp
resR = resR-(g1*Conjg(UP(gt1,2))*dUP(gt2,2)*Sin(TW))/2._dp
resR = resR+dCosTW*g2*Conjg(UP(gt1,1))*UP(gt2,1)
resR = resR+g2*Conjg(dUP(gt1,1))*Cos(TW)*UP(gt2,1)
resR = resR+dg2*Conjg(UP(gt1,1))*Cos(TW)*UP(gt2,1)
resR = resR-(dSinTW*g1*Conjg(UP(gt1,2))*UP(gt2,2))/2._dp
resR = resR+(dCosTW*g2*Conjg(UP(gt1,2))*UP(gt2,2))/2._dp
resR = resR+(g2*Conjg(dUP(gt1,2))*Cos(TW)*UP(gt2,2))/2._dp
resR = resR+(dg2*Conjg(UP(gt1,2))*Cos(TW)*UP(gt2,2))/2._dp
resR = resR-(g1*Conjg(dUP(gt1,2))*Sin(TW)*UP(gt2,2))/2._dp
resR = resR-(dg1*Conjg(UP(gt1,2))*Sin(TW)*UP(gt2,2))/2._dp
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcChaChaVZ
Subroutine CT_CouplingChiChiVZ(gt1,gt2,g1,g2,ZN,TW,dg1,dg2,dZN,dSinTW,dCosTW, &
& dTanTW,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(in) :: ZN(5,5),dZN(5,5)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingChiChiVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
resL = resL-(g2*Conjg(ZN(gt2,3))*Cos(TW)*dZN(gt1,3))/2._dp
resL = resL+(g2*Conjg(ZN(gt2,4))*Cos(TW)*dZN(gt1,4))/2._dp
resL = resL-(g1*Conjg(ZN(gt2,3))*dZN(gt1,3)*Sin(TW))/2._dp
resL = resL+(g1*Conjg(ZN(gt2,4))*dZN(gt1,4)*Sin(TW))/2._dp
resL = resL-(dSinTW*g1*Conjg(ZN(gt2,3))*ZN(gt1,3))/2._dp
resL = resL-(dCosTW*g2*Conjg(ZN(gt2,3))*ZN(gt1,3))/2._dp
resL = resL-(g2*Conjg(dZN(gt2,3))*Cos(TW)*ZN(gt1,3))/2._dp
resL = resL-(dg2*Conjg(ZN(gt2,3))*Cos(TW)*ZN(gt1,3))/2._dp
resL = resL-(g1*Conjg(dZN(gt2,3))*Sin(TW)*ZN(gt1,3))/2._dp
resL = resL-(dg1*Conjg(ZN(gt2,3))*Sin(TW)*ZN(gt1,3))/2._dp
resL = resL+(dSinTW*g1*Conjg(ZN(gt2,4))*ZN(gt1,4))/2._dp
resL = resL+(dCosTW*g2*Conjg(ZN(gt2,4))*ZN(gt1,4))/2._dp
resL = resL+(g2*Conjg(dZN(gt2,4))*Cos(TW)*ZN(gt1,4))/2._dp
resL = resL+(dg2*Conjg(ZN(gt2,4))*Cos(TW)*ZN(gt1,4))/2._dp
resL = resL+(g1*Conjg(dZN(gt2,4))*Sin(TW)*ZN(gt1,4))/2._dp
resL = resL+(dg1*Conjg(ZN(gt2,4))*Sin(TW)*ZN(gt1,4))/2._dp
resR = 0._dp
resR = resR+(g2*Conjg(ZN(gt1,3))*Cos(TW)*dZN(gt2,3))/2._dp
resR = resR-(g2*Conjg(ZN(gt1,4))*Cos(TW)*dZN(gt2,4))/2._dp
resR = resR+(g1*Conjg(ZN(gt1,3))*dZN(gt2,3)*Sin(TW))/2._dp
resR = resR-(g1*Conjg(ZN(gt1,4))*dZN(gt2,4)*Sin(TW))/2._dp
resR = resR+(dSinTW*g1*Conjg(ZN(gt1,3))*ZN(gt2,3))/2._dp
resR = resR+(dCosTW*g2*Conjg(ZN(gt1,3))*ZN(gt2,3))/2._dp
resR = resR+(g2*Conjg(dZN(gt1,3))*Cos(TW)*ZN(gt2,3))/2._dp
resR = resR+(dg2*Conjg(ZN(gt1,3))*Cos(TW)*ZN(gt2,3))/2._dp
resR = resR+(g1*Conjg(dZN(gt1,3))*Sin(TW)*ZN(gt2,3))/2._dp
resR = resR+(dg1*Conjg(ZN(gt1,3))*Sin(TW)*ZN(gt2,3))/2._dp
resR = resR-(dSinTW*g1*Conjg(ZN(gt1,4))*ZN(gt2,4))/2._dp
resR = resR-(dCosTW*g2*Conjg(ZN(gt1,4))*ZN(gt2,4))/2._dp
resR = resR-(g2*Conjg(dZN(gt1,4))*Cos(TW)*ZN(gt2,4))/2._dp
resR = resR-(dg2*Conjg(ZN(gt1,4))*Cos(TW)*ZN(gt2,4))/2._dp
resR = resR-(g1*Conjg(dZN(gt1,4))*Sin(TW)*ZN(gt2,4))/2._dp
resR = resR-(dg1*Conjg(ZN(gt1,4))*Sin(TW)*ZN(gt2,4))/2._dp
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingChiChiVZ
Subroutine CT_CouplingcChaChiVWm(gt1,gt2,g2,ZN,UM,UP,dg2,dZN,dUM,dUP,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: ZN(5,5),UM(2,2),UP(2,2),dZN(5,5),dUM(2,2),dUP(2,2)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcChaChiVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.2)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.5)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
resL = resL-(g2*Conjg(ZN(gt2,2))*dUM(gt1,1))
resL = resL-((g2*Conjg(ZN(gt2,3))*dUM(gt1,2))/sqrt(2._dp))
resL = resL-(g2*Conjg(dZN(gt2,2))*UM(gt1,1))
resL = resL-(dg2*Conjg(ZN(gt2,2))*UM(gt1,1))
resL = resL-((g2*Conjg(dZN(gt2,3))*UM(gt1,2))/sqrt(2._dp))
resL = resL-((dg2*Conjg(ZN(gt2,3))*UM(gt1,2))/sqrt(2._dp))
resR = 0._dp
resR = resR-(g2*Conjg(UP(gt1,1))*dZN(gt2,2))
resR = resR+(g2*Conjg(UP(gt1,2))*dZN(gt2,4))/sqrt(2._dp)
resR = resR-(g2*Conjg(dUP(gt1,1))*ZN(gt2,2))
resR = resR-(dg2*Conjg(UP(gt1,1))*ZN(gt2,2))
resR = resR+(g2*Conjg(dUP(gt1,2))*ZN(gt2,4))/sqrt(2._dp)
resR = resR+(dg2*Conjg(UP(gt1,2))*ZN(gt2,4))/sqrt(2._dp)
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcChaChiVWm
Subroutine CT_CouplingcFdFdVG(gt1,gt2,g3,dg3,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g3,dg3
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFdFdVG'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
If ((gt1.eq.gt2)) Then
resL = resL-1._dp*(dg3)
End If
resR = 0._dp
If ((gt1.eq.gt2)) Then
resR = resR-1._dp*(dg3)
End If
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFdFdVG
Subroutine CT_CouplingcFdFdVP(gt1,gt2,g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFdFdVP'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
If ((gt1.eq.gt2)) Then
resL = resL-(dCosTW*g1)/6._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL+(dSinTW*g2)/2._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL-(dg1*Cos(TW))/6._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL+(dg2*Sin(TW))/2._dp
End If
resR = 0._dp
If ((gt1.eq.gt2)) Then
resR = resR+(dCosTW*g1)/3._dp
End If
If ((gt1.eq.gt2)) Then
resR = resR+(dg1*Cos(TW))/3._dp
End If
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFdFdVP
Subroutine CT_CouplingcFdFdVZ(gt1,gt2,g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFdFdVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
If ((gt1.eq.gt2)) Then
resL = resL+(dSinTW*g1)/6._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL+(dCosTW*g2)/2._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL+(dg2*Cos(TW))/2._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL+(dg1*Sin(TW))/6._dp
End If
resR = 0._dp
If ((gt1.eq.gt2)) Then
resR = resR-(dSinTW*g1)/3._dp
End If
If ((gt1.eq.gt2)) Then
resR = resR-(dg1*Sin(TW))/3._dp
End If
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFdFdVZ
Subroutine CT_CouplingcFuFdcVWm(gt1,gt2,g2,ZDL,ZUL,dg2,dZDL,dZUL,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: ZDL(3,3),ZUL(3,3),dZDL(3,3),dZUL(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFuFdcVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-((g2*Conjg(ZDL(gt2,j1))*dZUL(gt1,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((g2*Conjg(dZDL(gt2,j1))*ZUL(gt1,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((dg2*Conjg(ZDL(gt2,j1))*ZUL(gt1,j1))/sqrt(2._dp))
End Do
resR = 0._dp
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFuFdcVWm
Subroutine CT_CouplingFvFecVWm(gt1,gt2,g2,UV,ZEL,dg2,dUV,dZEL,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: UV(9,9),ZEL(3,3),dUV(9,9),dZEL(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingFvFecVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-((g2*Conjg(ZEL(gt2,j1))*dUV(gt1,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((g2*Conjg(dZEL(gt2,j1))*UV(gt1,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((dg2*Conjg(ZEL(gt2,j1))*UV(gt1,j1))/sqrt(2._dp))
End Do
resR = 0._dp
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingFvFecVWm
Subroutine CT_CouplingcFeFeVP(gt1,gt2,g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFeFeVP'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
If ((gt1.eq.gt2)) Then
resL = resL+(dCosTW*g1)/2._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL+(dSinTW*g2)/2._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL+(dg1*Cos(TW))/2._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL+(dg2*Sin(TW))/2._dp
End If
resR = 0._dp
If ((gt1.eq.gt2)) Then
resR = resR+dCosTW*g1
End If
If ((gt1.eq.gt2)) Then
resR = resR+dg1*Cos(TW)
End If
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFeFeVP
Subroutine CT_CouplingcFeFeVZ(gt1,gt2,g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFeFeVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
If ((gt1.eq.gt2)) Then
resL = resL-(dSinTW*g1)/2._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL+(dCosTW*g2)/2._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL+(dg2*Cos(TW))/2._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL-(dg1*Sin(TW))/2._dp
End If
resR = 0._dp
If ((gt1.eq.gt2)) Then
resR = resR-(dSinTW*g1)
End If
If ((gt1.eq.gt2)) Then
resR = resR-(dg1*Sin(TW))
End If
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFeFeVZ
Subroutine CT_CouplingcFuFuVG(gt1,gt2,g3,dg3,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g3,dg3
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFuFuVG'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
If ((gt1.eq.gt2)) Then
resL = resL-1._dp*(dg3)
End If
resR = 0._dp
If ((gt1.eq.gt2)) Then
resR = resR-1._dp*(dg3)
End If
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFuFuVG
Subroutine CT_CouplingcFuFuVP(gt1,gt2,g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFuFuVP'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
If ((gt1.eq.gt2)) Then
resL = resL-(dCosTW*g1)/6._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL-(dSinTW*g2)/2._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL-(dg1*Cos(TW))/6._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL-(dg2*Sin(TW))/2._dp
End If
resR = 0._dp
If ((gt1.eq.gt2)) Then
resR = resR+(-2*dCosTW*g1)/3._dp
End If
If ((gt1.eq.gt2)) Then
resR = resR+(-2*dg1*Cos(TW))/3._dp
End If
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFuFuVP
Subroutine CT_CouplingcFdFuVWm(gt1,gt2,g2,ZDL,ZUL,dg2,dZDL,dZUL,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: ZDL(3,3),ZUL(3,3),dZDL(3,3),dZUL(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFdFuVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-((g2*Conjg(ZUL(gt2,j1))*dZDL(gt1,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((g2*Conjg(dZUL(gt2,j1))*ZDL(gt1,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((dg2*Conjg(ZUL(gt2,j1))*ZDL(gt1,j1))/sqrt(2._dp))
End Do
resR = 0._dp
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFdFuVWm
Subroutine CT_CouplingcFuFuVZ(gt1,gt2,g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW, &
& resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFuFuVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
If ((gt1.eq.gt2)) Then
resL = resL+(dSinTW*g1)/6._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL-(dCosTW*g2)/2._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL-(dg2*Cos(TW))/2._dp
End If
If ((gt1.eq.gt2)) Then
resL = resL+(dg1*Sin(TW))/6._dp
End If
resR = 0._dp
If ((gt1.eq.gt2)) Then
resR = resR+(2*dSinTW*g1)/3._dp
End If
If ((gt1.eq.gt2)) Then
resR = resR+(2*dg1*Sin(TW))/3._dp
End If
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFuFuVZ
Subroutine CT_CouplingFvFvVZ(gt1,gt2,g1,g2,UV,TW,dg1,dg2,dUV,dSinTW,dCosTW, &
& dTanTW,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g1,g2,TW,dg1,dg2,dSinTW,dCosTW,dTanTW
Complex(dp), Intent(in) :: UV(9,9),dUV(9,9)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingFvFvVZ'
If ((gt1.Lt.1).Or.(gt1.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-(g2*Conjg(UV(gt2,j1))*Cos(TW)*dUV(gt1,j1))/2._dp
End Do
Do j1 = 1,3
resL = resL-(g1*Conjg(UV(gt2,j1))*dUV(gt1,j1)*Sin(TW))/2._dp
End Do
Do j1 = 1,3
resL = resL-(dSinTW*g1*Conjg(UV(gt2,j1))*UV(gt1,j1))/2._dp
End Do
Do j1 = 1,3
resL = resL-(dCosTW*g2*Conjg(UV(gt2,j1))*UV(gt1,j1))/2._dp
End Do
Do j1 = 1,3
resL = resL-(g2*Conjg(dUV(gt2,j1))*Cos(TW)*UV(gt1,j1))/2._dp
End Do
Do j1 = 1,3
resL = resL-(dg2*Conjg(UV(gt2,j1))*Cos(TW)*UV(gt1,j1))/2._dp
End Do
Do j1 = 1,3
resL = resL-(g1*Conjg(dUV(gt2,j1))*Sin(TW)*UV(gt1,j1))/2._dp
End Do
Do j1 = 1,3
resL = resL-(dg1*Conjg(UV(gt2,j1))*Sin(TW)*UV(gt1,j1))/2._dp
End Do
resR = 0._dp
Do j1 = 1,3
resR = resR+(g2*Conjg(UV(gt1,j1))*Cos(TW)*dUV(gt2,j1))/2._dp
End Do
Do j1 = 1,3
resR = resR+(g1*Conjg(UV(gt1,j1))*dUV(gt2,j1)*Sin(TW))/2._dp
End Do
Do j1 = 1,3
resR = resR+(dSinTW*g1*Conjg(UV(gt1,j1))*UV(gt2,j1))/2._dp
End Do
Do j1 = 1,3
resR = resR+(dCosTW*g2*Conjg(UV(gt1,j1))*UV(gt2,j1))/2._dp
End Do
Do j1 = 1,3
resR = resR+(g2*Conjg(dUV(gt1,j1))*Cos(TW)*UV(gt2,j1))/2._dp
End Do
Do j1 = 1,3
resR = resR+(dg2*Conjg(UV(gt1,j1))*Cos(TW)*UV(gt2,j1))/2._dp
End Do
Do j1 = 1,3
resR = resR+(g1*Conjg(dUV(gt1,j1))*Sin(TW)*UV(gt2,j1))/2._dp
End Do
Do j1 = 1,3
resR = resR+(dg1*Conjg(UV(gt1,j1))*Sin(TW)*UV(gt2,j1))/2._dp
End Do
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingFvFvVZ
Subroutine CT_CouplingcFeFvVWm(gt1,gt2,g2,UV,ZEL,dg2,dUV,dZEL,resL,resR)
Implicit None
Integer, Intent(in) :: gt1,gt2
Real(dp), Intent(in) :: g2,dg2
Complex(dp), Intent(in) :: UV(9,9),ZEL(3,3),dUV(9,9),dZEL(3,3)
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingcFeFvVWm'
If ((gt1.Lt.1).Or.(gt1.Gt.3)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt1 out of range', gt1
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt1 out of range', gt1
Call TerminateProgram
End If
If ((gt2.Lt.1).Or.(gt2.Gt.9)) Then
Write (ErrCan,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (ErrCan,*) 'index gt2 out of range', gt2
Write (*,*) 'Problem in Subroutine ',NameOfUnit(Iname)
Write (*,*) 'index gt2 out of range', gt2
Call TerminateProgram
End If
resL = 0._dp
Do j1 = 1,3
resL = resL-((g2*Conjg(UV(gt2,j1))*dZEL(gt1,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((g2*Conjg(dUV(gt2,j1))*ZEL(gt1,j1))/sqrt(2._dp))
End Do
Do j1 = 1,3
resL = resL-((dg2*Conjg(UV(gt2,j1))*ZEL(gt1,j1))/sqrt(2._dp))
End Do
resR = 0._dp
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingcFeFvVWm
Subroutine CT_CouplingGluGluVG(g3,pG,dg3,dpG,resL,resR)
Implicit None
Real(dp), Intent(in) :: g3,dg3
Complex(dp), Intent(in) :: pG,dpG
Complex(dp), Intent(out) :: resL, resR
Integer :: j1,j2,j3,j4,j5,j6, j7, j8, j9, j10, j11, j12
Iname = Iname +1
NameOfUnit(Iname) = 'CT_CouplingGluGluVG'
resL = 0._dp
resL = resL-(g3*pG*Conjg(dpG))
resL = resL-(dpG*g3*Conjg(pG))
resL = resL-(dg3*pG*Conjg(pG))
resR = 0._dp
resR = resR-(g3*pG*Conjg(dpG))
resR = resR-(dpG*g3*Conjg(pG))
resR = resR-(dg3*pG*Conjg(pG))
resL = -(0.,1.)*resL
resR = -(0.,1.)*resR
If ((Real(resL,dp).ne.Real(resL,dp)).or.(Real(resR,dp).ne.Real(resR,dp))) Then
Write(*,*) "NaN appearing in ",NameOfUnit(Iname)
Call TerminateProgram
End If
Iname = Iname - 1
End Subroutine CT_CouplingGluGluVG
End Module CouplingsCT_NInvSeesaw
| {"hexsha": "73c9a23a1a67c95d584069564d09b9ff2b20076c", "size": 711348, "ext": "f90", "lang": "FORTRAN", "max_stars_repo_path": "Externals/SPheno-4.0.3/NMSSM_IS/CouplingsCT_NInvSeesaw.f90", "max_stars_repo_name": "yuanfangtardis/vscode_project", "max_stars_repo_head_hexsha": "2d78a85413cc85789cc4fee8ec991eb2a0563ef8", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Externals/SPheno-4.0.3/NMSSM_IS/CouplingsCT_NInvSeesaw.f90", "max_issues_repo_name": "yuanfangtardis/vscode_project", "max_issues_repo_head_hexsha": "2d78a85413cc85789cc4fee8ec991eb2a0563ef8", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Externals/SPheno-4.0.3/NMSSM_IS/CouplingsCT_NInvSeesaw.f90", "max_forks_repo_name": "yuanfangtardis/vscode_project", "max_forks_repo_head_hexsha": "2d78a85413cc85789cc4fee8ec991eb2a0563ef8", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-01-15T12:22:30.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-15T12:22:30.000Z", "avg_line_length": 29.2759897934, "max_line_length": 118, "alphanum_fraction": 0.6181489229, "num_tokens": 376098} |
/* Copyright (c) 2018 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License.
*/
#include "graph/service/GraphService.h"
#include <proxygen/lib/utils/CryptUtil.h>
#include <boost/filesystem.hpp>
#include "clients/storage/StorageClient.h"
#include "common/base/Base.h"
#include "common/stats/StatsManager.h"
#include "common/time/Duration.h"
#include "common/time/TimezoneInfo.h"
#include "graph/service/CloudAuthenticator.h"
#include "graph/service/GraphFlags.h"
#include "graph/service/PasswordAuthenticator.h"
#include "graph/service/RequestContext.h"
#include "graph/stats/GraphStats.h"
#include "version/Version.h"
namespace nebula {
namespace graph {
Status GraphService::init(std::shared_ptr<folly::IOThreadPoolExecutor> ioExecutor,
const HostAddr& hostAddr) {
auto addrs = network::NetworkUtils::toHosts(FLAGS_meta_server_addrs);
if (!addrs.ok()) {
return addrs.status();
}
meta::MetaClientOptions options;
options.serviceName_ = "graph";
options.skipConfig_ = FLAGS_local_config;
options.role_ = meta::cpp2::HostRole::GRAPH;
options.localHost_ = hostAddr;
options.gitInfoSHA_ = gitInfoSha();
options.rootPath_ = boost::filesystem::current_path().string();
metaClient_ = std::make_unique<meta::MetaClient>(ioExecutor, std::move(addrs.value()), options);
// Load data try 3 time
bool loadDataOk = metaClient_->waitForMetadReady(3);
if (!loadDataOk) {
// Resort to retrying in the background
LOG(ERROR) << "Failed to wait for meta service ready synchronously.";
return Status::Error("Failed to wait for meta service ready synchronously.");
}
sessionManager_ = std::make_unique<GraphSessionManager>(metaClient_.get(), hostAddr);
auto initSessionMgrStatus = sessionManager_->init();
if (!initSessionMgrStatus.ok()) {
LOG(ERROR) << "Failed to initialize session manager: " << initSessionMgrStatus.toString();
return Status::Error("Failed to initialize session manager: %s",
initSessionMgrStatus.toString().c_str());
}
queryEngine_ = std::make_unique<QueryEngine>();
return queryEngine_->init(std::move(ioExecutor), metaClient_.get());
}
folly::Future<AuthResponse> GraphService::future_authenticate(const std::string& username,
const std::string& password) {
auto* peer = getRequestContext()->getPeerAddress();
auto clientIp = peer->getAddressStr();
LOG(INFO) << "Authenticating user " << username << " from " << peer->describe();
auto ctx = std::make_unique<RequestContext<AuthResponse>>();
auto future = ctx->future();
// check username and password failed
auto authResult = auth(username, password);
if (!authResult.ok()) {
ctx->resp().errorCode = ErrorCode::E_BAD_USERNAME_PASSWORD;
ctx->resp().errorMsg.reset(new std::string(authResult.toString()));
ctx->finish();
stats::StatsManager::addValue(kNumAuthFailedSessions);
stats::StatsManager::addValue(kNumAuthFailedSessionsBadUserNamePassword);
return future;
}
if (sessionManager_->isOutOfConnections()) {
ctx->resp().errorCode = ErrorCode::E_TOO_MANY_CONNECTIONS;
ctx->resp().errorMsg.reset(new std::string("Too many connections in the cluster"));
ctx->finish();
stats::StatsManager::addValue(kNumAuthFailedSessions);
stats::StatsManager::addValue(kNumAuthFailedSessionsOutOfMaxAllowed);
return future;
}
auto cb = [user = username, cIp = clientIp, ctx = std::move(ctx)](
StatusOr<std::shared_ptr<ClientSession>> ret) mutable {
VLOG(2) << "Create session doFinish";
if (!ret.ok()) {
LOG(ERROR) << "Create session for userName: " << user << ", ip: " << cIp
<< " failed: " << ret.status();
ctx->resp().errorCode = ErrorCode::E_SESSION_INVALID;
ctx->resp().errorMsg.reset(new std::string(ret.status().toString()));
return ctx->finish();
}
auto sessionPtr = std::move(ret).value();
if (sessionPtr == nullptr) {
LOG(ERROR) << "Get session for sessionId is nullptr";
ctx->resp().errorCode = ErrorCode::E_SESSION_INVALID;
ctx->resp().errorMsg.reset(new std::string("Get session for sessionId is nullptr"));
return ctx->finish();
}
stats::StatsManager::addValue(kNumOpenedSessions);
stats::StatsManager::addValue(kNumActiveSessions);
ctx->setSession(sessionPtr);
ctx->resp().sessionId.reset(new int64_t(ctx->session()->id()));
ctx->resp().timeZoneOffsetSeconds.reset(
new int32_t(time::Timezone::getGlobalTimezone().utcOffsetSecs()));
ctx->resp().timeZoneName.reset(
new std::string(time::Timezone::getGlobalTimezone().stdZoneName()));
return ctx->finish();
};
sessionManager_->createSession(username, clientIp, getThreadManager()).thenValue(std::move(cb));
return future;
}
void GraphService::signout(int64_t sessionId) {
VLOG(2) << "Sign out session " << sessionId;
sessionManager_->removeSession(sessionId);
}
folly::Future<ExecutionResponse> GraphService::future_executeWithParameter(
int64_t sessionId,
const std::string& query,
const std::unordered_map<std::string, Value>& parameterMap) {
auto ctx = std::make_unique<RequestContext<ExecutionResponse>>();
ctx->setQuery(query);
ctx->setRunner(getThreadManager());
ctx->setSessionMgr(sessionManager_.get());
auto future = ctx->future();
// When the sessionId is 0, it means the clients to ping the connection is ok
if (sessionId == 0) {
ctx->resp().errorCode = ErrorCode::E_SESSION_INVALID;
ctx->resp().errorMsg = std::make_unique<std::string>("Invalid session id");
ctx->finish();
return future;
}
auto cb = [this, sessionId, ctx = std::move(ctx), parameterMap = std::move(parameterMap)](
StatusOr<std::shared_ptr<ClientSession>> ret) mutable {
if (!ret.ok()) {
LOG(ERROR) << "Get session for sessionId: " << sessionId << " failed: " << ret.status();
ctx->resp().errorCode = ErrorCode::E_SESSION_INVALID;
ctx->resp().errorMsg.reset(new std::string(folly::stringPrintf(
"Get sessionId[%ld] failed: %s", sessionId, ret.status().toString().c_str())));
return ctx->finish();
}
auto sessionPtr = std::move(ret).value();
if (sessionPtr == nullptr) {
LOG(ERROR) << "Get session for sessionId: " << sessionId << " is nullptr";
ctx->resp().errorCode = ErrorCode::E_SESSION_INVALID;
ctx->resp().errorMsg.reset(
new std::string(folly::stringPrintf("SessionId[%ld] does not exist", sessionId)));
return ctx->finish();
}
stats::StatsManager::addValue(kNumQueries);
stats::StatsManager::addValue(kNumActiveQueries);
if (FLAGS_enable_space_level_metrics && sessionPtr->space().name != "") {
stats::StatsManager::addValue(stats::StatsManager::counterWithLabels(
kNumQueries, {{"space", sessionPtr->space().name}}));
stats::StatsManager::addValue(stats::StatsManager::counterWithLabels(
kNumActiveQueries, {{"space", sessionPtr->space().name}}));
}
auto& spaceName = sessionPtr->space().name;
ctx->setSession(std::move(sessionPtr));
ctx->setParameterMap(parameterMap);
queryEngine_->execute(std::move(ctx));
stats::StatsManager::decValue(kNumActiveQueries);
if (FLAGS_enable_space_level_metrics && spaceName != "") {
stats::StatsManager::decValue(
stats::StatsManager::counterWithLabels(kNumActiveQueries, {{"space", spaceName}}));
}
};
sessionManager_->findSession(sessionId, getThreadManager()).thenValue(std::move(cb));
return future;
}
folly::Future<ExecutionResponse> GraphService::future_execute(int64_t sessionId,
const std::string& query) {
return future_executeWithParameter(sessionId, query, std::unordered_map<std::string, Value>{});
}
folly::Future<std::string> GraphService::future_executeJson(int64_t sessionId,
const std::string& query) {
return future_executeJsonWithParameter(
sessionId, query, std::unordered_map<std::string, Value>{});
}
folly::Future<std::string> GraphService::future_executeJsonWithParameter(
int64_t sessionId,
const std::string& query,
const std::unordered_map<std::string, Value>& parameterMap) {
return future_executeWithParameter(sessionId, query, parameterMap).thenValue([](auto&& resp) {
return folly::toJson(resp.toJson());
});
}
Status GraphService::auth(const std::string& username, const std::string& password) {
auto metaClient = queryEngine_->metaClient();
// Skip authentication if FLAGS_enable_authorize is false
if (!FLAGS_enable_authorize) {
return Status::OK();
}
// Authenticate via diffrent auth types
if (FLAGS_auth_type == "password") {
// Auth with PasswordAuthenticator
auto authenticator = std::make_unique<PasswordAuthenticator>(metaClient);
return authenticator->auth(username, proxygen::md5Encode(folly::StringPiece(password)));
} else if (FLAGS_auth_type == "cloud") {
// Cloud user and native user will be mixed.
// Since cloud user and native user has the same transport protocol,
// There is no way to identify which one is in the graph layer,
// let's check the native user's password first, then cloud user.
auto pwdAuth = std::make_unique<PasswordAuthenticator>(metaClient);
auto pwdAuthRes = pwdAuth->auth(username, proxygen::md5Encode(folly::StringPiece(password)));
if (pwdAuthRes.ok()) {
return Status::OK();
}
// Password auth failed, try cloud token
auto cloudAuth = std::make_unique<CloudAuthenticator>(metaClient);
return cloudAuth->auth(username, password);
}
LOG(WARNING) << "Unknown auth type: " << FLAGS_auth_type;
return Status::Error("Unknown auth type: %s", FLAGS_auth_type.c_str());
}
folly::Future<cpp2::VerifyClientVersionResp> GraphService::future_verifyClientVersion(
const cpp2::VerifyClientVersionReq& req) {
std::unordered_set<std::string> whiteList;
folly::splitTo<std::string>(
":", FLAGS_client_white_list, std::inserter(whiteList, whiteList.begin()));
cpp2::VerifyClientVersionResp resp;
if (FLAGS_enable_client_white_list && whiteList.find(req.get_version()) == whiteList.end()) {
std::string uniqueWhiteList;
std::for_each(whiteList.begin(), whiteList.end(), [&uniqueWhiteList](auto& version) {
uniqueWhiteList.append(version);
});
resp.error_code_ref() = nebula::cpp2::ErrorCode::E_CLIENT_SERVER_INCOMPATIBLE;
resp.error_msg_ref() = folly::stringPrintf(
"Graph client version(%s) is not accepted, current graph client white list: %s.",
req.get_version().c_str(),
uniqueWhiteList.c_str());
} else {
resp.error_code_ref() = nebula::cpp2::ErrorCode::SUCCEEDED;
}
return folly::makeFuture<cpp2::VerifyClientVersionResp>(std::move(resp));
}
} // namespace graph
} // namespace nebula
| {"hexsha": "9c6e37f12838a6be93ea4c74452a677853e07075", "size": 11015, "ext": "cpp", "lang": "C++", "max_stars_repo_path": "src/graph/service/GraphService.cpp", "max_stars_repo_name": "sworduo/nebula", "max_stars_repo_head_hexsha": "9d172209cf05b0d4fb433d2fb17f44e301cdf440", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/graph/service/GraphService.cpp", "max_issues_repo_name": "sworduo/nebula", "max_issues_repo_head_hexsha": "9d172209cf05b0d4fb433d2fb17f44e301cdf440", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/graph/service/GraphService.cpp", "max_forks_repo_name": "sworduo/nebula", "max_forks_repo_head_hexsha": "9d172209cf05b0d4fb433d2fb17f44e301cdf440", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 42.0419847328, "max_line_length": 98, "alphanum_fraction": 0.6874262369, "num_tokens": 2617} |
import numpy as np
import cv2
from PIL import Image
from random import *
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import math
from collections import deque
#dna encoding
msg_str = raw_input('Enter message: ')
key =int(raw_input('Enter shift key: '))
msg=list(msg_str)
print msg
enc=[]
bin1=[]
j=0
dna=""
for i in msg:
print i
yy=(ord(i)-97+key)%26
enc.append(chr(yy+97))
xx='{0:08b}'.format(yy+97)
bin1.append(xx)
print enc
print bin1
a=[]
a=np.array(a)
str_comp=""
matrix = [[0 for i in range(3)] for j in range(3)]
for b in bin1:
#b -> string
#complement
str_comp=""
for b1 in b:
if(b1=='0'):
str_comp=str_comp+'1'
else:
str_comp=str_comp+'0'
print type(str_comp)
matrix[0][0]=str_comp[0]
matrix[1][0]=str_comp[1]
matrix[2][0]=str_comp[2]
matrix[0][1]=str_comp[3]
matrix[1][1]=-1
matrix[2][1]=str_comp[4]
matrix[0][2]=str_comp[5]
matrix[1][2]=str_comp[6]
matrix[2][2]=str_comp[7]
print matrix
new_str=""
for i in range(3):
for j in range(3):
if(matrix[i][j]!=-1):
new_str=new_str+matrix[i][j]
print new_str
for i in range(4):
if(new_str[i]+new_str[7-i]=='00'):
dna=dna+'A'
elif(new_str[i]+new_str[7-i]=='01'):
dna=dna+'C'
elif(new_str[i]+new_str[7-i]=='10'):
dna=dna+'G'
else:
dna=dna+'T'
print "Encoded format is ",dna
img = cv2.imread("enc.png")
print "The image size is:", img.size
print "Image shape is:",img.shape
#for blue
b = img[:,:,0]
#for green
g = img[:,:,1]
#for red
r= img[:,:,2]
#for encoding algorithm mentioned in nit rourkela paper lsb technique
rs=r.copy()
bs=b.copy()
gs=g.copy()
print
print
ascii=[]
#ASCII -> bin
binary=[] #contains list of binary values for message
for i in range(len(dna)):
v=ord(dna[i])
ascii.append(v)
v1 = '{0:08b}'.format(v)
binary.append(v1)
print "binary of message",bin
#getting image dimsensions
shape=img.shape
rows = shape[0]
col = shape[1]
#For embedding data into image
count = 0
#for red
for i in range(rows):
for j in range(col):
rval = r[i][j]
gval = g[i][j]
bval = b[i][j]
if count==len(binary):
break
bin_2bits = binary[count][6:]
count=count+1
red_bin = '{0:08b}'.format(rv)
green_bin = '{0:08b}'.format(gv)
blue_bin = '{0:08b}'.format(bv)
#print "red_bin value", red_bin
red_2bits = red_bin[6:]
#print "Last two bits of red pixel for pixel ",count," is ",red_2bits
input_a0 = int(bin_2bits[0],2)
input_b0 = int(red_2bits[0],2)
xor_res0 = bin(input_a0^input_b0)
xor_res0= xor_res0[2:] #after removing 0b
input_a1 = int(bin_2bits[1],2)
input_b1 = int(red_2bits[1],2)
xor_res1 = bin(input_a1^input_b1)
xor_res1 = xor_res1[2:]
#print "result of xor is: ",xor_res0,xor_res1
stego = red_bin[0:6]+xor_res0+xor_res1
#print "stego 8 bit binary value is ",stego, " for pixel ", count
int_red=int(stego,2)
red_stego[i][j] = int_red
if count==len(binary):
break
print red
print red_stego
print "green"
count = 0
for i in range(rows):
if i%2 == 0:
for j in range(col):
green_val = g[i][j]
#print "count is",count
if count==len(binary):
break
bin_2bits = binary[count][4:6]
#print "The 5th and 6th of message is: ",bin_2bits, " for pixel ", count
count=count+1
green_bin = '{0:08b}'.format(green_val)
green_2bits = green_bin[6:]
#print "last 2 bits of green pixel is: ",green_2bits, " for pixel ", count
input_a0 = int(bin_2bits[0],2)
input_b0 = int(green_2bits[0],2)
xor_res0 = bin(input_a0^input_b0)
xor_res0= xor_res0[2:]
input_a1 = int(bin_2bits[1],2)
input_b1 = int(green_2bits[1],2)
xor_res1 = bin(input_a1^input_b1)
xor_res1 = xor_res1[2:]
#print "result of xor for green pixel is: ",xor_res0,xor_res1
stego = green_bin[0:6]+xor_res0+xor_res1
#print "stego 8 bit binary value for green pixel is: ",stego
int_green=int(stego,2)
green_stego[i][j] = int_green
else:
j = col-1
while j>=0:
green_val = green[i][j]
#print "count is",count
if count==len(binary):
break
bin_2bits = binary[count][4:6]
#print "5th and 6th bit of message is: ",bin_2bits
count=count+1
green_bin = '{0:08b}'.format(green_val)
green_2bits = green_bin[6:]
#print "last two bits of green pixel is: ",green_2bits, " for pixel ", count
input_a0 = int(bin_2bits[0],2)
input_b0 = int(green_2bits[0],2)
xor_res0 = bin(input_a0^input_b0)
xor_res0= xor_res0[2:]
input_a1 = int(bin_2bits[1],2)
input_b1 = int(green_2bits[1],2)
xor_res1 = bin(input_a1^input_b1)
xor_res1 = xor_res1[2:]
#print "result of xor for green pixel is: ",xor_res0,xor_res1, " for pixel ",count
stego = green_bin[0:6]+xor_res0+xor_res1
#print "stego 8 bit binary value for green pixel is: ",stego, " for pixel ", count
int_green=int(stego,2)
green_stego[i][j] = int_green
j=j-1
if count==len(binary):
break
print green
print green_stego
print "blue"
count = 0
#for blue
for j in range(col):
#print "blue"
if j%2 == 0:
for i in range(rows):
blue_val = b[i][j]
if count==len(binary):
break
bin_4bits = binary[count][0:4]
#print "the first 4 bits of the message are: ",bin_4bits," for pixel ",count
count=count+1
blue_bin = '{0:08b}'.format(blue_val)
#print "blue_bin value", blue_bin
blue_4bits = blue_bin[4:]
#print "last four bits of blue pixel are: ",blue_4bits, " for pixel ",count
input_a0 = int(bin_4bits[0],2)
input_b0 = int(blue_4bits[0],2)
xor_res0 = bin(input_a0^input_b0)
xor_res0= xor_res0[2:]
input_a1 = int(bin_4bits[1],2)
input_b1 = int(blue_4bits[1],2)
xor_res1 = bin(input_a1^input_b1)
xor_res1 = xor_res1[2:]
input_a2 = int(bin_4bits[2],2)
input_b2 = int(blue_4bits[2],2)
xor_res2 = bin(input_a2^input_b2)
xor_res2 = xor_res2[2:]
input_a3 = int(bin_4bits[3],2)
input_b3 = int(blue_4bits[3],2)
xor_res3 = bin(input_a3^input_b3)
xor_res3 = xor_res3[2:]
#print "result of xor for blue pixel",xor_res0,xor_res1, " for pixel ", count
stego = blue_bin[0:4]+xor_res0+xor_res1+xor_res2+xor_res3
#print "stego 8 bit binary value of blue pixel is: ",stego, "for pixel", count
int_blue=int(stego,2)
blue_stego[i][j] = int_blue
else:
i = rows-1
while i>=0:
blue_val = blue[i][j]
if count==len(binary):
break
bin_4bits = binary[count][0:4]
print "first four bits of the message are: ",bin_4bits, " for pixel ",count
count=count+1
blue_bin = '{0:08b}'.format(blue_val)
blue_4bits = blue_bin[4:]
print "last four bits of blue pixel is: ",blue_4bits, " for pixel ", count
input_a0 = int(bin_4bits[0],2)
input_b0 = int(blue_4bits[0],2)
xor_res0 = bin(input_a0^input_b0)
xor_res0= xor_res0[2:]
input_a1 = int(bin_4bits[1],2)
print "input_a1",input_a1,type(input_a1)
input_b1 = int(blue_4bits[1],2)
print "input_b1",input_b1,type(input_b1)
xor_res1 = bin(input_a1^input_b1)
xor_res1 = xor_res1[2:]
input_a2 = int(bin_4bits[2],2)
input_b2 = int(blue_4bits[2],2)
xor_res2 = bin(input_a2^input_b2)
xor_res2 = xor_res2[2:]
input_a3 = int(bin_4bits[3],2)
input_b3 = int(blue_4bits[3],2)
xor_res3 = bin(input_a3^input_b3)
xor_res3 = xor_res3[2:]
#print "result of xor for blue pixel ",xor_res0,xor_res1,xor_res2,xor_res3," for pixel ", count
stego = blue_bin[0:4]+xor_res0+xor_res1+xor_res2+xor_res3
#print "stego 8 bit binary value for blue pixel is: ",stego, " for pixel ",count
int_blue=int(stego,2)
blue_stego[i][j] = int_blue
i=i-1
if count==len(binary):
break
print blue
print blue_stego
# merging
merge_img = cv2.merge((blue_stego,green_stego,red_stego))
#
#
#
#
#
#
####################################################################
print "OUTPUT IMAGE"
###########################################################################################33
cv2.imwrite('stego.png',merge_img)
#Decryption part
bit_xor = merge_img^img
print "The original image is", img
print "The merge image is", merge_img
print "The bit_xor imge is: ",bit_xor
#print "bit_xor[0][0]", bit_xor[0][0]
print "SHape of xor matrix",bit_xor.shape
l_encr_words_red=[]
l_encr_words_green=[]
l_encr_words_blue=[]
l_encr_words=[]
l_encr_words_int=[]
#For red
for i in range(rows):
for j in range(col):
r_bin = '{0:02b}'.format(bit_xor[i][j][2])
###########################################################??
l_encr_words_red.append(r_bin)
#For green
for i in range(rows):
if i%2==0:
for j in range(col):
g_bin = '{0:02b}'.format(bit_xor[i][j][1])
l_encr_words_green.append(g_bin)
else:
j=col-1
while j>=0:
g_bin = '{0:02b}'.format(bit_xor[i][j][1])
l_encr_words_green.append(g_bin)
j=j-1
#For blue
for j in range(col):
if j%2==0:
for i in range(rows):
print "b value before ",bit_xor[i][j][0]
b_bin = '{0:04b}'.format(bit_xor[i][j][0])
print "b value 4 bits ",b_bin
l_encr_words_blue.append(b_bin)
else:
i=rows-1
while i>=0:
print "b value before ",bit_xor[i][j][0]
b_bin = '{0:04b}'.format(bit_xor[i][j][0])
print "b value 4 bits ",b_bin
l_encr_words_blue.append(b_bin)
i=i-1
print "Length of list for b is ",len(l_encr_words_blue)
print "List is "
print "Size is ", bit_xor.size
for i in range(bit_xor.size/3):
#print "blue value ", l_encr_words_blue[i]
#print "green value ", l_encr_words_green[i]
#print "red value ", l_encr_words_red[i]
k = l_encr_words_blue[i] + l_encr_words_green[i] + l_encr_words_red[i]
#print k
l_encr_words.append(k)
l_encr_words_int.append(int(k,2))
print l_encr_words_int
l_encr_words_bin=[]
for i in range(len(l_encr_words_int)):
v2 = '{0:08b}'.format(l_encr_words_int[i])
l_encr_words_bin.append(v2)
print "Binary form is ",l_encr_words_bin
#print '{0:04b}'.format(bit_xor[1][0][0]),'{0:02b}'.format(bit_xor[0][1][1]),'{0:02b}'.format(bit_xor[0][1][0])
l_encr_words_final=[]
for i in range(len(l_encr_words_int)):
if(l_encr_words_int[i]<>0):
l_encr_words_final.append(l_encr_words_int[i])
else:
break
print l_encr_words_final
enc_msg=""
for i in range(len(l_encr_words_final)):
c=(chr)(l_encr_words_final[i])
enc_msg=enc_msg+c
print enc_msg
dna1=enc_msg
# Decoding
dec_string=""
i=0
while(i<len(dna1)):
j=0
print "i is ",i
binfromdna=[0]*8
new_str=dna1[i:i+4]
i=i+4
print "new_str is ",new_str
for k in range(4):
if(new_str[k]=='A'):
binfromdna[j]='0'
binfromdna[7-j]='0'
elif(new_str[k]=='C'):
binfromdna[j]='0'
binfromdna[7-j]='1'
elif(new_str[k]=='G'):
binfromdna[j]='1'
binfromdna[7-j]='0'
else:
binfromdna[j]='1'
binfromdna[7-j]='1'
j=j+1
print binfromdna
matrix[0][0]=binfromdna[0]
matrix[1][0]=binfromdna[1]
matrix[2][0]=binfromdna[2]
matrix[0][1]=binfromdna[3]
matrix[1][1]=-1
matrix[2][1]=binfromdna[4]
matrix[0][2]=binfromdna[5]
matrix[1][2]=binfromdna[6]
matrix[2][2]=binfromdna[7]
new_str1=""
for m in range(3):
for n in range(3):
if(matrix[m][n]!=-1):
new_str1=new_str1+matrix[m][n]
print "new_str1 is ",new_str1
str_comp1=""
for n1 in new_str1:
if(n1=='0'):
str_comp1=str_comp1+'1'
else:
str_comp1=str_comp1+'0'
print "complemented value is ",str_comp1
print "int value is ",int(str_comp1,2)
enc_char=chr(int(str_comp1,2))
print enc_char
yy1=(ord(enc_char)-97-key)%26
dec_string=dec_string+(chr(yy1+97))
print dec_string | {"hexsha": "f401ff5970137edb0a95677b5593ed046180fa11", "size": 14472, "ext": "py", "lang": "Python", "max_stars_repo_path": "ias new/test.py", "max_stars_repo_name": "vrishabh22/IAS-Phishing-detection", "max_stars_repo_head_hexsha": "0a07f9a3a90c8f4c6c4f3e5abdd14bf354718f08", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "ias new/test.py", "max_issues_repo_name": "vrishabh22/IAS-Phishing-detection", "max_issues_repo_head_hexsha": "0a07f9a3a90c8f4c6c4f3e5abdd14bf354718f08", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ias new/test.py", "max_forks_repo_name": "vrishabh22/IAS-Phishing-detection", "max_forks_repo_head_hexsha": "0a07f9a3a90c8f4c6c4f3e5abdd14bf354718f08", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.6595744681, "max_line_length": 853, "alphanum_fraction": 0.5093974572, "include": true, "reason": "import numpy", "num_tokens": 4276} |
# -*- coding: utf-8 -*-
"""
Created on July 2017
@author: JulienWuthrich
"""
import dateutil.parser
import datetime
import numpy
def time2scds(tm):
if isinstance(tm, str):
tm = dateutil.parser.parse(tm)
return tm.hour * 3600 + tm.minute * 60 + tm.second
if isinstance(tm, datetime.datetime):
return tm.hour * 3600 + tm.minute * 60 + tm.second
if isinstance(tm, int):
return tm
if isinstance(tm, numpy.int64):
return time2scds(int(tm))
else:
message = "Format of time {} unknow".format(type(tm))
raise Time2ScdsException(message)
def scds2time(scd):
if isinstance(scd, str):
try:
return scds2time(int(scd))
except TypeError as e:
raise Scds2TimeException(e)
if isinstance(scd, int):
return str(datetime.timedelta(seconds=scd))
if isinstance(scd, datetime.datetime):
return str(scd.date())
if isinstance(scd, numpy.int64):
return scds2time(int(scd))
else:
message = "Format of seconds {} unknow".format(type(scd))
raise Scds2TimeException(message)
class Scds2TimeException(Exception):
def __call__(self, *args):
return self.__class__(*args)
class Time2ScdsException(Exception):
def __call__(self, *args):
return self.__class__(*args)
| {"hexsha": "e4879b438d453b4b026146f00c200111693665bc", "size": 1353, "ext": "py", "lang": "Python", "max_stars_repo_path": "pytools/format/time.py", "max_stars_repo_name": "Jwuthri/PythonTools", "max_stars_repo_head_hexsha": "7281fc5e41eb874bc8cb0aae844abe669d00a1a2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "pytools/format/time.py", "max_issues_repo_name": "Jwuthri/PythonTools", "max_issues_repo_head_hexsha": "7281fc5e41eb874bc8cb0aae844abe669d00a1a2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "pytools/format/time.py", "max_forks_repo_name": "Jwuthri/PythonTools", "max_forks_repo_head_hexsha": "7281fc5e41eb874bc8cb0aae844abe669d00a1a2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.140625, "max_line_length": 65, "alphanum_fraction": 0.63045085, "include": true, "reason": "import numpy", "num_tokens": 333} |
import numpy as np
import cv2
class FisheyeToEquirectangular:
def __init__(self, n=2048, side=3072, blending=16, aperture=1):
self.blending = blending
blending_ratio = blending / n
x_samples = np.linspace(0-blending_ratio, 1+blending_ratio, n+blending*2)
y_samples = np.linspace(-1, 1, n)
# equirectangular
x, y = np.meshgrid(x_samples, y_samples)
# longitude/latitude
longitude = x * np.pi
latitude = y * np.pi / 2
# 3d vector
Px = np.cos(latitude) * np.cos(longitude)
Py = np.cos(latitude) * np.sin(longitude)
Pz = np.sin(latitude)
# 2d fisheye
aperture *= np.pi
r = 2 * np.arctan2(np.sqrt(Px*Px + Pz*Pz), Py) / aperture
theta = np.arctan2(Pz, Px)
theta += np.pi
x = r * np.cos(theta)
y = r * np.sin(theta)
x = np.clip(x, -1, 1)
y = np.clip(y, -1, 1)
x = (-x + 1) * side / 2
y = (y + 1) * side / 2
self.x = x.astype(np.float32)
self.y = y.astype(np.float32)
def unwarp_single(self, img, interpolation=cv2.INTER_LINEAR, border=cv2.BORDER_REFLECT):
return cv2.remap(
img, self.x, self.y,
interpolation=interpolation,
borderMode=border
)
def unwarp_pair(self, left, right, **kwargs):
ul = self.unwarp_single(left, **kwargs)
ur = self.unwarp_single(right, **kwargs)
b = self.blending
la = ul[:,:b]
lb = ul[:,b:b*2]
lc = ul[:,b*2:-b*2]
ld = ul[:,-b*2:]
ra = ur[:,:b*2]
rb = ur[:,b*2:-b*2]
rc = ur[:,-b*2:-b]
rd = ur[:,-b:]
fd = np.linspace(1, 0, b*2).reshape(1,-1,1).repeat(3, axis=2)
fu = np.linspace(0, 1, b*2).reshape(1,-1,1).repeat(3, axis=2)
out = np.hstack((
lb * fu[:,b:] + rd * fd[:,b:],
lc,
ld * fd + ra * fu,
rb,
rc * fd[:,:b] + la * fu[:,:b]
))
return out | {"hexsha": "7bcbd9524251f35e2493c91439752c0395ba1a61", "size": 2063, "ext": "py", "lang": "Python", "max_stars_repo_path": "fisheye.py", "max_stars_repo_name": "kylemcdonald/FisheyeToEquirectangular", "max_stars_repo_head_hexsha": "224d036972f7f4a0b6445311e82498f58660745d", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 12, "max_stars_repo_stars_event_min_datetime": "2019-08-04T06:43:00.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-24T14:12:33.000Z", "max_issues_repo_path": "fisheye.py", "max_issues_repo_name": "kylemcdonald/FisheyeToEquirectangular", "max_issues_repo_head_hexsha": "224d036972f7f4a0b6445311e82498f58660745d", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "fisheye.py", "max_forks_repo_name": "kylemcdonald/FisheyeToEquirectangular", "max_forks_repo_head_hexsha": "224d036972f7f4a0b6445311e82498f58660745d", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2021-02-03T03:03:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-17T11:22:15.000Z", "avg_line_length": 28.2602739726, "max_line_length": 92, "alphanum_fraction": 0.4886088221, "include": true, "reason": "import numpy", "num_tokens": 648} |
function [pitch, roll, yaw] = q2att(qnb)
q11 = qnb(1)*qnb(1); q12 = qnb(1)*qnb(2); q13 = qnb(1)*qnb(3); q14 = qnb(1)*qnb(4);
q22 = qnb(2)*qnb(2); q23 = qnb(2)*qnb(3); q24 = qnb(2)*qnb(4);
q33 = qnb(3)*qnb(3); q34 = qnb(3)*qnb(4);
q44 = qnb(4)*qnb(4);
C12=2*(q23-q14);
C22=q11-q22+q33-q44;
C31=2*(q24-q13); C32=2*(q34+q12); C33=q11-q22-q33+q44;
pitch = asind(C32);
roll = atan2d(-C31,C33);
yaw = atan2d(C12,C22);
yaw = yaw + (yaw<0)*360;
end
| {"author": "yandld", "repo": "nav_matlab", "sha": "da70cb2083de407409ebe1ec1096a308611cf063", "save_path": "github-repos/MATLAB/yandld-nav_matlab", "path": "github-repos/MATLAB/yandld-nav_matlab/nav_matlab-da70cb2083de407409ebe1ec1096a308611cf063/study/eskf156/q2att.m"} |
import random
import numpy as np
import torch
class ConcatDataset(torch.utils.data.Dataset):
def __init__(self, *datasets, randomize_subset_idx=False):
self.datasets = datasets
self.cslen = np.concatenate([[0], np.cumsum([len(d) for d in datasets])])
self.subset_idx = [list(range(len(d))) for d in datasets]
self.last_ds = 0
self.randomize_subset_idx = randomize_subset_idx
def _randomize_subset_idx(self):
for idx_list in self.subset_idx:
random.shuffle(idx_list)
def __len__(self):
return self.cslen[-1]
def __getitem__(self, idx):
if idx == 0 and self.randomize_subset_idx:
self._randomize_subset_idx()
ds_idx = np.searchsorted(self.cslen - 1, idx) - 1
if ds_idx != self.last_ds and hasattr(self.datasets[self.last_ds], 'unload_datasets'):
self.datasets[self.last_ds].unload_datasets()
self.last_ds = ds_idx
pos_idx = idx - self.cslen[ds_idx]
return self.datasets[ds_idx][self.subset_idx[ds_idx][pos_idx]]
| {"hexsha": "dd2d3e8e2708c71c11efa8d2ceac7ca4d248d77e", "size": 1079, "ext": "py", "lang": "Python", "max_stars_repo_path": "concatdataset.py", "max_stars_repo_name": "phernst/sparse_dbp", "max_stars_repo_head_hexsha": "e66a5dffc20ecf2c770e336bc450b53d58db5df7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "concatdataset.py", "max_issues_repo_name": "phernst/sparse_dbp", "max_issues_repo_head_hexsha": "e66a5dffc20ecf2c770e336bc450b53d58db5df7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-07-01T16:13:16.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-01T16:13:16.000Z", "max_forks_repo_path": "concatdataset.py", "max_forks_repo_name": "phernst/sparse_dbp", "max_forks_repo_head_hexsha": "e66a5dffc20ecf2c770e336bc450b53d58db5df7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.7352941176, "max_line_length": 94, "alphanum_fraction": 0.656163114, "include": true, "reason": "import numpy", "num_tokens": 261} |
[STATEMENT]
lemma GuardsFlip_sound:
assumes valid: "\<forall>n. \<Gamma>,\<Theta>\<Turnstile>n:\<^bsub>/F\<^esub> P c Q,A"
assumes validFlip: "\<forall>n. \<Gamma>,\<Theta>\<Turnstile>n:\<^bsub>/-F\<^esub> P c UNIV,UNIV"
shows "\<Gamma>,\<Theta>\<Turnstile>n:\<^bsub>/{}\<^esub> P c Q,A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<Gamma>,\<Theta>\<Turnstile>n:\<^bsub>/{}\<^esub> P c Q,A
[PROOF STEP]
proof (rule cnvalidI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>s t. \<lbrakk>\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P Call p Q,A; \<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> =n\<Rightarrow> t; s \<in> P; t \<notin> Fault ` {}\<rbrakk> \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
fix s t
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>s t. \<lbrakk>\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P Call p Q,A; \<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> =n\<Rightarrow> t; s \<in> P; t \<notin> Fault ` {}\<rbrakk> \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
assume ctxt: "\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P (Call p) Q,A"
[PROOF STATE]
proof (state)
this:
\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P Call p Q,A
goal (1 subgoal):
1. \<And>s t. \<lbrakk>\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P Call p Q,A; \<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> =n\<Rightarrow> t; s \<in> P; t \<notin> Fault ` {}\<rbrakk> \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
hence ctxt': "\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/F\<^esub> P (Call p) Q,A"
[PROOF STATE]
proof (prove)
using this:
\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P Call p Q,A
goal (1 subgoal):
1. \<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/F\<^esub> P Call p Q,A
[PROOF STEP]
by (auto intro: nvalid_augment_Faults)
[PROOF STATE]
proof (state)
this:
\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/F\<^esub> P Call p Q,A
goal (1 subgoal):
1. \<And>s t. \<lbrakk>\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P Call p Q,A; \<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> =n\<Rightarrow> t; s \<in> P; t \<notin> Fault ` {}\<rbrakk> \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
from ctxt
[PROOF STATE]
proof (chain)
picking this:
\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P Call p Q,A
[PROOF STEP]
have ctxtFlip: "\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/-F\<^esub> P (Call p) Q,A"
[PROOF STATE]
proof (prove)
using this:
\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P Call p Q,A
goal (1 subgoal):
1. \<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/- F\<^esub> P Call p Q,A
[PROOF STEP]
by (auto intro: nvalid_augment_Faults)
[PROOF STATE]
proof (state)
this:
\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/- F\<^esub> P Call p Q,A
goal (1 subgoal):
1. \<And>s t. \<lbrakk>\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P Call p Q,A; \<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> =n\<Rightarrow> t; s \<in> P; t \<notin> Fault ` {}\<rbrakk> \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
assume exec: "\<Gamma>\<turnstile>\<langle>c,Normal s\<rangle> =n\<Rightarrow> t"
[PROOF STATE]
proof (state)
this:
\<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> =n\<Rightarrow> t
goal (1 subgoal):
1. \<And>s t. \<lbrakk>\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P Call p Q,A; \<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> =n\<Rightarrow> t; s \<in> P; t \<notin> Fault ` {}\<rbrakk> \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
assume P: "s \<in> P"
[PROOF STATE]
proof (state)
this:
s \<in> P
goal (1 subgoal):
1. \<And>s t. \<lbrakk>\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P Call p Q,A; \<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> =n\<Rightarrow> t; s \<in> P; t \<notin> Fault ` {}\<rbrakk> \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
assume t_noFault: "t \<notin> Fault ` {}"
[PROOF STATE]
proof (state)
this:
t \<notin> Fault ` {}
goal (1 subgoal):
1. \<And>s t. \<lbrakk>\<forall>(P, p, Q, A)\<in>\<Theta>. \<Gamma>\<Turnstile>n:\<^bsub>/{}\<^esub> P Call p Q,A; \<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> =n\<Rightarrow> t; s \<in> P; t \<notin> Fault ` {}\<rbrakk> \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
show "t \<in> Normal ` Q \<union> Abrupt ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
proof (cases t)
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. \<And>x1. t = Normal x1 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
2. \<And>x2. t = Abrupt x2 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
3. \<And>x3. t = Fault x3 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
4. t = Stuck \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
case (Normal t')
[PROOF STATE]
proof (state)
this:
t = Normal t'
goal (4 subgoals):
1. \<And>x1. t = Normal x1 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
2. \<And>x2. t = Abrupt x2 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
3. \<And>x3. t = Fault x3 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
4. t = Stuck \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
from cnvalidD [OF valid [rule_format] ctxt' exec P] Normal
[PROOF STATE]
proof (chain)
picking this:
t \<notin> Fault ` F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
t = Normal t'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
t \<notin> Fault ` F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
t = Normal t'
goal (1 subgoal):
1. t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<in> Normal ` Q \<union> Abrupt ` A
goal (3 subgoals):
1. \<And>x2. t = Abrupt x2 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
2. \<And>x3. t = Fault x3 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
3. t = Stuck \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. \<And>x2. t = Abrupt x2 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
2. \<And>x3. t = Fault x3 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
3. t = Stuck \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
case (Abrupt t')
[PROOF STATE]
proof (state)
this:
t = Abrupt t'
goal (3 subgoals):
1. \<And>x2. t = Abrupt x2 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
2. \<And>x3. t = Fault x3 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
3. t = Stuck \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
from cnvalidD [OF valid [rule_format] ctxt' exec P] Abrupt
[PROOF STATE]
proof (chain)
picking this:
t \<notin> Fault ` F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
t = Abrupt t'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
t \<notin> Fault ` F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
t = Abrupt t'
goal (1 subgoal):
1. t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<in> Normal ` Q \<union> Abrupt ` A
goal (2 subgoals):
1. \<And>x3. t = Fault x3 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
2. t = Stuck \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>x3. t = Fault x3 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
2. t = Stuck \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
case (Fault f)
[PROOF STATE]
proof (state)
this:
t = Fault f
goal (2 subgoals):
1. \<And>x3. t = Fault x3 \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
2. t = Stuck \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
proof (cases "f \<in> F")
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. f \<in> F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
2. f \<notin> F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f \<in> F
goal (2 subgoals):
1. f \<in> F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
2. f \<notin> F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
hence "f \<notin> -F"
[PROOF STATE]
proof (prove)
using this:
f \<in> F
goal (1 subgoal):
1. f \<notin> - F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f \<notin> - F
goal (2 subgoals):
1. f \<in> F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
2. f \<notin> F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
with cnvalidD [OF validFlip [rule_format] ctxtFlip exec P] Fault
[PROOF STATE]
proof (chain)
picking this:
t \<notin> Fault ` (- F) \<Longrightarrow> t \<in> range Normal \<union> range Abrupt
t = Fault f
f \<notin> - F
[PROOF STEP]
have False
[PROOF STATE]
proof (prove)
using this:
t \<notin> Fault ` (- F) \<Longrightarrow> t \<in> range Normal \<union> range Abrupt
t = Fault f
f \<notin> - F
goal (1 subgoal):
1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False
goal (2 subgoals):
1. f \<in> F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
2. f \<notin> F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
False
goal (1 subgoal):
1. t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
t \<in> Normal ` Q \<union> Abrupt ` A
goal (1 subgoal):
1. f \<notin> F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. f \<notin> F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f \<notin> F
goal (1 subgoal):
1. f \<notin> F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
with cnvalidD [OF valid [rule_format] ctxt' exec P] Fault
[PROOF STATE]
proof (chain)
picking this:
t \<notin> Fault ` F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
t = Fault f
f \<notin> F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
t \<notin> Fault ` F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
t = Fault f
f \<notin> F
goal (1 subgoal):
1. t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<in> Normal ` Q \<union> Abrupt ` A
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
t \<in> Normal ` Q \<union> Abrupt ` A
goal (1 subgoal):
1. t = Stuck \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. t = Stuck \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
case Stuck
[PROOF STATE]
proof (state)
this:
t = Stuck
goal (1 subgoal):
1. t = Stuck \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
from cnvalidD [OF valid [rule_format] ctxt' exec P] Stuck
[PROOF STATE]
proof (chain)
picking this:
t \<notin> Fault ` F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
t = Stuck
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
t \<notin> Fault ` F \<Longrightarrow> t \<in> Normal ` Q \<union> Abrupt ` A
t = Stuck
goal (1 subgoal):
1. t \<in> Normal ` Q \<union> Abrupt ` A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
t \<in> Normal ` Q \<union> Abrupt ` A
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
t \<in> Normal ` Q \<union> Abrupt ` A
goal:
No subgoals!
[PROOF STEP]
qed | {"llama_tokens": 5137, "file": "Simpl_HoarePartialProps", "length": 47} |
(*
* @TAG(OTHER_LGPL)
*)
(*
Author: Norbert Schirmer
Maintainer: Norbert Schirmer, norbert.schirmer at web de
License: LGPL
*)
(* Title: Compose.thy
Author: Norbert Schirmer, TU Muenchen
Copyright (C) 2006-2008 Norbert Schirmer
Some rights reserved, TU Muenchen
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
*)
header "Experiments on State Composition"
theory Compose imports "../HoareTotalProps" begin
text {*
We develop some theory to support state-space modular development of programs.
These experiments aim at the representation of state-spaces with records.
If we use @{text "statespaces"} instead we get this kind of compositionality for free.
*}
subsection {* Changing the State-Space *}
(* Lift a command on statespace 'b to work on statespace 'a *)
definition lift\<^sub>f:: "('S \<Rightarrow> 's) \<Rightarrow> ('S \<Rightarrow> 's \<Rightarrow> 'S) \<Rightarrow> ('s \<Rightarrow> 's) \<Rightarrow> ('S \<Rightarrow> 'S)"
where "lift\<^sub>f prj inject f = (\<lambda>S. inject S (f (prj S)))"
definition lift\<^sub>s:: "('S \<Rightarrow> 's) \<Rightarrow> 's set \<Rightarrow> 'S set"
where "lift\<^sub>s prj A = {S. prj S \<in> A}"
definition lift\<^sub>r:: "('S \<Rightarrow> 's) \<Rightarrow> ('S \<Rightarrow> 's \<Rightarrow> 'S) \<Rightarrow> ('s \<times> 's) set
\<Rightarrow> ('S \<times> 'S) set"
where
"lift\<^sub>r prj inject R = {(S,T). (prj S,prj T) \<in> R \<and> T=inject S (prj T)}"
primrec lift\<^sub>c:: "('S \<Rightarrow> 's) \<Rightarrow> ('S \<Rightarrow> 's \<Rightarrow> 'S) \<Rightarrow> ('s,'p,'f) com \<Rightarrow> ('S,'p,'f) com"
where
"lift\<^sub>c prj inject Skip = Skip" |
"lift\<^sub>c prj inject (Basic f) = Basic (lift\<^sub>f prj inject f)" |
"lift\<^sub>c prj inject (Spec r) = Spec (lift\<^sub>r prj inject r)" |
"lift\<^sub>c prj inject (Seq c\<^sub>1 c\<^sub>2) =
(Seq (lift\<^sub>c prj inject c\<^sub>1) (lift\<^sub>c prj inject c\<^sub>2))" |
"lift\<^sub>c prj inject (Cond b c\<^sub>1 c\<^sub>2) =
Cond (lift\<^sub>s prj b) (lift\<^sub>c prj inject c\<^sub>1) (lift\<^sub>c prj inject c\<^sub>2)" |
"lift\<^sub>c prj inject (While b c) =
While (lift\<^sub>s prj b) (lift\<^sub>c prj inject c)" |
"lift\<^sub>c prj inject (Call p) = Call p" |
"lift\<^sub>c prj inject (DynCom c) = DynCom (\<lambda>s. lift\<^sub>c prj inject (c (prj s)))" |
"lift\<^sub>c prj inject (Guard f g c) = Guard f (lift\<^sub>s prj g) (lift\<^sub>c prj inject c)" |
"lift\<^sub>c prj inject Throw = Throw" |
"lift\<^sub>c prj inject (Catch c\<^sub>1 c\<^sub>2) =
Catch (lift\<^sub>c prj inject c\<^sub>1) (lift\<^sub>c prj inject c\<^sub>2)"
lemma lift\<^sub>c_Skip: "(lift\<^sub>c prj inject c = Skip) = (c = Skip)"
by (cases c) auto
lemma lift\<^sub>c_Basic:
"(lift\<^sub>c prj inject c = Basic lf) = (\<exists>f. c = Basic f \<and> lf = lift\<^sub>f prj inject f)"
by (cases c) auto
lemma lift\<^sub>c_Spec:
"(lift\<^sub>c prj inject c = Spec lr) = (\<exists>r. c = Spec r \<and> lr = lift\<^sub>r prj inject r)"
by (cases c) auto
lemma lift\<^sub>c_Seq:
"(lift\<^sub>c prj inject c = Seq lc\<^sub>1 lc\<^sub>2) =
(\<exists> c\<^sub>1 c\<^sub>2. c = Seq c\<^sub>1 c\<^sub>2 \<and>
lc\<^sub>1 = lift\<^sub>c prj inject c\<^sub>1 \<and> lc\<^sub>2 = lift\<^sub>c prj inject c\<^sub>2 )"
by (cases c) auto
lemma lift\<^sub>c_Cond:
"(lift\<^sub>c prj inject c = Cond lb lc\<^sub>1 lc\<^sub>2) =
(\<exists>b c\<^sub>1 c\<^sub>2. c = Cond b c\<^sub>1 c\<^sub>2 \<and> lb = lift\<^sub>s prj b \<and>
lc\<^sub>1 = lift\<^sub>c prj inject c\<^sub>1 \<and> lc\<^sub>2 = lift\<^sub>c prj inject c\<^sub>2 )"
by (cases c) auto
lemma lift\<^sub>c_While:
"(lift\<^sub>c prj inject c = While lb lc') =
(\<exists>b c'. c = While b c' \<and> lb = lift\<^sub>s prj b \<and>
lc' = lift\<^sub>c prj inject c')"
by (cases c) auto
lemma lift\<^sub>c_Call:
"(lift\<^sub>c prj inject c = Call p) = (c = Call p)"
by (cases c) auto
lemma lift\<^sub>c_DynCom:
"(lift\<^sub>c prj inject c = DynCom lc) =
(\<exists>C. c=DynCom C \<and> lc = (\<lambda>s. lift\<^sub>c prj inject (C (prj s))))"
by (cases c) auto
lemma lift\<^sub>c_Guard:
"(lift\<^sub>c prj inject c = Guard f lg lc') =
(\<exists>g c'. c = Guard f g c' \<and> lg = lift\<^sub>s prj g \<and>
lc' = lift\<^sub>c prj inject c')"
by (cases c) auto
lemma lift\<^sub>c_Throw:
"(lift\<^sub>c prj inject c = Throw) = (c = Throw)"
by (cases c) auto
lemma lift\<^sub>c_Catch:
"(lift\<^sub>c prj inject c = Catch lc\<^sub>1 lc\<^sub>2) =
(\<exists> c\<^sub>1 c\<^sub>2. c = Catch c\<^sub>1 c\<^sub>2 \<and>
lc\<^sub>1 = lift\<^sub>c prj inject c\<^sub>1 \<and> lc\<^sub>2 = lift\<^sub>c prj inject c\<^sub>2 )"
by (cases c) auto
definition xstate_map:: "('S \<Rightarrow> 's) \<Rightarrow> ('S,'f) xstate \<Rightarrow> ('s,'f) xstate"
where
"xstate_map g x = (case x of
Normal s \<Rightarrow> Normal (g s)
| Abrupt s \<Rightarrow> Abrupt (g s)
| Fault f \<Rightarrow> Fault f
| Stuck \<Rightarrow> Stuck)"
lemma xstate_map_simps [simp]:
"xstate_map g (Normal s) = Normal (g s)"
"xstate_map g (Abrupt s) = Abrupt (g s)"
"xstate_map g (Fault f) = (Fault f)"
"xstate_map g Stuck = Stuck"
by (auto simp add: xstate_map_def)
lemma xstate_map_Normal_conv:
"xstate_map g S = Normal s = (\<exists>s'. S=Normal s' \<and> s = g s')"
by (cases S) auto
lemma xstate_map_Abrupt_conv:
"xstate_map g S = Abrupt s = (\<exists>s'. S=Abrupt s' \<and> s = g s')"
by (cases S) auto
lemma xstate_map_Fault_conv:
"xstate_map g S = Fault f = (S=Fault f)"
by (cases S) auto
lemma xstate_map_Stuck_conv:
"xstate_map g S = Stuck = (S=Stuck)"
by (cases S) auto
lemmas xstate_map_convs = xstate_map_Normal_conv xstate_map_Abrupt_conv
xstate_map_Fault_conv xstate_map_Stuck_conv
definition state:: "('s,'f) xstate \<Rightarrow> 's"
where
"state x = (case x of
Normal s \<Rightarrow> s
| Abrupt s \<Rightarrow> s
| Fault g \<Rightarrow> undefined
| Stuck \<Rightarrow> undefined)"
lemma state_simps [simp]:
"state (Normal s) = s"
"state (Abrupt s) = s"
by (auto simp add: state_def )
locale lift_state_space =
fixes project::"'S \<Rightarrow> 's"
fixes "inject"::"'S \<Rightarrow> 's \<Rightarrow> 'S"
fixes "project\<^sub>x"::"('S,'f) xstate \<Rightarrow> ('s,'f) xstate"
fixes "lift\<^sub>e"::"('s,'p,'f) body \<Rightarrow> ('S,'p,'f) body"
fixes lift\<^sub>c:: "('s,'p,'f) com \<Rightarrow> ('S,'p,'f) com"
fixes lift\<^sub>f:: "('s \<Rightarrow> 's) \<Rightarrow> ('S \<Rightarrow> 'S)"
fixes lift\<^sub>s:: "'s set \<Rightarrow> 'S set"
fixes lift\<^sub>r:: "('s \<times> 's) set \<Rightarrow> ('S \<times> 'S) set"
assumes proj_inj_commute: "\<And>S s. project (inject S s) = s"
defines "lift\<^sub>c \<equiv> Compose.lift\<^sub>c project inject"
defines "project\<^sub>x \<equiv> xstate_map project"
defines "lift\<^sub>e \<equiv> (\<lambda>\<Gamma> p. map_option lift\<^sub>c (\<Gamma> p))"
defines "lift\<^sub>f \<equiv> Compose.lift\<^sub>f project inject"
defines "lift\<^sub>s \<equiv> Compose.lift\<^sub>s project"
defines "lift\<^sub>r \<equiv> Compose.lift\<^sub>r project inject"
lemma (in lift_state_space) lift\<^sub>f_simp:
"lift\<^sub>f f \<equiv> \<lambda>S. inject S (f (project S))"
by (simp add: lift\<^sub>f_def Compose.lift\<^sub>f_def)
lemma (in lift_state_space) lift\<^sub>s_simp:
"lift\<^sub>s A \<equiv> {S. project S \<in> A}"
by (simp add: lift\<^sub>s_def Compose.lift\<^sub>s_def)
lemma (in lift_state_space) lift\<^sub>r_simp:
"lift\<^sub>r R \<equiv> {(S,T). (project S,project T) \<in> R \<and> T=inject S (project T)}"
by (simp add: lift\<^sub>r_def Compose.lift\<^sub>r_def)
(* Causes loop when instantiating locale
lemmas (in lift_state_space) lift\<^sub>f_simp = Compose.lift\<^sub>f_def
[of project "inject", folded lift\<^sub>f_def]
lemmas (in lift_state_space) lift\<^sub>s_simp = Compose.lift\<^sub>s_def
[of project, folded lift\<^sub>s_def]
lemmas (in lift_state_space) lift\<^sub>r_simp = Compose.lift\<^sub>r_def
[of project "inject", folded lift\<^sub>r_def]
*)
lemma (in lift_state_space) lift\<^sub>c_Skip_simp [simp]:
"lift\<^sub>c Skip = Skip"
by (simp add: lift\<^sub>c_def)
lemma (in lift_state_space) lift\<^sub>c_Basic_simp [simp]:
"lift\<^sub>c (Basic f) = Basic (lift\<^sub>f f)"
by (simp add: lift\<^sub>c_def lift\<^sub>f_def)
lemma (in lift_state_space) lift\<^sub>c_Spec_simp [simp]:
"lift\<^sub>c (Spec r) = Spec (lift\<^sub>r r)"
by (simp add: lift\<^sub>c_def lift\<^sub>r_def)
lemma (in lift_state_space) lift\<^sub>c_Seq_simp [simp]:
"lift\<^sub>c (Seq c\<^sub>1 c\<^sub>2) =
(Seq (lift\<^sub>c c\<^sub>1) (lift\<^sub>c c\<^sub>2))"
by (simp add: lift\<^sub>c_def)
lemma (in lift_state_space) lift\<^sub>c_Cond_simp [simp]:
"lift\<^sub>c (Cond b c\<^sub>1 c\<^sub>2) =
Cond (lift\<^sub>s b) (lift\<^sub>c c\<^sub>1) (lift\<^sub>c c\<^sub>2)"
by (simp add: lift\<^sub>c_def lift\<^sub>s_def)
lemma (in lift_state_space) lift\<^sub>c_While_simp [simp]:
"lift\<^sub>c (While b c) =
While (lift\<^sub>s b) (lift\<^sub>c c)"
by (simp add: lift\<^sub>c_def lift\<^sub>s_def)
lemma (in lift_state_space) lift\<^sub>c_Call_simp [simp]:
"lift\<^sub>c (Call p) = Call p"
by (simp add: lift\<^sub>c_def)
lemma (in lift_state_space) lift\<^sub>c_DynCom_simp [simp]:
"lift\<^sub>c (DynCom c) = DynCom (\<lambda>s. lift\<^sub>c (c (project s)))"
by (simp add: lift\<^sub>c_def)
lemma (in lift_state_space) lift\<^sub>c_Guard_simp [simp]:
"lift\<^sub>c (Guard f g c) = Guard f (lift\<^sub>s g) (lift\<^sub>c c)"
by (simp add: lift\<^sub>c_def lift\<^sub>s_def)
lemma (in lift_state_space) lift\<^sub>c_Throw_simp [simp]:
"lift\<^sub>c Throw = Throw"
by (simp add: lift\<^sub>c_def)
lemma (in lift_state_space) lift\<^sub>c_Catch_simp [simp]:
"lift\<^sub>c (Catch c\<^sub>1 c\<^sub>2) =
Catch (lift\<^sub>c c\<^sub>1) (lift\<^sub>c c\<^sub>2)"
by (simp add: lift\<^sub>c_def)
lemma (in lift_state_space) project\<^sub>x_def':
"project\<^sub>x s \<equiv> (case s of
Normal s \<Rightarrow> Normal (project s)
| Abrupt s \<Rightarrow> Abrupt (project s)
| Fault f \<Rightarrow> Fault f
| Stuck \<Rightarrow> Stuck)"
by (simp add: xstate_map_def project\<^sub>x_def)
lemma (in lift_state_space) lift\<^sub>e_def':
"lift\<^sub>e \<Gamma> p \<equiv> (case \<Gamma> p of Some bdy \<Rightarrow> Some (lift\<^sub>c bdy) | None \<Rightarrow> None)"
by (simp add: lift\<^sub>e_def map_option_def)
text {*
The problem is that @{term "(lift\<^sub>c project inject \<circ> \<Gamma>)"} is quite
a strong premise. The problem is that @{term "\<Gamma>"} is a function here.
A map would be better. We only have to lift those procedures in the domain
of @{term "\<Gamma>"}:
@{text "\<Gamma> p = Some bdy \<longrightarrow> \<Gamma>' p = Some lift\<^sub>c project inject bdy"}.
We then can com up with theorems that allow us to extend the domains
of @{term \<Gamma>} and preserve validity.
*}
lemma (in lift_state_space)
"{(S,T). \<exists>t. (project S,t) \<in> r \<and> T=inject S t}
\<subseteq> {(S,T). (project S,project T) \<in> r \<and> T=inject S (project T)}"
apply clarsimp
apply (rename_tac S t)
apply (simp add: proj_inj_commute)
done
lemma (in lift_state_space)
"{(S,T). (project S,project T) \<in> r \<and> T=inject S (project T)}
\<subseteq> {(S,T). \<exists>t. (project S,t) \<in> r \<and> T=inject S t}"
apply clarsimp
apply (rename_tac S T)
apply (rule_tac x="project T" in exI)
apply simp
done
lemma (in lift_state_space) lift_exec:
assumes exec_lc: "(lift\<^sub>e \<Gamma>)\<turnstile>\<langle>lc,s\<rangle> \<Rightarrow> t"
shows "\<And>c. \<lbrakk> lift\<^sub>c c = lc\<rbrakk> \<Longrightarrow>
\<Gamma>\<turnstile>\<langle>c,project\<^sub>x s\<rangle> \<Rightarrow> project\<^sub>x t"
using exec_lc
proof (induct)
case Skip thus ?case
by (auto simp add: project\<^sub>x_def lift\<^sub>c_Skip lift\<^sub>c_def intro: exec.Skip)
next
case Guard thus ?case
by (auto simp add: project\<^sub>x_def lift\<^sub>s_def Compose.lift\<^sub>s_def lift\<^sub>c_Guard lift\<^sub>c_def
intro: exec.Guard)
next
case GuardFault thus ?case
by (auto simp add: project\<^sub>x_def lift\<^sub>s_def Compose.lift\<^sub>s_def lift\<^sub>c_Guard lift\<^sub>c_def
intro: exec.GuardFault)
next
case FaultProp thus ?case
by (fastforce simp add: project\<^sub>x_def)
next
case Basic
thus ?case
by (fastforce simp add: project\<^sub>x_def lift\<^sub>c_Basic lift\<^sub>f_def Compose.lift\<^sub>f_def
lift\<^sub>c_def
proj_inj_commute
intro: exec.Basic)
next
case Spec
thus ?case
by (fastforce simp add: project\<^sub>x_def lift\<^sub>c_Spec lift\<^sub>f_def Compose.lift\<^sub>f_def
lift\<^sub>r_def Compose.lift\<^sub>r_def lift\<^sub>c_def
proj_inj_commute
intro: exec.Spec)
next
case (SpecStuck s r)
thus ?case
apply (simp add: project\<^sub>x_def)
apply (clarsimp simp add: lift\<^sub>c_Spec lift\<^sub>c_def)
apply (unfold lift\<^sub>r_def Compose.lift\<^sub>r_def)
apply (rule exec.SpecStuck)
apply (rule allI)
apply (erule_tac x="inject s t" in allE)
apply clarsimp
apply (simp add: proj_inj_commute)
done
next
case Seq
thus ?case
by (fastforce simp add: project\<^sub>x_def lift\<^sub>c_Seq lift\<^sub>c_def intro: exec.intros)
next
case CondTrue
thus ?case
by (auto simp add: project\<^sub>x_def lift\<^sub>s_def Compose.lift\<^sub>s_def lift\<^sub>c_Cond lift\<^sub>c_def
intro: exec.CondTrue)
next
case CondFalse
thus ?case
by (auto simp add: project\<^sub>x_def lift\<^sub>s_def Compose.lift\<^sub>s_def lift\<^sub>c_Cond lift\<^sub>c_def
intro: exec.CondFalse)
next
case WhileTrue
thus ?case
by (fastforce simp add: project\<^sub>x_def lift\<^sub>s_def Compose.lift\<^sub>s_def
lift\<^sub>c_While lift\<^sub>c_def
intro: exec.WhileTrue)
next
case WhileFalse
thus ?case
by (fastforce simp add: project\<^sub>x_def lift\<^sub>s_def Compose.lift\<^sub>s_def
lift\<^sub>c_While lift\<^sub>c_def
intro: exec.WhileFalse)
next
case Call
thus ?case
by (fastforce simp add:
project\<^sub>x_def lift\<^sub>c_Call lift\<^sub>f_def Compose.lift\<^sub>f_def lift\<^sub>c_def
lift\<^sub>e_def
intro: exec.Call)
next
case CallUndefined
thus ?case
by (fastforce simp add:
project\<^sub>x_def lift\<^sub>c_Call lift\<^sub>f_def Compose.lift\<^sub>f_def lift\<^sub>c_def
lift\<^sub>e_def
intro: exec.CallUndefined)
next
case StuckProp thus ?case
by (fastforce simp add: project\<^sub>x_def)
next
case DynCom
thus ?case
by (fastforce simp add:
project\<^sub>x_def lift\<^sub>c_DynCom lift\<^sub>f_def Compose.lift\<^sub>f_def lift\<^sub>c_def
intro: exec.DynCom)
next
case Throw thus ?case
by (fastforce simp add: project\<^sub>x_def lift\<^sub>c_Throw lift\<^sub>c_def intro: exec.Throw)
next
case AbruptProp thus ?case
by (fastforce simp add: project\<^sub>x_def)
next
case CatchMatch
thus ?case
by (fastforce simp add: project\<^sub>x_def lift\<^sub>c_Catch lift\<^sub>c_def intro: exec.CatchMatch)
next
case (CatchMiss c\<^sub>1 s t c\<^sub>2 c)
thus ?case
by (cases t)
(fastforce simp add: project\<^sub>x_def lift\<^sub>c_Catch lift\<^sub>c_def intro: exec.CatchMiss)+
qed
lemma (in lift_state_space) lift_exec':
assumes exec_lc: "(lift\<^sub>e \<Gamma>)\<turnstile>\<langle>lift\<^sub>c c,s\<rangle> \<Rightarrow> t"
shows "\<Gamma>\<turnstile>\<langle>c,project\<^sub>x s\<rangle> \<Rightarrow> project\<^sub>x t"
using lift_exec [OF exec_lc]
by simp
lemma (in lift_state_space) lift_valid:
assumes valid: "\<Gamma>\<Turnstile>\<^bsub>/F\<^esub> P c Q,A"
shows
"(lift\<^sub>e \<Gamma>)\<Turnstile>\<^bsub>/F\<^esub> (lift\<^sub>s P) (lift\<^sub>c c) (lift\<^sub>s Q),(lift\<^sub>s A)"
proof (rule validI)
fix s t
assume lexec:
"(lift\<^sub>e \<Gamma>)\<turnstile>\<langle>lift\<^sub>c c,Normal s\<rangle> \<Rightarrow> t"
assume lP: "s \<in> lift\<^sub>s P"
assume noFault: "t \<notin> Fault ` F"
show "t \<in> Normal ` lift\<^sub>s Q \<union> Abrupt ` lift\<^sub>s A"
proof -
from lexec
have "\<Gamma>\<turnstile> \<langle>c,project\<^sub>x (Normal s)\<rangle> \<Rightarrow> (project\<^sub>x t)"
by (rule lift_exec) (simp_all)
moreover
from lP have "project s \<in> P"
by (simp add: lift\<^sub>s_def Compose.lift\<^sub>s_def project\<^sub>x_def)
ultimately
have "project\<^sub>x t \<in> Normal ` Q \<union> Abrupt ` A"
using valid noFault
apply (clarsimp simp add: valid_def project\<^sub>x_def)
apply (cases t)
apply auto
done
thus ?thesis
apply (simp add: lift\<^sub>s_def Compose.lift\<^sub>s_def)
apply (cases t)
apply (auto simp add: project\<^sub>x_def)
done
qed
qed
lemma (in lift_state_space) lift_hoarep:
assumes deriv: "\<Gamma>,{}\<turnstile>\<^bsub>/F\<^esub> P c Q,A"
shows
"(lift\<^sub>e \<Gamma>),{}\<turnstile>\<^bsub>/F\<^esub> (lift\<^sub>s P) (lift\<^sub>c c) (lift\<^sub>s Q),(lift\<^sub>s A)"
apply (rule hoare_complete)
apply (insert hoare_sound [OF deriv])
apply (rule lift_valid)
apply (simp add: cvalid_def)
done
lemma (in lift_state_space) lift_hoarep':
"\<forall>Z. \<Gamma>,{}\<turnstile>\<^bsub>/F\<^esub> (P Z) c (Q Z),(A Z) \<Longrightarrow>
\<forall>Z. (lift\<^sub>e \<Gamma>),{}\<turnstile>\<^bsub>/F\<^esub> (lift\<^sub>s (P Z)) (lift\<^sub>c c)
(lift\<^sub>s (Q Z)),(lift\<^sub>s (A Z))"
apply (iprover intro: lift_hoarep)
done
lemma (in lift_state_space) lift_termination:
assumes termi: "\<Gamma>\<turnstile>c\<down>s"
shows "\<And>S. project\<^sub>x S = s \<Longrightarrow>
lift\<^sub>e \<Gamma> \<turnstile>(lift\<^sub>c c)\<down>S"
using termi
proof (induct)
case Skip thus ?case
by (clarsimp simp add: terminates.Skip project\<^sub>x_def xstate_map_convs)
next
case Basic thus ?case
by (fastforce simp add: project\<^sub>x_def xstate_map_convs intro: terminates.intros)
next
case Spec thus ?case
by (fastforce simp add: project\<^sub>x_def xstate_map_convs intro: terminates.intros)
next
case Guard thus ?case
by (auto simp add: project\<^sub>x_def xstate_map_convs intro: terminates.intros)
next
case GuardFault thus ?case
by (auto simp add: project\<^sub>x_def xstate_map_convs lift\<^sub>s_def Compose.lift\<^sub>s_def
intro: terminates.intros)
next
case Fault thus ?case by (clarsimp simp add: project\<^sub>x_def xstate_map_convs)
next
case (Seq c1 s c2)
have "project\<^sub>x S = Normal s" by fact
then obtain s' where S: "S=Normal s'" and s: "s = project s'"
by (auto simp add: project\<^sub>x_def xstate_map_convs)
from Seq have "lift\<^sub>e \<Gamma>\<turnstile>lift\<^sub>c c1 \<down> S"
by simp
moreover
{
fix w
assume exec_lc1: "lift\<^sub>e \<Gamma>\<turnstile>\<langle>lift\<^sub>c c1,Normal s'\<rangle> \<Rightarrow> w"
have "lift\<^sub>e \<Gamma>\<turnstile>lift\<^sub>c c2 \<down> w"
proof (cases w)
case (Normal w')
with lift_exec [where c=c1, OF exec_lc1] s
have "\<Gamma>\<turnstile>\<langle>c1,Normal s\<rangle> \<Rightarrow> Normal (project w')"
by (simp add: project\<^sub>x_def)
from Seq.hyps (3) [rule_format, OF this] Normal
show "lift\<^sub>e \<Gamma>\<turnstile>lift\<^sub>c c2 \<down> w"
by (auto simp add: project\<^sub>x_def xstate_map_convs)
qed (auto)
}
ultimately show ?case
using S s
by (auto intro: terminates.intros)
next
case CondTrue thus ?case
by (fastforce simp add: project\<^sub>x_def lift\<^sub>s_def Compose.lift\<^sub>s_def xstate_map_convs
intro: terminates.intros)
next
case CondFalse thus ?case
by (fastforce simp add: project\<^sub>x_def lift\<^sub>s_def Compose.lift\<^sub>s_def xstate_map_convs
intro: terminates.intros)
next
case (WhileTrue s b c)
have "project\<^sub>x S = Normal s" by fact
then obtain s' where S: "S=Normal s'" and s: "s = project s'"
by (auto simp add: project\<^sub>x_def xstate_map_convs)
from WhileTrue have "lift\<^sub>e \<Gamma>\<turnstile>lift\<^sub>c c \<down> S"
by simp
moreover
{
fix w
assume exec_lc: "lift\<^sub>e \<Gamma>\<turnstile>\<langle>lift\<^sub>c c,Normal s'\<rangle> \<Rightarrow> w"
have "lift\<^sub>e \<Gamma>\<turnstile>lift\<^sub>c (While b c) \<down> w"
proof (cases w)
case (Normal w')
with lift_exec [where c=c, OF exec_lc] s
have "\<Gamma>\<turnstile>\<langle>c,Normal s\<rangle> \<Rightarrow> Normal (project w')"
by (simp add: project\<^sub>x_def)
from WhileTrue.hyps (4) [rule_format, OF this] Normal
show "lift\<^sub>e \<Gamma>\<turnstile>lift\<^sub>c (While b c) \<down> w"
by (auto simp add: project\<^sub>x_def xstate_map_convs)
qed (auto)
}
ultimately show ?case
using S s
by (auto intro: terminates.intros)
next
case WhileFalse thus ?case
by (fastforce simp add: project\<^sub>x_def lift\<^sub>s_def Compose.lift\<^sub>s_def xstate_map_convs
intro: terminates.intros)
next
case Call thus ?case
by (fastforce simp add: project\<^sub>x_def xstate_map_convs lift\<^sub>e_def
intro: terminates.intros)
next
case CallUndefined thus ?case
by (fastforce simp add: project\<^sub>x_def xstate_map_convs lift\<^sub>e_def
intro: terminates.intros)
next
case Stuck thus ?case
by (fastforce simp add: project\<^sub>x_def xstate_map_convs)
next
case DynCom thus ?case
by (fastforce simp add: project\<^sub>x_def xstate_map_convs
intro: terminates.intros)
next
case Throw thus ?case
by (fastforce simp add: project\<^sub>x_def xstate_map_convs
intro: terminates.intros)
next
case Abrupt thus ?case
by (fastforce simp add: project\<^sub>x_def xstate_map_convs
intro: terminates.intros)
next
case (Catch c1 s c2)
have "project\<^sub>x S = Normal s" by fact
then obtain s' where S: "S=Normal s'" and s: "s = project s'"
by (auto simp add: project\<^sub>x_def xstate_map_convs)
from Catch have "lift\<^sub>e \<Gamma>\<turnstile>lift\<^sub>c c1 \<down> S"
by simp
moreover
{
fix w
assume exec_lc1: "lift\<^sub>e \<Gamma>\<turnstile>\<langle>lift\<^sub>c c1,Normal s'\<rangle> \<Rightarrow> Abrupt w"
have "lift\<^sub>e \<Gamma>\<turnstile>lift\<^sub>c c2 \<down> Normal w"
proof -
from lift_exec [where c=c1, OF exec_lc1] s
have "\<Gamma>\<turnstile>\<langle>c1,Normal s\<rangle> \<Rightarrow> Abrupt (project w)"
by (simp add: project\<^sub>x_def)
from Catch.hyps (3) [rule_format, OF this]
show "lift\<^sub>e \<Gamma>\<turnstile>lift\<^sub>c c2 \<down> Normal w"
by (auto simp add: project\<^sub>x_def xstate_map_convs)
qed
}
ultimately show ?case
using S s
by (auto intro: terminates.intros)
qed
lemma (in lift_state_space) lift_termination':
assumes termi: "\<Gamma>\<turnstile>c\<down>project\<^sub>x S"
shows "lift\<^sub>e \<Gamma> \<turnstile>(lift\<^sub>c c)\<down>S"
using lift_termination [OF termi]
by iprover
lemma (in lift_state_space) lift_validt:
assumes valid: "\<Gamma>\<Turnstile>\<^sub>t\<^bsub>/F\<^esub> P c Q,A"
shows "(lift\<^sub>e \<Gamma>)\<Turnstile>\<^sub>t\<^bsub>/F\<^esub> (lift\<^sub>s P) (lift\<^sub>c c) (lift\<^sub>s Q),(lift\<^sub>s A)"
proof -
from valid
have "(lift\<^sub>e \<Gamma>)\<Turnstile>\<^bsub>/F\<^esub> (lift\<^sub>s P) (lift\<^sub>c c) (lift\<^sub>s Q),(lift\<^sub>s A)"
by (auto intro: lift_valid simp add: validt_def)
moreover
{
fix S
assume "S \<in> lift\<^sub>s P"
hence "project S \<in> P"
by (simp add: lift\<^sub>s_def Compose.lift\<^sub>s_def)
with valid have "\<Gamma>\<turnstile>c \<down> project\<^sub>x (Normal S)"
by (simp add: validt_def project\<^sub>x_def)
hence "lift\<^sub>e \<Gamma>\<turnstile>lift\<^sub>c c \<down> Normal S"
by (rule lift_termination')
}
ultimately show ?thesis
by (simp add: validt_def)
qed
lemma (in lift_state_space) lift_hoaret:
assumes deriv: "\<Gamma>,{}\<turnstile>\<^sub>t\<^bsub>/F\<^esub> P c Q,A"
shows
"(lift\<^sub>e \<Gamma>),{}\<turnstile>\<^sub>t\<^bsub>/F\<^esub> (lift\<^sub>s P) (lift\<^sub>c c) (lift\<^sub>s Q),(lift\<^sub>s A)"
apply (rule hoaret_complete)
apply (insert hoaret_sound [OF deriv])
apply (rule lift_validt)
apply (simp add: cvalidt_def)
done
locale lift_state_space_ext = lift_state_space +
assumes inj_proj_commute: "\<And>S. inject S (project S) = S"
assumes inject_last: "\<And>S s t. inject (inject S s) t = inject S t"
(* \<exists>x. state t = inject (state s) x *)
lemma (in lift_state_space_ext) lift_exec_inject_same:
assumes exec_lc: "(lift\<^sub>e \<Gamma>)\<turnstile>\<langle>lc,s\<rangle> \<Rightarrow> t"
shows "\<And>c. \<lbrakk>lift\<^sub>c c = lc; t \<notin> (Fault ` UNIV) \<union> {Stuck}\<rbrakk> \<Longrightarrow>
state t = inject (state s) (project (state t))"
using exec_lc
proof (induct)
case Skip thus ?case
by (clarsimp simp add: inj_proj_commute)
next
case Guard thus ?case
by (clarsimp simp add: lift\<^sub>c_Guard lift\<^sub>c_def)
next
case GuardFault thus ?case
by simp
next
case FaultProp thus ?case by simp
next
case Basic thus ?case
by (clarsimp simp add: lift\<^sub>f_def Compose.lift\<^sub>f_def
proj_inj_commute lift\<^sub>c_Basic lift\<^sub>c_def)
next
case (Spec r) thus ?case
by (clarsimp simp add: Compose.lift\<^sub>r_def lift\<^sub>c_Spec lift\<^sub>c_def)
next
case SpecStuck
thus ?case by simp
next
case (Seq lc1 s s' lc2 t c)
have t: "t \<notin> Fault ` UNIV \<union> {Stuck}" by fact
have "lift\<^sub>c c = Seq lc1 lc2" by fact
then obtain c1 c2 where
c: "c = Seq c1 c2" and
lc1: "lc1 = lift\<^sub>c c1" and
lc2: "lc2 = lift\<^sub>c c2"
by (auto simp add: lift\<^sub>c_Seq lift\<^sub>c_def)
show ?case
proof (cases s')
case (Normal s'')
from Seq.hyps (2) [OF lc1 [symmetric]] this
have "s'' = inject s (project s'')"
by auto
moreover from Seq.hyps (4) [OF lc2 [symmetric]] Normal t
have "state t = inject s'' (project (state t))"
by auto
ultimately have "state t = inject (inject s (project s'')) (project (state t))"
by simp
then show ?thesis
by (simp add: inject_last)
next
case (Abrupt s'')
from Seq.hyps (2) [OF lc1 [symmetric]] this
have "s'' = inject s (project s'')"
by auto
moreover from Seq.hyps (4) [OF lc2 [symmetric]] Abrupt t
have "state t = inject s'' (project (state t))"
by auto
ultimately have "state t = inject (inject s (project s'')) (project (state t))"
by simp
then show ?thesis
by (simp add: inject_last)
next
case (Fault f)
with Seq
have "t = Fault f"
by (auto dest: Fault_end)
with t have False by simp
thus ?thesis ..
next
case Stuck
with Seq
have "t = Stuck"
by (auto dest: Stuck_end)
with t have False by simp
thus ?thesis ..
qed
next
case CondTrue thus ?case
by (clarsimp simp add: lift\<^sub>c_Cond lift\<^sub>c_def)
next
case CondFalse thus ?case
by (clarsimp simp add: lift\<^sub>c_Cond lift\<^sub>c_def)
next
case (WhileTrue s lb lc' s' t c)
have t: "t \<notin> Fault ` UNIV \<union> {Stuck}" by fact
have lw: "lift\<^sub>c c = While lb lc'" by fact
then obtain b c' where
c: "c = While b c'" and
lb: "lb = lift\<^sub>s b" and
lc: "lc' = lift\<^sub>c c'"
by (auto simp add: lift\<^sub>c_While lift\<^sub>s_def lift\<^sub>c_def)
show ?case
proof (cases s')
case (Normal s'')
from WhileTrue.hyps (3) [OF lc [symmetric]] this
have "s'' = inject s (project s'')"
by auto
moreover from WhileTrue.hyps (5) [OF lw] Normal t
have "state t = inject s'' (project (state t))"
by auto
ultimately have "state t = inject (inject s (project s'')) (project (state t))"
by simp
then show ?thesis
by (simp add: inject_last)
next
case (Abrupt s'')
from WhileTrue.hyps (3) [OF lc [symmetric]] this
have "s'' = inject s (project s'')"
by auto
moreover from WhileTrue.hyps (5) [OF lw] Abrupt t
have "state t = inject s'' (project (state t))"
by auto
ultimately have "state t = inject (inject s (project s'')) (project (state t))"
by simp
then show ?thesis
by (simp add: inject_last)
next
case (Fault f)
with WhileTrue
have "t = Fault f"
by (auto dest: Fault_end)
with t have False by simp
thus ?thesis ..
next
case Stuck
with WhileTrue
have "t = Stuck"
by (auto dest: Stuck_end)
with t have False by simp
thus ?thesis ..
qed
next
case WhileFalse thus ?case
by (clarsimp simp add: lift\<^sub>c_While inj_proj_commute)
next
case Call thus ?case
by (clarsimp simp add: inject_last lift\<^sub>c_Call lift\<^sub>e_def lift\<^sub>c_def)
next
case CallUndefined thus ?case by simp
next
case StuckProp thus ?case by simp
next
case DynCom
thus ?case
by (clarsimp simp add: lift\<^sub>c_DynCom lift\<^sub>c_def)
next
case Throw thus ?case
by (simp add: inj_proj_commute)
next
case AbruptProp thus ?case by (simp add: inj_proj_commute)
next
case (CatchMatch lc1 s s' lc2 t c)
have t: "t \<notin> Fault ` UNIV \<union> {Stuck}" by fact
have "lift\<^sub>c c = Catch lc1 lc2" by fact
then obtain c1 c2 where
c: "c = Catch c1 c2" and
lc1: "lc1 = lift\<^sub>c c1" and
lc2: "lc2 = lift\<^sub>c c2"
by (auto simp add: lift\<^sub>c_Catch lift\<^sub>c_def)
from CatchMatch.hyps (2) [OF lc1 [symmetric]] this
have "s' = inject s (project s')"
by auto
moreover
from CatchMatch.hyps (4) [OF lc2 [symmetric]] t
have "state t = inject s' (project (state t))"
by auto
ultimately have "state t = inject (inject s (project s')) (project (state t))"
by simp
then show ?case
by (simp add: inject_last)
next
case CatchMiss
thus ?case
by (clarsimp simp add: lift\<^sub>c_Catch lift\<^sub>c_def)
qed
lemma (in lift_state_space_ext) valid_inject_project:
assumes noFaultStuck:
"\<Gamma>\<turnstile>\<langle>c,Normal (project \<sigma>)\<rangle> \<Rightarrow>\<notin>(Fault ` UNIV \<union> {Stuck})"
shows "lift\<^sub>e \<Gamma>\<Turnstile>\<^bsub>/F\<^esub> {\<sigma>} lift\<^sub>c c
{t. t=inject \<sigma> (project t)}, {t. t=inject \<sigma> (project t)}"
proof (rule validI)
fix s t
assume exec: "lift\<^sub>e \<Gamma>\<turnstile>\<langle>lift\<^sub>c c,Normal s\<rangle> \<Rightarrow> t"
assume P: "s \<in> {\<sigma>}"
assume noFault: "t \<notin> Fault ` F"
show "t \<in> Normal ` {t. t = inject \<sigma> (project t)} \<union>
Abrupt ` {t. t = inject \<sigma> (project t)}"
proof -
from lift_exec [OF exec]
have "\<Gamma>\<turnstile>\<langle>c,project\<^sub>x (Normal s)\<rangle> \<Rightarrow> project\<^sub>x t"
by simp
with noFaultStuck P have t: "t \<notin> Fault ` UNIV \<union> {Stuck}"
by (auto simp add: final_notin_def project\<^sub>x_def)
from lift_exec_inject_same [OF exec refl this] P
have "state t = inject \<sigma> (project (state t))"
by simp
with t show ?thesis
by (cases t) auto
qed
qed
lemma (in lift_state_space_ext) lift_exec_inject_same':
assumes exec_lc: "(lift\<^sub>e \<Gamma>)\<turnstile>\<langle>lift\<^sub>c c,S\<rangle> \<Rightarrow> T"
shows "\<And>c. \<lbrakk>T \<notin> (Fault ` UNIV) \<union> {Stuck}\<rbrakk> \<Longrightarrow>
state T = inject (state S) (project (state T))"
using lift_exec_inject_same [OF exec_lc]
by simp
lemma (in lift_state_space_ext) valid_lift_modifies:
assumes valid: "\<forall>s. \<Gamma>\<Turnstile>\<^bsub>/F\<^esub> {s} c (Modif s),(ModifAbr s)"
shows "(lift\<^sub>e \<Gamma>)\<Turnstile>\<^bsub>/F\<^esub> {S} (lift\<^sub>c c)
{T. T \<in> lift\<^sub>s (Modif (project S)) \<and> T=inject S (project T)},
{T. T \<in> lift\<^sub>s (ModifAbr (project S)) \<and> T=inject S (project T)}"
proof (rule validI)
fix s t
assume exec: "lift\<^sub>e \<Gamma>\<turnstile>\<langle>lift\<^sub>c c,Normal s\<rangle> \<Rightarrow> t"
assume P: "s \<in> {S}"
assume noFault: "t \<notin> Fault ` F"
show "t \<in> Normal `
{t \<in> lift\<^sub>s (Modif (project S)).
t = inject S (project t)} \<union>
Abrupt `
{t \<in> lift\<^sub>s (ModifAbr (project S)).
t = inject S (project t)}"
proof -
from lift_exec [OF exec]
have "\<Gamma>\<turnstile> \<langle>c,project\<^sub>x (Normal s)\<rangle> \<Rightarrow> project\<^sub>x t"
by auto
moreover
from noFault have "project\<^sub>x t \<notin> Fault ` F"
by (cases "t") (auto simp add: project\<^sub>x_def)
ultimately
have "project\<^sub>x t \<in>
Normal ` (Modif (project s)) \<union> Abrupt ` (ModifAbr (project s))"
using valid [rule_format, of "(project s)"]
by (auto simp add: valid_def project\<^sub>x_def)
hence "t \<in> Normal ` lift\<^sub>s (Modif (project s)) \<union>
Abrupt ` lift\<^sub>s (ModifAbr (project s))"
by (cases t) (auto simp add: project\<^sub>x_def lift\<^sub>s_def Compose.lift\<^sub>s_def)
moreover
from this
have "t \<notin> Fault ` UNIV \<union> {Stuck}"
by (cases t) auto
from lift_exec_inject_same [OF exec _ this]
have "state t = inject (state (Normal s)) (project (state t))"
by simp
ultimately show ?thesis
using P by auto
qed
qed
lemma (in lift_state_space_ext) hoare_lift_modifies:
assumes deriv: "\<forall>\<sigma>. \<Gamma>,{}\<turnstile>\<^bsub>/F\<^esub> {\<sigma>} c (Modif \<sigma>),(ModifAbr \<sigma>)"
shows "\<forall>\<sigma>. (lift\<^sub>e \<Gamma>),{}\<turnstile>\<^bsub>/F\<^esub> {\<sigma>} (lift\<^sub>c c)
{T. T \<in> lift\<^sub>s (Modif (project \<sigma>)) \<and> T=inject \<sigma> (project T)},
{T. T \<in> lift\<^sub>s (ModifAbr (project \<sigma>)) \<and> T=inject \<sigma> (project T)}"
apply (rule allI)
apply (rule hoare_complete)
apply (rule valid_lift_modifies)
apply (rule allI)
apply (insert hoare_sound [OF deriv [rule_format]])
apply (simp add: cvalid_def)
done
lemma (in lift_state_space_ext) hoare_lift_modifies':
assumes deriv: "\<forall>\<sigma>. \<Gamma>,{}\<turnstile>\<^bsub>/F\<^esub> {\<sigma>} c (Modif \<sigma>),(ModifAbr \<sigma>)"
shows "\<forall>\<sigma>. (lift\<^sub>e \<Gamma>),{}\<turnstile>\<^bsub>/F\<^esub> {\<sigma>} (lift\<^sub>c c)
{T. T \<in> lift\<^sub>s (Modif (project \<sigma>)) \<and>
(\<exists>T'. T=inject \<sigma> T')},
{T. T \<in> lift\<^sub>s (ModifAbr (project \<sigma>)) \<and>
(\<exists>T'. T=inject \<sigma> T')}"
apply (rule allI)
apply (rule HoarePartialDef.conseq [OF hoare_lift_modifies [OF deriv]])
apply blast
done
subsection {* Renaming Procedures *}
primrec rename:: "('p \<Rightarrow> 'q) \<Rightarrow> ('s,'p,'f) com \<Rightarrow> ('s,'q,'f) com"
where
"rename N Skip = Skip" |
"rename N (Basic f) = Basic f" |
"rename N (Spec r) = Spec r" |
"rename N (Seq c\<^sub>1 c\<^sub>2) = (Seq (rename N c\<^sub>1) (rename N c\<^sub>2))" |
"rename N (Cond b c\<^sub>1 c\<^sub>2) = Cond b (rename N c\<^sub>1) (rename N c\<^sub>2)" |
"rename N (While b c) = While b (rename N c)" |
"rename N (Call p) = Call (N p)" |
"rename N (DynCom c) = DynCom (\<lambda>s. rename N (c s))" |
"rename N (Guard f g c) = Guard f g (rename N c)" |
"rename N Throw = Throw" |
"rename N (Catch c\<^sub>1 c\<^sub>2) = Catch (rename N c\<^sub>1) (rename N c\<^sub>2)"
lemma rename_Skip: "rename h c = Skip = (c=Skip)"
by (cases c) auto
lemma rename_Basic:
"(rename h c = Basic f) = (c=Basic f)"
by (cases c) auto
lemma rename_Spec:
"(rename h c = Spec r) = (c=Spec r)"
by (cases c) auto
lemma rename_Seq:
"(rename h c = Seq rc\<^sub>1 rc\<^sub>2) =
(\<exists> c\<^sub>1 c\<^sub>2. c = Seq c\<^sub>1 c\<^sub>2 \<and>
rc\<^sub>1 = rename h c\<^sub>1 \<and> rc\<^sub>2 = rename h c\<^sub>2 )"
by (cases c) auto
lemma rename_Cond:
"(rename h c = Cond b rc\<^sub>1 rc\<^sub>2) =
(\<exists>c\<^sub>1 c\<^sub>2. c = Cond b c\<^sub>1 c\<^sub>2 \<and> rc\<^sub>1 = rename h c\<^sub>1 \<and> rc\<^sub>2 = rename h c\<^sub>2 )"
by (cases c) auto
lemma rename_While:
"(rename h c = While b rc') = (\<exists>c'. c = While b c' \<and> rc' = rename h c')"
by (cases c) auto
lemma rename_Call:
"(rename h c = Call q) = (\<exists>p. c = Call p \<and> q=h p)"
by (cases c) auto
lemma rename_Guard:
"(rename h c = Guard f g rc') =
(\<exists>c'. c = Guard f g c' \<and> rc' = rename h c')"
by (cases c) auto
lemma rename_Throw:
"(rename h c = Throw) = (c = Throw)"
by (cases c) auto
lemma rename_Catch:
"(rename h c = Catch rc\<^sub>1 rc\<^sub>2) =
(\<exists>c\<^sub>1 c\<^sub>2. c = Catch c\<^sub>1 c\<^sub>2 \<and> rc\<^sub>1 = rename h c\<^sub>1 \<and> rc\<^sub>2 = rename h c\<^sub>2 )"
by (cases c) auto
lemma exec_rename_to_exec:
assumes \<Gamma>: "\<forall>p bdy. \<Gamma> p = Some bdy \<longrightarrow> \<Gamma>' (h p) = Some (rename h bdy)"
assumes exec: "\<Gamma>'\<turnstile>\<langle>rc,s\<rangle> \<Rightarrow> t"
shows "\<And>c. rename h c = rc\<Longrightarrow> \<exists>t'. \<Gamma>\<turnstile>\<langle>c,s\<rangle> \<Rightarrow> t' \<and> (t'=Stuck \<or> t'=t)"
using exec
proof (induct)
case Skip thus ?case by (fastforce intro: exec.intros simp add: rename_Skip)
next
case Guard thus ?case by (fastforce intro: exec.intros simp add: rename_Guard)
next
case GuardFault thus ?case by (fastforce intro: exec.intros simp add: rename_Guard)
next
case FaultProp thus ?case by (fastforce intro: exec.intros)
next
case Basic thus ?case by (fastforce intro: exec.intros simp add: rename_Basic)
next
case Spec thus ?case by (fastforce intro: exec.intros simp add: rename_Spec)
next
case SpecStuck thus ?case by (fastforce intro: exec.intros simp add: rename_Spec)
next
case Seq thus ?case by (fastforce intro: exec.intros simp add: rename_Seq)
next
case CondTrue thus ?case by (fastforce intro: exec.intros simp add: rename_Cond)
next
case CondFalse thus ?case by (fastforce intro: exec.intros simp add: rename_Cond)
next
case WhileTrue thus ?case by (fastforce intro: exec.intros simp add: rename_While)
next
case WhileFalse thus ?case by (fastforce intro: exec.intros simp add: rename_While)
next
case (Call p rbdy s t)
have rbdy: "\<Gamma>' p = Some rbdy" by fact
have "rename h c = Call p" by fact
then obtain q where c: "c=Call q" and p: "p=h q"
by (auto simp add: rename_Call)
show ?case
proof (cases "\<Gamma> q")
case None
with c show ?thesis by (auto intro: exec.CallUndefined)
next
case (Some bdy)
from \<Gamma> [rule_format, OF this] p rbdy
have "rename h bdy = rbdy" by simp
with Call.hyps c Some
show ?thesis
by (fastforce intro: exec.intros)
qed
next
case (CallUndefined p s)
have undef: "\<Gamma>' p = None" by fact
have "rename h c = Call p" by fact
then obtain q where c: "c=Call q" and p: "p=h q"
by (auto simp add: rename_Call)
from undef p \<Gamma> have "\<Gamma> q = None"
by (cases "\<Gamma> q") auto
with p c show ?case
by (auto intro: exec.intros)
next
case StuckProp thus ?case by (fastforce intro: exec.intros)
next
case DynCom thus ?case by (fastforce intro: exec.intros simp add: rename_DynCom)
next
case Throw thus ?case by (fastforce intro: exec.intros simp add: rename_Throw)
next
case AbruptProp thus ?case by (fastforce intro: exec.intros)
next
case CatchMatch thus ?case by (fastforce intro: exec.intros simp add: rename_Catch)
next
case CatchMiss thus ?case by (fastforce intro: exec.intros simp add: rename_Catch)
qed
lemma exec_rename_to_exec':
assumes \<Gamma>: "\<forall>p bdy. \<Gamma> p = Some bdy \<longrightarrow> \<Gamma>' (N p) = Some (rename N bdy)"
assumes exec: "\<Gamma>'\<turnstile>\<langle>rename N c,s\<rangle> \<Rightarrow> t"
shows "\<exists>t'. \<Gamma>\<turnstile>\<langle>c,s\<rangle> \<Rightarrow> t' \<and> (t'=Stuck \<or> t'=t)"
using exec_rename_to_exec [OF \<Gamma> exec]
by auto
lemma valid_to_valid_rename:
assumes \<Gamma>: "\<forall>p bdy. \<Gamma> p = Some bdy \<longrightarrow> \<Gamma>' (N p) = Some (rename N bdy)"
assumes valid: "\<Gamma>\<Turnstile>\<^bsub>/F\<^esub> P c Q,A"
shows "\<Gamma>'\<Turnstile>\<^bsub>/F\<^esub> P (rename N c) Q,A"
proof (rule validI)
fix s t
assume execr: "\<Gamma>'\<turnstile> \<langle>rename N c,Normal s\<rangle> \<Rightarrow> t"
assume P: "s \<in> P"
assume noFault: "t \<notin> Fault ` F"
show "t \<in> Normal ` Q \<union> Abrupt ` A"
proof -
from exec_rename_to_exec [OF \<Gamma> execr]
obtain t' where
exec: "\<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> \<Rightarrow> t'" and t': "(t' = Stuck \<or> t' = t)"
by auto
with valid noFault P show ?thesis
by (auto simp add: valid_def)
qed
qed
lemma hoare_to_hoare_rename:
assumes \<Gamma>: "\<forall>p bdy. \<Gamma> p = Some bdy \<longrightarrow> \<Gamma>' (N p) = Some (rename N bdy)"
assumes deriv: "\<Gamma>,{}\<turnstile>\<^bsub>/F\<^esub> P c Q,A"
shows "\<Gamma>',{}\<turnstile>\<^bsub>/F\<^esub> P (rename N c) Q,A"
apply (rule hoare_complete)
apply (insert hoare_sound [OF deriv])
apply (rule valid_to_valid_rename)
apply (rule \<Gamma>)
apply (simp add: cvalid_def)
done
lemma hoare_to_hoare_rename':
assumes \<Gamma>: "\<forall>p bdy. \<Gamma> p = Some bdy \<longrightarrow> \<Gamma>' (N p) = Some (rename N bdy)"
assumes deriv: "\<forall>Z. \<Gamma>,{}\<turnstile>\<^bsub>/F\<^esub> (P Z) c (Q Z),(A Z)"
shows "\<forall>Z. \<Gamma>',{}\<turnstile>\<^bsub>/F\<^esub> (P Z) (rename N c) (Q Z),(A Z)"
apply rule
apply (rule hoare_to_hoare_rename [OF \<Gamma>])
apply (rule deriv[rule_format])
done
lemma terminates_to_terminates_rename:
assumes \<Gamma>: "\<forall>p bdy. \<Gamma> p = Some bdy \<longrightarrow> \<Gamma>' (N p) = Some (rename N bdy)"
assumes termi: "\<Gamma>\<turnstile> c \<down> s"
assumes noStuck: "\<Gamma>\<turnstile> \<langle>c,s\<rangle> \<Rightarrow>\<notin>{Stuck}"
shows "\<Gamma>'\<turnstile> rename N c \<down> s"
using termi noStuck
proof (induct)
case Skip thus ?case by (fastforce intro: terminates.intros)
next
case Basic thus ?case by (fastforce intro: terminates.intros)
next
case Spec thus ?case by (fastforce intro: terminates.intros)
next
case Guard thus ?case by (fastforce intro: terminates.intros
simp add: final_notin_def exec.intros)
next
case GuardFault thus ?case by (fastforce intro: terminates.intros)
next
case Fault thus ?case by (fastforce intro: terminates.intros)
next
case Seq
thus ?case
by (force intro!: terminates.intros exec.intros dest: exec_rename_to_exec [OF \<Gamma>]
simp add: final_notin_def)
next
case CondTrue thus ?case by (fastforce intro: terminates.intros
simp add: final_notin_def exec.intros)
next
case CondFalse thus ?case by (fastforce intro: terminates.intros
simp add: final_notin_def exec.intros)
next
case (WhileTrue s b c)
have s_in_b: "s \<in> b" by fact
have noStuck: "\<Gamma>\<turnstile> \<langle>While b c,Normal s\<rangle> \<Rightarrow>\<notin>{Stuck}" by fact
with s_in_b have "\<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> \<Rightarrow>\<notin>{Stuck}"
by (auto simp add: final_notin_def intro: exec.intros)
with WhileTrue.hyps have "\<Gamma>'\<turnstile>rename N c \<down> Normal s"
by simp
moreover
{
fix t
assume exec_rc: "\<Gamma>'\<turnstile> \<langle>rename N c,Normal s\<rangle> \<Rightarrow> t"
have "\<Gamma>'\<turnstile> While b (rename N c) \<down> t"
proof -
from exec_rename_to_exec [OF \<Gamma> exec_rc] obtain t'
where exec_c: "\<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> \<Rightarrow> t'" and t': "(t' = Stuck \<or> t' = t)"
by auto
with s_in_b noStuck obtain "t'=t" and "\<Gamma>\<turnstile> \<langle>While b c,t\<rangle> \<Rightarrow>\<notin>{Stuck}"
by (auto simp add: final_notin_def intro: exec.intros)
with exec_c WhileTrue.hyps
show ?thesis
by auto
qed
}
ultimately show ?case
using s_in_b
by (auto intro: terminates.intros)
next
case WhileFalse thus ?case by (fastforce intro: terminates.intros)
next
case (Call p bdy s)
have "\<Gamma> p = Some bdy" by fact
from \<Gamma> [rule_format, OF this]
have bdy': "\<Gamma>' (N p) = Some (rename N bdy)".
from Call have "\<Gamma>'\<turnstile>rename N bdy \<down> Normal s"
by (auto simp add: final_notin_def intro: exec.intros)
with bdy' have "\<Gamma>'\<turnstile>Call (N p) \<down> Normal s"
by (auto intro: terminates.intros)
thus ?case by simp
next
case (CallUndefined p s)
have "\<Gamma> p = None" "\<Gamma>\<turnstile> \<langle>Call p,Normal s\<rangle> \<Rightarrow>\<notin>{Stuck}" by fact+
hence False by (auto simp add: final_notin_def intro: exec.intros)
thus ?case ..
next
case Stuck thus ?case by (fastforce intro: terminates.intros)
next
case DynCom thus ?case by (fastforce intro: terminates.intros
simp add: final_notin_def exec.intros)
next
case Throw thus ?case by (fastforce intro: terminates.intros)
next
case Abrupt thus ?case by (fastforce intro: terminates.intros)
next
case (Catch c1 s c2)
have noStuck: "\<Gamma>\<turnstile> \<langle>Catch c1 c2,Normal s\<rangle> \<Rightarrow>\<notin>{Stuck}" by fact
hence "\<Gamma>\<turnstile> \<langle>c1,Normal s\<rangle> \<Rightarrow>\<notin>{Stuck}"
by (fastforce simp add: final_notin_def intro: exec.intros)
with Catch.hyps have "\<Gamma>'\<turnstile>rename N c1 \<down> Normal s"
by auto
moreover
{
fix t
assume exec_rc1:"\<Gamma>'\<turnstile> \<langle>rename N c1,Normal s\<rangle> \<Rightarrow> Abrupt t"
have "\<Gamma>'\<turnstile>rename N c2 \<down> Normal t"
proof -
from exec_rename_to_exec [OF \<Gamma> exec_rc1] obtain t'
where exec_c: "\<Gamma>\<turnstile> \<langle>c1,Normal s\<rangle> \<Rightarrow> t'" and "(t' = Stuck \<or> t' = Abrupt t)"
by auto
with noStuck have t': "t'=Abrupt t"
by (fastforce simp add: final_notin_def intro: exec.intros)
with exec_c noStuck have "\<Gamma>\<turnstile> \<langle>c2,Normal t\<rangle> \<Rightarrow>\<notin>{Stuck}"
by (auto simp add: final_notin_def intro: exec.intros)
with exec_c t' Catch.hyps
show ?thesis
by auto
qed
}
ultimately show ?case
by (auto intro: terminates.intros)
qed
lemma validt_to_validt_rename:
assumes \<Gamma>: "\<forall>p bdy. \<Gamma> p = Some bdy \<longrightarrow> \<Gamma>' (N p) = Some (rename N bdy)"
assumes valid: "\<Gamma>\<Turnstile>\<^sub>t\<^bsub>/F\<^esub> P c Q,A"
shows "\<Gamma>'\<Turnstile>\<^sub>t\<^bsub>/F\<^esub> P (rename N c) Q,A"
proof -
from valid
have "\<Gamma>'\<Turnstile>\<^bsub>/F\<^esub> P (rename N c) Q,A"
by (auto intro: valid_to_valid_rename [OF \<Gamma>] simp add: validt_def)
moreover
{
fix s
assume "s \<in> P"
with valid obtain "\<Gamma>\<turnstile>c \<down> (Normal s)" "\<Gamma>\<turnstile> \<langle>c,Normal s\<rangle> \<Rightarrow>\<notin>{Stuck}"
by (auto simp add: validt_def valid_def final_notin_def)
from terminates_to_terminates_rename [OF \<Gamma> this]
have "\<Gamma>'\<turnstile>rename N c \<down> Normal s"
.
}
ultimately show ?thesis
by (simp add: validt_def)
qed
lemma hoaret_to_hoaret_rename:
assumes \<Gamma>: "\<forall>p bdy. \<Gamma> p = Some bdy \<longrightarrow> \<Gamma>' (N p) = Some (rename N bdy)"
assumes deriv: "\<Gamma>,{}\<turnstile>\<^sub>t\<^bsub>/F\<^esub> P c Q,A"
shows "\<Gamma>',{}\<turnstile>\<^sub>t\<^bsub>/F\<^esub> P (rename N c) Q,A"
apply (rule hoaret_complete)
apply (insert hoaret_sound [OF deriv])
apply (rule validt_to_validt_rename)
apply (rule \<Gamma>)
apply (simp add: cvalidt_def)
done
lemma hoaret_to_hoaret_rename':
assumes \<Gamma>: "\<forall>p bdy. \<Gamma> p = Some bdy \<longrightarrow> \<Gamma>' (N p) = Some (rename N bdy)"
assumes deriv: "\<forall>Z. \<Gamma>,{}\<turnstile>\<^sub>t\<^bsub>/F\<^esub> (P Z) c (Q Z),(A Z)"
shows "\<forall>Z. \<Gamma>',{}\<turnstile>\<^sub>t\<^bsub>/F\<^esub> (P Z) (rename N c) (Q Z),(A Z)"
apply rule
apply (rule hoaret_to_hoaret_rename [OF \<Gamma>])
apply (rule deriv[rule_format])
done
lemma lift\<^sub>c_whileAnno [simp]: "lift\<^sub>c prj inject (whileAnno b I V c) =
whileAnno (lift\<^sub>s prj b)
(lift\<^sub>s prj I) (lift\<^sub>r prj inject V) (lift\<^sub>c prj inject c)"
by (simp add: whileAnno_def)
lemma lift\<^sub>c_block [simp]: "lift\<^sub>c prj inject (block init bdy return c) =
block (lift\<^sub>f prj inject init) (lift\<^sub>c prj inject bdy)
(\<lambda>s. (lift\<^sub>f prj inject (return (prj s))))
(\<lambda>s t. lift\<^sub>c prj inject (c (prj s) (prj t)))"
by (simp add: block_def)
(*
lemma lift\<^sub>c_block [simp]: "lift\<^sub>c prj inject (block init bdy return c) =
block (lift\<^sub>f prj inject init) (lift\<^sub>c prj inject bdy)
(\<lambda>s t. inject s (return (prj s) (prj t)))
(\<lambda>s t. lift\<^sub>c prj inject (c (prj s) (prj t)))"
apply (simp add: block_def)
apply (simp add: lift\<^sub>f_def)
*)
lemma lift\<^sub>c_call [simp]: "lift\<^sub>c prj inject (call init p return c) =
call (lift\<^sub>f prj inject init) p
(\<lambda>s. (lift\<^sub>f prj inject (return (prj s))))
(\<lambda>s t. lift\<^sub>c prj inject (c (prj s) (prj t)))"
by (simp add: call_def lift\<^sub>c_block)
lemma rename_whileAnno [simp]: "rename h (whileAnno b I V c) =
whileAnno b I V (rename h c)"
by (simp add: whileAnno_def)
lemma rename_block [simp]: "rename h (block init bdy return c) =
block init (rename h bdy) return (\<lambda>s t. rename h (c s t))"
by (simp add: block_def)
lemma rename_call [simp]: "rename h (call init p return c) =
call init (h p) return (\<lambda>s t. rename h (c s t))"
by (simp add: call_def)
end
| {"author": "crizkallah", "repo": "checker-verification", "sha": "cd5101e57ef70dcdd1680db2de2f08521605bd7c", "save_path": "github-repos/isabelle/crizkallah-checker-verification", "path": "github-repos/isabelle/crizkallah-checker-verification/checker-verification-cd5101e57ef70dcdd1680db2de2f08521605bd7c/autocorres-1.0/c-parser/hoare-package/ex/Compose.thy"} |
#!/usr/bin/env python
import argparse
import logging
import os
import re
import numpy as np
def evaluate(session_directory, num_obj_complete):
# Parse data from session (action executed, reward values)
transitions_directory = os.path.join(session_directory, 'transitions')
executed_action_log = np.loadtxt(os.path.join(transitions_directory, 'executed-action.log.txt'), delimiter=' ')
max_iteration = executed_action_log.shape[0]
executed_action_log = executed_action_log[0:max_iteration, :]
reward_value_log = np.loadtxt(os.path.join(transitions_directory, 'reward-value.log.txt'), delimiter=' ')
reward_value_log = reward_value_log[0:max_iteration]
clearance_log = np.loadtxt(os.path.join(transitions_directory, 'task_complete.log.txt'), delimiter=' ')
clearance_log = np.unique(clearance_log)
max_trials = len(clearance_log)
clearance_log = np.concatenate((np.asarray([0]), clearance_log), axis=0).astype(int)
# Count number of pushing/grasping actions before completion
num_actions_before_completion = clearance_log[1:(max_trials + 1)] - clearance_log[0:(max_trials)]
grasp_success_rate = np.zeros(max_trials)
grasp_num_success = np.zeros(max_trials)
grasp_to_push_ratio = np.zeros(max_trials)
for trial_idx in range(1, len(clearance_log)):
# Get actions and reward values for current trial
tmp_executed_action_log = executed_action_log[clearance_log[trial_idx - 1]:clearance_log[trial_idx], 0]
tmp_reward_value_log = reward_value_log[clearance_log[trial_idx - 1]:clearance_log[trial_idx]]
# Get indices of pushing and grasping actions for current trial
tmp_grasp_attempt_ind = np.argwhere(tmp_executed_action_log == 1)
tmp_push_attempt_ind = np.argwhere(tmp_executed_action_log == 0)
grasp_to_push_ratio[trial_idx - 1] = float(len(tmp_grasp_attempt_ind)) / float(len(tmp_executed_action_log))
# Count number of times grasp attempts were successful
# Reward value for successful grasping is anything larger than 0.5
tmp_num_grasp_success = np.sum(tmp_reward_value_log[
tmp_grasp_attempt_ind] >= 0.5)
grasp_num_success[trial_idx - 1] = tmp_num_grasp_success
grasp_success_rate[trial_idx - 1] = float(tmp_num_grasp_success) / float(len(tmp_grasp_attempt_ind))
# Which trials reached task completion?
valid_clearance = grasp_num_success >= num_obj_complete
# Display results
clearance = float(np.sum(valid_clearance)) / float(max_trials) * 100
logging.info('Average %% clearance: %2.1f' % clearance)
grasp_success = np.mean(grasp_success_rate[valid_clearance]) * 100
logging.info('Average %% grasp success per clearance: %2.1f' % grasp_success)
action_efficiency = 100 * np.mean(
np.divide(float(num_obj_complete), num_actions_before_completion[valid_clearance]))
logging.info('Average %% action efficiency: %2.1f' % action_efficiency)
grasp_to_push_ratio = np.mean(grasp_to_push_ratio[valid_clearance]) * 100
logging.info('Average grasp to push ratio: %2.1f' % grasp_to_push_ratio)
return clearance, grasp_success, action_efficiency, grasp_to_push_ratio
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Evaluate the performance all test sessions.')
parser.add_argument('--session_directory', dest='session_directory', action='store', type=str,
help='path to session directory for which to measure performance')
parser.add_argument('--test_type', dest='test_type', action='store', type=str, default='preset',
help='type of test to evaluate. (random/preset)')
parser.add_argument('--num_obj_complete', dest='num_obj_complete', action='store', type=int, default=10,
help='number of objects picked before considering task complete')
args = parser.parse_args()
# Initialize logging
logging.root.handlers = []
logging.basicConfig(
level=logging.INFO,
filename="{0}/{1}.log".format(args.session_directory, 'evaluate'),
format='[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s',
datefmt='%H:%M:%S'
)
# set up logging to console
console = logging.StreamHandler()
console.setLevel(logging.DEBUG)
# set a format which is simpler for console use
formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
console.setFormatter(formatter)
# add the handler to the root logger
logging.getLogger('').addHandler(console)
if args.test_type == 'random':
session_directory = args.session_directory
num_obj_complete = args.num_obj_complete
evaluate(session_directory, num_obj_complete)
elif args.test_type == 'preset':
num_obj_presets = [4, 5, 3, 5, 5, 6, 3, 6, 6, 5, 4]
preset_files = os.listdir(args.session_directory)
preset_files = [os.path.abspath(os.path.join(args.session_directory, filename)) for filename in preset_files if
os.path.isdir(os.path.join(args.session_directory, filename))]
preset_files = sorted(preset_files)
avg_clearance = 0
avg_grasp_success = 0
avg_action_efficiency = 0
avg_grasp_to_push_ratio = 0
valid_clearance_count = 0
complete_clearance_count = 0
for idx, preset_file in enumerate(preset_files):
logging.info('Preset {}: {}'.format(idx, preset_file))
session_directory = preset_file
m = re.search(r'\d+$', session_directory)
num_obj_complete = num_obj_presets[int(m.group())]
clearance, grasp_success, action_efficiency, grasp_to_push_ratio = evaluate(session_directory,
num_obj_complete)
avg_clearance += clearance
if clearance:
avg_grasp_success += grasp_success
avg_action_efficiency += action_efficiency
avg_grasp_to_push_ratio += grasp_to_push_ratio
valid_clearance_count += 1
if clearance == 100:
complete_clearance_count += 1
logging.info('Summary')
logging.info('Scenarios 100 %% complete: %d' % complete_clearance_count)
logging.info('Overall average %% clearance: %2.1f' % (avg_clearance / (idx + 1)))
logging.info('Overall average %% grasp success per clearance: %2.1f' % (avg_grasp_success / valid_clearance_count))
logging.info('Overall average %% action efficiency: %2.1f' % (avg_action_efficiency / valid_clearance_count))
logging.info('Overall average grasp to push ratio: %2.1f' % (avg_grasp_to_push_ratio / valid_clearance_count))
else:
raise NotImplementedError('Test type {} is not implemented'.format(args.test_type))
| {"hexsha": "c089dfebf4085140a155c37f956b8393f2032479", "size": 6938, "ext": "py", "lang": "Python", "max_stars_repo_path": "evaluate.py", "max_stars_repo_name": "skumra/romannet", "max_stars_repo_head_hexsha": "0af092a1be26ac5f213f1e5c21f81f89699a4c92", "max_stars_repo_licenses": ["BSD-2-Clause"], "max_stars_count": 5, "max_stars_repo_stars_event_min_datetime": "2021-07-09T15:09:59.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-27T00:32:33.000Z", "max_issues_repo_path": "evaluate.py", "max_issues_repo_name": "skumra/romannet", "max_issues_repo_head_hexsha": "0af092a1be26ac5f213f1e5c21f81f89699a4c92", "max_issues_repo_licenses": ["BSD-2-Clause"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2021-04-17T14:11:26.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-17T07:39:11.000Z", "max_forks_repo_path": "evaluate.py", "max_forks_repo_name": "skumra/romannet", "max_forks_repo_head_hexsha": "0af092a1be26ac5f213f1e5c21f81f89699a4c92", "max_forks_repo_licenses": ["BSD-2-Clause"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2022-01-17T10:12:03.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-20T13:51:55.000Z", "avg_line_length": 50.2753623188, "max_line_length": 123, "alphanum_fraction": 0.6870856155, "include": true, "reason": "import numpy", "num_tokens": 1553} |
import napari
import numpy as np
from dask import array as da
from transitions import Machine
from ._logging import log_error
from ._logging import logger
from ._transitions import transitions
from ._viewer_model import ViewerModel
from ._viewer_model import ViewerState
# XXX tenative implementation : pluginfy later.
class TravaliViewer:
def __init__(
self,
image,
label,
target_Ts,
df_segments,
df_divisions,
zarr_path,
label_dataset_name,
data_chunks,
new_segment_id,
new_label_value,
finalized_segment_ids,
candidate_segment_ids,
termination_annotations,
persist,
):
self.zarr_path = zarr_path
self.label_dataset_name = label_dataset_name
self.data_chunks = data_chunks
self.target_Ts = sorted(list(map(int, target_Ts)))
self.persist = persist
self.viewer = napari.Viewer()
contrast_limits = np.percentile(np.array(image[0]).ravel(), (50, 98))
self.viewer.add_image(image, contrast_limits=contrast_limits)
self.label_layer = self.viewer.add_labels(
label,
name="label",
cache=False
)
self.sel_label_layer = self.viewer.add_labels(
da.zeros_like(label, dtype=np.uint8),
name="Selected label",
cache=False
)
self.sel_label_layer.contour = 3
self.redraw_label_layer = self.viewer.add_labels(
np.zeros(label.shape[-3:], dtype=np.uint8),
name="Drawing",
cache=False
)
self.finalized_label_layer = self.viewer.add_labels(
da.zeros_like(label, dtype=np.uint8),
name="Finalized",
# color ={1:"red"}, not working
opacity=1.0,
blending="opaque",
cache=False
)
self.finalized_label_layer.contour = 3
self.viewer_model = ViewerModel(
self,
df_segments,
df_divisions,
new_segment_id=new_segment_id,
new_label_value=new_label_value,
finalized_segment_ids=finalized_segment_ids,
candidate_segment_ids=candidate_segment_ids,
termination_annotations=termination_annotations,
)
self.machine = Machine(
model=self.viewer_model,
states=ViewerState,
transitions=transitions,
after_state_change="update_layer_status",
initial=ViewerState.ALL_LABEL,
ignore_invalid_triggers=True, # ignore invalid key presses
)
self.viewer_model.update_layer_status()
@log_error
def track_clicked(layer, event):
logger.info("Track clicked")
yield # important to avoid a potential bug when selecting the daughter
logger.info("button released")
global viewer_model
data_coordinates = layer.world_to_data(event.position)
cords = np.round(data_coordinates).astype(int)
val = layer.get_value(data_coordinates)
if val is None:
return
if val != 0:
msg = f"clicked at {cords}"
frame = cords[0]
logger.info("%s %i %s", msg, frame, val)
row = self.viewer_model.df_segments.xs(
(cords[0], val), level=("frame", "label")
)
if len(row) != 1:
return
logger.info(row)
segment_id = row["segment_id"].iloc[0]
self.viewer_model.track_clicked(frame, val, segment_id)
self.label_layer.mouse_drag_callbacks.append(track_clicked)
bind_keys = [
"Escape",
"Enter",
"r",
"s",
"d",
"t",
]
class KeyTyped:
def __init__(self1, key: str) -> None:
self1.key = key
def __call__(self1, _event) -> None:
logger.info(f"{self1.key} typed")
getattr(
self.viewer_model, f"{self1.key}_typed"
)() # call associated function of the model
for k in bind_keys:
# register the callback to the viewer
self.viewer.bind_key(k, KeyTyped(k), overwrite=True)
class MoveInTargetTs:
def __init__(self1, forward: bool):
self1.forward = forward
def __call__(self1, _event) -> None:
# XXX dirty implementation but works
target_Ts = np.array(self.target_Ts)
logger.info(f"moving {self1.forward}")
iT = self.viewer.dims.point[0]
if self1.forward:
iTs = target_Ts[target_Ts > iT]
if len(iTs) > 0:
self.viewer.dims.set_point(0, np.min(iTs))
else:
iTs = target_Ts[target_Ts < iT]
if len(iTs) > 0:
self.viewer.dims.set_point(0, np.max(iTs))
self.viewer.bind_key("Shift-Right", MoveInTargetTs(True), overwrite=True)
self.viewer.bind_key("Shift-Left", MoveInTargetTs(False), overwrite=True)
@log_error
def save_typed(_event):
logger.info("saving validation results...")
self.viewer_model.save_results(
self.zarr_path, self.label_dataset_name, self.data_chunks, self.persist
)
logger.info("done.")
self.viewer.bind_key("Control-Alt-Shift-S", save_typed, overwrite=True)
| {"hexsha": "c6f19b3d21db643ce2c8d5b0a6acc20f4980803a", "size": 5696, "ext": "py", "lang": "Python", "max_stars_repo_path": "src/napari_travali/_viewer.py", "max_stars_repo_name": "yfukai/napariTrackEditor", "max_stars_repo_head_hexsha": "23022fd718bc5adc6e12acf948a091c7c038a465", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/napari_travali/_viewer.py", "max_issues_repo_name": "yfukai/napariTrackEditor", "max_issues_repo_head_hexsha": "23022fd718bc5adc6e12acf948a091c7c038a465", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 27, "max_issues_repo_issues_event_min_datetime": "2021-11-01T00:27:39.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-01T00:03:19.000Z", "max_forks_repo_path": "src/napari_travali/_viewer.py", "max_forks_repo_name": "yfukai/napari-travali", "max_forks_repo_head_hexsha": "80bc7ab036f81e95d83d14da65a375090d13fd56", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 33.9047619048, "max_line_length": 87, "alphanum_fraction": 0.5609199438, "include": true, "reason": "import numpy", "num_tokens": 1172} |
function yPred = objFcn(p , tObs, drug)
%Copyright (c) 2011, The MathWorks, Inc.
L0 = p(1) ; % Drug-independent parameter 1
L1 = p(2) ; % Drug-independent parameter 2
k1 = p(3) ; % Drug-independent parameter 3
k2_A = p(4) ; % Drug dependent parameter (drug A)
k2_B = p(5) ; % Drug dependent parameter (drug B)
% Simulate model for drug A
yPred_A = evalTumorWeight(tObs(drug == 'A'), [L1, L0, k1, k2_A]) ;
% Simulate model for drug B
yPred_B = evalTumorWeight(tObs(drug == 'B'), [L1, L0, k1, k2_B]) ;
% Combine prediction
yPred = [yPred_A; yPred_B] ;
end | {"author": "Sable", "repo": "mcbench-benchmarks", "sha": "ba13b2f0296ef49491b95e3f984c7c41fccdb6d8", "save_path": "github-repos/MATLAB/Sable-mcbench-benchmarks", "path": "github-repos/MATLAB/Sable-mcbench-benchmarks/mcbench-benchmarks-ba13b2f0296ef49491b95e3f984c7c41fccdb6d8/30869-fitting-with-matlab-statistics-optimization-and-curve-fitting/objFcn.m"} |
import os
import arrow
import glob
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
import torch
from torch.nn import Module, Linear, Sequential, ReLU
from torch.nn.functional import mse_loss
from torch.optim import Adam, SGD
from torch.utils.data import TensorDataset
from mlxtend.plotting import plot_confusion_matrix
from sklearn.preprocessing import MinMaxScaler
print('Imports..') | {"hexsha": "03bba1f0c9f4546e774e14c0ef80f1d13c95a90b", "size": 449, "ext": "py", "lang": "Python", "max_stars_repo_path": "01_AnomalyDetection/scripts/PythonImports.py", "max_stars_repo_name": "yellingmonkees/MetaLearningForAD", "max_stars_repo_head_hexsha": "04579ddf707421a016f5ca3a0a2e4ba80efe2890", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "01_AnomalyDetection/scripts/PythonImports.py", "max_issues_repo_name": "yellingmonkees/MetaLearningForAD", "max_issues_repo_head_hexsha": "04579ddf707421a016f5ca3a0a2e4ba80efe2890", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2022-03-03T02:00:24.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-03T02:00:24.000Z", "max_forks_repo_path": "01_AnomalyDetection/scripts/PythonImports.py", "max_forks_repo_name": "yellingmonkees/MetaLearningForAD", "max_forks_repo_head_hexsha": "04579ddf707421a016f5ca3a0a2e4ba80efe2890", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.45, "max_line_length": 53, "alphanum_fraction": 0.8285077951, "include": true, "reason": "import numpy", "num_tokens": 98} |
#=
Copyright 2013 - 2015 Marco Nehmeier ([email protected])
Copyright 2015 Oliver Heimlich ([email protected])
Original author: Marco Nehmeier (unit tests in libieeep1788)
Converted into portable ITL format by Oliver Heimlich with minor corrections.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=#
#Language imports
#Test library imports
using Base.Test
#Arithmetic library imports
using ValidatedNumerics
#Preamble
setprecision(53)
setprecision(Interval, Float64)
setrounding(Interval, :narrow)
@testset "minimal_mulRevToPair_test" begin
@test nthargout(1, 2, @mulrev, ∅, Interval(1.0, 2.0)) == ∅
@test nthargout(2, 2, @mulrev, ∅, Interval(1.0, 2.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(1.0, 2.0), ∅) == ∅
@test nthargout(2, 2, @mulrev, Interval(1.0, 2.0), ∅) == ∅
@test nthargout(1, 2, @mulrev, ∅, ∅) == ∅
@test nthargout(2, 2, @mulrev, ∅, ∅) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), Interval(-2.1, -0.4)) == Interval(0x1.999999999999ap-3, 0x1.5p+4)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), Interval(-2.1, -0.4)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), Interval(-2.1, -0.4)) == Interval(0x1.999999999999ap-3, Inf)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), Interval(-2.1, -0.4)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), Interval(-2.1, -0.4)) == Interval(-Inf, -0x1.745d1745d1745p-2)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), Interval(-2.1, -0.4)) == Interval(0x1.999999999999ap-3, Inf)
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), Interval(-2.1, -0.4)) == Interval(-Inf, -0x1.745d1745d1745p-2)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), Interval(-2.1, -0.4)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), Interval(-2.1, -0.4)) == Interval(-0x1.a400000000001p+7, -0x1.745d1745d1745p-2)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), Interval(-2.1, -0.4)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), Interval(-2.1, -0.4)) == ∅
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), Interval(-2.1, -0.4)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), Interval(-2.1, -0.4)) == Interval(0.0, 0x1.5p+4)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), Interval(-2.1, -0.4)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), Interval(-2.1, -0.4)) == Interval(0.0, Inf)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), Interval(-2.1, -0.4)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), Interval(-2.1, -0.4)) == Interval(-Inf, -0x1.745d1745d1745p-2)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), Interval(-2.1, -0.4)) == Interval(0.0, Inf)
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), Interval(-2.1, -0.4)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), Interval(-2.1, -0.4)) == Interval(0x1.999999999999ap-3, Inf)
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), Interval(-2.1, -0.4)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), Interval(-2.1, -0.4)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), Interval(-2.1, -0.4)) == Interval(-0x1.a400000000001p+7, 0.0)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), Interval(-2.1, -0.4)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), Interval(-2.1, -0.4)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), Interval(-2.1, -0.4)) == Interval(0.0, Inf)
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), Interval(-2.1, 0.0)) == Interval(0.0, 0x1.5p+4)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), Interval(-2.1, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), Interval(-2.1, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), Interval(-2.1, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), Interval(-2.1, 0.0)) == Interval(-0x1.a400000000001p+7, 0.0)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), Interval(-2.1, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), Interval(-2.1, 0.0)) == Interval(0.0, 0x1.5p+4)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), Interval(-2.1, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), Interval(-2.1, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), Interval(-2.1, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), Interval(-2.1, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), Interval(-2.1, 0.0)) == Interval(-0x1.a400000000001p+7, 0.0)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), Interval(-2.1, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), Interval(-2.1, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), Interval(-2.1, 0.12)) == Interval(-0x1.3333333333333p+0, 0x1.5p+4)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), Interval(-2.1, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), Interval(-2.1, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), Interval(-2.1, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), Interval(-2.1, 0.12)) == Interval(-0x1.a400000000001p+7, 0x1.8p+3)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), Interval(-2.1, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), Interval(-2.1, 0.12)) == Interval(-0x1.3333333333333p+0, 0x1.5p+4)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), Interval(-2.1, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), Interval(-2.1, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), Interval(-2.1, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), Interval(-2.1, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), Interval(-2.1, 0.12)) == Interval(-0x1.a400000000001p+7, 0x1.8p+3)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), Interval(-2.1, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), Interval(-2.1, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), Interval(0.0, 0.12)) == Interval(-0x1.3333333333333p+0, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), Interval(0.0, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), Interval(0.0, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), Interval(0.0, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), Interval(0.0, 0.12)) == Interval(0.0, 0x1.8p+3)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), Interval(0.0, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), Interval(0.0, 0.12)) == Interval(-0x1.3333333333333p+0, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), Interval(0.0, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), Interval(0.0, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), Interval(0.0, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), Interval(0.0, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), Interval(0.0, 0.12)) == Interval(0.0, 0x1.8p+3)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), Interval(0.0, 0.12)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), Interval(0.0, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), Interval(0.01, 0.12)) == Interval(-0x1.3333333333333p+0, -0x1.47ae147ae147bp-8)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), Interval(0.01, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), Interval(0.01, 0.12)) == Interval(-Inf, -0x1.47ae147ae147bp-8)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), Interval(0.01, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), Interval(0.01, 0.12)) == Interval(-Inf, -0x1.47ae147ae147bp-8)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), Interval(0.01, 0.12)) == Interval(0x1.29e4129e4129dp-7, Inf)
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), Interval(0.01, 0.12)) == Interval(0x1.29e4129e4129dp-7, Inf)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), Interval(0.01, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), Interval(0.01, 0.12)) == Interval(0x1.29e4129e4129dp-7, 0x1.8p+3)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), Interval(0.01, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), Interval(0.01, 0.12)) == ∅
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), Interval(0.01, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), Interval(0.01, 0.12)) == Interval(-0x1.3333333333333p+0, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), Interval(0.01, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), Interval(0.01, 0.12)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), Interval(0.01, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), Interval(0.01, 0.12)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), Interval(0.01, 0.12)) == Interval(0x1.29e4129e4129dp-7, Inf)
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), Interval(0.01, 0.12)) == Interval(-Inf, -0x1.47ae147ae147bp-8)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), Interval(0.01, 0.12)) == Interval(0.0, Inf)
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), Interval(0.01, 0.12)) == Interval(0.0, Inf)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), Interval(0.01, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), Interval(0.01, 0.12)) == Interval(0.0, 0x1.8p+3)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), Interval(0.01, 0.12)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), Interval(0.01, 0.12)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), Interval(0.01, 0.12)) == Interval(0.0, Inf)
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), Interval(0.0, 0.0)) == Interval(0.0, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), Interval(0.0, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), Interval(0.0, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), Interval(0.0, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), Interval(0.0, 0.0)) == Interval(0.0, 0.0)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), Interval(0.0, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), Interval(0.0, 0.0)) == Interval(0.0, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), Interval(0.0, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), Interval(0.0, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), Interval(0.0, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), Interval(0.0, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), Interval(0.0, 0.0)) == Interval(0.0, 0.0)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), Interval(0.0, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), Interval(0.0, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), Interval(-Inf, -0.1)) == Interval(0x1.999999999999ap-5, Inf)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), Interval(-Inf, -0.1)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), Interval(-Inf, -0.1)) == Interval(0x1.999999999999ap-5, Inf)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), Interval(-Inf, -0.1)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), Interval(-Inf, -0.1)) == Interval(-Inf, -0x1.745d1745d1745p-4)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), Interval(-Inf, -0.1)) == Interval(0x1.999999999999ap-5, Inf)
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), Interval(-Inf, -0.1)) == Interval(-Inf, -0x1.745d1745d1745p-4)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), Interval(-Inf, -0.1)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), Interval(-Inf, -0.1)) == Interval(-Inf, -0x1.745d1745d1745p-4)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), Interval(-Inf, -0.1)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), Interval(-Inf, -0.1)) == ∅
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), Interval(-Inf, -0.1)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), Interval(-Inf, -0.1)) == Interval(0.0, Inf)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), Interval(-Inf, -0.1)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), Interval(-Inf, -0.1)) == Interval(0.0, Inf)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), Interval(-Inf, -0.1)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), Interval(-Inf, -0.1)) == Interval(-Inf, -0x1.745d1745d1745p-4)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), Interval(-Inf, -0.1)) == Interval(0.0, Inf)
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), Interval(-Inf, -0.1)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), Interval(-Inf, -0.1)) == Interval(0x1.999999999999ap-5, Inf)
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), Interval(-Inf, -0.1)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), Interval(-Inf, -0.1)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), Interval(-Inf, -0.1)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), Interval(-Inf, -0.1)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), Interval(-Inf, -0.1)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), Interval(-Inf, -0.1)) == Interval(0.0, Inf)
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), Interval(-Inf, 0.0)) == Interval(0.0, Inf)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), Interval(-Inf, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), Interval(-Inf, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), Interval(-Inf, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), Interval(-Inf, 0.0)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), Interval(-Inf, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), Interval(-Inf, 0.0)) == Interval(0.0, Inf)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), Interval(-Inf, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), Interval(-Inf, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), Interval(-Inf, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), Interval(-Inf, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), Interval(-Inf, 0.0)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), Interval(-Inf, 0.0)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), Interval(-Inf, 0.0)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), Interval(-Inf, 0.3)) == Interval(-0x1.8p+1, Inf)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), Interval(-Inf, 0.3)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), Interval(-Inf, 0.3)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), Interval(-Inf, 0.3)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), Interval(-Inf, 0.3)) == Interval(-Inf, 0x1.ep+4)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), Interval(-Inf, 0.3)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), Interval(-Inf, 0.3)) == Interval(-0x1.8p+1, Inf)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), Interval(-Inf, 0.3)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), Interval(-Inf, 0.3)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), Interval(-Inf, 0.3)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), Interval(-Inf, 0.3)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), Interval(-Inf, 0.3)) == Interval(-Inf, 0x1.ep+4)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), Interval(-Inf, 0.3)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), Interval(-Inf, 0.3)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), Interval(-0.21, Inf)) == Interval(-Inf, 0x1.0cccccccccccdp+1)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), Interval(-0.21, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), Interval(-0.21, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), Interval(-0.21, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), Interval(-0.21, Inf)) == Interval(-0x1.5p+4, Inf)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), Interval(-0.21, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), Interval(-0.21, Inf)) == Interval(-Inf, 0x1.0cccccccccccdp+1)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), Interval(-0.21, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), Interval(-0.21, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), Interval(-0.21, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), Interval(-0.21, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), Interval(-0.21, Inf)) == Interval(-0x1.5p+4, Inf)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), Interval(-0.21, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), Interval(-0.21, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), Interval(0.0, Inf)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), Interval(0.0, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), Interval(0.0, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), Interval(0.0, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), Interval(0.0, Inf)) == Interval(0.0, Inf)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), Interval(0.0, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), Interval(0.0, Inf)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), Interval(0.0, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), Interval(0.0, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), Interval(0.0, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), Interval(0.0, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), Interval(0.0, Inf)) == Interval(0.0, Inf)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), Interval(0.0, Inf)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), Interval(0.0, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), Interval(0.04, Inf)) == Interval(-Inf, -0x1.47ae147ae147bp-6)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), Interval(0.04, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), Interval(0.04, Inf)) == Interval(-Inf, -0x1.47ae147ae147bp-6)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), Interval(0.04, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), Interval(0.04, Inf)) == Interval(-Inf, -0x1.47ae147ae147bp-6)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), Interval(0.04, Inf)) == Interval(0x1.29e4129e4129dp-5, Inf)
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), Interval(0.04, Inf)) == Interval(0x1.29e4129e4129dp-5, Inf)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), Interval(0.04, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), Interval(0.04, Inf)) == Interval(0x1.29e4129e4129dp-5, Inf)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), Interval(0.04, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), Interval(0.04, Inf)) == ∅
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), Interval(0.04, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), Interval(0.04, Inf)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), Interval(0.04, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), Interval(0.04, Inf)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), Interval(0.04, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), Interval(0.04, Inf)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), Interval(0.04, Inf)) == Interval(0x1.29e4129e4129dp-5, Inf)
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), Interval(0.04, Inf)) == Interval(-Inf, -0x1.47ae147ae147bp-6)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), Interval(0.04, Inf)) == Interval(0.0, Inf)
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), Interval(0.04, Inf)) == Interval(0.0, Inf)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), Interval(0.04, Inf)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), Interval(0.04, Inf)) == Interval(0.0, Inf)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), Interval(0.04, Inf)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), Interval(0.04, Inf)) == Interval(-Inf, 0.0)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), Interval(0.04, Inf)) == Interval(0.0, Inf)
@test nthargout(1, 2, @mulrev, Interval(-2.0, -0.1), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, -0.1), entireinterval(Float64)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 0.0), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 0.0), entireinterval(Float64)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, 1.1), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, 1.1), entireinterval(Float64)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 1.1), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 1.1), entireinterval(Float64)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, 1.1), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.01, 1.1), entireinterval(Float64)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, 0.0), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, 0.0), entireinterval(Float64)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, -0.1), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, -0.1), entireinterval(Float64)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 0.0), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 0.0), entireinterval(Float64)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-Inf, 1.1), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-Inf, 1.1), entireinterval(Float64)) == ∅
@test nthargout(1, 2, @mulrev, Interval(-2.0, Inf), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(-2.0, Inf), entireinterval(Float64)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.0, Inf), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.0, Inf), entireinterval(Float64)) == ∅
@test nthargout(1, 2, @mulrev, Interval(0.01, Inf), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, Interval(0.01, Inf), entireinterval(Float64)) == ∅
@test nthargout(1, 2, @mulrev, entireinterval(Float64), entireinterval(Float64)) == entireinterval(Float64)
@test nthargout(2, 2, @mulrev, entireinterval(Float64), entireinterval(Float64)) == ∅
end
@testset "minimal_mulRevToPair_dec_test" begin
@test nthargout(1, 2, @mulrev, DecoratedInterval(∅, trv), DecoratedInterval(Interval(1.0, 2.0), def)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(∅, trv), DecoratedInterval(Interval(1.0, 2.0), def))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(∅, trv), DecoratedInterval(Interval(1.0, 2.0), def)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(∅, trv), DecoratedInterval(Interval(1.0, 2.0), def))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(1.0, 2.0), com), DecoratedInterval(∅, trv)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(1.0, 2.0), com), DecoratedInterval(∅, trv))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(1.0, 2.0), com), DecoratedInterval(∅, trv)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(1.0, 2.0), com), DecoratedInterval(∅, trv))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(∅, trv), DecoratedInterval(∅, trv)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(∅, trv), DecoratedInterval(∅, trv))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(∅, trv), DecoratedInterval(∅, trv)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(∅, trv), DecoratedInterval(∅, trv))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), com), DecoratedInterval(Interval(-2.1, -0.4), com)) == DecoratedInterval(Interval(0x1.999999999999ap-3, 0x1.5p+4), com)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), com), DecoratedInterval(Interval(-2.1, -0.4), com))) == decoration(DecoratedInterval(Interval(0x1.999999999999ap-3, 0x1.5p+4), com))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), com), DecoratedInterval(Interval(-2.1, -0.4), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), com), DecoratedInterval(Interval(-2.1, -0.4), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-2.1, -0.4), com)) == DecoratedInterval(Interval(0x1.999999999999ap-3, Inf), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-2.1, -0.4), com))) == decoration(DecoratedInterval(Interval(0x1.999999999999ap-3, Inf), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-2.1, -0.4), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-2.1, -0.4), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), com), DecoratedInterval(Interval(-2.1, -0.4), dac)) == DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-2), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), com), DecoratedInterval(Interval(-2.1, -0.4), dac))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-2), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), com), DecoratedInterval(Interval(-2.1, -0.4), dac)) == DecoratedInterval(Interval(0x1.999999999999ap-3, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), com), DecoratedInterval(Interval(-2.1, -0.4), dac))) == decoration(DecoratedInterval(Interval(0x1.999999999999ap-3, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), trv), DecoratedInterval(Interval(-2.1, -0.4), def)) == DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-2), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), trv), DecoratedInterval(Interval(-2.1, -0.4), def))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-2), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), trv), DecoratedInterval(Interval(-2.1, -0.4), def)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), trv), DecoratedInterval(Interval(-2.1, -0.4), def))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), com), DecoratedInterval(Interval(-2.1, -0.4), com)) == DecoratedInterval(Interval(-0x1.a400000000001p+7, -0x1.745d1745d1745p-2), com)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), com), DecoratedInterval(Interval(-2.1, -0.4), com))) == decoration(DecoratedInterval(Interval(-0x1.a400000000001p+7, -0x1.745d1745d1745p-2), com))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), com), DecoratedInterval(Interval(-2.1, -0.4), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), com), DecoratedInterval(Interval(-2.1, -0.4), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-2.1, -0.4), def)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-2.1, -0.4), def))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-2.1, -0.4), def)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-2.1, -0.4), def))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-2.1, -0.4), dac)) == DecoratedInterval(Interval(0.0, 0x1.5p+4), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-2.1, -0.4), dac))) == decoration(DecoratedInterval(Interval(0.0, 0x1.5p+4), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-2.1, -0.4), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-2.1, -0.4), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), def), DecoratedInterval(Interval(-2.1, -0.4), com)) == DecoratedInterval(Interval(0.0, Inf), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), def), DecoratedInterval(Interval(-2.1, -0.4), com))) == decoration(DecoratedInterval(Interval(0.0, Inf), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), def), DecoratedInterval(Interval(-2.1, -0.4), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), def), DecoratedInterval(Interval(-2.1, -0.4), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), trv), DecoratedInterval(Interval(-2.1, -0.4), def)) == DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-2), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), trv), DecoratedInterval(Interval(-2.1, -0.4), def))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-2), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), trv), DecoratedInterval(Interval(-2.1, -0.4), def)) == DecoratedInterval(Interval(0.0, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), trv), DecoratedInterval(Interval(-2.1, -0.4), def))) == decoration(DecoratedInterval(Interval(0.0, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-2.1, -0.4), dac)) == DecoratedInterval(Interval(-Inf, 0.0), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-2.1, -0.4), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-2.1, -0.4), dac)) == DecoratedInterval(Interval(0x1.999999999999ap-3, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-2.1, -0.4), dac))) == decoration(DecoratedInterval(Interval(0x1.999999999999ap-3, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), def), DecoratedInterval(Interval(-2.1, -0.4), com)) == DecoratedInterval(Interval(-Inf, 0.0), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), def), DecoratedInterval(Interval(-2.1, -0.4), com))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), def), DecoratedInterval(Interval(-2.1, -0.4), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), def), DecoratedInterval(Interval(-2.1, -0.4), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), def), DecoratedInterval(Interval(-2.1, -0.4), def)) == DecoratedInterval(Interval(-0x1.a400000000001p+7, 0.0), def)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), def), DecoratedInterval(Interval(-2.1, -0.4), def))) == decoration(DecoratedInterval(Interval(-0x1.a400000000001p+7, 0.0), def))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), def), DecoratedInterval(Interval(-2.1, -0.4), def)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), def), DecoratedInterval(Interval(-2.1, -0.4), def))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-2.1, -0.4), dac)) == DecoratedInterval(Interval(-Inf, 0.0), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-2.1, -0.4), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-2.1, -0.4), dac)) == DecoratedInterval(Interval(0.0, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-2.1, -0.4), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(Interval(0.0, 0x1.5p+4), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(Interval(0.0, 0x1.5p+4), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(Interval(-0x1.a400000000001p+7, 0.0), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(Interval(-0x1.a400000000001p+7, 0.0), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(Interval(0.0, 0x1.5p+4), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(Interval(0.0, 0x1.5p+4), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(Interval(-0x1.a400000000001p+7, 0.0), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(Interval(-0x1.a400000000001p+7, 0.0), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-2.1, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-2.1, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(Interval(-0x1.3333333333333p+0, 0x1.5p+4), def)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(Interval(-0x1.3333333333333p+0, 0x1.5p+4), def))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(Interval(-0x1.a400000000001p+7, 0x1.8p+3), def)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(Interval(-0x1.a400000000001p+7, 0x1.8p+3), def))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(Interval(-0x1.3333333333333p+0, 0x1.5p+4), def)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(Interval(-0x1.3333333333333p+0, 0x1.5p+4), def))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(Interval(-0x1.a400000000001p+7, 0x1.8p+3), def)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(Interval(-0x1.a400000000001p+7, 0x1.8p+3), def))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), def), DecoratedInterval(Interval(-2.1, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), def), DecoratedInterval(Interval(-2.1, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), com), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(Interval(-0x1.3333333333333p+0, 0.0), com)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), com), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(Interval(-0x1.3333333333333p+0, 0.0), com))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), com), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), com), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), com), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(Interval(0.0, 0x1.8p+3), com)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), com), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(Interval(0.0, 0x1.8p+3), com))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), com), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), com), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(Interval(-0x1.3333333333333p+0, 0.0), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(Interval(-0x1.3333333333333p+0, 0.0), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(Interval(0.0, 0x1.8p+3), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(Interval(0.0, 0x1.8p+3), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.0, 0.12), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.0, 0.12), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(-0x1.3333333333333p+0, -0x1.47ae147ae147bp-8), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(-0x1.3333333333333p+0, -0x1.47ae147ae147bp-8), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-8), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-8), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-8), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-8), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(0x1.29e4129e4129dp-7, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(0x1.29e4129e4129dp-7, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(0x1.29e4129e4129dp-7, Inf), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(0x1.29e4129e4129dp-7, Inf), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(0x1.29e4129e4129dp-7, 0x1.8p+3), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(0x1.29e4129e4129dp-7, 0x1.8p+3), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(-0x1.3333333333333p+0, 0.0), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(-0x1.3333333333333p+0, 0.0), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(-Inf, 0.0), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(-Inf, 0.0), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(0x1.29e4129e4129dp-7, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(0x1.29e4129e4129dp-7, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-8), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-8), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(0.0, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(0.0, Inf), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(0.0, 0x1.8p+3), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(0.0, 0x1.8p+3), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(-Inf, 0.0), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.01, 0.12), dac)) == DecoratedInterval(Interval(0.0, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.01, 0.12), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), com), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(Interval(0.0, 0.0), com)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), com), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(Interval(0.0, 0.0), com))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), com), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), com), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), com), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), com), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(Interval(0.0, 0.0), com)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), com), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(Interval(0.0, 0.0), com))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), com), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), com), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), com), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(Interval(0.0, 0.0), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(Interval(0.0, 0.0), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(Interval(0.0, 0.0), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(Interval(0.0, 0.0), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.0, 0.0), com)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.0, 0.0), com))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(0x1.999999999999ap-5, Inf), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(0x1.999999999999ap-5, Inf), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(0x1.999999999999ap-5, Inf), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(0x1.999999999999ap-5, Inf), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-4), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-4), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(0x1.999999999999ap-5, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(0x1.999999999999ap-5, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-4), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-4), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-4), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-4), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(0.0, Inf), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(0.0, Inf), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-4), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.745d1745d1745p-4), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(0.0, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(-Inf, 0.0), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(0x1.999999999999ap-5, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(0x1.999999999999ap-5, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(-Inf, 0.0), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(-Inf, 0.0), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(-Inf, 0.0), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-Inf, -0.1), dac)) == DecoratedInterval(Interval(0.0, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-Inf, -0.1), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(Interval(0.0, Inf), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(Interval(-Inf, 0.0), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(Interval(0.0, Inf), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(Interval(-Inf, 0.0), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-Inf, 0.0), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-Inf, 0.0), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(Interval(-0x1.8p+1, Inf), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(Interval(-0x1.8p+1, Inf), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(Interval(-Inf, 0x1.ep+4), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0x1.ep+4), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(Interval(-0x1.8p+1, Inf), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(Interval(-0x1.8p+1, Inf), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(Interval(-Inf, 0x1.ep+4), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0x1.ep+4), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-Inf, 0.3), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-Inf, 0.3), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(Interval(-Inf, 0x1.0cccccccccccdp+1), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0x1.0cccccccccccdp+1), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(Interval(-0x1.5p+4, Inf), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(Interval(-0x1.5p+4, Inf), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(Interval(-Inf, 0x1.0cccccccccccdp+1), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0x1.0cccccccccccdp+1), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(Interval(-0x1.5p+4, Inf), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(Interval(-0x1.5p+4, Inf), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-0.21, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(-0.21, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(Interval(-Inf, 0.0), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(Interval(0.0, Inf), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(Interval(-Inf, 0.0), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(Interval(0.0, Inf), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.0, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.0, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-6), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-6), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-6), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-6), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-6), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-6), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(0x1.29e4129e4129dp-5, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(0x1.29e4129e4129dp-5, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(0x1.29e4129e4129dp-5, Inf), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(0x1.29e4129e4129dp-5, Inf), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(0x1.29e4129e4129dp-5, Inf), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(0x1.29e4129e4129dp-5, Inf), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(-Inf, 0.0), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(-Inf, 0.0), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(-Inf, 0.0), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(0x1.29e4129e4129dp-5, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(0x1.29e4129e4129dp-5, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-6), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(-Inf, -0x1.47ae147ae147bp-6), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(0.0, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(0.0, Inf), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(0.0, Inf), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(-Inf, 0.0), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(-Inf, 0.0), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.04, Inf), dac)) == DecoratedInterval(Interval(0.0, Inf), trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(Interval(0.04, Inf), dac))) == decoration(DecoratedInterval(Interval(0.0, Inf), trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, -0.1), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 0.0), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, 0.0), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, -0.1), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 0.0), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-Inf, 1.1), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(-2.0, Inf), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.0, Inf), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), dac)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), dac))
@test nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(Interval(0.01, Inf), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
@test nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(entireinterval(Float64), trv)
@test decoration(nthargout(1, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(entireinterval(Float64), trv))
@test nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(entireinterval(Float64), dac)) == DecoratedInterval(∅, trv)
@test decoration(nthargout(2, 2, @mulrev, DecoratedInterval(entireinterval(Float64), dac), DecoratedInterval(entireinterval(Float64), dac))) == decoration(DecoratedInterval(∅, trv))
end
# FactCheck.exitstatus()
| {"hexsha": "8d6e1c081be57d6b400af569cae6504bfb5ef92c", "size": 158287, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "output/julia/Base.Test/ValidatedNumerics/libieeep1788_tests_mul_rev.jl", "max_stars_repo_name": "krish8484/ITF1788", "max_stars_repo_head_hexsha": "54dbc581703b5b0d89bb2f3a49bca4299b7d3b56", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "output/julia/Base.Test/ValidatedNumerics/libieeep1788_tests_mul_rev.jl", "max_issues_repo_name": "krish8484/ITF1788", "max_issues_repo_head_hexsha": "54dbc581703b5b0d89bb2f3a49bca4299b7d3b56", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2020-03-10T13:47:39.000Z", "max_issues_repo_issues_event_max_datetime": "2020-03-13T21:45:39.000Z", "max_forks_repo_path": "output/julia/Base.Test/ValidatedNumerics/libieeep1788_tests_mul_rev.jl", "max_forks_repo_name": "krish8484/ITF1788", "max_forks_repo_head_hexsha": "54dbc581703b5b0d89bb2f3a49bca4299b7d3b56", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 147.7936507937, "max_line_length": 233, "alphanum_fraction": 0.6926026774, "num_tokens": 57318} |
import numpy as np
def updateState(state, patterns):
newState = [None]*len(state)
for pos in range(2, len(state) - 2):
newState[pos] = patterns[state[pos-2:pos+3]]
newState[-2:] = ['.', '.']
newState[:2] = ['.', '.']
newState = ''.join(newState)
return newState
nPadding = 10000
with open('day12.txt') as f:
data = f.read().splitlines()
padding = '.' * nPadding
state = padding + data[0].split('state: ')[1] + padding
patterns = {pattern.split(' => ')[0]: pattern.split(' => ')[1] for pattern in data[2:]}
nIter = 200
potNumbers = np.arange(-nPadding, len(data[0].split('state: ')[1])+nPadding)
sums = np.zeros(nIter)
for t in range(1, nIter+1):
state = updateState(state, patterns)
stateList = np.array([letter for letter in state])
sums[t-1] = np.sum(potNumbers[stateList == '#'])
print("Visual inspection")
print(np.diff(sums))
maxIters = 50000000000
print(int((maxIters - nIter) * 62 + sums[-1]))
| {"hexsha": "fb0e4bc0a63e4bdcce57df8f8127ec107ee01971", "size": 978, "ext": "py", "lang": "Python", "max_stars_repo_path": "2018/day12-2.py", "max_stars_repo_name": "alvaropp/AdventOfCode2017", "max_stars_repo_head_hexsha": "2827dcc18ecb9ad59a1a5fe11e469f31bafb74ad", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "2018/day12-2.py", "max_issues_repo_name": "alvaropp/AdventOfCode2017", "max_issues_repo_head_hexsha": "2827dcc18ecb9ad59a1a5fe11e469f31bafb74ad", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "2018/day12-2.py", "max_forks_repo_name": "alvaropp/AdventOfCode2017", "max_forks_repo_head_hexsha": "2827dcc18ecb9ad59a1a5fe11e469f31bafb74ad", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 24.45, "max_line_length": 91, "alphanum_fraction": 0.609406953, "include": true, "reason": "import numpy", "num_tokens": 290} |
function prepareFWIDataFiles(m,Minv::RegularMesh,mref,boundsHigh,boundsLow,
filenamePrefix::String,omega::Array{Float64,1},waveCoef::Array{Complex128,1},
pad::Int64,ABLpad::Int64,jump::Int64,offset::Int64=prod(Minv.n+1),workerList = workers(),
maxBatchSize::Int64=48, Ainv::AbstractSolver = getMUMPSsolver([],0,0,2),useFilesForFields::Bool = false)
########################## m is in Velocity here. ###################################
RCVfile = string(filenamePrefix,"_rcvMap.dat");
SRCfile = string(filenamePrefix,"_srcMap.dat");
writeSrcRcvLocFile(SRCfile,Minv,ABLpad,jump);
writeSrcRcvLocFile(RCVfile,Minv,ABLpad,1);
dataFullFilenamePrefix = string(filenamePrefix,"_freq");
gamma = prepareFWIDataFiles2(m, Minv, filenamePrefix,dataFullFilenamePrefix,omega,waveCoef,pad,ABLpad,offset,workerList,maxBatchSize,Ainv);
file = matopen(string(filenamePrefix,"_PARAM.mat"), "w");
write(file,"boundsLow",boundsLow);
write(file,"boundsHigh",boundsHigh);
write(file,"mref",mref);
write(file,"domain",Minv.domain);
write(file,"n",Minv.n);
write(file,"gamma",gamma);
write(file,"pad",pad);
write(file,"omega",omega);
write(file,"waveCoef",waveCoef);
close(file);
return gamma;
end
function prepareJointTravelTimeAndFWIDataFiles(m,Minv::RegularMesh,mref,boundsHigh,boundsLow,
filenamePrefix::String,omega::Array{Float64,1},waveCoef::Array{Complex128,1},
pad::Int64,ABLpad::Int64,jump::Int64,offset::Int64=prod(Minv.n+1),workerList = workers(),
maxBatchSize::Int64=48, Ainv::AbstractSolver = getMUMPSsolver([],0,0,2),useFilesForFields::Bool = false)
########################## m is in Velocity here. ###################################
RCVfile = string(filenamePrefix,"_rcvMap.dat");
SRCfile = string(filenamePrefix,"_srcMap.dat");
writeSrcRcvLocFile(SRCfile,Minv,ABLpad,jump);
writeSrcRcvLocFile(RCVfile,Minv,ABLpad,1);
dataFullFilenamePrefix = string(filenamePrefix,"_freq");
gamma = prepareFWIDataFiles2(m, Minv, filenamePrefix,dataFullFilenamePrefix,omega,waveCoef,pad,ABLpad,offset,workerList,maxBatchSize,Ainv,useFilesForFields);
dataFullFilenamePrefix = string(filenamePrefix,"_travelTime");
HO = false;
prepareTravelTimeDataFiles(m, Minv, filenamePrefix,dataFullFilenamePrefix,offset,HO,useFilesForFields);
file = matopen(string(filenamePrefix,"_PARAM.mat"), "w");
write(file,"boundsLow",boundsLow);
write(file,"boundsHigh",boundsHigh);
write(file,"mref",mref);
write(file,"MinvOmega",Minv.domain);
write(file,"MinvN",Minv.n);
write(file,"gamma",gamma);
write(file,"pad",pad);
write(file,"omega",omega);
write(file,"waveCoef",waveCoef);
write(file,"HO",HO);
close(file);
end
function prepareFWIDataFiles2(m, Minv::RegularMesh, filenamePrefix::String,dataFullFilenamePrefix::String, omega::Array{Float64,1},
waveCoef::Array{Complex128,1}, pad::Int64,ABLpad::Int64,offset::Int64,workerList::Array{Int64,1},maxBatchSize::Int64,
Ainv::AbstractSolver,useFilesForFields::Bool = false)
println("maxOmega*maxKappaSq*h: should be below 0.6");
println(omega[end]*maximum(Minv.h)*(1./minimum(m)));
RCVfile = string(filenamePrefix,"_rcvMap.dat");
SRCfile = string(filenamePrefix,"_srcMap.dat");
srcNodeMap = readSrcRcvLocationFile(SRCfile,Minv);
rcvNodeMap = readSrcRcvLocationFile(RCVfile,Minv);
Q = generateSrcRcvProjOperators(Minv.n+1,srcNodeMap);
P = generateSrcRcvProjOperators(Minv.n+1,rcvNodeMap);
Q = Q.*1/(norm(Minv.h)^2);
println("We have ",size(Q,2)," sources");
# compute observed data
ABLamp = getMaximalFrequency(1./(minimum(m).^2),Minv);
gamma = getABL(Minv,true,ones(Int64,Minv.dim)*ABLpad,ABLamp);
attenuation = 0.01*ABLamp;
gamma += attenuation; # adding Attenuation.
println("~~~~~~~ Getting data FWI: ~~~~~~~");
# Solve forward problem (should be relaced in reading data from file)
batch = min(size(Q,2),maxBatchSize);
(pFor,contDiv,SourcesSubInd) = getFWIparam(omega,waveCoef,vec(gamma),Q,P,Minv,Ainv,workerList,batch,useFilesForFields);
(D,pFor) = getData(velocityToSlowSquared(m[:])[1],pFor,ones(length(pFor)),true);
nsrc = size(Q,2);
nrcv = size(P,2);
for k = 1:length(omega)
I = contDiv[k] : contDiv[k+1] - 1
Dobsk = Array{Array{Complex128,2}}(length(I));
for i = 1:length(I)
Dobsk[i] = fetch(D[I[i]]);
end
Dobsk = arrangeRemoteCallDataIntoLocalData(Dobsk);
omRound = string(round((omega[k]/(2*pi))*100.0)/100.0);
Wd_k = (1./(abs.(real(Dobsk))+0.1*mean(abs.(Dobsk)))) + 1im*(1./(abs.(imag(Dobsk))+0.1*mean(abs.(Dobsk))));
# Wd_k = (1./(0.0*abs(real(Dobsk))+1.0*mean(abs(Dobsk)))) + 1im*(1./(0.0*abs(imag(Dobsk))+1.0*mean(abs(Dobsk))));
Wd_k = limitDataToOffset(Wd_k,srcNodeMap,rcvNodeMap,offset);
filename = string(dataFullFilenamePrefix,omRound,".dat");
writeDataFile(filename,Dobsk,Wd_k,srcNodeMap,rcvNodeMap);
end
return gamma;
end | {"hexsha": "a82c7582a7a62e91ef387746c085a23eaa3d53ff", "size": 4750, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "examples/ex2DFWI/prepareFWIDataFiles.jl", "max_stars_repo_name": "UnofficialJuliaMirrorSnapshots/jInv.jl-3dacf901-f8cd-5544-86ed-7a705f85c244", "max_stars_repo_head_hexsha": "2e7305f231a29bd8e1e803b82cc2bc8e9b7a205a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 40, "max_stars_repo_stars_event_min_datetime": "2016-04-11T22:51:45.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-15T21:58:53.000Z", "max_issues_repo_path": "examples/ex2DFWI/prepareFWIDataFiles.jl", "max_issues_repo_name": "UnofficialJuliaMirrorSnapshots/jInv.jl-3dacf901-f8cd-5544-86ed-7a705f85c244", "max_issues_repo_head_hexsha": "2e7305f231a29bd8e1e803b82cc2bc8e9b7a205a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 52, "max_issues_repo_issues_event_min_datetime": "2016-03-23T18:24:31.000Z", "max_issues_repo_issues_event_max_datetime": "2020-02-08T15:52:47.000Z", "max_forks_repo_path": "examples/ex2DFWI/prepareFWIDataFiles.jl", "max_forks_repo_name": "UnofficialJuliaMirrorSnapshots/jInv.jl-3dacf901-f8cd-5544-86ed-7a705f85c244", "max_forks_repo_head_hexsha": "2e7305f231a29bd8e1e803b82cc2bc8e9b7a205a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 31, "max_forks_repo_forks_event_min_datetime": "2016-03-23T16:52:44.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-08T17:04:41.000Z", "avg_line_length": 41.3043478261, "max_line_length": 158, "alphanum_fraction": 0.7223157895, "num_tokens": 1476} |
[STATEMENT]
lemma cf_pos_poly_represents[simp]: "(cf_pos_poly p) represents x \<longleftrightarrow> p represents x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. cf_pos_poly p represents x = p represents x
[PROOF STEP]
unfolding represents_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (ipoly (cf_pos_poly p) x = (0::'a) \<and> cf_pos_poly p \<noteq> 0) = (ipoly p x = (0::'a) \<and> p \<noteq> 0)
[PROOF STEP]
by auto | {"llama_tokens": 185, "file": "Algebraic_Numbers_Algebraic_Numbers_Prelim", "length": 2} |
from __future__ import division, print_function
import numpy as np
import matplotlib.pyplot as plt
def posterior(fitresult,plot_likelihood=False):
'''
Plot the posterior probablity/likelihood from the given FitResult object.
'''
#The fit parameters and the inverse covariance matrix
p0 = fitresult.p
cov = fitresult.cov
invcov = np.linalg.inv(fitresult.cov)
#A single parameter
if p0.size == 1:
x = np.linspace(p0[0]-5*np.sqrt(cov[0,0]),p0[0]+5*np.sqrt(cov[0,0]),150)
#L might not be vectorized in terms of p, so will calculate the values
#separately for compatibility
L = np.zeros(x.shape)
for i in range(L.size):
L[i] = fitresult.L([x[i]])
#Normalize L
L = L-np.max(L)
if plot_likelihood:
plt.plot(x,L,label='Likelihood')
plt.plot(x,-0.5*(x-p0[0])**2/cov[0,0],label='Gaussian approximation')
plt.ylabel('$L(p_1|data)$')
else:
#Compute probablity
p = np.exp(L)
#Normalize
p = p/np.trapz(p,x)
plt.plot(x,p,label='Probability')
plt.plot(x,np.exp(-0.5*(x-p0)**2*invcov[0,0])/np.sqrt(2*np.pi*cov[0,0]),label='Gaussian approximation')
plt.ylabel('$p(p_1|data)$')
plt.xlabel('$p_1$')
plt.legend()
elif p0.size == 2:
x = np.linspace(p0[0]-5*np.sqrt(cov[0,0]),p0[0]+5*np.sqrt(cov[0,0]),100)
y = np.linspace(p0[1]-5*np.sqrt(cov[1,1]),p0[1]+5*np.sqrt(cov[1,1]),100)
X,Y = np.meshgrid(x,y)
#L might not be vectorized in terms of p, so will calculate the values
#separately for compatibility
L = np.zeros(X.shape)
for i in range(L.shape[0]):
for j in range(L.shape[1]):
L[i,j] = fitresult.L([x[i],y[j]])
#Normalize L
L = L-np.max(L[:])
#Calculate L values for the gaussian approximation
Lapprox = np.zeros(X.shape)
for i in range(L.shape[0]):
for j in range(L.shape[1]):
coord = np.array([[X[i,j]-p0[0],Y[i,j]-p0[1]]]).T
Lapprox[i,j] = -0.5*np.dot(coord.T,np.dot(invcov,coord))
if plot_likelihood:
plt.pcolor(X,Y,L)
else:
#Compute probablity
p = np.exp(L)
plt.pcolor(X,Y,p)
#plot sigma contours
CS = plt.contour(X,Y,Lapprox,[-4.5,-2,-0.5],colors='black',linestyles='solid')
fmt = {}
strs = ['$3 \sigma$','$2 \sigma$','$1 \sigma$']
for l, s in zip(CS.levels, strs):
fmt[l] = s
# Label every other level using strings
plt.clabel(CS, CS.levels, inline=True, fmt=fmt, fontsize=10)
plt.xlabel('$p_1$')
plt.ylabel('$p_2$')
else:
print('More than 2-parameter plots not supported yet!')
| {"hexsha": "d0f36e7457e7bb19cb217930608a5513ee719330", "size": 2885, "ext": "py", "lang": "Python", "max_stars_repo_path": "bayesfit/plot.py", "max_stars_repo_name": "aripekka/bayesfit", "max_stars_repo_head_hexsha": "e17b46540ae8c8bbaecc90073690a197d77a78bb", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "bayesfit/plot.py", "max_issues_repo_name": "aripekka/bayesfit", "max_issues_repo_head_hexsha": "e17b46540ae8c8bbaecc90073690a197d77a78bb", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2018-05-04T10:43:51.000Z", "max_issues_repo_issues_event_max_datetime": "2018-05-04T10:48:52.000Z", "max_forks_repo_path": "bayesfit/plot.py", "max_forks_repo_name": "aripekka/bayesfit", "max_forks_repo_head_hexsha": "e17b46540ae8c8bbaecc90073690a197d77a78bb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.5643564356, "max_line_length": 115, "alphanum_fraction": 0.5421143847, "include": true, "reason": "import numpy", "num_tokens": 830} |
from collections import OrderedDict
from typing import Callable
from typing import Hashable
from typing import List
from typing import Type
import numpy as np
from caldera.utils.np import replace_nan_with_inf
from caldera.utils.nx.traversal._path_utils import PathSum
from caldera.utils.nx.traversal._path_utils import PathSymbol
from caldera.utils.nx.types import Graph
def floyd_warshall(
g: Graph,
symbols: List[PathSymbol],
func: Callable = None,
nodelist: List[Hashable] = None,
return_all: bool = False,
dtype: Type = np.float64,
):
"""Run the floyd-warshall algorithm (all pairs shortest _path) with
arbitrary cost functions.
.. code-block::
W = floyd_warshall2(g, symbols=[
PathSymbol("A", SumPath),
PathSymbol("B", MulPath)
], func: lambda a, b: a / b
)
.. code-block::
W = floyd_warshall2(g, key="weight")
:param g:
:param symbols:
:param func:
:param nodelist:
:param return_all:
:param dtype:
:return:
"""
_symbols = symbols[:]
symbols = []
for s in _symbols:
if isinstance(s, str):
s = PathSymbol(s, PathSum)
symbols.append(s)
if func is None:
def func(x):
return x
if nodelist is None:
nodelist = list(g.nodes())
# initialize weight matrices
matrix_dict = OrderedDict()
for symbol in symbols:
matrix_dict[symbol.name] = symbol.initialize_matrix(g, dtype, nodelist)
if return_all:
ori_matrix_dict = {k: v.copy() for k, v in matrix_dict.items()}
n, m = list(matrix_dict.values())[0].shape
for i in np.arange(n):
# get costs if using node 'i'
parts_dict = OrderedDict()
for symbol in symbols:
M = matrix_dict[symbol.name]
parts_dict[symbol.name] = symbol.accumulator(M[i, :], M[:, i])
# get total cost
m_arr = [np.asarray(m) for m in matrix_dict.values()]
p_arr = [np.asarray(m) for m in parts_dict.values()]
C = replace_nan_with_inf(func(*m_arr))
C_part = func(*p_arr)
# update
for key, M in matrix_dict.items():
part = parts_dict[key]
c = C > C_part
if np.any(c):
# assert M.shape == part.shape
np.putmask(M, c, part)
m_arr = [np.asarray(m) for m in matrix_dict.values()]
C = replace_nan_with_inf(func(*m_arr))
if return_all:
return C, matrix_dict, ori_matrix_dict
return C
| {"hexsha": "5e66e49e7ffc2ae246a179a34a555165ee82bfd5", "size": 2560, "ext": "py", "lang": "Python", "max_stars_repo_path": "caldera/utils/nx/traversal/_all_pairs_shortest_path.py", "max_stars_repo_name": "jvrana/caldera", "max_stars_repo_head_hexsha": "a346324e77f20739e00a82f97530dda4906f59dd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-12-13T17:52:17.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-13T17:52:18.000Z", "max_issues_repo_path": "caldera/utils/nx/traversal/_all_pairs_shortest_path.py", "max_issues_repo_name": "jvrana/caldera", "max_issues_repo_head_hexsha": "a346324e77f20739e00a82f97530dda4906f59dd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2020-10-06T21:06:15.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-10T01:18:23.000Z", "max_forks_repo_path": "caldera/utils/nx/traversal/_all_pairs_shortest_path.py", "max_forks_repo_name": "jvrana/caldera", "max_forks_repo_head_hexsha": "a346324e77f20739e00a82f97530dda4906f59dd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.8585858586, "max_line_length": 79, "alphanum_fraction": 0.603515625, "include": true, "reason": "import numpy", "num_tokens": 633} |
import numpy as np
import cv2,sys,csv,os,threading
from PyQt5.QtWidgets import QMessageBox,QAction
from keras.models import load_model
import qimage2ndarray as q2a
from PyQt5 import QtWidgets,QtGui,QtCore,QtCore
from PyQt5.QtWidgets import QWidget, QLabel, QApplication,QMainWindow,QMessageBox,QFileDialog,QInputDialog
from PyQt5.QtGui import QImage, QPixmap
import pyttsx3
from ui import Ui_MainWindow
import constants
from PyQt5.QtCore import QThread,pyqtSignal,pyqtSlot,QObject
class MainWindow(QMainWindow):
speech_seq_signal=pyqtSignal(str)
def __init__(self):
super(MainWindow,self).__init__()
self.ui=Ui_MainWindow()
self.ui.setupUi(self)
self.showMaximized()
#Menu and Action
about_action=QAction('About',self)
about_action.triggered.connect(self.show_about)
self.ui.menuOptions.addAction(about_action)
#Initalize Buttons
self.ui.speak_btn.clicked.connect(self.start_speak_thread)
self.ui.speak_btn.setShortcut("S")
self.ui.speak_btn.setToolTip("Shortcut: S")
#Initilizing paremeters
self.ui.outTextEdit.setReadOnly(True)
#ComboBox
self.others=['All','Model Loss','Model Accuracy']
signNames=[files.split('.')[0] for files in os.listdir(constants.signImagePath)]
self.ui.search_drop_comboBox.addItems(signNames)
self.ui.search_drop_comboBox.insertSeparator(len(signNames))
self.ui.search_drop_comboBox.addItems(self.others)
self.ui.search_drop_comboBox.insertSeparator((len(signNames)+2))
#Buttons
self.ui.search_sign_btn.clicked.connect(self.displaySign)
#Speech Worker
self.speak_seq=''
self.speech_worker=SpeechWorker(self.speak_seq)
self.speech_seq_signal.connect(self.speech_worker.get_sequnece)
#Threading Stuffs
self.video_worker=VideoWorker(self)
self.video_worker.image_signals.connect(self.show_pixmap)
self.video_worker.pred_text_signal.connect(self.update_Texts)
self.video_worker.start()
def show_pixmap(self,image:list):
frame,thresh =image
w_f,h_f=self.ui.video_label.width(),self.ui.video_label.height()
w_f,h_f=w_f-200,h_f-100
frame=cv2.resize(frame,(w_f,h_f),cv2.INTER_AREA)
frame_img=q2a.array2qimage(frame)
frame_img = frame_img.rgbSwapped()
self.ui.video_label.setPixmap(QPixmap.fromImage(frame_img))
w_t,h_t=self.ui.thresh_video_label.width(),self.ui.thresh_video_label.height()
w_t,h_t=w_t-100,h_t-100
thresh=cv2.resize(thresh,(w_t,h_t),cv2.INTER_AREA)
thresh_img=q2a.array2qimage(thresh)
thresh_img = thresh_img.rgbSwapped()
self.ui.thresh_video_label.setPixmap(QPixmap.fromImage(thresh_img))
def update_Texts(self,letter,sequence):
self.speak_seq=sequence
self.ui.current_letter_label.setText(letter)
self.ui.outTextEdit.clear()
self.ui.outTextEdit.append(sequence)
def displaySign(self):
selectedSign=self.ui.search_drop_comboBox.currentText()
signPath=os.path.join(constants.signImagePath,f'{selectedSign}.png')
if selectedSign in self.others:
signPath=os.path.join(constants.othersPath,f'{selectedSign}.png')
pixmap=QPixmap(signPath)
self.ui.sign_image_label.setPixmap(pixmap)
self.ui.sign_image_label.setScaledContents(True)
def show_about(self):
message="Developed By:\n Kanchan Sapkota\nSys ID:2017009931\nRoll No:170101113\nB.Tech CSE VII'A'"
QMessageBox.about(self,"About",message)
def start_speak_thread(self):
self.speech_worker.start()
print(self.speak_seq)
self.speech_seq_signal.emit(self.speak_seq)
class VideoWorker(QThread):
image_signals=pyqtSignal(list)
pred_text_signal=pyqtSignal(str,str)
def __init__(self,parent=None):
QThread.__init__(self,parent)
self.running=False
def run(self):
self.model=load_model(constants.modelPath)
self.is_predict_roi=True
cap=cv2.VideoCapture(0)
sequence=constants.start_sequence
pred_text=''
pred_letter=''
del_count=0
prev_pred=None
consecutive_goal=constants.consecutive_goal
consecutive_count=0
while True:
ret,frame=cap.read()
if ret:
frame=cv2.flip(frame,1)
y,x,_=frame.shape
x1,y1=(x//2+50,0)
x2,y2=(x,y//2+50)
cv2.rectangle(frame, (x1,y1), (x2,y2), (0,255,0), 2)
crop_img = frame[y1:y2, x1:x2]
blur = cv2.GaussianBlur(crop_img,(7,7),0)
grey = cv2.cvtColor(blur, cv2.COLOR_BGR2GRAY)
kernel = np.ones((5,5))
dilation = cv2.dilate(grey,kernel,iterations=1)
erosion = cv2.erode(dilation,kernel,iterations=1)
blur1 = cv2.GaussianBlur(erosion,(5,5),0)
thresh = cv2.threshold(blur1,0,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)[1]
if self.is_predict_roi:
img = cv2.resize(thresh, (50,50))
img = img.reshape(1,50,50,1)
img = img/255.0
prd = self.model.predict(img)
index = prd.argmax()
pred_text=constants.gestures[index]
pred_letter=pred_text
if prev_pred==pred_text:
consecutive_count+=1
else:
consecutive_count=0
if pred_text=='BG':
pred_text=''
if pred_text=="SPACE":
del_count+=1
pred_text=""
if del_count>=consecutive_goal:
sequence+=" "
del_count=0
if pred_text=="DEL":
del_count+=1
pred_text=''
if del_count>consecutive_goal:
sequence=sequence[:-1]
del_count=0
if consecutive_count>consecutive_goal:
sequence+=pred_text
consecutive_count=0
images=[frame,thresh]
self.image_signals.emit(images)
self.pred_text_signal.emit(pred_letter,sequence)
prev_pred=pred_text
class SpeechWorker(QThread):
def __init__(self,sequence,parent=None):
QThread.__init__(self,parent)
self.sequence=''
self.running=False
def run(self):
engine=pyttsx3.init()
engine.setProperty('rate',constants.voiceSpeed)
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[constants.voiceId].id)
engine.say(self.sequence)
engine.runAndWait()
@pyqtSlot(str)
def get_sequnece(self,sequence):
self.sequence=sequence
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())
| {"hexsha": "18c9f17a944e54d17469e37b66afcd4e3e2d2eaa", "size": 7426, "ext": "py", "lang": "Python", "max_stars_repo_path": "app.py", "max_stars_repo_name": "kanchansapkota27/Sign-Language-Translator", "max_stars_repo_head_hexsha": "2e63032d6a42042d8caecfc628de5abc647ab234", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2020-11-28T04:34:49.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-28T04:34:49.000Z", "max_issues_repo_path": "app.py", "max_issues_repo_name": "kanchansapkota27/Sign-Language-Translator", "max_issues_repo_head_hexsha": "2e63032d6a42042d8caecfc628de5abc647ab234", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app.py", "max_forks_repo_name": "kanchansapkota27/Sign-Language-Translator", "max_forks_repo_head_hexsha": "2e63032d6a42042d8caecfc628de5abc647ab234", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 36.7623762376, "max_line_length": 108, "alphanum_fraction": 0.6001885268, "include": true, "reason": "import numpy", "num_tokens": 1626} |
#!/usr/bin/env python
import math
import sys
import os
import random
import struct
import popen2
import getopt
import numpy
pi=math.pi
e=math.e
j=complex(0,1)
doreal=0
datatype = os.environ.get('DATATYPE','float')
util = '../tools/fft_' + datatype
minsnr=90
if datatype == 'double':
fmt='d'
elif datatype=='int16_t':
fmt='h'
minsnr=10
elif datatype=='int32_t':
fmt='i'
elif datatype=='simd':
fmt='4f'
sys.stderr.write('testkiss.py does not yet test simd')
sys.exit(0)
elif datatype=='float':
fmt='f'
else:
sys.stderr.write('unrecognized datatype %s\n' % datatype)
sys.exit(1)
def dopack(x,cpx=1):
x = numpy.reshape( x, ( numpy.size(x),) )
if cpx:
s = ''.join( [ struct.pack(fmt*2,c.real,c.imag) for c in x ] )
else:
s = ''.join( [ struct.pack(fmt,c.real) for c in x ] )
return s
def dounpack(x,cpx):
uf = fmt * ( len(x) / struct.calcsize(fmt) )
s = struct.unpack(uf,x)
if cpx:
return numpy.array(s[::2]) + numpy.array( s[1::2] )*j
else:
return numpy.array(s )
def make_random(dims=[1]):
res = []
for i in range(dims[0]):
if len(dims)==1:
r=random.uniform(-1,1)
if doreal:
res.append( r )
else:
i=random.uniform(-1,1)
res.append( complex(r,i) )
else:
res.append( make_random( dims[1:] ) )
return numpy.array(res)
def flatten(x):
ntotal = numpy.size(x)
return numpy.reshape(x,(ntotal,))
def randmat( ndims ):
dims=[]
for i in range( ndims ):
curdim = int( random.uniform(2,5) )
if doreal and i==(ndims-1):
curdim = int(curdim/2)*2 # force even last dimension if real
dims.append( curdim )
return make_random(dims )
def test_fft(ndims):
x=randmat( ndims )
if doreal:
xver = numpy.fft.rfftn(x)
else:
xver = numpy.fft.fftn(x)
open('/tmp/fftexp.dat','w').write(dopack( flatten(xver) , True ) )
x2=dofft(x,doreal)
err = xver - x2
errf = flatten(err)
xverf = flatten(xver)
errpow = numpy.vdot(errf,errf)+1e-10
sigpow = numpy.vdot(xverf,xverf)+1e-10
snr = 10*math.log10(abs(sigpow/errpow) )
print 'SNR (compared to NumPy) : %.1fdB' % float(snr)
if snr<minsnr:
print 'xver=',xver
print 'x2=',x2
print 'err',err
sys.exit(1)
def dofft(x,isreal):
dims=list( numpy.shape(x) )
x = flatten(x)
scale=1
if datatype=='int16_t':
x = 32767 * x
scale = len(x) / 32767.0
elif datatype=='int32_t':
x = 2147483647.0 * x
scale = len(x) / 2147483647.0
cmd='%s -n ' % util
cmd += ','.join([str(d) for d in dims])
if doreal:
cmd += ' -R '
print cmd
p = popen2.Popen3(cmd )
open('/tmp/fftin.dat','w').write(dopack( x , isreal==False ) )
p.tochild.write( dopack( x , isreal==False ) )
p.tochild.close()
res = dounpack( p.fromchild.read() , 1 )
open('/tmp/fftout.dat','w').write(dopack( flatten(res) , True ) )
if doreal:
dims[-1] = int( dims[-1]/2 ) + 1
res = scale * res
p.wait()
return numpy.reshape(res,dims)
def main():
opts,args = getopt.getopt(sys.argv[1:],'r')
opts=dict(opts)
global doreal
doreal = opts.has_key('-r')
if doreal:
print 'Testing multi-dimensional real FFTs'
else:
print 'Testing multi-dimensional FFTs'
for dim in range(1,4):
test_fft( dim )
if __name__ == "__main__":
main()
| {"hexsha": "e161a42b3067bd33f81964ca4120c851df447067", "size": 3565, "ext": "py", "lang": "Python", "max_stars_repo_path": "KissFFT/kiss_fft130/test/testkiss.py", "max_stars_repo_name": "mpoullet/audio-tools", "max_stars_repo_head_hexsha": "b7cb54ec16f2845830ab6168d8e6992124c98a75", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "KissFFT/kiss_fft130/test/testkiss.py", "max_issues_repo_name": "mpoullet/audio-tools", "max_issues_repo_head_hexsha": "b7cb54ec16f2845830ab6168d8e6992124c98a75", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "KissFFT/kiss_fft130/test/testkiss.py", "max_forks_repo_name": "mpoullet/audio-tools", "max_forks_repo_head_hexsha": "b7cb54ec16f2845830ab6168d8e6992124c98a75", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.8711656442, "max_line_length": 72, "alphanum_fraction": 0.5612903226, "include": true, "reason": "import numpy", "num_tokens": 1110} |
FUNCTION TRAPZ2(X,Y,N,X1,X2,IERR)
c Finds area below y(x) from x=X1 to x =X2
c X1 and X2 are not necessarily values of x(i)
c but must fulfill X1>=x(1) and X2<=x(n)
c Array declaration
real x(n),y(n)
data jerr1,jerr2/2*0/
TRAPZ2=0.
ierr=0.
! Check for values outside valid range
if (x1 < x(1)) then
if (jerr1.eq.0) then
write (6,*) 'TRAPZ2: X1 outside valid range:',x1,x(1),x(n),n
jerr1=1
endif
ierr=1
return
! stop
elseif (x1 == x(1)) then
i1 = 1
else
! Find first element in array X above X1
do i=1,n
if (x(i) > x1) then
i1=i
! Find by interpolation values of Y1=y(X1)
Y1 = ( (x(i1)-x1)*y(i1-1) + (x1-x(i1-1))*y(i1) ) / (x(i1)-x(i1-1))
! Add area from x(i1-1) to X1
trapz2=trapz2+(x(i1)-x1)*(Y1+y(i1))/2.
goto 1
endif
enddo
endif
1 if (x2 > x(n)) then
if (jerr2.eq.0) then
write (6,*) 'TRAPZ2: X2 outside valid range:',x2,x(1),x(n),n
jerr2=1
endif
ierr=2
return
! stop
elseif (x2 == x(n)) then
i2 = n
else
! Find last element in array X below X2
do i=i1,n
if (x(i) > x2) then
i2=i-1
! Find by interpolation values of Y2=y(X2)
Y2 = ( (x(i2+1)-x2)*y(i2) + (x2-x(i2))*y(i2+1) ) / (x(i2+1)-x(i2))
! Add area from x(i2) to X2
trapz2=trapz2+(x2-x(i2))*(Y2+y(i2))/2.
goto 2
endif
enddo
endif
! Compute area from x(i1) to x(i2)
2 do i=i1+1,i2
trapz2=trapz2+(x(i)-x(i-1))*(y(i)+y(i-1))/2.
enddo
! write (6,*) 'TRAPZ2: using = ',i1+1,i2,x(i1),x(i2),i2-i1,' points'
return
end
| {"hexsha": "37962eba3f3af0876aeea409928ba29420c436e6", "size": 1474, "ext": "f", "lang": "FORTRAN", "max_stars_repo_path": "bc03/src/trapz2.f", "max_stars_repo_name": "jchavesmontero/galaxpy", "max_stars_repo_head_hexsha": "ef5eaffa8f5ec0418dae44b88cf212ca03814b57", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2019-10-29T02:26:52.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-15T22:22:35.000Z", "max_issues_repo_path": "bc03/src/trapz2.f", "max_issues_repo_name": "jchavesmontero/galaxpy", "max_issues_repo_head_hexsha": "ef5eaffa8f5ec0418dae44b88cf212ca03814b57", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "bc03/src/trapz2.f", "max_forks_repo_name": "jchavesmontero/galaxpy", "max_forks_repo_head_hexsha": "ef5eaffa8f5ec0418dae44b88cf212ca03814b57", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 21.3623188406, "max_line_length": 69, "alphanum_fraction": 0.5868385346, "num_tokens": 693} |
import numpy as np
import sys
from detector_hit_conditions import *
def get_acceptance_from_four_vectors(ma, ctau, four_vector_list, zmin, zmax, det_rad, Ethr=1.):
evt_fraction_detected = []
for pa, pr in four_vector_list:
if pa[3] < 0:
continue
gct = (pa[3]/ma)*ctau
np.seterr(over='raise')
try:
xi_high = np.exp(-zmin/gct)
xi_low = np.exp(-zmax/gct)
except:
print "zmin, zmax, gct = ", zmin, zmax, gct
sys.exit(0)
f = 0.
fs = []
if xi_high > 0.:
xis = np.linspace(xi_low,xi_high,num=100.)
xvs = xv_from_uni(xis,zmax,gct)
coef = (xi_high-xi_low)/len(xis)
#fs.append(coef*np.sum(det_hit_condition(pa, pr, det_rad, zmax, xvs, Ethr).astype('float')))
#f = max(fs)
f = coef*np.sum(det_hit_condition(pa, pr, det_rad, zmax, xvs, Ethr).astype('float'))
evt_fraction_detected.append(f)
evt_fraction_detected = np.array(evt_fraction_detected)
return np.sum(evt_fraction_detected)/len(evt_fraction_detected)
| {"hexsha": "f02d5cc6867ba5d28c985c814a082f978504e26a", "size": 1167, "ext": "py", "lang": "Python", "max_stars_repo_path": "dev/mathematica/get_ldmx_acceptance_to_share/compute_acceptance_LDMX.py", "max_stars_repo_name": "jmlazaro25/vissig", "max_stars_repo_head_hexsha": "370262b0546959bd2936cfd1ffa16de5b85a3dee", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "dev/mathematica/get_ldmx_acceptance_to_share/compute_acceptance_LDMX.py", "max_issues_repo_name": "jmlazaro25/vissig", "max_issues_repo_head_hexsha": "370262b0546959bd2936cfd1ffa16de5b85a3dee", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dev/mathematica/get_ldmx_acceptance_to_share/compute_acceptance_LDMX.py", "max_forks_repo_name": "jmlazaro25/vissig", "max_forks_repo_head_hexsha": "370262b0546959bd2936cfd1ffa16de5b85a3dee", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.175, "max_line_length": 104, "alphanum_fraction": 0.5681233933, "include": true, "reason": "import numpy", "num_tokens": 323} |
import numpy as np
import scipy as sp
import properties
from ....utils.code_utils import deprecate_class
from ....utils import mkvc, sdiag, Zero
from ....data import Data
from ...base import BaseEMSimulation
from .boundary_utils import getxBCyBC_CC
from .survey import Survey
from .fields import Fields3DCellCentered, Fields3DNodal
from .utils import _mini_pole_pole
class BaseDCSimulation(BaseEMSimulation):
"""
Base DC Problem
"""
survey = properties.Instance("a DC survey object", Survey, required=True)
storeJ = properties.Bool("store the sensitivity matrix?", default=False)
_mini_survey = None
Ainv = None
_Jmatrix = None
gtgdiag = None
def __init__(self, *args, **kwargs):
miniaturize = kwargs.pop("miniaturize", False)
super().__init__(*args, **kwargs)
# Do stuff to simplify the forward and JTvec operation if number of dipole
# sources is greater than the number of unique pole sources
if miniaturize:
self._dipoles, self._invs, self._mini_survey = _mini_pole_pole(self.survey)
def fields(self, m=None, calcJ=True):
if m is not None:
self.model = m
self._Jmatrix = None
f = self.fieldsPair(self)
if self.Ainv is not None:
self.Ainv.clean()
A = self.getA()
self.Ainv = self.solver(A, **self.solver_opts)
RHS = self.getRHS()
f[:, self._solutionType] = self.Ainv * RHS
return f
def getJ(self, m, f=None):
if self._Jmatrix is None:
if f is None:
f = self.fields(m)
self._Jmatrix = self._Jtvec(m, v=None, f=f).T
return self._Jmatrix
def dpred(self, m=None, f=None):
if self._mini_survey is not None:
# Temporarily set self.survey to self._mini_survey
survey = self.survey
self.survey = self._mini_survey
data = super().dpred(m=m, f=f)
if self._mini_survey is not None:
# reset survey
self.survey = survey
return self._mini_survey_data(data)
def getJtJdiag(self, m, W=None):
"""
Return the diagonal of JtJ
"""
if self.gtgdiag is None:
J = self.getJ(m)
if W is None:
W = np.ones(J.shape[0])
else:
W = W.diagonal() ** 2
diag = np.zeros(J.shape[1])
for i in range(J.shape[0]):
diag += (W[i]) * (J[i] * J[i])
self.gtgdiag = diag
return self.gtgdiag
def Jvec(self, m, v, f=None):
"""
Compute sensitivity matrix (J) and vector (v) product.
"""
if f is None:
f = self.fields(m)
if self.storeJ:
J = self.getJ(m, f=f)
return J.dot(v)
self.model = m
if self._mini_survey is not None:
survey = self._mini_survey
else:
survey = self.survey
Jv = []
for source in survey.source_list:
u_source = f[source, self._solutionType] # solution vector
dA_dm_v = self.getADeriv(u_source, v)
dRHS_dm_v = self.getRHSDeriv(source, v)
du_dm_v = self.Ainv * (-dA_dm_v + dRHS_dm_v)
for rx in source.receiver_list:
df_dmFun = getattr(f, "_{0!s}Deriv".format(rx.projField), None)
df_dm_v = df_dmFun(source, du_dm_v, v, adjoint=False)
Jv.append(rx.evalDeriv(source, self.mesh, f, df_dm_v))
Jv = np.hstack(Jv)
return self._mini_survey_data(Jv)
def Jtvec(self, m, v, f=None):
"""
Compute adjoint sensitivity matrix (J^T) and vector (v) product.
"""
if f is None:
f = self.fields(m)
self.model = m
if self.storeJ:
J = self.getJ(m, f=f)
return np.asarray(J.T.dot(v))
return self._Jtvec(m, v=v, f=f)
def _Jtvec(self, m, v=None, f=None):
"""
Compute adjoint sensitivity matrix (J^T) and vector (v) product.
Full J matrix can be computed by inputing v=None
"""
if self._mini_survey is not None:
survey = self._mini_survey
else:
survey = self.survey
if v is not None:
if isinstance(v, Data):
v = v.dobs
v = self._mini_survey_dataT(v)
v = Data(survey, v)
Jtv = np.zeros(m.size)
else:
# This is for forming full sensitivity matrix
Jtv = np.zeros((self.model.size, survey.nD), order="F")
istrt = int(0)
iend = int(0)
for source in survey.source_list:
u_source = f[source, self._solutionType].copy()
for rx in source.receiver_list:
# wrt f, need possibility wrt m
if v is not None:
PTv = rx.evalDeriv(
source, self.mesh, f, v[source, rx], adjoint=True
)
else:
# This is for forming full sensitivity matrix
PTv = rx.getP(self.mesh, rx.projGLoc(f)).toarray().T
df_duTFun = getattr(f, "_{0!s}Deriv".format(rx.projField), None)
df_duT, df_dmT = df_duTFun(source, None, PTv, adjoint=True)
ATinvdf_duT = self.Ainv * df_duT
dA_dmT = self.getADeriv(u_source, ATinvdf_duT, adjoint=True)
dRHS_dmT = self.getRHSDeriv(source, ATinvdf_duT, adjoint=True)
du_dmT = -dA_dmT + dRHS_dmT
if v is not None:
Jtv += (df_dmT + du_dmT).astype(float)
else:
iend = istrt + rx.nD
if rx.nD == 1:
Jtv[:, istrt] = df_dmT + du_dmT
else:
Jtv[:, istrt:iend] = df_dmT + du_dmT
istrt += rx.nD
if v is not None:
return mkvc(Jtv)
else:
return (self._mini_survey_data(Jtv.T)).T
def getSourceTerm(self):
"""
Evaluates the sources, and puts them in matrix form
:rtype: tuple
:return: q (nC or nN, nSrc)
"""
if self._mini_survey is not None:
Srcs = self._mini_survey.source_list
else:
Srcs = self.survey.source_list
if self._formulation == "EB":
n = self.mesh.nN
# return NotImplementedError
elif self._formulation == "HJ":
n = self.mesh.nC
q = np.zeros((n, len(Srcs)), order="F")
for i, source in enumerate(Srcs):
q[:, i] = source.eval(self)
return q
@property
def deleteTheseOnModelUpdate(self):
toDelete = super(BaseDCSimulation, self).deleteTheseOnModelUpdate
if self._Jmatrix is not None:
toDelete += ["_Jmatrix"]
if self.gtgdiag is not None:
toDelete += ["gtgdiag"]
return toDelete
def _mini_survey_data(self, d_mini):
if self._mini_survey is not None:
out = d_mini[self._invs[0]] # AM
out[self._dipoles[0]] -= d_mini[self._invs[1]] # AN
out[self._dipoles[1]] -= d_mini[self._invs[2]] # BM
out[self._dipoles[0] & self._dipoles[1]] += d_mini[self._invs[3]] # BN
else:
out = d_mini
return out
def _mini_survey_dataT(self, v):
if self._mini_survey is not None:
out = np.zeros(self._mini_survey.nD)
# Need to use ufunc.at because there could be repeated indices
# That need to be properly handled.
np.add.at(out, self._invs[0], v) # AM
np.subtract.at(out, self._invs[1], v[self._dipoles[0]]) # AN
np.subtract.at(out, self._invs[2], v[self._dipoles[1]]) # BM
np.add.at(out, self._invs[3], v[self._dipoles[0] & self._dipoles[1]]) # BN
return out
else:
out = v
return out
class Simulation3DCellCentered(BaseDCSimulation):
"""
3D cell centered DC problem
"""
_solutionType = "phiSolution"
_formulation = "HJ" # CC potentials means J is on faces
fieldsPair = Fields3DCellCentered
bc_type = "Dirichlet"
def __init__(self, mesh, **kwargs):
BaseDCSimulation.__init__(self, mesh, **kwargs)
self.setBC()
def getA(self):
"""
Make the A matrix for the cell centered DC resistivity problem
A = D MfRhoI G
"""
D = self.Div
G = self.Grad
MfRhoI = self.MfRhoI
A = D @ MfRhoI @ G
if self.bc_type == "Neumann":
if self.verbose:
print("Perturbing first row of A to remove nullspace for Neumann BC.")
# Handling Null space of A
I, J, V = sp.sparse.find(A[0, :])
for jj in J:
A[0, jj] = 0.0
A[0, 0] = 1.0
return A
def getADeriv(self, u, v, adjoint=False):
D = self.Div
G = self.Grad
MfRhoIDeriv = self.MfRhoIDeriv
if adjoint:
return MfRhoIDeriv(G @ u, D.T @ v, adjoint)
return D * (MfRhoIDeriv(G @ u, v, adjoint))
def getRHS(self):
"""
RHS for the DC problem
q
"""
RHS = self.getSourceTerm()
return RHS
def getRHSDeriv(self, source, v, adjoint=False):
"""
Derivative of the right hand side with respect to the model
"""
# TODO: add qDeriv for RHS depending on m
# qDeriv = source.evalDeriv(self, adjoint=adjoint)
# return qDeriv
return Zero()
def setBC(self):
if self.bc_type == "Dirichlet":
if self.verbose:
print(
"Homogeneous Dirichlet is the natural BC for this CC discretization."
)
self.Div = sdiag(self.mesh.vol) @ self.mesh.faceDiv
self.Grad = self.Div.T
else:
if self.mesh._meshType == "TREE" and self.bc_type == "Neumann":
raise NotImplementedError()
if self.mesh.dim == 3:
fxm, fxp, fym, fyp, fzm, fzp = self.mesh.faceBoundaryInd
gBFxm = self.mesh.gridFx[fxm, :]
gBFxp = self.mesh.gridFx[fxp, :]
gBFym = self.mesh.gridFy[fym, :]
gBFyp = self.mesh.gridFy[fyp, :]
gBFzm = self.mesh.gridFz[fzm, :]
gBFzp = self.mesh.gridFz[fzp, :]
# Setup Mixed B.C (alpha, beta, gamma)
temp_xm = np.ones_like(gBFxm[:, 0])
temp_xp = np.ones_like(gBFxp[:, 0])
temp_ym = np.ones_like(gBFym[:, 1])
temp_yp = np.ones_like(gBFyp[:, 1])
temp_zm = np.ones_like(gBFzm[:, 2])
temp_zp = np.ones_like(gBFzp[:, 2])
if self.bc_type == "Neumann":
if self.verbose:
print("Setting BC to Neumann.")
alpha_xm, alpha_xp = temp_xm * 0.0, temp_xp * 0.0
alpha_ym, alpha_yp = temp_ym * 0.0, temp_yp * 0.0
alpha_zm, alpha_zp = temp_zm * 0.0, temp_zp * 0.0
beta_xm, beta_xp = temp_xm, temp_xp
beta_ym, beta_yp = temp_ym, temp_yp
beta_zm, beta_zp = temp_zm, temp_zp
gamma_xm, gamma_xp = temp_xm * 0.0, temp_xp * 0.0
gamma_ym, gamma_yp = temp_ym * 0.0, temp_yp * 0.0
gamma_zm, gamma_zp = temp_zm * 0.0, temp_zp * 0.0
elif self.bc_type == "Dirichlet":
if self.verbose:
print("Setting BC to Dirichlet.")
alpha_xm, alpha_xp = temp_xm, temp_xp
alpha_ym, alpha_yp = temp_ym, temp_yp
alpha_zm, alpha_zp = temp_zm, temp_zp
beta_xm, beta_xp = temp_xm * 0, temp_xp * 0
beta_ym, beta_yp = temp_ym * 0, temp_yp * 0
beta_zm, beta_zp = temp_zm * 0, temp_zp * 0
gamma_xm, gamma_xp = temp_xm * 0.0, temp_xp * 0.0
gamma_ym, gamma_yp = temp_ym * 0.0, temp_yp * 0.0
gamma_zm, gamma_zp = temp_zm * 0.0, temp_zp * 0.0
elif self.bc_type == "Mixed":
# Ztop: Neumann
# Others: Mixed: alpha * phi + d phi dn = 0
# where alpha = 1 / r * dr/dn
# (Dey and Morrison, 1979)
# This assumes that the source is located at
# (x_center, y_center_y, ztop)
# TODO: Implement Zhang et al. (1995)
xs = np.median(self.mesh.vectorCCx)
ys = np.median(self.mesh.vectorCCy)
zs = self.mesh.vectorCCz[-1]
def r_boundary(x, y, z):
return 1.0 / np.sqrt(
(x - xs) ** 2 + (y - ys) ** 2 + (z - zs) ** 2
)
rxm = r_boundary(gBFxm[:, 0], gBFxm[:, 1], gBFxm[:, 2])
rxp = r_boundary(gBFxp[:, 0], gBFxp[:, 1], gBFxp[:, 2])
rym = r_boundary(gBFym[:, 0], gBFym[:, 1], gBFym[:, 2])
ryp = r_boundary(gBFyp[:, 0], gBFyp[:, 1], gBFyp[:, 2])
rzm = r_boundary(gBFzm[:, 0], gBFzm[:, 1], gBFzm[:, 2])
alpha_xm = (gBFxm[:, 0] - xs) / rxm ** 2
alpha_xp = (gBFxp[:, 0] - xs) / rxp ** 2
alpha_ym = (gBFym[:, 1] - ys) / rym ** 2
alpha_yp = (gBFyp[:, 1] - ys) / ryp ** 2
alpha_zm = (gBFzm[:, 2] - zs) / rzm ** 2
alpha_zp = temp_zp.copy() * 0.0
beta_xm, beta_xp = temp_xm * 1, temp_xp * 1
beta_ym, beta_yp = temp_ym * 1, temp_yp * 1
beta_zm, beta_zp = temp_zm * 1, temp_zp * 1
gamma_xm, gamma_xp = temp_xm * 0.0, temp_xp * 0.0
gamma_ym, gamma_yp = temp_ym * 0.0, temp_yp * 0.0
gamma_zm, gamma_zp = temp_zm * 0.0, temp_zp * 0.0
alpha = [alpha_xm, alpha_xp, alpha_ym, alpha_yp, alpha_zm, alpha_zp]
beta = [beta_xm, beta_xp, beta_ym, beta_yp, beta_zm, beta_zp]
gamma = [gamma_xm, gamma_xp, gamma_ym, gamma_yp, gamma_zm, gamma_zp]
elif self.mesh.dim == 2:
fxm, fxp, fym, fyp = self.mesh.faceBoundaryInd
gBFxm = self.mesh.gridFx[fxm, :]
gBFxp = self.mesh.gridFx[fxp, :]
gBFym = self.mesh.gridFy[fym, :]
gBFyp = self.mesh.gridFy[fyp, :]
# Setup Mixed B.C (alpha, beta, gamma)
temp_xm = np.ones_like(gBFxm[:, 0])
temp_xp = np.ones_like(gBFxp[:, 0])
temp_ym = np.ones_like(gBFym[:, 1])
temp_yp = np.ones_like(gBFyp[:, 1])
alpha_xm, alpha_xp = temp_xm * 0.0, temp_xp * 0.0
alpha_ym, alpha_yp = temp_ym * 0.0, temp_yp * 0.0
beta_xm, beta_xp = temp_xm, temp_xp
beta_ym, beta_yp = temp_ym, temp_yp
gamma_xm, gamma_xp = temp_xm * 0.0, temp_xp * 0.0
gamma_ym, gamma_yp = temp_ym * 0.0, temp_yp * 0.0
alpha = [alpha_xm, alpha_xp, alpha_ym, alpha_yp]
beta = [beta_xm, beta_xp, beta_ym, beta_yp]
gamma = [gamma_xm, gamma_xp, gamma_ym, gamma_yp]
x_BC, y_BC = getxBCyBC_CC(self.mesh, alpha, beta, gamma)
V = self.Vol
self.Div = V * self.mesh.faceDiv
P_BC, B = self.mesh.getBCProjWF_simple()
M = B * self.mesh.aveCC2F
self.Grad = self.Div.T - P_BC * sdiag(y_BC) * M
class Simulation3DNodal(BaseDCSimulation):
"""
3D nodal DC problem
"""
_solutionType = "phiSolution"
_formulation = "EB" # N potentials means B is on faces
fieldsPair = Fields3DNodal
def __init__(self, mesh, **kwargs):
BaseDCSimulation.__init__(self, mesh, **kwargs)
# Not sure why I need to do this
# To evaluate mesh.aveE2CC, this is required....
if mesh._meshType == "TREE":
mesh.nodalGrad
def getA(self):
"""
Make the A matrix for the cell centered DC resistivity problem
A = G.T MeSigma G
"""
MeSigma = self.MeSigma
Grad = self.mesh.nodalGrad
A = Grad.T @ MeSigma @ Grad
# Handling Null space of A
I, J, V = sp.sparse.find(A[0, :])
for jj in J:
A[0, jj] = 0.0
A[0, 0] = 1.0
return A
def getADeriv(self, u, v, adjoint=False):
"""
Product of the derivative of our system matrix with respect to the
model and a vector
"""
Grad = self.mesh.nodalGrad
if not adjoint:
return Grad.T @ self.MeSigmaDeriv(Grad @ u, v, adjoint)
elif adjoint:
return self.MeSigmaDeriv(Grad @ u, Grad @ v, adjoint)
def getRHS(self):
"""
RHS for the DC problem
q
"""
RHS = self.getSourceTerm()
return RHS
def getRHSDeriv(self, source, v, adjoint=False):
"""
Derivative of the right hand side with respect to the model
"""
# TODO: add qDeriv for RHS depending on m
# qDeriv = source.evalDeriv(self, adjoint=adjoint)
# return qDeriv
return Zero()
Simulation3DCellCentred = Simulation3DCellCentered # UK and US!
############
# Deprecated
############
@deprecate_class(removal_version="0.15.0")
class Problem3D_N(Simulation3DNodal):
pass
@deprecate_class(removal_version="0.15.0")
class Problem3D_CC(Simulation3DCellCentered):
pass
| {"hexsha": "ac40a782639b1fe138e609a23531840da8ef2ada", "size": 18048, "ext": "py", "lang": "Python", "max_stars_repo_path": "SimPEG/electromagnetics/static/resistivity/simulation.py", "max_stars_repo_name": "jcapriot/simpeg", "max_stars_repo_head_hexsha": "e88e653673c6b818592b6c075f76ee9215fe82b7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-08-07T13:50:54.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-07T13:50:54.000Z", "max_issues_repo_path": "SimPEG/electromagnetics/static/resistivity/simulation.py", "max_issues_repo_name": "jcapriot/simpeg", "max_issues_repo_head_hexsha": "e88e653673c6b818592b6c075f76ee9215fe82b7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "SimPEG/electromagnetics/static/resistivity/simulation.py", "max_forks_repo_name": "jcapriot/simpeg", "max_forks_repo_head_hexsha": "e88e653673c6b818592b6c075f76ee9215fe82b7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-01-05T18:16:54.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-05T18:16:54.000Z", "avg_line_length": 33.1764705882, "max_line_length": 89, "alphanum_fraction": 0.515347961, "include": true, "reason": "import numpy,import scipy", "num_tokens": 5053} |
\documentclass[runningheads]{llncs}
%
\usepackage{graphicx}
% Used for displaying a sample figure. If possible, figure files should
% be included in EPS format.
\graphicspath{ {../plots/} }
\usepackage{calc}
% state diagrams
\usepackage{tikz}
\usetikzlibrary{automata, arrows, positioning}
\tikzset{
initial text={},
->, % makes the edges directed
every state/.style={rectangle, thick, text width=5em, align=center, scale=1} % sets the properties for each ’state’ node
}
% tables
\usepackage{multirow}
\usepackage{hyperref}
% If you use the hyperref package, please uncomment the following line
% to display URLs in blue roman font according to Springer's eBook style:
\renewcommand\UrlFont{\color{blue}\rmfamily}
% references
\usepackage[numbers,sort]{natbib}
% quotation
\usepackage{dirtytalk}
\begin{document}
%
\title{Localised Reputation in the Prisoner's Dilemma}
%Spatial Prisoner’s Dilemma: \\
%Keep your enemies closer and be loud about it}
%
%\titlerunning{Abbreviated paper title}
% If the paper title is too long for the running head, you can set
% an abbreviated paper title here
%
\author{
Martin Toman \and
Neil Yorke-Smith\orcidID{0000-0002-1814-3515}\\\email{[email protected]}
}
%
\authorrunning{M. Toman, N. Yorke-Smith}
% First names are abbreviated in the running head.
% If there are more than two authors, 'et al.' is used.
%
\institute{Delft University of Technology, The Netherlands}
%
\maketitle % typeset the header of the contribution
%
%
%
\begin{abstract}
Under what conditions can cooperation emerge and be sustained?
Previous studies abstract cooperation and defection using the spatial Prisoner's Dilemma (PD) game.
%We build a computer simulation of a multi-agent spatial environment using Prisoner's Dilemma as the principal agent interaction.
We study a local reputation mechanism in which agents can remember defectors, abstain from interacting with them, and warn nearby agents.
%---local reputation of each agent is created.
Simulations find that local reputation is effective in sustaining cooperation and punishing defection.
Further, we find that the size of agent memory and amount of gossip are not significant factors, provided the locality range of gossip is greater than the agent movement speed.
%
%\keywords{First keyword \and Second keyword \and Another keyword.}
\end{abstract}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Motivation and Experimental Design}
%\section{Related Work \& Motivation}
Reputation systems strongly boost cooperation in spatial exchange games such as spatial PD \cite{simple-reputation, dong-reputation}.
Similarly, allowing game participants to pass information, either directly \cite{cooperation-communication} or indirectly \cite{public-private-monitoring}, increases the rate of cooperation.
We aim to explore the limits of local reputation---built up via gossip---in promoting and sustaining cooperation.
% in Spatial Prisoner’s Dilemma and under what parameters does it yield optimal results.
%
%
%
%\section{Methodology}
%We build a computer simulation \cite{smaldino} in Python using the Mesa\footnote{\url{https://github.com/projectmesa/mesa}} framework; the complete source is available online (\url{https://github.com/tinybeachthor/IPD}).
%
Agent's behaviour is defined by the finite state diagram shown in Figure~\ref{fig:agent_behaviour}.
We expand over prior work \cite{smaldino} %the model
by giving agents a (limited size) memory to keep track of defectors and to allow them to share this information by gossiping with other agents in a certain range.
\begin{figure}[tb]
\centering
\begin{tikzpicture}
[align=center, node distance=3cm, on grid]
\node[state, initial] (find_opponent) {Find Opponent?};
\node[state, below= 1.5cm of find_opponent] (play) {Play PD Game};
\node[state, right of=play] (reproduce) {Attempt to Reproduce};
\node[state, right of=find_opponent] (move) {Attempt Movement};
\node[state, right of=move] (cost) {Pay Cost of Living};
\node[state, below= 1.5cm of cost] (energy) {Energy $\le 0$?};
\node[state, accepting, right of=energy] (die) {Die};
\node[state, accepting, above= 1.5cm of die] (end) {End Turn};
\draw
(find_opponent) edge[left] node{Yes} (play)
(find_opponent) edge[above] node{No} (move)
(play) edge[] node{} (reproduce)
(reproduce) edge[] node{} (cost)
(move) edge[] node{} (cost)
(cost) edge[] node{} (energy)
(energy) edge[below] node{No} (end)
(energy) edge[below] node{Yes} (die)
;
\end{tikzpicture}
\caption{Agent behaviour diagram: showing the decision flow of an agent's single turn}
\label{fig:agent_behaviour}
\end{figure}
%When running the simulation, we observe the saturation of cooperator and defector populations; we also record characteristic patterns \cite{spatial-patterns} formed by the populations as influenced by different parameters.
%These patterns are very similar to patterns occurring in nature, which are often created by reaction--diffusion processes.
%
%
\section{Results and Discussion}
We allow agents to remember the 5 most recent defectors and to ask nearby agents in a Moore neighbourhood of radius 1, 2, and 3 if they remember an agent defecting in a certain number of past encounters---varying between $0$ and $5$ (including both bounds).
We run the simulation for 1000 steps and plot the agent type saturations in Figure~\ref{fig:agent_sat/gossip_size_step1000}.
\begin{figure}[tb]
\centering
\makebox[\textwidth]{
\includegraphics[width=\textwidth]{saturation&gossip_size-range1_1000steps_large.pdf}
}
\makebox[\textwidth]{
\includegraphics[width=\textwidth]{saturation&gossip_size-range2_1000steps_large.pdf}
}
\makebox[\textwidth]{
\includegraphics[width=\textwidth]{saturation&gossip_size-range3_1000steps_large.pdf}
}
\caption{Agent type saturation for various gossip sizes after 1000 steps, gossip radii 1, 2, and 3, respectively top to bottom; std.\@ dev.\@ of 30 simulation runs, outliers removed}
\label{fig:agent_sat/gossip_size_step1000}
\end{figure}
The introduction of gossip is a strong deterrent of defection and quickly leads to cooperator--only populations.
The size of the memory and the size of the gossip are not significant factors, only speeding up the convergence slightly.
%The most important factor in predicting cooperator success is the range of the gossip.
%\begin{figure}[!hb]
% \centering
% \textbf{Baseline:} Memory size 0 - Gossip size 0 - Gossip range 0
% \makebox[\textwidth]{
% \includegraphics[width=\textwidth/4]{spatial-memory0+gossip0+range0.pdf}
% \includegraphics[width=\textwidth/4]{spatial-memory0+gossip0+range0-B.pdf}
% \includegraphics[width=\textwidth/4]{spatial-memory0+gossip0+range0-C.pdf}
% }
% \textbf{Final:} Memory size 1 - Gossip size 1 - Gossip range 3
% \makebox[\textwidth]{
% \includegraphics[width=\textwidth/4]{spatial-memory1+gossip1+range3-A.pdf}
% \includegraphics[width=\textwidth/4]{spatial-memory1+gossip1+range3-B.pdf}
% \includegraphics[width=\textwidth/4]{spatial-memory1+gossip1+range3-C.pdf}
% }
% \caption{Spatial patterns formed by agents after simulating for 500 steps, defectors shown in red, cooperators green, empty cells light-yellow}
% \label{fig:spatial}
%\end{figure}
%We include images of the spatial patterns formed by the simulations in Figure~\ref{fig:spatial}.
%Since the model has an inspiration in biology this is an interesting visualization to include.
%\section{Conclusion}
Our simulation results find that the most important factor in predicting cooperator success is the range at which gossip can be exchanged; the amount of information included in the gossip has negligible effect.
If the gossip can move faster than agents, cooperators will flourish. Otherwise, defectors can reach full population saturation.
%The best way to ensure cooperation (and survival of a population) is to keep your enemies close and be loud about it. The louder the better.
% future work
Several directions can build on our results.
%Our simulation setup was limited in representing real world conditions.
Notably, we assumed all information is transferred with 100\% fidelity. However,
not all strategies that perform well in noiseless environments can do so under the presence of noise~\cite{noise}.
The gossip mechanism could turn out to be disadvantageous if the agent behaviour was unpredictable enough, since it would deter more cooperator--cooperator interactions.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- Bibliography ----
%
\renewcommand{\bibsection}{\section*{References}} % required for natbib to have "References" printed and as section*, not chapter*
\bibliographystyle{splncs04}
\bibliography{references}
\end{document}
| {"hexsha": "59dfbb7da92600b5604953293ac0065f1c441d9b", "size": 9079, "ext": "tex", "lang": "TeX", "max_stars_repo_path": "bnaic/2-page-summary-bnaic.tex", "max_stars_repo_name": "tinybeachthor/IPD", "max_stars_repo_head_hexsha": "af3dbb21a349c792125a1548d35d2e0fdfb23e60", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "bnaic/2-page-summary-bnaic.tex", "max_issues_repo_name": "tinybeachthor/IPD", "max_issues_repo_head_hexsha": "af3dbb21a349c792125a1548d35d2e0fdfb23e60", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "bnaic/2-page-summary-bnaic.tex", "max_forks_repo_name": "tinybeachthor/IPD", "max_forks_repo_head_hexsha": "af3dbb21a349c792125a1548d35d2e0fdfb23e60", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.8535353535, "max_line_length": 258, "alphanum_fraction": 0.7333406763, "num_tokens": 2247} |
import numpy as np
from pennpaper import Metric, plot_group
xs = np.arange(0.1, 5, step=0.01)
uni_noise = lambda x: np.random.uniform(size=x.shape) + x
funcs = {}
funcs['uniform'] = lambda x: np.random.uniform(size=x.shape) + x
funcs['weibull'] = lambda x: np.random.weibull(a=1, size=x.shape) + x
funcs['beta'] = lambda x: np.random.beta(a=1, b=1, size=x.shape) + x
metrics = []
for name, f in funcs.items():
m = Metric(name=name)
for i in range(100):
m.add_arrays(uni_noise(xs), f(xs), new_sample=True)
metrics.append(m)
plot_group(metrics)
plot_group(metrics, name='true', smoothen=False) | {"hexsha": "6fdadbe2d1b788b063b75b85051f531dd1ff4a04", "size": 619, "ext": "py", "lang": "Python", "max_stars_repo_path": "examples/plot_randoms.py", "max_stars_repo_name": "ikamensh/pennpaper", "max_stars_repo_head_hexsha": "82c8a7a55a2407ed44d095036ed4ae8f2d004b04", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2019-10-11T16:15:20.000Z", "max_stars_repo_stars_event_max_datetime": "2019-10-18T18:36:00.000Z", "max_issues_repo_path": "examples/plot_randoms.py", "max_issues_repo_name": "ikamensh/ilya_ezplot", "max_issues_repo_head_hexsha": "82c8a7a55a2407ed44d095036ed4ae8f2d004b04", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2019-06-21T13:12:07.000Z", "max_issues_repo_issues_event_max_datetime": "2019-08-28T12:02:24.000Z", "max_forks_repo_path": "examples/plot_randoms.py", "max_forks_repo_name": "ikamensh/ilya_ezplot", "max_forks_repo_head_hexsha": "82c8a7a55a2407ed44d095036ed4ae8f2d004b04", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2020-04-16T08:04:32.000Z", "max_forks_repo_forks_event_max_datetime": "2020-04-16T08:04:32.000Z", "avg_line_length": 25.7916666667, "max_line_length": 69, "alphanum_fraction": 0.6720516963, "include": true, "reason": "import numpy", "num_tokens": 185} |
import numpy as np
import random
import os
import json
import mxnet as mx
from mxnet import gluon
import argparse
import logging
import time
from gluonnlp.utils.misc import logging_config
from gluonnlp.models.transformer import TransformerModel, TransformerInference
from gluonnlp.data.batchify import Tuple, Pad, Stack
from gluonnlp.data.filtering import MosesNormalizer
from gluonnlp.data import tokenizers
from gluonnlp.data.tokenizers import huggingface
from gluonnlp.sequence_sampler import BeamSearchSampler, BeamSearchScorer
import sacrebleu
from tqdm import tqdm
mx.npx.set_np()
def parse_args():
parser = argparse.ArgumentParser(
description='Transformer for Neural Machine Translation. Load a checkpoint and inference.')
parser.add_argument('--seed', type=int, default=100, help='The random seed.')
parser.add_argument('--src_lang', type=str, default='en', help='Source language')
parser.add_argument('--tgt_lang', type=str, default='de', help='Target language')
parser.add_argument('--src_corpus', type=str, required=True,
help='The source corpus for evaluation.')
parser.add_argument('--tgt_corpus', type=str, default=None,
help='The target corpus for evaluation.')
parser.add_argument('--src_normalizer', choices=['no', 'moses'],
default='moses', help='The sentence normalizer that will be '
'used to normalize the source sentence.')
parser.add_argument('--src_base_tokenizer', choices=['whitespace', 'moses',
'no'],
default='moses', help='The base tokenizer to tokenize the target '
'sentence into a list of tokens.')
parser.add_argument('--src_tokenizer', choices=['spm',
'subword_nmt',
'yttm',
'hf_bytebpe',
'hf_wordpiece',
'hf_bpe'],
required=True, type=str,
help='The source subword tokenizer. '
'Only supports online encoding at present.')
parser.add_argument('--tgt_normalizer', choices=['no', 'moses'],
default='moses', help='The sentence normalizer that will be '
'used to normalize the target sentence.')
parser.add_argument('--tgt_base_tokenizer', choices=['whitespace', 'moses',
'no'],
default='moses', help='The base tokenizer to tokenize the source '
'sentence into a list of tokens.')
parser.add_argument('--tgt_tokenizer', choices=['spm',
'subword_nmt',
'yttm',
'hf_bytebpe',
'hf_wordpiece',
'hf_bpe'],
required=True, type=str,
help='The target tokenizer. Only supports online encoding at present.')
parser.add_argument('--src_subword_model_path', type=str,
help='Path to the source subword model.')
parser.add_argument('--src_vocab_path', type=str,
help='Path to the source subword vocab.')
parser.add_argument('--tgt_subword_model_path', type=str,
help='Path to the target subword model.')
parser.add_argument('--tgt_vocab_path', type=str,
help='Path to the target subword vocab.')
parser.add_argument('--src_max_len', type=int, default=None,
help='Maximum length of the source sentence.')
parser.add_argument('--tgt_max_len', type=int, default=None,
help='Maximum length of the target sentence.')
parser.add_argument('--cfg', type=str, help='Config file of the Transformer model.')
parser.add_argument('--beam-size', type=int, default=4, help='Number of beams')
parser.add_argument('--lp_alpha', type=float, default=0.6,
help='The alpha value in the length penalty')
parser.add_argument('--lp_k', type=int, default=5, help='The K value in the length penalty')
parser.add_argument('--max_length_a', type=int, default=1,
help='The a in the a * x + b formula of beam search')
parser.add_argument('--max_length_b', type=int, default=50,
help='The b in the a * x + b formula of beam search')
parser.add_argument('--param_path', type=str, help='The path to the model parameters.')
parser.add_argument('--gpus', type=str, default='0',
help='List of gpus to run, e.g. 0 or 0,2,5. empty means using cpu.'
'(using single gpu is suggested)')
parser.add_argument('--save_dir', type=str, default=None,
help='The path to save the log files and predictions.')
parser.add_argument('--stochastic', action='store_true',
help='Whether to use the stochastic beam search')
parser.add_argument('--temperature', type=float, default=None,
help='the temperature used for softmax normalization with stochastic setting')
parser.add_argument('--inference', action='store_true',
help='Whether to inference with your own data, '
'when applying inference, tgt_corpus is not needed and will be set to None.')
parser.add_argument('--fp16', action='store_true',
help='Whether to use dtype float16')
args = parser.parse_args()
if args.save_dir is None:
args.save_dir = os.path.splitext(args.param_path)[0] + '_evaluation'
assert args.inference or args.tgt_corpus, 'requring --tgt_corpus while not using --inference'
if args.inference:
args.tgt_corpus = None
if args.stochastic:
if args.temperature is None:
args.temperature = 0.5
logging_config(args.save_dir, console=True)
logging.info(args)
return args
def process_corpus(corpus_path, sentence_normalizer, bpe_tokenizer,
base_tokenizer=None, add_bos=True,
add_eos=True):
processed_token_ids = []
raw_lines = []
with open(corpus_path, 'r', encoding='utf-8') as f:
for line in f:
line = line.strip()
raw_lines.append(line)
line = sentence_normalizer(line)
if base_tokenizer is not None:
line = ' '.join(base_tokenizer.encode(line))
bpe_token_ids = bpe_tokenizer.encode(line, output_type=int)
if add_bos:
bpe_token_ids = [bpe_tokenizer.vocab.bos_id] + bpe_token_ids
if add_eos:
bpe_token_ids.append(bpe_tokenizer.vocab.eos_id)
processed_token_ids.append(bpe_token_ids)
return processed_token_ids, raw_lines
def create_tokenizer(tokenizer_type, model_path, vocab_path):
if tokenizer_type == 'spm':
return tokenizers.create(tokenizer_type, model_path=model_path, vocab=vocab_path)
elif tokenizer_type == 'subword_nmt':
return tokenizers.create(tokenizer_type, model_path=model_path, vocab=vocab_path)
elif tokenizer_type == 'yttm':
return tokenizers.create(tokenizer_type, model_path=model_path, vocab=vocab_path)
elif tokenizer_type in ['hf_bytebpe', 'hf_wordpiece', 'hf_bpe']:
if huggingface.is_new_version_model_file(model_path):
return tokenizers.create('hf_tokenizer', model_path=model_path, vocab=vocab_path)
elif tokenizer_type == 'hf_bytebpe':
return tokenizers.create(tokenizer_type, merges_file=model_path, vocab_file=vocab_path)
elif tokenizer_type == 'hf_wordpiece':
return tokenizers.create(tokenizer_type, vocab_file=vocab_path)
elif tokenizer_type == 'hf_bpe':
return tokenizers.create(tokenizer_type, merges_file=model_path, vocab_file=vocab_path)
else:
raise NotImplementedError
def get_normalizer(normalize_method, lang):
if normalize_method == 'moses':
return MosesNormalizer(lang)
elif normalize_method == 'no':
return lambda x: x
else:
raise NotImplementedError
def get_base_tokenizer(method, lang):
"""The base tokenization method
Parameters
----------
method
lang
Returns
-------
"""
if method == 'moses':
return tokenizers.create('moses', lang)
elif method == 'whitespace':
return tokenizers.create('whitespace')
elif method == 'no':
return None
else:
raise NotImplementedError
def evaluate(args):
ctx_l = [mx.cpu()] if args.gpus is None or args.gpus == '' else [mx.gpu(int(x)) for x in
args.gpus.split(',')]
src_normalizer = get_normalizer(args.src_normalizer, args.src_lang)
tgt_normalizer = get_normalizer(args.src_normalizer, args.tgt_lang)
base_src_tokenizer = get_base_tokenizer(args.src_base_tokenizer, args.src_lang)
base_tgt_tokenizer = get_base_tokenizer(args.tgt_base_tokenizer, args.tgt_lang)
src_tokenizer = create_tokenizer(args.src_tokenizer,
args.src_subword_model_path,
args.src_vocab_path)
tgt_tokenizer = create_tokenizer(args.tgt_tokenizer,
args.tgt_subword_model_path,
args.tgt_vocab_path)
src_vocab = src_tokenizer.vocab
tgt_vocab = tgt_tokenizer.vocab
if args.cfg.endswith('.yml'):
cfg = TransformerModel.get_cfg().clone_merge(args.cfg)
else:
cfg = TransformerModel.get_cfg(args.cfg)
cfg.defrost()
cfg.MODEL.src_vocab_size = len(src_vocab)
cfg.MODEL.tgt_vocab_size = len(tgt_vocab)
if args.fp16:
cfg.MODEL.dtype = 'float16'
cfg.freeze()
model = TransformerModel.from_cfg(cfg)
model.cast('float16')
model.hybridize()
model.load_parameters(args.param_path, ctx=ctx_l, cast_dtype=True)
inference_model = TransformerInference(model=model)
inference_model.hybridize()
# Construct the BeamSearchSampler
if args.stochastic:
scorer = BeamSearchScorer(alpha=0.0,
K=0.0,
temperature=args.temperature,
from_logits=False)
else:
scorer = BeamSearchScorer(alpha=args.lp_alpha,
K=args.lp_k,
from_logits=False)
beam_search_sampler = BeamSearchSampler(beam_size=args.beam_size,
decoder=inference_model,
vocab_size=len(tgt_vocab),
eos_id=tgt_vocab.eos_id,
scorer=scorer,
stochastic=args.stochastic,
max_length_a=args.max_length_a,
max_length_b=args.max_length_b)
logging.info(beam_search_sampler)
all_src_token_ids, all_src_lines = process_corpus(
args.src_corpus,
sentence_normalizer=src_normalizer,
base_tokenizer=base_src_tokenizer,
bpe_tokenizer=src_tokenizer,
add_bos=False,
add_eos=True
)
if args.tgt_corpus is not None:
all_tgt_token_ids, all_tgt_lines = process_corpus(
args.tgt_corpus,
sentence_normalizer=tgt_normalizer,
base_tokenizer=base_tgt_tokenizer,
bpe_tokenizer=tgt_tokenizer,
add_bos=True,
add_eos=True
)
else:
# when applying inference, populate the fake tgt tokens
all_tgt_token_ids = all_tgt_lines = [[] for i in range(len(all_src_token_ids))]
test_dataloader = gluon.data.DataLoader(
list(zip(all_src_token_ids,
[len(ele) for ele in all_src_token_ids],
all_tgt_token_ids,
[len(ele) for ele in all_tgt_token_ids])),
batch_size=32,
batchify_fn=Tuple(Pad(), Stack(), Pad(), Stack()),
shuffle=False)
ctx = ctx_l[0]
pred_sentences = []
start_eval_time = time.time()
# evaluate
if not args.inference:
avg_nll_loss = 0
ntokens = 0
for i, (src_token_ids, src_valid_length, tgt_token_ids, tgt_valid_length)\
in enumerate(test_dataloader):
src_token_ids = mx.np.array(src_token_ids, ctx=ctx, dtype=np.int32)
src_valid_length = mx.np.array(src_valid_length, ctx=ctx, dtype=np.int32)
tgt_token_ids = mx.np.array(tgt_token_ids, ctx=ctx, dtype=np.int32)
tgt_valid_length = mx.np.array(tgt_valid_length, ctx=ctx, dtype=np.int32)
if model.layout == 'NT':
tgt_pred = model(src_token_ids, src_valid_length, tgt_token_ids[:, :-1],
tgt_valid_length - 1)
pred_logits = mx.npx.log_softmax(tgt_pred, axis=-1)
nll = - mx.npx.pick(pred_logits, tgt_token_ids[:, 1:])
avg_nll_loss += mx.npx.sequence_mask(nll,
sequence_length=tgt_valid_length - 1,
use_sequence_length=True,
axis=1).sum().asnumpy()
elif model.layout == 'TN':
tgt_pred = model(src_token_ids.T, src_valid_length, tgt_token_ids.T[:-1, :],
tgt_valid_length - 1)
pred_logits = mx.npx.log_softmax(tgt_pred, axis=-1)
nll = - mx.npx.pick(pred_logits, tgt_token_ids.T[1:, :])
avg_nll_loss += mx.npx.sequence_mask(nll,
sequence_length=tgt_valid_length - 1,
use_sequence_length=True,
axis=0).sum().asnumpy()
else:
raise NotImplementedError
ntokens += int((tgt_valid_length - 1).sum().asnumpy())
init_input = mx.np.array([tgt_vocab.bos_id for _ in range(src_token_ids.shape[0])], ctx=ctx)
if model.layout == 'NT':
states = inference_model.init_states(src_token_ids, src_valid_length)
elif model.layout == 'TN':
states = inference_model.init_states(src_token_ids.T, src_valid_length)
else:
raise NotImplementedError
samples, scores, valid_length = beam_search_sampler(init_input, states, src_valid_length)
for j in range(samples.shape[0]):
pred_tok_ids = samples[j, 0, :valid_length[j, 0].asnumpy()].asnumpy().tolist()
bpe_decode_line = tgt_tokenizer.decode(pred_tok_ids[1:-1])
pred_sentence = base_tgt_tokenizer.decode(bpe_decode_line.split(' '))
pred_sentences.append(pred_sentence)
print(pred_sentence)
print('Processed {}/{}'.format(len(pred_sentences), len(all_tgt_lines)))
end_eval_time = time.time()
avg_nll_loss = avg_nll_loss / ntokens
with open(os.path.join(args.save_dir, 'gt_sentences.txt'), 'w', encoding='utf-8') as of:
of.write('\n'.join(all_tgt_lines))
of.write('\n')
with open(os.path.join(args.save_dir, 'pred_sentences.txt'), 'w', encoding='utf-8') as of:
of.write('\n'.join(pred_sentences))
of.write('\n')
sacrebleu_out = sacrebleu.corpus_bleu(sys_stream=pred_sentences,
ref_streams=[all_tgt_lines])
logging.info('Time Spent: {}, #Sent={}, SacreBlEU={} '
'({:2.1f} {:2.1f} {:2.1f} {:2.1f}) '
'(BP={:.3f}, ratio={:.3f}, syslen={}, reflen={}), '
'Avg NLL={}, Perplexity={}'
.format(end_eval_time - start_eval_time, len(all_tgt_lines),
sacrebleu_out.score,
*sacrebleu_out.precisions,
sacrebleu_out.bp, sacrebleu_out.sys_len / sacrebleu_out.ref_len,
sacrebleu_out.sys_len, sacrebleu_out.ref_len,
avg_nll_loss, np.exp(avg_nll_loss)))
results = {'sacrebleu': sacrebleu_out.score,
'nll': avg_nll_loss}
with open(os.path.join(args.save_dir, 'results.json'), 'w') as of:
json.dump(results, of)
# inference only
else:
with open(os.path.join(args.save_dir, 'pred_sentences.txt'), 'w', encoding='utf-8') as of:
processed_sentences = 0
for src_token_ids, src_valid_length, _, _ in tqdm(test_dataloader):
src_token_ids = mx.np.array(src_token_ids, ctx=ctx, dtype=np.int32)
src_valid_length = mx.np.array(src_valid_length, ctx=ctx, dtype=np.int32)
init_input = mx.np.array([tgt_vocab.bos_id for _ in range(src_token_ids.shape[0])], ctx=ctx)
if model.layout == 'NT':
states = inference_model.init_states(src_token_ids, src_valid_length)
elif model.layout == 'TN':
states = inference_model.init_states(src_token_ids.T, src_valid_length)
else:
raise NotImplementedError
samples, scores, valid_length = beam_search_sampler(init_input, states, src_valid_length)
for j in range(samples.shape[0]):
pred_tok_ids = samples[j, 0, :valid_length[j, 0].asnumpy()].asnumpy().tolist()
bpe_decode_line = tgt_tokenizer.decode(pred_tok_ids[1:-1])
pred_sentence = base_tgt_tokenizer.decode(bpe_decode_line.split(' '))
pred_sentences.append(pred_sentence)
of.write('\n'.join(pred_sentences))
of.write('\n')
processed_sentences += len(pred_sentences)
pred_sentences = []
end_eval_time = time.time()
logging.info('Time Spent: {}, Inferred sentences: {}'
.format(end_eval_time - start_eval_time, processed_sentences))
if __name__ == '__main__':
os.environ['MXNET_GPU_MEM_POOL_TYPE'] = 'Round'
args = parse_args()
np.random.seed(args.seed)
mx.random.seed(args.seed)
random.seed(args.seed)
evaluate(args)
| {"hexsha": "46487e9442c1092c0e2edb35946a2e4987e4fe2d", "size": 19135, "ext": "py", "lang": "Python", "max_stars_repo_path": "scripts/machine_translation/evaluate_transformer.py", "max_stars_repo_name": "leezu/gluon-nlp", "max_stars_repo_head_hexsha": "19de74c2b03f22dde8311a0225b4571c2deef0e4", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 2461, "max_stars_repo_stars_event_min_datetime": "2018-04-25T03:47:22.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T03:58:48.000Z", "max_issues_repo_path": "scripts/machine_translation/evaluate_transformer.py", "max_issues_repo_name": "leezu/gluon-nlp", "max_issues_repo_head_hexsha": "19de74c2b03f22dde8311a0225b4571c2deef0e4", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 1450, "max_issues_repo_issues_event_min_datetime": "2018-04-25T16:14:25.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-24T21:02:57.000Z", "max_forks_repo_path": "scripts/machine_translation/evaluate_transformer.py", "max_forks_repo_name": "leezu/gluon-nlp", "max_forks_repo_head_hexsha": "19de74c2b03f22dde8311a0225b4571c2deef0e4", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 578, "max_forks_repo_forks_event_min_datetime": "2018-04-25T04:55:18.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-16T03:01:45.000Z", "avg_line_length": 50.6216931217, "max_line_length": 108, "alphanum_fraction": 0.5743402143, "include": true, "reason": "import numpy", "num_tokens": 3914} |
import gensim, time, os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import numpy as np
import pandas as pd
import gensim
import string, nltk
from nltk import word_tokenize
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.keras as tfk
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Embedding, Flatten, GRU, LSTM
from tensorflow.keras.initializers import Constant
from keras_preprocessing.sequence import pad_sequences
from sklearn.model_selection import train_test_split
EMBEDDING_DIM = 128
# Tokenize the data in order to be used by both the Word2Vec model and the Tokenizer()
def getreviewLine(data):
reviewLines = list()
tokens = word_tokenize(data)
reviewLines.append(tokens)
return reviewLines
# Function to create weight matrix from word2vec gensim model
def get_weight_matrix(model, vocab):
vocab_size = len(vocab) + 1
weight_matrix = np.zeros((vocab_size, EMBEDDING_DIM))
print(f"The weight matrix initialy is {weight_matrix}")
# step vocab, store vectors using the Tokenizer's integer mapping
for word, i in vocab.items():
weight_matrix[i] = model[word]
return weight_matrix
data = "in fake news detection we detect the fake news"
reviewLines = getreviewLine(data)
# Initialize the Word2Vec model and save the model to use it in the first layer of the NN
word2vecSteps = gensim.models.Word2Vec(sentences=reviewLines, size=EMBEDDING_DIM, window=5, min_count=1)
filename = 'word2vecSteps.txt'
word2vecSteps.wv.save_word2vec_format(filename, binary=False)
# Now we convert the word embedding to tokenized vector
tokenizer = Tokenizer(num_words=60000)
tokenizer.fit_on_texts(reviewLines)
sequences = tokenizer.texts_to_sequences(reviewLines)
wordIndex = tokenizer.word_index
reviewData = pad_sequences(sequences, maxlen=20, padding='post')
vocabSize = len(tokenizer.word_index) + 1 # Plus one for all the unknown words
#Getting embedding vectors from word2vec and usings it as weights of non-trainable keras embedding layer
embedding_vectors = get_weight_matrix(word2vecSteps, wordIndex)
# Print the results
print('\n\n')
print(f"The result of the getReviewLine is: {reviewLines}")
print('\n\n')
print(f"The result of the Tokenizer is this sequence: {sequences}")
print('\n\n')
print(f"The word index is the following: {wordIndex}")
print('\n\n')
print(f"The vocabulary size we are going to use is {vocabSize}")
print('\n\n')
print(f"The data that we insert to the model for the training are: {reviewData}")
print('\n\n')
print(f"The weights we use in teh input layer are {embedding_vectors}") | {"hexsha": "e366a259aff710107f72b3e90267d0f5014b73c8", "size": 2692, "ext": "py", "lang": "Python", "max_stars_repo_path": "Theory/steps.py", "max_stars_repo_name": "StamatisOrfanos/Fake-News_Detection", "max_stars_repo_head_hexsha": "1a26ff2396fc6083bd27ed276d6b927fb6783850", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2021-03-20T12:18:12.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-12T11:06:01.000Z", "max_issues_repo_path": "Theory/steps.py", "max_issues_repo_name": "StamatisOrfanos/Fake-News_Detection", "max_issues_repo_head_hexsha": "1a26ff2396fc6083bd27ed276d6b927fb6783850", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Theory/steps.py", "max_forks_repo_name": "StamatisOrfanos/Fake-News_Detection", "max_forks_repo_head_hexsha": "1a26ff2396fc6083bd27ed276d6b927fb6783850", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.4210526316, "max_line_length": 104, "alphanum_fraction": 0.7767459138, "include": true, "reason": "import numpy", "num_tokens": 635} |
[GOAL]
E : Type u_1
X : Type u_2
c : E
f : ContDiffBump c
⊢ 1 < f.rOut / f.rIn
[PROOFSTEP]
rw [one_lt_div f.rIn_pos]
[GOAL]
E : Type u_1
X : Type u_2
c : E
f : ContDiffBump c
⊢ f.rIn < f.rOut
[PROOFSTEP]
exact f.rIn_lt_rOut
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c : E
f : ContDiffBump c
x✝ : E
n : ℕ∞
x : E
⊢ ↑f (c - x) = ↑f (c + x)
[PROOFSTEP]
simp [f.apply, ContDiffBumpBase.symmetric]
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c : E
f✝ : ContDiffBump c
x✝ : E
n : ℕ∞
f : ContDiffBump 0
x : E
⊢ ↑f (-x) = ↑f x
[PROOFSTEP]
simp_rw [← zero_sub, f.sub, zero_add]
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c : E
f : ContDiffBump c
x : E
n : ℕ∞
hx : x ∈ closedBall c f.rIn
⊢ ↑f x = 1
[PROOFSTEP]
apply ContDiffBumpBase.eq_one _ _ f.one_lt_rOut_div_rIn
[GOAL]
case a
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c : E
f : ContDiffBump c
x : E
n : ℕ∞
hx : x ∈ closedBall c f.rIn
⊢ ‖(fun x => f.rIn⁻¹ • (x - c)) x‖ ≤ 1
[PROOFSTEP]
simpa only [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_nonneg f.rIn_pos.le, ← div_eq_inv_mul,
div_le_one f.rIn_pos] using mem_closedBall_iff_norm.1 hx
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c : E
f : ContDiffBump c
x : E
n : ℕ∞
⊢ support ↑f = ball c f.rOut
[PROOFSTEP]
simp only [toFun, support_comp_eq_preimage, ContDiffBumpBase.support _ _ f.one_lt_rOut_div_rIn]
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c : E
f : ContDiffBump c
x : E
n : ℕ∞
⊢ (fun x => f.rIn⁻¹ • (x - c)) ⁻¹' ball 0 (f.rOut / f.rIn) = ball c f.rOut
[PROOFSTEP]
ext x
[GOAL]
case h
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c : E
f : ContDiffBump c
x✝ : E
n : ℕ∞
x : E
⊢ x ∈ (fun x => f.rIn⁻¹ • (x - c)) ⁻¹' ball 0 (f.rOut / f.rIn) ↔ x ∈ ball c f.rOut
[PROOFSTEP]
simp only [mem_ball_iff_norm, sub_zero, norm_smul, mem_preimage, Real.norm_eq_abs, abs_inv, abs_of_pos f.rIn_pos, ←
div_eq_inv_mul, div_lt_div_right f.rIn_pos]
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c : E
f : ContDiffBump c
x : E
n : ℕ∞
⊢ tsupport ↑f = closedBall c f.rOut
[PROOFSTEP]
simp_rw [tsupport, f.support_eq, closure_ball _ f.rOut_pos.ne']
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c : E
f : ContDiffBump c
x : E
n : ℕ∞
hx : x ∈ ball c f.rOut
⊢ ↑f x ≠ 0
[PROOFSTEP]
rwa [← support_eq, mem_support] at hx
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c : E
f : ContDiffBump c
x : E
n : ℕ∞
hx : f.rOut ≤ dist x c
⊢ ↑f x = 0
[PROOFSTEP]
rwa [← nmem_support, support_eq, mem_ball, not_lt]
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : NormedAddCommGroup X
inst✝² : NormedSpace ℝ X
inst✝¹ : HasContDiffBump E
c : E
f : ContDiffBump c
x : E
n : ℕ∞
inst✝ : FiniteDimensional ℝ E
⊢ HasCompactSupport ↑f
[PROOFSTEP]
simp_rw [HasCompactSupport, f.tsupport_eq, isCompact_closedBall]
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c✝ : E
f✝ : ContDiffBump c✝
x✝ : E
n : ℕ∞
c g : X → E
s : Set X
f : (x : X) → ContDiffBump (c x)
x : X
hc : ContDiffWithinAt ℝ n c s x
hr : ContDiffWithinAt ℝ n (fun x => (f x).rIn) s x
hR : ContDiffWithinAt ℝ n (fun x => (f x).rOut) s x
hg : ContDiffWithinAt ℝ n g s x
⊢ ContDiffWithinAt ℝ n (fun x => ↑(f x) (g x)) s x
[PROOFSTEP]
change
ContDiffWithinAt ℝ n
(uncurry (someContDiffBumpBase E).toFun ∘ fun x : X => ((f x).rOut / (f x).rIn, (f x).rIn⁻¹ • (g x - c x))) s x
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c✝ : E
f✝ : ContDiffBump c✝
x✝ : E
n : ℕ∞
c g : X → E
s : Set X
f : (x : X) → ContDiffBump (c x)
x : X
hc : ContDiffWithinAt ℝ n c s x
hr : ContDiffWithinAt ℝ n (fun x => (f x).rIn) s x
hR : ContDiffWithinAt ℝ n (fun x => (f x).rOut) s x
hg : ContDiffWithinAt ℝ n g s x
⊢ ContDiffWithinAt ℝ n
(uncurry (someContDiffBumpBase E).toFun ∘ fun x => ((f x).rOut / (f x).rIn, (f x).rIn⁻¹ • (g x - c x))) s x
[PROOFSTEP]
refine (((someContDiffBumpBase E).smooth.contDiffAt ?_).of_le le_top).comp_contDiffWithinAt x ?_
[GOAL]
case refine_1
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c✝ : E
f✝ : ContDiffBump c✝
x✝ : E
n : ℕ∞
c g : X → E
s : Set X
f : (x : X) → ContDiffBump (c x)
x : X
hc : ContDiffWithinAt ℝ n c s x
hr : ContDiffWithinAt ℝ n (fun x => (f x).rIn) s x
hR : ContDiffWithinAt ℝ n (fun x => (f x).rOut) s x
hg : ContDiffWithinAt ℝ n g s x
⊢ Ioi 1 ×ˢ univ ∈ 𝓝 ((f x).rOut / (f x).rIn, (f x).rIn⁻¹ • (g x - c x))
[PROOFSTEP]
exact prod_mem_nhds (Ioi_mem_nhds (f x).one_lt_rOut_div_rIn) univ_mem
[GOAL]
case refine_2
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c✝ : E
f✝ : ContDiffBump c✝
x✝ : E
n : ℕ∞
c g : X → E
s : Set X
f : (x : X) → ContDiffBump (c x)
x : X
hc : ContDiffWithinAt ℝ n c s x
hr : ContDiffWithinAt ℝ n (fun x => (f x).rIn) s x
hR : ContDiffWithinAt ℝ n (fun x => (f x).rOut) s x
hg : ContDiffWithinAt ℝ n g s x
⊢ ContDiffWithinAt ℝ n (fun x => ((f x).rOut / (f x).rIn, (f x).rIn⁻¹ • (g x - c x))) s x
[PROOFSTEP]
exact (hR.div hr (f x).rIn_pos.ne').prod ((hr.inv (f x).rIn_pos.ne').smul (hg.sub hc))
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c✝ : E
f✝ : ContDiffBump c✝
x : E
n : ℕ∞
c g : X → E
f : (x : X) → ContDiffBump (c x)
hc : ContDiff ℝ n c
hr : ContDiff ℝ n fun x => (f x).rIn
hR : ContDiff ℝ n fun x => (f x).rOut
hg : ContDiff ℝ n g
⊢ ContDiff ℝ n fun x => ↑(f x) (g x)
[PROOFSTEP]
rw [contDiff_iff_contDiffAt] at *
[GOAL]
E : Type u_1
X : Type u_2
inst✝⁴ : NormedAddCommGroup E
inst✝³ : NormedSpace ℝ E
inst✝² : NormedAddCommGroup X
inst✝¹ : NormedSpace ℝ X
inst✝ : HasContDiffBump E
c✝ : E
f✝ : ContDiffBump c✝
x : E
n : ℕ∞
c g : X → E
f : (x : X) → ContDiffBump (c x)
hc : ∀ (x : X), ContDiffAt ℝ n c x
hr : ∀ (x : X), ContDiffAt ℝ n (fun x => (f x).rIn) x
hR : ∀ (x : X), ContDiffAt ℝ n (fun x => (f x).rOut) x
hg : ∀ (x : X), ContDiffAt ℝ n g x
⊢ ∀ (x : X), ContDiffAt ℝ n (fun x => ↑(f x) (g x)) x
[PROOFSTEP]
exact fun x => (hc x).contDiffBump (hr x) (hR x) (hg x)
| {"mathlib_filename": "Mathlib.Analysis.Calculus.BumpFunction.Basic", "llama_tokens": 3895} |
!subroutine mpas_initialize_vectors(meshPool)!{{{
subroutine mpas_initialize_vectors(nCells, nEdges, maxEdges, R3, &
verticesOnEdge, cellsOnEdge, &
edgesOnCell, xCell, yCell, zCell, xEdge, yEdge, zEdge, &
localVerticalUnitVectors, edgeNormalVectors, cellTangentPlane, &
on_a_sphere, is_periodic, x_period, y_period)
implicit none
integer, parameter :: RKIND = selected_real_kind(12)
integer :: nCells, nEdges, maxEdges, R3
integer, dimension(2, nEdges) :: verticesOnEdge, cellsOnEdge
integer, dimension(maxEdges, nCells) :: edgesOnCell
real(kind=RKIND), dimension(nCells) :: xCell, yCell, zCell
real(kind=RKIND), dimension(nEdges) :: xEdge, yEdge, zEdge
real(kind=RKIND), dimension(R3,nCells) :: localVerticalUnitVectors
real(kind=RKIND), dimension(R3,nEdges) :: edgeNormalVectors
real(kind=RKIND), dimension(R3,2,nCells) :: cellTangentPlane
logical :: on_a_sphere, is_periodic
real(kind=RKIND) :: x_period, y_period
!f2py intent(in) nCells, nEdges, maxEdges, R3
!f2py intent(in) verticesOnEdge, cellsOnEdge, edgesOnCell
!f2py intent(in) xCell, yCell, zCell, xEdge, yEdge, zEdge
!f2py intent(in) on_a_sphere, is_periodic, x_period, y_period
!f2py intent(out) localVerticalUnitVectors, edgeNormalVectors, cellTangentPlane
! local variables
integer :: iEdge, iCell, cell1, cell2
real(kind=RKIND) :: mpas_fix_periodicity
real(kind=RKIND), dimension(3) :: xHatPlane, yHatPlane, rHat
real(kind=RKIND) :: normalDotRHat
! init arrays
edgeNormalVectors = 0
localVerticalUnitVectors = 0
! loop over all cells to be solved on this block
do iCell = 1, nCells
if (on_a_sphere) then
localVerticalUnitVectors(1,iCell) = xCell(iCell)
localVerticalUnitVectors(2,iCell) = yCell(iCell)
localVerticalUnitVectors(3,iCell) = zCell(iCell)
call mpas_unit_vec_in_r3(localVerticalUnitVectors(:,iCell))
else ! on a plane
localVerticalUnitVectors(:,iCell) = (/ 0., 0., 1. /)
end if
end do
! Initialize normal unit vectors at each edge
! These vectors point from cell to cell.
! At boundaries, one cell does not exist, so it points from cell to edge or from edge to cell.
do iEdge = 1,nEdges
cell1 = cellsOnEdge(1,iEdge)
cell2 = cellsOnEdge(2,iEdge)
if (cell1 == nCells+1) then ! this is a boundary edge
! the normal points from the edge location to the cell location
if (is_periodic) then
edgeNormalVectors(1,iEdge) = xCell(cell2) - mpas_fix_periodicity(xEdge(iEdge), xCell(cell2), x_period)
edgeNormalVectors(2,iEdge) = yCell(cell2) - mpas_fix_periodicity(yEdge(iEdge), yCell(cell2), y_period)
edgeNormalVectors(3,iEdge) = zCell(cell2) - zEdge(iEdge)
else
edgeNormalVectors(1,iEdge) = xCell(cell2) - xEdge(iEdge)
edgeNormalVectors(2,iEdge) = yCell(cell2) - yEdge(iEdge)
edgeNormalVectors(3,iEdge) = zCell(cell2) - zEdge(iEdge)
end if
else if (cell2 == nCells+1) then ! this is a boundary edge
! the normal points from the cell location to the edge location
if (is_periodic) then
edgeNormalVectors(1,iEdge) = mpas_fix_periodicity(xEdge(iEdge), xCell(cell1), x_period) - xCell(cell1)
edgeNormalVectors(2,iEdge) = mpas_fix_periodicity(yEdge(iEdge), yCell(cell1), y_period) - yCell(cell1)
edgeNormalVectors(3,iEdge) = zEdge(iEdge) - zCell(cell1)
else
edgeNormalVectors(1,iEdge) = xEdge(iEdge) - xCell(cell1)
edgeNormalVectors(2,iEdge) = yEdge(iEdge) - yCell(cell1)
edgeNormalVectors(3,iEdge) = zEdge(iEdge) - zCell(cell1)
end if
else ! this is not a boundary cell
! the normal points from the cell 1 to cell2
! mrp problem: on periodic domains, vectors on edges of domain point the wrong way.
if (is_periodic) then
edgeNormalVectors(1,iEdge) = mpas_fix_periodicity(xCell(cell2), xCell(cell1), x_period) - xCell(cell1)
edgeNormalVectors(2,iEdge) = mpas_fix_periodicity(yCell(cell2), yCell(cell1), y_period) - yCell(cell1)
edgeNormalVectors(3,iEdge) = zCell(cell2) - zCell(cell1)
else
edgeNormalVectors(1,iEdge) = xCell(cell2) - xCell(cell1)
edgeNormalVectors(2,iEdge) = yCell(cell2) - yCell(cell1)
edgeNormalVectors(3,iEdge) = zCell(cell2) - zCell(cell1)
end if
end if
call mpas_unit_vec_in_r3(edgeNormalVectors(:,iEdge))
end do
do iCell=1,nCells
iEdge = edgesOnCell(1,iCell)
! xHat and yHat are a local basis in the plane of the horizontal cell
! we arbitrarily choose xHat to point toward the first edge
rHat = localVerticalUnitVectors(:,iCell)
normalDotRHat = sum(edgeNormalVectors(:,iEdge)*rHat)
xHatPlane = edgeNormalVectors(:,iEdge) - normalDotRHat*rHat
call mpas_unit_vec_in_r3(xHatPlane)
call mpas_cross_product_in_r3(rHat, xHatPlane, yHatPlane)
call mpas_unit_vec_in_r3(yHatPlane) ! just to be sure...
cellTangentPlane(:,1,iCell) = xHatPlane
cellTangentPlane(:,2,iCell) = yHatPlane
end do
end subroutine mpas_initialize_vectors!}}}
subroutine mpas_unit_vec_in_r3(xin)!{{{
implicit none
integer, parameter :: RKIND = selected_real_kind(12)
real (kind=RKIND), dimension(3), intent(inout) :: xin !< Input/Output: Vector and unit vector
real (kind=RKIND) :: mag
mag = sqrt(xin(1)**2+xin(2)**2+xin(3)**2)
xin(:) = xin(:) / mag
end subroutine mpas_unit_vec_in_r3!}}}
subroutine mpas_cross_product_in_r3(p_1,p_2,p_out)!{{{
integer, parameter :: RKIND = selected_real_kind(12)
real (kind=RKIND), intent(in) :: p_1 (3) !< Input: Vector 1
real (kind=RKIND), intent(in) :: p_2 (3) !< Input: Vector 2
real (kind=RKIND), intent(out) :: p_out (3) !< Output: Cross product of vector 1 and vector 2
p_out(1) = p_1(2)*p_2(3)-p_1(3)*p_2(2)
p_out(2) = p_1(3)*p_2(1)-p_1(1)*p_2(3)
p_out(3) = p_1(1)*p_2(2)-p_1(2)*p_2(1)
end subroutine mpas_cross_product_in_r3!}}}
function mpas_fix_periodicity(pxi, xci, xiRef) !{{{
implicit none
integer, parameter :: RKIND = selected_real_kind(12)
real (kind=RKIND), intent(in) :: pxi, xci, xiRef
real (kind=RKIND) :: mpas_fix_periodicity
! local variables
real (kind=RKIND) :: dist
dist = pxi - xci
if (abs(dist) > xiRef * 0.5_RKIND) then
mpas_fix_periodicity = pxi - (dist/abs(dist)) * xiRef
else
mpas_fix_periodicity = pxi
end if
end function mpas_fix_periodicity !}}}
!subroutine mpas_init_reconstruct(meshPool) ! ,includeHalos)
subroutine mpas_init_reconstruct(nCells, nEdges, maxEdges, R3, &
edgesOnCell, nEdgesOnCell, &
xCell, yCell, zCell, xEdge, yEdge, zEdge, edgeNormalVectors, &
cellTangentPlane, coeffs_reconstruct, is_periodic, x_period, y_period)
implicit none
!logical, optional, intent(in) :: includeHalos
integer, parameter :: RKIND = selected_real_kind(12)
! temporary arrays needed in the (to be constructed) init procedure
integer :: nCells, nEdges, maxEdges, R3
integer, dimension(maxEdges, nCells) :: edgesOnCell
integer, dimension(nCells) :: nEdgesOnCell
real(kind=RKIND), dimension(nCells) :: xCell, yCell, zCell
real(kind=RKIND), dimension(nEdges) :: xEdge, yEdge, zEdge
real(kind=RKIND), dimension(R3,nEdges) :: edgeNormalVectors
real(kind=RKIND), dimension(R3,2,nCells) :: cellTangentPlane
real (kind=RKIND), dimension(R3,maxEdges,nCells) :: coeffs_reconstruct
logical :: is_periodic
real(kind=RKIND) :: x_period, y_period
!f2py intent(in) nCells, nEdges, maxEdges, R3, edgesOnCell, nEdgesOnCell
!f2py intent(in) xCell, yCell, zCell, xEdge, yEdge, zEdge, edgeNormalVectors
!f2py intent(in) cellTangentPlane, is_periodic, x_period, y_period
!f2py intent(out) coeffs_reconstruct
! local variables
integer :: i, iCell, iEdge, pointCount, maxEdgeCount
real (kind=RKIND) :: mpas_fix_periodicity
real (kind=RKIND) :: r, cellCenter(3), alpha, tangentPlane(2,3)
real (kind=RKIND), allocatable, dimension(:,:) :: edgeOnCellLocations, &
edgeOnCellNormals, coeffs, edgeOnCellLocationsWork, &
edgeOnCellNormalsWork, coeffsWork
logical :: includeHalosLocal=.False.
!if ( present(includeHalos) ) then
! includeHalosLocal = includeHalos
!else
! includeHalosLocal = .false.
!end if
!if ( includeHalosLocal ) then
! call mpas_pool_get_dimension(meshPool, 'nCells', nCells)
!else
! call mpas_pool_get_dimension(meshPool, 'nCellsSolve', nCells)
!end if
! init arrays
coeffs_reconstruct = 0.0
maxEdgeCount = maxval(nEdgesOnCell)
allocate(edgeOnCellLocations(maxEdgeCount,3))
allocate(edgeOnCellNormals(maxEdgeCount,3))
allocate(coeffs(maxEdgeCount,3))
! loop over all cells to be solved on this block
do iCell=1,nCells
pointCount = nEdgesOnCell(iCell)
cellCenter(1) = xCell(iCell)
cellCenter(2) = yCell(iCell)
cellCenter(3) = zCell(iCell)
do i=1,pointCount
iEdge = edgesOnCell(i,iCell)
if (is_periodic) then
edgeOnCellLocations(i,1) = mpas_fix_periodicity(xEdge(iEdge), cellCenter(1), x_period)
edgeOnCellLocations(i,2) = mpas_fix_periodicity(yEdge(iEdge), cellCenter(2), y_period)
edgeOnCellLocations(i,3) = zEdge(iEdge)
else
edgeOnCellLocations(i,1) = xEdge(iEdge)
edgeOnCellLocations(i,2) = yEdge(iEdge)
edgeOnCellLocations(i,3) = zEdge(iEdge)
end if
edgeOnCellNormals(i,:) = edgeNormalVectors(:, iEdge)
end do
alpha = 0.0
do i=1,pointCount
r = sqrt(sum((cellCenter - edgeOnCellLocations(i,:))**2))
alpha = alpha + r
enddo
alpha = alpha/pointCount
tangentPlane(1,:) = cellTangentPlane(:,1,iCell)
tangentPlane(2,:) = cellTangentPlane(:,2,iCell)
allocate(edgeOnCellLocationsWork(pointCount,3))
allocate(edgeOnCellNormalsWork(pointCount,3))
allocate(coeffsWork(pointCount,3))
edgeOnCellLocationsWork = edgeOnCellLocations(1:pointCount,:)
edgeOnCellNormalsWork = edgeOnCellNormals(1:pointCount,:)
call mpas_rbf_interp_func_3D_plane_vec_const_dir_comp_coeffs(pointCount, &
edgeOnCellLocationsWork, edgeOnCellNormalsWork, &
cellCenter, alpha, tangentPlane, coeffsWork)
coeffs(1:pointCount,:) = coeffsWork
deallocate(edgeOnCellLocationsWork)
deallocate(edgeOnCellNormalsWork)
deallocate(coeffsWork)
do i=1,pointCount
coeffs_reconstruct(:,i,iCell) = coeffs(i,:)
end do
enddo ! iCell
deallocate(edgeOnCellLocations)
deallocate(edgeOnCellNormals)
deallocate(coeffs)
end subroutine mpas_init_reconstruct!}}}
!subroutine mpas_reconstruct_2d(meshPool, u, uReconstructX, uReconstructY, uReconstructZ, uReconstructZonal, uReconstructMeridional, includeHalos)!{{{
subroutine mpas_reconstruct_2d(nCells, nEdges, maxEdges, nVertLevels, R3, &
on_a_sphere, &
edgesOnCell, nEdgesOnCell, latCell, lonCell, coeffs_reconstruct, u, &
uReconstructX, uReconstructY, uReconstructZ, uReconstructZonal, &
uReconstructMeridional)
implicit none
integer, parameter :: RKIND = selected_real_kind(12)
integer :: nCells, nEdges, nVertLevels, maxEdges, R3
real (kind=RKIND), dimension(nVertLevels,nEdges) :: u
real (kind=RKIND), dimension(nVertLevels,nCells) :: uReconstructX
real (kind=RKIND), dimension(nVertLevels,nCells) :: uReconstructY
real (kind=RKIND), dimension(nVertLevels,nCells) :: uReconstructZ
real (kind=RKIND), dimension(nVertLevels,nCells) :: uReconstructZonal
real (kind=RKIND), dimension(nVertLevels,nCells) :: uReconstructMeridional
!logical, optional, intent(in) :: includeHalos
integer, dimension(maxEdges,nCells) :: edgesOnCell
integer, dimension(nCells) :: nEdgesOnCell
real(kind=RKIND), dimension(nCells) :: latCell, lonCell
real (kind=RKIND), dimension(R3,maxEdges,nCells) :: coeffs_reconstruct
logical :: on_a_sphere
!f2py intent(in) nCells, nEdges, nVertLevels, maxEdges, R3, on_a_sphere
!f2py intent(in) edgesOnCell, nEdgesOnCell, latCell, lonCell,
!f2py intent(in) coeffs_reconstruct, u
!f2py intent(out) uReconstructX, uReconstructY, uReconstructZ, uReconstructZonal
!f2py intent(out) uReconstructMeridional
! local variable
logical :: includeHalosLocal
integer :: iCell,iEdge, i
real (kind=RKIND) :: clat, slat, clon, slon
!if ( present(includeHalos) ) then
! includeHalosLocal = includeHalos
!else
! includeHalosLocal = .false.
!end if
! loop over cell centers
!$omp do schedule(runtime)
do iCell = 1, nCells
! initialize the reconstructed vectors
uReconstructX(:,iCell) = 0.0
uReconstructY(:,iCell) = 0.0
uReconstructZ(:,iCell) = 0.0
! a more efficient reconstruction where rbf_values*matrix_reconstruct
! has been precomputed in coeffs_reconstruct
do i=1,nEdgesOnCell(iCell)
iEdge = edgesOnCell(i,iCell)
uReconstructX(:,iCell) = uReconstructX(:,iCell) &
+ coeffs_reconstruct(1,i,iCell) * u(:,iEdge)
uReconstructY(:,iCell) = uReconstructY(:,iCell) &
+ coeffs_reconstruct(2,i,iCell) * u(:,iEdge)
uReconstructZ(:,iCell) = uReconstructZ(:,iCell) &
+ coeffs_reconstruct(3,i,iCell) * u(:,iEdge)
enddo
enddo ! iCell
!$omp end do
if (on_a_sphere) then
!$omp do schedule(runtime)
do iCell = 1, nCells
clat = cos(latCell(iCell))
slat = sin(latCell(iCell))
clon = cos(lonCell(iCell))
slon = sin(lonCell(iCell))
uReconstructZonal(:,iCell) = -uReconstructX(:,iCell)*slon + &
uReconstructY(:,iCell)*clon
uReconstructMeridional(:,iCell) = -(uReconstructX(:,iCell)*clon &
+ uReconstructY(:,iCell)*slon)*slat &
+ uReconstructZ(:,iCell)*clat
end do
!$omp end do
else
!$omp do schedule(runtime)
do iCell = 1, nCells
uReconstructZonal (:,iCell) = uReconstructX(:,iCell)
uReconstructMeridional(:,iCell) = uReconstructY(:,iCell)
end do
!$omp end do
end if
end subroutine mpas_reconstruct_2d!}}}
subroutine mpas_rbf_interp_func_3D_plane_vec_const_dir_comp_coeffs(pointCount, &!{{{
sourcePoints, unitVectors, destinationPoint, &
alpha, planeBasisVectors, coefficients)
integer, parameter :: RKIND = selected_real_kind(12)
integer, intent(in) :: pointCount !< Input: Number of points
real(kind=RKIND), dimension(pointCount,3), intent(in) :: sourcePoints !< Input: List of points
real(kind=RKIND), dimension(pointCount,3), intent(in) :: unitVectors !< Input: List of unit vectors
real(kind=RKIND), dimension(3), intent(in) :: destinationPoint !< Input: Destination point
real(kind=RKIND), intent(in) :: alpha !< Input: Characteristic length scale of RBFs
real(kind=RKIND), dimension(2,3) :: planeBasisVectors !< Input: Basis vectors for interpolation plane
real(kind=RKIND), dimension(pointCount, 3), intent(out) :: coefficients !< Output: List of coefficients
integer :: i
integer :: matrixSize
real(kind=RKIND), dimension(pointCount,2) :: planarSourcePoints
real(kind=RKIND), dimension(pointCount,2) :: planarUnitVectors
real(kind=RKIND), dimension(2) :: planarDestinationPoint
real(kind=RKIND), dimension(pointCount+2, pointCount+2) :: matrix, matrixCopy
real(kind=RKIND), dimension(pointCount, pointCount) :: matrixWork
real(kind=RKIND), dimension(pointCount+2, 2) :: rhs, coeffs
real(kind=RKIND), dimension(pointCount,2) :: rhsWork
integer, dimension(pointCount+2) :: pivotIndices
matrixSize = pointCount+2 ! space for constant vector in plane
matrix = 0.0
rhs = 0.0
coeffs = 0.0
do i = 1, pointCount
planarSourcePoints(i,1) = sum(sourcePoints(i,:)*planeBasisVectors(1,:))
planarSourcePoints(i,2) = sum(sourcePoints(i,:)*planeBasisVectors(2,:))
planarUnitVectors(i,1) = sum(unitVectors(i,:)*planeBasisVectors(1,:))
planarUnitVectors(i,2) = sum(unitVectors(i,:)*planeBasisVectors(2,:))
end do
planarDestinationPoint(1) = sum(destinationPoint*planeBasisVectors(1,:))
planarDestinationPoint(2) = sum(destinationPoint*planeBasisVectors(2,:))
call mpas_set_up_vector_dirichlet_rbf_matrix_and_rhs(pointCount, 2, &
planarSourcePoints, planarUnitVectors, planarDestinationPoint, &
alpha, matrixWork, rhsWork)
matrix(1:pointCount,1:pointCount) = matrixWork
rhs(1:pointCount,:) = rhsWork
do i = 1, pointCount
matrix(i,pointCount+1:pointCount+2) = planarUnitVectors(i,:)
matrix(pointCount+1:pointCount+2,i) = matrix(i,pointCount+1:pointCount+2)
end do
do i = 1,2
rhs(pointCount+i,i) = 1.0 ! the unit vector in the ith direction
end do
! solve each linear system
matrixCopy = matrix
call mpas_legs(matrix, matrixSize, rhs(:,1), coeffs(:,1), pivotIndices)
call mpas_legs(matrixCopy, matrixSize, rhs(:,2), coeffs(:,2), pivotIndices)
do i = 1,3
coefficients(:,i) = planeBasisVectors(1,i)*coeffs(1:pointCount,1) &
+ planeBasisVectors(2,i)*coeffs(1:pointCount,2)
end do
end subroutine mpas_rbf_interp_func_3D_plane_vec_const_dir_comp_coeffs !}}}
subroutine mpas_set_up_vector_dirichlet_rbf_matrix_and_rhs(pointCount, dimensions, &!{{{
sourcePoints, unitVectors, destinationPoint, &
alpha, matrix, rhs)
integer, parameter :: RKIND = selected_real_kind(12)
integer, intent(in) :: pointCount !< Input: Number of points
integer, intent(in) :: dimensions !< Input: Number of dimensions
real(kind=RKIND), dimension(pointCount,dimensions), intent(in) :: sourcePoints !< Input: List of points
real(kind=RKIND), dimension(pointCount,dimensions), intent(in) :: unitVectors !< Input: List of unit vectors
real(kind=RKIND), dimension(dimensions), intent(in) :: destinationPoint !< Input: Destination point
real(kind=RKIND), intent(in) :: alpha !< Input: Characteristic length scale of RBFs
real(kind=RKIND), dimension(pointCount,pointCount), intent(out) :: matrix !< Output: Matrix
real(kind=RKIND), dimension(pointCount,dimensions), intent(out) :: rhs !< Output: Right hand side
integer :: i, j
real(kind=RKIND) :: evaluate_rbf
real(kind=RKIND) :: rSquared, rbfValue, unitVectorDotProduct
do j = 1, pointCount
do i = j, pointCount
rSquared = sum((sourcePoints(i,:)-sourcePoints(j,:))**2)/alpha**2
rbfValue = evaluate_rbf(rSquared)
unitVectorDotProduct = sum(unitVectors(i,:)*unitVectors(j,:))
matrix(i,j) = rbfValue*unitVectorDotProduct
matrix(j,i) = matrix(i,j)
end do
end do
do j = 1, pointCount
rSquared = sum((destinationPoint-sourcePoints(j,:))**2)/alpha**2
rhs(j,:) = evaluate_rbf(rSquared)*unitVectors(j,:)
end do
end subroutine mpas_set_up_vector_dirichlet_rbf_matrix_and_rhs!}}}
function evaluate_rbf(rSquared) result(rbfValue)!{{{
integer, parameter :: RKIND = selected_real_kind(12)
real(kind=RKIND), intent(in) :: rSquared !< Input: Squared value of r
real(kind=RKIND) :: rbfValue
! inverse multiquadratic
rbfValue = 1/sqrt(1 + rSquared)
end function evaluate_rbf!}}}
subroutine mpas_legs (A,N,B,X,INDX)!{{{
IMPLICIT NONE
integer, parameter :: RKIND = selected_real_kind(12)
integer, INTENT (IN) :: N !< Input: Size of matrix and vectors
integer, INTENT (OUT), DIMENSION (N) :: INDX !< Output: Pivot vector
real(kind=RKIND), INTENT (INOUT), DIMENSION (N,N) :: A !< Input/Output: Matrix
real(kind=RKIND), INTENT (INOUT), DIMENSION (N) :: B !< Input/Output: Right hand side vector
real(kind=RKIND), INTENT (OUT), DIMENSION (N) :: X !< Output: Solution
integer :: I,J
!
CALL elgs (A,N,INDX)
!
DO I = 1, N-1
DO J = I+1, N
B(INDX(J)) = B(INDX(J))-A(INDX(J),I)*B(INDX(I))
END DO
END DO
!
X(N) = B(INDX(N))/A(INDX(N),N)
DO I = N-1, 1, -1
X(I) = B(INDX(I))
DO J = I+1, N
X(I) = X(I)-A(INDX(I),J)*X(J)
END DO
X(I) = X(I)/A(INDX(I),I)
END DO
!
END subroutine mpas_legs!}}}
subroutine elgs (A,N,INDX)!{{{
!
! subroutine to perform the partial-pivoting Gaussian elimination.
! A(N,N) is the original matrix in the input and transformed matrix
! plus the pivoting element ratios below the diagonal in the output.
! INDX(N) records the pivoting order. Copyright (c) Tao Pang 2001.
!
IMPLICIT NONE
integer, parameter :: RKIND = selected_real_kind(12)
integer, INTENT (IN) :: N !< Input: Size of matrix
integer, INTENT (OUT), DIMENSION (N) :: INDX !< Output: Pivot vector
real(kind=RKIND), INTENT (INOUT), DIMENSION (N,N) :: A !< Input/Output: Matrix and solution
integer :: I,J,K,ITMP
real(kind=RKIND) :: C1,PI,PI1,PJ
real(kind=RKIND), DIMENSION (N) :: C
!
! Initialize the index
!
DO I = 1, N
INDX(I) = I
END DO
!
! Find the rescaling factors, one from each row
!
DO I = 1, N
C1= 0.0
DO J = 1, N
!C1 = AMAX1(C1,ABS(A(I,J)))
C1 = MAX(C1,ABS(A(I,J)))
END DO
C(I) = C1
END DO
!
! Search the pivoting (largest) element from each column
!
DO J = 1, N-1
PI1 = 0.0
DO I = J, N
PI = ABS(A(INDX(I),J))/C(INDX(I))
IF (PI>PI1) THEN
PI1 = PI
K = I
ENDIF
END DO
!
! Interchange the rows via INDX(N) to record pivoting order
!
ITMP = INDX(J)
INDX(J) = INDX(K)
INDX(K) = ITMP
DO I = J+1, N
PJ = A(INDX(I),J)/A(INDX(J),J)
!
! Record pivoting ratios below the diagonal
A(INDX(I),J) = PJ
!
! Modify other elements accordingly
!
DO K = J+1, N
A(INDX(I),K) = A(INDX(I),K)-PJ*A(INDX(J),K)
END DO
END DO
END DO
!
END subroutine elgs!}}}
| {"hexsha": "061aab53461bb69815ea2bb2b62e5847696fc56d", "size": 21694, "ext": "f90", "lang": "FORTRAN", "max_stars_repo_path": "src/mpas_sw_operators.f90", "max_stars_repo_name": "xtian15/MPAS-SW-TL-AD", "max_stars_repo_head_hexsha": "d6ac1597ac4a6c1ee3339e8384dd6bef42eccbfc", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/mpas_sw_operators.f90", "max_issues_repo_name": "xtian15/MPAS-SW-TL-AD", "max_issues_repo_head_hexsha": "d6ac1597ac4a6c1ee3339e8384dd6bef42eccbfc", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/mpas_sw_operators.f90", "max_forks_repo_name": "xtian15/MPAS-SW-TL-AD", "max_forks_repo_head_hexsha": "d6ac1597ac4a6c1ee3339e8384dd6bef42eccbfc", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.0204778157, "max_line_length": 150, "alphanum_fraction": 0.682216281, "num_tokens": 6789} |
# OPTIMO_FEAS
#
# PART OF OPTIMO
"""
FeasOptiModel( prob, [x0, with_indicator, xp, dp, wp, name] )
represents the following structured, proximal, feasibility problem:
```
minimize Φ(x) + with_indicator ind_g( x )
```
with respect to `x`, starting from `x0`, where
```
Φ(x) := m( c(x) - proj_S( c(x) ) ) + wprox/2 * || dprox .* (x - xprox) ||^2
```
and `m()` is a loss function, e.g., L1-norm, L2-norm, and Huber loss.
Optional arguments:
* `x0::Vector` (default: `xprox`) initial guess
* `with_indicator::Bool` (default: `false`) include proximable term as indicator?
* `xprox::Vector` (default: `prob.meta.x0`) proximal point
* `dprox::Vector` (default: `ones(R,nvar)`) vector for nonnegative, diagonal scaling
* `wprox::Real` (default: `0`) nonnegative scalar value for proximal regularization
* `name::String` (default: `prob.meta.name * "-feas"`) model name
"""
using LinearAlgebra: norm
export FeasOptiModel
export infeasibility, infeasibilitygrad!
export cviolation, proxdistance, unsproxdistance
mutable struct FeasOptiModel <: AbstractOptiModel
meta::OptiModelMeta
base::AbstractOptiModel
xprox::AbstractVector
dprox::AbstractVector
wprox::Real
with_prox::Bool
with_indicator::Bool
loss::Symbol
huber_rho::Real
huber_mu::Real
# additional allocation
_cx::AbstractVector
_px::AbstractVector
function FeasOptiModel( meta::OptiModelMeta,
base::TP,
xprox::Tx,
dprox::Tx,
wprox::Real,
with_prox::Bool,
with_indicator::Bool,
loss::Symbol,
huber_rho::Real,
huber_mu::Real,
) where {TP <: AbstractOptiModel, Tx <: AbstractVector}
R = eltype(base.meta.x0)
ncon = base.meta.ncon
new( meta, base, xprox, dprox, wprox, with_prox, with_indicator, loss,
huber_rho, huber_mu, zeros(R,ncon), zeros(R,ncon) )
end
end
function FeasOptiModel( prob::TP;
xprox::Tx=prob.meta.x0,
dprox::Tx=ones(eltype(prob.meta.x0),prob.meta.nvar),
wprox::Real=zero(eltype(prob.meta.x0)),
x0::Tx=xprox,
with_indicator::Bool=false,
loss::Symbol=:l2sq,
huber_rho::Real=1.0,
huber_mu::Real=1.0,
name::String=prob.meta.name * "-feas",
) where {TP <: AbstractOptiModel, Tx <: AbstractVector}
@assert length(x0) == prob.meta.nvar
@assert length(xprox) == prob.meta.nvar
@assert length(dprox) == prob.meta.nvar
@assert 0 <= wprox
@assert all( 0 .<= dprox )
@assert loss ∈ [:l1, :l2, :l2sq, :huber]
@assert 0 < huber_rho
@assert 0 < huber_mu
meta = OptiModelMeta( prob.meta.nvar, 0, x0=x0, minimize=true, name=name )
with_prox = wprox > 0 && all( dprox .> 0 )
fprob = FeasOptiModel( meta, prob, xprox, dprox, wprox, with_prox,
with_indicator, loss, huber_rho, huber_mu )
finalizer( p -> finalize(p.base), fprob )
return fprob
end
##########################################################
# Methods
##########################################################
# obj, grad!, prox!, objprox!
"""
obj( fprob, x )
evaluates Φ at x.
"""
function obj(prob::FeasOptiModel, x::AbstractVector)
Φ = infeasibility( prob, x )
if prob.with_prox
Φ += prob.wprox * proxdistance( prob, x )
end
return Φ
end
"""
grad!( fprob, x, dfx )
computes ∇Φ at x, in place.
"""
function grad!(prob::FeasOptiModel, x::AbstractVector, dfx::AbstractVector)
@lencheck prob.meta.nvar dfx
infeasibilitygrad!( prob, x, dfx )
if prob.with_prox
dfx .+= prob.wprox .* prob.dprox .* (x .- prob.xprox)
end
return nothing
end
"""
prox!( fprob, x, a, z )
computes z := prox_{a g}(x), in place.
"""
function prox!(prob::FeasOptiModel, x::AbstractVector, a::Real, z::AbstractVector)
@lencheck prob.meta.nvar x z
if prob.with_indicator
prox!(prob.base, x, a, z )
else
copyto!(z, x)
end
return nothing
end
"""
objprox!( fprob, x, a, z )
computes z := prox_{a g}(x) and g(z), in place, assuming g is an indicator.
"""
function objprox!(prob::FeasOptiModel, x::AbstractVector, a::Real, z::AbstractVector)
@lencheck prob.meta.nvar x z
if prob.with_indicator
prox!(prob.base, x, a, z )
else
copyto!(z, x)
end
return 0.0
end
##########################################################
"""
infeasibility( fprob, x )
computes the infeasibility measure Φ at x, without proximal regularization (wprox = 0).
"""
function infeasibility( prob::FeasOptiModel, x::AbstractVector )
evalinfeasvec( prob, x )
if prob.loss == :l1
return norm( prob._px, 1 )
elseif prob.loss == :l2
return norm( prob._px, 2 )
elseif prob.loss == :l2sq
return 0.5 * norm( prob._px, 2 )^2
elseif prob.loss == :huber
return huberloss( prob._px, prob.huber_rho, prob.huber_mu )
end
end
"""
infeasibility_grad!( fprob, x, dfx )
computes the gradient ∇Φ of the infeasibility measure Φ at x, without proximal
regularization (wprox = 0).
"""
function infeasibilitygrad!(prob::FeasOptiModel, x::AbstractVector, dfx::AbstractVector)
evalinfeasvec( prob, x )
if prob.loss == :l1
prob._px .= sign.( prob._px )
jtprod!( prob.base, x, prob._px, dfx )
elseif prob.loss == :l2
normx = norm( prob._px, 2 )
if normx == 0
dfx .= 0
else
prob._px ./= normx
jtprod!( prob.base, x, prob._px, dfx )
end
elseif prob.loss == :l2sq
jtprod!( prob.base, x, prob._px, dfx )
elseif prob.loss == :huber
huberlossgrad!( prob._px, prob.huber_rho, prob.huber_mu, prob._px )
jtprod!( prob.base, x, prob._px, dfx )
end
return nothing
end
"""
cviolation( fprob, x )
computes the constraint violation.
"""
function cviolation( prob::FeasOptiModel, x::AbstractVector )
evalinfeasvec( prob, x )
return norm( prob._px, Inf )
end
"""
proxdistance( fprob, x )
computes the (scaled) distance to the proximal point.
"""
proxdistance, unsproxdistance
function proxdistance( prob::FeasOptiModel, x::AbstractVector )
@lencheck prob.meta.nvar x
return 0.5 * sum( prob.dprox .* (x .- prob.xprox).^2 )
end
"""
unsproxdistance( fprob, x )
computes the unscaled distance to the proximal point.
"""
function unsproxdistance( prob::FeasOptiModel, x::AbstractVector )
@lencheck prob.meta.nvar x
return 0.5 * norm( x .- prob.xprox, 2)^2
end
##########################################################
# INTERNAL FUNCTIONS
##########################################################
function evalinfeasvec( prob::FeasOptiModel, x::AbstractVector )
@lencheck prob.meta.nvar x
cons!( prob.base, x, prob._cx )
proj!( prob.base, prob._cx, prob._px )
prob._px .= prob._cx .- prob._px
return nothing
end
"""
Huber loss, with parameter ρ > 0
f(x) = { 1/2 ||x||^2 if ||x|| ⩽ ρ
{ ρ ( ||x|| - ρ/2 ) otherwise
"""
function huberloss( x::AbstractVector, rho::Real, mu::Real )
normx = norm( x, 2 )
if normx <= rho
return 0.5 * mu * normx^2
else
return rho * mu * ( normx - 0.5 * rho )
end
end
function huberlossgrad!( x::AbstractVector, rho::Real, mu::Real, dfx::AbstractVector )
normx = norm( x, 2 )
if normx <= rho
dfx .= mu .* x
else
dfx .= ( rho * mu / normx ) .* x
end
return nothing
end
| {"hexsha": "ee0a8593bc69ad24f9ff041cdb18783799704189", "size": 7848, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "src/optimo_feas.jl", "max_stars_repo_name": "aldma/OptiMo.jl", "max_stars_repo_head_hexsha": "9512545b1e4f867c88438dcc24f1b63f37f3d889", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/optimo_feas.jl", "max_issues_repo_name": "aldma/OptiMo.jl", "max_issues_repo_head_hexsha": "9512545b1e4f867c88438dcc24f1b63f37f3d889", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/optimo_feas.jl", "max_forks_repo_name": "aldma/OptiMo.jl", "max_forks_repo_head_hexsha": "9512545b1e4f867c88438dcc24f1b63f37f3d889", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.5369649805, "max_line_length": 88, "alphanum_fraction": 0.5676605505, "num_tokens": 2304} |
import numpy as np
import pandas as pd
from parallelm.components import ConnectableComponent
class RandomDataframe(ConnectableComponent):
"""
Generating a random dataframe. The number of rows and columns is provided as input parameters to the component
"""
def __init__(self, engine):
super(self.__class__, self).__init__(engine)
def _materialize(self, parent_data_objs, user_data):
num_rows = self._params.get('num_lines', 100)
num_cols = self._params.get('num_cols', 5)
df = pd.DataFrame(np.random.randint(0, 100, size=(num_rows, num_cols)))
self._logger.info("Generated random dataframe rows: {} cols: {})".format(num_rows, num_cols))
return [df]
| {"hexsha": "76d8fe96125e2baaf71de5153f081c790faa44d2", "size": 723, "ext": "py", "lang": "Python", "max_stars_repo_path": "reflex-algos/components/Python/random-dataframe/random_dataframe.py", "max_stars_repo_name": "lisapm/mlpiper", "max_stars_repo_head_hexsha": "74ad5ae343d364682cc2f8aaa007f2e8a1d84929", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 7, "max_stars_repo_stars_event_min_datetime": "2019-04-08T02:31:55.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-15T14:40:49.000Z", "max_issues_repo_path": "reflex-algos/components/Python/random-dataframe/random_dataframe.py", "max_issues_repo_name": "lisapm/mlpiper", "max_issues_repo_head_hexsha": "74ad5ae343d364682cc2f8aaa007f2e8a1d84929", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 31, "max_issues_repo_issues_event_min_datetime": "2019-02-22T22:23:26.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-02T17:17:06.000Z", "max_forks_repo_path": "reflex-algos/components/Python/random-dataframe/random_dataframe.py", "max_forks_repo_name": "lisapm/mlpiper", "max_forks_repo_head_hexsha": "74ad5ae343d364682cc2f8aaa007f2e8a1d84929", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2019-03-15T23:46:08.000Z", "max_forks_repo_forks_event_max_datetime": "2020-02-06T09:16:02.000Z", "avg_line_length": 34.4285714286, "max_line_length": 114, "alphanum_fraction": 0.7012448133, "include": true, "reason": "import numpy", "num_tokens": 168} |
%for subplots
function p=plots1(x,y,z,img)
H1=abs(img);
colormap(hot)
subplot(x,y,z);
image(5*100*H1/max(max(H1)));%4 for B-727r;
if z==2
title('ISAR images using Harmonic Wavelets');
end
if z==4
ylabel('Range')
end
if z==8
xlabel('Doppler')
end | {"author": "Sable", "repo": "mcbench-benchmarks", "sha": "ba13b2f0296ef49491b95e3f984c7c41fccdb6d8", "save_path": "github-repos/MATLAB/Sable-mcbench-benchmarks", "path": "github-repos/MATLAB/Sable-mcbench-benchmarks/mcbench-benchmarks-ba13b2f0296ef49491b95e3f984c7c41fccdb6d8/43601-harmonic-wavelet-based-isar-imaging/Codes/B-727/plothw.m"} |
from math import pi, log10, ceil
from typing import Optional, Dict, Union, Tuple
import numpy as np
import plotkit.plotkit as pk
from sympy import Expr, sympify, Symbol
Value = Union[float, int, complex]
class FrequencyDomainPlotter:
S = Symbol("s")
def __init__(self, expr: Expr) -> None:
self.expr: Expr = expr
self.fmin: float = 1
self.fmax: float = 100e3
self.points_per_decade: int = 50
def set_range(self, fmin: float, fmax: float):
self.fmin = fmin
self.fmax = fmax
def _evaluate(self, values: Dict[str, Value]) -> Tuple[np.ndarray, np.ndarray]:
rvals = {Symbol(n): sympify(v) for n, v in values.items()}
rexpr: Expr = self.expr.xreplace(rvals)
vtest = rexpr.evalf(subs={self.S: 1})
if vtest.free_symbols:
raise ValueError("Some symbols not given values: " + str(vtest.free_symbols))
feval = np.vectorize(lambda w: complex(rexpr.evalf(subs={self.S: w})), otypes=[np.cfloat])
points = ceil(log10(self.fmax / self.fmin) * self.points_per_decade)
X = np.geomspace(self.fmin, self.fmax, points)
Xiw = X * 2 * pi * 1j
Y = feval(Xiw)
return X, Y
def bode(self, values: Optional[Dict[str, Value]] = None, *,
ax: Optional[Tuple[pk.Axes, pk.Axes]] = None, return_fig=False,
amplitude_linear=False, frequency_linear=False,
) -> Optional[pk.Figure]:
if values is None:
values = {}
X, Y = self._evaluate(values)
if amplitude_linear:
ampl = np.abs(Y)
else:
ampl = 20 * np.log10(np.abs(Y))
phase = np.angle(Y, deg=True)
if ax is None:
fig, (ax1, ax2) = pk.new_regular(2, 1)
else:
ax1, ax2 = ax
fig = None
if frequency_linear:
ax1.plot(X, ampl)
else:
ax1.semilogx(X, ampl)
if amplitude_linear:
ax1.set_ylabel("Amplitude")
else:
ax1.set_ylabel("Amplitude / dB")
pk.set_grid(ax1)
ax1.set_xlim(self.fmin, self.fmax)
if frequency_linear:
ax2.plot(X, phase)
else:
ax2.semilogx(X, phase)
ax2.set_ylabel("Phase / °")
ax2.set_xlabel("Frequency / Hz")
pk.set_grid(ax2)
ax2.set_xlim(self.fmin, self.fmax)
if return_fig:
return fig
pk.finalize(fig)
def nyquist(self, values: Optional[Dict[str, Value]] = None, *,
ax: Optional[Tuple[pk.Axes, pk.Axes]] = None, return_fig=False) -> Optional[pk.Figure]:
if values is None:
values = {}
X, Y = self._evaluate(values)
if ax is None:
fig, ax = pk.new_regular(1, 1)
else:
fig = None
ax.set_aspect("equal")
ax.plot(np.real(Y), np.imag(Y))
ax.set_ylabel("Imag")
ax.set_xlabel("Real")
pk.set_grid(ax)
if return_fig:
return fig
pk.finalize(fig)
| {"hexsha": "e34094896421ee0ed3daff8fd96d02191bd8270c", "size": 3060, "ext": "py", "lang": "Python", "max_stars_repo_path": "symcircuit/plotting.py", "max_stars_repo_name": "martok/py-symcircuit", "max_stars_repo_head_hexsha": "c48b1ad8ae4e496306da0c0a7474b4cd968a629f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "symcircuit/plotting.py", "max_issues_repo_name": "martok/py-symcircuit", "max_issues_repo_head_hexsha": "c48b1ad8ae4e496306da0c0a7474b4cd968a629f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "symcircuit/plotting.py", "max_forks_repo_name": "martok/py-symcircuit", "max_forks_repo_head_hexsha": "c48b1ad8ae4e496306da0c0a7474b4cd968a629f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.297029703, "max_line_length": 103, "alphanum_fraction": 0.5545751634, "include": true, "reason": "import numpy,from sympy", "num_tokens": 815} |